From 64341cb918796a1352bfa9be26523cdafdb36ca3 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Thu, 7 Dec 2023 23:23:43 +0800 Subject: [PATCH] [saco] Add d3d9 headers --- saco/d3d9/include/PIXPlugin.h | 120 + saco/d3d9/include/d3d.h | 1688 ++++++++ saco/d3d9/include/d3d8.h | 1279 ++++++ saco/d3d9/include/d3d8caps.h | 364 ++ saco/d3d9/include/d3d8types.h | 1684 ++++++++ saco/d3d9/include/d3d9.h | 1870 +++++++++ saco/d3d9/include/d3d9caps.h | 476 +++ saco/d3d9/include/d3d9types.h | 1855 +++++++++ saco/d3d9/include/d3dcaps.h | 601 +++ saco/d3d9/include/d3dfont.h | 79 + saco/d3d9/include/d3drm.h | 342 ++ saco/d3d9/include/d3drmdef.h | 695 ++++ saco/d3d9/include/d3drmobj.h | 1666 ++++++++ saco/d3d9/include/d3drmwin.h | 50 + saco/d3d9/include/d3dtypes.h | 2119 ++++++++++ saco/d3d9/include/d3dutil.h | 95 + saco/d3d9/include/d3dvec.inl | 255 ++ saco/d3d9/include/d3dx9.h | 76 + saco/d3d9/include/d3dx9.lib | Bin 0 -> 86070 bytes saco/d3d9/include/d3dx9anim.h | 1114 ++++++ saco/d3d9/include/d3dx9core.h | 748 ++++ saco/d3d9/include/d3dx9effect.h | 867 ++++ saco/d3d9/include/d3dx9math.h | 1765 +++++++++ saco/d3d9/include/d3dx9math.inl | 2244 +++++++++++ saco/d3d9/include/d3dx9mesh.h | 2791 +++++++++++++ saco/d3d9/include/d3dx9shader.h | 1072 +++++ saco/d3d9/include/d3dx9shape.h | 221 ++ saco/d3d9/include/d3dx9tex.h | 1723 ++++++++ saco/d3d9/include/d3dx9xof.h | 299 ++ saco/d3d9/include/ddraw.h | 5792 +++++++++++++++++++++++++++ saco/d3d9/include/dinput.h | 4417 +++++++++++++++++++++ saco/d3d9/include/dinputd.h | 755 ++++ saco/d3d9/include/dls1.h | 267 ++ saco/d3d9/include/dls2.h | 130 + saco/d3d9/include/dmdls.h | 199 + saco/d3d9/include/dmerror.h | 843 ++++ saco/d3d9/include/dmksctrl.h | 166 + saco/d3d9/include/dmplugin.h | 280 ++ saco/d3d9/include/dmusbuff.h | 41 + saco/d3d9/include/dmusicc.h | 784 ++++ saco/d3d9/include/dmusicf.h | 2199 ++++++++++ saco/d3d9/include/dmusici.h | 1883 +++++++++ saco/d3d9/include/dmusics.h | 193 + saco/d3d9/include/dpaddr.h | 392 ++ saco/d3d9/include/dplay.h | 2154 ++++++++++ saco/d3d9/include/dplay8.h | 1456 +++++++ saco/d3d9/include/dplobby.h | 853 ++++ saco/d3d9/include/dplobby8.h | 407 ++ saco/d3d9/include/dpnathlp.h | 318 ++ saco/d3d9/include/dsconf.h | 195 + saco/d3d9/include/dsetup.h | 287 ++ saco/d3d9/include/dsound.h | 2358 +++++++++++ saco/d3d9/include/dvoice.h | 857 ++++ saco/d3d9/include/dvp.h | 966 +++++ saco/d3d9/include/dx7todx8.h | 98 + saco/d3d9/include/dxdiag.h | 187 + saco/d3d9/include/dxerr8.h | 99 + saco/d3d9/include/dxerr9.h | 99 + saco/d3d9/include/dxfile.h | 240 ++ saco/d3d9/include/dxsdkver.h | 18 + saco/d3d9/include/dxtrans.h | 5362 +++++++++++++++++++++++++ saco/d3d9/include/dxutil.h | 181 + saco/d3d9/include/multimon.h | 484 +++ saco/d3d9/include/rmxfguid.h | 223 ++ saco/d3d9/include/rmxftmpl.h | 339 ++ saco/d3d9/include/strsafe.h | 6611 +++++++++++++++++++++++++++++++ 66 files changed, 70291 insertions(+) create mode 100644 saco/d3d9/include/PIXPlugin.h create mode 100644 saco/d3d9/include/d3d.h create mode 100644 saco/d3d9/include/d3d8.h create mode 100644 saco/d3d9/include/d3d8caps.h create mode 100644 saco/d3d9/include/d3d8types.h create mode 100644 saco/d3d9/include/d3d9.h create mode 100644 saco/d3d9/include/d3d9caps.h create mode 100644 saco/d3d9/include/d3d9types.h create mode 100644 saco/d3d9/include/d3dcaps.h create mode 100644 saco/d3d9/include/d3dfont.h create mode 100644 saco/d3d9/include/d3drm.h create mode 100644 saco/d3d9/include/d3drmdef.h create mode 100644 saco/d3d9/include/d3drmobj.h create mode 100644 saco/d3d9/include/d3drmwin.h create mode 100644 saco/d3d9/include/d3dtypes.h create mode 100644 saco/d3d9/include/d3dutil.h create mode 100644 saco/d3d9/include/d3dvec.inl create mode 100644 saco/d3d9/include/d3dx9.h create mode 100644 saco/d3d9/include/d3dx9.lib create mode 100644 saco/d3d9/include/d3dx9anim.h create mode 100644 saco/d3d9/include/d3dx9core.h create mode 100644 saco/d3d9/include/d3dx9effect.h create mode 100644 saco/d3d9/include/d3dx9math.h create mode 100644 saco/d3d9/include/d3dx9math.inl create mode 100644 saco/d3d9/include/d3dx9mesh.h create mode 100644 saco/d3d9/include/d3dx9shader.h create mode 100644 saco/d3d9/include/d3dx9shape.h create mode 100644 saco/d3d9/include/d3dx9tex.h create mode 100644 saco/d3d9/include/d3dx9xof.h create mode 100644 saco/d3d9/include/ddraw.h create mode 100644 saco/d3d9/include/dinput.h create mode 100644 saco/d3d9/include/dinputd.h create mode 100644 saco/d3d9/include/dls1.h create mode 100644 saco/d3d9/include/dls2.h create mode 100644 saco/d3d9/include/dmdls.h create mode 100644 saco/d3d9/include/dmerror.h create mode 100644 saco/d3d9/include/dmksctrl.h create mode 100644 saco/d3d9/include/dmplugin.h create mode 100644 saco/d3d9/include/dmusbuff.h create mode 100644 saco/d3d9/include/dmusicc.h create mode 100644 saco/d3d9/include/dmusicf.h create mode 100644 saco/d3d9/include/dmusici.h create mode 100644 saco/d3d9/include/dmusics.h create mode 100644 saco/d3d9/include/dpaddr.h create mode 100644 saco/d3d9/include/dplay.h create mode 100644 saco/d3d9/include/dplay8.h create mode 100644 saco/d3d9/include/dplobby.h create mode 100644 saco/d3d9/include/dplobby8.h create mode 100644 saco/d3d9/include/dpnathlp.h create mode 100644 saco/d3d9/include/dsconf.h create mode 100644 saco/d3d9/include/dsetup.h create mode 100644 saco/d3d9/include/dsound.h create mode 100644 saco/d3d9/include/dvoice.h create mode 100644 saco/d3d9/include/dvp.h create mode 100644 saco/d3d9/include/dx7todx8.h create mode 100644 saco/d3d9/include/dxdiag.h create mode 100644 saco/d3d9/include/dxerr8.h create mode 100644 saco/d3d9/include/dxerr9.h create mode 100644 saco/d3d9/include/dxfile.h create mode 100644 saco/d3d9/include/dxsdkver.h create mode 100644 saco/d3d9/include/dxtrans.h create mode 100644 saco/d3d9/include/dxutil.h create mode 100644 saco/d3d9/include/multimon.h create mode 100644 saco/d3d9/include/rmxfguid.h create mode 100644 saco/d3d9/include/rmxftmpl.h create mode 100644 saco/d3d9/include/strsafe.h diff --git a/saco/d3d9/include/PIXPlugin.h b/saco/d3d9/include/PIXPlugin.h new file mode 100644 index 0000000..9c249af --- /dev/null +++ b/saco/d3d9/include/PIXPlugin.h @@ -0,0 +1,120 @@ +//================================================================================================== +// PIXPlugin.h +// +// Microsoft PIX Plugin Header +// +// Copyright (c) Microsoft Corporation, All rights reserved +//================================================================================================== + +#pragma once + +#ifdef __cplusplus +extern "C" +{ +#endif + + +//================================================================================================== +// PIX_PLUGIN_SYSTEM_VERSION - Indicates version of the plugin interface the plugin is built with. +//================================================================================================== +#define PIX_PLUGIN_SYSTEM_VERSION 0x101 + + +//================================================================================================== +// PIXCOUNTERID - A unique identifier for each PIX plugin counter. +//================================================================================================== +typedef int PIXCOUNTERID; + + +//================================================================================================== +// PIXCOUNTERDATATYPE - Indicates what type of data the counter produces. +//================================================================================================== +enum PIXCOUNTERDATATYPE +{ + PCDT_RESERVED, + PCDT_FLOAT, + PCDT_INT, + PCDT_INT64, + PCDT_STRING, +}; + + +//================================================================================================== +// PIXPLUGININFO - This structure is filled out by PIXGetPluginInfo and passed back to PIX. +//================================================================================================== +struct PIXPLUGININFO +{ + // Filled in by caller: + HINSTANCE hinst; + + // Filled in by PIXGetPluginInfo: + WCHAR* pstrPluginName; // Name of plugin + int iPluginVersion; // Version of this particular plugin + int iPluginSystemVersion; // Version of PIX's plugin system this plugin was designed for +}; + + +//================================================================================================== +// PIXCOUNTERINFO - This structure is filled out by PIXGetCounterInfo and passed back to PIX +// to allow PIX to determine information about the counters in the plugin. +//================================================================================================== +struct PIXCOUNTERINFO +{ + PIXCOUNTERID counterID; // Used to uniquely ID this counter + WCHAR* pstrName; // String name of the counter + PIXCOUNTERDATATYPE pcdtDataType; // Data type returned by this counter +}; + + +//================================================================================================== +// PIXGetPluginInfo - This returns basic information about this plugin to PIX. +//================================================================================================== +BOOL WINAPI PIXGetPluginInfo( PIXPLUGININFO* pPIXPluginInfo ); + + +//================================================================================================== +// PIXGetCounterInfo - This returns an array of PIXCOUNTERINFO structs to PIX. +// These PIXCOUNTERINFOs allow PIX to enumerate the counters contained +// in this plugin. +//================================================================================================== +BOOL WINAPI PIXGetCounterInfo( DWORD* pdwReturnCounters, PIXCOUNTERINFO** ppCounterInfoList ); + + +//================================================================================================== +// PIXGetCounterDesc - This is called by PIX to request a description of the indicated counter. +//================================================================================================== +BOOL WINAPI PIXGetCounterDesc( PIXCOUNTERID id, WCHAR** ppstrCounterDesc ); + + +//================================================================================================== +// PIXBeginExperiment - This called by PIX once per counter when instrumentation starts. +//================================================================================================== +BOOL WINAPI PIXBeginExperiment( PIXCOUNTERID id, const WCHAR* pstrApplication ); + + +//================================================================================================== +// PIXEndFrame - This is called by PIX once per counter at the end of each frame to gather the +// counter value for that frame. Note that the pointer to the return data must +// continue to point to valid counter data until the next call to PIXEndFrame (or +// PIXEndExperiment) for the same counter. So do not set *ppReturnData to the same +// pointer for multiple counters, or point to a local variable that will go out of +// scope. See the sample PIX plugin for an example of how to structure a plugin +// properly. +//================================================================================================== +BOOL WINAPI PIXEndFrame( PIXCOUNTERID id, UINT iFrame, DWORD* pdwReturnBytes, BYTE** ppReturnData ); + + +//================================================================================================== +// PIXEndExperiment - This is called by PIX once per counter when instrumentation ends. +//================================================================================================== +BOOL WINAPI PIXEndExperiment( PIXCOUNTERID id ); + + +#ifdef __cplusplus +}; +#endif + +//================================================================================================== +// eof: PIXPlugin.h +//================================================================================================== + diff --git a/saco/d3d9/include/d3d.h b/saco/d3d9/include/d3d.h new file mode 100644 index 0000000..eea7dff --- /dev/null +++ b/saco/d3d9/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/saco/d3d9/include/d3d8.h b/saco/d3d9/include/d3d8.h new file mode 100644 index 0000000..adf91eb --- /dev/null +++ b/saco/d3d9/include/d3d8.h @@ -0,0 +1,1279 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D8_H_ +#define _D3D8_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + + +/* This identifier is passed to Direct3DCreate8 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate8 will fail. + * (The number itself has no meaning.)*/ + +#define D3D_SDK_VERSION 220 + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); +#endif + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) + +/* IID_IDirect3D8 */ +/* {1DD9E8DA-1C77-4d40-B0CF-98FEFDFF9512} */ +DEFINE_GUID(IID_IDirect3D8, 0x1dd9e8da, 0x1c77, 0x4d40, 0xb0, 0xcf, 0x98, 0xfe, 0xfd, 0xff, 0x95, 0x12); + +/* IID_IDirect3DDevice8 */ +/* {7385E5DF-8FE8-41D5-86B6-D7B48547B6CF} */ +DEFINE_GUID(IID_IDirect3DDevice8, 0x7385e5df, 0x8fe8, 0x41d5, 0x86, 0xb6, 0xd7, 0xb4, 0x85, 0x47, 0xb6, 0xcf); + +/* IID_IDirect3DResource8 */ +/* {1B36BB7B-09B7-410a-B445-7D1430D7B33F} */ +DEFINE_GUID(IID_IDirect3DResource8, 0x1b36bb7b, 0x9b7, 0x410a, 0xb4, 0x45, 0x7d, 0x14, 0x30, 0xd7, 0xb3, 0x3f); + +/* IID_IDirect3DBaseTexture8 */ +/* {B4211CFA-51B9-4a9f-AB78-DB99B2BB678E} */ +DEFINE_GUID(IID_IDirect3DBaseTexture8, 0xb4211cfa, 0x51b9, 0x4a9f, 0xab, 0x78, 0xdb, 0x99, 0xb2, 0xbb, 0x67, 0x8e); + +/* IID_IDirect3DTexture8 */ +/* {E4CDD575-2866-4f01-B12E-7EECE1EC9358} */ +DEFINE_GUID(IID_IDirect3DTexture8, 0xe4cdd575, 0x2866, 0x4f01, 0xb1, 0x2e, 0x7e, 0xec, 0xe1, 0xec, 0x93, 0x58); + +/* IID_IDirect3DCubeTexture8 */ +/* {3EE5B968-2ACA-4c34-8BB5-7E0C3D19B750} */ +DEFINE_GUID(IID_IDirect3DCubeTexture8, 0x3ee5b968, 0x2aca, 0x4c34, 0x8b, 0xb5, 0x7e, 0x0c, 0x3d, 0x19, 0xb7, 0x50); + +/* IID_IDirect3DVolumeTexture8 */ +/* {4B8AAAFA-140F-42ba-9131-597EAFAA2EAD} */ +DEFINE_GUID(IID_IDirect3DVolumeTexture8, 0x4b8aaafa, 0x140f, 0x42ba, 0x91, 0x31, 0x59, 0x7e, 0xaf, 0xaa, 0x2e, 0xad); + +/* IID_IDirect3DVertexBuffer8 */ +/* {8AEEEAC7-05F9-44d4-B591-000B0DF1CB95} */ +DEFINE_GUID(IID_IDirect3DVertexBuffer8, 0x8aeeeac7, 0x05f9, 0x44d4, 0xb5, 0x91, 0x00, 0x0b, 0x0d, 0xf1, 0xcb, 0x95); + +/* IID_IDirect3DIndexBuffer8 */ +/* {0E689C9A-053D-44a0-9D92-DB0E3D750F86} */ +DEFINE_GUID(IID_IDirect3DIndexBuffer8, 0x0e689c9a, 0x053d, 0x44a0, 0x9d, 0x92, 0xdb, 0x0e, 0x3d, 0x75, 0x0f, 0x86); + +/* IID_IDirect3DSurface8 */ +/* {B96EEBCA-B326-4ea5-882F-2FF5BAE021DD} */ +DEFINE_GUID(IID_IDirect3DSurface8, 0xb96eebca, 0xb326, 0x4ea5, 0x88, 0x2f, 0x2f, 0xf5, 0xba, 0xe0, 0x21, 0xdd); + +/* IID_IDirect3DVolume8 */ +/* {BD7349F5-14F1-42e4-9C79-972380DB40C0} */ +DEFINE_GUID(IID_IDirect3DVolume8, 0xbd7349f5, 0x14f1, 0x42e4, 0x9c, 0x79, 0x97, 0x23, 0x80, 0xdb, 0x40, 0xc0); + +/* IID_IDirect3DSwapChain8 */ +/* {928C088B-76B9-4C6B-A536-A590853876CD} */ +DEFINE_GUID(IID_IDirect3DSwapChain8, 0x928c088b, 0x76b9, 0x4c6b, 0xa5, 0x36, 0xa5, 0x90, 0x85, 0x38, 0x76, 0xcd); + +#endif + +#ifdef __cplusplus + +interface IDirect3D8; +interface IDirect3DDevice8; + +interface IDirect3DResource8; +interface IDirect3DBaseTexture8; +interface IDirect3DTexture8; +interface IDirect3DVolumeTexture8; +interface IDirect3DCubeTexture8; + +interface IDirect3DVertexBuffer8; +interface IDirect3DIndexBuffer8; + +interface IDirect3DSurface8; +interface IDirect3DVolume8; + +interface IDirect3DSwapChain8; + +#endif + + +typedef interface IDirect3D8 IDirect3D8; +typedef interface IDirect3DDevice8 IDirect3DDevice8; +typedef interface IDirect3DResource8 IDirect3DResource8; +typedef interface IDirect3DBaseTexture8 IDirect3DBaseTexture8; +typedef interface IDirect3DTexture8 IDirect3DTexture8; +typedef interface IDirect3DVolumeTexture8 IDirect3DVolumeTexture8; +typedef interface IDirect3DCubeTexture8 IDirect3DCubeTexture8; +typedef interface IDirect3DVertexBuffer8 IDirect3DVertexBuffer8; +typedef interface IDirect3DIndexBuffer8 IDirect3DIndexBuffer8; +typedef interface IDirect3DSurface8 IDirect3DSurface8; +typedef interface IDirect3DVolume8 IDirect3DVolume8; +typedef interface IDirect3DSwapChain8 IDirect3DSwapChain8; + +#include "d3d8types.h" +#include "d3d8caps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DLL Function for creating a Direct3D8 object. This object supports + * enumeration and allows the creation of Direct3DDevice8 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + */ + +IDirect3D8 * WINAPI Direct3DCreate8(UINT SDKVersion); + + +/* + * Direct3D interfaces + */ + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3D8 + +DECLARE_INTERFACE_(IDirect3D8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D8 methods ***/ + STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER8* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE CheckType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL Windowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS8* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice8** ppReturnedDeviceInterface) PURE; +}; + +typedef struct IDirect3D8 *LPDIRECT3D8, *PDIRECT3D8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D8_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D8_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D8_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D8_GetAdapterModeCount(p,a) (p)->lpVtbl->GetAdapterModeCount(p,a) +#define IDirect3D8_EnumAdapterModes(p,a,b,c) (p)->lpVtbl->EnumAdapterModes(p,a,b,c) +#define IDirect3D8_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D8_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D8_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D8_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e) +#define IDirect3D8_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D8_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D8_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D8_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#else +#define IDirect3D8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D8_AddRef(p) (p)->AddRef() +#define IDirect3D8_Release(p) (p)->Release() +#define IDirect3D8_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) +#define IDirect3D8_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D8_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D8_GetAdapterModeCount(p,a) (p)->GetAdapterModeCount(a) +#define IDirect3D8_EnumAdapterModes(p,a,b,c) (p)->EnumAdapterModes(a,b,c) +#define IDirect3D8_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D8_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D8_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D8_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->CheckDeviceMultiSampleType(a,b,c,d,e) +#define IDirect3D8_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D8_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D8_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D8_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#endif + + + + + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice8 + +DECLARE_INTERFACE_(IDirect3DDevice8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice8 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(ResourceManagerDiscardBytes)(THIS_ DWORD Bytes) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D8** ppD3D8) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS8* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface8* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain8** pSwapChain) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture8** ppTexture) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture8** ppVolumeTexture) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture8** ppCubeTexture) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer8** ppVertexBuffer) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer8** ppIndexBuffer) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,BOOL Lockable,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CreateImageSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CopyRects)(THIS_ IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture8* pSourceTexture,IDirect3DBaseTexture8* pDestinationTexture) PURE; + STDMETHOD(GetFrontBuffer)(THIS_ IDirect3DSurface8* pDestSurface) PURE; + STDMETHOD(SetRenderTarget)(THIS_ IDirect3DSurface8* pRenderTarget,IDirect3DSurface8* pNewZStencil) PURE; + STDMETHOD(GetRenderTarget)(THIS_ IDirect3DSurface8** ppRenderTarget) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface8** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL8* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL8* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT8*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT8*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ DWORD* pToken) PURE; + STDMETHOD(ApplyStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(CaptureStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(DeleteStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,DWORD* pToken) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS8* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS8* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture8** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture8* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(GetInfo)(THIS_ DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage) PURE; + STDMETHOD(SetVertexShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(GetVertexShader)(THIS_ DWORD* pHandle) PURE; + STDMETHOD(DeleteVertexShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(SetVertexShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetVertexShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetVertexShaderDeclaration)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(GetVertexShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer8** ppStreamData,UINT* pStride) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,DWORD* pHandle) PURE; + STDMETHOD(SetPixelShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(GetPixelShader)(THIS_ DWORD* pHandle) PURE; + STDMETHOD(DeletePixelShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(SetPixelShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetPixelShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetPixelShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; +}; + +typedef struct IDirect3DDevice8 *LPDIRECT3DDEVICE8, *PDIRECT3DDEVICE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice8_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice8_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice8_ResourceManagerDiscardBytes(p,a) (p)->lpVtbl->ResourceManagerDiscardBytes(p,a) +#define IDirect3DDevice8_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice8_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice8_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DDevice8_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice8_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice8_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice8_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice8_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice8_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice8_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice8_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DDevice8_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DDevice8_SetGammaRamp(p,a,b) (p)->lpVtbl->SetGammaRamp(p,a,b) +#define IDirect3DDevice8_GetGammaRamp(p,a) (p)->lpVtbl->GetGammaRamp(p,a) +#define IDirect3DDevice8_CreateTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice8_CreateVolumeTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_CreateCubeTexture(p,a,b,c,d,e,f) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f) +#define IDirect3DDevice8_CreateVertexBuffer(p,a,b,c,d,e) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateIndexBuffer(p,a,b,c,d,e) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateRenderTarget(p,a,b,c,d,e,f) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f) +#define IDirect3DDevice8_CreateDepthStencilSurface(p,a,b,c,d,e) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateImageSurface(p,a,b,c,d) (p)->lpVtbl->CreateImageSurface(p,a,b,c,d) +#define IDirect3DDevice8_CopyRects(p,a,b,c,d,e) (p)->lpVtbl->CopyRects(p,a,b,c,d,e) +#define IDirect3DDevice8_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice8_GetFrontBuffer(p,a) (p)->lpVtbl->GetFrontBuffer(p,a) +#define IDirect3DDevice8_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice8_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice8_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice8_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice8_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice8_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice8_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice8_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice8_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice8_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice8_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice8_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice8_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice8_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice8_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice8_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice8_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice8_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice8_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice8_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice8_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice8_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice8_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice8_ApplyStateBlock(p,a) (p)->lpVtbl->ApplyStateBlock(p,a) +#define IDirect3DDevice8_CaptureStateBlock(p,a) (p)->lpVtbl->CaptureStateBlock(p,a) +#define IDirect3DDevice8_DeleteStateBlock(p,a) (p)->lpVtbl->DeleteStateBlock(p,a) +#define IDirect3DDevice8_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice8_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice8_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice8_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice8_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice8_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice8_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice8_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice8_GetInfo(p,a,b,c) (p)->lpVtbl->GetInfo(p,a,b,c) +#define IDirect3DDevice8_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice8_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice8_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice8_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice8_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->lpVtbl->CreateVertexShader(p,a,b,c,d) +#define IDirect3DDevice8_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice8_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice8_DeleteVertexShader(p,a) (p)->lpVtbl->DeleteVertexShader(p,a) +#define IDirect3DDevice8_SetVertexShaderConstant(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderConstant(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderDeclaration(p,a,b,c) (p)->lpVtbl->GetVertexShaderDeclaration(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderFunction(p,a,b,c) (p)->lpVtbl->GetVertexShaderFunction(p,a,b,c) +#define IDirect3DDevice8_SetStreamSource(p,a,b,c) (p)->lpVtbl->SetStreamSource(p,a,b,c) +#define IDirect3DDevice8_GetStreamSource(p,a,b,c) (p)->lpVtbl->GetStreamSource(p,a,b,c) +#define IDirect3DDevice8_SetIndices(p,a,b) (p)->lpVtbl->SetIndices(p,a,b) +#define IDirect3DDevice8_GetIndices(p,a,b) (p)->lpVtbl->GetIndices(p,a,b) +#define IDirect3DDevice8_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice8_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice8_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice8_DeletePixelShader(p,a) (p)->lpVtbl->DeletePixelShader(p,a) +#define IDirect3DDevice8_SetPixelShaderConstant(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetPixelShaderConstant(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetPixelShaderFunction(p,a,b,c) (p)->lpVtbl->GetPixelShaderFunction(p,a,b,c) +#define IDirect3DDevice8_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice8_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice8_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#else +#define IDirect3DDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice8_AddRef(p) (p)->AddRef() +#define IDirect3DDevice8_Release(p) (p)->Release() +#define IDirect3DDevice8_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice8_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice8_ResourceManagerDiscardBytes(p,a) (p)->ResourceManagerDiscardBytes(a) +#define IDirect3DDevice8_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice8_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice8_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DDevice8_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice8_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice8_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice8_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice8_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice8_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice8_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice8_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DDevice8_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DDevice8_SetGammaRamp(p,a,b) (p)->SetGammaRamp(a,b) +#define IDirect3DDevice8_GetGammaRamp(p,a) (p)->GetGammaRamp(a) +#define IDirect3DDevice8_CreateTexture(p,a,b,c,d,e,f,g) (p)->CreateTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice8_CreateVolumeTexture(p,a,b,c,d,e,f,g,h) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_CreateCubeTexture(p,a,b,c,d,e,f) (p)->CreateCubeTexture(a,b,c,d,e,f) +#define IDirect3DDevice8_CreateVertexBuffer(p,a,b,c,d,e) (p)->CreateVertexBuffer(a,b,c,d,e) +#define IDirect3DDevice8_CreateIndexBuffer(p,a,b,c,d,e) (p)->CreateIndexBuffer(a,b,c,d,e) +#define IDirect3DDevice8_CreateRenderTarget(p,a,b,c,d,e,f) (p)->CreateRenderTarget(a,b,c,d,e,f) +#define IDirect3DDevice8_CreateDepthStencilSurface(p,a,b,c,d,e) (p)->CreateDepthStencilSurface(a,b,c,d,e) +#define IDirect3DDevice8_CreateImageSurface(p,a,b,c,d) (p)->CreateImageSurface(a,b,c,d) +#define IDirect3DDevice8_CopyRects(p,a,b,c,d,e) (p)->CopyRects(a,b,c,d,e) +#define IDirect3DDevice8_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice8_GetFrontBuffer(p,a) (p)->GetFrontBuffer(a) +#define IDirect3DDevice8_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice8_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice8_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice8_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice8_EndScene(p) (p)->EndScene() +#define IDirect3DDevice8_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice8_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice8_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice8_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice8_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice8_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice8_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice8_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice8_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice8_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice8_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice8_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice8_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice8_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice8_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice8_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice8_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice8_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice8_ApplyStateBlock(p,a) (p)->ApplyStateBlock(a) +#define IDirect3DDevice8_CaptureStateBlock(p,a) (p)->CaptureStateBlock(a) +#define IDirect3DDevice8_DeleteStateBlock(p,a) (p)->DeleteStateBlock(a) +#define IDirect3DDevice8_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice8_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice8_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice8_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice8_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice8_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice8_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice8_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice8_GetInfo(p,a,b,c) (p)->GetInfo(a,b,c) +#define IDirect3DDevice8_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice8_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice8_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice8_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice8_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->DrawIndexedPrimitive(a,b,c,d,e) +#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->ProcessVertices(a,b,c,d,e) +#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->CreateVertexShader(a,b,c,d) +#define IDirect3DDevice8_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice8_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice8_DeleteVertexShader(p,a) (p)->DeleteVertexShader(a) +#define IDirect3DDevice8_SetVertexShaderConstant(p,a,b,c) (p)->SetVertexShaderConstant(a,b,c) +#define IDirect3DDevice8_GetVertexShaderConstant(p,a,b,c) (p)->GetVertexShaderConstant(a,b,c) +#define IDirect3DDevice8_GetVertexShaderDeclaration(p,a,b,c) (p)->GetVertexShaderDeclaration(a,b,c) +#define IDirect3DDevice8_GetVertexShaderFunction(p,a,b,c) (p)->GetVertexShaderFunction(a,b,c) +#define IDirect3DDevice8_SetStreamSource(p,a,b,c) (p)->SetStreamSource(a,b,c) +#define IDirect3DDevice8_GetStreamSource(p,a,b,c) (p)->GetStreamSource(a,b,c) +#define IDirect3DDevice8_SetIndices(p,a,b) (p)->SetIndices(a,b) +#define IDirect3DDevice8_GetIndices(p,a,b) (p)->GetIndices(a,b) +#define IDirect3DDevice8_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice8_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice8_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice8_DeletePixelShader(p,a) (p)->DeletePixelShader(a) +#define IDirect3DDevice8_SetPixelShaderConstant(p,a,b,c) (p)->SetPixelShaderConstant(a,b,c) +#define IDirect3DDevice8_GetPixelShaderConstant(p,a,b,c) (p)->GetPixelShaderConstant(a,b,c) +#define IDirect3DDevice8_GetPixelShaderFunction(p,a,b,c) (p)->GetPixelShaderFunction(a,b,c) +#define IDirect3DDevice8_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice8_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice8_DeletePatch(p,a) (p)->DeletePatch(a) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain8 + +DECLARE_INTERFACE_(IDirect3DSwapChain8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain8 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) PURE; +}; + +typedef struct IDirect3DSwapChain8 *LPDIRECT3DSWAPCHAIN8, *PDIRECT3DSWAPCHAIN8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain8_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DSwapChain8_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#else +#define IDirect3DSwapChain8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain8_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain8_Release(p) (p)->Release() +#define IDirect3DSwapChain8_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DSwapChain8_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DResource8 + +DECLARE_INTERFACE_(IDirect3DResource8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; +}; + +typedef struct IDirect3DResource8 *LPDIRECT3DRESOURCE8, *PDIRECT3DRESOURCE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DResource8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DResource8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource8_GetType(p) (p)->lpVtbl->GetType(p) +#else +#define IDirect3DResource8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DResource8_AddRef(p) (p)->AddRef() +#define IDirect3DResource8_Release(p) (p)->Release() +#define IDirect3DResource8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DResource8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DResource8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DResource8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DResource8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DResource8_GetPriority(p) (p)->GetPriority() +#define IDirect3DResource8_PreLoad(p) (p)->PreLoad() +#define IDirect3DResource8_GetType(p) (p)->GetType() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DBaseTexture8 + +DECLARE_INTERFACE_(IDirect3DBaseTexture8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; +}; + +typedef struct IDirect3DBaseTexture8 *LPDIRECT3DBASETEXTURE8, *PDIRECT3DBASETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DBaseTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DBaseTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DBaseTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#else +#define IDirect3DBaseTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DBaseTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DBaseTexture8_Release(p) (p)->Release() +#define IDirect3DBaseTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DBaseTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DBaseTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DBaseTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DBaseTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DBaseTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DBaseTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DBaseTexture8_GetType(p) (p)->GetType() +#define IDirect3DBaseTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DBaseTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DBaseTexture8_GetLevelCount(p) (p)->GetLevelCount() +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DTexture8 + +DECLARE_INTERFACE_(IDirect3DTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface8** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DTexture8 *LPDIRECT3DTEXTURE8, *PDIRECT3DTEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture8_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture8_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture8_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture8_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#else +#define IDirect3DTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DTexture8_Release(p) (p)->Release() +#define IDirect3DTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DTexture8_GetType(p) (p)->GetType() +#define IDirect3DTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DTexture8_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) +#define IDirect3DTexture8_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) +#define IDirect3DTexture8_UnlockRect(p,a) (p)->UnlockRect(a) +#define IDirect3DTexture8_AddDirtyRect(p,a) (p)->AddDirtyRect(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolumeTexture8 + +DECLARE_INTERFACE_(IDirect3DVolumeTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume8** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; +}; + +typedef struct IDirect3DVolumeTexture8 *LPDIRECT3DVOLUMETEXTURE8, *PDIRECT3DVOLUMETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolumeTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolumeTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVolumeTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture8_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture8_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture8_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#else +#define IDirect3DVolumeTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolumeTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DVolumeTexture8_Release(p) (p)->Release() +#define IDirect3DVolumeTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolumeTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolumeTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolumeTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolumeTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVolumeTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DVolumeTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DVolumeTexture8_GetType(p) (p)->GetType() +#define IDirect3DVolumeTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DVolumeTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DVolumeTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DVolumeTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DVolumeTexture8_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) +#define IDirect3DVolumeTexture8_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) +#define IDirect3DVolumeTexture8_UnlockBox(p,a) (p)->UnlockBox(a) +#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) (p)->AddDirtyBox(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DCubeTexture8 + +DECLARE_INTERFACE_(IDirect3DCubeTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface8** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DCubeTexture8 *LPDIRECT3DCUBETEXTURE8, *PDIRECT3DCUBETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCubeTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCubeTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DCubeTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture8_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture8_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture8_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture8_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#else +#define IDirect3DCubeTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCubeTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DCubeTexture8_Release(p) (p)->Release() +#define IDirect3DCubeTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DCubeTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DCubeTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DCubeTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DCubeTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DCubeTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DCubeTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DCubeTexture8_GetType(p) (p)->GetType() +#define IDirect3DCubeTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DCubeTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DCubeTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DCubeTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DCubeTexture8_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) +#define IDirect3DCubeTexture8_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) +#define IDirect3DCubeTexture8_UnlockRect(p,a,b) (p)->UnlockRect(a,b) +#define IDirect3DCubeTexture8_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer8 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DVertexBuffer8 *LPDIRECT3DVERTEXBUFFER8, *PDIRECT3DVERTEXBUFFER8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVertexBuffer8_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer8_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DVertexBuffer8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer8_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer8_Release(p) (p)->Release() +#define IDirect3DVertexBuffer8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexBuffer8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVertexBuffer8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVertexBuffer8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVertexBuffer8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVertexBuffer8_GetPriority(p) (p)->GetPriority() +#define IDirect3DVertexBuffer8_PreLoad(p) (p)->PreLoad() +#define IDirect3DVertexBuffer8_GetType(p) (p)->GetType() +#define IDirect3DVertexBuffer8_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DVertexBuffer8_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer8_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DIndexBuffer8 + +DECLARE_INTERFACE_(IDirect3DIndexBuffer8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DIndexBuffer8 *LPDIRECT3DINDEXBUFFER8, *PDIRECT3DINDEXBUFFER8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DIndexBuffer8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DIndexBuffer8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DIndexBuffer8_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer8_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DIndexBuffer8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DIndexBuffer8_AddRef(p) (p)->AddRef() +#define IDirect3DIndexBuffer8_Release(p) (p)->Release() +#define IDirect3DIndexBuffer8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DIndexBuffer8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DIndexBuffer8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DIndexBuffer8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DIndexBuffer8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DIndexBuffer8_GetPriority(p) (p)->GetPriority() +#define IDirect3DIndexBuffer8_PreLoad(p) (p)->PreLoad() +#define IDirect3DIndexBuffer8_GetType(p) (p)->GetType() +#define IDirect3DIndexBuffer8_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DIndexBuffer8_Unlock(p) (p)->Unlock() +#define IDirect3DIndexBuffer8_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSurface8 + +DECLARE_INTERFACE_(IDirect3DSurface8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSurface8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS) PURE; +}; + +typedef struct IDirect3DSurface8 *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSurface8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSurface8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface8_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface8_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface8_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#else +#define IDirect3DSurface8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSurface8_AddRef(p) (p)->AddRef() +#define IDirect3DSurface8_Release(p) (p)->Release() +#define IDirect3DSurface8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSurface8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DSurface8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DSurface8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DSurface8_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DSurface8_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DSurface8_LockRect(p,a,b,c) (p)->LockRect(a,b,c) +#define IDirect3DSurface8_UnlockRect(p) (p)->UnlockRect() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolume8 + +DECLARE_INTERFACE_(IDirect3DVolume8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVolume8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; +}; + +typedef struct IDirect3DVolume8 *LPDIRECT3DVOLUME8, *PDIRECT3DVOLUME8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolume8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolume8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume8_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume8_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume8_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#else +#define IDirect3DVolume8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolume8_AddRef(p) (p)->AddRef() +#define IDirect3DVolume8_Release(p) (p)->Release() +#define IDirect3DVolume8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolume8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolume8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolume8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolume8_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DVolume8_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DVolume8_LockBox(p,a,b,c) (p)->LockBox(a,b,c) +#define IDirect3DVolume8_UnlockBox(p) (p)->UnlockBox() +#endif + +/**************************************************************************** + * Flags for SetPrivateData method on all D3D8 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D8 object is freed. + ****************************************************************************/ +#define D3DSPD_IUNKNOWN 0x00000001L + +/**************************************************************************** + * + * Parameter for IDirect3D8 Enum and GetCaps8 functions to get the info for + * the current mode only. + * + ****************************************************************************/ + +#define D3DCURRENT_DISPLAY_MODE 0x00EFFFFFL + +/**************************************************************************** + * + * Flags for IDirect3D8::CreateDevice's BehaviorFlags + * + ****************************************************************************/ + +#define D3DCREATE_FPU_PRESERVE 0x00000002L +#define D3DCREATE_MULTITHREADED 0x00000004L + +#define D3DCREATE_PUREDEVICE 0x00000010L +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L + +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L + + +/**************************************************************************** + * + * Parameter for IDirect3D8::CreateDevice's iAdapter + * + ****************************************************************************/ + +#define D3DADAPTER_DEFAULT 0 + +/**************************************************************************** + * + * Flags for IDirect3D8::EnumAdapters + * + ****************************************************************************/ + +#define D3DENUM_NO_WHQL_LEVEL 0x00000002L + +/**************************************************************************** + * + * Maximum number of back-buffers supported in DX8 + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX 3L + +/**************************************************************************** + * + * Flags for IDirect3DDevice8::SetGammaRamp + * + ****************************************************************************/ + +#define D3DSGR_NO_CALIBRATION 0x00000000L +#define D3DSGR_CALIBRATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DDevice8::SetCursorPosition + * + ****************************************************************************/ + +#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + + +/* + * DirectDraw error codes + */ +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) + +/* + * Direct3D Errors + */ +#define D3D_OK S_OK + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) + +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D_H_ */ + diff --git a/saco/d3d9/include/d3d8caps.h b/saco/d3d9/include/d3d8caps.h new file mode 100644 index 0000000..6af8e6c --- /dev/null +++ b/saco/d3d9/include/d3d8caps.h @@ -0,0 +1,364 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8caps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3D8CAPS_H +#define _D3D8CAPS_H + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +typedef struct _D3DCAPS8 +{ + /* Device Info */ + D3DDEVTYPE DeviceType; + UINT AdapterOrdinal; + + /* Caps from DX7 Draw */ + DWORD Caps; + DWORD Caps2; + DWORD Caps3; + DWORD PresentationIntervals; + + /* Cursor Caps */ + DWORD CursorCaps; + + /* 3D Device Caps */ + DWORD DevCaps; + + DWORD PrimitiveMiscCaps; + DWORD RasterCaps; + DWORD ZCmpCaps; + DWORD SrcBlendCaps; + DWORD DestBlendCaps; + DWORD AlphaCmpCaps; + DWORD ShadeCaps; + DWORD TextureCaps; + DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture8's + DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture8's + DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture8's + DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture8's + DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture8's + + DWORD LineCaps; // D3DLINECAPS + + DWORD MaxTextureWidth, MaxTextureHeight; + DWORD MaxVolumeExtent; + + DWORD MaxTextureRepeat; + DWORD MaxTextureAspectRatio; + DWORD MaxAnisotropy; + float MaxVertexW; + + float GuardBandLeft; + float GuardBandTop; + float GuardBandRight; + float GuardBandBottom; + + float ExtentsAdjust; + DWORD StencilCaps; + + DWORD FVFCaps; + DWORD TextureOpCaps; + DWORD MaxTextureBlendStages; + DWORD MaxSimultaneousTextures; + + DWORD VertexProcessingCaps; + DWORD MaxActiveLights; + DWORD MaxUserClipPlanes; + DWORD MaxVertexBlendMatrices; + DWORD MaxVertexBlendMatrixIndex; + + float MaxPointSize; + + DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call + DWORD MaxVertexIndex; + DWORD MaxStreams; + DWORD MaxStreamStride; // max stride for SetStreamSource + + DWORD VertexShaderVersion; + DWORD MaxVertexShaderConst; // number of vertex shader constant registers + + DWORD PixelShaderVersion; + float MaxPixelShaderValue; // max value of pixel shader arithmetic component + +} D3DCAPS8; + +// +// BIT DEFINES FOR D3DCAPS8 DWORD MEMBERS +// + +// +// Caps +// +#define D3DCAPS_READ_SCANLINE 0x00020000L + +// +// Caps2 +// +#define D3DCAPS2_NO2DDURING3DSCENE 0x00000002L +#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L +#define D3DCAPS2_CANRENDERWINDOWED 0x00080000L +#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L +#define D3DCAPS2_RESERVED 0x02000000L +#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L +#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L + +// +// Caps3 +// +#define D3DCAPS3_RESERVED 0x8000001fL + +// Indicates that the device can respect the ALPHABLENDENABLE render state +// when fullscreen while using the FLIP or DISCARD swap effect. +// COPY and COPYVSYNC swap effects work whether or not this flag is set. +#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L + +// +// PresentationIntervals +// +#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L +#define D3DPRESENT_INTERVAL_ONE 0x00000001L +#define D3DPRESENT_INTERVAL_TWO 0x00000002L +#define D3DPRESENT_INTERVAL_THREE 0x00000004L +#define D3DPRESENT_INTERVAL_FOUR 0x00000008L +#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L + +// +// CursorCaps +// +// Driver supports HW color cursor in at least hi-res modes(height >=400) +#define D3DCURSORCAPS_COLOR 0x00000001L +// Driver supports HW cursor also in low-res modes(height < 400) +#define D3DCURSORCAPS_LOWRES 0x00000002L + +// +// DevCaps +// +#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 */ +#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 */ +#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*/ +#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 */ +#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */ +#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */ +#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */ +#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */ +#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */ + +// +// PrimitiveMiscCaps +// +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L +#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L +#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */ +#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */ +#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */ +#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */ +#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */ + +// +// LineCaps +// +#define D3DLINECAPS_TEXTURE 0x00000001L +#define D3DLINECAPS_ZTEST 0x00000002L +#define D3DLINECAPS_BLEND 0x00000004L +#define D3DLINECAPS_ALPHACMP 0x00000008L +#define D3DLINECAPS_FOG 0x00000010L + +// +// RasterCaps +// +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_PAT 0x00000008L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBIAS 0x00004000L +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L +#define D3DPRASTERCAPS_FOGRANGE 0x00010000L +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L +#define D3DPRASTERCAPS_WBUFFER 0x00040000L +#define D3DPRASTERCAPS_WFOG 0x00100000L +#define D3DPRASTERCAPS_ZFOG 0x00200000L +#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */ +#define D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE 0x00800000L + +// +// ZCmpCaps, AlphaCmpCaps +// +#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 + +// +// SourceBlendCaps, DestBlendCaps +// +#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 + +// +// ShadeCaps +// +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L + +// +// TextureCaps +// +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */ +#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */ +#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */ +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */ +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */ +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */ +// 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 +#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */ +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */ +#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */ +#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */ +#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */ +#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */ +#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */ + +// +// TextureFilterCaps +// +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */ +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */ +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */ +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000L + +// +// TextureAddressCaps +// +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L +#define D3DPTADDRESSCAPS_BORDER 0x00000008L +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L +#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L + +// +// StencilCaps +// +#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 + +// +// TextureOpCaps +// +#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 +#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L +#define D3DTEXOPCAPS_LERP 0x02000000L + +// +// FVFCaps +// +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ +#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */ + +// +// VertexProcessingCaps +// +#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */ +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */ +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */ +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */ +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */ +#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */ +#define D3DVTXPCAPS_NO_VSDT_UBYTE4 0x00000080L /* device does not support D3DVSDT_UBYTE4 */ + +#pragma pack() + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D8CAPS_H_ */ + diff --git a/saco/d3d9/include/d3d8types.h b/saco/d3d9/include/d3d8types.h new file mode 100644 index 0000000..5d622af --- /dev/null +++ b/saco/d3d9/include/d3d8types.h @@ -0,0 +1,1684 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3D8TYPES_H_ +#define _D3D8TYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + +#include + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +// maps unsigned 8 bits/channel to D3DCOLOR +#define D3DCOLOR_ARGB(a,r,g,b) \ + ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) + +// maps floating point channels (0.f to 1.f range) to D3DCOLOR +#define D3DCOLOR_COLORVALUE(r,g,b,a) \ + D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) + + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + float r; + float g; + float b; + float a; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + LONG x1; + LONG y1; + LONG x2; + LONG y2; +} D3DRECT; +#define D3DRECT_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +typedef struct _D3DVIEWPORT8 { + DWORD X; + DWORD Y; /* Viewport Top left */ + DWORD Width; + DWORD Height; /* Viewport Dimensions */ + float MinZ; /* Min/max of clip Volume */ + float MaxZ; +} D3DVIEWPORT8; + +/* + * Values for clip fields. + */ + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRS_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) + +// The following bits are used in the ClipUnion and ClipIntersection +// members of the D3DCLIPSTATUS8 +// + +#define D3DCS_LEFT 0x00000001L +#define D3DCS_RIGHT 0x00000002L +#define D3DCS_TOP 0x00000004L +#define D3DCS_BOTTOM 0x00000008L +#define D3DCS_FRONT 0x00000010L +#define D3DCS_BACK 0x00000020L +#define D3DCS_PLANE0 0x00000040L +#define D3DCS_PLANE1 0x00000080L +#define D3DCS_PLANE2 0x00000100L +#define D3DCS_PLANE3 0x00000200L +#define D3DCS_PLANE4 0x00000400L +#define D3DCS_PLANE5 0x00000800L + +#define D3DCS_ALL (D3DCS_LEFT | \ + D3DCS_RIGHT | \ + D3DCS_TOP | \ + D3DCS_BOTTOM | \ + D3DCS_FRONT | \ + D3DCS_BACK | \ + D3DCS_PLANE0 | \ + D3DCS_PLANE1 | \ + D3DCS_PLANE2 | \ + D3DCS_PLANE3 | \ + D3DCS_PLANE4 | \ + D3DCS_PLANE5) + +typedef struct _D3DCLIPSTATUS8 { + DWORD ClipUnion; + DWORD ClipIntersection; +} D3DCLIPSTATUS8; + +typedef struct _D3DMATERIAL8 { + D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE Ambient; /* Ambient color RGB */ + D3DCOLORVALUE Specular; /* Specular 'shininess' */ + D3DCOLORVALUE Emissive; /* Emissive color RGB */ + float Power; /* Sharpness if specular highlight */ +} D3DMATERIAL8; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +typedef struct _D3DLIGHT8 { + D3DLIGHTTYPE Type; /* Type of light source */ + D3DCOLORVALUE Diffuse; /* Diffuse color of light */ + D3DCOLORVALUE Specular; /* Specular color of light */ + D3DCOLORVALUE Ambient; /* Ambient color of light */ + D3DVECTOR Position; /* Position in world space */ + D3DVECTOR Direction; /* Direction in world space */ + float Range; /* Cutoff range */ + float Falloff; /* Falloff */ + float Attenuation0; /* Constant attenuation */ + float Attenuation1; /* Linear attenuation */ + float Attenuation2; /* Quadratic attenuation */ + float Theta; /* Inner angle of spotlight cone */ + float Phi; /* Outer angle of spotlight cone */ +} D3DLIGHT8; + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ + +/* + * The following defines the rendering states + */ + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFILLMODE; + +typedef struct _D3DLINEPATTERN { + WORD wRepeatFactor; + WORD wLinePattern; +} D3DLINEPATTERN; + +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, + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLEND; + +typedef enum _D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, + D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLENDOP; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} 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, + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCMPFUNC; + +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; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFOGMODE; + +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; + +// 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; + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, + D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTRANSFORMSTATETYPE; + +#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) +#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) +#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) +#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + +typedef enum _D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRS_FILLMODE = 8, /* D3DFILLMODE */ + D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRS_LINEPATTERN = 10, /* D3DLINEPATTERN */ + D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRS_SRCBLEND = 19, /* D3DBLEND */ + D3DRS_DESTBLEND = 20, /* D3DBLEND */ + D3DRS_CULLMODE = 22, /* D3DCULL */ + D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRS_ALPHAREF = 24, /* D3DFIXED */ + D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ + D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ + D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRS_ZVISIBLE = 30, /* TRUE to enable z checking */ + D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ + D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRS_FOGEND = 37, /* Fog end */ + D3DRS_FOGDENSITY = 38, /* Fog density */ + D3DRS_EDGEANTIALIAS = 40, /* TRUE to enable edge antialiasing */ + D3DRS_ZBIAS = 47, /* LONG Z bias */ + D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ + D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ + D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_SOFTWAREVERTEXPROCESSING = 153, + D3DRS_POINTSIZE = 154, /* float point size */ + D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ + D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ + D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ + D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ + D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ + D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_PATCHSEGMENTS = 164, // Number of segments per edge when drawing patches + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONORDER = 172, // NPatch position interpolation order. D3DORDER_LINEAR or D3DORDER_CUBIC (default) + D3DRS_NORMALORDER = 173, // NPatch normal interpolation order. D3DORDER_LINEAR (default) or D3DORDER_QUADRATIC + + D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DRENDERSTATETYPE; + +// 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; + +// 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 +#define D3DWRAP_W 0x00000004L + +/* 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 // same as D3DWRAP_W +#define D3DWRAPCOORD_3 0x00000008L + +/* Flags to construct D3DRS_COLORWRITEENABLE */ +#define D3DCOLORWRITEENABLE_RED (1L<<0) +#define D3DCOLORWRITEENABLE_GREEN (1L<<1) +#define D3DCOLORWRITEENABLE_BLUE (1L<<2) +#define D3DCOLORWRITEENABLE_ALPHA (1L<<3) + +/* + * 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, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_ADDRESSU = 13, /* D3DTEXTUREADDRESS for U coordinate */ + D3DTSS_ADDRESSV = 14, /* D3DTEXTUREADDRESS for V coordinate */ + D3DTSS_BORDERCOLOR = 15, /* D3DCOLOR */ + D3DTSS_MAGFILTER = 16, /* D3DTEXTUREFILTER filter to use for magnification */ + D3DTSS_MINFILTER = 17, /* D3DTEXTUREFILTER filter to use for minification */ + D3DTSS_MIPFILTER = 18, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ + D3DTSS_MIPMAPLODBIAS = 19, /* float 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, /* float scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ + D3DTSS_ADDRESSW = 25, /* D3DTEXTUREADDRESS for W coordinate */ + D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ + D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ + D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +// 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 + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + */ +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 D3DRS_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, + + // Triadic ops + D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 + D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG 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 (read only) +#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) +#define D3DTA_TEXTURE 0x00000002 // select texture color (read only) +#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) +#define D3DTA_SPECULAR 0x00000004 // select specular color (read only) +#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) + +// +// Values for D3DTSS_***FILTER texture stage states +// +typedef enum _D3DTEXTUREFILTERTYPE +{ + D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) + D3DTEXF_POINT = 1, // nearest + D3DTEXF_LINEAR = 2, // linear interpolation + D3DTEXF_ANISOTROPIC = 3, // anisotropic + D3DTEXF_FLATCUBIC = 4, // cubic + D3DTEXF_GAUSSIANCUBIC = 5, // different cubic kernel + D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREFILTERTYPE; + +/* Bits for Flags in ProcessVertices call */ + +#define D3DPV_DONOTCOPYDATA (1 << 0) + +//------------------------------------------------------------------- + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x00E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e + +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_PSIZE 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_LASTBETA_UBYTE4 0x1000 + +#define D3DFVF_RESERVED2 0xE000 // 4 reserved bits + +//--------------------------------------------------------------------- +// Vertex Shaders +// + +/* + +Vertex Shader Declaration + +The declaration portion of a vertex shader defines the static external +interface of the shader. The information in the declaration includes: + +- Assignments of vertex shader input registers to data streams. These +assignments bind a specific vertex register to a single component within a +vertex stream. A vertex stream element is identified by a byte offset +within the stream and a type. The type specifies the arithmetic data type +plus the dimensionality (1, 2, 3, or 4 values). Stream data which is +less than 4 values are always expanded out to 4 values with zero or more +0.F values and one 1.F value. + +- Assignment of vertex shader input registers to implicit data from the +primitive tessellator. This controls the loading of vertex data which is +not loaded from a stream, but rather is generated during primitive +tessellation prior to the vertex shader. + +- Loading data into the constant memory at the time a shader is set as the +current shader. Each token specifies values for one or more contiguous 4 +DWORD constant registers. This allows the shader to update an arbitrary +subset of the constant memory, overwriting the device state (which +contains the current values of the constant memory). Note that these +values can be subsequently overwritten (between DrawPrimitive calls) +during the time a shader is bound to a device via the +SetVertexShaderConstant method. + + +Declaration arrays are single-dimensional arrays of DWORDs composed of +multiple tokens each of which is one or more DWORDs. The single-DWORD +token value 0xFFFFFFFF is a special token used to indicate the end of the +declaration array. The single DWORD token value 0x00000000 is a NOP token +with is ignored during the declaration parsing. Note that 0x00000000 is a +valid value for DWORDs following the first DWORD for multiple word tokens. + +[31:29] TokenType + 0x0 - NOP (requires all DWORD bits to be zero) + 0x1 - stream selector + 0x2 - stream data definition (map to vertex input memory) + 0x3 - vertex input memory from tessellator + 0x4 - constant memory from shader + 0x5 - extension + 0x6 - reserved + 0x7 - end-of-array (requires all DWORD bits to be 1) + +NOP Token (single DWORD token) + [31:29] 0x0 + [28:00] 0x0 + +Stream Selector (single DWORD token) + [31:29] 0x1 + [28] indicates whether this is a tessellator stream + [27:04] 0x0 + [03:00] stream selector (0..15) + +Stream Data Definition (single DWORD token) + Vertex Input Register Load + [31:29] 0x2 + [28] 0x0 + [27:20] 0x0 + [19:16] type (dimensionality and data type) + [15:04] 0x0 + [03:00] vertex register address (0..15) + Data Skip (no register load) + [31:29] 0x2 + [28] 0x1 + [27:20] 0x0 + [19:16] count of DWORDS to skip over (0..15) + [15:00] 0x0 + Vertex Input Memory from Tessellator Data (single DWORD token) + [31:29] 0x3 + [28] indicates whether data is normals or u/v + [27:24] 0x0 + [23:20] vertex register address (0..15) + [19:16] type (dimensionality) + [15:04] 0x0 + [03:00] vertex register address (0..15) + +Constant Memory from Shader (multiple DWORD token) + [31:29] 0x4 + [28:25] count of 4*DWORD constants to load (0..15) + [24:07] 0x0 + [06:00] constant memory address (0..95) + +Extension Token (single or multiple DWORD token) + [31:29] 0x5 + [28:24] count of additional DWORDs in token (0..31) + [23:00] extension-specific information + +End-of-array token (single DWORD token) + [31:29] 0x7 + [28:00] 0x1fffffff + +The stream selector token must be immediately followed by a contiguous set of stream data definition tokens. This token sequence fully defines that stream, including the set of elements within the stream, the order in which the elements appear, the type of each element, and the vertex register into which to load an element. +Streams are allowed to include data which is not loaded into a vertex register, thus allowing data which is not used for this shader to exist in the vertex stream. This skipped data is defined only by a count of DWORDs to skip over, since the type information is irrelevant. +The token sequence: +Stream Select: stream=0 +Stream Data Definition (Load): type=FLOAT3; register=3 +Stream Data Definition (Load): type=FLOAT3; register=4 +Stream Data Definition (Skip): count=2 +Stream Data Definition (Load): type=FLOAT2; register=7 + +defines stream zero to consist of 4 elements, 3 of which are loaded into registers and the fourth skipped over. Register 3 is loaded with the first three DWORDs in each vertex interpreted as FLOAT data. Register 4 is loaded with the 4th, 5th, and 6th DWORDs interpreted as FLOAT data. The next two DWORDs (7th and 8th) are skipped over and not loaded into any vertex input register. Register 7 is loaded with the 9th and 10th DWORDS interpreted as FLOAT data. +Placing of tokens other than NOPs between the Stream Selector and Stream Data Definition tokens is disallowed. + +*/ + +typedef enum _D3DVSD_TOKENTYPE +{ + D3DVSD_TOKEN_NOP = 0, // NOP or extension + D3DVSD_TOKEN_STREAM, // stream selector + D3DVSD_TOKEN_STREAMDATA, // stream data definition (map to vertex input memory) + D3DVSD_TOKEN_TESSELLATOR, // vertex input memory from tessellator + D3DVSD_TOKEN_CONSTMEM, // constant memory from shader + D3DVSD_TOKEN_EXT, // extension + D3DVSD_TOKEN_END = 7, // end-of-array (requires all DWORD bits to be 1) + D3DVSD_FORCE_DWORD = 0x7fffffff,// force 32-bit size enum +} D3DVSD_TOKENTYPE; + +#define D3DVSD_TOKENTYPESHIFT 29 +#define D3DVSD_TOKENTYPEMASK (7 << D3DVSD_TOKENTYPESHIFT) + +#define D3DVSD_STREAMNUMBERSHIFT 0 +#define D3DVSD_STREAMNUMBERMASK (0xF << D3DVSD_STREAMNUMBERSHIFT) + +#define D3DVSD_DATALOADTYPESHIFT 28 +#define D3DVSD_DATALOADTYPEMASK (0x1 << D3DVSD_DATALOADTYPESHIFT) + +#define D3DVSD_DATATYPESHIFT 16 +#define D3DVSD_DATATYPEMASK (0xF << D3DVSD_DATATYPESHIFT) + +#define D3DVSD_SKIPCOUNTSHIFT 16 +#define D3DVSD_SKIPCOUNTMASK (0xF << D3DVSD_SKIPCOUNTSHIFT) + +#define D3DVSD_VERTEXREGSHIFT 0 +#define D3DVSD_VERTEXREGMASK (0x1F << D3DVSD_VERTEXREGSHIFT) + +#define D3DVSD_VERTEXREGINSHIFT 20 +#define D3DVSD_VERTEXREGINMASK (0xF << D3DVSD_VERTEXREGINSHIFT) + +#define D3DVSD_CONSTCOUNTSHIFT 25 +#define D3DVSD_CONSTCOUNTMASK (0xF << D3DVSD_CONSTCOUNTSHIFT) + +#define D3DVSD_CONSTADDRESSSHIFT 0 +#define D3DVSD_CONSTADDRESSMASK (0x7F << D3DVSD_CONSTADDRESSSHIFT) + +#define D3DVSD_CONSTRSSHIFT 16 +#define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTRSSHIFT) + +#define D3DVSD_EXTCOUNTSHIFT 24 +#define D3DVSD_EXTCOUNTMASK (0x1F << D3DVSD_EXTCOUNTSHIFT) + +#define D3DVSD_EXTINFOSHIFT 0 +#define D3DVSD_EXTINFOMASK (0xFFFFFF << D3DVSD_EXTINFOSHIFT) + +#define D3DVSD_MAKETOKENTYPE(tokenType) ((tokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK) + +// macros for generation of CreateVertexShader Declaration token array + +// Set current stream +// _StreamNumber [0..(MaxStreams-1)] stream to get data from +// +#define D3DVSD_STREAM( _StreamNumber ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (_StreamNumber)) + +// Set tessellator stream +// +#define D3DVSD_STREAMTESSSHIFT 28 +#define D3DVSD_STREAMTESSMASK (1 << D3DVSD_STREAMTESSSHIFT) +#define D3DVSD_STREAM_TESS( ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (D3DVSD_STREAMTESSMASK)) + +// bind single vertex register to vertex element from vertex stream +// +// _VertexRegister [0..15] address of the vertex register +// _Type [D3DVSDT_*] dimensionality and arithmetic data type + +#define D3DVSD_REG( _VertexRegister, _Type ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | \ + ((_Type) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) + +// Skip _DWORDCount DWORDs in vertex +// +#define D3DVSD_SKIP( _DWORDCount ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | \ + ((_DWORDCount) << D3DVSD_SKIPCOUNTSHIFT)) + +// load data into vertex shader constant memory +// +// _ConstantAddress [0..95] - address of constant array to begin filling data +// _Count [0..15] - number of constant vectors to load (4 DWORDs each) +// followed by 4*_Count DWORDS of data +// +#define D3DVSD_CONST( _ConstantAddress, _Count ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | \ + ((_Count) << D3DVSD_CONSTCOUNTSHIFT) | (_ConstantAddress)) + +// enable tessellator generated normals +// +// _VertexRegisterIn [0..15] address of vertex register whose input stream +// will be used in normal computation +// _VertexRegisterOut [0..15] address of vertex register to output the normal to +// +#define D3DVSD_TESSNORMAL( _VertexRegisterIn, _VertexRegisterOut ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | \ + ((_VertexRegisterIn) << D3DVSD_VERTEXREGINSHIFT) | \ + ((0x02) << D3DVSD_DATATYPESHIFT) | (_VertexRegisterOut)) + +// enable tessellator generated surface parameters +// +// _VertexRegister [0..15] address of vertex register to output parameters +// +#define D3DVSD_TESSUV( _VertexRegister ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | \ + ((0x01) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) + +// Generates END token +// +#define D3DVSD_END() 0xFFFFFFFF + +// Generates NOP token +#define D3DVSD_NOP() 0x00000000 + +// bit declarations for _Type fields +#define D3DVSDT_FLOAT1 0x00 // 1D float expanded to (value, 0., 0., 1.) +#define D3DVSDT_FLOAT2 0x01 // 2D float expanded to (value, value, 0., 1.) +#define D3DVSDT_FLOAT3 0x02 // 3D float expanded to (value, value, value, 1.) +#define D3DVSDT_FLOAT4 0x03 // 4D float +#define D3DVSDT_D3DCOLOR 0x04 // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) +#define D3DVSDT_UBYTE4 0x05 // 4D unsigned byte +#define D3DVSDT_SHORT2 0x06 // 2D signed short expanded to (value, value, 0., 1.) +#define D3DVSDT_SHORT4 0x07 // 4D signed short + +// assignments of vertex input registers for fixed function vertex shader +// +#define D3DVSDE_POSITION 0 +#define D3DVSDE_BLENDWEIGHT 1 +#define D3DVSDE_BLENDINDICES 2 +#define D3DVSDE_NORMAL 3 +#define D3DVSDE_PSIZE 4 +#define D3DVSDE_DIFFUSE 5 +#define D3DVSDE_SPECULAR 6 +#define D3DVSDE_TEXCOORD0 7 +#define D3DVSDE_TEXCOORD1 8 +#define D3DVSDE_TEXCOORD2 9 +#define D3DVSDE_TEXCOORD3 10 +#define D3DVSDE_TEXCOORD4 11 +#define D3DVSDE_TEXCOORD5 12 +#define D3DVSDE_TEXCOORD6 13 +#define D3DVSDE_TEXCOORD7 14 +#define D3DVSDE_POSITION2 15 +#define D3DVSDE_NORMAL2 16 + +// Maximum supported number of texture coordinate sets +#define D3DDP_MAXTEXCOORD 8 + + +// +// Instruction Token Bit Definitions +// +#define D3DSI_OPCODE_MASK 0x0000FFFF + +typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE +{ + D3DSIO_NOP = 0, // PS/VS + D3DSIO_MOV , // PS/VS + D3DSIO_ADD , // PS/VS + D3DSIO_SUB , // PS + D3DSIO_MAD , // PS/VS + D3DSIO_MUL , // PS/VS + D3DSIO_RCP , // VS + D3DSIO_RSQ , // VS + D3DSIO_DP3 , // PS/VS + D3DSIO_DP4 , // PS/VS + D3DSIO_MIN , // VS + D3DSIO_MAX , // VS + D3DSIO_SLT , // VS + D3DSIO_SGE , // VS + D3DSIO_EXP , // VS + D3DSIO_LOG , // VS + D3DSIO_LIT , // VS + D3DSIO_DST , // VS + D3DSIO_LRP , // PS + D3DSIO_FRC , // VS + D3DSIO_M4x4 , // VS + D3DSIO_M4x3 , // VS + D3DSIO_M3x4 , // VS + D3DSIO_M3x3 , // VS + D3DSIO_M3x2 , // VS + + D3DSIO_TEXCOORD = 64, // PS + D3DSIO_TEXKILL , // PS + D3DSIO_TEX , // PS + D3DSIO_TEXBEM , // PS + D3DSIO_TEXBEML , // PS + D3DSIO_TEXREG2AR , // PS + D3DSIO_TEXREG2GB , // PS + D3DSIO_TEXM3x2PAD , // PS + D3DSIO_TEXM3x2TEX , // PS + D3DSIO_TEXM3x3PAD , // PS + D3DSIO_TEXM3x3TEX , // PS + D3DSIO_TEXM3x3DIFF , // PS + D3DSIO_TEXM3x3SPEC , // PS + D3DSIO_TEXM3x3VSPEC , // PS + D3DSIO_EXPP , // VS + D3DSIO_LOGP , // VS + D3DSIO_CND , // PS + D3DSIO_DEF , // PS + D3DSIO_TEXREG2RGB , // PS + D3DSIO_TEXDP3TEX , // PS + D3DSIO_TEXM3x2DEPTH , // PS + D3DSIO_TEXDP3 , // PS + D3DSIO_TEXM3x3 , // PS + D3DSIO_TEXDEPTH , // PS + D3DSIO_CMP , // PS + D3DSIO_BEM , // PS + + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, + + D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +// +// Co-Issue Instruction Modifier - if set then this instruction is to be +// issued in parallel with the previous instruction(s) for which this bit +// is not set. +// +#define D3DSI_COISSUE 0x40000000 + +// +// Parameter Token Bit Definitions +// +#define D3DSP_REGNUM_MASK 0x00001FFF + +// destination parameter write mask +#define D3DSP_WRITEMASK_0 0x00010000 // Component 0 (X;Red) +#define D3DSP_WRITEMASK_1 0x00020000 // Component 1 (Y;Green) +#define D3DSP_WRITEMASK_2 0x00040000 // Component 2 (Z;Blue) +#define D3DSP_WRITEMASK_3 0x00080000 // Component 3 (W;Alpha) +#define D3DSP_WRITEMASK_ALL 0x000F0000 // All Components + +// destination parameter modifiers +#define D3DSP_DSTMOD_SHIFT 20 +#define D3DSP_DSTMOD_MASK 0x00F00000 + +typedef enum _D3DSHADER_PARAM_DSTMOD_TYPE +{ + D3DSPDM_NONE = 0<>8)&0xFF) +#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) + +// destination/source parameter register type +#define D3DSI_COMMENTSIZE_SHIFT 16 +#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 +#define D3DSHADER_COMMENT(_DWordSize) \ + ((((_DWordSize)<= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D8TYPES(P)_H_ */ + diff --git a/saco/d3d9/include/d3d9.h b/saco/d3d9/include/d3d9.h new file mode 100644 index 0000000..85bd957 --- /dev/null +++ b/saco/d3d9/include/d3d9.h @@ -0,0 +1,1870 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D9_H_ +#define _D3D9_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + + +/* This identifier is passed to Direct3DCreate9 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate9 will fail. + * (The number itself has no meaning.)*/ + +#ifdef D3D_DEBUG_INFO +#define D3D_SDK_VERSION (32 | 0x80000000) +#define D3D9b_SDK_VERSION (31 | 0x80000000) + +#else +#define D3D_SDK_VERSION 32 +#define D3D9b_SDK_VERSION 31 +#endif + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); +#endif + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) + +/* IID_IDirect3D9 */ +/* {81BDCBCA-64D4-426d-AE8D-AD0147F4275C} */ +DEFINE_GUID(IID_IDirect3D9, 0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c); + +/* IID_IDirect3DDevice9 */ +// {D0223B96-BF7A-43fd-92BD-A43B0D82B9EB} */ +DEFINE_GUID(IID_IDirect3DDevice9, 0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb); + +/* IID_IDirect3DResource9 */ +// {05EEC05D-8F7D-4362-B999-D1BAF357C704} +DEFINE_GUID(IID_IDirect3DResource9, 0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4); + +/* IID_IDirect3DBaseTexture9 */ +/* {580CA87E-1D3C-4d54-991D-B7D3E3C298CE} */ +DEFINE_GUID(IID_IDirect3DBaseTexture9, 0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce); + +/* IID_IDirect3DTexture9 */ +/* {85C31227-3DE5-4f00-9B3A-F11AC38C18B5} */ +DEFINE_GUID(IID_IDirect3DTexture9, 0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5); + +/* IID_IDirect3DCubeTexture9 */ +/* {FFF32F81-D953-473a-9223-93D652ABA93F} */ +DEFINE_GUID(IID_IDirect3DCubeTexture9, 0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f); + +/* IID_IDirect3DVolumeTexture9 */ +/* {2518526C-E789-4111-A7B9-47EF328D13E6} */ +DEFINE_GUID(IID_IDirect3DVolumeTexture9, 0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6); + +/* IID_IDirect3DVertexBuffer9 */ +/* {B64BB1B5-FD70-4df6-BF91-19D0A12455E3} */ +DEFINE_GUID(IID_IDirect3DVertexBuffer9, 0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3); + +/* IID_IDirect3DIndexBuffer9 */ +/* {7C9DD65E-D3F7-4529-ACEE-785830ACDE35} */ +DEFINE_GUID(IID_IDirect3DIndexBuffer9, 0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35); + +/* IID_IDirect3DSurface9 */ +/* {0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B} */ +DEFINE_GUID(IID_IDirect3DSurface9, 0xcfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b); + +/* IID_IDirect3DVolume9 */ +/* {24F416E6-1F67-4aa7-B88E-D33F6F3128A1} */ +DEFINE_GUID(IID_IDirect3DVolume9, 0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1); + +/* IID_IDirect3DSwapChain9 */ +/* {794950F2-ADFC-458a-905E-10A10B0B503B} */ +DEFINE_GUID(IID_IDirect3DSwapChain9, 0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0xb, 0xb, 0x50, 0x3b); + +/* IID_IDirect3DVertexDeclaration9 */ +/* {DD13C59C-36FA-4098-A8FB-C7ED39DC8546} */ +DEFINE_GUID(IID_IDirect3DVertexDeclaration9, 0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46); + +/* IID_IDirect3DVertexShader9 */ +/* {EFC5557E-6265-4613-8A94-43857889EB36} */ +DEFINE_GUID(IID_IDirect3DVertexShader9, 0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36); + +/* IID_IDirect3DPixelShader9 */ +/* {6D3BDBDC-5B02-4415-B852-CE5E8BCCB289} */ +DEFINE_GUID(IID_IDirect3DPixelShader9, 0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89); + +/* IID_IDirect3DStateBlock9 */ +/* {B07C4FE5-310D-4ba8-A23C-4F0F206F218B} */ +DEFINE_GUID(IID_IDirect3DStateBlock9, 0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0xf, 0x20, 0x6f, 0x21, 0x8b); + +/* IID_IDirect3DQuery9 */ +/* {d9771460-a695-4f26-bbd3-27b840b541cc} */ +DEFINE_GUID(IID_IDirect3DQuery9, 0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc); + + +/* IID_HelperName */ +/* {E4A36723-FDFE-4b22-B146-3C04C07F4CC8} */ +DEFINE_GUID(IID_HelperName, 0xe4a36723, 0xfdfe, 0x4b22, 0xb1, 0x46, 0x3c, 0x4, 0xc0, 0x7f, 0x4c, 0xc8); + + +#endif + +#ifdef __cplusplus + +#ifndef DECLSPEC_UUID +#if _MSC_VER >= 1100 +#define DECLSPEC_UUID(x) __declspec(uuid(x)) +#else +#define DECLSPEC_UUID(x) +#endif +#endif + +interface DECLSPEC_UUID("81BDCBCA-64D4-426d-AE8D-AD0147F4275C") IDirect3D9; +interface DECLSPEC_UUID("D0223B96-BF7A-43fd-92BD-A43B0D82B9EB") IDirect3DDevice9; + +interface DECLSPEC_UUID("B07C4FE5-310D-4ba8-A23C-4F0F206F218B") IDirect3DStateBlock9; +interface DECLSPEC_UUID("05EEC05D-8F7D-4362-B999-D1BAF357C704") IDirect3DResource9; +interface DECLSPEC_UUID("DD13C59C-36FA-4098-A8FB-C7ED39DC8546") IDirect3DVertexDeclaration9; +interface DECLSPEC_UUID("EFC5557E-6265-4613-8A94-43857889EB36") IDirect3DVertexShader9; +interface DECLSPEC_UUID("6D3BDBDC-5B02-4415-B852-CE5E8BCCB289") IDirect3DPixelShader9; +interface DECLSPEC_UUID("580CA87E-1D3C-4d54-991D-B7D3E3C298CE") IDirect3DBaseTexture9; +interface DECLSPEC_UUID("85C31227-3DE5-4f00-9B3A-F11AC38C18B5") IDirect3DTexture9; +interface DECLSPEC_UUID("2518526C-E789-4111-A7B9-47EF328D13E6") IDirect3DVolumeTexture9; +interface DECLSPEC_UUID("FFF32F81-D953-473a-9223-93D652ABA93F") IDirect3DCubeTexture9; + +interface DECLSPEC_UUID("B64BB1B5-FD70-4df6-BF91-19D0A12455E3") IDirect3DVertexBuffer9; +interface DECLSPEC_UUID("7C9DD65E-D3F7-4529-ACEE-785830ACDE35") IDirect3DIndexBuffer9; + +interface DECLSPEC_UUID("0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B") IDirect3DSurface9; +interface DECLSPEC_UUID("24F416E6-1F67-4aa7-B88E-D33F6F3128A1") IDirect3DVolume9; + +interface DECLSPEC_UUID("794950F2-ADFC-458a-905E-10A10B0B503B") IDirect3DSwapChain9; +interface DECLSPEC_UUID("d9771460-a695-4f26-bbd3-27b840b541cc") IDirect3DQuery9; + + +#if defined(_COM_SMARTPTR_TYPEDEF) +_COM_SMARTPTR_TYPEDEF(IDirect3D9, __uuidof(IDirect3D9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9, __uuidof(IDirect3DDevice9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DStateBlock9, __uuidof(IDirect3DStateBlock9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DResource9, __uuidof(IDirect3DResource9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexDeclaration9, __uuidof(IDirect3DVertexDeclaration9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexShader9, __uuidof(IDirect3DVertexShader9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DPixelShader9, __uuidof(IDirect3DPixelShader9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DBaseTexture9, __uuidof(IDirect3DBaseTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DTexture9, __uuidof(IDirect3DTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVolumeTexture9, __uuidof(IDirect3DVolumeTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DCubeTexture9, __uuidof(IDirect3DCubeTexture9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexBuffer9, __uuidof(IDirect3DVertexBuffer9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DIndexBuffer9, __uuidof(IDirect3DIndexBuffer9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DSurface9, __uuidof(IDirect3DSurface9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVolume9, __uuidof(IDirect3DVolume9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9, __uuidof(IDirect3DSwapChain9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DQuery9, __uuidof(IDirect3DQuery9)); + +#endif +#endif + + +typedef interface IDirect3D9 IDirect3D9; +typedef interface IDirect3DDevice9 IDirect3DDevice9; +typedef interface IDirect3DStateBlock9 IDirect3DStateBlock9; +typedef interface IDirect3DVertexDeclaration9 IDirect3DVertexDeclaration9; +typedef interface IDirect3DVertexShader9 IDirect3DVertexShader9; +typedef interface IDirect3DPixelShader9 IDirect3DPixelShader9; +typedef interface IDirect3DResource9 IDirect3DResource9; +typedef interface IDirect3DBaseTexture9 IDirect3DBaseTexture9; +typedef interface IDirect3DTexture9 IDirect3DTexture9; +typedef interface IDirect3DVolumeTexture9 IDirect3DVolumeTexture9; +typedef interface IDirect3DCubeTexture9 IDirect3DCubeTexture9; +typedef interface IDirect3DVertexBuffer9 IDirect3DVertexBuffer9; +typedef interface IDirect3DIndexBuffer9 IDirect3DIndexBuffer9; +typedef interface IDirect3DSurface9 IDirect3DSurface9; +typedef interface IDirect3DVolume9 IDirect3DVolume9; +typedef interface IDirect3DSwapChain9 IDirect3DSwapChain9; +typedef interface IDirect3DQuery9 IDirect3DQuery9; + + +#include "d3d9types.h" +#include "d3d9caps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DLL Function for creating a Direct3D9 object. This object supports + * enumeration and allows the creation of Direct3DDevice9 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + */ + +IDirect3D9 * WINAPI Direct3DCreate9(UINT SDKVersion); + +/* + * Stubs for graphics profiling. + */ + +int WINAPI D3DPERF_BeginEvent( D3DCOLOR col, LPCWSTR wszName ); +int WINAPI D3DPERF_EndEvent( void ); +void WINAPI D3DPERF_SetMarker( D3DCOLOR col, LPCWSTR wszName ); +void WINAPI D3DPERF_SetRegion( D3DCOLOR col, LPCWSTR wszName ); +BOOL WINAPI D3DPERF_QueryRepeatFrame( void ); + +void WINAPI D3DPERF_SetOptions( DWORD dwOptions ); +DWORD WINAPI D3DPERF_GetStatus( void ); + +/* + * Direct3D interfaces + */ + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3D9 + +DECLARE_INTERFACE_(IDirect3D9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D9 methods ***/ + STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Version; + #endif +}; + +typedef struct IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D9_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#else +#define IDirect3D9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D9_AddRef(p) (p)->AddRef() +#define IDirect3D9_Release(p) (p)->Release() +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) +#define IDirect3D9_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#endif + + + + + + + +/* SwapChain */ + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice9 + +DECLARE_INTERFACE_(IDirect3DDevice9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice9 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(EvictManagedResources)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE; + STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE; + STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE; + STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE; + STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE; + STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE; + STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE; + STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE; + STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE; + STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE; + STDMETHOD_(float, GetNPatchMode)(THIS) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE; + STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE; + STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE; + STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE; + STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE; + STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; + STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE; + + #ifdef D3D_DEBUG_INFO + D3DDEVICE_CREATION_PARAMETERS CreationParameters; + D3DPRESENT_PARAMETERS PresentParameters; + D3DDISPLAYMODE DisplayMode; + D3DCAPS9 Caps; + + UINT AvailableTextureMem; + UINT SwapChains; + UINT Textures; + UINT VertexBuffers; + UINT IndexBuffers; + UINT VertexShaders; + UINT PixelShaders; + + D3DVIEWPORT9 Viewport; + D3DMATRIX ProjectionMatrix; + D3DMATRIX ViewMatrix; + D3DMATRIX WorldMatrix; + D3DMATRIX TextureMatrices[8]; + + DWORD FVF; + UINT VertexSize; + DWORD VertexShaderVersion; + DWORD PixelShaderVersion; + BOOL SoftwareVertexProcessing; + + D3DMATERIAL9 Material; + D3DLIGHT9 Lights[16]; + BOOL LightsEnabled[16]; + + D3DGAMMARAMP GammaRamp; + RECT ScissorRect; + BOOL DialogBoxMode; + #endif +}; + +typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice9_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) +#define IDirect3DDevice9_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice9_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice9_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) +#define IDirect3DDevice9_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) +#else +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice9_AddRef(p) (p)->AddRef() +#define IDirect3DDevice9_Release(p) (p)->Release() +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice9_EvictManagedResources(p) (p)->EvictManagedResources() +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains() +#define IDirect3DDevice9_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice9_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice9_EndScene(p) (p)->EndScene() +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->SetScissorRect(a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->GetScissorRect(a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing() +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->SetNPatchMode(a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->GetNPatchMode() +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->SetFVF(a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->GetFVF(a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->SetIndices(a) +#define IDirect3DDevice9_GetIndices(p,a) (p)->GetIndices(a) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->DeletePatch(a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->CreateQuery(a,b) +#endif + + +#undef INTERFACE +#define INTERFACE IDirect3DStateBlock9 + +DECLARE_INTERFACE_(IDirect3DStateBlock9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DStateBlock9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(Capture)(THIS) PURE; + STDMETHOD(Apply)(THIS) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DStateBlock9 *LPDIRECT3DSTATEBLOCK9, *PDIRECT3DSTATEBLOCK9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DStateBlock9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DStateBlock9_Capture(p) (p)->lpVtbl->Capture(p) +#define IDirect3DStateBlock9_Apply(p) (p)->lpVtbl->Apply(p) +#else +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->AddRef() +#define IDirect3DStateBlock9_Release(p) (p)->Release() +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DStateBlock9_Capture(p) (p)->Capture() +#define IDirect3DStateBlock9_Apply(p) (p)->Apply() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain9 + +DECLARE_INTERFACE_(IDirect3DSwapChain9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain9 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + + #ifdef D3D_DEBUG_INFO + D3DPRESENT_PARAMETERS PresentParameters; + D3DDISPLAYMODE DisplayMode; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DSwapChain9 *LPDIRECT3DSWAPCHAIN9, *PDIRECT3DSWAPCHAIN9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) +#else +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain9_Release(p) (p)->Release() +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->GetPresentParameters(a) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DResource9 + +DECLARE_INTERFACE_(IDirect3DResource9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; +}; + +typedef struct IDirect3DResource9 *LPDIRECT3DRESOURCE9, *PDIRECT3DRESOURCE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DResource9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource9_GetType(p) (p)->lpVtbl->GetType(p) +#else +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DResource9_AddRef(p) (p)->AddRef() +#define IDirect3DResource9_Release(p) (p)->Release() +#define IDirect3DResource9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DResource9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DResource9_GetPriority(p) (p)->GetPriority() +#define IDirect3DResource9_PreLoad(p) (p)->PreLoad() +#define IDirect3DResource9_GetType(p) (p)->GetType() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexDeclaration9 + +DECLARE_INTERFACE_(IDirect3DVertexDeclaration9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexDeclaration9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9* pElement,UINT* pNumElements) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexDeclaration9 *LPDIRECT3DVERTEXDECLARATION9, *PDIRECT3DVERTEXDECLARATION9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexDeclaration9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->lpVtbl->GetDeclaration(p,a,b) +#else +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexDeclaration9_Release(p) (p)->Release() +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->GetDeclaration(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexShader9 + +DECLARE_INTERFACE_(IDirect3DVertexShader9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexShader9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; + + #ifdef D3D_DEBUG_INFO + DWORD Version; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexShader9 *LPDIRECT3DVERTEXSHADER9, *PDIRECT3DVERTEXSHADER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexShader9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#else +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexShader9_Release(p) (p)->Release() +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DPixelShader9 + +DECLARE_INTERFACE_(IDirect3DPixelShader9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DPixelShader9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; + + #ifdef D3D_DEBUG_INFO + DWORD Version; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DPixelShader9 *LPDIRECT3DPIXELSHADER9, *PDIRECT3DPIXELSHADER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DPixelShader9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#else +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->AddRef() +#define IDirect3DPixelShader9_Release(p) (p)->Release() +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DBaseTexture9 + +DECLARE_INTERFACE_(IDirect3DBaseTexture9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; +}; + +typedef struct IDirect3DBaseTexture9 *LPDIRECT3DBASETEXTURE9, *PDIRECT3DBASETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#else +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DBaseTexture9_Release(p) (p)->Release() +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DBaseTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DBaseTexture9_GetType(p) (p)->GetType() +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DTexture9 + +DECLARE_INTERFACE_(IDirect3DTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface9** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DTexture9 *LPDIRECT3DTEXTURE9, *PDIRECT3DTEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#else +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DTexture9_Release(p) (p)->Release() +#define IDirect3DTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DTexture9_GetType(p) (p)->GetType() +#define IDirect3DTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->UnlockRect(a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->AddDirtyRect(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolumeTexture9 + +DECLARE_INTERFACE_(IDirect3DVolumeTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume9** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Depth; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVolumeTexture9 *LPDIRECT3DVOLUMETEXTURE9, *PDIRECT3DVOLUMETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#else +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DVolumeTexture9_Release(p) (p)->Release() +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DVolumeTexture9_GetType(p) (p)->GetType() +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->UnlockBox(a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->AddDirtyBox(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DCubeTexture9 + +DECLARE_INTERFACE_(IDirect3DCubeTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface9** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DCubeTexture9 *LPDIRECT3DCUBETEXTURE9, *PDIRECT3DCUBETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#else +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DCubeTexture9_Release(p) (p)->Release() +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DCubeTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DCubeTexture9_GetType(p) (p)->GetType() +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->UnlockRect(a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer9 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Length; + DWORD Usage; + DWORD FVF; + D3DPOOL Pool; + DWORD Priority; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexBuffer9 *LPDIRECT3DVERTEXBUFFER9, *PDIRECT3DVERTEXBUFFER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer9_Release(p) (p)->Release() +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->GetPriority() +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->PreLoad() +#define IDirect3DVertexBuffer9_GetType(p) (p)->GetType() +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DIndexBuffer9 + +DECLARE_INTERFACE_(IDirect3DIndexBuffer9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Length; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DIndexBuffer9 *LPDIRECT3DINDEXBUFFER9, *PDIRECT3DINDEXBUFFER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->AddRef() +#define IDirect3DIndexBuffer9_Release(p) (p)->Release() +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->GetPriority() +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->PreLoad() +#define IDirect3DIndexBuffer9_GetType(p) (p)->GetType() +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->Unlock() +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSurface9 + +DECLARE_INTERFACE_(IDirect3DSurface9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS) PURE; + STDMETHOD(GetDC)(THIS_ HDC *phdc) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC hdc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + D3DMULTISAMPLE_TYPE MultiSampleType; + DWORD MultiSampleQuality; + DWORD Priority; + UINT LockCount; + UINT DCCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DSurface9 *LPDIRECT3DSURFACE9, *PDIRECT3DSURFACE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSurface9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DSurface9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DSurface9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DSurface9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#define IDirect3DSurface9_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#else +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSurface9_AddRef(p) (p)->AddRef() +#define IDirect3DSurface9_Release(p) (p)->Release() +#define IDirect3DSurface9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DSurface9_GetPriority(p) (p)->GetPriority() +#define IDirect3DSurface9_PreLoad(p) (p)->PreLoad() +#define IDirect3DSurface9_GetType(p) (p)->GetType() +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->LockRect(a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->UnlockRect() +#define IDirect3DSurface9_GetDC(p,a) (p)->GetDC(a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->ReleaseDC(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolume9 + +DECLARE_INTERFACE_(IDirect3DVolume9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVolume9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Depth; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVolume9 *LPDIRECT3DVOLUME9, *PDIRECT3DVOLUME9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolume9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#else +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolume9_AddRef(p) (p)->AddRef() +#define IDirect3DVolume9_Release(p) (p)->Release() +#define IDirect3DVolume9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->LockBox(a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->UnlockBox() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DQuery9 + +DECLARE_INTERFACE_(IDirect3DQuery9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DQuery9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD_(D3DQUERYTYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, GetDataSize)(THIS) PURE; + STDMETHOD(Issue)(THIS_ DWORD dwIssueFlags) PURE; + STDMETHOD(GetData)(THIS_ void* pData,DWORD dwSize,DWORD dwGetDataFlags) PURE; + + #ifdef D3D_DEBUG_INFO + D3DQUERYTYPE Type; + DWORD DataSize; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DQuery9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DQuery9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DQuery9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DQuery9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DQuery9_GetDataSize(p) (p)->lpVtbl->GetDataSize(p) +#define IDirect3DQuery9_Issue(p,a) (p)->lpVtbl->Issue(p,a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c) +#else +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DQuery9_AddRef(p) (p)->AddRef() +#define IDirect3DQuery9_Release(p) (p)->Release() +#define IDirect3DQuery9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DQuery9_GetType(p) (p)->GetType() +#define IDirect3DQuery9_GetDataSize(p) (p)->GetDataSize() +#define IDirect3DQuery9_Issue(p,a) (p)->Issue(a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->GetData(a,b,c) +#endif + + +/**************************************************************************** + * Flags for SetPrivateData method on all D3D9 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D9 object is freed. + ****************************************************************************/ +#define D3DSPD_IUNKNOWN 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3D9::CreateDevice's BehaviorFlags + * + ****************************************************************************/ + +#define D3DCREATE_FPU_PRESERVE 0x00000002L +#define D3DCREATE_MULTITHREADED 0x00000004L + +#define D3DCREATE_PUREDEVICE 0x00000010L +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L + +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L +#define D3DCREATE_ADAPTERGROUP_DEVICE 0x00000200L +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX 0x00000400L + +// This flag causes the D3D runtime not to alter the focus +// window in any way. Use with caution- the burden of supporting +// focus management events (alt-tab, etc.) falls on the +// application, and appropriate responses (switching display +// mode, etc.) should be coded. +#define D3DCREATE_NOWINDOWCHANGES 0x00000800L + + +/**************************************************************************** + * + * Parameter for IDirect3D9::CreateDevice's Adapter argument + * + ****************************************************************************/ + +#define D3DADAPTER_DEFAULT 0 + +/**************************************************************************** + * + * Flags for IDirect3D9::EnumAdapters + * + ****************************************************************************/ + +#define D3DENUM_WHQL_LEVEL 0x00000002L + +/**************************************************************************** + * + * Maximum number of back-buffers supported in DX9 + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX 3L + +/**************************************************************************** + * + * Flags for IDirect3DDevice9::SetGammaRamp + * + ****************************************************************************/ + +#define D3DSGR_NO_CALIBRATION 0x00000000L +#define D3DSGR_CALIBRATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DDevice9::SetCursorPosition + * + ****************************************************************************/ + +#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DSwapChain9::Present + * + ****************************************************************************/ + +#define D3DPRESENT_DONOTWAIT 0x00000001L +#define D3DPRESENT_LINEAR_CONTENT 0x00000002L + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + + +/* + * DirectDraw error codes + */ +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) + +/* + * Direct3D Errors + */ +#define D3D_OK S_OK + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) + +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) +#define D3DOK_NOAUTOGEN MAKE_D3DSTATUS(2159) + + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _D3D_H_ */ + diff --git a/saco/d3d9/include/d3d9caps.h b/saco/d3d9/include/d3d9caps.h new file mode 100644 index 0000000..6489f0e --- /dev/null +++ b/saco/d3d9/include/d3d9caps.h @@ -0,0 +1,476 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9caps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _d3d9CAPS_H +#define _d3d9CAPS_H + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + +#if defined(_X86_) || defined(_IA64) +#pragma pack(4) +#endif + +typedef struct _D3DVSHADERCAPS2_0 +{ + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; +} D3DVSHADERCAPS2_0; + +#define D3DVS20CAPS_PREDICATION (1<<0) + +#define D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define D3DVS20_MAX_NUMTEMPS 32 +#define D3DVS20_MIN_NUMTEMPS 12 +#define D3DVS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define D3DVS20_MIN_STATICFLOWCONTROLDEPTH 1 + +typedef struct _D3DPSHADERCAPS2_0 +{ + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; + INT NumInstructionSlots; +} D3DPSHADERCAPS2_0; + +#define D3DPS20CAPS_ARBITRARYSWIZZLE (1<<0) +#define D3DPS20CAPS_GRADIENTINSTRUCTIONS (1<<1) +#define D3DPS20CAPS_PREDICATION (1<<2) +#define D3DPS20CAPS_NODEPENDENTREADLIMIT (1<<3) +#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT (1<<4) + +#define D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define D3DPS20_MAX_NUMTEMPS 32 +#define D3DPS20_MIN_NUMTEMPS 12 +#define D3DPS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define D3DPS20_MIN_STATICFLOWCONTROLDEPTH 0 +#define D3DPS20_MAX_NUMINSTRUCTIONSLOTS 512 +#define D3DPS20_MIN_NUMINSTRUCTIONSLOTS 96 + +#define D3DMIN30SHADERINSTRUCTIONS 512 +#define D3DMAX30SHADERINSTRUCTIONS 32768 + +typedef struct _D3DCAPS9 +{ + /* Device Info */ + D3DDEVTYPE DeviceType; + UINT AdapterOrdinal; + + /* Caps from DX7 Draw */ + DWORD Caps; + DWORD Caps2; + DWORD Caps3; + DWORD PresentationIntervals; + + /* Cursor Caps */ + DWORD CursorCaps; + + /* 3D Device Caps */ + DWORD DevCaps; + + DWORD PrimitiveMiscCaps; + DWORD RasterCaps; + DWORD ZCmpCaps; + DWORD SrcBlendCaps; + DWORD DestBlendCaps; + DWORD AlphaCmpCaps; + DWORD ShadeCaps; + DWORD TextureCaps; + DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's + DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture9's + DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture9's + DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture9's + DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture9's + + DWORD LineCaps; // D3DLINECAPS + + DWORD MaxTextureWidth, MaxTextureHeight; + DWORD MaxVolumeExtent; + + DWORD MaxTextureRepeat; + DWORD MaxTextureAspectRatio; + DWORD MaxAnisotropy; + float MaxVertexW; + + float GuardBandLeft; + float GuardBandTop; + float GuardBandRight; + float GuardBandBottom; + + float ExtentsAdjust; + DWORD StencilCaps; + + DWORD FVFCaps; + DWORD TextureOpCaps; + DWORD MaxTextureBlendStages; + DWORD MaxSimultaneousTextures; + + DWORD VertexProcessingCaps; + DWORD MaxActiveLights; + DWORD MaxUserClipPlanes; + DWORD MaxVertexBlendMatrices; + DWORD MaxVertexBlendMatrixIndex; + + float MaxPointSize; + + DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call + DWORD MaxVertexIndex; + DWORD MaxStreams; + DWORD MaxStreamStride; // max stride for SetStreamSource + + DWORD VertexShaderVersion; + DWORD MaxVertexShaderConst; // number of vertex shader constant registers + + DWORD PixelShaderVersion; + float PixelShader1xMaxValue; // max value storable in registers of ps.1.x shaders + + // Here are the DX9 specific ones + DWORD DevCaps2; + + float MaxNpatchTessellationLevel; + DWORD Reserved5; + + UINT MasterAdapterOrdinal; // ordinal of master adaptor for adapter group + UINT AdapterOrdinalInGroup; // ordinal inside the adapter group + UINT NumberOfAdaptersInGroup; // number of adapters in this adapter group (only if master) + DWORD DeclTypes; // Data types, supported in vertex declarations + DWORD NumSimultaneousRTs; // Will be at least 1 + DWORD StretchRectFilterCaps; // Filter caps supported by StretchRect + D3DVSHADERCAPS2_0 VS20Caps; + D3DPSHADERCAPS2_0 PS20Caps; + DWORD VertexTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's for texture, used in vertex shaders + DWORD MaxVShaderInstructionsExecuted; // maximum number of vertex shader instructions that can be executed + DWORD MaxPShaderInstructionsExecuted; // maximum number of pixel shader instructions that can be executed + DWORD MaxVertexShader30InstructionSlots; + DWORD MaxPixelShader30InstructionSlots; +} D3DCAPS9; + +// +// BIT DEFINES FOR D3DCAPS9 DWORD MEMBERS +// + +// +// Caps +// +#define D3DCAPS_READ_SCANLINE 0x00020000L + +// +// Caps2 +// +#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L +#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L +#define D3DCAPS2_RESERVED 0x02000000L +#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L +#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L +#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000L + +// +// Caps3 +// +#define D3DCAPS3_RESERVED 0x8000001fL + +// Indicates that the device can respect the ALPHABLENDENABLE render state +// when fullscreen while using the FLIP or DISCARD swap effect. +// COPY and COPYVSYNC swap effects work whether or not this flag is set. +#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L + +// Indicates that the device can perform a gamma correction from +// a windowed back buffer containing linear content to the sRGB desktop. +#define D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080L + +#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100L /* Device can acclerate copies from sysmem to local vidmem */ +#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200L /* Device can acclerate copies from local vidmem to sysmem */ + + +// +// PresentationIntervals +// +#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L +#define D3DPRESENT_INTERVAL_ONE 0x00000001L +#define D3DPRESENT_INTERVAL_TWO 0x00000002L +#define D3DPRESENT_INTERVAL_THREE 0x00000004L +#define D3DPRESENT_INTERVAL_FOUR 0x00000008L +#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L + +// +// CursorCaps +// +// Driver supports HW color cursor in at least hi-res modes(height >=400) +#define D3DCURSORCAPS_COLOR 0x00000001L +// Driver supports HW cursor also in low-res modes(height < 400) +#define D3DCURSORCAPS_LOWRES 0x00000002L + +// +// DevCaps +// +#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 */ +#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 */ +#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*/ +#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 */ +#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */ +#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */ +#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */ +#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */ +#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */ + +// +// PrimitiveMiscCaps +// +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L +#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L +#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */ +#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */ +#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */ +#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */ +#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */ +#define D3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000L /* Device supports independent write masks for MET or MRT */ +#define D3DPMISCCAPS_PERSTAGECONSTANT 0x00008000L /* Device supports per-stage constants */ +#define D3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000L /* Device supports separate fog and specular alpha (many devices + use the specular alpha channel to store fog factor) */ +#define D3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000L /* Device supports separate blend settings for the alpha channel */ +#define D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000L /* Device supports different bit depths for MRT */ +#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000L /* Device supports post-pixel shader operations for MRT */ +#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000L /* Device clamps fog blend factor per vertex */ + +// +// LineCaps +// +#define D3DLINECAPS_TEXTURE 0x00000001L +#define D3DLINECAPS_ZTEST 0x00000002L +#define D3DLINECAPS_BLEND 0x00000004L +#define D3DLINECAPS_ALPHACMP 0x00000008L +#define D3DLINECAPS_FOG 0x00000010L +#define D3DLINECAPS_ANTIALIAS 0x00000020L + +// +// RasterCaps +// +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L +#define D3DPRASTERCAPS_FOGRANGE 0x00010000L +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L +#define D3DPRASTERCAPS_WBUFFER 0x00040000L +#define D3DPRASTERCAPS_WFOG 0x00100000L +#define D3DPRASTERCAPS_ZFOG 0x00200000L +#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */ +#define D3DPRASTERCAPS_SCISSORTEST 0x01000000L +#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000L +#define D3DPRASTERCAPS_DEPTHBIAS 0x04000000L +#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000L + +// +// ZCmpCaps, AlphaCmpCaps +// +#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 + +// +// SourceBlendCaps, DestBlendCaps +// +#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 +#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000L /* Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR */ + +// +// ShadeCaps +// +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L + +// +// TextureCaps +// +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */ +#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */ +#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */ +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */ +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */ +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */ +// 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 +#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */ +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */ +#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */ +#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */ +#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */ +#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */ +#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000L /* Device does not support projected bump env lookup operation + in programmable and fixed function pixel shaders */ + +// +// TextureFilterCaps, StretchRectFilterCaps +// +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */ +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L +#define D3DPTFILTERCAPS_MINFPYRAMIDALQUAD 0x00000800L +#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD 0x00001000L +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */ +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */ +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000L + +// +// TextureAddressCaps +// +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L +#define D3DPTADDRESSCAPS_BORDER 0x00000008L +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L +#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L + +// +// StencilCaps +// +#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 +#define D3DSTENCILCAPS_TWOSIDED 0x00000100L + +// +// TextureOpCaps +// +#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 +#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L +#define D3DTEXOPCAPS_LERP 0x02000000L + +// +// FVFCaps +// +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ +#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */ + +// +// VertexProcessingCaps +// +#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */ +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */ +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */ +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */ +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */ +#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */ +#define D3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100L /* device supports D3DTSS_TCI_SPHEREMAP */ +#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200L /* device does not support TexGen in non-local + viewer mode */ + +// +// DevCaps2 +// +#define D3DDEVCAPS2_STREAMOFFSET 0x00000001L /* Device supports offsets in streams. Must be set by DX9 drivers */ +#define D3DDEVCAPS2_DMAPNPATCH 0x00000002L /* Device supports displacement maps for N-Patches*/ +#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004L /* Device supports adaptive tesselation of RT-patches*/ +#define D3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008L /* Device supports adaptive tesselation of N-patches*/ +#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010L /* Device supports StretchRect calls with a texture as the source*/ +#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020L /* Device supports presampled displacement maps for N-Patches */ +#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040L /* Vertex elements in a vertex declaration can share the same stream offset */ + +// +// DeclTypes +// +#define D3DDTCAPS_UBYTE4 0x00000001L +#define D3DDTCAPS_UBYTE4N 0x00000002L +#define D3DDTCAPS_SHORT2N 0x00000004L +#define D3DDTCAPS_SHORT4N 0x00000008L +#define D3DDTCAPS_USHORT2N 0x00000010L +#define D3DDTCAPS_USHORT4N 0x00000020L +#define D3DDTCAPS_UDEC3 0x00000040L +#define D3DDTCAPS_DEC3N 0x00000080L +#define D3DDTCAPS_FLOAT16_2 0x00000100L +#define D3DDTCAPS_FLOAT16_4 0x00000200L + + +#pragma pack() + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _d3d9CAPS_H_ */ + diff --git a/saco/d3d9/include/d3d9types.h b/saco/d3d9/include/d3d9types.h new file mode 100644 index 0000000..4c2108f --- /dev/null +++ b/saco/d3d9/include/d3d9types.h @@ -0,0 +1,1855 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _d3d9TYPES_H_ +#define _d3d9TYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + +#include + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64) +#pragma pack(4) +#endif + +// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +// maps unsigned 8 bits/channel to D3DCOLOR +#define D3DCOLOR_ARGB(a,r,g,b) \ + ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) + +#define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xff,y,u,v) +#define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) + +// maps floating point channels (0.f to 1.f range) to D3DCOLOR +#define D3DCOLOR_COLORVALUE(r,g,b,a) \ + D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) + + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + float r; + float g; + float b; + float a; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + LONG x1; + LONG y1; + LONG x2; + LONG y2; +} D3DRECT; +#define D3DRECT_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +typedef struct _D3DVIEWPORT9 { + DWORD X; + DWORD Y; /* Viewport Top left */ + DWORD Width; + DWORD Height; /* Viewport Dimensions */ + float MinZ; /* Min/max of clip Volume */ + float MaxZ; +} D3DVIEWPORT9; + +/* + * Values for clip fields. + */ + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRS_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) + +// The following bits are used in the ClipUnion and ClipIntersection +// members of the D3DCLIPSTATUS9 +// + +#define D3DCS_LEFT 0x00000001L +#define D3DCS_RIGHT 0x00000002L +#define D3DCS_TOP 0x00000004L +#define D3DCS_BOTTOM 0x00000008L +#define D3DCS_FRONT 0x00000010L +#define D3DCS_BACK 0x00000020L +#define D3DCS_PLANE0 0x00000040L +#define D3DCS_PLANE1 0x00000080L +#define D3DCS_PLANE2 0x00000100L +#define D3DCS_PLANE3 0x00000200L +#define D3DCS_PLANE4 0x00000400L +#define D3DCS_PLANE5 0x00000800L + +#define D3DCS_ALL (D3DCS_LEFT | \ + D3DCS_RIGHT | \ + D3DCS_TOP | \ + D3DCS_BOTTOM | \ + D3DCS_FRONT | \ + D3DCS_BACK | \ + D3DCS_PLANE0 | \ + D3DCS_PLANE1 | \ + D3DCS_PLANE2 | \ + D3DCS_PLANE3 | \ + D3DCS_PLANE4 | \ + D3DCS_PLANE5) + +typedef struct _D3DCLIPSTATUS9 { + DWORD ClipUnion; + DWORD ClipIntersection; +} D3DCLIPSTATUS9; + +typedef struct _D3DMATERIAL9 { + D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE Ambient; /* Ambient color RGB */ + D3DCOLORVALUE Specular; /* Specular 'shininess' */ + D3DCOLORVALUE Emissive; /* Emissive color RGB */ + float Power; /* Sharpness if specular highlight */ +} D3DMATERIAL9; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +typedef struct _D3DLIGHT9 { + D3DLIGHTTYPE Type; /* Type of light source */ + D3DCOLORVALUE Diffuse; /* Diffuse color of light */ + D3DCOLORVALUE Specular; /* Specular color of light */ + D3DCOLORVALUE Ambient; /* Ambient color of light */ + D3DVECTOR Position; /* Position in world space */ + D3DVECTOR Direction; /* Direction in world space */ + float Range; /* Cutoff range */ + float Falloff; /* Falloff */ + float Attenuation0; /* Constant attenuation */ + float Attenuation1; /* Linear attenuation */ + float Attenuation2; /* Quadratic attenuation */ + float Theta; /* Inner angle of spotlight cone */ + float Phi; /* Outer angle of spotlight cone */ +} D3DLIGHT9; + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ + +/* + * The following defines the rendering states + */ + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFILLMODE; + +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, + D3DBLEND_BLENDFACTOR = 14, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ + D3DBLEND_INVBLENDFACTOR = 15, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLEND; + +typedef enum _D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, + D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLENDOP; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} 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, + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCMPFUNC; + +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; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFOGMODE; + +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; + +// 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; + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, + D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTRANSFORMSTATETYPE; + +#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) +#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) +#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) +#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + +typedef enum _D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRS_FILLMODE = 8, /* D3DFILLMODE */ + D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRS_SRCBLEND = 19, /* D3DBLEND */ + D3DRS_DESTBLEND = 20, /* D3DBLEND */ + D3DRS_CULLMODE = 22, /* D3DCULL */ + D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRS_ALPHAREF = 24, /* D3DFIXED */ + D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ + D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ + D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ + D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRS_FOGEND = 37, /* Fog end */ + D3DRS_FOGDENSITY = 38, /* Fog density */ + D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ + D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ + D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_POINTSIZE = 154, /* float point size */ + D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ + D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ + D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ + D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ + D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ + D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONDEGREE = 172, // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default) + D3DRS_NORMALDEGREE = 173, // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC + D3DRS_SCISSORTESTENABLE = 174, + D3DRS_SLOPESCALEDEPTHBIAS = 175, + D3DRS_ANTIALIASEDLINEENABLE = 176, + D3DRS_MINTESSELLATIONLEVEL = 178, + D3DRS_MAXTESSELLATIONLEVEL = 179, + D3DRS_ADAPTIVETESS_X = 180, + D3DRS_ADAPTIVETESS_Y = 181, + D3DRS_ADAPTIVETESS_Z = 182, + D3DRS_ADAPTIVETESS_W = 183, + D3DRS_ENABLEADAPTIVETESSELLATION = 184, + D3DRS_TWOSIDEDSTENCILMODE = 185, /* BOOL enable/disable 2 sided stenciling */ + D3DRS_CCW_STENCILFAIL = 186, /* D3DSTENCILOP to do if ccw stencil test fails */ + D3DRS_CCW_STENCILZFAIL = 187, /* D3DSTENCILOP to do if ccw stencil test passes and Z test fails */ + D3DRS_CCW_STENCILPASS = 188, /* D3DSTENCILOP to do if both ccw stencil and Z tests pass */ + D3DRS_CCW_STENCILFUNC = 189, /* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_COLORWRITEENABLE1 = 190, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_COLORWRITEENABLE2 = 191, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_COLORWRITEENABLE3 = 192, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_BLENDFACTOR = 193, /* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR */ + D3DRS_SRGBWRITEENABLE = 194, /* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) */ + D3DRS_DEPTHBIAS = 195, + D3DRS_WRAP8 = 198, /* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD */ + D3DRS_WRAP9 = 199, + D3DRS_WRAP10 = 200, + D3DRS_WRAP11 = 201, + D3DRS_WRAP12 = 202, + D3DRS_WRAP13 = 203, + D3DRS_WRAP14 = 204, + D3DRS_WRAP15 = 205, + D3DRS_SEPARATEALPHABLENDENABLE = 206, /* TRUE to enable a separate blending function for the alpha channel */ + D3DRS_SRCBLENDALPHA = 207, /* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + D3DRS_DESTBLENDALPHA = 208, /* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + D3DRS_BLENDOPALPHA = 209, /* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + + + D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DRENDERSTATETYPE; + +// Maximum number of simultaneous render targets D3D supports +#define D3D_MAX_SIMULTANEOUS_RENDERTARGETS 4 + +// 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; + +// 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 +#define D3DWRAP_W 0x00000004L + +/* 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 // same as D3DWRAP_W +#define D3DWRAPCOORD_3 0x00000008L + +/* Flags to construct D3DRS_COLORWRITEENABLE */ +#define D3DCOLORWRITEENABLE_RED (1L<<0) +#define D3DCOLORWRITEENABLE_GREEN (1L<<1) +#define D3DCOLORWRITEENABLE_BLUE (1L<<2) +#define D3DCOLORWRITEENABLE_ALPHA (1L<<3) + +/* + * State enumerants for per-stage processing of fixed function pixel processing + * Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX. + */ +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, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ + D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ + D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ + D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ + D3DTSS_CONSTANT = 32, /* Per-stage constant D3DTA_CONSTANT */ + + + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +/* + * State enumerants for per-sampler texture processing. + */ +typedef enum _D3DSAMPLERSTATETYPE +{ + D3DSAMP_ADDRESSU = 1, /* D3DTEXTUREADDRESS for U coordinate */ + D3DSAMP_ADDRESSV = 2, /* D3DTEXTUREADDRESS for V coordinate */ + D3DSAMP_ADDRESSW = 3, /* D3DTEXTUREADDRESS for W coordinate */ + D3DSAMP_BORDERCOLOR = 4, /* D3DCOLOR */ + D3DSAMP_MAGFILTER = 5, /* D3DTEXTUREFILTER filter to use for magnification */ + D3DSAMP_MINFILTER = 6, /* D3DTEXTUREFILTER filter to use for minification */ + D3DSAMP_MIPFILTER = 7, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ + D3DSAMP_MIPMAPLODBIAS = 8, /* float Mipmap LOD bias */ + D3DSAMP_MAXMIPLEVEL = 9, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ + D3DSAMP_MAXANISOTROPY = 10, /* DWORD maximum anisotropy */ + D3DSAMP_SRGBTEXTURE = 11, /* Default = 0 (which means Gamma 1.0, + no correction required.) else correct for + Gamma = 2.2 */ + D3DSAMP_ELEMENTINDEX = 12, /* When multi-element texture is assigned to sampler, this + indicates which element index to use. Default = 0. */ + D3DSAMP_DMAPOFFSET = 13, /* Offset in vertices in the pre-sampled displacement map. + Only valid for D3DDMAPSAMPLER sampler */ + D3DSAMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSAMPLERSTATETYPE; + +/* Special sampler which is used in the tesselator */ +#define D3DDMAPSAMPLER 256 + +// Samplers used in vertex shaders +#define D3DVERTEXTEXTURESAMPLER0 (D3DDMAPSAMPLER+1) +#define D3DVERTEXTEXTURESAMPLER1 (D3DDMAPSAMPLER+2) +#define D3DVERTEXTEXTURESAMPLER2 (D3DDMAPSAMPLER+3) +#define D3DVERTEXTEXTURESAMPLER3 (D3DDMAPSAMPLER+4) + +// 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 +#define D3DTSS_TCI_SPHEREMAP 0x00040000 + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + */ +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 D3DRS_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, + + // Triadic ops + D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 + D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG 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 (read only) +#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) +#define D3DTA_TEXTURE 0x00000002 // select texture color (read only) +#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) +#define D3DTA_SPECULAR 0x00000004 // select specular color (read only) +#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) +#define D3DTA_CONSTANT 0x00000006 // select texture stage constant +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) + +// +// Values for D3DSAMP_***FILTER texture stage states +// +typedef enum _D3DTEXTUREFILTERTYPE +{ + D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) + D3DTEXF_POINT = 1, // nearest + D3DTEXF_LINEAR = 2, // linear interpolation + D3DTEXF_ANISOTROPIC = 3, // anisotropic + D3DTEXF_PYRAMIDALQUAD = 6, // 4-sample tent + D3DTEXF_GAUSSIANQUAD = 7, // 4-sample gaussian + D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREFILTERTYPE; + +/* Bits for Flags in ProcessVertices call */ + +#define D3DPV_DONOTCOPYDATA (1 << 0) + +//------------------------------------------------------------------- + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x400E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e +#define D3DFVF_XYZW 0x4002 + +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_PSIZE 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_LASTBETA_UBYTE4 0x1000 +#define D3DFVF_LASTBETA_D3DCOLOR 0x8000 + +#define D3DFVF_RESERVED2 0x6000 // 2 reserved bits + +//--------------------------------------------------------------------- +// Vertex Shaders +// + +// Vertex shader declaration + +// Vertex element semantics +// +typedef enum _D3DDECLUSAGE +{ + D3DDECLUSAGE_POSITION = 0, + D3DDECLUSAGE_BLENDWEIGHT, // 1 + D3DDECLUSAGE_BLENDINDICES, // 2 + D3DDECLUSAGE_NORMAL, // 3 + D3DDECLUSAGE_PSIZE, // 4 + D3DDECLUSAGE_TEXCOORD, // 5 + D3DDECLUSAGE_TANGENT, // 6 + D3DDECLUSAGE_BINORMAL, // 7 + D3DDECLUSAGE_TESSFACTOR, // 8 + D3DDECLUSAGE_POSITIONT, // 9 + D3DDECLUSAGE_COLOR, // 10 + D3DDECLUSAGE_FOG, // 11 + D3DDECLUSAGE_DEPTH, // 12 + D3DDECLUSAGE_SAMPLE, // 13 +} D3DDECLUSAGE; + +#define MAXD3DDECLUSAGE D3DDECLUSAGE_SAMPLE +#define MAXD3DDECLUSAGEINDEX 15 +#define MAXD3DDECLLENGTH 64 // does not include "end" marker vertex element + +typedef enum _D3DDECLMETHOD +{ + D3DDECLMETHOD_DEFAULT = 0, + D3DDECLMETHOD_PARTIALU, + D3DDECLMETHOD_PARTIALV, + D3DDECLMETHOD_CROSSUV, // Normal + D3DDECLMETHOD_UV, + D3DDECLMETHOD_LOOKUP, // Lookup a displacement map + D3DDECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map +} D3DDECLMETHOD; + +#define MAXD3DDECLMETHOD D3DDECLMETHOD_LOOKUPPRESAMPLED + +// Declarations for _Type fields +// +typedef enum _D3DDECLTYPE +{ + D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.) + D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.) + D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.) + D3DDECLTYPE_FLOAT4 = 3, // 4D float + D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) + D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned byte + D3DDECLTYPE_SHORT2 = 6, // 2D signed short expanded to (value, value, 0., 1.) + D3DDECLTYPE_SHORT4 = 7, // 4D signed short + +// The following types are valid only with vertex shaders >= 2.0 + + + D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0 + D3DDECLTYPE_SHORT2N = 9, // 2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1) + D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) + D3DDECLTYPE_USHORT2N = 11, // 2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1) + D3DDECLTYPE_USHORT4N = 12, // 4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0) + D3DDECLTYPE_UDEC3 = 13, // 3D unsigned 10 10 10 format expanded to (value, value, value, 1) + D3DDECLTYPE_DEC3N = 14, // 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1) + D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1) + D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values + D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused. +} D3DDECLTYPE; + +#define MAXD3DDECLTYPE D3DDECLTYPE_UNUSED + +typedef struct _D3DVERTEXELEMENT9 +{ + WORD Stream; // Stream index + WORD Offset; // Offset in the stream in bytes + BYTE Type; // Data type + BYTE Method; // Processing method + BYTE Usage; // Semantics + BYTE UsageIndex; // Semantic index +} D3DVERTEXELEMENT9, *LPD3DVERTEXELEMENT9; + +// This is used to initialize the last vertex element in a vertex declaration +// array +// +#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0} + +// Maximum supported number of texture coordinate sets +#define D3DDP_MAXTEXCOORD 8 + +//--------------------------------------------------------------------- +// Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter +//--------------------------------------------------------------------- +#define D3DSTREAMSOURCE_INDEXEDDATA (1<<30) +#define D3DSTREAMSOURCE_INSTANCEDATA (2<<30) + + + +//--------------------------------------------------------------------- +// +// The internal format of Pixel Shader (PS) & Vertex Shader (VS) +// Instruction Tokens is defined in the Direct3D Device Driver Kit +// +//--------------------------------------------------------------------- + +// +// Instruction Token Bit Definitions +// +#define D3DSI_OPCODE_MASK 0x0000FFFF + +#define D3DSI_INSTLENGTH_MASK 0x0F000000 +#define D3DSI_INSTLENGTH_SHIFT 24 + +typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE +{ + D3DSIO_NOP = 0, + D3DSIO_MOV , + D3DSIO_ADD , + D3DSIO_SUB , + D3DSIO_MAD , + D3DSIO_MUL , + D3DSIO_RCP , + D3DSIO_RSQ , + D3DSIO_DP3 , + D3DSIO_DP4 , + D3DSIO_MIN , + D3DSIO_MAX , + D3DSIO_SLT , + D3DSIO_SGE , + D3DSIO_EXP , + D3DSIO_LOG , + D3DSIO_LIT , + D3DSIO_DST , + D3DSIO_LRP , + D3DSIO_FRC , + D3DSIO_M4x4 , + D3DSIO_M4x3 , + D3DSIO_M3x4 , + D3DSIO_M3x3 , + D3DSIO_M3x2 , + D3DSIO_CALL , + D3DSIO_CALLNZ , + D3DSIO_LOOP , + D3DSIO_RET , + D3DSIO_ENDLOOP , + D3DSIO_LABEL , + D3DSIO_DCL , + D3DSIO_POW , + D3DSIO_CRS , + D3DSIO_SGN , + D3DSIO_ABS , + D3DSIO_NRM , + D3DSIO_SINCOS , + D3DSIO_REP , + D3DSIO_ENDREP , + D3DSIO_IF , + D3DSIO_IFC , + D3DSIO_ELSE , + D3DSIO_ENDIF , + D3DSIO_BREAK , + D3DSIO_BREAKC , + D3DSIO_MOVA , + D3DSIO_DEFB , + D3DSIO_DEFI , + + D3DSIO_TEXCOORD = 64, + D3DSIO_TEXKILL , + D3DSIO_TEX , + D3DSIO_TEXBEM , + D3DSIO_TEXBEML , + D3DSIO_TEXREG2AR , + D3DSIO_TEXREG2GB , + D3DSIO_TEXM3x2PAD , + D3DSIO_TEXM3x2TEX , + D3DSIO_TEXM3x3PAD , + D3DSIO_TEXM3x3TEX , + D3DSIO_RESERVED0 , + D3DSIO_TEXM3x3SPEC , + D3DSIO_TEXM3x3VSPEC , + D3DSIO_EXPP , + D3DSIO_LOGP , + D3DSIO_CND , + D3DSIO_DEF , + D3DSIO_TEXREG2RGB , + D3DSIO_TEXDP3TEX , + D3DSIO_TEXM3x2DEPTH , + D3DSIO_TEXDP3 , + D3DSIO_TEXM3x3 , + D3DSIO_TEXDEPTH , + D3DSIO_CMP , + D3DSIO_BEM , + D3DSIO_DP2ADD , + D3DSIO_DSX , + D3DSIO_DSY , + D3DSIO_TEXLDD , + D3DSIO_SETP , + D3DSIO_TEXLDL , + D3DSIO_BREAKP , + + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, + + D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +//--------------------------------------------------------------------- +// Use these constants with D3DSIO_SINCOS macro as SRC2, SRC3 +// +#define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f +#define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f + +//--------------------------------------------------------------------- +// Co-Issue Instruction Modifier - if set then this instruction is to be +// issued in parallel with the previous instruction(s) for which this bit +// is not set. +// +#define D3DSI_COISSUE 0x40000000 + +//--------------------------------------------------------------------- +// Opcode specific controls + +#define D3DSP_OPCODESPECIFICCONTROL_MASK 0x00ff0000 +#define D3DSP_OPCODESPECIFICCONTROL_SHIFT 16 + +// ps_2_0 texld controls +#define D3DSI_TEXLD_PROJECT (0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) +#define D3DSI_TEXLD_BIAS (0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) + +// Comparison for dynamic conditional instruction opcodes (i.e. if, breakc) +typedef enum _D3DSHADER_COMPARISON +{ + // < = > + D3DSPC_RESERVED0= 0, // 0 0 0 + D3DSPC_GT = 1, // 0 0 1 + D3DSPC_EQ = 2, // 0 1 0 + D3DSPC_GE = 3, // 0 1 1 + D3DSPC_LT = 4, // 1 0 0 + D3DSPC_NE = 5, // 1 0 1 + D3DSPC_LE = 6, // 1 1 0 + D3DSPC_RESERVED1= 7 // 1 1 1 +} D3DSHADER_COMPARISON; + +// Comparison is part of instruction opcode token: +#define D3DSHADER_COMPARISON_SHIFT D3DSP_OPCODESPECIFICCONTROL_SHIFT +#define D3DSHADER_COMPARISON_MASK (0x7<>8)&0xFF) +#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) + +// destination/source parameter register type +#define D3DSI_COMMENTSIZE_SHIFT 16 +#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 +#define D3DSHADER_COMMENT(_DWordSize) \ + ((((_DWordSize)<= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _d3d9TYPES(P)_H_ */ + diff --git a/saco/d3d9/include/d3dcaps.h b/saco/d3d9/include/d3dcaps.h new file mode 100644 index 0000000..6066c7a --- /dev/null +++ b/saco/d3d9/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/saco/d3d9/include/d3dfont.h b/saco/d3d9/include/d3dfont.h new file mode 100644 index 0000000..d8fa24f --- /dev/null +++ b/saco/d3d9/include/d3dfont.h @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// File: D3DFont.h +// +// Desc: Texture-based font class +// +// Copyright (c) Microsoft Corporation. All rights reserved. +//----------------------------------------------------------------------------- +#ifndef D3DFONT_H +#define D3DFONT_H +#include +#include + + +// Font creation flags +#define D3DFONT_BOLD 0x0001 +#define D3DFONT_ITALIC 0x0002 +#define D3DFONT_ZENABLE 0x0004 + +// Font rendering flags +#define D3DFONT_CENTERED_X 0x0001 +#define D3DFONT_CENTERED_Y 0x0002 +#define D3DFONT_TWOSIDED 0x0004 +#define D3DFONT_FILTERED 0x0008 + + + + +//----------------------------------------------------------------------------- +// Name: class CD3DFont +// Desc: Texture-based font class for doing text in a 3D scene. +//----------------------------------------------------------------------------- +class CD3DFont +{ + TCHAR m_strFontName[80]; // Font properties + DWORD m_dwFontHeight; + DWORD m_dwFontFlags; + + LPDIRECT3DDEVICE9 m_pd3dDevice; // A D3DDevice used for rendering + LPDIRECT3DTEXTURE9 m_pTexture; // The d3d texture for this font + LPDIRECT3DVERTEXBUFFER9 m_pVB; // VertexBuffer for rendering text + DWORD m_dwTexWidth; // Texture dimensions + DWORD m_dwTexHeight; + FLOAT m_fTextScale; + FLOAT m_fTexCoords[256-32][4]; + DWORD m_dwSpacing; // Character pixel spacing per side + + // Stateblocks for setting and restoring render states + LPDIRECT3DSTATEBLOCK9 m_pStateBlockSaved; + LPDIRECT3DSTATEBLOCK9 m_pStateBlockDrawText; + +public: + // 2D and 3D text drawing functions + HRESULT DrawText( FLOAT x, FLOAT y, DWORD dwColor, + const TCHAR* strText, DWORD dwFlags=0L ); + HRESULT DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, + FLOAT fXScale, FLOAT fYScale, DWORD dwColor, + const TCHAR* strText, DWORD dwFlags=0L ); + HRESULT Render3DText( const TCHAR* strText, DWORD dwFlags=0L ); + + // Function to get extent of text + HRESULT GetTextExtent( const TCHAR* strText, SIZE* pSize ); + + // Initializing and destroying device-dependent objects + HRESULT InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ); + HRESULT RestoreDeviceObjects(); + HRESULT InvalidateDeviceObjects(); + HRESULT DeleteDeviceObjects(); + + // Constructor / destructor + CD3DFont( const TCHAR* strFontName, DWORD dwHeight, DWORD dwFlags=0L ); + ~CD3DFont(); +}; + + + + +#endif + + diff --git a/saco/d3d9/include/d3drm.h b/saco/d3d9/include/d3drm.h new file mode 100644 index 0000000..143c0e0 --- /dev/null +++ b/saco/d3d9/include/d3drm.h @@ -0,0 +1,342 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRM_H__ +#define __D3DRM_H__ + +#include "ddraw.h" + +#ifdef __cplusplus +struct IDirect3DRM; +#endif + +typedef struct IDirect3DRM *LPDIRECT3DRM; + +#include "d3drmobj.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +DEFINE_GUID(IID_IDirect3DRM, 0x2bc49361, 0x8327, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRM2, 0x4516ecc8, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRM3, 0x4516ec83, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +WIN_TYPES(IDirect3DRM, DIRECT3DRM); +WIN_TYPES(IDirect3DRM2, DIRECT3DRM2); +WIN_TYPES(IDirect3DRM3, DIRECT3DRM3); + +/* + * Direct3DRM Object Class (for CoCreateInstance()) + */ +DEFINE_GUID(CLSID_CDirect3DRM, 0x4516ec41, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); + + +/* Create a Direct3DRM API */ +STDAPI Direct3DRMCreate(LPDIRECT3DRM FAR *lplpDirect3DRM); + +#undef INTERFACE +#define INTERFACE IDirect3DRM + +DECLARE_INTERFACE_(IDirect3DRM, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD(CreateObject) + (THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE; + STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER *) PURE; + STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE *) PURE; + STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION *) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET *) PURE; + STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateLightRGB) + (THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL *) PURE; + STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE *) PURE; + + /* Create a Windows Device using DirectDraw surfaces */ + STDMETHOD(CreateDeviceFromSurface) + ( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, + LPDIRECTDRAWSURFACE lpDDSBack, LPDIRECT3DRMDEVICE * + ) PURE; + + /* Create a Windows Device using D3D objects */ + STDMETHOD(CreateDeviceFromD3D) + ( THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev, + LPDIRECT3DRMDEVICE * + ) PURE; + + STDMETHOD(CreateDeviceFromClipper) + ( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, + int width, int height, LPDIRECT3DRMDEVICE *) PURE; + + STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE *) PURE; + + STDMETHOD(CreateShadow) + ( THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMLIGHT, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + LPDIRECT3DRMVISUAL * + ) PURE; + STDMETHOD(CreateViewport) + ( THIS_ LPDIRECT3DRMDEVICE, LPDIRECT3DRMFRAME, DWORD, DWORD, + DWORD, DWORD, LPDIRECT3DRMVIEWPORT * + ) PURE; + STDMETHOD(CreateWrap) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, + LPDIRECT3DRMWRAP * + ) PURE; + STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE; + STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(LoadTextureFromResource) (THIS_ HRSRC rs, LPDIRECT3DRMTEXTURE *) PURE; + + STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + + STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE; + STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE; + + STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE; + + STDMETHOD(Load) + ( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS, + D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURECALLBACK, LPVOID, + LPDIRECT3DRMFRAME + ) PURE; + STDMETHOD(Tick) (THIS_ D3DVALUE) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRM2 + +DECLARE_INTERFACE_(IDirect3DRM2, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD(CreateObject) + (THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE; + STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME2 *) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER2 *) PURE; + STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE *) PURE; + STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION *) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET *) PURE; + STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE2 *) PURE; + STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateLightRGB) + (THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL *) PURE; + STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE2 *) PURE; + + /* Create a Windows Device using DirectDraw surfaces */ + STDMETHOD(CreateDeviceFromSurface) + ( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, + LPDIRECTDRAWSURFACE lpDDSBack, LPDIRECT3DRMDEVICE2 * + ) PURE; + + /* Create a Windows Device using D3D objects */ + STDMETHOD(CreateDeviceFromD3D) + ( THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev, + LPDIRECT3DRMDEVICE2 * + ) PURE; + + STDMETHOD(CreateDeviceFromClipper) + ( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, + int width, int height, LPDIRECT3DRMDEVICE2 *) PURE; + + STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE2 *) PURE; + + STDMETHOD(CreateShadow) + ( THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMLIGHT, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + LPDIRECT3DRMVISUAL * + ) PURE; + STDMETHOD(CreateViewport) + ( THIS_ LPDIRECT3DRMDEVICE, LPDIRECT3DRMFRAME, DWORD, DWORD, + DWORD, DWORD, LPDIRECT3DRMVIEWPORT * + ) PURE; + STDMETHOD(CreateWrap) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, + LPDIRECT3DRMWRAP * + ) PURE; + STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE; + STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE2 *) PURE; + STDMETHOD(LoadTextureFromResource) (THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType, LPDIRECT3DRMTEXTURE2 *) PURE; + + STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + + STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE; + STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE; + + STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE; + + STDMETHOD(Load) + ( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS, + D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURECALLBACK, LPVOID, + LPDIRECT3DRMFRAME + ) PURE; + STDMETHOD(Tick) (THIS_ D3DVALUE) PURE; + + STDMETHOD(CreateProgressiveMesh)(THIS_ LPDIRECT3DRMPROGRESSIVEMESH *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRM3 + +DECLARE_INTERFACE_(IDirect3DRM3, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD(CreateObject) + (THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE; + STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME3, LPDIRECT3DRMFRAME3 *) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER3 *) PURE; + STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE2 *) PURE; + STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION2 *) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET2 *) PURE; + STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE3 *) PURE; + STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateLightRGB) + (THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL2 *) PURE; + STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE3 *) PURE; + + /* Create a Windows Device using DirectDraw surfaces */ + STDMETHOD(CreateDeviceFromSurface) + ( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, + LPDIRECTDRAWSURFACE lpDDSBack, DWORD dwFlags, LPDIRECT3DRMDEVICE3 * + ) PURE; + + /* Create a Windows Device using D3D objects */ + STDMETHOD(CreateDeviceFromD3D) + ( THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev, + LPDIRECT3DRMDEVICE3 * + ) PURE; + + STDMETHOD(CreateDeviceFromClipper) + ( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, + int width, int height, LPDIRECT3DRMDEVICE3 *) PURE; + + STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE3 *) PURE; + + STDMETHOD(CreateShadow) + ( THIS_ LPUNKNOWN, LPDIRECT3DRMLIGHT, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + LPDIRECT3DRMSHADOW2 * + ) PURE; + STDMETHOD(CreateViewport) + ( THIS_ LPDIRECT3DRMDEVICE3, LPDIRECT3DRMFRAME3, DWORD, DWORD, + DWORD, DWORD, LPDIRECT3DRMVIEWPORT2 * + ) PURE; + STDMETHOD(CreateWrap) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME3, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, + LPDIRECT3DRMWRAP * + ) PURE; + STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE; + STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE3 *) PURE; + STDMETHOD(LoadTextureFromResource) (THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType, LPDIRECT3DRMTEXTURE3 *) PURE; + + STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + + STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE; + STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE; + + STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE; + + STDMETHOD(Load) + ( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS, + D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURE3CALLBACK, LPVOID, + LPDIRECT3DRMFRAME3 + ) PURE; + STDMETHOD(Tick) (THIS_ D3DVALUE) PURE; + + STDMETHOD(CreateProgressiveMesh)(THIS_ LPDIRECT3DRMPROGRESSIVEMESH *) PURE; + + /* Used with IDirect3DRMObject2 */ + STDMETHOD(RegisterClient) (THIS_ REFGUID rguid, LPDWORD lpdwID) PURE; + STDMETHOD(UnregisterClient) (THIS_ REFGUID rguid) PURE; + + STDMETHOD(CreateClippedVisual) (THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMCLIPPEDVISUAL *) PURE; + STDMETHOD(SetOptions) (THIS_ DWORD); + STDMETHOD(GetOptions) (THIS_ LPDWORD); +}; + +#define D3DRM_OK DD_OK +#define D3DRMERR_BADOBJECT MAKE_DDHRESULT(781) +#define D3DRMERR_BADTYPE MAKE_DDHRESULT(782) +#define D3DRMERR_BADALLOC MAKE_DDHRESULT(783) +#define D3DRMERR_FACEUSED MAKE_DDHRESULT(784) +#define D3DRMERR_NOTFOUND MAKE_DDHRESULT(785) +#define D3DRMERR_NOTDONEYET MAKE_DDHRESULT(786) +#define D3DRMERR_FILENOTFOUND MAKE_DDHRESULT(787) +#define D3DRMERR_BADFILE MAKE_DDHRESULT(788) +#define D3DRMERR_BADDEVICE MAKE_DDHRESULT(789) +#define D3DRMERR_BADVALUE MAKE_DDHRESULT(790) +#define D3DRMERR_BADMAJORVERSION MAKE_DDHRESULT(791) +#define D3DRMERR_BADMINORVERSION MAKE_DDHRESULT(792) +#define D3DRMERR_UNABLETOEXECUTE MAKE_DDHRESULT(793) +#define D3DRMERR_LIBRARYNOTFOUND MAKE_DDHRESULT(794) +#define D3DRMERR_INVALIDLIBRARY MAKE_DDHRESULT(795) +#define D3DRMERR_PENDING MAKE_DDHRESULT(796) +#define D3DRMERR_NOTENOUGHDATA MAKE_DDHRESULT(797) +#define D3DRMERR_REQUESTTOOLARGE MAKE_DDHRESULT(798) +#define D3DRMERR_REQUESTTOOSMALL MAKE_DDHRESULT(799) +#define D3DRMERR_CONNECTIONLOST MAKE_DDHRESULT(800) +#define D3DRMERR_LOADABORTED MAKE_DDHRESULT(801) +#define D3DRMERR_NOINTERNET MAKE_DDHRESULT(802) +#define D3DRMERR_BADCACHEFILE MAKE_DDHRESULT(803) +#define D3DRMERR_BOXNOTSET MAKE_DDHRESULT(804) +#define D3DRMERR_BADPMDATA MAKE_DDHRESULT(805) +#define D3DRMERR_CLIENTNOTREGISTERED MAKE_DDHRESULT(806) +#define D3DRMERR_NOTCREATEDFROMDDS MAKE_DDHRESULT(807) +#define D3DRMERR_NOSUCHKEY MAKE_DDHRESULT(808) +#define D3DRMERR_INCOMPATABLEKEY MAKE_DDHRESULT(809) +#define D3DRMERR_ELEMENTINUSE MAKE_DDHRESULT(810) +#define D3DRMERR_TEXTUREFORMATNOTFOUND MAKE_DDHRESULT(811) +#define D3DRMERR_NOTAGGREGATED MAKE_DDHRESULT(812) + +#ifdef __cplusplus +}; +#endif + +#endif /* _D3DRMAPI_H_ */ + + diff --git a/saco/d3d9/include/d3drmdef.h b/saco/d3d9/include/d3drmdef.h new file mode 100644 index 0000000..9da4b18 --- /dev/null +++ b/saco/d3d9/include/d3drmdef.h @@ -0,0 +1,695 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRMDEFS_H__ +#define __D3DRMDEFS_H__ + +#include +#include "d3dtypes.h" + +#ifdef WIN32 +#define D3DRMAPI __stdcall +#else +#define D3DRMAPI +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#ifndef TRUE +#define FALSE 0 +#define TRUE 1 +#endif + +typedef struct _D3DRMVECTOR4D +{ D3DVALUE x, y, z, w; +} D3DRMVECTOR4D, *LPD3DRMVECTOR4D; + +typedef D3DVALUE D3DRMMATRIX4D[4][4]; + +typedef struct _D3DRMQUATERNION +{ D3DVALUE s; + D3DVECTOR v; +} D3DRMQUATERNION, *LPD3DRMQUATERNION; + +typedef struct _D3DRMRAY +{ D3DVECTOR dvDir; + D3DVECTOR dvPos; +} D3DRMRAY, *LPD3DRMRAY; + +typedef struct _D3DRMBOX +{ D3DVECTOR min, max; +} D3DRMBOX, *LPD3DRMBOX; + +typedef void (*D3DRMWRAPCALLBACK) + (LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID); + +typedef enum _D3DRMLIGHTTYPE +{ D3DRMLIGHT_AMBIENT, + D3DRMLIGHT_POINT, + D3DRMLIGHT_SPOT, + D3DRMLIGHT_DIRECTIONAL, + D3DRMLIGHT_PARALLELPOINT +} D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE; + +typedef enum _D3DRMSHADEMODE { + D3DRMSHADE_FLAT = 0, + D3DRMSHADE_GOURAUD = 1, + D3DRMSHADE_PHONG = 2, + + D3DRMSHADE_MASK = 7, + D3DRMSHADE_MAX = 8 +} D3DRMSHADEMODE, *LPD3DRMSHADEMODE; + +typedef enum _D3DRMLIGHTMODE { + D3DRMLIGHT_OFF = 0 * D3DRMSHADE_MAX, + D3DRMLIGHT_ON = 1 * D3DRMSHADE_MAX, + + D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX, + D3DRMLIGHT_MAX = 8 * D3DRMSHADE_MAX +} D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE; + +typedef enum _D3DRMFILLMODE { + D3DRMFILL_POINTS = 0 * D3DRMLIGHT_MAX, + D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX, + D3DRMFILL_SOLID = 2 * D3DRMLIGHT_MAX, + + D3DRMFILL_MASK = 7 * D3DRMLIGHT_MAX, + D3DRMFILL_MAX = 8 * D3DRMLIGHT_MAX +} D3DRMFILLMODE, *LPD3DRMFILLMODE; + +typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY; + +#define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME) +#define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID) +#define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID) +#define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID) +#define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID) + +#define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1 +#define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2 +#define D3DRMRENDERMODE_LIGHTINMODELSPACE 8 +#define D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR 16 +#define D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE 32 + +typedef enum _D3DRMTEXTUREQUALITY +{ D3DRMTEXTURE_NEAREST, /* choose nearest texel */ + D3DRMTEXTURE_LINEAR, /* interpolate 4 texels */ + D3DRMTEXTURE_MIPNEAREST, /* nearest texel in nearest mipmap */ + D3DRMTEXTURE_MIPLINEAR, /* interpolate 2 texels from 2 mipmaps */ + D3DRMTEXTURE_LINEARMIPNEAREST, /* interpolate 4 texels in nearest mipmap */ + D3DRMTEXTURE_LINEARMIPLINEAR /* interpolate 8 texels from 2 mipmaps */ +} D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY; + +/* + * Texture flags + */ +#define D3DRMTEXTURE_FORCERESIDENT 0x00000001 /* texture should be kept in video memory */ +#define D3DRMTEXTURE_STATIC 0x00000002 /* texture will not change */ +#define D3DRMTEXTURE_DOWNSAMPLEPOINT 0x00000004 /* point filtering should be used when downsampling */ +#define D3DRMTEXTURE_DOWNSAMPLEBILINEAR 0x00000008 /* bilinear filtering should be used when downsampling */ +#define D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH 0x00000010 /* reduce bit depth when downsampling */ +#define D3DRMTEXTURE_DOWNSAMPLENONE 0x00000020 /* texture should never be downsampled */ +#define D3DRMTEXTURE_CHANGEDPIXELS 0x00000040 /* pixels have changed */ +#define D3DRMTEXTURE_CHANGEDPALETTE 0x00000080 /* palette has changed */ +#define D3DRMTEXTURE_INVALIDATEONLY 0x00000100 /* dirty regions are invalid */ + +/* + * Shadow flags + */ +#define D3DRMSHADOW_TRUEALPHA 0x00000001 /* shadow should render without artifacts when true alpha is on */ + +typedef enum _D3DRMCOMBINETYPE +{ D3DRMCOMBINE_REPLACE, + D3DRMCOMBINE_BEFORE, + D3DRMCOMBINE_AFTER +} D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE; + +typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL; + +typedef enum _D3DRMPALETTEFLAGS +{ D3DRMPALETTE_FREE, /* renderer may use this entry freely */ + D3DRMPALETTE_READONLY, /* fixed but may be used by renderer */ + D3DRMPALETTE_RESERVED /* may not be used by renderer */ +} D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS; + +typedef struct _D3DRMPALETTEENTRY +{ unsigned char red; /* 0 .. 255 */ + unsigned char green; /* 0 .. 255 */ + unsigned char blue; /* 0 .. 255 */ + unsigned char flags; /* one of D3DRMPALETTEFLAGS */ +} D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY; + +typedef struct _D3DRMIMAGE +{ int width, height; /* width and height in pixels */ + int aspectx, aspecty; /* aspect ratio for non-square pixels */ + int depth; /* bits per pixel */ + int rgb; /* if false, pixels are indices into a + palette otherwise, pixels encode + RGB values. */ + int bytes_per_line; /* number of bytes of memory for a + scanline. This must be a multiple + of 4. */ + void* buffer1; /* memory to render into (first buffer). */ + void* buffer2; /* second rendering buffer for double + buffering, set to NULL for single + buffering. */ + unsigned long red_mask; + unsigned long green_mask; + unsigned long blue_mask; + unsigned long alpha_mask; /* if rgb is true, these are masks for + the red, green and blue parts of a + pixel. Otherwise, these are masks + for the significant bits of the + red, green and blue elements in the + palette. For instance, most SVGA + displays use 64 intensities of red, + green and blue, so the masks should + all be set to 0xfc. */ + int palette_size; /* number of entries in palette */ + D3DRMPALETTEENTRY* palette; /* description of the palette (only if + rgb is false). Must be (1< /* Use Windows header files */ +#define VIRTUAL +#include "d3drmdef.h" + +#include "d3d.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The methods for IUnknown + */ +#define IUNKNOWN_METHODS(kind) \ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD_(ULONG, AddRef) (THIS) kind; \ + STDMETHOD_(ULONG, Release) (THIS) kind + +/* + * The methods for IDirect3DRMObject + */ +#define IDIRECT3DRMOBJECT_METHODS(kind) \ + STDMETHOD(Clone) (THIS_ LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD(AddDestroyCallback) (THIS_ D3DRMOBJECTCALLBACK, LPVOID argument) kind; \ + STDMETHOD(DeleteDestroyCallback) (THIS_ D3DRMOBJECTCALLBACK, LPVOID argument) kind; \ + STDMETHOD(SetAppData) (THIS_ DWORD data) kind; \ + STDMETHOD_(DWORD, GetAppData) (THIS) kind; \ + STDMETHOD(SetName) (THIS_ LPCSTR) kind; \ + STDMETHOD(GetName) (THIS_ LPDWORD lpdwSize, LPSTR lpName) kind; \ + STDMETHOD(GetClassName) (THIS_ LPDWORD lpdwSize, LPSTR lpName) kind + + +#define WIN_TYPES(itype, ptype) \ + typedef interface itype FAR *LP##ptype, FAR **LPLP##ptype + +WIN_TYPES(IDirect3DRMObject, DIRECT3DRMOBJECT); +WIN_TYPES(IDirect3DRMObject2, DIRECT3DRMOBJECT2); +WIN_TYPES(IDirect3DRMDevice, DIRECT3DRMDEVICE); +WIN_TYPES(IDirect3DRMDevice2, DIRECT3DRMDEVICE2); +WIN_TYPES(IDirect3DRMDevice3, DIRECT3DRMDEVICE3); +WIN_TYPES(IDirect3DRMViewport, DIRECT3DRMVIEWPORT); +WIN_TYPES(IDirect3DRMViewport2, DIRECT3DRMVIEWPORT2); +WIN_TYPES(IDirect3DRMFrame, DIRECT3DRMFRAME); +WIN_TYPES(IDirect3DRMFrame2, DIRECT3DRMFRAME2); +WIN_TYPES(IDirect3DRMFrame3, DIRECT3DRMFRAME3); +WIN_TYPES(IDirect3DRMVisual, DIRECT3DRMVISUAL); +WIN_TYPES(IDirect3DRMMesh, DIRECT3DRMMESH); +WIN_TYPES(IDirect3DRMMeshBuilder, DIRECT3DRMMESHBUILDER); +WIN_TYPES(IDirect3DRMMeshBuilder2, DIRECT3DRMMESHBUILDER2); +WIN_TYPES(IDirect3DRMMeshBuilder3, DIRECT3DRMMESHBUILDER3); +WIN_TYPES(IDirect3DRMFace, DIRECT3DRMFACE); +WIN_TYPES(IDirect3DRMFace2, DIRECT3DRMFACE2); +WIN_TYPES(IDirect3DRMLight, DIRECT3DRMLIGHT); +WIN_TYPES(IDirect3DRMTexture, DIRECT3DRMTEXTURE); +WIN_TYPES(IDirect3DRMTexture2, DIRECT3DRMTEXTURE2); +WIN_TYPES(IDirect3DRMTexture3, DIRECT3DRMTEXTURE3); +WIN_TYPES(IDirect3DRMWrap, DIRECT3DRMWRAP); +WIN_TYPES(IDirect3DRMMaterial, DIRECT3DRMMATERIAL); +WIN_TYPES(IDirect3DRMMaterial2, DIRECT3DRMMATERIAL2); +WIN_TYPES(IDirect3DRMInterpolator, DIRECT3DRMINTERPOLATOR); +WIN_TYPES(IDirect3DRMAnimation, DIRECT3DRMANIMATION); +WIN_TYPES(IDirect3DRMAnimation2, DIRECT3DRMANIMATION2); +WIN_TYPES(IDirect3DRMAnimationSet, DIRECT3DRMANIMATIONSET); +WIN_TYPES(IDirect3DRMAnimationSet2, DIRECT3DRMANIMATIONSET2); +WIN_TYPES(IDirect3DRMUserVisual, DIRECT3DRMUSERVISUAL); +WIN_TYPES(IDirect3DRMShadow, DIRECT3DRMSHADOW); +WIN_TYPES(IDirect3DRMShadow2, DIRECT3DRMSHADOW2); +WIN_TYPES(IDirect3DRMArray, DIRECT3DRMARRAY); +WIN_TYPES(IDirect3DRMObjectArray, DIRECT3DRMOBJECTARRAY); +WIN_TYPES(IDirect3DRMDeviceArray, DIRECT3DRMDEVICEARRAY); +WIN_TYPES(IDirect3DRMFaceArray, DIRECT3DRMFACEARRAY); +WIN_TYPES(IDirect3DRMViewportArray, DIRECT3DRMVIEWPORTARRAY); +WIN_TYPES(IDirect3DRMFrameArray, DIRECT3DRMFRAMEARRAY); +WIN_TYPES(IDirect3DRMAnimationArray, DIRECT3DRMANIMATIONARRAY); +WIN_TYPES(IDirect3DRMVisualArray, DIRECT3DRMVISUALARRAY); +WIN_TYPES(IDirect3DRMPickedArray, DIRECT3DRMPICKEDARRAY); +WIN_TYPES(IDirect3DRMPicked2Array, DIRECT3DRMPICKED2ARRAY); +WIN_TYPES(IDirect3DRMLightArray, DIRECT3DRMLIGHTARRAY); +WIN_TYPES(IDirect3DRMProgressiveMesh, DIRECT3DRMPROGRESSIVEMESH); +WIN_TYPES(IDirect3DRMClippedVisual, DIRECT3DRMCLIPPEDVISUAL); + +/* + * Direct3DRM Object classes + */ +DEFINE_GUID(CLSID_CDirect3DRMDevice, 0x4fa3568e, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewport, 0x4fa3568f, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFrame, 0x4fa35690, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMesh, 0x4fa35691, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMeshBuilder, 0x4fa35692, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFace, 0x4fa35693, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMLight, 0x4fa35694, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMTexture, 0x4fa35695, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMWrap, 0x4fa35696, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMaterial, 0x4fa35697, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimation, 0x4fa35698, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimationSet, 0x4fa35699, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMUserVisual, 0x4fa3569a, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMShadow, 0x4fa3569b, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewportInterpolator, +0xde9eaa1, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMFrameInterpolator, +0xde9eaa2, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMMeshInterpolator, +0xde9eaa3, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMLightInterpolator, +0xde9eaa6, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMMaterialInterpolator, +0xde9eaa7, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMTextureInterpolator, +0xde9eaa8, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMProgressiveMesh, 0x4516ec40, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMClippedVisual, 0x5434e72d, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a); + + +/* + * Direct3DRM Object interfaces + */ +DEFINE_GUID(IID_IDirect3DRMObject, 0xeb16cb00, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMObject2, 0x4516ec7c, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDevice, 0xe9e19280, 0x6e05, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMDevice2, 0x4516ec78, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDevice3, 0x549f498b, 0xbfeb, 0x11d1, 0x8e, 0xd8, 0x0, 0xa0, 0xc9, 0x67, 0xa4, 0x82); +DEFINE_GUID(IID_IDirect3DRMViewport, 0xeb16cb02, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMViewport2, 0x4a1b1be6, 0xbfed, 0x11d1, 0x8e, 0xd8, 0x0, 0xa0, 0xc9, 0x67, 0xa4, 0x82); +DEFINE_GUID(IID_IDirect3DRMFrame, 0xeb16cb03, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFrame2, 0xc3dfbd60, 0x3988, 0x11d0, 0x9e, 0xc2, 0x0, 0x0, 0xc0, 0x29, 0x1a, 0xc3); +DEFINE_GUID(IID_IDirect3DRMFrame3, 0xff6b7f70, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMVisual, 0xeb16cb04, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMesh, 0xa3a80d01, 0x6e12, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder, 0xa3a80d02, 0x6e12, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder2, 0x4516ec77, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder3, 0x4516ec82, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMFace, 0xeb16cb07, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFace2, 0x4516ec81, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMLight, 0xeb16cb08, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMTexture, 0xeb16cb09, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMTexture2, 0x120f30c0, 0x1629, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); +DEFINE_GUID(IID_IDirect3DRMTexture3, 0xff6b7f73, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMWrap, 0xeb16cb0a, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial, 0xeb16cb0b, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial2, 0xff6b7f75, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMAnimation, 0xeb16cb0d, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimation2, 0xff6b7f77, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMAnimationSet, 0xeb16cb0e, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimationSet2, 0xff6b7f79, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMObjectArray, 0x242f6bc2, 0x3849, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDeviceArray, 0xeb16cb10, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMViewportArray, 0xeb16cb11, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFrameArray, 0xeb16cb12, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMVisualArray, 0xeb16cb13, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMLightArray, 0xeb16cb14, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMPickedArray, 0xeb16cb16, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFaceArray, 0xeb16cb17, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimationArray, +0xd5f1cae0, 0x4bd7, 0x11d1, 0xb9, 0x74, 0x0, 0x60, 0x8, 0x3e, 0x45, 0xf3); +DEFINE_GUID(IID_IDirect3DRMUserVisual, 0x59163de0, 0x6d43, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMShadow, 0xaf359780, 0x6ba3, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMShadow2, 0x86b44e25, 0x9c82, 0x11d1, 0xbb, 0xb, 0x0, 0xa0, 0xc9, 0x81, 0xa0, 0xa6); +DEFINE_GUID(IID_IDirect3DRMInterpolator, 0x242f6bc1, 0x3849, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMProgressiveMesh, 0x4516ec79, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMPicked2Array, 0x4516ec7b, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMClippedVisual, 0x5434e733, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a); + +typedef void (__cdecl *D3DRMOBJECTCALLBACK)(LPDIRECT3DRMOBJECT obj, LPVOID arg); +typedef void (__cdecl *D3DRMFRAMEMOVECALLBACK)(LPDIRECT3DRMFRAME obj, LPVOID arg, D3DVALUE delta); +typedef void (__cdecl *D3DRMFRAME3MOVECALLBACK)(LPDIRECT3DRMFRAME3 obj, LPVOID arg, D3DVALUE delta); +typedef void (__cdecl *D3DRMUPDATECALLBACK)(LPDIRECT3DRMDEVICE obj, LPVOID arg, int, LPD3DRECT); +typedef void (__cdecl *D3DRMDEVICE3UPDATECALLBACK)(LPDIRECT3DRMDEVICE3 obj, LPVOID arg, int, LPD3DRECT); +typedef int (__cdecl *D3DRMUSERVISUALCALLBACK) + ( LPDIRECT3DRMUSERVISUAL obj, LPVOID arg, D3DRMUSERVISUALREASON reason, + LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view + ); +typedef HRESULT (__cdecl *D3DRMLOADTEXTURECALLBACK) + (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE *); +typedef HRESULT (__cdecl *D3DRMLOADTEXTURE3CALLBACK) + (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE3 *); +typedef void (__cdecl *D3DRMLOADCALLBACK) + (LPDIRECT3DRMOBJECT object, REFIID objectguid, LPVOID arg); + +typedef HRESULT (__cdecl *D3DRMDOWNSAMPLECALLBACK) + (LPDIRECT3DRMTEXTURE3 lpDirect3DRMTexture, LPVOID pArg, + LPDIRECTDRAWSURFACE pDDSSrc, LPDIRECTDRAWSURFACE pDDSDst); +typedef HRESULT (__cdecl *D3DRMVALIDATIONCALLBACK) + (LPDIRECT3DRMTEXTURE3 lpDirect3DRMTexture, LPVOID pArg, + DWORD dwFlags, DWORD dwcRects, LPRECT pRects); + + +typedef struct _D3DRMPICKDESC +{ + ULONG ulFaceIdx; + LONG lGroupIdx; + D3DVECTOR vPosition; + +} D3DRMPICKDESC, *LPD3DRMPICKDESC; + +typedef struct _D3DRMPICKDESC2 +{ + ULONG ulFaceIdx; + LONG lGroupIdx; + D3DVECTOR dvPosition; + D3DVALUE tu; + D3DVALUE tv; + D3DVECTOR dvNormal; + D3DCOLOR dcColor; + +} D3DRMPICKDESC2, *LPD3DRMPICKDESC2; + +#undef INTERFACE +#define INTERFACE IDirect3DRMObject + +/* + * Base class + */ +DECLARE_INTERFACE_(IDirect3DRMObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMObject2 + +DECLARE_INTERFACE_(IDirect3DRMObject2, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + /* + * IDirect3DRMObject2 methods + */ + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK lpFunc, LPVOID pvArg) PURE; + STDMETHOD(Clone)(THIS_ LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj) PURE; \ + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK lpFunc, LPVOID pvArg) PURE; \ + STDMETHOD(GetClientData)(THIS_ DWORD dwID, LPVOID* lplpvData) PURE; + STDMETHOD(GetDirect3DRM)(THIS_ LPDIRECT3DRM* lplpDirect3DRM) PURE; + STDMETHOD(GetName)(THIS_ LPDWORD lpdwSize, LPSTR lpName) PURE; + STDMETHOD(SetClientData)(THIS_ DWORD dwID, LPVOID lpvData, DWORD dwFlags) PURE; + STDMETHOD(SetName)(THIS_ LPCSTR lpName) PURE; + STDMETHOD(GetAge)(THIS_ DWORD dwFlags, LPDWORD pdwAge) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMVisual + +DECLARE_INTERFACE_(IDirect3DRMVisual, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDevice + +DECLARE_INTERFACE_(IDirect3DRMDevice, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMDevice methods + */ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev) PURE; + STDMETHOD(InitFromClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, int width, int height) PURE; + + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + + STDMETHOD(GetViewports)(THIS_ LPDIRECT3DRMVIEWPORTARRAY *return_views) PURE; + + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ LPDIRECT3DDEVICE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDevice2 + +DECLARE_INTERFACE_(IDirect3DRMDevice2, IDirect3DRMDevice) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMDevice methods + */ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev) PURE; + STDMETHOD(InitFromClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, int width, int height) PURE; + + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + + STDMETHOD(GetViewports)(THIS_ LPDIRECT3DRMVIEWPORTARRAY *return_views) PURE; + + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ LPDIRECT3DDEVICE *) PURE; + + /* + * IDirect3DRMDevice2 methods + */ + STDMETHOD(InitFromD3D2)(THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, LPDIRECTDRAWSURFACE lpDDSBack) PURE; + STDMETHOD(SetRenderMode)(THIS_ DWORD dwFlags) PURE; + STDMETHOD_(DWORD, GetRenderMode)(THIS) PURE; + STDMETHOD(GetDirect3DDevice2)(THIS_ LPDIRECT3DDEVICE2 *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDevice3 + +DECLARE_INTERFACE_(IDirect3DRMDevice3, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMDevice methods + */ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev) PURE; + STDMETHOD(InitFromClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, int width, int height) PURE; + + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMDEVICE3UPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMDEVICE3UPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + + STDMETHOD(GetViewports)(THIS_ LPDIRECT3DRMVIEWPORTARRAY *return_views) PURE; + + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ LPDIRECT3DDEVICE *) PURE; + + /* + * IDirect3DRMDevice2 methods + */ + STDMETHOD(InitFromD3D2)(THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, LPDIRECTDRAWSURFACE lpDDSBack, DWORD dwFlags) PURE; + STDMETHOD(SetRenderMode)(THIS_ DWORD dwFlags) PURE; + STDMETHOD_(DWORD, GetRenderMode)(THIS) PURE; + STDMETHOD(GetDirect3DDevice2)(THIS_ LPDIRECT3DDEVICE2 *) PURE; + + /* + * IDirect3DRMDevice3 methods + */ + STDMETHOD(FindPreferredTextureFormat)(THIS_ DWORD dwBitDepths, DWORD dwFlags, LPDDPIXELFORMAT lpDDPF) PURE; + STDMETHOD(RenderStateChange)(THIS_ D3DRENDERSTATETYPE drsType, DWORD dwVal, DWORD dwFlags) PURE; + STDMETHOD(LightStateChange)(THIS_ D3DLIGHTSTATETYPE drsType, DWORD dwVal, DWORD dwFlags) PURE; + STDMETHOD(GetStateChangeOptions)(THIS_ DWORD dwStateClass, DWORD dwStateNum, LPDWORD pdwFlags) PURE; + STDMETHOD(SetStateChangeOptions)(THIS_ DWORD dwStateClass, DWORD dwStateNum, DWORD dwFlags) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMViewport + +DECLARE_INTERFACE_(IDirect3DRMViewport, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMViewport methods + */ + STDMETHOD(Init) + ( THIS_ LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMFRAME camera, + DWORD xpos, DWORD ypos, DWORD width, DWORD height + ) PURE; + STDMETHOD(Clear)(THIS) PURE; + STDMETHOD(Render)(THIS_ LPDIRECT3DRMFRAME) PURE; + + STDMETHOD(SetFront)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetBack)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetField)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUniformScaling)(THIS_ BOOL) PURE; + STDMETHOD(SetCamera)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(SetProjection)(THIS_ D3DRMPROJECTIONTYPE) PURE; + STDMETHOD(Transform)(THIS_ D3DRMVECTOR4D *d, D3DVECTOR *s) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DRMVECTOR4D *s) PURE; + STDMETHOD(Configure)(THIS_ LONG x, LONG y, DWORD width, DWORD height) PURE; + STDMETHOD(ForceUpdate)(THIS_ DWORD x1, DWORD y1, DWORD x2, DWORD y2) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) PURE; + + STDMETHOD(GetCamera)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DRMDEVICE *) PURE; + STDMETHOD(GetPlane)(THIS_ D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) PURE; + STDMETHOD(Pick)(THIS_ LONG x, LONG y, LPDIRECT3DRMPICKEDARRAY *return_visuals) PURE; + + STDMETHOD_(BOOL, GetUniformScaling)(THIS) PURE; + STDMETHOD_(LONG, GetX)(THIS) PURE; + STDMETHOD_(LONG, GetY)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetField)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetBack)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetFront)(THIS) PURE; + STDMETHOD_(D3DRMPROJECTIONTYPE, GetProjection)(THIS) PURE; + STDMETHOD(GetDirect3DViewport)(THIS_ LPDIRECT3DVIEWPORT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMViewport2 +DECLARE_INTERFACE_(IDirect3DRMViewport2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMViewport2 methods + */ + STDMETHOD(Init) + ( THIS_ LPDIRECT3DRMDEVICE3 dev, LPDIRECT3DRMFRAME3 camera, + DWORD xpos, DWORD ypos, DWORD width, DWORD height + ) PURE; + STDMETHOD(Clear)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(Render)(THIS_ LPDIRECT3DRMFRAME3) PURE; + + STDMETHOD(SetFront)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetBack)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetField)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUniformScaling)(THIS_ BOOL) PURE; + STDMETHOD(SetCamera)(THIS_ LPDIRECT3DRMFRAME3) PURE; + STDMETHOD(SetProjection)(THIS_ D3DRMPROJECTIONTYPE) PURE; + STDMETHOD(Transform)(THIS_ D3DRMVECTOR4D *d, D3DVECTOR *s) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DRMVECTOR4D *s) PURE; + STDMETHOD(Configure)(THIS_ LONG x, LONG y, DWORD width, DWORD height) PURE; + STDMETHOD(ForceUpdate)(THIS_ DWORD x1, DWORD y1, DWORD x2, DWORD y2) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) PURE; + + STDMETHOD(GetCamera)(THIS_ LPDIRECT3DRMFRAME3 *) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DRMDEVICE3 *) PURE; + STDMETHOD(GetPlane)(THIS_ D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) PURE; + STDMETHOD(Pick)(THIS_ LONG x, LONG y, LPDIRECT3DRMPICKEDARRAY *return_visuals) PURE; + + STDMETHOD_(BOOL, GetUniformScaling)(THIS) PURE; + STDMETHOD_(LONG, GetX)(THIS) PURE; + STDMETHOD_(LONG, GetY)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetField)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetBack)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetFront)(THIS) PURE; + STDMETHOD_(D3DRMPROJECTIONTYPE, GetProjection)(THIS) PURE; + STDMETHOD(GetDirect3DViewport)(THIS_ LPDIRECT3DVIEWPORT *) PURE; + STDMETHOD(TransformVectors)(THIS_ DWORD dwNumVectors, + LPD3DRMVECTOR4D lpDstVectors, + LPD3DVECTOR lpSrcVectors) PURE; + STDMETHOD(InverseTransformVectors)(THIS_ DWORD dwNumVectors, + LPD3DVECTOR lpDstVectors, + LPD3DRMVECTOR4D lpSrcVectors) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrame + +DECLARE_INTERFACE_(IDirect3DRMFrame, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFrame methods + */ + STDMETHOD(AddChild)(THIS_ LPDIRECT3DRMFRAME child) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(GetPosition)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_position) PURE; + STDMETHOD(GetRotation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR axis, LPD3DVALUE return_theta) PURE; + STDMETHOD(GetScene)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(GetTransform)(THIS_ D3DRMMATRIX4D return_matrix) PURE; + STDMETHOD(GetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR dir, LPD3DVECTOR up) PURE; + STDMETHOD(GetVisuals)(THIS_ LPDIRECT3DRMVISUALARRAY *visuals) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg)PURE; + STDMETHOD(LookAt)(THIS_ LPDIRECT3DRMFRAME target, LPDIRECT3DRMFRAME reference, D3DRMFRAMECONSTRAINT) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(DeleteVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation) + ( THIS_ LPDIRECT3DRMFRAME reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz + ) PURE; + STDMETHOD(SetPosition)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrame2 + +DECLARE_INTERFACE_(IDirect3DRMFrame2, IDirect3DRMFrame) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFrame methods + */ + STDMETHOD(AddChild)(THIS_ LPDIRECT3DRMFRAME child) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(GetPosition)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_position) PURE; + STDMETHOD(GetRotation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR axis, LPD3DVALUE return_theta) PURE; + STDMETHOD(GetScene)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(GetTransform)(THIS_ D3DRMMATRIX4D return_matrix) PURE; + STDMETHOD(GetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR dir, LPD3DVECTOR up) PURE; + STDMETHOD(GetVisuals)(THIS_ LPDIRECT3DRMVISUALARRAY *visuals) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg)PURE; + STDMETHOD(LookAt)(THIS_ LPDIRECT3DRMFRAME target, LPDIRECT3DRMFRAME reference, D3DRMFRAMECONSTRAINT) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(DeleteVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation) + ( THIS_ LPDIRECT3DRMFRAME reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz + ) PURE; + STDMETHOD(SetPosition)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + + /* + * IDirect3DRMFrame2 methods + */ + STDMETHOD(AddMoveCallback2)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg, DWORD dwFlags) PURE; + STDMETHOD(GetBox)(THIS_ LPD3DRMBOX) PURE; + STDMETHOD_(BOOL, GetBoxEnable)(THIS) PURE; + STDMETHOD(GetAxes)(THIS_ LPD3DVECTOR dir, LPD3DVECTOR up); + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL *) PURE; + STDMETHOD_(BOOL, GetInheritAxes)(THIS); + STDMETHOD(GetHierarchyBox)(THIS_ LPD3DRMBOX) PURE; + + STDMETHOD(SetBox)(THIS_ LPD3DRMBOX) PURE; + STDMETHOD(SetBoxEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetAxes)(THIS_ D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz); + STDMETHOD(SetInheritAxes)(THIS_ BOOL inherit_from_parent); + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetQuaternion)(THIS_ LPDIRECT3DRMFRAME reference, D3DRMQUATERNION *q) PURE; + + STDMETHOD(RayPick)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DRMRAY ray, DWORD dwFlags, LPDIRECT3DRMPICKED2ARRAY *return_visuals) PURE; + STDMETHOD(Save)(THIS_ LPCSTR filename, D3DRMXOFFORMAT d3dFormat, + D3DRMSAVEOPTIONS d3dSaveFlags); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrame3 + +DECLARE_INTERFACE_(IDirect3DRMFrame3, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFrame3 methods + */ + STDMETHOD(AddChild)(THIS_ LPDIRECT3DRMFRAME3 child) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAME3MOVECALLBACK, VOID *arg, DWORD dwFlags) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ LPUNKNOWN) PURE; + STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ LPDIRECT3DRMFRAME3 *) PURE; + STDMETHOD(GetPosition)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR return_position) PURE; + STDMETHOD(GetRotation)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR axis, LPD3DVALUE return_theta) PURE; + STDMETHOD(GetScene)(THIS_ LPDIRECT3DRMFRAME3 *) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE3 *) PURE; + STDMETHOD(GetTransform)(THIS_ LPDIRECT3DRMFRAME3 reference, + D3DRMMATRIX4D rmMatrix) PURE; + STDMETHOD(GetVelocity)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR dir, LPD3DVECTOR up) PURE; + STDMETHOD(GetVisuals)(THIS_ LPDWORD lpdwCount, LPUNKNOWN *) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURE3CALLBACK, LPVOID lpArg)PURE; + STDMETHOD(LookAt)(THIS_ LPDIRECT3DRMFRAME3 target, LPDIRECT3DRMFRAME3 reference, D3DRMFRAMECONSTRAINT) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ LPDIRECT3DRMFRAME3) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAME3MOVECALLBACK, VOID *arg) PURE; + STDMETHOD(DeleteVisual)(THIS_ LPUNKNOWN) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ LPDIRECT3DRMTEXTURE3) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation) + ( THIS_ LPDIRECT3DRMFRAME3 reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz + ) PURE; + STDMETHOD(SetPosition)(THIS_ LPDIRECT3DRMFRAME3 reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ LPDIRECT3DRMFRAME3 reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE3) PURE; + STDMETHOD(SetVelocity)(THIS_ LPDIRECT3DRMFRAME3 reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(GetBox)(THIS_ LPD3DRMBOX) PURE; + STDMETHOD_(BOOL, GetBoxEnable)(THIS) PURE; + STDMETHOD(GetAxes)(THIS_ LPD3DVECTOR dir, LPD3DVECTOR up); + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2 *) PURE; + STDMETHOD_(BOOL, GetInheritAxes)(THIS); + STDMETHOD(GetHierarchyBox)(THIS_ LPD3DRMBOX) PURE; + + STDMETHOD(SetBox)(THIS_ LPD3DRMBOX) PURE; + STDMETHOD(SetBoxEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetAxes)(THIS_ D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz); + STDMETHOD(SetInheritAxes)(THIS_ BOOL inherit_from_parent); + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; + STDMETHOD(SetQuaternion)(THIS_ LPDIRECT3DRMFRAME3 reference, D3DRMQUATERNION *q) PURE; + + STDMETHOD(RayPick)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DRMRAY ray, DWORD dwFlags, LPDIRECT3DRMPICKED2ARRAY *return_visuals) PURE; + STDMETHOD(Save)(THIS_ LPCSTR filename, D3DRMXOFFORMAT d3dFormat, + D3DRMSAVEOPTIONS d3dSaveFlags); + STDMETHOD(TransformVectors)(THIS_ LPDIRECT3DRMFRAME3 reference, + DWORD dwNumVectors, + LPD3DVECTOR lpDstVectors, + LPD3DVECTOR lpSrcVectors) PURE; + STDMETHOD(InverseTransformVectors)(THIS_ LPDIRECT3DRMFRAME3 reference, + DWORD dwNumVectors, + LPD3DVECTOR lpDstVectors, + LPD3DVECTOR lpSrcVectors) PURE; + STDMETHOD(SetTraversalOptions)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(GetTraversalOptions)(THIS_ LPDWORD lpdwFlags) PURE; + STDMETHOD(SetSceneFogMethod)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(GetSceneFogMethod)(THIS_ LPDWORD lpdwFlags) PURE; + STDMETHOD(SetMaterialOverride)(THIS_ LPD3DRMMATERIALOVERRIDE) PURE; + STDMETHOD(GetMaterialOverride)(THIS_ LPD3DRMMATERIALOVERRIDE) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMesh + +DECLARE_INTERFACE_(IDirect3DRMMesh, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMesh methods + */ + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(AddGroup)(THIS_ unsigned vCount, unsigned fCount, unsigned vPerFace, unsigned *fData, D3DRMGROUPINDEX *returnId) PURE; + STDMETHOD(SetVertices)(THIS_ D3DRMGROUPINDEX id, unsigned index, unsigned count, D3DRMVERTEX *values) PURE; + STDMETHOD(SetGroupColor)(THIS_ D3DRMGROUPINDEX id, D3DCOLOR value) PURE; + STDMETHOD(SetGroupColorRGB)(THIS_ D3DRMGROUPINDEX id, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetGroupMapping)(THIS_ D3DRMGROUPINDEX id, D3DRMMAPPING value) PURE; + STDMETHOD(SetGroupQuality)(THIS_ D3DRMGROUPINDEX id, D3DRMRENDERQUALITY value) PURE; + STDMETHOD(SetGroupMaterial)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMMATERIAL value) PURE; + STDMETHOD(SetGroupTexture)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMTEXTURE value) PURE; + + STDMETHOD_(unsigned, GetGroupCount)(THIS) PURE; + STDMETHOD(GetGroup)(THIS_ D3DRMGROUPINDEX id, unsigned *vCount, unsigned *fCount, unsigned *vPerFace, DWORD *fDataSize, unsigned *fData) PURE; + STDMETHOD(GetVertices)(THIS_ D3DRMGROUPINDEX id, DWORD index, DWORD count, D3DRMVERTEX *returnPtr) PURE; + STDMETHOD_(D3DCOLOR, GetGroupColor)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD_(D3DRMMAPPING, GetGroupMapping)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetGroupQuality)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD(GetGroupMaterial)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMMATERIAL *returnPtr) PURE; + STDMETHOD(GetGroupTexture)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMTEXTURE *returnPtr) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMProgressiveMesh + +DECLARE_INTERFACE_(IDirect3DRMProgressiveMesh, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMProgressiveMesh methods + */ + STDMETHOD(Load) (THIS_ LPVOID lpObjLocation, LPVOID lpObjId, + D3DRMLOADOPTIONS dloLoadflags, D3DRMLOADTEXTURECALLBACK lpCallback, + LPVOID lpArg) PURE; + STDMETHOD(GetLoadStatus) (THIS_ LPD3DRMPMESHLOADSTATUS lpStatus) PURE; + STDMETHOD(SetMinRenderDetail) (THIS_ D3DVALUE d3dVal) PURE; + STDMETHOD(Abort) (THIS_ DWORD dwFlags) PURE; + + STDMETHOD(GetFaceDetail) (THIS_ LPDWORD lpdwCount) PURE; + STDMETHOD(GetVertexDetail) (THIS_ LPDWORD lpdwCount) PURE; + STDMETHOD(SetFaceDetail) (THIS_ DWORD dwCount) PURE; + STDMETHOD(SetVertexDetail) (THIS_ DWORD dwCount) PURE; + STDMETHOD(GetFaceDetailRange) (THIS_ LPDWORD lpdwMin, LPDWORD lpdwMax) PURE; + STDMETHOD(GetVertexDetailRange) (THIS_ LPDWORD lpdwMin, LPDWORD lpdwMax) PURE; + STDMETHOD(GetDetail) (THIS_ D3DVALUE *lpdvVal) PURE; + STDMETHOD(SetDetail) (THIS_ D3DVALUE d3dVal) PURE; + + STDMETHOD(RegisterEvents) (THIS_ HANDLE hEvent, DWORD dwFlags, DWORD dwReserved) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *lplpD3DRMMesh) PURE; + STDMETHOD(Duplicate) (THIS_ LPDIRECT3DRMPROGRESSIVEMESH *lplpD3DRMPMesh) PURE; + STDMETHOD(GetBox) (THIS_ LPD3DRMBOX lpBBox) PURE; + STDMETHOD(SetQuality) (THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(GetQuality) (THIS_ LPD3DRMRENDERQUALITY lpdwquality) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMShadow + +DECLARE_INTERFACE_(IDirect3DRMShadow, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMShadow methods + */ + STDMETHOD(Init) + ( THIS_ LPDIRECT3DRMVISUAL visual, LPDIRECT3DRMLIGHT light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz + ) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMShadow2 + +DECLARE_INTERFACE_(IDirect3DRMShadow2, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMShadow methods + */ + STDMETHOD(Init) + ( THIS_ LPUNKNOWN pUNK, LPDIRECT3DRMLIGHT light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz + ) PURE; + + /* + * IDirect3DRMShadow2 methods + */ + STDMETHOD(GetVisual)(THIS_ LPDIRECT3DRMVISUAL *) PURE; + STDMETHOD(SetVisual)(THIS_ LPUNKNOWN pUNK, DWORD) PURE; + STDMETHOD(GetLight)(THIS_ LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(SetLight)(THIS_ LPDIRECT3DRMLIGHT, DWORD) PURE; + STDMETHOD(GetPlane)(THIS_ LPD3DVALUE px, LPD3DVALUE py, LPD3DVALUE pz, + LPD3DVALUE nx, LPD3DVALUE ny, LPD3DVALUE nz) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, DWORD) PURE; + STDMETHOD(GetOptions)(THIS_ LPDWORD) PURE; + STDMETHOD(SetOptions)(THIS_ DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFace + +DECLARE_INTERFACE_(IDirect3DRMFace, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFace methods + */ + STDMETHOD(AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddVertexAndNormalIndexed)(THIS_ DWORD vertex, DWORD normal) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + + STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals); + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL *) PURE; + + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFace2 + +DECLARE_INTERFACE_(IDirect3DRMFace2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFace methods + */ + STDMETHOD(AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddVertexAndNormalIndexed)(THIS_ DWORD vertex, DWORD normal) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE3) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + + STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals); + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE3 *) PURE; + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2 *) PURE; + + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMeshBuilder + +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMeshBuilder methods + */ + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + + STDMETHOD(AddMesh)(THIS_ LPDIRECT3DRMMESH) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER) PURE; + STDMETHOD(AddFrame)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(AddFace)(THIS_ LPDIRECT3DRMFACE) PURE; + STDMETHOD(AddFaces) + ( THIS_ DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, + DWORD *data, LPDIRECT3DRMFACEARRAY* + ) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + + STDMETHOD(GetFaces)(THIS_ LPDIRECT3DRMFACEARRAY*) PURE; + STDMETHOD(GetVertices) + ( THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data + ) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ LPDIRECT3DRMFACE*) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + + STDMETHOD(CreateMesh)(THIS_ LPDIRECT3DRMMESH*) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMeshBuilder2 + +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder2, IDirect3DRMMeshBuilder) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMeshBuilder methods + */ + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + + STDMETHOD(AddMesh)(THIS_ LPDIRECT3DRMMESH) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER) PURE; + STDMETHOD(AddFrame)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(AddFace)(THIS_ LPDIRECT3DRMFACE) PURE; + STDMETHOD(AddFaces) + ( THIS_ DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, + DWORD *data, LPDIRECT3DRMFACEARRAY* + ) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + + STDMETHOD(GetFaces)(THIS_ LPDIRECT3DRMFACEARRAY*) PURE; + STDMETHOD(GetVertices) + ( THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data + ) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ LPDIRECT3DRMFACE*) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + + STDMETHOD(CreateMesh)(THIS_ LPDIRECT3DRMMESH*) PURE; + + /* + * IDirect3DRMMeshBuilder2 methods + */ + STDMETHOD(GenerateNormals2)(THIS_ D3DVALUE crease, DWORD dwFlags) PURE; + STDMETHOD(GetFace)(THIS_ DWORD index, LPDIRECT3DRMFACE*) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMeshBuilder3 + +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder3, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMeshBuilder3 methods + */ + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURE3CALLBACK, LPVOID lpArg) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS_ D3DVALUE crease, DWORD dwFlags) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + + STDMETHOD(AddMesh)(THIS_ LPDIRECT3DRMMESH) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER3, DWORD dwFlags) PURE; + STDMETHOD(AddFrame)(THIS_ LPDIRECT3DRMFRAME3) PURE; + STDMETHOD(AddFace)(THIS_ LPDIRECT3DRMFACE2) PURE; + STDMETHOD(AddFaces) + ( THIS_ DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, + DWORD *data, LPDIRECT3DRMFACEARRAY* + ) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE3) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(GetFaces)(THIS_ LPDIRECT3DRMFACEARRAY*) PURE; + STDMETHOD(GetGeometry) + ( THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data + ) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ LPDIRECT3DRMFACE2 *) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + STDMETHOD(CreateMesh)(THIS_ LPDIRECT3DRMMESH*) PURE; + STDMETHOD(GetFace)(THIS_ DWORD index, LPDIRECT3DRMFACE2 *) PURE; + STDMETHOD(GetVertex)(THIS_ DWORD dwIndex, LPD3DVECTOR lpVector) PURE; + STDMETHOD(GetNormal)(THIS_ DWORD dwIndex, LPD3DVECTOR lpVector) PURE; + STDMETHOD(DeleteVertices)(THIS_ DWORD dwIndexFirst, DWORD dwCount) PURE; + STDMETHOD(DeleteNormals)(THIS_ DWORD dwIndexFirst, DWORD dwCount) PURE; + STDMETHOD(DeleteFace)(THIS_ LPDIRECT3DRMFACE2) PURE; + STDMETHOD(Empty)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(Optimize)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(AddFacesIndexed)(THIS_ DWORD dwFlags, DWORD *lpdwvIndices, DWORD *dwIndexFirst, DWORD *dwCount) PURE; + STDMETHOD(CreateSubMesh)(THIS_ LPUNKNOWN *) PURE; + STDMETHOD(GetParentMesh)(THIS_ DWORD, LPUNKNOWN *) PURE; + STDMETHOD(GetSubMeshes)(THIS_ LPDWORD lpdwCount, LPUNKNOWN *) PURE; + STDMETHOD(DeleteSubMesh)(THIS_ LPUNKNOWN) PURE; + STDMETHOD(Enable)(THIS_ DWORD) PURE; + STDMETHOD(GetEnable)(THIS_ DWORD *) PURE; + STDMETHOD(AddTriangles)(THIS_ DWORD dwFlags, DWORD dwFormat, + DWORD dwVertexCount, LPVOID lpvData) PURE; + STDMETHOD(SetVertices)(THIS_ DWORD dwIndexFirst, DWORD dwCount, LPD3DVECTOR) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD dwIndexFirst, LPDWORD lpdwCount, LPD3DVECTOR) PURE; + STDMETHOD(SetNormals)(THIS_ DWORD dwIndexFirst, DWORD dwCount, LPD3DVECTOR) PURE; + STDMETHOD(GetNormals)(THIS_ DWORD dwIndexFirst, LPDWORD lpdwCount, LPD3DVECTOR) PURE; + STDMETHOD_(int, GetNormalCount)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMLight + +DECLARE_INTERFACE_(IDirect3DRMLight, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMLight methods + */ + STDMETHOD(SetType)(THIS_ D3DRMLIGHTTYPE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetRange)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUmbra)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetPenumbra)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetConstantAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetLinearAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetQuadraticAttenuation)(THIS_ D3DVALUE) PURE; + + STDMETHOD_(D3DVALUE, GetRange)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetUmbra)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetPenumbra)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetConstantAttenuation)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetLinearAttenuation)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetQuadraticAttenuation)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD_(D3DRMLIGHTTYPE, GetType)(THIS) PURE; + + STDMETHOD(SetEnableFrame)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(GetEnableFrame)(THIS_ LPDIRECT3DRMFRAME*) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMTexture + +DECLARE_INTERFACE_(IDirect3DRMTexture, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMTexture methods + */ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ BOOL pixels, BOOL palette) PURE; + + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMTexture2 + +DECLARE_INTERFACE_(IDirect3DRMTexture2, IDirect3DRMTexture) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMTexture methods + */ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ BOOL pixels, BOOL palette) PURE; + + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; + + /* + * IDirect3DRMTexture2 methods + */ + STDMETHOD(InitFromImage)(THIS_ LPD3DRMIMAGE) PURE; + STDMETHOD(InitFromResource2)(THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType) PURE; + STDMETHOD(GenerateMIPMap)(THIS_ DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMTexture3 + +DECLARE_INTERFACE_(IDirect3DRMTexture3, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMTexture3 methods + */ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ DWORD dwFlags, DWORD dwcRects, LPRECT pRects) PURE; + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; + STDMETHOD(InitFromImage)(THIS_ LPD3DRMIMAGE) PURE; + STDMETHOD(InitFromResource2)(THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType) PURE; + STDMETHOD(GenerateMIPMap)(THIS_ DWORD) PURE; + STDMETHOD(GetSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE* lplpDDS) PURE; + STDMETHOD(SetCacheOptions)(THIS_ LONG lImportance, DWORD dwFlags) PURE; + STDMETHOD(GetCacheOptions)(THIS_ LPLONG lplImportance, LPDWORD lpdwFlags) PURE; + STDMETHOD(SetDownsampleCallback)(THIS_ D3DRMDOWNSAMPLECALLBACK pCallback, LPVOID pArg) PURE; + STDMETHOD(SetValidationCallback)(THIS_ D3DRMVALIDATIONCALLBACK pCallback, LPVOID pArg) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMWrap + +DECLARE_INTERFACE_(IDirect3DRMWrap, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMWrap methods + */ + STDMETHOD(Init) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME ref, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv + ) PURE; + STDMETHOD(Apply)(THIS_ LPDIRECT3DRMOBJECT) PURE; + STDMETHOD(ApplyRelative)(THIS_ LPDIRECT3DRMFRAME frame, LPDIRECT3DRMOBJECT) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMaterial + +DECLARE_INTERFACE_(IDirect3DRMMaterial, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMaterial methods + */ + STDMETHOD(SetPower)(THIS_ D3DVALUE power) PURE; + STDMETHOD(SetSpecular)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD(SetEmissive)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + + STDMETHOD_(D3DVALUE, GetPower)(THIS) PURE; + STDMETHOD(GetSpecular)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetEmissive)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMMaterial2 + +DECLARE_INTERFACE_(IDirect3DRMMaterial2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMaterial2 methods + */ + STDMETHOD(SetPower)(THIS_ D3DVALUE power) PURE; + STDMETHOD(SetSpecular)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD(SetEmissive)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD_(D3DVALUE, GetPower)(THIS) PURE; + STDMETHOD(GetSpecular)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetEmissive)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetAmbient)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(SetAmbient)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimation + +DECLARE_INTERFACE_(IDirect3DRMAnimation, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimation methods + */ + STDMETHOD(SetOptions)(THIS_ D3DRMANIMATIONOPTIONS flags) PURE; + STDMETHOD(AddRotateKey)(THIS_ D3DVALUE time, D3DRMQUATERNION *q) PURE; + STDMETHOD(AddPositionKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScaleKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(DeleteKey)(THIS_ D3DVALUE time) PURE; + STDMETHOD(SetFrame)(THIS_ LPDIRECT3DRMFRAME frame) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + + STDMETHOD_(D3DRMANIMATIONOPTIONS, GetOptions)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimation2 + +DECLARE_INTERFACE_(IDirect3DRMAnimation2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimation2 methods + */ + STDMETHOD(SetOptions)(THIS_ D3DRMANIMATIONOPTIONS flags) PURE; + STDMETHOD(AddRotateKey)(THIS_ D3DVALUE time, D3DRMQUATERNION *q) PURE; + STDMETHOD(AddPositionKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScaleKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(DeleteKey)(THIS_ D3DVALUE time) PURE; + STDMETHOD(SetFrame)(THIS_ LPDIRECT3DRMFRAME3 frame) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + + STDMETHOD_(D3DRMANIMATIONOPTIONS, GetOptions)(THIS) PURE; + STDMETHOD(GetFrame)(THIS_ LPDIRECT3DRMFRAME3 *lpD3DFrame) PURE; + STDMETHOD(DeleteKeyByID)(THIS_ DWORD dwID) PURE; + STDMETHOD(AddKey)(THIS_ LPD3DRMANIMATIONKEY lpKey) PURE; + STDMETHOD(ModifyKey)(THIS_ LPD3DRMANIMATIONKEY lpKey) PURE; + STDMETHOD(GetKeys)(THIS_ D3DVALUE dvTimeMin, + D3DVALUE dvTimeMax, LPDWORD lpdwNumKeys, + LPD3DRMANIMATIONKEY lpKey); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimationSet + +DECLARE_INTERFACE_(IDirect3DRMAnimationSet, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimationSet methods + */ + STDMETHOD(AddAnimation)(THIS_ LPDIRECT3DRMANIMATION aid) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg, LPDIRECT3DRMFRAME parent)PURE; + STDMETHOD(DeleteAnimation)(THIS_ LPDIRECT3DRMANIMATION aid) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimationSet2 + +DECLARE_INTERFACE_(IDirect3DRMAnimationSet2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimationSet2 methods + */ + STDMETHOD(AddAnimation)(THIS_ LPDIRECT3DRMANIMATION2 aid) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURE3CALLBACK, LPVOID lpArg, LPDIRECT3DRMFRAME3 parent)PURE; + STDMETHOD(DeleteAnimation)(THIS_ LPDIRECT3DRMANIMATION2 aid) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + STDMETHOD(GetAnimations)(THIS_ LPDIRECT3DRMANIMATIONARRAY *) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMUserVisual + +DECLARE_INTERFACE_(IDirect3DRMUserVisual, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMUserVisual methods + */ + STDMETHOD(Init)(THIS_ D3DRMUSERVISUALCALLBACK fn, void *arg) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMArray + +DECLARE_INTERFACE_(IDirect3DRMArray, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /* No GetElement method as it would get overloaded + * in derived classes, and overloading is + * a no-no in COM + */ +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMObjectArray + +DECLARE_INTERFACE_(IDirect3DRMObjectArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMOBJECT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDeviceArray + +DECLARE_INTERFACE_(IDirect3DRMDeviceArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMDEVICE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrameArray + +DECLARE_INTERFACE_(IDirect3DRMFrameArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMFRAME *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMViewportArray + +DECLARE_INTERFACE_(IDirect3DRMViewportArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMVIEWPORT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMVisualArray + +DECLARE_INTERFACE_(IDirect3DRMVisualArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMVISUAL *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimationArray + +DECLARE_INTERFACE_(IDirect3DRMAnimationArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMANIMATION2 *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMPickedArray + +DECLARE_INTERFACE_(IDirect3DRMPickedArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetPick)(THIS_ DWORD index, LPDIRECT3DRMVISUAL *, LPDIRECT3DRMFRAMEARRAY *, LPD3DRMPICKDESC) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMLightArray + +DECLARE_INTERFACE_(IDirect3DRMLightArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMLIGHT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFaceArray + +DECLARE_INTERFACE_(IDirect3DRMFaceArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMFACE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMPicked2Array + +DECLARE_INTERFACE_(IDirect3DRMPicked2Array, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetPick)(THIS_ DWORD index, LPDIRECT3DRMVISUAL *, LPDIRECT3DRMFRAMEARRAY *, LPD3DRMPICKDESC2) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMInterpolator + +DECLARE_INTERFACE_(IDirect3DRMInterpolator, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMInterpolator methods + */ + STDMETHOD(AttachObject)(THIS_ LPDIRECT3DRMOBJECT) PURE; + STDMETHOD(GetAttachedObjects)(THIS_ LPDIRECT3DRMOBJECTARRAY *) PURE; + STDMETHOD(DetachObject)(THIS_ LPDIRECT3DRMOBJECT) PURE; + STDMETHOD(SetIndex)(THIS_ D3DVALUE) PURE; + STDMETHOD_(D3DVALUE, GetIndex)(THIS) PURE; + STDMETHOD(Interpolate)(THIS_ D3DVALUE, LPDIRECT3DRMOBJECT, D3DRMINTERPOLATIONOPTIONS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMClippedVisual + +DECLARE_INTERFACE_(IDirect3DRMClippedVisual, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMClippedVisual methods + */ + STDMETHOD(Init) (THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD(AddPlane) (THIS_ LPDIRECT3DRMFRAME3, LPD3DVECTOR, LPD3DVECTOR, DWORD, LPDWORD) PURE; + STDMETHOD(DeletePlane)(THIS_ DWORD, DWORD) PURE; + STDMETHOD(GetPlaneIDs)(THIS_ LPDWORD, LPDWORD, DWORD) PURE; + STDMETHOD(GetPlane) (THIS_ DWORD, LPDIRECT3DRMFRAME3, LPD3DVECTOR, LPD3DVECTOR, DWORD) PURE; + STDMETHOD(SetPlane) (THIS_ DWORD, LPDIRECT3DRMFRAME3, LPD3DVECTOR, LPD3DVECTOR, DWORD) PURE; +}; + +#ifdef __cplusplus +}; +#endif +#endif /* _D3DRMOBJ_H_ */ + diff --git a/saco/d3d9/include/d3drmwin.h b/saco/d3d9/include/d3drmwin.h new file mode 100644 index 0000000..d051ef4 --- /dev/null +++ b/saco/d3d9/include/d3drmwin.h @@ -0,0 +1,50 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRMWIN_H__ +#define __D3DRMWIN_H__ + +#ifndef WIN32 +#define WIN32 +#endif + +#include "d3drm.h" + +#include "ddraw.h" +#include "d3d.h" + +/* + * GUIDS used by Direct3DRM Windows interface + */ +DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); + +WIN_TYPES(IDirect3DRMWinDevice, DIRECT3DRMWINDEVICE); + +#undef INTERFACE +#define INTERFACE IDirect3DRMWinDevice + +DECLARE_INTERFACE_(IDirect3DRMWinDevice, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMWinDevice methods + */ + + /* Repaint the window with the last frame which was rendered. */ + STDMETHOD(HandlePaint)(THIS_ HDC hdc) PURE; + + /* Respond to a WM_ACTIVATE message. */ + STDMETHOD(HandleActivate)(THIS_ WORD wparam) PURE; +}; + + +#endif + diff --git a/saco/d3d9/include/d3dtypes.h b/saco/d3d9/include/d3dtypes.h new file mode 100644 index 0000000..7949041 --- /dev/null +++ b/saco/d3d9/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/saco/d3d9/include/d3dutil.h b/saco/d3d9/include/d3dutil.h new file mode 100644 index 0000000..eaae93e --- /dev/null +++ b/saco/d3d9/include/d3dutil.h @@ -0,0 +1,95 @@ +//----------------------------------------------------------------------------- +// File: D3DUtil.h +// +// Desc: Helper functions and typing shortcuts for Direct3D programming +// +// Copyright (c) Microsoft Corporation. All rights reserved +//----------------------------------------------------------------------------- + +#pragma once + +#ifndef D3DUTIL_H +#define D3DUTIL_H +#include +#include + + +//----------------------------------------------------------------------------- +// Miscellaneous helper functions +//----------------------------------------------------------------------------- +const TCHAR* D3DUtil_GetDXSDKMediaPath(); + +#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } } +#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } + + +//----------------------------------------------------------------------------- +// Short cut functions for creating and using DirectX structures +//----------------------------------------------------------------------------- +VOID D3DUtil_InitDeviceDesc( D3DDEVICEDESC7& ddDevDesc ); + +VOID D3DUtil_InitSurfaceDesc( DDSURFACEDESC2& ddsd, DWORD dwFlags=0, + DWORD dwCaps=0 ); + +VOID D3DUtil_InitMaterial( D3DMATERIAL7& mtrl, FLOAT r=0.0f, FLOAT g=0.0f, + FLOAT b=0.0f, FLOAT a=1.0f ); + +VOID D3DUtil_InitLight( D3DLIGHT7& light, D3DLIGHTTYPE ltType, + FLOAT x=0.0f, FLOAT y=0.0f, FLOAT z=0.0f ); + + +//----------------------------------------------------------------------------- +// D3D Matrix functions. For performance reasons, some functions are inline. +//----------------------------------------------------------------------------- +HRESULT D3DUtil_SetViewMatrix( D3DMATRIX& mat, D3DVECTOR& vFrom, + D3DVECTOR& vAt, D3DVECTOR& vUp ); + +HRESULT D3DUtil_SetProjectionMatrix( D3DMATRIX& mat, FLOAT fFOV = 1.570795f, + FLOAT fAspect = 1.0f, + FLOAT fNearPlane = 1.0f, + FLOAT fFarPlane = 1000.0f ); + +inline VOID D3DUtil_SetIdentityMatrix( D3DMATRIX& m ) +{ + m._12 = m._13 = m._14 = m._21 = m._23 = m._24 = 0.0f; + m._31 = m._32 = m._34 = m._41 = m._42 = m._43 = 0.0f; + m._11 = m._22 = m._33 = m._44 = 1.0f; +} + +inline VOID D3DUtil_SetTranslateMatrix( D3DMATRIX& m, FLOAT tx, FLOAT ty, + FLOAT tz ) +{ D3DUtil_SetIdentityMatrix( m ); m._41 = tx; m._42 = ty; m._43 = tz; } + +inline VOID D3DUtil_SetTranslateMatrix( D3DMATRIX& m, D3DVECTOR& v ) +{ D3DUtil_SetTranslateMatrix( m, v.x, v.y, v.z ); } + +inline VOID D3DUtil_SetScaleMatrix( D3DMATRIX& m, FLOAT sx, FLOAT sy, + FLOAT sz ) +{ D3DUtil_SetIdentityMatrix( m ); m._11 = sx; m._22 = sy; m._33 = sz; } + +inline VOID SetScaleMatrix( D3DMATRIX& m, D3DVECTOR& v ) +{ D3DUtil_SetScaleMatrix( m, v.x, v.y, v.z ); } + +VOID D3DUtil_SetRotateXMatrix( D3DMATRIX& mat, FLOAT fRads ); +VOID D3DUtil_SetRotateYMatrix( D3DMATRIX& mat, FLOAT fRads ); +VOID D3DUtil_SetRotateZMatrix( D3DMATRIX& mat, FLOAT fRads ); +VOID D3DUtil_SetRotationMatrix( D3DMATRIX& mat, D3DVECTOR& vDir, FLOAT fRads ); + + +//----------------------------------------------------------------------------- +// Debug printing support +//----------------------------------------------------------------------------- + +HRESULT _DbgOut( CHAR*, DWORD, HRESULT, TCHAR* ); + +#if defined(DEBUG) | defined(_DEBUG) + #define DEBUG_MSG(str) _DbgOut( __FILE__, (DWORD)__LINE__, 0, str ) + #define DEBUG_ERR(hr,str) _DbgOut( __FILE__, (DWORD)__LINE__, hr, str ) +#else + #define DEBUG_MSG(str) (0L) + #define DEBUG_ERR(hr,str) (hr) +#endif + + + +#endif // D3DUTIL_H diff --git a/saco/d3d9/include/d3dvec.inl b/saco/d3d9/include/d3dvec.inl new file mode 100644 index 0000000..ff7fdfe --- /dev/null +++ b/saco/d3d9/include/d3dvec.inl @@ -0,0 +1,255 @@ + +/****************************************************************** + * * + * D3DVec.inl * + * * + * Float-valued 3D vector class for Direct3D. * + * * + * Copyright (c) Microsoft Corp. All rights reserved. * + * * + ******************************************************************/ + +#include + +// ===================================== +// Constructors +// ===================================== + +inline +_D3DVECTOR::_D3DVECTOR(D3DVALUE f) +{ + x = y = z = f; +} + +inline +_D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z) +{ + x = _x; y = _y; z = _z; +} + +inline +_D3DVECTOR::_D3DVECTOR(const D3DVALUE f[3]) +{ + x = f[0]; y = f[1]; z = f[2]; +} + +// ===================================== +// Access grants +// ===================================== + +inline const D3DVALUE& +_D3DVECTOR::operator[](int i) const +{ + return (&x)[i]; +} + +inline D3DVALUE& +_D3DVECTOR::operator[](int i) +{ + return (&x)[i]; +} + + +// ===================================== +// Assignment operators +// ===================================== + +inline _D3DVECTOR& +_D3DVECTOR::operator += (const _D3DVECTOR& v) +{ + x += v.x; y += v.y; z += v.z; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator -= (const _D3DVECTOR& v) +{ + x -= v.x; y -= v.y; z -= v.z; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator *= (const _D3DVECTOR& v) +{ + x *= v.x; y *= v.y; z *= v.z; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator /= (const _D3DVECTOR& v) +{ + x /= v.x; y /= v.y; z /= v.z; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator *= (D3DVALUE s) +{ + x *= s; y *= s; z *= s; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator /= (D3DVALUE s) +{ + x /= s; y /= s; z /= s; + return *this; +} + +inline _D3DVECTOR +operator + (const _D3DVECTOR& v) +{ + return v; +} + +inline _D3DVECTOR +operator - (const _D3DVECTOR& v) +{ + return _D3DVECTOR(-v.x, -v.y, -v.z); +} + +inline _D3DVECTOR +operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z); +} + +inline _D3DVECTOR +operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z); +} + +inline _D3DVECTOR +operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z); +} + +inline _D3DVECTOR +operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR(v1.x/v2.x, v1.y/v2.y, v1.z/v2.z); +} + +inline int +operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return v1[0] < v2[0] && v1[1] < v2[1] && v1[2] < v2[2]; +} + +inline int +operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return v1[0] <= v2[0] && v1[1] <= v2[1] && v1[2] <= v2[2]; +} + +inline _D3DVECTOR +operator * (const _D3DVECTOR& v, D3DVALUE s) +{ + return _D3DVECTOR(s*v.x, s*v.y, s*v.z); +} + +inline _D3DVECTOR +operator * (D3DVALUE s, const _D3DVECTOR& v) +{ + return _D3DVECTOR(s*v.x, s*v.y, s*v.z); +} + +inline _D3DVECTOR +operator / (const _D3DVECTOR& v, D3DVALUE s) +{ + return _D3DVECTOR(v.x/s, v.y/s, v.z/s); +} + +inline int +operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return v1.x==v2.x && v1.y==v2.y && v1.z == v2.z; +} + +inline D3DVALUE +Magnitude (const _D3DVECTOR& v) +{ + return (D3DVALUE) sqrt(SquareMagnitude(v)); +} + +inline D3DVALUE +SquareMagnitude (const _D3DVECTOR& v) +{ + return v.x*v.x + v.y*v.y + v.z*v.z; +} + +inline _D3DVECTOR +Normalize (const _D3DVECTOR& v) +{ + return v / Magnitude(v); +} + +inline D3DVALUE +Min (const _D3DVECTOR& v) +{ + D3DVALUE ret = v.x; + if (v.y < ret) ret = v.y; + if (v.z < ret) ret = v.z; + return ret; +} + +inline D3DVALUE +Max (const _D3DVECTOR& v) +{ + D3DVALUE ret = v.x; + if (ret < v.y) ret = v.y; + if (ret < v.z) ret = v.z; + return ret; +} + +inline _D3DVECTOR +Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR( v1[0] < v2[0] ? v1[0] : v2[0], + v1[1] < v2[1] ? v1[1] : v2[1], + v1[2] < v2[2] ? v1[2] : v2[2]); +} + +inline _D3DVECTOR +Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR( v1[0] > v2[0] ? v1[0] : v2[0], + v1[1] > v2[1] ? v1[1] : v2[1], + v1[2] > v2[2] ? v1[2] : v2[2]); +} + +inline D3DVALUE +DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return v1.x*v2.x + v1.y * v2.y + v1.z*v2.z; +} + +inline _D3DVECTOR +CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + _D3DVECTOR result; + + result[0] = v1[1] * v2[2] - v1[2] * v2[1]; + result[1] = v1[2] * v2[0] - v1[0] * v2[2]; + result[2] = v1[0] * v2[1] - v1[1] * v2[0]; + + return result; +} + +inline _D3DMATRIX +operator* (const _D3DMATRIX& a, const _D3DMATRIX& b) +{ + _D3DMATRIX ret; + for (int i=0; i<4; i++) { + for (int j=0; j<4; j++) { + ret(i, j) = 0.0f; + for (int k=0; k<4; k++) { + ret(i, j) += a(i, k) * b(k, j); + } + } + } + return ret; +} + diff --git a/saco/d3d9/include/d3dx9.h b/saco/d3d9/include/d3dx9.h new file mode 100644 index 0000000..822f0a8 --- /dev/null +++ b/saco/d3d9/include/d3dx9.h @@ -0,0 +1,76 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9.h +// Content: D3DX utility library +// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __D3DX_INTERNAL__ +#error Incorrect D3DX header used +#endif + +#ifndef __D3DX9_H__ +#define __D3DX9_H__ + + +// Defines +#include + +#define D3DX_DEFAULT ((UINT) -1) +#define D3DX_DEFAULT_NONPOW2 ((UINT) -2) +#define D3DX_DEFAULT_FLOAT FLT_MAX +#define D3DX_FROM_FILE ((UINT) -3) +#define D3DFMT_FROM_FILE ((D3DFORMAT) -3) + +#ifndef D3DXINLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DXINLINE __forceinline + #else + #define D3DXINLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DXINLINE inline + #else + #define D3DXINLINE + #endif +#endif +#endif + + + +// Includes +#include "d3d9.h" +#include "d3dx9math.h" +#include "d3dx9core.h" +#include "d3dx9xof.h" +#include "d3dx9mesh.h" +#include "d3dx9shader.h" +#include "d3dx9effect.h" +#include "d3dx9tex.h" +#include "d3dx9shape.h" +#include "d3dx9anim.h" + + +// Errors +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +enum _D3DXERR { + D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900), + D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901), + D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902), + D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903), + D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904), + D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905), + D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906), + D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907), + D3DXERR_CANNOTREMOVELASTITEM = MAKE_DDHRESULT(2908), +}; + + +#endif //__D3DX9_H__ + diff --git a/saco/d3d9/include/d3dx9.lib b/saco/d3d9/include/d3dx9.lib new file mode 100644 index 0000000000000000000000000000000000000000..cfb8f730a80fc8632d48ed7c4554ef5411f20870 GIT binary patch literal 86070 zcmeHwdz@WWb^kgcKnO8}S3sU2ydi{SUP*Y)WF}z(lVqG30#Zx3nYl>@?#vzT+=&UL zYALl!skM~0)KW`ZN-3q3Qba^VM8p@OA|fIxB3491L_|cy-&%X0efD1abV(~>1c1`_m`xXEiKDh<=+>~2AJ`F zfZGlMxP2YKN8StY{0)-sx*ve(vGY@U2!D~j{i39g-vxk_bY3M0UONVel2c{~f_rCz zpif>2Ky>fRl0J1IfS~W-FVcM*Bz@*~0HPOO5R~i+AZS(v5~5w}DZPNdNNrC_Y9D|E z3BGx!r0@D<%E3*yOM883OL38mJ>9uPGB}ZUh5FL*Bh6GQ% zPts?4uso3-L=2+uJ|gLvO96=xj+}pAR7DgZPW| z?QN2tcn$H8zOh}>Ba2ZF=_?(QzIqD)(Zh&C^fmmO=)rp=edRWkL;C6xNe|zIa!6lW zB9-dG2znZSu{>Zz5WM~j@}I#vc%P)X z_dr6l$L*5lwLn5N_Y_ISpo^sDlB`VGq5icGz))` zR%00pIs|`_dLNOr=3YpM&b&j?8EBvAtXm|ly&Mvvb(%t9X#Tq-EqD?VqJ?)$I&>x^g0|x?(t?VlL*_yv=)L%hbSS2kXyHmphdlrZ(Y||0 z+UJAVUXb?NENT9Wh=+7A`bu=*^(h^Lzeoq%Ea@Ojw;;^xgOCoubQA6Wprp5=pMpB^ z7wNDeNe5#+B06CgNymK{5sP| z^egPoiC(=~(ytfec#HI_TP3}Ue01jW{Sf^i z`qs6Q?t2*LR}bTufwqV`?vykK^NnbC#3JfAO;Y>)IG;k=eL&LeM{$1f=*Ep}*7mO- z7~0sgYOs4?P5;pPfsG@rBimPOY-xv$8`quP*XK&WyOoF(80tNH-B}xZx`w)7V^3?( zxjp4gQ(M+f)yti2Xk&D2VxxPT?8iW1P{u1Vluy3%0e5G6(_c_DvljMd{WpqSHE^RT*^7|xtMtQtk z!!)K&upDuDq%nw@TN&NFLps6~9G399IyQmjva&igJ~BGKWpH9^xmNCM;mHlkcr2`} zZjY-g0Yi6PwKi6&Oj;!_Q4OA!?l%u)=?XbXcEjgGGw-(2ln%CbkQGN!9TeNRkH@jaU8 z^2$nie59QADiLr>o-IojS^ify$ErrkRa%rR>TN_lBpyR2yFLlh9x6{xmMazP-`4e) z>cd;hlU92U2#{`1dAL%-uCZDpT*@0(E4*ydLrGH5e6HtZlir%~Iu1+a;ks3C`F$oi zIJIfAjPk6n$m9(!(;BLcTA81zC>F_|y`igKDNUwbMF&f~%QH0kOSSrFoyOO8R#2%D zXEVLwi>$KER8kH}58~)k7lRM42mHR2q@hL(JpHxmrm|J}#m+qxIEH0 zr(7AqNkx5hm}(fyDu+e#-PQ4JC{C%6r8HE<9$|FCR*uVsEa50yDGPhfIO)P#!osE) zHAI8)4Dx9&Ma?PWlGXrLU7<5LdI@GV8!TKNX<%&&DL5=4pS5Piw$i6tGZWytnJ+!<2C>!MDGcRzl< zN+aR)j^cz67lU_*blQWV>cxFhVJr3!>9?XsOFv%^`>b;15GK#m2%mXARHZ2oCXh`N zqGAy{=zJbKQjF|~SzJ$fvR8Y-P9O2!UiZ|#3z#Jcb6)|Q#5K@4-LFi5q4st zWKXt}v&uU*)1-W)YkYL9L}Sw+j+=Z!+elJd>&Dr5jryX-<|3lnUgi{b_gEV$6`aQN z$|QXY$&sZq%5|Js&=^$SE;?YAqr^ccz7ikEHbtuBdy)vKg=q#<*vzgpR`1t%cBTr_!FLp(FGJd>8xeJ$C&qk;_z zi^x}f7*p%0hh7hW!P4?W)!LLZ7Z9Ve<`~lD(nPgx4Y|_&A6}#wB&H(@!p+$1?ih z>2cj0P?n{9$Z`&2LWJ~ja8ljllb5JCpj~#{c#AQK95s$vkI^LmLK5(&! z9lL7_*wKBPCBU*b>XIYr@k$Nw(fl!mJT}txZr-t3UK=uGfgVy*tKp|ukAPPfn>Xu} z9ph5KtD9BS1}2!C%7YEn%G6jnR!Myler;bB<=VW4Y96n7dZmv_ASC7bpse_+r)!1R zPR)0!T*w_q(Dg`K^|V|KXNb7^s>-pUjc1A>Li$v3q{(olboo9_UzId9d5ttVtfJ}M zvt46iGS{qflH`xF$^wpiZ9J&TAou;=&AYtPO%qx@7ii4!i* z<5f^l`{ofrxO}#xptfaYZQQr0a6_AZ9|JaRKb=gDd)h!;`x+GVd)q)<+cnCF#wmI< ziA(fbxu^q>b{m-Yk%Y%~e{g+&p?NUumim zIhU`L8SV`UmXbF-kPMxHmV;c6dEnFZ2oNT%W@3b>jKdUfJ9riJv4yXdYN_7ZGE`mK z(N(LJcG#KXV`q9xJBF&QEkQk-O?n&3!!6QDif~~|s18fX_m*p8^g@iU5R%2I7dH$JN3>w1rp%~e`MwbJ1C}Tr0Eez zb=w-{o=<>uMGV*Wo-$5o#zx0WxS4^CDPFdzH;e;sb5@Twe zwNsV)=tRXHzoiaix;ok51M==nC2Jw{49LBY5!0?cVG71j3os@03S>I1#r{AEmAr!S_HGPO=W zw#EsZc8qQ-Bbd)!SHi1}mK$iN5?<}q)oqR8wNS`LV<*r?%#Zb(H`C0%TqAEh{i%@| zwy4*qOo%{p+Dk>Xz4f*F)@mSoOrE6?$PA(3u=UKy zHIfPWZ8%+R%$6g}ZL$e~&khsdx^fohJgw{WFafTs#(!3pTGL>2y*_JSu~v~BF1>2| zM5w@07MCByNVW;98`cP#YiV6PRT{CL(RnM`6)a8)Kb+VT;F~Y@)e#fLl*ig zrSWt%$SFFPmuY0X*hGvgpK1v;S0K}+x2FBo(eb*h5LQDJ+CC9i-+rd$s*;;&WrMvB zk275z-=ma3%M`T)X?IsE)mqocg;SID!4if!q%%@BbqmW_7Q{}4(xek~t}&PdX|Jx8 zC&$aUAc|{FtW8-Afh1l@$o_1wUc%jfOhdj2v)Dp!Vk+HBAW}EUA9%VwT+-^otsG;U zaLXL__Tf0um{iybMyjxfF25Bi<+q|<3fb|Xt|cxRw}yx;OT*Trq-!l|Krl%sja0R> zmOnX1gn~BgKr62e9cSgRb!PFvy9R<@f0QjJyjg}G>%?~M90jcC@E_^^7B({sp#FJ#91WYGdfvf zjnhK%^DRvo*lcyNhNi)1K4K1tQ$kq##jKTX8eFEeW*pyT43@`mxn*?Nel*UsJyOhy z+`ie+j8BZ&87$#p9heR)^_d@x&or_Bo~&achDz8o^6od&c4Wu`3+|A4#nl4>S{FC= zZJ}y~6m&x)@uNNtaZ@V->vNO5)sA>6 zTLw&_)J9JY7YS;8>9zBXDncCuvgua610x!Lh8Fxs>j*#H`uH0NePzXQl)Qn%T{~StCet5 zNZSxw6i3mi)Pm(a!FWWpK6Vr3uqx+jt={t3=%hF-Nb2(ND(SdSMp{T0;^|ekc%#f# zz6N_e>{M@Hh-LtTQxoM{cLnFlv=^5(4^$4wa0}{~iotFxq(U38L`YwDZ-|f{=fi7? zkL%IG7yj1rm!+r#m@cI|MdfqDOxcpq+G&Kr8B=x4uikP6GtcWlNKRYAl&>1!LYo)) z`d#LO!4+E7@nKv=9!H|X3-I_2DCrye4NlQ|uT1Ko`+lgXQ5i8cFrhpY8MOG-R zp829WZ_AswT-1`~QP5K6Q|fc$ym2Iqd@*^J2Oj$wcIutfj^~9(#>fZGwLI{mkjxu6 z1-VU~g1kBbIOH~fb+-e&_agu|JdbA>;#r~RKZa+#BE9%+JPY;X09SP;aLj7}Gfqih z=Dh${eiF~j#or4*g=Y;TZMYB5QT~iLzZhWG1S+!KJnI%^df$@3d8a0@&rbm^c>&s4){*)@hW@Qj z;Gs_goQbs869AW;kih+?CD4cTFxq-(P69K!5?G0NxBeP^+bw}}XD9Fo{yyEBz$WzP zg_rT{#$Nzz`X$~=@fCnu zzKS|{KH)82!!sYz)@^ui3EsO2?=8Z6_k9`v{u0VRggm5^@OlYekH3z2{#!hk6=?*I zg?t9D@54O2XKn(w?~y>uyaZ0czi-9g<#>JjvIK5kp1>laJrg);uLKU*JArGEZoupL z`y_B3-n;sw1gp6h;;JukYM0q?9^MNk{T!Hr%U_E*r&nb;2NY?QTBS2dl6;c^)%)KVqE%TfFo95JwX4i#oq-l0rb5HaKXE&m%w9qeJ9$v5$#-uc6w1~IqEDy`Sa1nLX_#l zx;blp0$1&uKpWPV$M;KM-Tn!@3-3L-Ac4CVV*5EXf$c~YyqkH2EVdz}GmpV^B0Y9A+Q9qs7bS2d(mU|_)gu$Q4CyMY=X3CP{HO$;Lc0EL ztfxp{z&7#>*57s5F8V);eFIY8o%oCN#2o-ve*(+#9_$y8=6n*%AFrPVtaCeKK4Y1! z+X>qww(l#jo!^UpKb~NloRPqzNay3H3*d6B zr`O`|!`NSSVB5H}1IuR)>g}GuY54d3*iQ}M-;d5t;QccI_DtTA%uV)4<|T{Zz3?Zn zGyEy+2D>G*lKIJA$==C6$-c>4cnkaw>;dy&PuL4iOHPEvFeh0JYhiC#1@DJHhrfdl z!S(QO@B#QM_(!-7u7-6`f{S1aY=u#{5H`c_!zLJp^I;>l>M~pa?|`%695@#?z~M;` z{2uI{>;k*OGB^-cBqt>&C#NP$pbyT2x5F$r2o8orU_A`M+h70&;eGID@V9Uc{0rOw zSHfSyKfs6KDmW!snDoOH@E7p+a4q~R+z20pzlMK;e}=z-nXnKJN)Aj8hkf7{_;2`6 zxE1~jZiAcQt;t8=b~qin;WX%kmCyyVlOvL&lVg%2lcSR5usf`QUN}BE11c~9V=xX? z*e^LOIV3qWS&$r%9Go1R9GC2$905ndQLr!U2m8Z(I22aE$#4>^PF5u=ldhy47Qn?Y z1vPjlOhO&D!5_f8;Zpb`_(OOXya!LT{sBA+Ux&xx8TcVQ2H%7i;6?Zu{1l#pAH%co zJp2TH1TVpp@ICl8d=U4;34^O~1;4C;3W+po)J0&xcU6NgsB>4^e8eW56 z!K?5~co|-S*8w}!q$4>YS)43MPJvV5t#APJB;848 za(c2IE`c5J@9-aR6I=$D!ym&OI3A9J!=MdXp#_eHW8oN>4IS_?xD!4KcfeinAbcFY z1b4$ja4&ok?txFh{qQh+3cd{Y!B^nZ@KyK>d=0(;pN9wFbMRUCB0K^oU^|-ee>L&{ zYU2L~HE|~yInUSMv*mMsTg`;!$`4I*{d~Pt>%lLf>n=lhrx-*m#453k&s{dPgOU>bFzY8!*Wg=Y*symh@7~~cOApseqy;p za(&O{DF+wt`1zN8?QS%@8W(es` z-&ymOAjWa;I<5 zk`fcCjX`Qbx$CZ>MZG&HEd}%3Hm#k${mB}%C~$rjj#ZqTsftVY$r8>lrF-U(luD<3 z^I-c)H4&HW#bHKDQuorPO)SE!|1i>|-Q}kNNOu*NO2d~Uns4-R9_z?ubwgWMPKWI) z3GyM70xjb|CyM-3GJa3hd1pF(G=WXw;NnK z-?ExvdRMh#dFmB6gvXyKw%a9J`gEQfA0{jTHJpg|T|pcrMKcFAaS8SI&^vtDw@?(25RGgjHs*(X_ikE!Gf&X0+P%yLSxzu< z#$ihMS}?P((&LRH67E-UU$1Wi?rLJRS{r_a20eL%&cE)CoF<(q8wYV`_nZ^5qlZ>E zI2M})KN5r$)samyt^2xdtC2e(pr@7|0o_*A$QKdP6Uy*u@rt9r8zj;s4~*uAKT|-4 zbI7!k=20B!UFRh0^uGV>$PiO^P3c?|9dRt=JQ~u6q4HFBR0!Y?%}do~i}prMp{nG* zk;pJ+J{;1eg6^2O3av@I4)o)VMDC;}(OA8_T_(f`EF^9ge4S0|vpbDGR6^?Xu2xK8 zadLGoK0KsF%5G-`t{z<&R~1)=&$xO5#co?)q9G5m?*~xJL|0UUQhJ=PeX=~}V!FwZ z84LyRytr1`;Bd1#oa*W@4c&R96X>7>x1m1nA(DuBV5TwjtsOF*POmkrSxy#H=S(^v zcnt7TF$}1a2h;hYrK*ZrKV$|3^s}KQpq>*<|K;fBPaEfXlg34O$}~?UENzbDmS+0X zpi#?6(u~|q zh&!>=yvMwaJHhyEXYY@cR=34g2pU$Ifzl_*3;_S=i?5r!4=z?i%?zXI|jqr3^edL0FuR`6WkyCy> zDlKHbamd(~M7B87+EtW|tJyxNOvTym#y1RQlX-rd?<3MB>)X4fx!&z-s?Ddvk(T!D zjZ>{Sb4!am3DGQX<#gGy{8Z(1`Q9q0#TxIlqf9sCFUB2sp^b9(7En^nK0=j!PK)l^ zp~7y!Zz!CWhdxVN!2n^+4oBEV!+z6X#_XGHgE9zK+Eq+D#x~{3lVr@uUCD^XTuTuv zMj9hL*^Et{Nv1kd3PJP;;AAXqgi0X$Dx`o(weY5%w#A|uJ-lqXmGbnIP5GF%kN}_Q zr;`<>X*$nX*|a1m!Bd_-u`9c3tGS<>vp;P|wiM$a^4})6bHAHX>>#%)5NJU<%@J9>13V+#Zc(jeyLo#4C!J6apv3UzmcHwHohdlErM3LIrTK1d**q6FJAsI$ zE4%BYtSykeZT{@_9PQ;hkjt0h`hX*|?&!NbEzTD=-LHw~_};kj5pfkuOEm5EohTklOf4xfk8_+&Z^|5$vPlfVd??K)q^o z(6Z1U6%*u`kgd@Fy>v4^$WgSva2^#%Uj&&lzK9{l-_{^*C@zerWV#>O^~4YvR>T{s zP$ZEpr{am6`@xU1)6B2tk1eu|7_V-uPDsA~G5EUX@_m&-LGiK|*GM9m%BFbjn@=>G z!_mwzhiN5`6(i>{$8zz#foa|Ha`>TyMUFIfTZi7LvBC0BNygHlVxa64=tw9ZhsQ(3B>ZiY ztjpLaN4N35|8Sg?ZA?W=+4tqTPxw$7dbZ-TGFcDlp-aV2**19;mCg0VQaLi}jgMI0 z4svkj?c1{j3_Oar9P(XfntjGuYn9GA}=^hP>PKMww}K z9&5(#J0GqHa($nMNSlyY-{FcW$EUVqX0Scc zY8E#Zvu24Jk!u!5#jjbneNk+dNHCVolw%QXnqdW&Su+ZYtNSTF=L(3~k02f~)&A_K zkBF%K;GtsMc_*G*wSo#%YD!8WDj?5-N+{Bd&(QubF)^qfb=6GP{b@*SS$5o7UmK0cKs z>*z5#(pR+*YID62cFeRXp{zK0o7SZ8F@9Mjfc03J-8UldG)95_c1s+^ycLmA@m(m`y=HM5$y9|=TM=Vd&9(T@> zv07GYM?cKz4w6k5gK|E5>fw%TotsAUakqRieU`*jZF6Zj+Z$ppwU9sQ^PTco=O>%2 zdL(^iY#37^aqKC=GNY=Jz0?vAvsXndG4-TM(SJM}{)c}85Hjy;SEHMW$-Ax6wJ zN|)hQCK^bcAsX<^h)=X#ast6Z0y;{I&+}v@Qf8uGVTpfkCGQtXydPjOBN^=!&@?0P zeS$2Cz>I3N^|_EWRhP*ZB1VLx*My35)JzrEsG}WS9?f5}m`Ba#!Hq^FLr6r%KU&;u z7L!FmS^_N4z~W{3Vm(xb;v%)Wu1j`wgij`N`oHSe*s!myhrcoq=(@COAmLg-)%YyD z*XOztlC^|49M_Z+P3beKV=BGeiyMB!K*v}54A@bYS|$ta%3>`wPe)vu_f*`ad5;1j zdGw{tiaqXl*Ntu1hOv1%4KbW#gG~%>_}40a^p!IUO#<1gFk|M zV@tInk1)0F>k}Dx5mPi~c)TO76%%OKMWz`C$T@+riY$i4XvWi#f!uDUtYa)=0u9Z0 zXDQ4RDG@N_M5;1p?08kq3}znxI4)O8&%d@_cA~>>94lAMGR~SAk!r>Zr7{x;JedD^b`}#Hx^`5=%tc^WgLtUU4i$^Mz6BjI4u$2C-Xz6Hg!wciz zlJxJk6)V!eE|}ey>;&uTC$Ge#bMa(N@h@3CQrTQh5mkekKc#i;t81&k#y)EIXDAUvODo)SGu!R-4O{Sjh)n;Hj=>` zTBcp!q5Fr?f9XH6g$Kf>SM)Ojk2nQf<65(}fBnGF#-3G!-2-d-ht?0|2#^j}m)T~L z^VFA?_7_k9h)O;`z}&OuYz=uTB|w z;r16ppAkpLNp{odYOt{Kdnu-Ur!cx+@U}C*c={tA%xvs|cxG&_1lj}Te>mpB&dLL4 zD@Svf%hYgf?TSS-(=0&brA82Wd(Su!?2kCRBz4OEbWNjc1dV8zC&C!rK zi=nGGuvQ~4T+f!NVb02N>QHy%h_Rz@n@hDCGAthsMIUBoKA8J&7+m2rcLeZ`MZDcJ zJpaC)CXoZ>dpsh~@gVd4Ld{{v+Vfj9wzUtbIn0i1HqOVbMVQ{XUQ9iN;NuMgH!t$E zr5N@eQEc%h(u8A<~A}fS_YX1nX3==ld-atMF=72|IKEG9C zd-f+bhZ~y{9AMyXi|>16PM831st>a~;OF<7NX2V(M__!SImyBxuAYx!G!t{cyvUR8Sk52b5MS&X z`Wdm>Y#h@MVF1W(E3jRBk_TjKdvT z&3O{5l}9)9L_}>f2h59HB@%i5Jtm5;XX|!x6!szTltgRm$L8`uv<|B%rqhe#a(W^5 zo14I_b~IZa$LI1wyvlFNhuCWCBFhJ3cYJf0fjY1d>%a*dQ*XL&3b7+l^N&MB{I;E3 z-!(V9(|D-%@;8ONEHKNUmn0{~ko92H^a^jxhb4J@n1)s6Ws%WfX(JzW_tW%RbIgyH zynal_igV<-veoAY4nR$>lmup=v?AB$!_;*UL-AQNC_DfZ?^n%0`t=OF7-q0AJ%fu1Q+pVwNbYD4lgq&3oV*IB6g z6szV^8he&s&oSN8u^6;@k*iKcT5rD}S#4!*`ngrd`ts-kS~GbY$JU2=nF(agDNkx+ zD?`$cMeC?C%c)+Dqf2tX*}0POb?7>fW^}o zL43Q5I1SJEvABryTtqy?j?NZnE|sx}qu=vl>cymH->!88*3Kwy@f}g@>3DY#L;w8- z=+p4dAhMo(eiVHg->3y@I0dk8%;f_`j93%A!tE?p122er;XZboZ6Qz38GDmg3S#SJ zHG5iJ6hHQUc~e7tY6W)oPp1dNIXn>O7n-1~KWerNMjCq1{F}2_{7Tu2Zy!*}l3%?3 zN20_wd-2l~2d$7e(~CU$9$RtRV&SUuG);`+v$NQ<+*Xd5Za~)ObT)?^YiFYo1ztvwdSQOV)MG>(3OXOxpMH^vHhLStaFdv{{>b3BJH z&5wl30yBDw=cqRDU>e86z>IJ?dNGmH3(-=n0x^4!JbmM`h#wc{_5)i>vwlQMrIyo= z=10i(zz9Vf1}Bvl<~h4&b{C!x#A4Fx8f~~zs+H>1n&_g%C*hkz4fF=IVlkDW`c4IA zu!TqeSY+ik4{kd4+Y`^?xREy!?^L+HQ;b=1&5JzkD)!!GdxnYuJ2Hj`&jU3PiqAM= zYvnr(Jp0h)CQ&1Kdr1IQ9IMP=&5K-l8+e+dRiHmGQPWL;bk2c^@dk1?&^ysu=A|CQ zX-H$FmHwfL$mfqur!@BV<6S}AX-IEmUH;t$E@|Ne1GgS9{a|T+t&yUSAFK4KcbJLj%=0&b_ zNBXEgVIJt?*iDQ#&__k)F7IWC=`rsN&b-KzzSujhKV@j1)8kFB!Zj+kit#>%96FSq z!56Muu~>umYkc#tdj@D;!5BQ*s zn|)8ANzBOX?k_cFoj&Z)S03L|-)c|SP5fMKIx-etWg(`A_RG&dm_UVl&e&VGzcNv4 zqquprue_~Xu@hRnw~UPcR~wl2*D6>-3!}zHr@uB(oljiQS1=f~d6B1NV|~Zp#E|uJ zpY^a()Pq>s|2F0U9UN+cv5P!ukB!XNgphTo+5EFhpsrEm_}?|ccNZ3?wbp&e!1sQ- zq`90A%rtMTIT4@qJuzpEz*8jml_k6*H!J8L( zYJ6;z{IG*=ei+6?dIO_mWW@SM7gv68hC!Maxl$TvTNIIhor9>(KWcVWEA}4kpA1y< z>o@C4V|a?R)rl6b)qxzQvvK}8fUHt&gBQ)~Sj_Fe7})8|!1|nziS`C+Rv=n~&KS5} zVP{9>H^0{<_H^^F4xaw}P?M<)lrF93-Qb|6pEY8T=0&dd6X>VtRF;2Ji1dLL{akQttJA~P^Th!eUlg44QVqoK3Dlh`p5t9V#;q(nK;E; zYiy6=%{D6kdX@ObRdeXEH~s$^N7oh2>ZnbR^5lCg2X2Y`;65Z5A0;BS{J%_e=QCc; zgT}OC-x|esCi=y(1GSxI+W&1~>zxXEeaL#ym{$DT8sbkw`UCMLv^)QQ7{1!MKxt1u zrDj&~;(dBxe5TV8Z#R)WUua{%#q&Ip=8rIB&zIjAw0V)MjR)S-(2m?YBFMUvX?jmk zB<&xKc+mW~5}OO&89-Jae``8kH876Sv(?7}*lHAax4;)J^$7Z14ba^!$c51ZGenyI ze>{M$w$9k0>V>f*ZTxN%TfY0%-Kq^-yp0FeCFvBZPlSeppsOEP(8LWAcX9f{_^YK}Z zsy?G@sbVnnY8==L5^;G)3rIw*xsQpc`&mNrOI!`GH~-EPYK7c zABthikF=U_g-bfta=+}smS25kkcG=Pmfo*$OyhgA*%xyexOvfRUVk-)?MZlH?8vtz`8h4g%FP_hlk@A~s{_^~uU;m4;BX*Y)%nG<}QV;bM*W{}0}Q(%pP-eP^n z!py$=%^=N-TVQ_gU08?O*od_xv(S8ir5!>1ELx!5Y-WMmrHT`@TsZq}`T>0G< zPoQJrw8mP_j~HgwO*tVWW^U)IPm$U4vwqC%v$rNz@%9sYNAP2XtmiS-cbA*Pj?EpP zbFo)#pJ;ldjr0~jaS_#ePP5~C;7u>>IeXqk?Hjj~S-1|z+UrkU#OYgGiOkJkaB+i; z)~r{#+D~L|@iP~9;LUn2crlDE*N2-f=~x`a&%@|%pVm2Z;Eg`T_r2u$Fjy(qCY+_i z!gV}068^%2dht|gWE#F78ktGH96%i`*QX|$o=L`f>R-CZLsfd}?Hb=wnTCkQ*h<&->g}&J)~ao# z3Ik+s;zL7!Xsg%e}W|a_Qzl^#*|TP)!;;Bv`$f@ zgWXM^!V&AA5*K-DqFn2)Oiki@y5@W3*qgx_26nA_Ay(~f{P>pmLZcPrQZ%n)Cw}at zQN?TnJH#eSHg+n+OdIVy2d;1(ZVN}3Q8czEPjE-~?);=a~dd5y*peml;zhS2oWc5Ftue}*WY8CF)O#z*>V)lKd+sBr!U#wyxD_g0OXPTHG) zDvb3S2PnKD`ciHMUrd$dw?WF2&V;>aI%Bhe16|x~Wx<(h6|PCK6d&XwwLSADrQ)Xx;^s!ia(KpCZi;QHW=6=&Dyrlj%Wn9nH?QVyEREYGL-5hA(Qq2FKdz z0tXRa|A~c-_TS;N*kKBFL#Z+$d#o3?yIQT`GP1SoR~R?Y`;Pab%gW^>yEt;7&C;B7Q3Tna@S?dMTiHIrKyQ81`l-bx>YLP0ooHgdDgD$E z6LI?bslci|y(?d8BI1Ob)^ewzFOI|nw0IC@t+fw1C|qj;eFe?VT20h9sXuP>VopyB zjrGUvUfkb(f7}tq^(VS`uNdi%mwD0OjQ)6e1lgbP>8#l+O!TwIC#I_n$7O~GVxmsx*b}JDv@&rj!>m;&ry=4nHYY#L#Cuc5y3=^N`JV?d{g e_$G}3U0%#->J=hyoK`B_bIO$w9iwY4M*Ke~sg_Lu literal 0 HcmV?d00001 diff --git a/saco/d3d9/include/d3dx9anim.h b/saco/d3d9/include/d3dx9anim.h new file mode 100644 index 0000000..fedb1db --- /dev/null +++ b/saco/d3d9/include/d3dx9anim.h @@ -0,0 +1,1114 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9anim.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX9ANIM_H__ +#define __D3DX9ANIM_H__ + +// {698CFB3F-9289-4d95-9A57-33A94B5A65F9} +DEFINE_GUID(IID_ID3DXAnimationSet, +0x698cfb3f, 0x9289, 0x4d95, 0x9a, 0x57, 0x33, 0xa9, 0x4b, 0x5a, 0x65, 0xf9); + +// {FA4E8E3A-9786-407d-8B4C-5995893764AF} +DEFINE_GUID(IID_ID3DXKeyframedAnimationSet, +0xfa4e8e3a, 0x9786, 0x407d, 0x8b, 0x4c, 0x59, 0x95, 0x89, 0x37, 0x64, 0xaf); + +// {6CC2480D-3808-4739-9F88-DE49FACD8D4C} +DEFINE_GUID(IID_ID3DXCompressedAnimationSet, +0x6cc2480d, 0x3808, 0x4739, 0x9f, 0x88, 0xde, 0x49, 0xfa, 0xcd, 0x8d, 0x4c); + +// {AC8948EC-F86D-43e2-96DE-31FC35F96D9E} +DEFINE_GUID(IID_ID3DXAnimationController, +0xac8948ec, 0xf86d, 0x43e2, 0x96, 0xde, 0x31, 0xfc, 0x35, 0xf9, 0x6d, 0x9e); + + +//---------------------------------------------------------------------------- +// D3DXMESHDATATYPE: +// ----------------- +// This enum defines the type of mesh data present in a MeshData structure. +//---------------------------------------------------------------------------- +typedef enum _D3DXMESHDATATYPE { + D3DXMESHTYPE_MESH = 0x001, // Normal ID3DXMesh data + D3DXMESHTYPE_PMESH = 0x002, // Progressive Mesh - ID3DXPMesh + D3DXMESHTYPE_PATCHMESH = 0x003, // Patch Mesh - ID3DXPatchMesh + + D3DXMESHTYPE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXMESHDATATYPE; + +//---------------------------------------------------------------------------- +// D3DXMESHDATA: +// ------------- +// This struct encapsulates a the mesh data that can be present in a mesh +// container. The supported mesh types are pMesh, pPMesh, pPatchMesh. +// The valid way to access this is determined by the Type enum. +//---------------------------------------------------------------------------- +typedef struct _D3DXMESHDATA +{ + D3DXMESHDATATYPE Type; + + // current mesh data interface + union + { + LPD3DXMESH pMesh; + LPD3DXPMESH pPMesh; + LPD3DXPATCHMESH pPatchMesh; + }; +} D3DXMESHDATA, *LPD3DXMESHDATA; + +//---------------------------------------------------------------------------- +// D3DXMESHCONTAINER: +// ------------------ +// This struct encapsulates a mesh object in a transformation frame +// hierarchy. The app can derive from this structure to add other app specific +// data to this. +//---------------------------------------------------------------------------- +typedef struct _D3DXMESHCONTAINER +{ + LPSTR Name; + + D3DXMESHDATA MeshData; + + LPD3DXMATERIAL pMaterials; + LPD3DXEFFECTINSTANCE pEffects; + DWORD NumMaterials; + DWORD *pAdjacency; + + LPD3DXSKININFO pSkinInfo; + + struct _D3DXMESHCONTAINER *pNextMeshContainer; +} D3DXMESHCONTAINER, *LPD3DXMESHCONTAINER; + +//---------------------------------------------------------------------------- +// D3DXFRAME: +// ---------- +// This struct is the encapsulates a transform frame in a transformation frame +// hierarchy. The app can derive from this structure to add other app specific +// data to this +//---------------------------------------------------------------------------- +typedef struct _D3DXFRAME +{ + LPSTR Name; + D3DXMATRIX TransformationMatrix; + + LPD3DXMESHCONTAINER pMeshContainer; + + struct _D3DXFRAME *pFrameSibling; + struct _D3DXFRAME *pFrameFirstChild; +} D3DXFRAME, *LPD3DXFRAME; + + +//---------------------------------------------------------------------------- +// ID3DXAllocateHierarchy: +// ----------------------- +// This interface is implemented by the application to allocate/free frame and +// mesh container objects. Methods on this are called during loading and +// destroying frame hierarchies +//---------------------------------------------------------------------------- +typedef interface ID3DXAllocateHierarchy ID3DXAllocateHierarchy; +typedef interface ID3DXAllocateHierarchy *LPD3DXALLOCATEHIERARCHY; + +#undef INTERFACE +#define INTERFACE ID3DXAllocateHierarchy + +DECLARE_INTERFACE(ID3DXAllocateHierarchy) +{ + // ID3DXAllocateHierarchy + + //------------------------------------------------------------------------ + // CreateFrame: + // ------------ + // Requests allocation of a frame object. + // + // Parameters: + // Name + // Name of the frame to be created + // ppNewFrame + // Returns the created frame object + // + //------------------------------------------------------------------------ + STDMETHOD(CreateFrame)(THIS_ LPCSTR Name, + LPD3DXFRAME *ppNewFrame) PURE; + + //------------------------------------------------------------------------ + // CreateMeshContainer: + // -------------------- + // Requests allocation of a mesh container object. + // + // Parameters: + // Name + // Name of the mesh + // pMesh + // Pointer to the mesh object if basic polygon data found + // pPMesh + // Pointer to the progressive mesh object if progressive mesh data found + // pPatchMesh + // Pointer to the patch mesh object if patch data found + // pMaterials + // Array of materials used in the mesh + // pEffectInstances + // Array of effect instances used in the mesh + // NumMaterials + // Num elements in the pMaterials array + // pAdjacency + // Adjacency array for the mesh + // pSkinInfo + // Pointer to the skininfo object if the mesh is skinned + // pBoneNames + // Array of names, one for each bone in the skinned mesh. + // The numberof bones can be found from the pSkinMesh object + // pBoneOffsetMatrices + // Array of matrices, one for each bone in the skinned mesh. + // + //------------------------------------------------------------------------ + STDMETHOD(CreateMeshContainer)(THIS_ + LPCSTR Name, + CONST D3DXMESHDATA *pMeshData, + CONST D3DXMATERIAL *pMaterials, + CONST D3DXEFFECTINSTANCE *pEffectInstances, + DWORD NumMaterials, + CONST DWORD *pAdjacency, + LPD3DXSKININFO pSkinInfo, + LPD3DXMESHCONTAINER *ppNewMeshContainer) PURE; + + //------------------------------------------------------------------------ + // DestroyFrame: + // ------------- + // Requests de-allocation of a frame object. + // + // Parameters: + // pFrameToFree + // Pointer to the frame to be de-allocated + // + //------------------------------------------------------------------------ + STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree) PURE; + + //------------------------------------------------------------------------ + // DestroyMeshContainer: + // --------------------- + // Requests de-allocation of a mesh container object. + // + // Parameters: + // pMeshContainerToFree + // Pointer to the mesh container object to be de-allocated + // + //------------------------------------------------------------------------ + STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerToFree) PURE; +}; + +//---------------------------------------------------------------------------- +// ID3DXLoadUserData: +// ------------------ +// This interface is implemented by the application to load user data in a .X file +// When user data is found, these callbacks will be used to allow the application +// to load the data. +//---------------------------------------------------------------------------- +typedef interface ID3DXLoadUserData ID3DXLoadUserData; +typedef interface ID3DXLoadUserData *LPD3DXLOADUSERDATA; + +#undef INTERFACE +#define INTERFACE ID3DXLoadUserData + +DECLARE_INTERFACE(ID3DXLoadUserData) +{ + STDMETHOD(LoadTopLevelData)(LPD3DXFILEDATA pXofChildData) PURE; + + STDMETHOD(LoadFrameChildData)(LPD3DXFRAME pFrame, + LPD3DXFILEDATA pXofChildData) PURE; + + STDMETHOD(LoadMeshChildData)(LPD3DXMESHCONTAINER pMeshContainer, + LPD3DXFILEDATA pXofChildData) PURE; +}; + +//---------------------------------------------------------------------------- +// ID3DXSaveUserData: +// ------------------ +// This interface is implemented by the application to save user data in a .X file +// The callbacks are called for all data saved. The user can then add any +// child data objects to the object provided to the callback. +//---------------------------------------------------------------------------- +typedef interface ID3DXSaveUserData ID3DXSaveUserData; +typedef interface ID3DXSaveUserData *LPD3DXSAVEUSERDATA; + +#undef INTERFACE +#define INTERFACE ID3DXSaveUserData + +DECLARE_INTERFACE(ID3DXSaveUserData) +{ + STDMETHOD(AddFrameChildData)(CONST D3DXFRAME *pFrame, + LPD3DXFILESAVEOBJECT pXofSave, + LPD3DXFILESAVEDATA pXofFrameData) PURE; + + STDMETHOD(AddMeshChildData)(CONST D3DXMESHCONTAINER *pMeshContainer, + LPD3DXFILESAVEOBJECT pXofSave, + LPD3DXFILESAVEDATA pXofMeshData) PURE; + + // NOTE: this is called once per Save. All top level objects should be added using the + // provided interface. One call adds objects before the frame hierarchy, the other after + STDMETHOD(AddTopLevelDataObjectsPre)(LPD3DXFILESAVEOBJECT pXofSave) PURE; + STDMETHOD(AddTopLevelDataObjectsPost)(LPD3DXFILESAVEOBJECT pXofSave) PURE; + + // callbacks for the user to register and then save templates to the XFile + STDMETHOD(RegisterTemplates)(LPD3DXFILE pXFileApi) PURE; + STDMETHOD(SaveTemplates)(LPD3DXFILESAVEOBJECT pXofSave) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXCALLBACK_SEARCH_FLAGS: +// -------------------------- +// Flags that can be passed into ID3DXAnimationSet::GetCallback. +//---------------------------------------------------------------------------- +typedef enum _D3DXCALLBACK_SEARCH_FLAGS +{ + D3DXCALLBACK_SEARCH_EXCLUDING_INITIAL_POSITION = 0x01, // exclude callbacks at the initial position from the search + D3DXCALLBACK_SEARCH_BEHIND_INITIAL_POSITION = 0x02, // reverse the callback search direction + + D3DXCALLBACK_SEARCH_FORCE_DWORD = 0x7fffffff, +} D3DXCALLBACK_SEARCH_FLAGS; + +//---------------------------------------------------------------------------- +// ID3DXAnimationSet: +// ------------------ +// This interface implements an animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationSet ID3DXAnimationSet; +typedef interface ID3DXAnimationSet *LPD3DXANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationSet + +DECLARE_INTERFACE_(ID3DXAnimationSet, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer +}; + + +//---------------------------------------------------------------------------- +// D3DXPLAYBACK_TYPE: +// ------------------ +// This enum defines the type of animation set loop modes. +//---------------------------------------------------------------------------- +typedef enum _D3DXPLAYBACK_TYPE +{ + D3DXPLAY_LOOP = 0, + D3DXPLAY_ONCE = 1, + D3DXPLAY_PINGPONG = 2, + + D3DXPLAY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPLAYBACK_TYPE; + + +//---------------------------------------------------------------------------- +// D3DXKEY_VECTOR3: +// ---------------- +// This structure describes a vector key for use in keyframe animation. +// It specifies a vector Value at a given Time. This is used for scale and +// translation keys. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_VECTOR3 +{ + FLOAT Time; + D3DXVECTOR3 Value; +} D3DXKEY_VECTOR3, *LPD3DXKEY_VECTOR3; + + +//---------------------------------------------------------------------------- +// D3DXKEY_QUATERNION: +// ------------------- +// This structure describes a quaternion key for use in keyframe animation. +// It specifies a quaternion Value at a given Time. This is used for rotation +// keys. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_QUATERNION +{ + FLOAT Time; + D3DXQUATERNION Value; +} D3DXKEY_QUATERNION, *LPD3DXKEY_QUATERNION; + + +//---------------------------------------------------------------------------- +// D3DXKEY_CALLBACK: +// ----------------- +// This structure describes an callback key for use in keyframe animation. +// It specifies a pointer to user data at a given Time. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_CALLBACK +{ + FLOAT Time; + LPVOID pCallbackData; +} D3DXKEY_CALLBACK, *LPD3DXKEY_CALLBACK; + + +//---------------------------------------------------------------------------- +// D3DXCOMPRESSION_FLAGS: +// ---------------------- +// Flags that can be passed into ID3DXKeyframedAnimationSet::Compress. +//---------------------------------------------------------------------------- +typedef enum _D3DXCOMPRESSION_FLAGS +{ + D3DXCOMPRESS_DEFAULT = 0x00, + + D3DXCOMPRESS_FORCE_DWORD = 0x7fffffff, +} D3DXCOMPRESSION_FLAGS; + + +//---------------------------------------------------------------------------- +// ID3DXKeyframedAnimationSet: +// --------------------------- +// This interface implements a compressable keyframed animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXKeyframedAnimationSet ID3DXKeyframedAnimationSet; +typedef interface ID3DXKeyframedAnimationSet *LPD3DXKEYFRAMEDANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXKeyframedAnimationSet + +DECLARE_INTERFACE_(ID3DXKeyframedAnimationSet, ID3DXAnimationSet) +{ + // ID3DXAnimationSet + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer + + // Playback + STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE; + STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE; + + // Scale keys + STDMETHOD_(UINT, GetNumScaleKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetScaleKeys)(THIS_ UINT Animation, LPD3DXKEY_VECTOR3 pScaleKeys) PURE; + STDMETHOD(GetScaleKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pScaleKey) PURE; + STDMETHOD(SetScaleKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pScaleKey) PURE; + + // Rotation keys + STDMETHOD_(UINT, GetNumRotationKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetRotationKeys)(THIS_ UINT Animation, LPD3DXKEY_QUATERNION pRotationKeys) PURE; + STDMETHOD(GetRotationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_QUATERNION pRotationKey) PURE; + STDMETHOD(SetRotationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_QUATERNION pRotationKey) PURE; + + // Translation keys + STDMETHOD_(UINT, GetNumTranslationKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetTranslationKeys)(THIS_ UINT Animation, LPD3DXKEY_VECTOR3 pTranslationKeys) PURE; + STDMETHOD(GetTranslationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pTranslationKey) PURE; + STDMETHOD(SetTranslationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pTranslationKey) PURE; + + // Callback keys + STDMETHOD_(UINT, GetNumCallbackKeys)(THIS) PURE; + STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE; + STDMETHOD(GetCallbackKey)(THIS_ UINT Key, LPD3DXKEY_CALLBACK pCallbackKey) PURE; + STDMETHOD(SetCallbackKey)(THIS_ UINT Key, LPD3DXKEY_CALLBACK pCallbackKey) PURE; + + // Key removal methods. These are slow, and should not be used once the animation starts playing + STDMETHOD(UnregisterScaleKey)(THIS_ UINT Animation, UINT Key) PURE; + STDMETHOD(UnregisterRotationKey)(THIS_ UINT Animation, UINT Key) PURE; + STDMETHOD(UnregisterTranslationKey)(THIS_ UINT Animation, UINT Key) PURE; + + // One-time animaton SRT keyframe registration + STDMETHOD(RegisterAnimationSRTKeys)(THIS_ + LPCSTR pName, // Animation name + UINT NumScaleKeys, // Number of scale keys + UINT NumRotationKeys, // Number of rotation keys + UINT NumTranslationKeys, // Number of translation keys + CONST D3DXKEY_VECTOR3 *pScaleKeys, // Array of scale keys + CONST D3DXKEY_QUATERNION *pRotationKeys, // Array of rotation keys + CONST D3DXKEY_VECTOR3 *pTranslationKeys, // Array of translation keys + DWORD *pAnimationIndex) PURE; // Returns the animation index + + // Compression + STDMETHOD(Compress)(THIS_ + DWORD Flags, // Compression flags (use D3DXCOMPRESS_STRONG for better results) + FLOAT Lossiness, // Compression loss ratio in the [0, 1] range + LPD3DXFRAME pHierarchy, // Frame hierarchy (optional) + LPD3DXBUFFER *ppCompressedData) PURE; // Returns the compressed animation set + + STDMETHOD(UnregisterAnimation)(THIS_ UINT Index) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXCompressedAnimationSet: +// ---------------------------- +// This interface implements a compressed keyframed animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXCompressedAnimationSet ID3DXCompressedAnimationSet; +typedef interface ID3DXCompressedAnimationSet *LPD3DXCOMPRESSEDANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXCompressedAnimationSet + +DECLARE_INTERFACE_(ID3DXCompressedAnimationSet, ID3DXAnimationSet) +{ + // ID3DXAnimationSet + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer + + // Playback + STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE; + STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE; + + // Scale keys + STDMETHOD(GetCompressedData)(THIS_ LPD3DXBUFFER *ppCompressedData) PURE; + + // Callback keys + STDMETHOD_(UINT, GetNumCallbackKeys)(THIS) PURE; + STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXPRIORITY_TYPE: +// ------------------ +// This enum defines the type of priority group that a track can be assigned to. +//---------------------------------------------------------------------------- +typedef enum _D3DXPRIORITY_TYPE { + D3DXPRIORITY_LOW = 0, // This track should be blended with all low priority tracks before mixed with the high priority result + D3DXPRIORITY_HIGH = 1, // This track should be blended with all high priority tracks before mixed with the low priority result + + D3DXPRIORITY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPRIORITY_TYPE; + +//---------------------------------------------------------------------------- +// D3DXTRACK_DESC: +// --------------- +// This structure describes the mixing information of an animation track. +// The mixing information consists of the current position, speed, and blending +// weight for the track. The Flags field also specifies whether the track is +// low or high priority. Tracks with the same priority are blended together +// and then the two resulting values are blended using the priority blend factor. +// A track also has an animation set (stored separately) associated with it. +//---------------------------------------------------------------------------- +typedef struct _D3DXTRACK_DESC +{ + D3DXPRIORITY_TYPE Priority; + FLOAT Weight; + FLOAT Speed; + DOUBLE Position; + BOOL Enable; +} D3DXTRACK_DESC, *LPD3DXTRACK_DESC; + +//---------------------------------------------------------------------------- +// D3DXEVENT_TYPE: +// --------------- +// This enum defines the type of events keyable via the animation controller. +//---------------------------------------------------------------------------- +typedef enum _D3DXEVENT_TYPE +{ + D3DXEVENT_TRACKSPEED = 0, + D3DXEVENT_TRACKWEIGHT = 1, + D3DXEVENT_TRACKPOSITION = 2, + D3DXEVENT_TRACKENABLE = 3, + D3DXEVENT_PRIORITYBLEND = 4, + + D3DXEVENT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXEVENT_TYPE; + +//---------------------------------------------------------------------------- +// D3DXTRANSITION_TYPE: +// -------------------- +// This enum defines the type of transtion performed on a event that +// transitions from one value to another. +//---------------------------------------------------------------------------- +typedef enum _D3DXTRANSITION_TYPE { + D3DXTRANSITION_LINEAR = 0x000, // Linear transition from one value to the next + D3DXTRANSITION_EASEINEASEOUT = 0x001, // Ease-In Ease-Out spline transtion from one value to the next + + D3DXTRANSITION_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXTRANSITION_TYPE; + +//---------------------------------------------------------------------------- +// D3DXEVENT_DESC: +// --------------- +// This structure describes a animation controller event. +// It gives the event's type, track (if the event is a track event), global +// start time, duration, transition method, and target value. +//---------------------------------------------------------------------------- +typedef struct _D3DXEVENT_DESC +{ + D3DXEVENT_TYPE Type; + UINT Track; + DOUBLE StartTime; + DOUBLE Duration; + D3DXTRANSITION_TYPE Transition; + union + { + FLOAT Weight; + FLOAT Speed; + DOUBLE Position; + BOOL Enable; + }; +} D3DXEVENT_DESC, *LPD3DXEVENT_DESC; + +//---------------------------------------------------------------------------- +// D3DXEVENTHANDLE: +// ---------------- +// Handle values used to efficiently reference animation controller events. +//---------------------------------------------------------------------------- +typedef DWORD D3DXEVENTHANDLE; +typedef D3DXEVENTHANDLE *LPD3DXEVENTHANDLE; + + +//---------------------------------------------------------------------------- +// ID3DXAnimationCallbackHandler: +// ------------------------------ +// This interface is intended to be implemented by the application, and can +// be used to handle callbacks in animation sets generated when +// ID3DXAnimationController::AdvanceTime() is called. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationCallbackHandler ID3DXAnimationCallbackHandler; +typedef interface ID3DXAnimationCallbackHandler *LPD3DXANIMATIONCALLBACKHANDLER; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationCallbackHandler + +DECLARE_INTERFACE(ID3DXAnimationCallbackHandler) +{ + //---------------------------------------------------------------------------- + // ID3DXAnimationCallbackHandler::HandleCallback: + // ---------------------------------------------- + // This method gets called when a callback occurs for an animation set in one + // of the tracks during the ID3DXAnimationController::AdvanceTime() call. + // + // Parameters: + // Track + // Index of the track on which the callback occured. + // pCallbackData + // Pointer to user owned callback data. + // + //---------------------------------------------------------------------------- + STDMETHOD(HandleCallback)(THIS_ UINT Track, LPVOID pCallbackData) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXAnimationController: +// ------------------------- +// This interface implements the main animation functionality. It connects +// animation sets with the transform frames that are being animated. Allows +// mixing multiple animations for blended animations or for transistions +// It adds also has methods to modify blending parameters over time to +// enable smooth transistions and other effects. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationController ID3DXAnimationController; +typedef interface ID3DXAnimationController *LPD3DXANIMATIONCONTROLLER; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationController + +DECLARE_INTERFACE_(ID3DXAnimationController, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Max sizes + STDMETHOD_(UINT, GetMaxNumAnimationOutputs)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumAnimationSets)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumTracks)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumEvents)(THIS) PURE; + + // Animation output registration + STDMETHOD(RegisterAnimationOutput)(THIS_ + LPCSTR pName, + D3DXMATRIX *pMatrix, + D3DXVECTOR3 *pScale, + D3DXQUATERNION *pRotation, + D3DXVECTOR3 *pTranslation) PURE; + + // Animation set registration + STDMETHOD(RegisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE; + STDMETHOD(UnregisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE; + + STDMETHOD_(UINT, GetNumAnimationSets)(THIS) PURE; + STDMETHOD(GetAnimationSet)(THIS_ UINT Index, LPD3DXANIMATIONSET *ppAnimationSet) PURE; + STDMETHOD(GetAnimationSetByName)(THIS_ LPCSTR szName, LPD3DXANIMATIONSET *ppAnimationSet) PURE; + + // Global time + STDMETHOD(AdvanceTime)(THIS_ DOUBLE TimeDelta, LPD3DXANIMATIONCALLBACKHANDLER pCallbackHandler) PURE; + STDMETHOD(ResetTime)(THIS) PURE; + STDMETHOD_(DOUBLE, GetTime)(THIS) PURE; + + // Tracks + STDMETHOD(SetTrackAnimationSet)(THIS_ UINT Track, LPD3DXANIMATIONSET pAnimSet) PURE; + STDMETHOD(GetTrackAnimationSet)(THIS_ UINT Track, LPD3DXANIMATIONSET *ppAnimSet) PURE; + + STDMETHOD(SetTrackPriority)(THIS_ UINT Track, D3DXPRIORITY_TYPE Priority) PURE; + + STDMETHOD(SetTrackSpeed)(THIS_ UINT Track, FLOAT Speed) PURE; + STDMETHOD(SetTrackWeight)(THIS_ UINT Track, FLOAT Weight) PURE; + STDMETHOD(SetTrackPosition)(THIS_ UINT Track, DOUBLE Position) PURE; + STDMETHOD(SetTrackEnable)(THIS_ UINT Track, BOOL Enable) PURE; + + STDMETHOD(SetTrackDesc)(THIS_ UINT Track, LPD3DXTRACK_DESC pDesc) PURE; + STDMETHOD(GetTrackDesc)(THIS_ UINT Track, LPD3DXTRACK_DESC pDesc) PURE; + + // Priority blending + STDMETHOD(SetPriorityBlend)(THIS_ FLOAT BlendWeight) PURE; + STDMETHOD_(FLOAT, GetPriorityBlend)(THIS) PURE; + + // Event keying + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackSpeed)(THIS_ UINT Track, FLOAT NewSpeed, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackWeight)(THIS_ UINT Track, FLOAT NewWeight, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackPosition)(THIS_ UINT Track, DOUBLE NewPosition, DOUBLE StartTime) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackEnable)(THIS_ UINT Track, BOOL NewEnable, DOUBLE StartTime) PURE; + + STDMETHOD_(D3DXEVENTHANDLE, KeyPriorityBlend)(THIS_ FLOAT NewBlendWeight, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + + // Event unkeying + STDMETHOD(UnkeyEvent)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(UnkeyAllTrackEvents)(THIS_ UINT Track) PURE; + STDMETHOD(UnkeyAllPriorityBlends)(THIS) PURE; + + // Event enumeration + STDMETHOD_(D3DXEVENTHANDLE, GetCurrentTrackEvent)(THIS_ UINT Track, D3DXEVENT_TYPE EventType) PURE; + STDMETHOD_(D3DXEVENTHANDLE, GetCurrentPriorityBlend)(THIS) PURE; + + STDMETHOD_(D3DXEVENTHANDLE, GetUpcomingTrackEvent)(THIS_ UINT Track, D3DXEVENTHANDLE hEvent) PURE; + STDMETHOD_(D3DXEVENTHANDLE, GetUpcomingPriorityBlend)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(ValidateEvent)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(GetEventDesc)(THIS_ D3DXEVENTHANDLE hEvent, LPD3DXEVENT_DESC pDesc) PURE; + + // Cloning + STDMETHOD(CloneAnimationController)(THIS_ + UINT MaxNumAnimationOutputs, + UINT MaxNumAnimationSets, + UINT MaxNumTracks, + UINT MaxNumEvents, + LPD3DXANIMATIONCONTROLLER *ppAnimController) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DXLoadMeshHierarchyFromX: +// --------------------------- +// Loads the first frame hierarchy in a .X file. +// +// Parameters: +// Filename +// Name of the .X file +// MeshOptions +// Mesh creation options for meshes in the file (see d3dx9mesh.h) +// pD3DDevice +// D3D9 device on which meshes in the file are created in +// pAlloc +// Allocation interface used to allocate nodes of the frame hierarchy +// pUserDataLoader +// Application provided interface to allow loading of user data +// ppFrameHierarchy +// Returns root node pointer of the loaded frame hierarchy +// ppAnimController +// Returns pointer to an animation controller corresponding to animation +// in the .X file. This is created with default max tracks and events +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXA + ( + LPCSTR Filename, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXW + ( + LPCWSTR Filename, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +#ifdef UNICODE +#define D3DXLoadMeshHierarchyFromX D3DXLoadMeshHierarchyFromXW +#else +#define D3DXLoadMeshHierarchyFromX D3DXLoadMeshHierarchyFromXA +#endif + +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXInMemory + ( + LPCVOID Memory, + DWORD SizeOfMemory, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +//---------------------------------------------------------------------------- +// D3DXSaveMeshHierarchyToFile: +// ---------------------------- +// Creates a .X file and saves the mesh hierarchy and corresponding animations +// in it +// +// Parameters: +// Filename +// Name of the .X file +// XFormat +// Format of the .X file (text or binary, compressed or not, etc) +// pFrameRoot +// Root node of the hierarchy to be saved +// pAnimController +// The animation controller whose animation sets are to be stored +// pUserDataSaver +// Application provided interface to allow adding of user data to +// data objects saved to .X file +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXSaveMeshHierarchyToFileA + ( + LPCSTR Filename, + DWORD XFormat, + CONST D3DXFRAME *pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimcontroller, + LPD3DXSAVEUSERDATA pUserDataSaver + ); + +HRESULT WINAPI +D3DXSaveMeshHierarchyToFileW + ( + LPCWSTR Filename, + DWORD XFormat, + CONST D3DXFRAME *pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimController, + LPD3DXSAVEUSERDATA pUserDataSaver + ); + +#ifdef UNICODE +#define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileW +#else +#define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileA +#endif + +//---------------------------------------------------------------------------- +// D3DXFrameDestroy: +// ----------------- +// Destroys the subtree of frames under the root, including the root +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pAlloc +// Allocation interface used to de-allocate nodes of the frame hierarchy +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameDestroy + ( + LPD3DXFRAME pFrameRoot, + LPD3DXALLOCATEHIERARCHY pAlloc + ); + +//---------------------------------------------------------------------------- +// D3DXFrameAppendChild: +// --------------------- +// Add a child frame to a frame +// +// Parameters: +// pFrameParent +// Pointer to the parent node +// pFrameChild +// Pointer to the child node +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameAppendChild + ( + LPD3DXFRAME pFrameParent, + CONST D3DXFRAME *pFrameChild + ); + +//---------------------------------------------------------------------------- +// D3DXFrameFind: +// -------------- +// Finds a frame with the given name. Returns NULL if no frame found. +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// Name +// Name of frame to find +// +//---------------------------------------------------------------------------- +LPD3DXFRAME WINAPI +D3DXFrameFind + ( + CONST D3DXFRAME *pFrameRoot, + LPCSTR Name + ); + +//---------------------------------------------------------------------------- +// D3DXFrameRegisterNamedMatrices: +// ------------------------------- +// Finds all frames that have non-null names and registers each of those frame +// matrices to the given animation controller +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pAnimController +// Pointer to the animation controller where the matrices are registered +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameRegisterNamedMatrices + ( + LPD3DXFRAME pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimController + ); + +//---------------------------------------------------------------------------- +// D3DXFrameNumNamedMatrices: +// -------------------------- +// Counts number of frames in a subtree that have non-null names +// +// Parameters: +// pFrameRoot +// Pointer to the root node of the subtree +// Return Value: +// Count of frames +// +//---------------------------------------------------------------------------- +UINT WINAPI +D3DXFrameNumNamedMatrices + ( + CONST D3DXFRAME *pFrameRoot + ); + +//---------------------------------------------------------------------------- +// D3DXFrameCalculateBoundingSphere: +// --------------------------------- +// Computes the bounding sphere of all the meshes in the frame hierarchy. +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pObjectCenter +// Returns the center of the bounding sphere +// pObjectRadius +// Returns the radius of the bounding sphere +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameCalculateBoundingSphere + ( + CONST D3DXFRAME *pFrameRoot, + LPD3DXVECTOR3 pObjectCenter, + FLOAT *pObjectRadius + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateKeyframedAnimationSet: +// -------------------------------- +// This function creates a compressable keyframed animations set interface. +// +// Parameters: +// pName +// Name of the animation set +// TicksPerSecond +// Number of keyframe ticks that elapse per second +// Playback +// Playback mode of keyframe looping +// NumAnimations +// Number of SRT animations +// NumCallbackKeys +// Number of callback keys +// pCallbackKeys +// Array of callback keys +// ppAnimationSet +// Returns the animation set interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateKeyframedAnimationSet + ( + LPCSTR pName, + DOUBLE TicksPerSecond, + D3DXPLAYBACK_TYPE Playback, + UINT NumAnimations, + UINT NumCallbackKeys, + CONST D3DXKEY_CALLBACK *pCallbackKeys, + LPD3DXKEYFRAMEDANIMATIONSET *ppAnimationSet + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateCompressedAnimationSet: +// -------------------------------- +// This function creates a compressed animations set interface from +// compressed data. +// +// Parameters: +// pName +// Name of the animation set +// TicksPerSecond +// Number of keyframe ticks that elapse per second +// Playback +// Playback mode of keyframe looping +// pCompressedData +// Compressed animation SRT data +// NumCallbackKeys +// Number of callback keys +// pCallbackKeys +// Array of callback keys +// ppAnimationSet +// Returns the animation set interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateCompressedAnimationSet + ( + LPCSTR pName, + DOUBLE TicksPerSecond, + D3DXPLAYBACK_TYPE Playback, + LPD3DXBUFFER pCompressedData, + UINT NumCallbackKeys, + CONST D3DXKEY_CALLBACK *pCallbackKeys, + LPD3DXCOMPRESSEDANIMATIONSET *ppAnimationSet + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateAnimationController: +// ------------------------------ +// This function creates an animation controller object. +// +// Parameters: +// MaxNumMatrices +// Maximum number of matrices that can be animated +// MaxNumAnimationSets +// Maximum number of animation sets that can be played +// MaxNumTracks +// Maximum number of animation sets that can be blended +// MaxNumEvents +// Maximum number of outstanding events that can be scheduled at any given time +// ppAnimController +// Returns the animation controller interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateAnimationController + ( + UINT MaxNumMatrices, + UINT MaxNumAnimationSets, + UINT MaxNumTracks, + UINT MaxNumEvents, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9ANIM_H__ + + diff --git a/saco/d3d9/include/d3dx9core.h b/saco/d3d9/include/d3dx9core.h new file mode 100644 index 0000000..efe11f0 --- /dev/null +++ b/saco/d3d9/include/d3dx9core.h @@ -0,0 +1,748 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9core.h +// Content: D3DX core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9CORE_H__ +#define __D3DX9CORE_H__ + + +/////////////////////////////////////////////////////////////////////////// +// D3DX_SDK_VERSION: +// ----------------- +// This identifier is passed to D3DXCheckVersion in order to ensure that an +// application was built against the correct header files and lib files. +// This number is incremented whenever a header (or other) change would +// require applications to be rebuilt. If the version doesn't match, +// D3DXCheckVersion will return FALSE. (The number itself has no meaning.) +/////////////////////////////////////////////////////////////////////////// + +#define D3DX_VERSION 0x0902 +#define D3DX_SDK_VERSION 25 + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +BOOL WINAPI + D3DXCheckVersion(UINT D3DSdkVersion, UINT D3DXSdkVersion); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// D3DXDebugMute +// Mutes D3DX and D3D debug spew (TRUE - mute, FALSE - not mute) +// +// returns previous mute value +// +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +BOOL WINAPI + D3DXDebugMute(BOOL Mute); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +/////////////////////////////////////////////////////////////////////////// +// D3DXGetDriverLevel: +// Returns driver version information: +// +// 700 - DX7 level driver +// 800 - DX8 level driver +// 900 - DX9 level driver +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +UINT WINAPI + D3DXGetDriverLevel(LPDIRECT3DDEVICE9 pDevice); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXBuffer: +// ------------ +// The buffer object is used by D3DX to return arbitrary size data. +// +// GetBufferPointer - +// Returns a pointer to the beginning of the buffer. +// +// GetBufferSize - +// Returns the size of the buffer, in bytes. +/////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXBuffer ID3DXBuffer; +typedef interface ID3DXBuffer *LPD3DXBUFFER; + +// {8BA5FB08-5195-40e2-AC58-0D989C3A0102} +DEFINE_GUID(IID_ID3DXBuffer, +0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); + +#undef INTERFACE +#define INTERFACE ID3DXBuffer + +DECLARE_INTERFACE_(ID3DXBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBuffer + STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; +}; + + + +////////////////////////////////////////////////////////////////////////////// +// D3DXSPRITE flags: +// ----------------- +// D3DXSPRITE_DONOTSAVESTATE +// Specifies device state is not to be saved and restored in Begin/End. +// D3DXSPRITE_DONOTMODIFY_RENDERSTATE +// Specifies device render state is not to be changed in Begin. The device +// is assumed to be in a valid state to draw vertices containing POSITION0, +// TEXCOORD0, and COLOR0 data. +// D3DXSPRITE_OBJECTSPACE +// The WORLD, VIEW, and PROJECTION transforms are NOT modified. The +// transforms currently set to the device are used to transform the sprites +// when the batch is drawn (at Flush or End). If this is not specified, +// WORLD, VIEW, and PROJECTION transforms are modified so that sprites are +// drawn in screenspace coordinates. +// D3DXSPRITE_BILLBOARD +// Rotates each sprite about its center so that it is facing the viewer. +// D3DXSPRITE_ALPHABLEND +// Enables ALPHABLEND(SRCALPHA, INVSRCALPHA) and ALPHATEST(alpha > 0). +// ID3DXFont expects this to be set when drawing text. +// D3DXSPRITE_SORT_TEXTURE +// Sprites are sorted by texture prior to drawing. This is recommended when +// drawing non-overlapping sprites of uniform depth. For example, drawing +// screen-aligned text with ID3DXFont. +// D3DXSPRITE_SORT_DEPTH_FRONTTOBACK +// Sprites are sorted by depth front-to-back prior to drawing. This is +// recommended when drawing opaque sprites of varying depths. +// D3DXSPRITE_SORT_DEPTH_BACKTOFRONT +// Sprites are sorted by depth back-to-front prior to drawing. This is +// recommended when drawing transparent sprites of varying depths. +////////////////////////////////////////////////////////////////////////////// + +#define D3DXSPRITE_DONOTSAVESTATE (1 << 0) +#define D3DXSPRITE_DONOTMODIFY_RENDERSTATE (1 << 1) +#define D3DXSPRITE_OBJECTSPACE (1 << 2) +#define D3DXSPRITE_BILLBOARD (1 << 3) +#define D3DXSPRITE_ALPHABLEND (1 << 4) +#define D3DXSPRITE_SORT_TEXTURE (1 << 5) +#define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK (1 << 6) +#define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT (1 << 7) + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXSprite: +// ------------ +// This object intends to provide an easy way to drawing sprites using D3D. +// +// Begin - +// Prepares device for drawing sprites. +// +// Draw - +// Draws a sprite. Before transformation, the sprite is the size of +// SrcRect, with its top-left corner specified by Position. The color +// and alpha channels are modulated by Color. +// +// Flush - +// Forces all batched sprites to submitted to the device. +// +// End - +// Restores device state to how it was when Begin was called. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXSprite ID3DXSprite; +typedef interface ID3DXSprite *LPD3DXSPRITE; + + +// {BA0B762D-7D28-43ec-B9DC-2F84443B0614} +DEFINE_GUID(IID_ID3DXSprite, +0xba0b762d, 0x7d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14); + + +#undef INTERFACE +#define INTERFACE ID3DXSprite + +DECLARE_INTERFACE_(ID3DXSprite, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXSprite + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + + STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *pTransform) PURE; + STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *pTransform) PURE; + + STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE; + STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE; + + STDMETHOD(Begin)(THIS_ DWORD Flags) PURE; + STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color) PURE; + STDMETHOD(Flush)(THIS) PURE; + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateSprite( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXSPRITE* ppSprite); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFont: +// ---------- +// Font objects contain the textures and resources needed to render a specific +// font on a specific device. +// +// GetGlyphData - +// Returns glyph cache data, for a given glyph. +// +// PreloadCharacters/PreloadGlyphs/PreloadText - +// Preloads glyphs into the glyph cache textures. +// +// DrawText - +// Draws formatted text on a D3D device. Some parameters are +// surprisingly similar to those of GDI's DrawText function. See GDI +// documentation for a detailed description of these parameters. +// If pSprite is NULL, an internal sprite object will be used. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +////////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXFONT_DESCA +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + CHAR FaceName[LF_FACESIZE]; + +} D3DXFONT_DESCA, *LPD3DXFONT_DESCA; + +typedef struct _D3DXFONT_DESCW +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + WCHAR FaceName[LF_FACESIZE]; + +} D3DXFONT_DESCW, *LPD3DXFONT_DESCW; + +#ifdef UNICODE +typedef D3DXFONT_DESCW D3DXFONT_DESC; +typedef LPD3DXFONT_DESCW LPD3DXFONT_DESC; +#else +typedef D3DXFONT_DESCA D3DXFONT_DESC; +typedef LPD3DXFONT_DESCA LPD3DXFONT_DESC; +#endif + + +typedef interface ID3DXFont ID3DXFont; +typedef interface ID3DXFont *LPD3DXFONT; + + +// {D79DBB70-5F21-4d36-BBC2-FF525C213CDC} +DEFINE_GUID(IID_ID3DXFont, +0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc); + + +#undef INTERFACE +#define INTERFACE ID3DXFont + +DECLARE_INTERFACE_(ID3DXFont, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXFont + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE; + STDMETHOD(GetDescA)(THIS_ D3DXFONT_DESCA *pDesc) PURE; + STDMETHOD(GetDescW)(THIS_ D3DXFONT_DESCW *pDesc) PURE; + STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; + STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE; + + STDMETHOD_(HDC, GetDC)(THIS) PURE; + STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE; + + STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE; + STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE; + + STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; + STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; + +#ifdef __cplusplus +#ifdef UNICODE + HRESULT GetDesc(D3DXFONT_DESCW *pDesc) { return GetDescW(pDesc); } + HRESULT PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } +#else + HRESULT GetDesc(D3DXFONT_DESCA *pDesc) { return GetDescA(pDesc); } + HRESULT PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); } +#endif +#endif //__cplusplus +}; + +#ifndef GetTextMetrics +#ifdef UNICODE +#define GetTextMetrics GetTextMetricsW +#else +#define GetTextMetrics GetTextMetricsA +#endif +#endif + +#ifndef DrawText +#ifdef UNICODE +#define DrawText DrawTextW +#else +#define DrawText DrawTextA +#endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateFontA( + LPDIRECT3DDEVICE9 pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + DWORD CharSet, + DWORD OutputPrecision, + DWORD Quality, + DWORD PitchAndFamily, + LPCSTR pFaceName, + LPD3DXFONT* ppFont); + +HRESULT WINAPI + D3DXCreateFontW( + LPDIRECT3DDEVICE9 pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + DWORD CharSet, + DWORD OutputPrecision, + DWORD Quality, + DWORD PitchAndFamily, + LPCWSTR pFaceName, + LPD3DXFONT* ppFont); + +#ifdef UNICODE +#define D3DXCreateFont D3DXCreateFontW +#else +#define D3DXCreateFont D3DXCreateFontA +#endif + + +HRESULT WINAPI + D3DXCreateFontIndirectA( + LPDIRECT3DDEVICE9 pDevice, + CONST D3DXFONT_DESCA* pDesc, + LPD3DXFONT* ppFont); + +HRESULT WINAPI + D3DXCreateFontIndirectW( + LPDIRECT3DDEVICE9 pDevice, + CONST D3DXFONT_DESCW* pDesc, + LPD3DXFONT* ppFont); + +#ifdef UNICODE +#define D3DXCreateFontIndirect D3DXCreateFontIndirectW +#else +#define D3DXCreateFontIndirect D3DXCreateFontIndirectA +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToSurface: +// --------------------- +// This object abstracts rendering to surfaces. These surfaces do not +// necessarily need to be render targets. If they are not, a compatible +// render target is used, and the result copied into surface at end scene. +// +// BeginScene, EndScene - +// Call BeginScene() and EndScene() at the beginning and ending of your +// scene. These calls will setup and restore render targets, viewports, +// etc.. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXRTS_DESC +{ + UINT Width; + UINT Height; + D3DFORMAT Format; + BOOL DepthStencil; + D3DFORMAT DepthStencilFormat; + +} D3DXRTS_DESC, *LPD3DXRTS_DESC; + + +typedef interface ID3DXRenderToSurface ID3DXRenderToSurface; +typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE; + + +// {6985F346-2C3D-43b3-BE8B-DAAE8A03D894} +DEFINE_GUID(IID_ID3DXRenderToSurface, +0x6985f346, 0x2c3d, 0x43b3, 0xbe, 0x8b, 0xda, 0xae, 0x8a, 0x3, 0xd8, 0x94); + + +#undef INTERFACE +#define INTERFACE ID3DXRenderToSurface + +DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXRenderToSurface + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE; + + STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE9 pSurface, CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(EndScene)(THIS_ DWORD MipFilter) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateRenderToSurface( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + D3DFORMAT Format, + BOOL DepthStencil, + D3DFORMAT DepthStencilFormat, + LPD3DXRENDERTOSURFACE* ppRenderToSurface); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToEnvMap: +// -------------------- +// This object abstracts rendering to environment maps. These surfaces +// do not necessarily need to be render targets. If they are not, a +// compatible render target is used, and the result copied into the +// environment map at end scene. +// +// BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - +// This function initiates the rendering of the environment map. As +// parameters, you pass the textures in which will get filled in with +// the resulting environment map. +// +// Face - +// Call this function to initiate the drawing of each face. For each +// environment map, you will call this six times.. once for each face +// in D3DCUBEMAP_FACES. +// +// End - +// This will restore all render targets, and if needed compose all the +// rendered faces into the environment map surfaces. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXRTE_DESC +{ + UINT Size; + UINT MipLevels; + D3DFORMAT Format; + BOOL DepthStencil; + D3DFORMAT DepthStencilFormat; + +} D3DXRTE_DESC, *LPD3DXRTE_DESC; + + +typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap; +typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap; + + +// {313F1B4B-C7B0-4fa2-9D9D-8D380B64385E} +DEFINE_GUID(IID_ID3DXRenderToEnvMap, +0x313f1b4b, 0xc7b0, 0x4fa2, 0x9d, 0x9d, 0x8d, 0x38, 0xb, 0x64, 0x38, 0x5e); + + +#undef INTERFACE +#define INTERFACE ID3DXRenderToEnvMap + +DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXRenderToEnvMap + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE; + + STDMETHOD(BeginCube)(THIS_ + LPDIRECT3DCUBETEXTURE9 pCubeTex) PURE; + + STDMETHOD(BeginSphere)(THIS_ + LPDIRECT3DTEXTURE9 pTex) PURE; + + STDMETHOD(BeginHemisphere)(THIS_ + LPDIRECT3DTEXTURE9 pTexZPos, + LPDIRECT3DTEXTURE9 pTexZNeg) PURE; + + STDMETHOD(BeginParabolic)(THIS_ + LPDIRECT3DTEXTURE9 pTexZPos, + LPDIRECT3DTEXTURE9 pTexZNeg) PURE; + + STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face, DWORD MipFilter) PURE; + STDMETHOD(End)(THIS_ DWORD MipFilter) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateRenderToEnvMap( + LPDIRECT3DDEVICE9 pDevice, + UINT Size, + UINT MipLevels, + D3DFORMAT Format, + BOOL DepthStencil, + D3DFORMAT DepthStencilFormat, + LPD3DXRenderToEnvMap* ppRenderToEnvMap); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXLine: +// ------------ +// This object intends to provide an easy way to draw lines using D3D. +// +// Begin - +// Prepares device for drawing lines +// +// Draw - +// Draws a line strip in screen-space. +// Input is in the form of a array defining points on the line strip. of D3DXVECTOR2 +// +// DrawTransform - +// Draws a line in screen-space with a specified input transformation matrix. +// +// End - +// Restores device state to how it was when Begin was called. +// +// SetPattern - +// Applies a stipple pattern to the line. Input is one 32-bit +// DWORD which describes the stipple pattern. 1 is opaque, 0 is +// transparent. +// +// SetPatternScale - +// Stretches the stipple pattern in the u direction. Input is one +// floating-point value. 0.0f is no scaling, whereas 1.0f doubles +// the length of the stipple pattern. +// +// SetWidth - +// Specifies the thickness of the line in the v direction. Input is +// one floating-point value. +// +// SetAntialias - +// Toggles line antialiasing. Input is a BOOL. +// TRUE = Antialiasing on. +// FALSE = Antialiasing off. +// +// SetGLLines - +// Toggles non-antialiased OpenGL line emulation. Input is a BOOL. +// TRUE = OpenGL line emulation on. +// FALSE = OpenGL line emulation off. +// +// OpenGL line: Regular line: +// *\ *\ +// | \ / \ +// | \ *\ \ +// *\ \ \ \ +// \ \ \ \ +// \ * \ * +// \ | \ / +// \| * +// * +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + + +typedef interface ID3DXLine ID3DXLine; +typedef interface ID3DXLine *LPD3DXLINE; + + +// {D379BA7F-9042-4ac4-9F5E-58192A4C6BD8} +DEFINE_GUID(IID_ID3DXLine, +0xd379ba7f, 0x9042, 0x4ac4, 0x9f, 0x5e, 0x58, 0x19, 0x2a, 0x4c, 0x6b, 0xd8); + +#undef INTERFACE +#define INTERFACE ID3DXLine + +DECLARE_INTERFACE_(ID3DXLine, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXLine + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + + STDMETHOD(Begin)(THIS) PURE; + + STDMETHOD(Draw)(THIS_ CONST D3DXVECTOR2 *pVertexList, + DWORD dwVertexListCount, D3DCOLOR Color) PURE; + + STDMETHOD(DrawTransform)(THIS_ CONST D3DXVECTOR3 *pVertexList, + DWORD dwVertexListCount, CONST D3DXMATRIX* pTransform, + D3DCOLOR Color) PURE; + + STDMETHOD(SetPattern)(THIS_ DWORD dwPattern) PURE; + STDMETHOD_(DWORD, GetPattern)(THIS) PURE; + + STDMETHOD(SetPatternScale)(THIS_ FLOAT fPatternScale) PURE; + STDMETHOD_(FLOAT, GetPatternScale)(THIS) PURE; + + STDMETHOD(SetWidth)(THIS_ FLOAT fWidth) PURE; + STDMETHOD_(FLOAT, GetWidth)(THIS) PURE; + + STDMETHOD(SetAntialias)(THIS_ BOOL bAntialias) PURE; + STDMETHOD_(BOOL, GetAntialias)(THIS) PURE; + + STDMETHOD(SetGLLines)(THIS_ BOOL bGLLines) PURE; + STDMETHOD_(BOOL, GetGLLines)(THIS) PURE; + + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateLine( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXLINE* ppLine); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9CORE_H__ + diff --git a/saco/d3d9/include/d3dx9effect.h b/saco/d3d9/include/d3dx9effect.h new file mode 100644 index 0000000..662eca0 --- /dev/null +++ b/saco/d3d9/include/d3dx9effect.h @@ -0,0 +1,867 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9effect.h +// Content: D3DX effect types and Shaders +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9EFFECT_H__ +#define __D3DX9EFFECT_H__ + + +//---------------------------------------------------------------------------- +// D3DXFX_DONOTSAVESTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, device state is not saved or restored in Begin/End. +// D3DXFX_DONOTSAVESHADERSTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, shader device state is not saved or restored in Begin/End. +// This includes pixel/vertex shaders and shader constants +// D3DXFX_DONOTSAVESAMPLERSTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, sampler device state is not saved or restored in Begin/End. +// D3DXFX_NOT_CLONEABLE +// This flag is used as a parameter to the D3DXCreateEffect family of APIs. +// When this flag is specified, the effect will be non-cloneable and will not +// contain any shader binary data. +// Furthermore, GetPassDesc will not return shader function pointers. +// Setting this flag reduces effect memory usage by about 50%. +//---------------------------------------------------------------------------- + +#define D3DXFX_DONOTSAVESTATE (1 << 0) +#define D3DXFX_DONOTSAVESHADERSTATE (1 << 1) +#define D3DXFX_DONOTSAVESAMPLERSTATE (1 << 2) +#define D3DXFX_NOT_CLONEABLE (1 << 11) + +//---------------------------------------------------------------------------- +// D3DX_PARAMETER_SHARED +// Indicates that the value of a parameter will be shared with all effects +// which share the same namespace. Changing the value in one effect will +// change it in all. +// +// D3DX_PARAMETER_LITERAL +// Indicates that the value of this parameter can be treated as literal. +// Literal parameters can be marked when the effect is compiled, and their +// cannot be changed after the effect is compiled. Shared parameters cannot +// be literal. +//---------------------------------------------------------------------------- + +#define D3DX_PARAMETER_SHARED (1 << 0) +#define D3DX_PARAMETER_LITERAL (1 << 1) +#define D3DX_PARAMETER_ANNOTATION (1 << 2) + +//---------------------------------------------------------------------------- +// D3DXEFFECT_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXEFFECT_DESC +{ + LPCSTR Creator; // Creator string + UINT Parameters; // Number of parameters + UINT Techniques; // Number of techniques + UINT Functions; // Number of function entrypoints + +} D3DXEFFECT_DESC; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXPARAMETER_DESC +{ + LPCSTR Name; // Parameter name + LPCSTR Semantic; // Parameter semantic + D3DXPARAMETER_CLASS Class; // Class + D3DXPARAMETER_TYPE Type; // Component type + UINT Rows; // Number of rows + UINT Columns; // Number of columns + UINT Elements; // Number of array elements + UINT Annotations; // Number of annotations + UINT StructMembers; // Number of structure member sub-parameters + DWORD Flags; // D3DX_PARAMETER_* flags + UINT Bytes; // Parameter size, in bytes + +} D3DXPARAMETER_DESC; + + +//---------------------------------------------------------------------------- +// D3DXTECHNIQUE_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXTECHNIQUE_DESC +{ + LPCSTR Name; // Technique name + UINT Passes; // Number of passes + UINT Annotations; // Number of annotations + +} D3DXTECHNIQUE_DESC; + + +//---------------------------------------------------------------------------- +// D3DXPASS_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXPASS_DESC +{ + LPCSTR Name; // Pass name + UINT Annotations; // Number of annotations + + CONST DWORD *pVertexShaderFunction; // Vertex shader function + CONST DWORD *pPixelShaderFunction; // Pixel shader function + +} D3DXPASS_DESC; + + +//---------------------------------------------------------------------------- +// D3DXFUNCTION_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXFUNCTION_DESC +{ + LPCSTR Name; // Function name + UINT Annotations; // Number of annotations + +} D3DXFUNCTION_DESC; + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffectPool /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffectPool ID3DXEffectPool; +typedef interface ID3DXEffectPool *LPD3DXEFFECTPOOL; + +// {9537AB04-3250-412e-8213-FCD2F8677933} +DEFINE_GUID(IID_ID3DXEffectPool, +0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); + + +#undef INTERFACE +#define INTERFACE ID3DXEffectPool + +DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // No public methods +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXBaseEffect /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXBaseEffect ID3DXBaseEffect; +typedef interface ID3DXBaseEffect *LPD3DXBASEEFFECT; + +// {017C18AC-103F-4417-8C51-6BF6EF1E56BE} +DEFINE_GUID(IID_ID3DXBaseEffect, +0x17c18ac, 0x103f, 0x4417, 0x8c, 0x51, 0x6b, 0xf6, 0xef, 0x1e, 0x56, 0xbe); + + +#undef INTERFACE +#define INTERFACE ID3DXBaseEffect + +DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Useful for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + +}; + + +//---------------------------------------------------------------------------- +// ID3DXEffectStateManager: +// ------------------------ +// This is a user implemented interface that can be used to manage device +// state changes made by an Effect. +//---------------------------------------------------------------------------- + +typedef interface ID3DXEffectStateManager ID3DXEffectStateManager; +typedef interface ID3DXEffectStateManager *LPD3DXEFFECTSTATEMANAGER; + +// {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE} +DEFINE_GUID(IID_ID3DXEffectStateManager, +0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, 0x37, 0xfa, 0x17, 0x81, 0xc5, 0xce); + +#undef INTERFACE +#define INTERFACE ID3DXEffectStateManager + +DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown) +{ + // The user must correctly implement QueryInterface, AddRef, and Release. + + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // The following methods are called by the Effect when it wants to make + // the corresponding device call. Note that: + // 1. Users manage the state and are therefore responsible for making the + // the corresponding device calls themselves inside their callbacks. + // 2. Effects pay attention to the return values of the callbacks, and so + // users must pay attention to what they return in their callbacks. + + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9 *pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index, CONST D3DLIGHT9 *pLight) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index, BOOL Enable) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD Value) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) PURE; + STDMETHOD(SetNPatchMode)(THIS_ FLOAT NumSegments) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(SetVertexShader)(THIS_ LPDIRECT3DVERTEXSHADER9 pShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShader)(THIS_ LPDIRECT3DPIXELSHADER9 pShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffect /////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffect ID3DXEffect; +typedef interface ID3DXEffect *LPD3DXEFFECT; + +// {D165CCB1-62B0-4a33-B3FA-A92300305A11} +DEFINE_GUID(IID_ID3DXEffect, +0xd165ccb1, 0x62b0, 0x4a33, 0xb3, 0xfa, 0xa9, 0x23, 0x0, 0x30, 0x5a, 0x11); + +#undef INTERFACE +#define INTERFACE ID3DXEffect + +DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) +{ + // ID3DXBaseEffect + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Usefull for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + // ID3DXBaseEffect + + + // Pool + STDMETHOD(GetPool)(THIS_ LPD3DXEFFECTPOOL* ppPool) PURE; + + // Selecting and setting a technique + STDMETHOD(SetTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; + STDMETHOD_(D3DXHANDLE, GetCurrentTechnique)(THIS) PURE; + STDMETHOD(ValidateTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; + STDMETHOD(FindNextValidTechnique)(THIS_ D3DXHANDLE hTechnique, D3DXHANDLE *pTechnique) PURE; + STDMETHOD_(BOOL, IsParameterUsed)(THIS_ D3DXHANDLE hParameter, D3DXHANDLE hTechnique) PURE; + + // Using current technique + // Begin starts active technique + // BeginPass begins a pass + // CommitChanges updates changes to any set calls in the pass. This should be called before + // any DrawPrimitive call to d3d + // EndPass ends a pass + // End ends active technique + STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE; + STDMETHOD(BeginPass)(THIS_ UINT Pass) PURE; + STDMETHOD(CommitChanges)(THIS) PURE; + STDMETHOD(EndPass)(THIS) PURE; + STDMETHOD(End)(THIS) PURE; + + // Managing D3D Device + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; + + // Logging device calls + STDMETHOD(SetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER pManager) PURE; + STDMETHOD(GetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER *ppManager) PURE; + + // Parameter blocks + STDMETHOD(BeginParameterBlock)(THIS) PURE; + STDMETHOD_(D3DXHANDLE, EndParameterBlock)(THIS) PURE; + STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; + + // Cloning + STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE9 pDevice, LPD3DXEFFECT* ppEffect) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffectCompiler /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffectCompiler ID3DXEffectCompiler; +typedef interface ID3DXEffectCompiler *LPD3DXEFFECTCOMPILER; + +// {51B8A949-1A31-47e6-BEA0-4B30DB53F1E0} +DEFINE_GUID(IID_ID3DXEffectCompiler, +0x51b8a949, 0x1a31, 0x47e6, 0xbe, 0xa0, 0x4b, 0x30, 0xdb, 0x53, 0xf1, 0xe0); + + +#undef INTERFACE +#define INTERFACE ID3DXEffectCompiler + +DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) +{ + // ID3DXBaseEffect + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Usefull for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + // ID3DXBaseEffect + + // Parameter sharing, specialization, and information + STDMETHOD(SetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL Literal) PURE; + STDMETHOD(GetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL *pLiteral) PURE; + + // Compilation + STDMETHOD(CompileEffect)(THIS_ DWORD Flags, + LPD3DXBUFFER* ppEffect, LPD3DXBUFFER* ppErrorMsgs) PURE; + + STDMETHOD(CompileShader)(THIS_ D3DXHANDLE hFunction, LPCSTR pTarget, DWORD Flags, + LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3DXCreateEffectPool: +// --------------------- +// Creates an effect pool. Pools are used for sharing parameters between +// multiple effects. For all effects within a pool, shared parameters of the +// same name all share the same value. +// +// Parameters: +// ppPool +// Returns the created pool. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectPool( + LPD3DXEFFECTPOOL* ppPool); + + +//---------------------------------------------------------------------------- +// D3DXCreateEffect: +// ----------------- +// Creates an effect from an ascii or binary effect description. +// +// Parameters: +// pDevice +// Pointer of the device on which to create the effect +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// Flags +// See D3DXSHADER_xxx flags. +// pSkipConstants +// A list of semi-colon delimited variable names. The effect will +// not set these variables to the device when they are referenced +// by a shader. NOTE: the variables specified here must be +// register bound in the file and must not be used in expressions +// in passes or samplers or the file will not load. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pPool +// Pointer to ID3DXEffectPool object to use for shared parameters. +// If NULL, no parameters will be shared. +// ppEffect +// Returns a buffer containing created effect. +// ppCompilationErrors +// Returns a buffer containing any error messages which occurred during +// compile. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW +#else +#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateEffectFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW +#else +#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateEffect( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +// +// Ex functions that accept pSkipConstants in addition to other parameters +// + +HRESULT WINAPI + D3DXCreateEffectFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExW +#else +#define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateEffectFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExW +#else +#define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateEffectEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +//---------------------------------------------------------------------------- +// D3DXCreateEffectCompiler: +// ------------------------- +// Creates an effect from an ascii or binary effect description. +// +// Parameters: +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pPool +// Pointer to ID3DXEffectPool object to use for shared parameters. +// If NULL, no parameters will be shared. +// ppCompiler +// Returns a buffer containing created effect compiler. +// ppParseErrors +// Returns a buffer containing any error messages which occurred during +// parse. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectCompilerFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +HRESULT WINAPI + D3DXCreateEffectCompilerFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +#ifdef UNICODE +#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileW +#else +#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateEffectCompilerFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +HRESULT WINAPI + D3DXCreateEffectCompilerFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +#ifdef UNICODE +#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceW +#else +#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateEffectCompiler( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +//---------------------------------------------------------------------------- +// D3DXDisassembleEffect: +// ----------------------- +// +// Parameters: +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXDisassembleEffect( + LPD3DXEFFECT pEffect, + BOOL EnableColorCode, + LPD3DXBUFFER *ppDisassembly); + + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9EFFECT_H__ + + diff --git a/saco/d3d9/include/d3dx9math.h b/saco/d3d9/include/d3dx9math.h new file mode 100644 index 0000000..2ba4a60 --- /dev/null +++ b/saco/d3d9/include/d3dx9math.h @@ -0,0 +1,1765 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9math.h +// Content: D3DX math types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9MATH_H__ +#define __D3DX9MATH_H__ + +#include +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning + + + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== +#define D3DX_PI ((FLOAT) 3.141592654f) +#define D3DX_1BYPI ((FLOAT) 0.318309886f) + +#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f)) +#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI)) + + + +//=========================================================================== +// +// 16 bit floating point numbers +// +//=========================================================================== + +#define D3DX_16F_DIG 3 // # of decimal digits of precision +#define D3DX_16F_EPSILON 4.8875809e-4f // smallest such that 1.0 + epsilon != 1.0 +#define D3DX_16F_MANT_DIG 11 // # of bits in mantissa +#define D3DX_16F_MAX 6.550400e+004 // max value +#define D3DX_16F_MAX_10_EXP 4 // max decimal exponent +#define D3DX_16F_MAX_EXP 15 // max binary exponent +#define D3DX_16F_MIN 6.1035156e-5f // min positive value +#define D3DX_16F_MIN_10_EXP (-4) // min decimal exponent +#define D3DX_16F_MIN_EXP (-12) // min binary exponent +#define D3DX_16F_RADIX 2 // exponent radix +#define D3DX_16F_ROUNDS 1 // addition rounding: near + + +typedef struct D3DXFLOAT16 +{ +#ifdef __cplusplus +public: + D3DXFLOAT16() {}; + D3DXFLOAT16( FLOAT ); + D3DXFLOAT16( CONST D3DXFLOAT16& ); + + // casting + operator FLOAT (); + + // binary operators + BOOL operator == ( CONST D3DXFLOAT16& ) const; + BOOL operator != ( CONST D3DXFLOAT16& ) const; + +protected: +#endif //__cplusplus + WORD value; +} D3DXFLOAT16, *LPD3DXFLOAT16; + + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- +typedef struct D3DXVECTOR2 +{ +#ifdef __cplusplus +public: + D3DXVECTOR2() {}; + D3DXVECTOR2( CONST FLOAT * ); + D3DXVECTOR2( CONST D3DXFLOAT16 * ); + D3DXVECTOR2( FLOAT x, FLOAT y ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR2& operator += ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator -= ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator *= ( FLOAT ); + D3DXVECTOR2& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR2 operator + () const; + D3DXVECTOR2 operator - () const; + + // binary operators + D3DXVECTOR2 operator + ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator - ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator * ( FLOAT ) const; + D3DXVECTOR2 operator / ( FLOAT ) const; + + friend D3DXVECTOR2 operator * ( FLOAT, CONST D3DXVECTOR2& ); + + BOOL operator == ( CONST D3DXVECTOR2& ) const; + BOOL operator != ( CONST D3DXVECTOR2& ) const; + + +public: +#endif //__cplusplus + FLOAT x, y; +} D3DXVECTOR2, *LPD3DXVECTOR2; + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +typedef struct D3DXVECTOR2_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR2_16F() {}; + D3DXVECTOR2_16F( CONST FLOAT * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR2_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR2_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y; + +} D3DXVECTOR2_16F, *LPD3DXVECTOR2_16F; + + + +//-------------------------- +// 3D Vector +//-------------------------- +#ifdef __cplusplus +typedef struct D3DXVECTOR3 : public D3DVECTOR +{ +public: + D3DXVECTOR3() {}; + D3DXVECTOR3( CONST FLOAT * ); + D3DXVECTOR3( CONST D3DVECTOR& ); + D3DXVECTOR3( CONST D3DXFLOAT16 * ); + D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator *= ( FLOAT ); + D3DXVECTOR3& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR3 operator + () const; + D3DXVECTOR3 operator - () const; + + // binary operators + D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator * ( FLOAT ) const; + D3DXVECTOR3 operator / ( FLOAT ) const; + + friend D3DXVECTOR3 operator * ( FLOAT, CONST struct D3DXVECTOR3& ); + + BOOL operator == ( CONST D3DXVECTOR3& ) const; + BOOL operator != ( CONST D3DXVECTOR3& ) const; + +} D3DXVECTOR3, *LPD3DXVECTOR3; + +#else //!__cplusplus +typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; +#endif //!__cplusplus + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR3_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR3_16F() {}; + D3DXVECTOR3_16F( CONST FLOAT * ); + D3DXVECTOR3_16F( CONST D3DVECTOR& ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y, CONST D3DXFLOAT16 &z ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR3_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR3_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z; + +} D3DXVECTOR3_16F, *LPD3DXVECTOR3_16F; + + + +//-------------------------- +// 4D Vector +//-------------------------- +typedef struct D3DXVECTOR4 +{ +#ifdef __cplusplus +public: + D3DXVECTOR4() {}; + D3DXVECTOR4( CONST FLOAT* ); + D3DXVECTOR4( CONST D3DXFLOAT16* ); + D3DXVECTOR4( CONST D3DVECTOR& xyz, FLOAT w ); + D3DXVECTOR4( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR4& operator += ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator -= ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator *= ( FLOAT ); + D3DXVECTOR4& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR4 operator + () const; + D3DXVECTOR4 operator - () const; + + // binary operators + D3DXVECTOR4 operator + ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator - ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator * ( FLOAT ) const; + D3DXVECTOR4 operator / ( FLOAT ) const; + + friend D3DXVECTOR4 operator * ( FLOAT, CONST D3DXVECTOR4& ); + + BOOL operator == ( CONST D3DXVECTOR4& ) const; + BOOL operator != ( CONST D3DXVECTOR4& ) const; + +public: +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXVECTOR4, *LPD3DXVECTOR4; + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR4_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR4_16F() {}; + D3DXVECTOR4_16F( CONST FLOAT * ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16* ); + D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& xyz, CONST D3DXFLOAT16& w ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16& x, CONST D3DXFLOAT16& y, CONST D3DXFLOAT16& z, CONST D3DXFLOAT16& w ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR4_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR4_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z, w; + +} D3DXVECTOR4_16F, *LPD3DXVECTOR4_16F; + + + +//=========================================================================== +// +// Matrices +// +//=========================================================================== +#ifdef __cplusplus +typedef struct D3DXMATRIX : public D3DMATRIX +{ +public: + D3DXMATRIX() {}; + D3DXMATRIX( CONST FLOAT * ); + D3DXMATRIX( CONST D3DMATRIX& ); + D3DXMATRIX( CONST D3DXFLOAT16 * ); + D3DXMATRIX( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + + // access grants + FLOAT& operator () ( UINT Row, UINT Col ); + FLOAT operator () ( UINT Row, UINT Col ) const; + + // casting operators + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXMATRIX& operator *= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator += ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator -= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator *= ( FLOAT ); + D3DXMATRIX& operator /= ( FLOAT ); + + // unary operators + D3DXMATRIX operator + () const; + D3DXMATRIX operator - () const; + + // binary operators + D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator * ( FLOAT ) const; + D3DXMATRIX operator / ( FLOAT ) const; + + friend D3DXMATRIX operator * ( FLOAT, CONST D3DXMATRIX& ); + + BOOL operator == ( CONST D3DXMATRIX& ) const; + BOOL operator != ( CONST D3DXMATRIX& ) const; + +} D3DXMATRIX, *LPD3DXMATRIX; + +#else //!__cplusplus +typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX; +#endif //!__cplusplus + + +//--------------------------------------------------------------------------- +// Aligned Matrices +// +// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. +// It aligns matrices on the stack and on the heap or in global scope. +// It does this using __declspec(align(16)) which works on VC7 and on VC 6 +// with the processor pack. Unfortunately there is no way to detect the +// latter so this is turned on only on VC7. On other compilers this is the +// the same as D3DXMATRIX. +// +// Using this class on a compiler that does not actually do the alignment +// can be dangerous since it will not expose bugs that ignore alignment. +// E.g if an object of this class in inside a struct or class, and some code +// memcopys data in it assuming tight packing. This could break on a compiler +// that eventually start aligning the matrix. +//--------------------------------------------------------------------------- +#ifdef __cplusplus +typedef struct _D3DXMATRIXA16 : public D3DXMATRIX +{ + _D3DXMATRIXA16() {} + _D3DXMATRIXA16( CONST FLOAT * ); + _D3DXMATRIXA16( CONST D3DMATRIX& ); + _D3DXMATRIXA16( CONST D3DXFLOAT16 * ); + _D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + // new operators + void* operator new ( size_t ); + void* operator new[] ( size_t ); + + // delete operators + void operator delete ( void* ); // These are NOT virtual; Do not + void operator delete[] ( void* ); // cast to D3DXMATRIX and delete. + + // assignment operators + _D3DXMATRIXA16& operator = ( CONST D3DXMATRIX& ); + +} _D3DXMATRIXA16; + +#else //!__cplusplus +typedef D3DXMATRIX _D3DXMATRIXA16; +#endif //!__cplusplus + + + +#if _MSC_VER >= 1300 // VC7 +#define D3DX_ALIGN16 __declspec(align(16)) +#else +#define D3DX_ALIGN16 // Earlier compiler may not understand this, do nothing. +#endif + +typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16; + + + +//=========================================================================== +// +// Quaternions +// +//=========================================================================== +typedef struct D3DXQUATERNION +{ +#ifdef __cplusplus +public: + D3DXQUATERNION() {} + D3DXQUATERNION( CONST FLOAT * ); + D3DXQUATERNION( CONST D3DXFLOAT16 * ); + D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( FLOAT ); + D3DXQUATERNION& operator /= ( FLOAT ); + + // unary operators + D3DXQUATERNION operator + () const; + D3DXQUATERNION operator - () const; + + // binary operators + D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( FLOAT ) const; + D3DXQUATERNION operator / ( FLOAT ) const; + + friend D3DXQUATERNION operator * (FLOAT, CONST D3DXQUATERNION& ); + + BOOL operator == ( CONST D3DXQUATERNION& ) const; + BOOL operator != ( CONST D3DXQUATERNION& ) const; + +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXQUATERNION, *LPD3DXQUATERNION; + + +//=========================================================================== +// +// Planes +// +//=========================================================================== +typedef struct D3DXPLANE +{ +#ifdef __cplusplus +public: + D3DXPLANE() {} + D3DXPLANE( CONST FLOAT* ); + D3DXPLANE( CONST D3DXFLOAT16* ); + D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXPLANE& operator *= ( FLOAT ); + D3DXPLANE& operator /= ( FLOAT ); + + // unary operators + D3DXPLANE operator + () const; + D3DXPLANE operator - () const; + + // binary operators + D3DXPLANE operator * ( FLOAT ) const; + D3DXPLANE operator / ( FLOAT ) const; + + friend D3DXPLANE operator * ( FLOAT, CONST D3DXPLANE& ); + + BOOL operator == ( CONST D3DXPLANE& ) const; + BOOL operator != ( CONST D3DXPLANE& ) const; + +#endif //__cplusplus + FLOAT a, b, c, d; +} D3DXPLANE, *LPD3DXPLANE; + + +//=========================================================================== +// +// Colors +// +//=========================================================================== + +typedef struct D3DXCOLOR +{ +#ifdef __cplusplus +public: + D3DXCOLOR() {} + D3DXCOLOR( DWORD argb ); + D3DXCOLOR( CONST FLOAT * ); + D3DXCOLOR( CONST D3DXFLOAT16 * ); + D3DXCOLOR( CONST D3DCOLORVALUE& ); + D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); + + // casting + operator DWORD () const; + + operator FLOAT* (); + operator CONST FLOAT* () const; + + operator D3DCOLORVALUE* (); + operator CONST D3DCOLORVALUE* () const; + + operator D3DCOLORVALUE& (); + operator CONST D3DCOLORVALUE& () const; + + // assignment operators + D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator *= ( FLOAT ); + D3DXCOLOR& operator /= ( FLOAT ); + + // unary operators + D3DXCOLOR operator + () const; + D3DXCOLOR operator - () const; + + // binary operators + D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator * ( FLOAT ) const; + D3DXCOLOR operator / ( FLOAT ) const; + + friend D3DXCOLOR operator * ( FLOAT, CONST D3DXCOLOR& ); + + BOOL operator == ( CONST D3DXCOLOR& ) const; + BOOL operator != ( CONST D3DXCOLOR& ) const; + +#endif //__cplusplus + FLOAT r, g, b, a; +} D3DXCOLOR, *LPD3DXCOLOR; + + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// Float16 +//-------------------------- + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Converts an array 32-bit floats to 16-bit floats +D3DXFLOAT16* WINAPI D3DXFloat32To16Array + ( D3DXFLOAT16 *pOut, CONST FLOAT *pIn, UINT n ); + +// Converts an array 16-bit floats to 32-bit floats +FLOAT* WINAPI D3DXFloat16To32Array + ( FLOAT *pOut, CONST D3DXFLOAT16 *pIn, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 2D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR2* WINAPI D3DXVec2Normalize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR2* WINAPI D3DXVec2Hermite + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR2* WINAPI D3DXVec2CatmullRom + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR2* WINAPI D3DXVec2BaryCentric + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoord + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormal + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform Array (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n); + +// Transform Array (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + + + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 3D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR3* WINAPI D3DXVec3Normalize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR3* WINAPI D3DXVec3Hermite + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR3* WINAPI D3DXVec3CatmullRom + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR3* WINAPI D3DXVec3BaryCentric + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoord + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormal + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + + +// Transform Array (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Project vector from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3Project + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3Unproject + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector Array from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3ProjectArray + ( D3DXVECTOR3 *pOut, UINT OutStride,CONST D3DXVECTOR3 *pV, UINT VStride,CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + +// Project vector Array from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + + +#ifdef __cplusplus +} +#endif + + + +//-------------------------- +// 4D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ); + +D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Cross-product in 4 dimensions. +D3DXVECTOR4* WINAPI D3DXVec4Cross + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3); + +D3DXVECTOR4* WINAPI D3DXVec4Normalize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR4* WINAPI D3DXVec4Hermite + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR4* WINAPI D3DXVec4CatmullRom + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR4* WINAPI D3DXVec4BaryCentric + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); + +// Transform vector by matrix. +D3DXVECTOR4* WINAPI D3DXVec4Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); + +// Transform vector array by matrix. +D3DXVECTOR4* WINAPI D3DXVec4TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR4 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline + +D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ); + +BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +FLOAT WINAPI D3DXMatrixDeterminant + ( CONST D3DXMATRIX *pM ); + +HRESULT WINAPI D3DXMatrixDecompose + ( D3DXVECTOR3 *pOutScale, D3DXQUATERNION *pOutRotation, + D3DXVECTOR3 *pOutTranslation, CONST D3DXMATRIX *pM ); + +D3DXMATRIX* WINAPI D3DXMatrixTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); + +// Matrix multiplication. The result represents the transformation M2 +// followed by the transformation M1. (Out = M1 * M2) +D3DXMATRIX* WINAPI D3DXMatrixMultiply + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Calculate inverse of matrix. Inversion my fail, in which case NULL will +// be returned. The determinant of pM is also returned it pfDeterminant +// is non-NULL. +D3DXMATRIX* WINAPI D3DXMatrixInverse + ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); + +// Build a matrix which scales by (sx, sy, sz) +D3DXMATRIX* WINAPI D3DXMatrixScaling + ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); + +// Build a matrix which translates by (x, y, z) +D3DXMATRIX* WINAPI D3DXMatrixTranslation + ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); + +// Build a matrix which rotates around the X axis +D3DXMATRIX* WINAPI D3DXMatrixRotationX + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Y axis +D3DXMATRIX* WINAPI D3DXMatrixRotationY + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Z axis +D3DXMATRIX* WINAPI D3DXMatrixRotationZ + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around an arbitrary axis +D3DXMATRIX* WINAPI D3DXMatrixRotationAxis + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Build a matrix from a quaternion +D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion + ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll + ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Build transformation matrix. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, + CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, + CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, + CONST D3DXVECTOR3 *pTranslation); + +// Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation2D + ( D3DXMATRIX *pOut, CONST D3DXVECTOR2* pScalingCenter, + FLOAT ScalingRotation, CONST D3DXVECTOR2* pScaling, + CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, + CONST D3DXVECTOR2* pTranslation); + +// Build affine transformation matrix. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, + CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); + +// Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR2* pRotationCenter, + FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); + +// Build a lookat matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtRH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a lookat matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtLH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a matrix which flattens geometry into a plane, as if casting +// a shadow from a light. +D3DXMATRIX* WINAPI D3DXMatrixShadow + ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, + CONST D3DXPLANE *pPlane ); + +// Build a matrix which reflects the coordinate system about a plane +D3DXMATRIX* WINAPI D3DXMatrixReflect + ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ); + +// Length squared, or "norm" +FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ); + +FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); + +// (0, 0, 0, 1) +D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ); + +BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ); + +// (-x, -y, -z, w) +D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +void WINAPI D3DXQuaternionToAxisAngle + ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); + +// Build a quaternion from a rotation matrix. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix + ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); + +// Rotation about arbitrary axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis + ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll + ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Quaternion multiplication. The result represents the rotation Q2 +// followed by the rotation Q1. (Out = Q2 * Q1) +D3DXQUATERNION* WINAPI D3DXQuaternionMultiply + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2 ); + +D3DXQUATERNION* WINAPI D3DXQuaternionNormalize + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Conjugate and re-norm +D3DXQUATERNION* WINAPI D3DXQuaternionInverse + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects unit quaternions. +// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +D3DXQUATERNION* WINAPI D3DXQuaternionLn + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects pure quaternions. (w == 0) w is ignored in calculation. +// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +D3DXQUATERNION* WINAPI D3DXQuaternionExp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). +// Expects unit quaternions. +D3DXQUATERNION* WINAPI D3DXQuaternionSlerp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, FLOAT t ); + +// Spherical quadrangle interpolation. +// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +D3DXQUATERNION* WINAPI D3DXQuaternionSquad + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, + CONST D3DXQUATERNION *pC, FLOAT t ); + +// Setup control points for spherical quadrangle interpolation +// from Q1 to Q2. The control points are chosen in such a way +// to ensure the continuity of tangents with adjacent segments. +void WINAPI D3DXQuaternionSquadSetup + ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, + CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); + +// Barycentric interpolation. +// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, + FLOAT f, FLOAT g ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Plane +//-------------------------- + +// inline + +// ax + by + cz + dw +FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); + +// ax + by + cz + d +FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +// ax + by + cz +FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Normalize plane (so that |a,b,c| == 1) +D3DXPLANE* WINAPI D3DXPlaneNormalize + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); + +// Find the intersection between a plane and a line. If the line is +// parallel to the plane, NULL is returned. +D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine + ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2); + +// Construct a plane from a point and a normal +D3DXPLANE* WINAPI D3DXPlaneFromPointNormal + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); + +// Construct a plane from 3 points +D3DXPLANE* WINAPI D3DXPlaneFromPoints + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3); + +// Transform a plane by a matrix. The vector (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransform + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); + +// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransformArray + ( D3DXPLANE *pOut, UINT OutStride, CONST D3DXPLANE *pP, UINT PStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Color +//-------------------------- + +// inline + +// (1-r, 1-g, 1-b, a) +D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); + +D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// (r1*r2, g1*g2, b1*b2, a1*a2) +D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Interpolate r,g,b between desaturated color and color. +// DesaturatedColor + s(Color - DesaturatedColor) +D3DXCOLOR* WINAPI D3DXColorAdjustSaturation + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +D3DXCOLOR* WINAPI D3DXColorAdjustContrast + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); + +#ifdef __cplusplus +} +#endif + + + + +//-------------------------- +// Misc +//-------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +// Calculate Fresnel term given the cosine of theta (likely obtained by +// taking the dot of two normals), and the refraction index of the material. +FLOAT WINAPI D3DXFresnelTerm + (FLOAT CosTheta, FLOAT RefractionIndex); + +#ifdef __cplusplus +} +#endif + + + +//=========================================================================== +// +// Matrix Stack +// +//=========================================================================== + +typedef interface ID3DXMatrixStack ID3DXMatrixStack; +typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; + +// {C7885BA7-F990-4fe7-922D-8515E477DD85} +DEFINE_GUID(IID_ID3DXMatrixStack, +0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85); + + +#undef INTERFACE +#define INTERFACE ID3DXMatrixStack + +DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) +{ + // + // IUnknown methods + // + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + // + // ID3DXMatrixStack methods + // + + // Pops the top of the stack, returns the current top + // *after* popping the top. + STDMETHOD(Pop)(THIS) PURE; + + // Pushes the stack by one, duplicating the current matrix. + STDMETHOD(Push)(THIS) PURE; + + // Loads identity in the current matrix. + STDMETHOD(LoadIdentity)(THIS) PURE; + + // Loads the given matrix into the current matrix + STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right-Multiplies the given matrix to the current matrix. + // (transformation is about the current world origin) + STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Left-Multiplies the given matrix to the current matrix + // (transformation is about the local origin of the object) + STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the current world origin) + STDMETHOD(RotateAxis) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the local origin of the object) + STDMETHOD(RotateAxisLocal) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // current world origin) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRoll) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // local origin of the object) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRollLocal) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Right multiply the current matrix with the computed scale + // matrix. (transformation is about the current world origin) + STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Left multiply the current matrix with the computed scale + // matrix. (transformation is about the local origin of the object) + STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Right multiply the current matrix with the computed translation + // matrix. (transformation is about the current world origin) + STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; + + // Left multiply the current matrix with the computed translation + // matrix. (transformation is about the local origin of the object) + STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Obtain the current matrix at the top of the stack + STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI + D3DXCreateMatrixStack( + DWORD Flags, + LPD3DXMATRIXSTACK* ppStack); + +#ifdef __cplusplus +} +#endif + +//=========================================================================== +// +// Spherical Harmonic Runtime Routines +// +// NOTE: +// * Most of these functions can take the same object as in and out parameters. +// The exceptions are the rotation functions. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//============================================================================ + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +//============================================================================ +// +// Basic Spherical Harmonic math routines +// +//============================================================================ + +#define D3DXSH_MINORDER 2 +#define D3DXSH_MAXORDER 6 + +//============================================================================ +// +// D3DXSHEvalDirection: +// -------------------- +// Evaluates the Spherical Harmonic basis functions +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction to evaluate in - assumed to be normalized +// +//============================================================================ + +FLOAT* WINAPI D3DXSHEvalDirection + ( FLOAT *pOut, UINT Order, CONST D3DXVECTOR3 *pDir ); + +//============================================================================ +// +// D3DXSHRotate: +// -------------------- +// Rotates SH vector by a rotation matrix +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pMatrix +// Matrix used for rotation - rotation sub matrix should be orthogonal +// and have a unit determinant. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHRotate + ( FLOAT *pOut, UINT Order, CONST D3DXMATRIX *pMatrix, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHRotateZ: +// -------------------- +// Rotates the SH vector in the Z axis by an angle +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// Angle +// Angle in radians to rotate around the Z axis. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + + +FLOAT* WINAPI D3DXSHRotateZ + ( FLOAT *pOut, UINT Order, FLOAT Angle, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHAdd: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i] + pB[i]; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Input SH coeffs (second vector.) +// +//============================================================================ + +FLOAT* WINAPI D3DXSHAdd + ( FLOAT *pOut, UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHScale: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i]*Scale; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pIn +// Input SH coeffs. +// Scale +// Scale factor. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHScale + ( FLOAT *pOut, UINT Order, CONST FLOAT *pIn, CONST FLOAT Scale ); + +//============================================================================ +// +// D3DXSHDot: +// -------------------- +// Computes the dot product of two SH vectors +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Second set of input SH coeffs. +// +//============================================================================ + +FLOAT WINAPI D3DXSHDot + ( UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// Basic Spherical Harmonic lighting routines +// +//============================================================================ + +//============================================================================ +// +// D3DXSHEvalDirectionalLight: +// -------------------- +// Evaluates a directional light and returns spectral SH data. The output +// vector is computed so that if the intensity of R/G/B is unit the resulting +// exit radiance of a point directly under the light on a diffuse object with +// an albedo of 1 would be 1.0. This will compute 3 spectral samples, pROut +// has to be specified, while pGout and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalDirectionalLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalSphericalLight: +// -------------------- +// Evaluates a spherical light and returns spectral SH data. There is no +// normalization of the intensity of the light like there is for directional +// lights, care has to be taken when specifiying the intensities. This will +// compute 3 spectral samples, pROut has to be specified, while pGout and +// pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pPos +// Position of light - reciever is assumed to be at the origin. +// Radius +// Radius of the spherical light source. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalSphericalLight + ( UINT Order, CONST D3DXVECTOR3 *pPos, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalConeLight: +// -------------------- +// Evaluates a light that is a cone of constant intensity and returns spectral +// SH data. The output vector is computed so that if the intensity of R/G/B is +// unit the resulting exit radiance of a point directly under the light oriented +// in the cone direction on a diffuse object with an albedo of 1 would be 1.0. +// This will compute 3 spectral samples, pROut has to be specified, while pGout +// and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// Radius +// Radius of cone in radians. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalConeLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalHemisphereLight: +// -------------------- +// Evaluates a light that is a linear interpolant between two colors over the +// sphere. The interpolant is linear along the axis of the two points, not +// over the surface of the sphere (ie: if the axis was (0,0,1) it is linear in +// Z, not in the azimuthal angle.) The resulting spherical lighting function +// is normalized so that a point on a perfectly diffuse surface with no +// shadowing and a normal pointed in the direction pDir would result in exit +// radiance with a value of 1 if the top color was white and the bottom color +// was black. This is a very simple model where Top represents the intensity +// of the "sky" and Bottom represents the intensity of the "ground". +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Axis of the hemisphere. +// Top +// Color of the upper hemisphere. +// Bottom +// Color of the lower hemisphere. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalHemisphereLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, D3DXCOLOR Top, D3DXCOLOR Bottom, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// Basic Spherical Harmonic projection routines +// +//============================================================================ + +//============================================================================ +// +// D3DXSHProjectCubeMap: +// -------------------- +// Projects a function represented on a cube map into spherical harmonics. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pCubeMap +// CubeMap that is going to be projected into spherical harmonics +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//============================================================================ + +HRESULT WINAPI D3DXSHProjectCubeMap + ( UINT uOrder, LPDIRECT3DCUBETEXTURE9 pCubeMap, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + + +#ifdef __cplusplus +} +#endif + + +#include "d3dx9math.inl" + +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif // __D3DX9MATH_H__ + diff --git a/saco/d3d9/include/d3dx9math.inl b/saco/d3d9/include/d3dx9math.inl new file mode 100644 index 0000000..ecf52f9 --- /dev/null +++ b/saco/d3d9/include/d3dx9math.inl @@ -0,0 +1,2244 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9math.inl +// Content: D3DX math inline functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX9MATH_INL__ +#define __D3DX9MATH_INL__ + + +//=========================================================================== +// +// Inline Class Methods +// +//=========================================================================== + +#ifdef __cplusplus + +//-------------------------- +// Float16 +//-------------------------- + +D3DXINLINE +D3DXFLOAT16::D3DXFLOAT16( FLOAT f ) +{ + D3DXFloat32To16Array(this, &f, 1); +} + +D3DXINLINE +D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f ) +{ + value = f.value; +} + +// casting +D3DXINLINE +D3DXFLOAT16::operator FLOAT () +{ + FLOAT f; + D3DXFloat16To32Array(&f, this, 1); + return f; +} + +// binary operators +D3DXINLINE BOOL +D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const +{ + return value == f.value; +} + +D3DXINLINE BOOL +D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const +{ + return value != f.value; +} + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; +} + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 2); +} + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DXINLINE +D3DXVECTOR2::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR2::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) +{ + x += v.x; + y += v.y; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator -= ( CONST D3DXVECTOR2& v ) +{ + x -= v.x; + y -= v.y; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator - () const +{ + return D3DXVECTOR2(-x, -y); +} + + +// binary operators +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x + v.x, y + v.y); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator - ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x - v.x, y - v.y); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator * ( FLOAT f ) const +{ + return D3DXVECTOR2(x * f, y * f); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR2(x * fInv, y * fInv); +} + +D3DXINLINE D3DXVECTOR2 +operator * ( FLOAT f, CONST D3DXVECTOR2& v ) +{ + return D3DXVECTOR2(f * v.x, f * v.y); +} + +D3DXINLINE BOOL +D3DXVECTOR2::operator == ( CONST D3DXVECTOR2& v ) const +{ + return x == v.x && y == v.y; +} + +D3DXINLINE BOOL +D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const +{ + return x != v.x || y != v.y; +} + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 2); +} + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); +} + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DXINLINE +D3DXVECTOR2_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x); +} + +D3DXINLINE BOOL +D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x); +} + + +//-------------------------- +// 3D Vector +//-------------------------- +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DVECTOR& v ) +{ + x = v.x; + y = v.y; + z = v.z; +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 3); +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DXINLINE +D3DXVECTOR3::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR3::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) +{ + x += v.x; + y += v.y; + z += v.z; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator -= ( CONST D3DXVECTOR3& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator - () const +{ + return D3DXVECTOR3(-x, -y, -z); +} + + +// binary operators +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x + v.x, y + v.y, z + v.z); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator - ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x - v.x, y - v.y, z - v.z); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator * ( FLOAT f ) const +{ + return D3DXVECTOR3(x * f, y * f, z * f); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR3(x * fInv, y * fInv, z * fInv); +} + + +D3DXINLINE D3DXVECTOR3 +operator * ( FLOAT f, CONST struct D3DXVECTOR3& v ) +{ + return D3DXVECTOR3(f * v.x, f * v.y, f * v.z); +} + + +D3DXINLINE BOOL +D3DXVECTOR3::operator == ( CONST D3DXVECTOR3& v ) const +{ + return x == v.x && y == v.y && z == v.z; +} + +D3DXINLINE BOOL +D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const +{ + return x != v.x || y != v.y || z != v.z; +} + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 3); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DVECTOR& v ) +{ + D3DXFloat32To16Array(&x, &v.x, 1); + D3DXFloat32To16Array(&y, &v.y, 1); + D3DXFloat32To16Array(&z, &v.z, 1); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); + *((WORD *) &z) = *((WORD *) &pf[2]); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DXINLINE +D3DXVECTOR3_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x) && + *((WORD *) &z) == *((WORD *) &v.z); +} + +D3DXINLINE BOOL +D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x) || + *((WORD *) &z) != *((WORD *) &v.z); +} + + +//-------------------------- +// 4D Vector +//-------------------------- +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DVECTOR& v, FLOAT f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXVECTOR4::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR4::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) +{ + x += v.x; + y += v.y; + z += v.z; + w += v.w; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator -= ( CONST D3DXVECTOR4& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + w -= v.w; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator - () const +{ + return D3DXVECTOR4(-x, -y, -z, -w); +} + + +// binary operators +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator - ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator * ( FLOAT f ) const +{ + return D3DXVECTOR4(x * f, y * f, z * f, w * f); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR4(x * fInv, y * fInv, z * fInv, w * fInv); +} + +D3DXINLINE D3DXVECTOR4 +operator * ( FLOAT f, CONST D3DXVECTOR4& v ) +{ + return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w); +} + + +D3DXINLINE BOOL +D3DXVECTOR4::operator == ( CONST D3DXVECTOR4& v ) const +{ + return x == v.x && y == v.y && z == v.z && w == v.w; +} + +D3DXINLINE BOOL +D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const +{ + return x != v.x || y != v.y || z != v.z || w != v.w; +} + + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 4); +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); + *((DWORD *) &z) = *((DWORD *) &pf[2]); +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& v, CONST D3DXFLOAT16& f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz, CONST D3DXFLOAT16 &fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXVECTOR4_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x) && + *((DWORD *) &z) == *((DWORD *) &v.z); +} + +D3DXINLINE BOOL +D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x) || + *((DWORD *) &z) != *((DWORD *) &v.z); +} + + +//-------------------------- +// Matrix +//-------------------------- +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + memcpy(&_11, pf, sizeof(D3DXMATRIX)); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DMATRIX& mat ) +{ + memcpy(&_11, &mat, sizeof(D3DXMATRIX)); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&_11, pf, 16); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, + FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24, + FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34, + FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44 ) +{ + _11 = f11; _12 = f12; _13 = f13; _14 = f14; + _21 = f21; _22 = f22; _23 = f23; _24 = f24; + _31 = f31; _32 = f32; _33 = f33; _34 = f34; + _41 = f41; _42 = f42; _43 = f43; _44 = f44; +} + + + +// access grants +D3DXINLINE FLOAT& +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) +{ + return m[iRow][iCol]; +} + +D3DXINLINE FLOAT +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const +{ + return m[iRow][iCol]; +} + + +// casting operators +D3DXINLINE +D3DXMATRIX::operator FLOAT* () +{ + return (FLOAT *) &_11; +} + +D3DXINLINE +D3DXMATRIX::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &_11; +} + + +// assignment operators +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) +{ + D3DXMatrixMultiply(this, this, &mat); + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator += ( CONST D3DXMATRIX& mat ) +{ + _11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14; + _21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24; + _31 += mat._31; _32 += mat._32; _33 += mat._33; _34 += mat._34; + _41 += mat._41; _42 += mat._42; _43 += mat._43; _44 += mat._44; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator -= ( CONST D3DXMATRIX& mat ) +{ + _11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14; + _21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24; + _31 -= mat._31; _32 -= mat._32; _33 -= mat._33; _34 -= mat._34; + _41 -= mat._41; _42 -= mat._42; _43 -= mat._43; _44 -= mat._44; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( FLOAT f ) +{ + _11 *= f; _12 *= f; _13 *= f; _14 *= f; + _21 *= f; _22 *= f; _23 *= f; _24 *= f; + _31 *= f; _32 *= f; _33 *= f; _34 *= f; + _41 *= f; _42 *= f; _43 *= f; _44 *= f; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + _11 *= fInv; _12 *= fInv; _13 *= fInv; _14 *= fInv; + _21 *= fInv; _22 *= fInv; _23 *= fInv; _24 *= fInv; + _31 *= fInv; _32 *= fInv; _33 *= fInv; _34 *= fInv; + _41 *= fInv; _42 *= fInv; _43 *= fInv; _44 *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator - () const +{ + return D3DXMATRIX(-_11, -_12, -_13, -_14, + -_21, -_22, -_23, -_24, + -_31, -_32, -_33, -_34, + -_41, -_42, -_43, -_44); +} + + +// binary operators +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const +{ + D3DXMATRIX matT; + D3DXMatrixMultiply(&matT, this, &mat); + return matT; +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator + ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + mat._14, + _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24, + _31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + mat._34, + _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator - ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14, + _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24, + _31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - mat._34, + _41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - mat._44); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator * ( FLOAT f ) const +{ + return D3DXMATRIX(_11 * f, _12 * f, _13 * f, _14 * f, + _21 * f, _22 * f, _23 * f, _24 * f, + _31 * f, _32 * f, _33 * f, _34 * f, + _41 * f, _42 * f, _43 * f, _44 * f); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXMATRIX(_11 * fInv, _12 * fInv, _13 * fInv, _14 * fInv, + _21 * fInv, _22 * fInv, _23 * fInv, _24 * fInv, + _31 * fInv, _32 * fInv, _33 * fInv, _34 * fInv, + _41 * fInv, _42 * fInv, _43 * fInv, _44 * fInv); +} + + +D3DXINLINE D3DXMATRIX +operator * ( FLOAT f, CONST D3DXMATRIX& mat ) +{ + return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14, + f * mat._21, f * mat._22, f * mat._23, f * mat._24, + f * mat._31, f * mat._32, f * mat._33, f * mat._34, + f * mat._41, f * mat._42, f * mat._43, f * mat._44); +} + + +D3DXINLINE BOOL +D3DXMATRIX::operator == ( CONST D3DXMATRIX& mat ) const +{ + return 0 == memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + +D3DXINLINE BOOL +D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const +{ + return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + + + +//-------------------------- +// Aligned Matrices +//-------------------------- + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) : + D3DXMATRIX( f ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DMATRIX& m ) : + D3DXMATRIX( m ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DXFLOAT16* f ) : + D3DXMATRIX( f ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ) : + D3DXMATRIX(_11, _12, _13, _14, + _21, _22, _23, _24, + _31, _32, _33, _34, + _41, _42, _43, _44) +{ +} + +D3DXINLINE void* +_D3DXMATRIXA16::operator new( size_t s ) +{ + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DXINLINE void* +_D3DXMATRIXA16::operator new[]( size_t s ) +{ + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DXINLINE void +_D3DXMATRIXA16::operator delete(void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DXINLINE void +_D3DXMATRIXA16::operator delete[](void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DXINLINE _D3DXMATRIXA16& +_D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs) +{ + memcpy(&_11, &rhs, sizeof(D3DXMATRIX)); + return *this; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXQUATERNION::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXQUATERNION::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) +{ + x += q.x; + y += q.y; + z += q.z; + w += q.w; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator -= ( CONST D3DXQUATERNION& q ) +{ + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( CONST D3DXQUATERNION& q ) +{ + D3DXQuaternionMultiply(this, this, &q); + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator - () const +{ + return D3DXQUATERNION(-x, -y, -z, -w); +} + + +// binary operators +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x + q.x, y + q.y, z + q.z, w + q.w); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator - ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x - q.x, y - q.y, z - q.z, w - q.w); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( CONST D3DXQUATERNION& q ) const +{ + D3DXQUATERNION qT; + D3DXQuaternionMultiply(&qT, this, &q); + return qT; +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( FLOAT f ) const +{ + return D3DXQUATERNION(x * f, y * f, z * f, w * f); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXQUATERNION(x * fInv, y * fInv, z * fInv, w * fInv); +} + + +D3DXINLINE D3DXQUATERNION +operator * (FLOAT f, CONST D3DXQUATERNION& q ) +{ + return D3DXQUATERNION(f * q.x, f * q.y, f * q.z, f * q.w); +} + + +D3DXINLINE BOOL +D3DXQUATERNION::operator == ( CONST D3DXQUATERNION& q ) const +{ + return x == q.x && y == q.y && z == q.z && w == q.w; +} + +D3DXINLINE BOOL +D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const +{ + return x != q.x || y != q.y || z != q.z || w != q.w; +} + + + +//-------------------------- +// Plane +//-------------------------- + +D3DXINLINE +D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + a = pf[0]; + b = pf[1]; + c = pf[2]; + d = pf[3]; +} + +D3DXINLINE +D3DXPLANE::D3DXPLANE( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&a, pf, 4); +} + +D3DXINLINE +D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) +{ + a = fa; + b = fb; + c = fc; + d = fd; +} + + +// casting +D3DXINLINE +D3DXPLANE::operator FLOAT* () +{ + return (FLOAT *) &a; +} + +D3DXINLINE +D3DXPLANE::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &a; +} + + +// assignment operators +D3DXINLINE D3DXPLANE& +D3DXPLANE::operator *= ( FLOAT f ) +{ + a *= f; + b *= f; + c *= f; + d *= f; + return *this; +} + +D3DXINLINE D3DXPLANE& +D3DXPLANE::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + a *= fInv; + b *= fInv; + c *= fInv; + d *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXPLANE +D3DXPLANE::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXPLANE +D3DXPLANE::operator - () const +{ + return D3DXPLANE(-a, -b, -c, -d); +} + + +// binary operators +D3DXINLINE D3DXPLANE +D3DXPLANE::operator * ( FLOAT f ) const +{ + return D3DXPLANE(a * f, b * f, c * f, d * f); +} + +D3DXINLINE D3DXPLANE +D3DXPLANE::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXPLANE(a * fInv, b * fInv, c * fInv, d * fInv); +} + +D3DXINLINE D3DXPLANE +operator * (FLOAT f, CONST D3DXPLANE& p ) +{ + return D3DXPLANE(f * p.a, f * p.b, f * p.c, f * p.d); +} + +D3DXINLINE BOOL +D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const +{ + return a == p.a && b == p.b && c == p.c && d == p.d; +} + +D3DXINLINE BOOL +D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const +{ + return a != p.a || b != p.b || c != p.c || d != p.d; +} + + + + +//-------------------------- +// Color +//-------------------------- + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( DWORD dw ) +{ + CONST FLOAT f = 1.0f / 255.0f; + r = f * (FLOAT) (unsigned char) (dw >> 16); + g = f * (FLOAT) (unsigned char) (dw >> 8); + b = f * (FLOAT) (unsigned char) (dw >> 0); + a = f * (FLOAT) (unsigned char) (dw >> 24); +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + r = pf[0]; + g = pf[1]; + b = pf[2]; + a = pf[3]; +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&r, pf, 4); +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DCOLORVALUE& c ) +{ + r = c.r; + g = c.g; + b = c.b; + a = c.a; +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) +{ + r = fr; + g = fg; + b = fb; + a = fa; +} + + +// casting +D3DXINLINE +D3DXCOLOR::operator DWORD () const +{ + DWORD dwR = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (DWORD) (r * 255.0f + 0.5f); + DWORD dwG = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (DWORD) (g * 255.0f + 0.5f); + DWORD dwB = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (DWORD) (b * 255.0f + 0.5f); + DWORD dwA = a >= 1.0f ? 0xff : a <= 0.0f ? 0x00 : (DWORD) (a * 255.0f + 0.5f); + + return (dwA << 24) | (dwR << 16) | (dwG << 8) | dwB; +} + + +D3DXINLINE +D3DXCOLOR::operator FLOAT * () +{ + return (FLOAT *) &r; +} + +D3DXINLINE +D3DXCOLOR::operator CONST FLOAT * () const +{ + return (CONST FLOAT *) &r; +} + + +D3DXINLINE +D3DXCOLOR::operator D3DCOLORVALUE * () +{ + return (D3DCOLORVALUE *) &r; +} + +D3DXINLINE +D3DXCOLOR::operator CONST D3DCOLORVALUE * () const +{ + return (CONST D3DCOLORVALUE *) &r; +} + + +D3DXINLINE +D3DXCOLOR::operator D3DCOLORVALUE& () +{ + return *((D3DCOLORVALUE *) &r); +} + +D3DXINLINE +D3DXCOLOR::operator CONST D3DCOLORVALUE& () const +{ + return *((CONST D3DCOLORVALUE *) &r); +} + + +// assignment operators +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) +{ + r += c.r; + g += c.g; + b += c.b; + a += c.a; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator -= ( CONST D3DXCOLOR& c ) +{ + r -= c.r; + g -= c.g; + b -= c.b; + a -= c.a; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator *= ( FLOAT f ) +{ + r *= f; + g *= f; + b *= f; + a *= f; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + r *= fInv; + g *= fInv; + b *= fInv; + a *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator - () const +{ + return D3DXCOLOR(-r, -g, -b, -a); +} + + +// binary operators +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r + c.r, g + c.g, b + c.b, a + c.a); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator - ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r - c.r, g - c.g, b - c.b, a - c.a); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator * ( FLOAT f ) const +{ + return D3DXCOLOR(r * f, g * f, b * f, a * f); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXCOLOR(r * fInv, g * fInv, b * fInv, a * fInv); +} + + +D3DXINLINE D3DXCOLOR +operator * (FLOAT f, CONST D3DXCOLOR& c ) +{ + return D3DXCOLOR(f * c.r, f * c.g, f * c.b, f * c.a); +} + + +D3DXINLINE BOOL +D3DXCOLOR::operator == ( CONST D3DXCOLOR& c ) const +{ + return r == c.r && g == c.g && b == c.b && a == c.a; +} + +D3DXINLINE BOOL +D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const +{ + return r != c.r || g != c.g || b != c.b || a != c.a; +} + + +#endif //__cplusplus + + + +//=========================================================================== +// +// Inline functions +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y); +#endif +} + +D3DXINLINE FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y; +} + +D3DXINLINE FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y; +} + +D3DXINLINE FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->y - pV1->y * pV2->x; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + return pOut; +} + + +//-------------------------- +// 3D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#endif +} + +D3DXINLINE FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z; +} + +D3DXINLINE FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ + D3DXVECTOR3 v; + +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + v.x = pV1->y * pV2->z - pV1->z * pV2->y; + v.y = pV1->z * pV2->x - pV1->x * pV2->z; + v.z = pV1->x * pV2->y - pV1->y * pV2->x; + + *pOut = v; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + return pOut; +} + + +//-------------------------- +// 4D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#endif +} + +D3DXINLINE FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w; +} + +D3DXINLINE FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z + pV1->w * pV2->w; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + pOut->w = pV1->w + pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + pOut->w = pV1->w - pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w < pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w > pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + pOut->w = pV->w * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + pOut->w = pV1->w + s * (pV2->w - pV1->w); + return pOut; +} + + +//-------------------------- +// 4D Matrix +//-------------------------- + +D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ) +{ +#ifdef D3DX_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->m[0][1] = pOut->m[0][2] = pOut->m[0][3] = + pOut->m[1][0] = pOut->m[1][2] = pOut->m[1][3] = + pOut->m[2][0] = pOut->m[2][1] = pOut->m[2][3] = + pOut->m[3][0] = pOut->m[3][1] = pOut->m[3][2] = 0.0f; + + pOut->m[0][0] = pOut->m[1][1] = pOut->m[2][2] = pOut->m[3][3] = 1.0f; + return pOut; +} + + +D3DXINLINE BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ) +{ +#ifdef D3DX_DEBUG + if(!pM) + return FALSE; +#endif + + return pM->m[0][0] == 1.0f && pM->m[0][1] == 0.0f && pM->m[0][2] == 0.0f && pM->m[0][3] == 0.0f && + pM->m[1][0] == 0.0f && pM->m[1][1] == 1.0f && pM->m[1][2] == 0.0f && pM->m[1][3] == 0.0f && + pM->m[2][0] == 0.0f && pM->m[2][1] == 0.0f && pM->m[2][2] == 1.0f && pM->m[2][3] == 0.0f && + pM->m[3][0] == 0.0f && pM->m[3][1] == 0.0f && pM->m[3][2] == 0.0f && pM->m[3][3] == 1.0f; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DXINLINE FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#else + return (FLOAT) sqrt(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#endif +} + +D3DXINLINE FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return 0.0f; +#endif + + return pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w; +} + +D3DXINLINE FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ) +{ +#ifdef D3DX_DEBUG + if(!pQ1 || !pQ2) + return 0.0f; +#endif + + return pQ1->x * pQ2->x + pQ1->y * pQ2->y + pQ1->z * pQ2->z + pQ1->w * pQ2->w; +} + + +D3DXINLINE D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ) +{ +#ifdef D3DX_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->x = pOut->y = pOut->z = 0.0f; + pOut->w = 1.0f; + return pOut; +} + +D3DXINLINE BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return FALSE; +#endif + + return pQ->x == 0.0f && pQ->y == 0.0f && pQ->z == 0.0f && pQ->w == 1.0f; +} + + +D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pQ) + return NULL; +#endif + + pOut->x = -pQ->x; + pOut->y = -pQ->y; + pOut->z = -pQ->z; + pOut->w = pQ->w; + return pOut; +} + + +//-------------------------- +// Plane +//-------------------------- + +D3DXINLINE FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d * pV->w; +} + +D3DXINLINE FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d; +} + +D3DXINLINE FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z; +} + +D3DXINLINE D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pP) + return NULL; +#endif + + pOut->a = pP->a * s; + pOut->b = pP->b * s; + pOut->c = pP->c * s; + pOut->d = pP->d * s; + return pOut; +} + + +//-------------------------- +// Color +//-------------------------- + +D3DXINLINE D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = 1.0f - pC->r; + pOut->g = 1.0f - pC->g; + pOut->b = 1.0f - pC->b; + pOut->a = pC->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + pC2->r; + pOut->g = pC1->g + pC2->g; + pOut->b = pC1->b + pC2->b; + pOut->a = pC1->a + pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r - pC2->r; + pOut->g = pC1->g - pC2->g; + pOut->b = pC1->b - pC2->b; + pOut->a = pC1->a - pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = pC->r * s; + pOut->g = pC->g * s; + pOut->b = pC->b * s; + pOut->a = pC->a * s; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r * pC2->r; + pOut->g = pC1->g * pC2->g; + pOut->b = pC1->b * pC2->b; + pOut->a = pC1->a * pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + s * (pC2->r - pC1->r); + pOut->g = pC1->g + s * (pC2->g - pC1->g); + pOut->b = pC1->b + s * (pC2->b - pC1->b); + pOut->a = pC1->a + s * (pC2->a - pC1->a); + return pOut; +} + + +#endif // __D3DX9MATH_INL__ + diff --git a/saco/d3d9/include/d3dx9mesh.h b/saco/d3d9/include/d3dx9mesh.h new file mode 100644 index 0000000..e182967 --- /dev/null +++ b/saco/d3d9/include/d3dx9mesh.h @@ -0,0 +1,2791 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9mesh.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9MESH_H__ +#define __D3DX9MESH_H__ + +// {7ED943DD-52E8-40b5-A8D8-76685C406330} +DEFINE_GUID(IID_ID3DXBaseMesh, +0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30); + +// {4020E5C2-1403-4929-883F-E2E849FAC195} +DEFINE_GUID(IID_ID3DXMesh, +0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95); + +// {8875769A-D579-4088-AAEB-534D1AD84E96} +DEFINE_GUID(IID_ID3DXPMesh, +0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96); + +// {667EA4C7-F1CD-4386-B523-7C0290B83CC5} +DEFINE_GUID(IID_ID3DXSPMesh, +0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5); + +// {11EAA540-F9A6-4d49-AE6A-E19221F70CC4} +DEFINE_GUID(IID_ID3DXSkinInfo, +0x11eaa540, 0xf9a6, 0x4d49, 0xae, 0x6a, 0xe1, 0x92, 0x21, 0xf7, 0xc, 0xc4); + +// {3CE6CC22-DBF2-44f4-894D-F9C34A337139} +DEFINE_GUID(IID_ID3DXPatchMesh, +0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39); + +//patch mesh can be quads or tris +typedef enum _D3DXPATCHMESHTYPE { + D3DXPATCHMESH_RECT = 0x001, + D3DXPATCHMESH_TRI = 0x002, + D3DXPATCHMESH_NPATCH = 0x003, + + D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPATCHMESHTYPE; + +// Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags +enum _D3DXMESH { + D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. + D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB. + D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB. + D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB. + D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB. + D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER + D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB. + D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB. + D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB. + D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB. + D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER + D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB. + D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB. + D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB. + D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + + D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + + D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinInfo::ConvertToBlendedMesh + + // Helper options + D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM + D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED + D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY + D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC + D3DXMESH_SOFTWAREPROCESSING = 0x18000, // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + +}; + +//patch mesh options +enum _D3DXPATCHMESH { + D3DXPATCHMESH_DEFAULT = 000, +}; +// option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh +enum _D3DXMESHSIMP +{ + D3DXMESHSIMP_VERTEX = 0x1, + D3DXMESHSIMP_FACE = 0x2, + +}; + +typedef enum _D3DXCLEANTYPE { + D3DXCLEAN_BACKFACING = 0x00000001, + D3DXCLEAN_BOWTIES = 0x00000002, + + // Helper options + D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING, // Bowtie cleaning modifies geometry and breaks skinning + D3DXCLEAN_OPTIMIZATION = D3DXCLEAN_BACKFACING, + D3DXCLEAN_SIMPLIFICATION= D3DXCLEAN_BACKFACING | D3DXCLEAN_BOWTIES, +} D3DXCLEANTYPE; + +enum _MAX_FVF_DECL_SIZE +{ + MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 // +1 for END +}; + +typedef enum _D3DXTANGENT +{ + D3DXTANGENT_WRAP_U = 0x01, + D3DXTANGENT_WRAP_V = 0x02, + D3DXTANGENT_WRAP_UV = 0x03, + D3DXTANGENT_DONT_NORMALIZE_PARTIALS = 0x04, + D3DXTANGENT_DONT_ORTHOGONALIZE = 0x08, + D3DXTANGENT_ORTHOGONALIZE_FROM_V = 0x010, + D3DXTANGENT_ORTHOGONALIZE_FROM_U = 0x020, + D3DXTANGENT_WEIGHT_BY_AREA = 0x040, + D3DXTANGENT_WEIGHT_EQUAL = 0x080, + D3DXTANGENT_WIND_CW = 0x0100, + D3DXTANGENT_CALCULATE_NORMALS = 0x0200, + D3DXTANGENT_GENERATE_IN_PLACE = 0x0400, +} D3DXTANGENT; + + +typedef struct ID3DXBaseMesh *LPD3DXBASEMESH; +typedef struct ID3DXMesh *LPD3DXMESH; +typedef struct ID3DXPMesh *LPD3DXPMESH; +typedef struct ID3DXSPMesh *LPD3DXSPMESH; +typedef struct ID3DXSkinInfo *LPD3DXSKININFO; +typedef struct ID3DXPatchMesh *LPD3DXPATCHMESH; + +typedef struct _D3DXATTRIBUTERANGE +{ + DWORD AttribId; + DWORD FaceStart; + DWORD FaceCount; + DWORD VertexStart; + DWORD VertexCount; +} D3DXATTRIBUTERANGE; + +typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE; + +typedef struct _D3DXMATERIAL +{ + D3DMATERIAL9 MatD3D; + LPSTR pTextureFilename; +} D3DXMATERIAL; +typedef D3DXMATERIAL *LPD3DXMATERIAL; + +typedef enum _D3DXEFFECTDEFAULTTYPE +{ + D3DXEDT_STRING = 0x1, // pValue points to a null terminated ASCII string + D3DXEDT_FLOATS = 0x2, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float) + D3DXEDT_DWORD = 0x3, // pValue points to a DWORD + + D3DXEDT_FORCEDWORD = 0x7fffffff +} D3DXEFFECTDEFAULTTYPE; + +typedef struct _D3DXEFFECTDEFAULT +{ + LPSTR pParamName; + D3DXEFFECTDEFAULTTYPE Type; // type of the data pointed to by pValue + DWORD NumBytes; // size in bytes of the data pointed to by pValue + LPVOID pValue; // data for the default of the effect +} D3DXEFFECTDEFAULT, *LPD3DXEFFECTDEFAULT; + +typedef struct _D3DXEFFECTINSTANCE +{ + LPSTR pEffectFilename; + DWORD NumDefaults; + LPD3DXEFFECTDEFAULT pDefaults; +} D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE; + +typedef struct _D3DXATTRIBUTEWEIGHTS +{ + FLOAT Position; + FLOAT Boundary; + FLOAT Normal; + FLOAT Diffuse; + FLOAT Specular; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; +} D3DXATTRIBUTEWEIGHTS, *LPD3DXATTRIBUTEWEIGHTS; + +enum _D3DXWELDEPSILONSFLAGS +{ + D3DXWELDEPSILONS_WELDALL = 0x1, // weld all vertices marked by adjacency as being overlapping + + D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, // if a given vertex component is within epsilon, modify partial matched + // vertices so that both components identical AND if all components "equal" + // remove one of the vertices + D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, // instructs weld to only allow modifications to vertices and not removal + // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set + // useful to modify vertices to be equal, but not allow vertices to be removed + + D3DXWELDEPSILONS_DONOTSPLIT = 0x8, // instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT) + // if this flag is not set, all vertices that are in separate attribute groups + // will remain split and not welded. Setting this flag can slow down software vertex processing + +}; + +typedef struct _D3DXWELDEPSILONS +{ + FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency + // in general, it should be the same value or greater than the one passed to GeneratedAdjacency + FLOAT BlendWeights; + FLOAT Normal; + FLOAT PSize; + FLOAT Specular; + FLOAT Diffuse; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; + FLOAT TessFactor; +} D3DXWELDEPSILONS; + +typedef D3DXWELDEPSILONS* LPD3DXWELDEPSILONS; + + +#undef INTERFACE +#define INTERFACE ID3DXBaseMesh + +DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXMesh + +DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // ID3DXMesh + STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE; + STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; + STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppOptMesh) PURE; + STDMETHOD(OptimizeInplace)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap) PURE; + STDMETHOD(SetAttributeTable)(THIS_ CONST D3DXATTRIBUTERANGE *pAttribTable, DWORD cAttribTableSize) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXPMesh + +DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // ID3DXPMesh + STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(SetNumFaces)(THIS_ DWORD Faces) PURE; + STDMETHOD(SetNumVertices)(THIS_ DWORD Vertices) PURE; + STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE; + STDMETHOD(Save)(THIS_ IStream *pStream, CONST D3DXMATERIAL* pMaterials, CONST D3DXEFFECTINSTANCE* pEffectInstances, DWORD NumMaterials) PURE; + + STDMETHOD(Optimize)(THIS_ DWORD Flags, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppOptMesh) PURE; + + STDMETHOD(OptimizeBaseLOD)(THIS_ DWORD Flags, DWORD* pFaceRemap) PURE; + STDMETHOD(TrimByFaces)(THIS_ DWORD NewFacesMin, DWORD NewFacesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE; + STDMETHOD(TrimByVertices)(THIS_ DWORD NewVerticesMin, DWORD NewVerticesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE; + + STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE; + + // Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs + // Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh + STDMETHOD(GenerateVertexHistory)(THIS_ DWORD* pVertexHistory) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXSPMesh + +DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXSPMesh + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsByFace, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsbyFace, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ReduceFaces)(THIS_ DWORD Faces) PURE; + STDMETHOD(ReduceVertices)(THIS_ DWORD Vertices) PURE; + STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; + STDMETHOD(GetVertexAttributeWeights)(THIS_ LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights) PURE; + STDMETHOD(GetVertexWeights)(THIS_ FLOAT *pVertexWeights) PURE; +}; + +#define UNUSED16 (0xffff) +#define UNUSED32 (0xffffffff) + +// ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags +enum _D3DXMESHOPT { + D3DXMESHOPT_COMPACT = 0x01000000, + D3DXMESHOPT_ATTRSORT = 0x02000000, + D3DXMESHOPT_VERTEXCACHE = 0x04000000, + D3DXMESHOPT_STRIPREORDER = 0x08000000, + D3DXMESHOPT_IGNOREVERTS = 0x10000000, // optimize faces only, don't touch vertices + D3DXMESHOPT_DONOTSPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting + D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000, // Only affects VCache. uses a static known good cache size for all cards + + // D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead + +}; + +// Subset of the mesh that has the same attribute and bone combination. +// This subset can be rendered in a single draw call +typedef struct _D3DXBONECOMBINATION +{ + DWORD AttribId; + DWORD FaceStart; + DWORD FaceCount; + DWORD VertexStart; + DWORD VertexCount; + DWORD* BoneId; +} D3DXBONECOMBINATION, *LPD3DXBONECOMBINATION; + +// The following types of patch combinations are supported: +// Patch type Basis Degree +// Rect Bezier 2,3,5 +// Rect B-Spline 2,3,5 +// Rect Catmull-Rom 3 +// Tri Bezier 2,3,5 +// N-Patch N/A 3 + +typedef struct _D3DXPATCHINFO +{ + D3DXPATCHMESHTYPE PatchType; + D3DDEGREETYPE Degree; + D3DBASISTYPE Basis; +} D3DXPATCHINFO, *LPD3DXPATCHINFO; + +#undef INTERFACE +#define INTERFACE ID3DXPatchMesh + +DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPatchMesh + + // Return creation parameters + STDMETHOD_(DWORD, GetNumPatches)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetControlVerticesPerPatch)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE; + STDMETHOD(GetPatchInfo)(THIS_ LPD3DXPATCHINFO PatchInfo) PURE; + + // Control mesh access + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE; + STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; + + // This function returns the size of the tessellated mesh given a tessellation level. + // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must + // be set to TRUE and TessellationLevel should be the max tessellation. + // This will result in the max mesh size necessary for adaptive tessellation. + STDMETHOD(GetTessSize)(THIS_ FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) PURE; + + //GenerateAdjacency determines which patches are adjacent with provided tolerance + //this information is used internally to optimize tessellation + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Tolerance) PURE; + + //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer + //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh + //has adjacency, the new mesh will also have adjacency + STDMETHOD(CloneMesh)(THIS_ DWORD Options, CONST D3DVERTEXELEMENT9 *pDecl, LPD3DXPATCHMESH *pMesh) PURE; + + // Optimizes the patchmesh for efficient tessellation. This function is designed + // to perform one time optimization for patch meshes that need to be tessellated + // repeatedly by calling the Tessellate() method. The optimization performed is + // independent of the actual tessellation level used. + // Currently Flags is unused. + // If vertices are changed, Optimize must be called again + STDMETHOD(Optimize)(THIS_ DWORD flags) PURE; + + //gets and sets displacement parameters + //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation + STDMETHOD(SetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 Texture, + D3DTEXTUREFILTERTYPE MinFilter, + D3DTEXTUREFILTERTYPE MagFilter, + D3DTEXTUREFILTERTYPE MipFilter, + D3DTEXTUREADDRESS Wrap, + DWORD dwLODBias) PURE; + + STDMETHOD(GetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 *Texture, + D3DTEXTUREFILTERTYPE *MinFilter, + D3DTEXTUREFILTERTYPE *MagFilter, + D3DTEXTUREFILTERTYPE *MipFilter, + D3DTEXTUREADDRESS *Wrap, + DWORD *dwLODBias) PURE; + + // Performs the uniform tessellation based on the tessellation level. + // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + STDMETHOD(Tessellate)(THIS_ FLOAT fTessLevel,LPD3DXMESH pMesh) PURE; + + // Performs adaptive tessellation based on the Z based adaptive tessellation criterion. + // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex + // adaptive tessellation amount. Each edge is tessellated to the average of the criterion + // at the 2 vertices it connects. + // MaxTessLevel specifies the upper limit for adaptive tesselation. + // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + STDMETHOD(TessellateAdaptive)(THIS_ + CONST D3DXVECTOR4 *pTrans, + DWORD dwMaxTessLevel, + DWORD dwMinTessLevel, + LPD3DXMESH pMesh) PURE; + +}; + +#undef INTERFACE +#define INTERFACE ID3DXSkinInfo + +DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Specify the which vertices do each bones influence and by how much + STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE; + STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float weight) PURE; + STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE; + STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE; + STDMETHOD(GetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float *pWeight, DWORD *pVertexNum) PURE; + STDMETHOD(GetMaxVertexInfluences)(THIS_ DWORD* maxVertexInfluences) PURE; + STDMETHOD_(DWORD, GetNumBones)(THIS) PURE; + STDMETHOD(FindBoneVertexInfluenceIndex)(THIS_ DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex) PURE; + + // This gets the max face influences based on a triangle mesh with the specified index buffer + STDMETHOD(GetMaxFaceInfluences)(THIS_ LPDIRECT3DINDEXBUFFER9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences) PURE; + + // Set min bone influence. Bone influences that are smaller than this are ignored + STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT MinInfl) PURE; + // Get min bone influence. + STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE; + + // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object + STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; // pName is copied to an internal string buffer + STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; // A pointer to an internal string buffer is returned. Do not free this. + + // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object + STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; // pBoneTransform is copied to an internal buffer + STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; // A pointer to an internal matrix is returned. Do not free this. + + // Clone a skin info object + STDMETHOD(Clone)(THIS_ LPD3DXSKININFO* ppSkinInfo) PURE; + + // Update bone influence information to match vertices after they are reordered. This should be called + // if the target vertex buffer has been reordered externally. + STDMETHOD(Remap)(THIS_ DWORD NumVertices, DWORD* pVertexRemap) PURE; + + // These methods enable the modification of the vertex layout of the vertices that will be skinned + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9 *pDeclaration) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // Apply SW skinning based on current pose matrices to the target vertices. + STDMETHOD(UpdateSkinnedMesh)(THIS_ + CONST D3DXMATRIX* pBoneTransforms, + CONST D3DXMATRIX* pBoneInvTransposeTransforms, + LPCVOID pVerticesSrc, + PVOID pVerticesDst) PURE; + + // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination + // table that describes which bones affect which subsets of the mesh + STDMETHOD(ConvertToBlendedMesh)(THIS_ + LPD3DXMESH pMesh, + DWORD Options, + CONST DWORD *pAdjacencyIn, + LPDWORD pAdjacencyOut, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + DWORD* pMaxFaceInfl, + DWORD* pNumBoneCombinations, + LPD3DXBUFFER* ppBoneCombinationTable, + LPD3DXMESH* ppMesh) PURE; + + // Takes a mesh and returns a new mesh with per vertex blend weights and indices + // and a bone combination table that describes which bones palettes affect which subsets of the mesh + STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_ + LPD3DXMESH pMesh, + DWORD Options, + DWORD paletteSize, + CONST DWORD *pAdjacencyIn, + LPDWORD pAdjacencyOut, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + DWORD* pMaxVertexInfl, + DWORD* pNumBoneCombinations, + LPD3DXBUFFER* ppBoneCombinationTable, + LPD3DXMESH* ppMesh) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateMesh( + DWORD NumFaces, + DWORD NumVertices, + DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXCreateMeshFVF( + DWORD NumFaces, + DWORD NumVertices, + DWORD Options, + DWORD FVF, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXCreateSPMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + LPD3DXSPMESH* ppSMesh); + +// clean a mesh up for simplification, try to make manifold +HRESULT WINAPI + D3DXCleanMesh( + D3DXCLEANTYPE CleanType, + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacencyIn, + LPD3DXMESH* ppMeshOut, + DWORD* pAdjacencyOut, + LPD3DXBUFFER* ppErrorsAndWarnings); + +HRESULT WINAPI + D3DXValidMesh( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacency, + LPD3DXBUFFER* ppErrorsAndWarnings); + +HRESULT WINAPI + D3DXGeneratePMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + DWORD MinValue, + DWORD Options, + LPD3DXPMESH* ppPMesh); + +HRESULT WINAPI + D3DXSimplifyMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + DWORD MinValue, + DWORD Options, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXComputeBoundingSphere( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pCenter, + FLOAT *pRadius); + +HRESULT WINAPI + D3DXComputeBoundingBox( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pMin, + D3DXVECTOR3 *pMax); + +HRESULT WINAPI + D3DXComputeNormals( + LPD3DXBASEMESH pMesh, + CONST DWORD *pAdjacency); + +HRESULT WINAPI + D3DXCreateBuffer( + DWORD NumBytes, + LPD3DXBUFFER *ppBuffer); + + +HRESULT WINAPI + D3DXLoadMeshFromXA( + LPCSTR pFilename, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXW( + LPCWSTR pFilename, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +#ifdef UNICODE +#define D3DXLoadMeshFromX D3DXLoadMeshFromXW +#else +#define D3DXLoadMeshFromX D3DXLoadMeshFromXA +#endif + +HRESULT WINAPI + D3DXLoadMeshFromXInMemory( + LPCVOID Memory, + DWORD SizeOfMemory, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXResource( + HMODULE Module, + LPCSTR Name, + LPCSTR Type, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXSaveMeshToXA( + LPCSTR pFilename, + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXMATERIAL* pMaterials, + CONST D3DXEFFECTINSTANCE* pEffectInstances, + DWORD NumMaterials, + DWORD Format + ); + +HRESULT WINAPI + D3DXSaveMeshToXW( + LPCWSTR pFilename, + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXMATERIAL* pMaterials, + CONST D3DXEFFECTINSTANCE* pEffectInstances, + DWORD NumMaterials, + DWORD Format + ); + +#ifdef UNICODE +#define D3DXSaveMeshToX D3DXSaveMeshToXW +#else +#define D3DXSaveMeshToX D3DXSaveMeshToXA +#endif + + +HRESULT WINAPI + D3DXCreatePMeshFromStream( + IStream *pStream, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD* pNumMaterials, + LPD3DXPMESH *ppPMesh); + +// Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices +// The bone names and initial bone transforms are not filled in the skin info object by this method. +HRESULT WINAPI + D3DXCreateSkinInfo( + DWORD NumVertices, + CONST D3DVERTEXELEMENT9 *pDeclaration, + DWORD NumBones, + LPD3DXSKININFO* ppSkinInfo); + +// Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices +// The bone names and initial bone transforms are not filled in the skin info object by this method. +HRESULT WINAPI + D3DXCreateSkinInfoFVF( + DWORD NumVertices, + DWORD FVF, + DWORD NumBones, + LPD3DXSKININFO* ppSkinInfo); + +#ifdef __cplusplus +} + +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXLoadMeshFromXof( + LPD3DXFILEDATA pxofMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +// This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file +// If skinning info is not present, ppSkinInfo will be NULL +HRESULT WINAPI + D3DXLoadSkinMeshFromXof( + LPD3DXFILEDATA pxofMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER* ppAdjacency, + LPD3DXBUFFER* ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pMatOut, + LPD3DXSKININFO* ppSkinInfo, + LPD3DXMESH* ppMesh); + + +// The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from +// the mesh and the bone combination table and populates a skin info object with that data. The bone +// names and initial bone transforms are not filled in the skin info object by this method. This works +// with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to +// determine what type it is. +HRESULT WINAPI + D3DXCreateSkinInfoFromBlendedMesh( + LPD3DXBASEMESH pMesh, + DWORD NumBones, + CONST D3DXBONECOMBINATION *pBoneCombinationTable, + LPD3DXSKININFO* ppSkinInfo); + +HRESULT WINAPI + D3DXTessellateNPatches( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacencyIn, + FLOAT NumSegs, + BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppAdjacencyOut); + + +//generates implied outputdecl from input decl +//the decl generated from this should be used to generate the output decl for +//the tessellator subroutines. + +HRESULT WINAPI + D3DXGenerateOutputDecl( + D3DVERTEXELEMENT9 *pOutput, + CONST D3DVERTEXELEMENT9 *pInput); + +//loads patches from an XFileData +//since an X file can have up to 6 different patch meshes in it, +//returns them in an array - pNumPatches will contain the number of +//meshes in the actual file. +HRESULT WINAPI + D3DXLoadPatchMeshFromXof( + LPD3DXFILEDATA pXofObjMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + PDWORD pNumMaterials, + LPD3DXPATCHMESH *ppMesh); + +//computes the size a single rect patch. +HRESULT WINAPI + D3DXRectPatchSize( + CONST FLOAT *pfNumSegs, //segments for each edge (4) + DWORD *pdwTriangles, //output number of triangles + DWORD *pdwVertices); //output number of vertices + +//computes the size of a single triangle patch +HRESULT WINAPI + D3DXTriPatchSize( + CONST FLOAT *pfNumSegs, //segments for each edge (3) + DWORD *pdwTriangles, //output number of triangles + DWORD *pdwVertices); //output number of vertices + + +//tessellates a patch into a created mesh +//similar to D3D RT patch +HRESULT WINAPI + D3DXTessellateRectPatch( + LPDIRECT3DVERTEXBUFFER9 pVB, + CONST FLOAT *pNumSegs, + CONST D3DVERTEXELEMENT9 *pdwInDecl, + CONST D3DRECTPATCH_INFO *pRectPatchInfo, + LPD3DXMESH pMesh); + + +HRESULT WINAPI + D3DXTessellateTriPatch( + LPDIRECT3DVERTEXBUFFER9 pVB, + CONST FLOAT *pNumSegs, + CONST D3DVERTEXELEMENT9 *pInDecl, + CONST D3DTRIPATCH_INFO *pTriPatchInfo, + LPD3DXMESH pMesh); + + + +//creates an NPatch PatchMesh from a D3DXMESH +HRESULT WINAPI + D3DXCreateNPatchMesh( + LPD3DXMESH pMeshSysMem, + LPD3DXPATCHMESH *pPatchMesh); + + +//creates a patch mesh +HRESULT WINAPI + D3DXCreatePatchMesh( + CONST D3DXPATCHINFO *pInfo, //patch type + DWORD dwNumPatches, //number of patches + DWORD dwNumVertices, //number of control vertices + DWORD dwOptions, //options + CONST D3DVERTEXELEMENT9 *pDecl, //format of control vertices + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXPATCHMESH *pPatchMesh); + + +//returns the number of degenerates in a patch mesh - +//text output put in string. +HRESULT WINAPI + D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh, + DWORD *dwcDegenerateVertices, + DWORD *dwcDegeneratePatches, + LPD3DXBUFFER *ppErrorsAndWarnings); + +UINT WINAPI + D3DXGetFVFVertexSize(DWORD FVF); + +UINT WINAPI + D3DXGetDeclVertexSize(CONST D3DVERTEXELEMENT9 *pDecl,DWORD Stream); + +UINT WINAPI + D3DXGetDeclLength(CONST D3DVERTEXELEMENT9 *pDecl); + +HRESULT WINAPI + D3DXDeclaratorFromFVF( + DWORD FVF, + D3DVERTEXELEMENT9 pDeclarator[MAX_FVF_DECL_SIZE]); + +HRESULT WINAPI + D3DXFVFFromDeclarator( + CONST D3DVERTEXELEMENT9 *pDeclarator, + DWORD *pFVF); + +HRESULT WINAPI + D3DXWeldVertices( + LPD3DXMESH pMesh, + DWORD Flags, + CONST D3DXWELDEPSILONS *pEpsilons, + CONST DWORD *pAdjacencyIn, + DWORD *pAdjacencyOut, + DWORD *pFaceRemap, + LPD3DXBUFFER *ppVertexRemap); + +typedef struct _D3DXINTERSECTINFO +{ + DWORD FaceIndex; // index of face intersected + FLOAT U; // Barycentric Hit Coordinates + FLOAT V; // Barycentric Hit Coordinates + FLOAT Dist; // Ray-Intersection Parameter Distance +} D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO; + + +HRESULT WINAPI + D3DXIntersect( + LPD3DXBASEMESH pMesh, + CONST D3DXVECTOR3 *pRayPos, + CONST D3DXVECTOR3 *pRayDir, + BOOL *pHit, // True if any faces were intersected + DWORD *pFaceIndex, // index of closest face intersected + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist, // Ray-Intersection Parameter Distance + LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) + DWORD *pCountOfHits); // Number of entries in AllHits array + +HRESULT WINAPI + D3DXIntersectSubset( + LPD3DXBASEMESH pMesh, + DWORD AttribId, + CONST D3DXVECTOR3 *pRayPos, + CONST D3DXVECTOR3 *pRayDir, + BOOL *pHit, // True if any faces were intersected + DWORD *pFaceIndex, // index of closest face intersected + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist, // Ray-Intersection Parameter Distance + LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) + DWORD *pCountOfHits); // Number of entries in AllHits array + + +HRESULT WINAPI D3DXSplitMesh + ( + LPD3DXMESH pMeshIn, + CONST DWORD *pAdjacencyIn, + CONST DWORD MaxSize, + CONST DWORD Options, + DWORD *pMeshesOut, + LPD3DXBUFFER *ppMeshArrayOut, + LPD3DXBUFFER *ppAdjacencyArrayOut, + LPD3DXBUFFER *ppFaceRemapArrayOut, + LPD3DXBUFFER *ppVertRemapArrayOut + ); + +BOOL WINAPI D3DXIntersectTri +( + CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position + CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position + CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position + CONST D3DXVECTOR3 *pRayPos, // Ray origin + CONST D3DXVECTOR3 *pRayDir, // Ray direction + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist); // Ray-Intersection Parameter Distance + +BOOL WINAPI + D3DXSphereBoundProbe( + CONST D3DXVECTOR3 *pCenter, + FLOAT Radius, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +BOOL WINAPI + D3DXBoxBoundProbe( + CONST D3DXVECTOR3 *pMin, + CONST D3DXVECTOR3 *pMax, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + + +HRESULT WINAPI D3DXComputeTangentFrame(ID3DXMesh *pMesh, + DWORD dwOptions); + +HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh, + DWORD dwTextureInSemantic, + DWORD dwTextureInIndex, + DWORD dwUPartialOutSemantic, + DWORD dwUPartialOutIndex, + DWORD dwVPartialOutSemantic, + DWORD dwVPartialOutIndex, + DWORD dwNormalOutSemantic, + DWORD dwNormalOutIndex, + DWORD dwOptions, + CONST DWORD *pdwAdjacency, + FLOAT fPartialEdgeThreshold, + FLOAT fSingularPointThreshold, + FLOAT fNormalEdgeThreshold, + ID3DXMesh **ppMeshOut, + ID3DXBuffer **ppVertexMapping); + + +//D3DXComputeTangent +// +//Computes the Tangent vectors for the TexStage texture coordinates +//and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL +//puts the binorm in BINORM[BinormIndex] also specified in the decl. +// +//If neither the binorm or the tangnet are in the meshes declaration, +//the function will fail. +// +//If a tangent or Binorm field is in the Decl, but the user does not +//wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified +//in the TangentIndex or BinormIndex will cause it to ignore the specified +//semantic. +// +//Wrap should be specified if the texture coordinates wrap. + +HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh, + DWORD TexStage, + DWORD TangentIndex, + DWORD BinormIndex, + DWORD Wrap, + CONST DWORD *pAdjacency); + +//============================================================================ +// +// UVAtlas apis +// +//============================================================================ +typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext); + +// This function creates atlases for meshes. There are two modes of operation, +// either based on the number of charts, or the maximum allowed stretch. If the +// maximum allowed stretch is 0, then each triangle will likely be in its own +// chart. + +// +// The parameters are as follows: +// pMesh - Input mesh to calculate an atlas for. This must have a position +// channel and at least a 2-d texture channel. +// uMaxChartNumber - The maximum number of charts required for the atlas. +// If this is 0, it will be parameterized based solely on +// stretch. +// fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed, +// if 1, then any amount of stretching is allowed. +// uWidth - The width of the texture the atlas will be used on. +// uHeight - The height of the texture the atlas will be used on. +// fGutter - The minimum distance, in texels between two charts on the atlas. +// this gets scaled by the width, so if fGutter is 2.5, and it is +// used on a 512x512 texture, then the minimum distance will be +// 2.5 / 512 in u-v space. +// dwTextureIndex - Specifies which texture coordinate to write to in the +// output mesh (which is cloned from the input mesh). Useful +// if your vertex has multiple texture coordinates. +// pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating +// which triangles are adjacent to each other (unused so far). +// pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the +// integrated metric tensor for that face. This lets you control +// the way this triangle may be stretched in the atlas. The IMT +// passed in will be 3 floats (a,b,c) and specify a symmetric +// matrix (a b) that, given a vector (s,t), specifies the +// (b c) +// distance between a vector v1 and a vector v2 = v1 + (s,t) as +// sqrt((s, t) * M * (s, t)^T). +// In other words, this lets one specify the magnitude of the +// stretch in an arbitrary direction in u-v space. For example +// if a = b = c = 1, then this scales the vector (1,1) by 2, and +// the vector (1,-1) by 0. Note that this is multiplying the edge +// length by the square of the matrix, so if you want the face to +// stretch to twice its +// size with no shearing, the IMT value should be (2, 0, 2), which +// is just the identity matrix times 2. +// Note that this assumes you have an orientation for the triangle +// in some 2-D space. For D3DXUVAtlas, this space is created by +// letting S be the direction from the first to the second +// vertex, and T be the cross product between the normal and S. +// +// pCallback - Since the atlas creation process can be very CPU intensive, +// this allows the programmer to specify a function to be called +// periodically, similarly to how it is done in the PRT simulation +// engine. +// fCallbackFrequency - This lets you specify how often the callback will be +// called. A decent default should be 0.0001f. +// pUserContext - a void pointer to be passed back to the callback function +// ppMeshOut - A pointer to a location to store a pointer for the newly created +// mesh. +// ppFacePartitioning - A pointer to a location to store a pointer for an array, +// one DWORD per face, giving the final partitioning +// created by the atlasing algorithm. +// ppVertexRemapArray - A pointer to a location to store a pointer for an array, +// one DWORD per vertex, giving the vertex it was copied +// from, if any vertices needed to be split. +// pfMaxStretchOut - A location to store the maximum stretch resulting from the +// atlasing algorithm. +// puNumChartsOut - A location to store the number of charts created, or if the +// maximum number of charts was too low, this gives the minimum +// number of charts needed to create an atlas. + +HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh, + UINT uMaxChartNumber, + FLOAT fMaxStretch, + UINT uWidth, + UINT uHeight, + FLOAT fGutter, + DWORD dwTextureIndex, + CONST DWORD *pdwAdjacency, + FLOAT *pfIMTArray, + LPD3DXUVATLASCB pCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppFacePartitioning, + LPD3DXBUFFER *ppVertexRemapArray, + FLOAT *pfMaxStretchOut, + UINT *puNumChartsOut); + +// This has the same exact arguments as Create, except that it does not perform the +// final packing step. This method allows one to get a partitioning out, and possibly +// modify it before sending it to be repacked. Note that if you change the +// partitioning, you'll also need to calculate new texture coordinates for any faces +// that have switched charts. +HRESULT WINAPI D3DXUVAtlasPartition(LPD3DXMESH pMesh, + UINT uMaxChartNumber, + FLOAT fMaxStretch, + DWORD dwTextureIndex, + CONST DWORD *pdwAdjacency, + FLOAT *pfIMTArray, + LPD3DXUVATLASCB pCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppFacePartitioning, + LPD3DXBUFFER *ppVertexRemapArray, + FLOAT *pfMaxStretchOut, + UINT *puNumChartsOut); + +// This takes the face partitioning result from Partition and packs it into an +// atlas of the given size. +HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh, + UINT uWidth, + UINT uHeight, + FLOAT fGutter, + DWORD dwTextureIndex, + LPD3DXUVATLASCB pCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + LPD3DXBUFFER pFacePartitioning); + +HRESULT WINAPI + D3DXConvertMeshSubsetToSingleStrip( + LPD3DXBASEMESH MeshIn, + DWORD AttribId, + DWORD IBOptions, + LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer, + DWORD *pNumIndices); + +HRESULT WINAPI + D3DXConvertMeshSubsetToStrips( + LPD3DXBASEMESH MeshIn, + DWORD AttribId, + DWORD IBOptions, + LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer, + DWORD *pNumIndices, + LPD3DXBUFFER *ppStripLengths, + DWORD *pNumStrips); + + +//============================================================================ +// +// D3DXOptimizeFaces: +// -------------------- +// Generate a face remapping for a triangle list that more effectively utilizes +// vertex caches. This optimization is identical to the one provided +// by ID3DXMesh::Optimize with the hardware independent option enabled. +// +// Parameters: +// pbIndices +// Triangle list indices to use for generating a vertex ordering +// NumFaces +// Number of faces in the triangle list +// NumVertices +// Number of vertices referenced by the triangle list +// b32BitIndices +// TRUE if indices are 32 bit, FALSE if indices are 16 bit +// pFaceRemap +// Destination buffer to store face ordering +// The number stored for a given element is where in the new ordering +// the face will have come from. See ID3DXMesh::Optimize for more info. +// +//============================================================================ +HRESULT WINAPI + D3DXOptimizeFaces( + LPCVOID pbIndices, + UINT cFaces, + UINT cVertices, + BOOL b32BitIndices, + DWORD* pFaceRemap); + +//============================================================================ +// +// D3DXOptimizeVertices: +// -------------------- +// Generate a vertex remapping to optimize for in order use of vertices for +// a given set of indices. This is commonly used after applying the face +// remap generated by D3DXOptimizeFaces +// +// Parameters: +// pbIndices +// Triangle list indices to use for generating a vertex ordering +// NumFaces +// Number of faces in the triangle list +// NumVertices +// Number of vertices referenced by the triangle list +// b32BitIndices +// TRUE if indices are 32 bit, FALSE if indices are 16 bit +// pVertexRemap +// Destination buffer to store vertex ordering +// The number stored for a given element is where in the new ordering +// the vertex will have come from. See ID3DXMesh::Optimize for more info. +// +//============================================================================ +HRESULT WINAPI + D3DXOptimizeVertices( + LPCVOID pbIndices, + UINT cFaces, + UINT cVertices, + BOOL b32BitIndices, + DWORD* pVertexRemap); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +//=========================================================================== +// +// Data structures for Spherical Harmonic Precomputation +// +// +//============================================================================ + +typedef enum _D3DXSHCOMPRESSQUALITYTYPE { + D3DXSHCQUAL_FASTLOWQUALITY = 1, + D3DXSHCQUAL_SLOWHIGHQUALITY = 2, + D3DXSHCQUAL_FORCE_DWORD = 0x7fffffff +} D3DXSHCOMPRESSQUALITYTYPE; + +typedef enum _D3DXSHGPUSIMOPT { + D3DXSHGPUSIMOPT_SHADOWRES256 = 1, + D3DXSHGPUSIMOPT_SHADOWRES512 = 0, + D3DXSHGPUSIMOPT_SHADOWRES1024 = 2, + D3DXSHGPUSIMOPT_SHADOWRES2048 = 3, + + D3DXSHGPUSIMOPT_HIGHQUALITY = 4, + + D3DXSHGPUSIMOPT_FORCE_DWORD = 0x7fffffff +} D3DXSHGPUSIMOPT; + +// for all properties that are colors the luminance is computed +// if the simulator is run with a single channel using the following +// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + +typedef struct _D3DXSHMATERIAL { + D3DCOLORVALUE Diffuse; // Diffuse albedo of the surface. (Ignored if object is a Mirror) + BOOL bMirror; // Must be set to FALSE. bMirror == TRUE not currently supported + BOOL bSubSurf; // true if the object does subsurface scattering - can't do this and be a mirror + + // subsurface scattering parameters + FLOAT RelativeIndexOfRefraction; + D3DCOLORVALUE Absorption; + D3DCOLORVALUE ReducedScattering; + +} D3DXSHMATERIAL; + +// allocated in D3DXSHPRTCompSplitMeshSC +// vertices are duplicated into multiple super clusters but +// only have a valid status in one super cluster (fill in the rest) + +typedef struct _D3DXSHPRTSPLITMESHVERTDATA { + UINT uVertRemap; // vertex in original mesh this corresponds to + UINT uSubCluster; // cluster index relative to super cluster + UCHAR ucVertStatus; // 1 if vertex has valid data, 0 if it is "fill" +} D3DXSHPRTSPLITMESHVERTDATA; + +// used in D3DXSHPRTCompSplitMeshSC +// information for each super cluster that maps into face/vert arrays + +typedef struct _D3DXSHPRTSPLITMESHCLUSTERDATA { + UINT uVertStart; // initial index into remapped vertex array + UINT uVertLength; // number of vertices in this super cluster + + UINT uFaceStart; // initial index into face array + UINT uFaceLength; // number of faces in this super cluster + + UINT uClusterStart; // initial index into cluster array + UINT uClusterLength; // number of clusters in this super cluster +} D3DXSHPRTSPLITMESHCLUSTERDATA; + +// call back function for simulator +// return S_OK to keep running the simulator - anything else represents +// failure and the simulator will abort. + +typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float fPercentDone, LPVOID lpUserContext); + +// interfaces for PRT buffers/simulator + +// GUIDs +// {F1827E47-00A8-49cd-908C-9D11955F8728} +DEFINE_GUID(IID_ID3DXPRTBuffer, +0xf1827e47, 0xa8, 0x49cd, 0x90, 0x8c, 0x9d, 0x11, 0x95, 0x5f, 0x87, 0x28); + +// {A758D465-FE8D-45ad-9CF0-D01E56266A07} +DEFINE_GUID(IID_ID3DXPRTCompBuffer, +0xa758d465, 0xfe8d, 0x45ad, 0x9c, 0xf0, 0xd0, 0x1e, 0x56, 0x26, 0x6a, 0x7); + +// {06F57E0A-BD95-43f1-A3DA-791CF6CA297B} +DEFINE_GUID(IID_ID3DXTextureGutterHelper, +0x6f57e0a, 0xbd95, 0x43f1, 0xa3, 0xda, 0x79, 0x1c, 0xf6, 0xca, 0x29, 0x7b); + +// {683A4278-CD5F-4d24-90AD-C4E1B6855D53} +DEFINE_GUID(IID_ID3DXPRTEngine, +0x683a4278, 0xcd5f, 0x4d24, 0x90, 0xad, 0xc4, 0xe1, 0xb6, 0x85, 0x5d, 0x53); + +// interface defenitions + + +typedef interface ID3DXTextureGutterHelper ID3DXTextureGutterHelper; +typedef interface ID3DXTextureGutterHelper *LPD3DXTEXTUREGUTTERHELPER; + +typedef interface ID3DXPRTBuffer ID3DXPRTBuffer; +typedef interface ID3DXPRTBuffer *LPD3DXPRTBUFFER; + + +#undef INTERFACE +#define INTERFACE ID3DXPRTBuffer + +// Buffer interface - contains "NumSamples" samples +// each sample in memory is stored as NumCoeffs scalars per channel (1 or 3) +// Same interface is used for both Vertex and Pixel PRT buffers + +DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPRTBuffer + STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; + STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; + STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; + + STDMETHOD_(BOOL, IsTexture)(THIS) PURE; + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + // changes the number of samples allocated in the buffer + STDMETHOD(Resize)(THIS_ UINT NewSize) PURE; + + // ppData will point to the memory location where sample Start begins + // pointer is valid for at least NumSamples samples + STDMETHOD(LockBuffer)(THIS_ UINT Start, UINT NumSamples, FLOAT **ppData) PURE; + STDMETHOD(UnlockBuffer)(THIS) PURE; + + // every scalar in buffer is multiplied by Scale + STDMETHOD(ScaleBuffer)(THIS_ FLOAT Scale) PURE; + + // every scalar contains the sum of this and pBuffers values + // pBuffer must have the same storage class/dimensions + STDMETHOD(AddBuffer)(THIS_ LPD3DXPRTBUFFER pBuffer) PURE; + + // GutterHelper (described below) will fill in the gutter + // regions of a texture by interpolating "internal" values + STDMETHOD(AttachGH)(THIS_ LPD3DXTEXTUREGUTTERHELPER) PURE; + STDMETHOD(ReleaseGH)(THIS) PURE; + + // Evaluates attached gutter helper on the contents of this buffer + STDMETHOD(EvalGH)(THIS) PURE; + + // extracts a given channel into texture pTexture + // NumCoefficients starting from StartCoefficient are copied + STDMETHOD(ExtractTexture)(THIS_ UINT Channel, UINT StartCoefficient, + UINT NumCoefficients, LPDIRECT3DTEXTURE9 pTexture) PURE; + + // extracts NumCoefficients coefficients into mesh - only applicable on single channel + // buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients + // should be Order^2 + STDMETHOD(ExtractToMesh)(THIS_ UINT NumCoefficients, D3DDECLUSAGE Usage, UINT UsageIndexStart, + LPD3DXMESH pScene) PURE; + +}; + +typedef interface ID3DXPRTCompBuffer ID3DXPRTCompBuffer; +typedef interface ID3DXPRTCompBuffer *LPD3DXPRTCOMPBUFFER; + +#undef INTERFACE +#define INTERFACE ID3DXPRTCompBuffer + +// compressed buffers stored a compressed version of a PRTBuffer + +DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DPRTCompBuffer + + // NumCoeffs and NumChannels are properties of input buffer + STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; + STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; + STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; + + STDMETHOD_(BOOL, IsTexture)(THIS) PURE; + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + // number of clusters, and PCA vectors per-cluster + STDMETHOD_(UINT, GetNumClusters)(THIS) PURE; + STDMETHOD_(UINT, GetNumPCA)(THIS) PURE; + + // normalizes PCA weights so that they are between [-1,1] + // basis vectors are modified to reflect this + STDMETHOD(NormalizeData)(THIS) PURE; + + // copies basis vectors for cluster "Cluster" into pClusterBasis + // (NumPCA+1)*NumCoeffs*NumChannels floats + STDMETHOD(ExtractBasis)(THIS_ UINT Cluster, FLOAT *pClusterBasis) PURE; + + // UINT per sample - which cluster it belongs to + STDMETHOD(ExtractClusterIDs)(THIS_ UINT *pClusterIDs) PURE; + + // copies NumExtract PCA projection coefficients starting at StartPCA + // into pPCACoefficients - NumSamples*NumExtract floats copied + STDMETHOD(ExtractPCA)(THIS_ UINT StartPCA, UINT NumExtract, FLOAT *pPCACoefficients) PURE; + + // copies NumPCA projection coefficients starting at StartPCA + // into pTexture - should be able to cope with signed formats + STDMETHOD(ExtractTexture)(THIS_ UINT StartPCA, UINT NumpPCA, + LPDIRECT3DTEXTURE9 pTexture) PURE; + + // copies NumPCA projection coefficients into mesh pScene + // Usage is D3DDECLUSAGE where coefficients are to be stored + // UsageIndexStart is starting index + STDMETHOD(ExtractToMesh)(THIS_ UINT NumPCA, D3DDECLUSAGE Usage, UINT UsageIndexStart, + LPD3DXMESH pScene) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXTextureGutterHelper + +// ID3DXTextureGutterHelper will build and manage +// "gutter" regions in a texture - this will allow for +// bi-linear interpolation to not have artifacts when rendering +// It generates a map (in texture space) where each texel +// is in one of 3 states: +// 0 Invalid - not used at all +// 1 Inside triangle +// 2 Gutter texel +// 4 represents a gutter texel that will be computed during PRT +// For each Inside/Gutter texel it stores the face it +// belongs to and barycentric coordinates for the 1st two +// vertices of that face. Gutter vertices are assigned to +// the closest edge in texture space. +// +// When used with PRT this requires a unique parameterization +// of the model - every texel must correspond to a single point +// on the surface of the model and vice versa + +DECLARE_INTERFACE_(ID3DXTextureGutterHelper, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXTextureGutterHelper + + // dimensions of texture this is bound too + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + + // Applying gutters recomputes all of the gutter texels of class "2" + // based on texels of class "1" or "4" + + // Applies gutters to a raw float buffer - each texel is NumCoeffs floats + // Width and Height must match GutterHelper + STDMETHOD(ApplyGuttersFloat)(THIS_ FLOAT *pDataIn, UINT NumCoeffs, UINT Width, UINT Height); + + // Applies gutters to pTexture + // Dimensions must match GutterHelper + STDMETHOD(ApplyGuttersTex)(THIS_ LPDIRECT3DTEXTURE9 pTexture); + + // Applies gutters to a D3DXPRTBuffer + // Dimensions must match GutterHelper + STDMETHOD(ApplyGuttersPRT)(THIS_ LPD3DXPRTBUFFER pBuffer); + + // the routines below provide access to the data structures + // used by the Apply functions + + // face map is a UINT per texel that represents the + // face of the mesh that texel belongs too - + // only valid if same texel is valid in pGutterData + // pFaceData must be allocated by the user + STDMETHOD(GetFaceMap)(THIS_ UINT *pFaceData) PURE; + + // BaryMap is a D3DXVECTOR2 per texel + // the 1st two barycentric coordinates for the corresponding + // face (3rd weight is always 1-sum of first two) + // only valid if same texel is valid in pGutterData + // pBaryData must be allocated by the user + STDMETHOD(GetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; + + // TexelMap is a D3DXVECTOR2 per texel that + // stores the location in pixel coordinates where the + // corresponding texel is mapped + // pTexelData must be allocated by the user + STDMETHOD(GetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; + + // GutterMap is a BYTE per texel + // 0/1/2 for Invalid/Internal/Gutter texels + // 4 represents a gutter texel that will be computed + // during PRT + // pGutterData must be allocated by the user + STDMETHOD(GetGutterMap)(THIS_ BYTE *pGutterData) PURE; + + // face map is a UINT per texel that represents the + // face of the mesh that texel belongs too - + // only valid if same texel is valid in pGutterData + STDMETHOD(SetFaceMap)(THIS_ UINT *pFaceData) PURE; + + // BaryMap is a D3DXVECTOR2 per texel + // the 1st two barycentric coordinates for the corresponding + // face (3rd weight is always 1-sum of first two) + // only valid if same texel is valid in pGutterData + STDMETHOD(SetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; + + // TexelMap is a D3DXVECTOR2 per texel that + // stores the location in pixel coordinates where the + // corresponding texel is mapped + STDMETHOD(SetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; + + // GutterMap is a BYTE per texel + // 0/1/2 for Invalid/Internal/Gutter texels + // 4 represents a gutter texel that will be computed + // during PRT + STDMETHOD(SetGutterMap)(THIS_ BYTE *pGutterData) PURE; +}; + + +typedef interface ID3DXPRTEngine ID3DXPRTEngine; +typedef interface ID3DXPRTEngine *LPD3DXPRTENGINE; + +#undef INTERFACE +#define INTERFACE ID3DXPRTEngine + +// ID3DXPRTEngine is used to compute a PRT simulation +// Use the following steps to compute PRT for SH +// (1) create an interface (which includes a scene) +// (2) call SetSamplingInfo +// (3) [optional] Set MeshMaterials/albedo's (required if doing bounces) +// (4) call ComputeDirectLightingSH +// (5) [optional] call ComputeBounce +// repeat step 5 for as many bounces as wanted. +// if you want to model subsurface scattering you +// need to call ComputeSS after direct lighting and +// each bounce. +// If you want to bake the albedo into the PRT signal, you +// must call MutliplyAlbedo, otherwise the user has to multiply +// the albedo themselves. Not multiplying the albedo allows you +// to model albedo variation at a finer scale then illumination, and +// can result in better compression results. +// Luminance values are computed from RGB values using the following +// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + +DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPRTEngine + + // This sets a material per attribute in the scene mesh and it is + // the only way to specify subsurface scattering parameters. if + // bSetAlbedo is FALSE, NumChannels must match the current + // configuration of the PRTEngine. If you intend to change + // NumChannels (through some other SetAlbedo function) it must + // happen before SetMeshMaterials is called. + // + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // bSetAlbedo sets albedo from material if TRUE - which clobbers per texel/vertex + // albedo that might have been set before. FALSE won't clobber. + // fLengthScale is used for subsurface scattering - scene is mapped into a 1mm unit cube + // and scaled by this amount + STDMETHOD(SetMeshMaterials)(THIS_ CONST D3DXSHMATERIAL **ppMaterials, UINT NumMeshes, + UINT NumChannels, BOOL bSetAlbedo, FLOAT fLengthScale) PURE; + + // setting albedo per-vertex or per-texel over rides the albedos stored per mesh + // but it does not over ride any other settings + + // sets an albedo to be used per vertex - the albedo is represented as a float + // pDataIn input pointer (pointint to albedo of 1st sample) + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // Stride - stride in bytes to get to next samples albedo + STDMETHOD(SetPerVertexAlbedo)(THIS_ CONST VOID *pDataIn, UINT NumChannels, UINT Stride) PURE; + + // represents the albedo per-texel instead of per-vertex (even if per-vertex PRT is used) + // pAlbedoTexture - texture that stores the albedo (dimension arbitrary) + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // pGH - optional gutter helper, otherwise one is constructed in computation routines and + // destroyed (if not attached to buffers) + STDMETHOD(SetPerTexelAlbedo)(THIS_ LPDIRECT3DTEXTURE9 pAlbedoTexture, + UINT NumChannels, + LPD3DXTEXTUREGUTTERHELPER pGH) PURE; + + // gets the per-vertex albedo + STDMETHOD(GetVertexAlbedo)(THIS_ D3DXCOLOR *pVertColors, UINT NumVerts) PURE; + + // If pixel PRT is being computed normals default to ones that are interpolated + // from the vertex normals. This specifies a texture that stores an object + // space normal map instead (must use a texture format that can represent signed values) + // pNormalTexture - normal map, must be same dimensions as PRTBuffers, signed + STDMETHOD(SetPerTexelNormal)(THIS_ LPDIRECT3DTEXTURE9 pNormalTexture) PURE; + + // Copies per-vertex albedo from mesh + // pMesh - mesh that represents the scene. It must have the same + // properties as the mesh used to create the PRTEngine + // Usage - D3DDECLUSAGE to extract albedos from + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + STDMETHOD(ExtractPerVertexAlbedo)(THIS_ LPD3DXMESH pMesh, + D3DDECLUSAGE Usage, + UINT NumChannels) PURE; + + // Resamples the input buffer into the output buffer + // can be used to move between per-vertex and per-texel buffers. This can also be used + // to convert single channel buffers to 3-channel buffers and vice-versa. + STDMETHOD(ResampleBuffer)(THIS_ LPD3DXPRTBUFFER pBufferIn, LPD3DXPRTBUFFER pBufferOut) PURE; + + // Returns the scene mesh - including modifications from adaptive spatial sampling + // The returned mesh only has positions, normals and texture coordinates (if defined) + // pD3DDevice - d3d device that will be used to allocate the mesh + // pFaceRemap - each face has a pointer back to the face on the original mesh that it comes from + // if the face hasn't been subdivided this will be an identity mapping + // pVertRemap - each vertex contains 3 vertices that this is a linear combination of + // pVertWeights - weights for each of above indices (sum to 1.0f) + // ppMesh - mesh that will be allocated and filled + STDMETHOD(GetAdaptedMesh)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice,UINT *pFaceRemap, UINT *pVertRemap, FLOAT *pfVertWeights, LPD3DXMESH *ppMesh) PURE; + + // Number of vertices currently allocated (includes new vertices from adaptive sampling) + STDMETHOD_(UINT, GetNumVerts)(THIS) PURE; + // Number of faces currently allocated (includes new faces) + STDMETHOD_(UINT, GetNumFaces)(THIS) PURE; + + // Sets the Minimum/Maximum intersection distances, this can be used to control + // maximum distance that objects can shadow/reflect light, and help with "bad" + // art that might have near features that you don't want to shadow. This does not + // apply for GPU simulations. + // fMin - minimum intersection distance, must be positive and less than fMax + // fMax - maximum intersection distance, if 0.0f use the previous value, otherwise + // must be strictly greater than fMin + STDMETHOD(SetMinMaxIntersection)(THIS_ FLOAT fMin, FLOAT fMax) PURE; + + // This will subdivide faces on a mesh so that adaptively simulations can + // use a more conservative threshold (it won't miss features.) + // MinEdgeLength - minimum edge length that will be generated, if 0.0f a + // reasonable default will be used + // MaxSubdiv - maximum level of subdivision, if 0 is specified a default + // value will be used (5) + STDMETHOD(RobustMeshRefine)(THIS_ FLOAT MinEdgeLength, UINT MaxSubdiv) PURE; + + // This sets to sampling information used by the simulator. Adaptive sampling + // parameters are currently ignored. + // NumRays - number of rays to shoot per sample + // UseSphere - if TRUE uses spherical samples, otherwise samples over + // the hemisphere. Should only be used with GPU and Vol computations + // UseCosine - if TRUE uses a cosine weighting - not used for Vol computations + // or if only the visiblity function is desired + // Adaptive - if TRUE adaptive sampling (angular) is used + // AdaptiveThresh - threshold used to terminate adaptive angular sampling + // ignored if adaptive sampling is not set + STDMETHOD(SetSamplingInfo)(THIS_ UINT NumRays, + BOOL UseSphere, + BOOL UseCosine, + BOOL Adaptive, + FLOAT AdaptiveThresh) PURE; + + // Methods that compute the direct lighting contribution for objects + // always represente light using spherical harmonics (SH) + // the albedo is not multiplied by the signal - it just integrates + // incoming light. If NumChannels is not 1 the vector is replicated + // + // SHOrder - order of SH to use + // pDataOut - PRT buffer that is generated. Can be single channel + STDMETHOD(ComputeDirectLightingSH)(THIS_ UINT SHOrder, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Adaptive variant of above function. This will refine the mesh + // generating new vertices/faces to approximate the PRT signal + // more faithfully. + // SHOrder - order of SH to use + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - PRT buffer that is generated. Can be single channel. + STDMETHOD(ComputeDirectLightingSHAdaptive)(THIS_ UINT SHOrder, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Function that computes the direct lighting contribution for objects + // light is always represented using spherical harmonics (SH) + // This is done on the GPU and is much faster then using the CPU. + // The albedo is not multiplied by the signal - it just integrates + // incoming light. If NumChannels is not 1 the vector is replicated. + // ZBias/ZAngleBias are akin to parameters used with shadow zbuffers. + // A reasonable default for both values is 0.005, but the user should + // experiment (ZAngleBias can be zero, ZBias should not be.) + // Callbacks should not use the Direct3D9Device the simulator is using. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // + // pD3DDevice - device used to run GPU simulator - must support PS2.0 + // and FP render targets + // Flags - parameters for the GPU simulator, combination of one or more + // D3DXSHGPUSIMOPT flags. Only one SHADOWRES setting should be set and + // the defaults is 512 + // SHOrder - order of SH to use + // ZBias - bias in normal direction (for depth test) + // ZAngleBias - scaled by one minus cosine of angle with light (offset in depth) + // pDataOut - PRT buffer that is filled in. Can be single channel + STDMETHOD(ComputeDirectLightingSHGPU)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice, + UINT Flags, + UINT SHOrder, + FLOAT ZBias, + FLOAT ZAngleBias, + LPD3DXPRTBUFFER pDataOut) PURE; + + + // Functions that computes subsurface scattering (using material properties) + // Albedo is not multiplied by result. This only works for per-vertex data + // use ResampleBuffer to move per-vertex data into a texture and back. + // + // pDataIn - input data (previous bounce) + // pDataOut - result of subsurface scattering simulation + // pDataTotal - [optional] results can be summed into this buffer + STDMETHOD(ComputeSS)(THIS_ LPD3DXPRTBUFFER pDataIn, + LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; + + // Adaptive version of ComputeSS. + // + // pDataIn - input data (previous bounce) + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - result of subsurface scattering simulation + // pDataTotal - [optional] results can be summed into this buffer + STDMETHOD(ComputeSSAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; + + // computes a single bounce of inter-reflected light + // works for SH based PRT or generic lighting + // Albedo is not multiplied by result + // + // pDataIn - previous bounces data + // pDataOut - PRT buffer that is generated + // pDataTotal - [optional] can be used to keep a running sum + STDMETHOD(ComputeBounce)(THIS_ LPD3DXPRTBUFFER pDataIn, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Adaptive version of above function. + // + // pDataIn - previous bounces data, can be single channel + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - PRT buffer that is generated + // pDataTotal - [optional] can be used to keep a running sum + STDMETHOD(ComputeBounceAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Computes projection of distant SH radiance into a local SH radiance + // function. This models how direct lighting is attenuated by the + // scene and is a form of "neighborhood transfer." The result is + // a linear operator (matrix) at every sample point, if you multiply + // this matrix by the distant SH lighting coefficients you get an + // approximation of the local incident radiance function from + // direct lighting. These resulting lighting coefficients can + // than be projected into another basis or used with any rendering + // technique that uses spherical harmonics as input. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // Generates SHOrderIn*SHOrderIn*SHOrderOut*SHOrderOut scalars + // per channel at each sample location. + // + // SHOrderIn - Order of the SH representation of distant lighting + // SHOrderOut - Order of the SH representation of local lighting + // NumVolSamples - Number of sample locations + // pSampleLocs - position of sample locations + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeVolumeSamplesDirectSH)(THIS_ UINT SHOrderIn, + UINT SHOrderOut, + UINT NumVolSamples, + CONST D3DXVECTOR3 *pSampleLocs, + LPD3DXPRTBUFFER pDataOut) PURE; + + // At each sample location computes a linear operator (matrix) that maps + // the representation of source radiance (NumCoeffs in pSurfDataIn) + // into a local incident radiance function approximated with spherical + // harmonics. For example if a light map data is specified in pSurfDataIn + // the result is an SH representation of the flow of light at each sample + // point. If PRT data for an outdoor scene is used, each sample point + // contains a matrix that models how distant lighting bounces of the objects + // in the scene and arrives at the given sample point. Combined with + // ComputeVolumeSamplesDirectSH this gives the complete representation for + // how light arrives at each sample point parameterized by distant lighting. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // Generates pSurfDataIn->NumCoeffs()*SHOrder*SHOrder scalars + // per channel at each sample location. + // + // pSurfDataIn - previous bounce data + // SHOrder - order of SH to generate projection with + // NumVolSamples - Number of sample locations + // pSampleLocs - position of sample locations + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeVolumeSamples)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, + UINT SHOrder, + UINT NumVolSamples, + CONST D3DXVECTOR3 *pSampleLocs, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Computes direct lighting (SH) for a point not on the mesh + // with a given normal - cannot use texture buffers. + // + // SHOrder - order of SH to use + // NumSamples - number of sample locations + // pSampleLocs - position for each sample + // pSampleNorms - normal for each sample + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeSurfSamplesDirectSH)(THIS_ UINT SHOrder, + UINT NumSamples, + CONST D3DXVECTOR3 *pSampleLocs, + CONST D3DXVECTOR3 *pSampleNorms, + LPD3DXPRTBUFFER pDataOut) PURE; + + + // given the solution for PRT or light maps, computes transfer vector at arbitrary + // position/normal pairs in space + // + // pSurfDataIn - input data + // NumSamples - number of sample locations + // pSampleLocs - position for each sample + // pSampleNorms - normal for each sample + // pDataOut - PRT Buffer that will store output results + // pDataTotal - optional buffer to sum results into - can be NULL + STDMETHOD(ComputeSurfSamplesBounce)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, + UINT NumSamples, + CONST D3DXVECTOR3 *pSampleLocs, + CONST D3DXVECTOR3 *pSampleNorms, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Frees temporary data structures that can be created for subsurface scattering + // this data is freed when the PRTComputeEngine is freed and is lazily created + STDMETHOD(FreeSSData)(THIS) PURE; + + // Frees temporary data structures that can be created for bounce simulations + // this data is freed when the PRTComputeEngine is freed and is lazily created + STDMETHOD(FreeBounceData)(THIS) PURE; + + // This computes the Local Deformable PRT (LDPRT) coefficients relative to the + // per sample normals that minimize error in a least squares sense with respect + // to the input PRT data set. These coefficients can be used with skinned/transformed + // normals to model global effects with dynamic objects. Shading normals can + // optionally be solved for - these normals (along with the LDPRT coefficients) can + // more accurately represent the PRT signal. The coefficients are for zonal + // harmonics oriented in the normal/shading normal direction. + // + // pDataIn - SH PRT dataset that is input + // SHOrder - Order of SH to compute conv coefficients for + // pNormOut - Optional array of vectors (passed in) that will be filled with + // "shading normals", LDPRT coefficients are optimized for + // these normals. This array must be the same size as the number of + // samples in pDataIn + // pDataOut - Output buffer (SHOrder zonal harmonic coefficients per channel per sample) + STDMETHOD(ComputeLDPRTCoeffs)(THIS_ LPD3DXPRTBUFFER pDataIn, + UINT SHOrder, + D3DXVECTOR3 *pNormOut, + LPD3DXPRTBUFFER pDataOut) PURE; + + // scales all the samples associated with a given sub mesh + // can be useful when using subsurface scattering + // fScale - value to scale each vector in submesh by + STDMETHOD(ScaleMeshChunk)(THIS_ UINT uMeshChunk, FLOAT fScale, LPD3DXPRTBUFFER pDataOut) PURE; + + // mutliplies each PRT vector by the albedo - can be used if you want to have the albedo + // burned into the dataset, often better not to do this. If this is not done the user + // must mutliply the albedo themselves when rendering - just multiply the albedo times + // the result of the PRT dot product. + // If pDataOut is a texture simulation result and there is an albedo texture it + // must be represented at the same resolution as the simulation buffer. You can use + // LoadSurfaceFromSurface and set a new albedo texture if this is an issue - but must + // be careful about how the gutters are handled. + // + // pDataOut - dataset that will get albedo pushed into it + STDMETHOD(MultiplyAlbedo)(THIS_ LPD3DXPRTBUFFER pDataOut) PURE; + + // Sets a pointer to an optional call back function that reports back to the + // user percentage done and gives them the option of quitting + // pCB - pointer to call back function, return S_OK for the simulation + // to continue + // Frequency - 1/Frequency is roughly the number of times the call back + // will be invoked + // lpUserContext - will be passed back to the users call back + STDMETHOD(SetCallBack)(THIS_ LPD3DXSHPRTSIMCB pCB, FLOAT Frequency, LPVOID lpUserContext) PURE; + + // Returns TRUE if the ray intersects the mesh, FALSE if it does not. This function + // takes into account settings from SetMinMaxIntersection. If the closest intersection + // is not needed this function is more efficient compared to the ClosestRayIntersection + // method. + // pRayPos - origin of ray + // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + + STDMETHOD_(BOOL, ShadowRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir) PURE; + + // Returns TRUE if the ray intersects the mesh, FALSE if it does not. If there is an + // intersection the closest face that was intersected and its first two barycentric coordinates + // are returned. This function takes into account settings from SetMinMaxIntersection. + // This is a slower function compared to ShadowRayIntersects and should only be used where + // needed. The third vertices barycentric coordinates will be 1 - pU - pV. + // pRayPos - origin of ray + // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + // pFaceIndex - Closest face that intersects. This index is based on stacking the pBlockerMesh + // faces before the faces from pMesh + // pU - Barycentric coordinate for vertex 0 + // pV - Barycentric coordinate for vertex 1 + // pDist - Distance along ray where the intersection occured + + STDMETHOD_(BOOL, ClosestRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, + DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist) PURE; +}; + + +// API functions for creating interfaces + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//============================================================================ +// +// D3DXCreatePRTBuffer: +// -------------------- +// Generates a PRT Buffer that can be compressed or filled by a simulator +// This function should be used to create per-vertex or volume buffers. +// When buffers are created all values are initialized to zero. +// +// Parameters: +// NumSamples +// Number of sample locations represented +// NumCoeffs +// Number of coefficients per sample location (order^2 for SH) +// NumChannels +// Number of color channels to represent (1 or 3) +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXCreatePRTBuffer( + UINT NumSamples, + UINT NumCoeffs, + UINT NumChannels, + LPD3DXPRTBUFFER* ppBuffer); + +//============================================================================ +// +// D3DXCreatePRTBufferTex: +// -------------------- +// Generates a PRT Buffer that can be compressed or filled by a simulator +// This function should be used to create per-pixel buffers. +// When buffers are created all values are initialized to zero. +// +// Parameters: +// Width +// Width of texture +// Height +// Height of texture +// NumCoeffs +// Number of coefficients per sample location (order^2 for SH) +// NumChannels +// Number of color channels to represent (1 or 3) +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXCreatePRTBufferTex( + UINT Width, + UINT Height, + UINT NumCoeffs, + UINT NumChannels, + LPD3DXPRTBUFFER* ppBuffer); + +//============================================================================ +// +// D3DXLoadPRTBufferFromFile: +// -------------------- +// Loads a PRT buffer that has been saved to disk. +// +// Parameters: +// pFilename +// Name of the file to load +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXLoadPRTBufferFromFileA( + LPCSTR pFilename, + LPD3DXPRTBUFFER* ppBuffer); + +HRESULT WINAPI + D3DXLoadPRTBufferFromFileW( + LPCWSTR pFilename, + LPD3DXPRTBUFFER* ppBuffer); + +#ifdef UNICODE +#define D3DXLoadPRTBufferFromFile D3DXLoadPRTBufferFromFileW +#else +#define D3DXLoadPRTBufferFromFile D3DXLoadPRTBufferFromFileA +#endif + + +//============================================================================ +// +// D3DXSavePRTBufferToFile: +// -------------------- +// Saves a PRTBuffer to disk. +// +// Parameters: +// pFilename +// Name of the file to save +// pBuffer +// Buffer that will be saved +// +//============================================================================ + +HRESULT WINAPI + D3DXSavePRTBufferToFileA( + LPCSTR pFileName, + LPD3DXPRTBUFFER pBuffer); + +HRESULT WINAPI + D3DXSavePRTBufferToFileW( + LPCWSTR pFileName, + LPD3DXPRTBUFFER pBuffer); + +#ifdef UNICODE +#define D3DXSavePRTBufferToFile D3DXSavePRTBufferToFileW +#else +#define D3DXSavePRTBufferToFile D3DXSavePRTBufferToFileA +#endif + + +//============================================================================ +// +// D3DXLoadPRTCompBufferFromFile: +// -------------------- +// Loads a PRTComp buffer that has been saved to disk. +// +// Parameters: +// pFilename +// Name of the file to load +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXLoadPRTCompBufferFromFileA( + LPCSTR pFilename, + LPD3DXPRTCOMPBUFFER* ppBuffer); + +HRESULT WINAPI + D3DXLoadPRTCompBufferFromFileW( + LPCWSTR pFilename, + LPD3DXPRTCOMPBUFFER* ppBuffer); + +#ifdef UNICODE +#define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileW +#else +#define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileA +#endif + +//============================================================================ +// +// D3DXSavePRTCompBufferToFile: +// -------------------- +// Saves a PRTCompBuffer to disk. +// +// Parameters: +// pFilename +// Name of the file to save +// pBuffer +// Buffer that will be saved +// +//============================================================================ + +HRESULT WINAPI + D3DXSavePRTCompBufferToFileA( + LPCSTR pFileName, + LPD3DXPRTCOMPBUFFER pBuffer); + +HRESULT WINAPI + D3DXSavePRTCompBufferToFileW( + LPCWSTR pFileName, + LPD3DXPRTCOMPBUFFER pBuffer); + +#ifdef UNICODE +#define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileW +#else +#define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileA +#endif + +//============================================================================ +// +// D3DXCreatePRTCompBuffer: +// -------------------- +// Compresses a PRT buffer (vertex or texel) +// +// Parameters: +// D3DXSHCOMPRESSQUALITYTYPE +// Quality of compression - low is faster (computes PCA per voronoi cluster) +// high is slower but better quality (clusters based on distance to affine subspace) +// NumClusters +// Number of clusters to compute +// NumPCA +// Number of basis vectors to compute +// pCB +// Optional Callback function +// lpUserContext +// Optional user context +// pBufferIn +// Buffer that will be compressed +// ppBufferOut +// Compressed buffer that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreatePRTCompBuffer( + D3DXSHCOMPRESSQUALITYTYPE Quality, + UINT NumClusters, + UINT NumPCA, + LPD3DXSHPRTSIMCB pCB, + LPVOID lpUserContext, + LPD3DXPRTBUFFER pBufferIn, + LPD3DXPRTCOMPBUFFER *ppBufferOut + ); + +//============================================================================ +// +// D3DXCreateTextureGutterHelper: +// -------------------- +// Generates a "GutterHelper" for a given set of meshes and texture +// resolution +// +// Parameters: +// Width +// Width of texture +// Height +// Height of texture +// pMesh +// Mesh that represents the scene +// GutterSize +// Number of texels to over rasterize in texture space +// this should be at least 1.0 +// ppBuffer +// GutterHelper that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreateTextureGutterHelper( + UINT Width, + UINT Height, + LPD3DXMESH pMesh, + FLOAT GutterSize, + LPD3DXTEXTUREGUTTERHELPER* ppBuffer); + + +//============================================================================ +// +// D3DXCreatePRTEngine: +// -------------------- +// Computes a PRTEngine which can efficiently generate PRT simulations +// of a scene +// +// Parameters: +// pMesh +// Mesh that represents the scene - must have an AttributeTable +// where vertices are in a unique attribute. +// pAdjacency +// Optional adjacency information +// ExtractUVs +// Set this to true if textures are going to be used for albedos +// or to store PRT vectors +// pBlockerMesh +// Optional mesh that just blocks the scene +// ppEngine +// PRTEngine that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreatePRTEngine( + LPD3DXMESH pMesh, + DWORD *pAdjacency, + BOOL ExtractUVs, + LPD3DXMESH pBlockerMesh, + LPD3DXPRTENGINE* ppEngine); + +//============================================================================ +// +// D3DXConcatenateMeshes: +// -------------------- +// Concatenates a group of meshes into one common mesh. This can optionaly transform +// each sub mesh or its texture coordinates. If no DECL is given it will +// generate a union of all of the DECL's of the sub meshes, promoting channels +// and types if neccesary. It will create an AttributeTable if possible, one can +// call OptimizeMesh with attribute sort and compacting enabled to ensure this. +// +// Parameters: +// ppMeshes +// Array of pointers to meshes that can store PRT vectors +// NumMeshes +// Number of meshes +// Options +// Passed through to D3DXCreateMesh +// pGeomXForms +// [optional] Each sub mesh is transformed by the corresponding +// matrix if this array is supplied +// pTextureXForms +// [optional] UV coordinates for each sub mesh are transformed +// by corresponding matrix if supplied +// pDecl +// [optional] Only information in this DECL is used when merging +// data +// pD3DDevice +// D3D device that is used to create the new mesh +// ppMeshOut +// Mesh that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXConcatenateMeshes( + LPD3DXMESH *ppMeshes, + UINT NumMeshes, + DWORD Options, + CONST D3DXMATRIX *pGeomXForms, + CONST D3DXMATRIX *pTextureXForms, + CONST D3DVERTEXELEMENT9 *pDecl, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH *ppMeshOut); + +//============================================================================ +// +// D3DXSHPRTCompSuperCluster: +// -------------------------- +// Used with compressed results of D3DXSHPRTSimulation. +// Generates "super clusters" - groups of clusters that can be drawn in +// the same draw call. A greedy algorithm that minimizes overdraw is used +// to group the clusters. +// +// Parameters: +// pClusterIDs +// NumVerts cluster ID's (extracted from a compressed buffer) +// pScene +// Mesh that represents composite scene passed to the simulator +// MaxNumClusters +// Maximum number of clusters allocated per super cluster +// NumClusters +// Number of clusters computed in the simulator +// pSuperClusterIDs +// Array of length NumClusters, contains index of super cluster +// that corresponding cluster was assigned to +// pNumSuperClusters +// Returns the number of super clusters allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXSHPRTCompSuperCluster( + UINT *pClusterIDs, + LPD3DXMESH pScene, + UINT MaxNumClusters, + UINT NumClusters, + UINT *pSuperClusterIDs, + UINT *pNumSuperClusters); + +//============================================================================ +// +// D3DXSHPRTCompSplitMeshSC: +// ------------------------- +// Used with compressed results of the vertex version of the PRT simulator. +// After D3DXSHRTCompSuperCluster has been called this function can be used +// to split the mesh into a group of faces/vertices per super cluster. +// Each super cluster contains all of the faces that contain any vertex +// classified in one of its clusters. All of the vertices connected to this +// set of faces are also included with the returned array ppVertStatus +// indicating whether or not the vertex belongs to the supercluster. +// +// Parameters: +// pClusterIDs +// NumVerts cluster ID's (extracted from a compressed buffer) +// NumVertices +// Number of vertices in original mesh +// NumClusters +// Number of clusters (input parameter to compression) +// pSuperClusterIDs +// Array of size NumClusters that will contain super cluster ID's (from +// D3DXSHCompSuerCluster) +// NumSuperClusters +// Number of superclusters allocated in D3DXSHCompSuerCluster +// pInputIB +// Raw index buffer for mesh - format depends on bInputIBIs32Bit +// InputIBIs32Bit +// Indicates whether the input index buffer is 32-bit (otherwise 16-bit +// is assumed) +// NumFaces +// Number of faces in the original mesh (pInputIB is 3 times this length) +// ppIBData +// LPD3DXBUFFER holds raw index buffer that will contain the resulting split faces. +// Format determined by bIBIs32Bit. Allocated by function +// pIBDataLength +// Length of ppIBData, assigned in function +// OutputIBIs32Bit +// Indicates whether the output index buffer is to be 32-bit (otherwise +// 16-bit is assumed) +// ppFaceRemap +// LPD3DXBUFFER mapping of each face in ppIBData to original faces. Length is +// *pIBDataLength/3. Optional paramter, allocated in function +// ppVertData +// LPD3DXBUFFER contains new vertex data structure. Size of pVertDataLength +// pVertDataLength +// Number of new vertices in split mesh. Assigned in function +// pSCClusterList +// Array of length NumClusters which pSCData indexes into (Cluster* fields) +// for each SC, contains clusters sorted by super cluster +// pSCData +// Structure per super cluster - contains indices into ppIBData, +// pSCClusterList and ppVertData +// +//============================================================================ + +HRESULT WINAPI + D3DXSHPRTCompSplitMeshSC( + UINT *pClusterIDs, + UINT NumVertices, + UINT NumClusters, + UINT *pSuperClusterIDs, + UINT NumSuperClusters, + LPVOID pInputIB, + BOOL InputIBIs32Bit, + UINT NumFaces, + LPD3DXBUFFER *ppIBData, + UINT *pIBDataLength, + BOOL OutputIBIs32Bit, + LPD3DXBUFFER *ppFaceRemap, + LPD3DXBUFFER *ppVertData, + UINT *pVertDataLength, + UINT *pSCClusterList, + D3DXSHPRTSPLITMESHCLUSTERDATA *pSCData); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +////////////////////////////////////////////////////////////////////////////// +// +// Definitions of .X file templates used by mesh load/save functions +// that are not RM standard +// +////////////////////////////////////////////////////////////////////////////// + +// {3CF169CE-FF7C-44ab-93C0-F78F62D172E2} +DEFINE_GUID(DXFILEOBJ_XSkinMeshHeader, +0x3cf169ce, 0xff7c, 0x44ab, 0x93, 0xc0, 0xf7, 0x8f, 0x62, 0xd1, 0x72, 0xe2); + +// {B8D65549-D7C9-4995-89CF-53A9A8B031E3} +DEFINE_GUID(DXFILEOBJ_VertexDuplicationIndices, +0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3); + +// {A64C844A-E282-4756-8B80-250CDE04398C} +DEFINE_GUID(DXFILEOBJ_FaceAdjacency, +0xa64c844a, 0xe282, 0x4756, 0x8b, 0x80, 0x25, 0xc, 0xde, 0x4, 0x39, 0x8c); + +// {6F0D123B-BAD2-4167-A0D0-80224F25FABB} +DEFINE_GUID(DXFILEOBJ_SkinWeights, +0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb); + +// {A3EB5D44-FC22-429d-9AFB-3221CB9719A6} +DEFINE_GUID(DXFILEOBJ_Patch, +0xa3eb5d44, 0xfc22, 0x429d, 0x9a, 0xfb, 0x32, 0x21, 0xcb, 0x97, 0x19, 0xa6); + +// {D02C95CC-EDBA-4305-9B5D-1820D7704BBF} +DEFINE_GUID(DXFILEOBJ_PatchMesh, +0xd02c95cc, 0xedba, 0x4305, 0x9b, 0x5d, 0x18, 0x20, 0xd7, 0x70, 0x4b, 0xbf); + +// {B9EC94E1-B9A6-4251-BA18-94893F02C0EA} +DEFINE_GUID(DXFILEOBJ_PatchMesh9, +0xb9ec94e1, 0xb9a6, 0x4251, 0xba, 0x18, 0x94, 0x89, 0x3f, 0x2, 0xc0, 0xea); + +// {B6C3E656-EC8B-4b92-9B62-681659522947} +DEFINE_GUID(DXFILEOBJ_PMInfo, +0xb6c3e656, 0xec8b, 0x4b92, 0x9b, 0x62, 0x68, 0x16, 0x59, 0x52, 0x29, 0x47); + +// {917E0427-C61E-4a14-9C64-AFE65F9E9844} +DEFINE_GUID(DXFILEOBJ_PMAttributeRange, +0x917e0427, 0xc61e, 0x4a14, 0x9c, 0x64, 0xaf, 0xe6, 0x5f, 0x9e, 0x98, 0x44); + +// {574CCC14-F0B3-4333-822D-93E8A8A08E4C} +DEFINE_GUID(DXFILEOBJ_PMVSplitRecord, +0x574ccc14, 0xf0b3, 0x4333, 0x82, 0x2d, 0x93, 0xe8, 0xa8, 0xa0, 0x8e, 0x4c); + +// {B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897} +DEFINE_GUID(DXFILEOBJ_FVFData, +0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97); + +// {F752461C-1E23-48f6-B9F8-8350850F336F} +DEFINE_GUID(DXFILEOBJ_VertexElement, +0xf752461c, 0x1e23, 0x48f6, 0xb9, 0xf8, 0x83, 0x50, 0x85, 0xf, 0x33, 0x6f); + +// {BF22E553-292C-4781-9FEA-62BD554BDD93} +DEFINE_GUID(DXFILEOBJ_DeclData, +0xbf22e553, 0x292c, 0x4781, 0x9f, 0xea, 0x62, 0xbd, 0x55, 0x4b, 0xdd, 0x93); + +// {F1CFE2B3-0DE3-4e28-AFA1-155A750A282D} +DEFINE_GUID(DXFILEOBJ_EffectFloats, +0xf1cfe2b3, 0xde3, 0x4e28, 0xaf, 0xa1, 0x15, 0x5a, 0x75, 0xa, 0x28, 0x2d); + +// {D55B097E-BDB6-4c52-B03D-6051C89D0E42} +DEFINE_GUID(DXFILEOBJ_EffectString, +0xd55b097e, 0xbdb6, 0x4c52, 0xb0, 0x3d, 0x60, 0x51, 0xc8, 0x9d, 0xe, 0x42); + +// {622C0ED0-956E-4da9-908A-2AF94F3CE716} +DEFINE_GUID(DXFILEOBJ_EffectDWord, +0x622c0ed0, 0x956e, 0x4da9, 0x90, 0x8a, 0x2a, 0xf9, 0x4f, 0x3c, 0xe7, 0x16); + +// {3014B9A0-62F5-478c-9B86-E4AC9F4E418B} +DEFINE_GUID(DXFILEOBJ_EffectParamFloats, +0x3014b9a0, 0x62f5, 0x478c, 0x9b, 0x86, 0xe4, 0xac, 0x9f, 0x4e, 0x41, 0x8b); + +// {1DBC4C88-94C1-46ee-9076-2C28818C9481} +DEFINE_GUID(DXFILEOBJ_EffectParamString, +0x1dbc4c88, 0x94c1, 0x46ee, 0x90, 0x76, 0x2c, 0x28, 0x81, 0x8c, 0x94, 0x81); + +// {E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5} +DEFINE_GUID(DXFILEOBJ_EffectParamDWord, +0xe13963bc, 0xae51, 0x4c5d, 0xb0, 0xf, 0xcf, 0xa3, 0xa9, 0xd9, 0x7c, 0xe5); + +// {E331F7E4-0559-4cc2-8E99-1CEC1657928F} +DEFINE_GUID(DXFILEOBJ_EffectInstance, +0xe331f7e4, 0x559, 0x4cc2, 0x8e, 0x99, 0x1c, 0xec, 0x16, 0x57, 0x92, 0x8f); + +// {9E415A43-7BA6-4a73-8743-B73D47E88476} +DEFINE_GUID(DXFILEOBJ_AnimTicksPerSecond, +0x9e415a43, 0x7ba6, 0x4a73, 0x87, 0x43, 0xb7, 0x3d, 0x47, 0xe8, 0x84, 0x76); + +// {7F9B00B3-F125-4890-876E-1CFFBF697C4D} +DEFINE_GUID(DXFILEOBJ_CompressedAnimationSet, +0x7f9b00b3, 0xf125, 0x4890, 0x87, 0x6e, 0x1c, 0x42, 0xbf, 0x69, 0x7c, 0x4d); + +#pragma pack(push, 1) +typedef struct _XFILECOMPRESSEDANIMATIONSET +{ + DWORD CompressedBlockSize; + FLOAT TicksPerSec; + DWORD PlaybackType; + DWORD BufferLength; +} XFILECOMPRESSEDANIMATIONSET; +#pragma pack(pop) + +#define XSKINEXP_TEMPLATES \ + "xof 0303txt 0032\ + template XSkinMeshHeader \ + { \ + <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \ + WORD nMaxSkinWeightsPerVertex; \ + WORD nMaxSkinWeightsPerFace; \ + WORD nBones; \ + } \ + template VertexDuplicationIndices \ + { \ + \ + DWORD nIndices; \ + DWORD nOriginalVertices; \ + array DWORD indices[nIndices]; \ + } \ + template FaceAdjacency \ + { \ + \ + DWORD nIndices; \ + array DWORD indices[nIndices]; \ + } \ + template SkinWeights \ + { \ + <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \ + STRING transformNodeName; \ + DWORD nWeights; \ + array DWORD vertexIndices[nWeights]; \ + array float weights[nWeights]; \ + Matrix4x4 matrixOffset; \ + } \ + template Patch \ + { \ + \ + DWORD nControlIndices; \ + array DWORD controlIndices[nControlIndices]; \ + } \ + template PatchMesh \ + { \ + \ + DWORD nVertices; \ + array Vector vertices[nVertices]; \ + DWORD nPatches; \ + array Patch patches[nPatches]; \ + [ ... ] \ + } \ + template PatchMesh9 \ + { \ + \ + DWORD Type; \ + DWORD Degree; \ + DWORD Basis; \ + DWORD nVertices; \ + array Vector vertices[nVertices]; \ + DWORD nPatches; \ + array Patch patches[nPatches]; \ + [ ... ] \ + } " \ + "template EffectFloats \ + { \ + \ + DWORD nFloats; \ + array float Floats[nFloats]; \ + } \ + template EffectString \ + { \ + \ + STRING Value; \ + } \ + template EffectDWord \ + { \ + <622C0ED0-956E-4da9-908A-2AF94F3CE716> \ + DWORD Value; \ + } " \ + "template EffectParamFloats \ + { \ + <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> \ + STRING ParamName; \ + DWORD nFloats; \ + array float Floats[nFloats]; \ + } " \ + "template EffectParamString \ + { \ + <1DBC4C88-94C1-46ee-9076-2C28818C9481> \ + STRING ParamName; \ + STRING Value; \ + } \ + template EffectParamDWord \ + { \ + \ + STRING ParamName; \ + DWORD Value; \ + } \ + template EffectInstance \ + { \ + \ + STRING EffectFilename; \ + [ ... ] \ + } " \ + "template AnimTicksPerSecond \ + { \ + <9E415A43-7BA6-4a73-8743-B73D47E88476> \ + DWORD AnimTicksPerSecond; \ + } \ + template CompressedAnimationSet \ + { \ + <7F9B00B3-F125-4890-876E-1C42BF697C4D> \ + DWORD CompressedBlockSize; \ + FLOAT TicksPerSec; \ + DWORD PlaybackType; \ + DWORD BufferLength; \ + array DWORD CompressedData[BufferLength]; \ + } " + +#define XEXTENSIONS_TEMPLATES \ + "xof 0303txt 0032\ + template FVFData \ + { \ + \ + DWORD dwFVF; \ + DWORD nDWords; \ + array DWORD data[nDWords]; \ + } \ + template VertexElement \ + { \ + \ + DWORD Type; \ + DWORD Method; \ + DWORD Usage; \ + DWORD UsageIndex; \ + } \ + template DeclData \ + { \ + \ + DWORD nElements; \ + array VertexElement Elements[nElements]; \ + DWORD nDWords; \ + array DWORD data[nDWords]; \ + } \ + template PMAttributeRange \ + { \ + <917E0427-C61E-4a14-9C64-AFE65F9E9844> \ + DWORD iFaceOffset; \ + DWORD nFacesMin; \ + DWORD nFacesMax; \ + DWORD iVertexOffset; \ + DWORD nVerticesMin; \ + DWORD nVerticesMax; \ + } \ + template PMVSplitRecord \ + { \ + <574CCC14-F0B3-4333-822D-93E8A8A08E4C> \ + DWORD iFaceCLW; \ + DWORD iVlrOffset; \ + DWORD iCode; \ + } \ + template PMInfo \ + { \ + \ + DWORD nAttributes; \ + array PMAttributeRange attributeRanges[nAttributes]; \ + DWORD nMaxValence; \ + DWORD nMinLogicalVertices; \ + DWORD nMaxLogicalVertices; \ + DWORD nVSplits; \ + array PMVSplitRecord splitRecords[nVSplits]; \ + DWORD nAttributeMispredicts; \ + array DWORD attributeMispredicts[nAttributeMispredicts]; \ + } " + +#endif //__D3DX9MESH_H__ + + diff --git a/saco/d3d9/include/d3dx9shader.h b/saco/d3d9/include/d3dx9shader.h new file mode 100644 index 0000000..cae915a --- /dev/null +++ b/saco/d3d9/include/d3dx9shader.h @@ -0,0 +1,1072 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9shader.h +// Content: D3DX Shader APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9SHADER_H__ +#define __D3DX9SHADER_H__ + + +//--------------------------------------------------------------------------- +// D3DXTX_VERSION: +// -------------- +// Version token used to create a procedural texture filler in effects +// Used by D3DXFill[]TX functions +//--------------------------------------------------------------------------- +#define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) + + + +//---------------------------------------------------------------------------- +// D3DXSHADER flags: +// ----------------- +// D3DXSHADER_DEBUG +// Insert debug file/line/type/symbol information. +// +// D3DXSHADER_SKIPVALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when compiling shaders +// you KNOW will work. (ie. have compiled before without this option.) +// Shaders are always validated by D3D before they are set to the device. +// +// D3DXSHADER_SKIPOPTIMIZATION +// Instructs the compiler to skip optimization steps during code generation. +// Unless you are trying to isolate a problem in your code using this option +// is not recommended. +// +// D3DXSHADER_PACKMATRIX_ROWMAJOR +// Unless explicitly specified, matrices will be packed in row-major order +// on input and output from the shader. +// +// D3DXSHADER_PACKMATRIX_COLUMNMAJOR +// Unless explicitly specified, matrices will be packed in column-major +// order on input and output from the shader. This is generally more +// efficient, since it allows vector-matrix multiplication to be performed +// using a series of dot-products. +// +// D3DXSHADER_PARTIALPRECISION +// Force all computations in resulting shader to occur at partial precision. +// This may result in faster evaluation of shaders on some hardware. +// +// D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT +// Force compiler to compile against the next highest available software +// target for vertex shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT +// Force compiler to compile against the next highest available software +// target for pixel shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3DXSHADER_NO_PRESHADER +// Disables Preshaders. Using this flag will cause the compiler to not +// pull out static expression for evaluation on the host cpu +// +// D3DXSHADER_AVOID_FLOW_CONTROL +// Hint compiler to avoid flow-control constructs where possible. +// +// D3DXSHADER_PREFER_FLOW_CONTROL +// Hint compiler to prefer flow-control constructs where possible. +// +//---------------------------------------------------------------------------- + +#define D3DXSHADER_DEBUG (1 << 0) +#define D3DXSHADER_SKIPVALIDATION (1 << 1) +#define D3DXSHADER_SKIPOPTIMIZATION (1 << 2) +#define D3DXSHADER_PACKMATRIX_ROWMAJOR (1 << 3) +#define D3DXSHADER_PACKMATRIX_COLUMNMAJOR (1 << 4) +#define D3DXSHADER_PARTIALPRECISION (1 << 5) +#define D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT (1 << 6) +#define D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT (1 << 7) +#define D3DXSHADER_NO_PRESHADER (1 << 8) +#define D3DXSHADER_AVOID_FLOW_CONTROL (1 << 9) +#define D3DXSHADER_PREFER_FLOW_CONTROL (1 << 10) + + + +//---------------------------------------------------------------------------- +// D3DXHANDLE: +// ----------- +// Handle values used to efficiently reference shader and effect parameters. +// Strings can be used as handles. However, handles are not always strings. +//---------------------------------------------------------------------------- + +typedef LPCSTR D3DXHANDLE; +typedef D3DXHANDLE *LPD3DXHANDLE; + + +//---------------------------------------------------------------------------- +// D3DXMACRO: +// ---------- +// Preprocessor macro definition. The application pass in a NULL-terminated +// array of this structure to various D3DX APIs. This enables the application +// to #define tokens at runtime, before the file is parsed. +//---------------------------------------------------------------------------- + +typedef struct _D3DXMACRO +{ + LPCSTR Name; + LPCSTR Definition; + +} D3DXMACRO, *LPD3DXMACRO; + + +//---------------------------------------------------------------------------- +// D3DXSEMANTIC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXSEMANTIC +{ + UINT Usage; + UINT UsageIndex; + +} D3DXSEMANTIC, *LPD3DXSEMANTIC; + + + +//---------------------------------------------------------------------------- +// D3DXFRAGMENT_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXFRAGMENT_DESC +{ + LPCSTR Name; + DWORD Target; + +} D3DXFRAGMENT_DESC, *LPD3DXFRAGMENT_DESC; + + +//---------------------------------------------------------------------------- +// D3DXREGISTER_SET: +//---------------------------------------------------------------------------- + +typedef enum _D3DXREGISTER_SET +{ + D3DXRS_BOOL, + D3DXRS_INT4, + D3DXRS_FLOAT4, + D3DXRS_SAMPLER, + + // force 32-bit size enum + D3DXRS_FORCE_DWORD = 0x7fffffff + +} D3DXREGISTER_SET, *LPD3DXREGISTER_SET; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_CLASS: +//---------------------------------------------------------------------------- + +typedef enum _D3DXPARAMETER_CLASS +{ + D3DXPC_SCALAR, + D3DXPC_VECTOR, + D3DXPC_MATRIX_ROWS, + D3DXPC_MATRIX_COLUMNS, + D3DXPC_OBJECT, + D3DXPC_STRUCT, + + // force 32-bit size enum + D3DXPC_FORCE_DWORD = 0x7fffffff + +} D3DXPARAMETER_CLASS, *LPD3DXPARAMETER_CLASS; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_TYPE: +//---------------------------------------------------------------------------- + +typedef enum _D3DXPARAMETER_TYPE +{ + D3DXPT_VOID, + D3DXPT_BOOL, + D3DXPT_INT, + D3DXPT_FLOAT, + D3DXPT_STRING, + D3DXPT_TEXTURE, + D3DXPT_TEXTURE1D, + D3DXPT_TEXTURE2D, + D3DXPT_TEXTURE3D, + D3DXPT_TEXTURECUBE, + D3DXPT_SAMPLER, + D3DXPT_SAMPLER1D, + D3DXPT_SAMPLER2D, + D3DXPT_SAMPLER3D, + D3DXPT_SAMPLERCUBE, + D3DXPT_PIXELSHADER, + D3DXPT_VERTEXSHADER, + D3DXPT_PIXELFRAGMENT, + D3DXPT_VERTEXFRAGMENT, + + // force 32-bit size enum + D3DXPT_FORCE_DWORD = 0x7fffffff + +} D3DXPARAMETER_TYPE, *LPD3DXPARAMETER_TYPE; + + +//---------------------------------------------------------------------------- +// D3DXCONSTANTTABLE_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXCONSTANTTABLE_DESC +{ + LPCSTR Creator; // Creator string + DWORD Version; // Shader version + UINT Constants; // Number of constants + +} D3DXCONSTANTTABLE_DESC, *LPD3DXCONSTANTTABLE_DESC; + + +//---------------------------------------------------------------------------- +// D3DXCONSTANT_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXCONSTANT_DESC +{ + LPCSTR Name; // Constant name + + D3DXREGISTER_SET RegisterSet; // Register set + UINT RegisterIndex; // Register index + UINT RegisterCount; // Number of registers occupied + + D3DXPARAMETER_CLASS Class; // Class + D3DXPARAMETER_TYPE Type; // Component type + + UINT Rows; // Number of rows + UINT Columns; // Number of columns + UINT Elements; // Number of array elements + UINT StructMembers; // Number of structure member sub-parameters + + UINT Bytes; // Data size, in bytes + LPCVOID DefaultValue; // Pointer to default value + +} D3DXCONSTANT_DESC, *LPD3DXCONSTANT_DESC; + + + +//---------------------------------------------------------------------------- +// ID3DXConstantTable: +//---------------------------------------------------------------------------- + +typedef interface ID3DXConstantTable ID3DXConstantTable; +typedef interface ID3DXConstantTable *LPD3DXCONSTANTTABLE; + +// {AB3C758F-093E-4356-B762-4DB18F1B3A01} +DEFINE_GUID(IID_ID3DXConstantTable, +0xab3c758f, 0x93e, 0x4356, 0xb7, 0x62, 0x4d, 0xb1, 0x8f, 0x1b, 0x3a, 0x1); + + +#undef INTERFACE +#define INTERFACE ID3DXConstantTable + +DECLARE_INTERFACE_(ID3DXConstantTable, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Buffer + STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; + STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; + STDMETHOD_(UINT, GetSamplerIndex)(THIS_ D3DXHANDLE hConstant) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + + // Set Constants + STDMETHOD(SetDefaults)(THIS_ LPDIRECT3DDEVICE9 pDevice) PURE; + STDMETHOD(SetValue)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, BOOL b) PURE; + STDMETHOD(SetBoolArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, INT n) PURE; + STDMETHOD(SetIntArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, FLOAT f) PURE; + STDMETHOD(SetFloatArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXTextureShader: +//---------------------------------------------------------------------------- + +typedef interface ID3DXTextureShader ID3DXTextureShader; +typedef interface ID3DXTextureShader *LPD3DXTEXTURESHADER; + +// {3E3D67F8-AA7A-405d-A857-BA01D4758426} +DEFINE_GUID(IID_ID3DXTextureShader, +0x3e3d67f8, 0xaa7a, 0x405d, 0xa8, 0x57, 0xba, 0x1, 0xd4, 0x75, 0x84, 0x26); + +#undef INTERFACE +#define INTERFACE ID3DXTextureShader + +DECLARE_INTERFACE_(ID3DXTextureShader, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Gets + STDMETHOD(GetFunction)(THIS_ LPD3DXBUFFER *ppFunction) PURE; + STDMETHOD(GetConstantBuffer)(THIS_ LPD3DXBUFFER *ppConstantBuffer) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; + STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + + // Set Constants + STDMETHOD(SetDefaults)(THIS) PURE; + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hConstant, BOOL b) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hConstant, INT n) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hConstant, FLOAT f) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; +}; + + + +//---------------------------------------------------------------------------- +// ID3DXFragmentLinker +//---------------------------------------------------------------------------- + +typedef interface ID3DXFragmentLinker ID3DXFragmentLinker; +typedef interface ID3DXFragmentLinker *LPD3DXFRAGMENTLINKER; + +// {1A2C0CC2-E5B6-4ebc-9E8D-390E057811B6} +DEFINE_GUID(IID_ID3DXFragmentLinker, +0x1a2c0cc2, 0xe5b6, 0x4ebc, 0x9e, 0x8d, 0x39, 0xe, 0x5, 0x78, 0x11, 0xb6); + +#undef INTERFACE +#define INTERFACE ID3DXFragmentLinker + +DECLARE_INTERFACE_(ID3DXFragmentLinker, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXFragmentLinker + + // fragment access and information retrieval functions + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD_(UINT, GetNumberOfFragments)(THIS) PURE; + + STDMETHOD_(D3DXHANDLE, GetFragmentHandleByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFragmentHandleByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD(GetFragmentDesc)(THIS_ D3DXHANDLE Name, LPD3DXFRAGMENT_DESC FragDesc) PURE; + + // add the fragments in the buffer to the linker + STDMETHOD(AddFragments)(THIS_ CONST DWORD *Fragments) PURE; + + // Create a buffer containing the fragments. Suitable for saving to disk + STDMETHOD(GetAllFragments)(THIS_ LPD3DXBUFFER *ppBuffer) PURE; + STDMETHOD(GetFragment)(THIS_ D3DXHANDLE Name, LPD3DXBUFFER *ppBuffer) PURE; + + STDMETHOD(LinkShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPD3DXBUFFER *ppBuffer, LPD3DXBUFFER *ppErrorMsgs) PURE; + STDMETHOD(LinkVertexShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPDIRECT3DVERTEXSHADER9 *pVShader, LPD3DXBUFFER *ppErrorMsgs) PURE; + STDMETHOD(LinkPixelShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPDIRECT3DPIXELSHADER9 *pPShader, LPD3DXBUFFER *ppErrorMsgs) PURE; + + STDMETHOD(ClearCache)(THIS) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXINCLUDE_TYPE: +//---------------------------------------------------------------------------- + +typedef enum _D3DXINCLUDE_TYPE +{ + D3DXINC_LOCAL, + D3DXINC_SYSTEM, + + // force 32-bit size enum + D3DXINC_FORCE_DWORD = 0x7fffffff + +} D3DXINCLUDE_TYPE, *LPD3DXINCLUDE_TYPE; + + +//---------------------------------------------------------------------------- +// ID3DXInclude: +// ------------- +// This interface is intended to be implemented by the application, and can +// be used by various D3DX APIs. This enables application-specific handling +// of #include directives in source files. +// +// Open() +// Opens an include file. If successful, it should fill in ppData and +// pBytes. The data pointer returned must remain valid until Close is +// subsequently called. +// Close() +// Closes an include file. If Open was successful, Close is guaranteed +// to be called before the API using this interface returns. +//---------------------------------------------------------------------------- + +typedef interface ID3DXInclude ID3DXInclude; +typedef interface ID3DXInclude *LPD3DXINCLUDE; + +#undef INTERFACE +#define INTERFACE ID3DXInclude + +DECLARE_INTERFACE(ID3DXInclude) +{ + STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE; + STDMETHOD(Close)(THIS_ LPCVOID pData) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DXAssembleShader: +// ------------------- +// Assembles a shader. +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// Flags +// See D3DXSHADER_xxx flags +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the assembled shader code, as well as any embedded debug info. +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DXAssembleShaderFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXAssembleShaderFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileW +#else +#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileA +#endif + + +HRESULT WINAPI + D3DXAssembleShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXAssembleShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceW +#else +#define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceA +#endif + + +HRESULT WINAPI + D3DXAssembleShader( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + + + +//---------------------------------------------------------------------------- +// D3DXCompileShader: +// ------------------ +// Compiles a shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. Currently supported +// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_1_1", +// "ps_1_2", "ps_1_3", "ps_1_4", "ps_2_0", "ps_2_a", "ps_2_sw", "tx_1_0" +// Flags +// See D3DXSHADER_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3DXGetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +// ppConstantTable +// Returns a ID3DXConstantTable object which can be used to set +// shader constants to the device. Alternatively, an application can +// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within +// the shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCompileShaderFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +HRESULT WINAPI + D3DXCompileShaderFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +#ifdef UNICODE +#define D3DXCompileShaderFromFile D3DXCompileShaderFromFileW +#else +#define D3DXCompileShaderFromFile D3DXCompileShaderFromFileA +#endif + + +HRESULT WINAPI + D3DXCompileShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +HRESULT WINAPI + D3DXCompileShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +#ifdef UNICODE +#define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceW +#else +#define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceA +#endif + + +HRESULT WINAPI + D3DXCompileShader( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + + +//---------------------------------------------------------------------------- +// D3DXDisassembleShader: +// ---------------------- +// Takes a binary shader, and returns a buffer containing text assembly. +// +// Parameters: +// pShader +// Pointer to the shader byte code. +// ShaderSizeInBytes +// Size of the shader byte code in bytes. +// EnableColorCode +// Emit HTML tags for color coding the output? +// pComments +// Pointer to a comment string to include at the top of the shader. +// ppDisassembly +// Returns a buffer containing the disassembled shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXDisassembleShader( + CONST DWORD* pShader, + BOOL EnableColorCode, + LPCSTR pComments, + LPD3DXBUFFER* ppDisassembly); + + +//---------------------------------------------------------------------------- +// D3DXGetPixelShaderProfile/D3DXGetVertexShaderProfile: +// ----------------------------------------------------- +// Returns the name of the HLSL profile best suited to a given device. +// +// Parameters: +// pDevice +// Pointer to the device in question +//---------------------------------------------------------------------------- + +LPCSTR WINAPI + D3DXGetPixelShaderProfile( + LPDIRECT3DDEVICE9 pDevice); + +LPCSTR WINAPI + D3DXGetVertexShaderProfile( + LPDIRECT3DDEVICE9 pDevice); + + +//---------------------------------------------------------------------------- +// D3DXFindShaderComment: +// ---------------------- +// Searches through a shader for a particular comment, denoted by a FourCC in +// the first DWORD of the comment. If the comment is not found, and no other +// error has occurred, S_FALSE is returned. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// FourCC +// FourCC used to identify the desired comment block. +// ppData +// Returns a pointer to the comment data (not including comment token +// and FourCC). Can be NULL. +// pSizeInBytes +// Returns the size of the comment data in bytes. Can be NULL. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFindShaderComment( + CONST DWORD* pFunction, + DWORD FourCC, + LPCVOID* ppData, + UINT* pSizeInBytes); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderSize: +// ------------------ +// Returns the size of the shader byte-code, in bytes. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +//---------------------------------------------------------------------------- + +UINT WINAPI + D3DXGetShaderSize( + CONST DWORD* pFunction); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderVersion: +// ----------------------- +// Returns the shader version of a given shader. Returns zero if the shader +// function is NULL. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +//---------------------------------------------------------------------------- + +DWORD WINAPI + D3DXGetShaderVersion( + CONST DWORD* pFunction); + +//---------------------------------------------------------------------------- +// D3DXGetShaderSemantics: +// ----------------------- +// Gets semantics for all input elements referenced inside a given shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// pSemantics +// Pointer to an array of D3DXSEMANTIC structures. The function will +// fill this array with the semantics for each input element referenced +// inside the shader. This array is assumed to contain at least +// MAXD3DDECLLENGTH elements. +// pCount +// Returns the number of elements referenced by the shader +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderInputSemantics( + CONST DWORD* pFunction, + D3DXSEMANTIC* pSemantics, + UINT* pCount); + +HRESULT WINAPI + D3DXGetShaderOutputSemantics( + CONST DWORD* pFunction, + D3DXSEMANTIC* pSemantics, + UINT* pCount); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderSamplers: +// ---------------------- +// Gets semantics for all input elements referenced inside a given shader. +// +// pFunction +// Pointer to the function DWORD stream +// pSamplers +// Pointer to an array of LPCSTRs. The function will fill this array +// with pointers to the sampler names contained within pFunction, for +// each sampler referenced inside the shader. This array is assumed to +// contain at least 16 elements. +// pCount +// Returns the number of samplers referenced by the shader +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderSamplers( + CONST DWORD* pFunction, + LPCSTR* pSamplers, + UINT* pCount); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderConstantTable: +// --------------------------- +// Gets shader constant table embedded inside shader. A constant table is +// generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in +// the body of the shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// ppConstantTable +// Returns a ID3DXConstantTable object which can be used to set +// shader constants to the device. Alternatively, an application can +// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within +// the shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderConstantTable( + CONST DWORD* pFunction, + LPD3DXCONSTANTTABLE* ppConstantTable); + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureShader: +// ------------------------ +// Creates a texture shader object, given the compiled shader. +// +// Parameters +// pFunction +// Pointer to the function DWORD stream +// ppTextureShader +// Returns a ID3DXTextureShader object which can be used to procedurally +// fill the contents of a texture using the D3DXFillTextureTX functions. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateTextureShader( + CONST DWORD* pFunction, + LPD3DXTEXTURESHADER* ppTextureShader); + + + +//---------------------------------------------------------------------------- +// D3DXGatherFragments: +// ------------------- +// Assembles shader fragments into a buffer to be passed to a fragment linker. +// will generate shader fragments for all fragments in the file +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// Flags +// See D3DXSHADER_xxx flags +// ppShader +// Returns a buffer containing the created shader fragments. This buffer contains +// the assembled shader code, as well as any embedded debug info. +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + + +HRESULT WINAPI +D3DXGatherFragmentsFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI +D3DXGatherFragmentsFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileW +#else +#define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileA +#endif + + +HRESULT WINAPI + D3DXGatherFragmentsFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXGatherFragmentsFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceW +#else +#define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceA +#endif + + +HRESULT WINAPI + D3DXGatherFragments( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + + + +//---------------------------------------------------------------------------- +// D3DXCreateFragmentLinker: +// ------------------------- +// Creates a fragment linker with a given cache size. The interface returned +// can be used to link together shader fragments. (both HLSL & ASM fragements) +// +// Parameters: +// pDevice +// Pointer to the device on which to create the shaders +// ShaderCacheSize +// Size of the shader cache +// ppFragmentLinker +// pointer to a memory location to put the created interface pointer +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateFragmentLinker( + LPDIRECT3DDEVICE9 pDevice, + UINT ShaderCacheSize, + LPD3DXFRAGMENTLINKER* ppFragmentLinker); + + + +#ifdef __cplusplus +} +#endif //__cplusplus + + +////////////////////////////////////////////////////////////////////////////// +// Shader comment block layouts ////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXSHADER_CONSTANTTABLE: +// ------------------------- +// Shader constant information; included as an CTAB comment block inside +// shaders. All offsets are BYTE offsets from start of CONSTANTTABLE struct. +// Entries in the table are sorted by Name in ascending order. +//---------------------------------------------------------------------------- + +typedef struct _D3DXSHADER_CONSTANTTABLE +{ + DWORD Size; // sizeof(D3DXSHADER_CONSTANTTABLE) + DWORD Creator; // LPCSTR offset + DWORD Version; // shader version + DWORD Constants; // number of constants + DWORD ConstantInfo; // D3DXSHADER_CONSTANTINFO[Constants] offset + DWORD Flags; // flags shader was compiled with + DWORD Target; // LPCSTR offset + +} D3DXSHADER_CONSTANTTABLE, *LPD3DXSHADER_CONSTANTTABLE; + + +typedef struct _D3DXSHADER_CONSTANTINFO +{ + DWORD Name; // LPCSTR offset + WORD RegisterSet; // D3DXREGISTER_SET + WORD RegisterIndex; // register number + WORD RegisterCount; // number of registers + WORD Reserved; // reserved + DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset + DWORD DefaultValue; // offset of default value + +} D3DXSHADER_CONSTANTINFO, *LPD3DXSHADER_CONSTANTINFO; + + +typedef struct _D3DXSHADER_TYPEINFO +{ + WORD Class; // D3DXPARAMETER_CLASS + WORD Type; // D3DXPARAMETER_TYPE + WORD Rows; // number of rows (matrices) + WORD Columns; // number of columns (vectors and matrices) + WORD Elements; // array dimension + WORD StructMembers; // number of struct members + DWORD StructMemberInfo; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset + +} D3DXSHADER_TYPEINFO, *LPD3DXSHADER_TYPEINFO; + + +typedef struct _D3DXSHADER_STRUCTMEMBERINFO +{ + DWORD Name; // LPCSTR offset + DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset + +} D3DXSHADER_STRUCTMEMBERINFO, *LPD3DXSHADER_STRUCTMEMBERINFO; + + + +#endif //__D3DX9SHADER_H__ + diff --git a/saco/d3d9/include/d3dx9shape.h b/saco/d3d9/include/d3dx9shape.h new file mode 100644 index 0000000..4c23091 --- /dev/null +++ b/saco/d3d9/include/d3dx9shape.h @@ -0,0 +1,221 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9shapes.h +// Content: D3DX simple shapes +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9SHAPES_H__ +#define __D3DX9SHAPES_H__ + +/////////////////////////////////////////////////////////////////////////// +// Functions: +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//------------------------------------------------------------------------- +// D3DXCreatePolygon: +// ------------------ +// Creates a mesh containing an n-sided polygon. The polygon is centered +// at the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Length Length of each side. +// Sides Number of sides the polygon has. (Must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreatePolygon( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Length, + UINT Sides, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateBox: +// -------------- +// Creates a mesh containing an axis-aligned box. The box is centered at +// the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Width Width of box (along X-axis) +// Height Height of box (along Y-axis) +// Depth Depth of box (along Z-axis) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateBox( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Width, + FLOAT Height, + FLOAT Depth, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateCylinder: +// ------------------- +// Creates a mesh containing a cylinder. The generated cylinder is +// centered at the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius1 Radius at -Z end (should be >= 0.0f) +// Radius2 Radius at +Z end (should be >= 0.0f) +// Length Length of cylinder (along Z-axis) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateCylinder( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Radius1, + FLOAT Radius2, + FLOAT Length, + UINT Slices, + UINT Stacks, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateSphere: +// ----------------- +// Creates a mesh containing a sphere. The sphere is centered at the +// origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius Radius of the sphere (should be >= 0.0f) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateSphere( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Radius, + UINT Slices, + UINT Stacks, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateTorus: +// ---------------- +// Creates a mesh containing a torus. The generated torus is centered at +// the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// InnerRadius Inner radius of the torus (should be >= 0.0f) +// OuterRadius Outer radius of the torue (should be >= 0.0f) +// Sides Number of sides in a cross-section (must be >= 3) +// Rings Number of rings making up the torus (must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTorus( + LPDIRECT3DDEVICE9 pDevice, + FLOAT InnerRadius, + FLOAT OuterRadius, + UINT Sides, + UINT Rings, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateTeapot: +// ----------------- +// Creates a mesh containing a teapot. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTeapot( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateText: +// --------------- +// Creates a mesh containing the specified text using the font associated +// with the device context. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// hDC Device context, with desired font selected +// pText Text to generate +// Deviation Maximum chordal deviation from true font outlines +// Extrusion Amount to extrude text in -Z direction +// ppMesh The mesh object which will be created +// pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTextA( + LPDIRECT3DDEVICE9 pDevice, + HDC hDC, + LPCSTR pText, + FLOAT Deviation, + FLOAT Extrusion, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency, + LPGLYPHMETRICSFLOAT pGlyphMetrics); + +HRESULT WINAPI + D3DXCreateTextW( + LPDIRECT3DDEVICE9 pDevice, + HDC hDC, + LPCWSTR pText, + FLOAT Deviation, + FLOAT Extrusion, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency, + LPGLYPHMETRICSFLOAT pGlyphMetrics); + +#ifdef UNICODE +#define D3DXCreateText D3DXCreateTextW +#else +#define D3DXCreateText D3DXCreateTextA +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9SHAPES_H__ + diff --git a/saco/d3d9/include/d3dx9tex.h b/saco/d3d9/include/d3dx9tex.h new file mode 100644 index 0000000..0d62b69 --- /dev/null +++ b/saco/d3d9/include/d3dx9tex.h @@ -0,0 +1,1723 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9tex.h +// Content: D3DX texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9TEX_H__ +#define __D3DX9TEX_H__ + + +//---------------------------------------------------------------------------- +// D3DX_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR +// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | +// D3DX_FILTER_MIRROR_V +// D3DX_FILTER_DITHER +// Dithers the resulting image using a 4x4 order dither pattern. +// D3DX_FILTER_SRGB_IN +// Denotes that the input data is in sRGB (gamma 2.2) colorspace. +// D3DX_FILTER_SRGB_OUT +// Denotes that the output data is in sRGB (gamma 2.2) colorspace. +// D3DX_FILTER_SRGB +// Same as specifying D3DX_FILTER_SRGB_IN | D3DX_FILTER_SRGB_OUT +// +//---------------------------------------------------------------------------- + +#define D3DX_FILTER_NONE (1 << 0) +#define D3DX_FILTER_POINT (2 << 0) +#define D3DX_FILTER_LINEAR (3 << 0) +#define D3DX_FILTER_TRIANGLE (4 << 0) +#define D3DX_FILTER_BOX (5 << 0) + +#define D3DX_FILTER_MIRROR_U (1 << 16) +#define D3DX_FILTER_MIRROR_V (2 << 16) +#define D3DX_FILTER_MIRROR_W (4 << 16) +#define D3DX_FILTER_MIRROR (7 << 16) + +#define D3DX_FILTER_DITHER (1 << 19) +#define D3DX_FILTER_DITHER_DIFFUSION (2 << 19) + +#define D3DX_FILTER_SRGB_IN (1 << 21) +#define D3DX_FILTER_SRGB_OUT (2 << 21) +#define D3DX_FILTER_SRGB (3 << 21) + + +//---------------------------------------------------------------------------- +// D3DX_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DXComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR +// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V +// D3DX_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- + +#define D3DX_NORMALMAP_MIRROR_U (1 << 16) +#define D3DX_NORMALMAP_MIRROR_V (2 << 16) +#define D3DX_NORMALMAP_MIRROR (3 << 16) +#define D3DX_NORMALMAP_INVERTSIGN (8 << 16) +#define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16) + + + + +//---------------------------------------------------------------------------- +// D3DX_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX_CHANNEL_RED +// Indicates the red channel should be used +// D3DX_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +#define D3DX_CHANNEL_RED (1 << 0) +#define D3DX_CHANNEL_BLUE (1 << 1) +#define D3DX_CHANNEL_GREEN (1 << 2) +#define D3DX_CHANNEL_ALPHA (1 << 3) +#define D3DX_CHANNEL_LUMINANCE (1 << 4) + + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_FILEFORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +typedef enum _D3DXIMAGE_FILEFORMAT +{ + D3DXIFF_BMP = 0, + D3DXIFF_JPG = 1, + D3DXIFF_TGA = 2, + D3DXIFF_PNG = 3, + D3DXIFF_DDS = 4, + D3DXIFF_PPM = 5, + D3DXIFF_DIB = 6, + D3DXIFF_HDR = 7, //high dynamic range formats + D3DXIFF_PFM = 8, // + D3DXIFF_FORCE_DWORD = 0x7fffffff + +} D3DXIMAGE_FILEFORMAT; + + +//---------------------------------------------------------------------------- +// LPD3DXFILL2D and LPD3DXFILL3D: +// ------------------------------ +// Function types used by the texture fill functions. +// +// Parameters: +// pOut +// Pointer to a vector which the function uses to return its result. +// X,Y,Z,W will be mapped to R,G,B,A respectivly. +// pTexCoord +// Pointer to a vector containing the coordinates of the texel currently +// being evaluated. Textures and VolumeTexture texcoord components +// range from 0 to 1. CubeTexture texcoord component range from -1 to 1. +// pTexelSize +// Pointer to a vector containing the dimensions of the current texel. +// pData +// Pointer to user data. +// +//---------------------------------------------------------------------------- + +typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *pOut, + CONST D3DXVECTOR2 *pTexCoord, CONST D3DXVECTOR2 *pTexelSize, LPVOID pData); + +typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *pOut, + CONST D3DXVECTOR3 *pTexCoord, CONST D3DXVECTOR3 *pTexelSize, LPVOID pData); + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// MipLevels +// Number of mip levels in original image +// Format +// D3D format which most closely describes the data in original image +// ResourceType +// D3DRESOURCETYPE representing the type of texture stored in the file. +// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. +// ImageFileFormat +// D3DXIMAGE_FILEFORMAT representing the format of the image file. +// +//---------------------------------------------------------------------------- + +typedef struct _D3DXIMAGE_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + D3DFORMAT Format; + D3DRESOURCETYPE ResourceType; + D3DXIMAGE_FILEFORMAT ImageFileFormat; + +} D3DXIMAGE_INFO; + + + + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +; +//---------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource: +// ------------------------------ +// Fills in a D3DXIMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetImageInfoFromFileA( + LPCSTR pSrcFile, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXGetImageInfoFromFileW( + LPCWSTR pSrcFile, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileW +#else +#define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileA +#endif + + +HRESULT WINAPI + D3DXGetImageInfoFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXGetImageInfoFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceW +#else +#define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceA +#endif + + +HRESULT WINAPI + D3DXGetImageInfoFromFileInMemory( + LPCVOID pSrcData, + UINT SrcDataSize, + D3DXIMAGE_INFO* pSrcInfo); + + + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Surface APIs //////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromFile/Resource: +// --------------------------------- +// Load surface from a file or resource +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcRect +// Source rectangle, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromFileA( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCSTR pSrcFile, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadSurfaceFromFileW( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCWSTR pSrcFile, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileW +#else +#define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileA +#endif + + + +HRESULT WINAPI + D3DXLoadSurfaceFromResourceA( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadSurfaceFromResourceW( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + +#ifdef UNICODE +#define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceW +#else +#define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceA +#endif + + + +HRESULT WINAPI + D3DXLoadSurfaceFromFileInMemory( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCVOID pSrcData, + UINT SrcDataSize, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromSurface: +// --------------------------- +// Load surface from another surface (with color conversion) +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcSurface +// Source surface +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for entire surface +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromSurface( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey); + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromMemory: +// -------------------------- +// Load surface from memory. +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcMemory +// Pointer to the top-left corner of the source image in memory +// SrcFormat +// Pixel format of the source image. +// SrcPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the width of one row of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromMemory( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCVOID pSrcMemory, + D3DFORMAT SrcFormat, + UINT SrcPitch, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey); + + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFile: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveSurfaceToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + +HRESULT WINAPI + D3DXSaveSurfaceToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + +#ifdef UNICODE +#define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileW +#else +#define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA +#endif + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFileInMemory: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// ppDestBuf +// address of pointer to d3dxbuffer for returning data bits +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveSurfaceToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Volume APIs ///////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromFile/Resource: +// -------------------------------- +// Load volume from a file or resource +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcBox +// Source box, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromFileA( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCSTR pSrcFile, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadVolumeFromFileW( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCWSTR pSrcFile, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileW +#else +#define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileA +#endif + + +HRESULT WINAPI + D3DXLoadVolumeFromResourceA( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadVolumeFromResourceW( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceW +#else +#define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceA +#endif + + + +HRESULT WINAPI + D3DXLoadVolumeFromFileInMemory( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCVOID pSrcData, + UINT SrcDataSize, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromVolume: +// ------------------------- +// Load volume from another volume (with color conversion) +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcVolume +// Source volume +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for entire volume +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromVolume( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey); + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromMemory: +// ------------------------- +// Load volume from memory. +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcMemory +// Pointer to the top-left corner of the source volume in memory +// SrcFormat +// Pixel format of the source volume. +// SrcRowPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one row of cells, in bytes. +// SrcSlicePitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one slice of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromMemory( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCVOID pSrcMemory, + D3DFORMAT SrcFormat, + UINT SrcRowPitch, + UINT SrcSlicePitch, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey); + + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFile: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveVolumeToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +HRESULT WINAPI + D3DXSaveVolumeToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +#ifdef UNICODE +#define D3DXSaveVolumeToFile D3DXSaveVolumeToFileW +#else +#define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFileInMemory: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveVolumeToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXCheckTextureRequirements: +// ----------------------------- +// Checks texture creation parameters. If parameters are invalid, this +// function returns corrected parameters. +// +// Parameters: +// +// pDevice +// The D3D device to be used +// pWidth, pHeight, pDepth, pSize +// Desired size in pixels, or NULL. Returns corrected size. +// pNumMipLevels +// Number of desired mipmap levels, or NULL. Returns corrected number. +// Usage +// Texture usage flags +// pFormat +// Desired pixel format, or NULL. Returns corrected format. +// Pool +// Memory pool to be used to create texture +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCheckTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pWidth, + UINT* pHeight, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + +HRESULT WINAPI + D3DXCheckCubeTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pSize, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + +HRESULT WINAPI + D3DXCheckVolumeTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pWidth, + UINT* pHeight, + UINT* pDepth, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + + +//---------------------------------------------------------------------------- +// D3DXCreateTexture: +// ------------------ +// Create an empty texture +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// Width, Height, Depth, Size +// size in pixels. these must be non-zero +// MipLevels +// number of mip levels desired. if zero or D3DX_DEFAULT, a complete +// mipmap chain will be created. +// Usage +// Texture usage flags +// Format +// Pixel format. +// Pool +// Memory pool to be used to create texture +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureFromFile/Resource: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// Width, Height, Depth, Size +// Size in pixels. If zero or D3DX_DEFAULT, the size will be taken from +// the file and rounded up to a power of two. If D3DX_DEFAULT_NONPOW2, +// and the device supports NONPOW2 textures, the size will not be rounded. +// If D3DX_FROM_FILE, the size will be taken exactly as it is in the file, +// and the call will fail if this violates device capabilities. +// MipLevels +// Number of mip levels. If zero or D3DX_DEFAULT, a complete mipmap +// chain will be created. If D3DX_FROM_FILE, the size will be taken +// exactly as it is in the file, and the call will fail if this violates +// device capabilities. +// Usage +// Texture usage flags +// Format +// Desired pixel format. If D3DFMT_UNKNOWN, the format will be +// taken from the file. If D3DFMT_FROM_FILE, the format will be taken +// exactly as it is in the file, and the call will fail if the device does +// not support the given format. +// Pool +// Memory pool to be used to create texture +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// MipFilter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// pPalette +// 256 color palette to be filled in, or NULL +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + + +// FromFile + +HRESULT WINAPI + D3DXCreateTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromFile D3DXCreateTextureFromFileW +#else +#define D3DXCreateTextureFromFile D3DXCreateTextureFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileW +#else +#define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileW +#else +#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA +#endif + + +// FromResource + +HRESULT WINAPI + D3DXCreateTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceW +#else +#define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceW +#else +#define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceW +#else +#define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA +#endif + + +// FromFileEx + +HRESULT WINAPI + D3DXCreateTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExW +#else +#define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExW +#else +#define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExW +#else +#define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA +#endif + + +// FromResourceEx + +HRESULT WINAPI + D3DXCreateTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExW +#else +#define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExW +#else +#define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExW +#else +#define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA +#endif + + +// FromFileInMemory + +HRESULT WINAPI + D3DXCreateTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + +// FromFileInMemoryEx + +HRESULT WINAPI + D3DXCreateTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DXSaveTextureToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + +HRESULT WINAPI + D3DXSaveTextureToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + +#ifdef UNICODE +#define D3DXSaveTextureToFile D3DXSaveTextureToFileW +#else +#define D3DXSaveTextureToFile D3DXSaveTextureToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFileInMemory: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// ppDestBuf +// address of a d3dxbuffer pointer to return the image data +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveTextureToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + + + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXFilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// pPalette +// 256 color palette to be used, or NULL for non-palettized formats +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// Filter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFilterTexture( + LPDIRECT3DBASETEXTURE9 pBaseTexture, + CONST PALETTEENTRY* pPalette, + UINT SrcLevel, + DWORD Filter); + +#define D3DXFilterCubeTexture D3DXFilterTexture +#define D3DXFilterVolumeTexture D3DXFilterTexture + + + +//---------------------------------------------------------------------------- +// D3DXFillTexture: +// ---------------- +// Uses a user provided function to fill each texel of each mip level of a +// given texture. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pFunction +// Pointer to user provided evalutor function which will be used to +// compute the value of each texel. +// pData +// Pointer to an arbitrary block of user defined data. This pointer +// will be passed to the function provided in pFunction +//----------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFillTexture( + LPDIRECT3DTEXTURE9 pTexture, + LPD3DXFILL2D pFunction, + LPVOID pData); + +HRESULT WINAPI + D3DXFillCubeTexture( + LPDIRECT3DCUBETEXTURE9 pCubeTexture, + LPD3DXFILL3D pFunction, + LPVOID pData); + +HRESULT WINAPI + D3DXFillVolumeTexture( + LPDIRECT3DVOLUMETEXTURE9 pVolumeTexture, + LPD3DXFILL3D pFunction, + LPVOID pData); + +//--------------------------------------------------------------------------- +// D3DXFillTextureTX: +// ------------------ +// Uses a TX Shader target to function to fill each texel of each mip level +// of a given texture. The TX Shader target should be a compiled function +// taking 2 paramters and returning a float4 color. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pTextureShader +// Pointer to the texture shader to be used to fill in the texture +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFillTextureTX( + LPDIRECT3DTEXTURE9 pTexture, + LPD3DXTEXTURESHADER pTextureShader); + + +HRESULT WINAPI + D3DXFillCubeTextureTX( + LPDIRECT3DCUBETEXTURE9 pCubeTexture, + LPD3DXTEXTURESHADER pTextureShader); + + +HRESULT WINAPI + D3DXFillVolumeTextureTX( + LPDIRECT3DVOLUMETEXTURE9 pVolumeTexture, + LPD3DXTEXTURESHADER pTextureShader); + + + +//---------------------------------------------------------------------------- +// D3DXComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pTexture +// Pointer to the destination texture +// pSrcTexture +// Pointer to the source heightmap texture +// pSrcPalette +// Source palette of 256 colors, or NULL +// Flags +// D3DX_NORMALMAP flags +// Channel +// D3DX_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXComputeNormalMap( + LPDIRECT3DTEXTURE9 pTexture, + LPDIRECT3DTEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette, + DWORD Flags, + DWORD Channel, + FLOAT Amplitude); + + + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9TEX_H__ + diff --git a/saco/d3d9/include/d3dx9xof.h b/saco/d3d9/include/d3dx9xof.h new file mode 100644 index 0000000..c513f0f --- /dev/null +++ b/saco/d3d9/include/d3dx9xof.h @@ -0,0 +1,299 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9xof.h +// Content: D3DX .X File types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#if !defined( __D3DX9XOF_H__ ) +#define __D3DX9XOF_H__ + +#if defined( __cplusplus ) +extern "C" { +#endif // defined( __cplusplus ) + +//---------------------------------------------------------------------------- +// D3DXF_FILEFORMAT +// This flag is used to specify what file type to use when saving to disk. +// _BINARY, and _TEXT are mutually exclusive, while +// _COMPRESSED is an optional setting that works with all file types. +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILEFORMAT; + +#define D3DXF_FILEFORMAT_BINARY 0 +#define D3DXF_FILEFORMAT_TEXT 1 +#define D3DXF_FILEFORMAT_COMPRESSED 2 + +//---------------------------------------------------------------------------- +// D3DXF_FILESAVEOPTIONS +// This flag is used to specify where to save the file to. Each flag is +// mutually exclusive, indicates the data location of the file, and also +// chooses which additional data will specify the location. +// _TOFILE is paired with a filename (LPCSTR) +// _TOWFILE is paired with a filename (LPWSTR) +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILESAVEOPTIONS; + +#define D3DXF_FILESAVE_TOFILE 0x00L +#define D3DXF_FILESAVE_TOWFILE 0x01L + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADOPTIONS +// This flag is used to specify where to load the file from. Each flag is +// mutually exclusive, indicates the data location of the file, and also +// chooses which additional data will specify the location. +// _FROMFILE is paired with a filename (LPCSTR) +// _FROMWFILE is paired with a filename (LPWSTR) +// _FROMRESOURCE is paired with a (D3DXF_FILELOADRESOUCE*) description. +// _FROMMEMORY is paired with a (D3DXF_FILELOADMEMORY*) description. +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILELOADOPTIONS; + +#define D3DXF_FILELOAD_FROMFILE 0x00L +#define D3DXF_FILELOAD_FROMWFILE 0x01L +#define D3DXF_FILELOAD_FROMRESOURCE 0x02L +#define D3DXF_FILELOAD_FROMMEMORY 0x03L + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADRESOURCE: +//---------------------------------------------------------------------------- + +typedef struct _D3DXF_FILELOADRESOURCE +{ + HMODULE hModule; // Desc + LPCSTR lpName; // Desc + LPCSTR lpType; // Desc +} D3DXF_FILELOADRESOURCE; + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADMEMORY: +//---------------------------------------------------------------------------- + +typedef struct _D3DXF_FILELOADMEMORY +{ + LPCVOID lpMemory; // Desc + SIZE_T dSize; // Desc +} D3DXF_FILELOADMEMORY; + +#if defined( _WIN32 ) && !defined( _NO_COM ) + +// {cef08cf9-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFile, +0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfa-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileSaveObject, +0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfb-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileSaveData, +0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfc-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileEnumObject, +0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfd-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileData, +0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +#endif // defined( _WIN32 ) && !defined( _NO_COM ) + +#if defined( __cplusplus ) +#if !defined( DECLSPEC_UUID ) +#if _MSC_VER >= 1100 +#define DECLSPEC_UUID( x ) __declspec( uuid( x ) ) +#else // !( _MSC_VER >= 1100 ) +#define DECLSPEC_UUID( x ) +#endif // !( _MSC_VER >= 1100 ) +#endif // !defined( DECLSPEC_UUID ) + +interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" ) + ID3DXFile; +interface DECLSPEC_UUID( "cef08cfa-7b4f-4429-9624-2a690a933201" ) + ID3DXFileSaveObject; +interface DECLSPEC_UUID( "cef08cfb-7b4f-4429-9624-2a690a933201" ) + ID3DXFileSaveData; +interface DECLSPEC_UUID( "cef08cfc-7b4f-4429-9624-2a690a933201" ) + ID3DXFileEnumObject; +interface DECLSPEC_UUID( "cef08cfd-7b4f-4429-9624-2a690a933201" ) + ID3DXFileData; + +#if defined( _COM_SMARTPTR_TYPEDEF ) +_COM_SMARTPTR_TYPEDEF( ID3DXFile, + __uuidof( ID3DXFile ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileSaveObject, + __uuidof( ID3DXFileSaveObject ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileSaveData, + __uuidof( ID3DXFileSaveData ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject, + __uuidof( ID3DXFileEnumObject ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileData, + __uuidof( ID3DXFileData ) ); +#endif // defined( _COM_SMARTPTR_TYPEDEF ) +#endif // defined( __cplusplus ) + +typedef interface ID3DXFile ID3DXFile; +typedef interface ID3DXFileSaveObject ID3DXFileSaveObject; +typedef interface ID3DXFileSaveData ID3DXFileSaveData; +typedef interface ID3DXFileEnumObject ID3DXFileEnumObject; +typedef interface ID3DXFileData ID3DXFileData; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFile ///////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFile + +DECLARE_INTERFACE_( ID3DXFile, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( CreateEnumObject )( THIS_ LPCVOID, D3DXF_FILELOADOPTIONS, + ID3DXFileEnumObject** ) PURE; + STDMETHOD( CreateSaveObject )( THIS_ LPCVOID, D3DXF_FILESAVEOPTIONS, + D3DXF_FILEFORMAT, ID3DXFileSaveObject** ) PURE; + STDMETHOD( RegisterTemplates )( THIS_ LPCVOID, SIZE_T ) PURE; + STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileSaveObject /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileSaveObject + +DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; + STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, + SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; + STDMETHOD( Save )( THIS ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileSaveData ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileSaveData + +DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetSave )( THIS_ ID3DXFileSaveObject** ) PURE; + STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; + STDMETHOD( GetId )( THIS_ LPGUID ) PURE; + STDMETHOD( GetType )( THIS_ GUID* ) PURE; + STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, + SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; + STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileEnumObject /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileEnumObject + +DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; + STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; + STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; + STDMETHOD( GetDataObjectById )( THIS_ REFGUID, ID3DXFileData** ) PURE; + STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileData ///////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileData + +DECLARE_INTERFACE_( ID3DXFileData, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetEnum )( THIS_ ID3DXFileEnumObject** ) PURE; + STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; + STDMETHOD( GetId )( THIS_ LPGUID ) PURE; + STDMETHOD( Lock )( THIS_ SIZE_T*, LPCVOID* ) PURE; + STDMETHOD( Unlock )( THIS ) PURE; + STDMETHOD( GetType )( THIS_ GUID* ) PURE; + STDMETHOD_( BOOL, IsReference )( THIS ) PURE; + STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; + STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; +}; + +STDAPI D3DXFileCreate( ID3DXFile** lplpDirectXFile ); + +/* + * DirectX File errors. + */ + +#define _FACD3DXF 0x876 + +#define D3DXFERR_BADOBJECT MAKE_HRESULT( 1, _FACD3DXF, 900 ) +#define D3DXFERR_BADVALUE MAKE_HRESULT( 1, _FACD3DXF, 901 ) +#define D3DXFERR_BADTYPE MAKE_HRESULT( 1, _FACD3DXF, 902 ) +#define D3DXFERR_NOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 903 ) +#define D3DXFERR_NOTDONEYET MAKE_HRESULT( 1, _FACD3DXF, 904 ) +#define D3DXFERR_FILENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 905 ) +#define D3DXFERR_RESOURCENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 906 ) +#define D3DXFERR_BADRESOURCE MAKE_HRESULT( 1, _FACD3DXF, 907 ) +#define D3DXFERR_BADFILETYPE MAKE_HRESULT( 1, _FACD3DXF, 908 ) +#define D3DXFERR_BADFILEVERSION MAKE_HRESULT( 1, _FACD3DXF, 909 ) +#define D3DXFERR_BADFILEFLOATSIZE MAKE_HRESULT( 1, _FACD3DXF, 910 ) +#define D3DXFERR_BADFILE MAKE_HRESULT( 1, _FACD3DXF, 911 ) +#define D3DXFERR_PARSEERROR MAKE_HRESULT( 1, _FACD3DXF, 912 ) +#define D3DXFERR_BADARRAYSIZE MAKE_HRESULT( 1, _FACD3DXF, 913 ) +#define D3DXFERR_BADDATAREFERENCE MAKE_HRESULT( 1, _FACD3DXF, 914 ) +#define D3DXFERR_NOMOREOBJECTS MAKE_HRESULT( 1, _FACD3DXF, 915 ) +#define D3DXFERR_NOMOREDATA MAKE_HRESULT( 1, _FACD3DXF, 916 ) +#define D3DXFERR_BADCACHEFILE MAKE_HRESULT( 1, _FACD3DXF, 917 ) + +/* + * DirectX File object types. + */ + +#ifndef WIN_TYPES +#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype +#endif + +WIN_TYPES(ID3DXFile, D3DXFILE); +WIN_TYPES(ID3DXFileEnumObject, D3DXFILEENUMOBJECT); +WIN_TYPES(ID3DXFileSaveObject, D3DXFILESAVEOBJECT); +WIN_TYPES(ID3DXFileData, D3DXFILEDATA); +WIN_TYPES(ID3DXFileSaveData, D3DXFILESAVEDATA); + +#if defined( __cplusplus ) +} // extern "C" +#endif // defined( __cplusplus ) + +#endif // !defined( __D3DX9XOF_H__ ) + + diff --git a/saco/d3d9/include/ddraw.h b/saco/d3d9/include/ddraw.h new file mode 100644 index 0000000..e66314b --- /dev/null +++ b/saco/d3d9/include/ddraw.h @@ -0,0 +1,5792 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: ddraw.h + * Content: DirectDraw include file + * + ***************************************************************************/ + +#ifndef __DDRAW_INCLUDED__ +#define __DDRAW_INCLUDED__ + +//Disable the nameless union warning when building internally +#undef ENABLE_NAMELESS_UNION_PRAGMA +#ifdef DIRECTX_REDIST +#define ENABLE_NAMELESS_UNION_PRAGMA +#endif + +#ifdef ENABLE_NAMELESS_UNION_PRAGMA +#pragma warning(disable:4201) +#endif + +/* + * If you wish an application built against the newest version of DirectDraw + * to run against an older DirectDraw run time then define DIRECTDRAW_VERSION + * to be the earlies version of DirectDraw you wish to run against. For, + * example if you wish an application to run against a DX 3 runtime define + * DIRECTDRAW_VERSION to be 0x0300. + */ +#ifndef DIRECTDRAW_VERSION +#define DIRECTDRAW_VERSION 0x0700 +#endif /* DIRECTDRAW_VERSION */ + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#define COM_NO_WINDOWS_H +#include +#else +#define IUnknown void +#if !defined( NT_BUILD_ENVIRONMENT ) && !defined(WINNT) + #define CO_E_NOTINITIALIZED 0x800401F0L +#endif +#endif + +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +#ifdef __cplusplus +extern "C" { +#endif + +// +// For compilers that don't support nameless unions, do a +// +// #define NONAMELESSUNION +// +// before #include +// +#ifndef DUMMYUNIONNAMEN +#if defined(__cplusplus) || !defined(NONAMELESSUNION) +#define DUMMYUNIONNAMEN(n) +#else +#define DUMMYUNIONNAMEN(n) u##n +#endif +#endif + +#ifndef MAKEFOURCC + #define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ + ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) +#endif //defined(MAKEFOURCC) + +/* + * FOURCC codes for DX compressed-texture pixel formats + */ +#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1')) +#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2')) +#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3')) +#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4')) +#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5')) + +/* + * GUIDS used by DirectDraw objects + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) + +DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); +DEFINE_GUID( CLSID_DirectDraw7, 0x3c305196,0x50db,0x11d3,0x9c,0xfe,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); +DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); +DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB ); +DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B ); +DEFINE_GUID( IID_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); +DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawColorControl, 0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 ); +DEFINE_GUID( IID_IDirectDrawGammaControl, 0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E ); + +#endif + +/*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*/ + +struct IDirectDraw; +struct IDirectDrawSurface; +struct IDirectDrawPalette; +struct IDirectDrawClipper; + +typedef struct IDirectDraw FAR *LPDIRECTDRAW; +typedef struct IDirectDraw2 FAR *LPDIRECTDRAW2; +typedef struct IDirectDraw4 FAR *LPDIRECTDRAW4; +typedef struct IDirectDraw7 FAR *LPDIRECTDRAW7; +typedef struct IDirectDrawSurface FAR *LPDIRECTDRAWSURFACE; +typedef struct IDirectDrawSurface2 FAR *LPDIRECTDRAWSURFACE2; +typedef struct IDirectDrawSurface3 FAR *LPDIRECTDRAWSURFACE3; +typedef struct IDirectDrawSurface4 FAR *LPDIRECTDRAWSURFACE4; +typedef struct IDirectDrawSurface7 FAR *LPDIRECTDRAWSURFACE7; +typedef struct IDirectDrawPalette FAR *LPDIRECTDRAWPALETTE; +typedef struct IDirectDrawClipper FAR *LPDIRECTDRAWCLIPPER; +typedef struct IDirectDrawColorControl FAR *LPDIRECTDRAWCOLORCONTROL; +typedef struct IDirectDrawGammaControl FAR *LPDIRECTDRAWGAMMACONTROL; + +typedef struct _DDFXROP FAR *LPDDFXROP; +typedef struct _DDSURFACEDESC FAR *LPDDSURFACEDESC; +typedef struct _DDSURFACEDESC2 FAR *LPDDSURFACEDESC2; +typedef struct _DDCOLORCONTROL FAR *LPDDCOLORCONTROL; + +/* + * API's + */ +#if (defined (WIN32) || defined( _WIN32 ) ) && !defined( _NO_COM ) +//#if defined( _WIN32 ) && !defined( _NO_ENUM ) + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID); + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKW)(GUID FAR *, LPWSTR, LPWSTR, LPVOID); + extern HRESULT WINAPI DirectDrawEnumerateW( LPDDENUMCALLBACKW lpCallback, LPVOID lpContext ); + extern HRESULT WINAPI DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback, LPVOID lpContext ); + /* + * Protect against old SDKs + */ + #if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); + #endif + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKEXA)(GUID FAR *, LPSTR, LPSTR, LPVOID, HMONITOR); + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKEXW)(GUID FAR *, LPWSTR, LPWSTR, LPVOID, HMONITOR); + extern HRESULT WINAPI DirectDrawEnumerateExW( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); + extern HRESULT WINAPI DirectDrawEnumerateExA( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); + typedef HRESULT (WINAPI * LPDIRECTDRAWENUMERATEEXA)( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); + typedef HRESULT (WINAPI * LPDIRECTDRAWENUMERATEEXW)( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); + + #ifdef UNICODE + typedef LPDDENUMCALLBACKW LPDDENUMCALLBACK; + #define DirectDrawEnumerate DirectDrawEnumerateW + typedef LPDDENUMCALLBACKEXW LPDDENUMCALLBACKEX; + typedef LPDIRECTDRAWENUMERATEEXW LPDIRECTDRAWENUMERATEEX; + #define DirectDrawEnumerateEx DirectDrawEnumerateExW + #else + typedef LPDDENUMCALLBACKA LPDDENUMCALLBACK; + #define DirectDrawEnumerate DirectDrawEnumerateA + typedef LPDDENUMCALLBACKEXA LPDDENUMCALLBACKEX; + typedef LPDIRECTDRAWENUMERATEEXA LPDIRECTDRAWENUMERATEEX; + #define DirectDrawEnumerateEx DirectDrawEnumerateExA + #endif + extern HRESULT WINAPI DirectDrawCreate( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter ); + extern HRESULT WINAPI DirectDrawCreateEx( GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter ); + extern HRESULT WINAPI DirectDrawCreateClipper( DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter ); +#endif +/* + * Flags for DirectDrawEnumerateEx + * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to + * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx. + * By default, only the primary display device is enumerated. + * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES) + */ + +/* + * This flag causes enumeration of any GDI display devices which are part of + * the Windows Desktop + */ +#define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001L + +/* + * This flag causes enumeration of any GDI display devices which are not + * part of the Windows Desktop + */ +#define DDENUM_DETACHEDSECONDARYDEVICES 0x00000002L + +/* + * This flag causes enumeration of non-display devices + */ +#define DDENUM_NONDISPLAYDEVICES 0x00000004L + + +#define REGSTR_KEY_DDHW_DESCRIPTION "Description" +#define REGSTR_KEY_DDHW_DRIVERNAME "DriverName" +#define REGSTR_PATH_DDHW "Hardware\\DirectDrawDrivers" + +#define DDCREATE_HARDWAREONLY 0x00000001l +#define DDCREATE_EMULATIONONLY 0x00000002l + +#if defined(WINNT) || !defined(WIN32) +typedef long HRESULT; +#endif + +//#ifndef WINNT +typedef HRESULT (FAR PASCAL * LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMMODESCALLBACK2)(LPDDSURFACEDESC2, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMSURFACESCALLBACK2)(LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMSURFACESCALLBACK7)(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); +//#endif + +/* + * Generic pixel format with 8-bit RGB and alpha components + */ +typedef struct _DDARGB +{ + BYTE blue; + BYTE green; + BYTE red; + BYTE alpha; +} DDARGB; + +typedef DDARGB FAR *LPDDARGB; + +/* + * This version of the structure remains for backwards source compatibility. + * The DDARGB structure is the one that should be used for all DirectDraw APIs. + */ +typedef struct _DDRGBA +{ + BYTE red; + BYTE green; + BYTE blue; + BYTE alpha; +} DDRGBA; + +typedef DDRGBA FAR *LPDDRGBA; + + +/* + * DDCOLORKEY + */ +typedef struct _DDCOLORKEY +{ + DWORD dwColorSpaceLowValue; // low boundary of color space that is to + // be treated as Color Key, inclusive + DWORD dwColorSpaceHighValue; // high boundary of color space that is + // to be treated as Color Key, inclusive +} DDCOLORKEY; + +typedef DDCOLORKEY FAR* LPDDCOLORKEY; + +/* + * DDBLTFX + * Used to pass override information to the DIRECTDRAWSURFACE callback Blt. + */ +typedef struct _DDBLTFX +{ + DWORD dwSize; // size of structure + DWORD dwDDFX; // FX operations + DWORD dwROP; // Win32 raster operations + DWORD dwDDROP; // Raster operations new for DirectDraw + DWORD dwRotationAngle; // Rotation angle for blt + DWORD dwZBufferOpCode; // ZBuffer compares + DWORD dwZBufferLow; // Low limit of Z buffer + DWORD dwZBufferHigh; // High limit of Z buffer + DWORD dwZBufferBaseDest; // Destination base value + DWORD dwZDestConstBitDepth; // Bit depth used to specify Z constant for destination + union + { + DWORD dwZDestConst; // Constant to use as Z buffer for dest + LPDIRECTDRAWSURFACE lpDDSZBufferDest; // Surface to use as Z buffer for dest + } DUMMYUNIONNAMEN(1); + DWORD dwZSrcConstBitDepth; // Bit depth used to specify Z constant for source + union + { + DWORD dwZSrcConst; // Constant to use as Z buffer for src + LPDIRECTDRAWSURFACE lpDDSZBufferSrc; // Surface to use as Z buffer for src + } DUMMYUNIONNAMEN(2); + DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend + DWORD dwAlphaEdgeBlend; // Alpha for edge blending + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination + union + { + DWORD dwAlphaDestConst; // Constant to use as Alpha Channel + LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as Alpha Channel + } DUMMYUNIONNAMEN(3); + DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source + union + { + DWORD dwAlphaSrcConst; // Constant to use as Alpha Channel + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as Alpha Channel + } DUMMYUNIONNAMEN(4); + union + { + DWORD dwFillColor; // color in RGB or Palettized + DWORD dwFillDepth; // depth value for z-buffer + DWORD dwFillPixel; // pixel value for RGBA or RGBZ + LPDIRECTDRAWSURFACE lpDDSPattern; // Surface to use as pattern + } DUMMYUNIONNAMEN(5); + DDCOLORKEY ddckDestColorkey; // DestColorkey override + DDCOLORKEY ddckSrcColorkey; // SrcColorkey override +} DDBLTFX; + +typedef DDBLTFX FAR* LPDDBLTFX; + + + +/* + * DDSCAPS + */ +typedef struct _DDSCAPS +{ + DWORD dwCaps; // capabilities of surface wanted +} DDSCAPS; + +typedef DDSCAPS FAR* LPDDSCAPS; + + +/* + * DDOSCAPS + */ +typedef struct _DDOSCAPS +{ + DWORD dwCaps; // capabilities of surface wanted +} DDOSCAPS; + +typedef DDOSCAPS FAR* LPDDOSCAPS; + +/* + * This structure is used internally by DirectDraw. + */ +typedef struct _DDSCAPSEX +{ + DWORD dwCaps2; + DWORD dwCaps3; + union + { + DWORD dwCaps4; + DWORD dwVolumeDepth; + } DUMMYUNIONNAMEN(1); +} DDSCAPSEX, FAR * LPDDSCAPSEX; + +/* + * DDSCAPS2 + */ +typedef struct _DDSCAPS2 +{ + DWORD dwCaps; // capabilities of surface wanted + DWORD dwCaps2; + DWORD dwCaps3; + union + { + DWORD dwCaps4; + DWORD dwVolumeDepth; + } DUMMYUNIONNAMEN(1); +} DDSCAPS2; + +typedef DDSCAPS2 FAR* LPDDSCAPS2; + +/* + * DDCAPS + */ +#define DD_ROP_SPACE (256/32) // space required to store ROP array +/* + * NOTE: Our choosen structure number scheme is to append a single digit to + * the end of the structure giving the version that structure is associated + * with. + */ + +/* + * This structure represents the DDCAPS structure released in DirectDraw 1.0. It is used internally + * by DirectDraw to interpret caps passed into ddraw by drivers written prior to the release of DirectDraw 2.0. + * New applications should use the DDCAPS structure defined below. + */ +typedef struct _DDCAPS_DX1 +{ + DWORD dwSize; // size of the DDDRIVERCAPS structure + DWORD dwCaps; // driver specific capabilities + DWORD dwCaps2; // more driver specific capabilites + DWORD dwCKeyCaps; // color key capabilities of the surface + DWORD dwFXCaps; // driver specific stretching and effects capabilites + DWORD dwFXAlphaCaps; // alpha driver specific capabilities + DWORD dwPalCaps; // palette capabilities + DWORD dwSVCaps; // stereo vision capabilities + DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 + DWORD dwVidMemTotal; // total amount of video memory + DWORD dwVidMemFree; // amount of free video memory + DWORD dwMaxVisibleOverlays; // maximum number of visible overlays + DWORD dwCurrVisibleOverlays; // current number of visible overlays + DWORD dwNumFourCCCodes; // number of four cc codes + DWORD dwAlignBoundarySrc; // source rectangle alignment + DWORD dwAlignSizeSrc; // source rectangle byte size + DWORD dwAlignBoundaryDest; // dest rectangle alignment + DWORD dwAlignSizeDest; // dest rectangle byte size + DWORD dwAlignStrideAlign; // stride alignment + DWORD dwRops[DD_ROP_SPACE]; // ROPS supported + DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities + DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinLiveVideoStretch; // OBSOLETE! This field remains for compatability reasons only + DWORD dwMaxLiveVideoStretch; // OBSOLETE! This field remains for compatability reasons only + DWORD dwMinHwCodecStretch; // OBSOLETE! This field remains for compatability reasons only + DWORD dwMaxHwCodecStretch; // OBSOLETE! This field remains for compatability reasons only + DWORD dwReserved1; // reserved + DWORD dwReserved2; // reserved + DWORD dwReserved3; // reserved +} DDCAPS_DX1; + +typedef DDCAPS_DX1 FAR* LPDDCAPS_DX1; + +/* + * This structure is the DDCAPS structure as it was in version 2 and 3 of Direct X. + * It is present for back compatability. + */ +typedef struct _DDCAPS_DX3 +{ + DWORD dwSize; // size of the DDDRIVERCAPS structure + DWORD dwCaps; // driver specific capabilities + DWORD dwCaps2; // more driver specific capabilites + DWORD dwCKeyCaps; // color key capabilities of the surface + DWORD dwFXCaps; // driver specific stretching and effects capabilites + DWORD dwFXAlphaCaps; // alpha driver specific capabilities + DWORD dwPalCaps; // palette capabilities + DWORD dwSVCaps; // stereo vision capabilities + DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 + DWORD dwVidMemTotal; // total amount of video memory + DWORD dwVidMemFree; // amount of free video memory + DWORD dwMaxVisibleOverlays; // maximum number of visible overlays + DWORD dwCurrVisibleOverlays; // current number of visible overlays + DWORD dwNumFourCCCodes; // number of four cc codes + DWORD dwAlignBoundarySrc; // source rectangle alignment + DWORD dwAlignSizeSrc; // source rectangle byte size + DWORD dwAlignBoundaryDest; // dest rectangle alignment + DWORD dwAlignSizeDest; // dest rectangle byte size + DWORD dwAlignStrideAlign; // stride alignment + DWORD dwRops[DD_ROP_SPACE]; // ROPS supported + DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities + DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwReserved1; // reserved + DWORD dwReserved2; // reserved + DWORD dwReserved3; // reserved + DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts + DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts + DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts + DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts + DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts + DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts + DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts + DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts + DWORD dwSSBCaps; // driver specific capabilities for System->System blts + DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts + DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts + DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts + DWORD dwReserved4; // reserved + DWORD dwReserved5; // reserved + DWORD dwReserved6; // reserved +} DDCAPS_DX3; +typedef DDCAPS_DX3 FAR* LPDDCAPS_DX3; + +/* + * This structure is the DDCAPS structure as it was in version 5 of Direct X. + * It is present for back compatability. + */ +typedef struct _DDCAPS_DX5 +{ +/* 0*/ DWORD dwSize; // size of the DDDRIVERCAPS structure +/* 4*/ DWORD dwCaps; // driver specific capabilities +/* 8*/ DWORD dwCaps2; // more driver specific capabilites +/* c*/ DWORD dwCKeyCaps; // color key capabilities of the surface +/* 10*/ DWORD dwFXCaps; // driver specific stretching and effects capabilites +/* 14*/ DWORD dwFXAlphaCaps; // alpha driver specific capabilities +/* 18*/ DWORD dwPalCaps; // palette capabilities +/* 1c*/ DWORD dwSVCaps; // stereo vision capabilities +/* 20*/ DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 +/* 24*/ DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 +/* 28*/ DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 +/* 2c*/ DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 +/* 30*/ DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 +/* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 +/* 38*/ DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 +/* 3c*/ DWORD dwVidMemTotal; // total amount of video memory +/* 40*/ DWORD dwVidMemFree; // amount of free video memory +/* 44*/ DWORD dwMaxVisibleOverlays; // maximum number of visible overlays +/* 48*/ DWORD dwCurrVisibleOverlays; // current number of visible overlays +/* 4c*/ DWORD dwNumFourCCCodes; // number of four cc codes +/* 50*/ DWORD dwAlignBoundarySrc; // source rectangle alignment +/* 54*/ DWORD dwAlignSizeSrc; // source rectangle byte size +/* 58*/ DWORD dwAlignBoundaryDest; // dest rectangle alignment +/* 5c*/ DWORD dwAlignSizeDest; // dest rectangle byte size +/* 60*/ DWORD dwAlignStrideAlign; // stride alignment +/* 64*/ DWORD dwRops[DD_ROP_SPACE]; // ROPS supported +/* 84*/ DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities +/* 88*/ DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 8c*/ DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 90*/ DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 94*/ DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 98*/ DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 9c*/ DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* a0*/ DWORD dwReserved1; // reserved +/* a4*/ DWORD dwReserved2; // reserved +/* a8*/ DWORD dwReserved3; // reserved +/* ac*/ DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts +/* b0*/ DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts +/* b4*/ DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts +/* b8*/ DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts +/* d8*/ DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts +/* dc*/ DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts +/* e0*/ DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts +/* e4*/ DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts +/*104*/ DWORD dwSSBCaps; // driver specific capabilities for System->System blts +/*108*/ DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts +/*10c*/ DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts +/*110*/ DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts +// Members added for DX5: +/*130*/ DWORD dwMaxVideoPorts; // maximum number of usable video ports +/*134*/ DWORD dwCurrVideoPorts; // current number of video ports used +/*138*/ DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts +/*13c*/ DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts +/*140*/ DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts +/*144*/ DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts +/*148*/ DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts +/*14c*/ DWORD dwNLVBRops[DD_ROP_SPACE]; // ROPS supported for non-local->local blts +} DDCAPS_DX5; +typedef DDCAPS_DX5 FAR* LPDDCAPS_DX5; + +typedef struct _DDCAPS_DX6 +{ +/* 0*/ DWORD dwSize; // size of the DDDRIVERCAPS structure +/* 4*/ DWORD dwCaps; // driver specific capabilities +/* 8*/ DWORD dwCaps2; // more driver specific capabilites +/* c*/ DWORD dwCKeyCaps; // color key capabilities of the surface +/* 10*/ DWORD dwFXCaps; // driver specific stretching and effects capabilites +/* 14*/ DWORD dwFXAlphaCaps; // alpha caps +/* 18*/ DWORD dwPalCaps; // palette capabilities +/* 1c*/ DWORD dwSVCaps; // stereo vision capabilities +/* 20*/ DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 +/* 24*/ DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 +/* 28*/ DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 +/* 2c*/ DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 +/* 30*/ DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 +/* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 +/* 38*/ DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 +/* 3c*/ DWORD dwVidMemTotal; // total amount of video memory +/* 40*/ DWORD dwVidMemFree; // amount of free video memory +/* 44*/ DWORD dwMaxVisibleOverlays; // maximum number of visible overlays +/* 48*/ DWORD dwCurrVisibleOverlays; // current number of visible overlays +/* 4c*/ DWORD dwNumFourCCCodes; // number of four cc codes +/* 50*/ DWORD dwAlignBoundarySrc; // source rectangle alignment +/* 54*/ DWORD dwAlignSizeSrc; // source rectangle byte size +/* 58*/ DWORD dwAlignBoundaryDest; // dest rectangle alignment +/* 5c*/ DWORD dwAlignSizeDest; // dest rectangle byte size +/* 60*/ DWORD dwAlignStrideAlign; // stride alignment +/* 64*/ DWORD dwRops[DD_ROP_SPACE]; // ROPS supported +/* 84*/ DDSCAPS ddsOldCaps; // Was DDSCAPS ddsCaps. ddsCaps is of type DDSCAPS2 for DX6 +/* 88*/ DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 8c*/ DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 90*/ DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 94*/ DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 98*/ DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 9c*/ DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* a0*/ DWORD dwReserved1; // reserved +/* a4*/ DWORD dwReserved2; // reserved +/* a8*/ DWORD dwReserved3; // reserved +/* ac*/ DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts +/* b0*/ DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts +/* b4*/ DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts +/* b8*/ DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts +/* d8*/ DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts +/* dc*/ DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts +/* e0*/ DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts +/* e4*/ DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts +/*104*/ DWORD dwSSBCaps; // driver specific capabilities for System->System blts +/*108*/ DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts +/*10c*/ DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts +/*110*/ DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts +/*130*/ DWORD dwMaxVideoPorts; // maximum number of usable video ports +/*134*/ DWORD dwCurrVideoPorts; // current number of video ports used +/*138*/ DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts +/*13c*/ DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts +/*140*/ DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts +/*144*/ DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts +/*148*/ DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts +/*14c*/ DWORD dwNLVBRops[DD_ROP_SPACE]; // ROPS supported for non-local->local blts +// Members added for DX6 release +/*16c*/ DDSCAPS2 ddsCaps; // Surface Caps +} DDCAPS_DX6; +typedef DDCAPS_DX6 FAR* LPDDCAPS_DX6; + +typedef struct _DDCAPS_DX7 +{ +/* 0*/ DWORD dwSize; // size of the DDDRIVERCAPS structure +/* 4*/ DWORD dwCaps; // driver specific capabilities +/* 8*/ DWORD dwCaps2; // more driver specific capabilites +/* c*/ DWORD dwCKeyCaps; // color key capabilities of the surface +/* 10*/ DWORD dwFXCaps; // driver specific stretching and effects capabilites +/* 14*/ DWORD dwFXAlphaCaps; // alpha driver specific capabilities +/* 18*/ DWORD dwPalCaps; // palette capabilities +/* 1c*/ DWORD dwSVCaps; // stereo vision capabilities +/* 20*/ DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 +/* 24*/ DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 +/* 28*/ DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 +/* 2c*/ DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 +/* 30*/ DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 +/* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 +/* 38*/ DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 +/* 3c*/ DWORD dwVidMemTotal; // total amount of video memory +/* 40*/ DWORD dwVidMemFree; // amount of free video memory +/* 44*/ DWORD dwMaxVisibleOverlays; // maximum number of visible overlays +/* 48*/ DWORD dwCurrVisibleOverlays; // current number of visible overlays +/* 4c*/ DWORD dwNumFourCCCodes; // number of four cc codes +/* 50*/ DWORD dwAlignBoundarySrc; // source rectangle alignment +/* 54*/ DWORD dwAlignSizeSrc; // source rectangle byte size +/* 58*/ DWORD dwAlignBoundaryDest; // dest rectangle alignment +/* 5c*/ DWORD dwAlignSizeDest; // dest rectangle byte size +/* 60*/ DWORD dwAlignStrideAlign; // stride alignment +/* 64*/ DWORD dwRops[DD_ROP_SPACE]; // ROPS supported +/* 84*/ DDSCAPS ddsOldCaps; // Was DDSCAPS ddsCaps. ddsCaps is of type DDSCAPS2 for DX6 +/* 88*/ DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 8c*/ DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 90*/ DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 94*/ DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 98*/ DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 9c*/ DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* a0*/ DWORD dwReserved1; // reserved +/* a4*/ DWORD dwReserved2; // reserved +/* a8*/ DWORD dwReserved3; // reserved +/* ac*/ DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts +/* b0*/ DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts +/* b4*/ DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts +/* b8*/ DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts +/* d8*/ DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts +/* dc*/ DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts +/* e0*/ DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts +/* e4*/ DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts +/*104*/ DWORD dwSSBCaps; // driver specific capabilities for System->System blts +/*108*/ DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts +/*10c*/ DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts +/*110*/ DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts +/*130*/ DWORD dwMaxVideoPorts; // maximum number of usable video ports +/*134*/ DWORD dwCurrVideoPorts; // current number of video ports used +/*138*/ DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts +/*13c*/ DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts +/*140*/ DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts +/*144*/ DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts +/*148*/ DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts +/*14c*/ DWORD dwNLVBRops[DD_ROP_SPACE]; // ROPS supported for non-local->local blts +// Members added for DX6 release +/*16c*/ DDSCAPS2 ddsCaps; // Surface Caps +} DDCAPS_DX7; +typedef DDCAPS_DX7 FAR* LPDDCAPS_DX7; + + +#if DIRECTDRAW_VERSION <= 0x300 + typedef DDCAPS_DX3 DDCAPS; +#elif DIRECTDRAW_VERSION <= 0x500 + typedef DDCAPS_DX5 DDCAPS; +#elif DIRECTDRAW_VERSION <= 0x600 + typedef DDCAPS_DX6 DDCAPS; +#else + typedef DDCAPS_DX7 DDCAPS; +#endif + +typedef DDCAPS FAR* LPDDCAPS; + + + +/* + * DDPIXELFORMAT + */ +typedef struct _DDPIXELFORMAT +{ + DWORD dwSize; // size of structure + DWORD dwFlags; // pixel format flags + DWORD dwFourCC; // (FOURCC code) + union + { + DWORD dwRGBBitCount; // how many bits per pixel + DWORD dwYUVBitCount; // how many bits per pixel + DWORD dwZBufferBitDepth; // how many total bits/pixel in z buffer (including any stencil bits) + DWORD dwAlphaBitDepth; // how many bits for alpha channels + DWORD dwLuminanceBitCount; // how many bits per pixel + DWORD dwBumpBitCount; // how many bits per "buxel", total + DWORD dwPrivateFormatBitCount;// Bits per pixel of private driver formats. Only valid in texture + // format list and if DDPF_D3DFORMAT is set + } DUMMYUNIONNAMEN(1); + union + { + DWORD dwRBitMask; // mask for red bit + DWORD dwYBitMask; // mask for Y bits + DWORD dwStencilBitDepth; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits) + DWORD dwLuminanceBitMask; // mask for luminance bits + DWORD dwBumpDuBitMask; // mask for bump map U delta bits + DWORD dwOperations; // DDPF_D3DFORMAT Operations + } DUMMYUNIONNAMEN(2); + union + { + DWORD dwGBitMask; // mask for green bits + DWORD dwUBitMask; // mask for U bits + DWORD dwZBitMask; // mask for Z bits + DWORD dwBumpDvBitMask; // mask for bump map V delta bits + struct + { + WORD wFlipMSTypes; // Multisample methods supported via flip for this D3DFORMAT + WORD wBltMSTypes; // Multisample methods supported via blt for this D3DFORMAT + } MultiSampleCaps; + + } DUMMYUNIONNAMEN(3); + union + { + DWORD dwBBitMask; // mask for blue bits + DWORD dwVBitMask; // mask for V bits + DWORD dwStencilBitMask; // mask for stencil bits + DWORD dwBumpLuminanceBitMask; // mask for luminance in bump map + } DUMMYUNIONNAMEN(4); + union + { + DWORD dwRGBAlphaBitMask; // mask for alpha channel + DWORD dwYUVAlphaBitMask; // mask for alpha channel + DWORD dwLuminanceAlphaBitMask;// mask for alpha channel + DWORD dwRGBZBitMask; // mask for Z channel + DWORD dwYUVZBitMask; // mask for Z channel + } DUMMYUNIONNAMEN(5); +} DDPIXELFORMAT; + +typedef DDPIXELFORMAT FAR* LPDDPIXELFORMAT; + +/* + * DDOVERLAYFX + */ +typedef struct _DDOVERLAYFX +{ + DWORD dwSize; // size of structure + DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend + DWORD dwAlphaEdgeBlend; // Constant to use as alpha for edge blend + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination + union + { + DWORD dwAlphaDestConst; // Constant to use as alpha channel for dest + LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as alpha channel for dest + } DUMMYUNIONNAMEN(1); + DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source + union + { + DWORD dwAlphaSrcConst; // Constant to use as alpha channel for src + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as alpha channel for src + } DUMMYUNIONNAMEN(2); + DDCOLORKEY dckDestColorkey; // DestColorkey override + DDCOLORKEY dckSrcColorkey; // DestColorkey override + DWORD dwDDFX; // Overlay FX + DWORD dwFlags; // flags +} DDOVERLAYFX; + +typedef DDOVERLAYFX FAR *LPDDOVERLAYFX; + + +/* + * DDBLTBATCH: BltBatch entry structure + */ +typedef struct _DDBLTBATCH +{ + LPRECT lprDest; + LPDIRECTDRAWSURFACE lpDDSSrc; + LPRECT lprSrc; + DWORD dwFlags; + LPDDBLTFX lpDDBltFx; +} DDBLTBATCH; + +typedef DDBLTBATCH FAR * LPDDBLTBATCH; + + +/* + * DDGAMMARAMP + */ +typedef struct _DDGAMMARAMP +{ + WORD red[256]; + WORD green[256]; + WORD blue[256]; +} DDGAMMARAMP; +typedef DDGAMMARAMP FAR * LPDDGAMMARAMP; + +/* + * This is the structure within which DirectDraw returns data about the current graphics driver and chipset + */ + +#define MAX_DDDEVICEID_STRING 512 + +typedef struct tagDDDEVICEIDENTIFIER +{ + /* + * These elements are for presentation to the user only. They should not be used to identify particular + * drivers, since this is unreliable and many different strings may be associated with the same + * device, and the same driver from different vendors. + */ + char szDriver[MAX_DDDEVICEID_STRING]; + char szDescription[MAX_DDDEVICEID_STRING]; + + /* + * This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons + * on the whole 64 bits. Caution should be exercised if you use this element to identify problematic + * drivers. It is recommended that guidDeviceIdentifier is used for this purpose. + * + * This version has the form: + * wProduct = HIWORD(liDriverVersion.HighPart) + * wVersion = LOWORD(liDriverVersion.HighPart) + * wSubVersion = HIWORD(liDriverVersion.LowPart) + * wBuild = LOWORD(liDriverVersion.LowPart) + */ +#ifdef _WIN32 + LARGE_INTEGER liDriverVersion; /* Defined for applications and other 32 bit components */ +#else + DWORD dwDriverVersionLowPart; /* Defined for 16 bit driver components */ + DWORD dwDriverVersionHighPart; +#endif + + + /* + * These elements can be used to identify particular chipsets. Use with extreme caution. + * dwVendorId Identifies the manufacturer. May be zero if unknown. + * dwDeviceId Identifies the type of chipset. May be zero if unknown. + * dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. + * dwRevision Identifies the revision level of the chipset. May be zero if unknown. + */ + DWORD dwVendorId; + DWORD dwDeviceId; + DWORD dwSubSysId; + DWORD dwRevision; + + /* + * This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the + * driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to + * reprofile the graphics subsystem. + * This element can also be used to identify particular problematic drivers. + */ + GUID guidDeviceIdentifier; +} DDDEVICEIDENTIFIER, * LPDDDEVICEIDENTIFIER; + +typedef struct tagDDDEVICEIDENTIFIER2 +{ + /* + * These elements are for presentation to the user only. They should not be used to identify particular + * drivers, since this is unreliable and many different strings may be associated with the same + * device, and the same driver from different vendors. + */ + char szDriver[MAX_DDDEVICEID_STRING]; + char szDescription[MAX_DDDEVICEID_STRING]; + + /* + * This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons + * on the whole 64 bits. Caution should be exercised if you use this element to identify problematic + * drivers. It is recommended that guidDeviceIdentifier is used for this purpose. + * + * This version has the form: + * wProduct = HIWORD(liDriverVersion.HighPart) + * wVersion = LOWORD(liDriverVersion.HighPart) + * wSubVersion = HIWORD(liDriverVersion.LowPart) + * wBuild = LOWORD(liDriverVersion.LowPart) + */ +#ifdef _WIN32 + LARGE_INTEGER liDriverVersion; /* Defined for applications and other 32 bit components */ +#else + DWORD dwDriverVersionLowPart; /* Defined for 16 bit driver components */ + DWORD dwDriverVersionHighPart; +#endif + + + /* + * These elements can be used to identify particular chipsets. Use with extreme caution. + * dwVendorId Identifies the manufacturer. May be zero if unknown. + * dwDeviceId Identifies the type of chipset. May be zero if unknown. + * dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. + * dwRevision Identifies the revision level of the chipset. May be zero if unknown. + */ + DWORD dwVendorId; + DWORD dwDeviceId; + DWORD dwSubSysId; + DWORD dwRevision; + + /* + * This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the + * driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to + * reprofile the graphics subsystem. + * This element can also be used to identify particular problematic drivers. + */ + GUID guidDeviceIdentifier; + + /* + * This element is used to determine the Windows Hardware Quality Lab (WHQL) + * certification level for this driver/device pair. + */ + DWORD dwWHQLLevel; + +} DDDEVICEIDENTIFIER2, * LPDDDEVICEIDENTIFIER2; + +/* + * Flags for the IDirectDraw4::GetDeviceIdentifier method + */ + +/* + * This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped + * with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the + * host adapter, but is typically physcially located on a separate card. The stacked secondary's information is + * returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities + * of the DirectDraw object involved. + */ +#define DDGDI_GETHOSTIDENTIFIER 0x00000001L + +/* + * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel + */ +#define GET_WHQL_YEAR( dwWHQLLevel ) \ + ( (dwWHQLLevel) / 0x10000 ) +#define GET_WHQL_MONTH( dwWHQLLevel ) \ + ( ( (dwWHQLLevel) / 0x100 ) & 0x00ff ) +#define GET_WHQL_DAY( dwWHQLLevel ) \ + ( (dwWHQLLevel) & 0xff ) + + +/* + * callbacks + */ +typedef DWORD (FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper, HWND hWnd, DWORD code, LPVOID lpContext ); +#ifdef STREAMING +typedef DWORD (FAR PASCAL *LPSURFACESTREAMINGCALLBACK)(DWORD); +#endif + + +/* + * INTERACES FOLLOW: + * IDirectDraw + * IDirectDrawClipper + * IDirectDrawPalette + * IDirectDrawSurface + */ + +/* + * IDirectDraw + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw +DECLARE_INTERFACE_( IDirectDraw, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw_SetDisplayMode(p, a, b, c) (p)->lpVtbl->SetDisplayMode(p, a, b, c) +#define IDirectDraw_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#else +#define IDirectDraw_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDraw_AddRef(p) (p)->AddRef() +#define IDirectDraw_Release(p) (p)->Release() +#define IDirectDraw_Compact(p) (p)->Compact() +#define IDirectDraw_CreateClipper(p, a, b, c) (p)->CreateClipper(a, b, c) +#define IDirectDraw_CreatePalette(p, a, b, c, d) (p)->CreatePalette(a, b, c, d) +#define IDirectDraw_CreateSurface(p, a, b, c) (p)->CreateSurface(a, b, c) +#define IDirectDraw_DuplicateSurface(p, a, b) (p)->DuplicateSurface(a, b) +#define IDirectDraw_EnumDisplayModes(p, a, b, c, d) (p)->EnumDisplayModes(a, b, c, d) +#define IDirectDraw_EnumSurfaces(p, a, b, c, d) (p)->EnumSurfaces(a, b, c, d) +#define IDirectDraw_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw_GetCaps(p, a, b) (p)->GetCaps(a, b) +#define IDirectDraw_GetDisplayMode(p, a) (p)->GetDisplayMode(a) +#define IDirectDraw_GetFourCCCodes(p, a, b) (p)->GetFourCCCodes(a, b) +#define IDirectDraw_GetGDISurface(p, a) (p)->GetGDISurface(a) +#define IDirectDraw_GetMonitorFrequency(p, a) (p)->GetMonitorFrequency(a) +#define IDirectDraw_GetScanLine(p, a) (p)->GetScanLine(a) +#define IDirectDraw_GetVerticalBlankStatus(p, a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw_Initialize(p, a) (p)->Initialize(a) +#define IDirectDraw_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw_SetCooperativeLevel(p, a, b) (p)->SetCooperativeLevel(a, b) +#define IDirectDraw_SetDisplayMode(p, a, b, c) (p)->SetDisplayMode(a, b, c) +#define IDirectDraw_WaitForVerticalBlank(p, a, b) (p)->WaitForVerticalBlank(a, b) +#endif + +#endif + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw2 +DECLARE_INTERFACE_( IDirectDraw2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS, LPDWORD, LPDWORD) PURE; +}; +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw2_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw2_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw2_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw2_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw2_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw2_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw2_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw2_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw2_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw2_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw2_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw2_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw2_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw2_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw2_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw2_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw2_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw2_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw2_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e) +#define IDirectDraw2_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw2_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) +#else +#define IDirectDraw2_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDraw2_AddRef(p) (p)->AddRef() +#define IDirectDraw2_Release(p) (p)->Release() +#define IDirectDraw2_Compact(p) (p)->Compact() +#define IDirectDraw2_CreateClipper(p, a, b, c) (p)->CreateClipper(a, b, c) +#define IDirectDraw2_CreatePalette(p, a, b, c, d) (p)->CreatePalette(a, b, c, d) +#define IDirectDraw2_CreateSurface(p, a, b, c) (p)->CreateSurface(a, b, c) +#define IDirectDraw2_DuplicateSurface(p, a, b) (p)->DuplicateSurface(a, b) +#define IDirectDraw2_EnumDisplayModes(p, a, b, c, d) (p)->EnumDisplayModes(a, b, c, d) +#define IDirectDraw2_EnumSurfaces(p, a, b, c, d) (p)->EnumSurfaces(a, b, c, d) +#define IDirectDraw2_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw2_GetCaps(p, a, b) (p)->GetCaps(a, b) +#define IDirectDraw2_GetDisplayMode(p, a) (p)->GetDisplayMode(a) +#define IDirectDraw2_GetFourCCCodes(p, a, b) (p)->GetFourCCCodes(a, b) +#define IDirectDraw2_GetGDISurface(p, a) (p)->GetGDISurface(a) +#define IDirectDraw2_GetMonitorFrequency(p, a) (p)->GetMonitorFrequency(a) +#define IDirectDraw2_GetScanLine(p, a) (p)->GetScanLine(a) +#define IDirectDraw2_GetVerticalBlankStatus(p, a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw2_Initialize(p, a) (p)->Initialize(a) +#define IDirectDraw2_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw2_SetCooperativeLevel(p, a, b) (p)->SetCooperativeLevel(a, b) +#define IDirectDraw2_SetDisplayMode(p, a, b, c, d, e) (p)->SetDisplayMode(a, b, c, d, e) +#define IDirectDraw2_WaitForVerticalBlank(p, a, b) (p)->WaitForVerticalBlank(a, b) +#define IDirectDraw2_GetAvailableVidMem(p, a, b, c) (p)->GetAvailableVidMem(a, b, c) +#endif + +#endif + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw4 +DECLARE_INTERFACE_( IDirectDraw4, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4 FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC2) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE4 FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2, LPDWORD, LPDWORD) PURE; + /*** Added in the V4 Interface ***/ + STDMETHOD(GetSurfaceFromDC) (THIS_ HDC, LPDIRECTDRAWSURFACE4 *) PURE; + STDMETHOD(RestoreAllSurfaces)(THIS) PURE; + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER, DWORD ) PURE; +}; +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw4_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw4_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw4_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw4_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw4_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw4_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw4_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw4_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw4_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw4_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw4_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw4_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw4_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw4_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw4_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw4_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw4_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw4_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw4_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw4_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw4_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw4_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e) +#define IDirectDraw4_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw4_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) +#define IDirectDraw4_GetSurfaceFromDC(p, a, b) (p)->lpVtbl->GetSurfaceFromDC(p, a, b) +#define IDirectDraw4_RestoreAllSurfaces(p) (p)->lpVtbl->RestoreAllSurfaces(p) +#define IDirectDraw4_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirectDraw4_GetDeviceIdentifier(p,a,b) (p)->lpVtbl->GetDeviceIdentifier(p,a,b) +#else +#define IDirectDraw4_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDraw4_AddRef(p) (p)->AddRef() +#define IDirectDraw4_Release(p) (p)->Release() +#define IDirectDraw4_Compact(p) (p)->Compact() +#define IDirectDraw4_CreateClipper(p, a, b, c) (p)->CreateClipper(a, b, c) +#define IDirectDraw4_CreatePalette(p, a, b, c, d) (p)->CreatePalette(a, b, c, d) +#define IDirectDraw4_CreateSurface(p, a, b, c) (p)->CreateSurface(a, b, c) +#define IDirectDraw4_DuplicateSurface(p, a, b) (p)->DuplicateSurface(a, b) +#define IDirectDraw4_EnumDisplayModes(p, a, b, c, d) (p)->EnumDisplayModes(a, b, c, d) +#define IDirectDraw4_EnumSurfaces(p, a, b, c, d) (p)->EnumSurfaces(a, b, c, d) +#define IDirectDraw4_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw4_GetCaps(p, a, b) (p)->GetCaps(a, b) +#define IDirectDraw4_GetDisplayMode(p, a) (p)->GetDisplayMode(a) +#define IDirectDraw4_GetFourCCCodes(p, a, b) (p)->GetFourCCCodes(a, b) +#define IDirectDraw4_GetGDISurface(p, a) (p)->GetGDISurface(a) +#define IDirectDraw4_GetMonitorFrequency(p, a) (p)->GetMonitorFrequency(a) +#define IDirectDraw4_GetScanLine(p, a) (p)->GetScanLine(a) +#define IDirectDraw4_GetVerticalBlankStatus(p, a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw4_Initialize(p, a) (p)->Initialize(a) +#define IDirectDraw4_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw4_SetCooperativeLevel(p, a, b) (p)->SetCooperativeLevel(a, b) +#define IDirectDraw4_SetDisplayMode(p, a, b, c, d, e) (p)->SetDisplayMode(a, b, c, d, e) +#define IDirectDraw4_WaitForVerticalBlank(p, a, b) (p)->WaitForVerticalBlank(a, b) +#define IDirectDraw4_GetAvailableVidMem(p, a, b, c) (p)->GetAvailableVidMem(a, b, c) +#define IDirectDraw4_GetSurfaceFromDC(p, a, b) (p)->GetSurfaceFromDC(a, b) +#define IDirectDraw4_RestoreAllSurfaces(p) (p)->RestoreAllSurfaces() +#define IDirectDraw4_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirectDraw4_GetDeviceIdentifier(p,a,b) (p)->GetDeviceIdentifier(a,b) +#endif + +#endif + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw7 +DECLARE_INTERFACE_( IDirectDraw7, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE7 FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7 FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK7 ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC2) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE7 FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2, LPDWORD, LPDWORD) PURE; + /*** Added in the V4 Interface ***/ + STDMETHOD(GetSurfaceFromDC) (THIS_ HDC, LPDIRECTDRAWSURFACE7 *) PURE; + STDMETHOD(RestoreAllSurfaces)(THIS) PURE; + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER2, DWORD ) PURE; + STDMETHOD(StartModeTest)(THIS_ LPSIZE, DWORD, DWORD ) PURE; + STDMETHOD(EvaluateMode)(THIS_ DWORD, DWORD * ) PURE; +}; +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw7_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw7_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw7_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw7_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw7_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw7_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw7_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw7_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw7_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw7_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw7_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw7_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw7_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw7_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw7_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw7_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw7_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw7_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw7_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw7_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e) +#define IDirectDraw7_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw7_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) +#define IDirectDraw7_GetSurfaceFromDC(p, a, b) (p)->lpVtbl->GetSurfaceFromDC(p, a, b) +#define IDirectDraw7_RestoreAllSurfaces(p) (p)->lpVtbl->RestoreAllSurfaces(p) +#define IDirectDraw7_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirectDraw7_GetDeviceIdentifier(p,a,b) (p)->lpVtbl->GetDeviceIdentifier(p,a,b) +#define IDirectDraw7_StartModeTest(p,a,b,c) (p)->lpVtbl->StartModeTest(p,a,b,c) +#define IDirectDraw7_EvaluateMode(p,a,b) (p)->lpVtbl->EvaluateMode(p,a,b) +#else +#define IDirectDraw7_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDraw7_AddRef(p) (p)->AddRef() +#define IDirectDraw7_Release(p) (p)->Release() +#define IDirectDraw7_Compact(p) (p)->Compact() +#define IDirectDraw7_CreateClipper(p, a, b, c) (p)->CreateClipper(a, b, c) +#define IDirectDraw7_CreatePalette(p, a, b, c, d) (p)->CreatePalette(a, b, c, d) +#define IDirectDraw7_CreateSurface(p, a, b, c) (p)->CreateSurface(a, b, c) +#define IDirectDraw7_DuplicateSurface(p, a, b) (p)->DuplicateSurface(a, b) +#define IDirectDraw7_EnumDisplayModes(p, a, b, c, d) (p)->EnumDisplayModes(a, b, c, d) +#define IDirectDraw7_EnumSurfaces(p, a, b, c, d) (p)->EnumSurfaces(a, b, c, d) +#define IDirectDraw7_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw7_GetCaps(p, a, b) (p)->GetCaps(a, b) +#define IDirectDraw7_GetDisplayMode(p, a) (p)->GetDisplayMode(a) +#define IDirectDraw7_GetFourCCCodes(p, a, b) (p)->GetFourCCCodes(a, b) +#define IDirectDraw7_GetGDISurface(p, a) (p)->GetGDISurface(a) +#define IDirectDraw7_GetMonitorFrequency(p, a) (p)->GetMonitorFrequency(a) +#define IDirectDraw7_GetScanLine(p, a) (p)->GetScanLine(a) +#define IDirectDraw7_GetVerticalBlankStatus(p, a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw7_Initialize(p, a) (p)->Initialize(a) +#define IDirectDraw7_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw7_SetCooperativeLevel(p, a, b) (p)->SetCooperativeLevel(a, b) +#define IDirectDraw7_SetDisplayMode(p, a, b, c, d, e) (p)->SetDisplayMode(a, b, c, d, e) +#define IDirectDraw7_WaitForVerticalBlank(p, a, b) (p)->WaitForVerticalBlank(a, b) +#define IDirectDraw7_GetAvailableVidMem(p, a, b, c) (p)->GetAvailableVidMem(a, b, c) +#define IDirectDraw7_GetSurfaceFromDC(p, a, b) (p)->GetSurfaceFromDC(a, b) +#define IDirectDraw7_RestoreAllSurfaces(p) (p)->RestoreAllSurfaces() +#define IDirectDraw7_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirectDraw7_GetDeviceIdentifier(p,a,b) (p)->GetDeviceIdentifier(a,b) +#define IDirectDraw7_StartModeTest(p,a,b,c) (p)->lpVtbl->StartModeTest(a,b,c) +#define IDirectDraw7_EvaluateMode(p,a,b) (p)->lpVtbl->EvaluateMode(a,b) +#endif + +#endif + + +/* + * IDirectDrawPalette + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawPalette +DECLARE_INTERFACE_( IDirectDrawPalette, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawPalette methods ***/ + STDMETHOD(GetCaps)(THIS_ LPDWORD) PURE; + STDMETHOD(GetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE; + STDMETHOD(SetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawPalette_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawPalette_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawPalette_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawPalette_GetCaps(p, a) (p)->lpVtbl->GetCaps(p, a) +#define IDirectDrawPalette_GetEntries(p, a, b, c, d) (p)->lpVtbl->GetEntries(p, a, b, c, d) +#define IDirectDrawPalette_Initialize(p, a, b, c) (p)->lpVtbl->Initialize(p, a, b, c) +#define IDirectDrawPalette_SetEntries(p, a, b, c, d) (p)->lpVtbl->SetEntries(p, a, b, c, d) +#else +#define IDirectDrawPalette_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDrawPalette_AddRef(p) (p)->AddRef() +#define IDirectDrawPalette_Release(p) (p)->Release() +#define IDirectDrawPalette_GetCaps(p, a) (p)->GetCaps(a) +#define IDirectDrawPalette_GetEntries(p, a, b, c, d) (p)->GetEntries(a, b, c, d) +#define IDirectDrawPalette_Initialize(p, a, b, c) (p)->Initialize(a, b, c) +#define IDirectDrawPalette_SetEntries(p, a, b, c, d) (p)->SetEntries(a, b, c, d) +#endif + +#endif + + +/* + * IDirectDrawClipper + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawClipper +DECLARE_INTERFACE_( IDirectDrawClipper, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawClipper methods ***/ + STDMETHOD(GetClipList)(THIS_ LPRECT, LPRGNDATA, LPDWORD) PURE; + STDMETHOD(GetHWnd)(THIS_ HWND FAR *) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD) PURE; + STDMETHOD(IsClipListChanged)(THIS_ BOOL FAR *) PURE; + STDMETHOD(SetClipList)(THIS_ LPRGNDATA,DWORD) PURE; + STDMETHOD(SetHWnd)(THIS_ DWORD, HWND ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawClipper_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawClipper_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawClipper_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawClipper_GetClipList(p, a, b, c) (p)->lpVtbl->GetClipList(p, a, b, c) +#define IDirectDrawClipper_GetHWnd(p, a) (p)->lpVtbl->GetHWnd(p, a) +#define IDirectDrawClipper_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b) +#define IDirectDrawClipper_IsClipListChanged(p, a) (p)->lpVtbl->IsClipListChanged(p, a) +#define IDirectDrawClipper_SetClipList(p, a, b) (p)->lpVtbl->SetClipList(p, a, b) +#define IDirectDrawClipper_SetHWnd(p, a, b) (p)->lpVtbl->SetHWnd(p, a, b) +#else +#define IDirectDrawClipper_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDrawClipper_AddRef(p) (p)->AddRef() +#define IDirectDrawClipper_Release(p) (p)->Release() +#define IDirectDrawClipper_GetClipList(p, a, b, c) (p)->GetClipList(a, b, c) +#define IDirectDrawClipper_GetHWnd(p, a) (p)->GetHWnd(a) +#define IDirectDrawClipper_Initialize(p, a, b) (p)->Initialize(a, b) +#define IDirectDrawClipper_IsClipListChanged(p, a) (p)->IsClipListChanged(a) +#define IDirectDrawClipper_SetClipList(p, a, b) (p)->SetClipList(a, b) +#define IDirectDrawClipper_SetHWnd(p, a, b) (p)->SetHWnd(a, b) +#endif + +#endif + +/* + * IDirectDrawSurface and related interfaces + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawSurface +DECLARE_INTERFACE_( IDirectDrawSurface, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#else +#define IDirectDrawSurface_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface_Release(p) (p)->Release() +#define IDirectDrawSurface_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface_Restore(p) (p)->Restore() +#define IDirectDrawSurface_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#endif + +/* + * IDirectDrawSurface2 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface2 +DECLARE_INTERFACE_( IDirectDrawSurface2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE2, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE2, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE2) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE2, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE2 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE2) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface2_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface2_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface2_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface2_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface2_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface2_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface2_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface2_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface2_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface2_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface2_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface2_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface2_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface2_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface2_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface2_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface2_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface2_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface2_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface2_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface2_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface2_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface2_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#else +#define IDirectDrawSurface2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface2_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface2_Release(p) (p)->Release() +#define IDirectDrawSurface2_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface2_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface2_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface2_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface2_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface2_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface2_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface2_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface2_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface2_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface2_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface2_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface2_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface2_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface2_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface2_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface2_Restore(p) (p)->Restore() +#define IDirectDrawSurface2_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface2_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface2_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface2_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#define IDirectDrawSurface2_GetDDInterface(p,a) (p)->GetDDInterface(a) +#define IDirectDrawSurface2_PageLock(p,a) (p)->PageLock(a) +#define IDirectDrawSurface2_PageUnlock(p,a) (p)->PageUnlock(a) +#endif + +/* + * IDirectDrawSurface3 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface3 +DECLARE_INTERFACE_( IDirectDrawSurface3, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE3) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE3, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE3, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE3) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE3, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE3 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE3,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE3) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; + /*** Added in the V3 interface ***/ + STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC, DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface3_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface3_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface3_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface3_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface3_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface3_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface3_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface3_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface3_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface3_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface3_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface3_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface3_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface3_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface3_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface3_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface3_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface3_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface3_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface3_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface3_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface3_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface3_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface3_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface3_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface3_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface3_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface3_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface3_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface3_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface3_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface3_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface3_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface3_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface3_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface3_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface3_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) (p)->lpVtbl->SetSurfaceDesc(p,a,b) +#else +#define IDirectDrawSurface3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface3_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface3_Release(p) (p)->Release() +#define IDirectDrawSurface3_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface3_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface3_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface3_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface3_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface3_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface3_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface3_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface3_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface3_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface3_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface3_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface3_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface3_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface3_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface3_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface3_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface3_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface3_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface3_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface3_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface3_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface3_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface3_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface3_Restore(p) (p)->Restore() +#define IDirectDrawSurface3_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface3_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface3_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface3_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface3_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface3_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface3_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface3_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#define IDirectDrawSurface3_GetDDInterface(p,a) (p)->GetDDInterface(a) +#define IDirectDrawSurface3_PageLock(p,a) (p)->PageLock(a) +#define IDirectDrawSurface3_PageUnlock(p,a) (p)->PageUnlock(a) +#define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) (p)->SetSurfaceDesc(a,b) +#endif + +/* + * IDirectDrawSurface4 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface4 +DECLARE_INTERFACE_( IDirectDrawSurface4, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE4) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE4, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE4, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE4) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK2) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK2) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE4, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2, LPDIRECTDRAWSURFACE4 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC2) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC2,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPRECT) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE4,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE4) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; + /*** Added in the v3 interface ***/ + STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC2, DWORD) PURE; + /*** Added in the v4 interface ***/ + STDMETHOD(SetPrivateData)(THIS_ REFGUID, LPVOID, DWORD, DWORD) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID, LPVOID, LPDWORD) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID) PURE; + STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD) PURE; + STDMETHOD(ChangeUniquenessValue)(THIS) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface4_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface4_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface4_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface4_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface4_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface4_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface4_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface4_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface4_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface4_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface4_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface4_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface4_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface4_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface4_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface4_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface4_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface4_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface4_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface4_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface4_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface4_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface4_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface4_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface4_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface4_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface4_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface4_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface4_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface4_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface4_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface4_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface4_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface4_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface4_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface4_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface4_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface4_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface4_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#define IDirectDrawSurface4_SetSurfaceDesc(p,a,b) (p)->lpVtbl->SetSurfaceDesc(p,a,b) +#define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirectDrawSurface4_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirectDrawSurface4_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirectDrawSurface4_GetUniquenessValue(p, a) (p)->lpVtbl->GetUniquenessValue(p, a) +#define IDirectDrawSurface4_ChangeUniquenessValue(p) (p)->lpVtbl->ChangeUniquenessValue(p) +#else +#define IDirectDrawSurface4_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface4_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface4_Release(p) (p)->Release() +#define IDirectDrawSurface4_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface4_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface4_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface4_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface4_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface4_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface4_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface4_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface4_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface4_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface4_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface4_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface4_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface4_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface4_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface4_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface4_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface4_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface4_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface4_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface4_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface4_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface4_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface4_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface4_Restore(p) (p)->Restore() +#define IDirectDrawSurface4_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface4_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface4_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface4_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface4_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface4_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface4_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface4_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#define IDirectDrawSurface4_GetDDInterface(p,a) (p)->GetDDInterface(a) +#define IDirectDrawSurface4_PageLock(p,a) (p)->PageLock(a) +#define IDirectDrawSurface4_PageUnlock(p,a) (p)->PageUnlock(a) +#define IDirectDrawSurface4_SetSurfaceDesc(p,a,b) (p)->SetSurfaceDesc(a,b) +#define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirectDrawSurface4_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirectDrawSurface4_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirectDrawSurface4_GetUniquenessValue(p, a) (p)->GetUniquenessValue(a) +#define IDirectDrawSurface4_ChangeUniquenessValue(p) (p)->ChangeUniquenessValue() +#endif + +/* + * IDirectDrawSurface7 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface7 +DECLARE_INTERFACE_( IDirectDrawSurface7, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE7) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE7, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE7, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE7) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK7) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK7) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE7, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2, LPDIRECTDRAWSURFACE7 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC2) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC2,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPRECT) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE7,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE7) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; + /*** Added in the v3 interface ***/ + STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC2, DWORD) PURE; + /*** Added in the v4 interface ***/ + STDMETHOD(SetPrivateData)(THIS_ REFGUID, LPVOID, DWORD, DWORD) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID, LPVOID, LPDWORD) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID) PURE; + STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD) PURE; + STDMETHOD(ChangeUniquenessValue)(THIS) PURE; + /*** Moved Texture7 methods here ***/ + STDMETHOD(SetPriority)(THIS_ DWORD) PURE; + STDMETHOD(GetPriority)(THIS_ LPDWORD) PURE; + STDMETHOD(SetLOD)(THIS_ DWORD) PURE; + STDMETHOD(GetLOD)(THIS_ LPDWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface7_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface7_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface7_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface7_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface7_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface7_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface7_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface7_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface7_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface7_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface7_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface7_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface7_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface7_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface7_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface7_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface7_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface7_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface7_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface7_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface7_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface7_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface7_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface7_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface7_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface7_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface7_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface7_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface7_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface7_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface7_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface7_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface7_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface7_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface7_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface7_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#define IDirectDrawSurface7_SetSurfaceDesc(p,a,b) (p)->lpVtbl->SetSurfaceDesc(p,a,b) +#define IDirectDrawSurface7_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirectDrawSurface7_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirectDrawSurface7_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirectDrawSurface7_GetUniquenessValue(p, a) (p)->lpVtbl->GetUniquenessValue(p, a) +#define IDirectDrawSurface7_ChangeUniquenessValue(p) (p)->lpVtbl->ChangeUniquenessValue(p) +#define IDirectDrawSurface7_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirectDrawSurface7_GetPriority(p,a) (p)->lpVtbl->GetPriority(p,a) +#define IDirectDrawSurface7_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirectDrawSurface7_GetLOD(p,a) (p)->lpVtbl->GetLOD(p,a) +#else +#define IDirectDrawSurface7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface7_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface7_Release(p) (p)->Release() +#define IDirectDrawSurface7_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface7_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface7_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface7_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface7_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface7_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface7_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface7_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface7_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface7_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface7_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface7_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface7_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface7_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface7_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface7_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface7_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface7_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface7_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface7_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface7_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface7_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface7_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface7_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface7_Restore(p) (p)->Restore() +#define IDirectDrawSurface7_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface7_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface7_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface7_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface7_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface7_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface7_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface7_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#define IDirectDrawSurface7_GetDDInterface(p,a) (p)->GetDDInterface(a) +#define IDirectDrawSurface7_PageLock(p,a) (p)->PageLock(a) +#define IDirectDrawSurface7_PageUnlock(p,a) (p)->PageUnlock(a) +#define IDirectDrawSurface7_SetSurfaceDesc(p,a,b) (p)->SetSurfaceDesc(a,b) +#define IDirectDrawSurface7_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirectDrawSurface7_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirectDrawSurface7_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirectDrawSurface7_GetUniquenessValue(p, a) (p)->GetUniquenessValue(a) +#define IDirectDrawSurface7_ChangeUniquenessValue(p) (p)->ChangeUniquenessValue() +#define IDirectDrawSurface7_SetPriority(p,a) (p)->SetPriority(a) +#define IDirectDrawSurface7_GetPriority(p,a) (p)->GetPriority(a) +#define IDirectDrawSurface7_SetLOD(p,a) (p)->SetLOD(a) +#define IDirectDrawSurface7_GetLOD(p,a) (p)->GetLOD(a) +#endif + + +/* + * IDirectDrawColorControl + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawColorControl +DECLARE_INTERFACE_( IDirectDrawColorControl, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawColorControl methods ***/ + STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL) PURE; + STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawColorControl_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawColorControl_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawColorControl_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawColorControl_GetColorControls(p, a) (p)->lpVtbl->GetColorControls(p, a) +#define IDirectDrawColorControl_SetColorControls(p, a) (p)->lpVtbl->SetColorControls(p, a) +#else +#define IDirectDrawColorControl_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDrawColorControl_AddRef(p) (p)->AddRef() +#define IDirectDrawColorControl_Release(p) (p)->Release() +#define IDirectDrawColorControl_GetColorControls(p, a) (p)->GetColorControls(a) +#define IDirectDrawColorControl_SetColorControls(p, a) (p)->SetColorControls(a) +#endif + +#endif + + +/* + * IDirectDrawGammaControl + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawGammaControl +DECLARE_INTERFACE_( IDirectDrawGammaControl, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawGammaControl methods ***/ + STDMETHOD(GetGammaRamp)(THIS_ DWORD, LPDDGAMMARAMP) PURE; + STDMETHOD(SetGammaRamp)(THIS_ DWORD, LPDDGAMMARAMP) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawGammaControl_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawGammaControl_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawGammaControl_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawGammaControl_GetGammaRamp(p, a, b) (p)->lpVtbl->GetGammaRamp(p, a, b) +#define IDirectDrawGammaControl_SetGammaRamp(p, a, b) (p)->lpVtbl->SetGammaRamp(p, a, b) +#else +#define IDirectDrawGammaControl_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDrawGammaControl_AddRef(p) (p)->AddRef() +#define IDirectDrawGammaControl_Release(p) (p)->Release() +#define IDirectDrawGammaControl_GetGammaRamp(p, a, b) (p)->GetGammaRamp(a, b) +#define IDirectDrawGammaControl_SetGammaRamp(p, a, b) (p)->SetGammaRamp(a, b) +#endif + +#endif + + + +#endif + + +/* + * DDSURFACEDESC + */ +typedef struct _DDSURFACEDESC +{ + DWORD dwSize; // size of the DDSURFACEDESC structure + DWORD dwFlags; // determines what fields are valid + DWORD dwHeight; // height of surface to be created + DWORD dwWidth; // width of input surface + union + { + LONG lPitch; // distance to start of next line (return value only) + DWORD dwLinearSize; // Formless late-allocated optimized surface size + } DUMMYUNIONNAMEN(1); + DWORD dwBackBufferCount; // number of back buffers requested + union + { + DWORD dwMipMapCount; // number of mip-map levels requested + DWORD dwZBufferBitDepth; // depth of Z buffer requested + DWORD dwRefreshRate; // refresh rate (used when display mode is described) + } DUMMYUNIONNAMEN(2); + DWORD dwAlphaBitDepth; // depth of alpha buffer requested + DWORD dwReserved; // reserved + LPVOID lpSurface; // pointer to the associated surface memory + DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use + DDCOLORKEY ddckCKDestBlt; // color key for destination blt use + DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use + DDCOLORKEY ddckCKSrcBlt; // color key for source blt use + DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface + DDSCAPS ddsCaps; // direct draw surface capabilities +} DDSURFACEDESC; + +/* + * DDSURFACEDESC2 + */ +typedef struct _DDSURFACEDESC2 +{ + DWORD dwSize; // size of the DDSURFACEDESC structure + DWORD dwFlags; // determines what fields are valid + DWORD dwHeight; // height of surface to be created + DWORD dwWidth; // width of input surface + union + { + LONG lPitch; // distance to start of next line (return value only) + DWORD dwLinearSize; // Formless late-allocated optimized surface size + } DUMMYUNIONNAMEN(1); + union + { + DWORD dwBackBufferCount; // number of back buffers requested + DWORD dwDepth; // the depth if this is a volume texture + } DUMMYUNIONNAMEN(5); + union + { + DWORD dwMipMapCount; // number of mip-map levels requestde + // dwZBufferBitDepth removed, use ddpfPixelFormat one instead + DWORD dwRefreshRate; // refresh rate (used when display mode is described) + DWORD dwSrcVBHandle; // The source used in VB::Optimize + } DUMMYUNIONNAMEN(2); + DWORD dwAlphaBitDepth; // depth of alpha buffer requested + DWORD dwReserved; // reserved + LPVOID lpSurface; // pointer to the associated surface memory + union + { + DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use + DWORD dwEmptyFaceColor; // Physical color for empty cubemap faces + } DUMMYUNIONNAMEN(3); + DDCOLORKEY ddckCKDestBlt; // color key for destination blt use + DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use + DDCOLORKEY ddckCKSrcBlt; // color key for source blt use + union + { + DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface + DWORD dwFVF; // vertex format description of vertex buffers + } DUMMYUNIONNAMEN(4); + DDSCAPS2 ddsCaps; // direct draw surface capabilities + DWORD dwTextureStage; // stage in multitexture cascade +} DDSURFACEDESC2; + +/* + * ddsCaps field is valid. + */ +#define DDSD_CAPS 0x00000001l // default + +/* + * dwHeight field is valid. + */ +#define DDSD_HEIGHT 0x00000002l + +/* + * dwWidth field is valid. + */ +#define DDSD_WIDTH 0x00000004l + +/* + * lPitch is valid. + */ +#define DDSD_PITCH 0x00000008l + +/* + * dwBackBufferCount is valid. + */ +#define DDSD_BACKBUFFERCOUNT 0x00000020l + +/* + * dwZBufferBitDepth is valid. (shouldnt be used in DDSURFACEDESC2) + */ +#define DDSD_ZBUFFERBITDEPTH 0x00000040l + +/* + * dwAlphaBitDepth is valid. + */ +#define DDSD_ALPHABITDEPTH 0x00000080l + + +/* + * lpSurface is valid. + */ +#define DDSD_LPSURFACE 0x00000800l + +/* + * ddpfPixelFormat is valid. + */ +#define DDSD_PIXELFORMAT 0x00001000l + +/* + * ddckCKDestOverlay is valid. + */ +#define DDSD_CKDESTOVERLAY 0x00002000l + +/* + * ddckCKDestBlt is valid. + */ +#define DDSD_CKDESTBLT 0x00004000l + +/* + * ddckCKSrcOverlay is valid. + */ +#define DDSD_CKSRCOVERLAY 0x00008000l + +/* + * ddckCKSrcBlt is valid. + */ +#define DDSD_CKSRCBLT 0x00010000l + +/* + * dwMipMapCount is valid. + */ +#define DDSD_MIPMAPCOUNT 0x00020000l + + /* + * dwRefreshRate is valid + */ +#define DDSD_REFRESHRATE 0x00040000l + +/* + * dwLinearSize is valid + */ +#define DDSD_LINEARSIZE 0x00080000l + +/* + * dwTextureStage is valid + */ +#define DDSD_TEXTURESTAGE 0x00100000l +/* + * dwFVF is valid + */ +#define DDSD_FVF 0x00200000l +/* + * dwSrcVBHandle is valid + */ +#define DDSD_SRCVBHANDLE 0x00400000l + +/* + * dwDepth is valid + */ +#define DDSD_DEPTH 0x00800000l + +/* + * All input fields are valid. + */ +#define DDSD_ALL 0x00fff9eel + +/* + * DDOPTSURFACEDESC + */ +typedef struct _DDOPTSURFACEDESC +{ + DWORD dwSize; // size of the DDOPTSURFACEDESC structure + DWORD dwFlags; // determines what fields are valid + DDSCAPS2 ddSCaps; // Common caps like: Memory type + DDOSCAPS ddOSCaps; // Common caps like: Memory type + GUID guid; // Compression technique GUID + DWORD dwCompressionRatio; // Compression ratio +} DDOPTSURFACEDESC; + +/* + * guid field is valid. + */ +#define DDOSD_GUID 0x00000001l + +/* + * dwCompressionRatio field is valid. + */ +#define DDOSD_COMPRESSION_RATIO 0x00000002l + +/* + * ddSCaps field is valid. + */ +#define DDOSD_SCAPS 0x00000004l + +/* + * ddOSCaps field is valid. + */ +#define DDOSD_OSCAPS 0x00000008l + +/* + * All input fields are valid. + */ +#define DDOSD_ALL 0x0000000fl + +/* + * The surface's optimized pixelformat is compressed + */ +#define DDOSDCAPS_OPTCOMPRESSED 0x00000001l + +/* + * The surface's optimized pixelformat is reordered + */ +#define DDOSDCAPS_OPTREORDERED 0x00000002l + +/* + * The opt surface is a monolithic mipmap + */ +#define DDOSDCAPS_MONOLITHICMIPMAP 0x00000004l + +/* + * The valid Surf caps: + * #define DDSCAPS_SYSTEMMEMORY 0x00000800l + * #define DDSCAPS_VIDEOMEMORY 0x00004000l + * #define DDSCAPS_LOCALVIDMEM 0x10000000l + * #define DDSCAPS_NONLOCALVIDMEM 0x20000000l + */ +#define DDOSDCAPS_VALIDSCAPS 0x30004800l + +/* + * The valid OptSurf caps + */ +#define DDOSDCAPS_VALIDOSCAPS 0x00000007l + + +/* + * DDCOLORCONTROL + */ +typedef struct _DDCOLORCONTROL +{ + DWORD dwSize; + DWORD dwFlags; + LONG lBrightness; + LONG lContrast; + LONG lHue; + LONG lSaturation; + LONG lSharpness; + LONG lGamma; + LONG lColorEnable; + DWORD dwReserved1; +} DDCOLORCONTROL; + + +/* + * lBrightness field is valid. + */ +#define DDCOLOR_BRIGHTNESS 0x00000001l + +/* + * lContrast field is valid. + */ +#define DDCOLOR_CONTRAST 0x00000002l + +/* + * lHue field is valid. + */ +#define DDCOLOR_HUE 0x00000004l + +/* + * lSaturation field is valid. + */ +#define DDCOLOR_SATURATION 0x00000008l + +/* + * lSharpness field is valid. + */ +#define DDCOLOR_SHARPNESS 0x00000010l + +/* + * lGamma field is valid. + */ +#define DDCOLOR_GAMMA 0x00000020l + +/* + * lColorEnable field is valid. + */ +#define DDCOLOR_COLORENABLE 0x00000040l + + + +/*============================================================================ + * + * Direct Draw Capability Flags + * + * These flags are used to describe the capabilities of a given Surface. + * All flags are bit flags. + * + *==========================================================================*/ + +/**************************************************************************** + * + * DIRECTDRAWSURFACE CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * This bit is reserved. It should not be specified. + */ +#define DDSCAPS_RESERVED1 0x00000001l + +/* + * Indicates that this surface contains alpha-only information. + * (To determine if a surface is RGBA/YUVA, the pixel format must be + * interrogated.) + */ +#define DDSCAPS_ALPHA 0x00000002l + +/* + * Indicates that this surface is a backbuffer. It is generally + * set by CreateSurface when the DDSCAPS_FLIP capability bit is set. + * It indicates that this surface is THE back buffer of a surface + * flipping structure. DirectDraw supports N surfaces in a + * surface flipping structure. Only the surface that immediately + * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set. + * The other surfaces are identified as back buffers by the presence + * of the DDSCAPS_FLIP capability, their attachment order, and the + * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER + * capabilities. The bit is sent to CreateSurface when a standalone + * back buffer is being created. This surface could be attached to + * a front buffer and/or back buffers to form a flipping surface + * structure after the CreateSurface call. See AddAttachments for + * a detailed description of the behaviors in this case. + */ +#define DDSCAPS_BACKBUFFER 0x00000004l + +/* + * Indicates a complex surface structure is being described. A + * complex surface structure results in the creation of more than + * one surface. The additional surfaces are attached to the root + * surface. The complex structure can only be destroyed by + * destroying the root. + */ +#define DDSCAPS_COMPLEX 0x00000008l + +/* + * Indicates that this surface is a part of a surface flipping structure. + * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and + * DDSCAP_BACKBUFFER bits are not set. They are set by CreateSurface + * on the resulting creations. The dwBackBufferCount field in the + * DDSURFACEDESC structure must be set to at least 1 in order for + * the CreateSurface call to succeed. The DDSCAPS_COMPLEX capability + * must always be set with creating multiple surfaces through CreateSurface. + */ +#define DDSCAPS_FLIP 0x00000010l + +/* + * Indicates that this surface is THE front buffer of a surface flipping + * structure. It is generally set by CreateSurface when the DDSCAPS_FLIP + * capability bit is set. + * If this capability is sent to CreateSurface then a standalonw front buffer + * is created. This surface will not have the DDSCAPS_FLIP capability. + * It can be attached to other back buffers to form a flipping structure. + * See AddAttachments for a detailed description of the behaviors in this + * case. + */ +#define DDSCAPS_FRONTBUFFER 0x00000020l + +/* + * Indicates that this surface is any offscreen surface that is not an overlay, + * texture, zbuffer, front buffer, back buffer, or alpha surface. It is used + * to identify plain vanilla surfaces. + */ +#define DDSCAPS_OFFSCREENPLAIN 0x00000040l + +/* + * Indicates that this surface is an overlay. It may or may not be directly visible + * depending on whether or not it is currently being overlayed onto the primary + * surface. DDSCAPS_VISIBLE can be used to determine whether or not it is being + * overlayed at the moment. + */ +#define DDSCAPS_OVERLAY 0x00000080l + +/* + * Indicates that unique DirectDrawPalette objects can be created and + * attached to this surface. + */ +#define DDSCAPS_PALETTE 0x00000100l + +/* + * Indicates that this surface is the primary surface. The primary + * surface represents what the user is seeing at the moment. + */ +#define DDSCAPS_PRIMARYSURFACE 0x00000200l + + +/* + * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now + * obsolete. + */ +#define DDSCAPS_RESERVED3 0x00000400l +#define DDSCAPS_PRIMARYSURFACELEFT 0x00000000l + +/* + * Indicates that this surface memory was allocated in system memory + */ +#define DDSCAPS_SYSTEMMEMORY 0x00000800l + +/* + * Indicates that this surface can be used as a 3D texture. It does not + * indicate whether or not the surface is being used for that purpose. + */ +#define DDSCAPS_TEXTURE 0x00001000l + +/* + * Indicates that a surface may be a destination for 3D rendering. This + * bit must be set in order to query for a Direct3D Device Interface + * from this surface. + */ +#define DDSCAPS_3DDEVICE 0x00002000l + +/* + * Indicates that this surface exists in video memory. + */ +#define DDSCAPS_VIDEOMEMORY 0x00004000l + +/* + * Indicates that changes made to this surface are immediately visible. + * It is always set for the primary surface and is set for overlays while + * they are being overlayed and texture maps while they are being textured. + */ +#define DDSCAPS_VISIBLE 0x00008000l + +/* + * Indicates that only writes are permitted to the surface. Read accesses + * from the surface may or may not generate a protection fault, but the + * results of a read from this surface will not be meaningful. READ ONLY. + */ +#define DDSCAPS_WRITEONLY 0x00010000l + +/* + * Indicates that this surface is a z buffer. A z buffer does not contain + * displayable information. Instead it contains bit depth information that is + * used to determine which pixels are visible and which are obscured. + */ +#define DDSCAPS_ZBUFFER 0x00020000l + +/* + * Indicates surface will have a DC associated long term + */ +#define DDSCAPS_OWNDC 0x00040000l + +/* + * Indicates surface should be able to receive live video + */ +#define DDSCAPS_LIVEVIDEO 0x00080000l + +/* + * Indicates surface should be able to have a stream decompressed + * to it by the hardware. + */ +#define DDSCAPS_HWCODEC 0x00100000l + +/* + * Surface is a ModeX surface. + * + */ +#define DDSCAPS_MODEX 0x00200000l + +/* + * Indicates surface is one level of a mip-map. This surface will + * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map. + * This can be done explicitly, by creating a number of surfaces and + * attaching them with AddAttachedSurface or by implicitly by CreateSurface. + * If this bit is set then DDSCAPS_TEXTURE must also be set. + */ +#define DDSCAPS_MIPMAP 0x00400000l + +/* + * This bit is reserved. It should not be specified. + */ +#define DDSCAPS_RESERVED2 0x00800000l + + +/* + * Indicates that memory for the surface is not allocated until the surface + * is loaded (via the Direct3D texture Load() function). + */ +#define DDSCAPS_ALLOCONLOAD 0x04000000l + +/* + * Indicates that the surface will recieve data from a video port. + */ +#define DDSCAPS_VIDEOPORT 0x08000000l + +/* + * Indicates that a video memory surface is resident in true, local video + * memory rather than non-local video memory. If this flag is specified then + * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with + * DDSCAPS_NONLOCALVIDMEM. + */ +#define DDSCAPS_LOCALVIDMEM 0x10000000l + +/* + * Indicates that a video memory surface is resident in non-local video + * memory rather than true, local video memory. If this flag is specified + * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with + * DDSCAPS_LOCALVIDMEM. + */ +#define DDSCAPS_NONLOCALVIDMEM 0x20000000l + +/* + * Indicates that this surface is a standard VGA mode surface, and not a + * ModeX surface. (This flag will never be set in combination with the + * DDSCAPS_MODEX flag). + */ +#define DDSCAPS_STANDARDVGAMODE 0x40000000l + +/* + * Indicates that this surface will be an optimized surface. This flag is + * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface + * will be created without any underlying video memory until loaded. + */ +#define DDSCAPS_OPTIMIZED 0x80000000l + + + +/* + * This bit is reserved + */ +#define DDSCAPS2_RESERVED4 0x00000002L +#define DDSCAPS2_HARDWAREDEINTERLACE 0x00000000L + +/* + * Indicates to the driver that this surface will be locked very frequently + * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap + * set must also have DDSCAPS_TEXTURE. This cap cannot be used with + * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE. + */ +#define DDSCAPS2_HINTDYNAMIC 0x00000004L + +/* + * Indicates to the driver that this surface can be re-ordered/retiled on + * load. This operation will not change the size of the texture. It is + * relatively fast and symmetrical, since the application may lock these + * bits (although it will take a performance hit when doing so). Surfaces + * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be + * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE. + */ +#define DDSCAPS2_HINTSTATIC 0x00000008L + +/* + * Indicates that the client would like this texture surface to be managed by the + * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have + * DDSCAPS_TEXTURE set. + */ +#define DDSCAPS2_TEXTUREMANAGE 0x00000010L + +/* + * These bits are reserved for internal use */ +#define DDSCAPS2_RESERVED1 0x00000020L +#define DDSCAPS2_RESERVED2 0x00000040L + +/* + * Indicates to the driver that this surface will never be locked again. + * The driver is free to optimize this surface via retiling and actual compression. + * All calls to Lock() or Blts from this surface will fail. Surfaces with this + * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with + * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC. + */ +#define DDSCAPS2_OPAQUE 0x00000080L + +/* + * Applications should set this bit at CreateSurface time to indicate that they + * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set. + */ +#define DDSCAPS2_HINTANTIALIASING 0x00000100L + + +/* + * This flag is used at CreateSurface time to indicate that this set of + * surfaces is a cubic environment map + */ +#define DDSCAPS2_CUBEMAP 0x00000200L + +/* + * These flags preform two functions: + * - At CreateSurface time, they define which of the six cube faces are + * required by the application. + * - After creation, each face in the cubemap will have exactly one of these + * bits set. + */ +#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400L +#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800L +#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000L +#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000L +#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000L +#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000L + +/* + * This macro may be used to specify all faces of a cube map at CreateSurface time + */ +#define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX |\ + DDSCAPS2_CUBEMAP_NEGATIVEX |\ + DDSCAPS2_CUBEMAP_POSITIVEY |\ + DDSCAPS2_CUBEMAP_NEGATIVEY |\ + DDSCAPS2_CUBEMAP_POSITIVEZ |\ + DDSCAPS2_CUBEMAP_NEGATIVEZ ) + + +/* + * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards + * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface + * constructs such as Cube Maps, wherein there are more than one mipmap surface attached + * to the root surface. + * This caps bit is ignored by CreateSurface + */ +#define DDSCAPS2_MIPMAPSUBLEVEL 0x00010000L + +/* This flag indicates that the texture should be managed by D3D only */ +#define DDSCAPS2_D3DTEXTUREMANAGE 0x00020000L + +/* This flag indicates that the managed surface can be safely lost */ +#define DDSCAPS2_DONOTPERSIST 0x00040000L + +/* indicates that this surface is part of a stereo flipping chain */ +#define DDSCAPS2_STEREOSURFACELEFT 0x00080000L + + +/* + * Indicates that the surface is a volume. + * Can be combined with DDSCAPS_MIPMAP to indicate a multi-level volume + */ +#define DDSCAPS2_VOLUME 0x00200000L + +/* + * Indicates that the surface may be locked multiple times by the application. + * This cap cannot be used with DDSCAPS2_OPAQUE. + */ +#define DDSCAPS2_NOTUSERLOCKABLE 0x00400000L + +/* + * Indicates that the vertex buffer data can be used to render points and + * point sprites. + */ +#define DDSCAPS2_POINTS 0x00800000L + +/* + * Indicates that the vertex buffer data can be used to render rt pactches. + */ +#define DDSCAPS2_RTPATCHES 0x01000000L + +/* + * Indicates that the vertex buffer data can be used to render n patches. + */ +#define DDSCAPS2_NPATCHES 0x02000000L + +/* + * This bit is reserved for internal use + */ +#define DDSCAPS2_RESERVED3 0x04000000L + + +/* + * Indicates that the contents of the backbuffer do not have to be preserved + * the contents of the backbuffer after they are presented. + */ +#define DDSCAPS2_DISCARDBACKBUFFER 0x10000000L + +/* + * Indicates that all surfaces in this creation chain should be given an alpha channel. + * This flag will be set on primary surface chains that may have no explicit pixel format + * (and thus take on the format of the current display mode). + * The driver should infer that all these surfaces have a format having an alpha channel. + * (e.g. assume D3DFMT_A8R8G8B8 if the display mode is x888.) + */ +#define DDSCAPS2_ENABLEALPHACHANNEL 0x20000000L + +/* + * Indicates that all surfaces in this creation chain is extended primary surface format. + * This flag will be set on extended primary surface chains that always have explicit pixel + * format and the pixel format is typically GDI (Graphics Device Interface) couldn't handle, + * thus only used with fullscreen application. (e.g. D3DFMT_A2R10G10B10 format) + */ +#define DDSCAPS2_EXTENDEDFORMATPRIMARY 0x40000000L + +/* + * Indicates that all surfaces in this creation chain is additional primary surface. + * This flag will be set on primary surface chains which must present on the adapter + * id provided on dwCaps4. Typically this will be used to create secondary primary surface + * on DualView display adapter. + */ +#define DDSCAPS2_ADDITIONALPRIMARY 0x80000000L + +/* + * This is a mask that indicates the set of bits that may be set + * at createsurface time to indicate number of samples per pixel + * when multisampling + */ +#define DDSCAPS3_MULTISAMPLE_MASK 0x0000001FL + +/* + * This is a mask that indicates the set of bits that may be set + * at createsurface time to indicate the quality level of rendering + * for the current number of samples per pixel + */ +#define DDSCAPS3_MULTISAMPLE_QUALITY_MASK 0x000000E0L +#define DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT 5 + +/* + * This bit is reserved for internal use + */ +#define DDSCAPS3_RESERVED1 0x00000100L + +/* + * This bit is reserved for internal use + */ +#define DDSCAPS3_RESERVED2 0x00000200L + +/* + * This indicates whether this surface has light-weight miplevels + */ +#define DDSCAPS3_LIGHTWEIGHTMIPMAP 0x00000400L + +/* + * This indicates that the mipsublevels for this surface are auto-generated + */ +#define DDSCAPS3_AUTOGENMIPMAP 0x00000800L + +/* + * This indicates that the mipsublevels for this surface are auto-generated + */ +#define DDSCAPS3_DMAP 0x00001000L + + + /**************************************************************************** + * + * DIRECTDRAW DRIVER CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Display hardware has 3D acceleration. + */ +#define DDCAPS_3D 0x00000001l + +/* + * Indicates that DirectDraw will support only dest rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively. + * READ ONLY. + */ +#define DDCAPS_ALIGNBOUNDARYDEST 0x00000002l + +/* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively. READ ONLY. + */ +#define DDCAPS_ALIGNSIZEDEST 0x00000004l +/* + * Indicates that DirectDraw will support only source rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively. + * READ ONLY. + */ +#define DDCAPS_ALIGNBOUNDARYSRC 0x00000008l + +/* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively. READ ONLY. + */ +#define DDCAPS_ALIGNSIZESRC 0x00000010l + +/* + * Indicates that DirectDraw will create video memory surfaces that have a stride + * alignment equal to DIRECTDRAWCAPS.dwAlignStride. READ ONLY. + */ +#define DDCAPS_ALIGNSTRIDE 0x00000020l + +/* + * Display hardware is capable of blt operations. + */ +#define DDCAPS_BLT 0x00000040l + +/* + * Display hardware is capable of asynchronous blt operations. + */ +#define DDCAPS_BLTQUEUE 0x00000080l + +/* + * Display hardware is capable of color space conversions during the blt operation. + */ +#define DDCAPS_BLTFOURCC 0x00000100l + +/* + * Display hardware is capable of stretching during blt operations. + */ +#define DDCAPS_BLTSTRETCH 0x00000200l + +/* + * Display hardware is shared with GDI. + */ +#define DDCAPS_GDI 0x00000400l + +/* + * Display hardware can overlay. + */ +#define DDCAPS_OVERLAY 0x00000800l + +/* + * Set if display hardware supports overlays but can not clip them. + */ +#define DDCAPS_OVERLAYCANTCLIP 0x00001000l + +/* + * Indicates that overlay hardware is capable of color space conversions during + * the overlay operation. + */ +#define DDCAPS_OVERLAYFOURCC 0x00002000l + +/* + * Indicates that stretching can be done by the overlay hardware. + */ +#define DDCAPS_OVERLAYSTRETCH 0x00004000l + +/* + * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces + * other than the primary surface. + */ +#define DDCAPS_PALETTE 0x00008000l + +/* + * Indicates that palette changes can be syncd with the veritcal refresh. + */ +#define DDCAPS_PALETTEVSYNC 0x00010000l + +/* + * Display hardware can return the current scan line. + */ +#define DDCAPS_READSCANLINE 0x00020000l + + +/* + * This flag used to bo DDCAPS_STEREOVIEW, which is now obsolete + */ +#define DDCAPS_RESERVED1 0x00040000l + +/* + * Display hardware is capable of generating a vertical blank interrupt. + */ +#define DDCAPS_VBI 0x00080000l + +/* + * Supports the use of z buffers with blt operations. + */ +#define DDCAPS_ZBLTS 0x00100000l + +/* + * Supports Z Ordering of overlays. + */ +#define DDCAPS_ZOVERLAYS 0x00200000l + +/* + * Supports color key + */ +#define DDCAPS_COLORKEY 0x00400000l + +/* + * Supports alpha surfaces + */ +#define DDCAPS_ALPHA 0x00800000l + +/* + * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set) + */ +#define DDCAPS_COLORKEYHWASSIST 0x01000000l + +/* + * no hardware support at all + */ +#define DDCAPS_NOHARDWARE 0x02000000l + +/* + * Display hardware is capable of color fill with bltter + */ +#define DDCAPS_BLTCOLORFILL 0x04000000l + +/* + * Display hardware is bank switched, and potentially very slow at + * random access to VRAM. + */ +#define DDCAPS_BANKSWITCHED 0x08000000l + +/* + * Display hardware is capable of depth filling Z-buffers with bltter + */ +#define DDCAPS_BLTDEPTHFILL 0x10000000l + +/* + * Display hardware is capable of clipping while bltting. + */ +#define DDCAPS_CANCLIP 0x20000000l + +/* + * Display hardware is capable of clipping while stretch bltting. + */ +#define DDCAPS_CANCLIPSTRETCHED 0x40000000l + +/* + * Display hardware is capable of bltting to or from system memory + */ +#define DDCAPS_CANBLTSYSMEM 0x80000000l + + + /**************************************************************************** + * + * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2) + * + ****************************************************************************/ + +/* + * Display hardware is certified + */ +#define DDCAPS2_CERTIFIED 0x00000001l + +/* + * Driver cannot interleave 2D operations (lock and blt) to surfaces with + * Direct3D rendering operations between calls to BeginScene() and EndScene() + */ +#define DDCAPS2_NO2DDURING3DSCENE 0x00000002l + +/* + * Display hardware contains a video port + */ +#define DDCAPS2_VIDEOPORT 0x00000004l + +/* + * The overlay can be automatically flipped according to the video port + * VSYNCs, providing automatic doubled buffered display of video port + * data using an overlay + */ +#define DDCAPS2_AUTOFLIPOVERLAY 0x00000008l + +/* + * Overlay can display each field of interlaced data individually while + * it is interleaved in memory without causing jittery artifacts. + */ +#define DDCAPS2_CANBOBINTERLEAVED 0x00000010l + +/* + * Overlay can display each field of interlaced data individually while + * it is not interleaved in memory without causing jittery artifacts. + */ +#define DDCAPS2_CANBOBNONINTERLEAVED 0x00000020l + +/* + * The overlay surface contains color controls (brightness, sharpness, etc.) + */ +#define DDCAPS2_COLORCONTROLOVERLAY 0x00000040l + +/* + * The primary surface contains color controls (gamma, etc.) + */ +#define DDCAPS2_COLORCONTROLPRIMARY 0x00000080l + +/* + * RGBZ -> RGB supported for 16:16 RGB:Z + */ +#define DDCAPS2_CANDROPZ16BIT 0x00000100l + +/* + * Driver supports non-local video memory. + */ +#define DDCAPS2_NONLOCALVIDMEM 0x00000200l + +/* + * Dirver supports non-local video memory but has different capabilities for + * non-local video memory surfaces. If this bit is set then so must + * DDCAPS2_NONLOCALVIDMEM. + */ +#define DDCAPS2_NONLOCALVIDMEMCAPS 0x00000400l + +/* + * Driver neither requires nor prefers surfaces to be pagelocked when performing + * blts involving system memory surfaces + */ +#define DDCAPS2_NOPAGELOCKREQUIRED 0x00000800l + +/* + * Driver can create surfaces which are wider than the primary surface + */ +#define DDCAPS2_WIDESURFACES 0x00001000l + +/* + * Driver supports bob without using a video port by handling the + * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip. + */ +#define DDCAPS2_CANFLIPODDEVEN 0x00002000l + +/* + * Driver supports bob using hardware + */ +#define DDCAPS2_CANBOBHARDWARE 0x00004000l + +/* + * Driver supports bltting any FOURCC surface to another surface of the same FOURCC + */ +#define DDCAPS2_COPYFOURCC 0x00008000l + + +/* + * Driver supports loadable gamma ramps for the primary surface + */ +#define DDCAPS2_PRIMARYGAMMA 0x00020000l + +/* + * Driver can render in windowed mode. + */ +#define DDCAPS2_CANRENDERWINDOWED 0x00080000l + +/* + * A calibrator is available to adjust the gamma ramp according to the + * physical display properties so that the result will be identical on + * all calibrated systems. + */ +#define DDCAPS2_CANCALIBRATEGAMMA 0x00100000l + +/* + * Indicates that the driver will respond to DDFLIP_INTERVALn flags + */ +#define DDCAPS2_FLIPINTERVAL 0x00200000l + +/* + * Indicates that the driver will respond to DDFLIP_NOVSYNC + */ +#define DDCAPS2_FLIPNOVSYNC 0x00400000l + +/* + * Driver supports management of video memory, if this flag is ON, + * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on + * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on + */ +#define DDCAPS2_CANMANAGETEXTURE 0x00800000l + +/* + * The Direct3D texture manager uses this cap to decide whether to put managed + * surfaces in non-local video memory. If the cap is set, the texture manager will + * put managed surfaces in non-local vidmem. Drivers that cannot texture from + * local vidmem SHOULD NOT set this cap. + */ +#define DDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000l + +/* + * Indicates that the driver supports DX7 type of stereo in at least one mode (which may + * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher) + * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of + * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application + * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode. + */ +#define DDCAPS2_STEREO 0x02000000L + +/* + * This caps bit is intended for internal DirectDraw use. + * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set. + * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and + * all the assoicated system memory blt caps must be correct). + * -It implies that the system->video blt caps in DDCAPS also apply to system to + * nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops + * members of DDCAPS (DDCORECAPS) are filled in correctly. + * -Any blt from system to nonlocal memory that matches these caps bits will + * be passed to the driver. + * + * NOTE: This is intended to enable the driver itself to do efficient reordering + * of textures. This is NOT meant to imply that hardware can write into AGP memory. + * This operation is not currently supported. + */ +#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000L + +/* + * was DDCAPS2_PUREHAL + */ +#define DDCAPS2_RESERVED1 0x08000000L + +/* + * Driver supports management of video memory, if this flag is ON, + * driver manages the resource if requested with DDSCAPS2_TEXTUREMANAGE on + * DirectX manages the resource if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on + */ +#define DDCAPS2_CANMANAGERESOURCE 0x10000000L + +/* + * Driver supports dynamic textures. This will allow the application to set + * D3DUSAGE_DYNAMIC (DDSCAPS2_HINTDYNAMIC for drivers) at texture create time. + * Video memory dynamic textures WILL be lockable by applications. It is + * expected that these locks will be very efficient (which implies that the + * driver should always maintain a linear copy, a pointer to which can be + * quickly handed out to the application). + */ +#define DDCAPS2_DYNAMICTEXTURES 0x20000000L + +/* + * Driver supports auto-generation of mipmaps. + */ +#define DDCAPS2_CANAUTOGENMIPMAP 0x40000000L + + +/**************************************************************************** + * + * DIRECTDRAW FX ALPHA CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Supports alpha blending around the edge of a source color keyed surface. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004l + +/* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008l + +/* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010l + +/* + * Supports alpha blending around the edge of a source color keyed surface. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080l + +/* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100l + +/* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200l + +#if DIRECTDRAW_VERSION < 0x0600 +#endif //DIRECTDRAW_VERSION + + +/**************************************************************************** + * + * DIRECTDRAW FX CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Uses arithmetic operations to stretch and shrink surfaces during blt + * rather than pixel doubling techniques. Along the Y axis. + */ +#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020l + +/* + * Uses arithmetic operations to stretch during blt + * rather than pixel doubling techniques. Along the Y axis. Only + * works for x1, x2, etc. + */ +#define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010l + +/* + * Supports mirroring left to right in blt. + */ +#define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040l + +/* + * Supports mirroring top to bottom in blt. + */ +#define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080l + +/* + * Supports arbitrary rotation for blts. + */ +#define DDFXCAPS_BLTROTATION 0x00000100l + +/* + * Supports 90 degree rotations for blts. + */ +#define DDFXCAPS_BLTROTATION90 0x00000200l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKX 0x00000400l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKXN 0x00000800l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKY 0x00001000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKYN 0x00002000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHX 0x00004000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHXN 0x00008000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHY 0x00010000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHYN 0x00020000l + +/* + * Uses arithmetic operations to stretch and shrink surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. + */ +#define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000l + +/* + * Uses arithmetic operations to stretch surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. Only works for x1, x2, etc. + */ +#define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKX 0x00080000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKXN 0x00100000l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKY 0x00200000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKYN 0x00400000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHX 0x00800000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHY 0x02000000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000l + +/* + * DirectDraw supports mirroring of overlays across the vertical axis + */ +#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000l + +/* + * DirectDraw supports mirroring of overlays across the horizontal axis + */ +#define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000l + +/* + * DirectDraw supports deinterlacing of overlay surfaces + */ +#define DDFXCAPS_OVERLAYDEINTERLACE 0x20000000l + +/* + * Driver can do alpha blending for blits. + */ +#define DDFXCAPS_BLTALPHA 0x00000001l + + +/* + * Driver can do surface-reconstruction filtering for warped blits. + */ +#define DDFXCAPS_BLTFILTER DDFXCAPS_BLTARITHSTRETCHY + +/* + * Driver can do alpha blending for overlays. + */ +#define DDFXCAPS_OVERLAYALPHA 0x00000004l + + +/* + * Driver can do surface-reconstruction filtering for warped overlays. + */ +#define DDFXCAPS_OVERLAYFILTER DDFXCAPS_OVERLAYARITHSTRETCHY + +/**************************************************************************** + * + * DIRECTDRAW STEREO VIEW CAPABILITIES + * + ****************************************************************************/ + +/* + * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete + */ + +#define DDSVCAPS_RESERVED1 0x00000001l + +/* + * This flag used to be DDSVCAPS_FLICKER, which is now obsolete + */ +#define DDSVCAPS_RESERVED2 0x00000002l + +/* + * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete + */ +#define DDSVCAPS_RESERVED3 0x00000004l + +/* + * This flag used to be DDSVCAPS_SPLIT, which is now obsolete + */ +#define DDSVCAPS_RESERVED4 0x00000008l + +/* + * The stereo view is accomplished with switching technology + */ + +#define DDSVCAPS_STEREOSEQUENTIAL 0x00000010L + + + +/**************************************************************************** + * + * DIRECTDRAWPALETTE CAPABILITIES + * + ****************************************************************************/ + +/* + * Index is 4 bits. There are sixteen color entries in the palette table. + */ +#define DDPCAPS_4BIT 0x00000001l + +/* + * Index is onto a 8 bit color index. This field is only valid with the + * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target + * surface is in 8bpp. Each color entry is one byte long and is an index + * into destination surface's 8bpp palette. + */ +#define DDPCAPS_8BITENTRIES 0x00000002l + +/* + * Index is 8 bits. There are 256 color entries in the palette table. + */ +#define DDPCAPS_8BIT 0x00000004l + +/* + * Indicates that this DIRECTDRAWPALETTE should use the palette color array + * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE + * object. + * This flag is obsolete. DirectDraw always initializes the color array from + * the lpDDColorArray parameter. The definition remains for source-level + * compatibility. + */ +#define DDPCAPS_INITIALIZE 0x00000000l + +/* + * This palette is the one attached to the primary surface. Changing this + * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified + * and supported. + */ +#define DDPCAPS_PRIMARYSURFACE 0x00000010l + +/* + * This palette is the one attached to the primary surface left. Changing + * this table has immediate effect on the display for the left eye unless + * DDPSETPAL_VSYNC is specified and supported. + */ +#define DDPCAPS_PRIMARYSURFACELEFT 0x00000020l + +/* + * This palette can have all 256 entries defined + */ +#define DDPCAPS_ALLOW256 0x00000040l + +/* + * This palette can have modifications to it synced with the monitors + * refresh rate. + */ +#define DDPCAPS_VSYNC 0x00000080l + +/* + * Index is 1 bit. There are two color entries in the palette table. + */ +#define DDPCAPS_1BIT 0x00000100l + +/* + * Index is 2 bit. There are four color entries in the palette table. + */ +#define DDPCAPS_2BIT 0x00000200l + +/* + * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value + */ +#define DDPCAPS_ALPHA 0x00000400l + + +/**************************************************************************** + * + * DIRECTDRAWPALETTE SETENTRY CONSTANTS + * + ****************************************************************************/ + + +/**************************************************************************** + * + * DIRECTDRAWPALETTE GETENTRY CONSTANTS + * + ****************************************************************************/ + +/* 0 is the only legal value */ + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SETPRIVATEDATA CONSTANTS + * + ****************************************************************************/ + +/* + * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData + * must be set to sizeof(IUnknown*). DirectDraw will call AddRef through this + * pointer and Release when the private data is destroyed. This includes when + * the surface or palette is destroyed before such priovate data is destroyed. + */ +#define DDSPD_IUNKNOWNPOINTER 0x00000001L + +/* + * Private data is only valid for the current state of the object, + * as determined by the uniqueness value. + */ +#define DDSPD_VOLATILE 0x00000002L + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SETPALETTE CONSTANTS + * + ****************************************************************************/ + + +/**************************************************************************** + * + * DIRECTDRAW BITDEPTH CONSTANTS + * + * NOTE: These are only used to indicate supported bit depths. These + * are flags only, they are not to be used as an actual bit depth. The + * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual + * bit depths in a surface or for changing the display mode. + * + ****************************************************************************/ + +/* + * 1 bit per pixel. + */ +#define DDBD_1 0x00004000l + +/* + * 2 bits per pixel. + */ +#define DDBD_2 0x00002000l + +/* + * 4 bits per pixel. + */ +#define DDBD_4 0x00001000l + +/* + * 8 bits per pixel. + */ +#define DDBD_8 0x00000800l + +/* + * 16 bits per pixel. + */ +#define DDBD_16 0x00000400l + +/* + * 24 bits per pixel. + */ +#define DDBD_24 0X00000200l + +/* + * 32 bits per pixel. + */ +#define DDBD_32 0x00000100l + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS + * + ****************************************************************************/ + +/* + * Set if the structure contains a color space. Not set if the structure + * contains a single color key. + */ +#define DDCKEY_COLORSPACE 0x00000001l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for blt operations. + */ +#define DDCKEY_DESTBLT 0x00000002l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for overlay operations. + */ +#define DDCKEY_DESTOVERLAY 0x00000004l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for blt operations. + */ +#define DDCKEY_SRCBLT 0x00000008l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for overlay operations. + */ +#define DDCKEY_SRCOVERLAY 0x00000010l + + +/**************************************************************************** + * + * DIRECTDRAW COLOR KEY CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for RGB colors. + */ +#define DDCKEYCAPS_DESTBLT 0x00000001l + +/* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for RGB colors. + */ +#define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002l + +/* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for YUV colors. + */ +#define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004l + +/* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for YUV colors. + */ +#define DDCKEYCAPS_DESTBLTYUV 0x00000008l + +/* + * Supports overlaying using colorkeying of the replaceable bits of the surface + * being overlayed for RGB colors. + */ +#define DDCKEYCAPS_DESTOVERLAY 0x00000010l + +/* + * Supports a color space as the color key for the destination for RGB colors. + */ +#define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020l + +/* + * Supports a color space as the color key for the destination for YUV colors. + */ +#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040l + +/* + * Supports only one active destination color key value for visible overlay + * surfaces. + */ +#define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080l + +/* + * Supports overlaying using colorkeying of the replaceable bits of the + * surface being overlayed for YUV colors. + */ +#define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100l + +/* + * Supports transparent blting using the color key for the source with + * this surface for RGB colors. + */ +#define DDCKEYCAPS_SRCBLT 0x00000200l + +/* + * Supports transparent blting using a color space for the source with + * this surface for RGB colors. + */ +#define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400l + +/* + * Supports transparent blting using a color space for the source with + * this surface for YUV colors. + */ +#define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800l + +/* + * Supports transparent blting using the color key for the source with + * this surface for YUV colors. + */ +#define DDCKEYCAPS_SRCBLTYUV 0x00001000l + +/* + * Supports overlays using the color key for the source with this + * overlay surface for RGB colors. + */ +#define DDCKEYCAPS_SRCOVERLAY 0x00002000l + +/* + * Supports overlays using a color space as the source color key for + * the overlay surface for RGB colors. + */ +#define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000l + +/* + * Supports overlays using a color space as the source color key for + * the overlay surface for YUV colors. + */ +#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000l + +/* + * Supports only one active source color key value for visible + * overlay surfaces. + */ +#define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000l + +/* + * Supports overlays using the color key for the source with this + * overlay surface for YUV colors. + */ +#define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000l + +/* + * there are no bandwidth trade-offs for using colorkey with an overlay + */ +#define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000l + + +/**************************************************************************** + * + * DIRECTDRAW PIXELFORMAT FLAGS + * + ****************************************************************************/ + +/* + * The surface has alpha channel information in the pixel format. + */ +#define DDPF_ALPHAPIXELS 0x00000001l + +/* + * The pixel format contains alpha only information + */ +#define DDPF_ALPHA 0x00000002l + +/* + * The FourCC code is valid. + */ +#define DDPF_FOURCC 0x00000004l + +/* + * The surface is 4-bit color indexed. + */ +#define DDPF_PALETTEINDEXED4 0x00000008l + +/* + * The surface is indexed into a palette which stores indices + * into the destination surface's 8-bit palette. + */ +#define DDPF_PALETTEINDEXEDTO8 0x00000010l + +/* + * The surface is 8-bit color indexed. + */ +#define DDPF_PALETTEINDEXED8 0x00000020l + +/* + * The RGB data in the pixel format structure is valid. + */ +#define DDPF_RGB 0x00000040l + +/* + * The surface will accept pixel data in the format specified + * and compress it during the write. + */ +#define DDPF_COMPRESSED 0x00000080l + +/* + * The surface will accept RGB data and translate it during + * the write to YUV data. The format of the data to be written + * will be contained in the pixel format structure. The DDPF_RGB + * flag will be set. + */ +#define DDPF_RGBTOYUV 0x00000100l + +/* + * pixel format is YUV - YUV data in pixel format struct is valid + */ +#define DDPF_YUV 0x00000200l + +/* + * pixel format is a z buffer only surface + */ +#define DDPF_ZBUFFER 0x00000400l + +/* + * The surface is 1-bit color indexed. + */ +#define DDPF_PALETTEINDEXED1 0x00000800l + +/* + * The surface is 2-bit color indexed. + */ +#define DDPF_PALETTEINDEXED2 0x00001000l + +/* + * The surface contains Z information in the pixels + */ +#define DDPF_ZPIXELS 0x00002000l + +/* + * The surface contains stencil information along with Z + */ +#define DDPF_STENCILBUFFER 0x00004000l + +/* + * Premultiplied alpha format -- the color components have been + * premultiplied by the alpha component. + */ +#define DDPF_ALPHAPREMULT 0x00008000l + + +/* + * Luminance data in the pixel format is valid. + * Use this flag for luminance-only or luminance+alpha surfaces, + * the bit depth is then ddpf.dwLuminanceBitCount. + */ +#define DDPF_LUMINANCE 0x00020000l + +/* + * Luminance data in the pixel format is valid. + * Use this flag when hanging luminance off bumpmap surfaces, + * the bit mask for the luminance portion of the pixel is then + * ddpf.dwBumpLuminanceBitMask + */ +#define DDPF_BUMPLUMINANCE 0x00040000l + +/* + * Bump map dUdV data in the pixel format is valid. + */ +#define DDPF_BUMPDUDV 0x00080000l + + +/*=========================================================================== + * + * + * DIRECTDRAW CALLBACK FLAGS + * + * + *==========================================================================*/ + +/**************************************************************************** + * + * DIRECTDRAW ENUMSURFACES FLAGS + * + ****************************************************************************/ + +/* + * Enumerate all of the surfaces that meet the search criterion. + */ +#define DDENUMSURFACES_ALL 0x00000001l + +/* + * A search hit is a surface that matches the surface description. + */ +#define DDENUMSURFACES_MATCH 0x00000002l + +/* + * A search hit is a surface that does not match the surface description. + */ +#define DDENUMSURFACES_NOMATCH 0x00000004l + +/* + * Enumerate the first surface that can be created which meets the search criterion. + */ +#define DDENUMSURFACES_CANBECREATED 0x00000008l + +/* + * Enumerate the surfaces that already exist that meet the search criterion. + */ +#define DDENUMSURFACES_DOESEXIST 0x00000010l + + +/**************************************************************************** + * + * DIRECTDRAW SETDISPLAYMODE FLAGS + * + ****************************************************************************/ + +/* + * The desired mode is a standard VGA mode + */ +#define DDSDM_STANDARDVGAMODE 0x00000001l + + +/**************************************************************************** + * + * DIRECTDRAW ENUMDISPLAYMODES FLAGS + * + ****************************************************************************/ + +/* + * Enumerate Modes with different refresh rates. EnumDisplayModes guarantees + * that a particular mode will be enumerated only once. This flag specifies whether + * the refresh rate is taken into account when determining if a mode is unique. + */ +#define DDEDM_REFRESHRATES 0x00000001l + +/* + * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA + * modes such as mode 0x13 in addition to the usual ModeX modes (which are always + * enumerated if the application has previously called SetCooperativeLevel with the + * DDSCL_ALLOWMODEX flag set). + */ +#define DDEDM_STANDARDVGAMODES 0x00000002L + + +/**************************************************************************** + * + * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS + * + ****************************************************************************/ + +/* + * Exclusive mode owner will be responsible for the entire primary surface. + * GDI can be ignored. used with DD + */ +#define DDSCL_FULLSCREEN 0x00000001l + +/* + * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode + */ +#define DDSCL_ALLOWREBOOT 0x00000002l + +/* + * prevents DDRAW from modifying the application window. + * prevents DDRAW from minimize/restore the application window on activation. + */ +#define DDSCL_NOWINDOWCHANGES 0x00000004l + +/* + * app wants to work as a regular Windows application + */ +#define DDSCL_NORMAL 0x00000008l + +/* + * app wants exclusive access + */ +#define DDSCL_EXCLUSIVE 0x00000010l + + +/* + * app can deal with non-windows display modes + */ +#define DDSCL_ALLOWMODEX 0x00000040l + +/* + * this window will receive the focus messages + */ +#define DDSCL_SETFOCUSWINDOW 0x00000080l + +/* + * this window is associated with the DDRAW object and will + * cover the screen in fullscreen mode + */ +#define DDSCL_SETDEVICEWINDOW 0x00000100l + +/* + * app wants DDRAW to create a window to be associated with the + * DDRAW object + */ +#define DDSCL_CREATEDEVICEWINDOW 0x00000200l + +/* + * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D + * take the global crtisec more frequently. + */ +#define DDSCL_MULTITHREADED 0x00000400l + +/* + * App specifies that it would like to keep the FPU set up for optimal Direct3D + * performance (single precision and exceptions disabled) so Direct3D + * does not need to explicitly set the FPU each time. This is assumed by + * default in DirectX 7. See also DDSCL_FPUPRESERVE + */ +#define DDSCL_FPUSETUP 0x00000800l + +/* + * App specifies that it needs either double precision FPU or FPU exceptions + * enabled. This makes Direct3D explicitly set the FPU state eah time it is + * called. Setting the flag will reduce Direct3D performance. The flag is + * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP + */ +#define DDSCL_FPUPRESERVE 0x00001000l + + +/**************************************************************************** + * + * DIRECTDRAW BLT FLAGS + * + ****************************************************************************/ + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for this blt. + */ +#define DDBLT_ALPHADEST 0x00000001l + +/* + * Use the dwConstAlphaDest field in the DDBLTFX structure as the alpha channel + * for the destination surface for this blt. + */ +#define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002l + +/* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. (0 is opaque) + */ +#define DDBLT_ALPHADESTNEG 0x00000004l + +/* + * Use the lpDDSAlphaDest field in the DDBLTFX structure as the alpha + * channel for the destination for this blt. + */ +#define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008l + +/* + * Use the dwAlphaEdgeBlend field in the DDBLTFX structure as the alpha channel + * for the edges of the image that border the color key colors. + */ +#define DDBLT_ALPHAEDGEBLEND 0x00000010l + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the alpha channel for this blt. + */ +#define DDBLT_ALPHASRC 0x00000020l + +/* + * Use the dwConstAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + */ +#define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040l + +/* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. (0 is opaque) + */ +#define DDBLT_ALPHASRCNEG 0x00000080l + +/* + * Use the lpDDSAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + */ +#define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100l + +/* + * Do this blt asynchronously through the FIFO in the order received. If + * there is no room in the hardware FIFO fail the call. + */ +#define DDBLT_ASYNC 0x00000200l + +/* + * Uses the dwFillColor field in the DDBLTFX structure as the RGB color + * to fill the destination rectangle on the destination surface with. + */ +#define DDBLT_COLORFILL 0x00000400l + +/* + * Uses the dwDDFX field in the DDBLTFX structure to specify the effects + * to use for the blt. + */ +#define DDBLT_DDFX 0x00000800l + +/* + * Uses the dwDDROPS field in the DDBLTFX structure to specify the ROPS + * that are not part of the Win32 API. + */ +#define DDBLT_DDROPS 0x00001000l + +/* + * Use the color key associated with the destination surface. + */ +#define DDBLT_KEYDEST 0x00002000l + +/* + * Use the dckDestColorkey field in the DDBLTFX structure as the color key + * for the destination surface. + */ +#define DDBLT_KEYDESTOVERRIDE 0x00004000l + +/* + * Use the color key associated with the source surface. + */ +#define DDBLT_KEYSRC 0x00008000l + +/* + * Use the dckSrcColorkey field in the DDBLTFX structure as the color key + * for the source surface. + */ +#define DDBLT_KEYSRCOVERRIDE 0x00010000l + +/* + * Use the dwROP field in the DDBLTFX structure for the raster operation + * for this blt. These ROPs are the same as the ones defined in the Win32 API. + */ +#define DDBLT_ROP 0x00020000l + +/* + * Use the dwRotationAngle field in the DDBLTFX structure as the angle + * (specified in 1/100th of a degree) to rotate the surface. + */ +#define DDBLT_ROTATIONANGLE 0x00040000l + +/* + * Z-buffered blt using the z-buffers attached to the source and destination + * surfaces and the dwZBufferOpCode field in the DDBLTFX structure as the + * z-buffer opcode. + */ +#define DDBLT_ZBUFFER 0x00080000l + +/* + * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the destination. + */ +#define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000l + +/* + * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the destination. + */ +#define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000l + +/* + * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the source. + */ +#define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000l + +/* + * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the source. + */ +#define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000l + +/* + * wait until the device is ready to handle the blt + * this will cause blt to not return DDERR_WASSTILLDRAWING + */ +#define DDBLT_WAIT 0x01000000l + +/* + * Uses the dwFillDepth field in the DDBLTFX structure as the depth value + * to fill the destination rectangle on the destination Z-buffer surface + * with. + */ +#define DDBLT_DEPTHFILL 0x02000000l + + +/* + * Return immediately (with DDERR_WASSTILLDRAWING) if the device is not + * ready to schedule the blt at the time Blt() is called. + */ +#define DDBLT_DONOTWAIT 0x08000000l + +/* + * These flags indicate a presentation blt (i.e. a blt + * that moves surface contents from an offscreen back buffer to the primary + * surface). The driver is not allowed to "queue" more than three such blts. + * The "end" of the presentation blt is indicated, since the + * blt may be clipped, in which case the runtime will call the driver with + * several blts. All blts (even if not clipped) are tagged with DDBLT_PRESENTATION + * and the last (even if not clipped) additionally with DDBLT_LAST_PRESENTATION. + * Thus the true rule is that the driver must not schedule a DDBLT_PRESENTATION + * blt if there are 3 or more DDBLT_PRESENTLAST blts in the hardware pipe. + * If there are such blts in the pipe, the driver should return DDERR_WASSTILLDRAWING + * until the oldest queued DDBLT_LAST_PRESENTATION blts has been retired (i.e. the + * pixels have been actually written to the primary surface). Once the oldest blt + * has been retired, the driver is free to schedule the current blt. + * The goal is to provide a mechanism whereby the device's hardware queue never + * gets more than 3 frames ahead of the frames being generated by the application. + * When excessive queueing occurs, applications become unusable because the application + * visibly lags user input, and such problems make windowed interactive applications impossible. + * Some drivers may not have sufficient knowledge of their hardware's FIFO to know + * when a certain blt has been retired. Such drivers should code cautiously, and + * simply not allow any frames to be queued at all. DDBLT_LAST_PRESENTATION should cause + * such drivers to return DDERR_WASSTILLDRAWING until the accelerator is completely + * finished- exactly as if the application had called Lock on the source surface + * before calling Blt. + * In other words, the driver is allowed and encouraged to + * generate as much latency as it can, but never more than 3 frames worth. + * Implementation detail: Drivers should count blts against the SOURCE surface, not + * against the primary surface. This enables multiple parallel windowed application + * to function more optimally. + * This flag is passed only to DX8 or higher drivers. + * + * APPLICATIONS DO NOT SET THESE FLAGS. THEY ARE SET BY THE DIRECTDRAW RUNTIME. + * + */ +#define DDBLT_PRESENTATION 0x10000000l +#define DDBLT_LAST_PRESENTATION 0x20000000l + +/* + * If DDBLT_EXTENDED_FLAGS is set, then the driver should re-interpret + * other flags according to the definitions that follow. + * For example, bit 0 (0x00000001L) means DDBLT_ALPHADEST, unless + * DDBLT_EXTENDED_FLAGS is also set, in which case bit 0 means + * DDBLT_EXTENDED_LINEAR_CONTENT. + * Only DirectX9 and higher drivers will be given extended blt flags. + * Only flags explicitly mentioned here should be re-interpreted. + * All other flags retain their original meanings. + * + * List of re-interpreted flags: + * + * Bit Hex value New meaning old meaning + * --------------------------------------------------------------- + * 2 0x00000004 DDBLT_EXTENDED_LINEAR_CONTENT DDBLT_ALPHADESTNEG + * 4 0x00000010 DDBLT_EXTENDED_PRESENTATION_STRETCHFACTOR DDBLT_ALPHAEDGEBLEND + * + * + * NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED + * FOR USE BY THE DIRECT3D RUNTIME. + */ +#define DDBLT_EXTENDED_FLAGS 0x40000000l + +/* + * EXTENDED FLAG. SEE DEFINITION OF DDBLT_EXTENDED_FLAGS. + * This flag indidcates that the source surface contains content in a + * linear color space. The driver may perform gamma correction to the + * desktop color space (i.e. sRGB, gamma 2.2) as part of this blt. + * If the device can perform such a conversion as part of the copy, + * the driver should also set D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION + * + * NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED + * FOR USE BY THE DIRECT3D RUNTIME. Use IDirect3DSwapChain9::Present + * and specify D3DPRESENT_LINEAR_CONTENT in order to use this functionality. + */ +#define DDBLT_EXTENDED_LINEAR_CONTENT 0x00000004l + + +/**************************************************************************** + * + * BLTFAST FLAGS + * + ****************************************************************************/ + +#define DDBLTFAST_NOCOLORKEY 0x00000000 +#define DDBLTFAST_SRCCOLORKEY 0x00000001 +#define DDBLTFAST_DESTCOLORKEY 0x00000002 +#define DDBLTFAST_WAIT 0x00000010 +#define DDBLTFAST_DONOTWAIT 0x00000020 + +/**************************************************************************** + * + * FLIP FLAGS + * + ****************************************************************************/ + +#define DDFLIP_WAIT 0x00000001L + +/* + * Indicates that the target surface contains the even field of video data. + * This flag is only valid with an overlay surface. + */ +#define DDFLIP_EVEN 0x00000002L + +/* + * Indicates that the target surface contains the odd field of video data. + * This flag is only valid with an overlay surface. + */ +#define DDFLIP_ODD 0x00000004L + +/* + * Causes DirectDraw to perform the physical flip immediately and return + * to the application. Typically, what was the front buffer but is now the back + * buffer will still be visible (depending on timing) until the next vertical + * retrace. Subsequent operations involving the two flipped surfaces will + * not check to see if the physical flip has finished (i.e. will not return + * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)). + * This allows an application to perform Flips at a higher frequency than the + * monitor refresh rate, but may introduce visible artifacts. + * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set, + * DDFLIP_NOVSYNC has no effect. + */ +#define DDFLIP_NOVSYNC 0x00000008L + + +/* + * Flip Interval Flags. These flags indicate how many vertical retraces to wait between + * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each + * surface involved in the flip until the specified number of vertical retraces has + * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set, + * DDFLIP_INTERVALn has no effect. + */ + +/* + * DirectDraw will flip on every other vertical sync + */ +#define DDFLIP_INTERVAL2 0x02000000L + + +/* + * DirectDraw will flip on every third vertical sync + */ +#define DDFLIP_INTERVAL3 0x03000000L + + +/* + * DirectDraw will flip on every fourth vertical sync + */ +#define DDFLIP_INTERVAL4 0x04000000L + +/* + * DirectDraw will flip and display a main stereo surface + */ +#define DDFLIP_STEREO 0x00000010L + +/* + * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish + * to override the default and use time when the accelerator is busy (as denoted by + * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT. + */ +#define DDFLIP_DONOTWAIT 0x00000020L + + +/**************************************************************************** + * + * DIRECTDRAW SURFACE OVERLAY FLAGS + * + ****************************************************************************/ + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for the + * destination overlay. + */ +#define DDOVER_ALPHADEST 0x00000001l + +/* + * Use the dwConstAlphaDest field in the DDOVERLAYFX structure as the + * destination alpha channel for this overlay. + */ +#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002l + +/* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. + */ +#define DDOVER_ALPHADESTNEG 0x00000004l + +/* + * Use the lpDDSAlphaDest field in the DDOVERLAYFX structure as the alpha + * channel destination for this overlay. + */ +#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008l + +/* + * Use the dwAlphaEdgeBlend field in the DDOVERLAYFX structure as the alpha + * channel for the edges of the image that border the color key colors. + */ +#define DDOVER_ALPHAEDGEBLEND 0x00000010l + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the source alpha channel for this overlay. + */ +#define DDOVER_ALPHASRC 0x00000020l + +/* + * Use the dwConstAlphaSrc field in the DDOVERLAYFX structure as the source + * alpha channel for this overlay. + */ +#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040l + +/* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. + */ +#define DDOVER_ALPHASRCNEG 0x00000080l + +/* + * Use the lpDDSAlphaSrc field in the DDOVERLAYFX structure as the alpha channel + * source for this overlay. + */ +#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100l + +/* + * Turn this overlay off. + */ +#define DDOVER_HIDE 0x00000200l + +/* + * Use the color key associated with the destination surface. + */ +#define DDOVER_KEYDEST 0x00000400l + +/* + * Use the dckDestColorkey field in the DDOVERLAYFX structure as the color key + * for the destination surface + */ +#define DDOVER_KEYDESTOVERRIDE 0x00000800l + +/* + * Use the color key associated with the source surface. + */ +#define DDOVER_KEYSRC 0x00001000l + +/* + * Use the dckSrcColorkey field in the DDOVERLAYFX structure as the color key + * for the source surface. + */ +#define DDOVER_KEYSRCOVERRIDE 0x00002000l + +/* + * Turn this overlay on. + */ +#define DDOVER_SHOW 0x00004000l + +/* + * Add a dirty rect to an emulated overlayed surface. + */ +#define DDOVER_ADDDIRTYRECT 0x00008000l + +/* + * Redraw all dirty rects on an emulated overlayed surface. + */ +#define DDOVER_REFRESHDIRTYRECTS 0x00010000l + +/* + * Redraw the entire surface on an emulated overlayed surface. + */ +#define DDOVER_REFRESHALL 0x00020000l + + +/* + * Use the overlay FX flags to define special overlay FX + */ +#define DDOVER_DDFX 0x00080000l + +/* + * Autoflip the overlay when ever the video port autoflips + */ +#define DDOVER_AUTOFLIP 0x00100000l + +/* + * Display each field of video port data individually without + * causing any jittery artifacts + */ +#define DDOVER_BOB 0x00200000l + +/* + * Indicates that bob/weave decisions should not be overridden by other + * interfaces. + */ +#define DDOVER_OVERRIDEBOBWEAVE 0x00400000l + +/* + * Indicates that the surface memory is composed of interleaved fields. + */ +#define DDOVER_INTERLEAVED 0x00800000l + +/* + * Indicates that bob will be performed using hardware rather than + * software or emulated. + */ +#define DDOVER_BOBHARDWARE 0x01000000l + +/* + * Indicates that overlay FX structure contains valid ARGB scaling factors. + */ +#define DDOVER_ARGBSCALEFACTORS 0x02000000l + +/* + * Indicates that ARGB scaling factors can be degraded to fit driver capabilities. + */ +#define DDOVER_DEGRADEARGBSCALING 0x04000000l + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE LOCK FLAGS + * + ****************************************************************************/ + +/* + * The default. Set to indicate that Lock should return a valid memory pointer + * to the top of the specified rectangle. If no rectangle is specified then a + * pointer to the top of the surface is returned. + */ +#define DDLOCK_SURFACEMEMORYPTR 0x00000000L // default + +/* + * Set to indicate that Lock should wait until it can obtain a valid memory + * pointer before returning. If this bit is set, Lock will never return + * DDERR_WASSTILLDRAWING. + */ +#define DDLOCK_WAIT 0x00000001L + +/* + * Set if an event handle is being passed to Lock. Lock will trigger the event + * when it can return the surface memory pointer requested. + */ +#define DDLOCK_EVENT 0x00000002L + +/* + * Indicates that the surface being locked will only be read from. + */ +#define DDLOCK_READONLY 0x00000010L + +/* + * Indicates that the surface being locked will only be written to + */ +#define DDLOCK_WRITEONLY 0x00000020L + + +/* + * Indicates that a system wide lock should not be taken when this surface + * is locked. This has several advantages (cursor responsiveness, ability + * to call more Windows functions, easier debugging) when locking video + * memory surfaces. However, an application specifying this flag must + * comply with a number of conditions documented in the help file. + * Furthermore, this flag cannot be specified when locking the primary. + */ +#define DDLOCK_NOSYSLOCK 0x00000800L + +/* + * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices + * that were referred to in Draw*PrimtiveVB calls since the start of the + * frame (or the last lock without this flag) will be modified during the + * lock. This can be useful when one is only appending data to the vertex + * buffer + */ +#define DDLOCK_NOOVERWRITE 0x00001000L + +/* + * Indicates that no assumptions will be made about the contents of the + * surface or vertex buffer during this lock. + * This enables two things: + * - Direct3D or the driver may provide an alternative memory + * area as the vertex buffer. This is useful when one plans to clear the + * contents of the vertex buffer and fill in new data. + * - Drivers sometimes store surface data in a re-ordered format. + * When the application locks the surface, the driver is forced to un-re-order + * the surface data before allowing the application to see the surface contents. + * This flag is a hint to the driver that it can skip the un-re-ordering process + * since the application plans to overwrite every single pixel in the surface + * or locked rectangle (and so erase any un-re-ordered pixels anyway). + * Applications should always set this flag when they intend to overwrite the entire + * surface or locked rectangle. + */ +#define DDLOCK_DISCARDCONTENTS 0x00002000L + /* + * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS + */ +#define DDLOCK_OKTOSWAP 0x00002000L + +/* + * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish + * to override the default and use time when the accelerator is busy (as denoted by + * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT. + */ +#define DDLOCK_DONOTWAIT 0x00004000L + +/* + * This indicates volume texture lock with front and back specified. + */ +#define DDLOCK_HASVOLUMETEXTUREBOXRECT 0x00008000L + +/* + * This indicates that the driver should not update dirty rect information for this lock. + */ +#define DDLOCK_NODIRTYUPDATE 0x00010000L + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE PAGELOCK FLAGS + * + ****************************************************************************/ + +/* + * No flags defined at present + */ + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS + * + ****************************************************************************/ + +/* + * No flags defined at present + */ + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE BLT FX FLAGS + * + ****************************************************************************/ + +/* + * If stretching, use arithmetic stretching along the Y axis for this blt. + */ +#define DDBLTFX_ARITHSTRETCHY 0x00000001l + +/* + * Do this blt mirroring the surface left to right. Spin the + * surface around its y-axis. + */ +#define DDBLTFX_MIRRORLEFTRIGHT 0x00000002l + +/* + * Do this blt mirroring the surface up and down. Spin the surface + * around its x-axis. + */ +#define DDBLTFX_MIRRORUPDOWN 0x00000004l + +/* + * Schedule this blt to avoid tearing. + */ +#define DDBLTFX_NOTEARING 0x00000008l + +/* + * Do this blt rotating the surface one hundred and eighty degrees. + */ +#define DDBLTFX_ROTATE180 0x00000010l + +/* + * Do this blt rotating the surface two hundred and seventy degrees. + */ +#define DDBLTFX_ROTATE270 0x00000020l + +/* + * Do this blt rotating the surface ninety degrees. + */ +#define DDBLTFX_ROTATE90 0x00000040l + +/* + * Do this z blt using dwZBufferLow and dwZBufferHigh as range values + * specified to limit the bits copied from the source surface. + */ +#define DDBLTFX_ZBUFFERRANGE 0x00000080l + +/* + * Do this z blt adding the dwZBufferBaseDest to each of the sources z values + * before comparing it with the desting z values. + */ +#define DDBLTFX_ZBUFFERBASEDEST 0x00000100l + +/**************************************************************************** + * + * DIRECTDRAWSURFACE OVERLAY FX FLAGS + * + ****************************************************************************/ + +/* + * If stretching, use arithmetic stretching along the Y axis for this overlay. + */ +#define DDOVERFX_ARITHSTRETCHY 0x00000001l + +/* + * Mirror the overlay across the vertical axis + */ +#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002l + +/* + * Mirror the overlay across the horizontal axis + */ +#define DDOVERFX_MIRRORUPDOWN 0x00000004l + +/* + * Deinterlace the overlay, if possible + */ +#define DDOVERFX_DEINTERLACE 0x00000008l + + +/**************************************************************************** + * + * DIRECTDRAW WAITFORVERTICALBLANK FLAGS + * + ****************************************************************************/ + +/* + * return when the vertical blank interval begins + */ +#define DDWAITVB_BLOCKBEGIN 0x00000001l + +/* + * set up an event to trigger when the vertical blank begins + */ +#define DDWAITVB_BLOCKBEGINEVENT 0x00000002l + +/* + * return when the vertical blank interval ends and display begins + */ +#define DDWAITVB_BLOCKEND 0x00000004l + +/**************************************************************************** + * + * DIRECTDRAW GETFLIPSTATUS FLAGS + * + ****************************************************************************/ + +/* + * is it OK to flip now? + */ +#define DDGFS_CANFLIP 0x00000001l + +/* + * is the last flip finished? + */ +#define DDGFS_ISFLIPDONE 0x00000002l + +/**************************************************************************** + * + * DIRECTDRAW GETBLTSTATUS FLAGS + * + ****************************************************************************/ + +/* + * is it OK to blt now? + */ +#define DDGBS_CANBLT 0x00000001l + +/* + * is the blt to the surface finished? + */ +#define DDGBS_ISBLTDONE 0x00000002l + + +/**************************************************************************** + * + * DIRECTDRAW ENUMOVERLAYZORDER FLAGS + * + ****************************************************************************/ + +/* + * Enumerate overlays back to front. + */ +#define DDENUMOVERLAYZ_BACKTOFRONT 0x00000000l + +/* + * Enumerate overlays front to back + */ +#define DDENUMOVERLAYZ_FRONTTOBACK 0x00000001l + +/**************************************************************************** + * + * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS + * + ****************************************************************************/ + +/* + * Send overlay to front + */ +#define DDOVERZ_SENDTOFRONT 0x00000000l + +/* + * Send overlay to back + */ +#define DDOVERZ_SENDTOBACK 0x00000001l + +/* + * Move Overlay forward + */ +#define DDOVERZ_MOVEFORWARD 0x00000002l + +/* + * Move Overlay backward + */ +#define DDOVERZ_MOVEBACKWARD 0x00000003l + +/* + * Move Overlay in front of relative surface + */ +#define DDOVERZ_INSERTINFRONTOF 0x00000004l + +/* + * Move Overlay in back of relative surface + */ +#define DDOVERZ_INSERTINBACKOF 0x00000005l + + +/**************************************************************************** + * + * DIRECTDRAW SETGAMMARAMP FLAGS + * + ****************************************************************************/ + +/* + * Request calibrator to adjust the gamma ramp according to the physical + * properties of the display so that the result should appear identical + * on all systems. + */ +#define DDSGR_CALIBRATE 0x00000001L + + +/**************************************************************************** + * + * DIRECTDRAW STARTMODETEST FLAGS + * + ****************************************************************************/ + +/* + * Indicates that the mode being tested has passed + */ +#define DDSMT_ISTESTREQUIRED 0x00000001L + + +/**************************************************************************** + * + * DIRECTDRAW EVALUATEMODE FLAGS + * + ****************************************************************************/ + +/* + * Indicates that the mode being tested has passed + */ +#define DDEM_MODEPASSED 0x00000001L + +/* + * Indicates that the mode being tested has failed + */ +#define DDEM_MODEFAILED 0x00000002L + + +/*=========================================================================== + * + * + * DIRECTDRAW RETURN CODES + * + * The return values from DirectDraw Commands and Surface that return an HRESULT + * are codes from DirectDraw concerning the results of the action + * requested by DirectDraw. + * + *==========================================================================*/ + +/* + * Status is OK + * + * Issued by: DirectDraw Commands and all callbacks + */ +#define DD_OK S_OK +#define DD_FALSE S_FALSE + +/**************************************************************************** + * + * DIRECTDRAW ENUMCALLBACK RETURN VALUES + * + * EnumCallback returns are used to control the flow of the DIRECTDRAW and + * DIRECTDRAWSURFACE object enumerations. They can only be returned by + * enumeration callback routines. + * + ****************************************************************************/ + +/* + * stop the enumeration + */ +#define DDENUMRET_CANCEL 0 + +/* + * continue the enumeration + */ +#define DDENUMRET_OK 1 + +/**************************************************************************** + * + * DIRECTDRAW ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +/* + * This object is already initialized + */ +#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 ) + +/* + * This surface can not be attached to the requested surface. + */ +#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 ) + +/* + * This surface can not be detached from the requested surface. + */ +#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 ) + +/* + * Support is currently not available. + */ +#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 ) + +/* + * An exception was encountered while performing the requested operation + */ +#define DDERR_EXCEPTION MAKE_DDHRESULT( 55 ) + +/* + * Generic failure. + */ +#define DDERR_GENERIC E_FAIL + +/* + * Height of rectangle provided is not a multiple of reqd alignment + */ +#define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 ) + +/* + * Unable to match primary surface creation request with existing + * primary surface. + */ +#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 ) + +/* + * One or more of the caps bits passed to the callback are incorrect. + */ +#define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 ) + +/* + * DirectDraw does not support provided Cliplist. + */ +#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 ) + +/* + * DirectDraw does not support the requested mode + */ +#define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 ) + +/* + * DirectDraw received a pointer that was an invalid DIRECTDRAW object. + */ +#define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 ) + +/* + * One or more of the parameters passed to the callback function are + * incorrect. + */ +#define DDERR_INVALIDPARAMS E_INVALIDARG + +/* + * pixel format was invalid as specified + */ +#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 ) + +/* + * Rectangle provided was invalid. + */ +#define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 ) + +/* + * Operation could not be carried out because one or more surfaces are locked + */ +#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) + +/* + * There is no 3D present. + */ +#define DDERR_NO3D MAKE_DDHRESULT( 170 ) + +/* + * Operation could not be carried out because there is no alpha accleration + * hardware present or available. + */ +#define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) + +/* + * Operation could not be carried out because there is no stereo + * hardware present or available. + */ +#define DDERR_NOSTEREOHARDWARE MAKE_DDHRESULT( 181 ) + +/* + * Operation could not be carried out because there is no hardware + * present which supports stereo surfaces + */ +#define DDERR_NOSURFACELEFT MAKE_DDHRESULT( 182 ) + + + +/* + * no clip list available + */ +#define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) + +/* + * Operation could not be carried out because there is no color conversion + * hardware present or available. + */ +#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) + +/* + * Create function called without DirectDraw object method SetCooperativeLevel + * being called. + */ +#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) + +/* + * Surface doesn't currently have a color key + */ +#define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 ) + +/* + * Operation could not be carried out because there is no hardware support + * of the dest color key. + */ +#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 ) + +/* + * No DirectDraw support possible with current display driver + */ +#define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 ) + +/* + * Operation requires the application to have exclusive mode but the + * application does not have exclusive mode. + */ +#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 ) + +/* + * Flipping visible surfaces is not supported. + */ +#define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 ) + +/* + * There is no GDI present. + */ +#define DDERR_NOGDI MAKE_DDHRESULT( 240 ) + +/* + * Operation could not be carried out because there is no hardware present + * or available. + */ +#define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) + +/* + * Requested item was not found + */ +#define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) + +/* + * Operation could not be carried out because there is no overlay hardware + * present or available. + */ +#define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) + +/* + * Operation could not be carried out because the source and destination + * rectangles are on the same surface and overlap each other. + */ +#define DDERR_OVERLAPPINGRECTS MAKE_DDHRESULT( 270 ) + +/* + * Operation could not be carried out because there is no appropriate raster + * op hardware present or available. + */ +#define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) + +/* + * Operation could not be carried out because there is no rotation hardware + * present or available. + */ +#define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) + +/* + * Operation could not be carried out because there is no hardware support + * for stretching + */ +#define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) + +/* + * DirectDrawSurface is not in 4 bit color palette and the requested operation + * requires 4 bit color palette. + */ +#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 ) + +/* + * DirectDrawSurface is not in 4 bit color index palette and the requested + * operation requires 4 bit color index palette. + */ +#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 ) + +/* + * DirectDraw Surface is not in 8 bit color mode and the requested operation + * requires 8 bit color. + */ +#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 ) + +/* + * Operation could not be carried out because there is no texture mapping + * hardware present or available. + */ +#define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 ) + +/* + * Operation could not be carried out because there is no hardware support + * for vertical blank synchronized operations. + */ +#define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 ) + +/* + * Operation could not be carried out because there is no hardware support + * for zbuffer blting. + */ +#define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 ) + +/* + * Overlay surfaces could not be z layered based on their BltOrder because + * the hardware does not support z layering of overlays. + */ +#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 ) + +/* + * The hardware needed for the requested operation has already been + * allocated. + */ +#define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 ) + +/* + * DirectDraw does not have enough memory to perform the operation. + */ +#define DDERR_OUTOFMEMORY E_OUTOFMEMORY + +/* + * DirectDraw does not have enough memory to perform the operation. + */ +#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 ) + +/* + * hardware does not support clipped overlays + */ +#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 ) + +/* + * Can only have ony color key active at one time for overlays + */ +#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 ) + +/* + * Access to this palette is being refused because the palette is already + * locked by another thread. + */ +#define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 ) + +/* + * No src color key specified for this operation. + */ +#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 ) + +/* + * This surface is already attached to the surface it is being attached to. + */ +#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 ) + +/* + * This surface is already a dependency of the surface it is being made a + * dependency of. + */ +#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 ) + +/* + * Access to this surface is being refused because the surface is already + * locked by another thread. + */ +#define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 ) + +/* + * Access to this surface is being refused because no driver exists + * which can supply a pointer to the surface. + * This is most likely to happen when attempting to lock the primary + * surface when no DCI provider is present. + * Will also happen on attempts to lock an optimized surface. + */ +#define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 ) + +/* + * Access to Surface refused because Surface is obscured. + */ +#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 ) + +/* + * Access to this surface is being refused because the surface is gone. + * The DIRECTDRAWSURFACE object representing this surface should + * have Restore called on it. + */ +#define DDERR_SURFACELOST MAKE_DDHRESULT( 450 ) + +/* + * The requested surface is not attached. + */ +#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 ) + +/* + * Height requested by DirectDraw is too large. + */ +#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 ) + +/* + * Size requested by DirectDraw is too large -- The individual height and + * width are OK. + */ +#define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 ) + +/* + * Width requested by DirectDraw is too large. + */ +#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 ) + +/* + * Action not supported. + */ +#define DDERR_UNSUPPORTED E_NOTIMPL + +/* + * Pixel format requested is unsupported by DirectDraw + */ +#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) + +/* + * Bitmask in the pixel format requested is unsupported by DirectDraw + */ +#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) + +/* + * The specified stream contains invalid data + */ +#define DDERR_INVALIDSTREAM MAKE_DDHRESULT( 521 ) + +/* + * vertical blank is in progress + */ +#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) + +/* + * Informs DirectDraw that the previous Blt which is transfering information + * to or from this Surface is incomplete. + */ +#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) + + +/* + * The specified surface type requires specification of the COMPLEX flag + */ +#define DDERR_DDSCAPSCOMPLEXREQUIRED MAKE_DDHRESULT( 542 ) + + +/* + * Rectangle provided was not horizontally aligned on reqd. boundary + */ +#define DDERR_XALIGN MAKE_DDHRESULT( 560 ) + +/* + * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver + * identifier. + */ +#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) + +/* + * A DirectDraw object representing this driver has already been created + * for this process. + */ +#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) + +/* + * A hardware only DirectDraw object creation was attempted but the driver + * did not support any hardware. + */ +#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 ) + +/* + * this process already has created a primary surface + */ +#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 ) + +/* + * software emulation not available. + */ +#define DDERR_NOEMULATION MAKE_DDHRESULT( 565 ) + +/* + * region passed to Clipper::GetClipList is too small. + */ +#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 ) + +/* + * an attempt was made to set a clip list for a clipper objec that + * is already monitoring an hwnd. + */ +#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 ) + +/* + * No clipper object attached to surface object + */ +#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 ) + +/* + * Clipper notification requires an HWND or + * no HWND has previously been set as the CooperativeLevel HWND. + */ +#define DDERR_NOHWND MAKE_DDHRESULT( 569 ) + +/* + * HWND used by DirectDraw CooperativeLevel has been subclassed, + * this prevents DirectDraw from restoring state. + */ +#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 ) + +/* + * The CooperativeLevel HWND has already been set. + * It can not be reset while the process has surfaces or palettes created. + */ +#define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 ) + +/* + * No palette object attached to this surface. + */ +#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 ) + +/* + * No hardware support for 16 or 256 color palettes. + */ +#define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 ) + +/* + * If a clipper object is attached to the source surface passed into a + * BltFast call. + */ +#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 ) + +/* + * No blter. + */ +#define DDERR_NOBLTHW MAKE_DDHRESULT( 575 ) + +/* + * No DirectDraw ROP hardware. + */ +#define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 ) + +/* + * returned when GetOverlayPosition is called on a hidden overlay + */ +#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 ) + +/* + * returned when GetOverlayPosition is called on a overlay that UpdateOverlay + * has never been called on to establish a destionation. + */ +#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 ) + +/* + * returned when the position of the overlay on the destionation is no longer + * legal for that destionation. + */ +#define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 ) + +/* + * returned when an overlay member is called for a non-overlay surface + */ +#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 ) + +/* + * An attempt was made to set the cooperative level when it was already + * set to exclusive. + */ +#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 ) + +/* + * An attempt has been made to flip a surface that is not flippable. + */ +#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 ) + +/* + * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly + * created. + */ +#define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 ) + +/* + * Surface was not locked. An attempt to unlock a surface that was not + * locked at all, or by this process, has been attempted. + */ +#define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 ) + +/* + * Windows can not create any more DCs, or a DC was requested for a paltte-indexed + * surface when the surface had no palette AND the display mode was not palette-indexed + * (in this case DirectDraw cannot select a proper palette into the DC) + */ +#define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 ) + +/* + * No DC was ever created for this surface. + */ +#define DDERR_NODC MAKE_DDHRESULT( 586 ) + +/* + * This surface can not be restored because it was created in a different + * mode. + */ +#define DDERR_WRONGMODE MAKE_DDHRESULT( 587 ) + +/* + * This surface can not be restored because it is an implicitly created + * surface. + */ +#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 ) + +/* + * The surface being used is not a palette-based surface + */ +#define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 ) + + +/* + * The display is currently in an unsupported mode + */ +#define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 ) + +/* + * Operation could not be carried out because there is no mip-map + * texture mapping hardware present or available. + */ +#define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 ) + +/* + * The requested action could not be performed because the surface was of + * the wrong type. + */ +#define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 ) + + +/* + * Device does not support optimized surfaces, therefore no video memory optimized surfaces + */ +#define DDERR_NOOPTIMIZEHW MAKE_DDHRESULT( 600 ) + +/* + * Surface is an optimized surface, but has not yet been allocated any memory + */ +#define DDERR_NOTLOADED MAKE_DDHRESULT( 601 ) + +/* + * Attempt was made to create or set a device window without first setting + * the focus window + */ +#define DDERR_NOFOCUSWINDOW MAKE_DDHRESULT( 602 ) + +/* + * Attempt was made to set a palette on a mipmap sublevel + */ +#define DDERR_NOTONMIPMAPSUBLEVEL MAKE_DDHRESULT( 603 ) + +/* + * A DC has already been returned for this surface. Only one DC can be + * retrieved per surface. + */ +#define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) + +/* + * An attempt was made to allocate non-local video memory from a device + * that does not support non-local video memory. + */ +#define DDERR_NONONLOCALVIDMEM MAKE_DDHRESULT( 630 ) + +/* + * The attempt to page lock a surface failed. + */ +#define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) + + +/* + * The attempt to page unlock a surface failed. + */ +#define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) + +/* + * An attempt was made to page unlock a surface with no outstanding page locks. + */ +#define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) + +/* + * There is more data available than the specified buffer size could hold + */ +#define DDERR_MOREDATA MAKE_DDHRESULT( 690 ) + +/* + * The data has expired and is therefore no longer valid. + */ +#define DDERR_EXPIRED MAKE_DDHRESULT( 691 ) + +/* + * The mode test has finished executing. + */ +#define DDERR_TESTFINISHED MAKE_DDHRESULT( 692 ) + +/* + * The mode test has switched to a new mode. + */ +#define DDERR_NEWMODE MAKE_DDHRESULT( 693 ) + +/* + * D3D has not yet been initialized. + */ +#define DDERR_D3DNOTINITIALIZED MAKE_DDHRESULT( 694 ) + +/* + * The video port is not active + */ +#define DDERR_VIDEONOTACTIVE MAKE_DDHRESULT( 695 ) + +/* + * The monitor does not have EDID data. + */ +#define DDERR_NOMONITORINFORMATION MAKE_DDHRESULT( 696 ) + +/* + * The driver does not enumerate display mode refresh rates. + */ +#define DDERR_NODRIVERSUPPORT MAKE_DDHRESULT( 697 ) + +/* + * Surfaces created by one direct draw device cannot be used directly by + * another direct draw device. + */ +#define DDERR_DEVICEDOESNTOWNSURFACE MAKE_DDHRESULT( 699 ) + + + +/* + * An attempt was made to invoke an interface member of a DirectDraw object + * created by CoCreateInstance() before it was initialized. + */ +#define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED + + +/* Alpha bit depth constants */ + + +#ifdef __cplusplus +}; +#endif + +#ifdef ENABLE_NAMELESS_UNION_PRAGMA +#pragma warning(default:4201) +#endif + +#endif //__DDRAW_INCLUDED__ + + diff --git a/saco/d3d9/include/dinput.h b/saco/d3d9/include/dinput.h new file mode 100644 index 0000000..5aac256 --- /dev/null +++ b/saco/d3d9/include/dinput.h @@ -0,0 +1,4417 @@ +/**************************************************************************** + * + * Copyright (C) 1996-2000 Microsoft Corporation. All Rights Reserved. + * + * File: dinput.h + * Content: DirectInput include file + * + ****************************************************************************/ + +#ifndef __DINPUT_INCLUDED__ +#define __DINPUT_INCLUDED__ + +#ifndef DIJ_RINGZERO + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include +#endif + +#endif /* DIJ_RINGZERO */ + +#ifdef __cplusplus +extern "C" { +#endif + + + + + +/* + * To build applications for older versions of DirectInput + * + * #define DIRECTINPUT_VERSION [ 0x0300 | 0x0500 | 0x0700 ] + * + * before #include . By default, #include + * will produce a DirectX 8-compatible header file. + * + */ + +#define DIRECTINPUT_HEADER_VERSION 0x0800 +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION DIRECTINPUT_HEADER_VERSION +#pragma message(__FILE__ ": DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800") +#endif + +#ifndef DIJ_RINGZERO + +/**************************************************************************** + * + * Class IDs + * + ****************************************************************************/ + +DEFINE_GUID(CLSID_DirectInput, 0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice, 0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(CLSID_DirectInput8, 0x25E609E4,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice8,0x25E609E5,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Interfaces + * + ****************************************************************************/ + +DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2A, 0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2W, 0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput7A, 0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput7W, 0x9A4CB685,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput8A, 0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInput8W, 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInputDeviceA, 0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDeviceW, 0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2A,0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2W,0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice7A,0x57D7C6BC,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice7W,0x57D7C6BD,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice8A,0x54D41080,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputDevice8W,0x54D41081,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputEffect, 0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +/**************************************************************************** + * + * Predefined object types + * + ****************************************************************************/ + +DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RxAxis, 0xA36D02F4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RyAxis, 0xA36D02F5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RzAxis, 0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Slider, 0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Button, 0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Key, 0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_POV, 0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Unknown, 0xA36D02F3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined product GUIDs + * + ****************************************************************************/ + +DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboard,0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Joystick ,0x6F1D2B70,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm, 0x6F1D2B80,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm2,0x6F1D2B81,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm, 0x6F1D2B82,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm2,0x6F1D2B83,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined force feedback effects + * + ****************************************************************************/ + +DEFINE_GUID(GUID_ConstantForce, 0x13541C20,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_RampForce, 0x13541C21,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Square, 0x13541C22,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Sine, 0x13541C23,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Triangle, 0x13541C24,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothUp, 0x13541C25,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothDown, 0x13541C26,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Spring, 0x13541C27,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Damper, 0x13541C28,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Inertia, 0x13541C29,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Friction, 0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_CustomForce, 0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Interfaces and Structures... + * + ****************************************************************************/ + +#if(DIRECTINPUT_VERSION >= 0x0500) + +/**************************************************************************** + * + * IDirectInputEffect + * + ****************************************************************************/ + +#define DIEFT_ALL 0x00000000 + +#define DIEFT_CONSTANTFORCE 0x00000001 +#define DIEFT_RAMPFORCE 0x00000002 +#define DIEFT_PERIODIC 0x00000003 +#define DIEFT_CONDITION 0x00000004 +#define DIEFT_CUSTOMFORCE 0x00000005 +#define DIEFT_HARDWARE 0x000000FF +#define DIEFT_FFATTACK 0x00000200 +#define DIEFT_FFFADE 0x00000400 +#define DIEFT_SATURATION 0x00000800 +#define DIEFT_POSNEGCOEFFICIENTS 0x00001000 +#define DIEFT_POSNEGSATURATION 0x00002000 +#define DIEFT_DEADBAND 0x00004000 +#define DIEFT_STARTDELAY 0x00008000 +#define DIEFT_GETTYPE(n) LOBYTE(n) + +#define DI_DEGREES 100 +#define DI_FFNOMINALMAX 10000 +#define DI_SECONDS 1000000 + +typedef struct DICONSTANTFORCE { + LONG lMagnitude; +} DICONSTANTFORCE, *LPDICONSTANTFORCE; +typedef const DICONSTANTFORCE *LPCDICONSTANTFORCE; + +typedef struct DIRAMPFORCE { + LONG lStart; + LONG lEnd; +} DIRAMPFORCE, *LPDIRAMPFORCE; +typedef const DIRAMPFORCE *LPCDIRAMPFORCE; + +typedef struct DIPERIODIC { + DWORD dwMagnitude; + LONG lOffset; + DWORD dwPhase; + DWORD dwPeriod; +} DIPERIODIC, *LPDIPERIODIC; +typedef const DIPERIODIC *LPCDIPERIODIC; + +typedef struct DICONDITION { + LONG lOffset; + LONG lPositiveCoefficient; + LONG lNegativeCoefficient; + DWORD dwPositiveSaturation; + DWORD dwNegativeSaturation; + LONG lDeadBand; +} DICONDITION, *LPDICONDITION; +typedef const DICONDITION *LPCDICONDITION; + +typedef struct DICUSTOMFORCE { + DWORD cChannels; + DWORD dwSamplePeriod; + DWORD cSamples; + LPLONG rglForceData; +} DICUSTOMFORCE, *LPDICUSTOMFORCE; +typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE; + + +typedef struct DIENVELOPE { + DWORD dwSize; /* sizeof(DIENVELOPE) */ + DWORD dwAttackLevel; + DWORD dwAttackTime; /* Microseconds */ + DWORD dwFadeLevel; + DWORD dwFadeTime; /* Microseconds */ +} DIENVELOPE, *LPDIENVELOPE; +typedef const DIENVELOPE *LPCDIENVELOPE; + + +/* This structure is defined for DirectX 5.0 compatibility */ +typedef struct DIEFFECT_DX5 { + DWORD dwSize; /* sizeof(DIEFFECT_DX5) */ + DWORD dwFlags; /* DIEFF_* */ + DWORD dwDuration; /* Microseconds */ + DWORD dwSamplePeriod; /* Microseconds */ + DWORD dwGain; + DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ + DWORD dwTriggerRepeatInterval; /* Microseconds */ + DWORD cAxes; /* Number of axes */ + LPDWORD rgdwAxes; /* Array of axes */ + LPLONG rglDirection; /* Array of directions */ + LPDIENVELOPE lpEnvelope; /* Optional */ + DWORD cbTypeSpecificParams; /* Size of params */ + LPVOID lpvTypeSpecificParams; /* Pointer to params */ +} DIEFFECT_DX5, *LPDIEFFECT_DX5; +typedef const DIEFFECT_DX5 *LPCDIEFFECT_DX5; + +typedef struct DIEFFECT { + DWORD dwSize; /* sizeof(DIEFFECT) */ + DWORD dwFlags; /* DIEFF_* */ + DWORD dwDuration; /* Microseconds */ + DWORD dwSamplePeriod; /* Microseconds */ + DWORD dwGain; + DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ + DWORD dwTriggerRepeatInterval; /* Microseconds */ + DWORD cAxes; /* Number of axes */ + LPDWORD rgdwAxes; /* Array of axes */ + LPLONG rglDirection; /* Array of directions */ + LPDIENVELOPE lpEnvelope; /* Optional */ + DWORD cbTypeSpecificParams; /* Size of params */ + LPVOID lpvTypeSpecificParams; /* Pointer to params */ +#if(DIRECTINPUT_VERSION >= 0x0600) + DWORD dwStartDelay; /* Microseconds */ +#endif /* DIRECTINPUT_VERSION >= 0x0600 */ +} DIEFFECT, *LPDIEFFECT; +typedef DIEFFECT DIEFFECT_DX6; +typedef LPDIEFFECT LPDIEFFECT_DX6; +typedef const DIEFFECT *LPCDIEFFECT; + + +#if(DIRECTINPUT_VERSION >= 0x0700) +#ifndef DIJ_RINGZERO +typedef struct DIFILEEFFECT{ + DWORD dwSize; + GUID GuidEffect; + LPCDIEFFECT lpDiEffect; + CHAR szFriendlyName[MAX_PATH]; +}DIFILEEFFECT, *LPDIFILEEFFECT; +typedef const DIFILEEFFECT *LPCDIFILEEFFECT; +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSINFILECALLBACK)(LPCDIFILEEFFECT , LPVOID); +#endif /* DIJ_RINGZERO */ +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#define DIEFF_OBJECTIDS 0x00000001 +#define DIEFF_OBJECTOFFSETS 0x00000002 +#define DIEFF_CARTESIAN 0x00000010 +#define DIEFF_POLAR 0x00000020 +#define DIEFF_SPHERICAL 0x00000040 + +#define DIEP_DURATION 0x00000001 +#define DIEP_SAMPLEPERIOD 0x00000002 +#define DIEP_GAIN 0x00000004 +#define DIEP_TRIGGERBUTTON 0x00000008 +#define DIEP_TRIGGERREPEATINTERVAL 0x00000010 +#define DIEP_AXES 0x00000020 +#define DIEP_DIRECTION 0x00000040 +#define DIEP_ENVELOPE 0x00000080 +#define DIEP_TYPESPECIFICPARAMS 0x00000100 +#if(DIRECTINPUT_VERSION >= 0x0600) +#define DIEP_STARTDELAY 0x00000200 +#define DIEP_ALLPARAMS_DX5 0x000001FF +#define DIEP_ALLPARAMS 0x000003FF +#else /* DIRECTINPUT_VERSION < 0x0600 */ +#define DIEP_ALLPARAMS 0x000001FF +#endif /* DIRECTINPUT_VERSION < 0x0600 */ +#define DIEP_START 0x20000000 +#define DIEP_NORESTART 0x40000000 +#define DIEP_NODOWNLOAD 0x80000000 +#define DIEB_NOTRIGGER 0xFFFFFFFF + +#define DIES_SOLO 0x00000001 +#define DIES_NODOWNLOAD 0x80000000 + +#define DIEGES_PLAYING 0x00000001 +#define DIEGES_EMULATED 0x00000002 + +typedef struct DIEFFESCAPE { + DWORD dwSize; + DWORD dwCommand; + LPVOID lpvInBuffer; + DWORD cbInBuffer; + LPVOID lpvOutBuffer; + DWORD cbOutBuffer; +} DIEFFESCAPE, *LPDIEFFESCAPE; + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputEffect + +DECLARE_INTERFACE_(IDirectInputEffect, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputEffect methods ***/ + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(GetEffectGuid)(THIS_ LPGUID) PURE; + STDMETHOD(GetParameters)(THIS_ LPDIEFFECT,DWORD) PURE; + STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT,DWORD) PURE; + STDMETHOD(Start)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(Stop)(THIS) PURE; + STDMETHOD(GetEffectStatus)(THIS_ LPDWORD) PURE; + STDMETHOD(Download)(THIS) PURE; + STDMETHOD(Unload)(THIS) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; +}; + +typedef struct IDirectInputEffect *LPDIRECTINPUTEFFECT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputEffect_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputEffect_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->lpVtbl->GetEffectGuid(p,a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->lpVtbl->GetParameters(p,a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->lpVtbl->SetParameters(p,a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->lpVtbl->Start(p,a,b) +#define IDirectInputEffect_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectInputEffect_GetEffectStatus(p,a) (p)->lpVtbl->GetEffectStatus(p,a) +#define IDirectInputEffect_Download(p) (p)->lpVtbl->Download(p) +#define IDirectInputEffect_Unload(p) (p)->lpVtbl->Unload(p) +#define IDirectInputEffect_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#else +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputEffect_AddRef(p) (p)->AddRef() +#define IDirectInputEffect_Release(p) (p)->Release() +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->GetEffectGuid(a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->GetParameters(a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->SetParameters(a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->Start(a,b) +#define IDirectInputEffect_Stop(p) (p)->Stop() +#define IDirectInputEffect_GetEffectStatus(p,a) (p)->GetEffectStatus(a) +#define IDirectInputEffect_Download(p) (p)->Download() +#define IDirectInputEffect_Unload(p) (p)->Unload() +#define IDirectInputEffect_Escape(p,a) (p)->Escape(a) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +/**************************************************************************** + * + * IDirectInputDevice + * + ****************************************************************************/ + +#if DIRECTINPUT_VERSION <= 0x700 +#define DIDEVTYPE_DEVICE 1 +#define DIDEVTYPE_MOUSE 2 +#define DIDEVTYPE_KEYBOARD 3 +#define DIDEVTYPE_JOYSTICK 4 + +#else +#define DI8DEVCLASS_ALL 0 +#define DI8DEVCLASS_DEVICE 1 +#define DI8DEVCLASS_POINTER 2 +#define DI8DEVCLASS_KEYBOARD 3 +#define DI8DEVCLASS_GAMECTRL 4 + +#define DI8DEVTYPE_DEVICE 0x11 +#define DI8DEVTYPE_MOUSE 0x12 +#define DI8DEVTYPE_KEYBOARD 0x13 +#define DI8DEVTYPE_JOYSTICK 0x14 +#define DI8DEVTYPE_GAMEPAD 0x15 +#define DI8DEVTYPE_DRIVING 0x16 +#define DI8DEVTYPE_FLIGHT 0x17 +#define DI8DEVTYPE_1STPERSON 0x18 +#define DI8DEVTYPE_DEVICECTRL 0x19 +#define DI8DEVTYPE_SCREENPOINTER 0x1A +#define DI8DEVTYPE_REMOTE 0x1B +#define DI8DEVTYPE_SUPPLEMENTAL 0x1C +#endif /* DIRECTINPUT_VERSION <= 0x700 */ + +#define DIDEVTYPE_HID 0x00010000 + +#if DIRECTINPUT_VERSION <= 0x700 +#define DIDEVTYPEMOUSE_UNKNOWN 1 +#define DIDEVTYPEMOUSE_TRADITIONAL 2 +#define DIDEVTYPEMOUSE_FINGERSTICK 3 +#define DIDEVTYPEMOUSE_TOUCHPAD 4 +#define DIDEVTYPEMOUSE_TRACKBALL 5 + +#define DIDEVTYPEKEYBOARD_UNKNOWN 0 +#define DIDEVTYPEKEYBOARD_PCXT 1 +#define DIDEVTYPEKEYBOARD_OLIVETTI 2 +#define DIDEVTYPEKEYBOARD_PCAT 3 +#define DIDEVTYPEKEYBOARD_PCENH 4 +#define DIDEVTYPEKEYBOARD_NOKIA1050 5 +#define DIDEVTYPEKEYBOARD_NOKIA9140 6 +#define DIDEVTYPEKEYBOARD_NEC98 7 +#define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DIDEVTYPEKEYBOARD_NEC98106 9 +#define DIDEVTYPEKEYBOARD_JAPAN106 10 +#define DIDEVTYPEKEYBOARD_JAPANAX 11 +#define DIDEVTYPEKEYBOARD_J3100 12 + +#define DIDEVTYPEJOYSTICK_UNKNOWN 1 +#define DIDEVTYPEJOYSTICK_TRADITIONAL 2 +#define DIDEVTYPEJOYSTICK_FLIGHTSTICK 3 +#define DIDEVTYPEJOYSTICK_GAMEPAD 4 +#define DIDEVTYPEJOYSTICK_RUDDER 5 +#define DIDEVTYPEJOYSTICK_WHEEL 6 +#define DIDEVTYPEJOYSTICK_HEADTRACKER 7 + +#else +#define DI8DEVTYPEMOUSE_UNKNOWN 1 +#define DI8DEVTYPEMOUSE_TRADITIONAL 2 +#define DI8DEVTYPEMOUSE_FINGERSTICK 3 +#define DI8DEVTYPEMOUSE_TOUCHPAD 4 +#define DI8DEVTYPEMOUSE_TRACKBALL 5 +#define DI8DEVTYPEMOUSE_ABSOLUTE 6 + +#define DI8DEVTYPEKEYBOARD_UNKNOWN 0 +#define DI8DEVTYPEKEYBOARD_PCXT 1 +#define DI8DEVTYPEKEYBOARD_OLIVETTI 2 +#define DI8DEVTYPEKEYBOARD_PCAT 3 +#define DI8DEVTYPEKEYBOARD_PCENH 4 +#define DI8DEVTYPEKEYBOARD_NOKIA1050 5 +#define DI8DEVTYPEKEYBOARD_NOKIA9140 6 +#define DI8DEVTYPEKEYBOARD_NEC98 7 +#define DI8DEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DI8DEVTYPEKEYBOARD_NEC98106 9 +#define DI8DEVTYPEKEYBOARD_JAPAN106 10 +#define DI8DEVTYPEKEYBOARD_JAPANAX 11 +#define DI8DEVTYPEKEYBOARD_J3100 12 + +#define DI8DEVTYPE_LIMITEDGAMESUBTYPE 1 + +#define DI8DEVTYPEJOYSTICK_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEJOYSTICK_STANDARD 2 + +#define DI8DEVTYPEGAMEPAD_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEGAMEPAD_STANDARD 2 +#define DI8DEVTYPEGAMEPAD_TILT 3 + +#define DI8DEVTYPEDRIVING_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEDRIVING_COMBINEDPEDALS 2 +#define DI8DEVTYPEDRIVING_DUALPEDALS 3 +#define DI8DEVTYPEDRIVING_THREEPEDALS 4 +#define DI8DEVTYPEDRIVING_HANDHELD 5 + +#define DI8DEVTYPEFLIGHT_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEFLIGHT_STICK 2 +#define DI8DEVTYPEFLIGHT_YOKE 3 +#define DI8DEVTYPEFLIGHT_RC 4 + +#define DI8DEVTYPE1STPERSON_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPE1STPERSON_UNKNOWN 2 +#define DI8DEVTYPE1STPERSON_SIXDOF 3 +#define DI8DEVTYPE1STPERSON_SHOOTER 4 + +#define DI8DEVTYPESCREENPTR_UNKNOWN 2 +#define DI8DEVTYPESCREENPTR_LIGHTGUN 3 +#define DI8DEVTYPESCREENPTR_LIGHTPEN 4 +#define DI8DEVTYPESCREENPTR_TOUCH 5 + +#define DI8DEVTYPEREMOTE_UNKNOWN 2 + +#define DI8DEVTYPEDEVICECTRL_UNKNOWN 2 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION 3 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED 4 + +#define DI8DEVTYPESUPPLEMENTAL_UNKNOWN 2 +#define DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER 3 +#define DI8DEVTYPESUPPLEMENTAL_HEADTRACKER 4 +#define DI8DEVTYPESUPPLEMENTAL_HANDTRACKER 5 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE 6 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTER 7 +#define DI8DEVTYPESUPPLEMENTAL_THROTTLE 8 +#define DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE 9 +#define DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS 10 +#define DI8DEVTYPESUPPLEMENTAL_DUALPEDALS 11 +#define DI8DEVTYPESUPPLEMENTAL_THREEPEDALS 12 +#define DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS 13 +#endif /* DIRECTINPUT_VERSION <= 0x700 */ + +#define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) +#define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* This structure is defined for DirectX 3.0 compatibility */ +typedef struct DIDEVCAPS_DX3 { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +} DIDEVCAPS_DX3, *LPDIDEVCAPS_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVCAPS { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFSamplePeriod; + DWORD dwFFMinTimeResolution; + DWORD dwFirmwareRevision; + DWORD dwHardwareRevision; + DWORD dwFFDriverVersion; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVCAPS, *LPDIDEVCAPS; + +#define DIDC_ATTACHED 0x00000001 +#define DIDC_POLLEDDEVICE 0x00000002 +#define DIDC_EMULATED 0x00000004 +#define DIDC_POLLEDDATAFORMAT 0x00000008 +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIDC_FORCEFEEDBACK 0x00000100 +#define DIDC_FFATTACK 0x00000200 +#define DIDC_FFFADE 0x00000400 +#define DIDC_SATURATION 0x00000800 +#define DIDC_POSNEGCOEFFICIENTS 0x00001000 +#define DIDC_POSNEGSATURATION 0x00002000 +#define DIDC_DEADBAND 0x00004000 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#define DIDC_STARTDELAY 0x00008000 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDC_ALIAS 0x00010000 +#define DIDC_PHANTOM 0x00020000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIDC_HIDDEN 0x00040000 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#define DIDFT_ALL 0x00000000 + +#define DIDFT_RELAXIS 0x00000001 +#define DIDFT_ABSAXIS 0x00000002 +#define DIDFT_AXIS 0x00000003 + +#define DIDFT_PSHBUTTON 0x00000004 +#define DIDFT_TGLBUTTON 0x00000008 +#define DIDFT_BUTTON 0x0000000C + +#define DIDFT_POV 0x00000010 +#define DIDFT_COLLECTION 0x00000040 +#define DIDFT_NODATA 0x00000080 + +#define DIDFT_ANYINSTANCE 0x00FFFF00 +#define DIDFT_INSTANCEMASK DIDFT_ANYINSTANCE +#define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8) +#define DIDFT_GETTYPE(n) LOBYTE(n) +#define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8) +#define DIDFT_FFACTUATOR 0x01000000 +#define DIDFT_FFEFFECTTRIGGER 0x02000000 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDFT_OUTPUT 0x10000000 +#define DIDFT_VENDORDEFINED 0x04000000 +#define DIDFT_ALIAS 0x08000000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#ifndef DIDFT_OPTIONAL +#define DIDFT_OPTIONAL 0x80000000 +#endif + +#define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8) +#define DIDFT_NOCOLLECTION 0x00FFFF00 + +#ifndef DIJ_RINGZERO + +typedef struct _DIOBJECTDATAFORMAT { + const GUID *pguid; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; +} DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT; +typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT; + +typedef struct _DIDATAFORMAT { + DWORD dwSize; + DWORD dwObjSize; + DWORD dwFlags; + DWORD dwDataSize; + DWORD dwNumObjs; + LPDIOBJECTDATAFORMAT rgodf; +} DIDATAFORMAT, *LPDIDATAFORMAT; +typedef const DIDATAFORMAT *LPCDIDATAFORMAT; + +#define DIDF_ABSAXIS 0x00000001 +#define DIDF_RELAXIS 0x00000002 + +#ifdef __cplusplus +extern "C" { +#endif +extern const DIDATAFORMAT c_dfDIMouse; + +#if(DIRECTINPUT_VERSION >= 0x0700) +extern const DIDATAFORMAT c_dfDIMouse2; +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +extern const DIDATAFORMAT c_dfDIKeyboard; + +#if(DIRECTINPUT_VERSION >= 0x0500) +extern const DIDATAFORMAT c_dfDIJoystick; +extern const DIDATAFORMAT c_dfDIJoystick2; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +#ifdef __cplusplus +}; +#endif + + +#if DIRECTINPUT_VERSION > 0x0700 + +typedef struct _DIACTIONA { + UINT_PTR uAppData; + DWORD dwSemantic; + OPTIONAL DWORD dwFlags; + OPTIONAL union { + LPCSTR lptszActionName; + UINT uResIdString; + }; + OPTIONAL GUID guidInstance; + OPTIONAL DWORD dwObjID; + OPTIONAL DWORD dwHow; +} DIACTIONA, *LPDIACTIONA ; +typedef struct _DIACTIONW { + UINT_PTR uAppData; + DWORD dwSemantic; + OPTIONAL DWORD dwFlags; + OPTIONAL union { + LPCWSTR lptszActionName; + UINT uResIdString; + }; + OPTIONAL GUID guidInstance; + OPTIONAL DWORD dwObjID; + OPTIONAL DWORD dwHow; +} DIACTIONW, *LPDIACTIONW ; +#ifdef UNICODE +typedef DIACTIONW DIACTION; +typedef LPDIACTIONW LPDIACTION; +#else +typedef DIACTIONA DIACTION; +typedef LPDIACTIONA LPDIACTION; +#endif // UNICODE + +typedef const DIACTIONA *LPCDIACTIONA; +typedef const DIACTIONW *LPCDIACTIONW; +#ifdef UNICODE +typedef DIACTIONW DIACTION; +typedef LPCDIACTIONW LPCDIACTION; +#else +typedef DIACTIONA DIACTION; +typedef LPCDIACTIONA LPCDIACTION; +#endif // UNICODE +typedef const DIACTION *LPCDIACTION; + + +#define DIA_FORCEFEEDBACK 0x00000001 +#define DIA_APPMAPPED 0x00000002 +#define DIA_APPNOMAP 0x00000004 +#define DIA_NORANGE 0x00000008 +#define DIA_APPFIXED 0x00000010 + +#define DIAH_UNMAPPED 0x00000000 +#define DIAH_USERCONFIG 0x00000001 +#define DIAH_APPREQUESTED 0x00000002 +#define DIAH_HWAPP 0x00000004 +#define DIAH_HWDEFAULT 0x00000008 +#define DIAH_DEFAULT 0x00000020 +#define DIAH_ERROR 0x80000000 + +typedef struct _DIACTIONFORMATA { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONA rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + OPTIONAL LONG lAxisMin; + OPTIONAL LONG lAxisMax; + OPTIONAL HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + CHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATA, *LPDIACTIONFORMATA; +typedef struct _DIACTIONFORMATW { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONW rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + OPTIONAL LONG lAxisMin; + OPTIONAL LONG lAxisMax; + OPTIONAL HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + WCHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATW, *LPDIACTIONFORMATW; +#ifdef UNICODE +typedef DIACTIONFORMATW DIACTIONFORMAT; +typedef LPDIACTIONFORMATW LPDIACTIONFORMAT; +#else +typedef DIACTIONFORMATA DIACTIONFORMAT; +typedef LPDIACTIONFORMATA LPDIACTIONFORMAT; +#endif // UNICODE +typedef const DIACTIONFORMATA *LPCDIACTIONFORMATA; +typedef const DIACTIONFORMATW *LPCDIACTIONFORMATW; +#ifdef UNICODE +typedef DIACTIONFORMATW DIACTIONFORMAT; +typedef LPCDIACTIONFORMATW LPCDIACTIONFORMAT; +#else +typedef DIACTIONFORMATA DIACTIONFORMAT; +typedef LPCDIACTIONFORMATA LPCDIACTIONFORMAT; +#endif // UNICODE +typedef const DIACTIONFORMAT *LPCDIACTIONFORMAT; + +#define DIAFTS_NEWDEVICELOW 0xFFFFFFFF +#define DIAFTS_NEWDEVICEHIGH 0xFFFFFFFF +#define DIAFTS_UNUSEDDEVICELOW 0x00000000 +#define DIAFTS_UNUSEDDEVICEHIGH 0x00000000 + +#define DIDBAM_DEFAULT 0x00000000 +#define DIDBAM_PRESERVE 0x00000001 +#define DIDBAM_INITIALIZE 0x00000002 +#define DIDBAM_HWDEFAULTS 0x00000004 + +#define DIDSAM_DEFAULT 0x00000000 +#define DIDSAM_NOUSER 0x00000001 +#define DIDSAM_FORCESAVE 0x00000002 + +#define DICD_DEFAULT 0x00000000 +#define DICD_EDIT 0x00000001 + +/* + * The following definition is normally defined in d3dtypes.h + */ +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +typedef struct _DICOLORSET{ + DWORD dwSize; + D3DCOLOR cTextFore; + D3DCOLOR cTextHighlight; + D3DCOLOR cCalloutLine; + D3DCOLOR cCalloutHighlight; + D3DCOLOR cBorder; + D3DCOLOR cControlFill; + D3DCOLOR cHighlightFill; + D3DCOLOR cAreaFill; +} DICOLORSET, *LPDICOLORSET; +typedef const DICOLORSET *LPCDICOLORSET; + + +typedef struct _DICONFIGUREDEVICESPARAMSA{ + DWORD dwSize; + DWORD dwcUsers; + LPSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATA lprgFormats; + HWND hwnd; + DICOLORSET dics; + IUnknown FAR * lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSA, *LPDICONFIGUREDEVICESPARAMSA; +typedef struct _DICONFIGUREDEVICESPARAMSW{ + DWORD dwSize; + DWORD dwcUsers; + LPWSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATW lprgFormats; + HWND hwnd; + DICOLORSET dics; + IUnknown FAR * lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSW, *LPDICONFIGUREDEVICESPARAMSW; +#ifdef UNICODE +typedef DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMS; +typedef LPDICONFIGUREDEVICESPARAMSW LPDICONFIGUREDEVICESPARAMS; +#else +typedef DICONFIGUREDEVICESPARAMSA DICONFIGUREDEVICESPARAMS; +typedef LPDICONFIGUREDEVICESPARAMSA LPDICONFIGUREDEVICESPARAMS; +#endif // UNICODE +typedef const DICONFIGUREDEVICESPARAMSA *LPCDICONFIGUREDEVICESPARAMSA; +typedef const DICONFIGUREDEVICESPARAMSW *LPCDICONFIGUREDEVICESPARAMSW; +#ifdef UNICODE +typedef DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMS; +typedef LPCDICONFIGUREDEVICESPARAMSW LPCDICONFIGUREDEVICESPARAMS; +#else +typedef DICONFIGUREDEVICESPARAMSA DICONFIGUREDEVICESPARAMS; +typedef LPCDICONFIGUREDEVICESPARAMSA LPCDICONFIGUREDEVICESPARAMS; +#endif // UNICODE +typedef const DICONFIGUREDEVICESPARAMS *LPCDICONFIGUREDEVICESPARAMS; + + +#define DIDIFT_CONFIGURATION 0x00000001 +#define DIDIFT_OVERLAY 0x00000002 + +#define DIDAL_CENTERED 0x00000000 +#define DIDAL_LEFTALIGNED 0x00000001 +#define DIDAL_RIGHTALIGNED 0x00000002 +#define DIDAL_MIDDLE 0x00000000 +#define DIDAL_TOPALIGNED 0x00000004 +#define DIDAL_BOTTOMALIGNED 0x00000008 + +typedef struct _DIDEVICEIMAGEINFOA { + CHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOA, *LPDIDEVICEIMAGEINFOA; +typedef struct _DIDEVICEIMAGEINFOW { + WCHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOW, *LPDIDEVICEIMAGEINFOW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFO; +typedef LPDIDEVICEIMAGEINFOW LPDIDEVICEIMAGEINFO; +#else +typedef DIDEVICEIMAGEINFOA DIDEVICEIMAGEINFO; +typedef LPDIDEVICEIMAGEINFOA LPDIDEVICEIMAGEINFO; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOA *LPCDIDEVICEIMAGEINFOA; +typedef const DIDEVICEIMAGEINFOW *LPCDIDEVICEIMAGEINFOW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFO; +typedef LPCDIDEVICEIMAGEINFOW LPCDIDEVICEIMAGEINFO; +#else +typedef DIDEVICEIMAGEINFOA DIDEVICEIMAGEINFO; +typedef LPCDIDEVICEIMAGEINFOA LPCDIDEVICEIMAGEINFO; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFO *LPCDIDEVICEIMAGEINFO; + +typedef struct _DIDEVICEIMAGEINFOHEADERA { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOA lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERA, *LPDIDEVICEIMAGEINFOHEADERA; +typedef struct _DIDEVICEIMAGEINFOHEADERW { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOW lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERW, *LPDIDEVICEIMAGEINFOHEADERW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADER; +typedef LPDIDEVICEIMAGEINFOHEADERW LPDIDEVICEIMAGEINFOHEADER; +#else +typedef DIDEVICEIMAGEINFOHEADERA DIDEVICEIMAGEINFOHEADER; +typedef LPDIDEVICEIMAGEINFOHEADERA LPDIDEVICEIMAGEINFOHEADER; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOHEADERA *LPCDIDEVICEIMAGEINFOHEADERA; +typedef const DIDEVICEIMAGEINFOHEADERW *LPCDIDEVICEIMAGEINFOHEADERW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADER; +typedef LPCDIDEVICEIMAGEINFOHEADERW LPCDIDEVICEIMAGEINFOHEADER; +#else +typedef DIDEVICEIMAGEINFOHEADERA DIDEVICEIMAGEINFOHEADER; +typedef LPCDIDEVICEIMAGEINFOHEADERA LPCDIDEVICEIMAGEINFOHEADER; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOHEADER *LPCDIDEVICEIMAGEINFOHEADER; + +#endif /* DIRECTINPUT_VERSION > 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* These structures are defined for DirectX 3.0 compatibility */ + +typedef struct DIDEVICEOBJECTINSTANCE_DX3A { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3A, *LPDIDEVICEOBJECTINSTANCE_DX3A; +typedef struct DIDEVICEOBJECTINSTANCE_DX3W { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3W, *LPDIDEVICEOBJECTINSTANCE_DX3W; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCE_DX3W DIDEVICEOBJECTINSTANCE_DX3; +typedef LPDIDEVICEOBJECTINSTANCE_DX3W LPDIDEVICEOBJECTINSTANCE_DX3; +#else +typedef DIDEVICEOBJECTINSTANCE_DX3A DIDEVICEOBJECTINSTANCE_DX3; +typedef LPDIDEVICEOBJECTINSTANCE_DX3A LPDIDEVICEOBJECTINSTANCE_DX3; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCE_DX3A *LPCDIDEVICEOBJECTINSTANCE_DX3A; +typedef const DIDEVICEOBJECTINSTANCE_DX3W *LPCDIDEVICEOBJECTINSTANCE_DX3W; +typedef const DIDEVICEOBJECTINSTANCE_DX3 *LPCDIDEVICEOBJECTINSTANCE_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVICEOBJECTINSTANCEA { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReportId; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA; +typedef struct DIDEVICEOBJECTINSTANCEW { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReportId; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCEW DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEW LPDIDEVICEOBJECTINSTANCE; +#else +typedef DIDEVICEOBJECTINSTANCEA DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEA LPDIDEVICEOBJECTINSTANCE; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA; +typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW; +typedef const DIDEVICEOBJECTINSTANCE *LPCDIDEVICEOBJECTINSTANCE; + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKW +#else +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKA +#endif // !UNICODE + +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIDOI_FFACTUATOR 0x00000001 +#define DIDOI_FFEFFECTTRIGGER 0x00000002 +#define DIDOI_POLLED 0x00008000 +#define DIDOI_ASPECTPOSITION 0x00000100 +#define DIDOI_ASPECTVELOCITY 0x00000200 +#define DIDOI_ASPECTACCEL 0x00000300 +#define DIDOI_ASPECTFORCE 0x00000400 +#define DIDOI_ASPECTMASK 0x00000F00 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDOI_GUIDISUSAGE 0x00010000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +typedef struct DIPROPHEADER { + DWORD dwSize; + DWORD dwHeaderSize; + DWORD dwObj; + DWORD dwHow; +} DIPROPHEADER, *LPDIPROPHEADER; +typedef const DIPROPHEADER *LPCDIPROPHEADER; + +#define DIPH_DEVICE 0 +#define DIPH_BYOFFSET 1 +#define DIPH_BYID 2 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIPH_BYUSAGE 3 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIMAKEUSAGEDWORD(UsagePage, Usage) \ + (DWORD)MAKELONG(Usage, UsagePage) +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +typedef struct DIPROPDWORD { + DIPROPHEADER diph; + DWORD dwData; +} DIPROPDWORD, *LPDIPROPDWORD; +typedef const DIPROPDWORD *LPCDIPROPDWORD; + +#if(DIRECTINPUT_VERSION >= 0x0800) +typedef struct DIPROPPOINTER { + DIPROPHEADER diph; + UINT_PTR uData; +} DIPROPPOINTER, *LPDIPROPPOINTER; +typedef const DIPROPPOINTER *LPCDIPROPPOINTER; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +typedef struct DIPROPRANGE { + DIPROPHEADER diph; + LONG lMin; + LONG lMax; +} DIPROPRANGE, *LPDIPROPRANGE; +typedef const DIPROPRANGE *LPCDIPROPRANGE; + +#define DIPROPRANGE_NOMIN ((LONG)0x80000000) +#define DIPROPRANGE_NOMAX ((LONG)0x7FFFFFFF) + +#if(DIRECTINPUT_VERSION >= 0x050a) +typedef struct DIPROPCAL { + DIPROPHEADER diph; + LONG lMin; + LONG lCenter; + LONG lMax; +} DIPROPCAL, *LPDIPROPCAL; +typedef const DIPROPCAL *LPCDIPROPCAL; + +typedef struct DIPROPCALPOV { + DIPROPHEADER diph; + LONG lMin[5]; + LONG lMax[5]; +} DIPROPCALPOV, *LPDIPROPCALPOV; +typedef const DIPROPCALPOV *LPCDIPROPCALPOV; + +typedef struct DIPROPGUIDANDPATH { + DIPROPHEADER diph; + GUID guidClass; + WCHAR wszPath[MAX_PATH]; +} DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH; +typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH; + +typedef struct DIPROPSTRING { + DIPROPHEADER diph; + WCHAR wsz[MAX_PATH]; +} DIPROPSTRING, *LPDIPROPSTRING; +typedef const DIPROPSTRING *LPCDIPROPSTRING; + +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define MAXCPOINTSNUM 8 + +typedef struct _CPOINT +{ + LONG lP; // raw value + DWORD dwLog; // logical_value / max_logical_value * 10000 +} CPOINT, *PCPOINT; + +typedef struct DIPROPCPOINTS { + DIPROPHEADER diph; + DWORD dwCPointsNum; + CPOINT cp[MAXCPOINTSNUM]; +} DIPROPCPOINTS, *LPDIPROPCPOINTS; +typedef const DIPROPCPOINTS *LPCDIPROPCPOINTS; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +#ifdef __cplusplus +#define MAKEDIPROP(prop) (*(const GUID *)(prop)) +#else +#define MAKEDIPROP(prop) ((REFGUID)(prop)) +#endif + +#define DIPROP_BUFFERSIZE MAKEDIPROP(1) + +#define DIPROP_AXISMODE MAKEDIPROP(2) + +#define DIPROPAXISMODE_ABS 0 +#define DIPROPAXISMODE_REL 1 + +#define DIPROP_GRANULARITY MAKEDIPROP(3) + +#define DIPROP_RANGE MAKEDIPROP(4) + +#define DIPROP_DEADZONE MAKEDIPROP(5) + +#define DIPROP_SATURATION MAKEDIPROP(6) + +#define DIPROP_FFGAIN MAKEDIPROP(7) + +#define DIPROP_FFLOAD MAKEDIPROP(8) + +#define DIPROP_AUTOCENTER MAKEDIPROP(9) + +#define DIPROPAUTOCENTER_OFF 0 +#define DIPROPAUTOCENTER_ON 1 + +#define DIPROP_CALIBRATIONMODE MAKEDIPROP(10) + +#define DIPROPCALIBRATIONMODE_COOKED 0 +#define DIPROPCALIBRATIONMODE_RAW 1 + +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIPROP_CALIBRATION MAKEDIPROP(11) + +#define DIPROP_GUIDANDPATH MAKEDIPROP(12) + +#define DIPROP_INSTANCENAME MAKEDIPROP(13) + +#define DIPROP_PRODUCTNAME MAKEDIPROP(14) +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x05b2) +#define DIPROP_JOYSTICKID MAKEDIPROP(15) + +#define DIPROP_GETPORTDISPLAYNAME MAKEDIPROP(16) + +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ + +#if(DIRECTINPUT_VERSION >= 0x0700) +#define DIPROP_PHYSICALRANGE MAKEDIPROP(18) + +#define DIPROP_LOGICALRANGE MAKEDIPROP(19) +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIPROP_KEYNAME MAKEDIPROP(20) + +#define DIPROP_CPOINTS MAKEDIPROP(21) + +#define DIPROP_APPDATA MAKEDIPROP(22) + +#define DIPROP_SCANCODE MAKEDIPROP(23) + +#define DIPROP_VIDPID MAKEDIPROP(24) + +#define DIPROP_USERNAME MAKEDIPROP(25) + +#define DIPROP_TYPENAME MAKEDIPROP(26) +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +typedef struct DIDEVICEOBJECTDATA_DX3 { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +} DIDEVICEOBJECTDATA_DX3, *LPDIDEVICEOBJECTDATA_DX3; +typedef const DIDEVICEOBJECTDATA_DX3 *LPCDIDEVICEOBJECTDATA_DX; + +typedef struct DIDEVICEOBJECTDATA { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +#if(DIRECTINPUT_VERSION >= 0x0800) + UINT_PTR uAppData; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ +} DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA; +typedef const DIDEVICEOBJECTDATA *LPCDIDEVICEOBJECTDATA; + +#define DIGDD_PEEK 0x00000001 + +#define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \ + ((int)((dwSequence1) - (dwSequence2)) cmp 0) +#define DISCL_EXCLUSIVE 0x00000001 +#define DISCL_NONEXCLUSIVE 0x00000002 +#define DISCL_FOREGROUND 0x00000004 +#define DISCL_BACKGROUND 0x00000008 +#define DISCL_NOWINKEY 0x00000010 + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* These structures are defined for DirectX 3.0 compatibility */ + +typedef struct DIDEVICEINSTANCE_DX3A { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3A, *LPDIDEVICEINSTANCE_DX3A; +typedef struct DIDEVICEINSTANCE_DX3W { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3W, *LPDIDEVICEINSTANCE_DX3W; +#ifdef UNICODE +typedef DIDEVICEINSTANCE_DX3W DIDEVICEINSTANCE_DX3; +typedef LPDIDEVICEINSTANCE_DX3W LPDIDEVICEINSTANCE_DX3; +#else +typedef DIDEVICEINSTANCE_DX3A DIDEVICEINSTANCE_DX3; +typedef LPDIDEVICEINSTANCE_DX3A LPDIDEVICEINSTANCE_DX3; +#endif // UNICODE +typedef const DIDEVICEINSTANCE_DX3A *LPCDIDEVICEINSTANCE_DX3A; +typedef const DIDEVICEINSTANCE_DX3W *LPCDIDEVICEINSTANCE_DX3W; +typedef const DIDEVICEINSTANCE_DX3 *LPCDIDEVICEINSTANCE_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVICEINSTANCEA { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA; +typedef struct DIDEVICEINSTANCEW { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE; +#endif // UNICODE + +typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA; +typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPCDIDEVICEINSTANCEW LPCDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPCDIDEVICEINSTANCEA LPCDIDEVICEINSTANCE; +#endif // UNICODE +typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceW + +DECLARE_INTERFACE_(IDirectInputDeviceW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceA + +DECLARE_INTERFACE_(IDirectInputDeviceA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA; + +#ifdef UNICODE +#define IID_IDirectInputDevice IID_IDirectInputDeviceW +#define IDirectInputDevice IDirectInputDeviceW +#define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl +#else +#define IID_IDirectInputDevice IID_IDirectInputDeviceA +#define IDirectInputDevice IDirectInputDeviceA +#define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl +#endif +typedef struct IDirectInputDevice *LPDIRECTINPUTDEVICE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#else +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice_AddRef(p) (p)->AddRef() +#define IDirectInputDevice_Release(p) (p)->Release() +#define IDirectInputDevice_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice_Acquire(p) (p)->Acquire() +#define IDirectInputDevice_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#endif + +#endif /* DIJ_RINGZERO */ + + +#if(DIRECTINPUT_VERSION >= 0x0500) + +#define DISFFC_RESET 0x00000001 +#define DISFFC_STOPALL 0x00000002 +#define DISFFC_PAUSE 0x00000004 +#define DISFFC_CONTINUE 0x00000008 +#define DISFFC_SETACTUATORSON 0x00000010 +#define DISFFC_SETACTUATORSOFF 0x00000020 + +#define DIGFFS_EMPTY 0x00000001 +#define DIGFFS_STOPPED 0x00000002 +#define DIGFFS_PAUSED 0x00000004 +#define DIGFFS_ACTUATORSON 0x00000010 +#define DIGFFS_ACTUATORSOFF 0x00000020 +#define DIGFFS_POWERON 0x00000040 +#define DIGFFS_POWEROFF 0x00000080 +#define DIGFFS_SAFETYSWITCHON 0x00000100 +#define DIGFFS_SAFETYSWITCHOFF 0x00000200 +#define DIGFFS_USERFFSWITCHON 0x00000400 +#define DIGFFS_USERFFSWITCHOFF 0x00000800 +#define DIGFFS_DEVICELOST 0x80000000 + +#ifndef DIJ_RINGZERO + +typedef struct DIEFFECTINFOA { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + CHAR tszName[MAX_PATH]; +} DIEFFECTINFOA, *LPDIEFFECTINFOA; +typedef struct DIEFFECTINFOW { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + WCHAR tszName[MAX_PATH]; +} DIEFFECTINFOW, *LPDIEFFECTINFOW; +#ifdef UNICODE +typedef DIEFFECTINFOW DIEFFECTINFO; +typedef LPDIEFFECTINFOW LPDIEFFECTINFO; +#else +typedef DIEFFECTINFOA DIEFFECTINFO; +typedef LPDIEFFECTINFOA LPDIEFFECTINFO; +#endif // UNICODE +typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA; +typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW; +typedef const DIEFFECTINFO *LPCDIEFFECTINFO; + +#define DISDD_CONTINUE 0x00000001 + +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID); +#ifdef UNICODE +#define LPDIENUMEFFECTSCALLBACK LPDIENUMEFFECTSCALLBACKW +#else +#define LPDIENUMEFFECTSCALLBACK LPDIENUMEFFECTSCALLBACKA +#endif // !UNICODE +typedef BOOL (FAR PASCAL * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID); + +#undef INTERFACE +#define INTERFACE IDirectInputDevice2W + +DECLARE_INTERFACE_(IDirectInputDevice2W, IDirectInputDeviceW) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; +}; + +typedef struct IDirectInputDevice2W *LPDIRECTINPUTDEVICE2W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice2A + +DECLARE_INTERFACE_(IDirectInputDevice2A, IDirectInputDeviceA) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; +}; + +typedef struct IDirectInputDevice2A *LPDIRECTINPUTDEVICE2A; + +#ifdef UNICODE +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2W +#define IDirectInputDevice2 IDirectInputDevice2W +#define IDirectInputDevice2Vtbl IDirectInputDevice2WVtbl +#else +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2A +#define IDirectInputDevice2 IDirectInputDevice2A +#define IDirectInputDevice2Vtbl IDirectInputDevice2AVtbl +#endif +typedef struct IDirectInputDevice2 *LPDIRECTINPUTDEVICE2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice2_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice2_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice2_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#else +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice2_AddRef(p) (p)->AddRef() +#define IDirectInputDevice2_Release(p) (p)->Release() +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice2_Acquire(p) (p)->Acquire() +#define IDirectInputDevice2_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice2_Poll(p) (p)->Poll() +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +#if(DIRECTINPUT_VERSION >= 0x0700) +#define DIFEF_DEFAULT 0x00000000 +#define DIFEF_INCLUDENONSTANDARD 0x00000001 +#define DIFEF_MODIFYIFNEEDED 0x00000010 + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputDevice7W + +DECLARE_INTERFACE_(IDirectInputDevice7W, IDirectInputDevice2W) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + + /*** IDirectInputDevice7W methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; +}; + +typedef struct IDirectInputDevice7W *LPDIRECTINPUTDEVICE7W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice7A + +DECLARE_INTERFACE_(IDirectInputDevice7A, IDirectInputDevice2A) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + + /*** IDirectInputDevice7A methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; +}; + +typedef struct IDirectInputDevice7A *LPDIRECTINPUTDEVICE7A; + +#ifdef UNICODE +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7W +#define IDirectInputDevice7 IDirectInputDevice7W +#define IDirectInputDevice7Vtbl IDirectInputDevice7WVtbl +#else +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7A +#define IDirectInputDevice7 IDirectInputDevice7A +#define IDirectInputDevice7Vtbl IDirectInputDevice7AVtbl +#endif +typedef struct IDirectInputDevice7 *LPDIRECTINPUTDEVICE7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice7_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice7_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice7_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#else +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice7_AddRef(p) (p)->AddRef() +#define IDirectInputDevice7_Release(p) (p)->Release() +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice7_Acquire(p) (p)->Acquire() +#define IDirectInputDevice7_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice7_Poll(p) (p)->Poll() +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputDevice8W + +DECLARE_INTERFACE_(IDirectInputDevice8W, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice8W methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATW,LPCWSTR,DWORD) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATW,LPCWSTR,DWORD) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERW) PURE; +}; + +typedef struct IDirectInputDevice8W *LPDIRECTINPUTDEVICE8W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice8A + +DECLARE_INTERFACE_(IDirectInputDevice8A, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice8A methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATA,LPCSTR,DWORD) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATA,LPCSTR,DWORD) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERA) PURE; +}; + +typedef struct IDirectInputDevice8A *LPDIRECTINPUTDEVICE8A; + +#ifdef UNICODE +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8W +#define IDirectInputDevice8 IDirectInputDevice8W +#define IDirectInputDevice8Vtbl IDirectInputDevice8WVtbl +#else +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8A +#define IDirectInputDevice8 IDirectInputDevice8A +#define IDirectInputDevice8Vtbl IDirectInputDevice8AVtbl +#endif +typedef struct IDirectInputDevice8 *LPDIRECTINPUTDEVICE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice8_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice8_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice8_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->lpVtbl->BuildActionMap(p,a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->lpVtbl->SetActionMap(p,a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->lpVtbl->GetImageInfo(p,a) +#else +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice8_AddRef(p) (p)->AddRef() +#define IDirectInputDevice8_Release(p) (p)->Release() +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice8_Acquire(p) (p)->Acquire() +#define IDirectInputDevice8_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice8_Poll(p) (p)->Poll() +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->BuildActionMap(a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->SetActionMap(a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->GetImageInfo(a) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +/**************************************************************************** + * + * Mouse + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +typedef struct _DIMOUSESTATE { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[4]; +} DIMOUSESTATE, *LPDIMOUSESTATE; + +#if DIRECTINPUT_VERSION >= 0x0700 +typedef struct _DIMOUSESTATE2 { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[8]; +} DIMOUSESTATE2, *LPDIMOUSESTATE2; +#endif + + +#define DIMOFS_X FIELD_OFFSET(DIMOUSESTATE, lX) +#define DIMOFS_Y FIELD_OFFSET(DIMOUSESTATE, lY) +#define DIMOFS_Z FIELD_OFFSET(DIMOUSESTATE, lZ) +#define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) +#define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) +#define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) +#define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) +#if (DIRECTINPUT_VERSION >= 0x0700) +#define DIMOFS_BUTTON4 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 4) +#define DIMOFS_BUTTON5 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 5) +#define DIMOFS_BUTTON6 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 6) +#define DIMOFS_BUTTON7 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 7) +#endif +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Keyboard + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +/**************************************************************************** + * + * DirectInput keyboard scan codes + * + ****************************************************************************/ +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_OEM_102 0x56 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_ABNT_C1 0x73 /* /? on Brazilian keyboard */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_ABNT_C2 0x7E /* Numpad . on Brazilian keyboard */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NEXTTRACK 0x99 /* Next Track */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_MUTE 0xA0 /* Mute */ +#define DIK_CALCULATOR 0xA1 /* Calculator */ +#define DIK_PLAYPAUSE 0xA2 /* Play / Pause */ +#define DIK_MEDIASTOP 0xA4 /* Media Stop */ +#define DIK_VOLUMEDOWN 0xAE /* Volume - */ +#define DIK_VOLUMEUP 0xB0 /* Volume + */ +#define DIK_WEBHOME 0xB2 /* Web home */ +#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE /* System Power */ +#define DIK_SLEEP 0xDF /* System Sleep */ +#define DIK_WAKE 0xE3 /* System Wake */ +#define DIK_WEBSEARCH 0xE5 /* Web Search */ +#define DIK_WEBFAVORITES 0xE6 /* Web Favorites */ +#define DIK_WEBREFRESH 0xE7 /* Web Refresh */ +#define DIK_WEBSTOP 0xE8 /* Web Stop */ +#define DIK_WEBFORWARD 0xE9 /* Web Forward */ +#define DIK_WEBBACK 0xEA /* Web Back */ +#define DIK_MYCOMPUTER 0xEB /* My Computer */ +#define DIK_MAIL 0xEC /* Mail */ +#define DIK_MEDIASELECT 0xED /* Media Select */ + +/* + * Alternate names for keys, to facilitate transition from DOS. + */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +/* + * Alternate names for keys originally not used on US keyboards. + */ +#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Joystick + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +typedef struct DIJOYSTATE { + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG rglSlider[2]; /* extra axes positions */ + DWORD rgdwPOV[4]; /* POV directions */ + BYTE rgbButtons[32]; /* 32 buttons */ +} DIJOYSTATE, *LPDIJOYSTATE; + +typedef struct DIJOYSTATE2 { + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG rglSlider[2]; /* extra axes positions */ + DWORD rgdwPOV[4]; /* POV directions */ + BYTE rgbButtons[128]; /* 128 buttons */ + LONG lVX; /* x-axis velocity */ + LONG lVY; /* y-axis velocity */ + LONG lVZ; /* z-axis velocity */ + LONG lVRx; /* x-axis angular velocity */ + LONG lVRy; /* y-axis angular velocity */ + LONG lVRz; /* z-axis angular velocity */ + LONG rglVSlider[2]; /* extra axes velocities */ + LONG lAX; /* x-axis acceleration */ + LONG lAY; /* y-axis acceleration */ + LONG lAZ; /* z-axis acceleration */ + LONG lARx; /* x-axis angular acceleration */ + LONG lARy; /* y-axis angular acceleration */ + LONG lARz; /* z-axis angular acceleration */ + LONG rglASlider[2]; /* extra axes accelerations */ + LONG lFX; /* x-axis force */ + LONG lFY; /* y-axis force */ + LONG lFZ; /* z-axis force */ + LONG lFRx; /* x-axis torque */ + LONG lFRy; /* y-axis torque */ + LONG lFRz; /* z-axis torque */ + LONG rglFSlider[2]; /* extra axes forces */ +} DIJOYSTATE2, *LPDIJOYSTATE2; + +#define DIJOFS_X FIELD_OFFSET(DIJOYSTATE, lX) +#define DIJOFS_Y FIELD_OFFSET(DIJOYSTATE, lY) +#define DIJOFS_Z FIELD_OFFSET(DIJOYSTATE, lZ) +#define DIJOFS_RX FIELD_OFFSET(DIJOYSTATE, lRx) +#define DIJOFS_RY FIELD_OFFSET(DIJOYSTATE, lRy) +#define DIJOFS_RZ FIELD_OFFSET(DIJOYSTATE, lRz) +#define DIJOFS_SLIDER(n) (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \ + (n) * sizeof(LONG)) +#define DIJOFS_POV(n) (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \ + (n) * sizeof(DWORD)) +#define DIJOFS_BUTTON(n) (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n)) +#define DIJOFS_BUTTON0 DIJOFS_BUTTON(0) +#define DIJOFS_BUTTON1 DIJOFS_BUTTON(1) +#define DIJOFS_BUTTON2 DIJOFS_BUTTON(2) +#define DIJOFS_BUTTON3 DIJOFS_BUTTON(3) +#define DIJOFS_BUTTON4 DIJOFS_BUTTON(4) +#define DIJOFS_BUTTON5 DIJOFS_BUTTON(5) +#define DIJOFS_BUTTON6 DIJOFS_BUTTON(6) +#define DIJOFS_BUTTON7 DIJOFS_BUTTON(7) +#define DIJOFS_BUTTON8 DIJOFS_BUTTON(8) +#define DIJOFS_BUTTON9 DIJOFS_BUTTON(9) +#define DIJOFS_BUTTON10 DIJOFS_BUTTON(10) +#define DIJOFS_BUTTON11 DIJOFS_BUTTON(11) +#define DIJOFS_BUTTON12 DIJOFS_BUTTON(12) +#define DIJOFS_BUTTON13 DIJOFS_BUTTON(13) +#define DIJOFS_BUTTON14 DIJOFS_BUTTON(14) +#define DIJOFS_BUTTON15 DIJOFS_BUTTON(15) +#define DIJOFS_BUTTON16 DIJOFS_BUTTON(16) +#define DIJOFS_BUTTON17 DIJOFS_BUTTON(17) +#define DIJOFS_BUTTON18 DIJOFS_BUTTON(18) +#define DIJOFS_BUTTON19 DIJOFS_BUTTON(19) +#define DIJOFS_BUTTON20 DIJOFS_BUTTON(20) +#define DIJOFS_BUTTON21 DIJOFS_BUTTON(21) +#define DIJOFS_BUTTON22 DIJOFS_BUTTON(22) +#define DIJOFS_BUTTON23 DIJOFS_BUTTON(23) +#define DIJOFS_BUTTON24 DIJOFS_BUTTON(24) +#define DIJOFS_BUTTON25 DIJOFS_BUTTON(25) +#define DIJOFS_BUTTON26 DIJOFS_BUTTON(26) +#define DIJOFS_BUTTON27 DIJOFS_BUTTON(27) +#define DIJOFS_BUTTON28 DIJOFS_BUTTON(28) +#define DIJOFS_BUTTON29 DIJOFS_BUTTON(29) +#define DIJOFS_BUTTON30 DIJOFS_BUTTON(30) +#define DIJOFS_BUTTON31 DIJOFS_BUTTON(31) + + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * IDirectInput + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +#define DIENUM_STOP 0 +#define DIENUM_CONTINUE 1 + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKW +#else +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKA +#endif // !UNICODE +typedef BOOL (FAR PASCAL * LPDICONFIGUREDEVICESCALLBACK)(IUnknown FAR *, LPVOID); + +#define DIEDFL_ALLDEVICES 0x00000000 +#define DIEDFL_ATTACHEDONLY 0x00000001 +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIEDFL_FORCEFEEDBACK 0x00000100 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIEDFL_INCLUDEALIASES 0x00010000 +#define DIEDFL_INCLUDEPHANTOMS 0x00020000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDFL_INCLUDEHIDDEN 0x00040000 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +#if(DIRECTINPUT_VERSION >= 0x0800) +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESBYSEMANTICSCBA)(LPCDIDEVICEINSTANCEA, LPDIRECTINPUTDEVICE8A, DWORD, DWORD, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESBYSEMANTICSCBW)(LPCDIDEVICEINSTANCEW, LPDIRECTINPUTDEVICE8W, DWORD, DWORD, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESBYSEMANTICSCB LPDIENUMDEVICESBYSEMANTICSCBW +#else +#define LPDIENUMDEVICESBYSEMANTICSCB LPDIENUMDEVICESBYSEMANTICSCBA +#endif // !UNICODE +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDBS_MAPPEDPRI1 0x00000001 +#define DIEDBS_MAPPEDPRI2 0x00000002 +#define DIEDBS_RECENTDEVICE 0x00000010 +#define DIEDBS_NEWDEVICE 0x00000020 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDBSFL_ATTACHEDONLY 0x00000000 +#define DIEDBSFL_THISUSER 0x00000010 +#define DIEDBSFL_FORCEFEEDBACK DIEDFL_FORCEFEEDBACK +#define DIEDBSFL_AVAILABLEDEVICES 0x00001000 +#define DIEDBSFL_MULTIMICEKEYBOARDS 0x00002000 +#define DIEDBSFL_NONGAMINGDEVICES 0x00004000 +#define DIEDBSFL_VALID 0x00007110 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#undef INTERFACE +#define INTERFACE IDirectInputW + +DECLARE_INTERFACE_(IDirectInputW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputW *LPDIRECTINPUTW; + +#undef INTERFACE +#define INTERFACE IDirectInputA + +DECLARE_INTERFACE_(IDirectInputA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputA *LPDIRECTINPUTA; + +#ifdef UNICODE +#define IID_IDirectInput IID_IDirectInputW +#define IDirectInput IDirectInputW +#define IDirectInputVtbl IDirectInputWVtbl +#else +#define IID_IDirectInput IID_IDirectInputA +#define IDirectInput IDirectInputA +#define IDirectInputVtbl IDirectInputAVtbl +#endif +typedef struct IDirectInput *LPDIRECTINPUT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#else +#define IDirectInput_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput_AddRef(p) (p)->AddRef() +#define IDirectInput_Release(p) (p)->Release() +#define IDirectInput_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput_Initialize(p,a,b) (p)->Initialize(a,b) +#endif + +#undef INTERFACE +#define INTERFACE IDirectInput2W + +DECLARE_INTERFACE_(IDirectInput2W, IDirectInputW) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + + /*** IDirectInput2W methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; +}; + +typedef struct IDirectInput2W *LPDIRECTINPUT2W; + +#undef INTERFACE +#define INTERFACE IDirectInput2A + +DECLARE_INTERFACE_(IDirectInput2A, IDirectInputA) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + + /*** IDirectInput2A methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; +}; + +typedef struct IDirectInput2A *LPDIRECTINPUT2A; + +#ifdef UNICODE +#define IID_IDirectInput2 IID_IDirectInput2W +#define IDirectInput2 IDirectInput2W +#define IDirectInput2Vtbl IDirectInput2WVtbl +#else +#define IID_IDirectInput2 IID_IDirectInput2A +#define IDirectInput2 IDirectInput2A +#define IDirectInput2Vtbl IDirectInput2AVtbl +#endif +typedef struct IDirectInput2 *LPDIRECTINPUT2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput2_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#else +#define IDirectInput2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput2_AddRef(p) (p)->AddRef() +#define IDirectInput2_Release(p) (p)->Release() +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput2_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#endif + + +#undef INTERFACE +#define INTERFACE IDirectInput7W + +DECLARE_INTERFACE_(IDirectInput7W, IDirectInput2W) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput2W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; + + /*** IDirectInput7W methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID,REFIID,LPVOID *,LPUNKNOWN) PURE; +}; + +typedef struct IDirectInput7W *LPDIRECTINPUT7W; + +#undef INTERFACE +#define INTERFACE IDirectInput7A + +DECLARE_INTERFACE_(IDirectInput7A, IDirectInput2A) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput2A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; + + /*** IDirectInput7A methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID,REFIID,LPVOID *,LPUNKNOWN) PURE; +}; + +typedef struct IDirectInput7A *LPDIRECTINPUT7A; + +#ifdef UNICODE +#define IID_IDirectInput7 IID_IDirectInput7W +#define IDirectInput7 IDirectInput7W +#define IDirectInput7Vtbl IDirectInput7WVtbl +#else +#define IID_IDirectInput7 IID_IDirectInput7A +#define IDirectInput7 IDirectInput7A +#define IDirectInput7Vtbl IDirectInput7AVtbl +#endif +typedef struct IDirectInput7 *LPDIRECTINPUT7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput7_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d) +#else +#define IDirectInput7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput7_AddRef(p) (p)->AddRef() +#define IDirectInput7_Release(p) (p)->Release() +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput7_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->CreateDeviceEx(a,b,c,d) +#endif + +#if(DIRECTINPUT_VERSION >= 0x0800) +#undef INTERFACE +#define INTERFACE IDirectInput8W + +DECLARE_INTERFACE_(IDirectInput8W, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput8W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8W *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCWSTR,LPDIACTIONFORMATW,LPDIENUMDEVICESBYSEMANTICSCBW,LPVOID,DWORD) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSW,DWORD,LPVOID) PURE; +}; + +typedef struct IDirectInput8W *LPDIRECTINPUT8W; + +#undef INTERFACE +#define INTERFACE IDirectInput8A + +DECLARE_INTERFACE_(IDirectInput8A, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput8A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8A *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCSTR,LPDIACTIONFORMATA,LPDIENUMDEVICESBYSEMANTICSCBA,LPVOID,DWORD) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSA,DWORD,LPVOID) PURE; +}; + +typedef struct IDirectInput8A *LPDIRECTINPUT8A; + +#ifdef UNICODE +#define IID_IDirectInput8 IID_IDirectInput8W +#define IDirectInput8 IDirectInput8W +#define IDirectInput8Vtbl IDirectInput8WVtbl +#else +#define IID_IDirectInput8 IID_IDirectInput8A +#define IDirectInput8 IDirectInput8A +#define IDirectInput8Vtbl IDirectInput8AVtbl +#endif +typedef struct IDirectInput8 *LPDIRECTINPUT8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->lpVtbl->EnumDevicesBySemantics(p,a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->lpVtbl->ConfigureDevices(p,a,b,c,d) +#else +#define IDirectInput8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput8_AddRef(p) (p)->AddRef() +#define IDirectInput8_Release(p) (p)->Release() +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->EnumDevicesBySemantics(a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->ConfigureDevices(a,b,c,d) +#endif +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if DIRECTINPUT_VERSION > 0x0700 + +extern HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +#else +extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); +extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter); +#ifdef UNICODE +#define DirectInputCreate DirectInputCreateW +#else +#define DirectInputCreate DirectInputCreateA +#endif // !UNICODE + +extern HRESULT WINAPI DirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +#endif /* DIRECTINPUT_VERSION > 0x700 */ + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * Return Codes + * + ****************************************************************************/ + +/* + * The operation completed successfully. + */ +#define DI_OK S_OK + +/* + * The device exists but is not currently attached. + */ +#define DI_NOTATTACHED S_FALSE + +/* + * The device buffer overflowed. Some input was lost. + */ +#define DI_BUFFEROVERFLOW S_FALSE + +/* + * The change in device properties had no effect. + */ +#define DI_PROPNOEFFECT S_FALSE + +/* + * The operation had no effect. + */ +#define DI_NOEFFECT S_FALSE + +/* + * The device is a polled device. As a result, device buffering + * will not collect any data and event notifications will not be + * signalled until GetDeviceState is called. + */ +#define DI_POLLEDDEVICE ((HRESULT)0x00000002L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but the effect was not + * downloaded because the device is not exclusively acquired + * or because the DIEP_NODOWNLOAD flag was passed. + */ +#define DI_DOWNLOADSKIPPED ((HRESULT)0x00000003L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but in order to change + * the parameters, the effect needed to be restarted. + */ +#define DI_EFFECTRESTARTED ((HRESULT)0x00000004L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but some of them were + * beyond the capabilities of the device and were truncated. + */ +#define DI_TRUNCATED ((HRESULT)0x00000008L) + +/* + * The settings have been successfully applied but could not be + * persisted. + */ +#define DI_SETTINGSNOTSAVED ((HRESULT)0x0000000BL) + +/* + * Equal to DI_EFFECTRESTARTED | DI_TRUNCATED. + */ +#define DI_TRUNCATEDANDRESTARTED ((HRESULT)0x0000000CL) + +/* + * A SUCCESS code indicating that settings cannot be modified. + */ +#define DI_WRITEPROTECT ((HRESULT)0x00000013L) + +/* + * The application requires a newer version of DirectInput. + */ +#define DIERR_OLDDIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION) + +/* + * The application was written for an unsupported prerelease version + * of DirectInput. + */ +#define DIERR_BETADIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP) + +/* + * The object could not be created due to an incompatible driver version + * or mismatched or incomplete driver components. + */ +#define DIERR_BADDRIVERVER \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL) + +/* + * The device or device instance or effect is not registered with DirectInput. + */ +#define DIERR_DEVICENOTREG REGDB_E_CLASSNOTREG + +/* + * The requested object does not exist. + */ +#define DIERR_NOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * The requested object does not exist. + */ +#define DIERR_OBJECTNOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * An invalid parameter was passed to the returning function, + * or the object was not in a state that admitted the function + * to be called. + */ +#define DIERR_INVALIDPARAM E_INVALIDARG + +/* + * The specified interface is not supported by the object + */ +#define DIERR_NOINTERFACE E_NOINTERFACE + +/* + * An undetermined error occured inside the DInput subsystem + */ +#define DIERR_GENERIC E_FAIL + +/* + * The DInput subsystem couldn't allocate sufficient memory to complete the + * caller's request. + */ +#define DIERR_OUTOFMEMORY E_OUTOFMEMORY + +/* + * The function called is not supported at this time + */ +#define DIERR_UNSUPPORTED E_NOTIMPL + +/* + * This object has not been initialized + */ +#define DIERR_NOTINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY) + +/* + * This object is already initialized + */ +#define DIERR_ALREADYINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED) + +/* + * This object does not support aggregation + */ +#define DIERR_NOAGGREGATION CLASS_E_NOAGGREGATION + +/* + * Another app has a higher priority level, preventing this call from + * succeeding. + */ +#define DIERR_OTHERAPPHASPRIO E_ACCESSDENIED + +/* + * Access to the device has been lost. It must be re-acquired. + */ +#define DIERR_INPUTLOST \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT) + +/* + * The operation cannot be performed while the device is acquired. + */ +#define DIERR_ACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY) + +/* + * The operation cannot be performed unless the device is acquired. + */ +#define DIERR_NOTACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS) + +/* + * The specified property cannot be changed. + */ +#define DIERR_READONLY E_ACCESSDENIED + +/* + * The device already has an event notification associated with it. + */ +#define DIERR_HANDLEEXISTS E_ACCESSDENIED + +/* + * Data is not yet available. + */ +#ifndef E_PENDING +#define E_PENDING 0x8000000AL +#endif + +/* + * Unable to IDirectInputJoyConfig_Acquire because the user + * does not have sufficient privileges to change the joystick + * configuration. + */ +#define DIERR_INSUFFICIENTPRIVS 0x80040200L + +/* + * The device is full. + */ +#define DIERR_DEVICEFULL 0x80040201L + +/* + * Not all the requested information fit into the buffer. + */ +#define DIERR_MOREDATA 0x80040202L + +/* + * The effect is not downloaded. + */ +#define DIERR_NOTDOWNLOADED 0x80040203L + +/* + * The device cannot be reinitialized because there are still effects + * attached to it. + */ +#define DIERR_HASEFFECTS 0x80040204L + +/* + * The operation cannot be performed unless the device is acquired + * in DISCL_EXCLUSIVE mode. + */ +#define DIERR_NOTEXCLUSIVEACQUIRED 0x80040205L + +/* + * The effect could not be downloaded because essential information + * is missing. For example, no axes have been associated with the + * effect, or no type-specific information has been created. + */ +#define DIERR_INCOMPLETEEFFECT 0x80040206L + +/* + * Attempted to read buffered device data from a device that is + * not buffered. + */ +#define DIERR_NOTBUFFERED 0x80040207L + +/* + * An attempt was made to modify parameters of an effect while it is + * playing. Not all hardware devices support altering the parameters + * of an effect while it is playing. + */ +#define DIERR_EFFECTPLAYING 0x80040208L + +/* + * The operation could not be completed because the device is not + * plugged in. + */ +#define DIERR_UNPLUGGED 0x80040209L + +/* + * SendDeviceData failed because more information was requested + * to be sent than can be sent to the device. Some devices have + * restrictions on how much data can be sent to them. (For example, + * there might be a limit on the number of buttons that can be + * pressed at once.) + */ +#define DIERR_REPORTFULL 0x8004020AL + + +/* + * A mapper file function failed because reading or writing the user or IHV + * settings file failed. + */ +#define DIERR_MAPFILEFAIL 0x8004020BL + + +/*--- DINPUT Mapper Definitions: New for Dx8 ---*/ + + +/*--- Keyboard + Physical Keyboard Device ---*/ + +#define DIKEYBOARD_ESCAPE 0x81000401 +#define DIKEYBOARD_1 0x81000402 +#define DIKEYBOARD_2 0x81000403 +#define DIKEYBOARD_3 0x81000404 +#define DIKEYBOARD_4 0x81000405 +#define DIKEYBOARD_5 0x81000406 +#define DIKEYBOARD_6 0x81000407 +#define DIKEYBOARD_7 0x81000408 +#define DIKEYBOARD_8 0x81000409 +#define DIKEYBOARD_9 0x8100040A +#define DIKEYBOARD_0 0x8100040B +#define DIKEYBOARD_MINUS 0x8100040C /* - on main keyboard */ +#define DIKEYBOARD_EQUALS 0x8100040D +#define DIKEYBOARD_BACK 0x8100040E /* backspace */ +#define DIKEYBOARD_TAB 0x8100040F +#define DIKEYBOARD_Q 0x81000410 +#define DIKEYBOARD_W 0x81000411 +#define DIKEYBOARD_E 0x81000412 +#define DIKEYBOARD_R 0x81000413 +#define DIKEYBOARD_T 0x81000414 +#define DIKEYBOARD_Y 0x81000415 +#define DIKEYBOARD_U 0x81000416 +#define DIKEYBOARD_I 0x81000417 +#define DIKEYBOARD_O 0x81000418 +#define DIKEYBOARD_P 0x81000419 +#define DIKEYBOARD_LBRACKET 0x8100041A +#define DIKEYBOARD_RBRACKET 0x8100041B +#define DIKEYBOARD_RETURN 0x8100041C /* Enter on main keyboard */ +#define DIKEYBOARD_LCONTROL 0x8100041D +#define DIKEYBOARD_A 0x8100041E +#define DIKEYBOARD_S 0x8100041F +#define DIKEYBOARD_D 0x81000420 +#define DIKEYBOARD_F 0x81000421 +#define DIKEYBOARD_G 0x81000422 +#define DIKEYBOARD_H 0x81000423 +#define DIKEYBOARD_J 0x81000424 +#define DIKEYBOARD_K 0x81000425 +#define DIKEYBOARD_L 0x81000426 +#define DIKEYBOARD_SEMICOLON 0x81000427 +#define DIKEYBOARD_APOSTROPHE 0x81000428 +#define DIKEYBOARD_GRAVE 0x81000429 /* accent grave */ +#define DIKEYBOARD_LSHIFT 0x8100042A +#define DIKEYBOARD_BACKSLASH 0x8100042B +#define DIKEYBOARD_Z 0x8100042C +#define DIKEYBOARD_X 0x8100042D +#define DIKEYBOARD_C 0x8100042E +#define DIKEYBOARD_V 0x8100042F +#define DIKEYBOARD_B 0x81000430 +#define DIKEYBOARD_N 0x81000431 +#define DIKEYBOARD_M 0x81000432 +#define DIKEYBOARD_COMMA 0x81000433 +#define DIKEYBOARD_PERIOD 0x81000434 /* . on main keyboard */ +#define DIKEYBOARD_SLASH 0x81000435 /* / on main keyboard */ +#define DIKEYBOARD_RSHIFT 0x81000436 +#define DIKEYBOARD_MULTIPLY 0x81000437 /* * on numeric keypad */ +#define DIKEYBOARD_LMENU 0x81000438 /* left Alt */ +#define DIKEYBOARD_SPACE 0x81000439 +#define DIKEYBOARD_CAPITAL 0x8100043A +#define DIKEYBOARD_F1 0x8100043B +#define DIKEYBOARD_F2 0x8100043C +#define DIKEYBOARD_F3 0x8100043D +#define DIKEYBOARD_F4 0x8100043E +#define DIKEYBOARD_F5 0x8100043F +#define DIKEYBOARD_F6 0x81000440 +#define DIKEYBOARD_F7 0x81000441 +#define DIKEYBOARD_F8 0x81000442 +#define DIKEYBOARD_F9 0x81000443 +#define DIKEYBOARD_F10 0x81000444 +#define DIKEYBOARD_NUMLOCK 0x81000445 +#define DIKEYBOARD_SCROLL 0x81000446 /* Scroll Lock */ +#define DIKEYBOARD_NUMPAD7 0x81000447 +#define DIKEYBOARD_NUMPAD8 0x81000448 +#define DIKEYBOARD_NUMPAD9 0x81000449 +#define DIKEYBOARD_SUBTRACT 0x8100044A /* - on numeric keypad */ +#define DIKEYBOARD_NUMPAD4 0x8100044B +#define DIKEYBOARD_NUMPAD5 0x8100044C +#define DIKEYBOARD_NUMPAD6 0x8100044D +#define DIKEYBOARD_ADD 0x8100044E /* + on numeric keypad */ +#define DIKEYBOARD_NUMPAD1 0x8100044F +#define DIKEYBOARD_NUMPAD2 0x81000450 +#define DIKEYBOARD_NUMPAD3 0x81000451 +#define DIKEYBOARD_NUMPAD0 0x81000452 +#define DIKEYBOARD_DECIMAL 0x81000453 /* . on numeric keypad */ +#define DIKEYBOARD_OEM_102 0x81000456 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +#define DIKEYBOARD_F11 0x81000457 +#define DIKEYBOARD_F12 0x81000458 +#define DIKEYBOARD_F13 0x81000464 /* (NEC PC98) */ +#define DIKEYBOARD_F14 0x81000465 /* (NEC PC98) */ +#define DIKEYBOARD_F15 0x81000466 /* (NEC PC98) */ +#define DIKEYBOARD_KANA 0x81000470 /* (Japanese keyboard) */ +#define DIKEYBOARD_ABNT_C1 0x81000473 /* /? on Brazilian keyboard */ +#define DIKEYBOARD_CONVERT 0x81000479 /* (Japanese keyboard) */ +#define DIKEYBOARD_NOCONVERT 0x8100047B /* (Japanese keyboard) */ +#define DIKEYBOARD_YEN 0x8100047D /* (Japanese keyboard) */ +#define DIKEYBOARD_ABNT_C2 0x8100047E /* Numpad . on Brazilian keyboard */ +#define DIKEYBOARD_NUMPADEQUALS 0x8100048D /* = on numeric keypad (NEC PC98) */ +#define DIKEYBOARD_PREVTRACK 0x81000490 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIKEYBOARD_AT 0x81000491 /* (NEC PC98) */ +#define DIKEYBOARD_COLON 0x81000492 /* (NEC PC98) */ +#define DIKEYBOARD_UNDERLINE 0x81000493 /* (NEC PC98) */ +#define DIKEYBOARD_KANJI 0x81000494 /* (Japanese keyboard) */ +#define DIKEYBOARD_STOP 0x81000495 /* (NEC PC98) */ +#define DIKEYBOARD_AX 0x81000496 /* (Japan AX) */ +#define DIKEYBOARD_UNLABELED 0x81000497 /* (J3100) */ +#define DIKEYBOARD_NEXTTRACK 0x81000499 /* Next Track */ +#define DIKEYBOARD_NUMPADENTER 0x8100049C /* Enter on numeric keypad */ +#define DIKEYBOARD_RCONTROL 0x8100049D +#define DIKEYBOARD_MUTE 0x810004A0 /* Mute */ +#define DIKEYBOARD_CALCULATOR 0x810004A1 /* Calculator */ +#define DIKEYBOARD_PLAYPAUSE 0x810004A2 /* Play / Pause */ +#define DIKEYBOARD_MEDIASTOP 0x810004A4 /* Media Stop */ +#define DIKEYBOARD_VOLUMEDOWN 0x810004AE /* Volume - */ +#define DIKEYBOARD_VOLUMEUP 0x810004B0 /* Volume + */ +#define DIKEYBOARD_WEBHOME 0x810004B2 /* Web home */ +#define DIKEYBOARD_NUMPADCOMMA 0x810004B3 /* , on numeric keypad (NEC PC98) */ +#define DIKEYBOARD_DIVIDE 0x810004B5 /* / on numeric keypad */ +#define DIKEYBOARD_SYSRQ 0x810004B7 +#define DIKEYBOARD_RMENU 0x810004B8 /* right Alt */ +#define DIKEYBOARD_PAUSE 0x810004C5 /* Pause */ +#define DIKEYBOARD_HOME 0x810004C7 /* Home on arrow keypad */ +#define DIKEYBOARD_UP 0x810004C8 /* UpArrow on arrow keypad */ +#define DIKEYBOARD_PRIOR 0x810004C9 /* PgUp on arrow keypad */ +#define DIKEYBOARD_LEFT 0x810004CB /* LeftArrow on arrow keypad */ +#define DIKEYBOARD_RIGHT 0x810004CD /* RightArrow on arrow keypad */ +#define DIKEYBOARD_END 0x810004CF /* End on arrow keypad */ +#define DIKEYBOARD_DOWN 0x810004D0 /* DownArrow on arrow keypad */ +#define DIKEYBOARD_NEXT 0x810004D1 /* PgDn on arrow keypad */ +#define DIKEYBOARD_INSERT 0x810004D2 /* Insert on arrow keypad */ +#define DIKEYBOARD_DELETE 0x810004D3 /* Delete on arrow keypad */ +#define DIKEYBOARD_LWIN 0x810004DB /* Left Windows key */ +#define DIKEYBOARD_RWIN 0x810004DC /* Right Windows key */ +#define DIKEYBOARD_APPS 0x810004DD /* AppMenu key */ +#define DIKEYBOARD_POWER 0x810004DE /* System Power */ +#define DIKEYBOARD_SLEEP 0x810004DF /* System Sleep */ +#define DIKEYBOARD_WAKE 0x810004E3 /* System Wake */ +#define DIKEYBOARD_WEBSEARCH 0x810004E5 /* Web Search */ +#define DIKEYBOARD_WEBFAVORITES 0x810004E6 /* Web Favorites */ +#define DIKEYBOARD_WEBREFRESH 0x810004E7 /* Web Refresh */ +#define DIKEYBOARD_WEBSTOP 0x810004E8 /* Web Stop */ +#define DIKEYBOARD_WEBFORWARD 0x810004E9 /* Web Forward */ +#define DIKEYBOARD_WEBBACK 0x810004EA /* Web Back */ +#define DIKEYBOARD_MYCOMPUTER 0x810004EB /* My Computer */ +#define DIKEYBOARD_MAIL 0x810004EC /* Mail */ +#define DIKEYBOARD_MEDIASELECT 0x810004ED /* Media Select */ + + +/*--- MOUSE + Physical Mouse Device ---*/ + +#define DIMOUSE_XAXISAB (0x82000200 |DIMOFS_X ) /* X Axis-absolute: Some mice natively report absolute coordinates */ +#define DIMOUSE_YAXISAB (0x82000200 |DIMOFS_Y ) /* Y Axis-absolute: Some mice natively report absolute coordinates */ +#define DIMOUSE_XAXIS (0x82000300 |DIMOFS_X ) /* X Axis */ +#define DIMOUSE_YAXIS (0x82000300 |DIMOFS_Y ) /* Y Axis */ +#define DIMOUSE_WHEEL (0x82000300 |DIMOFS_Z ) /* Z Axis */ +#define DIMOUSE_BUTTON0 (0x82000400 |DIMOFS_BUTTON0) /* Button 0 */ +#define DIMOUSE_BUTTON1 (0x82000400 |DIMOFS_BUTTON1) /* Button 1 */ +#define DIMOUSE_BUTTON2 (0x82000400 |DIMOFS_BUTTON2) /* Button 2 */ +#define DIMOUSE_BUTTON3 (0x82000400 |DIMOFS_BUTTON3) /* Button 3 */ +#define DIMOUSE_BUTTON4 (0x82000400 |DIMOFS_BUTTON4) /* Button 4 */ +#define DIMOUSE_BUTTON5 (0x82000400 |DIMOFS_BUTTON5) /* Button 5 */ +#define DIMOUSE_BUTTON6 (0x82000400 |DIMOFS_BUTTON6) /* Button 6 */ +#define DIMOUSE_BUTTON7 (0x82000400 |DIMOFS_BUTTON7) /* Button 7 */ + + +/*--- VOICE + Physical Dplay Voice Device ---*/ + +#define DIVOICE_CHANNEL1 0x83000401 +#define DIVOICE_CHANNEL2 0x83000402 +#define DIVOICE_CHANNEL3 0x83000403 +#define DIVOICE_CHANNEL4 0x83000404 +#define DIVOICE_CHANNEL5 0x83000405 +#define DIVOICE_CHANNEL6 0x83000406 +#define DIVOICE_CHANNEL7 0x83000407 +#define DIVOICE_CHANNEL8 0x83000408 +#define DIVOICE_TEAM 0x83000409 +#define DIVOICE_ALL 0x8300040A +#define DIVOICE_RECORDMUTE 0x8300040B +#define DIVOICE_PLAYBACKMUTE 0x8300040C +#define DIVOICE_TRANSMIT 0x8300040D + +#define DIVOICE_VOICECOMMAND 0x83000410 + + +/*--- Driving Simulator - Racing + Vehicle control is primary objective ---*/ +#define DIVIRTUAL_DRIVING_RACE 0x01000000 +#define DIAXIS_DRIVINGR_STEER 0x01008A01 /* Steering */ +#define DIAXIS_DRIVINGR_ACCELERATE 0x01039202 /* Accelerate */ +#define DIAXIS_DRIVINGR_BRAKE 0x01041203 /* Brake-Axis */ +#define DIBUTTON_DRIVINGR_SHIFTUP 0x01000C01 /* Shift to next higher gear */ +#define DIBUTTON_DRIVINGR_SHIFTDOWN 0x01000C02 /* Shift to next lower gear */ +#define DIBUTTON_DRIVINGR_VIEW 0x01001C03 /* Cycle through view options */ +#define DIBUTTON_DRIVINGR_MENU 0x010004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_DRIVINGR_ACCEL_AND_BRAKE 0x01014A04 /* Some devices combine accelerate and brake in a single axis */ +#define DIHATSWITCH_DRIVINGR_GLANCE 0x01004601 /* Look around */ +#define DIBUTTON_DRIVINGR_BRAKE 0x01004C04 /* Brake-button */ +#define DIBUTTON_DRIVINGR_DASHBOARD 0x01004405 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGR_AIDS 0x01004406 /* Driver correction aids */ +#define DIBUTTON_DRIVINGR_MAP 0x01004407 /* Display Driving Map */ +#define DIBUTTON_DRIVINGR_BOOST 0x01004408 /* Turbo Boost */ +#define DIBUTTON_DRIVINGR_PIT 0x01004409 /* Pit stop notification */ +#define DIBUTTON_DRIVINGR_ACCELERATE_LINK 0x0103D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGR_STEER_LEFT_LINK 0x0100CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGR_STEER_RIGHT_LINK 0x0100CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGR_GLANCE_LEFT_LINK 0x0107C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGR_GLANCE_RIGHT_LINK 0x0107C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGR_DEVICE 0x010044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGR_PAUSE 0x010044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Combat + Combat from within a vehicle is primary objective ---*/ +#define DIVIRTUAL_DRIVING_COMBAT 0x02000000 +#define DIAXIS_DRIVINGC_STEER 0x02008A01 /* Steering */ +#define DIAXIS_DRIVINGC_ACCELERATE 0x02039202 /* Accelerate */ +#define DIAXIS_DRIVINGC_BRAKE 0x02041203 /* Brake-axis */ +#define DIBUTTON_DRIVINGC_FIRE 0x02000C01 /* Fire */ +#define DIBUTTON_DRIVINGC_WEAPONS 0x02000C02 /* Select next weapon */ +#define DIBUTTON_DRIVINGC_TARGET 0x02000C03 /* Select next available target */ +#define DIBUTTON_DRIVINGC_MENU 0x020004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_DRIVINGC_ACCEL_AND_BRAKE 0x02014A04 /* Some devices combine accelerate and brake in a single axis */ +#define DIHATSWITCH_DRIVINGC_GLANCE 0x02004601 /* Look around */ +#define DIBUTTON_DRIVINGC_SHIFTUP 0x02004C04 /* Shift to next higher gear */ +#define DIBUTTON_DRIVINGC_SHIFTDOWN 0x02004C05 /* Shift to next lower gear */ +#define DIBUTTON_DRIVINGC_DASHBOARD 0x02004406 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGC_AIDS 0x02004407 /* Driver correction aids */ +#define DIBUTTON_DRIVINGC_BRAKE 0x02004C08 /* Brake-button */ +#define DIBUTTON_DRIVINGC_FIRESECONDARY 0x02004C09 /* Alternative fire button */ +#define DIBUTTON_DRIVINGC_ACCELERATE_LINK 0x0203D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGC_STEER_LEFT_LINK 0x0200CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGC_STEER_RIGHT_LINK 0x0200CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGC_GLANCE_LEFT_LINK 0x0207C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGC_GLANCE_RIGHT_LINK 0x0207C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGC_DEVICE 0x020044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGC_PAUSE 0x020044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Tank + Combat from withing a tank is primary objective ---*/ +#define DIVIRTUAL_DRIVING_TANK 0x03000000 +#define DIAXIS_DRIVINGT_STEER 0x03008A01 /* Turn tank left / right */ +#define DIAXIS_DRIVINGT_BARREL 0x03010202 /* Raise / lower barrel */ +#define DIAXIS_DRIVINGT_ACCELERATE 0x03039203 /* Accelerate */ +#define DIAXIS_DRIVINGT_ROTATE 0x03020204 /* Turn barrel left / right */ +#define DIBUTTON_DRIVINGT_FIRE 0x03000C01 /* Fire */ +#define DIBUTTON_DRIVINGT_WEAPONS 0x03000C02 /* Select next weapon */ +#define DIBUTTON_DRIVINGT_TARGET 0x03000C03 /* Selects next available target */ +#define DIBUTTON_DRIVINGT_MENU 0x030004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_DRIVINGT_GLANCE 0x03004601 /* Look around */ +#define DIAXIS_DRIVINGT_BRAKE 0x03045205 /* Brake-axis */ +#define DIAXIS_DRIVINGT_ACCEL_AND_BRAKE 0x03014A06 /* Some devices combine accelerate and brake in a single axis */ +#define DIBUTTON_DRIVINGT_VIEW 0x03005C04 /* Cycle through view options */ +#define DIBUTTON_DRIVINGT_DASHBOARD 0x03005C05 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGT_BRAKE 0x03004C06 /* Brake-button */ +#define DIBUTTON_DRIVINGT_FIRESECONDARY 0x03004C07 /* Alternative fire button */ +#define DIBUTTON_DRIVINGT_ACCELERATE_LINK 0x0303D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGT_STEER_LEFT_LINK 0x0300CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGT_STEER_RIGHT_LINK 0x0300CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGT_BARREL_UP_LINK 0x030144E0 /* Fallback Barrel up button */ +#define DIBUTTON_DRIVINGT_BARREL_DOWN_LINK 0x030144E8 /* Fallback Barrel down button */ +#define DIBUTTON_DRIVINGT_ROTATE_LEFT_LINK 0x030244E4 /* Fallback Rotate left button */ +#define DIBUTTON_DRIVINGT_ROTATE_RIGHT_LINK 0x030244EC /* Fallback Rotate right button */ +#define DIBUTTON_DRIVINGT_GLANCE_LEFT_LINK 0x0307C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGT_GLANCE_RIGHT_LINK 0x0307C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGT_DEVICE 0x030044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGT_PAUSE 0x030044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Civilian + Plane control is the primary objective ---*/ +#define DIVIRTUAL_FLYING_CIVILIAN 0x04000000 +#define DIAXIS_FLYINGC_BANK 0x04008A01 /* Roll ship left / right */ +#define DIAXIS_FLYINGC_PITCH 0x04010A02 /* Nose up / down */ +#define DIAXIS_FLYINGC_THROTTLE 0x04039203 /* Throttle */ +#define DIBUTTON_FLYINGC_VIEW 0x04002401 /* Cycle through view options */ +#define DIBUTTON_FLYINGC_DISPLAY 0x04002402 /* Select next dashboard / heads up display option */ +#define DIBUTTON_FLYINGC_GEAR 0x04002C03 /* Gear up / down */ +#define DIBUTTON_FLYINGC_MENU 0x040004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGC_GLANCE 0x04004601 /* Look around */ +#define DIAXIS_FLYINGC_BRAKE 0x04046A04 /* Apply Brake */ +#define DIAXIS_FLYINGC_RUDDER 0x04025205 /* Yaw ship left/right */ +#define DIAXIS_FLYINGC_FLAPS 0x04055A06 /* Flaps */ +#define DIBUTTON_FLYINGC_FLAPSUP 0x04006404 /* Increment stepping up until fully retracted */ +#define DIBUTTON_FLYINGC_FLAPSDOWN 0x04006405 /* Decrement stepping down until fully extended */ +#define DIBUTTON_FLYINGC_BRAKE_LINK 0x04046CE0 /* Fallback brake button */ +#define DIBUTTON_FLYINGC_FASTER_LINK 0x0403D4E0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGC_SLOWER_LINK 0x0403D4E8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGC_GLANCE_LEFT_LINK 0x0407C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGC_GLANCE_RIGHT_LINK 0x0407C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGC_GLANCE_UP_LINK 0x0407C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGC_GLANCE_DOWN_LINK 0x0407C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGC_DEVICE 0x040044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGC_PAUSE 0x040044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Military + Aerial combat is the primary objective ---*/ +#define DIVIRTUAL_FLYING_MILITARY 0x05000000 +#define DIAXIS_FLYINGM_BANK 0x05008A01 /* Bank - Roll ship left / right */ +#define DIAXIS_FLYINGM_PITCH 0x05010A02 /* Pitch - Nose up / down */ +#define DIAXIS_FLYINGM_THROTTLE 0x05039203 /* Throttle - faster / slower */ +#define DIBUTTON_FLYINGM_FIRE 0x05000C01 /* Fire */ +#define DIBUTTON_FLYINGM_WEAPONS 0x05000C02 /* Select next weapon */ +#define DIBUTTON_FLYINGM_TARGET 0x05000C03 /* Selects next available target */ +#define DIBUTTON_FLYINGM_MENU 0x050004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGM_GLANCE 0x05004601 /* Look around */ +#define DIBUTTON_FLYINGM_COUNTER 0x05005C04 /* Activate counter measures */ +#define DIAXIS_FLYINGM_RUDDER 0x05024A04 /* Rudder - Yaw ship left/right */ +#define DIAXIS_FLYINGM_BRAKE 0x05046205 /* Brake-axis */ +#define DIBUTTON_FLYINGM_VIEW 0x05006405 /* Cycle through view options */ +#define DIBUTTON_FLYINGM_DISPLAY 0x05006406 /* Select next dashboard option */ +#define DIAXIS_FLYINGM_FLAPS 0x05055206 /* Flaps */ +#define DIBUTTON_FLYINGM_FLAPSUP 0x05005407 /* Increment stepping up until fully retracted */ +#define DIBUTTON_FLYINGM_FLAPSDOWN 0x05005408 /* Decrement stepping down until fully extended */ +#define DIBUTTON_FLYINGM_FIRESECONDARY 0x05004C09 /* Alternative fire button */ +#define DIBUTTON_FLYINGM_GEAR 0x0500640A /* Gear up / down */ +#define DIBUTTON_FLYINGM_BRAKE_LINK 0x050464E0 /* Fallback brake button */ +#define DIBUTTON_FLYINGM_FASTER_LINK 0x0503D4E0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGM_SLOWER_LINK 0x0503D4E8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGM_GLANCE_LEFT_LINK 0x0507C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGM_GLANCE_RIGHT_LINK 0x0507C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGM_GLANCE_UP_LINK 0x0507C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGM_GLANCE_DOWN_LINK 0x0507C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGM_DEVICE 0x050044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGM_PAUSE 0x050044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Combat Helicopter + Combat from helicopter is primary objective ---*/ +#define DIVIRTUAL_FLYING_HELICOPTER 0x06000000 +#define DIAXIS_FLYINGH_BANK 0x06008A01 /* Bank - Roll ship left / right */ +#define DIAXIS_FLYINGH_PITCH 0x06010A02 /* Pitch - Nose up / down */ +#define DIAXIS_FLYINGH_COLLECTIVE 0x06018A03 /* Collective - Blade pitch/power */ +#define DIBUTTON_FLYINGH_FIRE 0x06001401 /* Fire */ +#define DIBUTTON_FLYINGH_WEAPONS 0x06001402 /* Select next weapon */ +#define DIBUTTON_FLYINGH_TARGET 0x06001403 /* Selects next available target */ +#define DIBUTTON_FLYINGH_MENU 0x060004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGH_GLANCE 0x06004601 /* Look around */ +#define DIAXIS_FLYINGH_TORQUE 0x06025A04 /* Torque - Rotate ship around left / right axis */ +#define DIAXIS_FLYINGH_THROTTLE 0x0603DA05 /* Throttle */ +#define DIBUTTON_FLYINGH_COUNTER 0x06005404 /* Activate counter measures */ +#define DIBUTTON_FLYINGH_VIEW 0x06006405 /* Cycle through view options */ +#define DIBUTTON_FLYINGH_GEAR 0x06006406 /* Gear up / down */ +#define DIBUTTON_FLYINGH_FIRESECONDARY 0x06004C07 /* Alternative fire button */ +#define DIBUTTON_FLYINGH_FASTER_LINK 0x0603DCE0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGH_SLOWER_LINK 0x0603DCE8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGH_GLANCE_LEFT_LINK 0x0607C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGH_GLANCE_RIGHT_LINK 0x0607C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGH_GLANCE_UP_LINK 0x0607C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGH_GLANCE_DOWN_LINK 0x0607C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGH_DEVICE 0x060044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGH_PAUSE 0x060044FC /* Start / Pause / Restart game */ + +/*--- Space Simulator - Combat + Space Simulator with weapons ---*/ +#define DIVIRTUAL_SPACESIM 0x07000000 +#define DIAXIS_SPACESIM_LATERAL 0x07008201 /* Move ship left / right */ +#define DIAXIS_SPACESIM_MOVE 0x07010202 /* Move ship forward/backward */ +#define DIAXIS_SPACESIM_THROTTLE 0x07038203 /* Throttle - Engine speed */ +#define DIBUTTON_SPACESIM_FIRE 0x07000401 /* Fire */ +#define DIBUTTON_SPACESIM_WEAPONS 0x07000402 /* Select next weapon */ +#define DIBUTTON_SPACESIM_TARGET 0x07000403 /* Selects next available target */ +#define DIBUTTON_SPACESIM_MENU 0x070004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SPACESIM_GLANCE 0x07004601 /* Look around */ +#define DIAXIS_SPACESIM_CLIMB 0x0701C204 /* Climb - Pitch ship up/down */ +#define DIAXIS_SPACESIM_ROTATE 0x07024205 /* Rotate - Turn ship left/right */ +#define DIBUTTON_SPACESIM_VIEW 0x07004404 /* Cycle through view options */ +#define DIBUTTON_SPACESIM_DISPLAY 0x07004405 /* Select next dashboard / heads up display option */ +#define DIBUTTON_SPACESIM_RAISE 0x07004406 /* Raise ship while maintaining current pitch */ +#define DIBUTTON_SPACESIM_LOWER 0x07004407 /* Lower ship while maintaining current pitch */ +#define DIBUTTON_SPACESIM_GEAR 0x07004408 /* Gear up / down */ +#define DIBUTTON_SPACESIM_FIRESECONDARY 0x07004409 /* Alternative fire button */ +#define DIBUTTON_SPACESIM_LEFT_LINK 0x0700C4E4 /* Fallback move left button */ +#define DIBUTTON_SPACESIM_RIGHT_LINK 0x0700C4EC /* Fallback move right button */ +#define DIBUTTON_SPACESIM_FORWARD_LINK 0x070144E0 /* Fallback move forward button */ +#define DIBUTTON_SPACESIM_BACKWARD_LINK 0x070144E8 /* Fallback move backwards button */ +#define DIBUTTON_SPACESIM_FASTER_LINK 0x0703C4E0 /* Fallback throttle up button */ +#define DIBUTTON_SPACESIM_SLOWER_LINK 0x0703C4E8 /* Fallback throttle down button */ +#define DIBUTTON_SPACESIM_TURN_LEFT_LINK 0x070244E4 /* Fallback turn left button */ +#define DIBUTTON_SPACESIM_TURN_RIGHT_LINK 0x070244EC /* Fallback turn right button */ +#define DIBUTTON_SPACESIM_GLANCE_LEFT_LINK 0x0707C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_SPACESIM_GLANCE_RIGHT_LINK 0x0707C4EC /* Fallback Glance Right button */ +#define DIBUTTON_SPACESIM_GLANCE_UP_LINK 0x0707C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_SPACESIM_GLANCE_DOWN_LINK 0x0707C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_SPACESIM_DEVICE 0x070044FE /* Show input device and controls */ +#define DIBUTTON_SPACESIM_PAUSE 0x070044FC /* Start / Pause / Restart game */ + +/*--- Fighting - First Person + Hand to Hand combat is primary objective ---*/ +#define DIVIRTUAL_FIGHTING_HAND2HAND 0x08000000 +#define DIAXIS_FIGHTINGH_LATERAL 0x08008201 /* Sidestep left/right */ +#define DIAXIS_FIGHTINGH_MOVE 0x08010202 /* Move forward/backward */ +#define DIBUTTON_FIGHTINGH_PUNCH 0x08000401 /* Punch */ +#define DIBUTTON_FIGHTINGH_KICK 0x08000402 /* Kick */ +#define DIBUTTON_FIGHTINGH_BLOCK 0x08000403 /* Block */ +#define DIBUTTON_FIGHTINGH_CROUCH 0x08000404 /* Crouch */ +#define DIBUTTON_FIGHTINGH_JUMP 0x08000405 /* Jump */ +#define DIBUTTON_FIGHTINGH_SPECIAL1 0x08000406 /* Apply first special move */ +#define DIBUTTON_FIGHTINGH_SPECIAL2 0x08000407 /* Apply second special move */ +#define DIBUTTON_FIGHTINGH_MENU 0x080004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FIGHTINGH_SELECT 0x08004408 /* Select special move */ +#define DIHATSWITCH_FIGHTINGH_SLIDE 0x08004601 /* Look around */ +#define DIBUTTON_FIGHTINGH_DISPLAY 0x08004409 /* Shows next on-screen display option */ +#define DIAXIS_FIGHTINGH_ROTATE 0x08024203 /* Rotate - Turn body left/right */ +#define DIBUTTON_FIGHTINGH_DODGE 0x0800440A /* Dodge */ +#define DIBUTTON_FIGHTINGH_LEFT_LINK 0x0800C4E4 /* Fallback left sidestep button */ +#define DIBUTTON_FIGHTINGH_RIGHT_LINK 0x0800C4EC /* Fallback right sidestep button */ +#define DIBUTTON_FIGHTINGH_FORWARD_LINK 0x080144E0 /* Fallback forward button */ +#define DIBUTTON_FIGHTINGH_BACKWARD_LINK 0x080144E8 /* Fallback backward button */ +#define DIBUTTON_FIGHTINGH_DEVICE 0x080044FE /* Show input device and controls */ +#define DIBUTTON_FIGHTINGH_PAUSE 0x080044FC /* Start / Pause / Restart game */ + +/*--- Fighting - First Person Shooting + Navigation and combat are primary objectives ---*/ +#define DIVIRTUAL_FIGHTING_FPS 0x09000000 +#define DIAXIS_FPS_ROTATE 0x09008201 /* Rotate character left/right */ +#define DIAXIS_FPS_MOVE 0x09010202 /* Move forward/backward */ +#define DIBUTTON_FPS_FIRE 0x09000401 /* Fire */ +#define DIBUTTON_FPS_WEAPONS 0x09000402 /* Select next weapon */ +#define DIBUTTON_FPS_APPLY 0x09000403 /* Use item */ +#define DIBUTTON_FPS_SELECT 0x09000404 /* Select next inventory item */ +#define DIBUTTON_FPS_CROUCH 0x09000405 /* Crouch/ climb down/ swim down */ +#define DIBUTTON_FPS_JUMP 0x09000406 /* Jump/ climb up/ swim up */ +#define DIAXIS_FPS_LOOKUPDOWN 0x09018203 /* Look up / down */ +#define DIBUTTON_FPS_STRAFE 0x09000407 /* Enable strafing while active */ +#define DIBUTTON_FPS_MENU 0x090004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FPS_GLANCE 0x09004601 /* Look around */ +#define DIBUTTON_FPS_DISPLAY 0x09004408 /* Shows next on-screen display option/ map */ +#define DIAXIS_FPS_SIDESTEP 0x09024204 /* Sidestep */ +#define DIBUTTON_FPS_DODGE 0x09004409 /* Dodge */ +#define DIBUTTON_FPS_GLANCEL 0x0900440A /* Glance Left */ +#define DIBUTTON_FPS_GLANCER 0x0900440B /* Glance Right */ +#define DIBUTTON_FPS_FIRESECONDARY 0x0900440C /* Alternative fire button */ +#define DIBUTTON_FPS_ROTATE_LEFT_LINK 0x0900C4E4 /* Fallback rotate left button */ +#define DIBUTTON_FPS_ROTATE_RIGHT_LINK 0x0900C4EC /* Fallback rotate right button */ +#define DIBUTTON_FPS_FORWARD_LINK 0x090144E0 /* Fallback forward button */ +#define DIBUTTON_FPS_BACKWARD_LINK 0x090144E8 /* Fallback backward button */ +#define DIBUTTON_FPS_GLANCE_UP_LINK 0x0901C4E0 /* Fallback look up button */ +#define DIBUTTON_FPS_GLANCE_DOWN_LINK 0x0901C4E8 /* Fallback look down button */ +#define DIBUTTON_FPS_STEP_LEFT_LINK 0x090244E4 /* Fallback step left button */ +#define DIBUTTON_FPS_STEP_RIGHT_LINK 0x090244EC /* Fallback step right button */ +#define DIBUTTON_FPS_DEVICE 0x090044FE /* Show input device and controls */ +#define DIBUTTON_FPS_PAUSE 0x090044FC /* Start / Pause / Restart game */ + +/*--- Fighting - Third Person action + Perspective of camera is behind the main character ---*/ +#define DIVIRTUAL_FIGHTING_THIRDPERSON 0x0A000000 +#define DIAXIS_TPS_TURN 0x0A020201 /* Turn left/right */ +#define DIAXIS_TPS_MOVE 0x0A010202 /* Move forward/backward */ +#define DIBUTTON_TPS_RUN 0x0A000401 /* Run or walk toggle switch */ +#define DIBUTTON_TPS_ACTION 0x0A000402 /* Action Button */ +#define DIBUTTON_TPS_SELECT 0x0A000403 /* Select next weapon */ +#define DIBUTTON_TPS_USE 0x0A000404 /* Use inventory item currently selected */ +#define DIBUTTON_TPS_JUMP 0x0A000405 /* Character Jumps */ +#define DIBUTTON_TPS_MENU 0x0A0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_TPS_GLANCE 0x0A004601 /* Look around */ +#define DIBUTTON_TPS_VIEW 0x0A004406 /* Select camera view */ +#define DIBUTTON_TPS_STEPLEFT 0x0A004407 /* Character takes a left step */ +#define DIBUTTON_TPS_STEPRIGHT 0x0A004408 /* Character takes a right step */ +#define DIAXIS_TPS_STEP 0x0A00C203 /* Character steps left/right */ +#define DIBUTTON_TPS_DODGE 0x0A004409 /* Character dodges or ducks */ +#define DIBUTTON_TPS_INVENTORY 0x0A00440A /* Cycle through inventory */ +#define DIBUTTON_TPS_TURN_LEFT_LINK 0x0A0244E4 /* Fallback turn left button */ +#define DIBUTTON_TPS_TURN_RIGHT_LINK 0x0A0244EC /* Fallback turn right button */ +#define DIBUTTON_TPS_FORWARD_LINK 0x0A0144E0 /* Fallback forward button */ +#define DIBUTTON_TPS_BACKWARD_LINK 0x0A0144E8 /* Fallback backward button */ +#define DIBUTTON_TPS_GLANCE_UP_LINK 0x0A07C4E0 /* Fallback look up button */ +#define DIBUTTON_TPS_GLANCE_DOWN_LINK 0x0A07C4E8 /* Fallback look down button */ +#define DIBUTTON_TPS_GLANCE_LEFT_LINK 0x0A07C4E4 /* Fallback glance up button */ +#define DIBUTTON_TPS_GLANCE_RIGHT_LINK 0x0A07C4EC /* Fallback glance right button */ +#define DIBUTTON_TPS_DEVICE 0x0A0044FE /* Show input device and controls */ +#define DIBUTTON_TPS_PAUSE 0x0A0044FC /* Start / Pause / Restart game */ + +/*--- Strategy - Role Playing + Navigation and problem solving are primary actions ---*/ +#define DIVIRTUAL_STRATEGY_ROLEPLAYING 0x0B000000 +#define DIAXIS_STRATEGYR_LATERAL 0x0B008201 /* sidestep - left/right */ +#define DIAXIS_STRATEGYR_MOVE 0x0B010202 /* move forward/backward */ +#define DIBUTTON_STRATEGYR_GET 0x0B000401 /* Acquire item */ +#define DIBUTTON_STRATEGYR_APPLY 0x0B000402 /* Use selected item */ +#define DIBUTTON_STRATEGYR_SELECT 0x0B000403 /* Select nextitem */ +#define DIBUTTON_STRATEGYR_ATTACK 0x0B000404 /* Attack */ +#define DIBUTTON_STRATEGYR_CAST 0x0B000405 /* Cast Spell */ +#define DIBUTTON_STRATEGYR_CROUCH 0x0B000406 /* Crouch */ +#define DIBUTTON_STRATEGYR_JUMP 0x0B000407 /* Jump */ +#define DIBUTTON_STRATEGYR_MENU 0x0B0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_STRATEGYR_GLANCE 0x0B004601 /* Look around */ +#define DIBUTTON_STRATEGYR_MAP 0x0B004408 /* Cycle through map options */ +#define DIBUTTON_STRATEGYR_DISPLAY 0x0B004409 /* Shows next on-screen display option */ +#define DIAXIS_STRATEGYR_ROTATE 0x0B024203 /* Turn body left/right */ +#define DIBUTTON_STRATEGYR_LEFT_LINK 0x0B00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_STRATEGYR_RIGHT_LINK 0x0B00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_STRATEGYR_FORWARD_LINK 0x0B0144E0 /* Fallback move forward button */ +#define DIBUTTON_STRATEGYR_BACK_LINK 0x0B0144E8 /* Fallback move backward button */ +#define DIBUTTON_STRATEGYR_ROTATE_LEFT_LINK 0x0B0244E4 /* Fallback turn body left button */ +#define DIBUTTON_STRATEGYR_ROTATE_RIGHT_LINK 0x0B0244EC /* Fallback turn body right button */ +#define DIBUTTON_STRATEGYR_DEVICE 0x0B0044FE /* Show input device and controls */ +#define DIBUTTON_STRATEGYR_PAUSE 0x0B0044FC /* Start / Pause / Restart game */ + +/*--- Strategy - Turn based + Navigation and problem solving are primary actions ---*/ +#define DIVIRTUAL_STRATEGY_TURN 0x0C000000 +#define DIAXIS_STRATEGYT_LATERAL 0x0C008201 /* Sidestep left/right */ +#define DIAXIS_STRATEGYT_MOVE 0x0C010202 /* Move forward/backwards */ +#define DIBUTTON_STRATEGYT_SELECT 0x0C000401 /* Select unit or object */ +#define DIBUTTON_STRATEGYT_INSTRUCT 0x0C000402 /* Cycle through instructions */ +#define DIBUTTON_STRATEGYT_APPLY 0x0C000403 /* Apply selected instruction */ +#define DIBUTTON_STRATEGYT_TEAM 0x0C000404 /* Select next team / cycle through all */ +#define DIBUTTON_STRATEGYT_TURN 0x0C000405 /* Indicate turn over */ +#define DIBUTTON_STRATEGYT_MENU 0x0C0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_STRATEGYT_ZOOM 0x0C004406 /* Zoom - in / out */ +#define DIBUTTON_STRATEGYT_MAP 0x0C004407 /* cycle through map options */ +#define DIBUTTON_STRATEGYT_DISPLAY 0x0C004408 /* shows next on-screen display options */ +#define DIBUTTON_STRATEGYT_LEFT_LINK 0x0C00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_STRATEGYT_RIGHT_LINK 0x0C00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_STRATEGYT_FORWARD_LINK 0x0C0144E0 /* Fallback move forward button */ +#define DIBUTTON_STRATEGYT_BACK_LINK 0x0C0144E8 /* Fallback move back button */ +#define DIBUTTON_STRATEGYT_DEVICE 0x0C0044FE /* Show input device and controls */ +#define DIBUTTON_STRATEGYT_PAUSE 0x0C0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hunting + Hunting ---*/ +#define DIVIRTUAL_SPORTS_HUNTING 0x0D000000 +#define DIAXIS_HUNTING_LATERAL 0x0D008201 /* sidestep left/right */ +#define DIAXIS_HUNTING_MOVE 0x0D010202 /* move forward/backwards */ +#define DIBUTTON_HUNTING_FIRE 0x0D000401 /* Fire selected weapon */ +#define DIBUTTON_HUNTING_AIM 0x0D000402 /* Select aim/move */ +#define DIBUTTON_HUNTING_WEAPON 0x0D000403 /* Select next weapon */ +#define DIBUTTON_HUNTING_BINOCULAR 0x0D000404 /* Look through Binoculars */ +#define DIBUTTON_HUNTING_CALL 0x0D000405 /* Make animal call */ +#define DIBUTTON_HUNTING_MAP 0x0D000406 /* View Map */ +#define DIBUTTON_HUNTING_SPECIAL 0x0D000407 /* Special game operation */ +#define DIBUTTON_HUNTING_MENU 0x0D0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HUNTING_GLANCE 0x0D004601 /* Look around */ +#define DIBUTTON_HUNTING_DISPLAY 0x0D004408 /* show next on-screen display option */ +#define DIAXIS_HUNTING_ROTATE 0x0D024203 /* Turn body left/right */ +#define DIBUTTON_HUNTING_CROUCH 0x0D004409 /* Crouch/ Climb / Swim down */ +#define DIBUTTON_HUNTING_JUMP 0x0D00440A /* Jump/ Climb up / Swim up */ +#define DIBUTTON_HUNTING_FIRESECONDARY 0x0D00440B /* Alternative fire button */ +#define DIBUTTON_HUNTING_LEFT_LINK 0x0D00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HUNTING_RIGHT_LINK 0x0D00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HUNTING_FORWARD_LINK 0x0D0144E0 /* Fallback move forward button */ +#define DIBUTTON_HUNTING_BACK_LINK 0x0D0144E8 /* Fallback move back button */ +#define DIBUTTON_HUNTING_ROTATE_LEFT_LINK 0x0D0244E4 /* Fallback turn body left button */ +#define DIBUTTON_HUNTING_ROTATE_RIGHT_LINK 0x0D0244EC /* Fallback turn body right button */ +#define DIBUTTON_HUNTING_DEVICE 0x0D0044FE /* Show input device and controls */ +#define DIBUTTON_HUNTING_PAUSE 0x0D0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Fishing + Catching Fish is primary objective ---*/ +#define DIVIRTUAL_SPORTS_FISHING 0x0E000000 +#define DIAXIS_FISHING_LATERAL 0x0E008201 /* sidestep left/right */ +#define DIAXIS_FISHING_MOVE 0x0E010202 /* move forward/backwards */ +#define DIBUTTON_FISHING_CAST 0x0E000401 /* Cast line */ +#define DIBUTTON_FISHING_TYPE 0x0E000402 /* Select cast type */ +#define DIBUTTON_FISHING_BINOCULAR 0x0E000403 /* Look through Binocular */ +#define DIBUTTON_FISHING_BAIT 0x0E000404 /* Select type of Bait */ +#define DIBUTTON_FISHING_MAP 0x0E000405 /* View Map */ +#define DIBUTTON_FISHING_MENU 0x0E0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FISHING_GLANCE 0x0E004601 /* Look around */ +#define DIBUTTON_FISHING_DISPLAY 0x0E004406 /* Show next on-screen display option */ +#define DIAXIS_FISHING_ROTATE 0x0E024203 /* Turn character left / right */ +#define DIBUTTON_FISHING_CROUCH 0x0E004407 /* Crouch/ Climb / Swim down */ +#define DIBUTTON_FISHING_JUMP 0x0E004408 /* Jump/ Climb up / Swim up */ +#define DIBUTTON_FISHING_LEFT_LINK 0x0E00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FISHING_RIGHT_LINK 0x0E00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FISHING_FORWARD_LINK 0x0E0144E0 /* Fallback move forward button */ +#define DIBUTTON_FISHING_BACK_LINK 0x0E0144E8 /* Fallback move back button */ +#define DIBUTTON_FISHING_ROTATE_LEFT_LINK 0x0E0244E4 /* Fallback turn body left button */ +#define DIBUTTON_FISHING_ROTATE_RIGHT_LINK 0x0E0244EC /* Fallback turn body right button */ +#define DIBUTTON_FISHING_DEVICE 0x0E0044FE /* Show input device and controls */ +#define DIBUTTON_FISHING_PAUSE 0x0E0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Batting + Batter control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_BAT 0x0F000000 +#define DIAXIS_BASEBALLB_LATERAL 0x0F008201 /* Aim left / right */ +#define DIAXIS_BASEBALLB_MOVE 0x0F010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLB_SELECT 0x0F000401 /* cycle through swing options */ +#define DIBUTTON_BASEBALLB_NORMAL 0x0F000402 /* normal swing */ +#define DIBUTTON_BASEBALLB_POWER 0x0F000403 /* swing for the fence */ +#define DIBUTTON_BASEBALLB_BUNT 0x0F000404 /* bunt */ +#define DIBUTTON_BASEBALLB_STEAL 0x0F000405 /* Base runner attempts to steal a base */ +#define DIBUTTON_BASEBALLB_BURST 0x0F000406 /* Base runner invokes burst of speed */ +#define DIBUTTON_BASEBALLB_SLIDE 0x0F000407 /* Base runner slides into base */ +#define DIBUTTON_BASEBALLB_CONTACT 0x0F000408 /* Contact swing */ +#define DIBUTTON_BASEBALLB_MENU 0x0F0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLB_NOSTEAL 0x0F004409 /* Base runner goes back to a base */ +#define DIBUTTON_BASEBALLB_BOX 0x0F00440A /* Enter or exit batting box */ +#define DIBUTTON_BASEBALLB_LEFT_LINK 0x0F00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BASEBALLB_RIGHT_LINK 0x0F00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BASEBALLB_FORWARD_LINK 0x0F0144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLB_BACK_LINK 0x0F0144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLB_DEVICE 0x0F0044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLB_PAUSE 0x0F0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Pitching + Pitcher control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_PITCH 0x10000000 +#define DIAXIS_BASEBALLP_LATERAL 0x10008201 /* Aim left / right */ +#define DIAXIS_BASEBALLP_MOVE 0x10010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLP_SELECT 0x10000401 /* cycle through pitch selections */ +#define DIBUTTON_BASEBALLP_PITCH 0x10000402 /* throw pitch */ +#define DIBUTTON_BASEBALLP_BASE 0x10000403 /* select base to throw to */ +#define DIBUTTON_BASEBALLP_THROW 0x10000404 /* throw to base */ +#define DIBUTTON_BASEBALLP_FAKE 0x10000405 /* Fake a throw to a base */ +#define DIBUTTON_BASEBALLP_MENU 0x100004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLP_WALK 0x10004406 /* Throw intentional walk / pitch out */ +#define DIBUTTON_BASEBALLP_LOOK 0x10004407 /* Look at runners on bases */ +#define DIBUTTON_BASEBALLP_LEFT_LINK 0x1000C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BASEBALLP_RIGHT_LINK 0x1000C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BASEBALLP_FORWARD_LINK 0x100144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLP_BACK_LINK 0x100144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLP_DEVICE 0x100044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLP_PAUSE 0x100044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Fielding + Fielder control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_FIELD 0x11000000 +#define DIAXIS_BASEBALLF_LATERAL 0x11008201 /* Aim left / right */ +#define DIAXIS_BASEBALLF_MOVE 0x11010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLF_NEAREST 0x11000401 /* Switch to fielder nearest to the ball */ +#define DIBUTTON_BASEBALLF_THROW1 0x11000402 /* Make conservative throw */ +#define DIBUTTON_BASEBALLF_THROW2 0x11000403 /* Make aggressive throw */ +#define DIBUTTON_BASEBALLF_BURST 0x11000404 /* Invoke burst of speed */ +#define DIBUTTON_BASEBALLF_JUMP 0x11000405 /* Jump to catch ball */ +#define DIBUTTON_BASEBALLF_DIVE 0x11000406 /* Dive to catch ball */ +#define DIBUTTON_BASEBALLF_MENU 0x110004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLF_SHIFTIN 0x11004407 /* Shift the infield positioning */ +#define DIBUTTON_BASEBALLF_SHIFTOUT 0x11004408 /* Shift the outfield positioning */ +#define DIBUTTON_BASEBALLF_AIM_LEFT_LINK 0x1100C4E4 /* Fallback aim left button */ +#define DIBUTTON_BASEBALLF_AIM_RIGHT_LINK 0x1100C4EC /* Fallback aim right button */ +#define DIBUTTON_BASEBALLF_FORWARD_LINK 0x110144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLF_BACK_LINK 0x110144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLF_DEVICE 0x110044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLF_PAUSE 0x110044FC /* Start / Pause / Restart game */ + +/*--- Sports - Basketball - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_BASKETBALL_OFFENSE 0x12000000 +#define DIAXIS_BBALLO_LATERAL 0x12008201 /* left / right */ +#define DIAXIS_BBALLO_MOVE 0x12010202 /* up / down */ +#define DIBUTTON_BBALLO_SHOOT 0x12000401 /* shoot basket */ +#define DIBUTTON_BBALLO_DUNK 0x12000402 /* dunk basket */ +#define DIBUTTON_BBALLO_PASS 0x12000403 /* throw pass */ +#define DIBUTTON_BBALLO_FAKE 0x12000404 /* fake shot or pass */ +#define DIBUTTON_BBALLO_SPECIAL 0x12000405 /* apply special move */ +#define DIBUTTON_BBALLO_PLAYER 0x12000406 /* select next player */ +#define DIBUTTON_BBALLO_BURST 0x12000407 /* invoke burst */ +#define DIBUTTON_BBALLO_CALL 0x12000408 /* call for ball / pass to me */ +#define DIBUTTON_BBALLO_MENU 0x120004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BBALLO_GLANCE 0x12004601 /* scroll view */ +#define DIBUTTON_BBALLO_SCREEN 0x12004409 /* Call for screen */ +#define DIBUTTON_BBALLO_PLAY 0x1200440A /* Call for specific offensive play */ +#define DIBUTTON_BBALLO_JAB 0x1200440B /* Initiate fake drive to basket */ +#define DIBUTTON_BBALLO_POST 0x1200440C /* Perform post move */ +#define DIBUTTON_BBALLO_TIMEOUT 0x1200440D /* Time Out */ +#define DIBUTTON_BBALLO_SUBSTITUTE 0x1200440E /* substitute one player for another */ +#define DIBUTTON_BBALLO_LEFT_LINK 0x1200C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BBALLO_RIGHT_LINK 0x1200C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BBALLO_FORWARD_LINK 0x120144E0 /* Fallback move forward button */ +#define DIBUTTON_BBALLO_BACK_LINK 0x120144E8 /* Fallback move back button */ +#define DIBUTTON_BBALLO_DEVICE 0x120044FE /* Show input device and controls */ +#define DIBUTTON_BBALLO_PAUSE 0x120044FC /* Start / Pause / Restart game */ + +/*--- Sports - Basketball - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_BASKETBALL_DEFENSE 0x13000000 +#define DIAXIS_BBALLD_LATERAL 0x13008201 /* left / right */ +#define DIAXIS_BBALLD_MOVE 0x13010202 /* up / down */ +#define DIBUTTON_BBALLD_JUMP 0x13000401 /* jump to block shot */ +#define DIBUTTON_BBALLD_STEAL 0x13000402 /* attempt to steal ball */ +#define DIBUTTON_BBALLD_FAKE 0x13000403 /* fake block or steal */ +#define DIBUTTON_BBALLD_SPECIAL 0x13000404 /* apply special move */ +#define DIBUTTON_BBALLD_PLAYER 0x13000405 /* select next player */ +#define DIBUTTON_BBALLD_BURST 0x13000406 /* invoke burst */ +#define DIBUTTON_BBALLD_PLAY 0x13000407 /* call for specific defensive play */ +#define DIBUTTON_BBALLD_MENU 0x130004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BBALLD_GLANCE 0x13004601 /* scroll view */ +#define DIBUTTON_BBALLD_TIMEOUT 0x13004408 /* Time Out */ +#define DIBUTTON_BBALLD_SUBSTITUTE 0x13004409 /* substitute one player for another */ +#define DIBUTTON_BBALLD_LEFT_LINK 0x1300C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BBALLD_RIGHT_LINK 0x1300C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BBALLD_FORWARD_LINK 0x130144E0 /* Fallback move forward button */ +#define DIBUTTON_BBALLD_BACK_LINK 0x130144E8 /* Fallback move back button */ +#define DIBUTTON_BBALLD_DEVICE 0x130044FE /* Show input device and controls */ +#define DIBUTTON_BBALLD_PAUSE 0x130044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Play + Play selection ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_FIELD 0x14000000 +#define DIBUTTON_FOOTBALLP_PLAY 0x14000401 /* cycle through available plays */ +#define DIBUTTON_FOOTBALLP_SELECT 0x14000402 /* select play */ +#define DIBUTTON_FOOTBALLP_HELP 0x14000403 /* Bring up pop-up help */ +#define DIBUTTON_FOOTBALLP_MENU 0x140004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLP_DEVICE 0x140044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLP_PAUSE 0x140044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - QB + Offense: Quarterback / Kicker ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_QBCK 0x15000000 +#define DIAXIS_FOOTBALLQ_LATERAL 0x15008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLQ_MOVE 0x15010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLQ_SELECT 0x15000401 /* Select */ +#define DIBUTTON_FOOTBALLQ_SNAP 0x15000402 /* snap ball - start play */ +#define DIBUTTON_FOOTBALLQ_JUMP 0x15000403 /* jump over defender */ +#define DIBUTTON_FOOTBALLQ_SLIDE 0x15000404 /* Dive/Slide */ +#define DIBUTTON_FOOTBALLQ_PASS 0x15000405 /* throws pass to receiver */ +#define DIBUTTON_FOOTBALLQ_FAKE 0x15000406 /* pump fake pass or fake kick */ +#define DIBUTTON_FOOTBALLQ_MENU 0x150004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLQ_FAKESNAP 0x15004407 /* Fake snap */ +#define DIBUTTON_FOOTBALLQ_MOTION 0x15004408 /* Send receivers in motion */ +#define DIBUTTON_FOOTBALLQ_AUDIBLE 0x15004409 /* Change offensive play at line of scrimmage */ +#define DIBUTTON_FOOTBALLQ_LEFT_LINK 0x1500C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLQ_RIGHT_LINK 0x1500C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLQ_FORWARD_LINK 0x150144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLQ_BACK_LINK 0x150144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLQ_DEVICE 0x150044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLQ_PAUSE 0x150044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Offense + Offense - Runner ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_OFFENSE 0x16000000 +#define DIAXIS_FOOTBALLO_LATERAL 0x16008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLO_MOVE 0x16010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLO_JUMP 0x16000401 /* jump or hurdle over defender */ +#define DIBUTTON_FOOTBALLO_LEFTARM 0x16000402 /* holds out left arm */ +#define DIBUTTON_FOOTBALLO_RIGHTARM 0x16000403 /* holds out right arm */ +#define DIBUTTON_FOOTBALLO_THROW 0x16000404 /* throw pass or lateral ball to another runner */ +#define DIBUTTON_FOOTBALLO_SPIN 0x16000405 /* Spin to avoid defenders */ +#define DIBUTTON_FOOTBALLO_MENU 0x160004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLO_JUKE 0x16004406 /* Use special move to avoid defenders */ +#define DIBUTTON_FOOTBALLO_SHOULDER 0x16004407 /* Lower shoulder to run over defenders */ +#define DIBUTTON_FOOTBALLO_TURBO 0x16004408 /* Speed burst past defenders */ +#define DIBUTTON_FOOTBALLO_DIVE 0x16004409 /* Dive over defenders */ +#define DIBUTTON_FOOTBALLO_ZOOM 0x1600440A /* Zoom view in / out */ +#define DIBUTTON_FOOTBALLO_SUBSTITUTE 0x1600440B /* substitute one player for another */ +#define DIBUTTON_FOOTBALLO_LEFT_LINK 0x1600C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLO_RIGHT_LINK 0x1600C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLO_FORWARD_LINK 0x160144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLO_BACK_LINK 0x160144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLO_DEVICE 0x160044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLO_PAUSE 0x160044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_DEFENSE 0x17000000 +#define DIAXIS_FOOTBALLD_LATERAL 0x17008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLD_MOVE 0x17010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLD_PLAY 0x17000401 /* cycle through available plays */ +#define DIBUTTON_FOOTBALLD_SELECT 0x17000402 /* select player closest to the ball */ +#define DIBUTTON_FOOTBALLD_JUMP 0x17000403 /* jump to intercept or block */ +#define DIBUTTON_FOOTBALLD_TACKLE 0x17000404 /* tackler runner */ +#define DIBUTTON_FOOTBALLD_FAKE 0x17000405 /* hold down to fake tackle or intercept */ +#define DIBUTTON_FOOTBALLD_SUPERTACKLE 0x17000406 /* Initiate special tackle */ +#define DIBUTTON_FOOTBALLD_MENU 0x170004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLD_SPIN 0x17004407 /* Spin to beat offensive line */ +#define DIBUTTON_FOOTBALLD_SWIM 0x17004408 /* Swim to beat the offensive line */ +#define DIBUTTON_FOOTBALLD_BULLRUSH 0x17004409 /* Bull rush the offensive line */ +#define DIBUTTON_FOOTBALLD_RIP 0x1700440A /* Rip the offensive line */ +#define DIBUTTON_FOOTBALLD_AUDIBLE 0x1700440B /* Change defensive play at the line of scrimmage */ +#define DIBUTTON_FOOTBALLD_ZOOM 0x1700440C /* Zoom view in / out */ +#define DIBUTTON_FOOTBALLD_SUBSTITUTE 0x1700440D /* substitute one player for another */ +#define DIBUTTON_FOOTBALLD_LEFT_LINK 0x1700C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLD_RIGHT_LINK 0x1700C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLD_FORWARD_LINK 0x170144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLD_BACK_LINK 0x170144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLD_DEVICE 0x170044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLD_PAUSE 0x170044FC /* Start / Pause / Restart game */ + +/*--- Sports - Golf + ---*/ +#define DIVIRTUAL_SPORTS_GOLF 0x18000000 +#define DIAXIS_GOLF_LATERAL 0x18008201 /* Move / Aim: left / right */ +#define DIAXIS_GOLF_MOVE 0x18010202 /* Move / Aim: up / down */ +#define DIBUTTON_GOLF_SWING 0x18000401 /* swing club */ +#define DIBUTTON_GOLF_SELECT 0x18000402 /* cycle between: club / swing strength / ball arc / ball spin */ +#define DIBUTTON_GOLF_UP 0x18000403 /* increase selection */ +#define DIBUTTON_GOLF_DOWN 0x18000404 /* decrease selection */ +#define DIBUTTON_GOLF_TERRAIN 0x18000405 /* shows terrain detail */ +#define DIBUTTON_GOLF_FLYBY 0x18000406 /* view the hole via a flyby */ +#define DIBUTTON_GOLF_MENU 0x180004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_GOLF_SCROLL 0x18004601 /* scroll view */ +#define DIBUTTON_GOLF_ZOOM 0x18004407 /* Zoom view in / out */ +#define DIBUTTON_GOLF_TIMEOUT 0x18004408 /* Call for time out */ +#define DIBUTTON_GOLF_SUBSTITUTE 0x18004409 /* substitute one player for another */ +#define DIBUTTON_GOLF_LEFT_LINK 0x1800C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_GOLF_RIGHT_LINK 0x1800C4EC /* Fallback sidestep right button */ +#define DIBUTTON_GOLF_FORWARD_LINK 0x180144E0 /* Fallback move forward button */ +#define DIBUTTON_GOLF_BACK_LINK 0x180144E8 /* Fallback move back button */ +#define DIBUTTON_GOLF_DEVICE 0x180044FE /* Show input device and controls */ +#define DIBUTTON_GOLF_PAUSE 0x180044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_OFFENSE 0x19000000 +#define DIAXIS_HOCKEYO_LATERAL 0x19008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYO_MOVE 0x19010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYO_SHOOT 0x19000401 /* Shoot */ +#define DIBUTTON_HOCKEYO_PASS 0x19000402 /* pass the puck */ +#define DIBUTTON_HOCKEYO_BURST 0x19000403 /* invoke speed burst */ +#define DIBUTTON_HOCKEYO_SPECIAL 0x19000404 /* invoke special move */ +#define DIBUTTON_HOCKEYO_FAKE 0x19000405 /* hold down to fake pass or kick */ +#define DIBUTTON_HOCKEYO_MENU 0x190004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYO_SCROLL 0x19004601 /* scroll view */ +#define DIBUTTON_HOCKEYO_ZOOM 0x19004406 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYO_STRATEGY 0x19004407 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYO_TIMEOUT 0x19004408 /* Call for time out */ +#define DIBUTTON_HOCKEYO_SUBSTITUTE 0x19004409 /* substitute one player for another */ +#define DIBUTTON_HOCKEYO_LEFT_LINK 0x1900C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYO_RIGHT_LINK 0x1900C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYO_FORWARD_LINK 0x190144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYO_BACK_LINK 0x190144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYO_DEVICE 0x190044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYO_PAUSE 0x190044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_DEFENSE 0x1A000000 +#define DIAXIS_HOCKEYD_LATERAL 0x1A008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYD_MOVE 0x1A010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYD_PLAYER 0x1A000401 /* control player closest to the puck */ +#define DIBUTTON_HOCKEYD_STEAL 0x1A000402 /* attempt steal */ +#define DIBUTTON_HOCKEYD_BURST 0x1A000403 /* speed burst or body check */ +#define DIBUTTON_HOCKEYD_BLOCK 0x1A000404 /* block puck */ +#define DIBUTTON_HOCKEYD_FAKE 0x1A000405 /* hold down to fake tackle or intercept */ +#define DIBUTTON_HOCKEYD_MENU 0x1A0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYD_SCROLL 0x1A004601 /* scroll view */ +#define DIBUTTON_HOCKEYD_ZOOM 0x1A004406 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYD_STRATEGY 0x1A004407 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYD_TIMEOUT 0x1A004408 /* Call for time out */ +#define DIBUTTON_HOCKEYD_SUBSTITUTE 0x1A004409 /* substitute one player for another */ +#define DIBUTTON_HOCKEYD_LEFT_LINK 0x1A00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYD_RIGHT_LINK 0x1A00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYD_FORWARD_LINK 0x1A0144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYD_BACK_LINK 0x1A0144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYD_DEVICE 0x1A0044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYD_PAUSE 0x1A0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Goalie + Goal tending ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_GOALIE 0x1B000000 +#define DIAXIS_HOCKEYG_LATERAL 0x1B008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYG_MOVE 0x1B010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYG_PASS 0x1B000401 /* pass puck */ +#define DIBUTTON_HOCKEYG_POKE 0x1B000402 /* poke / check / hack */ +#define DIBUTTON_HOCKEYG_STEAL 0x1B000403 /* attempt steal */ +#define DIBUTTON_HOCKEYG_BLOCK 0x1B000404 /* block puck */ +#define DIBUTTON_HOCKEYG_MENU 0x1B0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYG_SCROLL 0x1B004601 /* scroll view */ +#define DIBUTTON_HOCKEYG_ZOOM 0x1B004405 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYG_STRATEGY 0x1B004406 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYG_TIMEOUT 0x1B004407 /* Call for time out */ +#define DIBUTTON_HOCKEYG_SUBSTITUTE 0x1B004408 /* substitute one player for another */ +#define DIBUTTON_HOCKEYG_LEFT_LINK 0x1B00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYG_RIGHT_LINK 0x1B00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYG_FORWARD_LINK 0x1B0144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYG_BACK_LINK 0x1B0144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYG_DEVICE 0x1B0044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYG_PAUSE 0x1B0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Mountain Biking + ---*/ +#define DIVIRTUAL_SPORTS_BIKING_MOUNTAIN 0x1C000000 +#define DIAXIS_BIKINGM_TURN 0x1C008201 /* left / right */ +#define DIAXIS_BIKINGM_PEDAL 0x1C010202 /* Pedal faster / slower / brake */ +#define DIBUTTON_BIKINGM_JUMP 0x1C000401 /* jump over obstacle */ +#define DIBUTTON_BIKINGM_CAMERA 0x1C000402 /* switch camera view */ +#define DIBUTTON_BIKINGM_SPECIAL1 0x1C000403 /* perform first special move */ +#define DIBUTTON_BIKINGM_SELECT 0x1C000404 /* Select */ +#define DIBUTTON_BIKINGM_SPECIAL2 0x1C000405 /* perform second special move */ +#define DIBUTTON_BIKINGM_MENU 0x1C0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BIKINGM_SCROLL 0x1C004601 /* scroll view */ +#define DIBUTTON_BIKINGM_ZOOM 0x1C004406 /* Zoom view in / out */ +#define DIAXIS_BIKINGM_BRAKE 0x1C044203 /* Brake axis */ +#define DIBUTTON_BIKINGM_LEFT_LINK 0x1C00C4E4 /* Fallback turn left button */ +#define DIBUTTON_BIKINGM_RIGHT_LINK 0x1C00C4EC /* Fallback turn right button */ +#define DIBUTTON_BIKINGM_FASTER_LINK 0x1C0144E0 /* Fallback pedal faster button */ +#define DIBUTTON_BIKINGM_SLOWER_LINK 0x1C0144E8 /* Fallback pedal slower button */ +#define DIBUTTON_BIKINGM_BRAKE_BUTTON_LINK 0x1C0444E8 /* Fallback brake button */ +#define DIBUTTON_BIKINGM_DEVICE 0x1C0044FE /* Show input device and controls */ +#define DIBUTTON_BIKINGM_PAUSE 0x1C0044FC /* Start / Pause / Restart game */ + +/*--- Sports: Skiing / Snowboarding / Skateboarding + ---*/ +#define DIVIRTUAL_SPORTS_SKIING 0x1D000000 +#define DIAXIS_SKIING_TURN 0x1D008201 /* left / right */ +#define DIAXIS_SKIING_SPEED 0x1D010202 /* faster / slower */ +#define DIBUTTON_SKIING_JUMP 0x1D000401 /* Jump */ +#define DIBUTTON_SKIING_CROUCH 0x1D000402 /* crouch down */ +#define DIBUTTON_SKIING_CAMERA 0x1D000403 /* switch camera view */ +#define DIBUTTON_SKIING_SPECIAL1 0x1D000404 /* perform first special move */ +#define DIBUTTON_SKIING_SELECT 0x1D000405 /* Select */ +#define DIBUTTON_SKIING_SPECIAL2 0x1D000406 /* perform second special move */ +#define DIBUTTON_SKIING_MENU 0x1D0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SKIING_GLANCE 0x1D004601 /* scroll view */ +#define DIBUTTON_SKIING_ZOOM 0x1D004407 /* Zoom view in / out */ +#define DIBUTTON_SKIING_LEFT_LINK 0x1D00C4E4 /* Fallback turn left button */ +#define DIBUTTON_SKIING_RIGHT_LINK 0x1D00C4EC /* Fallback turn right button */ +#define DIBUTTON_SKIING_FASTER_LINK 0x1D0144E0 /* Fallback increase speed button */ +#define DIBUTTON_SKIING_SLOWER_LINK 0x1D0144E8 /* Fallback decrease speed button */ +#define DIBUTTON_SKIING_DEVICE 0x1D0044FE /* Show input device and controls */ +#define DIBUTTON_SKIING_PAUSE 0x1D0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Soccer - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_SOCCER_OFFENSE 0x1E000000 +#define DIAXIS_SOCCERO_LATERAL 0x1E008201 /* Move / Aim: left / right */ +#define DIAXIS_SOCCERO_MOVE 0x1E010202 /* Move / Aim: up / down */ +#define DIAXIS_SOCCERO_BEND 0x1E018203 /* Bend to soccer shot/pass */ +#define DIBUTTON_SOCCERO_SHOOT 0x1E000401 /* Shoot the ball */ +#define DIBUTTON_SOCCERO_PASS 0x1E000402 /* Pass */ +#define DIBUTTON_SOCCERO_FAKE 0x1E000403 /* Fake */ +#define DIBUTTON_SOCCERO_PLAYER 0x1E000404 /* Select next player */ +#define DIBUTTON_SOCCERO_SPECIAL1 0x1E000405 /* Apply special move */ +#define DIBUTTON_SOCCERO_SELECT 0x1E000406 /* Select special move */ +#define DIBUTTON_SOCCERO_MENU 0x1E0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SOCCERO_GLANCE 0x1E004601 /* scroll view */ +#define DIBUTTON_SOCCERO_SUBSTITUTE 0x1E004407 /* Substitute one player for another */ +#define DIBUTTON_SOCCERO_SHOOTLOW 0x1E004408 /* Shoot the ball low */ +#define DIBUTTON_SOCCERO_SHOOTHIGH 0x1E004409 /* Shoot the ball high */ +#define DIBUTTON_SOCCERO_PASSTHRU 0x1E00440A /* Make a thru pass */ +#define DIBUTTON_SOCCERO_SPRINT 0x1E00440B /* Sprint / turbo boost */ +#define DIBUTTON_SOCCERO_CONTROL 0x1E00440C /* Obtain control of the ball */ +#define DIBUTTON_SOCCERO_HEAD 0x1E00440D /* Attempt to head the ball */ +#define DIBUTTON_SOCCERO_LEFT_LINK 0x1E00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_SOCCERO_RIGHT_LINK 0x1E00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_SOCCERO_FORWARD_LINK 0x1E0144E0 /* Fallback move forward button */ +#define DIBUTTON_SOCCERO_BACK_LINK 0x1E0144E8 /* Fallback move back button */ +#define DIBUTTON_SOCCERO_DEVICE 0x1E0044FE /* Show input device and controls */ +#define DIBUTTON_SOCCERO_PAUSE 0x1E0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Soccer - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_SOCCER_DEFENSE 0x1F000000 +#define DIAXIS_SOCCERD_LATERAL 0x1F008201 /* Move / Aim: left / right */ +#define DIAXIS_SOCCERD_MOVE 0x1F010202 /* Move / Aim: up / down */ +#define DIBUTTON_SOCCERD_BLOCK 0x1F000401 /* Attempt to block shot */ +#define DIBUTTON_SOCCERD_STEAL 0x1F000402 /* Attempt to steal ball */ +#define DIBUTTON_SOCCERD_FAKE 0x1F000403 /* Fake a block or a steal */ +#define DIBUTTON_SOCCERD_PLAYER 0x1F000404 /* Select next player */ +#define DIBUTTON_SOCCERD_SPECIAL 0x1F000405 /* Apply special move */ +#define DIBUTTON_SOCCERD_SELECT 0x1F000406 /* Select special move */ +#define DIBUTTON_SOCCERD_SLIDE 0x1F000407 /* Attempt a slide tackle */ +#define DIBUTTON_SOCCERD_MENU 0x1F0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SOCCERD_GLANCE 0x1F004601 /* scroll view */ +#define DIBUTTON_SOCCERD_FOUL 0x1F004408 /* Initiate a foul / hard-foul */ +#define DIBUTTON_SOCCERD_HEAD 0x1F004409 /* Attempt a Header */ +#define DIBUTTON_SOCCERD_CLEAR 0x1F00440A /* Attempt to clear the ball down the field */ +#define DIBUTTON_SOCCERD_GOALIECHARGE 0x1F00440B /* Make the goalie charge out of the box */ +#define DIBUTTON_SOCCERD_SUBSTITUTE 0x1F00440C /* Substitute one player for another */ +#define DIBUTTON_SOCCERD_LEFT_LINK 0x1F00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_SOCCERD_RIGHT_LINK 0x1F00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_SOCCERD_FORWARD_LINK 0x1F0144E0 /* Fallback move forward button */ +#define DIBUTTON_SOCCERD_BACK_LINK 0x1F0144E8 /* Fallback move back button */ +#define DIBUTTON_SOCCERD_DEVICE 0x1F0044FE /* Show input device and controls */ +#define DIBUTTON_SOCCERD_PAUSE 0x1F0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Racquet + Tennis - Table-Tennis - Squash ---*/ +#define DIVIRTUAL_SPORTS_RACQUET 0x20000000 +#define DIAXIS_RACQUET_LATERAL 0x20008201 /* Move / Aim: left / right */ +#define DIAXIS_RACQUET_MOVE 0x20010202 /* Move / Aim: up / down */ +#define DIBUTTON_RACQUET_SWING 0x20000401 /* Swing racquet */ +#define DIBUTTON_RACQUET_BACKSWING 0x20000402 /* Swing backhand */ +#define DIBUTTON_RACQUET_SMASH 0x20000403 /* Smash shot */ +#define DIBUTTON_RACQUET_SPECIAL 0x20000404 /* Special shot */ +#define DIBUTTON_RACQUET_SELECT 0x20000405 /* Select special shot */ +#define DIBUTTON_RACQUET_MENU 0x200004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_RACQUET_GLANCE 0x20004601 /* scroll view */ +#define DIBUTTON_RACQUET_TIMEOUT 0x20004406 /* Call for time out */ +#define DIBUTTON_RACQUET_SUBSTITUTE 0x20004407 /* Substitute one player for another */ +#define DIBUTTON_RACQUET_LEFT_LINK 0x2000C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_RACQUET_RIGHT_LINK 0x2000C4EC /* Fallback sidestep right button */ +#define DIBUTTON_RACQUET_FORWARD_LINK 0x200144E0 /* Fallback move forward button */ +#define DIBUTTON_RACQUET_BACK_LINK 0x200144E8 /* Fallback move back button */ +#define DIBUTTON_RACQUET_DEVICE 0x200044FE /* Show input device and controls */ +#define DIBUTTON_RACQUET_PAUSE 0x200044FC /* Start / Pause / Restart game */ + +/*--- Arcade- 2D + Side to Side movement ---*/ +#define DIVIRTUAL_ARCADE_SIDE2SIDE 0x21000000 +#define DIAXIS_ARCADES_LATERAL 0x21008201 /* left / right */ +#define DIAXIS_ARCADES_MOVE 0x21010202 /* up / down */ +#define DIBUTTON_ARCADES_THROW 0x21000401 /* throw object */ +#define DIBUTTON_ARCADES_CARRY 0x21000402 /* carry object */ +#define DIBUTTON_ARCADES_ATTACK 0x21000403 /* attack */ +#define DIBUTTON_ARCADES_SPECIAL 0x21000404 /* apply special move */ +#define DIBUTTON_ARCADES_SELECT 0x21000405 /* select special move */ +#define DIBUTTON_ARCADES_MENU 0x210004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_ARCADES_VIEW 0x21004601 /* scroll view left / right / up / down */ +#define DIBUTTON_ARCADES_LEFT_LINK 0x2100C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_ARCADES_RIGHT_LINK 0x2100C4EC /* Fallback sidestep right button */ +#define DIBUTTON_ARCADES_FORWARD_LINK 0x210144E0 /* Fallback move forward button */ +#define DIBUTTON_ARCADES_BACK_LINK 0x210144E8 /* Fallback move back button */ +#define DIBUTTON_ARCADES_VIEW_UP_LINK 0x2107C4E0 /* Fallback scroll view up button */ +#define DIBUTTON_ARCADES_VIEW_DOWN_LINK 0x2107C4E8 /* Fallback scroll view down button */ +#define DIBUTTON_ARCADES_VIEW_LEFT_LINK 0x2107C4E4 /* Fallback scroll view left button */ +#define DIBUTTON_ARCADES_VIEW_RIGHT_LINK 0x2107C4EC /* Fallback scroll view right button */ +#define DIBUTTON_ARCADES_DEVICE 0x210044FE /* Show input device and controls */ +#define DIBUTTON_ARCADES_PAUSE 0x210044FC /* Start / Pause / Restart game */ + +/*--- Arcade - Platform Game + Character moves around on screen ---*/ +#define DIVIRTUAL_ARCADE_PLATFORM 0x22000000 +#define DIAXIS_ARCADEP_LATERAL 0x22008201 /* Left / right */ +#define DIAXIS_ARCADEP_MOVE 0x22010202 /* Up / down */ +#define DIBUTTON_ARCADEP_JUMP 0x22000401 /* Jump */ +#define DIBUTTON_ARCADEP_FIRE 0x22000402 /* Fire */ +#define DIBUTTON_ARCADEP_CROUCH 0x22000403 /* Crouch */ +#define DIBUTTON_ARCADEP_SPECIAL 0x22000404 /* Apply special move */ +#define DIBUTTON_ARCADEP_SELECT 0x22000405 /* Select special move */ +#define DIBUTTON_ARCADEP_MENU 0x220004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_ARCADEP_VIEW 0x22004601 /* Scroll view */ +#define DIBUTTON_ARCADEP_FIRESECONDARY 0x22004406 /* Alternative fire button */ +#define DIBUTTON_ARCADEP_LEFT_LINK 0x2200C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_ARCADEP_RIGHT_LINK 0x2200C4EC /* Fallback sidestep right button */ +#define DIBUTTON_ARCADEP_FORWARD_LINK 0x220144E0 /* Fallback move forward button */ +#define DIBUTTON_ARCADEP_BACK_LINK 0x220144E8 /* Fallback move back button */ +#define DIBUTTON_ARCADEP_VIEW_UP_LINK 0x2207C4E0 /* Fallback scroll view up button */ +#define DIBUTTON_ARCADEP_VIEW_DOWN_LINK 0x2207C4E8 /* Fallback scroll view down button */ +#define DIBUTTON_ARCADEP_VIEW_LEFT_LINK 0x2207C4E4 /* Fallback scroll view left button */ +#define DIBUTTON_ARCADEP_VIEW_RIGHT_LINK 0x2207C4EC /* Fallback scroll view right button */ +#define DIBUTTON_ARCADEP_DEVICE 0x220044FE /* Show input device and controls */ +#define DIBUTTON_ARCADEP_PAUSE 0x220044FC /* Start / Pause / Restart game */ + +/*--- CAD - 2D Object Control + Controls to select and move objects in 2D ---*/ +#define DIVIRTUAL_CAD_2DCONTROL 0x23000000 +#define DIAXIS_2DCONTROL_LATERAL 0x23008201 /* Move view left / right */ +#define DIAXIS_2DCONTROL_MOVE 0x23010202 /* Move view up / down */ +#define DIAXIS_2DCONTROL_INOUT 0x23018203 /* Zoom - in / out */ +#define DIBUTTON_2DCONTROL_SELECT 0x23000401 /* Select Object */ +#define DIBUTTON_2DCONTROL_SPECIAL1 0x23000402 /* Do first special operation */ +#define DIBUTTON_2DCONTROL_SPECIAL 0x23000403 /* Select special operation */ +#define DIBUTTON_2DCONTROL_SPECIAL2 0x23000404 /* Do second special operation */ +#define DIBUTTON_2DCONTROL_MENU 0x230004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_2DCONTROL_HATSWITCH 0x23004601 /* Hat switch */ +#define DIAXIS_2DCONTROL_ROTATEZ 0x23024204 /* Rotate view clockwise / counterclockwise */ +#define DIBUTTON_2DCONTROL_DISPLAY 0x23004405 /* Shows next on-screen display options */ +#define DIBUTTON_2DCONTROL_DEVICE 0x230044FE /* Show input device and controls */ +#define DIBUTTON_2DCONTROL_PAUSE 0x230044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D object control + Controls to select and move objects within a 3D environment ---*/ +#define DIVIRTUAL_CAD_3DCONTROL 0x24000000 +#define DIAXIS_3DCONTROL_LATERAL 0x24008201 /* Move view left / right */ +#define DIAXIS_3DCONTROL_MOVE 0x24010202 /* Move view up / down */ +#define DIAXIS_3DCONTROL_INOUT 0x24018203 /* Zoom - in / out */ +#define DIBUTTON_3DCONTROL_SELECT 0x24000401 /* Select Object */ +#define DIBUTTON_3DCONTROL_SPECIAL1 0x24000402 /* Do first special operation */ +#define DIBUTTON_3DCONTROL_SPECIAL 0x24000403 /* Select special operation */ +#define DIBUTTON_3DCONTROL_SPECIAL2 0x24000404 /* Do second special operation */ +#define DIBUTTON_3DCONTROL_MENU 0x240004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_3DCONTROL_HATSWITCH 0x24004601 /* Hat switch */ +#define DIAXIS_3DCONTROL_ROTATEX 0x24034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_3DCONTROL_ROTATEY 0x2402C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_3DCONTROL_ROTATEZ 0x24024206 /* Rotate view left / right */ +#define DIBUTTON_3DCONTROL_DISPLAY 0x24004405 /* Show next on-screen display options */ +#define DIBUTTON_3DCONTROL_DEVICE 0x240044FE /* Show input device and controls */ +#define DIBUTTON_3DCONTROL_PAUSE 0x240044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D Navigation - Fly through + Controls for 3D modeling ---*/ +#define DIVIRTUAL_CAD_FLYBY 0x25000000 +#define DIAXIS_CADF_LATERAL 0x25008201 /* move view left / right */ +#define DIAXIS_CADF_MOVE 0x25010202 /* move view up / down */ +#define DIAXIS_CADF_INOUT 0x25018203 /* in / out */ +#define DIBUTTON_CADF_SELECT 0x25000401 /* Select Object */ +#define DIBUTTON_CADF_SPECIAL1 0x25000402 /* do first special operation */ +#define DIBUTTON_CADF_SPECIAL 0x25000403 /* Select special operation */ +#define DIBUTTON_CADF_SPECIAL2 0x25000404 /* do second special operation */ +#define DIBUTTON_CADF_MENU 0x250004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_CADF_HATSWITCH 0x25004601 /* Hat switch */ +#define DIAXIS_CADF_ROTATEX 0x25034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_CADF_ROTATEY 0x2502C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_CADF_ROTATEZ 0x25024206 /* Rotate view left / right */ +#define DIBUTTON_CADF_DISPLAY 0x25004405 /* shows next on-screen display options */ +#define DIBUTTON_CADF_DEVICE 0x250044FE /* Show input device and controls */ +#define DIBUTTON_CADF_PAUSE 0x250044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D Model Control + Controls for 3D modeling ---*/ +#define DIVIRTUAL_CAD_MODEL 0x26000000 +#define DIAXIS_CADM_LATERAL 0x26008201 /* move view left / right */ +#define DIAXIS_CADM_MOVE 0x26010202 /* move view up / down */ +#define DIAXIS_CADM_INOUT 0x26018203 /* in / out */ +#define DIBUTTON_CADM_SELECT 0x26000401 /* Select Object */ +#define DIBUTTON_CADM_SPECIAL1 0x26000402 /* do first special operation */ +#define DIBUTTON_CADM_SPECIAL 0x26000403 /* Select special operation */ +#define DIBUTTON_CADM_SPECIAL2 0x26000404 /* do second special operation */ +#define DIBUTTON_CADM_MENU 0x260004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_CADM_HATSWITCH 0x26004601 /* Hat switch */ +#define DIAXIS_CADM_ROTATEX 0x26034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_CADM_ROTATEY 0x2602C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_CADM_ROTATEZ 0x26024206 /* Rotate view left / right */ +#define DIBUTTON_CADM_DISPLAY 0x26004405 /* shows next on-screen display options */ +#define DIBUTTON_CADM_DEVICE 0x260044FE /* Show input device and controls */ +#define DIBUTTON_CADM_PAUSE 0x260044FC /* Start / Pause / Restart game */ + +/*--- Control - Media Equipment + Remote ---*/ +#define DIVIRTUAL_REMOTE_CONTROL 0x27000000 +#define DIAXIS_REMOTE_SLIDER 0x27050201 /* Slider for adjustment: volume / color / bass / etc */ +#define DIBUTTON_REMOTE_MUTE 0x27000401 /* Set volume on current device to zero */ +#define DIBUTTON_REMOTE_SELECT 0x27000402 /* Next/previous: channel/ track / chapter / picture / station */ +#define DIBUTTON_REMOTE_PLAY 0x27002403 /* Start or pause entertainment on current device */ +#define DIBUTTON_REMOTE_CUE 0x27002404 /* Move through current media */ +#define DIBUTTON_REMOTE_REVIEW 0x27002405 /* Move through current media */ +#define DIBUTTON_REMOTE_CHANGE 0x27002406 /* Select next device */ +#define DIBUTTON_REMOTE_RECORD 0x27002407 /* Start recording the current media */ +#define DIBUTTON_REMOTE_MENU 0x270004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_REMOTE_SLIDER2 0x27054202 /* Slider for adjustment: volume */ +#define DIBUTTON_REMOTE_TV 0x27005C08 /* Select TV */ +#define DIBUTTON_REMOTE_CABLE 0x27005C09 /* Select cable box */ +#define DIBUTTON_REMOTE_CD 0x27005C0A /* Select CD player */ +#define DIBUTTON_REMOTE_VCR 0x27005C0B /* Select VCR */ +#define DIBUTTON_REMOTE_TUNER 0x27005C0C /* Select tuner */ +#define DIBUTTON_REMOTE_DVD 0x27005C0D /* Select DVD player */ +#define DIBUTTON_REMOTE_ADJUST 0x27005C0E /* Enter device adjustment menu */ +#define DIBUTTON_REMOTE_DIGIT0 0x2700540F /* Digit 0 */ +#define DIBUTTON_REMOTE_DIGIT1 0x27005410 /* Digit 1 */ +#define DIBUTTON_REMOTE_DIGIT2 0x27005411 /* Digit 2 */ +#define DIBUTTON_REMOTE_DIGIT3 0x27005412 /* Digit 3 */ +#define DIBUTTON_REMOTE_DIGIT4 0x27005413 /* Digit 4 */ +#define DIBUTTON_REMOTE_DIGIT5 0x27005414 /* Digit 5 */ +#define DIBUTTON_REMOTE_DIGIT6 0x27005415 /* Digit 6 */ +#define DIBUTTON_REMOTE_DIGIT7 0x27005416 /* Digit 7 */ +#define DIBUTTON_REMOTE_DIGIT8 0x27005417 /* Digit 8 */ +#define DIBUTTON_REMOTE_DIGIT9 0x27005418 /* Digit 9 */ +#define DIBUTTON_REMOTE_DEVICE 0x270044FE /* Show input device and controls */ +#define DIBUTTON_REMOTE_PAUSE 0x270044FC /* Start / Pause / Restart game */ + +/*--- Control- Web + Help or Browser ---*/ +#define DIVIRTUAL_BROWSER_CONTROL 0x28000000 +#define DIAXIS_BROWSER_LATERAL 0x28008201 /* Move on screen pointer */ +#define DIAXIS_BROWSER_MOVE 0x28010202 /* Move on screen pointer */ +#define DIBUTTON_BROWSER_SELECT 0x28000401 /* Select current item */ +#define DIAXIS_BROWSER_VIEW 0x28018203 /* Move view up/down */ +#define DIBUTTON_BROWSER_REFRESH 0x28000402 /* Refresh */ +#define DIBUTTON_BROWSER_MENU 0x280004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BROWSER_SEARCH 0x28004403 /* Use search tool */ +#define DIBUTTON_BROWSER_STOP 0x28004404 /* Cease current update */ +#define DIBUTTON_BROWSER_HOME 0x28004405 /* Go directly to "home" location */ +#define DIBUTTON_BROWSER_FAVORITES 0x28004406 /* Mark current site as favorite */ +#define DIBUTTON_BROWSER_NEXT 0x28004407 /* Select Next page */ +#define DIBUTTON_BROWSER_PREVIOUS 0x28004408 /* Select Previous page */ +#define DIBUTTON_BROWSER_HISTORY 0x28004409 /* Show/Hide History */ +#define DIBUTTON_BROWSER_PRINT 0x2800440A /* Print current page */ +#define DIBUTTON_BROWSER_DEVICE 0x280044FE /* Show input device and controls */ +#define DIBUTTON_BROWSER_PAUSE 0x280044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Giant Walking Robot + Walking tank with weapons ---*/ +#define DIVIRTUAL_DRIVING_MECHA 0x29000000 +#define DIAXIS_MECHA_STEER 0x29008201 /* Turns mecha left/right */ +#define DIAXIS_MECHA_TORSO 0x29010202 /* Tilts torso forward/backward */ +#define DIAXIS_MECHA_ROTATE 0x29020203 /* Turns torso left/right */ +#define DIAXIS_MECHA_THROTTLE 0x29038204 /* Engine Speed */ +#define DIBUTTON_MECHA_FIRE 0x29000401 /* Fire */ +#define DIBUTTON_MECHA_WEAPONS 0x29000402 /* Select next weapon group */ +#define DIBUTTON_MECHA_TARGET 0x29000403 /* Select closest enemy available target */ +#define DIBUTTON_MECHA_REVERSE 0x29000404 /* Toggles throttle in/out of reverse */ +#define DIBUTTON_MECHA_ZOOM 0x29000405 /* Zoom in/out targeting reticule */ +#define DIBUTTON_MECHA_JUMP 0x29000406 /* Fires jump jets */ +#define DIBUTTON_MECHA_MENU 0x290004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_MECHA_CENTER 0x29004407 /* Center torso to legs */ +#define DIHATSWITCH_MECHA_GLANCE 0x29004601 /* Look around */ +#define DIBUTTON_MECHA_VIEW 0x29004408 /* Cycle through view options */ +#define DIBUTTON_MECHA_FIRESECONDARY 0x29004409 /* Alternative fire button */ +#define DIBUTTON_MECHA_LEFT_LINK 0x2900C4E4 /* Fallback steer left button */ +#define DIBUTTON_MECHA_RIGHT_LINK 0x2900C4EC /* Fallback steer right button */ +#define DIBUTTON_MECHA_FORWARD_LINK 0x290144E0 /* Fallback tilt torso forward button */ +#define DIBUTTON_MECHA_BACK_LINK 0x290144E8 /* Fallback tilt toroso backward button */ +#define DIBUTTON_MECHA_ROTATE_LEFT_LINK 0x290244E4 /* Fallback rotate toroso right button */ +#define DIBUTTON_MECHA_ROTATE_RIGHT_LINK 0x290244EC /* Fallback rotate torso left button */ +#define DIBUTTON_MECHA_FASTER_LINK 0x2903C4E0 /* Fallback increase engine speed */ +#define DIBUTTON_MECHA_SLOWER_LINK 0x2903C4E8 /* Fallback decrease engine speed */ +#define DIBUTTON_MECHA_DEVICE 0x290044FE /* Show input device and controls */ +#define DIBUTTON_MECHA_PAUSE 0x290044FC /* Start / Pause / Restart game */ + +/* + * "ANY" semantics can be used as a last resort to get mappings for actions + * that match nothing in the chosen virtual genre. These semantics will be + * mapped at a lower priority that virtual genre semantics. Also, hardware + * vendors will not be able to provide sensible mappings for these unless + * they provide application specific mappings. + */ +#define DIAXIS_ANY_X_1 0xFF00C201 +#define DIAXIS_ANY_X_2 0xFF00C202 +#define DIAXIS_ANY_Y_1 0xFF014201 +#define DIAXIS_ANY_Y_2 0xFF014202 +#define DIAXIS_ANY_Z_1 0xFF01C201 +#define DIAXIS_ANY_Z_2 0xFF01C202 +#define DIAXIS_ANY_R_1 0xFF024201 +#define DIAXIS_ANY_R_2 0xFF024202 +#define DIAXIS_ANY_U_1 0xFF02C201 +#define DIAXIS_ANY_U_2 0xFF02C202 +#define DIAXIS_ANY_V_1 0xFF034201 +#define DIAXIS_ANY_V_2 0xFF034202 +#define DIAXIS_ANY_A_1 0xFF03C201 +#define DIAXIS_ANY_A_2 0xFF03C202 +#define DIAXIS_ANY_B_1 0xFF044201 +#define DIAXIS_ANY_B_2 0xFF044202 +#define DIAXIS_ANY_C_1 0xFF04C201 +#define DIAXIS_ANY_C_2 0xFF04C202 +#define DIAXIS_ANY_S_1 0xFF054201 +#define DIAXIS_ANY_S_2 0xFF054202 + +#define DIAXIS_ANY_1 0xFF004201 +#define DIAXIS_ANY_2 0xFF004202 +#define DIAXIS_ANY_3 0xFF004203 +#define DIAXIS_ANY_4 0xFF004204 + +#define DIPOV_ANY_1 0xFF004601 +#define DIPOV_ANY_2 0xFF004602 +#define DIPOV_ANY_3 0xFF004603 +#define DIPOV_ANY_4 0xFF004604 + +#define DIBUTTON_ANY(instance) ( 0xFF004400 | instance ) + + +#ifdef __cplusplus +}; +#endif + +#endif /* __DINPUT_INCLUDED__ */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current sdk files + * + ****************************************************************************/ + +#ifdef _INC_MMSYSTEM +#ifndef MMNOJOY + +#ifndef __VJOYDX_INCLUDED__ +#define __VJOYDX_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure + * contains mini-driver specific data to be passed by VJoyD to the mini- + * driver instead of doing a poll. + */ +#define JOY_PASSDRIVERDATA 0x10000000l + +/* + * Informs the joystick driver that the configuration has been changed + * and should be reloaded from the registery. + * dwFlags is reserved and should be set to zero + */ +WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags ); + +#ifndef DIJ_RINGZERO +/* + * Invoke the joystick control panel directly, using the passed window handle + * as the parent of the dialog. This API is only supported for compatibility + * purposes; new applications should use the RunControlPanel method of a + * device interface for a game controller. + * The API is called by using the function pointer returned by + * GetProcAddress( hCPL, TEXT("ShowJoyCPL") ) where hCPL is a HMODULE returned + * by LoadLibrary( TEXT("joy.cpl") ). The typedef is provided to allow + * declaration and casting of an appropriately typed variable. + */ +void WINAPI ShowJoyCPL( HWND hWnd ); +typedef void (WINAPI* LPFNSHOWJOYCPL)( HWND hWnd ); +#endif /* DIJ_RINGZERO */ + + +/* + * Hardware Setting indicating that the device is a headtracker + */ +#define JOY_HWS_ISHEADTRACKER 0x02000000l + +/* + * Hardware Setting indicating that the VxD is used to replace + * the standard analog polling + */ +#define JOY_HWS_ISGAMEPORTDRIVER 0x04000000l + +/* + * Hardware Setting indicating that the driver needs a standard + * gameport in order to communicate with the device. + */ +#define JOY_HWS_ISANALOGPORTDRIVER 0x08000000l + +/* + * Hardware Setting indicating that VJoyD should not load this + * driver, it will be loaded externally and will register with + * VJoyD of it's own accord. + */ +#define JOY_HWS_AUTOLOAD 0x10000000l + +/* + * Hardware Setting indicating that the driver acquires any + * resources needed without needing a devnode through VJoyD. + */ +#define JOY_HWS_NODEVNODE 0x20000000l + + +/* + * Hardware Setting indicating that the device is a gameport bus + */ +#define JOY_HWS_ISGAMEPORTBUS 0x80000000l +#define JOY_HWS_GAMEPORTBUSBUSY 0x00000001l + +/* + * Usage Setting indicating that the settings are volatile and + * should be removed if still present on a reboot. + */ +#define JOY_US_VOLATILE 0x00000008L + +#ifdef __cplusplus +}; +#endif + +#endif /* __VJOYDX_INCLUDED__ */ + +#endif /* not MMNOJOY */ +#endif /* _INC_MMSYSTEM */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current ddk files + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +#ifdef _INC_MMDDK +#ifndef MMNOJOYDEV + +#ifndef __VJOYDXD_INCLUDED__ +#define __VJOYDXD_INCLUDED__ +/* + * Poll type in which the do_other field of the JOYOEMPOLLDATA + * structure contains mini-driver specific data passed from an app. + */ +#define JOY_OEMPOLL_PASSDRIVERDATA 7 + +#endif /* __VJOYDXD_INCLUDED__ */ + +#endif /* not MMNOJOYDEV */ +#endif /* _INC_MMDDK */ + +#endif /* DIJ_RINGZERO */ + diff --git a/saco/d3d9/include/dinputd.h b/saco/d3d9/include/dinputd.h new file mode 100644 index 0000000..f534353 --- /dev/null +++ b/saco/d3d9/include/dinputd.h @@ -0,0 +1,755 @@ +/**************************************************************************** + * + * Copyright (C) 1995-2000 Microsoft Corporation. All Rights Reserved. + * + * File: dinputd.h + * Content: DirectInput include file for device driver implementors + * + ****************************************************************************/ +#ifndef __DINPUTD_INCLUDED__ +#define __DINPUTD_INCLUDED__ + +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0800 +#pragma message(__FILE__ ": DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800") +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/**************************************************************************** + * + * Interfaces + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +DEFINE_GUID(IID_IDirectInputEffectDriver, 0x02538130,0x898F,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(IID_IDirectInputJoyConfig, 0x1DE12AB1,0xC9F5,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputPIDDriver, 0xEEC6993A,0xB3FD,0x11D2,0xA9,0x16,0x00,0xC0,0x4F,0xB9,0x86,0x38); + +DEFINE_GUID(IID_IDirectInputJoyConfig8, 0xeb0d7dfa,0x1990,0x4f27,0xb4,0xd6,0xed,0xf2,0xee,0xc4,0xa4,0x4c); + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * IDirectInputEffectDriver + * + ****************************************************************************/ + +typedef struct DIOBJECTATTRIBUTES { + DWORD dwFlags; + WORD wUsagePage; + WORD wUsage; +} DIOBJECTATTRIBUTES, *LPDIOBJECTATTRIBUTES; +typedef const DIOBJECTATTRIBUTES *LPCDIOBJECTATTRIBUTES; + +typedef struct DIFFOBJECTATTRIBUTES { + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; +} DIFFOBJECTATTRIBUTES, *LPDIFFOBJECTATTRIBUTES; +typedef const DIFFOBJECTATTRIBUTES *LPCDIFFOBJECTATTRIBUTES; + +typedef struct DIOBJECTCALIBRATION { + LONG lMin; + LONG lCenter; + LONG lMax; +} DIOBJECTCALIBRATION, *LPDIOBJECTCALIBRATION; +typedef const DIOBJECTCALIBRATION *LPCDIOBJECTCALIBRATION; + +typedef struct DIPOVCALIBRATION { + LONG lMin[5]; + LONG lMax[5]; +} DIPOVCALIBRATION, *LPDIPOVCALIBRATION; +typedef const DIPOVCALIBRATION *LPCDIPOVCALIBRATION; + +typedef struct DIEFFECTATTRIBUTES { + DWORD dwEffectId; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + DWORD dwCoords; +} DIEFFECTATTRIBUTES, *LPDIEFFECTATTRIBUTES; +typedef const DIEFFECTATTRIBUTES *LPCDIEFFECTATTRIBUTES; + +typedef struct DIFFDEVICEATTRIBUTES { + DWORD dwFlags; + DWORD dwFFSamplePeriod; + DWORD dwFFMinTimeResolution; +} DIFFDEVICEATTRIBUTES, *LPDIFFDEVICEATTRIBUTES; +typedef const DIFFDEVICEATTRIBUTES *LPCDIFFDEVICEATTRIBUTES; + +typedef struct DIDRIVERVERSIONS { + DWORD dwSize; + DWORD dwFirmwareRevision; + DWORD dwHardwareRevision; + DWORD dwFFDriverVersion; +} DIDRIVERVERSIONS, *LPDIDRIVERVERSIONS; +typedef const DIDRIVERVERSIONS *LPCDIDRIVERVERSIONS; + +typedef struct DIDEVICESTATE { + DWORD dwSize; + DWORD dwState; + DWORD dwLoad; +} DIDEVICESTATE, *LPDIDEVICESTATE; + +#define DEV_STS_EFFECT_RUNNING DIEGES_PLAYING + +#ifndef DIJ_RINGZERO + +typedef struct DIHIDFFINITINFO { + DWORD dwSize; + LPWSTR pwszDeviceInterface; + GUID GuidInstance; +} DIHIDFFINITINFO, *LPDIHIDFFINITINFO; + +#undef INTERFACE +#define INTERFACE IDirectInputEffectDriver + +DECLARE_INTERFACE_(IDirectInputEffectDriver, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputEffectDriver methods ***/ + STDMETHOD(DeviceID)(THIS_ DWORD,DWORD,DWORD,DWORD,LPVOID) PURE; + STDMETHOD(GetVersions)(THIS_ LPDIDRIVERVERSIONS) PURE; + STDMETHOD(Escape)(THIS_ DWORD,DWORD,LPDIEFFESCAPE) PURE; + STDMETHOD(SetGain)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ DWORD,LPDIDEVICESTATE) PURE; + STDMETHOD(DownloadEffect)(THIS_ DWORD,DWORD,LPDWORD,LPCDIEFFECT,DWORD) PURE; + STDMETHOD(DestroyEffect)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(StartEffect)(THIS_ DWORD,DWORD,DWORD,DWORD) PURE; + STDMETHOD(StopEffect)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(GetEffectStatus)(THIS_ DWORD,DWORD,LPDWORD) PURE; +}; + +typedef struct IDirectInputEffectDriver *LPDIRECTINPUTEFFECTDRIVER; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputEffectDriver_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputEffectDriver_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputEffectDriver_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputEffectDriver_DeviceID(p,a,b,c,d,e) (p)->lpVtbl->DeviceID(p,a,b,c,d,e) +#define IDirectInputEffectDriver_GetVersions(p,a) (p)->lpVtbl->GetVersions(p,a) +#define IDirectInputEffectDriver_Escape(p,a,b,c) (p)->lpVtbl->Escape(p,a,b,c) +#define IDirectInputEffectDriver_SetGain(p,a,b) (p)->lpVtbl->SetGain(p,a,b) +#define IDirectInputEffectDriver_SendForceFeedbackCommand(p,a,b) (p)->lpVtbl->SendForceFeedbackCommand(p,a,b) +#define IDirectInputEffectDriver_GetForceFeedbackState(p,a,b) (p)->lpVtbl->GetForceFeedbackState(p,a,b) +#define IDirectInputEffectDriver_DownloadEffect(p,a,b,c,d,e) (p)->lpVtbl->DownloadEffect(p,a,b,c,d,e) +#define IDirectInputEffectDriver_DestroyEffect(p,a,b) (p)->lpVtbl->DestroyEffect(p,a,b) +#define IDirectInputEffectDriver_StartEffect(p,a,b,c,d) (p)->lpVtbl->StartEffect(p,a,b,c,d) +#define IDirectInputEffectDriver_StopEffect(p,a,b) (p)->lpVtbl->StopEffect(p,a,b) +#define IDirectInputEffectDriver_GetEffectStatus(p,a,b,c) (p)->lpVtbl->GetEffectStatus(p,a,b,c) +#else +#define IDirectInputEffectDriver_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputEffectDriver_AddRef(p) (p)->AddRef() +#define IDirectInputEffectDriver_Release(p) (p)->Release() +#define IDirectInputEffectDriver_DeviceID(p,a,b,c,d,e) (p)->DeviceID(a,b,c,d,e) +#define IDirectInputEffectDriver_GetVersions(p,a) (p)->GetVersions(a) +#define IDirectInputEffectDriver_Escape(p,a,b,c) (p)->Escape(a,b,c) +#define IDirectInputEffectDriver_SetGain(p,a,b) (p)->SetGain(a,b) +#define IDirectInputEffectDriver_SendForceFeedbackCommand(p,a,b) (p)->SendForceFeedbackCommand(a,b) +#define IDirectInputEffectDriver_GetForceFeedbackState(p,a,b) (p)->GetForceFeedbackState(a,b) +#define IDirectInputEffectDriver_DownloadEffect(p,a,b,c,d,e) (p)->DownloadEffect(a,b,c,d,e) +#define IDirectInputEffectDriver_DestroyEffect(p,a,b) (p)->DestroyEffect(a,b) +#define IDirectInputEffectDriver_StartEffect(p,a,b,c,d) (p)->StartEffect(a,b,c,d) +#define IDirectInputEffectDriver_StopEffect(p,a,b) (p)->StopEffect(a,b) +#define IDirectInputEffectDriver_GetEffectStatus(p,a,b,c) (p)->GetEffectStatus(a,b,c) +#endif + + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * IDirectInputJoyConfig + * + ****************************************************************************/ + +/**************************************************************************** + * + * Definitions copied from the DDK + * + ****************************************************************************/ + +#ifndef JOY_HW_NONE + +/* pre-defined joystick types */ +#define JOY_HW_NONE 0 +#define JOY_HW_CUSTOM 1 +#define JOY_HW_2A_2B_GENERIC 2 +#define JOY_HW_2A_4B_GENERIC 3 +#define JOY_HW_2B_GAMEPAD 4 +#define JOY_HW_2B_FLIGHTYOKE 5 +#define JOY_HW_2B_FLIGHTYOKETHROTTLE 6 +#define JOY_HW_3A_2B_GENERIC 7 +#define JOY_HW_3A_4B_GENERIC 8 +#define JOY_HW_4B_GAMEPAD 9 +#define JOY_HW_4B_FLIGHTYOKE 10 +#define JOY_HW_4B_FLIGHTYOKETHROTTLE 11 +#define JOY_HW_TWO_2A_2B_WITH_Y 12 +#define JOY_HW_LASTENTRY 13 + + +/* calibration flags */ +#define JOY_ISCAL_XY 0x00000001l /* XY are calibrated */ +#define JOY_ISCAL_Z 0x00000002l /* Z is calibrated */ +#define JOY_ISCAL_R 0x00000004l /* R is calibrated */ +#define JOY_ISCAL_U 0x00000008l /* U is calibrated */ +#define JOY_ISCAL_V 0x00000010l /* V is calibrated */ +#define JOY_ISCAL_POV 0x00000020l /* POV is calibrated */ + +/* point of view constants */ +#define JOY_POV_NUMDIRS 4 +#define JOY_POVVAL_FORWARD 0 +#define JOY_POVVAL_BACKWARD 1 +#define JOY_POVVAL_LEFT 2 +#define JOY_POVVAL_RIGHT 3 + +/* Specific settings for joystick hardware */ +#define JOY_HWS_HASZ 0x00000001l /* has Z info? */ +#define JOY_HWS_HASPOV 0x00000002l /* point of view hat present */ +#define JOY_HWS_POVISBUTTONCOMBOS 0x00000004l /* pov done through combo of buttons */ +#define JOY_HWS_POVISPOLL 0x00000008l /* pov done through polling */ +#define JOY_HWS_ISYOKE 0x00000010l /* joystick is a flight yoke */ +#define JOY_HWS_ISGAMEPAD 0x00000020l /* joystick is a game pad */ +#define JOY_HWS_ISCARCTRL 0x00000040l /* joystick is a car controller */ +/* X defaults to J1 X axis */ +#define JOY_HWS_XISJ1Y 0x00000080l /* X is on J1 Y axis */ +#define JOY_HWS_XISJ2X 0x00000100l /* X is on J2 X axis */ +#define JOY_HWS_XISJ2Y 0x00000200l /* X is on J2 Y axis */ +/* Y defaults to J1 Y axis */ +#define JOY_HWS_YISJ1X 0x00000400l /* Y is on J1 X axis */ +#define JOY_HWS_YISJ2X 0x00000800l /* Y is on J2 X axis */ +#define JOY_HWS_YISJ2Y 0x00001000l /* Y is on J2 Y axis */ +/* Z defaults to J2 Y axis */ +#define JOY_HWS_ZISJ1X 0x00002000l /* Z is on J1 X axis */ +#define JOY_HWS_ZISJ1Y 0x00004000l /* Z is on J1 Y axis */ +#define JOY_HWS_ZISJ2X 0x00008000l /* Z is on J2 X axis */ +/* POV defaults to J2 Y axis, if it is not button based */ +#define JOY_HWS_POVISJ1X 0x00010000l /* pov done through J1 X axis */ +#define JOY_HWS_POVISJ1Y 0x00020000l /* pov done through J1 Y axis */ +#define JOY_HWS_POVISJ2X 0x00040000l /* pov done through J2 X axis */ +/* R defaults to J2 X axis */ +#define JOY_HWS_HASR 0x00080000l /* has R (4th axis) info */ +#define JOY_HWS_RISJ1X 0x00100000l /* R done through J1 X axis */ +#define JOY_HWS_RISJ1Y 0x00200000l /* R done through J1 Y axis */ +#define JOY_HWS_RISJ2Y 0x00400000l /* R done through J2 X axis */ +/* U & V for future hardware */ +#define JOY_HWS_HASU 0x00800000l /* has U (5th axis) info */ +#define JOY_HWS_HASV 0x01000000l /* has V (6th axis) info */ + +/* Usage settings */ +#define JOY_US_HASRUDDER 0x00000001l /* joystick configured with rudder */ +#define JOY_US_PRESENT 0x00000002l /* is joystick actually present? */ +#define JOY_US_ISOEM 0x00000004l /* joystick is an OEM defined type */ + +/* reserved for future use -> as link to next possible dword */ +#define JOY_US_RESERVED 0x80000000l /* reserved */ + + +/* Settings for TypeInfo Flags1 */ +#define JOYTYPE_ZEROGAMEENUMOEMDATA 0x00000001l /* Zero GameEnum's OEM data field */ +#define JOYTYPE_NOAUTODETECTGAMEPORT 0x00000002l /* Device does not support Autodetect gameport*/ +#define JOYTYPE_NOHIDDIRECT 0x00000004l /* Do not use HID directly for this device */ +#define JOYTYPE_ANALOGCOMPAT 0x00000008l /* Expose the analog compatible ID */ +#define JOYTYPE_DEFAULTPROPSHEET 0x80000000l /* CPL overrides custom property sheet */ + +/* Settings for TypeInfo Flags2 */ +#define JOYTYPE_DEVICEHIDE 0x00010000l /* Hide unclassified devices */ +#define JOYTYPE_MOUSEHIDE 0x00020000l /* Hide mice */ +#define JOYTYPE_KEYBHIDE 0x00040000l /* Hide keyboards */ +#define JOYTYPE_GAMEHIDE 0x00080000l /* Hide game controllers */ +#define JOYTYPE_HIDEACTIVE 0x00100000l /* Hide flags are active */ +#define JOYTYPE_INFOMASK 0x00E00000l /* Mask for type specific info */ +#define JOYTYPE_INFODEFAULT 0x00000000l /* Use default axis mappings */ +#define JOYTYPE_INFOYYPEDALS 0x00200000l /* Use Y as a combined pedals axis */ +#define JOYTYPE_INFOZYPEDALS 0x00400000l /* Use Z for accelerate, Y for brake */ +#define JOYTYPE_INFOYRPEDALS 0x00600000l /* Use Y for accelerate, R for brake */ +#define JOYTYPE_INFOZRPEDALS 0x00800000l /* Use Z for accelerate, R for brake */ +#define JOYTYPE_INFOZISSLIDER 0x00200000l /* Use Z as a slider */ +#define JOYTYPE_INFOZISZ 0x00400000l /* Use Z as Z axis */ +#define JOYTYPE_ENABLEINPUTREPORT 0x01000000l /* Enable initial input reports */ + +/* struct for storing x,y, z, and rudder values */ +typedef struct joypos_tag { + DWORD dwX; + DWORD dwY; + DWORD dwZ; + DWORD dwR; + DWORD dwU; + DWORD dwV; +} JOYPOS, FAR *LPJOYPOS; + +/* struct for storing ranges */ +typedef struct joyrange_tag { + JOYPOS jpMin; + JOYPOS jpMax; + JOYPOS jpCenter; +} JOYRANGE,FAR *LPJOYRANGE; + +/* + * dwTimeout - value at which to timeout joystick polling + * jrvRanges - range of values app wants returned for axes + * jpDeadZone - area around center to be considered + * as "dead". specified as a percentage + * (0-100). Only X & Y handled by system driver + */ +typedef struct joyreguservalues_tag { + DWORD dwTimeOut; + JOYRANGE jrvRanges; + JOYPOS jpDeadZone; +} JOYREGUSERVALUES, FAR *LPJOYREGUSERVALUES; + +typedef struct joyreghwsettings_tag { + DWORD dwFlags; + DWORD dwNumButtons; +} JOYREGHWSETTINGS, FAR *LPJOYHWSETTINGS; + +/* range of values returned by the hardware (filled in by calibration) */ +/* + * jrvHardware - values returned by hardware + * dwPOVValues - POV values returned by hardware + * dwCalFlags - what has been calibrated + */ +typedef struct joyreghwvalues_tag { + JOYRANGE jrvHardware; + DWORD dwPOVValues[JOY_POV_NUMDIRS]; + DWORD dwCalFlags; +} JOYREGHWVALUES, FAR *LPJOYREGHWVALUES; + +/* hardware configuration */ +/* + * hws - hardware settings + * dwUsageSettings - usage settings + * hwv - values returned by hardware + * dwType - type of joystick + * dwReserved - reserved for OEM drivers + */ +typedef struct joyreghwconfig_tag { + JOYREGHWSETTINGS hws; + DWORD dwUsageSettings; + JOYREGHWVALUES hwv; + DWORD dwType; + DWORD dwReserved; +} JOYREGHWCONFIG, FAR *LPJOYREGHWCONFIG; + +/* joystick calibration info structure */ +typedef struct joycalibrate_tag { + UINT wXbase; + UINT wXdelta; + UINT wYbase; + UINT wYdelta; + UINT wZbase; + UINT wZdelta; +} JOYCALIBRATE; +typedef JOYCALIBRATE FAR *LPJOYCALIBRATE; + +#endif + +#ifndef DIJ_RINGZERO + +#define MAX_JOYSTRING 256 +typedef BOOL (FAR PASCAL * LPDIJOYTYPECALLBACK)(LPCWSTR, LPVOID); + +#ifndef MAX_JOYSTICKOEMVXDNAME +#define MAX_JOYSTICKOEMVXDNAME 260 +#endif + +#define DITC_REGHWSETTINGS 0x00000001 +#define DITC_CLSIDCONFIG 0x00000002 +#define DITC_DISPLAYNAME 0x00000004 +#define DITC_CALLOUT 0x00000008 +#define DITC_HARDWAREID 0x00000010 +#define DITC_FLAGS1 0x00000020 +#define DITC_FLAGS2 0x00000040 +#define DITC_MAPFILE 0x00000080 + + + +/* This structure is defined for DirectX 5.0 compatibility */ + +typedef struct DIJOYTYPEINFO_DX5 { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; +} DIJOYTYPEINFO_DX5, *LPDIJOYTYPEINFO_DX5; +typedef const DIJOYTYPEINFO_DX5 *LPCDIJOYTYPEINFO_DX5; + +/* This structure is defined for DirectX 6.1 compatibility */ +typedef struct DIJOYTYPEINFO_DX6 { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; + WCHAR wszHardwareId[MAX_JOYSTRING]; + DWORD dwFlags1; +} DIJOYTYPEINFO_DX6, *LPDIJOYTYPEINFO_DX6; +typedef const DIJOYTYPEINFO_DX6 *LPCDIJOYTYPEINFO_DX6; + +typedef struct DIJOYTYPEINFO { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; +#if(DIRECTINPUT_VERSION >= 0x05b2) + WCHAR wszHardwareId[MAX_JOYSTRING]; + DWORD dwFlags1; +#if(DIRECTINPUT_VERSION >= 0x0800) + DWORD dwFlags2; + WCHAR wszMapFile[MAX_JOYSTRING]; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ +} DIJOYTYPEINFO, *LPDIJOYTYPEINFO; +typedef const DIJOYTYPEINFO *LPCDIJOYTYPEINFO; +#define DIJC_GUIDINSTANCE 0x00000001 +#define DIJC_REGHWCONFIGTYPE 0x00000002 +#define DIJC_GAIN 0x00000004 +#define DIJC_CALLOUT 0x00000008 +#define DIJC_WDMGAMEPORT 0x00000010 + +/* This structure is defined for DirectX 5.0 compatibility */ + +typedef struct DIJOYCONFIG_DX5 { + DWORD dwSize; + GUID guidInstance; + JOYREGHWCONFIG hwc; + DWORD dwGain; + WCHAR wszType[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTRING]; +} DIJOYCONFIG_DX5, *LPDIJOYCONFIG_DX5; +typedef const DIJOYCONFIG_DX5 *LPCDIJOYCONFIG_DX5; + +typedef struct DIJOYCONFIG { + DWORD dwSize; + GUID guidInstance; + JOYREGHWCONFIG hwc; + DWORD dwGain; + WCHAR wszType[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTRING]; +#if(DIRECTINPUT_VERSION >= 0x05b2) + GUID guidGameport; +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ + } DIJOYCONFIG, *LPDIJOYCONFIG; +typedef const DIJOYCONFIG *LPCDIJOYCONFIG; + + +#define DIJU_USERVALUES 0x00000001 +#define DIJU_GLOBALDRIVER 0x00000002 +#define DIJU_GAMEPORTEMULATOR 0x00000004 + +typedef struct DIJOYUSERVALUES { + DWORD dwSize; + JOYREGUSERVALUES ruv; + WCHAR wszGlobalDriver[MAX_JOYSTRING]; + WCHAR wszGameportEmulator[MAX_JOYSTRING]; +} DIJOYUSERVALUES, *LPDIJOYUSERVALUES; +typedef const DIJOYUSERVALUES *LPCDIJOYUSERVALUES; + +DEFINE_GUID(GUID_KeyboardClass, 0x4D36E96B,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_MediaClass, 0x4D36E96C,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_MouseClass, 0x4D36E96F,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_HIDClass, 0x745A17A0,0x74D3,0x11D0,0xB6,0xFE,0x00,0xA0,0xC9,0x0F,0x57,0xDA); + +#undef INTERFACE +#define INTERFACE IDirectInputJoyConfig + +DECLARE_INTERFACE_(IDirectInputJoyConfig, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputJoyConfig methods ***/ + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(SendNotify)(THIS) PURE; + STDMETHOD(EnumTypes)(THIS_ LPDIJOYTYPECALLBACK,LPVOID) PURE; + STDMETHOD(GetTypeInfo)(THIS_ LPCWSTR,LPDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(SetTypeInfo)(THIS_ LPCWSTR,LPCDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(DeleteType)(THIS_ LPCWSTR) PURE; + STDMETHOD(GetConfig)(THIS_ UINT,LPDIJOYCONFIG,DWORD) PURE; + STDMETHOD(SetConfig)(THIS_ UINT,LPCDIJOYCONFIG,DWORD) PURE; + STDMETHOD(DeleteConfig)(THIS_ UINT) PURE; + STDMETHOD(GetUserValues)(THIS_ LPDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(SetUserValues)(THIS_ LPCDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(AddNewHardware)(THIS_ HWND,REFGUID) PURE; + STDMETHOD(OpenTypeKey)(THIS_ LPCWSTR,DWORD,PHKEY) PURE; + STDMETHOD(OpenConfigKey)(THIS_ UINT,DWORD,PHKEY) PURE; +}; + +typedef struct IDirectInputJoyConfig *LPDIRECTINPUTJOYCONFIG; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputJoyConfig_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputJoyConfig_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputJoyConfig_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputJoyConfig_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputJoyConfig_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputJoyConfig_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputJoyConfig_SendNotify(p) (p)->lpVtbl->SendNotify(p) +#define IDirectInputJoyConfig_EnumTypes(p,a,b) (p)->lpVtbl->EnumTypes(p,a,b) +#define IDirectInputJoyConfig_GetTypeInfo(p,a,b,c) (p)->lpVtbl->GetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig_SetTypeInfo(p,a,b,c) (p)->lpVtbl->SetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig_DeleteType(p,a) (p)->lpVtbl->DeleteType(p,a) +#define IDirectInputJoyConfig_GetConfig(p,a,b,c) (p)->lpVtbl->GetConfig(p,a,b,c) +#define IDirectInputJoyConfig_SetConfig(p,a,b,c) (p)->lpVtbl->SetConfig(p,a,b,c) +#define IDirectInputJoyConfig_DeleteConfig(p,a) (p)->lpVtbl->DeleteConfig(p,a) +#define IDirectInputJoyConfig_GetUserValues(p,a,b) (p)->lpVtbl->GetUserValues(p,a,b) +#define IDirectInputJoyConfig_SetUserValues(p,a,b) (p)->lpVtbl->SetUserValues(p,a,b) +#define IDirectInputJoyConfig_AddNewHardware(p,a,b) (p)->lpVtbl->AddNewHardware(p,a,b) +#define IDirectInputJoyConfig_OpenTypeKey(p,a,b,c) (p)->lpVtbl->OpenTypeKey(p,a,b,c) +#define IDirectInputJoyConfig_OpenConfigKey(p,a,b,c) (p)->lpVtbl->OpenConfigKey(p,a,b,c) +#else +#define IDirectInputJoyConfig_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputJoyConfig_AddRef(p) (p)->AddRef() +#define IDirectInputJoyConfig_Release(p) (p)->Release() +#define IDirectInputJoyConfig_Acquire(p) (p)->Acquire() +#define IDirectInputJoyConfig_Unacquire(p) (p)->Unacquire() +#define IDirectInputJoyConfig_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputJoyConfig_SendNotify(p) (p)->SendNotify() +#define IDirectInputJoyConfig_EnumTypes(p,a,b) (p)->EnumTypes(a,b) +#define IDirectInputJoyConfig_GetTypeInfo(p,a,b,c) (p)->GetTypeInfo(a,b,c) +#define IDirectInputJoyConfig_SetTypeInfo(p,a,b,c) (p)->SetTypeInfo(a,b,c) +#define IDirectInputJoyConfig_DeleteType(p,a) (p)->DeleteType(a) +#define IDirectInputJoyConfig_GetConfig(p,a,b,c) (p)->GetConfig(a,b,c) +#define IDirectInputJoyConfig_SetConfig(p,a,b,c) (p)->SetConfig(a,b,c) +#define IDirectInputJoyConfig_DeleteConfig(p,a) (p)->DeleteConfig(a) +#define IDirectInputJoyConfig_GetUserValues(p,a,b) (p)->GetUserValues(a,b) +#define IDirectInputJoyConfig_SetUserValues(p,a,b) (p)->SetUserValues(a,b) +#define IDirectInputJoyConfig_AddNewHardware(p,a,b) (p)->AddNewHardware(a,b) +#define IDirectInputJoyConfig_OpenTypeKey(p,a,b,c) (p)->OpenTypeKey(a,b,c) +#define IDirectInputJoyConfig_OpenConfigKey(p,a,b,c) (p)->OpenConfigKey(a,b,c) +#endif + +#endif /* DIJ_RINGZERO */ + +#if(DIRECTINPUT_VERSION >= 0x0800) + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputJoyConfig8 + +DECLARE_INTERFACE_(IDirectInputJoyConfig8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputJoyConfig8 methods ***/ + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(SendNotify)(THIS) PURE; + STDMETHOD(EnumTypes)(THIS_ LPDIJOYTYPECALLBACK,LPVOID) PURE; + STDMETHOD(GetTypeInfo)(THIS_ LPCWSTR,LPDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(SetTypeInfo)(THIS_ LPCWSTR,LPCDIJOYTYPEINFO,DWORD,LPWSTR) PURE; + STDMETHOD(DeleteType)(THIS_ LPCWSTR) PURE; + STDMETHOD(GetConfig)(THIS_ UINT,LPDIJOYCONFIG,DWORD) PURE; + STDMETHOD(SetConfig)(THIS_ UINT,LPCDIJOYCONFIG,DWORD) PURE; + STDMETHOD(DeleteConfig)(THIS_ UINT) PURE; + STDMETHOD(GetUserValues)(THIS_ LPDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(SetUserValues)(THIS_ LPCDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(AddNewHardware)(THIS_ HWND,REFGUID) PURE; + STDMETHOD(OpenTypeKey)(THIS_ LPCWSTR,DWORD,PHKEY) PURE; + STDMETHOD(OpenAppStatusKey)(THIS_ PHKEY) PURE; +}; + +typedef struct IDirectInputJoyConfig8 *LPDIRECTINPUTJOYCONFIG8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputJoyConfig8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputJoyConfig8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputJoyConfig8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputJoyConfig8_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputJoyConfig8_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputJoyConfig8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputJoyConfig8_SendNotify(p) (p)->lpVtbl->SendNotify(p) +#define IDirectInputJoyConfig8_EnumTypes(p,a,b) (p)->lpVtbl->EnumTypes(p,a,b) +#define IDirectInputJoyConfig8_GetTypeInfo(p,a,b,c) (p)->lpVtbl->GetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig8_SetTypeInfo(p,a,b,c,d) (p)->lpVtbl->SetTypeInfo(p,a,b,c,d) +#define IDirectInputJoyConfig8_DeleteType(p,a) (p)->lpVtbl->DeleteType(p,a) +#define IDirectInputJoyConfig8_GetConfig(p,a,b,c) (p)->lpVtbl->GetConfig(p,a,b,c) +#define IDirectInputJoyConfig8_SetConfig(p,a,b,c) (p)->lpVtbl->SetConfig(p,a,b,c) +#define IDirectInputJoyConfig8_DeleteConfig(p,a) (p)->lpVtbl->DeleteConfig(p,a) +#define IDirectInputJoyConfig8_GetUserValues(p,a,b) (p)->lpVtbl->GetUserValues(p,a,b) +#define IDirectInputJoyConfig8_SetUserValues(p,a,b) (p)->lpVtbl->SetUserValues(p,a,b) +#define IDirectInputJoyConfig8_AddNewHardware(p,a,b) (p)->lpVtbl->AddNewHardware(p,a,b) +#define IDirectInputJoyConfig8_OpenTypeKey(p,a,b,c) (p)->lpVtbl->OpenTypeKey(p,a,b,c) +#define IDirectInputJoyConfig8_OpenAppStatusKey(p,a) (p)->lpVtbl->OpenAppStatusKey(p,a) +#else +#define IDirectInputJoyConfig8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputJoyConfig8_AddRef(p) (p)->AddRef() +#define IDirectInputJoyConfig8_Release(p) (p)->Release() +#define IDirectInputJoyConfig8_Acquire(p) (p)->Acquire() +#define IDirectInputJoyConfig8_Unacquire(p) (p)->Unacquire() +#define IDirectInputJoyConfig8_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputJoyConfig8_SendNotify(p) (p)->SendNotify() +#define IDirectInputJoyConfig8_EnumTypes(p,a,b) (p)->EnumTypes(a,b) +#define IDirectInputJoyConfig8_GetTypeInfo(p,a,b,c) (p)->GetTypeInfo(a,b,c) +#define IDirectInputJoyConfig8_SetTypeInfo(p,a,b,c,d) (p)->SetTypeInfo(a,b,c,d) +#define IDirectInputJoyConfig8_DeleteType(p,a) (p)->DeleteType(a) +#define IDirectInputJoyConfig8_GetConfig(p,a,b,c) (p)->GetConfig(a,b,c) +#define IDirectInputJoyConfig8_SetConfig(p,a,b,c) (p)->SetConfig(a,b,c) +#define IDirectInputJoyConfig8_DeleteConfig(p,a) (p)->DeleteConfig(a) +#define IDirectInputJoyConfig8_GetUserValues(p,a,b) (p)->GetUserValues(a,b) +#define IDirectInputJoyConfig8_SetUserValues(p,a,b) (p)->SetUserValues(a,b) +#define IDirectInputJoyConfig8_AddNewHardware(p,a,b) (p)->AddNewHardware(a,b) +#define IDirectInputJoyConfig8_OpenTypeKey(p,a,b,c) (p)->OpenTypeKey(a,b,c) +#define IDirectInputJoyConfig8_OpenAppStatusKey(p,a) (p)->OpenAppStatusKey(a) +#endif + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Notification Messages + * + ****************************************************************************/ + +/* RegisterWindowMessage with this to get DirectInput notification messages */ +#define DIRECTINPUT_NOTIFICATION_MSGSTRINGA "DIRECTINPUT_NOTIFICATION_MSGSTRING" +#define DIRECTINPUT_NOTIFICATION_MSGSTRINGW L"DIRECTINPUT_NOTIFICATION_MSGSTRING" + +#ifdef UNICODE +#define DIRECTINPUT_NOTIFICATION_MSGSTRING DIRECTINPUT_NOTIFICATION_MSGSTRINGW +#else +#define DIRECTINPUT_NOTIFICATION_MSGSTRING DIRECTINPUT_NOTIFICATION_MSGSTRINGA +#endif + +#define DIMSGWP_NEWAPPSTART 0x00000001 +#define DIMSGWP_DX8APPSTART 0x00000002 +#define DIMSGWP_DX8MAPPERAPPSTART 0x00000003 + +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#define DIAPPIDFLAG_NOTIME 0x00000001 +#define DIAPPIDFLAG_NOSIZE 0x00000002 + +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAGA "AppIdFlag" +#define DIRECTINPUT_REGSTR_KEY_LASTAPPA "MostRecentApplication" +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPPA "MostRecentMapperApplication" +#define DIRECTINPUT_REGSTR_VAL_VERSIONA "Version" +#define DIRECTINPUT_REGSTR_VAL_NAMEA "Name" +#define DIRECTINPUT_REGSTR_VAL_IDA "Id" +#define DIRECTINPUT_REGSTR_VAL_MAPPERA "UsesMapper" +#define DIRECTINPUT_REGSTR_VAL_LASTSTARTA "MostRecentStart" + +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAGW L"AppIdFlag" +#define DIRECTINPUT_REGSTR_KEY_LASTAPPW L"MostRecentApplication" +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPPW L"MostRecentMapperApplication" +#define DIRECTINPUT_REGSTR_VAL_VERSIONW L"Version" +#define DIRECTINPUT_REGSTR_VAL_NAMEW L"Name" +#define DIRECTINPUT_REGSTR_VAL_IDW L"Id" +#define DIRECTINPUT_REGSTR_VAL_MAPPERW L"UsesMapper" +#define DIRECTINPUT_REGSTR_VAL_LASTSTARTW L"MostRecentStart" + +#ifdef UNICODE +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAG DIRECTINPUT_REGSTR_VAL_APPIDFLAGW +#define DIRECTINPUT_REGSTR_KEY_LASTAPP DIRECTINPUT_REGSTR_KEY_LASTAPPW +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPP DIRECTINPUT_REGSTR_KEY_LASTMAPAPPW +#define DIRECTINPUT_REGSTR_VAL_VERSION DIRECTINPUT_REGSTR_VAL_VERSIONW +#define DIRECTINPUT_REGSTR_VAL_NAME DIRECTINPUT_REGSTR_VAL_NAMEW +#define DIRECTINPUT_REGSTR_VAL_ID DIRECTINPUT_REGSTR_VAL_IDW +#define DIRECTINPUT_REGSTR_VAL_MAPPER DIRECTINPUT_REGSTR_VAL_MAPPERW +#define DIRECTINPUT_REGSTR_VAL_LASTSTART DIRECTINPUT_REGSTR_VAL_LASTSTARTW +#else +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAG DIRECTINPUT_REGSTR_VAL_APPIDFLAGA +#define DIRECTINPUT_REGSTR_KEY_LASTAPP DIRECTINPUT_REGSTR_KEY_LASTAPPA +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPP DIRECTINPUT_REGSTR_KEY_LASTMAPAPPA +#define DIRECTINPUT_REGSTR_VAL_VERSION DIRECTINPUT_REGSTR_VAL_VERSIONA +#define DIRECTINPUT_REGSTR_VAL_NAME DIRECTINPUT_REGSTR_VAL_NAMEA +#define DIRECTINPUT_REGSTR_VAL_ID DIRECTINPUT_REGSTR_VAL_IDA +#define DIRECTINPUT_REGSTR_VAL_MAPPER DIRECTINPUT_REGSTR_VAL_MAPPERA +#define DIRECTINPUT_REGSTR_VAL_LASTSTART DIRECTINPUT_REGSTR_VAL_LASTSTARTA +#endif + + +/**************************************************************************** + * + * Return Codes + * + ****************************************************************************/ + +#define DIERR_NOMOREITEMS \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NO_MORE_ITEMS) + +/* + * Device driver-specific codes. + */ + +#define DIERR_DRIVERFIRST 0x80040300L +#define DIERR_DRIVERLAST 0x800403FFL + +/* + * Unless the specific driver has been precisely identified, no meaning + * should be attributed to these values other than that the driver + * originated the error. However, to illustrate the types of error that + * may be causing the failure, the PID force feedback driver distributed + * with DirectX 7 could return the following errors: + * + * DIERR_DRIVERFIRST + 1 + * The requested usage was not found. + * DIERR_DRIVERFIRST + 2 + * The parameter block couldn't be downloaded to the device. + * DIERR_DRIVERFIRST + 3 + * PID initialization failed. + * DIERR_DRIVERFIRST + 4 + * The provided values couldn't be scaled. + */ + + +/* + * Device installer errors. + */ + +/* + * Registry entry or DLL for class installer invalid + * or class installer not found. + */ +#define DIERR_INVALIDCLASSINSTALLER 0x80040400L + +/* + * The user cancelled the install operation. + */ +#define DIERR_CANCELLED 0x80040401L + +/* + * The INF file for the selected device could not be + * found or is invalid or is damaged. + */ +#define DIERR_BADINF 0x80040402L + +/**************************************************************************** + * + * Map files + * + ****************************************************************************/ + +/* + * Delete particular data from default map file. + */ +#define DIDIFT_DELETE 0x01000000 + +#ifdef __cplusplus +}; +#endif + +#endif /* __DINPUTD_INCLUDED__ */ diff --git a/saco/d3d9/include/dls1.h b/saco/d3d9/include/dls1.h new file mode 100644 index 0000000..fc88a31 --- /dev/null +++ b/saco/d3d9/include/dls1.h @@ -0,0 +1,267 @@ +/*==========================================================================; +// +// dls1.h +// +// +// Description: +// +// Interface defines and structures for the Instrument Collection Form +// RIFF DLS. +// +// +// Written by Sonic Foundry 1996. Released for public use. +// +//=========================================================================*/ + +#ifndef _INC_DLS1 +#define _INC_DLS1 + +/*////////////////////////////////////////////////////////////////////////// +// +// +// Layout of an instrument collection: +// +// +// RIFF [] 'DLS ' [dlid,colh,INSTLIST,WAVEPOOL,INFOLIST] +// +// INSTLIST +// LIST [] 'lins' +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// +// RGNLIST +// LIST [] 'lrgn' +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// +// ARTLIST +// LIST [] 'lart' +// 'art1' level 1 Articulation connection graph +// 'art2' level 2 Articulation connection graph +// '3rd1' Possible 3rd party articulation structure 1 +// '3rd2' Possible 3rd party articulation structure 2 .... and so on +// +// WAVEPOOL +// ptbl [] [pool table] +// LIST [] 'wvpl' +// [path], +// [path], +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// +// INFOLIST +// LIST [] 'INFO' +// 'icmt' 'One of those crazy comments.' +// 'icop' 'Copyright (C) 1996 Sonic Foundry' +// +/////////////////////////////////////////////////////////////////////////*/ + + +/*///////////////////////////////////////////////////////////////////////// +// FOURCC's used in the DLS file +/////////////////////////////////////////////////////////////////////////*/ + +#define FOURCC_DLS mmioFOURCC('D','L','S',' ') +#define FOURCC_DLID mmioFOURCC('d','l','i','d') +#define FOURCC_COLH mmioFOURCC('c','o','l','h') +#define FOURCC_WVPL mmioFOURCC('w','v','p','l') +#define FOURCC_PTBL mmioFOURCC('p','t','b','l') +#define FOURCC_PATH mmioFOURCC('p','a','t','h') +#define FOURCC_wave mmioFOURCC('w','a','v','e') +#define FOURCC_LINS mmioFOURCC('l','i','n','s') +#define FOURCC_INS mmioFOURCC('i','n','s',' ') +#define FOURCC_INSH mmioFOURCC('i','n','s','h') +#define FOURCC_LRGN mmioFOURCC('l','r','g','n') +#define FOURCC_RGN mmioFOURCC('r','g','n',' ') +#define FOURCC_RGNH mmioFOURCC('r','g','n','h') +#define FOURCC_LART mmioFOURCC('l','a','r','t') +#define FOURCC_ART1 mmioFOURCC('a','r','t','1') +#define FOURCC_WLNK mmioFOURCC('w','l','n','k') +#define FOURCC_WSMP mmioFOURCC('w','s','m','p') +#define FOURCC_VERS mmioFOURCC('v','e','r','s') + +/*///////////////////////////////////////////////////////////////////////// +// Articulation connection graph definitions +/////////////////////////////////////////////////////////////////////////*/ + +/* Generic Sources */ +#define CONN_SRC_NONE 0x0000 +#define CONN_SRC_LFO 0x0001 +#define CONN_SRC_KEYONVELOCITY 0x0002 +#define CONN_SRC_KEYNUMBER 0x0003 +#define CONN_SRC_EG1 0x0004 +#define CONN_SRC_EG2 0x0005 +#define CONN_SRC_PITCHWHEEL 0x0006 + +/* Midi Controllers 0-127 */ +#define CONN_SRC_CC1 0x0081 +#define CONN_SRC_CC7 0x0087 +#define CONN_SRC_CC10 0x008a +#define CONN_SRC_CC11 0x008b + +/* Generic Destinations */ +#define CONN_DST_NONE 0x0000 +#define CONN_DST_ATTENUATION 0x0001 +#define CONN_DST_PITCH 0x0003 +#define CONN_DST_PAN 0x0004 + +/* LFO Destinations */ +#define CONN_DST_LFO_FREQUENCY 0x0104 +#define CONN_DST_LFO_STARTDELAY 0x0105 + +/* EG1 Destinations */ +#define CONN_DST_EG1_ATTACKTIME 0x0206 +#define CONN_DST_EG1_DECAYTIME 0x0207 +#define CONN_DST_EG1_RELEASETIME 0x0209 +#define CONN_DST_EG1_SUSTAINLEVEL 0x020a + +/* EG2 Destinations */ +#define CONN_DST_EG2_ATTACKTIME 0x030a +#define CONN_DST_EG2_DECAYTIME 0x030b +#define CONN_DST_EG2_RELEASETIME 0x030d +#define CONN_DST_EG2_SUSTAINLEVEL 0x030e + +#define CONN_TRN_NONE 0x0000 +#define CONN_TRN_CONCAVE 0x0001 + +typedef struct _DLSID { + ULONG ulData1; + USHORT usData2; + USHORT usData3; + BYTE abData4[8]; +} DLSID, FAR *LPDLSID; + +typedef struct _DLSVERSION { + DWORD dwVersionMS; + DWORD dwVersionLS; +}DLSVERSION, FAR *LPDLSVERSION; + + +typedef struct _CONNECTION { + USHORT usSource; + USHORT usControl; + USHORT usDestination; + USHORT usTransform; + LONG lScale; + }CONNECTION, FAR *LPCONNECTION; + + +/* Level 1 Articulation Data */ + +typedef struct _CONNECTIONLIST { + ULONG cbSize; /* size of the connection list structure */ + ULONG cConnections; /* count of connections in the list */ + } CONNECTIONLIST, FAR *LPCONNECTIONLIST; + + + +/*///////////////////////////////////////////////////////////////////////// +// Generic type defines for regions and instruments +/////////////////////////////////////////////////////////////////////////*/ + +typedef struct _RGNRANGE { + USHORT usLow; + USHORT usHigh; +}RGNRANGE, FAR * LPRGNRANGE; + +#define F_INSTRUMENT_DRUMS 0x80000000 + +typedef struct _MIDILOCALE { + ULONG ulBank; + ULONG ulInstrument; +}MIDILOCALE, FAR *LPMIDILOCALE; + +/*///////////////////////////////////////////////////////////////////////// +// Header structures found in an DLS file for collection, instruments, and +// regions. +/////////////////////////////////////////////////////////////////////////*/ + +#define F_RGN_OPTION_SELFNONEXCLUSIVE 0x0001 + +typedef struct _RGNHEADER { + RGNRANGE RangeKey; /* Key range */ + RGNRANGE RangeVelocity; /* Velocity Range */ + USHORT fusOptions; /* Synthesis options for this range */ + USHORT usKeyGroup; /* Key grouping for non simultaneous play */ + /* 0 = no group, 1 up is group */ + /* for Level 1 only groups 1-15 are allowed */ +}RGNHEADER, FAR *LPRGNHEADER; + +typedef struct _INSTHEADER { + ULONG cRegions; /* Count of regions in this instrument */ + MIDILOCALE Locale; /* Intended MIDI locale of this instrument */ +}INSTHEADER, FAR *LPINSTHEADER; + +typedef struct _DLSHEADER { + ULONG cInstruments; /* Count of instruments in the collection */ +}DLSHEADER, FAR *LPDLSHEADER; + +/*//////////////////////////////////////////////////////////////////////////// +// definitions for the Wave link structure +////////////////////////////////////////////////////////////////////////////*/ + +/* **** For level 1 only WAVELINK_CHANNEL_MONO is valid **** */ +/* ulChannel allows for up to 32 channels of audio with each bit position */ +/* specifiying a channel of playback */ + +#define WAVELINK_CHANNEL_LEFT 0x0001l +#define WAVELINK_CHANNEL_RIGHT 0x0002l + +#define F_WAVELINK_PHASE_MASTER 0x0001 + +typedef struct _WAVELINK { /* any paths or links are stored right after struct */ + USHORT fusOptions; /* options flags for this wave */ + USHORT usPhaseGroup; /* Phase grouping for locking channels */ + ULONG ulChannel; /* channel placement */ + ULONG ulTableIndex; /* index into the wave pool table, 0 based */ +}WAVELINK, FAR *LPWAVELINK; + +#define POOL_CUE_NULL 0xffffffffl + +typedef struct _POOLCUE { + ULONG ulOffset; /* Offset to the entry in the list */ +}POOLCUE, FAR *LPPOOLCUE; + +typedef struct _POOLTABLE { + ULONG cbSize; /* size of the pool table structure */ + ULONG cCues; /* count of cues in the list */ + } POOLTABLE, FAR *LPPOOLTABLE; + +/*//////////////////////////////////////////////////////////////////////////// +// Structures for the "wsmp" chunk +////////////////////////////////////////////////////////////////////////////*/ + +#define F_WSMP_NO_TRUNCATION 0x0001l +#define F_WSMP_NO_COMPRESSION 0x0002l + + +typedef struct _rwsmp { + ULONG cbSize; + USHORT usUnityNote; /* MIDI Unity Playback Note */ + SHORT sFineTune; /* Fine Tune in log tuning */ + LONG lAttenuation; /* Overall Attenuation to be applied to data */ + ULONG fulOptions; /* Flag options */ + ULONG cSampleLoops; /* Count of Sample loops, 0 loops is one shot */ + } WSMPL, FAR *LPWSMPL; + + +/* This loop type is a normal forward playing loop which is continually */ +/* played until the envelope reaches an off threshold in the release */ +/* portion of the volume envelope */ + +#define WLOOP_TYPE_FORWARD 0 + +typedef struct _rloop { + ULONG cbSize; + ULONG ulType; /* Loop Type */ + ULONG ulStart; /* Start of loop in samples */ + ULONG ulLength; /* Length of loop in samples */ +} WLOOP, FAR *LPWLOOP; + +#endif /*_INC_DLS1 */ + diff --git a/saco/d3d9/include/dls2.h b/saco/d3d9/include/dls2.h new file mode 100644 index 0000000..30cec23 --- /dev/null +++ b/saco/d3d9/include/dls2.h @@ -0,0 +1,130 @@ +/* + + dls2.h + + Description: + + Interface defines and structures for the DLS2 extensions of DLS. + + + Written by Microsoft 1998. Released for public use. + +*/ + +#ifndef _INC_DLS2 +#define _INC_DLS2 + +/* + FOURCC's used in the DLS2 file, in addition to DLS1 chunks +*/ + +#define FOURCC_RGN2 mmioFOURCC('r','g','n','2') +#define FOURCC_LAR2 mmioFOURCC('l','a','r','2') +#define FOURCC_ART2 mmioFOURCC('a','r','t','2') +#define FOURCC_CDL mmioFOURCC('c','d','l',' ') +#define FOURCC_DLID mmioFOURCC('d','l','i','d') + +/* + Articulation connection graph definitions. These are in addition to + the definitions in the DLS1 header. +*/ + +/* Generic Sources (in addition to DLS1 sources. */ +#define CONN_SRC_POLYPRESSURE 0x0007 /* Polyphonic Pressure */ +#define CONN_SRC_CHANNELPRESSURE 0x0008 /* Channel Pressure */ +#define CONN_SRC_VIBRATO 0x0009 /* Vibrato LFO */ +#define CONN_SRC_MONOPRESSURE 0x000a /* MIDI Mono pressure */ + + +/* Midi Controllers */ +#define CONN_SRC_CC91 0x00db /* Reverb Send */ +#define CONN_SRC_CC93 0x00dd /* Chorus Send */ + + +/* Generic Destinations */ +#define CONN_DST_GAIN 0x0001 /* Same as CONN_DST_ ATTENUATION, but more appropriate terminology. */ +#define CONN_DST_KEYNUMBER 0x0005 /* Key Number Generator */ + +/* Audio Channel Output Destinations */ +#define CONN_DST_LEFT 0x0010 /* Left Channel Send */ +#define CONN_DST_RIGHT 0x0011 /* Right Channel Send */ +#define CONN_DST_CENTER 0x0012 /* Center Channel Send */ +#define CONN_DST_LEFTREAR 0x0013 /* Left Rear Channel Send */ +#define CONN_DST_RIGHTREAR 0x0014 /* Right Rear Channel Send */ +#define CONN_DST_LFE_CHANNEL 0x0015 /* LFE Channel Send */ +#define CONN_DST_CHORUS 0x0080 /* Chorus Send */ +#define CONN_DST_REVERB 0x0081 /* Reverb Send */ + +/* Vibrato LFO Destinations */ +#define CONN_DST_VIB_FREQUENCY 0x0114 /* Vibrato Frequency */ +#define CONN_DST_VIB_STARTDELAY 0x0115 /* Vibrato Start Delay */ + +/* EG1 Destinations */ +#define CONN_DST_EG1_DELAYTIME 0x020B /* EG1 Delay Time */ +#define CONN_DST_EG1_HOLDTIME 0x020C /* EG1 Hold Time */ +#define CONN_DST_EG1_SHUTDOWNTIME 0x020D /* EG1 Shutdown Time */ + + +/* EG2 Destinations */ +#define CONN_DST_EG2_DELAYTIME 0x030F /* EG2 Delay Time */ +#define CONN_DST_EG2_HOLDTIME 0x0310 /* EG2 Hold Time */ + + +/* Filter Destinations */ +#define CONN_DST_FILTER_CUTOFF 0x0500 /* Filter Cutoff Frequency */ +#define CONN_DST_FILTER_Q 0x0501 /* Filter Resonance */ + + +/* Transforms */ +#define CONN_TRN_CONVEX 0x0002 /* Convex Transform */ +#define CONN_TRN_SWITCH 0x0003 /* Switch Transform */ + + +/* Conditional chunk operators */ + #define DLS_CDL_AND 0x0001 /* X = X & Y */ + #define DLS_CDL_OR 0x0002 /* X = X | Y */ + #define DLS_CDL_XOR 0x0003 /* X = X ^ Y */ + #define DLS_CDL_ADD 0x0004 /* X = X + Y */ + #define DLS_CDL_SUBTRACT 0x0005 /* X = X - Y */ + #define DLS_CDL_MULTIPLY 0x0006 /* X = X * Y */ + #define DLS_CDL_DIVIDE 0x0007 /* X = X / Y */ + #define DLS_CDL_LOGICAL_AND 0x0008 /* X = X && Y */ + #define DLS_CDL_LOGICAL_OR 0x0009 /* X = X || Y */ + #define DLS_CDL_LT 0x000A /* X = (X < Y) */ + #define DLS_CDL_LE 0x000B /* X = (X <= Y) */ + #define DLS_CDL_GT 0x000C /* X = (X > Y) */ + #define DLS_CDL_GE 0x000D /* X = (X >= Y) */ + #define DLS_CDL_EQ 0x000E /* X = (X == Y) */ + #define DLS_CDL_NOT 0x000F /* X = !X */ + #define DLS_CDL_CONST 0x0010 /* 32-bit constant */ + #define DLS_CDL_QUERY 0x0011 /* 32-bit value returned from query */ + #define DLS_CDL_QUERYSUPPORTED 0x0012 /* Test to see if query is supported by synth */ + +/* + Loop and release +*/ + +#define WLOOP_TYPE_RELEASE 1 + +/* + WaveLink chunk +*/ + +#define F_WAVELINK_MULTICHANNEL 0x0002 + + +/* + DLSID queries for +*/ + +DEFINE_GUID(DLSID_GMInHardware, 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_GSInHardware, 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_XGInHardware, 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_SupportsDLS1, 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_SupportsDLS2, 0xf14599e5, 0x4689, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(DLSID_SampleMemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_ManufacturersID, 0xb03e1181, 0x8095, 0x11d2, 0xa1, 0xef, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8); +DEFINE_GUID(DLSID_ProductID, 0xb03e1182, 0x8095, 0x11d2, 0xa1, 0xef, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8); +DEFINE_GUID(DLSID_SamplePlaybackRate, 0x2a91f713, 0xa4bf, 0x11d2, 0xbb, 0xdf, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8); + +#endif /* _INC_DLS2 */ diff --git a/saco/d3d9/include/dmdls.h b/saco/d3d9/include/dmdls.h new file mode 100644 index 0000000..c507268 --- /dev/null +++ b/saco/d3d9/include/dmdls.h @@ -0,0 +1,199 @@ +/************************************************************************ +* * +* dmdls.h -- DLS download definitions for DirectMusic API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMDLS_ +#define _DMDLS_ + +#include "dls1.h" + +typedef long PCENT; /* Pitch cents */ +typedef long GCENT; /* Gain cents */ +typedef long TCENT; /* Time cents */ +typedef long PERCENT; /* Per.. cent! */ + +typedef LONGLONG REFERENCE_TIME; +typedef REFERENCE_TIME *LPREFERENCE_TIME; + +#ifndef MAKE_FOURCC +#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ + ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) + + +typedef DWORD FOURCC; /* a four character code */ +#endif + +typedef struct _DMUS_DOWNLOADINFO +{ + DWORD dwDLType; /* Instrument or Wave */ + DWORD dwDLId; /* Unique identifier to tag this download. */ + DWORD dwNumOffsetTableEntries; /* Number of index in the offset address table. */ + DWORD cbSize; /* Total size of this memory chunk. */ +} DMUS_DOWNLOADINFO; + +#define DMUS_DOWNLOADINFO_INSTRUMENT 1 +#define DMUS_DOWNLOADINFO_WAVE 2 +#define DMUS_DOWNLOADINFO_INSTRUMENT2 3 /* New version for better DLS2 support. */ + +/* Support for oneshot and streaming wave data + */ +#define DMUS_DOWNLOADINFO_WAVEARTICULATION 4 /* Wave articulation data */ +#define DMUS_DOWNLOADINFO_STREAMINGWAVE 5 /* One chunk of a streaming */ +#define DMUS_DOWNLOADINFO_ONESHOTWAVE 6 + +#define DMUS_DEFAULT_SIZE_OFFSETTABLE 1 + +/* Flags for DMUS_INSTRUMENT's ulFlags member */ + +#define DMUS_INSTRUMENT_GM_INSTRUMENT (1 << 0) + +typedef struct _DMUS_OFFSETTABLE +{ + ULONG ulOffsetTable[DMUS_DEFAULT_SIZE_OFFSETTABLE]; +} DMUS_OFFSETTABLE; + +typedef struct _DMUS_INSTRUMENT +{ + ULONG ulPatch; + ULONG ulFirstRegionIdx; + ULONG ulGlobalArtIdx; /* If zero the instrument does not have an articulation */ + ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the instrument */ + ULONG ulCopyrightIdx; /* If zero no Copyright information associated with the instrument */ + ULONG ulFlags; +} DMUS_INSTRUMENT; + +typedef struct _DMUS_REGION +{ + RGNRANGE RangeKey; + RGNRANGE RangeVelocity; + USHORT fusOptions; + USHORT usKeyGroup; + ULONG ulRegionArtIdx; /* If zero the region does not have an articulation */ + ULONG ulNextRegionIdx; /* If zero no more regions */ + ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the region */ + WAVELINK WaveLink; + WSMPL WSMP; /* If WSMP.cSampleLoops > 1 then a WLOOP is included */ + WLOOP WLOOP[1]; +} DMUS_REGION; + +typedef struct _DMUS_LFOPARAMS +{ + PCENT pcFrequency; + TCENT tcDelay; + GCENT gcVolumeScale; + PCENT pcPitchScale; + GCENT gcMWToVolume; + PCENT pcMWToPitch; +} DMUS_LFOPARAMS; + +typedef struct _DMUS_VEGPARAMS +{ + TCENT tcAttack; + TCENT tcDecay; + PERCENT ptSustain; + TCENT tcRelease; + TCENT tcVel2Attack; + TCENT tcKey2Decay; +} DMUS_VEGPARAMS; + +typedef struct _DMUS_PEGPARAMS +{ + TCENT tcAttack; + TCENT tcDecay; + PERCENT ptSustain; + TCENT tcRelease; + TCENT tcVel2Attack; + TCENT tcKey2Decay; + PCENT pcRange; +} DMUS_PEGPARAMS; + +typedef struct _DMUS_MSCPARAMS +{ + PERCENT ptDefaultPan; +} DMUS_MSCPARAMS; + +typedef struct _DMUS_ARTICPARAMS +{ + DMUS_LFOPARAMS LFO; + DMUS_VEGPARAMS VolEG; + DMUS_PEGPARAMS PitchEG; + DMUS_MSCPARAMS Misc; +} DMUS_ARTICPARAMS; + +typedef struct _DMUS_ARTICULATION /* Articulation chunk for DMUS_DOWNLOADINFO_INSTRUMENT format. */ +{ + ULONG ulArt1Idx; /* DLS Level 1 articulation chunk */ + ULONG ulFirstExtCkIdx; /* 3rd party extenstion chunks associated with the articulation */ +} DMUS_ARTICULATION; + +typedef struct _DMUS_ARTICULATION2 /* Articulation chunk for DMUS_DOWNLOADINFO_INSTRUMENT2 format. */ +{ + ULONG ulArtIdx; /* DLS Level 1/2 articulation chunk */ + ULONG ulFirstExtCkIdx; /* 3rd party extenstion chunks associated with the articulation */ + ULONG ulNextArtIdx; /* Additional articulation chunks */ +} DMUS_ARTICULATION2; + +#define DMUS_MIN_DATA_SIZE 4 +/* The actual number is determined by cbSize of struct _DMUS_EXTENSIONCHUNK */ + +typedef struct _DMUS_EXTENSIONCHUNK +{ + ULONG cbSize; /* Size of extension chunk */ + ULONG ulNextExtCkIdx; /* If zero no more 3rd party entenstion chunks */ + FOURCC ExtCkID; + BYTE byExtCk[DMUS_MIN_DATA_SIZE]; /* The actual number that follows is determined by cbSize */ +} DMUS_EXTENSIONCHUNK; + +/* The actual number is determined by cbSize of struct _DMUS_COPYRIGHT */ + +typedef struct _DMUS_COPYRIGHT +{ + ULONG cbSize; /* Size of copyright information */ + BYTE byCopyright[DMUS_MIN_DATA_SIZE]; /* The actual number that follows is determined by cbSize */ +} DMUS_COPYRIGHT; + +typedef struct _DMUS_WAVEDATA +{ + ULONG cbSize; + BYTE byData[DMUS_MIN_DATA_SIZE]; +} DMUS_WAVEDATA; + +typedef struct _DMUS_WAVE +{ + ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the wave */ + ULONG ulCopyrightIdx; /* If zero no Copyright information associated with the wave */ + ULONG ulWaveDataIdx; /* Location of actual wave data. */ + WAVEFORMATEX WaveformatEx; +} DMUS_WAVE; + +typedef struct _DMUS_NOTERANGE *LPDMUS_NOTERANGE; +typedef struct _DMUS_NOTERANGE +{ + DWORD dwLowNote; /* Sets the low note for the range of MIDI note events to which the instrument responds.*/ + DWORD dwHighNote; /* Sets the high note for the range of MIDI note events to which the instrument responds.*/ +} DMUS_NOTERANGE; + +typedef struct _DMUS_WAVEARTDL +{ + ULONG ulDownloadIdIdx; /* Download ID's of each buffer */ + ULONG ulBus; /* Playback bus */ + ULONG ulBuffers; /* Buffers */ + ULONG ulMasterDLId; /* Download ID of master voice of slave group */ + USHORT usOptions; /* Same as DLS2 region options */ +} DMUS_WAVEARTDL, + *LPDMUS_WAVEARTDL; + +typedef struct _DMUS_WAVEDL +{ + ULONG cbWaveData; /* Bytes of wave data */ +} DMUS_WAVEDL, + *LPDMUS_WAVEDL; + +#endif + + diff --git a/saco/d3d9/include/dmerror.h b/saco/d3d9/include/dmerror.h new file mode 100644 index 0000000..a0a61ff --- /dev/null +++ b/saco/d3d9/include/dmerror.h @@ -0,0 +1,843 @@ +/************************************************************************ +* * +* dmerror.h -- Error codes returned by DirectMusic API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMERROR_ +#define _DMERROR_ + +#define FACILITY_DIRECTMUSIC 0x878 /* Shared with DirectSound */ +#define DMUS_ERRBASE 0x1000 /* Make error codes human readable in hex */ + +#ifndef MAKE_HRESULT +#define MAKE_HRESULT(sev,fac,code) \ + ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) +#endif + +#define MAKE_DMHRESULTSUCCESS(code) MAKE_HRESULT(0, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code))) +#define MAKE_DMHRESULTERROR(code) MAKE_HRESULT(1, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code))) + +/* DMUS_S_PARTIALLOAD + * + * The object could only load partially. This can happen if some components are + * not registered properly, such as embedded tracks and tools. This can also happen + * if some content is missing. For example, if a segment uses a DLS collection that + * is not in the loader's current search directory. + */ +#define DMUS_S_PARTIALLOAD MAKE_DMHRESULTSUCCESS(0x091) + +/* DMUS_S_PARTIALDOWNLOAD + * + * Return value from IDirectMusicBand::Download() which indicates that + * some of the instruments safely downloaded, but others failed. This usually + * occurs when some instruments are on PChannels not supported by the performance + * or port. + */ +#define DMUS_S_PARTIALDOWNLOAD MAKE_DMHRESULTSUCCESS(0x092) + +/* DMUS_S_REQUEUE + * + * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the + * performance that it should cue the PMsg again automatically. + */ +#define DMUS_S_REQUEUE MAKE_DMHRESULTSUCCESS(0x200) + +/* DMUS_S_FREE + * + * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the + * performance that it should free the PMsg automatically. + */ +#define DMUS_S_FREE MAKE_DMHRESULTSUCCESS(0x201) + +/* DMUS_S_END + * + * Return value from IDirectMusicTrack::Play() which indicates to the + * segment that the track has no more data after mtEnd. + */ +#define DMUS_S_END MAKE_DMHRESULTSUCCESS(0x202) + +/* DMUS_S_STRING_TRUNCATED + * + * Returned string has been truncated to fit the buffer size. + */ +#define DMUS_S_STRING_TRUNCATED MAKE_DMHRESULTSUCCESS(0x210) + +/* DMUS_S_LAST_TOOL + * + * Returned from IDirectMusicGraph::StampPMsg(), this indicates that the PMsg + * is already stamped with the last tool in the graph. The returned PMsg's + * tool pointer is now NULL. + */ +#define DMUS_S_LAST_TOOL MAKE_DMHRESULTSUCCESS(0x211) + +/* DMUS_S_OVER_CHORD + * + * Returned from IDirectMusicPerformance::MusicToMIDI(), this indicates + * that no note has been calculated because the music value has the note + * at a position higher than the top note of the chord. This applies only + * to DMUS_PLAYMODE_NORMALCHORD play mode. This success code indicates + * that the caller should not do anything with the note. It is not meant + * to be played against this chord. + */ +#define DMUS_S_OVER_CHORD MAKE_DMHRESULTSUCCESS(0x212) + +/* DMUS_S_UP_OCTAVE + * + * Returned from IDirectMusicPerformance::MIDIToMusic(), and + * IDirectMusicPerformance::MusicToMIDI(), this indicates + * that the note conversion generated a note value that is below 0, + * so it has been bumped up one or more octaves to be in the proper + * MIDI range of 0 through 127. + * Note that this is valid for MIDIToMusic() when using play modes + * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of + * which store MIDI values in wMusicValue. With MusicToMIDI(), it is + * valid for all play modes. + * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code. + */ +#define DMUS_S_UP_OCTAVE MAKE_DMHRESULTSUCCESS(0x213) + +/* DMUS_S_DOWN_OCTAVE + * + * Returned from IDirectMusicPerformance::MIDIToMusic(), and + * IDirectMusicPerformance::MusicToMIDI(), this indicates + * that the note conversion generated a note value that is above 127, + * so it has been bumped down one or more octaves to be in the proper + * MIDI range of 0 through 127. + * Note that this is valid for MIDIToMusic() when using play modes + * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of + * which store MIDI values in wMusicValue. With MusicToMIDI(), it is + * valid for all play modes. + * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code. + */ +#define DMUS_S_DOWN_OCTAVE MAKE_DMHRESULTSUCCESS(0x214) + +/* DMUS_S_NOBUFFERCONTROL + * + * Although the audio output from the port will be routed to the + * same device as the given DirectSound buffer, buffer controls + * such as pan and volume will not affect the output. + * + */ +#define DMUS_S_NOBUFFERCONTROL MAKE_DMHRESULTSUCCESS(0x215) + +/* DMUS_S_GARBAGE_COLLECTED + * + * The requested operation was not performed because during CollectGarbage + * the loader determined that the object had been released. + */ +#define DMUS_S_GARBAGE_COLLECTED MAKE_DMHRESULTSUCCESS(0x216) + +/* DMUS_E_DRIVER_FAILED + * + * An unexpected error was returned from a device driver, indicating + * possible failure of the driver or hardware. + */ +#define DMUS_E_DRIVER_FAILED MAKE_DMHRESULTERROR(0x0101) + +/* DMUS_E_PORTS_OPEN + * + * The requested operation cannot be performed while there are + * instantiated ports in any process in the system. + */ +#define DMUS_E_PORTS_OPEN MAKE_DMHRESULTERROR(0x0102) + +/* DMUS_E_DEVICE_IN_USE + * + * The requested device is already in use (possibly by a non-DirectMusic + * client) and cannot be opened again. + */ +#define DMUS_E_DEVICE_IN_USE MAKE_DMHRESULTERROR(0x0103) + +/* DMUS_E_INSUFFICIENTBUFFER + * + * Buffer is not large enough for requested operation. + */ +#define DMUS_E_INSUFFICIENTBUFFER MAKE_DMHRESULTERROR(0x0104) + +/* DMUS_E_BUFFERNOTSET + * + * No buffer was prepared for the download data. + */ +#define DMUS_E_BUFFERNOTSET MAKE_DMHRESULTERROR(0x0105) + +/* DMUS_E_BUFFERNOTAVAILABLE + * + * Download failed due to inability to access or create download buffer. + */ +#define DMUS_E_BUFFERNOTAVAILABLE MAKE_DMHRESULTERROR(0x0106) + +/* DMUS_E_NOTADLSCOL + * + * Error parsing DLS collection. File is corrupt. + */ +#define DMUS_E_NOTADLSCOL MAKE_DMHRESULTERROR(0x0108) + +/* DMUS_E_INVALIDOFFSET + * + * Wave chunks in DLS collection file are at incorrect offsets. + */ +#define DMUS_E_INVALIDOFFSET MAKE_DMHRESULTERROR(0x0109) + +/* DMUS_E_ALREADY_LOADED + * + * Second attempt to load a DLS collection that is currently open. + */ +#define DMUS_E_ALREADY_LOADED MAKE_DMHRESULTERROR(0x0111) + +/* DMUS_E_INVALIDPOS + * + * Error reading wave data from DLS collection. Indicates bad file. + */ +#define DMUS_E_INVALIDPOS MAKE_DMHRESULTERROR(0x0113) + +/* DMUS_E_INVALIDPATCH + * + * There is no instrument in the collection that matches patch number. + */ +#define DMUS_E_INVALIDPATCH MAKE_DMHRESULTERROR(0x0114) + +/* DMUS_E_CANNOTSEEK + * + * The IStream* doesn't support Seek(). + */ +#define DMUS_E_CANNOTSEEK MAKE_DMHRESULTERROR(0x0115) + +/* DMUS_E_CANNOTWRITE + * + * The IStream* doesn't support Write(). + */ +#define DMUS_E_CANNOTWRITE MAKE_DMHRESULTERROR(0x0116) + +/* DMUS_E_CHUNKNOTFOUND + * + * The RIFF parser doesn't contain a required chunk while parsing file. + */ +#define DMUS_E_CHUNKNOTFOUND MAKE_DMHRESULTERROR(0x0117) + +/* DMUS_E_INVALID_DOWNLOADID + * + * Invalid download id was used in the process of creating a download buffer. + */ +#define DMUS_E_INVALID_DOWNLOADID MAKE_DMHRESULTERROR(0x0119) + +/* DMUS_E_NOT_DOWNLOADED_TO_PORT + * + * Tried to unload an object that was not downloaded or previously unloaded. + */ +#define DMUS_E_NOT_DOWNLOADED_TO_PORT MAKE_DMHRESULTERROR(0x0120) + +/* DMUS_E_ALREADY_DOWNLOADED + * + * Buffer was already downloaded to synth. + */ +#define DMUS_E_ALREADY_DOWNLOADED MAKE_DMHRESULTERROR(0x0121) + +/* DMUS_E_UNKNOWN_PROPERTY + * + * The specified property item was not recognized by the target object. + */ +#define DMUS_E_UNKNOWN_PROPERTY MAKE_DMHRESULTERROR(0x0122) + +/* DMUS_E_SET_UNSUPPORTED + * + * The specified property item may not be set on the target object. + */ +#define DMUS_E_SET_UNSUPPORTED MAKE_DMHRESULTERROR(0x0123) + +/* DMUS_E_GET_UNSUPPORTED + * + * The specified property item may not be retrieved from the target object. + */ +#define DMUS_E_GET_UNSUPPORTED MAKE_DMHRESULTERROR(0x0124) + +/* DMUS_E_NOTMONO + * + * Wave chunk has more than one interleaved channel. DLS format requires MONO. + */ +#define DMUS_E_NOTMONO MAKE_DMHRESULTERROR(0x0125) + +/* DMUS_E_BADARTICULATION + * + * Invalid articulation chunk in DLS collection. + */ +#define DMUS_E_BADARTICULATION MAKE_DMHRESULTERROR(0x0126) + +/* DMUS_E_BADINSTRUMENT + * + * Invalid instrument chunk in DLS collection. + */ +#define DMUS_E_BADINSTRUMENT MAKE_DMHRESULTERROR(0x0127) + +/* DMUS_E_BADWAVELINK + * + * Wavelink chunk in DLS collection points to invalid wave. + */ +#define DMUS_E_BADWAVELINK MAKE_DMHRESULTERROR(0x0128) + +/* DMUS_E_NOARTICULATION + * + * Articulation missing from instrument in DLS collection. + */ +#define DMUS_E_NOARTICULATION MAKE_DMHRESULTERROR(0x0129) + +/* DMUS_E_NOTPCM + * + * Downoaded DLS wave is not in PCM format. +*/ +#define DMUS_E_NOTPCM MAKE_DMHRESULTERROR(0x012A) + +/* DMUS_E_BADWAVE + * + * Bad wave chunk in DLS collection + */ +#define DMUS_E_BADWAVE MAKE_DMHRESULTERROR(0x012B) + +/* DMUS_E_BADOFFSETTABLE + * + * Offset Table for download buffer has errors. + */ +#define DMUS_E_BADOFFSETTABLE MAKE_DMHRESULTERROR(0x012C) + +/* DMUS_E_UNKNOWNDOWNLOAD + * + * Attempted to download unknown data type. + */ +#define DMUS_E_UNKNOWNDOWNLOAD MAKE_DMHRESULTERROR(0x012D) + +/* DMUS_E_NOSYNTHSINK + * + * The operation could not be completed because no sink was connected to + * the synthesizer. + */ +#define DMUS_E_NOSYNTHSINK MAKE_DMHRESULTERROR(0x012E) + +/* DMUS_E_ALREADYOPEN + * + * An attempt was made to open the software synthesizer while it was already + * open. + * ASSERT? + */ +#define DMUS_E_ALREADYOPEN MAKE_DMHRESULTERROR(0x012F) + +/* DMUS_E_ALREADYCLOSE + * + * An attempt was made to close the software synthesizer while it was already + * open. + * ASSERT? + */ +#define DMUS_E_ALREADYCLOSED MAKE_DMHRESULTERROR(0x0130) + +/* DMUS_E_SYNTHNOTCONFIGURED + * + * The operation could not be completed because the software synth has not + * yet been fully configured. + * ASSERT? + */ +#define DMUS_E_SYNTHNOTCONFIGURED MAKE_DMHRESULTERROR(0x0131) + +/* DMUS_E_SYNTHACTIVE + * + * The operation cannot be carried out while the synthesizer is active. + */ +#define DMUS_E_SYNTHACTIVE MAKE_DMHRESULTERROR(0x0132) + +/* DMUS_E_CANNOTREAD + * + * An error occurred while attempting to read from the IStream* object. + */ +#define DMUS_E_CANNOTREAD MAKE_DMHRESULTERROR(0x0133) + +/* DMUS_E_DMUSIC_RELEASED + * + * The operation cannot be performed because the final instance of the + * DirectMusic object was released. Ports cannot be used after final + * release of the DirectMusic object. + */ +#define DMUS_E_DMUSIC_RELEASED MAKE_DMHRESULTERROR(0x0134) + +/* DMUS_E_BUFFER_EMPTY + * + * There was no data in the referenced buffer. + */ +#define DMUS_E_BUFFER_EMPTY MAKE_DMHRESULTERROR(0x0135) + +/* DMUS_E_BUFFER_FULL + * + * There is insufficient space to insert the given event into the buffer. + */ +#define DMUS_E_BUFFER_FULL MAKE_DMHRESULTERROR(0x0136) + +/* DMUS_E_PORT_NOT_CAPTURE + * + * The given operation could not be carried out because the port is a + * capture port. + */ +#define DMUS_E_PORT_NOT_CAPTURE MAKE_DMHRESULTERROR(0x0137) + +/* DMUS_E_PORT_NOT_RENDER + * + * The given operation could not be carried out because the port is a + * render port. + */ +#define DMUS_E_PORT_NOT_RENDER MAKE_DMHRESULTERROR(0x0138) + +/* DMUS_E_DSOUND_NOT_SET + * + * The port could not be created because no DirectSound has been specified. + * Specify a DirectSound interface via the IDirectMusic::SetDirectSound + * method; pass NULL to have DirectMusic manage usage of DirectSound. + */ +#define DMUS_E_DSOUND_NOT_SET MAKE_DMHRESULTERROR(0x0139) + +/* DMUS_E_ALREADY_ACTIVATED + * + * The operation cannot be carried out while the port is active. + */ +#define DMUS_E_ALREADY_ACTIVATED MAKE_DMHRESULTERROR(0x013A) + +/* DMUS_E_INVALIDBUFFER + * + * Invalid DirectSound buffer was handed to port. + */ +#define DMUS_E_INVALIDBUFFER MAKE_DMHRESULTERROR(0x013B) + +/* DMUS_E_WAVEFORMATNOTSUPPORTED + * + * Invalid buffer format was handed to the synth sink. + */ +#define DMUS_E_WAVEFORMATNOTSUPPORTED MAKE_DMHRESULTERROR(0x013C) + +/* DMUS_E_SYNTHINACTIVE + * + * The operation cannot be carried out while the synthesizer is inactive. + */ +#define DMUS_E_SYNTHINACTIVE MAKE_DMHRESULTERROR(0x013D) + +/* DMUS_E_DSOUND_ALREADY_SET + * + * IDirectMusic::SetDirectSound has already been called. It may not be + * changed while in use. + */ +#define DMUS_E_DSOUND_ALREADY_SET MAKE_DMHRESULTERROR(0x013E) + +/* DMUS_E_INVALID_EVENT + * + * The given event is invalid (either it is not a valid MIDI message + * or it makes use of running status). The event cannot be packed + * into the buffer. + */ +#define DMUS_E_INVALID_EVENT MAKE_DMHRESULTERROR(0x013F) + +/* DMUS_E_UNSUPPORTED_STREAM + * + * The IStream* object does not contain data supported by the loading object. + */ +#define DMUS_E_UNSUPPORTED_STREAM MAKE_DMHRESULTERROR(0x0150) + +/* DMUS_E_ALREADY_INITED + * + * The object has already been initialized. + */ +#define DMUS_E_ALREADY_INITED MAKE_DMHRESULTERROR(0x0151) + +/* DMUS_E_INVALID_BAND + * + * The file does not contain a valid band. + */ +#define DMUS_E_INVALID_BAND MAKE_DMHRESULTERROR(0x0152) + +/* DMUS_E_TRACK_HDR_NOT_FIRST_CK + * + * The IStream* object's data does not have a track header as the first chunk, + * and therefore can not be read by the segment object. + */ +#define DMUS_E_TRACK_HDR_NOT_FIRST_CK MAKE_DMHRESULTERROR(0x0155) + +/* DMUS_E_TOOL_HDR_NOT_FIRST_CK + * + * The IStream* object's data does not have a tool header as the first chunk, + * and therefore can not be read by the graph object. + */ +#define DMUS_E_TOOL_HDR_NOT_FIRST_CK MAKE_DMHRESULTERROR(0x0156) + +/* DMUS_E_INVALID_TRACK_HDR + * + * The IStream* object's data contains an invalid track header (ckid is 0 and + * fccType is NULL,) and therefore can not be read by the segment object. + */ +#define DMUS_E_INVALID_TRACK_HDR MAKE_DMHRESULTERROR(0x0157) + +/* DMUS_E_INVALID_TOOL_HDR + * + * The IStream* object's data contains an invalid tool header (ckid is 0 and + * fccType is NULL,) and therefore can not be read by the graph object. + */ +#define DMUS_E_INVALID_TOOL_HDR MAKE_DMHRESULTERROR(0x0158) + +/* DMUS_E_ALL_TOOLS_FAILED + * + * The graph object was unable to load all tools from the IStream* object data. + * This may be due to errors in the stream, or the tools being incorrectly + * registered on the client. + */ +#define DMUS_E_ALL_TOOLS_FAILED MAKE_DMHRESULTERROR(0x0159) + +/* DMUS_E_ALL_TRACKS_FAILED + * + * The segment object was unable to load all tracks from the IStream* object data. + * This may be due to errors in the stream, or the tracks being incorrectly + * registered on the client. + */ +#define DMUS_E_ALL_TRACKS_FAILED MAKE_DMHRESULTERROR(0x0160) + +/* DMUS_E_NOT_FOUND + * + * The requested item was not contained by the object. + */ +#define DMUS_E_NOT_FOUND MAKE_DMHRESULTERROR(0x0161) + +/* DMUS_E_NOT_INIT + * + * A required object is not initialized or failed to initialize. + */ +#define DMUS_E_NOT_INIT MAKE_DMHRESULTERROR(0x0162) + +/* DMUS_E_TYPE_DISABLED + * + * The requested parameter type is currently disabled. Parameter types may + * be enabled and disabled by certain calls to SetParam(). + */ +#define DMUS_E_TYPE_DISABLED MAKE_DMHRESULTERROR(0x0163) + +/* DMUS_E_TYPE_UNSUPPORTED + * + * The requested parameter type is not supported on the object. + */ +#define DMUS_E_TYPE_UNSUPPORTED MAKE_DMHRESULTERROR(0x0164) + +/* DMUS_E_TIME_PAST + * + * The time is in the past, and the operation can not succeed. + */ +#define DMUS_E_TIME_PAST MAKE_DMHRESULTERROR(0x0165) + +/* DMUS_E_TRACK_NOT_FOUND + * + * The requested track is not contained by the segment. + */ +#define DMUS_E_TRACK_NOT_FOUND MAKE_DMHRESULTERROR(0x0166) + +/* DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT + * + * The track does not support clock time playback or getparam. + */ +#define DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT MAKE_DMHRESULTERROR(0x0167) + +/* DMUS_E_NO_MASTER_CLOCK + * + * There is no master clock in the performance. Be sure to call + * IDirectMusicPerformance::Init(). + */ +#define DMUS_E_NO_MASTER_CLOCK MAKE_DMHRESULTERROR(0x0170) + +/* DMUS_E_LOADER_NOCLASSID + * + * The class id field is required and missing in the DMUS_OBJECTDESC. + */ +#define DMUS_E_LOADER_NOCLASSID MAKE_DMHRESULTERROR(0x0180) + +/* DMUS_E_LOADER_BADPATH + * + * The requested file path is invalid. + */ +#define DMUS_E_LOADER_BADPATH MAKE_DMHRESULTERROR(0x0181) + +/* DMUS_E_LOADER_FAILEDOPEN + * + * File open failed - either file doesn't exist or is locked. + */ +#define DMUS_E_LOADER_FAILEDOPEN MAKE_DMHRESULTERROR(0x0182) + +/* DMUS_E_LOADER_FORMATNOTSUPPORTED + * + * Search data type is not supported. + */ +#define DMUS_E_LOADER_FORMATNOTSUPPORTED MAKE_DMHRESULTERROR(0x0183) + +/* DMUS_E_LOADER_FAILEDCREATE + * + * Unable to find or create object. + */ +#define DMUS_E_LOADER_FAILEDCREATE MAKE_DMHRESULTERROR(0x0184) + +/* DMUS_E_LOADER_OBJECTNOTFOUND + * + * Object was not found. + */ +#define DMUS_E_LOADER_OBJECTNOTFOUND MAKE_DMHRESULTERROR(0x0185) + +/* DMUS_E_LOADER_NOFILENAME + * + * The file name is missing from the DMUS_OBJECTDESC. + */ +#define DMUS_E_LOADER_NOFILENAME MAKE_DMHRESULTERROR(0x0186) + +/* DMUS_E_INVALIDFILE + * + * The file requested is not a valid file. + */ +#define DMUS_E_INVALIDFILE MAKE_DMHRESULTERROR(0x0200) + +/* DMUS_E_ALREADY_EXISTS + * + * The tool is already contained in the graph. Create a new instance. + */ +#define DMUS_E_ALREADY_EXISTS MAKE_DMHRESULTERROR(0x0201) + +/* DMUS_E_OUT_OF_RANGE + * + * Value is out of range, for instance the requested length is longer than + * the segment. + */ +#define DMUS_E_OUT_OF_RANGE MAKE_DMHRESULTERROR(0x0202) + +/* DMUS_E_SEGMENT_INIT_FAILED + * + * Segment initialization failed, most likely due to a critical memory situation. + */ +#define DMUS_E_SEGMENT_INIT_FAILED MAKE_DMHRESULTERROR(0x0203) + +/* DMUS_E_ALREADY_SENT + * + * The DMUS_PMSG has already been sent to the performance object via + * IDirectMusicPerformance::SendPMsg(). + */ +#define DMUS_E_ALREADY_SENT MAKE_DMHRESULTERROR(0x0204) + +/* DMUS_E_CANNOT_FREE + * + * The DMUS_PMSG was either not allocated by the performance via + * IDirectMusicPerformance::AllocPMsg(), or it was already freed via + * IDirectMusicPerformance::FreePMsg(). + */ +#define DMUS_E_CANNOT_FREE MAKE_DMHRESULTERROR(0x0205) + +/* DMUS_E_CANNOT_OPEN_PORT + * + * The default system port could not be opened. + */ +#define DMUS_E_CANNOT_OPEN_PORT MAKE_DMHRESULTERROR(0x0206) + +/* DMUS_E_CANNOT_CONVERT + * + * A call to MIDIToMusic() or MusicToMIDI() resulted in an error because + * the requested conversion could not happen. This usually occurs when the + * provided DMUS_CHORD_KEY structure has an invalid chord or scale pattern. + */ +#define DMUS_E_CANNOT_CONVERT MAKE_DMHRESULTERROR(0x0207) +/* misspelling in previous versions of DirectX preserved for backward compatibility */ +#define DMUS_E_CONNOT_CONVERT DMUS_E_CANNOT_CONVERT + +/* DMUS_E_DESCEND_CHUNK_FAIL + * + * DMUS_E_DESCEND_CHUNK_FAIL is returned when the end of the file + * was reached before the desired chunk was found. + */ +#define DMUS_E_DESCEND_CHUNK_FAIL MAKE_DMHRESULTERROR(0x0210) + +/* DMUS_E_NOT_LOADED + * + * An attempt to use this object failed because it first needs to + * be loaded. + */ +#define DMUS_E_NOT_LOADED MAKE_DMHRESULTERROR(0x0211) + +/* DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE + * + * The activeX scripting engine for the script's language is not compatible with + * DirectMusic. + * + */ +#define DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE MAKE_DMHRESULTERROR(0x0213) + +/* DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE + * + * A varient was used that had a type that is not supported by DirectMusic. + * + */ +#define DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE MAKE_DMHRESULTERROR(0x0214) + +/* DMUS_E_SCRIPT_ERROR_IN_SCRIPT + * + * An error was encountered while parsing or executing the script. + * The pErrorInfo parameter (if supplied) was filled with information about the error. + */ +#define DMUS_E_SCRIPT_ERROR_IN_SCRIPT MAKE_DMHRESULTERROR(0x0215) + +/* DMUS_E_SCRIPT_CANTLOAD_OLEAUT32 + * + * Loading of oleaut32.dll failed. VBScript and other activeX scripting languages + * require use of oleaut32.dll. On platforms where oleaut32.dll is not present, only + * the DirectMusicScript language, which doesn't require oleaut32.dll can be used. + */ +#define DMUS_E_SCRIPT_CANTLOAD_OLEAUT32 MAKE_DMHRESULTERROR(0x0216) + +/* DMUS_E_SCRIPT_LOADSCRIPT_ERROR + * + * An error occured while parsing a script loaded using LoadScript. The script that + * was loaded contains an error. + */ +#define DMUS_E_SCRIPT_LOADSCRIPT_ERROR MAKE_DMHRESULTERROR(0x0217) + +/* DMUS_E_SCRIPT_INVALID_FILE + * + * The script file is invalid. + */ +#define DMUS_E_SCRIPT_INVALID_FILE MAKE_DMHRESULTERROR(0x0218) + +/* DMUS_E_INVALID_SCRIPTTRACK + * + * The file contains an invalid script track. + */ +#define DMUS_E_INVALID_SCRIPTTRACK MAKE_DMHRESULTERROR(0x0219) + +/* DMUS_E_SCRIPT_VARIABLE_NOT_FOUND + * + * The script does not contain a variable with the specified name. + */ +#define DMUS_E_SCRIPT_VARIABLE_NOT_FOUND MAKE_DMHRESULTERROR(0x021A) + +/* DMUS_E_SCRIPT_ROUTINE_NOT_FOUND + * + * The script does not contain a routine with the specified name. + */ +#define DMUS_E_SCRIPT_ROUTINE_NOT_FOUND MAKE_DMHRESULTERROR(0x021B) + +/* DMUS_E_SCRIPT_CONTENT_READONLY + * + * Scripts variables for content referenced or embedded in a script cannot be set. + */ +#define DMUS_E_SCRIPT_CONTENT_READONLY MAKE_DMHRESULTERROR(0x021C) + +/* DMUS_E_SCRIPT_NOT_A_REFERENCE + * + * Attempt was made to set a script's variable by reference to a value that was + * not an object type. + */ +#define DMUS_E_SCRIPT_NOT_A_REFERENCE MAKE_DMHRESULTERROR(0x021D) + +/* DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED + * + * Attempt was made to set a script's variable by value to an object that does + * not support a default value property. + */ +#define DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED MAKE_DMHRESULTERROR(0x021E) + +/* DMUS_E_INVALID_SEGMENTTRIGGERTRACK + * + * The file contains an invalid segment trigger track. + */ +#define DMUS_E_INVALID_SEGMENTTRIGGERTRACK MAKE_DMHRESULTERROR(0x0220) + +/* DMUS_E_INVALID_LYRICSTRACK + * + * The file contains an invalid lyrics track. + */ +#define DMUS_E_INVALID_LYRICSTRACK MAKE_DMHRESULTERROR(0x0221) + +/* DMUS_E_INVALID_PARAMCONTROLTRACK + * + * The file contains an invalid parameter control track. + */ +#define DMUS_E_INVALID_PARAMCONTROLTRACK MAKE_DMHRESULTERROR(0x0222) + +/* DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR + * + * A script written in AudioVBScript could not be read because it contained a statement that + * is not allowed by the AudioVBScript language. + */ +#define DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR MAKE_DMHRESULTERROR(0x0223) + +/* DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR + * + * A script routine written in AudioVBScript failed because an invalid operation occurred. For example, + * adding the number 3 to a segment object would produce this error. So would attempting to call a routine + * that doesn't exist. + */ +#define DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR MAKE_DMHRESULTERROR(0x0224) + +/* DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE + * + * A script routine written in AudioVBScript failed because a function outside of a script failed to complete. + * For example, a call to PlaySegment that fails to play because of low memory would return this error. + */ +#define DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE MAKE_DMHRESULTERROR(0x0225) + +/* DMUS_E_AUDIOPATHS_NOT_VALID + * + * The Performance has set up some PChannels using the AssignPChannel command, which + * makes it not capable of supporting audio paths. + */ +#define DMUS_E_AUDIOPATHS_NOT_VALID MAKE_DMHRESULTERROR(0x0226) + +/* DMUS_E_AUDIOPATHS_IN_USE + * + * This is the inverse of the previous error. + * The Performance has set up some audio paths, which makes is incompatible + * with the calls to allocate pchannels, etc. + */ +#define DMUS_E_AUDIOPATHS_IN_USE MAKE_DMHRESULTERROR(0x0227) + +/* DMUS_E_NO_AUDIOPATH_CONFIG + * + * A segment was asked for its embedded audio path configuration, + * but there isn't any. + */ +#define DMUS_E_NO_AUDIOPATH_CONFIG MAKE_DMHRESULTERROR(0x0228) + +/* DMUS_E_AUDIOPATH_INACTIVE + * + * An audiopath is inactive, perhaps because closedown was called. + */ +#define DMUS_E_AUDIOPATH_INACTIVE MAKE_DMHRESULTERROR(0x0229) + +/* DMUS_E_AUDIOPATH_NOBUFFER + * + * An audiopath failed to create because a requested buffer could not be created. + */ +#define DMUS_E_AUDIOPATH_NOBUFFER MAKE_DMHRESULTERROR(0x022A) + +/* DMUS_E_AUDIOPATH_NOPORT + * + * An audiopath could not be used for playback because it lacked port assignments. + */ +#define DMUS_E_AUDIOPATH_NOPORT MAKE_DMHRESULTERROR(0x022B) + +/* DMUS_E_NO_AUDIOPATH + * + * Attempt was made to play segment in audiopath mode and there was no audiopath. + */ +#define DMUS_E_NO_AUDIOPATH MAKE_DMHRESULTERROR(0x022C) + +/* DMUS_E_INVALIDCHUNK + * + * Invalid data was found in a RIFF file chunk. + */ +#define DMUS_E_INVALIDCHUNK MAKE_DMHRESULTERROR(0x022D) + +/* DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER + * + * Attempt was made to create an audiopath that sends to a global effects buffer which did not exist. + */ +#define DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER MAKE_DMHRESULTERROR(0x022E) + +/* DMUS_E_INVALID_CONTAINER_OBJECT + * + * The file does not contain a valid container object. + */ +#define DMUS_E_INVALID_CONTAINER_OBJECT MAKE_DMHRESULTERROR(0x022F) + +#endif diff --git a/saco/d3d9/include/dmksctrl.h b/saco/d3d9/include/dmksctrl.h new file mode 100644 index 0000000..f53e714 --- /dev/null +++ b/saco/d3d9/include/dmksctrl.h @@ -0,0 +1,166 @@ +/************************************************************************ +* * +* dmksctrl.h -- Definition of IKsControl * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +* This header file contains the definition of IKsControl, which * +* duplicates definitions from ks.h and ksproxy.h. Your code should * +* include ks.h and ksproxy.h directly if you have them (they are * +* provided in the Windows 98 DDK and will be in the Windows NT 5 * +* SDK). * +* * +************************************************************************/ + +#ifndef _DMKSCTRL_ +#define _DMKSCTRL_ + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) /* Disable warnings on anonymous unions */ + +#include + +#include + +#if !defined(_NTRTL_) + #ifndef DEFINE_GUIDEX + #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name + #endif /* !defined(DEFINE_GUIDEX) */ + + #ifndef STATICGUIDOF + #define STATICGUIDOF(guid) STATIC_##guid + #endif /* !defined(STATICGUIDOF) */ +#endif /* !defined(_NTRTL_) */ + +#ifndef STATIC_IID_IKsControl +#define STATIC_IID_IKsControl\ + 0x28F54685L, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 +#endif /* STATIC_IID_IKsControl */ + +/* + * Warning: This will prevent the rest of ks.h from being pulled in if ks.h is + * included after dmksctrl.h. Make sure you do not include both headers in + * the same source file. + */ +#ifndef _KS_ +#define _KS_ + +#if (defined(_MSC_EXTENSIONS) || defined(__cplusplus)) && !defined(CINTERFACE) +typedef struct { + union { + struct { + GUID Set; + ULONG Id; + ULONG Flags; + }; + LONGLONG Alignment; + }; +} KSIDENTIFIER, *PKSIDENTIFIER; +#else +typedef struct { + union { + struct { + GUID Set; + ULONG Id; + ULONG Flags; + } Data; + LONGLONG Alignment; + }; +} KSIDENTIFIER, *PKSIDENTIFIER; +#endif + +typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY, KSMETHOD, *PKSMETHOD, KSEVENT, *PKSEVENT; + +#define KSMETHOD_TYPE_NONE 0x00000000 +#define KSMETHOD_TYPE_READ 0x00000001 +#define KSMETHOD_TYPE_WRITE 0x00000002 +#define KSMETHOD_TYPE_MODIFY 0x00000003 +#define KSMETHOD_TYPE_SOURCE 0x00000004 + +#define KSMETHOD_TYPE_SEND 0x00000001 +#define KSMETHOD_TYPE_SETSUPPORT 0x00000100 +#define KSMETHOD_TYPE_BASICSUPPORT 0x00000200 + +#define KSPROPERTY_TYPE_GET 0x00000001 +#define KSPROPERTY_TYPE_SET 0x00000002 +#define KSPROPERTY_TYPE_SETSUPPORT 0x00000100 +#define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200 +#define KSPROPERTY_TYPE_RELATIONS 0x00000400 +#define KSPROPERTY_TYPE_SERIALIZESET 0x00000800 +#define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000 +#define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000 +#define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000 +#define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000 +#define KSPROPERTY_TYPE_DEFAULTVALUES 0x00010000 + +#define KSPROPERTY_TYPE_TOPOLOGY 0x10000000 +#endif /* _KS_ */ + +#ifndef _IKsControl_ +#define _IKsControl_ + +#ifdef DECLARE_INTERFACE_ + + +#undef INTERFACE +#define INTERFACE IKsControl +DECLARE_INTERFACE_(IKsControl, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*IKsControl*/ + STDMETHOD(KsProperty)( + THIS_ + IN PKSPROPERTY Property, + IN ULONG PropertyLength, + IN OUT LPVOID PropertyData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; + STDMETHOD(KsMethod)( + THIS_ + IN PKSMETHOD Method, + IN ULONG MethodLength, + IN OUT LPVOID MethodData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; + STDMETHOD(KsEvent)( + THIS_ + IN PKSEVENT Event OPTIONAL, + IN ULONG EventLength, + IN OUT LPVOID EventData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; +}; + +#endif /* DECLARE_INTERFACE_ */ +#endif /* _IKsControl_ */ + +#include + +DEFINE_GUID(IID_IKsControl, 0x28F54685, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96); + +/* These formats are in ksmedia.h + */ +#ifndef _KSMEDIA_ + +DEFINE_GUID(KSDATAFORMAT_SUBTYPE_MIDI, 0x1D262760L, 0xE957, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00); +DEFINE_GUID(KSDATAFORMAT_SUBTYPE_DIRECTMUSIC, 0x1a82f8bc, 0x3f8b, 0x11d2, 0xb7, 0x74, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1); + +#endif + +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + +#endif /* _DMKSCTRL */ + + + diff --git a/saco/d3d9/include/dmplugin.h b/saco/d3d9/include/dmplugin.h new file mode 100644 index 0000000..3f3e141 --- /dev/null +++ b/saco/d3d9/include/dmplugin.h @@ -0,0 +1,280 @@ +/************************************************************************ +* * +* dmplugin.h -- This module contains the API for plugins for the * +* DirectMusic performance layer * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMPLUGIN_ +#define _DMPLUGIN_ + +#include + +#define COM_NO_WINDOWS_H +#include + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +interface IDirectMusicTrack; +interface IDirectMusicTool; +interface IDirectMusicTool8; +interface IDirectMusicTrack8; +interface IDirectMusicPerformance; +interface IDirectMusicPerformance8; +interface IDirectMusicSegment; +interface IDirectMusicSegment8; +interface IDirectMusicSegmentState; +interface IDirectMusicSegmentState8; +interface IDirectMusicGraph; +#ifndef __cplusplus +typedef interface IDirectMusicTrack IDirectMusicTrack; +typedef interface IDirectMusicTool IDirectMusicTool; +typedef interface IDirectMusicTool8 IDirectMusicTool8; +typedef interface IDirectMusicTrack8 IDirectMusicTrack8; +typedef interface IDirectMusicPerformance IDirectMusicPerformance; +typedef interface IDirectMusicPerformance8 IDirectMusicPerformance8; +typedef interface IDirectMusicSegment IDirectMusicSegment; +typedef interface IDirectMusicSegment8 IDirectMusicSegment8; +typedef interface IDirectMusicSegmentState IDirectMusicSegmentState; +typedef interface IDirectMusicSegmentState8 IDirectMusicSegmentState8; +typedef interface IDirectMusicGraph IDirectMusicGraph; +#endif + +typedef struct _DMUS_PMSG DMUS_PMSG; +typedef long MUSIC_TIME; + +/* Registry location for tools */ +#define DMUS_REGSTR_PATH_TOOLS "Software\\Microsoft\\DirectMusic\\Tools" + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicTool */ +#undef INTERFACE +#define INTERFACE IDirectMusicTool +DECLARE_INTERFACE_(IDirectMusicTool, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicTool */ + STDMETHOD(Init) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(GetMsgDeliveryType) (THIS_ DWORD* pdwDeliveryType ) PURE; + STDMETHOD(GetMediaTypeArraySize)(THIS_ DWORD* pdwNumElements ) PURE; + STDMETHOD(GetMediaTypes) (THIS_ DWORD** padwMediaTypes, + DWORD dwNumElements) PURE; + STDMETHOD(ProcessPMsg) (THIS_ IDirectMusicPerformance* pPerf, + DMUS_PMSG* pPMSG) PURE; + STDMETHOD(Flush) (THIS_ IDirectMusicPerformance* pPerf, + DMUS_PMSG* pPMSG, + REFERENCE_TIME rtTime) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicTool8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicTool8 +DECLARE_INTERFACE_(IDirectMusicTool8, IDirectMusicTool) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicTool */ + STDMETHOD(Init) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(GetMsgDeliveryType) (THIS_ DWORD* pdwDeliveryType ) PURE; + STDMETHOD(GetMediaTypeArraySize)(THIS_ DWORD* pdwNumElements ) PURE; + STDMETHOD(GetMediaTypes) (THIS_ DWORD** padwMediaTypes, + DWORD dwNumElements) PURE; + STDMETHOD(ProcessPMsg) (THIS_ IDirectMusicPerformance* pPerf, + DMUS_PMSG* pPMSG) PURE; + STDMETHOD(Flush) (THIS_ IDirectMusicPerformance* pPerf, + DMUS_PMSG* pPMSG, + REFERENCE_TIME rtTime) PURE; + /* IDirectMusicTool8 */ + STDMETHOD(Clone) (THIS_ IDirectMusicTool ** ppTool) PURE; +}; + + +/* The following flags are sent in the IDirectMusicTrack::Play() method */ +/* inside the dwFlags parameter */ +typedef enum enumDMUS_TRACKF_FLAGS +{ + DMUS_TRACKF_SEEK = 1, /* set on a seek */ + DMUS_TRACKF_LOOP = 2, /* set on a loop (repeat) */ + DMUS_TRACKF_START = 4, /* set on first call to Play */ + DMUS_TRACKF_FLUSH = 8, /* set when this call is in response to a flush on the perfomance */ + DMUS_TRACKF_DIRTY = 0x10, /* set when the track should consider any cached values from a previous call to GetParam to be invalidated */ + /* The following flags are DX8 only. */ + DMUS_TRACKF_NOTIFY_OFF = 0x20, /* tells track not to send notifications. */ + DMUS_TRACKF_PLAY_OFF = 0x40, /* tells track not to play anything (but can still send notifications.) */ + DMUS_TRACKF_LOOPEND = 0x80, /* set when the end of range is also a loop end. */ + DMUS_TRACKF_STOP = 0x100, /* set when the end of range is also end of playing this segment. */ + DMUS_TRACKF_RECOMPOSE = 0x200, /* set to indicate the track should compose. */ + DMUS_TRACKF_CLOCK = 0x400, /* set when time parameters are in reference (clock) time. Only valid for PlayEx(). */ +} DMUS_TRACKF_FLAGS; + +/* The following flags are sent in the IDirectMusicTrack8::GetParamEx() and SetParamEx() methods */ +/* inside the dwFlags parameter */ +#define DMUS_TRACK_PARAMF_CLOCK 0x01 /* set when the time is measured is in reference (clock) time */ + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicTrack */ +#undef INTERFACE +#define INTERFACE IDirectMusicTrack +DECLARE_INTERFACE_(IDirectMusicTrack, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicTrack */ + STDMETHOD(Init) (THIS_ IDirectMusicSegment* pSegment) PURE; + STDMETHOD(InitPlay) (THIS_ IDirectMusicSegmentState* pSegmentState, + IDirectMusicPerformance* pPerformance, + void** ppStateData, + DWORD dwVirtualTrackID, + DWORD dwFlags) PURE; + STDMETHOD(EndPlay) (THIS_ void* pStateData) PURE; + STDMETHOD(Play) (THIS_ void* pStateData, + MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + MUSIC_TIME mtOffset, + DWORD dwFlags, + IDirectMusicPerformance* pPerf, + IDirectMusicSegmentState* pSegSt, + DWORD dwVirtualID) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(IsParamSupported) (THIS_ REFGUID rguidType) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(Clone) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + IDirectMusicTrack** ppTrack) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicTrack8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicTrack8 +DECLARE_INTERFACE_(IDirectMusicTrack8, IDirectMusicTrack) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicTrack */ + STDMETHOD(Init) (THIS_ IDirectMusicSegment* pSegment) PURE; + STDMETHOD(InitPlay) (THIS_ IDirectMusicSegmentState* pSegmentState, + IDirectMusicPerformance* pPerformance, + void** ppStateData, + DWORD dwVirtualTrackID, + DWORD dwFlags) PURE; + STDMETHOD(EndPlay) (THIS_ void* pStateData) PURE; + STDMETHOD(Play) (THIS_ void* pStateData, + MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + MUSIC_TIME mtOffset, + DWORD dwFlags, + IDirectMusicPerformance* pPerf, + IDirectMusicSegmentState* pSegSt, + DWORD dwVirtualID) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(IsParamSupported) (THIS_ REFGUID rguidType) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(Clone) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + IDirectMusicTrack** ppTrack) PURE; + /* IDirectMusicTrack8 */ + STDMETHOD(PlayEx) (THIS_ void* pStateData, + REFERENCE_TIME rtStart, + REFERENCE_TIME rtEnd, + REFERENCE_TIME rtOffset, + DWORD dwFlags, + IDirectMusicPerformance* pPerf, + IDirectMusicSegmentState* pSegSt, + DWORD dwVirtualID) PURE; + STDMETHOD(GetParamEx) (THIS_ REFGUID rguidType, /* Command type. */ + REFERENCE_TIME rtTime, /* Time, in ref time if dwFlags == DMUS_TRACK_PARAMF_CLOCK. Otherwise, music time. */ + REFERENCE_TIME* prtNext, /* Time of next parameter, relative to rtTime, in music or clock time units. */ + void* pParam, /* Pointer to the parameter data. */ + void * pStateData, /* State data for track instance. */ + DWORD dwFlags) PURE; /* Control flags. */ + STDMETHOD(SetParamEx) (THIS_ REFGUID rguidType, + REFERENCE_TIME rtTime, + void* pParam, /* Pointer to the parameter data. */ + void * pStateData, /* State data for track instance. */ + DWORD dwFlags) PURE; /* Control flags. */ + STDMETHOD(Compose) (THIS_ IUnknown* pContext, /* Context for composition */ + DWORD dwTrackGroup, + IDirectMusicTrack** ppResultTrack) PURE; + STDMETHOD(Join) (THIS_ IDirectMusicTrack* pNewTrack, + MUSIC_TIME mtJoin, + IUnknown* pContext, /* Context for joining */ + DWORD dwTrackGroup, + IDirectMusicTrack** ppResultTrack) PURE; +}; + +/* CLSID's */ +DEFINE_GUID(CLSID_DirectMusicTempoTrack,0xd2ac2885, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSeqTrack,0xd2ac2886, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSysExTrack,0xd2ac2887, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicTimeSigTrack,0xd2ac2888, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicChordTrack,0xd2ac288b, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicCommandTrack,0xd2ac288c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicStyleTrack,0xd2ac288d, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicMotifTrack,0xd2ac288e, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSignPostTrack,0xf17e8672, 0xc3b4, 0x11d1, 0x87, 0xb, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicBandTrack,0xd2ac2894, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicChordMapTrack,0xd2ac2896, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicMuteTrack,0xd2ac2898, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* New CLSID's for DX8 */ +DEFINE_GUID(CLSID_DirectMusicScriptTrack,0x4108fa85, 0x3586, 0x11d3, 0x8b, 0xd7, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {4108FA85-3586-11d3-8BD7-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicMarkerTrack,0x55a8fd00, 0x4288, 0x11d3, 0x9b, 0xd1, 0x8a, 0xd, 0x61, 0xc8, 0x88, 0x35); +DEFINE_GUID(CLSID_DirectMusicSegmentTriggerTrack, 0xbae4d665, 0x4ea1, 0x11d3, 0x8b, 0xda, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {BAE4D665-4EA1-11d3-8BDA-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicLyricsTrack, 0x995c1cf5, 0x54ff, 0x11d3, 0x8b, 0xda, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {995C1CF5-54FF-11d3-8BDA-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicParamControlTrack, 0x4be0537b, 0x5c19, 0x11d3, 0x8b, 0xdc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {4BE0537B-5C19-11d3-8BDC-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicWaveTrack,0xeed36461, 0x9ea5, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); + +/* IID's */ +DEFINE_GUID(IID_IDirectMusicTrack, 0xf96029a1, 0x4282, 0x11d2, 0x87, 0x17, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicTool,0xd2ac28ba, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Interface IDs for DX8 */ +/* changed interfaces (GUID only) */ +DEFINE_GUID(IID_IDirectMusicTool8, 0xe674303, 0x3b05, 0x11d3, 0x9b, 0xd1, 0xf9, 0xe7, 0xf0, 0xa0, 0x15, 0x36); +DEFINE_GUID(IID_IDirectMusicTrack8, 0xe674304, 0x3b05, 0x11d3, 0x9b, 0xd1, 0xf9, 0xe7, 0xf0, 0xa0, 0x15, 0x36); + +#ifdef __cplusplus +}; /* extern "C" */ +#endif + +#include + +#endif /* #ifndef _DMPLUGIN_ */ diff --git a/saco/d3d9/include/dmusbuff.h b/saco/d3d9/include/dmusbuff.h new file mode 100644 index 0000000..5488453 --- /dev/null +++ b/saco/d3d9/include/dmusbuff.h @@ -0,0 +1,41 @@ +/*************************************************************************** +* * +* DMusBuff.h -- This module defines the buffer format for DirectMusic * +* Shared file between user mode and kernel mode components * +* * +* Copyright (c) 1998, Microsoft Corp. All rights reserved. * +* * +***************************************************************************/ + +#ifndef _DMusBuff_ +#define _DMusBuff_ + +/* Format of DirectMusic events in a buffer + * + * A buffer contains 1 or more events, each with the following header. + * Immediately following the header is the event data. The header+data + * size is rounded to the nearest quadword (8 bytes). + */ + +#include /* Do not pad at end - that's where the data is */ +typedef struct _DMUS_EVENTHEADER *LPDMUS_EVENTHEADER; +typedef struct _DMUS_EVENTHEADER +{ + DWORD cbEvent; /* Unrounded bytes in event */ + DWORD dwChannelGroup; /* Channel group of event */ + REFERENCE_TIME rtDelta; /* Delta from start time of entire buffer */ + DWORD dwFlags; /* Flags DMUS_EVENT_xxx */ +} DMUS_EVENTHEADER; +#include + +#define DMUS_EVENT_STRUCTURED 0x00000001 /* Unstructured data (SysEx, etc.) */ + +/* The number of bytes to allocate for an event with 'cb' data bytes. + */ +#define QWORD_ALIGN(x) (((x) + 7) & ~7) +#define DMUS_EVENT_SIZE(cb) QWORD_ALIGN(sizeof(DMUS_EVENTHEADER) + cb) + + +#endif /* _DMusBuff_ */ + + diff --git a/saco/d3d9/include/dmusicc.h b/saco/d3d9/include/dmusicc.h new file mode 100644 index 0000000..0d0afb2 --- /dev/null +++ b/saco/d3d9/include/dmusicc.h @@ -0,0 +1,784 @@ +/************************************************************************ +* * +* dmusicc.h -- This module defines the DirectMusic core API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMUSICC_ +#define _DMUSICC_ + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#include "dls1.h" +#include "dmerror.h" +#include "dmdls.h" +#include "dsound.h" +#include "dmusbuff.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ULONGLONG SAMPLE_TIME; +typedef ULONGLONG SAMPLE_POSITION; +typedef SAMPLE_TIME *LPSAMPLE_TIME; + +#define DMUS_MAX_DESCRIPTION 128 +#define DMUS_MAX_DRIVER 128 + +typedef struct _DMUS_BUFFERDESC *LPDMUS_BUFFERDESC; +typedef struct _DMUS_BUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + GUID guidBufferFormat; + DWORD cbBuffer; +} DMUS_BUFFERDESC; + +/* DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS + * and DMUS_PORTPARAMS. + */ +#define DMUS_EFFECT_NONE 0x00000000 +#define DMUS_EFFECT_REVERB 0x00000001 +#define DMUS_EFFECT_CHORUS 0x00000002 +#define DMUS_EFFECT_DELAY 0x00000004 + +/* For DMUS_PORTCAPS dwClass + */ +#define DMUS_PC_INPUTCLASS (0) +#define DMUS_PC_OUTPUTCLASS (1) + +/* For DMUS_PORTCAPS dwFlags + */ +#define DMUS_PC_DLS (0x00000001) // Supports DLS downloading and DLS level 1. +#define DMUS_PC_EXTERNAL (0x00000002) // External MIDI module. +#define DMUS_PC_SOFTWARESYNTH (0x00000004) // Software synthesizer. +#define DMUS_PC_MEMORYSIZEFIXED (0x00000008) // Memory size is fixed. +#define DMUS_PC_GMINHARDWARE (0x00000010) // GM sound set is built in, no need to download. +#define DMUS_PC_GSINHARDWARE (0x00000020) // GS sound set is built in. +#define DMUS_PC_XGINHARDWARE (0x00000040) // XG sound set is built in. +#define DMUS_PC_DIRECTSOUND (0x00000080) // Connects to DirectSound via a DirectSound buffer. +#define DMUS_PC_SHAREABLE (0x00000100) // Synth can be actively shared by multiple apps at once. +#define DMUS_PC_DLS2 (0x00000200) // Supports DLS2 instruments. +#define DMUS_PC_AUDIOPATH (0x00000400) // Multiple outputs can be connected to DirectSound for audiopaths. +#define DMUS_PC_WAVE (0x00000800) // Supports streaming and one shot waves. + +#define DMUS_PC_SYSTEMMEMORY (0x7FFFFFFF) // Sample memory is system memory. + + +typedef struct _DMUS_PORTCAPS +{ + DWORD dwSize; + DWORD dwFlags; + GUID guidPort; + DWORD dwClass; + DWORD dwType; + DWORD dwMemorySize; + DWORD dwMaxChannelGroups; + DWORD dwMaxVoices; + DWORD dwMaxAudioChannels; + DWORD dwEffectFlags; + WCHAR wszDescription[DMUS_MAX_DESCRIPTION]; +} DMUS_PORTCAPS; + +typedef DMUS_PORTCAPS *LPDMUS_PORTCAPS; + +/* Values for DMUS_PORTCAPS dwType. This field indicates the underlying + * driver type of the port. + */ +#define DMUS_PORT_WINMM_DRIVER (0) +#define DMUS_PORT_USER_MODE_SYNTH (1) +#define DMUS_PORT_KERNEL_MODE (2) + +/* These flags (set in dwValidParams) indicate which other members of the */ +/* DMUS_PORTPARAMS are valid. */ +/* */ +#define DMUS_PORTPARAMS_VOICES 0x00000001 +#define DMUS_PORTPARAMS_CHANNELGROUPS 0x00000002 +#define DMUS_PORTPARAMS_AUDIOCHANNELS 0x00000004 +#define DMUS_PORTPARAMS_SAMPLERATE 0x00000008 +#define DMUS_PORTPARAMS_EFFECTS 0x00000020 +#define DMUS_PORTPARAMS_SHARE 0x00000040 +#define DMUS_PORTPARAMS_FEATURES 0x00000080 /* DirectX 8.0 and above */ + +typedef struct _DMUS_PORTPARAMS +{ + DWORD dwSize; + DWORD dwValidParams; + DWORD dwVoices; + DWORD dwChannelGroups; + DWORD dwAudioChannels; + DWORD dwSampleRate; + DWORD dwEffectFlags; + BOOL fShare; +} DMUS_PORTPARAMS7; + +typedef struct _DMUS_PORTPARAMS8 +{ + DWORD dwSize; + DWORD dwValidParams; + DWORD dwVoices; + DWORD dwChannelGroups; + DWORD dwAudioChannels; + DWORD dwSampleRate; + DWORD dwEffectFlags; + BOOL fShare; + DWORD dwFeatures; +} DMUS_PORTPARAMS8; + +#define DMUS_PORT_FEATURE_AUDIOPATH 0x00000001 /* Supports audiopath connection to DirectSound buffers. */ +#define DMUS_PORT_FEATURE_STREAMING 0x00000002 /* Supports streaming waves through the synth. */ + + +typedef DMUS_PORTPARAMS8 DMUS_PORTPARAMS; +typedef DMUS_PORTPARAMS *LPDMUS_PORTPARAMS; + +typedef struct _DMUS_SYNTHSTATS *LPDMUS_SYNTHSTATS; +typedef struct _DMUS_SYNTHSTATS8 *LPDMUS_SYNTHSTATS8; +typedef struct _DMUS_SYNTHSTATS +{ + DWORD dwSize; /* Size in bytes of the structure */ + DWORD dwValidStats; /* Flags indicating which fields below are valid. */ + DWORD dwVoices; /* Average number of voices playing. */ + DWORD dwTotalCPU; /* Total CPU usage as percent * 100. */ + DWORD dwCPUPerVoice; /* CPU per voice as percent * 100. */ + DWORD dwLostNotes; /* Number of notes lost in 1 second. */ + DWORD dwFreeMemory; /* Free memory in bytes */ + long lPeakVolume; /* Decibel level * 100. */ +} DMUS_SYNTHSTATS; + +typedef struct _DMUS_SYNTHSTATS8 +{ + DWORD dwSize; /* Size in bytes of the structure */ + DWORD dwValidStats; /* Flags indicating which fields below are valid. */ + DWORD dwVoices; /* Average number of voices playing. */ + DWORD dwTotalCPU; /* Total CPU usage as percent * 100. */ + DWORD dwCPUPerVoice; /* CPU per voice as percent * 100. */ + DWORD dwLostNotes; /* Number of notes lost in 1 second. */ + DWORD dwFreeMemory; /* Free memory in bytes */ + long lPeakVolume; /* Decibel level * 100. */ + DWORD dwSynthMemUse; /* Memory used by synth wave data */ +} DMUS_SYNTHSTATS8; + +#define DMUS_SYNTHSTATS_VOICES (1 << 0) +#define DMUS_SYNTHSTATS_TOTAL_CPU (1 << 1) +#define DMUS_SYNTHSTATS_CPU_PER_VOICE (1 << 2) +#define DMUS_SYNTHSTATS_LOST_NOTES (1 << 3) +#define DMUS_SYNTHSTATS_PEAK_VOLUME (1 << 4) +#define DMUS_SYNTHSTATS_FREE_MEMORY (1 << 5) + +#define DMUS_SYNTHSTATS_SYSTEMMEMORY DMUS_PC_SYSTEMMEMORY + +typedef struct _DMUS_WAVES_REVERB_PARAMS +{ + float fInGain; /* Input gain in dB (to avoid output overflows) */ + float fReverbMix; /* Reverb mix in dB. 0dB means 100% wet reverb (no direct signal) + Negative values gives less wet signal. + The coeficients are calculated so that the overall output level stays + (approximately) constant regardless of the ammount of reverb mix. */ + float fReverbTime; /* The reverb decay time, in milliseconds. */ + float fHighFreqRTRatio; /* The ratio of the high frequencies to the global reverb time. + Unless very 'splashy-bright' reverbs are wanted, this should be set to + a value < 1.0. + For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the + decay time for high frequencies will be 100ms.*/ + +} DMUS_WAVES_REVERB_PARAMS; + +/* Note: Default values for Reverb are: + fInGain = 0.0dB (no change in level) + fReverbMix = -10.0dB (a reasonable reverb mix) + fReverbTime = 1000.0ms (one second global reverb time) + fHighFreqRTRatio = 0.001 (the ratio of the high frequencies to the global reverb time) +*/ + +typedef enum +{ + DMUS_CLOCK_SYSTEM = 0, + DMUS_CLOCK_WAVE = 1 +} DMUS_CLOCKTYPE; + +#define DMUS_CLOCKF_GLOBAL 0x00000001 + +typedef struct _DMUS_CLOCKINFO7 *LPDMUS_CLOCKINFO7; +typedef struct _DMUS_CLOCKINFO7 +{ + DWORD dwSize; + DMUS_CLOCKTYPE ctType; + GUID guidClock; /* Identifies this time source */ + WCHAR wszDescription[DMUS_MAX_DESCRIPTION]; +} DMUS_CLOCKINFO7; + +typedef struct _DMUS_CLOCKINFO8 *LPDMUS_CLOCKINFO8; +typedef struct _DMUS_CLOCKINFO8 +{ + DWORD dwSize; + DMUS_CLOCKTYPE ctType; + GUID guidClock; /* Identifies this time source */ + WCHAR wszDescription[DMUS_MAX_DESCRIPTION]; + DWORD dwFlags; +} DMUS_CLOCKINFO8; + +typedef DMUS_CLOCKINFO8 DMUS_CLOCKINFO; +typedef DMUS_CLOCKINFO *LPDMUS_CLOCKINFO; + +/* Default bus identifiers + * + * The first 17 are direct mappings to the destinations defined in both + * the MMA DLS Level 2 specification and the Microsoft Multi-Channel audio + * specification. + */ +#define DSBUSID_FIRST_SPKR_LOC 0 +#define DSBUSID_FRONT_LEFT 0 +#define DSBUSID_LEFT 0 /* Front left is also just left */ +#define DSBUSID_FRONT_RIGHT 1 +#define DSBUSID_RIGHT 1 /* Ditto front right */ +#define DSBUSID_FRONT_CENTER 2 +#define DSBUSID_LOW_FREQUENCY 3 +#define DSBUSID_BACK_LEFT 4 +#define DSBUSID_BACK_RIGHT 5 +#define DSBUSID_FRONT_LEFT_OF_CENTER 6 +#define DSBUSID_FRONT_RIGHT_OF_CENTER 7 +#define DSBUSID_BACK_CENTER 8 +#define DSBUSID_SIDE_LEFT 9 +#define DSBUSID_SIDE_RIGHT 10 +#define DSBUSID_TOP_CENTER 11 +#define DSBUSID_TOP_FRONT_LEFT 12 +#define DSBUSID_TOP_FRONT_CENTER 13 +#define DSBUSID_TOP_FRONT_RIGHT 14 +#define DSBUSID_TOP_BACK_LEFT 15 +#define DSBUSID_TOP_BACK_CENTER 16 +#define DSBUSID_TOP_BACK_RIGHT 17 +#define DSBUSID_LAST_SPKR_LOC 17 + +#define DSBUSID_IS_SPKR_LOC(id) ( ((id) >= DSBUSID_FIRST_SPKR_LOC) && ((id) <= DSBUSID_LAST_SPKR_LOC) ) + +/* These bus identifiers are for the standard DLS effect sends + */ +#define DSBUSID_REVERB_SEND 64 +#define DSBUSID_CHORUS_SEND 65 + +/* Dynamic bus identifiers start here. See the documentation for how + * synthesizers map the output of voices to static and dynamic + * bus identifiers. + */ +#define DSBUSID_DYNAMIC_0 512 + +/* Null bus, used to identify busses that have no function mapping. +*/ +#define DSBUSID_NULL 0xFFFFFFFF + +interface IDirectMusic; +interface IDirectMusic8; +interface IDirectMusicBuffer; +interface IDirectMusicPort; +interface IDirectMusicThru; +interface IReferenceClock; + +#ifndef __cplusplus + +typedef interface IDirectMusic IDirectMusic; +typedef interface IDirectMusic8 IDirectMusic8; +typedef interface IDirectMusicPort IDirectMusicPort; +typedef interface IDirectMusicBuffer IDirectMusicBuffer; +typedef interface IDirectMusicThru IDirectMusicThru; +typedef interface IReferenceClock IReferenceClock; + +#endif /* C++ */ + +typedef IDirectMusic *LPDIRECTMUSIC; +typedef IDirectMusic8 *LPDIRECTMUSIC8; +typedef IDirectMusicPort *LPDIRECTMUSICPORT; +typedef IDirectMusicBuffer *LPDIRECTMUSICBUFFER; + +#undef INTERFACE +#define INTERFACE IDirectMusic +DECLARE_INTERFACE_(IDirectMusic, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusic */ + STDMETHOD(EnumPort) (THIS_ DWORD dwIndex, + LPDMUS_PORTCAPS pPortCaps) PURE; + STDMETHOD(CreateMusicBuffer) (THIS_ LPDMUS_BUFFERDESC pBufferDesc, + LPDIRECTMUSICBUFFER *ppBuffer, + LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(CreatePort) (THIS_ REFCLSID rclsidPort, + LPDMUS_PORTPARAMS pPortParams, + LPDIRECTMUSICPORT *ppPort, + LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumMasterClock) (THIS_ DWORD dwIndex, + LPDMUS_CLOCKINFO lpClockInfo) PURE; + STDMETHOD(GetMasterClock) (THIS_ LPGUID pguidClock, + IReferenceClock **ppReferenceClock) PURE; + STDMETHOD(SetMasterClock) (THIS_ REFGUID rguidClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(GetDefaultPort) (THIS_ LPGUID pguidPort) PURE; + STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, + HWND hWnd) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectMusic8 +DECLARE_INTERFACE_(IDirectMusic8, IDirectMusic) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusic */ + STDMETHOD(EnumPort) (THIS_ DWORD dwIndex, + LPDMUS_PORTCAPS pPortCaps) PURE; + STDMETHOD(CreateMusicBuffer) (THIS_ LPDMUS_BUFFERDESC pBufferDesc, + LPDIRECTMUSICBUFFER *ppBuffer, + LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(CreatePort) (THIS_ REFCLSID rclsidPort, + LPDMUS_PORTPARAMS pPortParams, + LPDIRECTMUSICPORT *ppPort, + LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumMasterClock) (THIS_ DWORD dwIndex, + LPDMUS_CLOCKINFO lpClockInfo) PURE; + STDMETHOD(GetMasterClock) (THIS_ LPGUID pguidClock, + IReferenceClock **ppReferenceClock) PURE; + STDMETHOD(SetMasterClock) (THIS_ REFGUID rguidClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(GetDefaultPort) (THIS_ LPGUID pguidPort) PURE; + STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, + HWND hWnd) PURE; + /* IDirectMusic8 */ + STDMETHOD(SetExternalMasterClock) + (THIS_ IReferenceClock *pClock) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectMusicBuffer +DECLARE_INTERFACE_(IDirectMusicBuffer, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicBuffer */ + STDMETHOD(Flush) (THIS) PURE; + STDMETHOD(TotalTime) (THIS_ LPREFERENCE_TIME prtTime) PURE; + + STDMETHOD(PackStructured) (THIS_ REFERENCE_TIME rt, + DWORD dwChannelGroup, + DWORD dwChannelMessage) PURE; + + STDMETHOD(PackUnstructured) (THIS_ REFERENCE_TIME rt, + DWORD dwChannelGroup, + DWORD cb, + LPBYTE lpb) PURE; + + STDMETHOD(ResetReadPtr) (THIS) PURE; + STDMETHOD(GetNextEvent) (THIS_ LPREFERENCE_TIME prt, + LPDWORD pdwChannelGroup, + LPDWORD pdwLength, + LPBYTE *ppData) PURE; + + STDMETHOD(GetRawBufferPtr) (THIS_ LPBYTE *ppData) PURE; + STDMETHOD(GetStartTime) (THIS_ LPREFERENCE_TIME prt) PURE; + STDMETHOD(GetUsedBytes) (THIS_ LPDWORD pcb) PURE; + STDMETHOD(GetMaxBytes) (THIS_ LPDWORD pcb) PURE; + STDMETHOD(GetBufferFormat) (THIS_ LPGUID pGuidFormat) PURE; + + STDMETHOD(SetStartTime) (THIS_ REFERENCE_TIME rt) PURE; + STDMETHOD(SetUsedBytes) (THIS_ DWORD cb) PURE; +}; + +typedef IDirectMusicBuffer IDirectMusicBuffer8; +typedef IDirectMusicBuffer8 *LPDIRECTMUSICBUFFER8; + +#undef INTERFACE +#define INTERFACE IDirectMusicInstrument +DECLARE_INTERFACE_(IDirectMusicInstrument, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicInstrument */ + STDMETHOD(GetPatch) (THIS_ DWORD* pdwPatch) PURE; + STDMETHOD(SetPatch) (THIS_ DWORD dwPatch) PURE; +}; + +typedef IDirectMusicInstrument IDirectMusicInstrument8; +typedef IDirectMusicInstrument8 *LPDIRECTMUSICINSTRUMENT8; + +#undef INTERFACE +#define INTERFACE IDirectMusicDownloadedInstrument +DECLARE_INTERFACE_(IDirectMusicDownloadedInstrument, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicDownloadedInstrument */ + /* None at this time */ +}; + +typedef IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument8; +typedef IDirectMusicDownloadedInstrument8 *LPDIRECTMUSICDOWNLOADEDINSTRUMENT8; + +#undef INTERFACE +#define INTERFACE IDirectMusicCollection +DECLARE_INTERFACE_(IDirectMusicCollection, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicCollection */ + STDMETHOD(GetInstrument) (THIS_ DWORD dwPatch, + IDirectMusicInstrument** ppInstrument) PURE; + STDMETHOD(EnumInstrument) (THIS_ DWORD dwIndex, + DWORD* pdwPatch, + LPWSTR pwszName, + DWORD dwNameLen) PURE; +}; + +typedef IDirectMusicCollection IDirectMusicCollection8; +typedef IDirectMusicCollection8 *LPDIRECTMUSICCOLLECTION8; + +#undef INTERFACE +#define INTERFACE IDirectMusicDownload +DECLARE_INTERFACE_(IDirectMusicDownload , IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicDownload */ + STDMETHOD(GetBuffer) (THIS_ void** ppvBuffer, + DWORD* pdwSize) PURE; +}; + +typedef IDirectMusicDownload IDirectMusicDownload8; +typedef IDirectMusicDownload8 *LPDIRECTMUSICDOWNLOAD8; + +#undef INTERFACE +#define INTERFACE IDirectMusicPortDownload +DECLARE_INTERFACE_(IDirectMusicPortDownload, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPortDownload */ + STDMETHOD(GetBuffer) (THIS_ DWORD dwDLId, + IDirectMusicDownload** ppIDMDownload) PURE; + STDMETHOD(AllocateBuffer) (THIS_ DWORD dwSize, + IDirectMusicDownload** ppIDMDownload) PURE; + STDMETHOD(GetDLId) (THIS_ DWORD* pdwStartDLId, + DWORD dwCount) PURE; + STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE; + STDMETHOD(Download) (THIS_ IDirectMusicDownload* pIDMDownload) PURE; + STDMETHOD(Unload) (THIS_ IDirectMusicDownload* pIDMDownload) PURE; +}; + +typedef IDirectMusicPortDownload IDirectMusicPortDownload8; +typedef IDirectMusicPortDownload8 *LPDIRECTMUSICPORTDOWNLOAD8; + +/* Standard values for voice priorities. Numerically higher priorities are higher in priority. + * These priorities are used to set the voice priority for all voices on a channel. They are + * used in the dwPriority parameter of IDirectMusicPort::GetPriority and returned in the + * lpwPriority parameter of pdwPriority. + * + * These priorities are shared with DirectSound. + */ + +#ifndef _DIRECTAUDIO_PRIORITIES_DEFINED_ +#define _DIRECTAUDIO_PRIORITIES_DEFINED_ + +#define DAUD_CRITICAL_VOICE_PRIORITY (0xF0000000) +#define DAUD_HIGH_VOICE_PRIORITY (0xC0000000) +#define DAUD_STANDARD_VOICE_PRIORITY (0x80000000) +#define DAUD_LOW_VOICE_PRIORITY (0x40000000) +#define DAUD_PERSIST_VOICE_PRIORITY (0x10000000) + +/* These are the default priorities assigned if not overridden. By default priorities are + * equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as + * channel 5 on channel group 2). + * + * In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16 + * except for 10. + */ +#define DAUD_CHAN1_VOICE_PRIORITY_OFFSET (0x0000000E) +#define DAUD_CHAN2_VOICE_PRIORITY_OFFSET (0x0000000D) +#define DAUD_CHAN3_VOICE_PRIORITY_OFFSET (0x0000000C) +#define DAUD_CHAN4_VOICE_PRIORITY_OFFSET (0x0000000B) +#define DAUD_CHAN5_VOICE_PRIORITY_OFFSET (0x0000000A) +#define DAUD_CHAN6_VOICE_PRIORITY_OFFSET (0x00000009) +#define DAUD_CHAN7_VOICE_PRIORITY_OFFSET (0x00000008) +#define DAUD_CHAN8_VOICE_PRIORITY_OFFSET (0x00000007) +#define DAUD_CHAN9_VOICE_PRIORITY_OFFSET (0x00000006) +#define DAUD_CHAN10_VOICE_PRIORITY_OFFSET (0x0000000F) +#define DAUD_CHAN11_VOICE_PRIORITY_OFFSET (0x00000005) +#define DAUD_CHAN12_VOICE_PRIORITY_OFFSET (0x00000004) +#define DAUD_CHAN13_VOICE_PRIORITY_OFFSET (0x00000003) +#define DAUD_CHAN14_VOICE_PRIORITY_OFFSET (0x00000002) +#define DAUD_CHAN15_VOICE_PRIORITY_OFFSET (0x00000001) +#define DAUD_CHAN16_VOICE_PRIORITY_OFFSET (0x00000000) + + +#define DAUD_CHAN1_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN1_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN2_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN2_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN3_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN3_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN4_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN4_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN5_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN5_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN6_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN6_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN7_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN7_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN8_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN8_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN9_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN9_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN10_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN10_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN11_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN11_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN12_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN12_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN13_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN13_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN14_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN14_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN15_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN15_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN16_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN16_VOICE_PRIORITY_OFFSET) + +#endif /* _DIRECTAUDIO_PRIORITIES_DEFINED_ */ + + +#undef INTERFACE +#define INTERFACE IDirectMusicPort +DECLARE_INTERFACE_(IDirectMusicPort, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPort */ + /* */ + STDMETHOD(PlayBuffer) (THIS_ LPDIRECTMUSICBUFFER pBuffer) PURE; + STDMETHOD(SetReadNotificationHandle) (THIS_ HANDLE hEvent) PURE; + STDMETHOD(Read) (THIS_ LPDIRECTMUSICBUFFER pBuffer) PURE; + STDMETHOD(DownloadInstrument) (THIS_ IDirectMusicInstrument *pInstrument, + IDirectMusicDownloadedInstrument **ppDownloadedInstrument, + DMUS_NOTERANGE *pNoteRanges, + DWORD dwNumNoteRanges) PURE; + STDMETHOD(UnloadInstrument) (THIS_ IDirectMusicDownloadedInstrument *pDownloadedInstrument) PURE; + STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; + STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE; + STDMETHOD(Compact) (THIS) PURE; + STDMETHOD(GetCaps) (THIS_ LPDMUS_PORTCAPS pPortCaps) PURE; + STDMETHOD(DeviceIoControl) (THIS_ DWORD dwIoControlCode, + LPVOID lpInBuffer, + DWORD nInBufferSize, + LPVOID lpOutBuffer, + DWORD nOutBufferSize, + LPDWORD lpBytesReturned, + LPOVERLAPPED lpOverlapped) PURE; + STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwChannelGroups) PURE; + STDMETHOD(GetNumChannelGroups) (THIS_ LPDWORD pdwChannelGroups) PURE; + STDMETHOD(Activate) (THIS_ BOOL fActive) PURE; + STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE; + STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE; + STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize, LPDWORD pdwBufferSize) PURE; +}; + +typedef IDirectMusicPort IDirectMusicPort8; +typedef IDirectMusicPort8 *LPDIRECTMUSICPORT8; + +#undef INTERFACE +#define INTERFACE IDirectMusicThru +DECLARE_INTERFACE_(IDirectMusicThru, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicThru + */ + STDMETHOD(ThruChannel) (THIS_ DWORD dwSourceChannelGroup, + DWORD dwSourceChannel, + DWORD dwDestinationChannelGroup, + DWORD dwDestinationChannel, + LPDIRECTMUSICPORT pDestinationPort) PURE; +}; + +typedef IDirectMusicThru IDirectMusicThru8; +typedef IDirectMusicThru8 *LPDIRECTMUSICTHRU8; + +#ifndef __IReferenceClock_INTERFACE_DEFINED__ +#define __IReferenceClock_INTERFACE_DEFINED__ + +DEFINE_GUID(IID_IReferenceClock,0x56a86897,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); + +#undef INTERFACE +#define INTERFACE IReferenceClock +DECLARE_INTERFACE_(IReferenceClock, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IReferenceClock */ + /* */ + + /* get the time now */ + STDMETHOD(GetTime) (THIS_ REFERENCE_TIME *pTime) PURE; + + /* ask for an async notification that a time has elapsed */ + STDMETHOD(AdviseTime) (THIS_ REFERENCE_TIME baseTime, /* base time */ + REFERENCE_TIME streamTime, /* stream offset time */ + HANDLE hEvent, /* advise via this event */ + DWORD * pdwAdviseCookie) PURE; /* where your cookie goes */ + + /* ask for an async periodic notification that a time has elapsed */ + STDMETHOD(AdvisePeriodic) (THIS_ REFERENCE_TIME startTime, /* starting at this time */ + REFERENCE_TIME periodTime, /* time between notifications */ + HANDLE hSemaphore, /* advise via a semaphore */ + DWORD * pdwAdviseCookie) PURE; /* where your cookie goes */ + + /* cancel a request for notification */ + STDMETHOD(Unadvise) (THIS_ DWORD dwAdviseCookie) PURE; +}; + +#endif /* __IReferenceClock_INTERFACE_DEFINED__ */ + +DEFINE_GUID(CLSID_DirectMusic,0x636b9f10,0x0c7d,0x11d1,0x95,0xb2,0x00,0x20,0xaf,0xdc,0x74,0x21); +DEFINE_GUID(CLSID_DirectMusicCollection,0x480ff4b0, 0x28b2, 0x11d1, 0xbe, 0xf7, 0x0, 0xc0, 0x4f, 0xbf, 0x8f, 0xef); +DEFINE_GUID(CLSID_DirectMusicSynth,0x58C2B4D0,0x46E7,0x11D1,0x89,0xAC,0x00,0xA0,0xC9,0x05,0x41,0x29); + +DEFINE_GUID(IID_IDirectMusic,0x6536115a,0x7b2d,0x11d2,0xba,0x18,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(IID_IDirectMusicBuffer,0xd2ac2878, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicPort, 0x08f2d8c9,0x37c2,0x11d2,0xb9,0xf9,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(IID_IDirectMusicThru, 0xced153e7, 0x3606, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(IID_IDirectMusicPortDownload,0xd2ac287a, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicDownload,0xd2ac287b, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicCollection,0xd2ac287c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicInstrument,0xd2ac287d, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicDownloadedInstrument,0xd2ac287e, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + + +/* Alternate interface ID for IID_IDirectMusic, available in DX7 release and after. */ +DEFINE_GUID(IID_IDirectMusic2,0x6fc2cae1, 0xbc78, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +DEFINE_GUID(IID_IDirectMusic8,0x2d3629f7,0x813d,0x4939,0x85,0x08,0xf0,0x5c,0x6b,0x75,0xfd,0x97); + +#define IID_IDirectMusicThru8 IID_IDirectMusicThru +#define IID_IDirectMusicPortDownload8 IID_IDirectMusicPortDownload +#define IID_IDirectMusicDownload8 IID_IDirectMusicDownload +#define IID_IDirectMusicCollection8 IID_IDirectMusicCollection +#define IID_IDirectMusicInstrument8 IID_IDirectMusicInstrument +#define IID_IDirectMusicDownloadedInstrument8 IID_IDirectMusicDownloadedInstrument +#define IID_IDirectMusicPort8 IID_IDirectMusicPort + + +/* Property Query GUID_DMUS_PROP_GM_Hardware - Local GM set, no need to download + * Property Query GUID_DMUS_PROP_GS_Hardware - Local GS set, no need to download + * Property Query GUID_DMUS_PROP_XG_Hardware - Local XG set, no need to download + * Property Query GUID_DMUS_PROP_DLS1 - Support DLS level 1 + * Property Query GUID_DMUS_PROP_INSTRUMENT2 - Support new INSTRUMENT2 download format + * Property Query GUID_DMUS_PROP_XG_Capable - Support minimum requirements of XG + * Property Query GUID_DMUS_PROP_GS_Capable - Support minimum requirements of GS + * Property Query GUID_DMUS_PROP_SynthSink_DSOUND - Synthsink talks to DirectSound + * Property Query GUID_DMUS_PROP_SynthSink_WAVE - Synthsink talks to Wave device + * + * Item 0: Supported + * Returns a DWORD which is non-zero if the feature is supported + */ +DEFINE_GUID(GUID_DMUS_PROP_GM_Hardware, 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_GS_Hardware, 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_XG_Hardware, 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_XG_Capable, 0x6496aba1, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(GUID_DMUS_PROP_GS_Capable, 0x6496aba2, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(GUID_DMUS_PROP_DLS1, 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_DLS2, 0xf14599e5, 0x4689, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(GUID_DMUS_PROP_INSTRUMENT2, 0x865fd372, 0x9f67, 0x11d2, 0x87, 0x2a, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_DMUS_PROP_SynthSink_DSOUND,0xaa97844, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_DMUS_PROP_SynthSink_WAVE,0xaa97845, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_DMUS_PROP_SampleMemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_SamplePlaybackRate, 0x2a91f713, 0xa4bf, 0x11d2, 0xbb, 0xdf, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8); + +/* Property Get/Set GUID_DMUS_PROP_WriteLatency + * + * Item 0: Synth buffer write latency, in milliseconds + * Get/Set SynthSink latency, the average time after the play head that the next buffer gets written. + */ +DEFINE_GUID(GUID_DMUS_PROP_WriteLatency,0x268a0fa0, 0x60f2, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +/* Property Get/Set GUID_DMUS_PROP_WritePeriod + * + * Item 0: Synth buffer write period, in milliseconds + * Get/Set SynthSink buffer write period, time span between successive writes. + */ +DEFINE_GUID(GUID_DMUS_PROP_WritePeriod,0x268a0fa1, 0x60f2, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +/* Property Get GUID_DMUS_PROP_MemorySize + * + * Item 0: Memory size + * Returns a DWORD containing the total number of bytes of sample RAM + */ +DEFINE_GUID(GUID_DMUS_PROP_MemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +/* Property Set GUID_DMUS_PROP_WavesReverb + * + * Item 0: DMUS_WAVES_REVERB structure + * Sets reverb parameters + */ +DEFINE_GUID(GUID_DMUS_PROP_WavesReverb,0x4cb5622, 0x32e5, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +/* Property Set GUID_DMUS_PROP_Effects + * + * Item 0: DWORD with effects flags. + * Get/Set effects bits, same as dwEffectFlags in DMUS_PORTPARAMS and DMUS_PORTCAPS: + * DMUS_EFFECT_NONE + * DMUS_EFFECT_REVERB + * DMUS_EFFECT_CHORUS + */ +DEFINE_GUID(GUID_DMUS_PROP_Effects, 0xcda8d611, 0x684a, 0x11d2, 0x87, 0x1e, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Property Set GUID_DMUS_PROP_LegacyCaps + * + * Item 0: The MIDINCAPS or MIDIOUTCAPS which describes the port's underlying WinMM device. This property is only supported + * by ports which wrap WinMM devices. + */ + +DEFINE_GUID(GUID_DMUS_PROP_LegacyCaps,0xcfa7cdc2, 0x00a1, 0x11d2, 0xaa, 0xd5, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +/* Property Set GUID_DMUS_PROP_Volume + * + * Item 0: A long which contains an offset, in 1/100 dB, to be added to the final volume + * + */ +DEFINE_GUID(GUID_DMUS_PROP_Volume, 0xfedfae25L, 0xe46e, 0x11d1, 0xaa, 0xce, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +/* Min and Max values for setting volume with GUID_DMUS_PROP_Volume */ + +#define DMUS_VOLUME_MAX 2000 /* +20 dB */ +#define DMUS_VOLUME_MIN -20000 /* -200 dB */ + +#ifdef __cplusplus +}; /* extern "C" */ +#endif + +#include + +#endif /* #ifndef _DMUSICC_ */ diff --git a/saco/d3d9/include/dmusicf.h b/saco/d3d9/include/dmusicf.h new file mode 100644 index 0000000..920b2fc --- /dev/null +++ b/saco/d3d9/include/dmusicf.h @@ -0,0 +1,2199 @@ +/************************************************************************ +* * +* dmusicf.h -- This module defines the DirectMusic file formats * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMUSICF_ +#define _DMUSICF_ + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +interface IDirectMusicCollection; +#ifndef __cplusplus +typedef interface IDirectMusicCollection IDirectMusicCollection; +#endif + +/* Common chunks */ + +#define DMUS_FOURCC_GUID_CHUNK mmioFOURCC('g','u','i','d') +#define DMUS_FOURCC_INFO_LIST mmioFOURCC('I','N','F','O') +#define DMUS_FOURCC_UNFO_LIST mmioFOURCC('U','N','F','O') +#define DMUS_FOURCC_UNAM_CHUNK mmioFOURCC('U','N','A','M') +#define DMUS_FOURCC_UART_CHUNK mmioFOURCC('U','A','R','T') +#define DMUS_FOURCC_UCOP_CHUNK mmioFOURCC('U','C','O','P') +#define DMUS_FOURCC_USBJ_CHUNK mmioFOURCC('U','S','B','J') +#define DMUS_FOURCC_UCMT_CHUNK mmioFOURCC('U','C','M','T') +#define DMUS_FOURCC_CATEGORY_CHUNK mmioFOURCC('c','a','t','g') +#define DMUS_FOURCC_VERSION_CHUNK mmioFOURCC('v','e','r','s') + +/* The following structures are used by the Tracks, and are the packed structures */ +/* that are passed to the Tracks inside the IStream. */ + + +typedef struct _DMUS_IO_SEQ_ITEM +{ + MUSIC_TIME mtTime; + MUSIC_TIME mtDuration; + DWORD dwPChannel; + short nOffset; + BYTE bStatus; + BYTE bByte1; + BYTE bByte2; +} DMUS_IO_SEQ_ITEM; + + +typedef struct _DMUS_IO_CURVE_ITEM +{ + MUSIC_TIME mtStart; + MUSIC_TIME mtDuration; + MUSIC_TIME mtResetDuration; + DWORD dwPChannel; + short nOffset; + short nStartValue; + short nEndValue; + short nResetValue; + BYTE bType; + BYTE bCurveShape; + BYTE bCCData; + BYTE bFlags; + /* Following was added for DirectX8. */ + WORD wParamType; /* RPN or NRPN parameter number. */ + WORD wMergeIndex; /* Allows multiple parameters to be merged (pitchbend, volume, and expression.) */ +} DMUS_IO_CURVE_ITEM; + + +typedef struct _DMUS_IO_TEMPO_ITEM +{ + MUSIC_TIME lTime; + double dblTempo; +} DMUS_IO_TEMPO_ITEM; + + +typedef struct _DMUS_IO_SYSEX_ITEM +{ + MUSIC_TIME mtTime; + DWORD dwPChannel; + DWORD dwSysExLength; +} DMUS_IO_SYSEX_ITEM; + +typedef DMUS_CHORD_KEY DMUS_CHORD_PARAM; /* DMUS_CHORD_KEY defined in dmusici.h */ + +typedef struct _DMUS_RHYTHM_PARAM +{ + DMUS_TIMESIGNATURE TimeSig; + DWORD dwRhythmPattern; +} DMUS_RHYTHM_PARAM; + +typedef struct _DMUS_TEMPO_PARAM +{ + MUSIC_TIME mtTime; + double dblTempo; +} DMUS_TEMPO_PARAM; + + +typedef struct _DMUS_MUTE_PARAM +{ + DWORD dwPChannel; + DWORD dwPChannelMap; + BOOL fMute; +} DMUS_MUTE_PARAM; + +/* Style chunks */ + +#define DMUS_FOURCC_STYLE_FORM mmioFOURCC('D','M','S','T') +#define DMUS_FOURCC_STYLE_CHUNK mmioFOURCC('s','t','y','h') +#define DMUS_FOURCC_PART_LIST mmioFOURCC('p','a','r','t') +#define DMUS_FOURCC_PART_CHUNK mmioFOURCC('p','r','t','h') +#define DMUS_FOURCC_NOTE_CHUNK mmioFOURCC('n','o','t','e') +#define DMUS_FOURCC_CURVE_CHUNK mmioFOURCC('c','r','v','e') +#define DMUS_FOURCC_MARKER_CHUNK mmioFOURCC('m','r','k','r') +#define DMUS_FOURCC_RESOLUTION_CHUNK mmioFOURCC('r','s','l','n') +#define DMUS_FOURCC_ANTICIPATION_CHUNK mmioFOURCC('a','n','p','n') +#define DMUS_FOURCC_PATTERN_LIST mmioFOURCC('p','t','t','n') +#define DMUS_FOURCC_PATTERN_CHUNK mmioFOURCC('p','t','n','h') +#define DMUS_FOURCC_RHYTHM_CHUNK mmioFOURCC('r','h','t','m') +#define DMUS_FOURCC_PARTREF_LIST mmioFOURCC('p','r','e','f') +#define DMUS_FOURCC_PARTREF_CHUNK mmioFOURCC('p','r','f','c') +#define DMUS_FOURCC_STYLE_PERS_REF_LIST mmioFOURCC('p','r','r','f') +#define DMUS_FOURCC_MOTIFSETTINGS_CHUNK mmioFOURCC('m','t','f','s') + +/* Flags used by variations: these make up the DWORDs in dwVariationChoices. */ + +/* These flags determine the types of chords supported by a given variation in DirectMusic */ +/* mode. The first seven flags (bits 1-7) are set if the variation supports major chords */ +/* rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation */ +/* supports major chords rooted in the tonic, second, and fourth scale positions. The */ +/* next seven flags serve the same purpose, but for minor chords, and the following seven */ +/* flags serve the same purpose for chords that are not major or minor (e.g., SUS 4 */ +/* chords). Bits 22, 23, and 24 are set if the variation supports chords rooted in the */ +/* scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones, */ +/* respectively. For example, to support a C# minor chord in the scale of C Major, */ +/* bits 8 (for tonic minor) and 24 (for sharp) need to be set. Bits 25, 26, an 27 handle */ +/* chords that are triads, 6th or 7th chords, and chords with extensions, respectively. */ +/* bits 28 and 29 handle chords that are followed by tonic and dominant chords, */ +/* respectively. */ +#define DMUS_VARIATIONF_MAJOR 0x0000007F /* Seven positions in the scale - major chords. */ +#define DMUS_VARIATIONF_MINOR 0x00003F80 /* Seven positions in the scale - minor chords. */ +#define DMUS_VARIATIONF_OTHER 0x001FC000 /* Seven positions in the scale - other chords. */ +#define DMUS_VARIATIONF_ROOT_SCALE 0x00200000 /* Handles chord roots in the scale. */ +#define DMUS_VARIATIONF_ROOT_FLAT 0x00400000 /* Handles flat chord roots (based on scale notes). */ +#define DMUS_VARIATIONF_ROOT_SHARP 0x00800000 /* Handles sharp chord roots (based on scale notes). */ +#define DMUS_VARIATIONF_TYPE_TRIAD 0x01000000 /* Handles simple chords - triads. */ +#define DMUS_VARIATIONF_TYPE_6AND7 0x02000000 /* Handles simple chords - 6 and 7. */ +#define DMUS_VARIATIONF_TYPE_COMPLEX 0x04000000 /* Handles complex chords. */ +#define DMUS_VARIATIONF_DEST_TO1 0x08000000 /* Handles transitions to 1 chord. */ +#define DMUS_VARIATIONF_DEST_TO5 0x10000000 /* Handles transitions to 5 chord. */ +#define DMUS_VARIATIONF_DEST_OTHER 0x40000000 /* Handles transitions to chords other than 1 . */ + +/* legacy mask for variation modes */ +#define DMUS_VARIATIONF_MODES 0xE0000000 +/* Bits 29 and 31 of the variation flags are the Mode bits. If both are 0, it's IMA. */ +/* If bit 29 is 1, it's Direct Music. */ +#define DMUS_VARIATIONF_MODES_EX (0x20000000 | 0x80000000) +#define DMUS_VARIATIONF_IMA25_MODE 0x00000000 +#define DMUS_VARIATIONF_DMUS_MODE 0x20000000 + +/* Set this if the part uses marker events */ +#define DMUS_PARTF_USE_MARKERS 0x1 +/* Set this if the part is allowed to switch only on chord-aligned markers */ +#define DMUS_PARTF_ALIGN_CHORDS 0x2 + +/* These specify if the marker event signals whether to stop a variation or start a +pattern/variation (or both), and whether new variations must align with a chord */ +#define DMUS_MARKERF_START 0x1 +#define DMUS_MARKERF_STOP 0x2 +#define DMUS_MARKERF_CHORD_ALIGN 0x4 + +/* if this flag is set, variation settings in a playing pattern-based track's state data will +persist in the track after it stops playing */ +#define DMUS_PATTERNF_PERSIST_CONTROL 0x1 + +/* These specify possible values for DMUS_IO_PARTREF.bRandomVariation + all but DMUS_VARIATIONT_SEQUENTIAL and DMUS_VARIATIONT_RANDOM are DirectX8. */ +typedef enum enumDMUS_VARIATIONT_TYPES +{ + DMUS_VARIATIONT_SEQUENTIAL = 0, /* Play sequential starting with variation 1. */ + DMUS_VARIATIONT_RANDOM = 1, /* Play randomly. */ + DMUS_VARIATIONT_RANDOM_START = 2, /* Play sequential starting with a random variation. */ + DMUS_VARIATIONT_NO_REPEAT = 3, /* Play randomly, but don't play the same variation twice. */ + DMUS_VARIATIONT_RANDOM_ROW = 4 /* Play randomly as a row: don't repeat any variation until all have played. */ +} DMUS_VARIATIONT_TYPES; + +/* These specify possible values for DMUS_IO_PATTERN.wEmbellishment (DirectX8) */ +typedef enum enumDMUS_EMBELLISHT_TYPES +{ + DMUS_EMBELLISHT_NORMAL = 0, + DMUS_EMBELLISHT_FILL = 1, + DMUS_EMBELLISHT_BREAK = 2, + DMUS_EMBELLISHT_INTRO = 4, + DMUS_EMBELLISHT_END = 8, + DMUS_EMBELLISHT_MOTIF = 16, + DMUS_EMBELLISHT_ALL = 0xFFFF +} DMUS_EMBELLISHT_TYPES; + +#pragma pack(2) + +typedef struct _DMUS_IO_TIMESIG +{ + /* Time signatures define how many beats per measure, which note receives */ + /* the beat, and the grid resolution. */ + BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */ + BYTE bBeat; /* what note receives the beat (bottom of time sig.) */ + /* we can assume that 0 means 256th note */ + WORD wGridsPerBeat; /* grids per beat */ +} DMUS_IO_TIMESIG; + +typedef struct _DMUS_IO_STYLE +{ + DMUS_IO_TIMESIG timeSig; /* Styles have a default Time Signature */ + double dblTempo; +} DMUS_IO_STYLE; + +typedef struct _DMUS_IO_VERSION +{ + DWORD dwVersionMS; /* Version # high-order 32 bits */ + DWORD dwVersionLS; /* Version # low-order 32 bits */ +} DMUS_IO_VERSION; + +typedef struct _DMUS_IO_PATTERN +{ + DMUS_IO_TIMESIG timeSig; /* Patterns can override the Style's Time sig. */ + BYTE bGrooveBottom; /* bottom of groove range */ + BYTE bGrooveTop; /* top of groove range */ + WORD wEmbellishment; /* Fill, Break, Intro, End, Normal, Motif */ + WORD wNbrMeasures; /* length in measures */ + BYTE bDestGrooveBottom; /* bottom of groove range for next pattern */ + BYTE bDestGrooveTop; /* top of groove range for next pattern */ + DWORD dwFlags; /* various flags */ +} DMUS_IO_PATTERN; + +typedef struct _DMUS_IO_STYLEPART +{ + DMUS_IO_TIMESIG timeSig; /* can override pattern's */ + DWORD dwVariationChoices[32]; /* MOAW choice bitfield */ + GUID guidPartID; /* identifies the part */ + WORD wNbrMeasures; /* length of the Part */ + BYTE bPlayModeFlags; /* see PLAYMODE flags */ + BYTE bInvertUpper; /* inversion upper limit */ + BYTE bInvertLower; /* inversion lower limit */ + BYTE bPad[3]; /* for DWORD alignment */ + DWORD dwFlags; /* various flags */ +} DMUS_IO_STYLEPART; + +typedef struct _DMUS_IO_PARTREF +{ + GUID guidPartID; /* unique ID for matching up with parts */ + WORD wLogicalPartID; /* corresponds to port/device/midi channel OBSOLETE */ + BYTE bVariationLockID; /* parts with the same ID lock variations. */ + /* high bit is used to identify master Part */ + BYTE bSubChordLevel; /* tells which sub chord level this part wants */ + BYTE bPriority; /* 256 priority levels. Parts with lower priority */ + /* aren't played first when a device runs out of */ + /* notes */ + BYTE bRandomVariation; /* when set, matching variations play in random order */ + /* when clear, matching variations play sequentially */ + WORD wPad; /* not used */ + DWORD dwPChannel; /* replaces wLogicalPartID */ +} DMUS_IO_PARTREF; + +typedef struct _DMUS_IO_STYLENOTE +{ + MUSIC_TIME mtGridStart; /* when this note occurs */ + DWORD dwVariation; /* variation bits */ + MUSIC_TIME mtDuration; /* how long this note lasts */ + short nTimeOffset; /* offset from mtGridStart */ + WORD wMusicValue; /* Position in scale. */ + BYTE bVelocity; /* Note velocity. */ + BYTE bTimeRange; /* Range to randomize start time. */ + BYTE bDurRange; /* Range to randomize duration. */ + BYTE bVelRange; /* Range to randomize velocity. */ + BYTE bInversionID; /* Identifies inversion group to which this note belongs */ + BYTE bPlayModeFlags; /* Can override part */ + /* Following exists only under DirectX8 and on */ + BYTE bNoteFlags; /* values from DMUS_NOTEF_FLAGS */ +} DMUS_IO_STYLENOTE; + +typedef struct _DMUS_IO_STYLECURVE +{ + MUSIC_TIME mtGridStart; /* when this curve occurs */ + DWORD dwVariation; /* variation bits */ + MUSIC_TIME mtDuration; /* how long this curve lasts */ + MUSIC_TIME mtResetDuration;/* how long after the end of the curve to reset the curve */ + short nTimeOffset; /* offset from mtGridStart */ + short nStartValue; /* curve's start value */ + short nEndValue; /* curve's end value */ + short nResetValue; /* the value to which to reset the curve */ + BYTE bEventType; /* type of curve */ + BYTE bCurveShape; /* shape of curve */ + BYTE bCCData; /* CC# */ + BYTE bFlags; /* Bit 1=TRUE means to send nResetValue. Otherwise, don't. + Other bits are reserved. */ + /* Following was added for DirectX8. */ + WORD wParamType; /* RPN or NRPN parameter number. */ + WORD wMergeIndex; /* Allows multiple parameters to be merged (pitchbend, volume, and expression.) */ +} DMUS_IO_STYLECURVE; + +typedef struct _DMUS_IO_STYLEMARKER +{ + MUSIC_TIME mtGridStart; /* when this marker occurs */ + DWORD dwVariation; /* variation bits */ + WORD wMarkerFlags; /* how the marker is used */ +} DMUS_IO_STYLEMARKER; + +typedef struct _DMUS_IO_STYLERESOLUTION +{ + DWORD dwVariation; /* variation bits */ + WORD wMusicValue; /* Position in scale. */ + BYTE bInversionID; /* Identifies inversion group to which this note belongs */ + BYTE bPlayModeFlags; /* Can override part */ +} DMUS_IO_STYLERESOLUTION; + +typedef struct _DMUS_IO_STYLE_ANTICIPATION +{ + MUSIC_TIME mtGridStart; /* when this anticipation occurs */ + DWORD dwVariation; /* variation bits */ + short nTimeOffset; /* offset from mtGridStart */ + BYTE bTimeRange; /* Range to randomize start time. */ +} DMUS_IO_STYLE_ANTICIPATION; + +typedef struct _DMUS_IO_MOTIFSETTINGS +{ + DWORD dwRepeats; /* Number of repeats. By default, 0. */ + MUSIC_TIME mtPlayStart; /* Start of playback. By default, 0. */ + MUSIC_TIME mtLoopStart; /* Start of looping portion. By default, 0. */ + MUSIC_TIME mtLoopEnd; /* End of loop. Must be greater than mtLoopStart. Or, 0, indicating loop full motif. */ + DWORD dwResolution; /* Default resolution. */ +} DMUS_IO_MOTIFSETTINGS; + +#pragma pack() + + +/* +RIFF +( + 'DMST' // Style + // Style header chunk + // Every Style has a GUID + [] // Name, author, copyright info., comments + [] // version chunk + ... // Array of parts in the Style, used by patterns + ... // Array of patterns in the Style + ... // Array of bands in the Style + []...// Optional array of chord map references in the Style +) + + // + styh + ( + + ) + + // + guid + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'part' + // Part header chunk + [] // Name, author, copyright info., comments + [] // Optional chunk containing an array of notes in Part + [] // Optional chunk containing an array of curves in Part + [] // Optional chunk containing an array of markers in Part + [] // Optional chunk containing an array of variation resolutions in Part + [] // Optional chunk containing an array of resolution anticipations in Part + ) + + // + prth + ( + + ) + + // + 'note' + ( + // sizeof DMUS_IO_STYLENOTE:DWORD + ... + ) + + // + 'crve' + ( + // sizeof DMUS_IO_STYLECURVE:DWORD + ... + ) + + // + 'mrkr' + ( + // sizeof DMUS_IO_STYLEMARKER:DWORD + ... + ) + + // + 'rsln' + ( + // sizeof DMUS_IO_STYLERESOLUTION:DWORD + ... + ) + + // + 'anpn' + ( + // sizeof DMUS_IO_STYLE_ANTICIPATION:DWORD + ... + ) + + // + LIST + ( + 'pttn' + // Pattern header chunk + // Chunk containing an array of rhythms for chord matching + [] // Name, author, copyright info., comments + [] // Motif settings chunk + [] // Optional band to be associated with the pattern (for motifs) + ... // Array of part reference id's + ) + + // + ptnh + ( + + ) + + // + 'rhtm' + ( + // DWORD's representing rhythms for chord matching based on number + // of measures in the pattern + ) + + + // pref-list + LIST + ( + 'pref' + // part ref chunk + ) + + // + prfc + ( + + ) + + // + mtfs + ( + + ) + + // + LIST + ( + 'prrf' + ... // Array of Chordmap references + ) +*/ + +/* Pattern chunk, for use in Pattern tracks */ + +#define DMUS_FOURCC_PATTERN_FORM mmioFOURCC('D','M','P','T') + +/* +RIFF +( + 'DMPT' // Pattern + // Style header chunk + // The pattern, in single pattern format (includes DMUS_FOURCC_PART_LIST chunks) +) +*/ + + +/* Chord and command file formats */ + +/* These specify possible values for DMUS_IO_COMMAND.bRepeatMode (DirectX8) */ +typedef enum enumDMUS_PATTERNT_TYPES +{ + DMUS_PATTERNT_RANDOM = 0, /* Play randomly. (DirectX7 behavior) */ + DMUS_PATTERNT_REPEAT = 1, /* Repeat last pattern. */ + DMUS_PATTERNT_SEQUENTIAL = 2, /* Play sequential starting with first matching pattern. */ + DMUS_PATTERNT_RANDOM_START = 3, /* Play sequential starting with a random pattern. */ + DMUS_PATTERNT_NO_REPEAT = 4, /* Play randomly, but don't play the same pattern twice. */ + DMUS_PATTERNT_RANDOM_ROW = 5 /* Play randomly as a row: don't repeat any pattern until all have played. */ +} DMUS_PATTERNT_TYPES; + + +#define DMUS_FOURCC_CHORDTRACK_LIST mmioFOURCC('c','o','r','d') +#define DMUS_FOURCC_CHORDTRACKHEADER_CHUNK mmioFOURCC('c','r','d','h') +#define DMUS_FOURCC_CHORDTRACKBODY_CHUNK mmioFOURCC('c','r','d','b') + +#define DMUS_FOURCC_COMMANDTRACK_CHUNK mmioFOURCC('c','m','n','d') + +typedef struct _DMUS_IO_CHORD +{ + WCHAR wszName[16]; /* Name of the chord */ + MUSIC_TIME mtTime; /* Time of this chord */ + WORD wMeasure; /* Measure this falls on */ + BYTE bBeat; /* Beat this falls on */ + BYTE bFlags; /* Various flags */ +} DMUS_IO_CHORD; + +typedef struct _DMUS_IO_SUBCHORD +{ + DWORD dwChordPattern; /* Notes in the subchord */ + DWORD dwScalePattern; /* Notes in the scale */ + DWORD dwInversionPoints; /* Where inversions can occur */ + DWORD dwLevels; /* Which levels are supported by this subchord */ + BYTE bChordRoot; /* Root of the subchord */ + BYTE bScaleRoot; /* Root of the scale */ +} DMUS_IO_SUBCHORD; + +typedef struct _DMUS_IO_COMMAND +{ + MUSIC_TIME mtTime; /* Time of this command */ + WORD wMeasure; /* Measure this falls on */ + BYTE bBeat; /* Beat this falls on */ + BYTE bCommand; /* Command type (see #defines below) */ + BYTE bGrooveLevel; /* Groove level (0 if command is not a groove) */ + BYTE bGrooveRange; /* Groove range */ + BYTE bRepeatMode; /* Used to control selection of patterns with same groove level */ +} DMUS_IO_COMMAND; + + +/* + + // + LIST + ( + 'cord' + + ... // Chord body chunks + ) + + // + crdh + ( + // Scale: dword (upper 8 bits for root, lower 24 for scale) + ) + + // + crdb + ( + // sizeof DMUS_IO_CHORD:dword + + // # of DMUS_IO_SUBCHORDS:dword + // sizeof DMUS_IO_SUBCHORDS:dword + // a number of + ) + + + // + 'cmnd' + ( + //sizeof DMUS_IO_COMMAND: DWORD + ... + ) + +*/ + +/* File io for DirectMusic Tool and ToolGraph objects +*/ + +/* RIFF ids: */ + +#define DMUS_FOURCC_TOOLGRAPH_FORM mmioFOURCC('D','M','T','G') +#define DMUS_FOURCC_TOOL_LIST mmioFOURCC('t','o','l','l') +#define DMUS_FOURCC_TOOL_FORM mmioFOURCC('D','M','T','L') +#define DMUS_FOURCC_TOOL_CHUNK mmioFOURCC('t','o','l','h') + +/* io structures: */ + +typedef struct _DMUS_IO_TOOL_HEADER +{ + GUID guidClassID; /* Class id of tool. */ + long lIndex; /* Position in graph. */ + DWORD cPChannels; /* Number of items in channels array. */ + FOURCC ckid; /* chunk ID of tool's data chunk if 0 fccType valid. */ + FOURCC fccType; /* list type if NULL ckid valid. */ + DWORD dwPChannels[1]; /* Array of PChannels, size determined by cPChannels. */ +} DMUS_IO_TOOL_HEADER; + +/* +RIFF +( + 'DMTG' // DirectMusic ToolGraph chunk + [] // GUID for ToolGraph + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Tools +) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'toll' // Array of tools + ... // Each tool is encapsulated in a RIFF chunk + ) + +// Tools are embedded in a graph. Theoretically, they can be saved as individual files too. +RIFF +( + 'DMTL' + + [] // Tool data. Must be a RIFF readable chunk. +) + + // // Tool header chunk + ( + 'tolh' + // Tool header + ) +*/ + +/* The AudioPath file carries everything for describing a specific audio path, + including Tool Graph and Buffer Descriptor. + This can even be used for configuring a complete performance. +*/ + +#define DMUS_FOURCC_AUDIOPATH_FORM mmioFOURCC('D','M','A','P') + +/* +RIFF +( + 'DMAP' // DirectMusic AudioPath chunk + [] // GUID for this Audio Path configuration + [] // Optional version info + [] // Name, author, copyright info., comments + [] // Optional ToolGraph + [] // Optional list of port configurations + []...// Optional array of DirectSound buffer descriptors +) +*/ + +#define DMUS_FOURCC_PORTCONFIGS_LIST mmioFOURCC('p','c','s','l') +#define DMUS_FOURCC_PORTCONFIG_LIST mmioFOURCC('p','c','f','l') +#define DMUS_FOURCC_PORTCONFIG_ITEM mmioFOURCC('p','c','f','h') +#define DMUS_FOURCC_PORTPARAMS_ITEM mmioFOURCC('p','p','r','h') +#define DMUS_FOURCC_DSBUFFER_LIST mmioFOURCC('d','b','f','l') +#define DMUS_FOURCC_DSBUFFATTR_ITEM mmioFOURCC('d','d','a','h') +#define DMUS_FOURCC_PCHANNELS_LIST mmioFOURCC('p','c','h','l') +#define DMUS_FOURCC_PCHANNELS_ITEM mmioFOURCC('p','c','h','h') + +typedef struct _DMUS_IO_PORTCONFIG_HEADER +{ + GUID guidPort; /* GUID of requested port. */ + DWORD dwPChannelBase; /* PChannel that this should start on. */ + DWORD dwPChannelCount; /* How many channels. */ + DWORD dwFlags; /* Various flags. */ +} DMUS_IO_PORTCONFIG_HEADER; + +#define DMUS_PORTCONFIGF_DRUMSON10 1 /* This port configured for drums on channel 10. */ +#define DMUS_PORTCONFIGF_USEDEFAULT 2 /* Use the default port. */ + +/* Each portconfig has one or more pchannel to buffer mappings. Each buffer + is identified by a guid. Each pchannel can map to one or more buffers. + This is defined with one or more DMUS_IO_PCHANNELTOBUFFER_HEADER + structures. Each defines a range of PChannels and the set of buffers + that they connect to. +*/ + +typedef struct _DMUS_IO_PCHANNELTOBUFFER_HEADER +{ + DWORD dwPChannelBase; /* PChannel that this should start on. */ + DWORD dwPChannelCount; /* How many PChannels. */ + DWORD dwBufferCount; /* How many buffers do these connect to. */ + DWORD dwFlags; /* Various flags. Currently reserved for future use. Must be 0. */ +} DMUS_IO_PCHANNELTOBUFFER_HEADER; + +/* Each buffer is represented by an DSBC form. This is wrapped by the + DMUS_IO_BUFFER_ATTRIBUTES_HEADER which identifies how to use the + buffer. In particular, it indicates whether this gets dynamically duplicated + or all references to this should share the same instance. + To resolve references, the unique GUID of the buffer is also stored + in this structure. +*/ + +typedef struct _DMUS_IO_BUFFER_ATTRIBUTES_HEADER +{ + GUID guidBufferID; /* Each buffer config has a unique ID. */ + DWORD dwFlags; /* Various flags. */ +} DMUS_IO_BUFFER_ATTRIBUTES_HEADER; + +/* DMUS_IO_BUFFER_ATTRIBUTES_HEADER.dwFlags: */ +#define DMUS_BUFFERF_SHARED 1 /* Share this with other audio paths, instead of creating unique copies. */ +#define DMUS_BUFFERF_DEFINED 2 /* Use one of the standard predefined buffers (see GUID_Buffer... in dmusici.h.) */ +#define DMUS_BUFFERF_MIXIN 8 /* This is a mixin buffer. */ + +/* + +LIST +( + 'pcsl' // Array of port configurations + ... // One or more port configurations, each in a list chunk +) + +LIST +( + 'pcfl' // List container for one port configuration. + // Portconfig header chunk. + // Port params, to be used to create the port. + []...// Optional array of DirectSound buffer descriptors + [] // Optional list of pchannel to buffer assignments + +) + + // // Port config header chunk + ( + 'pcfh' + // Port config header + ) + + // // Port params header chunk + ( + 'pprh' + // Port params header + ) + +LIST +( + 'pchl' // List container for one or more pchannel to buffer assignments. + ... // One or more pchannel to buffer assignment headers and data. + + // + ( + 'pchh' + // Description of PChannels + ... // Array of GUIDs defining the buffers they all connect to. + ) +) + +LIST +( + 'dbfl' // List container for one buffer and buffer attributes header. + // Buffer attributes header. + [] // Buffer configuration. Not required when header uses a predefined buffer type. + + // + ( + 'ddah' + // Buffer attributes. + ) +) +*/ + +/* File io for DirectMusic Band Track object */ + + +/* RIFF ids: */ +#define DMUS_FOURCC_BANDTRACK_FORM mmioFOURCC('D','M','B','T') +#define DMUS_FOURCC_BANDTRACK_CHUNK mmioFOURCC('b','d','t','h') +#define DMUS_FOURCC_BANDS_LIST mmioFOURCC('l','b','d','l') +#define DMUS_FOURCC_BAND_LIST mmioFOURCC('l','b','n','d') +#define DMUS_FOURCC_BANDITEM_CHUNK mmioFOURCC('b','d','i','h') +#define DMUS_FOURCC_BANDITEM_CHUNK2 mmioFOURCC('b','d','2','h') + +/* io structures */ +typedef struct _DMUS_IO_BAND_TRACK_HEADER +{ + BOOL bAutoDownload; /* Determines if Auto-Download is enabled. */ +} DMUS_IO_BAND_TRACK_HEADER; + +typedef struct _DMUS_IO_BAND_ITEM_HEADER +{ + MUSIC_TIME lBandTime; /* Position in track list. */ +} DMUS_IO_BAND_ITEM_HEADER; + +typedef struct _DMUS_IO_BAND_ITEM_HEADER2 +{ + MUSIC_TIME lBandTimeLogical; /* Position in track list. Time in the music with which band change is associated. */ + MUSIC_TIME lBandTimePhysical; /* Precise time band change will take effect. Should be close to logical time. */ +} DMUS_IO_BAND_ITEM_HEADER2; + +/* +RIFF +( + 'DMBT' // DirectMusic Band Track form-type + [] // Band track header + [] // GUID for band track + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Band items +) + + // + 'bdth' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'lbdl' + ... // Array of bands, each encapsulated in a list chunk + ) + + // + LIST + ( + 'lbnd' + or // bdih is a legacy format. bd2h is preferred for new content. + // Band + ) + + // or // band item header + ( + or // Band item header + ) +*/ + + +/* File io for DirectMusic Band object +*/ + +/* RIFF ids: */ + +#define DMUS_FOURCC_BAND_FORM mmioFOURCC('D','M','B','D') +#define DMUS_FOURCC_INSTRUMENTS_LIST mmioFOURCC('l','b','i','l') +#define DMUS_FOURCC_INSTRUMENT_LIST mmioFOURCC('l','b','i','n') +#define DMUS_FOURCC_INSTRUMENT_CHUNK mmioFOURCC('b','i','n','s') + +/* Flags for DMUS_IO_INSTRUMENT + */ +#define DMUS_IO_INST_PATCH (1 << 0) /* dwPatch is valid. */ +#define DMUS_IO_INST_BANKSELECT (1 << 1) /* dwPatch contains a valid Bank Select MSB and LSB part */ +#define DMUS_IO_INST_ASSIGN_PATCH (1 << 3) /* dwAssignPatch is valid */ +#define DMUS_IO_INST_NOTERANGES (1 << 4) /* dwNoteRanges is valid */ +#define DMUS_IO_INST_PAN (1 << 5) /* bPan is valid */ +#define DMUS_IO_INST_VOLUME (1 << 6 ) /* bVolume is valid */ +#define DMUS_IO_INST_TRANSPOSE (1 << 7) /* nTranspose is valid */ +#define DMUS_IO_INST_GM (1 << 8) /* Instrument is from GM collection */ +#define DMUS_IO_INST_GS (1 << 9) /* Instrument is from GS collection */ +#define DMUS_IO_INST_XG (1 << 10) /* Instrument is from XG collection */ +#define DMUS_IO_INST_CHANNEL_PRIORITY (1 << 11) /* dwChannelPriority is valid */ +#define DMUS_IO_INST_USE_DEFAULT_GM_SET (1 << 12) /* Always use the default GM set for this patch, */ + /* don't rely on the synth caps stating GM or GS in hardware. */ +#define DMUS_IO_INST_PITCHBENDRANGE (1 << 13) /* nPitchBendRange is valid */ + +/* io structures */ +typedef struct _DMUS_IO_INSTRUMENT +{ + DWORD dwPatch; /* MSB, LSB and Program change to define instrument */ + DWORD dwAssignPatch; /* MSB, LSB and Program change to assign to instrument when downloading */ + DWORD dwNoteRanges[4]; /* 128 bits; one for each MIDI note instrument needs to able to play */ + DWORD dwPChannel; /* PChannel instrument plays on */ + DWORD dwFlags; /* DMUS_IO_INST_ flags */ + BYTE bPan; /* Pan for instrument */ + BYTE bVolume; /* Volume for instrument */ + short nTranspose; /* Number of semitones to transpose notes */ + DWORD dwChannelPriority; /* Channel priority */ + short nPitchBendRange; /* Number of semitones shifted by pitch bend */ +} DMUS_IO_INSTRUMENT; + +/* +// bands can be embedded in other forms +RIFF +( + 'DMBD' // DirectMusic Band chunk + [] // GUID for band + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Instruments +) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'lbil' // Array of instruments + ... // Each instrument is encapsulated in a list + ) + + // + LIST + ( + 'lbin' + + [] // Optional reference to DLS Collection file. + ) + + // // Instrument chunk + ( + 'bins' + // Instrument header + ) +*/ + +/* This RIFF id and io struct have been added to allow wave files (and the wave object) to + differentiate between streaming and one-shot waves, and to give a prefetch for streaming + waves */ + +#define DMUS_FOURCC_WAVEHEADER_CHUNK mmioFOURCC('w','a','v','h') + +typedef struct _DMUS_IO_WAVE_HEADER +{ + REFERENCE_TIME rtReadAhead; /* How far ahead in the stream wave data will be read (in REFERENCE_TIME). Ignored for one-shot waves. */ + DWORD dwFlags; /* Various flags, including whether this is a streaming wave and whether it can be invalidated. */ +} DMUS_IO_WAVE_HEADER; + + +/* File io for Wave track */ + +/* RIFF ids: */ + +#define DMUS_FOURCC_WAVETRACK_LIST mmioFOURCC('w','a','v','t') +#define DMUS_FOURCC_WAVETRACK_CHUNK mmioFOURCC('w','a','t','h') +#define DMUS_FOURCC_WAVEPART_LIST mmioFOURCC('w','a','v','p') +#define DMUS_FOURCC_WAVEPART_CHUNK mmioFOURCC('w','a','p','h') +#define DMUS_FOURCC_WAVEITEM_LIST mmioFOURCC('w','a','v','i') +#define DMUS_FOURCC_WAVE_LIST mmioFOURCC('w','a','v','e') +#define DMUS_FOURCC_WAVEITEM_CHUNK mmioFOURCC('w','a','i','h') + +/* This flag is included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags. If set, the track will get its + variations from a pattern track, via GetParam(GUID_Variations). */ +#define DMUS_WAVETRACKF_SYNC_VAR 0x1 +/* This is also included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags. If set, variation control + information will persist from one playback instance to the next.*/ +#define DMUS_WAVETRACKF_PERSIST_CONTROL 0x2 + +typedef struct _DMUS_IO_WAVE_TRACK_HEADER +{ + long lVolume; /* Gain, in 1/100th of dB, to be applied to all waves. Note: All gain values should be negative. */ + DWORD dwFlags; /* Flags, including whether this track syncs to a pattern track for its variations. */ +} DMUS_IO_WAVE_TRACK_HEADER; + +typedef struct _DMUS_IO_WAVE_PART_HEADER +{ + long lVolume; /* Gain, in 1/100th of dB, to be applied to all waves in wave part. Note: All gain values should be negative. */ + DWORD dwVariations; /* Variation mask for which of 32 variations */ + DWORD dwPChannel; /* PChannel */ + DWORD dwLockToPart; /* Part ID to lock to. */ + DWORD dwFlags; /* Flags, including stuff for managing how variations are chosen (in low-order nibble) */ + DWORD dwIndex; /* Index for distinguishing multiple parts on the same PChannel*/ +} DMUS_IO_WAVE_PART_HEADER; + +typedef struct _DMUS_IO_WAVE_ITEM_HEADER +{ + long lVolume; /* Gain, in 1/100th of dB. Note: All gain values should be negative. */ + long lPitch; /* Pitch offset in 1/100th of a semitone. */ + DWORD dwVariations; /* Variation flags for which of 32 variations this wave belongs to. */ + REFERENCE_TIME rtTime; /* Start time, in REFERENCE_TIME, if clock time track, or MUSIC_TIME for music time track. */ + REFERENCE_TIME rtStartOffset; /* Distance into wave to start playback, in reference time units. */ + REFERENCE_TIME rtReserved; /* Reserved field. */ + REFERENCE_TIME rtDuration; /* Duration, in REFERENCE_TIME or MUSIC_TIME, depending on track timing format. */ + MUSIC_TIME mtLogicalTime; /* If in music track format, this indicates the musical boundary where this belongs. Otherwise, ignored. */ + DWORD dwLoopStart; /* Start point for a looping wave. */ + DWORD dwLoopEnd; /* End point for a looping wave. */ + DWORD dwFlags; /* Various flags, including whether this is a streaming wave and whether it can be invalidated. */ + WORD wVolumeRange; /* Random range for volume. */ + WORD wPitchRange; /* Random range for pitch. */ +} DMUS_IO_WAVE_ITEM_HEADER; + +/* +LIST +{ + 'wavt' // Wave track chunk + // Wave track header + ... // Array of Wave Parts +} + // + 'wath' + { + + } + + // + LIST + { + 'wavp' + // Wave Part Header + // List of wave items + } + + // + 'waph' + { + + } + + // + LIST + { + 'wavi' + ... // Array of waves; each wave is encapsulated in a list + } + + // + LIST + { + 'wave' + // Wave item header + // Reference to wave object + } + + // + 'waih' + { + + } + +*/ + +/* File io for DirectMusic Container file. This embeds a set of related files. And, + in turn, it can be embedded within a segment or script file. +*/ + +#define DMUS_FOURCC_CONTAINER_FORM mmioFOURCC('D','M','C','N') +#define DMUS_FOURCC_CONTAINER_CHUNK mmioFOURCC('c','o','n','h') +#define DMUS_FOURCC_CONTAINED_ALIAS_CHUNK mmioFOURCC('c','o','b','a') +#define DMUS_FOURCC_CONTAINED_OBJECT_CHUNK mmioFOURCC('c','o','b','h') +#define DMUS_FOURCC_CONTAINED_OBJECTS_LIST mmioFOURCC('c','o','s','l') +#define DMUS_FOURCC_CONTAINED_OBJECT_LIST mmioFOURCC('c','o','b','l') + +typedef struct _DMUS_IO_CONTAINER_HEADER +{ + DWORD dwFlags; /* Flags. */ +} DMUS_IO_CONTAINER_HEADER; + +#define DMUS_CONTAINER_NOLOADS (1 << 1) /* Contained items are not loaded when the container is loaded. + Entries will be created in the loader (via SetObject) but + the actual objects will not be created until they are + specifically loaded at a later time. */ + +typedef struct _DMUS_IO_CONTAINED_OBJECT_HEADER +{ + GUID guidClassID; /* Class id of object. */ + DWORD dwFlags; /* Flags, for example DMUS_CONTAINED_OBJF_KEEP. */ + FOURCC ckid; /* chunk ID of track's data chunk if 0 fccType valid. */ + FOURCC fccType; /* list type if NULL ckid valid */ + /* Note that LIST:DMRF may be used for ckid and fccType in order to reference an + object instead of embedding it within the container. */ +} DMUS_IO_CONTAINED_OBJECT_HEADER; + +#define DMUS_CONTAINED_OBJF_KEEP 1 /* Keep the object cached in the loader after the container is released. */ + +/* +RIFF +( + 'DMCN' // DirectMusic Container chunk + // Container header chunk + [] // GUID for container + [] // Optional version info + [] // Name, author, copyright info., comments + // List of objects. +) + + // + 'conh' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + LIST + ( + 'cosl' // Array of embedded objects. + ... // Each object is encapsulated in a LIST chunk + ) + + // // Encapsulates one object + LIST + ( + 'cobl' + [] // Alias. An alternative name by which this object is known + // within the container. + // Required header, includes CLASS ID for object. + [] or // Object data of the type specified in . + // If DMRF, it is a reference of where to find the object. + // Otherwise, it could be any RIFF readable chunk in the + // exact same format as a file. The object will load + // itself from this data. + ) + + // + 'coba' + ( + // Alias, stored as NULL terminated string of WCHARs + ) + + // + 'cobh' + ( + + ) +*/ + +/* File io for DirectMusic Segment object */ + +/* RIFF ids: */ + +#define DMUS_FOURCC_SEGMENT_FORM mmioFOURCC('D','M','S','G') +#define DMUS_FOURCC_SEGMENT_CHUNK mmioFOURCC('s','e','g','h') +#define DMUS_FOURCC_TRACK_LIST mmioFOURCC('t','r','k','l') +#define DMUS_FOURCC_TRACK_FORM mmioFOURCC('D','M','T','K') +#define DMUS_FOURCC_TRACK_CHUNK mmioFOURCC('t','r','k','h') +#define DMUS_FOURCC_TRACK_EXTRAS_CHUNK mmioFOURCC('t','r','k','x') + +/* io structures:*/ + +typedef struct _DMUS_IO_SEGMENT_HEADER +{ + DWORD dwRepeats; /* Number of repeats. By default, 0. */ + MUSIC_TIME mtLength; /* Length, in music time. */ + MUSIC_TIME mtPlayStart; /* Start of playback. By default, 0. */ + MUSIC_TIME mtLoopStart; /* Start of looping portion. By default, 0. */ + MUSIC_TIME mtLoopEnd; /* End of loop. Must be greater than dwPlayStart. Or, 0, indicating loop full segment. */ + DWORD dwResolution; /* Default resolution. */ + /* Following added for DirectX8: */ + REFERENCE_TIME rtLength; /* Length, in reference time (overrides music time length.) */ + DWORD dwFlags; + DWORD dwReserved; /* Reserved. */ + /* Added for DirectX9: */ + REFERENCE_TIME rtLoopStart; /* Clock time loop start. */ + REFERENCE_TIME rtLoopEnd; /* Clock time loop end. */ + REFERENCE_TIME rtPlayStart; /* Start of playback in clock time. */ +} DMUS_IO_SEGMENT_HEADER; + +#define DMUS_SEGIOF_REFLENGTH 1 /* Use the time in rtLength for the segment length. */ +#define DMUS_SEGIOF_CLOCKTIME 2 /* This is a clock time segment. */ + +typedef struct _DMUS_IO_TRACK_HEADER +{ + GUID guidClassID; /* Class id of track. */ + DWORD dwPosition; /* Position in track list. */ + DWORD dwGroup; /* Group bits for track. */ + FOURCC ckid; /* chunk ID of track's data chunk. */ + FOURCC fccType; /* list type if ckid is RIFF or LIST */ +} DMUS_IO_TRACK_HEADER; + +/* Additional parameters for the track header chunk, introduced in DirectX8 and + on, are stored in a separate chunk. */ + +typedef struct _DMUS_IO_TRACK_EXTRAS_HEADER +{ + DWORD dwFlags; /* DirectX8 Added flags for control tracks. */ + DWORD dwPriority; /* Priority for composition. */ +} DMUS_IO_TRACK_EXTRAS_HEADER; + +/* +RIFF +( + 'DMSG' // DirectMusic Segment chunk + // Segment header chunk + [] // GUID for segment + [] // Optional version info + [] // Name, author, copyright info., comments + [] // Optional container of objects embedded in file. Must precede tracklist. + // List of Tracks + [] // Optional ToolGraph + [] // Optional Audio Path +) + + // + 'segh' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'trkl' // Array of tracks + ... // Each track is encapsulated in a RIFF chunk + ) + + // // Tracks can be embedded in a segment or stored as separate files. + RIFF + ( + 'DMTK' + + [] // Optional track flags. + [] // Optional GUID for track object instance (not to be confused with Class id in track header) + [] // Optional version info + [] // Optional name, author, copyright info., comments + [] // Track data. Must be a RIFF readable chunk. + ) + + // // Track header chunk + ( + 'trkh' + // Track header + ) + + // // Track flags chunk + ( + 'trkx' + // DirectX8 Track flags header + ) +*/ + +/* File io for DirectMusic reference chunk. + This is used to embed a reference to an object. +*/ + +/* RIFF ids: */ + +#define DMUS_FOURCC_REF_LIST mmioFOURCC('D','M','R','F') +#define DMUS_FOURCC_REF_CHUNK mmioFOURCC('r','e','f','h') +#define DMUS_FOURCC_DATE_CHUNK mmioFOURCC('d','a','t','e') +#define DMUS_FOURCC_NAME_CHUNK mmioFOURCC('n','a','m','e') +#define DMUS_FOURCC_FILE_CHUNK mmioFOURCC('f','i','l','e') + +typedef struct _DMUS_IO_REFERENCE +{ + GUID guidClassID; /* Class id is always required. */ + DWORD dwValidData; /* Flags. */ +} DMUS_IO_REFERENCE; + +/* +LIST +( + 'DMRF' // DirectMusic Reference chunk + // Reference header chunk + [] // Optional object GUID. + [] // Optional file date. + [] // Optional name. + [] // Optional file name. + [] // Optional category name. + [] // Optional version info. +) + + // + 'refh' + ( + + ) + + // + 'guid' + ( + + ) + + // + date + ( + + ) + + // + name + ( + // Name, stored as NULL terminated string of WCHARs + ) + + // + file + ( + // File name, stored as NULL terminated string of WCHARs + ) + + // + catg + ( + // Category name, stored as NULL terminated string of WCHARs + ) + + // + vers + ( + + ) +*/ + +/* Chord Maps */ + +/* runtime chunks */ +#define DMUS_FOURCC_CHORDMAP_FORM mmioFOURCC('D','M','P','R') +#define DMUS_FOURCC_IOCHORDMAP_CHUNK mmioFOURCC('p','e','r','h') +#define DMUS_FOURCC_SUBCHORD_CHUNK mmioFOURCC('c','h','d','t') +#define DMUS_FOURCC_CHORDENTRY_CHUNK mmioFOURCC('c','h','e','h') +#define DMUS_FOURCC_SUBCHORDID_CHUNK mmioFOURCC('s','b','c','n') +#define DMUS_FOURCC_IONEXTCHORD_CHUNK mmioFOURCC('n','c','r','d') +#define DMUS_FOURCC_NEXTCHORDSEQ_CHUNK mmioFOURCC('n','c','s','q') +#define DMUS_FOURCC_IOSIGNPOST_CHUNK mmioFOURCC('s','p','s','h') +#define DMUS_FOURCC_CHORDNAME_CHUNK mmioFOURCC('I','N','A','M') + +/* runtime list chunks */ +#define DMUS_FOURCC_CHORDENTRY_LIST mmioFOURCC('c','h','o','e') +#define DMUS_FOURCC_CHORDMAP_LIST mmioFOURCC('c','m','a','p') +#define DMUS_FOURCC_CHORD_LIST mmioFOURCC('c','h','r','d') +#define DMUS_FOURCC_CHORDPALETTE_LIST mmioFOURCC('c','h','p','l') +#define DMUS_FOURCC_CADENCE_LIST mmioFOURCC('c','a','d','e') +#define DMUS_FOURCC_SIGNPOSTITEM_LIST mmioFOURCC('s','p','s','t') + +#define DMUS_FOURCC_SIGNPOST_LIST mmioFOURCC('s','p','s','q') + +/* values for dwChord field of DMUS_IO_PERS_SIGNPOST */ +/* DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST) */ +#define DMUS_SIGNPOSTF_A 1 +#define DMUS_SIGNPOSTF_B 2 +#define DMUS_SIGNPOSTF_C 4 +#define DMUS_SIGNPOSTF_D 8 +#define DMUS_SIGNPOSTF_E 0x10 +#define DMUS_SIGNPOSTF_F 0x20 +#define DMUS_SIGNPOSTF_LETTER (DMUS_SIGNPOSTF_A | DMUS_SIGNPOSTF_B | DMUS_SIGNPOSTF_C | DMUS_SIGNPOSTF_D | DMUS_SIGNPOSTF_E | DMUS_SIGNPOSTF_F) +#define DMUS_SIGNPOSTF_1 0x100 +#define DMUS_SIGNPOSTF_2 0x200 +#define DMUS_SIGNPOSTF_3 0x400 +#define DMUS_SIGNPOSTF_4 0x800 +#define DMUS_SIGNPOSTF_5 0x1000 +#define DMUS_SIGNPOSTF_6 0x2000 +#define DMUS_SIGNPOSTF_7 0x4000 +#define DMUS_SIGNPOSTF_ROOT (DMUS_SIGNPOSTF_1 | DMUS_SIGNPOSTF_2 | DMUS_SIGNPOSTF_3 | DMUS_SIGNPOSTF_4 | DMUS_SIGNPOSTF_5 | DMUS_SIGNPOSTF_6 | DMUS_SIGNPOSTF_7) +#define DMUS_SIGNPOSTF_CADENCE 0x8000 + +/* values for dwFlags field of DMUS_IO_CHORDMAP */ +#define DMUS_CHORDMAPF_VERSION8 1 /* Chordmap is version 8 or above. */ + +/* values for dwChord field of DMUS_IO_PERS_SIGNPOST */ +#define DMUS_SPOSTCADENCEF_1 2 /* Use the first cadence chord. */ +#define DMUS_SPOSTCADENCEF_2 4 /* Use the second cadence chord. */ + +/* run time data structs */ +typedef struct _DMUS_IO_CHORDMAP +{ + WCHAR wszLoadName[20]; + DWORD dwScalePattern; + DWORD dwFlags; /* Various flags. Only lower 16 bits are significant. */ +} DMUS_IO_CHORDMAP; + +typedef struct _DMUS_IO_CHORDMAP_SUBCHORD +{ + DWORD dwChordPattern; + DWORD dwScalePattern; + DWORD dwInvertPattern; + BYTE bChordRoot; + BYTE bScaleRoot; + WORD wCFlags; + DWORD dwLevels; /* parts or which subchord levels this chord supports */ +} DMUS_IO_CHORDMAP_SUBCHORD; + +/* Legacy name... */ +typedef DMUS_IO_CHORDMAP_SUBCHORD DMUS_IO_PERS_SUBCHORD; + +typedef struct _DMUS_IO_CHORDENTRY +{ + DWORD dwFlags; + WORD wConnectionID; /* replaces runtime "pointer to this" */ +} DMUS_IO_CHORDENTRY; + +typedef struct _DMUS_IO_NEXTCHORD +{ + DWORD dwFlags; + WORD nWeight; + WORD wMinBeats; + WORD wMaxBeats; + WORD wConnectionID; /* points to an ioChordEntry */ +} DMUS_IO_NEXTCHORD; + +typedef struct _DMUS_IO_CHORDMAP_SIGNPOST +{ + DWORD dwChords; /* 1bit per group */ + DWORD dwFlags; +} DMUS_IO_CHORDMAP_SIGNPOST; + +/* Legacy name... */ +typedef DMUS_IO_CHORDMAP_SIGNPOST DMUS_IO_PERS_SIGNPOST; + +/* +RIFF +( + 'DMPR' + // Chord map header chunk + [] // guid chunk + [] // version chunk (two DWORDS) + [] // Unfo chunk + // subchord database + // chord palette + // chord map + // signpost list + ) + + ::= LIST('cmap' ) + + ::= LIST('choe' + // chord entry data + // chord definition + // connecting(next) chords + ) + + ::= LIST('chrd' + // name of chord in wide char format + // list of subchords composing chord + ) + + ::= LIST('chpl' + ... // chord definition + ) + + ::== LIST('spsq' ... ) + + ::= LIST('spst' + + + [] + ) + + ::= LIST('cade' ...) + + ::= perh() + + ::= chdt( + ... ) + + ::= cheh() + + ::= sbcn( ...) + + ::= ncsq( + ...) + + ::= spsh() + +*/ + +/* File io for DirectMusic Script object */ + +/* RIFF ids: */ + +#define DMUS_FOURCC_SCRIPT_FORM mmioFOURCC('D','M','S','C') +#define DMUS_FOURCC_SCRIPT_CHUNK mmioFOURCC('s','c','h','d') +#define DMUS_FOURCC_SCRIPTVERSION_CHUNK mmioFOURCC('s','c','v','e') +#define DMUS_FOURCC_SCRIPTLANGUAGE_CHUNK mmioFOURCC('s','c','l','a') +#define DMUS_FOURCC_SCRIPTSOURCE_CHUNK mmioFOURCC('s','c','s','r') + +/* io structures:*/ + +typedef struct _DMUS_IO_SCRIPT_HEADER +{ + DWORD dwFlags; /* DMUS_SCRIPTIOF_ flags */ +} DMUS_IO_SCRIPT_HEADER; + +#define DMUS_SCRIPTIOF_LOAD_ALL_CONTENT (1 << 0) + /* If set, when the script loads it will also load all the content in its container. */ +#define DMUS_SCRIPTIOF_DOWNLOAD_ALL_SEGMENTS (1 << 1) + /* If set and LOAD_ALL_CONTENT is also set, when the script initializes it will also download all the segments in its container. + If set and LOAD_ALL_CONTENT is not set, when the script calls segment.Load on a segment then the segment will also be downloaded. + If not set, the script must manually download and unload by calling segment.DownloadSoundData and segment.UnloadSoundData. */ + +/* +RIFF +( + 'DMSC' // DirectMusic Script chunk + // Script header chunk + [] // GUID for script + [] // Optional version info + [] // Name, author, copyright info., comments + // Version of DirectMusic this script was authored to run against + // Container of content referenced by the script. + // ActiveX scripting language in which the script is written + or // The script's source code. + // If scsr-ck, the source is embedding in the chunk. + // If DMRF, it is a reference of where to find a text file with the source. + // Class id (guidClassID in DMUS_IO_REFERENCE) must be GUID_NULL because + // this text file is not a DirectMusic object in its own right. +) + + // + 'schd' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + scve + ( + + ) + + 'scla' + ( + // Language name, stored as NULL terminated string of WCHARs + ) + + 'scsr' + ( + // Source code, stored as NULL terminated string of WCHARs + ) +*/ + +/* Signpost tracks */ + +#define DMUS_FOURCC_SIGNPOST_TRACK_CHUNK mmioFOURCC( 's', 'g', 'n', 'p' ) + + +typedef struct _DMUS_IO_SIGNPOST +{ + MUSIC_TIME mtTime; + DWORD dwChords; + WORD wMeasure; +} DMUS_IO_SIGNPOST; + +/* + + // + 'sgnp' + ( + //sizeof DMUS_IO_SIGNPOST: DWORD + ... + ) + +*/ + +#define DMUS_FOURCC_MUTE_CHUNK mmioFOURCC('m','u','t','e') + +typedef struct _DMUS_IO_MUTE +{ + MUSIC_TIME mtTime; + DWORD dwPChannel; + DWORD dwPChannelMap; +} DMUS_IO_MUTE; + +/* + + // + 'mute' + ( + //sizeof DMUS_IO_MUTE:DWORD + ... + ) + + +*/ + +/* Used for both style and chord map tracks */ + +#define DMUS_FOURCC_TIME_STAMP_CHUNK mmioFOURCC('s', 't', 'm', 'p') + +/* Style tracks */ + +#define DMUS_FOURCC_STYLE_TRACK_LIST mmioFOURCC('s', 't', 't', 'r') +#define DMUS_FOURCC_STYLE_REF_LIST mmioFOURCC('s', 't', 'r', 'f') + +/* + + // + LIST('sttr' + ( + ... // Array of Style references + ) + + // + LIST('strf' + ( + + + ) + + // + 'stmp' + ( + // time:DWORD + ) + +*/ + +/* Chord map tracks */ + +#define DMUS_FOURCC_PERS_TRACK_LIST mmioFOURCC('p', 'f', 't', 'r') +#define DMUS_FOURCC_PERS_REF_LIST mmioFOURCC('p', 'f', 'r', 'f') + +/* + + // + LIST('pftr' + ( + ... // Array of Chord map references + ) + + // + LIST('pfrf' + ( + + + ) + + // + 'stmp' + ( + // time:DWORD + ) + +*/ + +#define DMUS_FOURCC_TEMPO_TRACK mmioFOURCC('t','e','t','r') + +/* + // tempo array + 'tetr' + ( + // sizeof DMUS_IO_TEMPO_ITEM: DWORD + ... + ) + */ + +#define DMUS_FOURCC_SEQ_TRACK mmioFOURCC('s','e','q','t') +#define DMUS_FOURCC_SEQ_LIST mmioFOURCC('e','v','t','l') +#define DMUS_FOURCC_CURVE_LIST mmioFOURCC('c','u','r','l') + +/* + // sequence track + 'seqt' + ( + // sequence array + 'evtl' + ( + // sizeof DMUS_IO_SEQ_ITEM: DWORD + ... + ) + // curve array + 'curl' + ( + // sizeof DMUS_IO_CURVE_ITEM: DWORD + ... + ) + ) +*/ + +#define DMUS_FOURCC_SYSEX_TRACK mmioFOURCC('s','y','e','x') + +/* + // sysex track + 'syex' + ( + { + + ... // Array of bytes, length defined in the DMUS_IO_SYSEXITEM structure + }... + ) +*/ + +#define DMUS_FOURCC_TIMESIGNATURE_TRACK mmioFOURCC('t','i','m','s') + +typedef struct _DMUS_IO_TIMESIGNATURE_ITEM +{ + MUSIC_TIME lTime; + BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */ + BYTE bBeat; /* what note receives the beat (bottom of time sig.) */ + /* we can assume that 0 means 256th note */ + WORD wGridsPerBeat; /* grids per beat */ +} DMUS_IO_TIMESIGNATURE_ITEM; + +/* DirectX6 time signature track + + 'tims' + ( + // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD + ... + ) +*/ + +/* DirectX8 Time signature track. The track has been updated from DirectX7 to support a list of + RIFF chunks. This will allow the time signature track to expand in the future. +*/ + +#define DMUS_FOURCC_TIMESIGTRACK_LIST mmioFOURCC('T','I','M','S') +#define DMUS_FOURCC_TIMESIG_CHUNK DMUS_FOURCC_TIMESIGNATURE_TRACK + +/* +LIST +( + 'TIMS' // Time Signature Track list-type + // Chunk containing an array of time signatures +) + + 'tims' + ( + // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD + ... + ) + +*/ + +/* DirectX8 Marker track. This is used to store valid start points and other + flow control parameters that may come later. For example, if we want + to implement more sophisticated looping and branching constructs, they + would live in this track. +*/ + +#define DMUS_FOURCC_MARKERTRACK_LIST mmioFOURCC('M','A','R','K') +#define DMUS_FOURCC_VALIDSTART_CHUNK mmioFOURCC('v','a','l','s') +#define DMUS_FOURCC_PLAYMARKER_CHUNK mmioFOURCC('p','l','a','y') + +/* io structures */ +typedef struct _DMUS_IO_VALID_START +{ + MUSIC_TIME mtTime; /* Time of a legal start. */ +} DMUS_IO_VALID_START; + +typedef struct _DMUS_IO_PLAY_MARKER +{ + MUSIC_TIME mtTime; /* Time of a next legal play point marker. */ +} DMUS_IO_PLAY_MARKER; + +/* +LIST +( + 'MARK' // Marker Track list-type + [] // Chunk containing an array of start points + [] // Chunk containing an array of play start markers +) + + 'vals' + ( + // size of DMUS_IO_VALID_START : DWORD + ... + ) + + 'play' + ( + // size of DMUS_IO_PLAY_MARKER : DWORD + ... + ) + +*/ + +/* segment trigger tracks */ + +/* RIFF ids: */ +#define DMUS_FOURCC_SEGTRACK_LIST mmioFOURCC('s','e','g','t') +#define DMUS_FOURCC_SEGTRACK_CHUNK mmioFOURCC('s','g','t','h') +#define DMUS_FOURCC_SEGMENTS_LIST mmioFOURCC('l','s','g','l') +#define DMUS_FOURCC_SEGMENT_LIST mmioFOURCC('l','s','e','g') +#define DMUS_FOURCC_SEGMENTITEM_CHUNK mmioFOURCC('s','g','i','h') +#define DMUS_FOURCC_SEGMENTITEMNAME_CHUNK mmioFOURCC('s','n','a','m') + +/* io structures */ +typedef struct _DMUS_IO_SEGMENT_TRACK_HEADER +{ + DWORD dwFlags; /* Reserved leave as 0. */ +} DMUS_IO_SEGMENT_TRACK_HEADER; + +typedef struct _DMUS_IO_SEGMENT_ITEM_HEADER +{ + MUSIC_TIME lTimeLogical; /* Position in track list. Time in the music with which the event is associated. */ + MUSIC_TIME lTimePhysical; /* Precise time event will be triggered. Should be close to logical time. */ + DWORD dwPlayFlags; /* Flags for PlaySegment(). */ + DWORD dwFlags; /* Flags. */ +} DMUS_IO_SEGMENT_ITEM_HEADER; + +/* values for dwflags field of DMUS_IO_SEGMENT_ITEM_HEADER */ +#define DMUS_SEGMENTTRACKF_MOTIF 1 /* interpret DMRF as link to style, and use snam as the name of a motif within the style */ + +/* +LIST +( + 'segt' // DirectMusic Segment Trigger Track form-type + [] // Segment track header + // List of Segment Lists +) + + // + 'sgth' + ( + + ) + + // + LIST + ( + 'lsgl' // Array of segments + ... // Each segment is encapsulated in a list (that way it can still be riff parsed.) + ) + + // + LIST + ( + 'lseg' + + // Link to a segment or style file. + [] // Name field. Used with DMUS_SEGMENTTRACKF_MOTIF flag. + ) + + // // segment item header + ( + // Segment item header + ) + + // + ( + // Name, stored as NULL terminated string of WCHARs + ) +*/ + +/* Script track. */ + +/* RIFF ids: */ +#define DMUS_FOURCC_SCRIPTTRACK_LIST mmioFOURCC('s','c','r','t') +#define DMUS_FOURCC_SCRIPTTRACKEVENTS_LIST mmioFOURCC('s','c','r','l') +#define DMUS_FOURCC_SCRIPTTRACKEVENT_LIST mmioFOURCC('s','c','r','e') +#define DMUS_FOURCC_SCRIPTTRACKEVENTHEADER_CHUNK mmioFOURCC('s','c','r','h') +#define DMUS_FOURCC_SCRIPTTRACKEVENTNAME_CHUNK mmioFOURCC('s','c','r','n') + +/* Flags for DMUS_IO_SCRIPTTRACK_TIMING + */ +#define DMUS_IO_SCRIPTTRACKF_PREPARE (1 << 0) /* Fire event in advance of time stamp, at Prepare time. This is the default because it leaves the script time to change the music happening at the target time. */ +#define DMUS_IO_SCRIPTTRACKF_QUEUE (1 << 1) /* Fire event just before time stamp, at Queue time. */ +#define DMUS_IO_SCRIPTTRACKF_ATTIME (1 << 2) /* Fire event right at the time stamp. */ + +typedef struct _DMUS_IO_SCRIPTTRACK_EVENTHEADER +{ + DWORD dwFlags; /* various bits (see DMUS_IO_SCRIPTTRACKF_*) */ + MUSIC_TIME lTimeLogical; /* Position in track list. Time in the music with which the event is associated. */ + MUSIC_TIME lTimePhysical; /* Precise time event will be triggered. Should be close to logical time. */ +} DMUS_IO_SCRIPTTRACK_EVENTHEADER; + +/* + // Script Track + + // + LIST + ( + // List of script events + ) + + // + LIST + ( + ... // Array of event descriptions + ) + + // + LIST + ( + // Event header chunk + + // Routine name + ) + + 'scrh' + ( + + ) + + 'scrn' + ( + // Name, stored as NULL terminated string of WCHARs + ) +*/ + +/* Lyrics/Notification track. */ + +/* RIFF ids: */ +#define DMUS_FOURCC_LYRICSTRACK_LIST mmioFOURCC('l','y','r','t') +#define DMUS_FOURCC_LYRICSTRACKEVENTS_LIST mmioFOURCC('l','y','r','l') +#define DMUS_FOURCC_LYRICSTRACKEVENT_LIST mmioFOURCC('l','y','r','e') +#define DMUS_FOURCC_LYRICSTRACKEVENTHEADER_CHUNK mmioFOURCC('l','y','r','h') +#define DMUS_FOURCC_LYRICSTRACKEVENTTEXT_CHUNK mmioFOURCC('l','y','r','n') + +typedef struct _DMUS_IO_LYRICSTRACK_EVENTHEADER +{ + DWORD dwFlags; /* Reserved leave as 0. */ + DWORD dwTimingFlags; /* Combination DMUS_PMSGF_TOOL_* flags. Determines the precise timing of when the notification happens. Invalid with the flag DMUS_PMSGF_REFTIME, DMUS_PMSGF_MUSICTIME, DMUS_PMSGF_TOOL_FLUSH, or DMUS_PMSGF_LOCKTOREFTIME. */ + MUSIC_TIME lTimeLogical; /* Position in track list. Time in the music with which the event is associated. */ + MUSIC_TIME lTimePhysical; /* Precise time event will be triggered. Should be close to logical time. */ +} DMUS_IO_LYRICSTRACK_EVENTHEADER; + +/* + // Lyrics/Notification Track + + // + LIST + ( + // List of notification events + ) + + // + LIST + ( + ... // Array of event descriptions + ) + + // + LIST + ( + // Event header chunk + // Notification text + ) + + 'lyrh' + ( + + ) + + 'lyrn' + ( + // Name, stored as NULL terminated string of WCHARs + ) +*/ + +/* Parameter control track */ + +/* RIFF ids: */ +#define DMUS_FOURCC_PARAMCONTROLTRACK_TRACK_LIST mmioFOURCC('p','r','m','t') +#define DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_LIST mmioFOURCC('p','r','o','l') +#define DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_CHUNK mmioFOURCC('p','r','o','h') +#define DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_LIST mmioFOURCC('p','r','p','l') +#define DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_CHUNK mmioFOURCC('p','r','p','h') +#define DMUS_FOURCC_PARAMCONTROLTRACK_CURVES_CHUNK mmioFOURCC('p','r','c','c') + +typedef struct _DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER +{ + DWORD dwFlags; /* Reserved. Must be zero. */ + GUID guidTimeFormat; /* Time format to set the object to. Must be GUID_TIME_REFERNCE or GUID_TIME_MUSIC from medparam.h. */ + /* Path for finding the object. These fields correspond to the first five parameters of IDirectMusicSegmentState::GetObjectInPath. */ + DWORD dwPChannel; + DWORD dwStage; + DWORD dwBuffer; + GUID guidObject; + DWORD dwIndex; +} DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER; + +typedef struct _DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER +{ + DWORD dwFlags; /* Reserved. Must be zero. */ + DWORD dwIndex; /* Index number of the parameter on the object */ +} DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER; + +typedef struct _DMUS_IO_PARAMCONTROLTRACK_CURVEINFO +{ + MUSIC_TIME mtStartTime; + MUSIC_TIME mtEndTime; + float fltStartValue; + float fltEndValue; + DWORD dwCurveType; /* One of the items from the MP_CURVE_TYPE enum in medparam.h */ + DWORD dwFlags; /* A combination of the MPF_ENVLP_* constants in medparam.h */ +} DMUS_IO_PARAMCONTROLTRACK_CURVEINFO; + +/* + // + LIST + ( + ... // one for each object + ) + + // + LIST + ( + // object header chunk + ... // one for each parameter + ) + + // + proh + ( + + ) + + // + LIST + ( + // parameter header chunk + // chunk containing an array of curves + ) + + // + prph + ( + + ) + + // + prcc + ( + // sizeof DMUS_IO_PARAMCONTROLTRACK_CURVEINFO:DWORD + ... // curves, sorted in order of mtTime + ) +*/ + +#if (DIRECTSOUND_VERSION >= 0x0800) + +/* DirectSoundBufferConfig FX Map */ + +/* RIFF ids: */ + +#define DMUS_FOURCC_DSBC_FORM mmioFOURCC('D','S','B','C') +#define DMUS_FOURCC_DSBD_CHUNK mmioFOURCC('d','s','b','d') +#define DMUS_FOURCC_BSID_CHUNK mmioFOURCC('b','s','i','d') +#define DMUS_FOURCC_DS3D_CHUNK mmioFOURCC('d','s','3','d') +#define DMUS_FOURCC_DSBC_LIST mmioFOURCC('f','x','l','s') +#define DMUS_FOURCC_DSFX_FORM mmioFOURCC('D','S','F','X') +#define DMUS_FOURCC_DSFX_CHUNK mmioFOURCC('f','x','h','r') +#define DMUS_FOURCC_DSFX_DATA mmioFOURCC('d','a','t','a') + +/* io structures */ + +typedef struct _DSOUND_IO_DSBUFFERDESC +{ + DWORD dwFlags; /* DirectSound buffer creation flags */ + WORD nChannels; /* No. of channels (rest of buffer format is determined by owning sink) */ + LONG lVolume; /* Initial pan; only used if CTRLVOLUME is specified */ + LONG lPan; /* Initial pan; only used if CTRLPAN is specified */ + DWORD dwReserved; /* Reserved - must be 0 */ +} DSOUND_IO_DSBUFFERDESC; + +typedef struct _DSOUND_IO_DSBUSID +{ + DWORD busid[1]; /* Array size determined from chunk size */ +} DSOUND_IO_DSBUSID; + +typedef struct _DSOUND_IO_3D +{ + GUID guid3DAlgorithm; /* GUID identifying the 3D algorithm to use (defined in dsound.h) */ + DS3DBUFFER ds3d; /* Initial 3D parameters */ +} DSOUND_IO_3D; + +typedef struct _DSOUND_IO_DXDMO_HEADER +{ + DWORD dwEffectFlags; /* Effect creation flags - equivalent to DSEFFECTDESC::dwFlags */ + GUID guidDSFXClass; /* GUID identifying the effect to use - corresponds to a COM CLSID */ + GUID guidReserved; /* Reserved - must be the null GUID */ + GUID guidSendBuffer; /* GUID identifying the buffer to send to if this is a send effect */ + DWORD dwReserved; /* Reserved - must be 0 */ +} DSOUND_IO_DXDMO_HEADER; + +typedef struct _DSOUND_IO_DXDMO_DATA +{ + DWORD data[1]; /* Array size determined by the DMO involved */ +} DSOUND_IO_DXDMO_DATA; + +/* +RIFF +( + 'DSBC' // DirectSoundBufferConfig chunk + [] // GUID identifier for this DirectSoundBufferConfig + [] // Optional version info + [] // Name, author, copyright info., comments + // DirectSound Buffer descriptor chunk + [] // Optional bus id array + [] // Optional 3d Parameters + [] // Optional list of FX descriptors +) + + // + 'guid' + ( + + ) + + // + 'vers' + ( + + ) + + // + 'dsbd' + ( + // Creation parameters and initial settings for the buffer + ) + + // + 'bsid' + ( + // The size of DSOUND_IO_DSBUSID is determined by the chunk size + ) + + // + 'ds3d' + ( + // Initial 3D buffer parameters: position, etc. + ) + + // + LIST + ( + 'fxls' // Array of DMO creation parameter blocks + ... // Each DMO is encapsulated in a RIFF chunk + ) + +// // DMOs can be embedded in a buffer configuration or stored as separate files +RIFF +( + 'DSFX' + // FX header chunk + [] // FX initial settings chunk +) + + // + 'fxhr' + ( + + ) + + // + 'data' + ( + // Opaque data block used by the DMO to load itself. + // For our standard included DMOs, this is simply the structure accepted by + // the DMO's SetAllParameters() method - e.g. struct DSFXChorus for Chorus. + ) +*/ + +#endif + +#ifdef __cplusplus +}; /* extern "C" */ +#endif + +#include + +#endif /* #ifndef _DMUSICF_ */ diff --git a/saco/d3d9/include/dmusici.h b/saco/d3d9/include/dmusici.h new file mode 100644 index 0000000..65bf7f6 --- /dev/null +++ b/saco/d3d9/include/dmusici.h @@ -0,0 +1,1883 @@ +/************************************************************************ +* * +* dmusici.h -- This module contains the API for the * +* DirectMusic performance layer * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMUSICI_ +#define _DMUSICI_ + +#include + +#define COM_NO_WINDOWS_H +#include + +#include +#include +/* plugin (track and tool) interfaces. This #include will eventually go away. */ +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef WORD TRANSITION_TYPE; +typedef __int64 REFERENCE_TIME; +typedef long MUSIC_TIME; + +#define MT_MIN 0x80000000 /* Minimum music time value. */ +#define MT_MAX 0x7FFFFFFF /* Maximum music time value. */ + +#define DMUS_PPQ 768 /* parts per quarter note */ + +interface IDirectMusicTrack; +interface IDirectMusicPerformance; +interface IDirectMusicPerformance8; +interface IDirectMusicTool; +interface IDirectMusicSegment; +interface IDirectMusicSegment8; +interface IDirectMusicSegmentState; +interface IDirectMusicSegmentState8; +interface IDirectMusicGraph; +interface IDirectMusicBuffer; +interface IDirectMusicInstrument; +interface IDirectMusicDownloadedInstrument; +interface IDirectMusicBand; +interface IDirectMusicChordMap; +interface IDirectMusicLoader; +interface IDirectMusicLoader8; +interface IDirectMusicScript; +interface IDirectMusicObject; +interface IDirectMusicStyle8; +interface IDirectMusicPatternTrack; +interface IDirectMusicContainer; +interface IDirectMusicTool8; +interface IDirectMusicTrack8; +interface IDirectMusicAudioPath; +#ifndef __cplusplus +typedef interface IDirectMusicTrack IDirectMusicTrack; +typedef interface IDirectMusicPerformance IDirectMusicPerformance; +typedef interface IDirectMusicPerformance8 IDirectMusicPerformance8; +typedef interface IDirectMusicTool IDirectMusicTool; +typedef interface IDirectMusicSegment IDirectMusicSegment; +typedef interface IDirectMusicSegment8 IDirectMusicSegment8; +typedef interface IDirectMusicSegmentState IDirectMusicSegmentState; +typedef interface IDirectMusicSegmentState8 IDirectMusicSegmentState8; +typedef interface IDirectMusicGraph IDirectMusicGraph; +typedef interface IDirectMusicBuffer IDirectMusicBuffer; +typedef interface IDirectMusicInstrument IDirectMusicInstrument; +typedef interface IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument; +typedef interface IDirectMusicBand IDirectMusicBand; +typedef interface IDirectMusicChordMap IDirectMusicChordMap; +typedef interface IDirectMusicObject IDirectMusicObject; +typedef interface IDirectMusicLoader IDirectMusicLoader; +typedef interface IDirectMusicLoader8 IDirectMusicLoader8; +typedef interface IDirectMusicScript IDirectMusicScript; +typedef interface IDirectMusicStyle8 IDirectMusicStyle8; +typedef interface IDirectMusicPatternTrack IDirectMusicPatternTrack; +typedef interface IDirectMusicContainer IDirectMusicContainer; +typedef interface IDirectMusicTool8 IDirectMusicTool8; +typedef interface IDirectMusicTrack8 IDirectMusicTrack8; +typedef interface IDirectMusicAudioPath IDirectMusicAudioPath; +#endif + +typedef enum enumDMUS_STYLET_TYPES +{ + DMUS_STYLET_PATTERN = 0, + DMUS_STYLET_MOTIF = 1, +} DMUS_STYLET_TYPES; + + +typedef enum enumDMUS_COMMANDT_TYPES +{ + DMUS_COMMANDT_GROOVE = 0, + DMUS_COMMANDT_FILL = 1, + DMUS_COMMANDT_INTRO = 2, + DMUS_COMMANDT_BREAK = 3, + DMUS_COMMANDT_END = 4, + DMUS_COMMANDT_ENDANDINTRO = 5 +} DMUS_COMMANDT_TYPES; + +typedef enum enumDMUS_SHAPET_TYPES +{ + DMUS_SHAPET_FALLING = 0, + DMUS_SHAPET_LEVEL = 1, + DMUS_SHAPET_LOOPABLE = 2, + DMUS_SHAPET_LOUD = 3, + DMUS_SHAPET_QUIET = 4, + DMUS_SHAPET_PEAKING = 5, + DMUS_SHAPET_RANDOM = 6, + DMUS_SHAPET_RISING = 7, + DMUS_SHAPET_SONG = 8 +} DMUS_SHAPET_TYPES; + +typedef enum enumDMUS_COMPOSEF_FLAGS +{ + DMUS_COMPOSEF_NONE = 0, + DMUS_COMPOSEF_ALIGN = 0x1, + DMUS_COMPOSEF_OVERLAP = 0x2, + DMUS_COMPOSEF_IMMEDIATE = 0x4, + DMUS_COMPOSEF_GRID = 0x8, + DMUS_COMPOSEF_BEAT = 0x10, + DMUS_COMPOSEF_MEASURE = 0x20, + DMUS_COMPOSEF_AFTERPREPARETIME = 0x40, + DMUS_COMPOSEF_VALID_START_BEAT = 0x80, /* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any beat. */ + DMUS_COMPOSEF_VALID_START_GRID = 0x100, /* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any grid. */ + DMUS_COMPOSEF_VALID_START_TICK = 0x200, /* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur any time. */ + DMUS_COMPOSEF_SEGMENTEND = 0x400, /* Play the transition at the end of the current segment. */ + DMUS_COMPOSEF_MARKER = 0x800, /* Play the transition at the next marker in the current segment. */ + DMUS_COMPOSEF_MODULATE = 0x1000, + DMUS_COMPOSEF_LONG = 0x2000, + DMUS_COMPOSEF_ENTIRE_TRANSITION = 0x4000, /* play the entire transition pattern */ + DMUS_COMPOSEF_1BAR_TRANSITION = 0x8000, /* play one bar of the transition pattern */ + DMUS_COMPOSEF_ENTIRE_ADDITION = 0x10000, /* play the additional pattern in its entirety */ + DMUS_COMPOSEF_1BAR_ADDITION = 0x20000, /* play one bar of the additional pattern */ + DMUS_COMPOSEF_VALID_START_MEASURE = 0x40000, /* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any bar. */ + DMUS_COMPOSEF_DEFAULT = 0x80000, /* Use segment's default boundary */ + DMUS_COMPOSEF_NOINVALIDATE = 0x100000, /* Play without invalidating the currently playing segment(s) */ + DMUS_COMPOSEF_USE_AUDIOPATH = 0x200000, /* Uses the audio paths that are embedded in the segments */ + DMUS_COMPOSEF_INVALIDATE_PRI = 0x400000 /* Invalidate only the current primary seg state */ +} DMUS_COMPOSEF_FLAGS; + +#define DMUS_PMSG_PART \ + DWORD dwSize; \ + REFERENCE_TIME rtTime; /* real time (in 100 nanosecond increments) */ \ + MUSIC_TIME mtTime; /* music time */ \ + DWORD dwFlags; /* various bits (see DMUS_PMSGF_FLAGS enumeration) */ \ + DWORD dwPChannel; /* Performance Channel. The Performance can */ \ + /* use this to determine the port/channel. */ \ + DWORD dwVirtualTrackID; /* virtual track ID */ \ + IDirectMusicTool* pTool; /* tool interface pointer */ \ + IDirectMusicGraph* pGraph; /* tool graph interface pointer */ \ + DWORD dwType; /* PMSG type (see DMUS_PMSGT_TYPES defines) */ \ + DWORD dwVoiceID; /* unique voice id which allows synthesizers to */ \ + /* identify a specific event. For DirectX 6.0, */ \ + /* this field should always be 0. */ \ + DWORD dwGroupID; /* Track group id */ \ + IUnknown* punkUser; /* user com pointer, auto released upon PMSG free */ + +/* every DMUS_PMSG is based off of this structure. The Performance needs + to access these members consistently in every PMSG that goes through it. */ +typedef struct _DMUS_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + +} DMUS_PMSG; + +#define DMUS_PCHANNEL_BROADCAST_PERFORMANCE 0xFFFFFFFF /* PMsg is sent on all PChannels of the performance. */ +#define DMUS_PCHANNEL_BROADCAST_AUDIOPATH 0xFFFFFFFE /* PMsg is sent on all PChannels of the audio path. */ +#define DMUS_PCHANNEL_BROADCAST_SEGMENT 0xFFFFFFFD /* PMsg is sent on all PChannels of the segment. */ +#define DMUS_PCHANNEL_BROADCAST_GROUPS 0xFFFFFFFC /* A duplicate PMsg is for each Channels Groups in the performance. */ + +/* The DMUS_PATH constants are used in conjunction with GetObjectInPath to find a requested + interface at a particular stage in the audio path. +*/ +#define DMUS_PATH_SEGMENT 0x1000 /* Get the segment itself (from a segment state.) */ +#define DMUS_PATH_SEGMENT_TRACK 0x1100 /* Look in Track List of Segment. */ +#define DMUS_PATH_SEGMENT_GRAPH 0x1200 /* Get the segment's tool graph. */ +#define DMUS_PATH_SEGMENT_TOOL 0x1300 /* Look in Tool Graph of Segment. */ +#define DMUS_PATH_AUDIOPATH 0x2000 /* Get the audiopath itself (from a segment state.) */ +#define DMUS_PATH_AUDIOPATH_GRAPH 0x2200 /* Get the audiopath's tool graph. */ +#define DMUS_PATH_AUDIOPATH_TOOL 0x2300 /* Look in Tool Graph of Audio Path. */ +#define DMUS_PATH_PERFORMANCE 0x3000 /* Access the performance. */ +#define DMUS_PATH_PERFORMANCE_GRAPH 0x3200 /* Get the performance's tool graph. */ +#define DMUS_PATH_PERFORMANCE_TOOL 0x3300 /* Look in Tool Graph of Performance. */ +#define DMUS_PATH_PORT 0x4000 /* Access the synth. */ +#define DMUS_PATH_BUFFER 0x6000 /* Look in DirectSoundBuffer. */ +#define DMUS_PATH_BUFFER_DMO 0x6100 /* Access a DMO in the buffer. */ +#define DMUS_PATH_MIXIN_BUFFER 0x7000 /* Look in a global mixin buffer. */ +#define DMUS_PATH_MIXIN_BUFFER_DMO 0x7100 /* Access a DMO in a global mixin buffer. */ +#define DMUS_PATH_PRIMARY_BUFFER 0x8000 /* Access the primary buffer. */ + +/* To ignore PChannels when calling GetObjectInPath(), use the DMUS_PCHANNEL_ALL constant. */ +#define DMUS_PCHANNEL_ALL 0xFFFFFFFB + +/* The DMUS_APATH types are used in conjunction with CreateStandardAudioPath to + build default path types. _SHARED_ means the same buffer is shared across multiple + instantiations of the audiopath type. _DYNAMIC_ means a unique buffer is created + every time. +*/ + +#define DMUS_APATH_SHARED_STEREOPLUSREVERB 1 /* A standard music set up with stereo outs and reverb. */ +#define DMUS_APATH_DYNAMIC_3D 6 /* An audio path with one dynamic bus from the synth feeding to a dynamic 3d buffer. Does not send to env reverb. */ +#define DMUS_APATH_DYNAMIC_MONO 7 /* An audio path with one dynamic bus from the synth feeding to a dynamic mono buffer. */ +#define DMUS_APATH_DYNAMIC_STEREO 8 /* An audio path with two dynamic buses from the synth feeding to a dynamic stereo buffer. */ + +typedef struct _DMUS_AUDIOPARAMS +{ + DWORD dwSize; /* Size of this structure. */ + BOOL fInitNow; /* If true, the sink and synth are created immediately and results returned in this structure. */ + DWORD dwValidData; /* Flags indicating which fields below are valid. */ + DWORD dwFeatures; /* Required DMUS_AUDIOF features. */ + DWORD dwVoices; /* Required number of voices. */ + DWORD dwSampleRate; /* Sample rate of synths and sink. */ + CLSID clsidDefaultSynth; /* Class ID of default synthesizer. */ +} DMUS_AUDIOPARAMS; + +/* dwFeatures flags. These indicate which features are required for the audio environment. */ +#define DMUS_AUDIOF_3D 0x1 /* Require 3D buffers. */ +#define DMUS_AUDIOF_ENVIRON 0x2 /* Require environmental modeling. */ +#define DMUS_AUDIOF_EAX 0x4 /* Require use of EAX effects. */ +#define DMUS_AUDIOF_DMOS 0x8 /* Require use of additional DMOs. */ +#define DMUS_AUDIOF_STREAMING 0x10 /* Require support for streaming waves. */ +#define DMUS_AUDIOF_BUFFERS 0x20 /* Require support for multiple buffers (all above cases need this.) */ +#define DMUS_AUDIOF_ALL 0x3F /* Requires everything. */ + +/* dwValidData flags. These indicate which fields in DMUS_AUDIOPARAMS have been filled in. If fInitNow is set, these also return what was allocated. */ +#define DMUS_AUDIOPARAMS_FEATURES 0x00000001 +#define DMUS_AUDIOPARAMS_VOICES 0x00000002 +#define DMUS_AUDIOPARAMS_SAMPLERATE 0x00000004 +#define DMUS_AUDIOPARAMS_DEFAULTSYNTH 0x00000008 + +/* DMUS_PMSGF_FLAGS fill the DMUS_PMSG's dwFlags member */ +typedef enum enumDMUS_PMSGF_FLAGS +{ + DMUS_PMSGF_REFTIME = 1, /* if rtTime is valid */ + DMUS_PMSGF_MUSICTIME = 2, /* if mtTime is valid */ + DMUS_PMSGF_TOOL_IMMEDIATE = 4, /* if PMSG should be processed immediately */ + DMUS_PMSGF_TOOL_QUEUE = 8, /* if PMSG should be processed a little early, at Queue time */ + DMUS_PMSGF_TOOL_ATTIME = 0x10, /* if PMSG should be processed at the time stamp */ + DMUS_PMSGF_TOOL_FLUSH = 0x20, /* if PMSG is being flushed */ + DMUS_PMSGF_LOCKTOREFTIME = 0x40, /* if rtTime can not be overriden by a tempo change. */ + DMUS_PMSGF_DX8 = 0x80 /* if the message has DX8 or later extensions. */ + /* The values of DMUS_TIME_RESOLVE_FLAGS may also be used inside the */ + /* DMUS_PMSG's dwFlags member. */ +} DMUS_PMSGF_FLAGS; + +/* DMUS_PMSGT_TYPES fill the DMUS_PMSG's dwType member */ +typedef enum enumDMUS_PMSGT_TYPES +{ + DMUS_PMSGT_MIDI = 0, /* MIDI short message */ + DMUS_PMSGT_NOTE = 1, /* Interactive Music Note */ + DMUS_PMSGT_SYSEX = 2, /* MIDI long message (system exclusive message) */ + DMUS_PMSGT_NOTIFICATION = 3, /* Notification message */ + DMUS_PMSGT_TEMPO = 4, /* Tempo message */ + DMUS_PMSGT_CURVE = 5, /* Control change / pitch bend, etc. curve */ + DMUS_PMSGT_TIMESIG = 6, /* Time signature */ + DMUS_PMSGT_PATCH = 7, /* Patch changes */ + DMUS_PMSGT_TRANSPOSE = 8, /* Transposition messages */ + DMUS_PMSGT_CHANNEL_PRIORITY = 9, /* Channel priority */ + DMUS_PMSGT_STOP = 10, /* Stop message */ + DMUS_PMSGT_DIRTY = 11, /* Tells Tools that cache GetParam() info to refresh */ + DMUS_PMSGT_WAVE = 12, /* Carries control information for playing a wave. */ + DMUS_PMSGT_LYRIC = 13, /* Lyric message from lyric track. */ + DMUS_PMSGT_SCRIPTLYRIC = 14, /* Lyric message sent by a script with the Trace function. */ + DMUS_PMSGT_USER = 255 /* User message */ +} DMUS_PMSGT_TYPES; + +/* DMUS_SEGF_FLAGS correspond to IDirectMusicPerformance::PlaySegment, and other API */ +typedef enum enumDMUS_SEGF_FLAGS +{ + DMUS_SEGF_REFTIME = 1<<6, /* 0x40 Time parameter is in reference time */ + DMUS_SEGF_SECONDARY = 1<<7, /* 0x80 Secondary segment */ + DMUS_SEGF_QUEUE = 1<<8, /* 0x100 Queue at the end of the primary segment queue (primary only) */ + DMUS_SEGF_CONTROL = 1<<9, /* 0x200 Play as a control track (secondary segments only) */ + DMUS_SEGF_AFTERPREPARETIME = 1<<10, /* 0x400 Play after the prepare time (See IDirectMusicPerformance::GetPrepareTime) */ + DMUS_SEGF_GRID = 1<<11, /* 0x800 Play on grid boundary */ + DMUS_SEGF_BEAT = 1<<12, /* 0x1000 Play on beat boundary */ + DMUS_SEGF_MEASURE = 1<<13, /* 0x2000 Play on measure boundary */ + DMUS_SEGF_DEFAULT = 1<<14, /* 0x4000 Use segment's default boundary */ + DMUS_SEGF_NOINVALIDATE = 1<<15, /* 0x8000 Play without invalidating the currently playing segment(s) */ + DMUS_SEGF_ALIGN = 1<<16, /* 0x10000 Align segment with requested boundary, but switch at first valid point */ + DMUS_SEGF_VALID_START_BEAT = 1<<17, /* 0x20000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any beat. */ + DMUS_SEGF_VALID_START_GRID = 1<<18, /* 0x40000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any grid. */ + DMUS_SEGF_VALID_START_TICK = 1<<19, /* 0x80000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur any time. */ + DMUS_SEGF_AUTOTRANSITION = 1<<20, /* 0x100000 Compose and play a transition segment, using the transition template. */ + DMUS_SEGF_AFTERQUEUETIME = 1<<21, /* 0x200000 Make sure to play after the queue time. This is default for primary segments */ + DMUS_SEGF_AFTERLATENCYTIME = 1<<22, /* 0x400000 Make sure to play after the latency time. This is true for all segments, so this is a nop */ + DMUS_SEGF_SEGMENTEND = 1<<23, /* 0x800000 Play at the next end of segment. */ + DMUS_SEGF_MARKER = 1<<24, /* 0x1000000 Play at next marker in the primary segment. If there are no markers, default to any other resolution requests. */ + DMUS_SEGF_TIMESIG_ALWAYS = 1<<25, /* 0x2000000 Even if there is no primary segment, align start time with current time signature. */ + DMUS_SEGF_USE_AUDIOPATH = 1<<26, /* 0x4000000 Uses the audio path that is embedded in the segment. */ + DMUS_SEGF_VALID_START_MEASURE = 1<<27, /* 0x8000000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any bar. */ + DMUS_SEGF_INVALIDATE_PRI = 1<<28 /* 0x10000000 invalidate only the current primary seg state */ +} DMUS_SEGF_FLAGS; + +#define DMUS_SEG_REPEAT_INFINITE 0xFFFFFFFF /* For IDirectMusicSegment::SetRepeat*/ +#define DMUS_SEG_ALLTRACKS 0x80000000 /* For IDirectMusicSegment::SetParam() and SetTrackConfig() - selects all tracks instead on nth index. */ +#define DMUS_SEG_ANYTRACK 0x80000000 /* For IDirectMusicSegment::GetParam() - checks each track until it finds one that returns data (not DMUS_E_NOT_FOUND.) */ + + +/* DMUS_TIME_RESOLVE_FLAGS correspond to IDirectMusicPerformance::GetResolvedTime, and can */ +/* also be used interchangeably with the corresponding DMUS_SEGF_FLAGS, since their values */ +/* are intentionally the same */ +typedef enum enumDMUS_TIME_RESOLVE_FLAGS +{ + DMUS_TIME_RESOLVE_AFTERPREPARETIME = DMUS_SEGF_AFTERPREPARETIME, + DMUS_TIME_RESOLVE_AFTERQUEUETIME = DMUS_SEGF_AFTERQUEUETIME, + DMUS_TIME_RESOLVE_AFTERLATENCYTIME = DMUS_SEGF_AFTERLATENCYTIME, + DMUS_TIME_RESOLVE_GRID = DMUS_SEGF_GRID, + DMUS_TIME_RESOLVE_BEAT = DMUS_SEGF_BEAT, + DMUS_TIME_RESOLVE_MEASURE = DMUS_SEGF_MEASURE, + DMUS_TIME_RESOLVE_MARKER = DMUS_SEGF_MARKER, + DMUS_TIME_RESOLVE_SEGMENTEND = DMUS_SEGF_SEGMENTEND, +} DMUS_TIME_RESOLVE_FLAGS; + +/* The following flags are sent inside the DMUS_CHORD_KEY.dwFlags parameter */ +typedef enum enumDMUS_CHORDKEYF_FLAGS +{ + DMUS_CHORDKEYF_SILENT = 1, /* is the chord silent? */ +} DMUS_CHORDKEYF_FLAGS; + +#define DMUS_MAXSUBCHORD 8 + +typedef struct _DMUS_SUBCHORD +{ + DWORD dwChordPattern; /* Notes in the subchord */ + DWORD dwScalePattern; /* Notes in the scale */ + DWORD dwInversionPoints; /* Where inversions can occur */ + DWORD dwLevels; /* Which levels are supported by this subchord */ + BYTE bChordRoot; /* Root of the subchord */ + BYTE bScaleRoot; /* Root of the scale */ +} DMUS_SUBCHORD; + +typedef struct _DMUS_CHORD_KEY +{ + WCHAR wszName[16]; /* Name of the chord */ + WORD wMeasure; /* Measure this falls on */ + BYTE bBeat; /* Beat this falls on */ + BYTE bSubChordCount; /* Number of chords in the list of subchords */ + DMUS_SUBCHORD SubChordList[DMUS_MAXSUBCHORD]; /* List of sub chords */ + DWORD dwScale; /* Scale underlying the entire chord */ + BYTE bKey; /* Key underlying the entire chord */ + BYTE bFlags; /* Miscelaneous flags */ +} DMUS_CHORD_KEY; + +/* DMUS_NOTE_PMSG */ +typedef struct _DMUS_NOTE_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + MUSIC_TIME mtDuration; /* duration */ + WORD wMusicValue; /* Description of note in chord and key. */ + WORD wMeasure; /* Measure in which this note occurs */ + short nOffset; /* Offset from grid at which this note occurs */ + BYTE bBeat; /* Beat (in measure) at which this note occurs */ + BYTE bGrid; /* Grid offset from beat at which this note occurs */ + BYTE bVelocity; /* Note velocity */ + BYTE bFlags; /* see DMUS_NOTEF_FLAGS */ + BYTE bTimeRange; /* Range to randomize time. */ + BYTE bDurRange; /* Range to randomize duration. */ + BYTE bVelRange; /* Range to randomize velocity. */ + BYTE bPlayModeFlags; /* Play mode */ + BYTE bSubChordLevel; /* Which subchord level this note uses. */ + BYTE bMidiValue; /* The MIDI note value, converted from wMusicValue */ + char cTranspose; /* Transposition to add to midi note value after converted from wMusicValue. */ +} DMUS_NOTE_PMSG; + +typedef enum enumDMUS_NOTEF_FLAGS +{ + DMUS_NOTEF_NOTEON = 1, /* Set if this is a MIDI Note On. Otherwise, it is MIDI Note Off */ + /* DX8 flags: */ + DMUS_NOTEF_NOINVALIDATE = 2, /* Don't invalidate this note off. */ + DMUS_NOTEF_NOINVALIDATE_INSCALE = 4,/* Don't invalidate if still within the scale. */ + DMUS_NOTEF_NOINVALIDATE_INCHORD = 8,/* Don't invalidate if still within the chord. */ + DMUS_NOTEF_REGENERATE = 0x10, /* Regenerate the note on an invalidate. */ +} DMUS_NOTEF_FLAGS; + +/* The DMUS_PLAYMODE_FLAGS are used to determine how to convert wMusicValue + into the appropriate bMidiValue. +*/ + +typedef enum enumDMUS_PLAYMODE_FLAGS +{ + DMUS_PLAYMODE_KEY_ROOT = 1, /* Transpose on top of the key root. */ + DMUS_PLAYMODE_CHORD_ROOT = 2, /* Transpose on top of the chord root. */ + DMUS_PLAYMODE_SCALE_INTERVALS = 4, /* Use scale intervals from scale pattern. */ + DMUS_PLAYMODE_CHORD_INTERVALS = 8, /* Use chord intervals from chord pattern. */ + DMUS_PLAYMODE_NONE = 16, /* No mode. Indicates the parent part's mode should be used. */ +} DMUS_PLAYMODE_FLAGS; + +/* The following are playback modes that can be created by combining the DMUS_PLAYMODE_FLAGS + in various ways: +*/ + +/* Fixed. wMusicValue holds final MIDI note value. This is used for drums, sound effects, and sequenced + notes that should not be transposed by the chord or scale. +*/ +#define DMUS_PLAYMODE_FIXED 0 +/* In fixed to key, the musicvalue is again a fixed MIDI value, but it + is transposed on top of the key root. +*/ +#define DMUS_PLAYMODE_FIXEDTOKEY DMUS_PLAYMODE_KEY_ROOT +/* In fixed to chord, the musicvalue is also a fixed MIDI value, but it + is transposed on top of the chord root. +*/ +#define DMUS_PLAYMODE_FIXEDTOCHORD DMUS_PLAYMODE_CHORD_ROOT +/* In Pedalpoint, the key root is used and the notes only track the intervals in + the scale. The chord root and intervals are completely ignored. This is useful + for melodic lines that play relative to the key root. +*/ +#define DMUS_PLAYMODE_PEDALPOINT (DMUS_PLAYMODE_KEY_ROOT | DMUS_PLAYMODE_SCALE_INTERVALS) +/* In the Melodic mode, the chord root is used but the notes only track the intervals in + the scale. The key root and chord intervals are completely ignored. This is useful + for melodic lines that play relative to the chord root. +*/ +#define DMUS_PLAYMODE_MELODIC (DMUS_PLAYMODE_CHORD_ROOT | DMUS_PLAYMODE_SCALE_INTERVALS) +/* Normal chord mode is the prevalent playback mode. + The notes track the intervals in the chord, which is based on the chord root. + If there is a scale component to the MusicValue, the additional intervals + are pulled from the scale and added. + If the chord does not have an interval to match the chord component of + the MusicValue, the note is silent. +*/ +#define DMUS_PLAYMODE_NORMALCHORD (DMUS_PLAYMODE_CHORD_ROOT | DMUS_PLAYMODE_CHORD_INTERVALS) +/* If it is desirable to play a note that is above the top of the chord, the + always play mode (known as "purpleized" in a former life) finds a position + for the note by using intervals from the scale. Essentially, this mode is + a combination of the Normal and Melodic playback modes, where a failure + in Normal causes a second try in Melodic mode. +*/ +#define DMUS_PLAYMODE_ALWAYSPLAY (DMUS_PLAYMODE_MELODIC | DMUS_PLAYMODE_NORMALCHORD) + +/* These playmodes are new for dx8. */ +/* In PedalpointChord, the key root is used and the notes only track the intervals in + the chord. The chord root and scale intervals are completely ignored. This is useful + for chordal lines that play relative to the key root. +*/ +#define DMUS_PLAYMODE_PEDALPOINTCHORD (DMUS_PLAYMODE_KEY_ROOT | DMUS_PLAYMODE_CHORD_INTERVALS) + +/* For completeness, here's a mode that tries for pedalpointchord, but if it fails + uses scale intervals +*/ +#define DMUS_PLAYMODE_PEDALPOINTALWAYS (DMUS_PLAYMODE_PEDALPOINT | DMUS_PLAYMODE_PEDALPOINTCHORD) + + +/* Legacy names for modes... */ +#define DMUS_PLAYMODE_PURPLEIZED DMUS_PLAYMODE_ALWAYSPLAY +#define DMUS_PLAYMODE_SCALE_ROOT DMUS_PLAYMODE_KEY_ROOT +#define DMUS_PLAYMODE_FIXEDTOSCALE DMUS_PLAYMODE_FIXEDTOKEY + + +/* DMUS_MIDI_PMSG */ +typedef struct _DMUS_MIDI_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + BYTE bStatus; + BYTE bByte1; + BYTE bByte2; + BYTE bPad[1]; +} DMUS_MIDI_PMSG; + +/* DMUS_PATCH_PMSG */ +typedef struct _DMUS_PATCH_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + BYTE byInstrument; + BYTE byMSB; + BYTE byLSB; + BYTE byPad[1]; +} DMUS_PATCH_PMSG; + +/* DMUS_TRANSPOSE_PMSG */ +typedef struct _DMUS_TRANSPOSE_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + short nTranspose; + /* Following exists only under DX8 and on (check dwFlags for DMUS_PMSGF_DX8) */ + WORD wMergeIndex; /* Allows multiple parameters to be merged (pitchbend, volume, and expression.)*/ +} DMUS_TRANSPOSE_PMSG; + +/* DMUS_CHANNEL_PRIORITY_PMSG */ +typedef struct _DMUS_CHANNEL_PRIORITY_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + DWORD dwChannelPriority; +} DMUS_CHANNEL_PRIORITY_PMSG; + +/* DMUS_TEMPO_PMSG */ +typedef struct _DMUS_TEMPO_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + double dblTempo; /* the tempo */ +} DMUS_TEMPO_PMSG; + +#define DMUS_TEMPO_MAX 1000 +#define DMUS_TEMPO_MIN 1 + +#define DMUS_MASTERTEMPO_MAX 100.0f +#define DMUS_MASTERTEMPO_MIN 0.01f + +/* DMUS_SYSEX_PMSG */ +typedef struct _DMUS_SYSEX_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + DWORD dwLen; /* length of the data */ + BYTE abData[1]; /* array of data, length equal to dwLen */ +} DMUS_SYSEX_PMSG; + +/* DMUS_CURVE_PMSG */ +typedef struct _DMUS_CURVE_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + MUSIC_TIME mtDuration; /* how long this curve lasts */ + MUSIC_TIME mtOriginalStart; /* must be set to either zero when this PMSG is created or to the original mtTime of the curve */ + MUSIC_TIME mtResetDuration; /* how long after the curve is finished to allow a flush or + invalidation to reset to the reset value, nResetValue */ + short nStartValue; /* curve's start value */ + short nEndValue; /* curve's end value */ + short nResetValue; /* curve's reset value, set when a flush or invalidation + occurs within mtDuration + mtResetDuration */ + WORD wMeasure; /* Measure in which this curve occurs */ + short nOffset; /* Offset from grid at which this curve occurs */ + BYTE bBeat; /* Beat (in measure) at which this curve occurs */ + BYTE bGrid; /* Grid offset from beat at which this curve occurs */ + BYTE bType; /* type of curve */ + BYTE bCurveShape; /* shape of curve */ + BYTE bCCData; /* CC# if this is a control change type */ + BYTE bFlags; /* Curve reset and start from current value flags. */ + /* Following exists only under DX8 and on (check dwFlags for DMUS_PMSGF_DX8) */ + WORD wParamType; /* RPN or NRPN parameter number. */ + WORD wMergeIndex; /* Allows multiple parameters to be merged (pitchbend, volume, and expression.)*/ +} DMUS_CURVE_PMSG; + +typedef enum enumDMUS_CURVE_FLAGS +{ + DMUS_CURVE_RESET = 1, /* When set, the nResetValue must be sent when the + time is reached or an invalidate occurs because + of a transition. If not set, the curve stays + permanently stuck at the new value. */ + DMUS_CURVE_START_FROM_CURRENT = 2/* Ignore Start, start the curve at the current value. + This only works for volume, expression, and pitchbend. */ +} DMUS_CURVE_FLAGS; + + +#define DMUS_CURVE_RESET 1 + +/* Curve shapes */ +enum +{ + DMUS_CURVES_LINEAR = 0, + DMUS_CURVES_INSTANT = 1, + DMUS_CURVES_EXP = 2, + DMUS_CURVES_LOG = 3, + DMUS_CURVES_SINE = 4 +}; +/* curve types */ +#define DMUS_CURVET_PBCURVE 0x03 /* Pitch bend curve. */ +#define DMUS_CURVET_CCCURVE 0x04 /* Control change curve. */ +#define DMUS_CURVET_MATCURVE 0x05 /* Mono aftertouch curve. */ +#define DMUS_CURVET_PATCURVE 0x06 /* Poly aftertouch curve. */ +#define DMUS_CURVET_RPNCURVE 0x07 /* RPN curve with curve type in wParamType. */ +#define DMUS_CURVET_NRPNCURVE 0x08 /* NRPN curve with curve type in wParamType. */ + +/* DMUS_TIMESIG_PMSG */ +typedef struct _DMUS_TIMESIG_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + /* Time signatures define how many beats per measure, which note receives */ + /* the beat, and the grid resolution. */ + BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */ + BYTE bBeat; /* what note receives the beat (bottom of time sig.) */ + /* we can assume that 0 means 256th note */ + WORD wGridsPerBeat; /* grids per beat */ +} DMUS_TIMESIG_PMSG; + + + +/* notification type values */ +/* The following correspond to GUID_NOTIFICATION_SEGMENT */ +#define DMUS_NOTIFICATION_SEGSTART 0 +#define DMUS_NOTIFICATION_SEGEND 1 +#define DMUS_NOTIFICATION_SEGALMOSTEND 2 +#define DMUS_NOTIFICATION_SEGLOOP 3 +#define DMUS_NOTIFICATION_SEGABORT 4 +/* The following correspond to GUID_NOTIFICATION_PERFORMANCE */ +#define DMUS_NOTIFICATION_MUSICSTARTED 0 +#define DMUS_NOTIFICATION_MUSICSTOPPED 1 +#define DMUS_NOTIFICATION_MUSICALMOSTEND 2 +/* The following corresponds to GUID_NOTIFICATION_MEASUREANDBEAT */ +#define DMUS_NOTIFICATION_MEASUREBEAT 0 +/* The following corresponds to GUID_NOTIFICATION_CHORD */ +#define DMUS_NOTIFICATION_CHORD 0 +/* The following correspond to GUID_NOTIFICATION_COMMAND */ +#define DMUS_NOTIFICATION_GROOVE 0 +#define DMUS_NOTIFICATION_EMBELLISHMENT 1 +/* The following corresponds to GUID_NOTIFICATION_RECOMPOSE */ +#define DMUS_NOTIFICATION_RECOMPOSE 0 + +/* DMUS_NOTIFICATION_PMSG */ +typedef struct _DMUS_NOTIFICATION_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + GUID guidNotificationType; + DWORD dwNotificationOption; + DWORD dwField1; + DWORD dwField2; +} DMUS_NOTIFICATION_PMSG; + +/* DMUS_WAVE_PMSG */ +typedef struct _DMUS_WAVE_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + REFERENCE_TIME rtStartOffset; /* How far into the wave to start, in reference time units only. */ + REFERENCE_TIME rtDuration; /* Duration of the wave, in either reference time or music time. */ + long lOffset; /* Offset from actual time to logical time, in music or ref time. */ + long lVolume; /* Initial volume, in 100ths of a dB. */ + long lPitch; /* Initial pitch, in 100ths of a semitone. */ + BYTE bFlags; /* Flags, including DMUS_WAVEF_OFF... */ +} DMUS_WAVE_PMSG; + +#define DMUS_WAVEF_OFF 1 /* If wave is playing and this is the off message. */ +#define DMUS_WAVEF_STREAMING 2 /* If wave is streaming. */ +#define DMUS_WAVEF_NOINVALIDATE 4 /* Don't invalidate this wave. */ +#define DMUS_WAVEF_NOPREROLL 8 /* Don't preroll any wave data. */ +#define DMUS_WAVEF_IGNORELOOPS 0x20 /* Ignore segment looping. */ + +/* DMUS_LYRIC_PMSG */ +typedef struct _DMUS_LYRIC_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + WCHAR wszString[1]; /* null-terminated Unicode lyric string (structure is actually larger than size 1) */ +} DMUS_LYRIC_PMSG; + +#define DMUS_MAX_NAME 64 /* Maximum object name length. */ +#define DMUS_MAX_CATEGORY 64 /* Maximum object category name length. */ +#define DMUS_MAX_FILENAME MAX_PATH + +typedef struct _DMUS_VERSION { + DWORD dwVersionMS; + DWORD dwVersionLS; +}DMUS_VERSION, FAR *LPDMUS_VERSION; + +/* Time Signature structure, used by IDirectMusicStyle */ +/* Also used as a parameter for GetParam() and SetParam */ +typedef struct _DMUS_TIMESIGNATURE +{ + MUSIC_TIME mtTime; + BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */ + BYTE bBeat; /* what note receives the beat (bottom of time sig.) */ + /* we can assume that 0 means 256th note */ + WORD wGridsPerBeat; /* grids per beat */ +} DMUS_TIMESIGNATURE; + +typedef struct _DMUS_VALID_START_PARAM +{ + MUSIC_TIME mtTime; /* Time of the first legal start + point after (or including) the requested time. + This is a returned value. + Time format is the relative offset from requested time. */ +} DMUS_VALID_START_PARAM; + +typedef struct _DMUS_PLAY_MARKER_PARAM +{ + MUSIC_TIME mtTime; /* Time of the first legal segment play + marker before (or including) the requested time. + This is a returned value. + Time format is the relative offset from requested time. */ +} DMUS_PLAY_MARKER_PARAM; + +/* The DMUSOBJECTDESC structure is used to communicate everything you could */ +/* possibly use to describe a DirectMusic object. */ + +typedef struct _DMUS_OBJECTDESC +{ + DWORD dwSize; /* Size of this structure. */ + DWORD dwValidData; /* Flags indicating which fields below are valid. */ + GUID guidObject; /* Unique ID for this object. */ + GUID guidClass; /* GUID for the class of object. */ + FILETIME ftDate; /* Last edited date of object. */ + DMUS_VERSION vVersion; /* Version. */ + WCHAR wszName[DMUS_MAX_NAME]; /* Name of object. */ + WCHAR wszCategory[DMUS_MAX_CATEGORY]; /* Category for object (optional). */ + WCHAR wszFileName[DMUS_MAX_FILENAME]; /* File path. */ + LONGLONG llMemLength; /* Size of Memory data. */ + LPBYTE pbMemData; /* Memory pointer for data. */ + IStream * pStream; /* Stream with data. */ +} DMUS_OBJECTDESC; + +typedef DMUS_OBJECTDESC *LPDMUS_OBJECTDESC; + +/* Flags for dwValidData. When set, a flag indicates that the */ +/* corresponding field in DMUSOBJECTDESC holds valid data. */ + +#define DMUS_OBJ_OBJECT (1 << 0) /* Object GUID is valid. */ +#define DMUS_OBJ_CLASS (1 << 1) /* Class GUID is valid. */ +#define DMUS_OBJ_NAME (1 << 2) /* Name is valid. */ +#define DMUS_OBJ_CATEGORY (1 << 3) /* Category is valid. */ +#define DMUS_OBJ_FILENAME (1 << 4) /* File path is valid. */ +#define DMUS_OBJ_FULLPATH (1 << 5) /* Path is full path. */ +#define DMUS_OBJ_URL (1 << 6) /* Path is URL. */ +#define DMUS_OBJ_VERSION (1 << 7) /* Version is valid. */ +#define DMUS_OBJ_DATE (1 << 8) /* Date is valid. */ +#define DMUS_OBJ_LOADED (1 << 9) /* Object is currently loaded in memory. */ +#define DMUS_OBJ_MEMORY (1 << 10) /* Object is pointed to by pbMemData. */ +#define DMUS_OBJ_STREAM (1 << 11) /* Object is stored in pStream. */ + +/* The DMUS_SCRIPT_ERRORINFO structure describes an error that occurred in a script. + It is returned by methods in IDirectMusicScript. */ +typedef struct _DMUS_SCRIPT_ERRORINFO +{ + DWORD dwSize; /* Size of this structure. */ + HRESULT hr; + ULONG ulLineNumber; + LONG ichCharPosition; + WCHAR wszSourceFile[DMUS_MAX_FILENAME]; + WCHAR wszSourceComponent[DMUS_MAX_FILENAME]; + WCHAR wszDescription[DMUS_MAX_FILENAME]; + WCHAR wszSourceLineText[DMUS_MAX_FILENAME]; +} DMUS_SCRIPT_ERRORINFO; + +/* Track configuration flags, used with IDirectMusicSegment8::SetTrackConfig() */ + +#define DMUS_TRACKCONFIG_OVERRIDE_ALL 1 /* This track should get parameters from this segment before controlling and primary tracks. */ +#define DMUS_TRACKCONFIG_OVERRIDE_PRIMARY 2 /* This track should get parameters from this segment before the primary segment tracks. */ +#define DMUS_TRACKCONFIG_FALLBACK 4 /* This track should get parameters from this segment if the primary and controlling segments don't succeed. */ +#define DMUS_TRACKCONFIG_CONTROL_ENABLED 8 /* GetParam() enabled for this track. */ +#define DMUS_TRACKCONFIG_PLAY_ENABLED 0x10 /* Play() enabled for this track. */ +#define DMUS_TRACKCONFIG_NOTIFICATION_ENABLED 0x20 /* Notifications enabled for this track. */ +#define DMUS_TRACKCONFIG_PLAY_CLOCKTIME 0x40 /* This track plays in clock time, not music time. */ +#define DMUS_TRACKCONFIG_PLAY_COMPOSE 0x80 /* This track should regenerate data each time it starts playing. */ +#define DMUS_TRACKCONFIG_LOOP_COMPOSE 0x100 /* This track should regenerate data each time it repeats. */ +#define DMUS_TRACKCONFIG_COMPOSING 0x200 /* This track is used to compose other tracks. */ +#define DMUS_TRACKCONFIG_CONTROL_PLAY 0x10000 /* This track, when played in a controlling segment, overrides playback of primary segment tracks. */ +#define DMUS_TRACKCONFIG_CONTROL_NOTIFICATION 0x20000 /* This track, when played in a controlling segment, overrides notification of primary segment tracks. */ +/* Additional track config flags for composing transitions */ +#define DMUS_TRACKCONFIG_TRANS1_FROMSEGSTART 0x400 /* Get track info from start of From segment */ +#define DMUS_TRACKCONFIG_TRANS1_FROMSEGCURRENT 0x800 /* Get track info from current place in From segment */ +#define DMUS_TRACKCONFIG_TRANS1_TOSEGSTART 0x1000 /* Get track info from start of To segment */ +#define DMUS_TRACKCONFIG_DEFAULT (DMUS_TRACKCONFIG_CONTROL_ENABLED | DMUS_TRACKCONFIG_PLAY_ENABLED | DMUS_TRACKCONFIG_NOTIFICATION_ENABLED) + +/* Get/SetParam structs for commands */ +/* PARAM structures, used by GetParam() and SetParam() */ +typedef struct _DMUS_COMMAND_PARAM +{ + BYTE bCommand; + BYTE bGrooveLevel; + BYTE bGrooveRange; + BYTE bRepeatMode; +} DMUS_COMMAND_PARAM; + +typedef struct _DMUS_COMMAND_PARAM_2 +{ + MUSIC_TIME mtTime; + BYTE bCommand; + BYTE bGrooveLevel; + BYTE bGrooveRange; + BYTE bRepeatMode; +} DMUS_COMMAND_PARAM_2; + +typedef IDirectMusicObject __RPC_FAR *LPDMUS_OBJECT; +typedef IDirectMusicLoader __RPC_FAR *LPDMUS_LOADER; +typedef IDirectMusicBand __RPC_FAR *LPDMUS_BAND; + +#define DMUSB_LOADED (1 << 0) /* Set when band has been loaded */ +#define DMUSB_DEFAULT (1 << 1) /* Set when band is default band for a style */ + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicBand */ +#undef INTERFACE +#define INTERFACE IDirectMusicBand +DECLARE_INTERFACE_(IDirectMusicBand, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicBand */ + STDMETHOD(CreateSegment) (THIS_ IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(Download) (THIS_ IDirectMusicPerformance* pPerformance) PURE; + STDMETHOD(Unload) (THIS_ IDirectMusicPerformance* pPerformance) PURE; +}; + +typedef IDirectMusicBand IDirectMusicBand8; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicObject */ +#undef INTERFACE +#define INTERFACE IDirectMusicObject +DECLARE_INTERFACE_(IDirectMusicObject, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicObject */ + STDMETHOD(GetDescriptor) (THIS_ LPDMUS_OBJECTDESC pDesc) PURE; + STDMETHOD(SetDescriptor) (THIS_ LPDMUS_OBJECTDESC pDesc) PURE; + STDMETHOD(ParseDescriptor) (THIS_ LPSTREAM pStream, + LPDMUS_OBJECTDESC pDesc) PURE; +}; + +typedef IDirectMusicObject IDirectMusicObject8; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicLoader */ +#undef INTERFACE +#define INTERFACE IDirectMusicLoader +DECLARE_INTERFACE_(IDirectMusicLoader, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicLoader */ + STDMETHOD(GetObject) (THIS_ LPDMUS_OBJECTDESC pDesc, + REFIID riid, + LPVOID FAR *ppv) PURE; + STDMETHOD(SetObject) (THIS_ LPDMUS_OBJECTDESC pDesc) PURE; + STDMETHOD(SetSearchDirectory) (THIS_ REFGUID rguidClass, + WCHAR *pwzPath, + BOOL fClear) PURE; + STDMETHOD(ScanDirectory) (THIS_ REFGUID rguidClass, + WCHAR *pwzFileExtension, + WCHAR *pwzScanFileName) PURE; + STDMETHOD(CacheObject) (THIS_ IDirectMusicObject * pObject) PURE; + STDMETHOD(ReleaseObject) (THIS_ IDirectMusicObject * pObject) PURE; + STDMETHOD(ClearCache) (THIS_ REFGUID rguidClass) PURE; + STDMETHOD(EnableCache) (THIS_ REFGUID rguidClass, + BOOL fEnable) PURE; + STDMETHOD(EnumObject) (THIS_ REFGUID rguidClass, + DWORD dwIndex, + LPDMUS_OBJECTDESC pDesc) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicLoader8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicLoader8 +DECLARE_INTERFACE_(IDirectMusicLoader8, IDirectMusicLoader) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicLoader */ + STDMETHOD(GetObject) (THIS_ LPDMUS_OBJECTDESC pDesc, + REFIID riid, + LPVOID FAR *ppv) PURE; + STDMETHOD(SetObject) (THIS_ LPDMUS_OBJECTDESC pDesc) PURE; + STDMETHOD(SetSearchDirectory) (THIS_ REFGUID rguidClass, + WCHAR *pwzPath, + BOOL fClear) PURE; + STDMETHOD(ScanDirectory) (THIS_ REFGUID rguidClass, + WCHAR *pwzFileExtension, + WCHAR *pwzScanFileName) PURE; + STDMETHOD(CacheObject) (THIS_ IDirectMusicObject * pObject) PURE; + STDMETHOD(ReleaseObject) (THIS_ IDirectMusicObject * pObject) PURE; + STDMETHOD(ClearCache) (THIS_ REFGUID rguidClass) PURE; + STDMETHOD(EnableCache) (THIS_ REFGUID rguidClass, + BOOL fEnable) PURE; + STDMETHOD(EnumObject) (THIS_ REFGUID rguidClass, + DWORD dwIndex, + LPDMUS_OBJECTDESC pDesc) PURE; + + /* IDirectMusicLoader8 */ + STDMETHOD_(void, CollectGarbage) (THIS) PURE; + STDMETHOD(ReleaseObjectByUnknown) (THIS_ IUnknown *pObject) PURE; + STDMETHOD(LoadObjectFromFile) (THIS_ REFGUID rguidClassID, + REFIID iidInterfaceID, + WCHAR *pwzFilePath, + void ** ppObject) PURE; +}; + +/* Stream object supports IDirectMusicGetLoader interface to access loader while file parsing. */ + +#undef INTERFACE +#define INTERFACE IDirectMusicGetLoader +DECLARE_INTERFACE_(IDirectMusicGetLoader, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicGetLoader */ + STDMETHOD(GetLoader) (THIS_ IDirectMusicLoader ** ppLoader) PURE; +}; + +typedef IDirectMusicGetLoader IDirectMusicGetLoader8; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicSegment */ +#undef INTERFACE +#define INTERFACE IDirectMusicSegment +DECLARE_INTERFACE_(IDirectMusicSegment, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSegment */ + STDMETHOD(GetLength) (THIS_ MUSIC_TIME* pmtLength) PURE; + STDMETHOD(SetLength) (THIS_ MUSIC_TIME mtLength) PURE; + STDMETHOD(GetRepeats) (THIS_ DWORD* pdwRepeats) PURE; + STDMETHOD(SetRepeats) (THIS_ DWORD dwRepeats) PURE; + STDMETHOD(GetDefaultResolution) (THIS_ DWORD* pdwResolution) PURE; + STDMETHOD(SetDefaultResolution) (THIS_ DWORD dwResolution) PURE; + STDMETHOD(GetTrack) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + IDirectMusicTrack** ppTrack) PURE; + STDMETHOD(GetTrackGroup) (THIS_ IDirectMusicTrack* pTrack, + DWORD* pdwGroupBits) PURE; + STDMETHOD(InsertTrack) (THIS_ IDirectMusicTrack* pTrack, + DWORD dwGroupBits) PURE; + STDMETHOD(RemoveTrack) (THIS_ IDirectMusicTrack* pTrack) PURE; + STDMETHOD(InitPlay) (THIS_ IDirectMusicSegmentState** ppSegState, + IDirectMusicPerformance* pPerformance, + DWORD dwFlags) PURE; + STDMETHOD(GetGraph) (THIS_ IDirectMusicGraph** ppGraph) PURE; + STDMETHOD(SetGraph) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(Clone) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(SetStartPoint) (THIS_ MUSIC_TIME mtStart) PURE; + STDMETHOD(GetStartPoint) (THIS_ MUSIC_TIME* pmtStart) PURE; + STDMETHOD(SetLoopPoints) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd) PURE; + STDMETHOD(GetLoopPoints) (THIS_ MUSIC_TIME* pmtStart, + MUSIC_TIME* pmtEnd) PURE; + STDMETHOD(SetPChannelsUsed) (THIS_ DWORD dwNumPChannels, + DWORD* paPChannels) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicSegment8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicSegment8 +DECLARE_INTERFACE_(IDirectMusicSegment8, IDirectMusicSegment) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSegment */ + STDMETHOD(GetLength) (THIS_ MUSIC_TIME* pmtLength) PURE; + STDMETHOD(SetLength) (THIS_ MUSIC_TIME mtLength) PURE; + STDMETHOD(GetRepeats) (THIS_ DWORD* pdwRepeats) PURE; + STDMETHOD(SetRepeats) (THIS_ DWORD dwRepeats) PURE; + STDMETHOD(GetDefaultResolution) (THIS_ DWORD* pdwResolution) PURE; + STDMETHOD(SetDefaultResolution) (THIS_ DWORD dwResolution) PURE; + STDMETHOD(GetTrack) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + IDirectMusicTrack** ppTrack) PURE; + STDMETHOD(GetTrackGroup) (THIS_ IDirectMusicTrack* pTrack, + DWORD* pdwGroupBits) PURE; + STDMETHOD(InsertTrack) (THIS_ IDirectMusicTrack* pTrack, + DWORD dwGroupBits) PURE; + STDMETHOD(RemoveTrack) (THIS_ IDirectMusicTrack* pTrack) PURE; + STDMETHOD(InitPlay) (THIS_ IDirectMusicSegmentState** ppSegState, + IDirectMusicPerformance* pPerformance, + DWORD dwFlags) PURE; + STDMETHOD(GetGraph) (THIS_ IDirectMusicGraph** ppGraph) PURE; + STDMETHOD(SetGraph) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(Clone) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(SetStartPoint) (THIS_ MUSIC_TIME mtStart) PURE; + STDMETHOD(GetStartPoint) (THIS_ MUSIC_TIME* pmtStart) PURE; + STDMETHOD(SetLoopPoints) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd) PURE; + STDMETHOD(GetLoopPoints) (THIS_ MUSIC_TIME* pmtStart, + MUSIC_TIME* pmtEnd) PURE; + STDMETHOD(SetPChannelsUsed) (THIS_ DWORD dwNumPChannels, + DWORD* paPChannels) PURE; + /* IDirectMusicSegment8 */ + STDMETHOD(SetTrackConfig) (THIS_ REFGUID rguidTrackClassID, /* Class ID of the type of track on which to set the configuration flags. */ + DWORD dwGroupBits, /* Group bits. */ + DWORD dwIndex, /* Nth track (or DMUS_SEG_ALLTRACKS) that matches class id and group id. */ + DWORD dwFlagsOn, /* DMUS_TRACKCONFIG_ flags to enable. */ + DWORD dwFlagsOff) PURE; /* DMUS_TRACKCONFIG_ flags to disable. */ + STDMETHOD(GetAudioPathConfig) (THIS_ IUnknown ** ppAudioPathConfig) PURE; + STDMETHOD(Compose) (THIS_ MUSIC_TIME mtTime, + IDirectMusicSegment* pFromSegment, + IDirectMusicSegment* pToSegment, + IDirectMusicSegment** ppComposedSegment) PURE; + STDMETHOD(Download) (THIS_ IUnknown *pAudioPath) PURE; + STDMETHOD(Unload) (THIS_ IUnknown *pAudioPath) PURE; +}; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicSegmentState */ +#undef INTERFACE +#define INTERFACE IDirectMusicSegmentState +DECLARE_INTERFACE_(IDirectMusicSegmentState, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSegmentState */ + STDMETHOD(GetRepeats) (THIS_ DWORD* pdwRepeats) PURE; + STDMETHOD(GetSegment ) (THIS_ IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(GetStartTime) (THIS_ MUSIC_TIME* pmtStart) PURE; + STDMETHOD(GetSeek) (THIS_ MUSIC_TIME* pmtSeek) PURE; + STDMETHOD(GetStartPoint) (THIS_ MUSIC_TIME* pmtStart) PURE; +}; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicSegmentState8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicSegmentState8 +DECLARE_INTERFACE_(IDirectMusicSegmentState8, IDirectMusicSegmentState) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSegmentState */ + STDMETHOD(GetRepeats) (THIS_ DWORD* pdwRepeats) PURE; + STDMETHOD(GetSegment ) (THIS_ IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(GetStartTime) (THIS_ MUSIC_TIME* pmtStart) PURE; + STDMETHOD(GetSeek) (THIS_ MUSIC_TIME* pmtSeek) PURE; + STDMETHOD(GetStartPoint) (THIS_ MUSIC_TIME* pmtStart) PURE; + + /* IDirectMusicSegmentState8 */ + STDMETHOD(SetTrackConfig) (THIS_ REFGUID rguidTrackClassID, /* Class ID of the type of track on which to set the configuration flags. */ + DWORD dwGroupBits, /* Group bits. */ + DWORD dwIndex, /* Nth track (or DMUS_SEG_ALLTRACKS) that matches class id and group id. */ + DWORD dwFlagsOn, /* DMUS_TRACKCONFIG_ flags to enable. */ + DWORD dwFlagsOff) PURE; /* DMUS_TRACKCONFIG_ flags to disable. */ + STDMETHOD(GetObjectInPath) (THIS_ DWORD dwPChannel, /* PChannel to search. */ + DWORD dwStage, /* Which stage in the path. */ + DWORD dwBuffer, /* Which buffer to address, if more than one. */ + REFGUID guidObject, /* ClassID of object. */ + DWORD dwIndex, /* Which object of that class. */ + REFGUID iidInterface,/* Requested COM interface. */ + void ** ppObject) PURE; /* Pointer to interface. */ +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicAudioPath */ +#undef INTERFACE +#define INTERFACE IDirectMusicAudioPath +DECLARE_INTERFACE_(IDirectMusicAudioPath, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicAudioPath */ + STDMETHOD(GetObjectInPath) (THIS_ DWORD dwPChannel, /* PChannel to search. */ + DWORD dwStage, /* Which stage in the path. */ + DWORD dwBuffer, /* Which buffer to address, if more than one. */ + REFGUID guidObject, /* ClassID of object. */ + DWORD dwIndex, /* Which object of that class. */ + REFGUID iidInterface,/* Requested COM interface. */ + void ** ppObject) PURE; /* Pointer to interface. */ + STDMETHOD(Activate) (THIS_ BOOL fActivate) PURE;/* True to activate, False to deactivate. */ + STDMETHOD(SetVolume) (THIS_ long lVolume, /* Gain, in 100ths of a dB. This must be negative (0 represents full volume.) */ + DWORD dwDuration) PURE;/* Duration of volume ramp in milliseconds. Note that 0 is more efficient. */ + STDMETHOD(ConvertPChannel) (THIS_ DWORD dwPChannelIn, /* Pchannel of source. */ + DWORD *pdwPChannelOut) PURE; /* Equivalent pchannel on performance. */ +}; + +typedef IDirectMusicAudioPath IDirectMusicAudioPath8; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicPerformance */ +#undef INTERFACE +#define INTERFACE IDirectMusicPerformance +DECLARE_INTERFACE_(IDirectMusicPerformance, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPerformance */ + STDMETHOD(Init) (THIS_ IDirectMusic** ppDirectMusic, + LPDIRECTSOUND pDirectSound, + HWND hWnd) PURE; + STDMETHOD(PlaySegment) (THIS_ IDirectMusicSegment* pSegment, + DWORD dwFlags, + __int64 i64StartTime, + IDirectMusicSegmentState** ppSegmentState) PURE; + STDMETHOD(Stop) (THIS_ IDirectMusicSegment* pSegment, + IDirectMusicSegmentState* pSegmentState, + MUSIC_TIME mtTime, + DWORD dwFlags) PURE; + STDMETHOD(GetSegmentState) (THIS_ IDirectMusicSegmentState** ppSegmentState, + MUSIC_TIME mtTime) PURE; + STDMETHOD(SetPrepareTime) (THIS_ DWORD dwMilliSeconds) PURE; + STDMETHOD(GetPrepareTime) (THIS_ DWORD* pdwMilliSeconds) PURE; + STDMETHOD(SetBumperLength) (THIS_ DWORD dwMilliSeconds) PURE; + STDMETHOD(GetBumperLength) (THIS_ DWORD* pdwMilliSeconds) PURE; + STDMETHOD(SendPMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(MusicToReferenceTime) (THIS_ MUSIC_TIME mtTime, + REFERENCE_TIME* prtTime) PURE; + STDMETHOD(ReferenceToMusicTime) (THIS_ REFERENCE_TIME rtTime, + MUSIC_TIME* pmtTime) PURE; + STDMETHOD(IsPlaying) (THIS_ IDirectMusicSegment* pSegment, + IDirectMusicSegmentState* pSegState) PURE; + STDMETHOD(GetTime) (THIS_ REFERENCE_TIME* prtNow, + MUSIC_TIME* pmtNow) PURE; + STDMETHOD(AllocPMsg) (THIS_ ULONG cb, + DMUS_PMSG** ppPMSG) PURE; + STDMETHOD(FreePMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(GetGraph) (THIS_ IDirectMusicGraph** ppGraph) PURE; + STDMETHOD(SetGraph) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(SetNotificationHandle)(THIS_ HANDLE hNotification, + REFERENCE_TIME rtMinimum) PURE; + STDMETHOD(GetNotificationPMsg) (THIS_ DMUS_NOTIFICATION_PMSG** ppNotificationPMsg) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType)(THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(AddPort) (THIS_ IDirectMusicPort* pPort) PURE; + STDMETHOD(RemovePort) (THIS_ IDirectMusicPort* pPort ) PURE; + STDMETHOD(AssignPChannelBlock) (THIS_ DWORD dwBlockNum, + IDirectMusicPort* pPort, + DWORD dwGroup ) PURE; + STDMETHOD(AssignPChannel) (THIS_ DWORD dwPChannel, + IDirectMusicPort* pPort, + DWORD dwGroup, + DWORD dwMChannel ) PURE; + STDMETHOD(PChannelInfo) (THIS_ DWORD dwPChannel, + IDirectMusicPort** ppPort, + DWORD* pdwGroup, + DWORD* pdwMChannel ) PURE; + STDMETHOD(DownloadInstrument) (THIS_ IDirectMusicInstrument* pInst, + DWORD dwPChannel, + IDirectMusicDownloadedInstrument** ppDownInst, + DMUS_NOTERANGE* pNoteRanges, + DWORD dwNumNoteRanges, + IDirectMusicPort** ppPort, + DWORD* pdwGroup, + DWORD* pdwMChannel ) PURE; + STDMETHOD(Invalidate) (THIS_ MUSIC_TIME mtTime, + DWORD dwFlags) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(GetGlobalParam) (THIS_ REFGUID rguidType, + void* pParam, + DWORD dwSize) PURE; + STDMETHOD(SetGlobalParam) (THIS_ REFGUID rguidType, + void* pParam, + DWORD dwSize) PURE; + STDMETHOD(GetLatencyTime) (THIS_ REFERENCE_TIME* prtTime) PURE; + STDMETHOD(GetQueueTime) (THIS_ REFERENCE_TIME* prtTime) PURE; + STDMETHOD(AdjustTime) (THIS_ REFERENCE_TIME rtAmount) PURE; + STDMETHOD(CloseDown) (THIS) PURE; + STDMETHOD(GetResolvedTime) (THIS_ REFERENCE_TIME rtTime, + REFERENCE_TIME* prtResolved, + DWORD dwTimeResolveFlags) PURE; + STDMETHOD(MIDIToMusic) (THIS_ BYTE bMIDIValue, + DMUS_CHORD_KEY* pChord, + BYTE bPlayMode, + BYTE bChordLevel, + WORD *pwMusicValue) PURE; + STDMETHOD(MusicToMIDI) (THIS_ WORD wMusicValue, + DMUS_CHORD_KEY* pChord, + BYTE bPlayMode, + BYTE bChordLevel, + BYTE *pbMIDIValue) PURE; + STDMETHOD(TimeToRhythm) (THIS_ MUSIC_TIME mtTime, + DMUS_TIMESIGNATURE *pTimeSig, + WORD *pwMeasure, + BYTE *pbBeat, + BYTE *pbGrid, + short *pnOffset) PURE; + STDMETHOD(RhythmToTime) (THIS_ WORD wMeasure, + BYTE bBeat, + BYTE bGrid, + short nOffset, + DMUS_TIMESIGNATURE *pTimeSig, + MUSIC_TIME *pmtTime) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicPerformance8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicPerformance8 +DECLARE_INTERFACE_(IDirectMusicPerformance8, IDirectMusicPerformance) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPerformance */ + STDMETHOD(Init) (THIS_ IDirectMusic** ppDirectMusic, + LPDIRECTSOUND pDirectSound, + HWND hWnd) PURE; + STDMETHOD(PlaySegment) (THIS_ IDirectMusicSegment* pSegment, + DWORD dwFlags, + __int64 i64StartTime, + IDirectMusicSegmentState** ppSegmentState) PURE; + STDMETHOD(Stop) (THIS_ IDirectMusicSegment* pSegment, + IDirectMusicSegmentState* pSegmentState, + MUSIC_TIME mtTime, + DWORD dwFlags) PURE; + STDMETHOD(GetSegmentState) (THIS_ IDirectMusicSegmentState** ppSegmentState, + MUSIC_TIME mtTime) PURE; + STDMETHOD(SetPrepareTime) (THIS_ DWORD dwMilliSeconds) PURE; + STDMETHOD(GetPrepareTime) (THIS_ DWORD* pdwMilliSeconds) PURE; + STDMETHOD(SetBumperLength) (THIS_ DWORD dwMilliSeconds) PURE; + STDMETHOD(GetBumperLength) (THIS_ DWORD* pdwMilliSeconds) PURE; + STDMETHOD(SendPMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(MusicToReferenceTime) (THIS_ MUSIC_TIME mtTime, + REFERENCE_TIME* prtTime) PURE; + STDMETHOD(ReferenceToMusicTime) (THIS_ REFERENCE_TIME rtTime, + MUSIC_TIME* pmtTime) PURE; + STDMETHOD(IsPlaying) (THIS_ IDirectMusicSegment* pSegment, + IDirectMusicSegmentState* pSegState) PURE; + STDMETHOD(GetTime) (THIS_ REFERENCE_TIME* prtNow, + MUSIC_TIME* pmtNow) PURE; + STDMETHOD(AllocPMsg) (THIS_ ULONG cb, + DMUS_PMSG** ppPMSG) PURE; + STDMETHOD(FreePMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(GetGraph) (THIS_ IDirectMusicGraph** ppGraph) PURE; + STDMETHOD(SetGraph) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(SetNotificationHandle)(THIS_ HANDLE hNotification, + REFERENCE_TIME rtMinimum) PURE; + STDMETHOD(GetNotificationPMsg) (THIS_ DMUS_NOTIFICATION_PMSG** ppNotificationPMsg) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType)(THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(AddPort) (THIS_ IDirectMusicPort* pPort) PURE; + STDMETHOD(RemovePort) (THIS_ IDirectMusicPort* pPort ) PURE; + STDMETHOD(AssignPChannelBlock) (THIS_ DWORD dwBlockNum, + IDirectMusicPort* pPort, + DWORD dwGroup ) PURE; + STDMETHOD(AssignPChannel) (THIS_ DWORD dwPChannel, + IDirectMusicPort* pPort, + DWORD dwGroup, + DWORD dwMChannel ) PURE; + STDMETHOD(PChannelInfo) (THIS_ DWORD dwPChannel, + IDirectMusicPort** ppPort, + DWORD* pdwGroup, + DWORD* pdwMChannel ) PURE; + STDMETHOD(DownloadInstrument) (THIS_ IDirectMusicInstrument* pInst, + DWORD dwPChannel, + IDirectMusicDownloadedInstrument** ppDownInst, + DMUS_NOTERANGE* pNoteRanges, + DWORD dwNumNoteRanges, + IDirectMusicPort** ppPort, + DWORD* pdwGroup, + DWORD* pdwMChannel ) PURE; + STDMETHOD(Invalidate) (THIS_ MUSIC_TIME mtTime, + DWORD dwFlags) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(GetGlobalParam) (THIS_ REFGUID rguidType, + void* pParam, + DWORD dwSize) PURE; + STDMETHOD(SetGlobalParam) (THIS_ REFGUID rguidType, + void* pParam, + DWORD dwSize) PURE; + STDMETHOD(GetLatencyTime) (THIS_ REFERENCE_TIME* prtTime) PURE; + STDMETHOD(GetQueueTime) (THIS_ REFERENCE_TIME* prtTime) PURE; + STDMETHOD(AdjustTime) (THIS_ REFERENCE_TIME rtAmount) PURE; + STDMETHOD(CloseDown) (THIS) PURE; + STDMETHOD(GetResolvedTime) (THIS_ REFERENCE_TIME rtTime, + REFERENCE_TIME* prtResolved, + DWORD dwTimeResolveFlags) PURE; + STDMETHOD(MIDIToMusic) (THIS_ BYTE bMIDIValue, + DMUS_CHORD_KEY* pChord, + BYTE bPlayMode, + BYTE bChordLevel, + WORD *pwMusicValue) PURE; + STDMETHOD(MusicToMIDI) (THIS_ WORD wMusicValue, + DMUS_CHORD_KEY* pChord, + BYTE bPlayMode, + BYTE bChordLevel, + BYTE *pbMIDIValue) PURE; + STDMETHOD(TimeToRhythm) (THIS_ MUSIC_TIME mtTime, + DMUS_TIMESIGNATURE *pTimeSig, + WORD *pwMeasure, + BYTE *pbBeat, + BYTE *pbGrid, + short *pnOffset) PURE; + STDMETHOD(RhythmToTime) (THIS_ WORD wMeasure, + BYTE bBeat, + BYTE bGrid, + short nOffset, + DMUS_TIMESIGNATURE *pTimeSig, + MUSIC_TIME *pmtTime) PURE; + /* IDirectMusicPerformance8 */ + STDMETHOD(InitAudio) (THIS_ IDirectMusic** ppDirectMusic, /* Optional DirectMusic pointer. */ + IDirectSound** ppDirectSound, /* Optional DirectSound pointer. */ + HWND hWnd, /* HWND for DirectSound. */ + DWORD dwDefaultPathType, /* Requested default audio path type, also optional. */ + DWORD dwPChannelCount, /* Number of PChannels, if default audio path to be created. */ + DWORD dwFlags, /* DMUS_AUDIOF flags, if no pParams structure. */ + DMUS_AUDIOPARAMS *pParams) PURE; /* Optional initialization structure, defining required voices, buffers, etc. */ + STDMETHOD(PlaySegmentEx) (THIS_ IUnknown* pSource, /* Segment to play. */ + WCHAR *pwzSegmentName, /* Not supported in DX8. */ + IUnknown* pTransition, /* Optional template segment to compose transition with. */ + DWORD dwFlags, /* DMUS_SEGF_ flags. */ + __int64 i64StartTime, /* Time to start playback. */ + IDirectMusicSegmentState** ppSegmentState, /* Returned Segment State. */ + IUnknown *pFrom, /* Optional segmentstate or audiopath to replace. */ + IUnknown *pAudioPath) PURE; /* Optional audioPath to play on. */ + STDMETHOD(StopEx) (THIS_ IUnknown *pObjectToStop, /* Segstate, AudioPath, or Segment. */ + __int64 i64StopTime, + DWORD dwFlags) PURE; + STDMETHOD(ClonePMsg) (THIS_ DMUS_PMSG* pSourcePMSG, + DMUS_PMSG** ppCopyPMSG) PURE; + STDMETHOD(CreateAudioPath) (THIS_ IUnknown *pSourceConfig, /* Source configuration, from AudioPathConfig file. */ + BOOL fActivate, /* TRUE to activate on creation. */ + IDirectMusicAudioPath **ppNewPath) PURE; /* Returns created audiopath. */ + STDMETHOD(CreateStandardAudioPath)(THIS_ DWORD dwType, /* Type of path to create. */ + DWORD dwPChannelCount, /* How many PChannels to allocate for it. */ + BOOL fActivate, /* TRUE to activate on creation. */ + IDirectMusicAudioPath **ppNewPath) PURE; /* Returns created audiopath. */ + STDMETHOD(SetDefaultAudioPath) (THIS_ IDirectMusicAudioPath *pAudioPath) PURE; + STDMETHOD(GetDefaultAudioPath) (THIS_ IDirectMusicAudioPath **ppAudioPath) PURE; + STDMETHOD(GetParamEx) (THIS_ REFGUID rguidType, /* GetParam command ID. */ + DWORD dwTrackID, /* Virtual track ID of caller. */ + DWORD dwGroupBits, /* Group bits of caller. */ + DWORD dwIndex, /* Index to Nth parameter. */ + MUSIC_TIME mtTime, /* Time of requested parameter. */ + MUSIC_TIME* pmtNext, /* Returned delta to next parameter. */ + void* pParam) PURE; /* Data structure to fill with parameter. */ +}; + + + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicGraph */ +#undef INTERFACE +#define INTERFACE IDirectMusicGraph +DECLARE_INTERFACE_(IDirectMusicGraph, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicGraph */ + STDMETHOD(StampPMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(InsertTool) (THIS_ IDirectMusicTool* pTool, + DWORD* pdwPChannels, + DWORD cPChannels, + LONG lIndex) PURE; + STDMETHOD(GetTool) (THIS_ DWORD dwIndex, + IDirectMusicTool** ppTool) PURE; + STDMETHOD(RemoveTool) (THIS_ IDirectMusicTool* pTool) PURE; +}; + +typedef IDirectMusicGraph IDirectMusicGraph8; + + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicStyle */ +#undef INTERFACE +#define INTERFACE IDirectMusicStyle +DECLARE_INTERFACE_(IDirectMusicStyle, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicStyle */ + STDMETHOD(GetBand) (THIS_ WCHAR* pwszName, + IDirectMusicBand** ppBand) PURE; + STDMETHOD(EnumBand) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(GetDefaultBand) (THIS_ IDirectMusicBand** ppBand) PURE; + STDMETHOD(EnumMotif) (THIS_ DWORD dwIndex, + WCHAR* pwszName) PURE; + STDMETHOD(GetMotif) (THIS_ WCHAR* pwszName, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(GetDefaultChordMap) (THIS_ IDirectMusicChordMap** ppChordMap) PURE; + STDMETHOD(EnumChordMap) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(GetChordMap) (THIS_ WCHAR* pwszName, + IDirectMusicChordMap** ppChordMap) PURE; + STDMETHOD(GetTimeSignature) (THIS_ DMUS_TIMESIGNATURE* pTimeSig) PURE; + STDMETHOD(GetEmbellishmentLength) (THIS_ DWORD dwType, + DWORD dwLevel, + DWORD* pdwMin, + DWORD* pdwMax) PURE; + STDMETHOD(GetTempo) (THIS_ double* pTempo) PURE; +}; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicStyle8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicStyle8 +DECLARE_INTERFACE_(IDirectMusicStyle8, IDirectMusicStyle) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicStyle */ + STDMETHOD(GetBand) (THIS_ WCHAR* pwszName, + IDirectMusicBand** ppBand) PURE; + STDMETHOD(EnumBand) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(GetDefaultBand) (THIS_ IDirectMusicBand** ppBand) PURE; + STDMETHOD(EnumMotif) (THIS_ DWORD dwIndex, + WCHAR* pwszName) PURE; + STDMETHOD(GetMotif) (THIS_ WCHAR* pwszName, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(GetDefaultChordMap) (THIS_ IDirectMusicChordMap** ppChordMap) PURE; + STDMETHOD(EnumChordMap) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(GetChordMap) (THIS_ WCHAR* pwszName, + IDirectMusicChordMap** ppChordMap) PURE; + STDMETHOD(GetTimeSignature) (THIS_ DMUS_TIMESIGNATURE* pTimeSig) PURE; + STDMETHOD(GetEmbellishmentLength) (THIS_ DWORD dwType, + DWORD dwLevel, + DWORD* pdwMin, + DWORD* pdwMax) PURE; + STDMETHOD(GetTempo) (THIS_ double* pTempo) PURE; + + /* IDirectMusicStyle8 */ + STDMETHOD(EnumPattern) (THIS_ DWORD dwIndex, + DWORD dwPatternType, + WCHAR* pwszName) PURE; +}; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicChordMap */ +#undef INTERFACE +#define INTERFACE IDirectMusicChordMap +DECLARE_INTERFACE_(IDirectMusicChordMap, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicChordMap */ + STDMETHOD(GetScale) (THIS_ DWORD* pdwScale) PURE; +}; + +typedef IDirectMusicChordMap IDirectMusicChordMap8; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicComposer */ +#undef INTERFACE +#define INTERFACE IDirectMusicComposer +DECLARE_INTERFACE_(IDirectMusicComposer, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicComposer */ + STDMETHOD(ComposeSegmentFromTemplate) (THIS_ IDirectMusicStyle* pStyle, + IDirectMusicSegment* pTemplate, + WORD wActivity, + IDirectMusicChordMap* pChordMap, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(ComposeSegmentFromShape) (THIS_ IDirectMusicStyle* pStyle, + WORD wNumMeasures, + WORD wShape, + WORD wActivity, + BOOL fIntro, + BOOL fEnd, + IDirectMusicChordMap* pChordMap, + IDirectMusicSegment** ppSegment ) PURE; + STDMETHOD(ComposeTransition) (THIS_ IDirectMusicSegment* pFromSeg, + IDirectMusicSegment* pToSeg, + MUSIC_TIME mtTime, + WORD wCommand, + DWORD dwFlags, + IDirectMusicChordMap* pChordMap, + IDirectMusicSegment** ppTransSeg) PURE; + STDMETHOD(AutoTransition) (THIS_ IDirectMusicPerformance* pPerformance, + IDirectMusicSegment* pToSeg, + WORD wCommand, + DWORD dwFlags, + IDirectMusicChordMap* pChordMap, + IDirectMusicSegment** ppTransSeg, + IDirectMusicSegmentState** ppToSegState, + IDirectMusicSegmentState** ppTransSegState) PURE; + STDMETHOD(ComposeTemplateFromShape) (THIS_ WORD wNumMeasures, + WORD wShape, + BOOL fIntro, + BOOL fEnd, + WORD wEndLength, + IDirectMusicSegment** ppTemplate) PURE; + STDMETHOD(ChangeChordMap) (THIS_ IDirectMusicSegment* pSegment, + BOOL fTrackScale, + IDirectMusicChordMap* pChordMap) PURE; +}; + +typedef IDirectMusicComposer IDirectMusicComposer8; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicPatternTrack */ + +#undef INTERFACE +#define INTERFACE IDirectMusicPatternTrack +DECLARE_INTERFACE_(IDirectMusicPatternTrack, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPatternTrack */ + STDMETHOD(CreateSegment) (THIS_ IDirectMusicStyle* pStyle, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(SetVariation) (THIS_ IDirectMusicSegmentState* pSegState, + DWORD dwVariationFlags, + DWORD dwPart) PURE; + STDMETHOD(SetPatternByName) (THIS_ IDirectMusicSegmentState* pSegState, + WCHAR* wszName, + IDirectMusicStyle* pStyle, + DWORD dwPatternType, + DWORD* pdwLength) PURE; +}; + +typedef IDirectMusicPatternTrack IDirectMusicPatternTrack8; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicScript */ + +#undef INTERFACE +#define INTERFACE IDirectMusicScript +DECLARE_INTERFACE_(IDirectMusicScript, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicScript */ + STDMETHOD(Init) (THIS_ IDirectMusicPerformance *pPerformance, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(CallRoutine) (THIS_ WCHAR *pwszRoutineName, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(SetVariableVariant) (THIS_ WCHAR *pwszVariableName, + VARIANT varValue, + BOOL fSetRef, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(GetVariableVariant) (THIS_ WCHAR *pwszVariableName, + VARIANT *pvarValue, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(SetVariableNumber) (THIS_ WCHAR *pwszVariableName, + LONG lValue, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(GetVariableNumber) (THIS_ WCHAR *pwszVariableName, + LONG *plValue, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(SetVariableObject) (THIS_ WCHAR *pwszVariableName, + IUnknown *punkValue, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(GetVariableObject) (THIS_ WCHAR *pwszVariableName, + REFIID riid, + LPVOID FAR *ppv, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(EnumRoutine) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(EnumVariable) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; +}; + +typedef IDirectMusicScript IDirectMusicScript8; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicContainer */ + +#undef INTERFACE +#define INTERFACE IDirectMusicContainer +DECLARE_INTERFACE_(IDirectMusicContainer, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicContainer */ + STDMETHOD(EnumObject) (THIS_ REFGUID rguidClass, + DWORD dwIndex, + LPDMUS_OBJECTDESC pDesc, + WCHAR *pwszAlias) PURE; +}; + +typedef IDirectMusicContainer IDirectMusicContainer8; + +/* CLSID's */ +DEFINE_GUID(CLSID_DirectMusicPerformance,0xd2ac2881, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSegment,0xd2ac2882, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSegmentState,0xd2ac2883, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicGraph,0xd2ac2884, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicStyle,0xd2ac288a, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicChordMap,0xd2ac288f, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicComposer,0xd2ac2890, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicLoader,0xd2ac2892, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicBand,0x79ba9e00, 0xb6ee, 0x11d1, 0x86, 0xbe, 0x0, 0xc0, 0x4f, 0xbf, 0x8f, 0xef); + +/* New CLSID's for DX8 */ +DEFINE_GUID(CLSID_DirectMusicPatternTrack,0xd2ac2897, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicScript,0x810b5013, 0xe88d, 0x11d2, 0x8b, 0xc1, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {810B5013-E88D-11d2-8BC1-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicContainer,0x9301e380, 0x1f22, 0x11d3, 0x82, 0x26, 0xd2, 0xfa, 0x76, 0x25, 0x5d, 0x47); +DEFINE_GUID(CLSID_DirectSoundWave,0x8a667154, 0xf9cb, 0x11d2, 0xad, 0x8a, 0x0, 0x60, 0xb0, 0x57, 0x5a, 0xbc); +DEFINE_GUID(CLSID_DirectMusicAudioPathConfig,0xee0b9ca0, 0xa81e, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); + +/* Special GUID for all object types. This is used by the loader. */ +DEFINE_GUID(GUID_DirectMusicAllTypes,0xd2ac2893, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Notification guids */ +DEFINE_GUID(GUID_NOTIFICATION_SEGMENT,0xd2ac2899, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_NOTIFICATION_PERFORMANCE,0x81f75bc5, 0x4e5d, 0x11d2, 0xbc, 0xc7, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(GUID_NOTIFICATION_MEASUREANDBEAT,0xd2ac289a, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_NOTIFICATION_CHORD,0xd2ac289b, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_NOTIFICATION_COMMAND,0xd2ac289c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_NOTIFICATION_RECOMPOSE, 0xd348372b, 0x945b, 0x45ae, 0xa5, 0x22, 0x45, 0xf, 0x12, 0x5b, 0x84, 0xa5); + +/* Track param type guids */ +/* Use to get/set a DMUS_COMMAND_PARAM param in the Command track */ +DEFINE_GUID(GUID_CommandParam,0xd2ac289d, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get a DMUS_COMMAND_PARAM_2 param in the Command track */ +DEFINE_GUID(GUID_CommandParam2, 0x28f97ef7, 0x9538, 0x11d2, 0x97, 0xa9, 0x0, 0xc0, 0x4f, 0xa3, 0x6e, 0x58); + +/* Use to get/set a DMUS_COMMAND_PARAM_2 param to be used as the command following all commands in +the Command track (this information can't be saved) */ +DEFINE_GUID(GUID_CommandParamNext, 0x472afe7a, 0x281b, 0x11d3, 0x81, 0x7d, 0x0, 0xc0, 0x4f, 0xa3, 0x6e, 0x58); + +/* Use to get/set a DMUS_CHORD_PARAM param in the Chord track */ +DEFINE_GUID(GUID_ChordParam,0xd2ac289e, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get a DMUS_RHYTHM_PARAM param in the Chord track */ +DEFINE_GUID(GUID_RhythmParam,0xd2ac289f, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get/set an IDirectMusicStyle param in the Style track */ +DEFINE_GUID(GUID_IDirectMusicStyle,0xd2ac28a1, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get a DMUS_TIMESIGNATURE param in the Style and TimeSig tracks */ +DEFINE_GUID(GUID_TimeSignature,0xd2ac28a4, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get/set a DMUS_TEMPO_PARAM param in the Tempo track */ +DEFINE_GUID(GUID_TempoParam,0xd2ac28a5, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get the next valid point in a segment at which it may start */ +DEFINE_GUID(GUID_Valid_Start_Time,0x7f6b1760, 0x1fdb, 0x11d3, 0x82, 0x26, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +/* Use to get the next point in the currently playing primary segment at which a new segment may start */ +DEFINE_GUID(GUID_Play_Marker,0xd8761a41, 0x801a, 0x11d3, 0x9b, 0xd1, 0xda, 0xf7, 0xe1, 0xc3, 0xd8, 0x34); + +/* Use to get (GetParam) or add (SetParam) bands in the Band track */ +DEFINE_GUID(GUID_BandParam,0x2bb1938, 0xcb8b, 0x11d2, 0x8b, 0xb9, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); +typedef struct _DMUS_BAND_PARAM +{ + MUSIC_TIME mtTimePhysical; /* Note: If this is a clock-time track, then this field is interpreted in the track's internal time format, which is the number of milliseconds after the beginning of playback. */ + IDirectMusicBand *pBand; +} DMUS_BAND_PARAM; + +/* Obsolete -- doesn't distinguish physical and logical time. Use GUID_BandParam instead. */ +DEFINE_GUID(GUID_IDirectMusicBand,0xd2ac28ac, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get/set an IDirectMusicChordMap param in the ChordMap track */ +DEFINE_GUID(GUID_IDirectMusicChordMap,0xd2ac28ad, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get/set a DMUS_MUTE_PARAM param in the Mute track */ +DEFINE_GUID(GUID_MuteParam,0xd2ac28af, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* These guids are used in IDirectMusicSegment::SetParam to tell the band track to perform various actions. + Some of these guids (where noted) also apply to wave tracks. + */ +/* Download bands/waves for the IDirectMusicSegment */ +DEFINE_GUID(GUID_Download,0xd2ac28a7, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Unload bands/waves for the IDirectMusicSegment */ +DEFINE_GUID(GUID_Unload,0xd2ac28a8, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Connect segment's bands to an IDirectMusicCollection */ +DEFINE_GUID(GUID_ConnectToDLSCollection, 0x1db1ae6b, 0xe92e, 0x11d1, 0xa8, 0xc5, 0x0, 0xc0, 0x4f, 0xa3, 0x72, 0x6e); + +/* Enable/disable autodownloading of bands/waves */ +DEFINE_GUID(GUID_Enable_Auto_Download,0xd2ac28a9, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_Disable_Auto_Download,0xd2ac28aa, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Clear all bands */ +DEFINE_GUID(GUID_Clear_All_Bands,0xd2ac28ab, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Set segment to manage all program changes, bank selects, etc. for simple playback of a standard MIDI file */ +DEFINE_GUID(GUID_StandardMIDIFile, 0x6621075, 0xe92e, 0x11d1, 0xa8, 0xc5, 0x0, 0xc0, 0x4f, 0xa3, 0x72, 0x6e); +/* For compatibility with beta releases... */ +#define GUID_IgnoreBankSelectForGM GUID_StandardMIDIFile + +/* Disable/enable param guids. Use these in SetParam calls to disable or enable sending + * specific PMsg types. + */ +DEFINE_GUID(GUID_DisableTimeSig, 0x45fc707b, 0x1db4, 0x11d2, 0xbc, 0xac, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(GUID_EnableTimeSig, 0x45fc707c, 0x1db4, 0x11d2, 0xbc, 0xac, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(GUID_DisableTempo, 0x45fc707d, 0x1db4, 0x11d2, 0xbc, 0xac, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(GUID_EnableTempo, 0x45fc707e, 0x1db4, 0x11d2, 0xbc, 0xac, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); + +/* Used in SetParam calls for pattern-based tracks. A nonzero value seeds the random number +generator for variation selection; a value of zero reverts to the default behavior of +getting the seed from the system clock. +*/ +DEFINE_GUID(GUID_SeedVariations, 0x65b76fa5, 0xff37, 0x11d2, 0x81, 0x4e, 0x0, 0xc0, 0x4f, 0xa3, 0x6e, 0x58); + +/* Used to get the variations currently in effect across PChannels */ +DEFINE_GUID(GUID_Variations, 0x11f72cce, 0x26e6, 0x4ecd, 0xaf, 0x2e, 0xd6, 0x68, 0xe6, 0x67, 0x7, 0xd8); +typedef struct _DMUS_VARIATIONS_PARAM +{ + DWORD dwPChannelsUsed; /* number of PChannels in use */ + DWORD* padwPChannels; /* array of PChannels in use */ + DWORD* padwVariations; /* array of variations in effect for each PChannel */ +} DMUS_VARIATIONS_PARAM; + +/* Download bands/waves for the IDirectMusicSegment, passed an IDirectMusicAudioPath instead of an IDirectMusicPerformance */ +DEFINE_GUID(GUID_DownloadToAudioPath,0x9f2c0341, 0xc5c4, 0x11d3, 0x9b, 0xd1, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +/* Unload bands/waves for the IDirectMusicSegment, passed an IDirectMusicAudioPath instead of an IDirectMusicPerformance */ +DEFINE_GUID(GUID_UnloadFromAudioPath,0x9f2c0342, 0xc5c4, 0x11d3, 0x9b, 0xd1, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + + +/* Global data guids */ +DEFINE_GUID(GUID_PerfMasterTempo,0xd2ac28b0, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_PerfMasterVolume,0xd2ac28b1, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_PerfMasterGrooveLevel,0xd2ac28b2, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_PerfAutoDownload, 0xfb09565b, 0x3631, 0x11d2, 0xbc, 0xb8, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); + +/* GUID for default GM/GS dls collection. */ +DEFINE_GUID(GUID_DefaultGMCollection, 0xf17e8673, 0xc3b4, 0x11d1, 0x87, 0xb, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* GUID to define default synth, placed in AudioPath configuration file. */ +DEFINE_GUID(GUID_Synth_Default,0x26bb9432, 0x45fe, 0x48d3, 0xa3, 0x75, 0x24, 0x72, 0xc5, 0xe3, 0xe7, 0x86); + +/* GUIDs to define default buffer configurations to place in AudioPath configuration file. */ +DEFINE_GUID(GUID_Buffer_Reverb,0x186cc541, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); +DEFINE_GUID(GUID_Buffer_EnvReverb,0x186cc542, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); +DEFINE_GUID(GUID_Buffer_Stereo,0x186cc545, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); +DEFINE_GUID(GUID_Buffer_3D_Dry,0x186cc546, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); +DEFINE_GUID(GUID_Buffer_Mono,0x186cc547, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); + +/* IID's */ +DEFINE_GUID(IID_IDirectMusicLoader, 0x2ffaaca2, 0x5dca, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusicGetLoader,0x68a04844, 0xd13d, 0x11d1, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusicObject,0xd2ac28b5, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicSegment, 0xf96029a2, 0x4282, 0x11d2, 0x87, 0x17, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicSegmentState, 0xa3afdcc7, 0xd3ee, 0x11d1, 0xbc, 0x8d, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(IID_IDirectMusicPerformance,0x7d43d03, 0x6523, 0x11d2, 0x87, 0x1d, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicGraph,0x2befc277, 0x5497, 0x11d2, 0xbc, 0xcb, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(IID_IDirectMusicStyle,0xd2ac28bd, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicChordMap,0xd2ac28be, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicComposer,0xd2ac28bf, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicBand,0xd2ac28c0, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Alternate interface IDs, available in DX7 release and after. */ +DEFINE_GUID(IID_IDirectMusicPerformance2,0x6fc2cae0, 0xbc78, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusicSegment2, 0xd38894d1, 0xc052, 0x11d2, 0x87, 0x2f, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Interface IDs for DX8 */ +/* changed interfaces (GUID only) */ +DEFINE_GUID(IID_IDirectMusicLoader8, 0x19e7c08c, 0xa44, 0x4e6a, 0xa1, 0x16, 0x59, 0x5a, 0x7c, 0xd5, 0xde, 0x8c); +DEFINE_GUID(IID_IDirectMusicPerformance8, 0x679c4137, 0xc62e, 0x4147, 0xb2, 0xb4, 0x9d, 0x56, 0x9a, 0xcb, 0x25, 0x4c); +DEFINE_GUID(IID_IDirectMusicSegment8,0xc6784488, 0x41a3, 0x418f, 0xaa, 0x15, 0xb3, 0x50, 0x93, 0xba, 0x42, 0xd4); +DEFINE_GUID(IID_IDirectMusicSegmentState8, 0xa50e4730, 0xae4, 0x48a7, 0x98, 0x39, 0xbc, 0x4, 0xbf, 0xe0, 0x77, 0x72); +DEFINE_GUID(IID_IDirectMusicStyle8, 0xfd24ad8a, 0xa260, 0x453d, 0xbf, 0x50, 0x6f, 0x93, 0x84, 0xf7, 0x9, 0x85); +/* new interfaces (GUID + alias) */ +DEFINE_GUID(IID_IDirectMusicPatternTrack, 0x51c22e10, 0xb49f, 0x46fc, 0xbe, 0xc2, 0xe6, 0x28, 0x8f, 0xb9, 0xed, 0xe6); +#define IID_IDirectMusicPatternTrack8 IID_IDirectMusicPatternTrack +DEFINE_GUID(IID_IDirectMusicScript, 0x2252373a, 0x5814, 0x489b, 0x82, 0x9, 0x31, 0xfe, 0xde, 0xba, 0xf1, 0x37); /* {2252373A-5814-489b-8209-31FEDEBAF137} */ +#define IID_IDirectMusicScript8 IID_IDirectMusicScript +DEFINE_GUID(IID_IDirectMusicContainer, 0x9301e386, 0x1f22, 0x11d3, 0x82, 0x26, 0xd2, 0xfa, 0x76, 0x25, 0x5d, 0x47); +#define IID_IDirectMusicContainer8 IID_IDirectMusicContainer +DEFINE_GUID(IID_IDirectMusicAudioPath,0xc87631f5, 0x23be, 0x4986, 0x88, 0x36, 0x5, 0x83, 0x2f, 0xcc, 0x48, 0xf9); +#define IID_IDirectMusicAudioPath8 IID_IDirectMusicAudioPath +/* unchanged interfaces (alias only) */ +#define IID_IDirectMusicGetLoader8 IID_IDirectMusicGetLoader +#define IID_IDirectMusicChordMap8 IID_IDirectMusicChordMap +#define IID_IDirectMusicGraph8 IID_IDirectMusicGraph +#define IID_IDirectMusicBand8 IID_IDirectMusicBand +#define IID_IDirectMusicObject8 IID_IDirectMusicObject +#define IID_IDirectMusicComposer8 IID_IDirectMusicComposer + + +#ifdef __cplusplus +}; /* extern "C" */ +#endif + +#include + +#endif /* #ifndef _DMUSICI_ */ diff --git a/saco/d3d9/include/dmusics.h b/saco/d3d9/include/dmusics.h new file mode 100644 index 0000000..8f1e45d --- /dev/null +++ b/saco/d3d9/include/dmusics.h @@ -0,0 +1,193 @@ +/************************************************************************ +* * +* dmusics.h -- Definitions for created a DirectMusic software synth * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMUSICS_ +#define _DMUSICS_ + +#include "dmusicc.h" + +/* Software synths are enumerated from under this registry key. + */ +#define REGSTR_PATH_SOFTWARESYNTHS "Software\\Microsoft\\DirectMusic\\SoftwareSynths" + +interface IDirectMusicSynth; +interface IDirectMusicSynthSink; + +#ifndef __cplusplus +typedef interface IDirectMusicSynth IDirectMusicSynth; +typedef interface IDirectMusicSynthSink IDirectMusicSynthSink; +#endif + +#ifndef _DMUS_VOICE_STATE_DEFINED +#define _DMUS_VOICE_STATE_DEFINED + +typedef struct _DMUS_VOICE_STATE +{ + BOOL bExists; + SAMPLE_POSITION spPosition; +} DMUS_VOICE_STATE; + +#endif /* _DMUS_VOICE_STATE_DEFINED */ + +/* IDirectMusicSynth::Refresh + * + * This is the last buffer of the stream. It may be a partial block. + */ +#define REFRESH_F_LASTBUFFER 0x00000001 + +#undef INTERFACE +#define INTERFACE IDirectMusicSynth +DECLARE_INTERFACE_(IDirectMusicSynth, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSynth */ + STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE; + STDMETHOD(Download) (THIS_ LPHANDLE phDownload, + LPVOID pvData, + LPBOOL pbFree ) PURE; + STDMETHOD(Unload) (THIS_ HANDLE hDownload, + HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), + HANDLE hUserData ) PURE; + STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt, + LPBYTE pbBuffer, + DWORD cbBuffer) PURE; + STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE; + STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE; + STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; + STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(SetSynthSink) (THIS_ IDirectMusicSynthSink *pSynthSink) PURE; + STDMETHOD(Render) (THIS_ short *pBuffer, + DWORD dwLength, + LONGLONG llPosition) PURE; + STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + DWORD dwPriority) PURE; + STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + LPDWORD pdwPriority) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, + LPDWORD pdwWaveFormatExSize) PURE; + STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE; +}; + +#undef INTERFACE + +#define INTERFACE IDirectMusicSynth8 +DECLARE_INTERFACE_(IDirectMusicSynth8, IDirectMusicSynth) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSynth */ + STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE; + STDMETHOD(Download) (THIS_ LPHANDLE phDownload, + LPVOID pvData, + LPBOOL pbFree ) PURE; + STDMETHOD(Unload) (THIS_ HANDLE hDownload, + HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), + HANDLE hUserData ) PURE; + STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt, + LPBYTE pbBuffer, + DWORD cbBuffer) PURE; + STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE; + STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE; + STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; + STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(SetSynthSink) (THIS_ IDirectMusicSynthSink *pSynthSink) PURE; + STDMETHOD(Render) (THIS_ short *pBuffer, + DWORD dwLength, + LONGLONG llPosition) PURE; + STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + DWORD dwPriority) PURE; + STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + LPDWORD pdwPriority) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, + LPDWORD pdwWaveFormatExSize) PURE; + STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE; + + /* IDirectMusicSynth8 */ + STDMETHOD(PlayVoice) (THIS_ REFERENCE_TIME rt, + DWORD dwVoiceId, + DWORD dwChannelGroup, + DWORD dwChannel, + DWORD dwDLId, + long prPitch, /* PREL not defined here */ + long vrVolume, /* VREL not defined here */ + SAMPLE_TIME stVoiceStart, + SAMPLE_TIME stLoopStart, + SAMPLE_TIME stLoopEnd) PURE; + + STDMETHOD(StopVoice) (THIS_ REFERENCE_TIME rt, + DWORD dwVoiceId ) PURE; + + STDMETHOD(GetVoiceState) (THIS_ DWORD dwVoice[], + DWORD cbVoice, + DMUS_VOICE_STATE dwVoiceState[] ) PURE; + STDMETHOD(Refresh) (THIS_ DWORD dwDownloadID, + DWORD dwFlags) PURE; + STDMETHOD(AssignChannelToBuses) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + LPDWORD pdwBuses, + DWORD cBuses) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectMusicSynthSink +DECLARE_INTERFACE_(IDirectMusicSynthSink, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSynthSink */ + STDMETHOD(Init) (THIS_ IDirectMusicSynth *pSynth) PURE; + STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; + STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(SampleToRefTime) (THIS_ LONGLONG llSampleTime, + REFERENCE_TIME *prfTime) PURE; + STDMETHOD(RefTimeToSample) (THIS_ REFERENCE_TIME rfTime, + LONGLONG *pllSampleTime) PURE; + STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, + LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE; + STDMETHOD(GetDesiredBufferSize) (THIS_ LPDWORD pdwBufferSizeInSamples) PURE; +}; + +DEFINE_GUID(IID_IDirectMusicSynth, 0x9823661, 0x5c85, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusicSynth8,0x53cab625, 0x2711, 0x4c9f, 0x9d, 0xe7, 0x1b, 0x7f, 0x92, 0x5f, 0x6f, 0xc8); +DEFINE_GUID(IID_IDirectMusicSynthSink,0x9823663, 0x5c85, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +/* Property Set GUID_DMUS_PROP_SetSynthSink + * + * Item 0: An IUnknown on which the port can QueryInterface for a user-mode synth sink. + */ +DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink,0x0a3a5ba5, 0x37b6, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +/* Property Set GUID_DMUS_PROP_SinkUsesDSound + * + * Item 0: A DWORD boolean indicating whether or not the sink requires an IDirectSound interface. The + * default is FALSE if this property item is not implemented by the sink. + */ +DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound, 0xbe208857, 0x8952, 0x11d2, 0xba, 0x1c, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +#endif diff --git a/saco/d3d9/include/dpaddr.h b/saco/d3d9/include/dpaddr.h new file mode 100644 index 0000000..6e3fccf --- /dev/null +++ b/saco/d3d9/include/dpaddr.h @@ -0,0 +1,392 @@ +/*==========================================================================; + * + * Copyright (C) 2000-2002 Microsoft Corporation. All Rights Reserved. + * + * File: dpaddr.h + * Content: DirectPlayAddress include file + ***************************************************************************/ + +#ifndef __DIRECTPLAYADDRESS__ +#define __DIRECTPLAYADDRESS__ + +#include // for DECLARE_INTERFACE_ and HRESULT + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dplay8.h" + + + +/**************************************************************************** + * + * DirectPlay8Address CLSIDs + * + ****************************************************************************/ + +// {934A9523-A3CA-4bc5-ADA0-D6D95D979421} +DEFINE_GUID(CLSID_DirectPlay8Address, +0x934a9523, 0xa3ca, 0x4bc5, 0xad, 0xa0, 0xd6, 0xd9, 0x5d, 0x97, 0x94, 0x21); + + +/**************************************************************************** + * + * DirectPlay8Address Interface IIDs + * + ****************************************************************************/ + + +typedef REFIID DPNAREFIID; + +// {83783300-4063-4c8a-9DB3-82830A7FEB31} +DEFINE_GUID(IID_IDirectPlay8Address, +0x83783300, 0x4063, 0x4c8a, 0x9d, 0xb3, 0x82, 0x83, 0xa, 0x7f, 0xeb, 0x31); + +// {E5A0E990-2BAD-430b-87DA-A142CF75DE58} +DEFINE_GUID(IID_IDirectPlay8AddressIP, +0xe5a0e990, 0x2bad, 0x430b, 0x87, 0xda, 0xa1, 0x42, 0xcf, 0x75, 0xde, 0x58); + + + +/**************************************************************************** + * + * DirectPlay8Address Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDirectPlay8Address *PDIRECTPLAY8ADDRESS, *LPDIRECTPLAY8ADDRESS; +typedef struct IDirectPlay8AddressIP *PDIRECTPLAY8ADDRESSIP, *LPDIRECTPLAY8ADDRESSIP; + + +/**************************************************************************** + * + * DirectPlay8Address Forward Declarations For External Types + * + ****************************************************************************/ + +typedef struct sockaddr SOCKADDR; + +/**************************************************************************** + * + * DirectPlay8Address Constants + * + ****************************************************************************/ +// +// Asynchronous operation flags +// +#define DPNA_DATATYPE_STRING 0x00000001 +#define DPNA_DATATYPE_DWORD 0x00000002 +#define DPNA_DATATYPE_GUID 0x00000003 +#define DPNA_DATATYPE_BINARY 0x00000004 +#define DPNA_DATATYPE_STRING_ANSI 0x00000005 + +#define DPNA_DPNSVR_PORT 6073 + +#define DPNA_INDEX_INVALID 0xFFFFFFFF + +/**************************************************************************** + * + * DirectPlay8Address Address Elements + * + ****************************************************************************/ + +#define DPNA_SEPARATOR_KEYVALUE L'=' +#define DPNA_SEPARATOR_USERDATA L'#' +#define DPNA_SEPARATOR_COMPONENT L';' +#define DPNA_ESCAPECHAR L'%' + +// Header +#define DPNA_HEADER L"x-directplay:/" + +// key names for address components +#define DPNA_KEY_NAT_RESOLVER L"natresolver" +#define DPNA_KEY_NAT_RESOLVER_USER_STRING L"natresolveruserstring" +#define DPNA_KEY_APPLICATION_INSTANCE L"applicationinstance" +#define DPNA_KEY_DEVICE L"device" +#define DPNA_KEY_HOSTNAME L"hostname" +#define DPNA_KEY_PORT L"port" +#define DPNA_KEY_NAMEINFO L"nameinfo" +#define DPNA_KEY_PROCESSOR L"processor" +#define DPNA_KEY_PROGRAM L"program" +#define DPNA_KEY_PROVIDER L"provider" +#define DPNA_KEY_SCOPE L"scope" +#define DPNA_KEY_TRAVERSALMODE L"traversalmode" +#define DPNA_KEY_BAUD L"baud" +#define DPNA_KEY_FLOWCONTROL L"flowcontrol" +#define DPNA_KEY_PARITY L"parity" +#define DPNA_KEY_PHONENUMBER L"phonenumber" +#define DPNA_KEY_STOPBITS L"stopbits" + +// values for baud rate +#define DPNA_BAUD_RATE_9600 9600 +#define DPNA_BAUD_RATE_14400 14400 +#define DPNA_BAUD_RATE_19200 19200 +#define DPNA_BAUD_RATE_38400 38400 +#define DPNA_BAUD_RATE_56000 56000 +#define DPNA_BAUD_RATE_57600 57600 +#define DPNA_BAUD_RATE_115200 115200 + +// values for stop bits +#define DPNA_STOP_BITS_ONE L"1" +#define DPNA_STOP_BITS_ONE_FIVE L"1.5" +#define DPNA_STOP_BITS_TWO L"2" + +// values for parity +#define DPNA_PARITY_NONE L"NONE" +#define DPNA_PARITY_EVEN L"EVEN" +#define DPNA_PARITY_ODD L"ODD" +#define DPNA_PARITY_MARK L"MARK" +#define DPNA_PARITY_SPACE L"SPACE" + +// values for flow control +#define DPNA_FLOW_CONTROL_NONE L"NONE" +#define DPNA_FLOW_CONTROL_XONXOFF L"XONXOFF" +#define DPNA_FLOW_CONTROL_RTS L"RTS" +#define DPNA_FLOW_CONTROL_DTR L"DTR" +#define DPNA_FLOW_CONTROL_RTSDTR L"RTSDTR" +// values for traversal mode +#define DPNA_TRAVERSALMODE_NONE 0 +#define DPNA_TRAVERSALMODE_PORTREQUIRED 1 +#define DPNA_TRAVERSALMODE_PORTRECOMMENDED 2 +// Shortcut values +// +// These can be used instead of the corresponding CLSID_DP8SP_XXXX guids +// +#define DPNA_VALUE_TCPIPPROVIDER L"IP" +#define DPNA_VALUE_IPXPROVIDER L"IPX" +#define DPNA_VALUE_MODEMPROVIDER L"MODEM" +#define DPNA_VALUE_SERIALPROVIDER L"SERIAL" + +//// ANSI DEFINITIONS + +// Header +#define DPNA_HEADER_A "x-directplay:/" +#define DPNA_SEPARATOR_KEYVALUE_A '=' +#define DPNA_SEPARATOR_USERDATA_A '#' +#define DPNA_SEPARATOR_COMPONENT_A ';' +#define DPNA_ESCAPECHAR_A '%' + +// key names for address components +#define DPNA_KEY_NAT_RESOLVER_A "natresolver" +#define DPNA_KEY_NAT_RESOLVER_USER_STRING_A "natresolveruserstring" +#define DPNA_KEY_APPLICATION_INSTANCE_A "applicationinstance" +#define DPNA_KEY_DEVICE_A "device" +#define DPNA_KEY_HOSTNAME_A "hostname" +#define DPNA_KEY_PORT_A "port" +#define DPNA_KEY_NAMEINFO_A "nameinfo" +#define DPNA_KEY_PROCESSOR_A "processor" +#define DPNA_KEY_PROGRAM_A "program" +#define DPNA_KEY_PROVIDER_A "provider" +#define DPNA_KEY_SCOPE_A "scope" +#define DPNA_KEY_TRAVERSALMODE_A "traversalmode" +#define DPNA_KEY_BAUD_A "baud" +#define DPNA_KEY_FLOWCONTROL_A "flowcontrol" +#define DPNA_KEY_PARITY_A "parity" +#define DPNA_KEY_PHONENUMBER_A "phonenumber" +#define DPNA_KEY_STOPBITS_A "stopbits" + +// values for stop bits +#define DPNA_STOP_BITS_ONE_A "1" +#define DPNA_STOP_BITS_ONE_FIVE_A "1.5" +#define DPNA_STOP_BITS_TWO_A "2" + +// values for parity +#define DPNA_PARITY_NONE_A "NONE" +#define DPNA_PARITY_EVEN_A "EVEN" +#define DPNA_PARITY_ODD_A "ODD" +#define DPNA_PARITY_MARK_A "MARK" +#define DPNA_PARITY_SPACE_A "SPACE" + +// values for flow control +#define DPNA_FLOW_CONTROL_NONE_A "NONE" +#define DPNA_FLOW_CONTROL_XONXOFF_A "XONXOFF" +#define DPNA_FLOW_CONTROL_RTS_A "RTS" +#define DPNA_FLOW_CONTROL_DTR_A "DTR" +#define DPNA_FLOW_CONTROL_RTSDTR_A "RTSDTR" +// Shortcut values +// +// These can be used instead of the corresponding CLSID_DP8SP_XXXX guids +// +#define DPNA_VALUE_TCPIPPROVIDER_A "IP" +#define DPNA_VALUE_IPXPROVIDER_A "IPX" +#define DPNA_VALUE_MODEMPROVIDER_A "MODEM" +#define DPNA_VALUE_SERIALPROVIDER_A "SERIAL" + +/**************************************************************************** + * + * DirectPlay8Address Functions + * + ****************************************************************************/ + + +/* + * + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 address objects. + * + * HRESULT WINAPI DirectPlay8AddressCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + */ + + +/**************************************************************************** + * + * DirectPlay8Address Application Interfaces + * + ****************************************************************************/ + +// +// COM definition for IDirectPlay8Address Generic Interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8Address +DECLARE_INTERFACE_(IDirectPlay8Address,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DPNAREFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDirectPlay8Address methods ***/ + STDMETHOD(BuildFromURLW)(THIS_ WCHAR *pwszSourceURL ) PURE; + STDMETHOD(BuildFromURLA)(THIS_ CHAR *pszSourceURL ) PURE; + STDMETHOD(Duplicate)(THIS_ PDIRECTPLAY8ADDRESS *ppdpaNewAddress ) PURE; + STDMETHOD(SetEqual)(THIS_ PDIRECTPLAY8ADDRESS pdpaAddress ) PURE; + STDMETHOD(IsEqual)(THIS_ PDIRECTPLAY8ADDRESS pdpaAddress ) PURE; + STDMETHOD(Clear)(THIS ) PURE; + STDMETHOD(GetURLW)(THIS_ WCHAR *pwszURL, PDWORD pdwNumChars ) PURE; + STDMETHOD(GetURLA)(THIS_ CHAR *pszURL, PDWORD pdwNumChars) PURE; + STDMETHOD(GetSP)(THIS_ GUID *pguidSP ) PURE; + STDMETHOD(GetUserData)(THIS_ void *pvUserData, PDWORD pdwBufferSize) PURE; + STDMETHOD(SetSP)(THIS_ const GUID * const pguidSP ) PURE; + STDMETHOD(SetUserData)(THIS_ const void * const pvUserData, const DWORD dwDataSize) PURE; + STDMETHOD(GetNumComponents)(THIS_ PDWORD pdwNumComponents ) PURE; + STDMETHOD(GetComponentByName)(THIS_ const WCHAR * const pwszName, void *pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType ) PURE; + STDMETHOD(GetComponentByIndex)(THIS_ const DWORD dwComponentID, WCHAR * pwszName, PDWORD pdwNameLen, void *pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType ) PURE; + STDMETHOD(AddComponent)(THIS_ const WCHAR * const pwszName, const void * const lpvData, const DWORD dwDataSize, const DWORD dwDataType ) PURE; + STDMETHOD(GetDevice)(THIS_ GUID * ) PURE; + STDMETHOD(SetDevice)(THIS_ const GUID * const) PURE; + STDMETHOD(BuildFromDPADDRESS)( THIS_ LPVOID pvAddress, DWORD dwDataSize ) PURE; +}; + +// +// COM definition for IDirectPlay8AddressIP Generic Interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8AddressIP +DECLARE_INTERFACE_(IDirectPlay8AddressIP,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DPNAREFIID, PVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDirectPlay8AddressIP methods ***/ + + // Constructs a IDirectPlay8 TCP Address from a SOCKADDR structure + STDMETHOD(BuildFromSockAddr)(THIS_ const SOCKADDR * const ) PURE; + + // Constructs a TCP Address from a string (hostname) and port + STDMETHOD(BuildAddress)(THIS_ const WCHAR * const wszAddress, const USHORT usPort ) PURE; + + // Builds a local TCP Address + STDMETHOD(BuildLocalAddress)(THIS_ const GUID * const pguidAdapter, const USHORT usPort ) PURE; + + // Gets the address from the structure in SOCKADR format + STDMETHOD(GetSockAddress)(THIS_ SOCKADDR *, PDWORD ) PURE; + + // Gets the local afddress + STDMETHOD(GetLocalAddress)(THIS_ GUID *pguidAdapter, USHORT *pusPort ) PURE; + + // Gets the remote address + STDMETHOD(GetAddress)(THIS_ WCHAR *wszAddress, PDWORD pdwAddressLength, USHORT *psPort ) PURE; +}; + + +/**************************************************************************** + * + * IDirectPlay8 application interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay8Address_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8Address_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8Address_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8Address_BuildFromURLW(p,a) (p)->lpVtbl->BuildFromURLW(p,a) +#define IDirectPlay8Address_BuildFromURLA(p,a) (p)->lpVtbl->BuildFromURLA(p,a) +#define IDirectPlay8Address_Duplicate(p,a) (p)->lpVtbl->Duplicate(p,a) +#define IDirectPlay8Address_SetEqual(p,a) (p)->lpVtbl->SetEqual(p,a) +#define IDirectPlay8Address_IsEqual(p,a) (p)->lpVtbl->IsEqual(p,a) +#define IDirectPlay8Address_Clear(p) (p)->lpVtbl->Clear(p) +#define IDirectPlay8Address_GetURLW(p,a,b) (p)->lpVtbl->GetURLW(p,a,b) +#define IDirectPlay8Address_GetURLA(p,a,b) (p)->lpVtbl->GetURLA(p,a,b) +#define IDirectPlay8Address_GetSP(p,a) (p)->lpVtbl->GetSP(p,a) +#define IDirectPlay8Address_GetUserData(p,a,b) (p)->lpVtbl->GetUserData(p,a,b) +#define IDirectPlay8Address_SetSP(p,a) (p)->lpVtbl->SetSP(p,a) +#define IDirectPlay8Address_SetUserData(p,a,b) (p)->lpVtbl->SetUserData(p,a,b) +#define IDirectPlay8Address_GetNumComponents(p,a) (p)->lpVtbl->GetNumComponents(p,a) +#define IDirectPlay8Address_GetComponentByName(p,a,b,c,d) (p)->lpVtbl->GetComponentByName(p,a,b,c,d) +#define IDirectPlay8Address_GetComponentByIndex(p,a,b,c,d,e,f) (p)->lpVtbl->GetComponentByIndex(p,a,b,c,d,e,f) +#define IDirectPlay8Address_AddComponent(p,a,b,c,d) (p)->lpVtbl->AddComponent(p,a,b,c,d) +#define IDirectPlay8Address_SetDevice(p,a) (p)->lpVtbl->SetDevice(p,a) +#define IDirectPlay8Address_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirectPlay8Address_BuildFromDirectPlay4Address(p,a,b) (p)->lpVtbl->BuildFromDirectPlay4Address(p,a,b) + +#define IDirectPlay8AddressIP_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8AddressIP_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8AddressIP_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8AddressIP_BuildFromSockAddr(p,a) (p)->lpVtbl->BuildFromSockAddr(p,a) +#define IDirectPlay8AddressIP_BuildAddress(p,a,b) (p)->lpVtbl->BuildAddress(p,a,b) +#define IDirectPlay8AddressIP_BuildLocalAddress(p,a,b) (p)->lpVtbl->BuildLocalAddress(p,a,b) +#define IDirectPlay8AddressIP_GetSockAddress(p,a,b) (p)->lpVtbl->GetSockAddress(p,a,b) +#define IDirectPlay8AddressIP_GetLocalAddress(p,a,b) (p)->lpVtbl->GetLocalAddress(p,a,b) +#define IDirectPlay8AddressIP_GetAddress(p,a,b,c) (p)->lpVtbl->GetAddress(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay8Address_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8Address_AddRef(p) (p)->AddRef() +#define IDirectPlay8Address_Release(p) (p)->Release() +#define IDirectPlay8Address_BuildFromURLW(p,a) (p)->BuildFromURLW(a) +#define IDirectPlay8Address_BuildFromURLA(p,a) (p)->BuildFromURLA(a) +#define IDirectPlay8Address_Duplicate(p,a) (p)->Duplicate(a) +#define IDirectPlay8Address_SetEqual(p,a) (p)->SetEqual(a) +#define IDirectPlay8Address_IsEqual(p,a) (p)->IsEqual(a) +#define IDirectPlay8Address_Clear(p) (p)->Clear() +#define IDirectPlay8Address_GetURLW(p,a,b) (p)->GetURLW(a,b) +#define IDirectPlay8Address_GetURLA(p,a,b) (p)->GetURLA(a,b) +#define IDirectPlay8Address_GetSP(p,a) (p)->GetSP(a) +#define IDirectPlay8Address_GetUserData(p,a,b) (p)->GetUserData(a,b) +#define IDirectPlay8Address_SetSP(p,a) (p)->SetSP(a) +#define IDirectPlay8Address_SetUserData(p,a,b) (p)->SetUserData(a,b) +#define IDirectPlay8Address_GetNumComponents(p,a) (p)->GetNumComponents(a) +#define IDirectPlay8Address_GetComponentByName(p,a,b,c,d) (p)->GetComponentByName(a,b,c,d) +#define IDirectPlay8Address_GetComponentByIndex(p,a,b,c,d,e,f) (p)->GetComponentByIndex(a,b,c,d,e,f) +#define IDirectPlay8Address_AddComponent(p,a,b,c,d) (p)->AddComponent(a,b,c,d) +#define IDirectPlay8Address_SetDevice(p,a) (p)->SetDevice(a) +#define IDirectPlay8Address_GetDevice(p,a) (p)->GetDevice(a) +#define IDirectPlay8Address_BuildFromDirectPlay4Address(p,a,b) (p)->BuildFromDirectPlay4Address(a,b) + +#define IDirectPlay8AddressIP_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8AddressIP_AddRef(p) (p)->AddRef() +#define IDirectPlay8AddressIP_Release(p) (p)->Release() +#define IDirectPlay8AddressIP_BuildFromSockAddr(p,a) (p)->BuildFromSockAddr(a) +#define IDirectPlay8AddressIP_BuildAddress(p,a,b) (p)->BuildAddress(a,b) +#define IDirectPlay8AddressIP_BuildLocalAddress(p,a,b) (p)->BuildLocalAddress(a,b) +#define IDirectPlay8AddressIP_GetSockAddress(p,a,b) (p)->GetSockAddress(a,b) +#define IDirectPlay8AddressIP_GetLocalAddress(p,a,b) (p)->GetLocalAddress(a,b) +#define IDirectPlay8AddressIP_GetAddress(p,a,b,c) (p)->GetAddress(a,b,c) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/saco/d3d9/include/dplay.h b/saco/d3d9/include/dplay.h new file mode 100644 index 0000000..d91c0a5 --- /dev/null +++ b/saco/d3d9/include/dplay.h @@ -0,0 +1,2154 @@ +/*==========================================================================; + * + * Copyright (C) 1994-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dplay.h + * Content: DirectPlay include file + * + ***************************************************************************/ + +#ifndef __DPLAY_INCLUDED__ +#define __DPLAY_INCLUDED__ + +#include // for DECLARE_INTERFACE and HRESULT + +/* avoid warnings in MSVC at Level4 */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) + + +/* + * Some types + */ + +#ifndef _WIN64 +#define DWORD_PTR DWORD +#endif + +typedef LPVOID (*LPRGLPVOID)[]; +typedef LPRGLPVOID PRGPVOID, LPRGPVOID, PRGLPVOID, PAPVOID, LPAPVOID, PALPVOID, LPALPVOID; + +#define VOL volatile +typedef VOID *VOL LPVOIDV; + + +#define _FACDP 0x877 +#define MAKE_DPHRESULT( code ) MAKE_HRESULT( 1, _FACDP, code ) + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GUIDS used by DirectPlay objects + */ +DEFINE_GUID(IID_IDirectPlay2, 0x2b74f7c0, 0x9154, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3); +DEFINE_GUID(IID_IDirectPlay2A,0x9d460580, 0xa822, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82); + +DEFINE_GUID(IID_IDirectPlay3, 0x133efe40, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); +DEFINE_GUID(IID_IDirectPlay3A,0x133efe41, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); + +DEFINE_GUID(IID_IDirectPlay4, 0xab1c530, 0x4745, 0x11d1, 0xa7, 0xa1, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); +DEFINE_GUID(IID_IDirectPlay4A,0xab1c531, 0x4745, 0x11d1, 0xa7, 0xa1, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); + +// {D1EB6D20-8923-11d0-9D97-00A0C90A43CB} +DEFINE_GUID(CLSID_DirectPlay,0xd1eb6d20, 0x8923, 0x11d0, 0x9d, 0x97, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); + +/* + * GUIDS used by Service Providers shipped with DirectPlay + * Use these to identify Service Provider returned by EnumConnections + */ + +// GUID for IPX service provider +// {685BC400-9D2C-11cf-A9CD-00AA006886E3} +DEFINE_GUID(DPSPGUID_IPX, +0x685bc400, 0x9d2c, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3); + +// GUID for TCP/IP service provider +// 36E95EE0-8577-11cf-960C-0080C7534E82 +DEFINE_GUID(DPSPGUID_TCPIP, +0x36E95EE0, 0x8577, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82); + +// GUID for Serial service provider +// {0F1D6860-88D9-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPSPGUID_SERIAL, +0xf1d6860, 0x88d9, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// GUID for Modem service provider +// {44EAA760-CB68-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPSPGUID_MODEM, +0x44eaa760, 0xcb68, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/**************************************************************************** + * + * DirectPlay Structures + * + * Various structures used to invoke DirectPlay. + * + ****************************************************************************/ + +#ifndef IDIRECTPLAY2_OR_GREATER +typedef struct IDirectPlay FAR *LPDIRECTPLAY; +#else +typedef struct IUnknown FAR *LPDIRECTPLAY; +#endif + +typedef struct IDirectPlay2 FAR *LPDIRECTPLAY2; +typedef struct IDirectPlay2 FAR *LPDIRECTPLAY2A; +typedef struct IDirectPlay2 IDirectPlay2A; + +typedef struct IDirectPlay3 FAR *LPDIRECTPLAY3; +typedef struct IDirectPlay3 FAR *LPDIRECTPLAY3A; +typedef struct IDirectPlay3 IDirectPlay3A; + +typedef struct IDirectPlay4 FAR *LPDIRECTPLAY4; +typedef struct IDirectPlay4 FAR *LPDIRECTPLAY4A; +typedef struct IDirectPlay4 IDirectPlay4A; + +/* + * DPID + * DirectPlay player and group ID + */ +typedef DWORD DPID, FAR *LPDPID; + +/* + * DPID that system messages come from + */ +#define DPID_SYSMSG 0 + +/* + * DPID representing all players in the session + */ +#define DPID_ALLPLAYERS 0 + +/* + * DPID representing the server player + */ +#define DPID_SERVERPLAYER 1 + + +/* + * DPID representing the maxiumum ID in the range of DPID's reserved for + * use by DirectPlay. + */ +#define DPID_RESERVEDRANGE 100 + +/* + * The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID) + */ +#define DPID_UNKNOWN 0xFFFFFFFF + +/* + * DPCAPS + * Used to obtain the capabilities of a DirectPlay object + */ +typedef struct +{ + DWORD dwSize; // Size of structure, in bytes + DWORD dwFlags; // DPCAPS_xxx flags + DWORD dwMaxBufferSize; // Maximum message size, in bytes, for this service provider + DWORD dwMaxQueueSize; // Obsolete. + DWORD dwMaxPlayers; // Maximum players/groups (local + remote) + DWORD dwHundredBaud; // Bandwidth in 100 bits per second units; + // i.e. 24 is 2400, 96 is 9600, etc. + DWORD dwLatency; // Estimated latency; 0 = unknown + DWORD dwMaxLocalPlayers; // Maximum # of locally created players allowed + DWORD dwHeaderLength; // Maximum header length, in bytes, on messages + // added by the service provider + DWORD dwTimeout; // Service provider's suggested timeout value + // This is how long DirectPlay will wait for + // responses to system messages +} DPCAPS, FAR *LPDPCAPS; + +/* + * This DirectPlay object is the session host. If the host exits the + * session, another application will become the host and receive a + * DPSYS_HOST system message. + */ +#define DPCAPS_ISHOST 0x00000002 + +/* + * The service provider bound to this DirectPlay object can optimize + * group messaging. + */ +#define DPCAPS_GROUPOPTIMIZED 0x00000008 + +/* + * The service provider bound to this DirectPlay object can optimize + * keep alives (see DPSESSION_KEEPALIVE) + */ +#define DPCAPS_KEEPALIVEOPTIMIZED 0x00000010 + +/* + * The service provider bound to this DirectPlay object can optimize + * guaranteed message delivery. + */ +#define DPCAPS_GUARANTEEDOPTIMIZED 0x00000020 + +/* + * This DirectPlay object supports guaranteed message delivery. + */ +#define DPCAPS_GUARANTEEDSUPPORTED 0x00000040 + +/* + * This DirectPlay object supports digital signing of messages. + */ +#define DPCAPS_SIGNINGSUPPORTED 0x00000080 + +/* + * This DirectPlay object supports encryption of messages. + */ +#define DPCAPS_ENCRYPTIONSUPPORTED 0x00000100 + +/* + * This DirectPlay player was created on this machine + */ +#define DPPLAYERCAPS_LOCAL 0x00000800 + +/* + * Current Open settings supports all forms of Cancel + */ +#define DPCAPS_ASYNCCANCELSUPPORTED 0x00001000 + +/* + * Current Open settings supports CancelAll, but not Cancel + */ +#define DPCAPS_ASYNCCANCELALLSUPPORTED 0x00002000 + +/* + * Current Open settings supports Send Timeouts for sends + */ +#define DPCAPS_SENDTIMEOUTSUPPORTED 0x00004000 + +/* + * Current Open settings supports send priority + */ +#define DPCAPS_SENDPRIORITYSUPPORTED 0x00008000 + +/* + * Current Open settings supports DPSEND_ASYNC flag + */ +#define DPCAPS_ASYNCSUPPORTED 0x00010000 + + +/* + * DPSESSIONDESC2 + * Used to describe the properties of a DirectPlay + * session instance + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // DPSESSION_xxx flags + GUID guidInstance; // ID for the session instance + GUID guidApplication; // GUID of the DirectPlay application. + // GUID_NULL for all applications. + DWORD dwMaxPlayers; // Maximum # players allowed in session + DWORD dwCurrentPlayers; // Current # players in session (read only) + union + { // Name of the session + LPWSTR lpszSessionName; // Unicode + LPSTR lpszSessionNameA; // ANSI + }; + union + { // Password of the session (optional) + LPWSTR lpszPassword; // Unicode + LPSTR lpszPasswordA; // ANSI + }; + DWORD_PTR dwReserved1; // Reserved for future MS use. + DWORD_PTR dwReserved2; + DWORD_PTR dwUser1; // For use by the application + DWORD_PTR dwUser2; + DWORD_PTR dwUser3; + DWORD_PTR dwUser4; +} DPSESSIONDESC2, FAR *LPDPSESSIONDESC2; + +typedef DPSESSIONDESC2 * VOL LPDPSESSIONDESC2_V; + +/* + * LPCDPSESSIONDESC2 + * A constant pointer to DPSESSIONDESC2 + */ +typedef const DPSESSIONDESC2 FAR *LPCDPSESSIONDESC2; + +/* + * Applications cannot create new players in this session. + */ +#define DPSESSION_NEWPLAYERSDISABLED 0x00000001 + +/* + * If the DirectPlay object that created the session, the host, + * quits, then the host will attempt to migrate to another + * DirectPlay object so that new players can continue to be created + * and new applications can join the session. + */ +#define DPSESSION_MIGRATEHOST 0x00000004 + +/* + * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom + * fields in player messages. This cuts two DWORD's off the message + * overhead. + */ +#define DPSESSION_NOMESSAGEID 0x00000008 + + +/* + * This flag tells DirectPlay to not allow any new applications to + * join the session. Applications already in the session can still + * create new players. + */ +#define DPSESSION_JOINDISABLED 0x00000020 + +/* + * This flag tells DirectPlay to detect when remote players + * exit abnormally (e.g. their computer or modem gets unplugged) + */ +#define DPSESSION_KEEPALIVE 0x00000040 + +/* + * This flag tells DirectPlay not to send a message to all players + * when a players remote data changes + */ +#define DPSESSION_NODATAMESSAGES 0x00000080 + +/* + * This flag indicates that the session belongs to a secure server + * and needs user authentication + */ +#define DPSESSION_SECURESERVER 0x00000100 + +/* + * This flag indicates that the session is private and requirs a password + * for EnumSessions as well as Open. + */ +#define DPSESSION_PRIVATE 0x00000200 + +/* + * This flag indicates that the session requires a password for joining. + */ +#define DPSESSION_PASSWORDREQUIRED 0x00000400 + +/* + * This flag tells DirectPlay to route all messages through the server + */ +#define DPSESSION_MULTICASTSERVER 0x00000800 + +/* + * This flag tells DirectPlay to only download information about the + * DPPLAYER_SERVERPLAYER. + */ +#define DPSESSION_CLIENTSERVER 0x00001000 + +/* + * This flag tells DirectPlay to use the protocol built into dplay + * for reliability and statistics all the time. When this bit is + * set, only other sessions with this bit set can join or be joined. + */ +#define DPSESSION_DIRECTPLAYPROTOCOL 0x00002000 + +/* + * This flag tells DirectPlay that preserving order of received + * packets is not important, when using reliable delivery. This + * will allow messages to be indicated out of order if preceding + * messages have not yet arrived. Otherwise DPLAY will wait for + * earlier messages before delivering later reliable messages. + */ +#define DPSESSION_NOPRESERVEORDER 0x00004000 + + +/* + * This flag tells DirectPlay to optimize communication for latency + */ +#define DPSESSION_OPTIMIZELATENCY 0x00008000 + +/* + * This flag allows lobby launched games that aren't voice enabled + * to get voice capabilities. + */ +#define DPSESSION_ALLOWVOICERETRO 0x00010000 + +/* + * This flag supresses transmission of session desc changes. + * DPSESSION_NODATAMESSAGES was supposed to do that, but SetSessionDesc + * was ignoring the flag and some apps depended on the broken behavior, this + * flag allows applications to get the right behaviour without breaking apps depending + * on old broken behavior. + */ +#define DPSESSION_NOSESSIONDESCMESSAGES 0x00020000 + +/* + * DPNAME + * Used to hold the name of a DirectPlay entity + * like a player or a group + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // The short or friendly name + LPWSTR lpszShortName; // Unicode + LPSTR lpszShortNameA; // ANSI + }; + union + { // The long or formal name + LPWSTR lpszLongName; // Unicode + LPSTR lpszLongNameA; // ANSI + }; + +} DPNAME, FAR *LPDPNAME; + +/* + * LPCDPNAME + * A constant pointer to DPNAME + */ +typedef const DPNAME FAR *LPCDPNAME; + +/* + * DPCREDENTIALS + * Used to hold the user name and password of a DirectPlay user + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // User name of the account + LPWSTR lpszUsername; // Unicode + LPSTR lpszUsernameA; // ANSI + }; + union + { // Password of the account + LPWSTR lpszPassword; // Unicode + LPSTR lpszPasswordA; // ANSI + }; + union + { // Domain name of the account + LPWSTR lpszDomain; // Unicode + LPSTR lpszDomainA; // ANSI + }; +} DPCREDENTIALS, FAR *LPDPCREDENTIALS; + +typedef const DPCREDENTIALS FAR *LPCDPCREDENTIALS; + +/* + * DPSECURITYDESC + * Used to describe the security properties of a DirectPlay + * session instance + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // SSPI provider name + LPWSTR lpszSSPIProvider; // Unicode + LPSTR lpszSSPIProviderA; // ANSI + }; + union + { // CAPI provider name + LPWSTR lpszCAPIProvider; // Unicode + LPSTR lpszCAPIProviderA; // ANSI + }; + DWORD dwCAPIProviderType; // Crypto Service Provider type + DWORD dwEncryptionAlgorithm; // Encryption Algorithm type +} DPSECURITYDESC, FAR *LPDPSECURITYDESC; + +typedef const DPSECURITYDESC FAR *LPCDPSECURITYDESC; + +/* + * DPACCOUNTDESC + * Used to describe a user membership account + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // Account identifier + LPWSTR lpszAccountID; // Unicode + LPSTR lpszAccountIDA; // ANSI + }; +} DPACCOUNTDESC, FAR *LPDPACCOUNTDESC; + +typedef const DPACCOUNTDESC FAR *LPCDPACCOUNTDESC; + +/* + * LPCGUID + * A constant pointer to a guid + */ +typedef const GUID FAR *LPCGUID; + +/* + * DPLCONNECTION + * Used to hold all in the informaion needed to connect + * an application to a session or create a session + */ +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags specific to this structure + LPDPSESSIONDESC2 lpSessionDesc; // Pointer to session desc to use on connect + LPDPNAME lpPlayerName; // Pointer to Player name structure + GUID guidSP; // GUID of the DPlay SP to use + LPVOID lpAddress; // Address for service provider + DWORD dwAddressSize; // Size of address data +} DPLCONNECTION, FAR *LPDPLCONNECTION; + +/* + * LPCDPLCONNECTION + * A constant pointer to DPLCONNECTION + */ +typedef const DPLCONNECTION FAR *LPCDPLCONNECTION; + +/* + * DPCHAT + * Used to hold the a DirectPlay chat message + */ +typedef struct +{ + DWORD dwSize; + DWORD dwFlags; + union + { // Message string + LPWSTR lpszMessage; // Unicode + LPSTR lpszMessageA; // ANSI + }; +} DPCHAT, FAR * LPDPCHAT; + +/* + * SGBUFFER + * Scatter Gather Buffer used for SendEx + */ +typedef struct +{ + UINT len; // length of buffer data + PUCHAR pData; // pointer to buffer data +} SGBUFFER, *PSGBUFFER, FAR *LPSGBUFFER; + + +/**************************************************************************** + * + * Prototypes for DirectPlay callback functions + * + ****************************************************************************/ + +/* + * Callback for IDirectPlay2::EnumSessions + */ +typedef BOOL (FAR PASCAL * LPDPENUMSESSIONSCALLBACK2)( + LPCDPSESSIONDESC2 lpThisSD, + LPDWORD lpdwTimeOut, + DWORD dwFlags, + LPVOID lpContext ); + +/* + * This flag is set on the EnumSessions callback dwFlags parameter when + * the time out has occurred. There will be no session data for this + * callback. If *lpdwTimeOut is set to a non-zero value and the + * EnumSessionsCallback function returns TRUE then EnumSessions will + * continue waiting until the next timeout occurs. Timeouts are in + * milliseconds. + */ +#define DPESC_TIMEDOUT 0x00000001 + + +/* + * Callback for IDirectPlay2::EnumPlayers + * IDirectPlay2::EnumGroups + * IDirectPlay2::EnumGroupPlayers + */ +typedef BOOL (FAR PASCAL *LPDPENUMPLAYERSCALLBACK2)( + DPID dpId, + DWORD dwPlayerType, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext ); + + +/* + * Unicode callback for DirectPlayEnumerate + * This callback prototype will be used if compiling + * for Unicode strings + */ +typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACK)( + LPGUID lpguidSP, + LPWSTR lpSPName, + DWORD dwMajorVersion, + DWORD dwMinorVersion, + LPVOID lpContext); + +/* + * ANSI callback for DirectPlayEnumerate + * This callback prototype will be used if compiling + * for ANSI strings + */ +typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACKA)( + LPGUID lpguidSP, + LPSTR lpSPName, + DWORD dwMajorVersion, + DWORD dwMinorVersion, + LPVOID lpContext); + +/* + * Callback for IDirectPlay3(A)::EnumConnections + */ +typedef BOOL (FAR PASCAL * LPDPENUMCONNECTIONSCALLBACK)( + LPCGUID lpguidSP, + LPVOID lpConnection, + DWORD dwConnectionSize, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext); + + +/* + * API's + */ + +#ifdef UNICODE +#define DirectPlayEnumerate DirectPlayEnumerateW +#else +#define DirectPlayEnumerate DirectPlayEnumerateA +#endif // UNICODE + +extern HRESULT WINAPI DirectPlayEnumerateA( LPDPENUMDPCALLBACKA, LPVOID ); +extern HRESULT WINAPI DirectPlayEnumerateW( LPDPENUMDPCALLBACK, LPVOID ); +extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY *lplpDP, IUnknown *pUnk); + +/**************************************************************************** + * + * IDirectPlay2 (and IDirectPlay2A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay2 +DECLARE_INTERFACE_( IDirectPlay2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay2 interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay2_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay2_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay2_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlay2_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay2_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay2_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlay2_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay2_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay2_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay2_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay2_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay2_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlay2_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlay2_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlay2_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlay2_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlay2_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlay2_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlay2_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay2_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlay2_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay2_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay2_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlay2_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlay2_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlay2_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlay2_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) + +#else /* C++ */ + +#define IDirectPlay2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay2_AddRef(p) (p)->AddRef() +#define IDirectPlay2_Release(p) (p)->Release() +#define IDirectPlay2_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay2_Close(p) (p)->Close() +#define IDirectPlay2_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlay2_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay2_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay2_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlay2_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay2_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay2_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay2_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay2_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay2_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlay2_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlay2_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlay2_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlay2_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlay2_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlay2_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlay2_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay2_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlay2_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay2_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay2_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlay2_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlay2_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlay2_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlay2_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) + +#endif + +/**************************************************************************** + * + * IDirectPlay3 (and IDirectPlay3A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay3 +DECLARE_INTERFACE_( IDirectPlay3, IDirectPlay2 ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + /*** IDirectPlay3 methods ***/ + STDMETHOD(AddGroupToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(CreateGroupInGroup) (THIS_ DPID,LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeleteGroupFromGroup) (THIS_ DPID,DPID) PURE; + STDMETHOD(EnumConnections) (THIS_ LPCGUID,LPDPENUMCONNECTIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroupsInGroup) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetGroupConnectionSettings)(THIS_ DWORD, DPID, LPVOID, LPDWORD) PURE; + STDMETHOD(InitializeConnection) (THIS_ LPVOID,DWORD) PURE; + STDMETHOD(SecureOpen) (THIS_ LPCDPSESSIONDESC2,DWORD,LPCDPSECURITYDESC,LPCDPCREDENTIALS) PURE; + STDMETHOD(SendChatMessage) (THIS_ DPID,DPID,DWORD,LPDPCHAT) PURE; + STDMETHOD(SetGroupConnectionSettings)(THIS_ DWORD,DPID,LPDPLCONNECTION) PURE; + STDMETHOD(StartSession) (THIS_ DWORD,DPID) PURE; + STDMETHOD(GetGroupFlags) (THIS_ DPID,LPDWORD) PURE; + STDMETHOD(GetGroupParent) (THIS_ DPID,LPDPID) PURE; + STDMETHOD(GetPlayerAccount) (THIS_ DPID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(GetPlayerFlags) (THIS_ DPID,LPDWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay3 interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay3_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay3_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay3_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay3_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlay3_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay3_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay3_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlay3_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay3_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay3_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay3_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay3_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay3_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlay3_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlay3_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlay3_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlay3_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlay3_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlay3_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlay3_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay3_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlay3_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay3_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay3_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlay3_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlay3_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlay3_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlay3_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) +#define IDirectPlay3_AddGroupToGroup(p,a,b) (p)->lpVtbl->AddGroupToGroup(p,a,b) +#define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->lpVtbl->CreateGroupInGroup(p,a,b,c,d,e,f) +#define IDirectPlay3_DeleteGroupFromGroup(p,a,b) (p)->lpVtbl->DeleteGroupFromGroup(p,a,b) +#define IDirectPlay3_EnumConnections(p,a,b,c,d) (p)->lpVtbl->EnumConnections(p,a,b,c,d) +#define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupsInGroup(p,a,b,c,d,e) +#define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetGroupConnectionSettings(p,a,b,c,d) +#define IDirectPlay3_InitializeConnection(p,a,b) (p)->lpVtbl->InitializeConnection(p,a,b) +#define IDirectPlay3_SecureOpen(p,a,b,c,d) (p)->lpVtbl->SecureOpen(p,a,b,c,d) +#define IDirectPlay3_SendChatMessage(p,a,b,c,d) (p)->lpVtbl->SendChatMessage(p,a,b,c,d) +#define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c) (p)->lpVtbl->SetGroupConnectionSettings(p,a,b,c) +#define IDirectPlay3_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b) +#define IDirectPlay3_GetGroupFlags(p,a,b) (p)->lpVtbl->GetGroupFlags(p,a,b) +#define IDirectPlay3_GetGroupParent(p,a,b) (p)->lpVtbl->GetGroupParent(p,a,b) +#define IDirectPlay3_GetPlayerAccount(p,a,b,c,d) (p)->lpVtbl->GetPlayerAccount(p,a,b,c,d) +#define IDirectPlay3_GetPlayerFlags(p,a,b) (p)->lpVtbl->GetPlayerFlags(p,a,b) + +#else /* C++ */ + +#define IDirectPlay3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay3_AddRef(p) (p)->AddRef() +#define IDirectPlay3_Release(p) (p)->Release() +#define IDirectPlay3_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay3_Close(p) (p)->Close() +#define IDirectPlay3_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlay3_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay3_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay3_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlay3_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay3_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay3_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay3_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay3_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay3_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlay3_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlay3_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlay3_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlay3_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlay3_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlay3_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlay3_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay3_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlay3_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay3_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay3_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlay3_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlay3_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlay3_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlay3_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) +#define IDirectPlay3_AddGroupToGroup(p,a,b) (p)->AddGroupToGroup(a,b) +#define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->CreateGroupInGroup(a,b,c,d,e,f) +#define IDirectPlay3_DeleteGroupFromGroup(p,a,b) (p)->DeleteGroupFromGroup(a,b) +#define IDirectPlay3_EnumConnections(p,a,b,c,d) (p)->EnumConnections(a,b,c,d) +#define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e) (p)->EnumGroupsInGroup(a,b,c,d,e) +#define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) (p)->GetGroupConnectionSettings(a,b,c,d) +#define IDirectPlay3_InitializeConnection(p,a,b) (p)->InitializeConnection(a,b) +#define IDirectPlay3_SecureOpen(p,a,b,c,d) (p)->SecureOpen(a,b,c,d) +#define IDirectPlay3_SendChatMessage(p,a,b,c,d) (p)->SendChatMessage(a,b,c,d) +#define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c) (p)->SetGroupConnectionSettings(a,b,c) +#define IDirectPlay3_StartSession(p,a,b) (p)->StartSession(a,b) +#define IDirectPlay3_GetGroupFlags(p,a,b) (p)->GetGroupFlags(a,b) +#define IDirectPlay3_GetGroupParent(p,a,b) (p)->GetGroupParent(a,b) +#define IDirectPlay3_GetPlayerAccount(p,a,b,c,d) (p)->GetPlayerAccount(a,b,c,d) +#define IDirectPlay3_GetPlayerFlags(p,a,b) (p)->GetPlayerFlags(a,b) + +#endif + +/**************************************************************************** + * + * IDirectPlay4 (and IDirectPlay4A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay4 +DECLARE_INTERFACE_( IDirectPlay4, IDirectPlay3 ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + /*** IDirectPlay3 methods ***/ + STDMETHOD(AddGroupToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(CreateGroupInGroup) (THIS_ DPID,LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeleteGroupFromGroup) (THIS_ DPID,DPID) PURE; + STDMETHOD(EnumConnections) (THIS_ LPCGUID,LPDPENUMCONNECTIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroupsInGroup) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetGroupConnectionSettings)(THIS_ DWORD, DPID, LPVOID, LPDWORD) PURE; + STDMETHOD(InitializeConnection) (THIS_ LPVOID,DWORD) PURE; + STDMETHOD(SecureOpen) (THIS_ LPCDPSESSIONDESC2,DWORD,LPCDPSECURITYDESC,LPCDPCREDENTIALS) PURE; + STDMETHOD(SendChatMessage) (THIS_ DPID,DPID,DWORD,LPDPCHAT) PURE; + STDMETHOD(SetGroupConnectionSettings)(THIS_ DWORD,DPID,LPDPLCONNECTION) PURE; + STDMETHOD(StartSession) (THIS_ DWORD,DPID) PURE; + STDMETHOD(GetGroupFlags) (THIS_ DPID,LPDWORD) PURE; + STDMETHOD(GetGroupParent) (THIS_ DPID,LPDPID) PURE; + STDMETHOD(GetPlayerAccount) (THIS_ DPID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(GetPlayerFlags) (THIS_ DPID,LPDWORD) PURE; + /*** IDirectPlay4 methods ***/ + STDMETHOD(GetGroupOwner) (THIS_ DPID, LPDPID) PURE; + STDMETHOD(SetGroupOwner) (THIS_ DPID, DPID) PURE; + STDMETHOD(SendEx) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD, DWORD, DWORD, LPVOID, DWORD_PTR *) PURE; + STDMETHOD(GetMessageQueue) (THIS_ DPID, DPID, DWORD, LPDWORD, LPDWORD) PURE; + STDMETHOD(CancelMessage) (THIS_ DWORD, DWORD) PURE; + STDMETHOD(CancelPriority) (THIS_ DWORD, DWORD, DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlayX interface macros (for IDirectPlay4 and beyond) + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlayX_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayX_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayX_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayX_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlayX_CancelMessage(p,a,b) (p)->lpVtbl->CancelMessage(p,a,b) +#define IDirectPlayX_CancelPriority(p,a,b,c) (p)->lpVtbl->CancelPriority(p,a,b,c) +#define IDirectPlayX_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlayX_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlayX_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlayX_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlayX_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlayX_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlayX_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlayX_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlayX_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlayX_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlayX_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlayX_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlayX_GetMessageQueue(p,a,b,c,d,e) (p)->lpVtbl->GetMessageQueue(p,a,b,c,d,e) +#define IDirectPlayX_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlayX_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlayX_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlayX_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlayX_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlayX_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlayX_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlayX_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlayX_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlayX_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlayX_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlayX_SendEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->SendEx(p,a,b,c,d,e,f,g,h,i) +#define IDirectPlayX_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlayX_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlayX_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlayX_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlayX_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) +#define IDirectPlayX_AddGroupToGroup(p,a,b) (p)->lpVtbl->AddGroupToGroup(p,a,b) +#define IDirectPlayX_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->lpVtbl->CreateGroupInGroup(p,a,b,c,d,e,f) +#define IDirectPlayX_DeleteGroupFromGroup(p,a,b) (p)->lpVtbl->DeleteGroupFromGroup(p,a,b) +#define IDirectPlayX_EnumConnections(p,a,b,c,d) (p)->lpVtbl->EnumConnections(p,a,b,c,d) +#define IDirectPlayX_EnumGroupsInGroup(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupsInGroup(p,a,b,c,d,e) +#define IDirectPlayX_GetGroupConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetGroupConnectionSettings(p,a,b,c,d) +#define IDirectPlayX_InitializeConnection(p,a,b) (p)->lpVtbl->InitializeConnection(p,a,b) +#define IDirectPlayX_SecureOpen(p,a,b,c,d) (p)->lpVtbl->SecureOpen(p,a,b,c,d) +#define IDirectPlayX_SendChatMessage(p,a,b,c,d) (p)->lpVtbl->SendChatMessage(p,a,b,c,d) +#define IDirectPlayX_SetGroupConnectionSettings(p,a,b,c) (p)->lpVtbl->SetGroupConnectionSettings(p,a,b,c) +#define IDirectPlayX_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b) +#define IDirectPlayX_GetGroupFlags(p,a,b) (p)->lpVtbl->GetGroupFlags(p,a,b) +#define IDirectPlayX_GetGroupParent(p,a,b) (p)->lpVtbl->GetGroupParent(p,a,b) +#define IDirectPlayX_GetPlayerAccount(p,a,b,c,d) (p)->lpVtbl->GetPlayerAccount(p,a,b,c,d) +#define IDirectPlayX_GetPlayerFlags(p,a,b) (p)->lpVtbl->GetPlayerFlags(p,a,b) +#define IDirectPlayX_GetGroupOwner(p,a,b) (p)->lpVtbl->GetGroupOwner(p,a,b) +#define IDirectPlayX_SetGroupOwner(p,a,b) (p)->lpVtbl->SetGroupOwner(p,a,b) + +#else /* C++ */ + +#define IDirectPlayX_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayX_AddRef(p) (p)->AddRef() +#define IDirectPlayX_Release(p) (p)->Release() +#define IDirectPlayX_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlayX_CancelMessage(p,a,b) (p)->CancelMessage(a,b) +#define IDirectPlayX_CancelPriority(p,a,b,c) (p)->CancelPriority(a,b,c) +#define IDirectPlayX_Close(p) (p)->Close() +#define IDirectPlayX_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlayX_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlayX_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlayX_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlayX_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlayX_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlayX_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlayX_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlayX_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlayX_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlayX_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlayX_GetMessageQueue(p,a,b,c,d,e) (p)->GetMessageQueue(a,b,c,d,e) +#define IDirectPlayX_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlayX_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlayX_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlayX_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlayX_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlayX_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlayX_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlayX_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlayX_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlayX_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlayX_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlayX_SendEx(p,a,b,c,d,e,f,g,h,i) (p)->SendEx(a,b,c,d,e,f,g,h,i) +#define IDirectPlayX_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlayX_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlayX_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlayX_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlayX_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) +#define IDirectPlayX_AddGroupToGroup(p,a,b) (p)->AddGroupToGroup(a,b) +#define IDirectPlayX_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->CreateGroupInGroup(a,b,c,d,e,f) +#define IDirectPlayX_DeleteGroupFromGroup(p,a,b) (p)->DeleteGroupFromGroup(a,b) +#define IDirectPlayX_EnumConnections(p,a,b,c,d) (p)->EnumConnections(a,b,c,d) +#define IDirectPlayX_EnumGroupsInGroup(p,a,b,c,d,e) (p)->EnumGroupsInGroup(a,b,c,d,e) +#define IDirectPlayX_GetGroupConnectionSettings(p,a,b,c,d) (p)->GetGroupConnectionSettings(a,b,c,d) +#define IDirectPlayX_InitializeConnection(p,a,b) (p)->InitializeConnection(a,b) +#define IDirectPlayX_SecureOpen(p,a,b,c,d) (p)->SecureOpen(a,b,c,d) +#define IDirectPlayX_SendChatMessage(p,a,b,c,d) (p)->SendChatMessage(a,b,c,d) +#define IDirectPlayX_SetGroupConnectionSettings(p,a,b,c) (p)->SetGroupConnectionSettings(a,b,c) +#define IDirectPlayX_StartSession(p,a,b) (p)->StartSession(a,b) +#define IDirectPlayX_GetGroupFlags(p,a,b) (p)->GetGroupFlags(a,b) +#define IDirectPlayX_GetGroupParent(p,a,b) (p)->GetGroupParent(a,b) +#define IDirectPlayX_GetPlayerAccount(p,a,b,c,d) (p)->GetPlayerAccount(a,b,c,d) +#define IDirectPlayX_GetPlayerFlags(p,a,b) (p)->GetPlayerFlags(a,b) +#define IDirectPlayX_GetGroupOwner(p,a,b) (p)->GetGroupOwner(a,b) +#define IDirectPlayX_SetGroupOwner(p,a,b) (p)->SetGroupOwner(a,b) + +#endif + +/**************************************************************************** + * + * EnumConnections API flags + * + ****************************************************************************/ + +/* + * Enumerate Service Providers + */ +#define DPCONNECTION_DIRECTPLAY 0x00000001 + +/* + * Enumerate Lobby Providers + */ +#define DPCONNECTION_DIRECTPLAYLOBBY 0x00000002 + + +/**************************************************************************** + * + * EnumPlayers API flags + * + ****************************************************************************/ + +/* + * Enumerate all players in the current session + */ +#define DPENUMPLAYERS_ALL 0x00000000 +#define DPENUMGROUPS_ALL DPENUMPLAYERS_ALL + + +/* + * Enumerate only local (created by this application) players + * or groups + */ +#define DPENUMPLAYERS_LOCAL 0x00000008 +#define DPENUMGROUPS_LOCAL DPENUMPLAYERS_LOCAL + +/* + * Enumerate only remote (non-local) players + * or groups + */ +#define DPENUMPLAYERS_REMOTE 0x00000010 +#define DPENUMGROUPS_REMOTE DPENUMPLAYERS_REMOTE + +/* + * Enumerate groups along with the players + */ +#define DPENUMPLAYERS_GROUP 0x00000020 + +/* + * Enumerate players or groups in another session + * (must supply lpguidInstance) + */ +#define DPENUMPLAYERS_SESSION 0x00000080 +#define DPENUMGROUPS_SESSION DPENUMPLAYERS_SESSION + +/* + * Enumerate server players + */ +#define DPENUMPLAYERS_SERVERPLAYER 0x00000100 + +/* + * Enumerate spectator players + */ +#define DPENUMPLAYERS_SPECTATOR 0x00000200 + +/* + * Enumerate shortcut groups + */ +#define DPENUMGROUPS_SHORTCUT 0x00000400 + +/* + * Enumerate staging area groups + */ +#define DPENUMGROUPS_STAGINGAREA 0x00000800 + +/* + * Enumerate hidden groups + */ +#define DPENUMGROUPS_HIDDEN 0x00001000 + +/* + * Enumerate the group's owner + */ +#define DPENUMPLAYERS_OWNER 0x00002000 + + +/**************************************************************************** + * + * CreatePlayer API flags + * + ****************************************************************************/ + +/* + * This flag indicates that this player should be designated + * the server player. The app should specify this at CreatePlayer. + */ +#define DPPLAYER_SERVERPLAYER DPENUMPLAYERS_SERVERPLAYER + +/* + * This flag indicates that this player should be designated + * a spectator. The app should specify this at CreatePlayer. + */ +#define DPPLAYER_SPECTATOR DPENUMPLAYERS_SPECTATOR + +/* + * This flag indicates that this player was created locally. + * (returned from GetPlayerFlags) + */ +#define DPPLAYER_LOCAL DPENUMPLAYERS_LOCAL + +/* + * This flag indicates that this player is the group's owner + * (Only returned in EnumGroupPlayers) + */ +#define DPPLAYER_OWNER DPENUMPLAYERS_OWNER + +/**************************************************************************** + * + * CreateGroup API flags + * + ****************************************************************************/ + + +/* + * This flag indicates that the StartSession can be called on the group. + * The app should specify this at CreateGroup, or CreateGroupInGroup. + */ +#define DPGROUP_STAGINGAREA DPENUMGROUPS_STAGINGAREA + +/* + * This flag indicates that this group was created locally. + * (returned from GetGroupFlags) + */ +#define DPGROUP_LOCAL DPENUMGROUPS_LOCAL + +/* + * This flag indicates that this group was created hidden. + */ +#define DPGROUP_HIDDEN DPENUMGROUPS_HIDDEN + + +/**************************************************************************** + * + * EnumSessions API flags + * + ****************************************************************************/ + +/* + * Enumerate sessions which can be joined + */ +#define DPENUMSESSIONS_AVAILABLE 0x00000001 + +/* + * Enumerate all sessions even if they can't be joined. + */ +#define DPENUMSESSIONS_ALL 0x00000002 + + +/* + * Start an asynchronous enum sessions + */ + #define DPENUMSESSIONS_ASYNC 0x00000010 + +/* + * Stop an asynchronous enum sessions + */ + #define DPENUMSESSIONS_STOPASYNC 0x00000020 + +/* + * Enumerate sessions even if they require a password + */ + #define DPENUMSESSIONS_PASSWORDREQUIRED 0x00000040 + +/* + * Return status about progress of enumeration instead of + * showing any status dialogs. + */ + #define DPENUMSESSIONS_RETURNSTATUS 0x00000080 + +/**************************************************************************** + * + * GetCaps and GetPlayerCaps API flags + * + ****************************************************************************/ + +/* + * The latency returned should be for guaranteed message sending. + * Default is non-guaranteed messaging. + */ +#define DPGETCAPS_GUARANTEED 0x00000001 + + +/**************************************************************************** + * + * GetGroupData, GetPlayerData API flags + * Remote and local Group/Player data is maintained separately. + * Default is DPGET_REMOTE. + * + ****************************************************************************/ + +/* + * Get the remote data (set by any DirectPlay object in + * the session using DPSET_REMOTE) + */ +#define DPGET_REMOTE 0x00000000 + +/* + * Get the local data (set by this DirectPlay object + * using DPSET_LOCAL) + */ +#define DPGET_LOCAL 0x00000001 + + +/**************************************************************************** + * + * Open API flags + * + ****************************************************************************/ + +/* + * Join the session that is described by the DPSESSIONDESC2 structure + */ +#define DPOPEN_JOIN 0x00000001 + +/* + * Create a new session as described by the DPSESSIONDESC2 structure + */ +#define DPOPEN_CREATE 0x00000002 + +/* + * Return status about progress of open instead of showing + * any status dialogs. + */ + #define DPOPEN_RETURNSTATUS DPENUMSESSIONS_RETURNSTATUS + + +/**************************************************************************** + * + * DPLCONNECTION flags + * + ****************************************************************************/ + +/* + * This application should create a new session as + * described by the DPSESIONDESC structure + */ +#define DPLCONNECTION_CREATESESSION DPOPEN_CREATE + +/* + * This application should join the session described by + * the DPSESIONDESC structure with the lpAddress data + */ +#define DPLCONNECTION_JOINSESSION DPOPEN_JOIN + +/**************************************************************************** + * + * Receive API flags + * Default is DPRECEIVE_ALL + * + ****************************************************************************/ + +/* + * Get the first message in the queue + */ +#define DPRECEIVE_ALL 0x00000001 + +/* + * Get the first message in the queue directed to a specific player + */ +#define DPRECEIVE_TOPLAYER 0x00000002 + +/* + * Get the first message in the queue from a specific player + */ +#define DPRECEIVE_FROMPLAYER 0x00000004 + +/* + * Get the message but don't remove it from the queue + */ +#define DPRECEIVE_PEEK 0x00000008 + + +/**************************************************************************** + * + * Send API flags + * + ****************************************************************************/ + +/* + * Send the message using a guaranteed send method. + * Default is non-guaranteed. + */ +#define DPSEND_GUARANTEED 0x00000001 + + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_HIGHPRIORITY 0x00000002 + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_OPENSTREAM 0x00000008 + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_CLOSESTREAM 0x00000010 + +/* + * Send the message digitally signed to ensure authenticity. + */ +#define DPSEND_SIGNED 0x00000020 + +/* + * Send the message with encryption to ensure privacy. + */ +#define DPSEND_ENCRYPTED 0x00000040 + +/* + * The message is a lobby system message + */ +#define DPSEND_LOBBYSYSTEMMESSAGE 0x00000080 + + +/* + * Send message asynchronously, must check caps + * before using this flag. It is always provided + * if the protocol flag is set. + */ +#define DPSEND_ASYNC 0x00000200 + +/* + * When an message is completed, don't tell me. + * by default the application is notified with a system message. + */ +#define DPSEND_NOSENDCOMPLETEMSG 0x00000400 + + +/* + * Maximum priority for sends available to applications + */ +#define DPSEND_MAX_PRI 0x0000FFFF +#define DPSEND_MAX_PRIORITY DPSEND_MAX_PRI + + +/**************************************************************************** + * + * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName, + * SetSessionDesc API flags. + * Default is DPSET_REMOTE. + * + ****************************************************************************/ + +/* + * Propagate the data to all players in the session + */ +#define DPSET_REMOTE 0x00000000 + +/* + * Do not propagate the data to other players + */ +#define DPSET_LOCAL 0x00000001 + +/* + * Used with DPSET_REMOTE, use guaranteed message send to + * propagate the data + */ +#define DPSET_GUARANTEED 0x00000002 + +/**************************************************************************** + * + * GetMessageQueue API flags. + * Default is DPMESSAGEQUEUE_SEND + * + ****************************************************************************/ + +/* + * Get Send Queue - requires Service Provider Support + */ +#define DPMESSAGEQUEUE_SEND 0x00000001 + +/* + * Get Receive Queue + */ +#define DPMESSAGEQUEUE_RECEIVE 0x00000002 + + +/**************************************************************************** + * + * Connect API flags + * + ****************************************************************************/ + + +/* + * Start an asynchronous connect which returns status codes + */ +#define DPCONNECT_RETURNSTATUS (DPENUMSESSIONS_RETURNSTATUS) + + +/**************************************************************************** + * + * DirectPlay system messages and message data structures + * + * All system message come 'From' player DPID_SYSMSG. To determine what type + * of message it is, cast the lpData from Receive to DPMSG_GENERIC and check + * the dwType member against one of the following DPSYS_xxx constants. Once + * a match is found, cast the lpData to the corresponding of the DPMSG_xxx + * structures to access the data of the message. + * + ****************************************************************************/ + +/* + * A new player or group has been created in the session + * Use DPMSG_CREATEPLAYERORGROUP. Check dwPlayerType to see if it + * is a player or a group. + */ +#define DPSYS_CREATEPLAYERORGROUP 0x0003 + +/* + * A player has been deleted from the session + * Use DPMSG_DESTROYPLAYERORGROUP + */ +#define DPSYS_DESTROYPLAYERORGROUP 0x0005 + +/* + * A player has been added to a group + * Use DPMSG_ADDPLAYERTOGROUP + */ +#define DPSYS_ADDPLAYERTOGROUP 0x0007 + +/* + * A player has been removed from a group + * Use DPMSG_DELETEPLAYERFROMGROUP + */ +#define DPSYS_DELETEPLAYERFROMGROUP 0x0021 + +/* + * This DirectPlay object lost its connection with all the + * other players in the session. + * Use DPMSG_SESSIONLOST. + */ +#define DPSYS_SESSIONLOST 0x0031 + +/* + * The current host has left the session. + * This DirectPlay object is now the host. + * Use DPMSG_HOST. + */ +#define DPSYS_HOST 0x0101 + +/* + * The remote data associated with a player or + * group has changed. Check dwPlayerType to see + * if it is a player or a group + * Use DPMSG_SETPLAYERORGROUPDATA + */ +#define DPSYS_SETPLAYERORGROUPDATA 0x0102 + +/* + * The name of a player or group has changed. + * Check dwPlayerType to see if it is a player + * or a group. + * Use DPMSG_SETPLAYERORGROUPNAME + */ +#define DPSYS_SETPLAYERORGROUPNAME 0x0103 + +/* + * The session description has changed. + * Use DPMSG_SETSESSIONDESC + */ +#define DPSYS_SETSESSIONDESC 0x0104 + +/* + * A group has been added to a group + * Use DPMSG_ADDGROUPTOGROUP + */ +#define DPSYS_ADDGROUPTOGROUP 0x0105 + +/* + * A group has been removed from a group + * Use DPMSG_DELETEGROUPFROMGROUP + */ +#define DPSYS_DELETEGROUPFROMGROUP 0x0106 + +/* + * A secure player-player message has arrived. + * Use DPMSG_SECUREMESSAGE + */ +#define DPSYS_SECUREMESSAGE 0x0107 + +/* + * Start a new session. + * Use DPMSG_STARTSESSION + */ +#define DPSYS_STARTSESSION 0x0108 + +/* + * A chat message has arrived + * Use DPMSG_CHAT + */ +#define DPSYS_CHAT 0x0109 + +/* + * The owner of a group has changed + * Use DPMSG_SETGROUPOWNER + */ +#define DPSYS_SETGROUPOWNER 0x010A + +/* + * An async send has finished, failed or been cancelled + * Use DPMSG_SENDCOMPLETE + */ +#define DPSYS_SENDCOMPLETE 0x010d + + +/* + * Used in the dwPlayerType field to indicate if it applies to a group + * or a player + */ +#define DPPLAYERTYPE_GROUP 0x00000000 +#define DPPLAYERTYPE_PLAYER 0x00000001 + + +/* + * DPMSG_GENERIC + * Generic message structure used to identify the message type. + */ +typedef struct +{ + DWORD dwType; // Message type +} DPMSG_GENERIC, FAR *LPDPMSG_GENERIC; + +/* + * DPMSG_CREATEPLAYERORGROUP + * System message generated when a new player or group + * created in the session with information about it. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of the player or group + DWORD dwCurrentPlayers; // current # players & groups in session + LPVOID lpData; // pointer to remote data + DWORD dwDataSize; // size of remote data + DPNAME dpnName; // structure with name info + // the following fields are only available when using + // the IDirectPlay3 interface or greater + DPID dpIdParent; // id of parent group + DWORD dwFlags; // player or group flags +} DPMSG_CREATEPLAYERORGROUP, FAR *LPDPMSG_CREATEPLAYERORGROUP; + +/* + * DPMSG_DESTROYPLAYERORGROUP + * System message generated when a player or group is being + * destroyed in the session with information about it. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // player ID being deleted + LPVOID lpLocalData; // copy of players local data + DWORD dwLocalDataSize; // sizeof local data + LPVOID lpRemoteData; // copy of players remote data + DWORD dwRemoteDataSize; // sizeof remote data + // the following fields are only available when using + // the IDirectPlay3 interface or greater + DPNAME dpnName; // structure with name info + DPID dpIdParent; // id of parent group + DWORD dwFlags; // player or group flags +} DPMSG_DESTROYPLAYERORGROUP, FAR *LPDPMSG_DESTROYPLAYERORGROUP; + +/* + * DPMSG_ADDPLAYERTOGROUP + * System message generated when a player is being added + * to a group. + */ +typedef struct +{ + DWORD dwType; // Message type + DPID dpIdGroup; // group ID being added to + DPID dpIdPlayer; // player ID being added +} DPMSG_ADDPLAYERTOGROUP, FAR *LPDPMSG_ADDPLAYERTOGROUP; + +/* + * DPMSG_DELETEPLAYERFROMGROUP + * System message generated when a player is being + * removed from a group + */ +typedef DPMSG_ADDPLAYERTOGROUP DPMSG_DELETEPLAYERFROMGROUP; +typedef DPMSG_DELETEPLAYERFROMGROUP FAR *LPDPMSG_DELETEPLAYERFROMGROUP; + +/* + * DPMSG_ADDGROUPTOGROUP + * System message generated when a group is being added + * to a group. + */ +typedef struct +{ + DWORD dwType; // Message type + DPID dpIdParentGroup; // group ID being added to + DPID dpIdGroup; // group ID being added +} DPMSG_ADDGROUPTOGROUP, FAR *LPDPMSG_ADDGROUPTOGROUP; + +/* + * DPMSG_DELETEGROUPFROMGROUP + * System message generated when a GROUP is being + * removed from a group + */ +typedef DPMSG_ADDGROUPTOGROUP DPMSG_DELETEGROUPFROMGROUP; +typedef DPMSG_DELETEGROUPFROMGROUP FAR *LPDPMSG_DELETEGROUPFROMGROUP; + +/* + * DPMSG_SETPLAYERORGROUPDATA + * System message generated when remote data for a player or + * group has changed. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of player or group + LPVOID lpData; // pointer to remote data + DWORD dwDataSize; // size of remote data +} DPMSG_SETPLAYERORGROUPDATA, FAR *LPDPMSG_SETPLAYERORGROUPDATA; + +/* + * DPMSG_SETPLAYERORGROUPNAME + * System message generated when the name of a player or + * group has changed. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of player or group + DPNAME dpnName; // structure with new name info +} DPMSG_SETPLAYERORGROUPNAME, FAR *LPDPMSG_SETPLAYERORGROUPNAME; + +/* + * DPMSG_SETSESSIONDESC + * System message generated when session desc has changed + */ +typedef struct +{ + DWORD dwType; // Message type + DPSESSIONDESC2 dpDesc; // Session desc +} DPMSG_SETSESSIONDESC, FAR *LPDPMSG_SETSESSIONDESC; + +/* + * DPMSG_HOST + * System message generated when the host has migrated to this + * DirectPlay object. + * + */ +typedef DPMSG_GENERIC DPMSG_HOST; +typedef DPMSG_HOST FAR *LPDPMSG_HOST; + +/* + * DPMSG_SESSIONLOST + * System message generated when the connection to the session is lost. + * + */ +typedef DPMSG_GENERIC DPMSG_SESSIONLOST; +typedef DPMSG_SESSIONLOST FAR *LPDPMSG_SESSIONLOST; + +/* + * DPMSG_SECUREMESSAGE + * System message generated when a player requests a secure send + */ +typedef struct +{ + DWORD dwType; // Message Type + DWORD dwFlags; // Signed/Encrypted + DPID dpIdFrom; // ID of Sending Player + LPVOID lpData; // Player message + DWORD dwDataSize; // Size of player message +} DPMSG_SECUREMESSAGE, FAR *LPDPMSG_SECUREMESSAGE; + +/* + * DPMSG_STARTSESSION + * System message containing all information required to + * start a new session + */ +typedef struct +{ + DWORD dwType; // Message type + LPDPLCONNECTION lpConn; // DPLCONNECTION structure +} DPMSG_STARTSESSION, FAR *LPDPMSG_STARTSESSION; + +/* + * DPMSG_CHAT + * System message containing a chat message + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwFlags; // Message flags + DPID idFromPlayer; // ID of the Sending Player + DPID idToPlayer; // ID of the To Player + DPID idToGroup; // ID of the To Group + LPDPCHAT lpChat; // Pointer to a structure containing the chat message +} DPMSG_CHAT, FAR *LPDPMSG_CHAT; + +/* + * DPMSG_SETGROUPOWNER + * System message generated when the owner of a group has changed + */ +typedef struct +{ + DWORD dwType; // Message type + DPID idGroup; // ID of the group + DPID idNewOwner; // ID of the player that is the new owner + DPID idOldOwner; // ID of the player that used to be the owner +} DPMSG_SETGROUPOWNER, FAR *LPDPMSG_SETGROUPOWNER; + +/* + * DPMSG_SENDCOMPLETE + * System message generated when finished with an Async Send message + * + * NOTE SENDPARMS has an overlay for DPMSG_SENDCOMPLETE, don't + * change this message w/o changing SENDPARMS. + */ +typedef struct +{ + DWORD dwType; + DPID idFrom; + DPID idTo; + DWORD dwFlags; + DWORD dwPriority; + DWORD dwTimeout; + LPVOID lpvContext; + DWORD dwMsgID; + HRESULT hr; + DWORD dwSendTime; +} DPMSG_SENDCOMPLETE, *LPDPMSG_SENDCOMPLETE; + +/**************************************************************************** + * + * DIRECTPLAY ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ +#define DP_OK S_OK +#define DPERR_ALREADYINITIALIZED MAKE_DPHRESULT( 5 ) +#define DPERR_ACCESSDENIED MAKE_DPHRESULT( 10 ) +#define DPERR_ACTIVEPLAYERS MAKE_DPHRESULT( 20 ) +#define DPERR_BUFFERTOOSMALL MAKE_DPHRESULT( 30 ) +#define DPERR_CANTADDPLAYER MAKE_DPHRESULT( 40 ) +#define DPERR_CANTCREATEGROUP MAKE_DPHRESULT( 50 ) +#define DPERR_CANTCREATEPLAYER MAKE_DPHRESULT( 60 ) +#define DPERR_CANTCREATESESSION MAKE_DPHRESULT( 70 ) +#define DPERR_CAPSNOTAVAILABLEYET MAKE_DPHRESULT( 80 ) +#define DPERR_EXCEPTION MAKE_DPHRESULT( 90 ) +#define DPERR_GENERIC E_FAIL +#define DPERR_INVALIDFLAGS MAKE_DPHRESULT( 120 ) +#define DPERR_INVALIDOBJECT MAKE_DPHRESULT( 130 ) +#define DPERR_INVALIDPARAM E_INVALIDARG +#define DPERR_INVALIDPARAMS DPERR_INVALIDPARAM +#define DPERR_INVALIDPLAYER MAKE_DPHRESULT( 150 ) +#define DPERR_INVALIDGROUP MAKE_DPHRESULT( 155 ) +#define DPERR_NOCAPS MAKE_DPHRESULT( 160 ) +#define DPERR_NOCONNECTION MAKE_DPHRESULT( 170 ) +#define DPERR_NOMEMORY E_OUTOFMEMORY +#define DPERR_OUTOFMEMORY DPERR_NOMEMORY +#define DPERR_NOMESSAGES MAKE_DPHRESULT( 190 ) +#define DPERR_NONAMESERVERFOUND MAKE_DPHRESULT( 200 ) +#define DPERR_NOPLAYERS MAKE_DPHRESULT( 210 ) +#define DPERR_NOSESSIONS MAKE_DPHRESULT( 220 ) +#define DPERR_PENDING E_PENDING +#define DPERR_SENDTOOBIG MAKE_DPHRESULT( 230 ) +#define DPERR_TIMEOUT MAKE_DPHRESULT( 240 ) +#define DPERR_UNAVAILABLE MAKE_DPHRESULT( 250 ) +#define DPERR_UNSUPPORTED E_NOTIMPL +#define DPERR_BUSY MAKE_DPHRESULT( 270 ) +#define DPERR_USERCANCEL MAKE_DPHRESULT( 280 ) +#define DPERR_NOINTERFACE E_NOINTERFACE +#define DPERR_CANNOTCREATESERVER MAKE_DPHRESULT( 290 ) +#define DPERR_PLAYERLOST MAKE_DPHRESULT( 300 ) +#define DPERR_SESSIONLOST MAKE_DPHRESULT( 310 ) +#define DPERR_UNINITIALIZED MAKE_DPHRESULT( 320 ) +#define DPERR_NONEWPLAYERS MAKE_DPHRESULT( 330 ) +#define DPERR_INVALIDPASSWORD MAKE_DPHRESULT( 340 ) +#define DPERR_CONNECTING MAKE_DPHRESULT( 350 ) +#define DPERR_CONNECTIONLOST MAKE_DPHRESULT( 360 ) +#define DPERR_UNKNOWNMESSAGE MAKE_DPHRESULT( 370 ) +#define DPERR_CANCELFAILED MAKE_DPHRESULT( 380 ) +#define DPERR_INVALIDPRIORITY MAKE_DPHRESULT( 390 ) +#define DPERR_NOTHANDLED MAKE_DPHRESULT( 400 ) +#define DPERR_CANCELLED MAKE_DPHRESULT( 410 ) +#define DPERR_ABORTED MAKE_DPHRESULT( 420 ) + + +#define DPERR_BUFFERTOOLARGE MAKE_DPHRESULT( 1000 ) +#define DPERR_CANTCREATEPROCESS MAKE_DPHRESULT( 1010 ) +#define DPERR_APPNOTSTARTED MAKE_DPHRESULT( 1020 ) +#define DPERR_INVALIDINTERFACE MAKE_DPHRESULT( 1030 ) +#define DPERR_NOSERVICEPROVIDER MAKE_DPHRESULT( 1040 ) +#define DPERR_UNKNOWNAPPLICATION MAKE_DPHRESULT( 1050 ) +#define DPERR_NOTLOBBIED MAKE_DPHRESULT( 1070 ) +#define DPERR_SERVICEPROVIDERLOADED MAKE_DPHRESULT( 1080 ) +#define DPERR_ALREADYREGISTERED MAKE_DPHRESULT( 1090 ) +#define DPERR_NOTREGISTERED MAKE_DPHRESULT( 1100 ) + +// +// Security related errors +// +#define DPERR_AUTHENTICATIONFAILED MAKE_DPHRESULT( 2000 ) +#define DPERR_CANTLOADSSPI MAKE_DPHRESULT( 2010 ) +#define DPERR_ENCRYPTIONFAILED MAKE_DPHRESULT( 2020 ) +#define DPERR_SIGNFAILED MAKE_DPHRESULT( 2030 ) +#define DPERR_CANTLOADSECURITYPACKAGE MAKE_DPHRESULT( 2040 ) +#define DPERR_ENCRYPTIONNOTSUPPORTED MAKE_DPHRESULT( 2050 ) +#define DPERR_CANTLOADCAPI MAKE_DPHRESULT( 2060 ) +#define DPERR_NOTLOGGEDIN MAKE_DPHRESULT( 2070 ) +#define DPERR_LOGONDENIED MAKE_DPHRESULT( 2080 ) + + +/**************************************************************************** + * + * dplay 1.0 obsolete structures + interfaces + * Included for compatibility only. New apps should + * use IDirectPlay2 + * + ****************************************************************************/ + +// define this to ignore obsolete interfaces and constants +#ifndef IDIRECTPLAY2_OR_GREATER + +#define DPOPEN_OPENSESSION DPOPEN_JOIN +#define DPOPEN_CREATESESSION DPOPEN_CREATE + +#define DPENUMSESSIONS_PREVIOUS 0x00000004 + +#define DPENUMPLAYERS_PREVIOUS 0x00000004 + +#define DPSEND_GUARANTEE DPSEND_GUARANTEED +#define DPSEND_TRYONCE 0x00000004 + +#define DPCAPS_NAMESERVICE 0x00000001 +#define DPCAPS_NAMESERVER DPCAPS_ISHOST +#define DPCAPS_GUARANTEED 0x00000004 + +#define DPLONGNAMELEN 52 +#define DPSHORTNAMELEN 20 +#define DPSESSIONNAMELEN 32 +#define DPPASSWORDLEN 16 +#define DPUSERRESERVED 16 + +#define DPSYS_ADDPLAYER 0x0003 +#define DPSYS_DELETEPLAYER 0x0005 + +#define DPSYS_DELETEGROUP 0x0020 +#define DPSYS_DELETEPLAYERFROMGRP 0x0021 +#define DPSYS_CONNECT 0x484b + +typedef struct +{ + DWORD dwType; + DWORD dwPlayerType; + DPID dpId; + char szLongName[DPLONGNAMELEN]; + char szShortName[DPSHORTNAMELEN]; + DWORD dwCurrentPlayers; +} DPMSG_ADDPLAYER; + +typedef DPMSG_ADDPLAYER DPMSG_ADDGROUP; + +typedef struct +{ + DWORD dwType; + DPID dpIdGroup; + DPID dpIdPlayer; +} DPMSG_GROUPADD; + +typedef DPMSG_GROUPADD DPMSG_GROUPDELETE; +typedef struct +{ + DWORD dwType; + DPID dpId; +} DPMSG_DELETEPLAYER; + +typedef BOOL (PASCAL *LPDPENUMPLAYERSCALLBACK)( + DPID dpId, + LPSTR lpFriendlyName, + LPSTR lpFormalName, + DWORD dwFlags, + LPVOID lpContext ); + +typedef struct +{ + DWORD dwSize; + GUID guidSession; + DWORD_PTR dwSession; + DWORD dwMaxPlayers; + DWORD dwCurrentPlayers; + DWORD dwFlags; + char szSessionName[DPSESSIONNAMELEN]; + char szUserField[DPUSERRESERVED]; + DWORD_PTR dwReserved1; + char szPassword[DPPASSWORDLEN]; + DWORD_PTR dwReserved2; + DWORD_PTR dwUser1; + DWORD_PTR dwUser2; + DWORD_PTR dwUser3; + DWORD_PTR dwUser4; +} DPSESSIONDESC,*LPDPSESSIONDESC; + +typedef BOOL (PASCAL * LPDPENUMSESSIONSCALLBACK)( + LPDPSESSIONDESC lpDPSessionDesc, + LPVOID lpContext, + LPDWORD lpdwTimeOut, + DWORD dwFlags); + +/* + * IDirectPlay + */ +#undef INTERFACE +#define INTERFACE IDirectPlay +DECLARE_INTERFACE_( IDirectPlay, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPSTR,LPSTR,LPHANDLE) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPSTR,LPSTR) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(EnableNewPlayers) (THIS_ BOOL) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ DWORD_PTR, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ DWORD_PTR, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC,DWORD,LPDPENUMSESSIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID, LPDPCAPS) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPSTR,LPDWORD,LPSTR,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(SaveSession) (THIS_ LPSTR) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPSTR,LPSTR) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay_CreateGroup(p,a,b,c) (p)->lpVtbl->CreateGroup(p,a,b,c) +#define IDirectPlay_CreatePlayer(p,a,b,c,d) (p)->lpVtbl->CreatePlayer(p,a,b,c,d) +#define IDirectPlay_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay_EnableNewPlayers(p,a) (p)->lpVtbl->EnableNewPlayers(p,a) +#define IDirectPlay_EnumGroupPlayers(p,a,b,c,d) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d) +#define IDirectPlay_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectPlay_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay_GetPlayerCaps(p,a,b) (p)->lpVtbl->GetPlayerCaps(p,a,b) +#define IDirectPlay_GetPlayerName(p,a,b,c,d,e) (p)->lpVtbl->GetPlayerName(p,a,b,c,d,e) +#define IDirectPlay_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay_Open(p,a) (p)->lpVtbl->Open(p,a) +#define IDirectPlay_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay_SaveSession(p,a) (p)->lpVtbl->SaveSession(p,a) +#define IDirectPlay_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay_Close(p) (p)->Close() +#define IDirectPlay_CreateGroup(p,a,b,c) (p)->CreateGroup(a,b,c) +#define IDirectPlay_CreatePlayer(p,a,b,c,d) (p)->CreatePlayer(a,b,c,d) +#define IDirectPlay_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay_EnableNewPlayers(p,a) (p)->EnableNewPlayers(a) +#define IDirectPlay_EnumGroupPlayers(p,a,b,c,d) (p)->EnumGroupPlayers(a,b,c,d) +#define IDirectPlay_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectPlay_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay_GetPlayerCaps(p,a,b) (p)->GetPlayerCaps(a,b) +#define IDirectPlay_GetPlayerName(p,a,b,c,d,e) (p)->GetPlayerName(a,b,c,d,e) +#define IDirectPlay_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay_Open(p,a) (p)->Open(a) +#define IDirectPlay_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay_SaveSession(p,a) (p)->SaveSession(a) +#define IDirectPlay_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) + +#endif + +DEFINE_GUID(IID_IDirectPlay, 0x5454e9a0, 0xdb65, 0x11ce, 0x92, 0x1c, 0x00, 0xaa, 0x00, 0x6c, 0x49, 0x72); + +#endif // IDIRECTPLAY2_OR_GREATER + +/**************************************************************************** + * + * IDirectPlay macros (included regardless of IDIRECTPLAY2_OR_GREATER flag) + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay_Release(p) (p)->lpVtbl->Release(p) + +#else + +#define IDirectPlay_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay_AddRef(p) (p)->AddRef() +#define IDirectPlay_Release(p) (p)->Release() + +#endif // IDirectPlay interface macros + +#ifdef __cplusplus +}; +#endif + +/* restore warning settings */ +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif + diff --git a/saco/d3d9/include/dplay8.h b/saco/d3d9/include/dplay8.h new file mode 100644 index 0000000..c6799a9 --- /dev/null +++ b/saco/d3d9/include/dplay8.h @@ -0,0 +1,1456 @@ +/*========================================================================== + * + * Copyright (C) 1998-2002 Microsoft Corporation. All Rights Reserved. + * + * File: DPlay8.h + * Content: DirectPlay8 include file + * + ***************************************************************************/ + +#ifndef __DIRECTPLAY8_H__ +#define __DIRECTPLAY8_H__ + +#include // for DECLARE_INTERFACE_ and HRESULT + +#include "dpaddr.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + + +/**************************************************************************** + * + * DirectPlay8 CLSIDs + * + ****************************************************************************/ + +// {743F1DC6-5ABA-429f-8BDF-C54D03253DC2} +DEFINE_GUID(CLSID_DirectPlay8Client, +0x743f1dc6, 0x5aba, 0x429f, 0x8b, 0xdf, 0xc5, 0x4d, 0x3, 0x25, 0x3d, 0xc2); + +// {DA825E1B-6830-43d7-835D-0B5AD82956A2} +DEFINE_GUID(CLSID_DirectPlay8Server, +0xda825e1b, 0x6830, 0x43d7, 0x83, 0x5d, 0xb, 0x5a, 0xd8, 0x29, 0x56, 0xa2); + +// {286F484D-375E-4458-A272-B138E2F80A6A} +DEFINE_GUID(CLSID_DirectPlay8Peer, +0x286f484d, 0x375e, 0x4458, 0xa2, 0x72, 0xb1, 0x38, 0xe2, 0xf8, 0xa, 0x6a); + + +// CLSIDs added for DirectX 9 + +// {FC47060E-6153-4b34-B975-8E4121EB7F3C} +DEFINE_GUID(CLSID_DirectPlay8ThreadPool, +0xfc47060e, 0x6153, 0x4b34, 0xb9, 0x75, 0x8e, 0x41, 0x21, 0xeb, 0x7f, 0x3c); + +// {E4C1D9A2-CBF7-48bd-9A69-34A55E0D8941} +DEFINE_GUID(CLSID_DirectPlay8NATResolver, +0xe4c1d9a2, 0xcbf7, 0x48bd, 0x9a, 0x69, 0x34, 0xa5, 0x5e, 0xd, 0x89, 0x41); + +/**************************************************************************** + * + * DirectPlay8 Interface IIDs + * + ****************************************************************************/ + +typedef REFIID DP8REFIID; + + +// {5102DACD-241B-11d3-AEA7-006097B01411} +DEFINE_GUID(IID_IDirectPlay8Client, +0x5102dacd, 0x241b, 0x11d3, 0xae, 0xa7, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +// {5102DACE-241B-11d3-AEA7-006097B01411} +DEFINE_GUID(IID_IDirectPlay8Server, +0x5102dace, 0x241b, 0x11d3, 0xae, 0xa7, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +// {5102DACF-241B-11d3-AEA7-006097B01411} +DEFINE_GUID(IID_IDirectPlay8Peer, +0x5102dacf, 0x241b, 0x11d3, 0xae, 0xa7, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// IIDs added for DirectX 9 + +// {0D22EE73-4A46-4a0d-89B2-045B4D666425} +DEFINE_GUID(IID_IDirectPlay8ThreadPool, +0xd22ee73, 0x4a46, 0x4a0d, 0x89, 0xb2, 0x4, 0x5b, 0x4d, 0x66, 0x64, 0x25); + +// {A9E213F2-9A60-486f-BF3B-53408B6D1CBB} +DEFINE_GUID(IID_IDirectPlay8NATResolver, +0xa9e213f2, 0x9a60, 0x486f, 0xbf, 0x3b, 0x53, 0x40, 0x8b, 0x6d, 0x1c, 0xbb); + +/**************************************************************************** + * + * DirectPlay8 Service Provider GUIDs + * + ****************************************************************************/ + + +// {53934290-628D-11D2-AE0F-006097B01411} +DEFINE_GUID(CLSID_DP8SP_IPX, +0x53934290, 0x628d, 0x11d2, 0xae, 0xf, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// {6D4A3650-628D-11D2-AE0F-006097B01411} +DEFINE_GUID(CLSID_DP8SP_MODEM, +0x6d4a3650, 0x628d, 0x11d2, 0xae, 0xf, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// {743B5D60-628D-11D2-AE0F-006097B01411} +DEFINE_GUID(CLSID_DP8SP_SERIAL, +0x743b5d60, 0x628d, 0x11d2, 0xae, 0xf, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// {EBFE7BA0-628D-11D2-AE0F-006097B01411} +DEFINE_GUID(CLSID_DP8SP_TCPIP, +0xebfe7ba0, 0x628d, 0x11d2, 0xae, 0xf, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// Service providers added for DirectX 9 + + +// {995513AF-3027-4b9a-956E-C772B3F78006} +DEFINE_GUID(CLSID_DP8SP_BLUETOOTH, +0x995513af, 0x3027, 0x4b9a, 0x95, 0x6e, 0xc7, 0x72, 0xb3, 0xf7, 0x80, 0x6); + + +/**************************************************************************** + * + * DirectPlay8 Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDirectPlay8Client *PDIRECTPLAY8CLIENT; + +typedef struct IDirectPlay8Server *PDIRECTPLAY8SERVER; + +typedef struct IDirectPlay8Peer *PDIRECTPLAY8PEER; + + +// Interface pointers added for DirectX 9 + +typedef struct IDirectPlay8ThreadPool *PDIRECTPLAY8THREADPOOL; + +typedef struct IDirectPlay8NATResolver *PDIRECTPLAY8NATRESOLVER; + +/**************************************************************************** + * + * DirectPlay8 Forward Declarations For External Types + * + ****************************************************************************/ + +typedef struct IDirectPlay8LobbiedApplication *PDNLOBBIEDAPPLICATION; +typedef struct IDirectPlay8Address IDirectPlay8Address; + +/**************************************************************************** + * + * DirectPlay8 Callback Functions + * + ****************************************************************************/ + +// +// Callback Function Type Definition +// +typedef HRESULT (WINAPI *PFNDPNMESSAGEHANDLER)(PVOID,DWORD,PVOID); + +/**************************************************************************** + * + * DirectPlay8 Datatypes (Non-Structure / Non-Message) + * + ****************************************************************************/ + +// +// Player IDs. Used to uniquely identify a player in a session +// +typedef DWORD DPNID, *PDPNID; + +// +// Used as identifiers for operations +// +typedef DWORD DPNHANDLE, *PDPNHANDLE; + + + + +/**************************************************************************** + * + * DirectPlay8 Message Identifiers + * + ****************************************************************************/ + +#define DPN_MSGID_OFFSET 0xFFFF0000 +#define DPN_MSGID_ADD_PLAYER_TO_GROUP ( DPN_MSGID_OFFSET | 0x0001 ) +#define DPN_MSGID_APPLICATION_DESC ( DPN_MSGID_OFFSET | 0x0002 ) +#define DPN_MSGID_ASYNC_OP_COMPLETE ( DPN_MSGID_OFFSET | 0x0003 ) +#define DPN_MSGID_CLIENT_INFO ( DPN_MSGID_OFFSET | 0x0004 ) +#define DPN_MSGID_CONNECT_COMPLETE ( DPN_MSGID_OFFSET | 0x0005 ) +#define DPN_MSGID_CREATE_GROUP ( DPN_MSGID_OFFSET | 0x0006 ) +#define DPN_MSGID_CREATE_PLAYER ( DPN_MSGID_OFFSET | 0x0007 ) +#define DPN_MSGID_DESTROY_GROUP ( DPN_MSGID_OFFSET | 0x0008 ) +#define DPN_MSGID_DESTROY_PLAYER ( DPN_MSGID_OFFSET | 0x0009 ) +#define DPN_MSGID_ENUM_HOSTS_QUERY ( DPN_MSGID_OFFSET | 0x000a ) +#define DPN_MSGID_ENUM_HOSTS_RESPONSE ( DPN_MSGID_OFFSET | 0x000b ) +#define DPN_MSGID_GROUP_INFO ( DPN_MSGID_OFFSET | 0x000c ) +#define DPN_MSGID_HOST_MIGRATE ( DPN_MSGID_OFFSET | 0x000d ) +#define DPN_MSGID_INDICATE_CONNECT ( DPN_MSGID_OFFSET | 0x000e ) +#define DPN_MSGID_INDICATED_CONNECT_ABORTED ( DPN_MSGID_OFFSET | 0x000f ) +#define DPN_MSGID_PEER_INFO ( DPN_MSGID_OFFSET | 0x0010 ) +#define DPN_MSGID_RECEIVE ( DPN_MSGID_OFFSET | 0x0011 ) +#define DPN_MSGID_REMOVE_PLAYER_FROM_GROUP ( DPN_MSGID_OFFSET | 0x0012 ) +#define DPN_MSGID_RETURN_BUFFER ( DPN_MSGID_OFFSET | 0x0013 ) +#define DPN_MSGID_SEND_COMPLETE ( DPN_MSGID_OFFSET | 0x0014 ) +#define DPN_MSGID_SERVER_INFO ( DPN_MSGID_OFFSET | 0x0015 ) +#define DPN_MSGID_TERMINATE_SESSION ( DPN_MSGID_OFFSET | 0x0016 ) + +// Messages added for DirectX 9 +#define DPN_MSGID_CREATE_THREAD ( DPN_MSGID_OFFSET | 0x0017 ) +#define DPN_MSGID_DESTROY_THREAD ( DPN_MSGID_OFFSET | 0x0018 ) +#define DPN_MSGID_NAT_RESOLVER_QUERY ( DPN_MSGID_OFFSET | 0x0101 ) + +/**************************************************************************** + * + * DirectPlay8 Constants + * + ****************************************************************************/ + +#define DPNID_ALL_PLAYERS_GROUP 0 + +// +// DESTROY_GROUP reasons +// +#define DPNDESTROYGROUPREASON_NORMAL 0x0001 +#define DPNDESTROYGROUPREASON_AUTODESTRUCTED 0x0002 +#define DPNDESTROYGROUPREASON_SESSIONTERMINATED 0x0003 + +// +// DESTROY_PLAYER reasons +// +#define DPNDESTROYPLAYERREASON_NORMAL 0x0001 +#define DPNDESTROYPLAYERREASON_CONNECTIONLOST 0x0002 +#define DPNDESTROYPLAYERREASON_SESSIONTERMINATED 0x0003 +#define DPNDESTROYPLAYERREASON_HOSTDESTROYEDPLAYER 0x0004 + +#define DPN_MAX_APPDESC_RESERVEDDATA_SIZE 64 + + + +/**************************************************************************** + * + * DirectPlay8 Flags + * + ****************************************************************************/ + +// +// Asynchronous operation flags (for Async Ops) +// +#define DPNOP_SYNC 0x80000000 + +// +// Add player to group flags (for AddPlayerToGroup) +// +#define DPNADDPLAYERTOGROUP_SYNC DPNOP_SYNC + +// +// Cancel flags +// +#define DPNCANCEL_CONNECT 0x00000001 +#define DPNCANCEL_ENUM 0x00000002 +#define DPNCANCEL_SEND 0x00000004 +#define DPNCANCEL_ALL_OPERATIONS 0x00008000 +// Flags added for DirectX 9 +#define DPNCANCEL_PLAYER_SENDS 0x80000000 +#define DPNCANCEL_PLAYER_SENDS_PRIORITY_HIGH (DPNCANCEL_PLAYER_SENDS | 0x00010000) +#define DPNCANCEL_PLAYER_SENDS_PRIORITY_NORMAL (DPNCANCEL_PLAYER_SENDS | 0x00020000) +#define DPNCANCEL_PLAYER_SENDS_PRIORITY_LOW (DPNCANCEL_PLAYER_SENDS | 0x00040000) + +// +// Close flags (for Close, added for DirectX 9) +// +#define DPNCLOSE_IMMEDIATE 0x00000001 + +// +// Connect flags (for Connect) +// +#define DPNCONNECT_SYNC DPNOP_SYNC +#define DPNCONNECT_OKTOQUERYFORADDRESSING 0x0001 + +// +// Create group flags (for CreateGroup) +// +#define DPNCREATEGROUP_SYNC DPNOP_SYNC + +// +// Destroy group flags (for DestroyGroup) +// +#define DPNDESTROYGROUP_SYNC DPNOP_SYNC + +// +// Enumerate clients and groups flags (for EnumPlayersAndGroups) +// +#define DPNENUM_PLAYERS 0x0001 +#define DPNENUM_GROUPS 0x0010 + +// +// Enum hosts flags (for EnumHosts) +// +#define DPNENUMHOSTS_SYNC DPNOP_SYNC +#define DPNENUMHOSTS_OKTOQUERYFORADDRESSING 0x0001 +#define DPNENUMHOSTS_NOBROADCASTFALLBACK 0x0002 + +// +// Enum service provider flags (for EnumSP) +// +#define DPNENUMSERVICEPROVIDERS_ALL 0x0001 + +// +// GetLocalHostAddresses flags (added for DirectX 9) +// +#define DPNGETLOCALHOSTADDRESSES_COMBINED 0x0001 + +// +// Get send queue info flags (for GetSendQueueInfo) +// +#define DPNGETSENDQUEUEINFO_PRIORITY_NORMAL 0x0001 +#define DPNGETSENDQUEUEINFO_PRIORITY_HIGH 0x0002 +#define DPNGETSENDQUEUEINFO_PRIORITY_LOW 0x0004 + +// +// Group information flags (for Group Info) +// +#define DPNGROUP_AUTODESTRUCT 0x0001 + +// +// Host flags (for Host) +// +#define DPNHOST_OKTOQUERYFORADDRESSING 0x0001 + +// +// Set info +// +#define DPNINFO_NAME 0x0001 +#define DPNINFO_DATA 0x0002 + +// +// Initialize flags (for Initialize) +// +#define DPNINITIALIZE_DISABLEPARAMVAL 0x0001 +// Flags added for DirectX 9 +#define DPNINITIALIZE_HINT_LANSESSION 0x0002 +#define DPNINITIALIZE_DISABLELINKTUNING 0x0004 + + +// +// Register Lobby flags +// +#define DPNLOBBY_REGISTER 0x0001 +#define DPNLOBBY_UNREGISTER 0x0002 + +// +// Player information flags (for Player Info / Player Messages) +// +#define DPNPLAYER_LOCAL 0x0002 +#define DPNPLAYER_HOST 0x0004 + +// +// Receive indication flags (added for DirectX 9) +// +#define DPNRECEIVE_GUARANTEED 0x0001 +#define DPNRECEIVE_COALESCED 0x0002 + +// +// Remove player from group flags (for RemovePlayerFromGroup) +// +#define DPNREMOVEPLAYERFROMGROUP_SYNC DPNOP_SYNC + +// +// Send flags (for Send/SendTo) +// +#define DPNSEND_SYNC DPNOP_SYNC +#define DPNSEND_NOCOPY 0x0001 +#define DPNSEND_NOCOMPLETE 0x0002 +#define DPNSEND_COMPLETEONPROCESS 0x0004 +#define DPNSEND_GUARANTEED 0x0008 +#define DPNSEND_NONSEQUENTIAL 0x0010 +#define DPNSEND_NOLOOPBACK 0x0020 +#define DPNSEND_PRIORITY_LOW 0x0040 +#define DPNSEND_PRIORITY_HIGH 0x0080 +// Flag added for DirectX 9 +#define DPNSEND_COALESCE 0x0100 + +// +// Send complete indication flags (added for DirectX 9) +// +#define DPNSENDCOMPLETE_GUARANTEED 0x0001 +#define DPNSENDCOMPLETE_COALESCED 0x0002 + +// +// Session Flags (for DPN_APPLICATION_DESC) +// +#define DPNSESSION_CLIENT_SERVER 0x0001 +#define DPNSESSION_MIGRATE_HOST 0x0004 +#define DPNSESSION_NODPNSVR 0x0040 +#define DPNSESSION_REQUIREPASSWORD 0x0080 +// Flag added for DirectX 9 +#define DPNSESSION_NOENUMS 0x0100 +#define DPNSESSION_FAST_SIGNED 0x0200 +#define DPNSESSION_FULL_SIGNED 0x0400 + +// +// Set client info flags (for SetClientInfo) +// +#define DPNSETCLIENTINFO_SYNC DPNOP_SYNC + +// +// Set group info flags (for SetGroupInfo) +// +#define DPNSETGROUPINFO_SYNC DPNOP_SYNC + +// +// Set peer info flags (for SetPeerInfo) +// +#define DPNSETPEERINFO_SYNC DPNOP_SYNC + +// +// Set server info flags (for SetServerInfo) +// +#define DPNSETSERVERINFO_SYNC DPNOP_SYNC + +// +// SP capabilities flags +// +#define DPNSPCAPS_SUPPORTSDPNSVR 0x0001 +#define DPNSPCAPS_SUPPORTSDPNSRV DPNSPCAPS_SUPPORTSDPNSVR +#define DPNSPCAPS_SUPPORTSBROADCAST 0x0002 +#define DPNSPCAPS_SUPPORTSALLADAPTERS 0x0004 +// Flags added for DirectX 9 +#define DPNSPCAPS_SUPPORTSTHREADPOOL 0x0008 +#define DPNSPCAPS_NETWORKSIMULATOR 0x0010 + +// +// SP information flags (added for DirectX 9) +// +#define DPNSPINFO_NETWORKSIMULATORDEVICE 0x0001 + +/**************************************************************************** + * + * DirectPlay8 Structures (Non-Message) + * + ****************************************************************************/ + +// +// Application description +// +typedef struct _DPN_APPLICATION_DESC +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags (DPNSESSION_...) + GUID guidInstance; // Instance GUID + GUID guidApplication; // Application GUID + DWORD dwMaxPlayers; // Maximum # of players allowed (0=no limit) + DWORD dwCurrentPlayers; // Current # of players allowed + WCHAR *pwszSessionName; // Name of the session + WCHAR *pwszPassword; // Password for the session + PVOID pvReservedData; + DWORD dwReservedDataSize; + PVOID pvApplicationReservedData; + DWORD dwApplicationReservedDataSize; +} DPN_APPLICATION_DESC, *PDPN_APPLICATION_DESC; + +// +// Generic Buffer Description +// +typedef struct _BUFFERDESC +{ + DWORD dwBufferSize; + BYTE * pBufferData; +} BUFFERDESC, DPN_BUFFER_DESC, *PDPN_BUFFER_DESC; + +typedef BUFFERDESC FAR * PBUFFERDESC; + +// +// DirectPlay8 capabilities +// +typedef struct _DPN_CAPS +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags + DWORD dwConnectTimeout; // ms before a connect request times out + DWORD dwConnectRetries; // # of times to attempt the connection + DWORD dwTimeoutUntilKeepAlive; // ms of inactivity before a keep alive is sent +} DPN_CAPS, *PDPN_CAPS; + +// +// Extended capabilities structures (added for DirectX 9) +// +typedef struct _DPN_CAPS_EX +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags + DWORD dwConnectTimeout; // ms before a connect request times out + DWORD dwConnectRetries; // # of times to attempt the connection + DWORD dwTimeoutUntilKeepAlive; // ms of inactivity before a keep alive is sent + DWORD dwMaxRecvMsgSize; // maximum size in bytes of message that can be received + DWORD dwNumSendRetries; // maximum number of send retries before link is considered dead + DWORD dwMaxSendRetryInterval; // maximum period in msec between send retries + DWORD dwDropThresholdRate; // percentage of dropped packets before throttling + DWORD dwThrottleRate; // percentage amount to reduce send window when throttling + DWORD dwNumHardDisconnectSends; // number of hard disconnect frames to send when close immediate flag is specified + DWORD dwMaxHardDisconnectPeriod; // maximum period between hard disconnect sends +} DPN_CAPS_EX, *PDPN_CAPS_EX; + +// +// Connection Statistics information +// +typedef struct _DPN_CONNECTION_INFO +{ + DWORD dwSize; + DWORD dwRoundTripLatencyMS; + DWORD dwThroughputBPS; + DWORD dwPeakThroughputBPS; + + DWORD dwBytesSentGuaranteed; + DWORD dwPacketsSentGuaranteed; + DWORD dwBytesSentNonGuaranteed; + DWORD dwPacketsSentNonGuaranteed; + + DWORD dwBytesRetried; // Guaranteed only + DWORD dwPacketsRetried; // Guaranteed only + DWORD dwBytesDropped; // Non Guaranteed only + DWORD dwPacketsDropped; // Non Guaranteed only + + DWORD dwMessagesTransmittedHighPriority; + DWORD dwMessagesTimedOutHighPriority; + DWORD dwMessagesTransmittedNormalPriority; + DWORD dwMessagesTimedOutNormalPriority; + DWORD dwMessagesTransmittedLowPriority; + DWORD dwMessagesTimedOutLowPriority; + + DWORD dwBytesReceivedGuaranteed; + DWORD dwPacketsReceivedGuaranteed; + DWORD dwBytesReceivedNonGuaranteed; + DWORD dwPacketsReceivedNonGuaranteed; + DWORD dwMessagesReceived; + +} DPN_CONNECTION_INFO, *PDPN_CONNECTION_INFO; + + +// +// Group information structure +// +typedef struct _DPN_GROUP_INFO +{ + DWORD dwSize; // size of this structure + DWORD dwInfoFlags; // information contained + PWSTR pwszName; // Unicode Name + PVOID pvData; // data block + DWORD dwDataSize; // size in BYTES of data block + DWORD dwGroupFlags; // group flags (DPNGROUP_...) +} DPN_GROUP_INFO, *PDPN_GROUP_INFO; + +// +// Player information structure +// +typedef struct _DPN_PLAYER_INFO +{ + DWORD dwSize; // size of this structure + DWORD dwInfoFlags; // information contained + PWSTR pwszName; // Unicode Name + PVOID pvData; // data block + DWORD dwDataSize; // size in BYTES of data block + DWORD dwPlayerFlags; // player flags (DPNPLAYER_...) +} DPN_PLAYER_INFO, *PDPN_PLAYER_INFO; + +typedef struct _DPN_SECURITY_CREDENTIALS DPN_SECURITY_CREDENTIALS, *PDPN_SECURITY_CREDENTIALS; +typedef struct _DPN_SECURITY_DESC DPN_SECURITY_DESC, *PDPN_SECURITY_DESC; + +// +// Service provider & adapter enumeration structure +// +typedef struct _DPN_SERVICE_PROVIDER_INFO +{ + DWORD dwFlags; + GUID guid; // SP Guid + WCHAR *pwszName; // Friendly Name + PVOID pvReserved; + DWORD dwReserved; +} DPN_SERVICE_PROVIDER_INFO, *PDPN_SERVICE_PROVIDER_INFO; + +// +// Service provider caps structure +// +typedef struct _DPN_SP_CAPS +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags (DPNSPCAPS_...) + DWORD dwNumThreads; // # of worker threads to use + DWORD dwDefaultEnumCount; // default # of enum requests + DWORD dwDefaultEnumRetryInterval; // default ms between enum requests + DWORD dwDefaultEnumTimeout; // default enum timeout + DWORD dwMaxEnumPayloadSize; // maximum size in bytes for enum payload data + DWORD dwBuffersPerThread; // number of receive buffers per thread + DWORD dwSystemBufferSize; // amount of buffering to do in addition to posted receive buffers +} DPN_SP_CAPS, *PDPN_SP_CAPS; + + +/**************************************************************************** + * + * IDirectPlay8 message handler call back structures + * + ****************************************************************************/ + +// +// Add player to group structure for message handler +// (DPN_MSGID_ADD_PLAYER_TO_GROUP) +// +typedef struct _DPNMSG_ADD_PLAYER_TO_GROUP +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of group + PVOID pvGroupContext; // Group context value + DPNID dpnidPlayer; // DPNID of added player + PVOID pvPlayerContext; // Player context value +} DPNMSG_ADD_PLAYER_TO_GROUP, *PDPNMSG_ADD_PLAYER_TO_GROUP; + +// +// Async operation completion structure for message handler +// (DPN_MSGID_ASYNC_OP_COMPLETE) +// +typedef struct _DPNMSG_ASYNC_OP_COMPLETE +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hAsyncOp; // DirectPlay8 async operation handle + PVOID pvUserContext; // User context supplied + HRESULT hResultCode; // HRESULT of operation +} DPNMSG_ASYNC_OP_COMPLETE, *PDPNMSG_ASYNC_OP_COMPLETE; + +// +// Client info structure for message handler +// (DPN_MSGID_CLIENT_INFO) +// +typedef struct _DPNMSG_CLIENT_INFO +{ + DWORD dwSize; // Size of this structure + DPNID dpnidClient; // DPNID of client + PVOID pvPlayerContext; // Player context value +} DPNMSG_CLIENT_INFO, *PDPNMSG_CLIENT_INFO; + +// +// Connect complete structure for message handler +// (DPN_MSGID_CONNECT_COMPLETE) +// +typedef struct _DPNMSG_CONNECT_COMPLETE +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hAsyncOp; // DirectPlay8 Async operation handle + PVOID pvUserContext; // User context supplied at Connect + HRESULT hResultCode; // HRESULT of connection attempt + PVOID pvApplicationReplyData; // Connection reply data from Host/Server + DWORD dwApplicationReplyDataSize; // Size (in bytes) of pvApplicationReplyData + + // Fields added for DirectX 9 + DPNID dpnidLocal; // DPNID of local player +} DPNMSG_CONNECT_COMPLETE, *PDPNMSG_CONNECT_COMPLETE; + +// +// Create group structure for message handler +// (DPN_MSGID_CREATE_GROUP) +// +typedef struct _DPNMSG_CREATE_GROUP +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of new group + DPNID dpnidOwner; // Owner of newgroup + PVOID pvGroupContext; // Group context value + + // Fields added for DirectX 9 + PVOID pvOwnerContext; // Owner context value +} DPNMSG_CREATE_GROUP, *PDPNMSG_CREATE_GROUP; + +// +// Create player structure for message handler +// (DPN_MSGID_CREATE_PLAYER) +// +typedef struct _DPNMSG_CREATE_PLAYER +{ + DWORD dwSize; // Size of this structure + DPNID dpnidPlayer; // DPNID of new player + PVOID pvPlayerContext; // Player context value +} DPNMSG_CREATE_PLAYER, *PDPNMSG_CREATE_PLAYER; + +// +// Destroy group structure for message handler +// (DPN_MSGID_DESTROY_GROUP) +// +typedef struct _DPNMSG_DESTROY_GROUP +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of destroyed group + PVOID pvGroupContext; // Group context value + DWORD dwReason; // Information only +} DPNMSG_DESTROY_GROUP, *PDPNMSG_DESTROY_GROUP; + +// +// Destroy player structure for message handler +// (DPN_MSGID_DESTROY_PLAYER) +// +typedef struct _DPNMSG_DESTROY_PLAYER +{ + DWORD dwSize; // Size of this structure + DPNID dpnidPlayer; // DPNID of leaving player + PVOID pvPlayerContext; // Player context value + DWORD dwReason; // Information only +} DPNMSG_DESTROY_PLAYER, *PDPNMSG_DESTROY_PLAYER; + +// +// Enumeration request received structure for message handler +// (DPN_MSGID_ENUM_HOSTS_QUERY) +// +typedef struct _DPNMSG_ENUM_HOSTS_QUERY +{ + DWORD dwSize; // Size of this structure. + IDirectPlay8Address *pAddressSender; // Address of client who sent the request + IDirectPlay8Address *pAddressDevice; // Address of device request was received on + PVOID pvReceivedData; // Request data (set on client) + DWORD dwReceivedDataSize; // Request data size (set on client) + DWORD dwMaxResponseDataSize; // Max allowable size of enum response + PVOID pvResponseData; // Optional query repsonse (user set) + DWORD dwResponseDataSize; // Optional query response size (user set) + PVOID pvResponseContext; // Optional query response context (user set) +} DPNMSG_ENUM_HOSTS_QUERY, *PDPNMSG_ENUM_HOSTS_QUERY; + +// +// Enumeration response received structure for message handler +// (DPN_MSGID_ENUM_HOSTS_RESPONSE) +// +typedef struct _DPNMSG_ENUM_HOSTS_RESPONSE +{ + DWORD dwSize; // Size of this structure + IDirectPlay8Address *pAddressSender; // Address of host who responded + IDirectPlay8Address *pAddressDevice; // Device response was received on + const DPN_APPLICATION_DESC *pApplicationDescription; // Application description for the session + PVOID pvResponseData; // Optional response data (set on host) + DWORD dwResponseDataSize; // Optional response data size (set on host) + PVOID pvUserContext; // Context value supplied for enumeration + DWORD dwRoundTripLatencyMS; // Round trip latency in MS +} DPNMSG_ENUM_HOSTS_RESPONSE, *PDPNMSG_ENUM_HOSTS_RESPONSE; + +// +// Group info structure for message handler +// (DPN_MSGID_GROUP_INFO) +// +typedef struct _DPNMSG_GROUP_INFO +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of group + PVOID pvGroupContext; // Group context value +} DPNMSG_GROUP_INFO, *PDPNMSG_GROUP_INFO; + +// +// Migrate host structure for message handler +// (DPN_MSGID_HOST_MIGRATE) +// +typedef struct _DPNMSG_HOST_MIGRATE +{ + DWORD dwSize; // Size of this structure + DPNID dpnidNewHost; // DPNID of new Host player + PVOID pvPlayerContext; // Player context value +} DPNMSG_HOST_MIGRATE, *PDPNMSG_HOST_MIGRATE; + +// +// Indicate connect structure for message handler +// (DPN_MSGID_INDICATE_CONNECT) +// +typedef struct _DPNMSG_INDICATE_CONNECT +{ + DWORD dwSize; // Size of this structure + PVOID pvUserConnectData; // Connecting player data + DWORD dwUserConnectDataSize; // Size (in bytes) of pvUserConnectData + PVOID pvReplyData; // Connection reply data + DWORD dwReplyDataSize; // Size (in bytes) of pvReplyData + PVOID pvReplyContext; // Buffer context for pvReplyData + PVOID pvPlayerContext; // Player context preset + IDirectPlay8Address *pAddressPlayer; // Address of connecting player + IDirectPlay8Address *pAddressDevice; // Address of device receiving connect attempt +} DPNMSG_INDICATE_CONNECT, *PDPNMSG_INDICATE_CONNECT; + +// +// Indicated connect aborted structure for message handler +// (DPN_MSGID_INDICATED_CONNECT_ABORTED) +// +typedef struct _DPNMSG_INDICATED_CONNECT_ABORTED +{ + DWORD dwSize; // Size of this structure + PVOID pvPlayerContext; // Player context preset from DPNMSG_INDICATE_CONNECT +} DPNMSG_INDICATED_CONNECT_ABORTED, *PDPNMSG_INDICATED_CONNECT_ABORTED; + +// +// Peer info structure for message handler +// (DPN_MSGID_PEER_INFO) +// +typedef struct _DPNMSG_PEER_INFO +{ + DWORD dwSize; // Size of this structure + DPNID dpnidPeer; // DPNID of peer + PVOID pvPlayerContext; // Player context value +} DPNMSG_PEER_INFO, *PDPNMSG_PEER_INFO; + +// +// Receive structure for message handler +// (DPN_MSGID_RECEIVE) +// +typedef struct _DPNMSG_RECEIVE +{ + DWORD dwSize; // Size of this structure + DPNID dpnidSender; // DPNID of sending player + PVOID pvPlayerContext; // Player context value of sending player + PBYTE pReceiveData; // Received data + DWORD dwReceiveDataSize; // Size (in bytes) of pReceiveData + DPNHANDLE hBufferHandle; // Buffer handle for pReceiveData + + // Fields added for DirectX 9 + DWORD dwReceiveFlags; // Flags describing how message was received +} DPNMSG_RECEIVE, *PDPNMSG_RECEIVE; + +// +// Remove player from group structure for message handler +// (DPN_MSGID_REMOVE_PLAYER_FROM_GROUP) +// +typedef struct _DPNMSG_REMOVE_PLAYER_FROM_GROUP +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of group + PVOID pvGroupContext; // Group context value + DPNID dpnidPlayer; // DPNID of deleted player + PVOID pvPlayerContext; // Player context value +} DPNMSG_REMOVE_PLAYER_FROM_GROUP, *PDPNMSG_REMOVE_PLAYER_FROM_GROUP; + +// +// Returned buffer structure for message handler +// (DPN_MSGID_RETURN_BUFFER) +// +typedef struct _DPNMSG_RETURN_BUFFER +{ + DWORD dwSize; // Size of this structure + HRESULT hResultCode; // Return value of operation + PVOID pvBuffer; // Buffer being returned + PVOID pvUserContext; // Context associated with buffer +} DPNMSG_RETURN_BUFFER, *PDPNMSG_RETURN_BUFFER; + +// +// Send complete structure for message handler +// (DPN_MSGID_SEND_COMPLETE) +// +typedef struct _DPNMSG_SEND_COMPLETE +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hAsyncOp; // DirectPlay8 Async operation handle + PVOID pvUserContext; // User context supplied at Send/SendTo + HRESULT hResultCode; // HRESULT of send + DWORD dwSendTime; // Send time in ms + + // Fields added for DirectX 9 + DWORD dwFirstFrameRTT; // RTT of the first frame in the message + DWORD dwFirstFrameRetryCount; // Retry count of the first frame + DWORD dwSendCompleteFlags; // Flags describing how message was sent + DPN_BUFFER_DESC *pBuffers; // Pointer to array of buffers sent, if DirectPlay did not make a copy + DWORD dwNumBuffers; // Number of buffers in previous array +} DPNMSG_SEND_COMPLETE, *PDPNMSG_SEND_COMPLETE; + +// +// Server info structure for message handler +// (DPN_MSGID_SERVER_INFO) +// +typedef struct _DPNMSG_SERVER_INFO +{ + DWORD dwSize; // Size of this structure + DPNID dpnidServer; // DPNID of server + PVOID pvPlayerContext; // Player context value +} DPNMSG_SERVER_INFO, *PDPNMSG_SERVER_INFO; + +// +// Terminated session structure for message handler +// (DPN_MSGID_TERMINATE_SESSION) +// +typedef struct _DPNMSG_TERMINATE_SESSION +{ + DWORD dwSize; // Size of this structure + HRESULT hResultCode; // Reason + PVOID pvTerminateData; // Data passed from Host/Server + DWORD dwTerminateDataSize;// Size (in bytes) of pvTerminateData +} DPNMSG_TERMINATE_SESSION, *PDPNMSG_TERMINATE_SESSION; + + +// +// Message structures added for DirectX 9 +// + +// +// Create thread info structure for message handler +// (DPN_MSGID_CREATE_THREAD) +// +typedef struct _DPNMSG_CREATE_THREAD +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags describing this thread + DWORD dwProcessorNum; // Index of processor to which thread is bound + PVOID pvUserContext; // Thread context value +} DPNMSG_CREATE_THREAD, *PDPNMSG_CREATE_THREAD; + +// +// Destroy thread info structure for message handler +// (DPN_MSGID_DESTROY_THREAD) +// +typedef struct _DPNMSG_DESTROY_THREAD +{ + DWORD dwSize; // Size of this structure + DWORD dwProcessorNum; // Index of processor to which thread was bound + PVOID pvUserContext; // Thread context value +} DPNMSG_DESTROY_THREAD, *PDPNMSG_DESTROY_THREAD; + + +// +// Query-to-resolve-NAT-address structure for message handler +// (DPN_MSGID_NAT_RESOLVER_QUERY) +// +typedef struct _DPNMSG_NAT_RESOLVER_QUERY +{ + DWORD dwSize; // Size of this structure. + IDirectPlay8Address *pAddressSender; // Address of client that sent the query + IDirectPlay8Address *pAddressDevice; // Address of device on which query was received + WCHAR *pwszUserString; // User specified string, or NULL if none +} DPNMSG_NAT_RESOLVER_QUERY, *PDPNMSG_NAT_RESOLVER_QUERY; + +/**************************************************************************** + * + * DirectPlay8 Functions + * + ****************************************************************************/ + + + +/* + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 objects. + * + * extern HRESULT WINAPI DirectPlay8Create( const CLSID * pcIID, void **ppvInterface, IUnknown *pUnknown ); + * + */ + + +/**************************************************************************** + * + * DirectPlay8 Application Interfaces + * + ****************************************************************************/ + +// +// COM definition for DirectPlay8 Client interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8Client +DECLARE_INTERFACE_(IDirectPlay8Client,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8Client methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(EnumServiceProviders) (THIS_ const GUID *const pguidServiceProvider, const GUID *const pguidApplication, DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer, PDWORD const pcbEnumData, PDWORD const pcReturned, const DWORD dwFlags) PURE; + STDMETHOD(EnumHosts) (THIS_ PDPN_APPLICATION_DESC const pApplicationDesc,IDirectPlay8Address *const pAddrHost,IDirectPlay8Address *const pDeviceInfo,PVOID const pUserEnumData,const DWORD dwUserEnumDataSize,const DWORD dwEnumCount,const DWORD dwRetryInterval,const DWORD dwTimeOut,PVOID const pvUserContext,DPNHANDLE *const pAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(CancelAsyncOperation) (THIS_ const DPNHANDLE hAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(Connect) (THIS_ const DPN_APPLICATION_DESC *const pdnAppDesc,IDirectPlay8Address *const pHostAddr,IDirectPlay8Address *const pDeviceInfo,const DPN_SECURITY_DESC *const pdnSecurity,const DPN_SECURITY_CREDENTIALS *const pdnCredentials,const void *const pvUserConnectData,const DWORD dwUserConnectDataSize,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(Send) (THIS_ const DPN_BUFFER_DESC *const prgBufferDesc,const DWORD cBufferDesc,const DWORD dwTimeOut,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetSendQueueInfo) (THIS_ DWORD *const pdwNumMsgs, DWORD *const pdwNumBytes, const DWORD dwFlags) PURE; + STDMETHOD(GetApplicationDesc) (THIS_ DPN_APPLICATION_DESC *const pAppDescBuffer, DWORD *const pcbDataSize, const DWORD dwFlags) PURE; + STDMETHOD(SetClientInfo) (THIS_ const DPN_PLAYER_INFO *const pdpnPlayerInfo,PVOID const pvAsyncContext,DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetServerInfo) (THIS_ DPN_PLAYER_INFO *const pdpnPlayerInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(GetServerAddress) (THIS_ IDirectPlay8Address **const pAddress,const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(ReturnBuffer) (THIS_ const DPNHANDLE hBufferHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetCaps) (THIS_ DPN_CAPS *const pdpCaps,const DWORD dwFlags) PURE; + STDMETHOD(SetCaps) (THIS_ const DPN_CAPS *const pdpCaps, const DWORD dwFlags) PURE; + STDMETHOD(SetSPCaps) (THIS_ const GUID * const pguidSP, const DPN_SP_CAPS *const pdpspCaps, const DWORD dwFlags ) PURE; + STDMETHOD(GetSPCaps) (THIS_ const GUID * const pguidSP,DPN_SP_CAPS *const pdpspCaps,const DWORD dwFlags) PURE; + STDMETHOD(GetConnectionInfo) (THIS_ DPN_CONNECTION_INFO *const pdpConnectionInfo,const DWORD dwFlags) PURE; + STDMETHOD(RegisterLobby) (THIS_ const DPNHANDLE dpnHandle, struct IDirectPlay8LobbiedApplication *const pIDP8LobbiedApplication,const DWORD dwFlags) PURE; +}; + +// +// COM definition for DirectPlay8 Server interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8Server +DECLARE_INTERFACE_(IDirectPlay8Server,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8Server methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(EnumServiceProviders) (THIS_ const GUID *const pguidServiceProvider,const GUID *const pguidApplication,DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer,PDWORD const pcbEnumData,PDWORD const pcReturned,const DWORD dwFlags) PURE; + STDMETHOD(CancelAsyncOperation) (THIS_ const DPNHANDLE hAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetSendQueueInfo) (THIS_ const DPNID dpnid,DWORD *const pdwNumMsgs, DWORD *const pdwNumBytes, const DWORD dwFlags) PURE; + STDMETHOD(GetApplicationDesc) (THIS_ DPN_APPLICATION_DESC *const pAppDescBuffer, DWORD *const pcbDataSize, const DWORD dwFlags) PURE; + STDMETHOD(SetServerInfo) (THIS_ const DPN_PLAYER_INFO *const pdpnPlayerInfo,PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetClientInfo) (THIS_ const DPNID dpnid,DPN_PLAYER_INFO *const pdpnPlayerInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(GetClientAddress) (THIS_ const DPNID dpnid,IDirectPlay8Address **const pAddress,const DWORD dwFlags) PURE; + STDMETHOD(GetLocalHostAddresses) (THIS_ IDirectPlay8Address **const prgpAddress,DWORD *const pcAddress,const DWORD dwFlags) PURE; + STDMETHOD(SetApplicationDesc) (THIS_ const DPN_APPLICATION_DESC *const pad, const DWORD dwFlags) PURE; + STDMETHOD(Host) (THIS_ const DPN_APPLICATION_DESC *const pdnAppDesc,IDirectPlay8Address **const prgpDeviceInfo,const DWORD cDeviceInfo,const DPN_SECURITY_DESC *const pdnSecurity,const DPN_SECURITY_CREDENTIALS *const pdnCredentials,void *const pvPlayerContext,const DWORD dwFlags) PURE; + STDMETHOD(SendTo) (THIS_ const DPNID dpnid,const DPN_BUFFER_DESC *const prgBufferDesc,const DWORD cBufferDesc,const DWORD dwTimeOut,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(CreateGroup) (THIS_ const DPN_GROUP_INFO *const pdpnGroupInfo,void *const pvGroupContext,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(DestroyGroup) (THIS_ const DPNID idGroup, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(AddPlayerToGroup) (THIS_ const DPNID idGroup, const DPNID idClient, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(RemovePlayerFromGroup) (THIS_ const DPNID idGroup, const DPNID idClient, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(SetGroupInfo) (THIS_ const DPNID dpnid,DPN_GROUP_INFO *const pdpnGroupInfo,PVOID const pvAsyncContext,DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetGroupInfo) (THIS_ const DPNID dpnid,DPN_GROUP_INFO *const pdpnGroupInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(EnumPlayersAndGroups) (THIS_ DPNID *const prgdpnid, DWORD *const pcdpnid, const DWORD dwFlags) PURE; + STDMETHOD(EnumGroupMembers) (THIS_ const DPNID dpnid, DPNID *const prgdpnid, DWORD *const pcdpnid, const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(DestroyClient) (THIS_ const DPNID dpnidClient, const void *const pvDestroyData, const DWORD dwDestroyDataSize, const DWORD dwFlags) PURE; + STDMETHOD(ReturnBuffer) (THIS_ const DPNHANDLE hBufferHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetPlayerContext) (THIS_ const DPNID dpnid,PVOID *const ppvPlayerContext,const DWORD dwFlags) PURE; + STDMETHOD(GetGroupContext) (THIS_ const DPNID dpnid,PVOID *const ppvGroupContext,const DWORD dwFlags) PURE; + STDMETHOD(GetCaps) (THIS_ DPN_CAPS *const pdpCaps,const DWORD dwFlags) PURE; + STDMETHOD(SetCaps) (THIS_ const DPN_CAPS *const pdpCaps, const DWORD dwFlags) PURE; + STDMETHOD(SetSPCaps) (THIS_ const GUID * const pguidSP, const DPN_SP_CAPS *const pdpspCaps, const DWORD dwFlags ) PURE; + STDMETHOD(GetSPCaps) (THIS_ const GUID * const pguidSP, DPN_SP_CAPS *const pdpspCaps,const DWORD dwFlags) PURE; + STDMETHOD(GetConnectionInfo) (THIS_ const DPNID dpnid, DPN_CONNECTION_INFO *const pdpConnectionInfo,const DWORD dwFlags) PURE; + STDMETHOD(RegisterLobby) (THIS_ const DPNHANDLE dpnHandle, struct IDirectPlay8LobbiedApplication *const pIDP8LobbiedApplication,const DWORD dwFlags) PURE; +}; + +// +// COM definition for DirectPlay8 Peer interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8Peer +DECLARE_INTERFACE_(IDirectPlay8Peer,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8Peer methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(EnumServiceProviders) (THIS_ const GUID *const pguidServiceProvider, const GUID *const pguidApplication, DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer, DWORD *const pcbEnumData, DWORD *const pcReturned, const DWORD dwFlags) PURE; + STDMETHOD(CancelAsyncOperation) (THIS_ const DPNHANDLE hAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(Connect) (THIS_ const DPN_APPLICATION_DESC *const pdnAppDesc,IDirectPlay8Address *const pHostAddr,IDirectPlay8Address *const pDeviceInfo,const DPN_SECURITY_DESC *const pdnSecurity,const DPN_SECURITY_CREDENTIALS *const pdnCredentials,const void *const pvUserConnectData,const DWORD dwUserConnectDataSize,void *const pvPlayerContext,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(SendTo) (THIS_ const DPNID dpnid,const DPN_BUFFER_DESC *const prgBufferDesc,const DWORD cBufferDesc,const DWORD dwTimeOut,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetSendQueueInfo) (THIS_ const DPNID dpnid, DWORD *const pdwNumMsgs, DWORD *const pdwNumBytes, const DWORD dwFlags) PURE; + STDMETHOD(Host) (THIS_ const DPN_APPLICATION_DESC *const pdnAppDesc,IDirectPlay8Address **const prgpDeviceInfo,const DWORD cDeviceInfo,const DPN_SECURITY_DESC *const pdnSecurity,const DPN_SECURITY_CREDENTIALS *const pdnCredentials,void *const pvPlayerContext,const DWORD dwFlags) PURE; + STDMETHOD(GetApplicationDesc) (THIS_ DPN_APPLICATION_DESC *const pAppDescBuffer, DWORD *const pcbDataSize, const DWORD dwFlags) PURE; + STDMETHOD(SetApplicationDesc) (THIS_ const DPN_APPLICATION_DESC *const pad, const DWORD dwFlags) PURE; + STDMETHOD(CreateGroup) (THIS_ const DPN_GROUP_INFO *const pdpnGroupInfo,void *const pvGroupContext,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(DestroyGroup) (THIS_ const DPNID idGroup, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(AddPlayerToGroup) (THIS_ const DPNID idGroup, const DPNID idClient, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(RemovePlayerFromGroup) (THIS_ const DPNID idGroup, const DPNID idClient, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(SetGroupInfo) (THIS_ const DPNID dpnid,DPN_GROUP_INFO *const pdpnGroupInfo,PVOID const pvAsyncContext,DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetGroupInfo) (THIS_ const DPNID dpnid,DPN_GROUP_INFO *const pdpnGroupInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(EnumPlayersAndGroups) (THIS_ DPNID *const prgdpnid, DWORD *const pcdpnid, const DWORD dwFlags) PURE; + STDMETHOD(EnumGroupMembers) (THIS_ const DPNID dpnid, DPNID *const prgdpnid, DWORD *const pcdpnid, const DWORD dwFlags) PURE; + STDMETHOD(SetPeerInfo) (THIS_ const DPN_PLAYER_INFO *const pdpnPlayerInfo,PVOID const pvAsyncContext,DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetPeerInfo) (THIS_ const DPNID dpnid,DPN_PLAYER_INFO *const pdpnPlayerInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(GetPeerAddress) (THIS_ const DPNID dpnid,IDirectPlay8Address **const ppAddress,const DWORD dwFlags) PURE; + STDMETHOD(GetLocalHostAddresses) (THIS_ IDirectPlay8Address **const prgpAddress,DWORD *const pcAddress,const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(EnumHosts) (THIS_ PDPN_APPLICATION_DESC const pApplicationDesc,IDirectPlay8Address *const pAddrHost,IDirectPlay8Address *const pDeviceInfo,PVOID const pUserEnumData,const DWORD dwUserEnumDataSize,const DWORD dwEnumCount,const DWORD dwRetryInterval,const DWORD dwTimeOut,PVOID const pvUserContext,DPNHANDLE *const pAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(DestroyPeer) (THIS_ const DPNID dpnidClient, const void *const pvDestroyData, const DWORD dwDestroyDataSize, const DWORD dwFlags) PURE; + STDMETHOD(ReturnBuffer) (THIS_ const DPNHANDLE hBufferHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetPlayerContext) (THIS_ const DPNID dpnid,PVOID *const ppvPlayerContext,const DWORD dwFlags) PURE; + STDMETHOD(GetGroupContext) (THIS_ const DPNID dpnid,PVOID *const ppvGroupContext,const DWORD dwFlags) PURE; + STDMETHOD(GetCaps) (THIS_ DPN_CAPS *const pdpCaps,const DWORD dwFlags) PURE; + STDMETHOD(SetCaps) (THIS_ const DPN_CAPS *const pdpCaps, const DWORD dwFlags) PURE; + STDMETHOD(SetSPCaps) (THIS_ const GUID * const pguidSP, const DPN_SP_CAPS *const pdpspCaps, const DWORD dwFlags ) PURE; + STDMETHOD(GetSPCaps) (THIS_ const GUID * const pguidSP, DPN_SP_CAPS *const pdpspCaps,const DWORD dwFlags) PURE; + STDMETHOD(GetConnectionInfo) (THIS_ const DPNID dpnid, DPN_CONNECTION_INFO *const pdpConnectionInfo,const DWORD dwFlags) PURE; + STDMETHOD(RegisterLobby) (THIS_ const DPNHANDLE dpnHandle, struct IDirectPlay8LobbiedApplication *const pIDP8LobbiedApplication,const DWORD dwFlags) PURE; + STDMETHOD(TerminateSession) (THIS_ void *const pvTerminateData,const DWORD dwTerminateDataSize,const DWORD dwFlags) PURE; +}; + + + +// +// COM definition for DirectPlay8 Thread Pool interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8ThreadPool +DECLARE_INTERFACE_(IDirectPlay8ThreadPool,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8ThreadPool methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(GetThreadCount) (THIS_ const DWORD dwProcessorNum, DWORD *const pdwNumThreads, const DWORD dwFlags) PURE; + STDMETHOD(SetThreadCount) (THIS_ const DWORD dwProcessorNum, const DWORD dwNumThreads, const DWORD dwFlags) PURE; + STDMETHOD(DoWork) (THIS_ const DWORD dwAllowedTimeSlice, const DWORD dwFlags) PURE; +}; + + +// +// COM definition for DirectPlay8 NAT Resolver interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8NATResolver +DECLARE_INTERFACE_(IDirectPlay8NATResolver,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8NATResolver methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(Start) (THIS_ IDirectPlay8Address **const ppDevices, const DWORD dwNumDevices, const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(EnumDevices) (THIS_ DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer, PDWORD const pdwBufferSize, PDWORD const pdwNumDevices, const DWORD dwFlags) PURE; + STDMETHOD(GetAddresses) (THIS_ IDirectPlay8Address **const ppAddresses, DWORD *const pdwNumAddresses, const DWORD dwFlags) PURE; +}; + + +/**************************************************************************** + * + * IDirectPlay8 application interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay8Client_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8Client_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8Client_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8Client_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8Client_EnumServiceProviders(p,a,b,c,d,e,f) (p)->lpVtbl->EnumServiceProviders(p,a,b,c,d,e,f) +#define IDirectPlay8Client_EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) (p)->lpVtbl->EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Client_CancelAsyncOperation(p,a,b) (p)->lpVtbl->CancelAsyncOperation(p,a,b) +#define IDirectPlay8Client_Connect(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->Connect(p,a,b,c,d,e,f,g,h,i,j) +#define IDirectPlay8Client_Send(p,a,b,c,d,e,f) (p)->lpVtbl->Send(p,a,b,c,d,e,f) +#define IDirectPlay8Client_GetSendQueueInfo(p,a,b,c) (p)->lpVtbl->GetSendQueueInfo(p,a,b,c) +#define IDirectPlay8Client_GetApplicationDesc(p,a,b,c) (p)->lpVtbl->GetApplicationDesc(p,a,b,c) +#define IDirectPlay8Client_SetClientInfo(p,a,b,c,d) (p)->lpVtbl->SetClientInfo(p,a,b,c,d) +#define IDirectPlay8Client_GetServerInfo(p,a,b,c) (p)->lpVtbl->GetServerInfo(p,a,b,c) +#define IDirectPlay8Client_GetServerAddress(p,a,b) (p)->lpVtbl->GetServerAddress(p,a,b) +#define IDirectPlay8Client_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8Client_ReturnBuffer(p,a,b) (p)->lpVtbl->ReturnBuffer(p,a,b) +#define IDirectPlay8Client_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay8Client_SetCaps(p,a,b) (p)->lpVtbl->SetCaps(p,a,b) +#define IDirectPlay8Client_SetSPCaps(p,a,b,c) (p)->lpVtbl->SetSPCaps(p,a,b,c) +#define IDirectPlay8Client_GetSPCaps(p,a,b,c) (p)->lpVtbl->GetSPCaps(p,a,b,c) +#define IDirectPlay8Client_GetConnectionInfo(p,a,b) (p)->lpVtbl->GetConnectionInfo(p,a,b) +#define IDirectPlay8Client_RegisterLobby(p,a,b,c) (p)->lpVtbl->RegisterLobby(p,a,b,c) + +#define IDirectPlay8Server_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8Server_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8Server_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8Server_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8Server_EnumServiceProviders(p,a,b,c,d,e,f) (p)->lpVtbl->EnumServiceProviders(p,a,b,c,d,e,f) +#define IDirectPlay8Server_CancelAsyncOperation(p,a,b) (p)->lpVtbl->CancelAsyncOperation(p,a,b) +#define IDirectPlay8Server_GetSendQueueInfo(p,a,b,c,d) (p)->lpVtbl->GetSendQueueInfo(p,a,b,c,d) +#define IDirectPlay8Server_GetApplicationDesc(p,a,b,c) (p)->lpVtbl->GetApplicationDesc(p,a,b,c) +#define IDirectPlay8Server_SetServerInfo(p,a,b,c,d) (p)->lpVtbl->SetServerInfo(p,a,b,c,d) +#define IDirectPlay8Server_GetClientInfo(p,a,b,c,d) (p)->lpVtbl->GetClientInfo(p,a,b,c,d) +#define IDirectPlay8Server_GetClientAddress(p,a,b,c) (p)->lpVtbl->GetClientAddress(p,a,b,c) +#define IDirectPlay8Server_GetLocalHostAddresses(p,a,b,c) (p)->lpVtbl->GetLocalHostAddresses(p,a,b,c) +#define IDirectPlay8Server_SetApplicationDesc(p,a,b) (p)->lpVtbl->SetApplicationDesc(p,a,b) +#define IDirectPlay8Server_Host(p,a,b,c,d,e,f,g) (p)->lpVtbl->Host(p,a,b,c,d,e,f,g) +#define IDirectPlay8Server_SendTo(p,a,b,c,d,e,f,g) (p)->lpVtbl->SendTo(p,a,b,c,d,e,f,g) +#define IDirectPlay8Server_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay8Server_DestroyGroup(p,a,b,c,d) (p)->lpVtbl->DestroyGroup(p,a,b,c,d) +#define IDirectPlay8Server_AddPlayerToGroup(p,a,b,c,d,e) (p)->lpVtbl->AddPlayerToGroup(p,a,b,c,d,e) +#define IDirectPlay8Server_RemovePlayerFromGroup(p,a,b,c,d,e) (p)->lpVtbl->RemovePlayerFromGroup(p,a,b,c,d,e) +#define IDirectPlay8Server_SetGroupInfo(p,a,b,c,d,e) (p)->lpVtbl->SetGroupInfo(p,a,b,c,d,e) +#define IDirectPlay8Server_GetGroupInfo(p,a,b,c,d) (p)->lpVtbl->GetGroupInfo(p,a,b,c,d) +#define IDirectPlay8Server_EnumPlayersAndGroups(p,a,b,c) (p)->lpVtbl->EnumPlayersAndGroups(p,a,b,c) +#define IDirectPlay8Server_EnumGroupMembers(p,a,b,c,d) (p)->lpVtbl->EnumGroupMembers(p,a,b,c,d) +#define IDirectPlay8Server_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8Server_DestroyClient(p,a,b,c,d) (p)->lpVtbl->DestroyClient(p,a,b,c,d) +#define IDirectPlay8Server_ReturnBuffer(p,a,b) (p)->lpVtbl->ReturnBuffer(p,a,b) +#define IDirectPlay8Server_GetPlayerContext(p,a,b,c) (p)->lpVtbl->GetPlayerContext(p,a,b,c) +#define IDirectPlay8Server_GetGroupContext(p,a,b,c) (p)->lpVtbl->GetGroupContext(p,a,b,c) +#define IDirectPlay8Server_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay8Server_SetCaps(p,a,b) (p)->lpVtbl->SetCaps(p,a,b) +#define IDirectPlay8Server_SetSPCaps(p,a,b,c) (p)->lpVtbl->SetSPCaps(p,a,b,c) +#define IDirectPlay8Server_GetSPCaps(p,a,b,c) (p)->lpVtbl->GetSPCaps(p,a,b,c) +#define IDirectPlay8Server_GetConnectionInfo(p,a,b,c) (p)->lpVtbl->GetConnectionInfo(p,a,b,c) +#define IDirectPlay8Server_RegisterLobby(p,a,b,c) (p)->lpVtbl->RegisterLobby(p,a,b,c) + +#define IDirectPlay8Peer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8Peer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8Peer_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8Peer_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8Peer_EnumServiceProviders(p,a,b,c,d,e,f) (p)->lpVtbl->EnumServiceProviders(p,a,b,c,d,e,f) +#define IDirectPlay8Peer_CancelAsyncOperation(p,a,b) (p)->lpVtbl->CancelAsyncOperation(p,a,b) +#define IDirectPlay8Peer_Connect(p,a,b,c,d,e,f,g,h,i,j,k) (p)->lpVtbl->Connect(p,a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Peer_SendTo(p,a,b,c,d,e,f,g) (p)->lpVtbl->SendTo(p,a,b,c,d,e,f,g) +#define IDirectPlay8Peer_GetSendQueueInfo(p,a,b,c,d) (p)->lpVtbl->GetSendQueueInfo(p,a,b,c,d) +#define IDirectPlay8Peer_Host(p,a,b,c,d,e,f,g) (p)->lpVtbl->Host(p,a,b,c,d,e,f,g) +#define IDirectPlay8Peer_GetApplicationDesc(p,a,b,c) (p)->lpVtbl->GetApplicationDesc(p,a,b,c) +#define IDirectPlay8Peer_SetApplicationDesc(p,a,b) (p)->lpVtbl->SetApplicationDesc(p,a,b) +#define IDirectPlay8Peer_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay8Peer_DestroyGroup(p,a,b,c,d) (p)->lpVtbl->DestroyGroup(p,a,b,c,d) +#define IDirectPlay8Peer_AddPlayerToGroup(p,a,b,c,d,e) (p)->lpVtbl->AddPlayerToGroup(p,a,b,c,d,e) +#define IDirectPlay8Peer_RemovePlayerFromGroup(p,a,b,c,d,e) (p)->lpVtbl->RemovePlayerFromGroup(p,a,b,c,d,e) +#define IDirectPlay8Peer_SetGroupInfo(p,a,b,c,d,e) (p)->lpVtbl->SetGroupInfo(p,a,b,c,d,e) +#define IDirectPlay8Peer_GetGroupInfo(p,a,b,c,d) (p)->lpVtbl->GetGroupInfo(p,a,b,c,d) +#define IDirectPlay8Peer_EnumPlayersAndGroups(p,a,b,c) (p)->lpVtbl->EnumPlayersAndGroups(p,a,b,c) +#define IDirectPlay8Peer_EnumGroupMembers(p,a,b,c,d) (p)->lpVtbl->EnumGroupMembers(p,a,b,c,d) +#define IDirectPlay8Peer_SetPeerInfo(p,a,b,c,d) (p)->lpVtbl->SetPeerInfo(p,a,b,c,d) +#define IDirectPlay8Peer_GetPeerInfo(p,a,b,c,d) (p)->lpVtbl->GetPeerInfo(p,a,b,c,d) +#define IDirectPlay8Peer_GetPeerAddress(p,a,b,c) (p)->lpVtbl->GetPeerAddress(p,a,b,c) +#define IDirectPlay8Peer_GetLocalHostAddresses(p,a,b,c) (p)->lpVtbl->GetLocalHostAddresses(p,a,b,c) +#define IDirectPlay8Peer_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8Peer_EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) (p)->lpVtbl->EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Peer_DestroyPeer(p,a,b,c,d) (p)->lpVtbl->DestroyPeer(p,a,b,c,d) +#define IDirectPlay8Peer_ReturnBuffer(p,a,b) (p)->lpVtbl->ReturnBuffer(p,a,b) +#define IDirectPlay8Peer_GetPlayerContext(p,a,b,c) (p)->lpVtbl->GetPlayerContext(p,a,b,c) +#define IDirectPlay8Peer_GetGroupContext(p,a,b,c) (p)->lpVtbl->GetGroupContext(p,a,b,c) +#define IDirectPlay8Peer_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay8Peer_SetCaps(p,a,b) (p)->lpVtbl->SetCaps(p,a,b) +#define IDirectPlay8Peer_SetSPCaps(p,a,b,c) (p)->lpVtbl->SetSPCaps(p,a,b,c) +#define IDirectPlay8Peer_GetSPCaps(p,a,b,c) (p)->lpVtbl->GetSPCaps(p,a,b,c) +#define IDirectPlay8Peer_GetConnectionInfo(p,a,b,c) (p)->lpVtbl->GetConnectionInfo(p,a,b,c) +#define IDirectPlay8Peer_RegisterLobby(p,a,b,c) (p)->lpVtbl->RegisterLobby(p,a,b,c) +#define IDirectPlay8Peer_TerminateSession(p,a,b,c) (p)->lpVtbl->TerminateSession(p,a,b,c) + +#define IDirectPlay8ThreadPool_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8ThreadPool_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8ThreadPool_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8ThreadPool_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8ThreadPool_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8ThreadPool_GetThreadCount(p,a,b,c) (p)->lpVtbl->GetThreadCount(p,a,b,c) +#define IDirectPlay8ThreadPool_SetThreadCount(p,a,b,c) (p)->lpVtbl->SetThreadCount(p,a,b,c) +#define IDirectPlay8ThreadPool_DoWork(p,a,b) (p)->lpVtbl->DoWork(p,a,b) + +#define IDirectPlay8NATResolver_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8NATResolver_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8NATResolver_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8NATResolver_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8NATResolver_Start(p,a,b,c) (p)->lpVtbl->Start(p,a,b,c) +#define IDirectPlay8NATResolver_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8NATResolver_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectPlay8NATResolver_GetAddresses(p,a,b,c) (p)->lpVtbl->GetAddresses(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay8Client_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8Client_AddRef(p) (p)->AddRef() +#define IDirectPlay8Client_Release(p) (p)->Release() +#define IDirectPlay8Client_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8Client_EnumServiceProviders(p,a,b,c,d,e,f) (p)->EnumServiceProviders(a,b,c,d,e,f) +#define IDirectPlay8Client_EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) (p)->EnumHosts(a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Client_CancelAsyncOperation(p,a,b) (p)->CancelAsyncOperation(a,b) +#define IDirectPlay8Client_Connect(p,a,b,c,d,e,f,g,h,i,j) (p)->Connect(a,b,c,d,e,f,g,h,i,j) +#define IDirectPlay8Client_Send(p,a,b,c,d,e,f) (p)->Send(a,b,c,d,e,f) +#define IDirectPlay8Client_GetSendQueueInfo(p,a,b,c) (p)->GetSendQueueInfo(a,b,c) +#define IDirectPlay8Client_GetApplicationDesc(p,a,b,c) (p)->GetApplicationDesc(a,b,c) +#define IDirectPlay8Client_SetClientInfo(p,a,b,c,d) (p)->SetClientInfo(a,b,c,d) +#define IDirectPlay8Client_GetServerInfo(p,a,b,c) (p)->GetServerInfo(a,b,c) +#define IDirectPlay8Client_GetServerAddress(p,a,b) (p)->GetServerAddress(a,b) +#define IDirectPlay8Client_Close(p,a) (p)->Close(a) +#define IDirectPlay8Client_ReturnBuffer(p,a,b) (p)->ReturnBuffer(a,b) +#define IDirectPlay8Client_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay8Client_SetCaps(p,a,b) (p)->SetCaps(a,b) +#define IDirectPlay8Client_SetSPCaps(p,a,b,c) (p)->SetSPCaps(a,b,c) +#define IDirectPlay8Client_GetSPCaps(p,a,b,c) (p)->GetSPCaps(a,b,c) +#define IDirectPlay8Client_GetConnectionInfo(p,a,b) (p)->GetConnectionInfo(a,b) +#define IDirectPlay8Client_RegisterLobby(p,a,b,c) (p)->RegisterLobby(a,b,c) + +#define IDirectPlay8Server_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8Server_AddRef(p) (p)->AddRef() +#define IDirectPlay8Server_Release(p) (p)->Release() +#define IDirectPlay8Server_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8Server_EnumServiceProviders(p,a,b,c,d,e,f) (p)->EnumServiceProviders(a,b,c,d,e,f) +#define IDirectPlay8Server_CancelAsyncOperation(p,a,b) (p)->CancelAsyncOperation(a,b) +#define IDirectPlay8Server_GetSendQueueInfo(p,a,b,c,d) (p)->GetSendQueueInfo(a,b,c,d) +#define IDirectPlay8Server_GetApplicationDesc(p,a,b,c) (p)->GetApplicationDesc(a,b,c) +#define IDirectPlay8Server_SetServerInfo(p,a,b,c,d) (p)->SetServerInfo(a,b,c,d) +#define IDirectPlay8Server_GetClientInfo(p,a,b,c,d) (p)->GetClientInfo(a,b,c,d) +#define IDirectPlay8Server_GetClientAddress(p,a,b,c) (p)->GetClientAddress(a,b,c) +#define IDirectPlay8Server_GetLocalHostAddresses(p,a,b,c) (p)->GetLocalHostAddresses(a,b,c) +#define IDirectPlay8Server_SetApplicationDesc(p,a,b) (p)->SetApplicationDesc(a,b) +#define IDirectPlay8Server_Host(p,a,b,c,d,e,f,g) (p)->Host(a,b,c,d,e,f,g) +#define IDirectPlay8Server_SendTo(p,a,b,c,d,e,f,g) (p)->SendTo(a,b,c,d,e,f,g) +#define IDirectPlay8Server_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay8Server_DestroyGroup(p,a,b,c,d) (p)->DestroyGroup(a,b,c,d) +#define IDirectPlay8Server_AddPlayerToGroup(p,a,b,c,d,e) (p)->AddPlayerToGroup(a,b,c,d,e) +#define IDirectPlay8Server_RemovePlayerFromGroup(p,a,b,c,d,e) (p)->RemovePlayerFromGroup(a,b,c,d,e) +#define IDirectPlay8Server_SetGroupInfo(p,a,b,c,d,e) (p)->SetGroupInfo(a,b,c,d,e) +#define IDirectPlay8Server_GetGroupInfo(p,a,b,c,d) (p)->GetGroupInfo(a,b,c,d) +#define IDirectPlay8Server_EnumPlayersAndGroups(p,a,b,c) (p)->EnumPlayersAndGroups(a,b,c) +#define IDirectPlay8Server_EnumGroupMembers(p,a,b,c,d) (p)->EnumGroupMembers(a,b,c,d) +#define IDirectPlay8Server_Close(p,a) (p)->Close(a) +#define IDirectPlay8Server_DestroyClient(p,a,b,c,d) (p)->DestroyClient(a,b,c,d) +#define IDirectPlay8Server_ReturnBuffer(p,a,b) (p)->ReturnBuffer(a,b) +#define IDirectPlay8Server_GetPlayerContext(p,a,b,c) (p)->GetPlayerContext(a,b,c) +#define IDirectPlay8Server_GetGroupContext(p,a,b,c) (p)->GetGroupContext(a,b,c) +#define IDirectPlay8Server_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay8Server_SetCaps(p,a,b) (p)->SetCaps(a,b) +#define IDirectPlay8Server_SetSPCaps(p,a,b,c) (p)->SetSPCaps(a,b,c) +#define IDirectPlay8Server_GetSPCaps(p,a,b,c) (p)->GetSPCaps(a,b,c) +#define IDirectPlay8Server_GetConnectionInfo(p,a,b,c) (p)->GetConnectionInfo(a,b,c) +#define IDirectPlay8Server_RegisterLobby(p,a,b,c) (p)->RegisterLobby(a,b,c) + +#define IDirectPlay8Peer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8Peer_AddRef(p) (p)->AddRef() +#define IDirectPlay8Peer_Release(p) (p)->Release() +#define IDirectPlay8Peer_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8Peer_EnumServiceProviders(p,a,b,c,d,e,f) (p)->EnumServiceProviders(a,b,c,d,e,f) +#define IDirectPlay8Peer_CancelAsyncOperation(p,a,b) (p)->CancelAsyncOperation(a,b) +#define IDirectPlay8Peer_Connect(p,a,b,c,d,e,f,g,h,i,j,k) (p)->Connect(a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Peer_SendTo(p,a,b,c,d,e,f,g) (p)->SendTo(a,b,c,d,e,f,g) +#define IDirectPlay8Peer_GetSendQueueInfo(p,a,b,c,d) (p)->GetSendQueueInfo(a,b,c,d) +#define IDirectPlay8Peer_Host(p,a,b,c,d,e,f,g) (p)->Host(a,b,c,d,e,f,g) +#define IDirectPlay8Peer_GetApplicationDesc(p,a,b,c) (p)->GetApplicationDesc(a,b,c) +#define IDirectPlay8Peer_SetApplicationDesc(p,a,b) (p)->SetApplicationDesc(a,b) +#define IDirectPlay8Peer_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay8Peer_DestroyGroup(p,a,b,c,d) (p)->DestroyGroup(a,b,c,d) +#define IDirectPlay8Peer_AddPlayerToGroup(p,a,b,c,d,e) (p)->AddPlayerToGroup(a,b,c,d,e) +#define IDirectPlay8Peer_RemovePlayerFromGroup(p,a,b,c,d,e) (p)->RemovePlayerFromGroup(a,b,c,d,e) +#define IDirectPlay8Peer_SetGroupInfo(p,a,b,c,d,e) (p)->SetGroupInfo(a,b,c,d,e) +#define IDirectPlay8Peer_GetGroupInfo(p,a,b,c,d) (p)->GetGroupInfo(a,b,c,d) +#define IDirectPlay8Peer_EnumPlayersAndGroups(p,a,b,c) (p)->EnumPlayersAndGroups(a,b,c) +#define IDirectPlay8Peer_EnumGroupMembers(p,a,b,c,d) (p)->EnumGroupMembers(a,b,c,d) +#define IDirectPlay8Peer_SetPeerInfo(p,a,b,c,d) (p)->SetPeerInfo(a,b,c,d) +#define IDirectPlay8Peer_GetPeerInfo(p,a,b,c,d) (p)->GetPeerInfo(a,b,c,d) +#define IDirectPlay8Peer_GetPeerAddress(p,a,b,c) (p)->GetPeerAddress(a,b,c) +#define IDirectPlay8Peer_GetLocalHostAddresses(p,a,b,c) (p)->GetLocalHostAddresses(a,b,c) +#define IDirectPlay8Peer_Close(p,a) (p)->Close(a) +#define IDirectPlay8Peer_EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) (p)->EnumHosts(a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Peer_DestroyPeer(p,a,b,c,d) (p)->DestroyPeer(a,b,c,d) +#define IDirectPlay8Peer_ReturnBuffer(p,a,b) (p)->ReturnBuffer(a,b) +#define IDirectPlay8Peer_GetPlayerContext(p,a,b,c) (p)->GetPlayerContext(a,b,c) +#define IDirectPlay8Peer_GetGroupContext(p,a,b,c) (p)->GetGroupContext(a,b,c) +#define IDirectPlay8Peer_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay8Peer_SetCaps(p,a,b) (p)->SetCaps(a,b) +#define IDirectPlay8Peer_SetSPCaps(p,a,b,c) (p)->SetSPCaps(a,b,c) +#define IDirectPlay8Peer_GetSPCaps(p,a,b,c) (p)->GetSPCaps(a,b,c) +#define IDirectPlay8Peer_GetConnectionInfo(p,a,b,c) (p)->GetConnectionInfo(a,b,c) +#define IDirectPlay8Peer_RegisterLobby(p,a,b,c) (p)->RegisterLobby(a,b,c) +#define IDirectPlay8Peer_TerminateSession(p,a,b,c) (p)->TerminateSession(a,b,c) + +#define IDirectPlay8ThreadPool_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8ThreadPool_AddRef(p) (p)->AddRef() +#define IDirectPlay8ThreadPool_Release(p) (p)->Release() +#define IDirectPlay8ThreadPool_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8ThreadPool_Close(p,a) (p)->Close(a) +#define IDirectPlay8ThreadPool_GetThreadCount(p,a,b,c) (p)->GetThreadCount(a,b,c) +#define IDirectPlay8ThreadPool_SetThreadCount(p,a,b,c) (p)->SetThreadCount(a,b,c) +#define IDirectPlay8ThreadPool_DoWork(p,a,b) (p)->DoWork(a,b) + +#define IDirectPlay8NATResolver_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8NATResolver_AddRef(p) (p)->AddRef() +#define IDirectPlay8NATResolver_Release(p) (p)->Release() +#define IDirectPlay8NATResolver_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8NATResolver_Start(p,a,b,c) (p)->Start(a,b,c) +#define IDirectPlay8NATResolver_Close(p,a) (p)->Close(a) +#define IDirectPlay8NATResolver_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectPlay8NATResolver_GetAddresses(p,a,b,c) (p)->GetAddresses(a,b,c) + +#endif + + + +/**************************************************************************** + * + * DIRECTPLAY8 ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +#define _DPN_FACILITY_CODE 0x015 +#define _DPNHRESULT_BASE 0x8000 +#define MAKE_DPNHRESULT( code ) MAKE_HRESULT( 1, _DPN_FACILITY_CODE, ( code + _DPNHRESULT_BASE ) ) + +#define DPN_OK S_OK + +#define DPNSUCCESS_EQUAL MAKE_HRESULT( 0, _DPN_FACILITY_CODE, ( 0x5 + _DPNHRESULT_BASE ) ) +#define DPNSUCCESS_NOPLAYERSINGROUP MAKE_HRESULT( 0, _DPN_FACILITY_CODE, ( 0x8 + _DPNHRESULT_BASE ) ) // added for DirectX 9 +#define DPNSUCCESS_NOTEQUAL MAKE_HRESULT( 0, _DPN_FACILITY_CODE, (0x0A + _DPNHRESULT_BASE ) ) +#define DPNSUCCESS_PENDING MAKE_HRESULT( 0, _DPN_FACILITY_CODE, (0x0e + _DPNHRESULT_BASE ) ) + +#define DPNERR_ABORTED MAKE_DPNHRESULT( 0x30 ) +#define DPNERR_ADDRESSING MAKE_DPNHRESULT( 0x40 ) +#define DPNERR_ALREADYCLOSING MAKE_DPNHRESULT( 0x50 ) +#define DPNERR_ALREADYCONNECTED MAKE_DPNHRESULT( 0x60 ) +#define DPNERR_ALREADYDISCONNECTING MAKE_DPNHRESULT( 0x70 ) +#define DPNERR_ALREADYINITIALIZED MAKE_DPNHRESULT( 0x80 ) +#define DPNERR_ALREADYREGISTERED MAKE_DPNHRESULT( 0x90 ) +#define DPNERR_BUFFERTOOSMALL MAKE_DPNHRESULT( 0x100 ) +#define DPNERR_CANNOTCANCEL MAKE_DPNHRESULT( 0x110 ) +#define DPNERR_CANTCREATEGROUP MAKE_DPNHRESULT( 0x120 ) +#define DPNERR_CANTCREATEPLAYER MAKE_DPNHRESULT( 0x130 ) +#define DPNERR_CANTLAUNCHAPPLICATION MAKE_DPNHRESULT( 0x140 ) +#define DPNERR_CONNECTING MAKE_DPNHRESULT( 0x150 ) +#define DPNERR_CONNECTIONLOST MAKE_DPNHRESULT( 0x160 ) +#define DPNERR_CONVERSION MAKE_DPNHRESULT( 0x170 ) +#define DPNERR_DATATOOLARGE MAKE_DPNHRESULT( 0x175 ) +#define DPNERR_DOESNOTEXIST MAKE_DPNHRESULT( 0x180 ) +#define DPNERR_DPNSVRNOTAVAILABLE MAKE_DPNHRESULT( 0x185 ) +#define DPNERR_DUPLICATECOMMAND MAKE_DPNHRESULT( 0x190 ) +#define DPNERR_ENDPOINTNOTRECEIVING MAKE_DPNHRESULT( 0x200 ) +#define DPNERR_ENUMQUERYTOOLARGE MAKE_DPNHRESULT( 0x210 ) +#define DPNERR_ENUMRESPONSETOOLARGE MAKE_DPNHRESULT( 0x220 ) +#define DPNERR_EXCEPTION MAKE_DPNHRESULT( 0x230 ) +#define DPNERR_GENERIC E_FAIL +#define DPNERR_GROUPNOTEMPTY MAKE_DPNHRESULT( 0x240 ) +#define DPNERR_HOSTING MAKE_DPNHRESULT( 0x250 ) +#define DPNERR_HOSTREJECTEDCONNECTION MAKE_DPNHRESULT( 0x260 ) +#define DPNERR_HOSTTERMINATEDSESSION MAKE_DPNHRESULT( 0x270 ) +#define DPNERR_INCOMPLETEADDRESS MAKE_DPNHRESULT( 0x280 ) +#define DPNERR_INVALIDADDRESSFORMAT MAKE_DPNHRESULT( 0x290 ) +#define DPNERR_INVALIDAPPLICATION MAKE_DPNHRESULT( 0x300 ) +#define DPNERR_INVALIDCOMMAND MAKE_DPNHRESULT( 0x310 ) +#define DPNERR_INVALIDDEVICEADDRESS MAKE_DPNHRESULT( 0x320 ) +#define DPNERR_INVALIDENDPOINT MAKE_DPNHRESULT( 0x330 ) +#define DPNERR_INVALIDFLAGS MAKE_DPNHRESULT( 0x340 ) +#define DPNERR_INVALIDGROUP MAKE_DPNHRESULT( 0x350 ) +#define DPNERR_INVALIDHANDLE MAKE_DPNHRESULT( 0x360 ) +#define DPNERR_INVALIDHOSTADDRESS MAKE_DPNHRESULT( 0x370 ) +#define DPNERR_INVALIDINSTANCE MAKE_DPNHRESULT( 0x380 ) +#define DPNERR_INVALIDINTERFACE MAKE_DPNHRESULT( 0x390 ) +#define DPNERR_INVALIDOBJECT MAKE_DPNHRESULT( 0x400 ) +#define DPNERR_INVALIDPARAM E_INVALIDARG +#define DPNERR_INVALIDPASSWORD MAKE_DPNHRESULT( 0x410 ) +#define DPNERR_INVALIDPLAYER MAKE_DPNHRESULT( 0x420 ) +#define DPNERR_INVALIDPOINTER E_POINTER +#define DPNERR_INVALIDPRIORITY MAKE_DPNHRESULT( 0x430 ) +#define DPNERR_INVALIDSTRING MAKE_DPNHRESULT( 0x440 ) +#define DPNERR_INVALIDURL MAKE_DPNHRESULT( 0x450 ) +#define DPNERR_INVALIDVERSION MAKE_DPNHRESULT( 0x460 ) +#define DPNERR_NOCAPS MAKE_DPNHRESULT( 0x470 ) +#define DPNERR_NOCONNECTION MAKE_DPNHRESULT( 0x480 ) +#define DPNERR_NOHOSTPLAYER MAKE_DPNHRESULT( 0x490 ) +#define DPNERR_NOINTERFACE E_NOINTERFACE +#define DPNERR_NOMOREADDRESSCOMPONENTS MAKE_DPNHRESULT( 0x500 ) +#define DPNERR_NORESPONSE MAKE_DPNHRESULT( 0x510 ) +#define DPNERR_NOTALLOWED MAKE_DPNHRESULT( 0x520 ) +#define DPNERR_NOTHOST MAKE_DPNHRESULT( 0x530 ) +#define DPNERR_NOTREADY MAKE_DPNHRESULT( 0x540 ) +#define DPNERR_NOTREGISTERED MAKE_DPNHRESULT( 0x550 ) +#define DPNERR_OUTOFMEMORY E_OUTOFMEMORY +#define DPNERR_PENDING DPNSUCCESS_PENDING +#define DPNERR_PLAYERALREADYINGROUP MAKE_DPNHRESULT( 0x560 ) +#define DPNERR_PLAYERLOST MAKE_DPNHRESULT( 0x570 ) +#define DPNERR_PLAYERNOTINGROUP MAKE_DPNHRESULT( 0x580 ) +#define DPNERR_PLAYERNOTREACHABLE MAKE_DPNHRESULT( 0x590 ) +#define DPNERR_SENDTOOLARGE MAKE_DPNHRESULT( 0x600 ) +#define DPNERR_SESSIONFULL MAKE_DPNHRESULT( 0x610 ) +#define DPNERR_TABLEFULL MAKE_DPNHRESULT( 0x620 ) +#define DPNERR_TIMEDOUT MAKE_DPNHRESULT( 0x630 ) +#define DPNERR_UNINITIALIZED MAKE_DPNHRESULT( 0x640 ) +#define DPNERR_UNSUPPORTED E_NOTIMPL +#define DPNERR_USERCANCEL MAKE_DPNHRESULT( 0x650 ) + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/saco/d3d9/include/dplobby.h b/saco/d3d9/include/dplobby.h new file mode 100644 index 0000000..c91d323 --- /dev/null +++ b/saco/d3d9/include/dplobby.h @@ -0,0 +1,853 @@ +/*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dplobby.h + * Content: DirectPlayLobby include file + ***************************************************************************/ +#ifndef __DPLOBBY_INCLUDED__ +#define __DPLOBBY_INCLUDED__ + +#include "dplay.h" + +/* avoid warnings at Level 4 */ +#pragma warning(disable:4201) + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * GUIDS used by DirectPlay objects + */ + +/* {AF465C71-9588-11cf-A020-00AA006157AC} */ +DEFINE_GUID(IID_IDirectPlayLobby, 0xaf465c71, 0x9588, 0x11cf, 0xa0, 0x20, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac); +/* {26C66A70-B367-11cf-A024-00AA006157AC} */ +DEFINE_GUID(IID_IDirectPlayLobbyA, 0x26c66a70, 0xb367, 0x11cf, 0xa0, 0x24, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac); +/* {0194C220-A303-11d0-9C4F-00A0C905425E} */ +DEFINE_GUID(IID_IDirectPlayLobby2, 0x194c220, 0xa303, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); +/* {1BB4AF80-A303-11d0-9C4F-00A0C905425E} */ +DEFINE_GUID(IID_IDirectPlayLobby2A, 0x1bb4af80, 0xa303, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); +/* {2DB72490-652C-11d1-A7A8-0000F803ABFC} */ +DEFINE_GUID(IID_IDirectPlayLobby3, 0x2db72490, 0x652c, 0x11d1, 0xa7, 0xa8, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); +/* {2DB72491-652C-11d1-A7A8-0000F803ABFC} */ +DEFINE_GUID(IID_IDirectPlayLobby3A, 0x2db72491, 0x652c, 0x11d1, 0xa7, 0xa8, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); +/* {2FE8F810-B2A5-11d0-A787-0000F803ABFC} */ +DEFINE_GUID(CLSID_DirectPlayLobby, 0x2fe8f810, 0xb2a5, 0x11d0, 0xa7, 0x87, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); + + +/**************************************************************************** + * + * IDirectPlayLobby Structures + * + * Various structures used to invoke DirectPlayLobby. + * + ****************************************************************************/ + +typedef struct IDirectPlayLobby FAR *LPDIRECTPLAYLOBBY; +typedef struct IDirectPlayLobby FAR *LPDIRECTPLAYLOBBYA; +typedef struct IDirectPlayLobby IDirectPlayLobbyA; + +typedef struct IDirectPlayLobby2 FAR *LPDIRECTPLAYLOBBY2; +typedef struct IDirectPlayLobby2 FAR *LPDIRECTPLAYLOBBY2A; +typedef struct IDirectPlayLobby2 IDirectPlayLobby2A; + +typedef struct IDirectPlayLobby3 FAR *LPDIRECTPLAYLOBBY3; +typedef struct IDirectPlayLobby3 FAR *LPDIRECTPLAYLOBBY3A; +typedef struct IDirectPlayLobby3 IDirectPlayLobby3A; + + +/* + * DPLAPPINFO + * Used to hold information about a registered DirectPlay + * application + */ +typedef struct DPLAPPINFO +{ + DWORD dwSize; // Size of this structure + GUID guidApplication; // GUID of the Application + union + { + LPSTR lpszAppNameA; // Pointer to the Application Name + LPWSTR lpszAppName; + }; + +} DPLAPPINFO, FAR *LPDPLAPPINFO; + +/* + * LPCDPLAPPINFO + * A constant pointer to DPLAPPINFO + */ +typedef const DPLAPPINFO FAR *LPCDPLAPPINFO; + +/* + * DPCOMPOUNDADDRESSELEMENT + * + * An array of these is passed to CreateCompoundAddresses() + */ +typedef struct DPCOMPOUNDADDRESSELEMENT +{ + GUID guidDataType; + DWORD dwDataSize; + LPVOID lpData; +} DPCOMPOUNDADDRESSELEMENT, FAR *LPDPCOMPOUNDADDRESSELEMENT; + +/* + * LPCDPCOMPOUNDADDRESSELEMENT + * A constant pointer to DPCOMPOUNDADDRESSELEMENT + */ +typedef const DPCOMPOUNDADDRESSELEMENT FAR *LPCDPCOMPOUNDADDRESSELEMENT; + +/* + * LPDPAPPLICATIONDESC + * Used to register a DirectPlay application + */ +typedef struct DPAPPLICATIONDESC +{ + DWORD dwSize; + DWORD dwFlags; + union + { + LPSTR lpszApplicationNameA; + LPWSTR lpszApplicationName; + }; + GUID guidApplication; + union + { + LPSTR lpszFilenameA; + LPWSTR lpszFilename; + }; + union + { + LPSTR lpszCommandLineA; + LPWSTR lpszCommandLine; + }; + union + { + LPSTR lpszPathA; + LPWSTR lpszPath; + }; + union + { + LPSTR lpszCurrentDirectoryA; + LPWSTR lpszCurrentDirectory; + }; + LPSTR lpszDescriptionA; + LPWSTR lpszDescriptionW; +} DPAPPLICATIONDESC, *LPDPAPPLICATIONDESC; + +/* + * LPDPAPPLICATIONDESC2 + * Used to register a DirectPlay application + */ +typedef struct DPAPPLICATIONDESC2 +{ + DWORD dwSize; + DWORD dwFlags; + union + { + LPSTR lpszApplicationNameA; + LPWSTR lpszApplicationName; + }; + GUID guidApplication; + union + { + LPSTR lpszFilenameA; + LPWSTR lpszFilename; + }; + union + { + LPSTR lpszCommandLineA; + LPWSTR lpszCommandLine; + }; + union + { + LPSTR lpszPathA; + LPWSTR lpszPath; + }; + union + { + LPSTR lpszCurrentDirectoryA; + LPWSTR lpszCurrentDirectory; + }; + LPSTR lpszDescriptionA; + LPWSTR lpszDescriptionW; + union + { + LPSTR lpszAppLauncherNameA; + LPWSTR lpszAppLauncherName; + }; +} DPAPPLICATIONDESC2, *LPDPAPPLICATIONDESC2; + + +/**************************************************************************** + * + * Enumeration Method Callback Prototypes + * + ****************************************************************************/ + +/* + * Callback for EnumAddress() + */ +typedef BOOL (FAR PASCAL *LPDPENUMADDRESSCALLBACK)( + REFGUID guidDataType, + DWORD dwDataSize, + LPCVOID lpData, + LPVOID lpContext); + +/* + * Callback for EnumAddressTypes() + */ +typedef BOOL (FAR PASCAL *LPDPLENUMADDRESSTYPESCALLBACK)( + REFGUID guidDataType, + LPVOID lpContext, + DWORD dwFlags); + +/* + * Callback for EnumLocalApplications() + */ +typedef BOOL (FAR PASCAL * LPDPLENUMLOCALAPPLICATIONSCALLBACK)( + LPCDPLAPPINFO lpAppInfo, + LPVOID lpContext, + DWORD dwFlags); + + +/**************************************************************************** + * + * DirectPlayLobby API Prototypes + * + ****************************************************************************/ +#ifdef UNICODE +#define DirectPlayLobbyCreate DirectPlayLobbyCreateW +#else +#define DirectPlayLobbyCreate DirectPlayLobbyCreateA +#endif /* UNICODE */ + +extern HRESULT WINAPI DirectPlayLobbyCreateW(LPGUID, LPDIRECTPLAYLOBBY *, IUnknown *, LPVOID, DWORD ); +extern HRESULT WINAPI DirectPlayLobbyCreateA(LPGUID, LPDIRECTPLAYLOBBYA *, IUnknown *, LPVOID, DWORD ); + + +/**************************************************************************** + * + * IDirectPlayLobby (and IDirectPlayLobbyA) Interface + * + ****************************************************************************/ +#undef INTERFACE +#define INTERFACE IDirectPlayLobby +DECLARE_INTERFACE_( IDirectPlayLobby, IUnknown ) +{ + /* IUnknown Methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectPlayLobby Methods */ + STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE; + STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE; + STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE; + STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE; + STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE; + STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE; + STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE; + +}; + +/**************************************************************************** + * + * IDirectPlayLobby2 (and IDirectPlayLobby2A) Interface + * + ****************************************************************************/ +#undef INTERFACE +#define INTERFACE IDirectPlayLobby2 +DECLARE_INTERFACE_( IDirectPlayLobby2, IDirectPlayLobby ) +{ + /* IUnknown Methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectPlayLobby Methods */ + STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE; + STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE; + STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE; + STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE; + STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE; + STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE; + STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE; + + /* IDirectPlayLobby2 Methods */ + STDMETHOD(CreateCompoundAddress)(THIS_ LPCDPCOMPOUNDADDRESSELEMENT,DWORD,LPVOID,LPDWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlayLobby3 (and IDirectPlayLobby3A) Interface + * + ****************************************************************************/ +#undef INTERFACE +#define INTERFACE IDirectPlayLobby3 +DECLARE_INTERFACE_( IDirectPlayLobby3, IDirectPlayLobby ) +{ + /* IUnknown Methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectPlayLobby Methods */ + STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE; + STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE; + STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE; + STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE; + STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE; + STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE; + STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE; + + /* IDirectPlayLobby2 Methods */ + STDMETHOD(CreateCompoundAddress)(THIS_ LPCDPCOMPOUNDADDRESSELEMENT,DWORD,LPVOID,LPDWORD) PURE; + + /* IDirectPlayLobby3 Methods */ + STDMETHOD(ConnectEx) (THIS_ DWORD, REFIID, LPVOID *, IUnknown FAR *) PURE; + STDMETHOD(RegisterApplication) (THIS_ DWORD, LPVOID) PURE; + STDMETHOD(UnregisterApplication)(THIS_ DWORD, REFGUID) PURE; + STDMETHOD(WaitForConnectionSettings)(THIS_ DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlayLobby interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlayLobby_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayLobby_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayLobby_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayLobby_Connect(p,a,b,c) (p)->lpVtbl->Connect(p,a,b,c) +#define IDirectPlayLobby_ConnectEx(p,a,b,c,d) (p)->lpVtbl->ConnectEx(p,a,b,c,d) +#define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f) (p)->lpVtbl->CreateAddress(p,a,b,c,d,e,f) +#define IDirectPlayLobby_CreateCompoundAddress(p,a,b,c,d) (p)->lpVtbl->CreateCompoundAddress(p,a,b,c,d) +#define IDirectPlayLobby_EnumAddress(p,a,b,c,d) (p)->lpVtbl->EnumAddress(p,a,b,c,d) +#define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d) (p)->lpVtbl->EnumAddressTypes(p,a,b,c,d) +#define IDirectPlayLobby_EnumLocalApplications(p,a,b,c) (p)->lpVtbl->EnumLocalApplications(p,a,b,c) +#define IDirectPlayLobby_GetConnectionSettings(p,a,b,c) (p)->lpVtbl->GetConnectionSettings(p,a,b,c) +#define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e) (p)->lpVtbl->ReceiveLobbyMessage(p,a,b,c,d,e) +#define IDirectPlayLobby_RegisterApplication(p,a,b) (p)->lpVtbl->RegisterApplication(p,a,b) +#define IDirectPlayLobby_RunApplication(p,a,b,c,d) (p)->lpVtbl->RunApplication(p,a,b,c,d) +#define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d) (p)->lpVtbl->SendLobbyMessage(p,a,b,c,d) +#define IDirectPlayLobby_SetConnectionSettings(p,a,b,c) (p)->lpVtbl->SetConnectionSettings(p,a,b,c) +#define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c) (p)->lpVtbl->SetLobbyMessageEvent(p,a,b,c) +#define IDirectPlayLobby_UnregisterApplication(p,a,b) (p)->lpVtbl->UnregisterApplication(p,a,b) +#define IDirectPlayLobby_WaitForConnectionSettings(p,a) (p)->lpVtbl->WaitForConnectionSettings(p,a) + +#else /* C++ */ + +#define IDirectPlayLobby_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayLobby_AddRef(p) (p)->AddRef() +#define IDirectPlayLobby_Release(p) (p)->Release() +#define IDirectPlayLobby_Connect(p,a,b,c) (p)->Connect(a,b,c) +#define IDirectPlayLobby_ConnectEx(p,a,b,c,d) (p)->ConnectEx(a,b,c,d) +#define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f) (p)->CreateAddress(a,b,c,d,e,f) +#define IDirectPlayLobby_CreateCompoundAddress(p,a,b,c,d) (p)->CreateCompoundAddress(a,b,c,d) +#define IDirectPlayLobby_EnumAddress(p,a,b,c,d) (p)->EnumAddress(a,b,c,d) +#define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d) (p)->EnumAddressTypes(a,b,c,d) +#define IDirectPlayLobby_EnumLocalApplications(p,a,b,c) (p)->EnumLocalApplications(a,b,c) +#define IDirectPlayLobby_GetConnectionSettings(p,a,b,c) (p)->GetConnectionSettings(a,b,c) +#define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e) (p)->ReceiveLobbyMessage(a,b,c,d,e) +#define IDirectPlayLobby_RegisterApplication(p,a,b) (p)->RegisterApplication(a,b) +#define IDirectPlayLobby_RunApplication(p,a,b,c,d) (p)->RunApplication(a,b,c,d) +#define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d) (p)->SendLobbyMessage(a,b,c,d) +#define IDirectPlayLobby_SetConnectionSettings(p,a,b,c) (p)->SetConnectionSettings(a,b,c) +#define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c) (p)->SetLobbyMessageEvent(a,b,c) +#define IDirectPlayLobby_UnregisterApplication(p,a,b) (p)->UnregisterApplication(a,b) +#define IDirectPlayLobby_WaitForConnectionSettings(p,a) (p)->WaitForConnectionSettings(a) + +#endif + +/**************************************************************************** + * + * DirectPlayLobby Flags + * + ****************************************************************************/ + +/* + * This flag is used by IDirectPlayLobby->WaitForConnectionSettings to + * cancel a current wait that is in progress. + */ +#define DPLWAIT_CANCEL 0x00000001 + + +/* + * This is a message flag used by ReceiveLobbyMessage. It can be + * returned in the dwMessageFlags parameter to indicate a message from + * the system. + */ +#define DPLMSG_SYSTEM 0x00000001 + +/* + * This is a message flag used by ReceiveLobbyMessage and SendLobbyMessage. + * It is used to indicate that the message is a standard lobby message. + * DPLMSG_SETPROPERTY, DPLMSG_SETPROPERTYRESPONSE, DPLMSG_GETPROPERTY, + * DPLMSG_GETPROPERTYRESPONSE + */ +#define DPLMSG_STANDARD 0x00000002 + +/* + * Lobbyable Application registration flags + */ + +/* + * Applications registered with this flag will not show up when + * applications are enumerated in the lobby. This application + * will only be able to be launched by a lobby client that already + * knows about the application. + */ +#define DPLAPP_NOENUM 0x80000000 + +/* + * Applications registered with this flag want voice to automatically + * be enabled for their application. All players will be launched into + * an 'n'-way voice conference when the application is started. The + * user will be able to enable this flag for existing non-voice + * directplay applications. + */ +#define DPLAPP_AUTOVOICE 0x00000001 + +/* + * Applications that do their own voice conferencing should register with + * this flag to avoid allowing the user to enable other voice chat + * capabilites during the same session. This is to avoid users forcing + * the DPLAPP_AUTOVOICE flag for the application. + */ +#define DPLAPP_SELFVOICE 0x00000002 + +/**************************************************************************** + * + * DirectPlayLobby messages and message data structures + * + * All system messages have a dwMessageFlags value of DPLMSG_SYSTEM returned + * from a call to ReceiveLobbyMessage. + * + * All standard messages have a dwMessageFlags value of DPLMSG_STANDARD returned + * from a call to ReceiveLobbyMessage. + * + ****************************************************************************/ + +/* + * DPLMSG_GENERIC + * Generic message structure used to identify the message type. + */ +typedef struct _DPLMSG_GENERIC +{ + DWORD dwType; // Message type +} DPLMSG_GENERIC, FAR *LPDPLMSG_GENERIC; + +/* + * DPLMSG_SYSTEMMESSAGE + * Generic message format for all system messages -- + * DPLSYS_CONNECTIONSETTINGSREAD, DPLSYS_DPLYCONNECTSUCCEEDED, + * DPLSYS_DPLAYCONNECTFAILED, DPLSYS_APPTERMINATED, DPLSYS_NEWCONNECTIONSETTINGS + */ +typedef struct _DPLMSG_SYSTEMMESSAGE +{ + DWORD dwType; // Message type + GUID guidInstance; // Instance GUID of the dplay session the message corresponds to +} DPLMSG_SYSTEMMESSAGE, FAR *LPDPLMSG_SYSTEMMESSAGE; + +/* + * DPLMSG_SETPROPERTY + * Standard message sent by an application to a lobby to set a + * property + */ +typedef struct _DPLMSG_SETPROPERTY +{ + DWORD dwType; // Message type + DWORD dwRequestID; // Request ID (DPL_NOCONFIRMATION if no confirmation desired) + GUID guidPlayer; // Player GUID + GUID guidPropertyTag; // Property GUID + DWORD dwDataSize; // Size of data + DWORD dwPropertyData[1]; // Buffer containing data +} DPLMSG_SETPROPERTY, FAR *LPDPLMSG_SETPROPERTY; + +#define DPL_NOCONFIRMATION 0 + +/* + * DPLMSG_SETPROPERTYRESPONSE + * Standard message returned by a lobby to confirm a + * DPLMSG_SETPROPERTY message. + */ +typedef struct _DPLMSG_SETPROPERTYRESPONSE +{ + DWORD dwType; // Message type + DWORD dwRequestID; // Request ID + GUID guidPlayer; // Player GUID + GUID guidPropertyTag; // Property GUID + HRESULT hr; // Return Code +} DPLMSG_SETPROPERTYRESPONSE, FAR *LPDPLMSG_SETPROPERTYRESPONSE; + +/* + * DPLMSG_GETPROPERTY + * Standard message sent by an application to a lobby to request + * the current value of a property + */ +typedef struct _DPLMSG_GETPROPERTY +{ + DWORD dwType; // Message type + DWORD dwRequestID; // Request ID + GUID guidPlayer; // Player GUID + GUID guidPropertyTag; // Property GUID +} DPLMSG_GETPROPERTY, FAR *LPDPLMSG_GETPROPERTY; + +/* + * DPLMSG_GETPROPERTYRESPONSE + * Standard message returned by a lobby in response to a + * DPLMSG_GETPROPERTY message. + */ +typedef struct _DPLMSG_GETPROPERTYRESPONSE +{ + DWORD dwType; // Message type + DWORD dwRequestID; // Request ID + GUID guidPlayer; // Player GUID + GUID guidPropertyTag; // Property GUID + HRESULT hr; // Return Code + DWORD dwDataSize; // Size of data + DWORD dwPropertyData[1]; // Buffer containing data +} DPLMSG_GETPROPERTYRESPONSE, FAR *LPDPLMSG_GETPROPERTYRESPONSE; + +/* + * DPLMSG_NEWSESSIONHOST + * Standard message returned by a lobby in response to a + * the session host migrating to a new client + */ +typedef struct _DPLMSG_NEWSESSIONHOST +{ + DWORD dwType; // Message type + GUID guidInstance; // GUID Instance of the session +} DPLMSG_NEWSESSIONHOST, FAR *LPDPLMSG_NEWSESSIONHOST; + + +/****************************************** + * + * DirectPlay Lobby message dwType values + * + *****************************************/ + +/* + * The application has read the connection settings. + * It is now O.K. for the lobby client to release + * its IDirectPlayLobby interface. + */ +#define DPLSYS_CONNECTIONSETTINGSREAD 0x00000001 + +/* + * The application's call to DirectPlayConnect failed + */ +#define DPLSYS_DPLAYCONNECTFAILED 0x00000002 + +/* + * The application has created a DirectPlay session. + */ +#define DPLSYS_DPLAYCONNECTSUCCEEDED 0x00000003 + +/* + * The application has terminated. + */ +#define DPLSYS_APPTERMINATED 0x00000004 + +/* + * The message is a DPLMSG_SETPROPERTY message. + */ +#define DPLSYS_SETPROPERTY 0x00000005 + +/* + * The message is a DPLMSG_SETPROPERTYRESPONSE message. + */ +#define DPLSYS_SETPROPERTYRESPONSE 0x00000006 + +/* + * The message is a DPLMSG_GETPROPERTY message. + */ +#define DPLSYS_GETPROPERTY 0x00000007 + +/* + * The message is a DPLMSG_GETPROPERTYRESPONSE message. + */ +#define DPLSYS_GETPROPERTYRESPONSE 0x00000008 + +/* + * The message is a DPLMSG_NEWSESSIONHOST message. + */ +#define DPLSYS_NEWSESSIONHOST 0x00000009 + +/* + * New connection settings are available. + */ +#define DPLSYS_NEWCONNECTIONSETTINGS 0x0000000A + +/* + * The Lobby Client has released the DirectPlayLobby Interface + */ +#define DPLSYS_LOBBYCLIENTRELEASE 0x0000000B + +/**************************************************************************** + * + * DirectPlay defined property GUIDs and associated data structures + * + ****************************************************************************/ + +/* + * DPLPROPERTY_MessagesSupported + * + * Request whether the lobby supports standard. Lobby with respond with either + * TRUE or FALSE or may not respond at all. + * + * Property data is a single BOOL with TRUE or FALSE + */ +// {762CCDA1-D916-11d0-BA39-00C04FD7ED67} +DEFINE_GUID(DPLPROPERTY_MessagesSupported, +0x762ccda1, 0xd916, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67); + +/* + * DPLPROPERTY_LobbyGuid + * + * Request the GUID that identifies the lobby software that the application + * is communicating with. + * + * Property data is a single GUID. + */ +// {F56920A0-D218-11d0-BA39-00C04FD7ED67} +DEFINE_GUID(DPLPROPERTY_LobbyGuid, +0xf56920a0, 0xd218, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67); + +/* + * DPLPROPERTY_PlayerGuid + * + * Request the GUID that identifies the player on this machine for sending + * property data back to the lobby. + * + * Property data is the DPLDATA_PLAYERDATA structure + */ +// {B4319322-D20D-11d0-BA39-00C04FD7ED67} +DEFINE_GUID(DPLPROPERTY_PlayerGuid, +0xb4319322, 0xd20d, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67); + +/* + * DPLDATA_PLAYERGUID + * + * Data structure to hold the GUID of the player and player creation flags + * from the lobby. + */ +typedef struct _DPLDATA_PLAYERGUID +{ + GUID guidPlayer; + DWORD dwPlayerFlags; +} DPLDATA_PLAYERGUID, FAR *LPDPLDATA_PLAYERGUID; + +/* + * DPLPROPERTY_PlayerScore + * + * Used to send an array of long integers to the lobby indicating the + * score of a player. + * + * Property data is the DPLDATA_PLAYERSCORE structure. + */ +// {48784000-D219-11d0-BA39-00C04FD7ED67} +DEFINE_GUID(DPLPROPERTY_PlayerScore, +0x48784000, 0xd219, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67); + +/* + * DPLDATA_PLAYERSCORE + * + * Data structure to hold an array of long integers representing a player score. + * Application must allocate enough memory to hold all the scores. + */ +typedef struct _DPLDATA_PLAYERSCORE +{ + DWORD dwScoreCount; + LONG Score[1]; +} DPLDATA_PLAYERSCORE, FAR *LPDPLDATA_PLAYERSCORE; + +/**************************************************************************** + * + * DirectPlay Address ID's + * + ****************************************************************************/ + +/* DirectPlay Address + * + * A DirectPlay address consists of multiple chunks of data, each tagged + * with a GUID signifying the type of data in the chunk. The chunk also + * has a length so that unknown chunk types can be skipped. + * + * The EnumAddress() function is used to parse these address data chunks. + */ + +/* + * DPADDRESS + * + * Header for block of address data elements + */ +typedef struct _DPADDRESS +{ + GUID guidDataType; + DWORD dwDataSize; +} DPADDRESS; + +typedef DPADDRESS FAR *LPDPADDRESS; + +/* + * DPAID_TotalSize + * + * Chunk is a DWORD containing size of entire DPADDRESS structure + */ + +// {1318F560-912C-11d0-9DAA-00A0C90A43CB} +DEFINE_GUID(DPAID_TotalSize, +0x1318f560, 0x912c, 0x11d0, 0x9d, 0xaa, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); + +/* + * DPAID_ServiceProvider + * + * Chunk is a GUID describing the service provider that created the chunk. + * All addresses must contain this chunk. + */ + +// {07D916C0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_ServiceProvider, +0x7d916c0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_LobbyProvider + * + * Chunk is a GUID describing the lobby provider that created the chunk. + * All addresses must contain this chunk. + */ + +// {59B95640-9667-11d0-A77D-0000F803ABFC} +DEFINE_GUID(DPAID_LobbyProvider, +0x59b95640, 0x9667, 0x11d0, 0xa7, 0x7d, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); + +/* + * DPAID_Phone and DPAID_PhoneW + * + * Chunk is a string containing a phone number (i.e. "1-800-555-1212") + * in ANSI or UNICODE format + */ + +// {78EC89A0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_Phone, +0x78ec89a0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// {BA5A7A70-9DBF-11d0-9CC1-00A0C905425E} +DEFINE_GUID(DPAID_PhoneW, +0xba5a7a70, 0x9dbf, 0x11d0, 0x9c, 0xc1, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_Modem and DPAID_ModemW + * + * Chunk is a string containing a modem name registered with TAPI + * in ANSI or UNICODE format + */ + +// {F6DCC200-A2FE-11d0-9C4F-00A0C905425E} +DEFINE_GUID(DPAID_Modem, +0xf6dcc200, 0xa2fe, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// {01FD92E0-A2FF-11d0-9C4F-00A0C905425E} +DEFINE_GUID(DPAID_ModemW, +0x1fd92e0, 0xa2ff, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_Inet and DPAID_InetW + * + * Chunk is a string containing a TCP/IP host name or an IP address + * (i.e. "dplay.microsoft.com" or "137.55.100.173") in ANSI or UNICODE format + */ + +// {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_INet, +0xc4a54da0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// {E63232A0-9DBF-11d0-9CC1-00A0C905425E} +DEFINE_GUID(DPAID_INetW, +0xe63232a0, 0x9dbf, 0x11d0, 0x9c, 0xc1, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_InetPort + * + * Chunk is the port number used for creating the apps TCP and UDP sockets. + * WORD value (i.e. 47624). + */ + +// {E4524541-8EA5-11d1-8A96-006097B01411} +DEFINE_GUID(DPAID_INetPort, +0xe4524541, 0x8ea5, 0x11d1, 0x8a, 0x96, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +#ifdef BIGMESSAGEDEFENSE +#endif + +/* + * DPCOMPORTADDRESS + * + * Used to specify com port settings. The constants that define baud rate, + * stop bits and parity are defined in WINBASE.H. The constants for flow + * control are given below. + */ + +#define DPCPA_NOFLOW 0 // no flow control +#define DPCPA_XONXOFFFLOW 1 // software flow control +#define DPCPA_RTSFLOW 2 // hardware flow control with RTS +#define DPCPA_DTRFLOW 3 // hardware flow control with DTR +#define DPCPA_RTSDTRFLOW 4 // hardware flow control with RTS and DTR + +typedef struct _DPCOMPORTADDRESS +{ + DWORD dwComPort; // COM port to use (1-4) + DWORD dwBaudRate; // baud rate (100-256k) + DWORD dwStopBits; // no. stop bits (1-2) + DWORD dwParity; // parity (none, odd, even, mark) + DWORD dwFlowControl; // flow control (none, xon/xoff, rts, dtr) +} DPCOMPORTADDRESS; + +typedef DPCOMPORTADDRESS FAR *LPDPCOMPORTADDRESS; + +/* + * DPAID_ComPort + * + * Chunk contains a DPCOMPORTADDRESS structure defining the serial port. + */ + +// {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_ComPort, +0xf2f0ce00, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/**************************************************************************** + * + * dplobby 1.0 obsolete definitions + * Included for compatibility only. + * + ****************************************************************************/ +#define DPLAD_SYSTEM DPLMSG_SYSTEM + + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#pragma warning(default:4201) + +#endif /* __DPLOBBY_INCLUDED__ */ + diff --git a/saco/d3d9/include/dplobby8.h b/saco/d3d9/include/dplobby8.h new file mode 100644 index 0000000..e63a5aa --- /dev/null +++ b/saco/d3d9/include/dplobby8.h @@ -0,0 +1,407 @@ +/*========================================================================== + * + * Copyright (C) 2000 Microsoft Corporation. All Rights Reserved. + * + * File: DPLobby.h + * Content: DirectPlay8 Lobby Include File + * + ***************************************************************************/ + +#ifndef __DPLOBBY_H__ +#define __DPLOBBY_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/**************************************************************************** + * + * DirectPlay8Lobby CLSIDs + * + ****************************************************************************/ + +// {667955AD-6B3B-43ca-B949-BC69B5BAFF7F} +DEFINE_GUID(CLSID_DirectPlay8LobbiedApplication, +0x667955ad, 0x6b3b, 0x43ca, 0xb9, 0x49, 0xbc, 0x69, 0xb5, 0xba, 0xff, 0x7f); + +// {3B2B6775-70B6-45af-8DEA-A209C69559F3} +DEFINE_GUID(CLSID_DirectPlay8LobbyClient, +0x3b2b6775, 0x70b6, 0x45af, 0x8d, 0xea, 0xa2, 0x9, 0xc6, 0x95, 0x59, 0xf3); + +/**************************************************************************** + * + * DirectPlay8Lobby Interface IIDs + * + ****************************************************************************/ + +// {819074A3-016C-11d3-AE14-006097B01411} +DEFINE_GUID(IID_IDirectPlay8LobbiedApplication, +0x819074a3, 0x16c, 0x11d3, 0xae, 0x14, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +// {819074A2-016C-11d3-AE14-006097B01411} +DEFINE_GUID(IID_IDirectPlay8LobbyClient, +0x819074a2, 0x16c, 0x11d3, 0xae, 0x14, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +/**************************************************************************** + * + * DirectPlay8Lobby Interface Pointer + * + ****************************************************************************/ + +typedef struct IDirectPlay8LobbiedApplication *PDIRECTPLAY8LOBBIEDAPPLICATION; +typedef struct IDirectPlay8LobbyClient *PDIRECTPLAY8LOBBYCLIENT; + +/**************************************************************************** + * + * DirectPlay8 Lobby Message IDs + * + ****************************************************************************/ + +#define DPL_MSGID_LOBBY 0x8000 +#define DPL_MSGID_RECEIVE (0x0001 | DPL_MSGID_LOBBY) +#define DPL_MSGID_CONNECT (0x0002 | DPL_MSGID_LOBBY) +#define DPL_MSGID_DISCONNECT (0x0003 | DPL_MSGID_LOBBY) +#define DPL_MSGID_SESSION_STATUS (0x0004 | DPL_MSGID_LOBBY) +#define DPL_MSGID_CONNECTION_SETTINGS (0x0005 | DPL_MSGID_LOBBY) + +/**************************************************************************** + * + * DirectPlay8Lobby Constants + * + ****************************************************************************/ + +// +// Specifies that operation should be performed on all open connections +// +#define DPLHANDLE_ALLCONNECTIONS 0xFFFFFFFF + +// +// The associated game session has suceeded in connecting / hosting +// +#define DPLSESSION_CONNECTED 0x0001 + +// The associated game session failed connecting / hosting +// +#define DPLSESSION_COULDNOTCONNECT 0x0002 + +// +// The associated game session has disconnected +// +#define DPLSESSION_DISCONNECTED 0x0003 + +// +// The associated game session has terminated +// +#define DPLSESSION_TERMINATED 0x0004 + +// +// The associated game session's host has migrated +// +#define DPLSESSION_HOSTMIGRATED 0x0005 + +// +// The associated game session's host has migrated to the local client +// +#define DPLSESSION_HOSTMIGRATEDHERE 0x0006 + + +/**************************************************************************** + * + * DirectPlay8 Lobby Flags + * + ****************************************************************************/ + +// +// Do not automatically make the lobby app unavailable when a connection is established +// +#define DPLAVAILABLE_ALLOWMULTIPLECONNECT 0x0001 + +// +// Launch a new instance of the application to connect to +// +#define DPLCONNECT_LAUNCHNEW 0x0001 + +// +// Launch a new instance of the application if one is not waiting +// +#define DPLCONNECT_LAUNCHNOTFOUND 0x0002 + +// +// When starting the associated game session, start it as a host +// +#define DPLCONNECTSETTINGS_HOST 0x0001 + +// +// Disable parameter validation +// +#define DPLINITIALIZE_DISABLEPARAMVAL 0x0001 + +/**************************************************************************** + * + * DirectPlay8Lobby Structures (Non-Message) + * + ****************************************************************************/ + +// +// Information on a registered game +// +typedef struct _DPL_APPLICATION_INFO { + GUID guidApplication; // GUID of the application + PWSTR pwszApplicationName; // Name of the application + DWORD dwNumRunning; // # of instances of this application running + DWORD dwNumWaiting; // # of instances of this application waiting + DWORD dwFlags; // Flags +} DPL_APPLICATION_INFO, *PDPL_APPLICATION_INFO; + +// +// Settings to be used for connecting / hosting a game session +// +typedef struct _DPL_CONNECTION_SETTINGS { + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Connection settings flags (DPLCONNECTSETTINGS_...) + DPN_APPLICATION_DESC dpnAppDesc; // Application desc for the associated DirectPlay session + IDirectPlay8Address *pdp8HostAddress; // Address of host to connect to + IDirectPlay8Address **ppdp8DeviceAddresses; // Address of device to connect from / host on + DWORD cNumDeviceAddresses; // # of addresses specified in ppdp8DeviceAddresses + PWSTR pwszPlayerName; // Name to give the player +} DPL_CONNECTION_SETTINGS, *PDPL_CONNECTION_SETTINGS; + +// +// Information for performing a lobby connect +// (ConnectApplication) +// +typedef struct _DPL_CONNECT_INFO { + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags (DPLCONNECT_...) + GUID guidApplication; // GUID of application to launch + PDPL_CONNECTION_SETTINGS pdplConnectionSettings; + // Settings application should use + PVOID pvLobbyConnectData; // User defined data block + DWORD dwLobbyConnectDataSize; + // Size of user defined data block +} DPL_CONNECT_INFO, *PDPL_CONNECT_INFO; + +// +// Information for registering an application +// (RegisterApplication) +// +typedef struct _DPL_PROGRAM_DESC { + DWORD dwSize; + DWORD dwFlags; + GUID guidApplication; // Application GUID + PWSTR pwszApplicationName; // Unicode application name + PWSTR pwszCommandLine; // Unicode command line arguments + PWSTR pwszCurrentDirectory; // Unicode current directory + PWSTR pwszDescription; // Unicode application description + PWSTR pwszExecutableFilename; // Unicode filename of application executable + PWSTR pwszExecutablePath; // Unicode path of application executable + PWSTR pwszLauncherFilename; // Unicode filename of launcher executable + PWSTR pwszLauncherPath; // Unicode path of launcher executable +} DPL_PROGRAM_DESC, *PDPL_PROGRAM_DESC; + +/**************************************************************************** + * + * DirectPlay8 Lobby Message Structures + * + ****************************************************************************/ + +// +// A connection was established +// (DPL_MSGID_CONNECT) +// +typedef struct _DPL_MESSAGE_CONNECT +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hConnectId; // Handle of new connection + PDPL_CONNECTION_SETTINGS pdplConnectionSettings; // Connection settings for this connection + PVOID pvLobbyConnectData; // User defined lobby data block + DWORD dwLobbyConnectDataSize; // Size of user defined lobby data block + PVOID pvConnectionContext; // Context value for this connection (user set) +} DPL_MESSAGE_CONNECT, *PDPL_MESSAGE_CONNECT; + +// +// Connection settings have been updated +// (DPL_MSGID_CONNECTION_SETTINGS) +// +typedef struct _DPL_MESSAGE_CONNECTION_SETTINGS +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hSender; // Handle of the connection for these settings + PDPL_CONNECTION_SETTINGS pdplConnectionSettings; // Connection settings + PVOID pvConnectionContext; // Context value for this connection +} DPL_MESSAGE_CONNECTION_SETTINGS, *PDPL_MESSAGE_CONNECTION_SETTINGS; + +// +// A connection has been disconnected +// (DPL_MSGID_DISCONNECT) +// +typedef struct _DPL_MESSAGE_DISCONNECT +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hDisconnectId; // Handle of the connection that was terminated + HRESULT hrReason; // Reason the connection was broken + PVOID pvConnectionContext; // Context value for this connection +} DPL_MESSAGE_DISCONNECT, *PDPL_MESSAGE_DISCONNECT; + +// +// Data was received through a connection +// (DPL_MSGID_RECEIVE) +// +typedef struct _DPL_MESSAGE_RECEIVE +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hSender; // Handle of the connection that is from + BYTE *pBuffer; // Contents of the message + DWORD dwBufferSize; // Size of the message context + PVOID pvConnectionContext; // Context value for this connection +} DPL_MESSAGE_RECEIVE, *PDPL_MESSAGE_RECEIVE; + +// +// Current status of the associated connection +// (DPL_MSGID_SESSION_STATUS) +// +typedef struct _DPL_MESSAGE_SESSION_STATUS +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hSender; // Handle of the connection that this is from + DWORD dwStatus; // Status (DPLSESSION_...) + PVOID pvConnectionContext; // Context value for this connection +} DPL_MESSAGE_SESSION_STATUS, *PDPL_MESSAGE_SESSION_STATUS; + +/**************************************************************************** + * + * DirectPlay8Lobby Create + * + ****************************************************************************/ + +/* + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 lobby objects. + * + * extern HRESULT WINAPI DirectPlay8LobbyCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + */ + +/**************************************************************************** + * + * DirectPlay8 Functions + * + ****************************************************************************/ + +// +// COM definition for DirectPlayLobbyClient +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8LobbyClient +DECLARE_INTERFACE_(IDirectPlay8LobbyClient,IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + // IDirectPlayLobbyClient methods + STDMETHOD(Initialize) (THIS_ const PVOID pvUserContext,const PFNDPNMESSAGEHANDLER pfn,const DWORD dwFlags) PURE; + STDMETHOD(EnumLocalPrograms) (THIS_ GUID *const pGuidApplication,BYTE *const pEnumData,DWORD *const pdwEnumData,DWORD *const pdwItems, const DWORD dwFlags) PURE; + STDMETHOD(ConnectApplication) (THIS_ DPL_CONNECT_INFO *const pdplConnectionInfo,const PVOID pvConnectionContext,DPNHANDLE *const hApplication,const DWORD dwTimeOut,const DWORD dwFlags) PURE; + STDMETHOD(Send) (THIS_ const DPNHANDLE hConnection,BYTE *const pBuffer,const DWORD pBufferSize,const DWORD dwFlags) PURE; + STDMETHOD(ReleaseApplication) (THIS_ const DPNHANDLE hConnection, const DWORD dwFlags ) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags ) PURE; + STDMETHOD(GetConnectionSettings) (THIS_ const DPNHANDLE hConnection, DPL_CONNECTION_SETTINGS * const pdplSessionInfo, DWORD *pdwInfoSize, const DWORD dwFlags ) PURE; + STDMETHOD(SetConnectionSettings) (THIS_ const DPNHANDLE hConnection, const DPL_CONNECTION_SETTINGS * const pdplSessionInfo, const DWORD dwFlags ) PURE; +}; + + +// +// COM definition for DirectPlayLobbiedApplication +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8LobbiedApplication +DECLARE_INTERFACE_(IDirectPlay8LobbiedApplication,IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + // IDirectPlayLobbiedApplication methods + STDMETHOD(Initialize) (THIS_ const PVOID pvUserContext,const PFNDPNMESSAGEHANDLER pfn,DPNHANDLE * const pdpnhConnection, const DWORD dwFlags) PURE; + STDMETHOD(RegisterProgram) (THIS_ PDPL_PROGRAM_DESC pdplProgramDesc,const DWORD dwFlags) PURE; + STDMETHOD(UnRegisterProgram) (THIS_ GUID *pguidApplication,const DWORD dwFlags) PURE; + STDMETHOD(Send) (THIS_ const DPNHANDLE hConnection,BYTE *const pBuffer,const DWORD pBufferSize,const DWORD dwFlags) PURE; + STDMETHOD(SetAppAvailable) (THIS_ const BOOL fAvailable, const DWORD dwFlags ) PURE; + STDMETHOD(UpdateStatus) (THIS_ const DPNHANDLE hConnection, const DWORD dwStatus, const DWORD dwFlags ) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags ) PURE; + STDMETHOD(GetConnectionSettings) (THIS_ const DPNHANDLE hConnection, DPL_CONNECTION_SETTINGS * const pdplSessionInfo, DWORD *pdwInfoSize, const DWORD dwFlags ) PURE; + STDMETHOD(SetConnectionSettings) (THIS_ const DPNHANDLE hConnection, const DPL_CONNECTION_SETTINGS * const pdplSessionInfo, const DWORD dwFlags ) PURE; +}; + + +/**************************************************************************** + * + * DirectPlayLobby Interface Macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay8LobbyClient_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8LobbyClient_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8LobbyClient_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8LobbyClient_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8LobbyClient_EnumLocalPrograms(p,a,b,c,d,e) (p)->lpVtbl->EnumLocalPrograms(p,a,b,c,d,e) +#define IDirectPlay8LobbyClient_ConnectApplication(p,a,b,c,d,e) (p)->lpVtbl->ConnectApplication(p,a,b,c,d,e) +#define IDirectPlay8LobbyClient_Send(p,a,b,c,d) (p)->lpVtbl->Send(p,a,b,c,d) +#define IDirectPlay8LobbyClient_ReleaseApplication(p,a,b) (p)->lpVtbl->ReleaseApplication(p,a,b) +#define IDirectPlay8LobbyClient_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8LobbyClient_GetConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetConnectionSettings(p,a,b,c,d) +#define IDirectPlay8LobbyClient_SetConnectionSettings(p,a,b,c) (p)->lpVtbl->SetConnectionSettings(p,a,b,c) + +#define IDirectPlay8LobbiedApplication_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8LobbiedApplication_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8LobbiedApplication_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8LobbiedApplication_Initialize(p,a,b,c,d) (p)->lpVtbl->Initialize(p,a,b,c,d) +#define IDirectPlay8LobbiedApplication_RegisterProgram(p,a,b) (p)->lpVtbl->RegisterProgram(p,a,b) +#define IDirectPlay8LobbiedApplication_UnRegisterProgram(p,a,b) (p)->lpVtbl->UnRegisterProgram(p,a,b) +#define IDirectPlay8LobbiedApplication_Send(p,a,b,c,d) (p)->lpVtbl->Send(p,a,b,c,d) +#define IDirectPlay8LobbiedApplication_SetAppAvailable(p,a,b) (p)->lpVtbl->SetAppAvailable(p,a,b) +#define IDirectPlay8LobbiedApplication_UpdateStatus(p,a,b,c) (p)->lpVtbl->UpdateStatus(p,a,b,c) +#define IDirectPlay8LobbiedApplication_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8LobbiedApplication_GetConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetConnectionSettings(p,a,b,c,d) +#define IDirectPlay8LobbiedApplication_SetConnectionSettings(p,a,b,c) (p)->lpVtbl->SetConnectionSettings(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay8LobbyClient_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8LobbyClient_AddRef(p) (p)->AddRef() +#define IDirectPlay8LobbyClient_Release(p) (p)->Release() +#define IDirectPlay8LobbyClient_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8LobbyClient_EnumLocalPrograms(p,a,b,c,d,e) (p)->EnumLocalPrograms(a,b,c,d,e) +#define IDirectPlay8LobbyClient_ConnectApplication(p,a,b,c,d,e) (p)->ConnectApplication(a,b,c,d,e) +#define IDirectPlay8LobbyClient_Send(p,a,b,c,d) (p)->Send(a,b,c,d) +#define IDirectPlay8LobbyClient_ReleaseApplication(p,a,b) (p)->ReleaseApplication(a,b) +#define IDirectPlay8LobbyClient_Close(p,a) (p)->Close(a) +#define IDirectPlay8LobbyClient_GetConnectionSettings(p,a,b,c,d) (p)->GetConnectionSettings(a,b,c,d) +#define IDirectPlay8LobbyClient_SetConnectionSettings(p,a,b,c) (p)->SetConnectionSettings(a,b,c) + +#define IDirectPlay8LobbiedApplication_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8LobbiedApplication_AddRef(p) (p)->AddRef() +#define IDirectPlay8LobbiedApplication_Release(p) (p)->Release() +#define IDirectPlay8LobbiedApplication_Initialize(p,a,b,c,d) (p)->Initialize(a,b,c,d) +#define IDirectPlay8LobbiedApplication_RegisterProgram(p,a,b) (p)->RegisterProgram(a,b) +#define IDirectPlay8LobbiedApplication_UnRegisterProgram(p,a,b) (p)->UnRegisterProgram(a,b) +#define IDirectPlay8LobbiedApplication_Send(p,a,b,c,d) (p)->Send(a,b,c,d) +#define IDirectPlay8LobbiedApplication_SetAppAvailable(p,a,b) (p)->SetAppAvailable(a,b) +#define IDirectPlay8LobbiedApplication_UpdateStatus(p,a,b,c) (p)->UpdateStatus(a,b,c) +#define IDirectPlay8LobbiedApplication_Close(p,a) (p)->Close(a) +#define IDirectPlay8LobbiedApplication_GetConnectionSettings(p,a,b,c,d) (p)->GetConnectionSettings(a,b,c,d) +#define IDirectPlay8LobbiedApplication_SetConnectionSettings(p,a,b,c) (p)->SetConnectionSettings(a,b,c) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __DPLOBBY_H__ + diff --git a/saco/d3d9/include/dpnathlp.h b/saco/d3d9/include/dpnathlp.h new file mode 100644 index 0000000..720e43a --- /dev/null +++ b/saco/d3d9/include/dpnathlp.h @@ -0,0 +1,318 @@ +/*************************************************************************** + * + * Copyright (C) 2001-2002 Microsoft Corporation. All Rights Reserved. + * + * File: dpnathlp.h + * + * Content: Header for using DirectPlayNATHelp interface. + * + * + * NOTE: This interface is deprecated and should no longer be used. + * + * + ***************************************************************************/ + + + +#ifndef __DPNATHLP_H__ +#define __DPNATHLP_H__ + + + +#include // for DECLARE_INTERFACE and HRESULT + + + +#ifndef DPNATHLP_EXPORTS +#define DPNATHLPAPI DECLSPEC_IMPORT +#else +#define DPNATHLPAPI +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper object class IDs + * + ****************************************************************************/ + +// {B9C2E9C4-68C1-4d42-A7A1-E76A26982AD6} +DEFINE_GUID(CLSID_DirectPlayNATHelpUPnP, +0xb9c2e9c4, 0x68c1, 0x4d42, 0xa7, 0xa1, 0xe7, 0x6a, 0x26, 0x98, 0x2a, 0xd6); + +// {963AB779-16A1-477c-A36D-CB5E711938F7} +DEFINE_GUID(CLSID_DirectPlayNATHelpPAST, +0x963ab779, 0x16a1, 0x477c, 0xa3, 0x6d, 0xcb, 0x5e, 0x71, 0x19, 0x38, 0xf7); + + +/**************************************************************************** + * + * DirectPlay NAT Helper interface ID + * + ****************************************************************************/ + +// {154940B6-2278-4a2f-9101-9BA9F431F603} +DEFINE_GUID(IID_IDirectPlayNATHelp, +0x154940b6, 0x2278, 0x4a2f, 0x91, 0x1, 0x9b, 0xa9, 0xf4, 0x31, 0xf6, 0x3); + +/**************************************************************************** + * + * DirectPlay NAT Helper interface pointer definitions + * + ****************************************************************************/ + +typedef struct IDirectPlayNATHelp *PDIRECTPLAYNATHELP; + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper data types + * + ****************************************************************************/ + +// +// Handles used to identify specific port binding groups. If multiple ports +// are registered at the same time, the DPNHHANDLE refers to all ports. +// +typedef DWORD_PTR DPNHHANDLE, * PDPNHHANDLE; + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper constants + * + ****************************************************************************/ + +#define DPNH_MAX_SIMULTANEOUS_PORTS 16 // up to 16 ports may be specified in a single RegisterPorts call + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper API flags + * + ****************************************************************************/ + +// +// Flags that can be passed to Initialize +// +#define DPNHINITIALIZE_DISABLEGATEWAYSUPPORT 0x01 // disables Internet gateway traversal support (cannot be specified with DPNHINITIALIZE_DISABLELOCALFIREWALLSUPPORT) +#define DPNHINITIALIZE_DISABLELOCALFIREWALLSUPPORT 0x02 // disables local firewall traversal support (cannot be specified with DPNHINITIALIZE_DISABLEGATEWAYSUPPORT) + +// +// Flags that can be passed to GetCaps. +// +#define DPNHGETCAPS_UPDATESERVERSTATUS 0x01 // automatically extend expiring leases and detect changes in server status + +// +// Flags that can be passed to RegisterPorts. +// +#define DPNHREGISTERPORTS_TCP 0x01 // request TCP ports instead of UDP +#define DPNHREGISTERPORTS_FIXEDPORTS 0x02 // asks the server to use the same port numbers on the public interface +#define DPNHREGISTERPORTS_SHAREDPORTS 0x04 // requests that the server allow the UDP fixed ports to be shared with other clients (must be specified with DPNHREGISTERPORTS_FIXEDPORTS and cannot be specified with DPNHREGISTERPORTS_TCP) + +// +// Flags that can be passed to GetRegisteredAddresses. +// +#define DPNHGETREGISTEREDADDRESSES_LOCALFIREWALLREMAPONLY 0x01 // retrieve the public address for the local firewall only, even if mapped on remote Internet gateway + +// +// Flags that can be passed to QueryAddress. +// +#define DPNHQUERYADDRESS_TCP 0x01 // request a TCP port instead of UDP +#define DPNHQUERYADDRESS_CACHEFOUND 0x02 // cache the discovered address if found +#define DPNHQUERYADDRESS_CACHENOTFOUND 0x04 // cache the fact that no address was found, if that is the case +#define DPNHQUERYADDRESS_CHECKFORPRIVATEBUTUNMAPPED 0x08 // determine if the address is behind the same Internet gateway, but not mapped on that Internet gateway + +/**************************************************************************** + * + * DirectPlay NAT Helper structure flags + * + ****************************************************************************/ + +// +// DPNHCAPS flags +// +#define DPNHCAPSFLAG_LOCALFIREWALLPRESENT 0x01 // at least one network connection has a local firewall present +#define DPNHCAPSFLAG_GATEWAYPRESENT 0x02 // at least one network connection has an Internet gateway present +#define DPNHCAPSFLAG_GATEWAYISLOCAL 0x04 // a detected Internet gateway is local (i.e. the public address is another network interface on the same machine) +#define DPNHCAPSFLAG_PUBLICADDRESSAVAILABLE 0x08 // at least one server has a valid public address for registered mappings +#define DPNHCAPSFLAG_NOTALLSUPPORTACTIVENOTIFY 0x10 // at least one available server does not support an active-notification mechanisms and must be polled + + + +/**************************************************************************** + * + * DirectPlay NAT Helper structures + * + ****************************************************************************/ + +typedef struct _DPNHCAPS +{ + DWORD dwSize; // size of this structure, must be filled in prior to calling GetCaps + DWORD dwFlags; // flags indicating capabilities of Internet gateway server(s) + DWORD dwNumRegisteredPorts; // number of ports currently registered, including multiple ports registered at the same time (so this may not be equal to the number of DPNHHANDLEs given out) + DWORD dwMinLeaseTimeRemaining; // approximate time remaining, in milliseconds, for the lease that will expire soonest + DWORD dwRecommendedGetCapsInterval; // recommended time, in milliseconds, after which GetCaps should be called again (with DPNHGETCAPS_UPDATESERVERSTATUS flag) +} DPNHCAPS, * PDPNHCAPS; + + + +/**************************************************************************** + * + * Address type flags (returned by GetRegisteredAddresses) + * + ****************************************************************************/ + +#define DPNHADDRESSTYPE_TCP 0x01 // the mappings are for TCP ports instead of UDP +#define DPNHADDRESSTYPE_FIXEDPORTS 0x02 // the mappings are for ports which are the same on the Internet gateway +#define DPNHADDRESSTYPE_SHAREDPORTS 0x04 // the mappings are for shared UDP fixed ports +#define DPNHADDRESSTYPE_LOCALFIREWALL 0x08 // the addresses are opened on a local firewall +#define DPNHADDRESSTYPE_GATEWAY 0x10 // the addresses are registered with an Internet gateway +#define DPNHADDRESSTYPE_GATEWAYISLOCAL 0x20 // the Internet gateway is local (i.e. the public address is another network interface on the same machine) + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper DLL exported functions + * + ****************************************************************************/ + +typedef HRESULT (WINAPI * PFN_DIRECTPLAYNATHELPCREATE)(const GUID * pIID, void ** ppvInterface); + + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper application interfaces + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlayNATHelp +DECLARE_INTERFACE_(IDirectPlayNATHelp, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDirectPlayNATHelp methods ***/ + STDMETHOD(Initialize) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(GetCaps) (THIS_ DPNHCAPS * const dpnhcaps, const DWORD dwFlags) PURE; + STDMETHOD(RegisterPorts) (THIS_ const SOCKADDR * const aLocalAddresses, const DWORD dwAddressesSize, const DWORD dwNumAddresses, const DWORD dwLeaseTime, DPNHHANDLE * const phRegisteredPorts, const DWORD dwFlags) PURE; + STDMETHOD(GetRegisteredAddresses) (THIS_ const DPNHHANDLE hRegisteredPorts, SOCKADDR * const paPublicAddresses, DWORD * const pdwPublicAddressesSize, DWORD * const pdwAddressTypeFlags, DWORD * const pdwLeaseTimeRemaining, const DWORD dwFlags) PURE; + STDMETHOD(DeregisterPorts) (THIS_ const DPNHHANDLE hRegisteredPorts, const DWORD dwFlags) PURE; + STDMETHOD(QueryAddress) (THIS_ const SOCKADDR * const pSourceAddress, const SOCKADDR * const pQueryAddress, SOCKADDR * const pResponseAddress, const int iAddressesSize, const DWORD dwFlags) PURE; + STDMETHOD(SetAlertEvent) (THIS_ const HANDLE hEvent, const DWORD dwFlags) PURE; + STDMETHOD(SetAlertIOCompletionPort) (THIS_ const HANDLE hIOCompletionPort, const DWORD dwCompletionKey, const DWORD dwNumConcurrentThreads, const DWORD dwFlags) PURE; + STDMETHOD(ExtendRegisteredPortsLease) (THIS_ const DPNHHANDLE hRegisteredPorts, const DWORD dwLeaseTime, const DWORD dwFlags) PURE; +}; + + +/**************************************************************************** + * + * DirectPlay NAT Helper application interface macros + * + ****************************************************************************/ + +#if (! defined(__cplusplus) || defined(CINTERFACE)) + +#define IDirectPlayNATHelp_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayNATHelp_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayNATHelp_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayNATHelp_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlayNATHelp_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlayNATHelp_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlayNATHelp_RegisterPorts(p,a,b,c,d,e,f) (p)->lpVtbl->RegisterPorts(p,a,b,c,d,e,f) +#define IDirectPlayNATHelp_GetRegisteredAddresses(p,a,b,c,d,e,f) (p)->lpVtbl->GetRegisteredAddresses(p,a,b,c,d,e,f) +#define IDirectPlayNATHelp_DeregisterPorts(p,a,b) (p)->lpVtbl->DeregisterPorts(p,a,b) +#define IDirectPlayNATHelp_QueryAddress(p,a,b,c,d,e) (p)->lpVtbl->QueryAddress(p,a,b,c,d,e) +#define IDirectPlayNATHelp_SetAlertEvent(p,a,b) (p)->lpVtbl->SetAlertEvent(p,a,b) +#define IDirectPlayNATHelp_SetAlertIOCompletionPort(p,a,b,c,d) (p)->lpVtbl->SetAlertIOCompletionPort(p,a,b,c,d) +#define IDirectPlayNATHelp_ExtendRegisteredPortsLease(p,a,b,c) (p)->lpVtbl->ExtendRegisteredPortsLease(p,a,b,c) + + +#else // C++ + +#define IDirectPlayNATHelp_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayNATHelp_AddRef(p) (p)->AddRef() +#define IDirectPlayNATHelp_Release(p) (p)->Release() +#define IDirectPlayNATHelp_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlayNATHelp_Close(p,a) (p)->Close(a) +#define IDirectPlayNATHelp_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlayNATHelp_RegisterPorts(p,a,b,c,d,e,f) (p)->RegisterPorts(a,b,c,d,e,f) +#define IDirectPlayNATHelp_GetRegisteredAddresses(p,a,b,c,d,e,f) (p)->GetRegisteredAddresses(a,b,c,d,e,f) +#define IDirectPlayNATHelp_DeregisterPorts(p,a,b) (p)->DeregisterPorts(a,b) +#define IDirectPlayNATHelp_QueryAddress(p,a,b,c,d,e) (p)->QueryAddress(a,b,c,d,e) +#define IDirectPlayNATHelp_SetAlertEvent(p,a,b) (p)->SetAlertEvent(a,b) +#define IDirectPlayNATHelp_SetAlertIOCompletionPort(p,a,b,c,d) (p)->SetAlertIOCompletionPort(a,b,c,d) +#define IDirectPlayNATHelp_ExtendRegisteredPortsLease(p,a,b,c) (p)->ExtendRegisteredPortsLease(a,b,c) + + +#endif + + + +/**************************************************************************** + * + * DirectPlay NAT Helper return codes + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +#define _DPNH_FACILITY_CODE 0x015 +#define _DPNH_HRESULT_BASE 0xF000 + +#define MAKE_DPNHSUCCESS(code) MAKE_HRESULT(0, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE)) +#define MAKE_DPNHFAILURE(code) MAKE_HRESULT(1, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE)) + + + +#define DPNH_OK S_OK + +#define DPNHSUCCESS_ADDRESSESCHANGED MAKE_DPNHSUCCESS(0x10) + +#define DPNHERR_ALREADYINITIALIZED MAKE_DPNHFAILURE(0x10) +#define DPNHERR_BUFFERTOOSMALL MAKE_DPNHFAILURE(0x20) +#define DPNHERR_GENERIC E_FAIL +#define DPNHERR_INVALIDFLAGS MAKE_DPNHFAILURE(0x30) +#define DPNHERR_INVALIDOBJECT MAKE_DPNHFAILURE(0x40) +#define DPNHERR_INVALIDPARAM E_INVALIDARG +#define DPNHERR_INVALIDPOINTER E_POINTER +#define DPNHERR_NOMAPPING MAKE_DPNHFAILURE(0x50) +#define DPNHERR_NOMAPPINGBUTPRIVATE MAKE_DPNHFAILURE(0x60) +#define DPNHERR_NOTINITIALIZED MAKE_DPNHFAILURE(0x70) +#define DPNHERR_OUTOFMEMORY E_OUTOFMEMORY +#define DPNHERR_PORTALREADYREGISTERED MAKE_DPNHFAILURE(0x80) +#define DPNHERR_PORTUNAVAILABLE MAKE_DPNHFAILURE(0x90) +#define DPNHERR_REENTRANT MAKE_DPNHFAILURE(0x95) +#define DPNHERR_SERVERNOTAVAILABLE MAKE_DPNHFAILURE(0xA0) +#define DPNHERR_UPDATESERVERSTATUS MAKE_DPNHFAILURE(0xC0) + +#ifdef __cplusplus +} +#endif + +#endif // __DPNATHLP_H__ + diff --git a/saco/d3d9/include/dsconf.h b/saco/d3d9/include/dsconf.h new file mode 100644 index 0000000..018f65a --- /dev/null +++ b/saco/d3d9/include/dsconf.h @@ -0,0 +1,195 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: dsconf.h + * Content: DirectSound configuration interface include file + * + **************************************************************************/ + +#ifndef __DSCONF_INCLUDED__ +#define __DSCONF_INCLUDED__ + +#ifndef __DSOUND_INCLUDED__ +#error dsound.h not included +#endif // __DSOUND_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + +// DirectSound Private Component GUID {11AB3EC0-25EC-11d1-A4D8-00C04FC28ACA} +DEFINE_GUID(CLSID_DirectSoundPrivate, 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + + +// +// DirectSound Device Properties {84624F82-25EC-11d1-A4D8-00C04FC28ACA} +// + +DEFINE_GUID(DSPROPSETID_DirectSoundDevice, 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +typedef enum +{ + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A = 1, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 = 2, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 = 3, + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W = 4, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A = 5, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W = 6, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A = 7, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W = 8, +} DSPROPERTY_DIRECTSOUNDDEVICE; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef enum +{ + DIRECTSOUNDDEVICE_TYPE_EMULATED, + DIRECTSOUNDDEVICE_TYPE_VXD, + DIRECTSOUNDDEVICE_TYPE_WDM +} DIRECTSOUNDDEVICE_TYPE; + +typedef enum +{ + DIRECTSOUNDDEVICE_DATAFLOW_RENDER, + DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE +} DIRECTSOUNDDEVICE_DATAFLOW; + + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +{ + LPSTR DeviceName; // waveIn/waveOut device name + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Data flow (i.e. waveIn or waveOut) + GUID DeviceId; // DirectSound device id +} DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +{ + LPWSTR DeviceName; // waveIn/waveOut device name + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Data flow (i.e. waveIn or waveOut) + GUID DeviceId; // DirectSound device id +} DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA; + +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +#endif // UNICODE + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +{ + GUID DeviceId; // DirectSound device id + CHAR DescriptionA[0x100]; // Device description (ANSI) + WCHAR DescriptionW[0x100]; // Device description (Unicode) + CHAR ModuleA[MAX_PATH]; // Device driver module (ANSI) + WCHAR ModuleW[MAX_PATH]; // Device driver module (Unicode) + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + ULONG WaveDeviceId; // Wave device id + ULONG Devnode; // Devnode (or DevInst) +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +{ + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + GUID DeviceId; // DirectSound device id + LPSTR Description; // Device description + LPSTR Module; // Device driver module + LPSTR Interface; // Device interface + ULONG WaveDeviceId; // Wave device id +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +{ + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + GUID DeviceId; // DirectSound device id + LPWSTR Description; // Device description + LPWSTR Module; // Device driver module + LPWSTR Interface; // Device interface + ULONG WaveDeviceId; // Wave device id +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA, LPVOID); +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA, LPVOID); +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA, LPVOID); + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW +#else // UNICODE +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1 +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1 Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +#endif // DIRECTSOUND_VERSION >= 0x0700 + + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // __DSCONF_INCLUDED__ + diff --git a/saco/d3d9/include/dsetup.h b/saco/d3d9/include/dsetup.h new file mode 100644 index 0000000..0f4e3b0 --- /dev/null +++ b/saco/d3d9/include/dsetup.h @@ -0,0 +1,287 @@ +/*========================================================================== + * + * Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dsetup.h + * Content: DirectXSetup, error codes and flags + ***************************************************************************/ + +#ifndef __DSETUP_H__ +#define __DSETUP_H__ + +#include // windows stuff + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include +#else +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +#define FOURCC_VERS mmioFOURCC('v','e','r','s') + +// DSETUP Error Codes, must remain compatible with previous setup. +#define DSETUPERR_SUCCESS_RESTART 1 +#define DSETUPERR_SUCCESS 0 +#define DSETUPERR_BADWINDOWSVERSION -1 +#define DSETUPERR_SOURCEFILENOTFOUND -2 +#define DSETUPERR_NOCOPY -5 +#define DSETUPERR_OUTOFDISKSPACE -6 +#define DSETUPERR_CANTFINDINF -7 +#define DSETUPERR_CANTFINDDIR -8 +#define DSETUPERR_INTERNAL -9 +#define DSETUPERR_UNKNOWNOS -11 +#define DSETUPERR_NEWERVERSION -14 +#define DSETUPERR_NOTADMIN -15 +#define DSETUPERR_UNSUPPORTEDPROCESSOR -16 +#define DSETUPERR_MISSINGCAB_MANAGEDDX -17 +#define DSETUPERR_NODOTNETFRAMEWORKINSTALLED -18 +#define DSETUPERR_CABDOWNLOADFAIL -19 + +// DSETUP flags. DirectX 5.0 apps should use these flags only. +#define DSETUP_DDRAWDRV 0x00000008 /* install DirectDraw Drivers */ +#define DSETUP_DSOUNDDRV 0x00000010 /* install DirectSound Drivers */ +#define DSETUP_DXCORE 0x00010000 /* install DirectX runtime */ +#define DSETUP_DIRECTX (DSETUP_DXCORE|DSETUP_DDRAWDRV|DSETUP_DSOUNDDRV) +#define DSETUP_MANAGEDDX 0x00004000 /* install managed DirectX */ +#define DSETUP_TESTINSTALL 0x00020000 /* just test install, don't do anything */ + +// These OBSOLETE flags are here for compatibility with pre-DX5 apps only. +// They are present to allow DX3 apps to be recompiled with DX5 and still work. +// DO NOT USE THEM for DX5. They will go away in future DX releases. +#define DSETUP_DDRAW 0x00000001 /* OBSOLETE. install DirectDraw */ +#define DSETUP_DSOUND 0x00000002 /* OBSOLETE. install DirectSound */ +#define DSETUP_DPLAY 0x00000004 /* OBSOLETE. install DirectPlay */ +#define DSETUP_DPLAYSP 0x00000020 /* OBSOLETE. install DirectPlay Providers */ +#define DSETUP_DVIDEO 0x00000040 /* OBSOLETE. install DirectVideo */ +#define DSETUP_D3D 0x00000200 /* OBSOLETE. install Direct3D */ +#define DSETUP_DINPUT 0x00000800 /* OBSOLETE. install DirectInput */ +#define DSETUP_DIRECTXSETUP 0x00001000 /* OBSOLETE. install DirectXSetup DLL's */ +#define DSETUP_NOUI 0x00002000 /* OBSOLETE. install DirectX with NO UI */ +#define DSETUP_PROMPTFORDRIVERS 0x10000000 /* OBSOLETE. prompt when replacing display/audio drivers */ +#define DSETUP_RESTOREDRIVERS 0x20000000 /* OBSOLETE. restore display/audio drivers */ + + + +//****************************************************************** +// DirectX Setup Callback mechanism +//****************************************************************** + +// DSETUP Message Info Codes, passed to callback as Reason parameter. +#define DSETUP_CB_MSG_NOMESSAGE 0 +#define DSETUP_CB_MSG_INTERNAL_ERROR 10 +#define DSETUP_CB_MSG_BEGIN_INSTALL 13 +#define DSETUP_CB_MSG_BEGIN_INSTALL_RUNTIME 14 +#define DSETUP_CB_MSG_PROGRESS 18 +#define DSETUP_CB_MSG_WARNING_DISABLED_COMPONENT 19 + + + + + +typedef struct _DSETUP_CB_PROGRESS +{ + DWORD dwPhase; + DWORD dwInPhaseMaximum; + DWORD dwInPhaseProgress; + DWORD dwOverallMaximum; + DWORD dwOverallProgress; +} DSETUP_CB_PROGRESS; + + +enum _DSETUP_CB_PROGRESS_PHASE +{ + DSETUP_INITIALIZING, + DSETUP_EXTRACTING, + DSETUP_COPYING, + DSETUP_FINALIZING +}; + + +#ifdef _WIN32 +// +// Data Structures +// +#ifndef UNICODE_ONLY + +typedef struct _DIRECTXREGISTERAPPA { + DWORD dwSize; + DWORD dwFlags; + LPSTR lpszApplicationName; + LPGUID lpGUID; + LPSTR lpszFilename; + LPSTR lpszCommandLine; + LPSTR lpszPath; + LPSTR lpszCurrentDirectory; +} DIRECTXREGISTERAPPA, *PDIRECTXREGISTERAPPA, *LPDIRECTXREGISTERAPPA; + +typedef struct _DIRECTXREGISTERAPP2A { + DWORD dwSize; + DWORD dwFlags; + LPSTR lpszApplicationName; + LPGUID lpGUID; + LPSTR lpszFilename; + LPSTR lpszCommandLine; + LPSTR lpszPath; + LPSTR lpszCurrentDirectory; + LPSTR lpszLauncherName; +} DIRECTXREGISTERAPP2A, *PDIRECTXREGISTERAPP2A, *LPDIRECTXREGISTERAPP2A; + +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY + +typedef struct _DIRECTXREGISTERAPPW { + DWORD dwSize; + DWORD dwFlags; + LPWSTR lpszApplicationName; + LPGUID lpGUID; + LPWSTR lpszFilename; + LPWSTR lpszCommandLine; + LPWSTR lpszPath; + LPWSTR lpszCurrentDirectory; +} DIRECTXREGISTERAPPW, *PDIRECTXREGISTERAPPW, *LPDIRECTXREGISTERAPPW; + +typedef struct _DIRECTXREGISTERAPP2W { + DWORD dwSize; + DWORD dwFlags; + LPWSTR lpszApplicationName; + LPGUID lpGUID; + LPWSTR lpszFilename; + LPWSTR lpszCommandLine; + LPWSTR lpszPath; + LPWSTR lpszCurrentDirectory; + LPWSTR lpszLauncherName; +} DIRECTXREGISTERAPP2W, *PDIRECTXREGISTERAPP2W, *LPDIRECTXREGISTERAPP2W; +#endif //!ANSI_ONLY +#ifdef UNICODE +typedef DIRECTXREGISTERAPPW DIRECTXREGISTERAPP; +typedef PDIRECTXREGISTERAPPW PDIRECTXREGISTERAPP; +typedef LPDIRECTXREGISTERAPPW LPDIRECTXREGISTERAPP; +typedef DIRECTXREGISTERAPP2W DIRECTXREGISTERAPP2; +typedef PDIRECTXREGISTERAPP2W PDIRECTXREGISTERAPP2; +typedef LPDIRECTXREGISTERAPP2W LPDIRECTXREGISTERAPP2; +#else +typedef DIRECTXREGISTERAPPA DIRECTXREGISTERAPP; +typedef PDIRECTXREGISTERAPPA PDIRECTXREGISTERAPP; +typedef LPDIRECTXREGISTERAPPA LPDIRECTXREGISTERAPP; +typedef DIRECTXREGISTERAPP2A DIRECTXREGISTERAPP2; +typedef PDIRECTXREGISTERAPP2A PDIRECTXREGISTERAPP2; +typedef LPDIRECTXREGISTERAPP2A LPDIRECTXREGISTERAPP2; +#endif // UNICODE + + +// +// API +// + +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXSetupA( + HWND hWnd, + LPSTR lpszRootPath, + DWORD dwFlags + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXSetupW( + HWND hWnd, + LPWSTR lpszRootPath, + DWORD dwFlags + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXSetup DirectXSetupW +#else +#define DirectXSetup DirectXSetupA +#endif // !UNICODE + +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXRegisterApplicationA( + HWND hWnd, + LPVOID lpDXRegApp + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXRegisterApplicationW( + HWND hWnd, + LPVOID lpDXRegApp + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXRegisterApplication DirectXRegisterApplicationW +#else +#define DirectXRegisterApplication DirectXRegisterApplicationA +#endif // !UNICODE + +INT +WINAPI +DirectXUnRegisterApplication( + HWND hWnd, + LPGUID lpGUID + ); + +// +// Function Pointers +// +#ifdef UNICODE +typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPWSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPVOID); +#else +typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPVOID); +#endif // UNICODE + +typedef DWORD (FAR PASCAL * DSETUP_CALLBACK)(DWORD Reason, + DWORD MsgType, /* Same as flags to MessageBox */ + LPSTR szMessage, + LPSTR szName, + void *pInfo); + +INT WINAPI DirectXSetupSetCallback(DSETUP_CALLBACK Callback); +INT WINAPI DirectXSetupGetVersion(DWORD *lpdwVersion, DWORD *lpdwMinorVersion); +INT WINAPI DirectXSetupShowEULA(HWND hWndParent); +#ifndef UNICODE_ONLY +UINT +WINAPI +DirectXSetupGetEULAA( + LPSTR lpszEULA, + UINT cchEULA, + WORD LangID + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +UINT +WINAPI +DirectXSetupGetEULAW( + LPWSTR lpszEULA, + UINT cchEULA, + WORD LangID + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXSetupGetEULA DirectXSetupGetEULAW +typedef UINT (WINAPI * LPDIRECTXSETUPGETEULA)(LPWSTR, UINT, WORD); +#else +#define DirectXSetupGetEULA DirectXSetupGetEULAA +typedef UINT (WINAPI * LPDIRECTXSETUPGETEULA)(LPSTR, UINT, WORD); +#endif // !UNICODE + +#endif // WIN32 + + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/saco/d3d9/include/dsound.h b/saco/d3d9/include/dsound.h new file mode 100644 index 0000000..8020a66 --- /dev/null +++ b/saco/d3d9/include/dsound.h @@ -0,0 +1,2358 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: dsound.h + * Content: DirectSound include file + * + **************************************************************************/ + +#define COM_NO_WINDOWS_H +#include +#include + +#ifndef DIRECTSOUND_VERSION +#define DIRECTSOUND_VERSION 0x0900 /* Version 9.0 */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#ifndef __DSOUND_INCLUDED__ +#define __DSOUND_INCLUDED__ + +/* Type definitions shared with Direct3D */ + +#ifndef DX_SHARED_DEFINES + +typedef float D3DVALUE, *LPD3DVALUE; + +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +#ifndef LPD3DCOLOR_DEFINED +typedef DWORD *LPD3DCOLOR; +#define LPD3DCOLOR_DEFINED +#endif + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef LPD3DVECTOR_DEFINED +typedef D3DVECTOR *LPD3DVECTOR; +#define LPD3DVECTOR_DEFINED +#endif + +#define DX_SHARED_DEFINES +#endif // DX_SHARED_DEFINES + +#define _FACDS 0x878 /* DirectSound's facility code */ +#define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code) + +// DirectSound Component GUID {47D4D946-62E8-11CF-93BC-444553540000} +DEFINE_GUID(CLSID_DirectSound, 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +// DirectSound 8.0 Component GUID {3901CC3F-84B5-4FA4-BA35-AA8172B8A09B} +DEFINE_GUID(CLSID_DirectSound8, 0x3901cc3f, 0x84b5, 0x4fa4, 0xba, 0x35, 0xaa, 0x81, 0x72, 0xb8, 0xa0, 0x9b); + +// DirectSound Capture Component GUID {B0210780-89CD-11D0-AF08-00A0C925CD16} +DEFINE_GUID(CLSID_DirectSoundCapture, 0xb0210780, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +// DirectSound 8.0 Capture Component GUID {E4BCAC13-7F99-4908-9A8E-74E3BF24B6E1} +DEFINE_GUID(CLSID_DirectSoundCapture8, 0xe4bcac13, 0x7f99, 0x4908, 0x9a, 0x8e, 0x74, 0xe3, 0xbf, 0x24, 0xb6, 0xe1); + +// DirectSound Full Duplex Component GUID {FEA4300C-7959-4147-B26A-2377B9E7A91D} +DEFINE_GUID(CLSID_DirectSoundFullDuplex, 0xfea4300c, 0x7959, 0x4147, 0xb2, 0x6a, 0x23, 0x77, 0xb9, 0xe7, 0xa9, 0x1d); + + +// DirectSound default playback device GUID {DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultPlayback, 0xdef00000, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default capture device GUID {DEF00001-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultCapture, 0xdef00001, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default device for voice playback {DEF00002-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultVoicePlayback, 0xdef00002, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default device for voice capture {DEF00003-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultVoiceCapture, 0xdef00003, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + + +// +// Forward declarations for interfaces. +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +// + +#ifdef __cplusplus +struct IDirectSound; +struct IDirectSoundBuffer; +struct IDirectSound3DListener; +struct IDirectSound3DBuffer; +struct IDirectSoundCapture; +struct IDirectSoundCaptureBuffer; +struct IDirectSoundNotify; +#endif // __cplusplus + + +// +// DirectSound 8.0 interfaces. +// + +#if DIRECTSOUND_VERSION >= 0x0800 + +#ifdef __cplusplus +struct IDirectSound8; +struct IDirectSoundBuffer8; +struct IDirectSoundCaptureBuffer8; +struct IDirectSoundFXGargle; +struct IDirectSoundFXChorus; +struct IDirectSoundFXFlanger; +struct IDirectSoundFXEcho; +struct IDirectSoundFXDistortion; +struct IDirectSoundFXCompressor; +struct IDirectSoundFXParamEq; +struct IDirectSoundFXWavesReverb; +struct IDirectSoundFXI3DL2Reverb; +struct IDirectSoundCaptureFXAec; +struct IDirectSoundCaptureFXNoiseSuppress; +struct IDirectSoundFullDuplex; +#endif // __cplusplus + +// IDirectSound8, IDirectSoundBuffer8 and IDirectSoundCaptureBuffer8 are the +// only DirectSound 7.0 interfaces with changed functionality in version 8.0. +// The other level 8 interfaces as equivalent to their level 7 counterparts: + +#define IDirectSoundCapture8 IDirectSoundCapture +#define IDirectSound3DListener8 IDirectSound3DListener +#define IDirectSound3DBuffer8 IDirectSound3DBuffer +#define IDirectSoundNotify8 IDirectSoundNotify +#define IDirectSoundFXGargle8 IDirectSoundFXGargle +#define IDirectSoundFXChorus8 IDirectSoundFXChorus +#define IDirectSoundFXFlanger8 IDirectSoundFXFlanger +#define IDirectSoundFXEcho8 IDirectSoundFXEcho +#define IDirectSoundFXDistortion8 IDirectSoundFXDistortion +#define IDirectSoundFXCompressor8 IDirectSoundFXCompressor +#define IDirectSoundFXParamEq8 IDirectSoundFXParamEq +#define IDirectSoundFXWavesReverb8 IDirectSoundFXWavesReverb +#define IDirectSoundFXI3DL2Reverb8 IDirectSoundFXI3DL2Reverb +#define IDirectSoundCaptureFXAec8 IDirectSoundCaptureFXAec +#define IDirectSoundCaptureFXNoiseSuppress8 IDirectSoundCaptureFXNoiseSuppress +#define IDirectSoundFullDuplex8 IDirectSoundFullDuplex + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +typedef struct IDirectSound *LPDIRECTSOUND; +typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER; +typedef struct IDirectSound3DListener *LPDIRECTSOUND3DLISTENER; +typedef struct IDirectSound3DBuffer *LPDIRECTSOUND3DBUFFER; +typedef struct IDirectSoundCapture *LPDIRECTSOUNDCAPTURE; +typedef struct IDirectSoundCaptureBuffer *LPDIRECTSOUNDCAPTUREBUFFER; +typedef struct IDirectSoundNotify *LPDIRECTSOUNDNOTIFY; + + +#if DIRECTSOUND_VERSION >= 0x0800 + +typedef struct IDirectSoundFXGargle *LPDIRECTSOUNDFXGARGLE; +typedef struct IDirectSoundFXChorus *LPDIRECTSOUNDFXCHORUS; +typedef struct IDirectSoundFXFlanger *LPDIRECTSOUNDFXFLANGER; +typedef struct IDirectSoundFXEcho *LPDIRECTSOUNDFXECHO; +typedef struct IDirectSoundFXDistortion *LPDIRECTSOUNDFXDISTORTION; +typedef struct IDirectSoundFXCompressor *LPDIRECTSOUNDFXCOMPRESSOR; +typedef struct IDirectSoundFXParamEq *LPDIRECTSOUNDFXPARAMEQ; +typedef struct IDirectSoundFXWavesReverb *LPDIRECTSOUNDFXWAVESREVERB; +typedef struct IDirectSoundFXI3DL2Reverb *LPDIRECTSOUNDFXI3DL2REVERB; +typedef struct IDirectSoundCaptureFXAec *LPDIRECTSOUNDCAPTUREFXAEC; +typedef struct IDirectSoundCaptureFXNoiseSuppress *LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS; +typedef struct IDirectSoundFullDuplex *LPDIRECTSOUNDFULLDUPLEX; + +typedef struct IDirectSound8 *LPDIRECTSOUND8; +typedef struct IDirectSoundBuffer8 *LPDIRECTSOUNDBUFFER8; +typedef struct IDirectSound3DListener8 *LPDIRECTSOUND3DLISTENER8; +typedef struct IDirectSound3DBuffer8 *LPDIRECTSOUND3DBUFFER8; +typedef struct IDirectSoundCapture8 *LPDIRECTSOUNDCAPTURE8; +typedef struct IDirectSoundCaptureBuffer8 *LPDIRECTSOUNDCAPTUREBUFFER8; +typedef struct IDirectSoundNotify8 *LPDIRECTSOUNDNOTIFY8; +typedef struct IDirectSoundFXGargle8 *LPDIRECTSOUNDFXGARGLE8; +typedef struct IDirectSoundFXChorus8 *LPDIRECTSOUNDFXCHORUS8; +typedef struct IDirectSoundFXFlanger8 *LPDIRECTSOUNDFXFLANGER8; +typedef struct IDirectSoundFXEcho8 *LPDIRECTSOUNDFXECHO8; +typedef struct IDirectSoundFXDistortion8 *LPDIRECTSOUNDFXDISTORTION8; +typedef struct IDirectSoundFXCompressor8 *LPDIRECTSOUNDFXCOMPRESSOR8; +typedef struct IDirectSoundFXParamEq8 *LPDIRECTSOUNDFXPARAMEQ8; +typedef struct IDirectSoundFXWavesReverb8 *LPDIRECTSOUNDFXWAVESREVERB8; +typedef struct IDirectSoundFXI3DL2Reverb8 *LPDIRECTSOUNDFXI3DL2REVERB8; +typedef struct IDirectSoundCaptureFXAec8 *LPDIRECTSOUNDCAPTUREFXAEC8; +typedef struct IDirectSoundCaptureFXNoiseSuppress8 *LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS8; +typedef struct IDirectSoundFullDuplex8 *LPDIRECTSOUNDFULLDUPLEX8; + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IID definitions for the unchanged DirectSound 8.0 interfaces +// + +#if DIRECTSOUND_VERSION >= 0x0800 + +#define IID_IDirectSoundCapture8 IID_IDirectSoundCapture +#define IID_IDirectSound3DListener8 IID_IDirectSound3DListener +#define IID_IDirectSound3DBuffer8 IID_IDirectSound3DBuffer +#define IID_IDirectSoundNotify8 IID_IDirectSoundNotify +#define IID_IDirectSoundFXGargle8 IID_IDirectSoundFXGargle +#define IID_IDirectSoundFXChorus8 IID_IDirectSoundFXChorus +#define IID_IDirectSoundFXFlanger8 IID_IDirectSoundFXFlanger +#define IID_IDirectSoundFXEcho8 IID_IDirectSoundFXEcho +#define IID_IDirectSoundFXDistortion8 IID_IDirectSoundFXDistortion +#define IID_IDirectSoundFXCompressor8 IID_IDirectSoundFXCompressor +#define IID_IDirectSoundFXParamEq8 IID_IDirectSoundFXParamEq +#define IID_IDirectSoundFXWavesReverb8 IID_IDirectSoundFXWavesReverb +#define IID_IDirectSoundFXI3DL2Reverb8 IID_IDirectSoundFXI3DL2Reverb +#define IID_IDirectSoundCaptureFXAec8 IID_IDirectSoundCaptureFXAec +#define IID_IDirectSoundCaptureFXNoiseSuppress8 IID_IDirectSoundCaptureFXNoiseSuppress +#define IID_IDirectSoundFullDuplex8 IID_IDirectSoundFullDuplex + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Compatibility typedefs +// + +#ifndef _LPCWAVEFORMATEX_DEFINED +#define _LPCWAVEFORMATEX_DEFINED +typedef const WAVEFORMATEX *LPCWAVEFORMATEX; +#endif // _LPCWAVEFORMATEX_DEFINED + +#ifndef __LPCGUID_DEFINED__ +#define __LPCGUID_DEFINED__ +typedef const GUID *LPCGUID; +#endif // __LPCGUID_DEFINED__ + +typedef LPDIRECTSOUND *LPLPDIRECTSOUND; +typedef LPDIRECTSOUNDBUFFER *LPLPDIRECTSOUNDBUFFER; +typedef LPDIRECTSOUND3DLISTENER *LPLPDIRECTSOUND3DLISTENER; +typedef LPDIRECTSOUND3DBUFFER *LPLPDIRECTSOUND3DBUFFER; +typedef LPDIRECTSOUNDCAPTURE *LPLPDIRECTSOUNDCAPTURE; +typedef LPDIRECTSOUNDCAPTUREBUFFER *LPLPDIRECTSOUNDCAPTUREBUFFER; +typedef LPDIRECTSOUNDNOTIFY *LPLPDIRECTSOUNDNOTIFY; + +#if DIRECTSOUND_VERSION >= 0x0800 +typedef LPDIRECTSOUND8 *LPLPDIRECTSOUND8; +typedef LPDIRECTSOUNDBUFFER8 *LPLPDIRECTSOUNDBUFFER8; +typedef LPDIRECTSOUNDCAPTURE8 *LPLPDIRECTSOUNDCAPTURE8; +typedef LPDIRECTSOUNDCAPTUREBUFFER8 *LPLPDIRECTSOUNDCAPTUREBUFFER8; +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Structures +// + +typedef struct _DSCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwMinSecondarySampleRate; + DWORD dwMaxSecondarySampleRate; + DWORD dwPrimaryBuffers; + DWORD dwMaxHwMixingAllBuffers; + DWORD dwMaxHwMixingStaticBuffers; + DWORD dwMaxHwMixingStreamingBuffers; + DWORD dwFreeHwMixingAllBuffers; + DWORD dwFreeHwMixingStaticBuffers; + DWORD dwFreeHwMixingStreamingBuffers; + DWORD dwMaxHw3DAllBuffers; + DWORD dwMaxHw3DStaticBuffers; + DWORD dwMaxHw3DStreamingBuffers; + DWORD dwFreeHw3DAllBuffers; + DWORD dwFreeHw3DStaticBuffers; + DWORD dwFreeHw3DStreamingBuffers; + DWORD dwTotalHwMemBytes; + DWORD dwFreeHwMemBytes; + DWORD dwMaxContigFreeHwMemBytes; + DWORD dwUnlockTransferRateHwBuffers; + DWORD dwPlayCpuOverheadSwBuffers; + DWORD dwReserved1; + DWORD dwReserved2; +} DSCAPS, *LPDSCAPS; + +typedef const DSCAPS *LPCDSCAPS; + +typedef struct _DSBCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwUnlockTransferRate; + DWORD dwPlayCpuOverhead; +} DSBCAPS, *LPDSBCAPS; + +typedef const DSBCAPS *LPCDSBCAPS; + +#if DIRECTSOUND_VERSION >= 0x0800 + + typedef struct _DSEFFECTDESC + { + DWORD dwSize; + DWORD dwFlags; + GUID guidDSFXClass; + DWORD_PTR dwReserved1; + DWORD_PTR dwReserved2; + } DSEFFECTDESC, *LPDSEFFECTDESC; + typedef const DSEFFECTDESC *LPCDSEFFECTDESC; + + #define DSFX_LOCHARDWARE 0x00000001 + #define DSFX_LOCSOFTWARE 0x00000002 + + enum + { + DSFXR_PRESENT, // 0 + DSFXR_LOCHARDWARE, // 1 + DSFXR_LOCSOFTWARE, // 2 + DSFXR_UNALLOCATED, // 3 + DSFXR_FAILED, // 4 + DSFXR_UNKNOWN, // 5 + DSFXR_SENDLOOP // 6 + }; + + typedef struct _DSCEFFECTDESC + { + DWORD dwSize; + DWORD dwFlags; + GUID guidDSCFXClass; + GUID guidDSCFXInstance; + DWORD dwReserved1; + DWORD dwReserved2; + } DSCEFFECTDESC, *LPDSCEFFECTDESC; + typedef const DSCEFFECTDESC *LPCDSCEFFECTDESC; + + #define DSCFX_LOCHARDWARE 0x00000001 + #define DSCFX_LOCSOFTWARE 0x00000002 + + #define DSCFXR_LOCHARDWARE 0x00000010 + #define DSCFXR_LOCSOFTWARE 0x00000020 + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +typedef struct _DSBUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +#if DIRECTSOUND_VERSION >= 0x0700 + GUID guid3DAlgorithm; +#endif +} DSBUFFERDESC, *LPDSBUFFERDESC; + +typedef const DSBUFFERDESC *LPCDSBUFFERDESC; + +// Older version of this structure: + +typedef struct _DSBUFFERDESC1 +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +} DSBUFFERDESC1, *LPDSBUFFERDESC1; + +typedef const DSBUFFERDESC1 *LPCDSBUFFERDESC1; + +typedef struct _DS3DBUFFER +{ + DWORD dwSize; + D3DVECTOR vPosition; + D3DVECTOR vVelocity; + DWORD dwInsideConeAngle; + DWORD dwOutsideConeAngle; + D3DVECTOR vConeOrientation; + LONG lConeOutsideVolume; + D3DVALUE flMinDistance; + D3DVALUE flMaxDistance; + DWORD dwMode; +} DS3DBUFFER, *LPDS3DBUFFER; + +typedef const DS3DBUFFER *LPCDS3DBUFFER; + +typedef struct _DS3DLISTENER +{ + DWORD dwSize; + D3DVECTOR vPosition; + D3DVECTOR vVelocity; + D3DVECTOR vOrientFront; + D3DVECTOR vOrientTop; + D3DVALUE flDistanceFactor; + D3DVALUE flRolloffFactor; + D3DVALUE flDopplerFactor; +} DS3DLISTENER, *LPDS3DLISTENER; + +typedef const DS3DLISTENER *LPCDS3DLISTENER; + +typedef struct _DSCCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwFormats; + DWORD dwChannels; +} DSCCAPS, *LPDSCCAPS; + +typedef const DSCCAPS *LPCDSCCAPS; + +typedef struct _DSCBUFFERDESC1 +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +} DSCBUFFERDESC1, *LPDSCBUFFERDESC1; + +typedef struct _DSCBUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +#if DIRECTSOUND_VERSION >= 0x0800 + DWORD dwFXCount; + LPDSCEFFECTDESC lpDSCFXDesc; +#endif +} DSCBUFFERDESC, *LPDSCBUFFERDESC; + +typedef const DSCBUFFERDESC *LPCDSCBUFFERDESC; + +typedef struct _DSCBCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; +} DSCBCAPS, *LPDSCBCAPS; + +typedef const DSCBCAPS *LPCDSCBCAPS; + +typedef struct _DSBPOSITIONNOTIFY +{ + DWORD dwOffset; + HANDLE hEventNotify; +} DSBPOSITIONNOTIFY, *LPDSBPOSITIONNOTIFY; + +typedef const DSBPOSITIONNOTIFY *LPCDSBPOSITIONNOTIFY; + +// +// DirectSound API +// + +typedef BOOL (CALLBACK *LPDSENUMCALLBACKA)(LPGUID, LPCSTR, LPCSTR, LPVOID); +typedef BOOL (CALLBACK *LPDSENUMCALLBACKW)(LPGUID, LPCWSTR, LPCWSTR, LPVOID); + +extern HRESULT WINAPI DirectSoundCreate(LPCGUID pcGuidDevice, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA pDSEnumCallback, LPVOID pContext); +extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW pDSEnumCallback, LPVOID pContext); + +extern HRESULT WINAPI DirectSoundCaptureCreate(LPCGUID pcGuidDevice, LPDIRECTSOUNDCAPTURE *ppDSC, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundCaptureEnumerateA(LPDSENUMCALLBACKA pDSEnumCallback, LPVOID pContext); +extern HRESULT WINAPI DirectSoundCaptureEnumerateW(LPDSENUMCALLBACKW pDSEnumCallback, LPVOID pContext); + +#if DIRECTSOUND_VERSION >= 0x0800 +extern HRESULT WINAPI DirectSoundCreate8(LPCGUID pcGuidDevice, LPDIRECTSOUND8 *ppDS8, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundCaptureCreate8(LPCGUID pcGuidDevice, LPDIRECTSOUNDCAPTURE8 *ppDSC8, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundFullDuplexCreate(LPCGUID pcGuidCaptureDevice, LPCGUID pcGuidRenderDevice, + LPCDSCBUFFERDESC pcDSCBufferDesc, LPCDSBUFFERDESC pcDSBufferDesc, HWND hWnd, + DWORD dwLevel, LPDIRECTSOUNDFULLDUPLEX* ppDSFD, LPDIRECTSOUNDCAPTUREBUFFER8 *ppDSCBuffer8, + LPDIRECTSOUNDBUFFER8 *ppDSBuffer8, LPUNKNOWN pUnkOuter); +#define DirectSoundFullDuplexCreate8 DirectSoundFullDuplexCreate + +extern HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest); +#endif // DIRECTSOUND_VERSION >= 0x0800 + +#ifdef UNICODE +#define LPDSENUMCALLBACK LPDSENUMCALLBACKW +#define DirectSoundEnumerate DirectSoundEnumerateW +#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateW +#else // UNICODE +#define LPDSENUMCALLBACK LPDSENUMCALLBACKA +#define DirectSoundEnumerate DirectSoundEnumerateA +#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateA +#endif // UNICODE + +// +// IUnknown +// + +#if !defined(__cplusplus) || defined(CINTERFACE) +#ifndef IUnknown_QueryInterface +#define IUnknown_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#endif // IUnknown_QueryInterface +#ifndef IUnknown_AddRef +#define IUnknown_AddRef(p) (p)->lpVtbl->AddRef(p) +#endif // IUnknown_AddRef +#ifndef IUnknown_Release +#define IUnknown_Release(p) (p)->lpVtbl->Release(p) +#endif // IUnknown_Release +#else // !defined(__cplusplus) || defined(CINTERFACE) +#ifndef IUnknown_QueryInterface +#define IUnknown_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#endif // IUnknown_QueryInterface +#ifndef IUnknown_AddRef +#define IUnknown_AddRef(p) (p)->AddRef() +#endif // IUnknown_AddRef +#ifndef IUnknown_Release +#define IUnknown_Release(p) (p)->Release() +#endif // IUnknown_Release +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#ifndef __IReferenceClock_INTERFACE_DEFINED__ +#define __IReferenceClock_INTERFACE_DEFINED__ + +typedef LONGLONG REFERENCE_TIME; +typedef REFERENCE_TIME *LPREFERENCE_TIME; + +DEFINE_GUID(IID_IReferenceClock, 0x56a86897, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); + +#undef INTERFACE +#define INTERFACE IReferenceClock + +DECLARE_INTERFACE_(IReferenceClock, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IReferenceClock methods + STDMETHOD(GetTime) (THIS_ REFERENCE_TIME *pTime) PURE; + STDMETHOD(AdviseTime) (THIS_ REFERENCE_TIME rtBaseTime, REFERENCE_TIME rtStreamTime, + HANDLE hEvent, LPDWORD pdwAdviseCookie) PURE; + STDMETHOD(AdvisePeriodic) (THIS_ REFERENCE_TIME rtStartTime, REFERENCE_TIME rtPeriodTime, + HANDLE hSemaphore, LPDWORD pdwAdviseCookie) PURE; + STDMETHOD(Unadvise) (THIS_ DWORD dwAdviseCookie) PURE; +}; + +#endif // __IReferenceClock_INTERFACE_DEFINED__ + +#ifndef IReferenceClock_QueryInterface + +#define IReferenceClock_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IReferenceClock_AddRef(p) IUnknown_AddRef(p) +#define IReferenceClock_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IReferenceClock_GetTime(p,a) (p)->lpVtbl->GetTime(p,a) +#define IReferenceClock_AdviseTime(p,a,b,c,d) (p)->lpVtbl->AdviseTime(p,a,b,c,d) +#define IReferenceClock_AdvisePeriodic(p,a,b,c,d) (p)->lpVtbl->AdvisePeriodic(p,a,b,c,d) +#define IReferenceClock_Unadvise(p,a) (p)->lpVtbl->Unadvise(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IReferenceClock_GetTime(p,a) (p)->GetTime(a) +#define IReferenceClock_AdviseTime(p,a,b,c,d) (p)->AdviseTime(a,b,c,d) +#define IReferenceClock_AdvisePeriodic(p,a,b,c,d) (p)->AdvisePeriodic(a,b,c,d) +#define IReferenceClock_Unadvise(p,a) (p)->Unadvise(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // IReferenceClock_QueryInterface + +// +// IDirectSound +// + +DEFINE_GUID(IID_IDirectSound, 0x279AFA83, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound + +DECLARE_INTERFACE_(IDirectSound, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound methods + STDMETHOD(CreateSoundBuffer) (THIS_ LPCDSBUFFERDESC pcDSBufferDesc, LPDIRECTSOUNDBUFFER *ppDSBuffer, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ LPDSCAPS pDSCaps) PURE; + STDMETHOD(DuplicateSoundBuffer) (THIS_ LPDIRECTSOUNDBUFFER pDSBufferOriginal, LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate) PURE; + STDMETHOD(SetCooperativeLevel) (THIS_ HWND hwnd, DWORD dwLevel) PURE; + STDMETHOD(Compact) (THIS) PURE; + STDMETHOD(GetSpeakerConfig) (THIS_ LPDWORD pdwSpeakerConfig) PURE; + STDMETHOD(SetSpeakerConfig) (THIS_ DWORD dwSpeakerConfig) PURE; + STDMETHOD(Initialize) (THIS_ LPCGUID pcGuidDevice) PURE; +}; + +#define IDirectSound_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b) +#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->CreateSoundBuffer(a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectSound_Compact(p) (p)->Compact() +#define IDirectSound_GetSpeakerConfig(p,a) (p)->GetSpeakerConfig(a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->SetSpeakerConfig(b) +#define IDirectSound_Initialize(p,a) (p)->Initialize(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSound8 +// + +DEFINE_GUID(IID_IDirectSound8, 0xC50A7E93, 0xF395, 0x4834, 0x9E, 0xF6, 0x7F, 0xA9, 0x9D, 0xE5, 0x09, 0x66); + +#undef INTERFACE +#define INTERFACE IDirectSound8 + +DECLARE_INTERFACE_(IDirectSound8, IDirectSound) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound methods + STDMETHOD(CreateSoundBuffer) (THIS_ LPCDSBUFFERDESC pcDSBufferDesc, LPDIRECTSOUNDBUFFER *ppDSBuffer, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ LPDSCAPS pDSCaps) PURE; + STDMETHOD(DuplicateSoundBuffer) (THIS_ LPDIRECTSOUNDBUFFER pDSBufferOriginal, LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate) PURE; + STDMETHOD(SetCooperativeLevel) (THIS_ HWND hwnd, DWORD dwLevel) PURE; + STDMETHOD(Compact) (THIS) PURE; + STDMETHOD(GetSpeakerConfig) (THIS_ LPDWORD pdwSpeakerConfig) PURE; + STDMETHOD(SetSpeakerConfig) (THIS_ DWORD dwSpeakerConfig) PURE; + STDMETHOD(Initialize) (THIS_ LPCGUID pcGuidDevice) PURE; + + // IDirectSound8 methods + STDMETHOD(VerifyCertification) (THIS_ LPDWORD pdwCertified) PURE; +}; + +#define IDirectSound8_QueryInterface(p,a,b) IDirectSound_QueryInterface(p,a,b) +#define IDirectSound8_AddRef(p) IDirectSound_AddRef(p) +#define IDirectSound8_Release(p) IDirectSound_Release(p) +#define IDirectSound8_CreateSoundBuffer(p,a,b,c) IDirectSound_CreateSoundBuffer(p,a,b,c) +#define IDirectSound8_GetCaps(p,a) IDirectSound_GetCaps(p,a) +#define IDirectSound8_DuplicateSoundBuffer(p,a,b) IDirectSound_DuplicateSoundBuffer(p,a,b) +#define IDirectSound8_SetCooperativeLevel(p,a,b) IDirectSound_SetCooperativeLevel(p,a,b) +#define IDirectSound8_Compact(p) IDirectSound_Compact(p) +#define IDirectSound8_GetSpeakerConfig(p,a) IDirectSound_GetSpeakerConfig(p,a) +#define IDirectSound8_SetSpeakerConfig(p,a) IDirectSound_SetSpeakerConfig(p,a) +#define IDirectSound8_Initialize(p,a) IDirectSound_Initialize(p,a) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound8_VerifyCertification(p,a) (p)->lpVtbl->VerifyCertification(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound8_VerifyCertification(p,a) (p)->VerifyCertification(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundBuffer +// + +DEFINE_GUID(IID_IDirectSoundBuffer, 0x279AFA85, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSoundBuffer + +DECLARE_INTERFACE_(IDirectSoundBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundBuffer methods + STDMETHOD(GetCaps) (THIS_ LPDSBCAPS pDSBufferCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD pdwCurrentPlayCursor, LPDWORD pdwCurrentWriteCursor) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetVolume) (THIS_ LPLONG plVolume) PURE; + STDMETHOD(GetPan) (THIS_ LPLONG plPan) PURE; + STDMETHOD(GetFrequency) (THIS_ LPDWORD pdwFrequency) PURE; + STDMETHOD(GetStatus) (THIS_ LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ LPDIRECTSOUND pDirectSound, LPCDSBUFFERDESC pcDSBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, + LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Play) (THIS_ DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags) PURE; + STDMETHOD(SetCurrentPosition) (THIS_ DWORD dwNewPosition) PURE; + STDMETHOD(SetFormat) (THIS_ LPCWAVEFORMATEX pcfxFormat) PURE; + STDMETHOD(SetVolume) (THIS_ LONG lVolume) PURE; + STDMETHOD(SetPan) (THIS_ LONG lPan) PURE; + STDMETHOD(SetFrequency) (THIS_ DWORD dwFrequency) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + STDMETHOD(Restore) (THIS) PURE; +}; + +#define IDirectSoundBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a) +#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->GetVolume(a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->GetPan(a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->GetFrequency(a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->GetStatus(a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->Play(a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->SetCurrentPosition(a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->SetFormat(a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->SetVolume(a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->SetPan(a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->SetFrequency(a) +#define IDirectSoundBuffer_Stop(p) (p)->Stop() +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->Restore() +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundBuffer8 +// + +DEFINE_GUID(IID_IDirectSoundBuffer8, 0x6825a449, 0x7524, 0x4d82, 0x92, 0x0f, 0x50, 0xe3, 0x6a, 0xb3, 0xab, 0x1e); + +#undef INTERFACE +#define INTERFACE IDirectSoundBuffer8 + +DECLARE_INTERFACE_(IDirectSoundBuffer8, IDirectSoundBuffer) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundBuffer methods + STDMETHOD(GetCaps) (THIS_ LPDSBCAPS pDSBufferCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD pdwCurrentPlayCursor, LPDWORD pdwCurrentWriteCursor) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetVolume) (THIS_ LPLONG plVolume) PURE; + STDMETHOD(GetPan) (THIS_ LPLONG plPan) PURE; + STDMETHOD(GetFrequency) (THIS_ LPDWORD pdwFrequency) PURE; + STDMETHOD(GetStatus) (THIS_ LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ LPDIRECTSOUND pDirectSound, LPCDSBUFFERDESC pcDSBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, + LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Play) (THIS_ DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags) PURE; + STDMETHOD(SetCurrentPosition) (THIS_ DWORD dwNewPosition) PURE; + STDMETHOD(SetFormat) (THIS_ LPCWAVEFORMATEX pcfxFormat) PURE; + STDMETHOD(SetVolume) (THIS_ LONG lVolume) PURE; + STDMETHOD(SetPan) (THIS_ LONG lPan) PURE; + STDMETHOD(SetFrequency) (THIS_ DWORD dwFrequency) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + STDMETHOD(Restore) (THIS) PURE; + + // IDirectSoundBuffer8 methods + STDMETHOD(SetFX) (THIS_ DWORD dwEffectsCount, LPDSEFFECTDESC pDSFXDesc, LPDWORD pdwResultCodes) PURE; + STDMETHOD(AcquireResources) (THIS_ DWORD dwFlags, DWORD dwEffectsCount, LPDWORD pdwResultCodes) PURE; + STDMETHOD(GetObjectInPath) (THIS_ REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject) PURE; +}; + +// Special GUID meaning "select all objects" for use in GetObjectInPath() +DEFINE_GUID(GUID_All_Objects, 0xaa114de5, 0xc262, 0x4169, 0xa1, 0xc8, 0x23, 0xd6, 0x98, 0xcc, 0x73, 0xb5); + +#define IDirectSoundBuffer8_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundBuffer8_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundBuffer8_Release(p) IUnknown_Release(p) + +#define IDirectSoundBuffer8_GetCaps(p,a) IDirectSoundBuffer_GetCaps(p,a) +#define IDirectSoundBuffer8_GetCurrentPosition(p,a,b) IDirectSoundBuffer_GetCurrentPosition(p,a,b) +#define IDirectSoundBuffer8_GetFormat(p,a,b,c) IDirectSoundBuffer_GetFormat(p,a,b,c) +#define IDirectSoundBuffer8_GetVolume(p,a) IDirectSoundBuffer_GetVolume(p,a) +#define IDirectSoundBuffer8_GetPan(p,a) IDirectSoundBuffer_GetPan(p,a) +#define IDirectSoundBuffer8_GetFrequency(p,a) IDirectSoundBuffer_GetFrequency(p,a) +#define IDirectSoundBuffer8_GetStatus(p,a) IDirectSoundBuffer_GetStatus(p,a) +#define IDirectSoundBuffer8_Initialize(p,a,b) IDirectSoundBuffer_Initialize(p,a,b) +#define IDirectSoundBuffer8_Lock(p,a,b,c,d,e,f,g) IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundBuffer8_Play(p,a,b,c) IDirectSoundBuffer_Play(p,a,b,c) +#define IDirectSoundBuffer8_SetCurrentPosition(p,a) IDirectSoundBuffer_SetCurrentPosition(p,a) +#define IDirectSoundBuffer8_SetFormat(p,a) IDirectSoundBuffer_SetFormat(p,a) +#define IDirectSoundBuffer8_SetVolume(p,a) IDirectSoundBuffer_SetVolume(p,a) +#define IDirectSoundBuffer8_SetPan(p,a) IDirectSoundBuffer_SetPan(p,a) +#define IDirectSoundBuffer8_SetFrequency(p,a) IDirectSoundBuffer_SetFrequency(p,a) +#define IDirectSoundBuffer8_Stop(p) IDirectSoundBuffer_Stop(p) +#define IDirectSoundBuffer8_Unlock(p,a,b,c,d) IDirectSoundBuffer_Unlock(p,a,b,c,d) +#define IDirectSoundBuffer8_Restore(p) IDirectSoundBuffer_Restore(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer8_SetFX(p,a,b,c) (p)->lpVtbl->SetFX(p,a,b,c) +#define IDirectSoundBuffer8_AcquireResources(p,a,b,c) (p)->lpVtbl->AcquireResources(p,a,b,c) +#define IDirectSoundBuffer8_GetObjectInPath(p,a,b,c,d) (p)->lpVtbl->GetObjectInPath(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer8_SetFX(p,a,b,c) (p)->SetFX(a,b,c) +#define IDirectSoundBuffer8_AcquireResources(p,a,b,c) (p)->AcquireResources(a,b,c) +#define IDirectSoundBuffer8_GetObjectInPath(p,a,b,c,d) (p)->GetObjectInPath(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSound3DListener +// + +DEFINE_GUID(IID_IDirectSound3DListener, 0x279AFA84, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound3DListener + +DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound3DListener methods + STDMETHOD(GetAllParameters) (THIS_ LPDS3DLISTENER pListener) PURE; + STDMETHOD(GetDistanceFactor) (THIS_ D3DVALUE* pflDistanceFactor) PURE; + STDMETHOD(GetDopplerFactor) (THIS_ D3DVALUE* pflDopplerFactor) PURE; + STDMETHOD(GetOrientation) (THIS_ D3DVECTOR* pvOrientFront, D3DVECTOR* pvOrientTop) PURE; + STDMETHOD(GetPosition) (THIS_ D3DVECTOR* pvPosition) PURE; + STDMETHOD(GetRolloffFactor) (THIS_ D3DVALUE* pflRolloffFactor) PURE; + STDMETHOD(GetVelocity) (THIS_ D3DVECTOR* pvVelocity) PURE; + STDMETHOD(SetAllParameters) (THIS_ LPCDS3DLISTENER pcListener, DWORD dwApply) PURE; + STDMETHOD(SetDistanceFactor) (THIS_ D3DVALUE flDistanceFactor, DWORD dwApply) PURE; + STDMETHOD(SetDopplerFactor) (THIS_ D3DVALUE flDopplerFactor, DWORD dwApply) PURE; + STDMETHOD(SetOrientation) (THIS_ D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront, + D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop, DWORD dwApply) PURE; + STDMETHOD(SetPosition) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetRolloffFactor) (THIS_ D3DVALUE flRolloffFactor, DWORD dwApply) PURE; + STDMETHOD(SetVelocity) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(CommitDeferredSettings) (THIS) PURE; +}; + +#define IDirectSound3DListener_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound3DListener_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound3DListener_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DListener_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->lpVtbl->GetDistanceFactor(p,a) +#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->lpVtbl->GetDopplerFactor(p,a) +#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->lpVtbl->GetOrientation(p,a,b) +#define IDirectSound3DListener_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a) +#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->lpVtbl->GetRolloffFactor(p,a) +#define IDirectSound3DListener_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a) +#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b) +#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->lpVtbl->SetDistanceFactor(p,a,b) +#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->lpVtbl->SetDopplerFactor(p,a,b) +#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g) +#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->lpVtbl->SetRolloffFactor(p,a,b) +#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d) +#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->lpVtbl->CommitDeferredSettings(p) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DListener_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->GetDistanceFactor(a) +#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->GetDopplerFactor(a) +#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->GetOrientation(a,b) +#define IDirectSound3DListener_GetPosition(p,a) (p)->GetPosition(a) +#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->GetRolloffFactor(a) +#define IDirectSound3DListener_GetVelocity(p,a) (p)->GetVelocity(a) +#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b) +#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->SetDistanceFactor(a,b) +#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->SetDopplerFactor(a,b) +#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g) +#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->SetRolloffFactor(a,b) +#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d) +#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->CommitDeferredSettings() +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSound3DBuffer +// + +DEFINE_GUID(IID_IDirectSound3DBuffer, 0x279AFA86, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound3DBuffer + +DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound3DBuffer methods + STDMETHOD(GetAllParameters) (THIS_ LPDS3DBUFFER pDs3dBuffer) PURE; + STDMETHOD(GetConeAngles) (THIS_ LPDWORD pdwInsideConeAngle, LPDWORD pdwOutsideConeAngle) PURE; + STDMETHOD(GetConeOrientation) (THIS_ D3DVECTOR* pvOrientation) PURE; + STDMETHOD(GetConeOutsideVolume) (THIS_ LPLONG plConeOutsideVolume) PURE; + STDMETHOD(GetMaxDistance) (THIS_ D3DVALUE* pflMaxDistance) PURE; + STDMETHOD(GetMinDistance) (THIS_ D3DVALUE* pflMinDistance) PURE; + STDMETHOD(GetMode) (THIS_ LPDWORD pdwMode) PURE; + STDMETHOD(GetPosition) (THIS_ D3DVECTOR* pvPosition) PURE; + STDMETHOD(GetVelocity) (THIS_ D3DVECTOR* pvVelocity) PURE; + STDMETHOD(SetAllParameters) (THIS_ LPCDS3DBUFFER pcDs3dBuffer, DWORD dwApply) PURE; + STDMETHOD(SetConeAngles) (THIS_ DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle, DWORD dwApply) PURE; + STDMETHOD(SetConeOrientation) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetConeOutsideVolume) (THIS_ LONG lConeOutsideVolume, DWORD dwApply) PURE; + STDMETHOD(SetMaxDistance) (THIS_ D3DVALUE flMaxDistance, DWORD dwApply) PURE; + STDMETHOD(SetMinDistance) (THIS_ D3DVALUE flMinDistance, DWORD dwApply) PURE; + STDMETHOD(SetMode) (THIS_ DWORD dwMode, DWORD dwApply) PURE; + STDMETHOD(SetPosition) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetVelocity) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; +}; + +#define IDirectSound3DBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound3DBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound3DBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->lpVtbl->GetConeAngles(p,a,b) +#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->lpVtbl->GetConeOrientation(p,a) +#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->lpVtbl->GetConeOutsideVolume(p,a) +#define IDirectSound3DBuffer_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a) +#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->lpVtbl->GetMinDistance(p,a) +#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->lpVtbl->GetMaxDistance(p,a) +#define IDirectSound3DBuffer_GetMode(p,a) (p)->lpVtbl->GetMode(p,a) +#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a) +#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b) +#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->lpVtbl->SetConeAngles(p,a,b,c) +#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d) +#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b) (p)->lpVtbl->SetConeOutsideVolume(p,a,b) +#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->lpVtbl->SetMinDistance(p,a,b) +#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->lpVtbl->SetMaxDistance(p,a,b) +#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->lpVtbl->SetMode(p,a,b) +#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->GetConeAngles(a,b) +#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->GetConeOrientation(a) +#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->GetConeOutsideVolume(a) +#define IDirectSound3DBuffer_GetPosition(p,a) (p)->GetPosition(a) +#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->GetMinDistance(a) +#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->GetMaxDistance(a) +#define IDirectSound3DBuffer_GetMode(p,a) (p)->GetMode(a) +#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->GetVelocity(a) +#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b) +#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->SetConeAngles(a,b,c) +#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d) +#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b) (p)->SetConeOutsideVolume(a,b) +#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->SetMinDistance(a,b) +#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->SetMaxDistance(a,b) +#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->SetMode(a,b) +#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCapture +// + +DEFINE_GUID(IID_IDirectSoundCapture, 0xb0210781, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundCapture + +DECLARE_INTERFACE_(IDirectSoundCapture, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCapture methods + STDMETHOD(CreateCaptureBuffer) (THIS_ LPCDSCBUFFERDESC pcDSCBufferDesc, LPDIRECTSOUNDCAPTUREBUFFER *ppDSCBuffer, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ LPDSCCAPS pDSCCaps) PURE; + STDMETHOD(Initialize) (THIS_ LPCGUID pcGuidDevice) PURE; +}; + +#define IDirectSoundCapture_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCapture_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCapture_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->lpVtbl->CreateCaptureBuffer(p,a,b,c) +#define IDirectSoundCapture_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundCapture_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->CreateCaptureBuffer(a,b,c) +#define IDirectSoundCapture_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundCapture_Initialize(p,a) (p)->Initialize(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCaptureBuffer +// + +DEFINE_GUID(IID_IDirectSoundCaptureBuffer, 0xb0210782, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureBuffer + +DECLARE_INTERFACE_(IDirectSoundCaptureBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureBuffer methods + STDMETHOD(GetCaps) (THIS_ LPDSCBCAPS pDSCBCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD pdwCapturePosition, LPDWORD pdwReadPosition) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetStatus) (THIS_ LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ LPDIRECTSOUNDCAPTURE pDirectSoundCapture, LPCDSCBUFFERDESC pcDSCBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, + LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Start) (THIS_ DWORD dwFlags) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; +}; + +#define IDirectSoundCaptureBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) +#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) +#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) +#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer_Start(p,a) (p)->lpVtbl->Start(p,a) +#define IDirectSoundCaptureBuffer_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b) +#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c) +#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->GetStatus(a) +#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer_Start(p,a) (p)->Start(a) +#define IDirectSoundCaptureBuffer_Stop(p) (p)->Stop() +#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundCaptureBuffer8 +// + +DEFINE_GUID(IID_IDirectSoundCaptureBuffer8, 0x990df4, 0xdbb, 0x4872, 0x83, 0x3e, 0x6d, 0x30, 0x3e, 0x80, 0xae, 0xb6); + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureBuffer8 + +DECLARE_INTERFACE_(IDirectSoundCaptureBuffer8, IDirectSoundCaptureBuffer) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureBuffer methods + STDMETHOD(GetCaps) (THIS_ LPDSCBCAPS pDSCBCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD pdwCapturePosition, LPDWORD pdwReadPosition) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetStatus) (THIS_ LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ LPDIRECTSOUNDCAPTURE pDirectSoundCapture, LPCDSCBUFFERDESC pcDSCBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, + LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Start) (THIS_ DWORD dwFlags) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + + // IDirectSoundCaptureBuffer8 methods + STDMETHOD(GetObjectInPath) (THIS_ REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject) PURE; + STDMETHOD(GetFXStatus) (DWORD dwFXCount, LPDWORD pdwFXStatus) PURE; +}; + +#define IDirectSoundCaptureBuffer8_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureBuffer8_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureBuffer8_Release(p) IUnknown_Release(p) + +#define IDirectSoundCaptureBuffer8_GetCaps(p,a) IDirectSoundCaptureBuffer_GetCaps(p,a) +#define IDirectSoundCaptureBuffer8_GetCurrentPosition(p,a,b) IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) +#define IDirectSoundCaptureBuffer8_GetFormat(p,a,b,c) IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) +#define IDirectSoundCaptureBuffer8_GetStatus(p,a) IDirectSoundCaptureBuffer_GetStatus(p,a) +#define IDirectSoundCaptureBuffer8_Initialize(p,a,b) IDirectSoundCaptureBuffer_Initialize(p,a,b) +#define IDirectSoundCaptureBuffer8_Lock(p,a,b,c,d,e,f,g) IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer8_Start(p,a) IDirectSoundCaptureBuffer_Start(p,a) +#define IDirectSoundCaptureBuffer8_Stop(p) IDirectSoundCaptureBuffer_Stop(p)) +#define IDirectSoundCaptureBuffer8_Unlock(p,a,b,c,d) IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer8_GetObjectInPath(p,a,b,c,d) (p)->lpVtbl->GetObjectInPath(p,a,b,c,d) +#define IDirectSoundCaptureBuffer8_GetFXStatus(p,a,b) (p)->lpVtbl->GetFXStatus(p,a,b) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer8_GetObjectInPath(p,a,b,c,d) (p)->GetObjectInPath(a,b,c,d) +#define IDirectSoundCaptureBuffer8_GetFXStatus(p,a,b) (p)->GetFXStatus(a,b) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundNotify +// + +DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundNotify + +DECLARE_INTERFACE_(IDirectSoundNotify, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundNotify methods + STDMETHOD(SetNotificationPositions) (THIS_ DWORD dwPositionNotifies, LPCDSBPOSITIONNOTIFY pcPositionNotifies) PURE; +}; + +#define IDirectSoundNotify_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundNotify_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundNotify_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->lpVtbl->SetNotificationPositions(p,a,b) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->SetNotificationPositions(a,b) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IKsPropertySet +// + +#ifndef _IKsPropertySet_ +#define _IKsPropertySet_ + +#ifdef __cplusplus +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +struct IKsPropertySet; +#endif // __cplusplus + +typedef struct IKsPropertySet *LPKSPROPERTYSET; + +#define KSPROPERTY_SUPPORT_GET 0x00000001 +#define KSPROPERTY_SUPPORT_SET 0x00000002 + +DEFINE_GUID(IID_IKsPropertySet, 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93); + +#undef INTERFACE +#define INTERFACE IKsPropertySet + +DECLARE_INTERFACE_(IKsPropertySet, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IKsPropertySet methods + STDMETHOD(Get) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength, + LPVOID pPropertyData, ULONG ulDataLength, PULONG pulBytesReturned) PURE; + STDMETHOD(Set) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength, + LPVOID pPropertyData, ULONG ulDataLength) PURE; + STDMETHOD(QuerySupport) (THIS_ REFGUID rguidPropSet, ULONG ulId, PULONG pulTypeSupport) PURE; +}; + +#define IKsPropertySet_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IKsPropertySet_AddRef(p) IUnknown_AddRef(p) +#define IKsPropertySet_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->lpVtbl->Get(p,a,b,c,d,e,f,g) +#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->lpVtbl->Set(p,a,b,c,d,e,f) +#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->lpVtbl->QuerySupport(p,a,b,c) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->Get(a,b,c,d,e,f,g) +#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->Set(a,b,c,d,e,f) +#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->QuerySupport(a,b,c) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // _IKsPropertySet_ + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundFXGargle +// + +DEFINE_GUID(IID_IDirectSoundFXGargle, 0xd616f352, 0xd622, 0x11ce, 0xaa, 0xc5, 0x00, 0x20, 0xaf, 0x0b, 0x99, 0xa3); + +typedef struct _DSFXGargle +{ + DWORD dwRateHz; // Rate of modulation in hz + DWORD dwWaveShape; // DSFXGARGLE_WAVE_xxx +} DSFXGargle, *LPDSFXGargle; + +#define DSFXGARGLE_WAVE_TRIANGLE 0 +#define DSFXGARGLE_WAVE_SQUARE 1 + +typedef const DSFXGargle *LPCDSFXGargle; + +#define DSFXGARGLE_RATEHZ_MIN 1 +#define DSFXGARGLE_RATEHZ_MAX 1000 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXGargle + +DECLARE_INTERFACE_(IDirectSoundFXGargle, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXGargle methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXGargle pcDsFxGargle) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXGargle pDsFxGargle) PURE; +}; + +#define IDirectSoundFXGargle_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXGargle_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXGargle_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXGargle_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXGargle_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXGargle_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXGargle_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXChorus +// + +DEFINE_GUID(IID_IDirectSoundFXChorus, 0x880842e3, 0x145f, 0x43e6, 0xa9, 0x34, 0xa7, 0x18, 0x06, 0xe5, 0x05, 0x47); + +typedef struct _DSFXChorus +{ + FLOAT fWetDryMix; + FLOAT fDepth; + FLOAT fFeedback; + FLOAT fFrequency; + LONG lWaveform; // LFO shape; DSFXCHORUS_WAVE_xxx + FLOAT fDelay; + LONG lPhase; +} DSFXChorus, *LPDSFXChorus; + +typedef const DSFXChorus *LPCDSFXChorus; + +#define DSFXCHORUS_WAVE_TRIANGLE 0 +#define DSFXCHORUS_WAVE_SIN 1 + +#define DSFXCHORUS_WETDRYMIX_MIN 0.0f +#define DSFXCHORUS_WETDRYMIX_MAX 100.0f +#define DSFXCHORUS_DEPTH_MIN 0.0f +#define DSFXCHORUS_DEPTH_MAX 100.0f +#define DSFXCHORUS_FEEDBACK_MIN -99.0f +#define DSFXCHORUS_FEEDBACK_MAX 99.0f +#define DSFXCHORUS_FREQUENCY_MIN 0.0f +#define DSFXCHORUS_FREQUENCY_MAX 10.0f +#define DSFXCHORUS_DELAY_MIN 0.0f +#define DSFXCHORUS_DELAY_MAX 20.0f +#define DSFXCHORUS_PHASE_MIN 0 +#define DSFXCHORUS_PHASE_MAX 4 + +#define DSFXCHORUS_PHASE_NEG_180 0 +#define DSFXCHORUS_PHASE_NEG_90 1 +#define DSFXCHORUS_PHASE_ZERO 2 +#define DSFXCHORUS_PHASE_90 3 +#define DSFXCHORUS_PHASE_180 4 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXChorus + +DECLARE_INTERFACE_(IDirectSoundFXChorus, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXChorus methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXChorus pcDsFxChorus) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXChorus pDsFxChorus) PURE; +}; + +#define IDirectSoundFXChorus_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXChorus_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXChorus_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXChorus_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXChorus_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXChorus_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXChorus_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXFlanger +// + +DEFINE_GUID(IID_IDirectSoundFXFlanger, 0x903e9878, 0x2c92, 0x4072, 0x9b, 0x2c, 0xea, 0x68, 0xf5, 0x39, 0x67, 0x83); + +typedef struct _DSFXFlanger +{ + FLOAT fWetDryMix; + FLOAT fDepth; + FLOAT fFeedback; + FLOAT fFrequency; + LONG lWaveform; + FLOAT fDelay; + LONG lPhase; +} DSFXFlanger, *LPDSFXFlanger; + +typedef const DSFXFlanger *LPCDSFXFlanger; + +#define DSFXFLANGER_WAVE_TRIANGLE 0 +#define DSFXFLANGER_WAVE_SIN 1 + +#define DSFXFLANGER_WETDRYMIX_MIN 0.0f +#define DSFXFLANGER_WETDRYMIX_MAX 100.0f +#define DSFXFLANGER_FREQUENCY_MIN 0.0f +#define DSFXFLANGER_FREQUENCY_MAX 10.0f +#define DSFXFLANGER_DEPTH_MIN 0.0f +#define DSFXFLANGER_DEPTH_MAX 100.0f +#define DSFXFLANGER_PHASE_MIN 0 +#define DSFXFLANGER_PHASE_MAX 4 +#define DSFXFLANGER_FEEDBACK_MIN -99.0f +#define DSFXFLANGER_FEEDBACK_MAX 99.0f +#define DSFXFLANGER_DELAY_MIN 0.0f +#define DSFXFLANGER_DELAY_MAX 4.0f + +#define DSFXFLANGER_PHASE_NEG_180 0 +#define DSFXFLANGER_PHASE_NEG_90 1 +#define DSFXFLANGER_PHASE_ZERO 2 +#define DSFXFLANGER_PHASE_90 3 +#define DSFXFLANGER_PHASE_180 4 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXFlanger + +DECLARE_INTERFACE_(IDirectSoundFXFlanger, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXFlanger methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXFlanger pcDsFxFlanger) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXFlanger pDsFxFlanger) PURE; +}; + +#define IDirectSoundFXFlanger_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXFlanger_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXFlanger_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXFlanger_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXFlanger_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXFlanger_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXFlanger_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXEcho +// + +DEFINE_GUID(IID_IDirectSoundFXEcho, 0x8bd28edf, 0x50db, 0x4e92, 0xa2, 0xbd, 0x44, 0x54, 0x88, 0xd1, 0xed, 0x42); + +typedef struct _DSFXEcho +{ + FLOAT fWetDryMix; + FLOAT fFeedback; + FLOAT fLeftDelay; + FLOAT fRightDelay; + LONG lPanDelay; +} DSFXEcho, *LPDSFXEcho; + +typedef const DSFXEcho *LPCDSFXEcho; + +#define DSFXECHO_WETDRYMIX_MIN 0.0f +#define DSFXECHO_WETDRYMIX_MAX 100.0f +#define DSFXECHO_FEEDBACK_MIN 0.0f +#define DSFXECHO_FEEDBACK_MAX 100.0f +#define DSFXECHO_LEFTDELAY_MIN 1.0f +#define DSFXECHO_LEFTDELAY_MAX 2000.0f +#define DSFXECHO_RIGHTDELAY_MIN 1.0f +#define DSFXECHO_RIGHTDELAY_MAX 2000.0f +#define DSFXECHO_PANDELAY_MIN 0 +#define DSFXECHO_PANDELAY_MAX 1 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXEcho + +DECLARE_INTERFACE_(IDirectSoundFXEcho, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXEcho methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXEcho pcDsFxEcho) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXEcho pDsFxEcho) PURE; +}; + +#define IDirectSoundFXEcho_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXEcho_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXEcho_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXEcho_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXEcho_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXEcho_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXEcho_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXDistortion +// + +DEFINE_GUID(IID_IDirectSoundFXDistortion, 0x8ecf4326, 0x455f, 0x4d8b, 0xbd, 0xa9, 0x8d, 0x5d, 0x3e, 0x9e, 0x3e, 0x0b); + +typedef struct _DSFXDistortion +{ + FLOAT fGain; + FLOAT fEdge; + FLOAT fPostEQCenterFrequency; + FLOAT fPostEQBandwidth; + FLOAT fPreLowpassCutoff; +} DSFXDistortion, *LPDSFXDistortion; + +typedef const DSFXDistortion *LPCDSFXDistortion; + +#define DSFXDISTORTION_GAIN_MIN -60.0f +#define DSFXDISTORTION_GAIN_MAX 0.0f +#define DSFXDISTORTION_EDGE_MIN 0.0f +#define DSFXDISTORTION_EDGE_MAX 100.0f +#define DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN 100.0f +#define DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX 8000.0f +#define DSFXDISTORTION_POSTEQBANDWIDTH_MIN 100.0f +#define DSFXDISTORTION_POSTEQBANDWIDTH_MAX 8000.0f +#define DSFXDISTORTION_PRELOWPASSCUTOFF_MIN 100.0f +#define DSFXDISTORTION_PRELOWPASSCUTOFF_MAX 8000.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXDistortion + +DECLARE_INTERFACE_(IDirectSoundFXDistortion, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXDistortion methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXDistortion pcDsFxDistortion) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXDistortion pDsFxDistortion) PURE; +}; + +#define IDirectSoundFXDistortion_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXDistortion_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXDistortion_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXDistortion_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXDistortion_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXDistortion_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXDistortion_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXCompressor +// + +DEFINE_GUID(IID_IDirectSoundFXCompressor, 0x4bbd1154, 0x62f6, 0x4e2c, 0xa1, 0x5c, 0xd3, 0xb6, 0xc4, 0x17, 0xf7, 0xa0); + +typedef struct _DSFXCompressor +{ + FLOAT fGain; + FLOAT fAttack; + FLOAT fRelease; + FLOAT fThreshold; + FLOAT fRatio; + FLOAT fPredelay; +} DSFXCompressor, *LPDSFXCompressor; + +typedef const DSFXCompressor *LPCDSFXCompressor; + +#define DSFXCOMPRESSOR_GAIN_MIN -60.0f +#define DSFXCOMPRESSOR_GAIN_MAX 60.0f +#define DSFXCOMPRESSOR_ATTACK_MIN 0.01f +#define DSFXCOMPRESSOR_ATTACK_MAX 500.0f +#define DSFXCOMPRESSOR_RELEASE_MIN 50.0f +#define DSFXCOMPRESSOR_RELEASE_MAX 3000.0f +#define DSFXCOMPRESSOR_THRESHOLD_MIN -60.0f +#define DSFXCOMPRESSOR_THRESHOLD_MAX 0.0f +#define DSFXCOMPRESSOR_RATIO_MIN 1.0f +#define DSFXCOMPRESSOR_RATIO_MAX 100.0f +#define DSFXCOMPRESSOR_PREDELAY_MIN 0.0f +#define DSFXCOMPRESSOR_PREDELAY_MAX 4.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXCompressor + +DECLARE_INTERFACE_(IDirectSoundFXCompressor, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXCompressor methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXCompressor pcDsFxCompressor) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXCompressor pDsFxCompressor) PURE; +}; + +#define IDirectSoundFXCompressor_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXCompressor_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXCompressor_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXCompressor_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXCompressor_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXCompressor_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXCompressor_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXParamEq +// + +DEFINE_GUID(IID_IDirectSoundFXParamEq, 0xc03ca9fe, 0xfe90, 0x4204, 0x80, 0x78, 0x82, 0x33, 0x4c, 0xd1, 0x77, 0xda); + +typedef struct _DSFXParamEq +{ + FLOAT fCenter; + FLOAT fBandwidth; + FLOAT fGain; +} DSFXParamEq, *LPDSFXParamEq; + +typedef const DSFXParamEq *LPCDSFXParamEq; + +#define DSFXPARAMEQ_CENTER_MIN 80.0f +#define DSFXPARAMEQ_CENTER_MAX 16000.0f +#define DSFXPARAMEQ_BANDWIDTH_MIN 1.0f +#define DSFXPARAMEQ_BANDWIDTH_MAX 36.0f +#define DSFXPARAMEQ_GAIN_MIN -15.0f +#define DSFXPARAMEQ_GAIN_MAX 15.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXParamEq + +DECLARE_INTERFACE_(IDirectSoundFXParamEq, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXParamEq methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXParamEq pcDsFxParamEq) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXParamEq pDsFxParamEq) PURE; +}; + +#define IDirectSoundFXParamEq_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXParamEq_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXParamEq_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXParamEq_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXParamEq_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXParamEq_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXParamEq_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXI3DL2Reverb +// + +DEFINE_GUID(IID_IDirectSoundFXI3DL2Reverb, 0x4b166a6a, 0x0d66, 0x43f3, 0x80, 0xe3, 0xee, 0x62, 0x80, 0xde, 0xe1, 0xa4); + +typedef struct _DSFXI3DL2Reverb +{ + LONG lRoom; // [-10000, 0] default: -1000 mB + LONG lRoomHF; // [-10000, 0] default: 0 mB + FLOAT flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 + FLOAT flDecayTime; // [0.1, 20.0] default: 1.49s + FLOAT flDecayHFRatio; // [0.1, 2.0] default: 0.83 + LONG lReflections; // [-10000, 1000] default: -2602 mB + FLOAT flReflectionsDelay; // [0.0, 0.3] default: 0.007 s + LONG lReverb; // [-10000, 2000] default: 200 mB + FLOAT flReverbDelay; // [0.0, 0.1] default: 0.011 s + FLOAT flDiffusion; // [0.0, 100.0] default: 100.0 % + FLOAT flDensity; // [0.0, 100.0] default: 100.0 % + FLOAT flHFReference; // [20.0, 20000.0] default: 5000.0 Hz +} DSFXI3DL2Reverb, *LPDSFXI3DL2Reverb; + +typedef const DSFXI3DL2Reverb *LPCDSFXI3DL2Reverb; + +#define DSFX_I3DL2REVERB_ROOM_MIN (-10000) +#define DSFX_I3DL2REVERB_ROOM_MAX 0 +#define DSFX_I3DL2REVERB_ROOM_DEFAULT (-1000) + +#define DSFX_I3DL2REVERB_ROOMHF_MIN (-10000) +#define DSFX_I3DL2REVERB_ROOMHF_MAX 0 +#define DSFX_I3DL2REVERB_ROOMHF_DEFAULT (-100) + +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN 0.0f +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX 10.0f +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT 0.0f + +#define DSFX_I3DL2REVERB_DECAYTIME_MIN 0.1f +#define DSFX_I3DL2REVERB_DECAYTIME_MAX 20.0f +#define DSFX_I3DL2REVERB_DECAYTIME_DEFAULT 1.49f + +#define DSFX_I3DL2REVERB_DECAYHFRATIO_MIN 0.1f +#define DSFX_I3DL2REVERB_DECAYHFRATIO_MAX 2.0f +#define DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT 0.83f + +#define DSFX_I3DL2REVERB_REFLECTIONS_MIN (-10000) +#define DSFX_I3DL2REVERB_REFLECTIONS_MAX 1000 +#define DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT (-2602) + +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN 0.0f +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX 0.3f +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT 0.007f + +#define DSFX_I3DL2REVERB_REVERB_MIN (-10000) +#define DSFX_I3DL2REVERB_REVERB_MAX 2000 +#define DSFX_I3DL2REVERB_REVERB_DEFAULT (200) + +#define DSFX_I3DL2REVERB_REVERBDELAY_MIN 0.0f +#define DSFX_I3DL2REVERB_REVERBDELAY_MAX 0.1f +#define DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT 0.011f + +#define DSFX_I3DL2REVERB_DIFFUSION_MIN 0.0f +#define DSFX_I3DL2REVERB_DIFFUSION_MAX 100.0f +#define DSFX_I3DL2REVERB_DIFFUSION_DEFAULT 100.0f + +#define DSFX_I3DL2REVERB_DENSITY_MIN 0.0f +#define DSFX_I3DL2REVERB_DENSITY_MAX 100.0f +#define DSFX_I3DL2REVERB_DENSITY_DEFAULT 100.0f + +#define DSFX_I3DL2REVERB_HFREFERENCE_MIN 20.0f +#define DSFX_I3DL2REVERB_HFREFERENCE_MAX 20000.0f +#define DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT 5000.0f + +#define DSFX_I3DL2REVERB_QUALITY_MIN 0 +#define DSFX_I3DL2REVERB_QUALITY_MAX 3 +#define DSFX_I3DL2REVERB_QUALITY_DEFAULT 2 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXI3DL2Reverb + +DECLARE_INTERFACE_(IDirectSoundFXI3DL2Reverb, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXI3DL2Reverb methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXI3DL2Reverb pcDsFxI3DL2Reverb) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXI3DL2Reverb pDsFxI3DL2Reverb) PURE; + STDMETHOD(SetPreset) (THIS_ DWORD dwPreset) PURE; + STDMETHOD(GetPreset) (THIS_ LPDWORD pdwPreset) PURE; + STDMETHOD(SetQuality) (THIS_ LONG lQuality) PURE; + STDMETHOD(GetQuality) (THIS_ LONG *plQuality) PURE; +}; + +#define IDirectSoundFXI3DL2Reverb_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXI3DL2Reverb_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXI3DL2Reverb_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXI3DL2Reverb_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXI3DL2Reverb_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSoundFXI3DL2Reverb_SetPreset(p,a) (p)->lpVtbl->SetPreset(p,a) +#define IDirectSoundFXI3DL2Reverb_GetPreset(p,a) (p)->lpVtbl->GetPreset(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXI3DL2Reverb_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXI3DL2Reverb_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSoundFXI3DL2Reverb_SetPreset(p,a) (p)->SetPreset(a) +#define IDirectSoundFXI3DL2Reverb_GetPreset(p,a) (p)->GetPreset(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXWavesReverb +// + +DEFINE_GUID(IID_IDirectSoundFXWavesReverb,0x46858c3a,0x0dc6,0x45e3,0xb7,0x60,0xd4,0xee,0xf1,0x6c,0xb3,0x25); + +typedef struct _DSFXWavesReverb +{ + FLOAT fInGain; // [-96.0,0.0] default: 0.0 dB + FLOAT fReverbMix; // [-96.0,0.0] default: 0.0 db + FLOAT fReverbTime; // [0.001,3000.0] default: 1000.0 ms + FLOAT fHighFreqRTRatio; // [0.001,0.999] default: 0.001 +} DSFXWavesReverb, *LPDSFXWavesReverb; + +typedef const DSFXWavesReverb *LPCDSFXWavesReverb; + +#define DSFX_WAVESREVERB_INGAIN_MIN -96.0f +#define DSFX_WAVESREVERB_INGAIN_MAX 0.0f +#define DSFX_WAVESREVERB_INGAIN_DEFAULT 0.0f +#define DSFX_WAVESREVERB_REVERBMIX_MIN -96.0f +#define DSFX_WAVESREVERB_REVERBMIX_MAX 0.0f +#define DSFX_WAVESREVERB_REVERBMIX_DEFAULT 0.0f +#define DSFX_WAVESREVERB_REVERBTIME_MIN 0.001f +#define DSFX_WAVESREVERB_REVERBTIME_MAX 3000.0f +#define DSFX_WAVESREVERB_REVERBTIME_DEFAULT 1000.0f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN 0.001f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX 0.999f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT 0.001f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXWavesReverb + +DECLARE_INTERFACE_(IDirectSoundFXWavesReverb, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXWavesReverb methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXWavesReverb pcDsFxWavesReverb) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXWavesReverb pDsFxWavesReverb) PURE; +}; + +#define IDirectSoundFXWavesReverb_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXWavesReverb_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXWavesReverb_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXWavesReverb_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXWavesReverb_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXWavesReverb_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXWavesReverb_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCaptureFXAec +// + +DEFINE_GUID(IID_IDirectSoundCaptureFXAec, 0xad74143d, 0x903d, 0x4ab7, 0x80, 0x66, 0x28, 0xd3, 0x63, 0x03, 0x6d, 0x65); + +typedef struct _DSCFXAec +{ + BOOL fEnable; + BOOL fNoiseFill; + DWORD dwMode; +} DSCFXAec, *LPDSCFXAec; + +typedef const DSCFXAec *LPCDSCFXAec; + +// These match the AEC_MODE_* constants in the DDK's ksmedia.h file +#define DSCFX_AEC_MODE_PASS_THROUGH 0x0 +#define DSCFX_AEC_MODE_HALF_DUPLEX 0x1 +#define DSCFX_AEC_MODE_FULL_DUPLEX 0x2 + +// These match the AEC_STATUS_* constants in ksmedia.h +#define DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED 0x0 +#define DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED 0x1 +#define DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED 0x2 +#define DSCFX_AEC_STATUS_CURRENTLY_CONVERGED 0x8 + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureFXAec + +DECLARE_INTERFACE_(IDirectSoundCaptureFXAec, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureFXAec methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSCFXAec pDscFxAec) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSCFXAec pDscFxAec) PURE; + STDMETHOD(GetStatus) (THIS_ PDWORD pdwStatus) PURE; + STDMETHOD(Reset) (THIS) PURE; +}; + +#define IDirectSoundCaptureFXAec_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureFXAec_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureFXAec_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXAec_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundCaptureFXAec_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXAec_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundCaptureFXAec_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + + +// +// IDirectSoundCaptureFXNoiseSuppress +// + +DEFINE_GUID(IID_IDirectSoundCaptureFXNoiseSuppress, 0xed311e41, 0xfbae, 0x4175, 0x96, 0x25, 0xcd, 0x8, 0x54, 0xf6, 0x93, 0xca); + +typedef struct _DSCFXNoiseSuppress +{ + BOOL fEnable; +} DSCFXNoiseSuppress, *LPDSCFXNoiseSuppress; + +typedef const DSCFXNoiseSuppress *LPCDSCFXNoiseSuppress; + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureFXNoiseSuppress + +DECLARE_INTERFACE_(IDirectSoundCaptureFXNoiseSuppress, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureFXNoiseSuppress methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSCFXNoiseSuppress pcDscFxNoiseSuppress) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSCFXNoiseSuppress pDscFxNoiseSuppress) PURE; + STDMETHOD(Reset) (THIS) PURE; +}; + +#define IDirectSoundCaptureFXNoiseSuppress_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureFXNoiseSuppress_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureFXNoiseSuppress_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXNoiseSuppress_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundCaptureFXNoiseSuppress_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXNoiseSuppress_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundCaptureFXNoiseSuppress_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + + +// +// IDirectSoundFullDuplex +// + +#ifndef _IDirectSoundFullDuplex_ +#define _IDirectSoundFullDuplex_ + +#ifdef __cplusplus +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +struct IDirectSoundFullDuplex; +#endif // __cplusplus + +typedef struct IDirectSoundFullDuplex *LPDIRECTSOUNDFULLDUPLEX; + +DEFINE_GUID(IID_IDirectSoundFullDuplex, 0xedcb4c7a, 0xdaab, 0x4216, 0xa4, 0x2e, 0x6c, 0x50, 0x59, 0x6d, 0xdc, 0x1d); + +#undef INTERFACE +#define INTERFACE IDirectSoundFullDuplex + +DECLARE_INTERFACE_(IDirectSoundFullDuplex, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFullDuplex methods + STDMETHOD(Initialize) (THIS_ LPCGUID pCaptureGuid, LPCGUID pRenderGuid, LPCDSCBUFFERDESC lpDscBufferDesc, LPCDSBUFFERDESC lpDsBufferDesc, HWND hWnd, DWORD dwLevel, LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8, LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8) PURE; +}; + +#define IDirectSoundFullDuplex_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFullDuplex_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFullDuplex_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFullDuplex_Initialize(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->Initialize(p,a,b,c,d,e,f,g,h) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFullDuplex_Initialize(p,a,b,c,d,e,f,g,h) (p)->Initialize(a,b,c,d,e,f,g,h) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // _IDirectSoundFullDuplex_ + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Return Codes +// + +// The function completed successfully +#define DS_OK S_OK + +// The call succeeded, but we had to substitute the 3D algorithm +#define DS_NO_VIRTUALIZATION MAKE_HRESULT(0, _FACDS, 10) + +// The call failed because resources (such as a priority level) +// were already being used by another caller +#define DSERR_ALLOCATED MAKE_DSHRESULT(10) + +// The control (vol, pan, etc.) requested by the caller is not available +#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT(30) + +// An invalid parameter was passed to the returning function +#define DSERR_INVALIDPARAM E_INVALIDARG + +// This call is not valid for the current state of this object +#define DSERR_INVALIDCALL MAKE_DSHRESULT(50) + +// An undetermined error occurred inside the DirectSound subsystem +#define DSERR_GENERIC E_FAIL + +// The caller does not have the priority level required for the function to +// succeed +#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70) + +// Not enough free memory is available to complete the operation +#define DSERR_OUTOFMEMORY E_OUTOFMEMORY + +// The specified WAVE format is not supported +#define DSERR_BADFORMAT MAKE_DSHRESULT(100) + +// The function called is not supported at this time +#define DSERR_UNSUPPORTED E_NOTIMPL + +// No sound driver is available for use +#define DSERR_NODRIVER MAKE_DSHRESULT(120) + +// This object is already initialized +#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT(130) + +// This object does not support aggregation +#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION + +// The buffer memory has been lost, and must be restored +#define DSERR_BUFFERLOST MAKE_DSHRESULT(150) + +// Another app has a higher priority level, preventing this call from +// succeeding +#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT(160) + +// This object has not been initialized +#define DSERR_UNINITIALIZED MAKE_DSHRESULT(170) + +// The requested COM interface is not available +#define DSERR_NOINTERFACE E_NOINTERFACE + +// Access is denied +#define DSERR_ACCESSDENIED E_ACCESSDENIED + +// Tried to create a DSBCAPS_CTRLFX buffer shorter than DSBSIZE_FX_MIN milliseconds +#define DSERR_BUFFERTOOSMALL MAKE_DSHRESULT(180) + +// Attempt to use DirectSound 8 functionality on an older DirectSound object +#define DSERR_DS8_REQUIRED MAKE_DSHRESULT(190) + +// A circular loop of send effects was detected +#define DSERR_SENDLOOP MAKE_DSHRESULT(200) + +// The GUID specified in an audiopath file does not match a valid MIXIN buffer +#define DSERR_BADSENDBUFFERGUID MAKE_DSHRESULT(210) + +// The object requested was not found (numerically equal to DMUS_E_NOT_FOUND) +#define DSERR_OBJECTNOTFOUND MAKE_DSHRESULT(4449) + +// The effects requested could not be found on the system, or they were found +// but in the wrong order, or in the wrong hardware/software locations. +#define DSERR_FXUNAVAILABLE MAKE_DSHRESULT(220) + +// +// Flags +// + +#define DSCAPS_PRIMARYMONO 0x00000001 +#define DSCAPS_PRIMARYSTEREO 0x00000002 +#define DSCAPS_PRIMARY8BIT 0x00000004 +#define DSCAPS_PRIMARY16BIT 0x00000008 +#define DSCAPS_CONTINUOUSRATE 0x00000010 +#define DSCAPS_EMULDRIVER 0x00000020 +#define DSCAPS_CERTIFIED 0x00000040 +#define DSCAPS_SECONDARYMONO 0x00000100 +#define DSCAPS_SECONDARYSTEREO 0x00000200 +#define DSCAPS_SECONDARY8BIT 0x00000400 +#define DSCAPS_SECONDARY16BIT 0x00000800 + +#define DSSCL_NORMAL 0x00000001 +#define DSSCL_PRIORITY 0x00000002 +#define DSSCL_EXCLUSIVE 0x00000003 +#define DSSCL_WRITEPRIMARY 0x00000004 + +#define DSSPEAKER_DIRECTOUT 0x00000000 +#define DSSPEAKER_HEADPHONE 0x00000001 +#define DSSPEAKER_MONO 0x00000002 +#define DSSPEAKER_QUAD 0x00000003 +#define DSSPEAKER_STEREO 0x00000004 +#define DSSPEAKER_SURROUND 0x00000005 +#define DSSPEAKER_5POINT1 0x00000006 +#define DSSPEAKER_7POINT1 0x00000007 + +#define DSSPEAKER_GEOMETRY_MIN 0x00000005 // 5 degrees +#define DSSPEAKER_GEOMETRY_NARROW 0x0000000A // 10 degrees +#define DSSPEAKER_GEOMETRY_WIDE 0x00000014 // 20 degrees +#define DSSPEAKER_GEOMETRY_MAX 0x000000B4 // 180 degrees + +#define DSSPEAKER_COMBINED(c, g) ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16)) +#define DSSPEAKER_CONFIG(a) ((BYTE)(a)) +#define DSSPEAKER_GEOMETRY(a) ((BYTE)(((DWORD)(a) >> 16) & 0x00FF)) + +#define DSBCAPS_PRIMARYBUFFER 0x00000001 +#define DSBCAPS_STATIC 0x00000002 +#define DSBCAPS_LOCHARDWARE 0x00000004 +#define DSBCAPS_LOCSOFTWARE 0x00000008 +#define DSBCAPS_CTRL3D 0x00000010 +#define DSBCAPS_CTRLFREQUENCY 0x00000020 +#define DSBCAPS_CTRLPAN 0x00000040 +#define DSBCAPS_CTRLVOLUME 0x00000080 +#define DSBCAPS_CTRLPOSITIONNOTIFY 0x00000100 +#define DSBCAPS_CTRLFX 0x00000200 +#define DSBCAPS_STICKYFOCUS 0x00004000 +#define DSBCAPS_GLOBALFOCUS 0x00008000 +#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 +#define DSBCAPS_MUTE3DATMAXDISTANCE 0x00020000 +#define DSBCAPS_LOCDEFER 0x00040000 + +#define DSBPLAY_LOOPING 0x00000001 +#define DSBPLAY_LOCHARDWARE 0x00000002 +#define DSBPLAY_LOCSOFTWARE 0x00000004 +#define DSBPLAY_TERMINATEBY_TIME 0x00000008 +#define DSBPLAY_TERMINATEBY_DISTANCE 0x000000010 +#define DSBPLAY_TERMINATEBY_PRIORITY 0x000000020 + +#define DSBSTATUS_PLAYING 0x00000001 +#define DSBSTATUS_BUFFERLOST 0x00000002 +#define DSBSTATUS_LOOPING 0x00000004 +#define DSBSTATUS_LOCHARDWARE 0x00000008 +#define DSBSTATUS_LOCSOFTWARE 0x00000010 +#define DSBSTATUS_TERMINATED 0x00000020 + +#define DSBLOCK_FROMWRITECURSOR 0x00000001 +#define DSBLOCK_ENTIREBUFFER 0x00000002 + +#define DSBFREQUENCY_ORIGINAL 0 +#define DSBFREQUENCY_MIN 100 +#if DIRECTSOUND_VERSION >= 0x0900 +#define DSBFREQUENCY_MAX 200000 +#else +#define DSBFREQUENCY_MAX 100000 +#endif + +#define DSBPAN_LEFT -10000 +#define DSBPAN_CENTER 0 +#define DSBPAN_RIGHT 10000 + +#define DSBVOLUME_MIN -10000 +#define DSBVOLUME_MAX 0 + +#define DSBSIZE_MIN 4 +#define DSBSIZE_MAX 0x0FFFFFFF +#define DSBSIZE_FX_MIN 150 // NOTE: Milliseconds, not bytes + +#define DS3DMODE_NORMAL 0x00000000 +#define DS3DMODE_HEADRELATIVE 0x00000001 +#define DS3DMODE_DISABLE 0x00000002 + +#define DS3D_IMMEDIATE 0x00000000 +#define DS3D_DEFERRED 0x00000001 + +#define DS3D_MINDISTANCEFACTOR FLT_MIN +#define DS3D_MAXDISTANCEFACTOR FLT_MAX +#define DS3D_DEFAULTDISTANCEFACTOR 1.0f + +#define DS3D_MINROLLOFFFACTOR 0.0f +#define DS3D_MAXROLLOFFFACTOR 10.0f +#define DS3D_DEFAULTROLLOFFFACTOR 1.0f + +#define DS3D_MINDOPPLERFACTOR 0.0f +#define DS3D_MAXDOPPLERFACTOR 10.0f +#define DS3D_DEFAULTDOPPLERFACTOR 1.0f + +#define DS3D_DEFAULTMINDISTANCE 1.0f +#define DS3D_DEFAULTMAXDISTANCE 1000000000.0f + +#define DS3D_MINCONEANGLE 0 +#define DS3D_MAXCONEANGLE 360 +#define DS3D_DEFAULTCONEANGLE 360 + +#define DS3D_DEFAULTCONEOUTSIDEVOLUME DSBVOLUME_MAX + +// IDirectSoundCapture attributes + +#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER +#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED +#define DSCCAPS_MULTIPLECAPTURE 0x00000001 + +// IDirectSoundCaptureBuffer attributes + +#define DSCBCAPS_WAVEMAPPED 0x80000000 + +#if DIRECTSOUND_VERSION >= 0x0800 +#define DSCBCAPS_CTRLFX 0x00000200 +#endif + + +#define DSCBLOCK_ENTIREBUFFER 0x00000001 + +#define DSCBSTATUS_CAPTURING 0x00000001 +#define DSCBSTATUS_LOOPING 0x00000002 + +#define DSCBSTART_LOOPING 0x00000001 + +#define DSBPN_OFFSETSTOP 0xFFFFFFFF + +#define DS_CERTIFIED 0x00000000 +#define DS_UNCERTIFIED 0x00000001 + + +// +// Flags for the I3DL2 effects +// + +// +// I3DL2 Material Presets +// + +enum +{ + DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW, + DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW, + DSFX_I3DL2_MATERIAL_PRESET_THINDOOR, + DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR, + DSFX_I3DL2_MATERIAL_PRESET_WOODWALL, + DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL, + DSFX_I3DL2_MATERIAL_PRESET_STONEWALL, + DSFX_I3DL2_MATERIAL_PRESET_CURTAIN +}; + +#define I3DL2_MATERIAL_PRESET_SINGLEWINDOW -2800,0.71f +#define I3DL2_MATERIAL_PRESET_DOUBLEWINDOW -5000,0.40f +#define I3DL2_MATERIAL_PRESET_THINDOOR -1800,0.66f +#define I3DL2_MATERIAL_PRESET_THICKDOOR -4400,0.64f +#define I3DL2_MATERIAL_PRESET_WOODWALL -4000,0.50f +#define I3DL2_MATERIAL_PRESET_BRICKWALL -5000,0.60f +#define I3DL2_MATERIAL_PRESET_STONEWALL -6000,0.68f +#define I3DL2_MATERIAL_PRESET_CURTAIN -1200,0.15f + +enum +{ + DSFX_I3DL2_ENVIRONMENT_PRESET_DEFAULT, + DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC, + DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL, + DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM, + DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE, + DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA, + DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR, + DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY, + DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY, + DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR, + DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY, + DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST, + DSFX_I3DL2_ENVIRONMENT_PRESET_CITY, + DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS, + DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY, + DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN, + DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT, + DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE, + DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER, + DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE +}; + +// +// I3DL2 Reverberation Presets Values +// + +#define I3DL2_ENVIRONMENT_PRESET_DEFAULT -1000, -100, 0.0f, 1.49f, 0.83f, -2602, 0.007f, 200, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_GENERIC -1000, -100, 0.0f, 1.49f, 0.83f, -2602, 0.007f, 200, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PADDEDCELL -1000,-6000, 0.0f, 0.17f, 0.10f, -1204, 0.001f, 207, 0.002f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ROOM -1000, -454, 0.0f, 0.40f, 0.83f, -1646, 0.002f, 53, 0.003f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_BATHROOM -1000,-1200, 0.0f, 1.49f, 0.54f, -370, 0.007f, 1030, 0.011f, 100.0f, 60.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LIVINGROOM -1000,-6000, 0.0f, 0.50f, 0.10f, -1376, 0.003f, -1104, 0.004f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_STONEROOM -1000, -300, 0.0f, 2.31f, 0.64f, -711, 0.012f, 83, 0.017f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_AUDITORIUM -1000, -476, 0.0f, 4.32f, 0.59f, -789, 0.020f, -289, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CONCERTHALL -1000, -500, 0.0f, 3.92f, 0.70f, -1230, 0.020f, -2, 0.029f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CAVE -1000, 0, 0.0f, 2.91f, 1.30f, -602, 0.015f, -302, 0.022f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ARENA -1000, -698, 0.0f, 7.24f, 0.33f, -1166, 0.020f, 16, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_HANGAR -1000,-1000, 0.0f,10.05f, 0.23f, -602, 0.020f, 198, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY -1000,-4000, 0.0f, 0.30f, 0.10f, -1831, 0.002f, -1630, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_HALLWAY -1000, -300, 0.0f, 1.49f, 0.59f, -1219, 0.007f, 441, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR -1000, -237, 0.0f, 2.70f, 0.79f, -1214, 0.013f, 395, 0.020f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ALLEY -1000, -270, 0.0f, 1.49f, 0.86f, -1204, 0.007f, -4, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_FOREST -1000,-3300, 0.0f, 1.49f, 0.54f, -2560, 0.162f, -613, 0.088f, 79.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CITY -1000, -800, 0.0f, 1.49f, 0.67f, -2273, 0.007f, -2217, 0.011f, 50.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MOUNTAINS -1000,-2500, 0.0f, 1.49f, 0.21f, -2780, 0.300f, -2014, 0.100f, 27.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_QUARRY -1000,-1000, 0.0f, 1.49f, 0.83f,-10000, 0.061f, 500, 0.025f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PLAIN -1000,-2000, 0.0f, 1.49f, 0.50f, -2466, 0.179f, -2514, 0.100f, 21.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PARKINGLOT -1000, 0, 0.0f, 1.65f, 1.50f, -1363, 0.008f, -1153, 0.012f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_SEWERPIPE -1000,-1000, 0.0f, 2.81f, 0.14f, 429, 0.014f, 648, 0.021f, 80.0f, 60.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_UNDERWATER -1000,-4000, 0.0f, 1.49f, 0.10f, -449, 0.007f, 1700, 0.011f, 100.0f, 100.0f, 5000.0f + +// +// Examples simulating 'musical' reverb presets +// +// Name Decay time Description +// Small Room 1.1s A small size room with a length of 5m or so. +// Medium Room 1.3s A medium size room with a length of 10m or so. +// Large Room 1.5s A large size room suitable for live performances. +// Medium Hall 1.8s A medium size concert hall. +// Large Hall 1.8s A large size concert hall suitable for a full orchestra. +// Plate 1.3s A plate reverb simulation. +// + +#define I3DL2_ENVIRONMENT_PRESET_SMALLROOM -1000, -600, 0.0f, 1.10f, 0.83f, -400, 0.005f, 500, 0.010f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM -1000, -600, 0.0f, 1.30f, 0.83f, -1000, 0.010f, -200, 0.020f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LARGEROOM -1000, -600, 0.0f, 1.50f, 0.83f, -1600, 0.020f, -1000, 0.040f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL -1000, -600, 0.0f, 1.80f, 0.70f, -1300, 0.015f, -800, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LARGEHALL -1000, -600, 0.0f, 1.80f, 0.70f, -2000, 0.030f, -1400, 0.060f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PLATE -1000, -200, 0.0f, 1.30f, 0.90f, 0, 0.002f, 0, 0.010f, 100.0f, 75.0f, 5000.0f + +// +// DirectSound3D Algorithms +// + +// Default DirectSound3D algorithm {00000000-0000-0000-0000-000000000000} +#define DS3DALG_DEFAULT GUID_NULL + +// No virtualization (Pan3D) {C241333F-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_NO_VIRTUALIZATION, 0xc241333f, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +// High-quality HRTF algorithm {C2413340-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_HRTF_FULL, 0xc2413340, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +// Lower-quality HRTF algorithm {C2413342-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_HRTF_LIGHT, 0xc2413342, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// DirectSound Internal Effect Algorithms +// + + +// Gargle {DAFD8210-5711-4B91-9FE3-F75B7AE279BF} +DEFINE_GUID(GUID_DSFX_STANDARD_GARGLE, 0xdafd8210, 0x5711, 0x4b91, 0x9f, 0xe3, 0xf7, 0x5b, 0x7a, 0xe2, 0x79, 0xbf); + +// Chorus {EFE6629C-81F7-4281-BD91-C9D604A95AF6} +DEFINE_GUID(GUID_DSFX_STANDARD_CHORUS, 0xefe6629c, 0x81f7, 0x4281, 0xbd, 0x91, 0xc9, 0xd6, 0x04, 0xa9, 0x5a, 0xf6); + +// Flanger {EFCA3D92-DFD8-4672-A603-7420894BAD98} +DEFINE_GUID(GUID_DSFX_STANDARD_FLANGER, 0xefca3d92, 0xdfd8, 0x4672, 0xa6, 0x03, 0x74, 0x20, 0x89, 0x4b, 0xad, 0x98); + +// Echo/Delay {EF3E932C-D40B-4F51-8CCF-3F98F1B29D5D} +DEFINE_GUID(GUID_DSFX_STANDARD_ECHO, 0xef3e932c, 0xd40b, 0x4f51, 0x8c, 0xcf, 0x3f, 0x98, 0xf1, 0xb2, 0x9d, 0x5d); + +// Distortion {EF114C90-CD1D-484E-96E5-09CFAF912A21} +DEFINE_GUID(GUID_DSFX_STANDARD_DISTORTION, 0xef114c90, 0xcd1d, 0x484e, 0x96, 0xe5, 0x09, 0xcf, 0xaf, 0x91, 0x2a, 0x21); + +// Compressor/Limiter {EF011F79-4000-406D-87AF-BFFB3FC39D57} +DEFINE_GUID(GUID_DSFX_STANDARD_COMPRESSOR, 0xef011f79, 0x4000, 0x406d, 0x87, 0xaf, 0xbf, 0xfb, 0x3f, 0xc3, 0x9d, 0x57); + +// Parametric Equalization {120CED89-3BF4-4173-A132-3CB406CF3231} +DEFINE_GUID(GUID_DSFX_STANDARD_PARAMEQ, 0x120ced89, 0x3bf4, 0x4173, 0xa1, 0x32, 0x3c, 0xb4, 0x06, 0xcf, 0x32, 0x31); + +// I3DL2 Environmental Reverberation: Reverb (Listener) Effect {EF985E71-D5C7-42D4-BA4D-2D073E2E96F4} +DEFINE_GUID(GUID_DSFX_STANDARD_I3DL2REVERB, 0xef985e71, 0xd5c7, 0x42d4, 0xba, 0x4d, 0x2d, 0x07, 0x3e, 0x2e, 0x96, 0xf4); + +// Waves Reverberation {87FC0268-9A55-4360-95AA-004A1D9DE26C} +DEFINE_GUID(GUID_DSFX_WAVES_REVERB, 0x87fc0268, 0x9a55, 0x4360, 0x95, 0xaa, 0x00, 0x4a, 0x1d, 0x9d, 0xe2, 0x6c); + +// +// DirectSound Capture Effect Algorithms +// + + +// Acoustic Echo Canceller {BF963D80-C559-11D0-8A2B-00A0C9255AC1} +// Matches KSNODETYPE_ACOUSTIC_ECHO_CANCEL in ksmedia.h +DEFINE_GUID(GUID_DSCFX_CLASS_AEC, 0xBF963D80L, 0xC559, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); + +// Microsoft AEC {CDEBB919-379A-488a-8765-F53CFD36DE40} +DEFINE_GUID(GUID_DSCFX_MS_AEC, 0xcdebb919, 0x379a, 0x488a, 0x87, 0x65, 0xf5, 0x3c, 0xfd, 0x36, 0xde, 0x40); + +// System AEC {1C22C56D-9879-4f5b-A389-27996DDC2810} +DEFINE_GUID(GUID_DSCFX_SYSTEM_AEC, 0x1c22c56d, 0x9879, 0x4f5b, 0xa3, 0x89, 0x27, 0x99, 0x6d, 0xdc, 0x28, 0x10); + +// Noise Supression {E07F903F-62FD-4e60-8CDD-DEA7236665B5} +// Matches KSNODETYPE_NOISE_SUPPRESS in post Windows ME DDK's ksmedia.h +DEFINE_GUID(GUID_DSCFX_CLASS_NS, 0xe07f903f, 0x62fd, 0x4e60, 0x8c, 0xdd, 0xde, 0xa7, 0x23, 0x66, 0x65, 0xb5); + +// Microsoft Noise Suppresion {11C5C73B-66E9-4ba1-A0BA-E814C6EED92D} +DEFINE_GUID(GUID_DSCFX_MS_NS, 0x11c5c73b, 0x66e9, 0x4ba1, 0xa0, 0xba, 0xe8, 0x14, 0xc6, 0xee, 0xd9, 0x2d); + +// System Noise Suppresion {5AB0882E-7274-4516-877D-4EEE99BA4FD0} +DEFINE_GUID(GUID_DSCFX_SYSTEM_NS, 0x5ab0882e, 0x7274, 0x4516, 0x87, 0x7d, 0x4e, 0xee, 0x99, 0xba, 0x4f, 0xd0); + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +#endif // __DSOUND_INCLUDED__ + + + +#ifdef __cplusplus +}; +#endif // __cplusplus + + diff --git a/saco/d3d9/include/dvoice.h b/saco/d3d9/include/dvoice.h new file mode 100644 index 0000000..000ac51 --- /dev/null +++ b/saco/d3d9/include/dvoice.h @@ -0,0 +1,857 @@ +/*==========================================================================; + * + * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved. + * + * File: dpvoice.h + * Content: DirectPlayVoice include file + ***************************************************************************/ + +#ifndef __DVOICE__ +#define __DVOICE__ + +#include // for DECLARE_INTERFACE and HRESULT +#include +#include +#include +#include "dsound.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/**************************************************************************** + * + * DirectPlayVoice CLSIDs + * + ****************************************************************************/ + + +// {B9F3EB85-B781-4ac1-8D90-93A05EE37D7D} +DEFINE_GUID(CLSID_DirectPlayVoiceClient, +0xb9f3eb85, 0xb781, 0x4ac1, 0x8d, 0x90, 0x93, 0xa0, 0x5e, 0xe3, 0x7d, 0x7d); + +// {D3F5B8E6-9B78-4a4c-94EA-CA2397B663D3} +DEFINE_GUID(CLSID_DirectPlayVoiceServer, +0xd3f5b8e6, 0x9b78, 0x4a4c, 0x94, 0xea, 0xca, 0x23, 0x97, 0xb6, 0x63, 0xd3); + +// {0F0F094B-B01C-4091-A14D-DD0CD807711A} +DEFINE_GUID(CLSID_DirectPlayVoiceTest, +0xf0f094b, 0xb01c, 0x4091, 0xa1, 0x4d, 0xdd, 0xc, 0xd8, 0x7, 0x71, 0x1a); + +/**************************************************************************** + * + * DirectPlayVoice Interface IIDs + * + ****************************************************************************/ + + +// {1DFDC8EA-BCF7-41d6-B295-AB64B3B23306} +DEFINE_GUID(IID_IDirectPlayVoiceClient, +0x1dfdc8ea, 0xbcf7, 0x41d6, 0xb2, 0x95, 0xab, 0x64, 0xb3, 0xb2, 0x33, 0x6); + +// {FAA1C173-0468-43b6-8A2A-EA8A4F2076C9} +DEFINE_GUID(IID_IDirectPlayVoiceServer, +0xfaa1c173, 0x468, 0x43b6, 0x8a, 0x2a, 0xea, 0x8a, 0x4f, 0x20, 0x76, 0xc9); + +// {D26AF734-208B-41da-8224-E0CE79810BE1} +DEFINE_GUID(IID_IDirectPlayVoiceTest, +0xd26af734, 0x208b, 0x41da, 0x82, 0x24, 0xe0, 0xce, 0x79, 0x81, 0xb, 0xe1); + +/**************************************************************************** + * + * DirectPlayVoice Compression Type GUIDs + * + ****************************************************************************/ + +// MS-ADPCM 32.8 kbit/s +// +// {699B52C1-A885-46a8-A308-97172419ADC7} +DEFINE_GUID(DPVCTGUID_ADPCM, +0x699b52c1, 0xa885, 0x46a8, 0xa3, 0x8, 0x97, 0x17, 0x24, 0x19, 0xad, 0xc7); + +// Microsoft GSM 6.10 13 kbit/s +// +// {24768C60-5A0D-11d3-9BE4-525400D985E7} +DEFINE_GUID(DPVCTGUID_GSM, +0x24768c60, 0x5a0d, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7); + +// MS-PCM 64 kbit/s +// +// {8DE12FD4-7CB3-48ce-A7E8-9C47A22E8AC5} +DEFINE_GUID(DPVCTGUID_NONE, +0x8de12fd4, 0x7cb3, 0x48ce, 0xa7, 0xe8, 0x9c, 0x47, 0xa2, 0x2e, 0x8a, 0xc5); + +// Voxware SC03 3.2kbit/s +// +// {7D82A29B-2242-4f82-8F39-5D1153DF3E41} +DEFINE_GUID(DPVCTGUID_SC03, +0x7d82a29b, 0x2242, 0x4f82, 0x8f, 0x39, 0x5d, 0x11, 0x53, 0xdf, 0x3e, 0x41); + +// Voxware SC06 6.4kbit/s +// +// {53DEF900-7168-4633-B47F-D143916A13C7} +DEFINE_GUID(DPVCTGUID_SC06, +0x53def900, 0x7168, 0x4633, 0xb4, 0x7f, 0xd1, 0x43, 0x91, 0x6a, 0x13, 0xc7); + +// TrueSpeech(TM) 8.6 kbit/s +// +// {D7954361-5A0B-11d3-9BE4-525400D985E7} +DEFINE_GUID(DPVCTGUID_TRUESPEECH, +0xd7954361, 0x5a0b, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7); + +// Voxware VR12 1.4kbit/s +// +// {FE44A9FE-8ED4-48bf-9D66-1B1ADFF9FF6D} +DEFINE_GUID(DPVCTGUID_VR12, +0xfe44a9fe, 0x8ed4, 0x48bf, 0x9d, 0x66, 0x1b, 0x1a, 0xdf, 0xf9, 0xff, 0x6d); + +// Define the default compression type +#define DPVCTGUID_DEFAULT DPVCTGUID_SC03 + +/**************************************************************************** + * + * DirectPlayVoice Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDirectPlayVoiceClient FAR *LPDIRECTPLAYVOICECLIENT, *PDIRECTPLAYVOICECLIENT; +typedef struct IDirectPlayVoiceServer FAR *LPDIRECTPLAYVOICESERVER, *PDIRECTPLAYVOICESERVER; +typedef struct IDirectPlayVoiceTest FAR *LPDIRECTPLAYVOICETEST, *PDIRECTPLAYVOICETEST; + +/**************************************************************************** + * + * DirectPlayVoice Callback Functions + * + ****************************************************************************/ +typedef HRESULT (FAR PASCAL *PDVMESSAGEHANDLER)( + PVOID pvUserContext, + DWORD dwMessageType, + LPVOID lpMessage +); + +typedef PDVMESSAGEHANDLER LPDVMESSAGEHANDLER; + +/**************************************************************************** + * + * DirectPlayVoice Datatypes (Non-Structure / Non-Message) + * + ****************************************************************************/ + +typedef DWORD DVID, *LPDVID, *PDVID; + +/**************************************************************************** + * + * DirectPlayVoice Message Types + * + ****************************************************************************/ + +#define DVMSGID_BASE 0x0000 + +#define DVMSGID_MINBASE (DVMSGID_CREATEVOICEPLAYER) +#define DVMSGID_CREATEVOICEPLAYER (DVMSGID_BASE+0x0001) +#define DVMSGID_DELETEVOICEPLAYER (DVMSGID_BASE+0x0002) +#define DVMSGID_SESSIONLOST (DVMSGID_BASE+0x0003) +#define DVMSGID_PLAYERVOICESTART (DVMSGID_BASE+0x0004) +#define DVMSGID_PLAYERVOICESTOP (DVMSGID_BASE+0x0005) +#define DVMSGID_RECORDSTART (DVMSGID_BASE+0x0006) +#define DVMSGID_RECORDSTOP (DVMSGID_BASE+0x0007) +#define DVMSGID_CONNECTRESULT (DVMSGID_BASE+0x0008) +#define DVMSGID_DISCONNECTRESULT (DVMSGID_BASE+0x0009) +#define DVMSGID_INPUTLEVEL (DVMSGID_BASE+0x000A) +#define DVMSGID_OUTPUTLEVEL (DVMSGID_BASE+0x000B) +#define DVMSGID_HOSTMIGRATED (DVMSGID_BASE+0x000C) +#define DVMSGID_SETTARGETS (DVMSGID_BASE+0x000D) +#define DVMSGID_PLAYEROUTPUTLEVEL (DVMSGID_BASE+0x000E) +#define DVMSGID_LOSTFOCUS (DVMSGID_BASE+0x0010) +#define DVMSGID_GAINFOCUS (DVMSGID_BASE+0x0011) +#define DVMSGID_LOCALHOSTSETUP (DVMSGID_BASE+0x0012) +#define DVMSGID_MAXBASE (DVMSGID_LOCALHOSTSETUP) + +/**************************************************************************** + * + * DirectPlayVoice Constants + * + ****************************************************************************/ + +// +// Buffer Aggresiveness Value Ranges +// +#define DVBUFFERAGGRESSIVENESS_MIN 0x00000001 +#define DVBUFFERAGGRESSIVENESS_MAX 0x00000064 +#define DVBUFFERAGGRESSIVENESS_DEFAULT 0x00000000 + +// +// Buffer Quality Value Ranges +// +#define DVBUFFERQUALITY_MIN 0x00000001 +#define DVBUFFERQUALITY_MAX 0x00000064 +#define DVBUFFERQUALITY_DEFAULT 0x00000000 + +#define DVID_SYS 0 + +// +// Used to identify the session host in client/server +// +#define DVID_SERVERPLAYER 1 + +// +// Used to target all players +// +#define DVID_ALLPLAYERS 0 + +// +// Used to identify the main buffer +// +#define DVID_REMAINING 0xFFFFFFFF + +// +// Input level range +// +#define DVINPUTLEVEL_MIN 0x00000000 +#define DVINPUTLEVEL_MAX 0x00000063 // 99 decimal + +#define DVNOTIFYPERIOD_MINPERIOD 20 + + +#define DVPLAYBACKVOLUME_DEFAULT DSBVOLUME_MAX + +#define DVRECORDVOLUME_LAST 0x00000001 + + +// +// Use the default value +// +#define DVTHRESHOLD_DEFAULT 0xFFFFFFFF + +// +// Threshold Ranges +// +#define DVTHRESHOLD_MIN 0x00000000 +#define DVTHRESHOLD_MAX 0x00000063 // 99 decimal + +// +// Threshold field is not used +// +#define DVTHRESHOLD_UNUSED 0xFFFFFFFE + +// +// Session Types +// +#define DVSESSIONTYPE_PEER 0x00000001 +#define DVSESSIONTYPE_MIXING 0x00000002 +#define DVSESSIONTYPE_FORWARDING 0x00000003 +#define DVSESSIONTYPE_ECHO 0x00000004 + +/**************************************************************************** + * + * DirectPlayVoice Flags + * + ****************************************************************************/ + + +// +// Enable automatic adjustment of the recording volume +// +#define DVCLIENTCONFIG_AUTORECORDVOLUME 0x00000008 + +// +// Enable automatic voice activation +// +#define DVCLIENTCONFIG_AUTOVOICEACTIVATED 0x00000020 + +// +// Enable echo suppression +// +#define DVCLIENTCONFIG_ECHOSUPPRESSION 0x08000000 + +// +// Voice Activation manual mode +// +#define DVCLIENTCONFIG_MANUALVOICEACTIVATED 0x00000004 + +// +// Only playback voices that have buffers created for them +// +#define DVCLIENTCONFIG_MUTEGLOBAL 0x00000010 + +// +// Mute the playback +// +#define DVCLIENTCONFIG_PLAYBACKMUTE 0x00000002 + +// +// Mute the recording +// +#define DVCLIENTCONFIG_RECORDMUTE 0x00000001 + +// +// Complete the operation before returning +// +#define DVFLAGS_SYNC 0x00000001 + +// +// Just check to see if wizard has been run, and if so what it's results were +// +#define DVFLAGS_QUERYONLY 0x00000002 + +// +// Shutdown the voice session without migrating the host +// +#define DVFLAGS_NOHOSTMIGRATE 0x00000008 + +// +// Allow the back button to be enabled in the wizard +// +#define DVFLAGS_ALLOWBACK 0x00000010 + +// +// Disable host migration in the voice session +// +#define DVSESSION_NOHOSTMIGRATION 0x00000001 + +// +// Server controlled targetting +// +#define DVSESSION_SERVERCONTROLTARGET 0x00000002 + +// +// Use DirectSound Normal Mode instead of priority +// +#define DVSOUNDCONFIG_NORMALMODE 0x00000001 + +// +// Automatically select the microphone +// +#define DVSOUNDCONFIG_AUTOSELECT 0x00000002 + +// +// Run in half duplex mode +// +#define DVSOUNDCONFIG_HALFDUPLEX 0x00000004 + +// +// No volume controls are available for the recording device +// +#define DVSOUNDCONFIG_NORECVOLAVAILABLE 0x00000010 + +// +// Disable capture sharing +// +#define DVSOUNDCONFIG_NOFOCUS 0x20000000 + +// +// Set system conversion quality to high +// +#define DVSOUNDCONFIG_SETCONVERSIONQUALITY 0x00000008 + +// +// Enable strict focus mode +// +#define DVSOUNDCONFIG_STRICTFOCUS 0x40000000 + +// +// Player is in half duplex mode +// +#define DVPLAYERCAPS_HALFDUPLEX 0x00000001 + +// +// Specifies that player is the local player +// +#define DVPLAYERCAPS_LOCAL 0x00000002 + +/**************************************************************************** + * + * DirectPlayVoice Structures (Non-Message) + * + ****************************************************************************/ + + +// +// DirectPlayVoice Caps +// (GetCaps / SetCaps) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Caps flags +} DVCAPS, *LPDVCAPS, *PDVCAPS; + +// +// DirectPlayVoice Client Configuration +// (Connect / GetClientConfig) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags for client config (DVCLIENTCONFIG_...) + LONG lRecordVolume; // Recording volume + LONG lPlaybackVolume; // Playback volume + DWORD dwThreshold; // Voice Activation Threshold + DWORD dwBufferQuality; // Buffer quality + DWORD dwBufferAggressiveness; // Buffer aggressiveness + DWORD dwNotifyPeriod; // Period of notification messages (ms) +} DVCLIENTCONFIG, *LPDVCLIENTCONFIG, *PDVCLIENTCONFIG; + +// +// DirectPlayVoice Compression Type Information +// (GetCompressionTypes) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + GUID guidType; // GUID that identifies this compression type + LPWSTR lpszName; // String name of this compression type + LPWSTR lpszDescription; // Description for this compression type + DWORD dwFlags; // Flags for this compression type + DWORD dwMaxBitsPerSecond; // Maximum # of bit/s this compression type uses +} DVCOMPRESSIONINFO, *LPDVCOMPRESSIONINFO, *PDVCOMPRESSIONINFO; + +// +// DirectPlayVoice Session Description +// (Host / GetSessionDesc) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Session flags (DVSESSION_...) + DWORD dwSessionType; // Session type (DVSESSIONTYPE_...) + GUID guidCT; // Compression Type to use + DWORD dwBufferQuality; // Buffer quality + DWORD dwBufferAggressiveness; // Buffer aggresiveness +} DVSESSIONDESC, *LPDVSESSIONDESC, *PDVSESSIONDESC; + +// +// DirectPlayVoice Client Sound Device Configuration +// (Connect / GetSoundDeviceConfig) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags for sound config (DVSOUNDCONFIG_...) + GUID guidPlaybackDevice; // GUID of the playback device to use + LPDIRECTSOUND lpdsPlaybackDevice; // DirectSound Object to use (optional) + GUID guidCaptureDevice; // GUID of the capture device to use + LPDIRECTSOUNDCAPTURE lpdsCaptureDevice; // DirectSoundCapture Object to use (optional) + HWND hwndAppWindow; // HWND of your application's top-level window + LPDIRECTSOUNDBUFFER lpdsMainBuffer; // DirectSoundBuffer to use for playback (optional) + DWORD dwMainBufferFlags; // Flags to pass to Play() on the main buffer + DWORD dwMainBufferPriority; // Priority to set when calling Play() on the main buffer +} DVSOUNDDEVICECONFIG, *LPDVSOUNDDEVICECONFIG, *PDVSOUNDDEVICECONFIG; + +/**************************************************************************** + * + * DirectPlayVoice message handler call back structures + * + ****************************************************************************/ + +// +// Result of the Connect() call. (If it wasn't called Async) +// (DVMSGID_CONNECTRESULT) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + HRESULT hrResult; // Result of the Connect() call +} DVMSG_CONNECTRESULT, *LPDVMSG_CONNECTRESULT, *PDVMSG_CONNECTRESULT; + +// +// A new player has entered the voice session +// (DVMSGID_CREATEVOICEPLAYER) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidPlayer; // DVID of the player who joined + DWORD dwFlags; // Player flags (DVPLAYERCAPS_...) + PVOID pvPlayerContext; // Context value for this player (user set) +} DVMSG_CREATEVOICEPLAYER, *LPDVMSG_CREATEVOICEPLAYER, *PDVMSG_CREATEVOICEPLAYER; + +// +// A player has left the voice session +// (DVMSGID_DELETEVOICEPLAYER) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidPlayer; // DVID of the player who left + PVOID pvPlayerContext; // Context value for the player +} DVMSG_DELETEVOICEPLAYER, *LPDVMSG_DELETEVOICEPLAYER, *PDVMSG_DELETEVOICEPLAYER; + +// +// Result of the Disconnect() call. (If it wasn't called Async) +// (DVMSGID_DISCONNECTRESULT) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + HRESULT hrResult; // Result of the Disconnect() call +} DVMSG_DISCONNECTRESULT, *LPDVMSG_DISCONNECTRESULT, *PDVMSG_DISCONNECTRESULT; + +// +// The voice session host has migrated. +// (DVMSGID_HOSTMIGRATED) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidNewHostID; // DVID of the player who is now the host + LPDIRECTPLAYVOICESERVER pdvServerInterface; + // Pointer to the new host object (if local player is now host) +} DVMSG_HOSTMIGRATED, *LPDVMSG_HOSTMIGRATED, *PDVMSG_HOSTMIGRATED; + +// +// The current input level / recording volume on the local machine +// (DVMSGID_INPUTLEVEL) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwPeakLevel; // Current peak level of the audio + LONG lRecordVolume; // Current recording volume + PVOID pvLocalPlayerContext; // Context value for the local player +} DVMSG_INPUTLEVEL, *LPDVMSG_INPUTLEVEL, *PDVMSG_INPUTLEVEL; + +// +// The local client is about to become the new host +// (DVMSGID_LOCALHOSTSETUP) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + PVOID pvContext; // Context value to be passed to Initialize() of new host object + PDVMESSAGEHANDLER pMessageHandler; // Message handler to be used by new host object +} DVMSG_LOCALHOSTSETUP, *LPDVMSG_LOCALHOSTSETUP, *PDVMSG_LOCALHOSTSETUP; + +// +// The current output level for the combined output of all incoming streams. +// (DVMSGID_OUTPUTLEVEL) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwPeakLevel; // Current peak level of the output + LONG lOutputVolume; // Current playback volume + PVOID pvLocalPlayerContext; // Context value for the local player +} DVMSG_OUTPUTLEVEL, *LPDVMSG_OUTPUTLEVEL, *PDVMSG_OUTPUTLEVEL; + +// +// The current peak level of an individual player's incoming audio stream as it is +// being played back. +// (DVMSGID_PLAYEROUTPUTLEVEL) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidSourcePlayerID; // DVID of the player + DWORD dwPeakLevel; // Peak level of the player's stream + PVOID pvPlayerContext; // Context value for the player +} DVMSG_PLAYEROUTPUTLEVEL, *LPDVMSG_PLAYEROUTPUTLEVEL, *PDVMSG_PLAYEROUTPUTLEVEL; + +// +// An audio stream from the specified player has started playing back on the local client. +// (DVMSGID_PLAYERVOICESTART). +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidSourcePlayerID; // DVID of the Player + PVOID pvPlayerContext; // Context value for this player +} DVMSG_PLAYERVOICESTART, *LPDVMSG_PLAYERVOICESTART, *PDVMSG_PLAYERVOICESTART; + +// +// The audio stream from the specified player has stopped playing back on the local client. +// (DVMSGID_PLAYERVOICESTOP) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidSourcePlayerID; // DVID of the player + PVOID pvPlayerContext; // Context value for this player +} DVMSG_PLAYERVOICESTOP, *LPDVMSG_PLAYERVOICESTOP, *PDVMSG_PLAYERVOICESTOP; + +// +// Transmission has started on the local machine +// (DVMSGID_RECORDSTART) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwPeakLevel; // Peak level that caused transmission to start + PVOID pvLocalPlayerContext; // Context value for the local player +} DVMSG_RECORDSTART, *LPDVMSG_RECORDSTART, *PDVMSG_RECORDSTART; + +// +// Transmission has stopped on the local machine +// (DVMSGID_RECORDSTOP) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwPeakLevel; // Peak level that caused transmission to stop + PVOID pvLocalPlayerContext; // Context value for the local player +} DVMSG_RECORDSTOP, *LPDVMSG_RECORDSTOP, *PDVMSG_RECORDSTOP; + +// +// The voice session has been lost +// (DVMSGID_SESSIONLOST) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + HRESULT hrResult; // Reason the session was disconnected +} DVMSG_SESSIONLOST, *LPDVMSG_SESSIONLOST, *PDVMSG_SESSIONLOST; + +// +// The target list has been updated for the local client +// (DVMSGID_SETTARGETS) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwNumTargets; // # of targets + PDVID pdvidTargets; // An array of DVIDs specifying the current targets +} DVMSG_SETTARGETS, *LPDVMSG_SETTARGETS, *PDVMSG_SETTARGETS; + + +/**************************************************************************** + * + * DirectPlayVoice Functions + * + ****************************************************************************/ + +/* + * + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay voice objects. + * + * extern HRESULT WINAPI DirectPlayVoiceCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + */ + +/**************************************************************************** + * + * DirectPlay8 Application Interfaces + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlayVoiceClient +DECLARE_INTERFACE_( IDirectPlayVoiceClient, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, PVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectPlayVoiceClient methods ***/ + STDMETHOD_(HRESULT, Initialize) (THIS_ LPUNKNOWN, PDVMESSAGEHANDLER, PVOID, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, Connect) (THIS_ PDVSOUNDDEVICECONFIG, PDVCLIENTCONFIG, DWORD ) PURE; + STDMETHOD_(HRESULT, Disconnect) (THIS_ DWORD ) PURE; + STDMETHOD_(HRESULT, GetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE; + STDMETHOD_(HRESULT, GetClientConfig)(THIS_ PDVCLIENTCONFIG ) PURE; + STDMETHOD_(HRESULT, SetClientConfig)(THIS_ PDVCLIENTCONFIG ) PURE; + STDMETHOD_(HRESULT, GetCaps) (THIS_ PDVCAPS ) PURE; + STDMETHOD_(HRESULT, GetCompressionTypes)( THIS_ PVOID, PDWORD, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, SetTransmitTargets)( THIS_ PDVID, DWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, GetTransmitTargets)( THIS_ PDVID, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, Create3DSoundBuffer)( THIS_ DVID, LPDIRECTSOUNDBUFFER, DWORD, DWORD, LPDIRECTSOUND3DBUFFER * ) PURE; + STDMETHOD_(HRESULT, Delete3DSoundBuffer)( THIS_ DVID, LPDIRECTSOUND3DBUFFER * ) PURE; + STDMETHOD_(HRESULT, SetNotifyMask)( THIS_ PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, GetSoundDeviceConfig)( THIS_ PDVSOUNDDEVICECONFIG, PDWORD ) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirectPlayVoiceServer +DECLARE_INTERFACE_( IDirectPlayVoiceServer, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlayVoiceServer methods ***/ + STDMETHOD_(HRESULT, Initialize) (THIS_ LPUNKNOWN, PDVMESSAGEHANDLER, PVOID, LPDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, StartSession) (THIS_ PDVSESSIONDESC, DWORD ) PURE; + STDMETHOD_(HRESULT, StopSession) (THIS_ DWORD ) PURE; + STDMETHOD_(HRESULT, GetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE; + STDMETHOD_(HRESULT, SetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE; + STDMETHOD_(HRESULT, GetCaps) (THIS_ PDVCAPS ) PURE; + STDMETHOD_(HRESULT, GetCompressionTypes)( THIS_ PVOID, PDWORD, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, SetTransmitTargets)( THIS_ DVID, PDVID, DWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, GetTransmitTargets)( THIS_ DVID, PDVID, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, SetNotifyMask)( THIS_ PDWORD, DWORD ) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectPlayVoiceTest +DECLARE_INTERFACE_( IDirectPlayVoiceTest, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, PVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlayVoiceTest methods ***/ + STDMETHOD_(HRESULT, CheckAudioSetup) (THIS_ const GUID *, const GUID * , HWND, DWORD ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlayVoiceClient_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayVoiceClient_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayVoiceClient_Release(p) (p)->lpVtbl->Release(p) + +#define IDirectPlayVoiceClient_Initialize(p,a,b,c,d,e) (p)->lpVtbl->Initialize(p,a,b,c,d,e) +#define IDirectPlayVoiceClient_Connect(p,a,b,c) (p)->lpVtbl->Connect(p,a,b,c) +#define IDirectPlayVoiceClient_Disconnect(p,a) (p)->lpVtbl->Disconnect(p,a) +#define IDirectPlayVoiceClient_GetSessionDesc(p,a) (p)->lpVtbl->GetSessionDesc(p,a) +#define IDirectPlayVoiceClient_GetClientConfig(p,a) (p)->lpVtbl->GetClientConfig(p,a) +#define IDirectPlayVoiceClient_SetClientConfig(p,a) (p)->lpVtbl->SetClientConfig(p,a) +#define IDirectPlayVoiceClient_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectPlayVoiceClient_GetCompressionTypes(p,a,b,c,d) (p)->lpVtbl->GetCompressionTypes(p,a,b,c,d) +#define IDirectPlayVoiceClient_SetTransmitTargets(p,a,b,c) (p)->lpVtbl->SetTransmitTargets(p,a,b,c) +#define IDirectPlayVoiceClient_GetTransmitTargets(p,a,b,c) (p)->lpVtbl->GetTransmitTargets(p,a,b,c) +#define IDirectPlayVoiceClient_Create3DSoundBuffer(p,a,b,c,d,e) (p)->lpVtbl->Create3DSoundBuffer(p,a,b,c,d,e) +#define IDirectPlayVoiceClient_Delete3DSoundBuffer(p,a,b) (p)->lpVtbl->Delete3DSoundBuffer(p,a,b) +#define IDirectPlayVoiceClient_SetNotifyMask(p,a,b) (p)->lpVtbl->SetNotifyMask(p,a,b) +#define IDirectPlayVoiceClient_GetSoundDeviceConfig(p,a,b) (p)->lpVtbl->GetSoundDeviceConfig(p,a,b) + +#define IDirectPlayVoiceServer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayVoiceServer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayVoiceServer_Release(p) (p)->lpVtbl->Release(p) + +#define IDirectPlayVoiceServer_Initialize(p,a,b,c,d,e) (p)->lpVtbl->Initialize(p,a,b,c,d,e) +#define IDirectPlayVoiceServer_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b) +#define IDirectPlayVoiceServer_StopSession(p,a) (p)->lpVtbl->StopSession(p,a) +#define IDirectPlayVoiceServer_GetSessionDesc(p,a) (p)->lpVtbl->GetSessionDesc(p,a) +#define IDirectPlayVoiceServer_SetSessionDesc(p,a) (p)->lpVtbl->SetSessionDesc(p,a) +#define IDirectPlayVoiceServer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectPlayVoiceServer_GetCompressionTypes(p,a,b,c,d) (p)->lpVtbl->GetCompressionTypes(p,a,b,c,d) +#define IDirectPlayVoiceServer_SetTransmitTargets(p,a,b,c,d) (p)->lpVtbl->SetTransmitTargets(p,a,b,c,d) +#define IDirectPlayVoiceServer_GetTransmitTargets(p,a,b,c,d) (p)->lpVtbl->GetTransmitTargets(p,a,b,c,d) +#define IDirectPlayVoiceServer_SetNotifyMask(p,a,b) (p)->lpVtbl->SetNotifyMask(p,a,b) +#define IDirectPlayVoiceTest_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayVoiceTest_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayVoiceTest_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayVoiceTest_CheckAudioSetup(p,a,b,c,d) (p)->lpVtbl->CheckAudioSetup(p,a,b,c,d) + + +#else /* C++ */ + +#define IDirectPlayVoiceClient_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayVoiceClient_AddRef(p) (p)->AddRef() +#define IDirectPlayVoiceClient_Release(p) (p)->Release() + +#define IDirectPlayVoiceClient_Initialize(p,a,b,c,d,e) (p)->Initialize(a,b,c,d,e) +#define IDirectPlayVoiceClient_Connect(p,a,b,c) (p)->Connect(a,b,c) +#define IDirectPlayVoiceClient_Disconnect(p,a) (p)->Disconnect(a) +#define IDirectPlayVoiceClient_GetSessionDesc(p,a) (p)->GetSessionDesc(a) +#define IDirectPlayVoiceClient_GetClientConfig(p,a) (p)->GetClientConfig(a) +#define IDirectPlayVoiceClient_SetClientConfig(p,a) (p)->SetClientConfig(a) +#define IDirectPlayVoiceClient_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectPlayVoiceClient_GetCompressionTypes(p,a,b,c,d) (p)->GetCompressionTypes(a,b,c,d) +#define IDirectPlayVoiceClient_SetTransmitTargets(p,a,b,c) (p)->SetTransmitTargets(a,b,c) +#define IDirectPlayVoiceClient_GetTransmitTargets(p,a,b,c) (p)->GetTransmitTargets(a,b,c) +#define IDirectPlayVoiceClient_Create3DSoundBuffer(p,a,b,c,d,e) (p)->Create3DSoundBuffer(a,b,c,d,e) +#define IDirectPlayVoiceClient_Delete3DSoundBuffer(p,a,b) (p)->Delete3DSoundBuffer(a,b) +#define IDirectPlayVoiceClient_SetNotifyMask(p,a,b) (p)->SetNotifyMask(a,b) +#define IDirectPlayVoiceClient_GetSoundDeviceConfig(p,a,b) (p)->GetSoundDeviceConfig(a,b) + +#define IDirectPlayVoiceServer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayVoiceServer_AddRef(p) (p)->AddRef() +#define IDirectPlayVoiceServer_Release(p) (p)->Release() + +#define IDirectPlayVoiceServer_Initialize(p,a,b,c,d,e) (p)->Initialize(a,b,c,d,e) +#define IDirectPlayVoiceServer_StartSession(p,a,b) (p)->StartSession(a,b) +#define IDirectPlayVoiceServer_StopSession(p,a) (p)->StopSession(a) +#define IDirectPlayVoiceServer_GetSessionDesc(p,a) (p)->GetSessionDesc(a) +#define IDirectPlayVoiceServer_SetSessionDesc(p,a) (p)->SetSessionDesc(a) +#define IDirectPlayVoiceServer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectPlayVoiceServer_GetCompressionTypes(p,a,b,c,d) (p)->GetCompressionTypes(a,b,c,d) +#define IDirectPlayVoiceServer_SetTransmitTargets(p,a,b,c,d) (p)->SetTransmitTargets(a,b,c,d) +#define IDirectPlayVoiceServer_GetTransmitTargets(p,a,b,c,d) (p)->GetTransmitTargets(a,b,c,d) +#define IDirectPlayVoiceServer_SetNotifyMask(p,a,b) (p)->SetNotifyMask(a,b) + +#define IDirectPlayVoiceTest_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayVoiceTest_AddRef(p) (p)->AddRef() +#define IDirectPlayVoiceTest_Release(p) (p)->Release() +#define IDirectPlayVoiceTest_CheckAudioSetup(p,a,b,c,d) (p)->CheckAudioSetup(a,b,c,d) + + +#endif + + +/**************************************************************************** + * + * DIRECTPLAYVOICE ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +#define _FACDPV 0x15 +#define MAKE_DVHRESULT( code ) MAKE_HRESULT( 1, _FACDPV, code ) + +#define DV_OK S_OK +#define DV_FULLDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x0005 ) +#define DV_HALFDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x000A ) +#define DV_PENDING MAKE_HRESULT( 0, _FACDPV, 0x0010 ) + +#define DVERR_BUFFERTOOSMALL MAKE_DVHRESULT( 0x001E ) +#define DVERR_EXCEPTION MAKE_DVHRESULT( 0x004A ) +#define DVERR_GENERIC E_FAIL +#define DVERR_INVALIDFLAGS MAKE_DVHRESULT( 0x0078 ) +#define DVERR_INVALIDOBJECT MAKE_DVHRESULT( 0x0082 ) +#define DVERR_INVALIDPARAM E_INVALIDARG +#define DVERR_INVALIDPLAYER MAKE_DVHRESULT( 0x0087 ) +#define DVERR_INVALIDGROUP MAKE_DVHRESULT( 0x0091 ) +#define DVERR_INVALIDHANDLE MAKE_DVHRESULT( 0x0096 ) +#define DVERR_OUTOFMEMORY E_OUTOFMEMORY +#define DVERR_PENDING DV_PENDING +#define DVERR_NOTSUPPORTED E_NOTIMPL +#define DVERR_NOINTERFACE E_NOINTERFACE +#define DVERR_SESSIONLOST MAKE_DVHRESULT( 0x012C ) +#define DVERR_NOVOICESESSION MAKE_DVHRESULT( 0x012E ) +#define DVERR_CONNECTIONLOST MAKE_DVHRESULT( 0x0168 ) +#define DVERR_NOTINITIALIZED MAKE_DVHRESULT( 0x0169 ) +#define DVERR_CONNECTED MAKE_DVHRESULT( 0x016A ) +#define DVERR_NOTCONNECTED MAKE_DVHRESULT( 0x016B ) +#define DVERR_CONNECTABORTING MAKE_DVHRESULT( 0x016E ) +#define DVERR_NOTALLOWED MAKE_DVHRESULT( 0x016F ) +#define DVERR_INVALIDTARGET MAKE_DVHRESULT( 0x0170 ) +#define DVERR_TRANSPORTNOTHOST MAKE_DVHRESULT( 0x0171 ) +#define DVERR_COMPRESSIONNOTSUPPORTED MAKE_DVHRESULT( 0x0172 ) +#define DVERR_ALREADYPENDING MAKE_DVHRESULT( 0x0173 ) +#define DVERR_SOUNDINITFAILURE MAKE_DVHRESULT( 0x0174 ) +#define DVERR_TIMEOUT MAKE_DVHRESULT( 0x0175 ) +#define DVERR_CONNECTABORTED MAKE_DVHRESULT( 0x0176 ) +#define DVERR_NO3DSOUND MAKE_DVHRESULT( 0x0177 ) +#define DVERR_ALREADYBUFFERED MAKE_DVHRESULT( 0x0178 ) +#define DVERR_NOTBUFFERED MAKE_DVHRESULT( 0x0179 ) +#define DVERR_HOSTING MAKE_DVHRESULT( 0x017A ) +#define DVERR_NOTHOSTING MAKE_DVHRESULT( 0x017B ) +#define DVERR_INVALIDDEVICE MAKE_DVHRESULT( 0x017C ) +#define DVERR_RECORDSYSTEMERROR MAKE_DVHRESULT( 0x017D ) +#define DVERR_PLAYBACKSYSTEMERROR MAKE_DVHRESULT( 0x017E ) +#define DVERR_SENDERROR MAKE_DVHRESULT( 0x017F ) +#define DVERR_USERCANCEL MAKE_DVHRESULT( 0x0180 ) +#define DVERR_RUNSETUP MAKE_DVHRESULT( 0x0183 ) +#define DVERR_INCOMPATIBLEVERSION MAKE_DVHRESULT( 0x0184 ) +#define DVERR_INITIALIZED MAKE_DVHRESULT( 0x0187 ) +#define DVERR_INVALIDPOINTER E_POINTER +#define DVERR_NOTRANSPORT MAKE_DVHRESULT( 0x0188 ) +#define DVERR_NOCALLBACK MAKE_DVHRESULT( 0x0189 ) +#define DVERR_TRANSPORTNOTINIT MAKE_DVHRESULT( 0x018A ) +#define DVERR_TRANSPORTNOSESSION MAKE_DVHRESULT( 0x018B ) +#define DVERR_TRANSPORTNOPLAYER MAKE_DVHRESULT( 0x018C ) +#define DVERR_USERBACK MAKE_DVHRESULT( 0x018D ) +#define DVERR_NORECVOLAVAILABLE MAKE_DVHRESULT( 0x018E ) +#define DVERR_INVALIDBUFFER MAKE_DVHRESULT( 0x018F ) +#define DVERR_LOCKEDBUFFER MAKE_DVHRESULT( 0x0190 ) + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/saco/d3d9/include/dvp.h b/saco/d3d9/include/dvp.h new file mode 100644 index 0000000..c40dc79 --- /dev/null +++ b/saco/d3d9/include/dvp.h @@ -0,0 +1,966 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: dvp.h + * Content: DirectDrawVideoPort include file + * + ***************************************************************************/ + +#ifndef __DVP_INCLUDED__ +#define __DVP_INCLUDED__ + +/* + * GUIDS used by DirectDrawVideoPort objects + */ +#if defined( _WIN32 ) && (!defined( _NO_COM ) || defined( DEFINE_GUID )) +DEFINE_GUID( IID_IDDVideoPortContainer, 0x6C142760,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawVideoPort, 0xB36D93E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDrawVideoPortNotify, 0xA655FB94,0x0589,0x4E57,0xB3,0x33,0x56,0x7A,0x89,0x46,0x8C,0x88); + + + +DEFINE_GUID( DDVPTYPE_E_HREFH_VREFH, 0x54F39980L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_E_HREFH_VREFL, 0x92783220L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_E_HREFL_VREFH, 0xA07A02E0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_E_HREFL_VREFL, 0xE09C77E0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_CCIR656, 0xFCA326A0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_BROOKTREE, 0x1352A560L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_PHILIPS, 0x332CF160L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +#endif + +#ifndef GUID_DEFS_ONLY + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#define COM_NO_WINDOWS_H +#include +#else +#define IUnknown void +#endif + +/* + * These definitions are required to allow polymorphic structure members (i.e. those + * that are referred to both as DWORDs and as pointers) to resolve into a type + * of correct size to hold the largest of those two types (i.e. pointer) on 64 bit + * systems. For 32 bit environments, ULONG_PTR resolves to a DWORD. + */ +#ifndef MAXULONG_PTR +#define ULONG_PTR DWORD +#endif //MAXULONG_PTR + +#ifdef __cplusplus +extern "C" { +#endif + +/*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*/ + +struct IDirectDraw; +struct IDirectDrawSurface; +struct IDirectDrawPalette; +struct IDirectDrawClipper; + +typedef struct IDDVideoPortContainer FAR *LPDDVIDEOPORTCONTAINER; +typedef struct IDirectDrawVideoPort FAR *LPDIRECTDRAWVIDEOPORT; +typedef struct IDirectDrawVideoPortNotify FAR *LPDIRECTDRAWVIDEOPORTNOTIFY; + +typedef struct _DDVIDEOPORTCONNECT FAR *LPDDVIDEOPORTCONNECT; +typedef struct _DDVIDEOPORTCAPS FAR *LPDDVIDEOPORTCAPS; +typedef struct _DDVIDEOPORTDESC FAR *LPDDVIDEOPORTDESC; +typedef struct _DDVIDEOPORTINFO FAR *LPDDVIDEOPORTINFO; +typedef struct _DDVIDEOPORTBANDWIDTH FAR *LPDDVIDEOPORTBANDWIDTH; +typedef struct _DDVIDEOPORTSTATUS FAR *LPDDVIDEOPORTSTATUS; +typedef struct _DDVIDEOPORTNOTIFY FAR *LPDDVIDEOPORTNOTIFY; + +typedef struct IDDVideoPortContainerVtbl DDVIDEOPORTCONTAINERCALLBACKS; +typedef struct IDirectDrawVideoPortVtbl DIRECTDRAWVIDEOPORTCALLBACKS; +typedef struct IDirectDrawVideoPortNotifyVtbl DIRECTDRAWVIDEOPORTNOTIFYCALLBACKS; + + +/* + * API's + */ +typedef HRESULT (FAR PASCAL * LPDDENUMVIDEOCALLBACK)(LPDDVIDEOPORTCAPS, LPVOID); + + +/* + * INTERACES FOLLOW: + * IDirectDrawVideoPort + * IVideoPort + */ + +/* + * IDirectDrawVideoPortContainer + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDDVideoPortContainer +DECLARE_INTERFACE_( IDDVideoPortContainer, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawVideoPort methods ***/ + STDMETHOD(CreateVideoPort)(THIS_ DWORD, LPDDVIDEOPORTDESC, LPDIRECTDRAWVIDEOPORT FAR *, IUnknown FAR *) PURE; + STDMETHOD(EnumVideoPorts)(THIS_ DWORD, LPDDVIDEOPORTCAPS, LPVOID,LPDDENUMVIDEOCALLBACK ) PURE; + STDMETHOD(GetVideoPortConnectInfo)(THIS_ DWORD, LPDWORD, LPDDVIDEOPORTCONNECT ) PURE; + STDMETHOD(QueryVideoPortStatus)(THIS_ DWORD, LPDDVIDEOPORTSTATUS ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IVideoPortContainer_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IVideoPortContainer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IVideoPortContainer_Release(p) (p)->lpVtbl->Release(p) +#define IVideoPortContainer_CreateVideoPort(p, a, b, c, d) (p)->lpVtbl->CreateVideoPort(p, a, b, c, d) +#define IVideoPortContainer_EnumVideoPorts(p, a, b, c, d) (p)->lpVtbl->EnumVideoPorts(p, a, b, c, d) +#define IVideoPortContainer_GetVideoPortConnectInfo(p, a, b, c) (p)->lpVtbl->GetVideoPortConnectInfo(p, a, b, c) +#define IVideoPortContainer_QueryVideoPortStatus(p, a, b) (p)->lpVtbl->QueryVideoPortStatus(p, a, b) +#else +#define IVideoPortContainer_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IVideoPortContainer_AddRef(p) (p)->AddRef() +#define IVideoPortContainer_Release(p) (p)->Release() +#define IVideoPortContainer_CreateVideoPort(p, a, b, c, d) (p)->CreateVideoPort(a, b, c, d) +#define IVideoPortContainer_EnumVideoPorts(p, a, b, c, d) (p)->EnumVideoPorts(a, b, c, d) +#define IVideoPortContainer_GetVideoPortConnectInfo(p, a, b, c) (p)->GetVideoPortConnectInfo(a, b, c) +#define IVideoPortContainer_QueryVideoPortStatus(p, a, b) (p)->QueryVideoPortStatus(a, b) +#endif + +#endif + + +/* + * IDirectDrawVideoPort + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawVideoPort +DECLARE_INTERFACE_( IDirectDrawVideoPort, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IVideoPort methods ***/ + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; + STDMETHOD(GetBandwidthInfo)(THIS_ LPDDPIXELFORMAT, DWORD, DWORD, DWORD, LPDDVIDEOPORTBANDWIDTH) PURE; + STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL) PURE; + STDMETHOD(GetInputFormats)(THIS_ LPDWORD, LPDDPIXELFORMAT, DWORD) PURE; + STDMETHOD(GetOutputFormats)(THIS_ LPDDPIXELFORMAT, LPDWORD, LPDDPIXELFORMAT, DWORD) PURE; + STDMETHOD(GetFieldPolarity)(THIS_ LPBOOL) PURE; + STDMETHOD(GetVideoLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVideoSignalStatus)(THIS_ LPDWORD) PURE; + STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL) PURE; + STDMETHOD(SetTargetSurface)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; + STDMETHOD(StartVideo)(THIS_ LPDDVIDEOPORTINFO) PURE; + STDMETHOD(StopVideo)(THIS) PURE; + STDMETHOD(UpdateVideo)(THIS_ LPDDVIDEOPORTINFO) PURE; + STDMETHOD(WaitForSync)(THIS_ DWORD, DWORD, DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IVideoPort_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IVideoPort_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IVideoPort_Release(p) (p)->lpVtbl->Release(p) +#define IVideoPort_SetTargetSurface(p,a,b) (p)->lpVtbl->SetTargetSurface(p,a,b) +#define IVideoPort_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IVideoPort_GetBandwidthInfo(p,a,b,c,d,e) (p)->lpVtbl->GetBandwidthInfo(p,a,b,c,d,e) +#define IVideoPort_GetColorControls(p,a) (p)->lpVtbl->GetColorControls(p,a) +#define IVideoPort_GetInputFormats(p,a,b,c) (p)->lpVtbl->GetInputFormats(p,a,b,c) +#define IVideoPort_GetOutputFormats(p,a,b,c,d) (p)->lpVtbl->GetOutputFormats(p,a,b,c,d) +#define IVideoPort_GetFieldPolarity(p,a) (p)->lpVtbl->GetFieldPolarity(p,a) +#define IVideoPort_GetVideoLine(p,a) (p)->lpVtbl->GetVideoLine(p,a) +#define IVideoPort_GetVideoSignalStatus(p,a) (p)->lpVtbl->GetVideoSignalStatus(p,a) +#define IVideoPort_SetColorControls(p,a) (p)->lpVtbl->SetColorControls(p,a) +#define IVideoPort_StartVideo(p,a) (p)->lpVtbl->StartVideo(p,a) +#define IVideoPort_StopVideo(p) (p)->lpVtbl->StopVideo(p) +#define IVideoPort_UpdateVideo(p,a) (p)->lpVtbl->UpdateVideo(p,a) +#define IVideoPort_WaitForSync(p,a,b,c) (p)->lpVtbl->WaitForSync(p,a,b,c) +#else +#define IVideoPort_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IVideoPort_AddRef(p) (p)->AddRef() +#define IVideoPort_Release(p) (p)->Release() +#define IVideoPort_SetTargetSurface(p,a,b) (p)->SetTargetSurface(a,b) +#define IVideoPort_Flip(p,a,b) (p)->Flip(a,b) +#define IVideoPort_GetBandwidthInfo(p,a,b,c,d,e) (p)->GetBandwidthInfo(a,b,c,d,e) +#define IVideoPort_GetColorControls(p,a) (p)->GetColorControls(a) +#define IVideoPort_GetInputFormats(p,a,b,c) (p)->GetInputFormats(a,b,c) +#define IVideoPort_GetOutputFormats(p,a,b,c,d) (p)->GetOutputFormats(a,b,c,d) +#define IVideoPort_GetFieldPolarity(p,a) (p)->GetFieldPolarity(a) +#define IVideoPort_GetVideoLine(p,a) (p)->GetVideoLine(a) +#define IVideoPort_GetVideoSignalStatus(p,a) (p)->GetVideoSignalStatus(a) +#define IVideoPort_SetColorControls(p,a) (p)->SetColorControls(a) +#define IVideoPort_StartVideo(p,a) (p)->StartVideo(a) +#define IVideoPort_StopVideo(p) (p)->StopVideo() +#define IVideoPort_UpdateVideo(p,a) (p)->UpdateVideo(a) +#define IVideoPort_WaitForSync(p,a,b,c) (p)->WaitForSync(a,b,c) +#endif + +#endif + +/* + * IDirectDrawVideoPort + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawVideoPortNotify +DECLARE_INTERFACE_( IDirectDrawVideoPortNotify, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IVideoPort methods ***/ + STDMETHOD(AcquireNotification)(THIS_ HANDLE *, LPDDVIDEOPORTNOTIFY) PURE; + STDMETHOD(ReleaseNotification)(THIS_ HANDLE) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IVideoPortNotify_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IVideoPortNotify_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IVideoPortNotify_Release(p) (p)->lpVtbl->Release(p) +#define IVideoPortNotify_AcquireNotification(p,a,b) (p)->lpVtbl->AcquireNotification(p,a,b) +#define IVideoPortNotify_ReleaseNotification(p,a) (p)->lpVtbl->ReleaseNotification(p,a) +#else +#define IVideoPortNotify_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IVideoPortNotify_AddRef(p) (p)->AddRef() +#define IVideoPortNotify_Release(p) (p)->Release() +#define IVideoPortNotify_AcquireNotification(p,a,b) (p)->lpVtbl->AcquireNotification(a,b) +#define IVideoPortNotify_ReleaseNotification(p,a) (p)->lpVtbl->ReleaseNotification(a) +#endif + +#endif + +/* + * DDVIDEOPORTCONNECT + */ +typedef struct _DDVIDEOPORTCONNECT +{ + DWORD dwSize; // size of the DDVIDEOPORTCONNECT structure + DWORD dwPortWidth; // Width of the video port + GUID guidTypeID; // Description of video port connection + DWORD dwFlags; // Connection flags + ULONG_PTR dwReserved1; // Reserved, set to zero. +} DDVIDEOPORTCONNECT; + + +/* + * DDVIDEOPORTCAPS + */ +typedef struct _DDVIDEOPORTCAPS +{ + DWORD dwSize; // size of the DDVIDEOPORTCAPS structure + DWORD dwFlags; // indicates which fields contain data + DWORD dwMaxWidth; // max width of the video port field + DWORD dwMaxVBIWidth; // max width of the VBI data + DWORD dwMaxHeight; // max height of the video port field + DWORD dwVideoPortID; // Video port ID (0 - (dwMaxVideoPorts -1)) + DWORD dwCaps; // Video port capabilities + DWORD dwFX; // More video port capabilities + DWORD dwNumAutoFlipSurfaces; // Max number of autoflippable surfaces allowed + DWORD dwAlignVideoPortBoundary; // Byte restriction of placement within the surface + DWORD dwAlignVideoPortPrescaleWidth;// Byte restriction of width after prescaling + DWORD dwAlignVideoPortCropBoundary; // Byte restriction of left cropping + DWORD dwAlignVideoPortCropWidth; // Byte restriction of cropping width + DWORD dwPreshrinkXStep; // Width can be shrunk in steps of 1/x + DWORD dwPreshrinkYStep; // Height can be shrunk in steps of 1/x + DWORD dwNumVBIAutoFlipSurfaces; // Max number of VBI autoflippable surfaces allowed + DWORD dwNumPreferredAutoflip; // Optimal number of autoflippable surfaces for hardware + WORD wNumFilterTapsX; // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.) + WORD wNumFilterTapsY; // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.) +} DDVIDEOPORTCAPS; + +/* + * The dwMaxWidth and dwMaxVBIWidth members are valid + */ +#define DDVPD_WIDTH 0x00000001l + +/* + * The dwMaxHeight member is valid + */ +#define DDVPD_HEIGHT 0x00000002l + +/* + * The dwVideoPortID member is valid + */ +#define DDVPD_ID 0x00000004l + +/* + * The dwCaps member is valid + */ +#define DDVPD_CAPS 0x00000008l + +/* + * The dwFX member is valid + */ +#define DDVPD_FX 0x00000010l + +/* + * The dwNumAutoFlipSurfaces member is valid + */ +#define DDVPD_AUTOFLIP 0x00000020l + +/* + * All of the alignment members are valid + */ +#define DDVPD_ALIGN 0x00000040l + +/* + * The dwNumPreferredAutoflip member is valid + */ +#define DDVPD_PREFERREDAUTOFLIP 0x00000080l + +/* + * The wNumFilterTapsX and wNumFilterTapsY fields are valid + */ +#define DDVPD_FILTERQUALITY 0x00000100l + +/* + * DDVIDEOPORTDESC + */ +typedef struct _DDVIDEOPORTDESC +{ + DWORD dwSize; // size of the DDVIDEOPORTDESC structure + DWORD dwFieldWidth; // width of the video port field + DWORD dwVBIWidth; // width of the VBI data + DWORD dwFieldHeight; // height of the video port field + DWORD dwMicrosecondsPerField; // Microseconds per video field + DWORD dwMaxPixelsPerSecond; // Maximum pixel rate per second + DWORD dwVideoPortID; // Video port ID (0 - (dwMaxVideoPorts -1)) + DWORD dwReserved1; // Reserved for future use - set to zero (struct padding) + DDVIDEOPORTCONNECT VideoPortType; // Description of video port connection + ULONG_PTR dwReserved2; // Reserved for future use - set to zero + ULONG_PTR dwReserved3; // Reserved for future use - set to zero +} DDVIDEOPORTDESC; + + +/* + * DDVIDEOPORTINFO + */ +typedef struct _DDVIDEOPORTINFO +{ + DWORD dwSize; // Size of the structure + DWORD dwOriginX; // Placement of the video data within the surface. + DWORD dwOriginY; // Placement of the video data within the surface. + DWORD dwVPFlags; // Video port options + RECT rCrop; // Cropping rectangle (optional). + DWORD dwPrescaleWidth; // Determines pre-scaling/zooming in the X direction (optional). + DWORD dwPrescaleHeight; // Determines pre-scaling/zooming in the Y direction (optional). + LPDDPIXELFORMAT lpddpfInputFormat; // Video format written to the video port + LPDDPIXELFORMAT lpddpfVBIInputFormat; // Input format of the VBI data + LPDDPIXELFORMAT lpddpfVBIOutputFormat;// Output format of the data + DWORD dwVBIHeight; // Specifies the number of lines of data within the vertical blanking interval. + ULONG_PTR dwReserved1; // Reserved for future use - set to zero + ULONG_PTR dwReserved2; // Reserved for future use - set to zero +} DDVIDEOPORTINFO; + + +/* + * DDVIDEOPORTBANDWIDTH + */ +typedef struct _DDVIDEOPORTBANDWIDTH +{ + DWORD dwSize; // Size of the structure + DWORD dwCaps; + DWORD dwOverlay; // Zoom factor at which overlay is supported + DWORD dwColorkey; // Zoom factor at which overlay w/ colorkey is supported + DWORD dwYInterpolate; // Zoom factor at which overlay w/ Y interpolation is supported + DWORD dwYInterpAndColorkey; // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported + ULONG_PTR dwReserved1; // Reserved for future use - set to zero + ULONG_PTR dwReserved2; // Reserved for future use - set to zero +} DDVIDEOPORTBANDWIDTH; + + +/* + * DDVIDEOPORTSTATUS + */ +typedef struct _DDVIDEOPORTSTATUS +{ + DWORD dwSize; // Size of the structure + BOOL bInUse; // TRUE if video port is currently being used + DWORD dwFlags; // Currently not used + DWORD dwReserved1; // Reserved for future use + DDVIDEOPORTCONNECT VideoPortType; // Information about the connection + ULONG_PTR dwReserved2; // Reserved for future use + ULONG_PTR dwReserved3; // Reserved for future use +} DDVIDEOPORTSTATUS; + +/* + * DDVIDEOPORTNOTIFY + */ +typedef struct _DDVIDEOPORTNOTIFY +{ + LARGE_INTEGER ApproximateTimeStamp; // Timestamp in the event notification + LONG lField; // 0 if even, 1 if odd, -1 if unknown + UINT dwSurfaceIndex; // Index in the surface chain of the surface that received the sample + LONG lDone; // Call InterlockedIncrement on this when done with sample +} DDVIDEOPORTNOTIFY; + + +/*============================================================================ + * + * Video Port Flags + * + * All flags are bit flags. + * + *==========================================================================*/ + +/**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTCONNECT FLAGS + * + ****************************************************************************/ + +/* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of double clocking the data. + * When this is set by the client, this indicates that the video port + * should enable double clocking. This flag is only valid with external + * syncs. + */ +#define DDVPCONNECT_DOUBLECLOCK 0x00000001l + +/* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of using an external VACT + * signal. When this is set by the client, this indicates that the + * video port should use the external VACT signal. + */ +#define DDVPCONNECT_VACT 0x00000002l + +/* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of treating even fields + * like odd fields and visa versa. When this is set by the client, + * this indicates that the video port should treat even fields like odd + * fields. + */ +#define DDVPCONNECT_INVERTPOLARITY 0x00000004l + +/* + * Indicates that any data written to the video port during the VREF + * period will not be written into the frame buffer. This flag is read only. + */ +#define DDVPCONNECT_DISCARDSVREFDATA 0x00000008l + +/* + * When this is set be the driver and passed to the client, this + * indicates that the device will write half lines into the frame buffer + * if half lines are provided by the decoder. If this is set by the client, + * this indicates that the decoder will be supplying half lines. + */ +#define DDVPCONNECT_HALFLINE 0x00000010l + +/* + * Indicates that the signal is interlaced. This flag is only + * set by the client. + */ +#define DDVPCONNECT_INTERLACED 0x00000020l + +/* + * Indicates that video port is shareable and that this video port + * will use the even fields. This flag is only set by the client. + */ +#define DDVPCONNECT_SHAREEVEN 0x00000040l + +/* + * Indicates that video port is shareable and that this video port + * will use the odd fields. This flag is only set by the client. + */ +#define DDVPCONNECT_SHAREODD 0x00000080l + +/**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC CAPS + * + ****************************************************************************/ + +/* + * Flip can be performed automatically to avoid tearing. + */ +#define DDVPCAPS_AUTOFLIP 0x00000001l + +/* + * Supports interlaced video + */ +#define DDVPCAPS_INTERLACED 0x00000002l + +/* + * Supports non-interlaced video + */ +#define DDVPCAPS_NONINTERLACED 0x00000004l + +/* + * Indicates that the device can return whether the current field + * of an interlaced signal is even or odd. + */ +#define DDVPCAPS_READBACKFIELD 0x00000008l + +/* + * Indicates that the device can return the current line of video + * being written into the frame buffer. + */ +#define DDVPCAPS_READBACKLINE 0x00000010l + +/* + * Allows two gen-locked video streams to share a single video port, + * where one stream uses the even fields and the other uses the odd + * fields. Separate parameters (including address, scaling, + * cropping, etc.) are maintained for both fields.) + */ +#define DDVPCAPS_SHAREABLE 0x00000020l + +/* + * Even fields of video can be automatically discarded. + */ +#define DDVPCAPS_SKIPEVENFIELDS 0x00000040l + +/* + * Odd fields of video can be automatically discarded. + */ +#define DDVPCAPS_SKIPODDFIELDS 0x00000080l + +/* + * Indicates that the device is capable of driving the graphics + * VSYNC with the video port VSYNC. + */ +#define DDVPCAPS_SYNCMASTER 0x00000100l + +/* + * Indicates that data within the vertical blanking interval can + * be written to a different surface. + */ +#define DDVPCAPS_VBISURFACE 0x00000200l + +/* + * Indicates that the video port can perform color operations + * on the incoming data before it is written to the frame buffer. + */ +#define DDVPCAPS_COLORCONTROL 0x00000400l + +/* + * Indicates that the video port can accept VBI data in a different + * width or format than the regular video data. + */ +#define DDVPCAPS_OVERSAMPLEDVBI 0x00000800l + +/* + * Indicates that the video port can write data directly to system memory + */ +#define DDVPCAPS_SYSTEMMEMORY 0x00001000l + +/* + * Indicates that the VBI and video portions of the video stream can + * be controlled by an independent processes. + */ +#define DDVPCAPS_VBIANDVIDEOINDEPENDENT 0x00002000l + +/* + * Indicates that the video port contains high quality hardware + * de-interlacing hardware that should be used instead of the + * bob/weave algorithms. + */ +#define DDVPCAPS_HARDWAREDEINTERLACE 0x00004000l + + +/**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC FX + * + ****************************************************************************/ + +/* + * Limited cropping is available to crop out the vertical interval data. + */ +#define DDVPFX_CROPTOPDATA 0x00000001l + +/* + * Incoming data can be cropped in the X direction before it is written + * to the surface. + */ +#define DDVPFX_CROPX 0x00000002l + +/* + * Incoming data can be cropped in the Y direction before it is written + * to the surface. + */ +#define DDVPFX_CROPY 0x00000004l + +/* + * Supports interleaving interlaced fields in memory. + */ +#define DDVPFX_INTERLEAVE 0x00000008l + +/* + * Supports mirroring left to right as the video data is written + * into the frame buffer. + */ +#define DDVPFX_MIRRORLEFTRIGHT 0x00000010l + +/* + * Supports mirroring top to bottom as the video data is written + * into the frame buffer. + */ +#define DDVPFX_MIRRORUPDOWN 0x00000020l + +/* + * Data can be arbitrarily shrunk in the X direction before it + * is written to the surface. + */ +#define DDVPFX_PRESHRINKX 0x00000040l + +/* + * Data can be arbitrarily shrunk in the Y direction before it + * is written to the surface. + */ +#define DDVPFX_PRESHRINKY 0x00000080l + +/* + * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X + * direction before it is written to the surface. + */ +#define DDVPFX_PRESHRINKXB 0x00000100l + +/* + * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y + * direction before it is written to the surface. + */ +#define DDVPFX_PRESHRINKYB 0x00000200l + +/* + * Data can be shrunk in increments of 1/x in the X direction + * (where X is specified in the DDVIDEOPORTCAPS.dwPreshrinkXStep) + * before it is written to the surface. + */ +#define DDVPFX_PRESHRINKXS 0x00000400l + +/* + * Data can be shrunk in increments of 1/x in the Y direction + * (where X is specified in the DDVIDEOPORTCAPS.dwPreshrinkYStep) + * before it is written to the surface. + */ +#define DDVPFX_PRESHRINKYS 0x00000800l + +/* + * Data can be arbitrarily stretched in the X direction before + * it is written to the surface. + */ +#define DDVPFX_PRESTRETCHX 0x00001000l + +/* + * Data can be arbitrarily stretched in the Y direction before + * it is written to the surface. + */ +#define DDVPFX_PRESTRETCHY 0x00002000l + +/* + * Data can be integer stretched in the X direction before it is + * written to the surface. + */ +#define DDVPFX_PRESTRETCHXN 0x00004000l + +/* + * Data can be integer stretched in the Y direction before it is + * written to the surface. + */ +#define DDVPFX_PRESTRETCHYN 0x00008000l + +/* + * Indicates that data within the vertical blanking interval can + * be converted independently of the remaining video data. + */ +#define DDVPFX_VBICONVERT 0x00010000l + +/* + * Indicates that scaling can be disabled for data within the + * vertical blanking interval. + */ +#define DDVPFX_VBINOSCALE 0x00020000l + +/* + * Indicates that the video data can ignore the left and right + * cropping coordinates when cropping oversampled VBI data. + */ +#define DDVPFX_IGNOREVBIXCROP 0x00040000l + +/* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + */ +#define DDVPFX_VBINOINTERLEAVE 0x00080000l + + +/**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTINFO FLAGS + * + ****************************************************************************/ + +/* + * Perform automatic flipping. Auto-flipping is performed between + * the overlay surface that was attached to the video port using + * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that + * are attached to the surface via the IDirectDrawSurface::AttachSurface + * method. The flip order is the order in which the overlay surfaces + * were. attached. + */ +#define DDVP_AUTOFLIP 0x00000001l + +/* + * Perform conversion using the ddpfOutputFormat information. + */ +#define DDVP_CONVERT 0x00000002l + +/* + * Perform cropping using the specified rectangle. + */ +#define DDVP_CROP 0x00000004l + +/* + * Indicates that interlaced fields should be interleaved in memory. + */ +#define DDVP_INTERLEAVE 0x00000008l + +/* + * Indicates that the data should be mirrored left to right as it's + * written into the frame buffer. + */ +#define DDVP_MIRRORLEFTRIGHT 0x00000010l + +/* + * Indicates that the data should be mirrored top to bottom as it's + * written into the frame buffer. + */ +#define DDVP_MIRRORUPDOWN 0x00000020l + +/* + * Perform pre-scaling/zooming based on the pre-scale parameters. + */ +#define DDVP_PRESCALE 0x00000040l + +/* + * Ignore input of even fields. + */ +#define DDVP_SKIPEVENFIELDS 0x00000080l + +/* + * Ignore input of odd fields. + */ +#define DDVP_SKIPODDFIELDS 0x00000100l + +/* + * Drive the graphics VSYNCs using the video port VYSNCs. + */ +#define DDVP_SYNCMASTER 0x00000200l + +/* + * The ddpfVBIOutputFormatFormat member contains data that should be used + * to convert the data within the vertical blanking interval. + */ +#define DDVP_VBICONVERT 0x00000400l + +/* + * Indicates that data within the vertical blanking interval + * should not be scaled. + */ +#define DDVP_VBINOSCALE 0x00000800l + +/* + * Indicates that these bob/weave decisions should not be + * overriden by other interfaces. + */ +#define DDVP_OVERRIDEBOBWEAVE 0x00001000l + +/* + * Indicates that the video data should ignore the left and right + * cropping coordinates when cropping the VBI data. + */ +#define DDVP_IGNOREVBIXCROP 0x00002000l + +/* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + */ +#define DDVP_VBINOINTERLEAVE 0x00004000l + +/* + * Indicates that the video port should use the hardware + * de-interlacing hardware. + */ +#define DDVP_HARDWAREDEINTERLACE 0x00008000l + +/**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS + * + ****************************************************************************/ + +/* + * Return formats for the video data + */ +#define DDVPFORMAT_VIDEO 0x00000001l + +/* + * Return formats for the VBI data + */ +#define DDVPFORMAT_VBI 0x00000002l + +/**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS + * + ****************************************************************************/ + +/* + * Surface should receive video data (and VBI data if a surface + * is not explicitly attached for that purpose) + */ +#define DDVPTARGET_VIDEO 0x00000001l + +/* + * Surface should receive VBI data + */ +#define DDVPTARGET_VBI 0x00000002l + + +/**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS + * + ****************************************************************************/ + +/* + * Waits until the beginning of the next VSYNC + */ +#define DDVPWAIT_BEGIN 0x00000001l + +/* + * Waits until the end of the next/current VSYNC + */ +#define DDVPWAIT_END 0x00000002l + +/* + * Waits until the beginning of the specified line + */ +#define DDVPWAIT_LINE 0x00000003l + +/**************************************************************************** + * + * DIRECTDRAWVIDEOPORT FLIP FLAGS + * + ****************************************************************************/ + +/* + * Flips the normal video surface + */ +#define DDVPFLIP_VIDEO 0x00000001l + +/* + * Flips the VBI surface + */ +#define DDVPFLIP_VBI 0x00000002l + +/**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES + * + ****************************************************************************/ + +/* + * No video signal is present at the video port + */ +#define DDVPSQ_NOSIGNAL 0x00000001l + +/* + * A valid video signal is present at the video port + */ +#define DDVPSQ_SIGNALOK 0x00000002l + +/**************************************************************************** + * + * VIDEOPORTBANDWIDTH Flags + * + ****************************************************************************/ + +/* + * The specified height/width refer to the size of the video port data + * written into memory, after prescaling has occured. + */ +#define DDVPB_VIDEOPORT 0x00000001l + +/* + * The specified height/width refer to the source size of the overlay. + */ +#define DDVPB_OVERLAY 0x00000002l + +/* + * This is a query for the device to return which caps this device requires. + */ +#define DDVPB_TYPE 0x00000004l + +/**************************************************************************** + * + * VIDEOPORTBANDWIDTH Caps + * + ****************************************************************************/ + +/* + * The bandwidth for this device is dependant on the overlay source size. + */ +#define DDVPBCAPS_SOURCE 0x00000001l + +/* + * The bandwidth for this device is dependant on the overlay destination + * size. + */ +#define DDVPBCAPS_DESTINATION 0x00000002l + +/**************************************************************************** + * + * DDVIDEOPORTCONTAINER CreateVideoPort flags + * + ****************************************************************************/ + +/* + * The process only wants to control the VBI portion of the video stream. + */ +#define DDVPCREATE_VBIONLY 0x00000001l + +/* + * The process only wants to control the non-VBI (video) portion of + * the video stream. + */ +#define DDVPCREATE_VIDEOONLY 0x00000002l + +/**************************************************************************** + * + * DDVIDEOPORTSTATUS flags + * + ****************************************************************************/ + +/* + * The video port interface is only controlling the VBI portion of the + * video stream + */ +#define DDVPSTATUS_VBIONLY 0x00000001l + +/* + * The video port interface is only controlling the video portion of the + * video stream + */ +#define DDVPSTATUS_VIDEOONLY 0x00000002l + + +#ifdef __cplusplus +}; +#endif + +#endif // GUID_DEFS_ONLY + +#endif + diff --git a/saco/d3d9/include/dx7todx8.h b/saco/d3d9/include/dx7todx8.h new file mode 100644 index 0000000..a513d69 --- /dev/null +++ b/saco/d3d9/include/dx7todx8.h @@ -0,0 +1,98 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: dx7todx8.h + * Content: DX7 to DX8 Direct3D aliases to aid porting DX7 apps to DX8 + * + ***************************************************************************/ + +#ifndef _DX7TODX8_H_ + +/////////////////////////////////////////////////////////////////////////////// +// +// d3d8types.h +// +/////////////////////////////////////////////////////////////////////////////// + +#define D3DTRANSFORMSTATE_WORLD D3DTS_WORLD +#define D3DTRANSFORMSTATE_VIEW D3DTS_VIEW +#define D3DTRANSFORMSTATE_PROJECTION D3DTS_PROJECTION +#define D3DTRANSFORMSTATE_WORLD1 D3DTS_WORLD1 +#define D3DTRANSFORMSTATE_WORLD2 D3DTS_WORLD2 +#define D3DTRANSFORMSTATE_WORLD3 D3DTS_WORLD3 +#define D3DTRANSFORMSTATE_TEXTURE0 D3DTS_TEXTURE0 +#define D3DTRANSFORMSTATE_TEXTURE1 D3DTS_TEXTURE1 +#define D3DTRANSFORMSTATE_TEXTURE2 D3DTS_TEXTURE2 +#define D3DTRANSFORMSTATE_TEXTURE3 D3DTS_TEXTURE3 +#define D3DTRANSFORMSTATE_TEXTURE4 D3DTS_TEXTURE4 +#define D3DTRANSFORMSTATE_TEXTURE5 D3DTS_TEXTURE5 +#define D3DTRANSFORMSTATE_TEXTURE6 D3DTS_TEXTURE6 +#define D3DTRANSFORMSTATE_TEXTURE7 D3DTS_TEXTURE7 +#define D3DTRANSFORMSTATE_FORCE_DWORD D3DTS_FORCE_DWORD + +#define D3DRENDERSTATE_ZENABLE D3DRS_ZENABLE +#define D3DRENDERSTATE_FILLMODE D3DRS_FILLMODE +#define D3DRENDERSTATE_SHADEMODE D3DRS_SHADEMODE +#define D3DRENDERSTATE_LINEPATTERN D3DRS_LINEPATTERN +#define D3DRENDERSTATE_ZWRITEENABLE D3DRS_ZWRITEENABLE +#define D3DRENDERSTATE_ALPHATESTENABLE D3DRS_ALPHATESTENABLE +#define D3DRENDERSTATE_LASTPIXEL D3DRS_LASTPIXEL +#define D3DRENDERSTATE_SRCBLEND D3DRS_SRCBLEND +#define D3DRENDERSTATE_DESTBLEND D3DRS_DESTBLEND +#define D3DRENDERSTATE_CULLMODE D3DRS_CULLMODE +#define D3DRENDERSTATE_ZFUNC D3DRS_ZFUNC +#define D3DRENDERSTATE_ALPHAREF D3DRS_ALPHAREF +#define D3DRENDERSTATE_ALPHAFUNC D3DRS_ALPHAFUNC +#define D3DRENDERSTATE_DITHERENABLE D3DRS_DITHERENABLE +#define D3DRENDERSTATE_ALPHABLENDENABLE D3DRS_ALPHABLENDENABLE +#define D3DRENDERSTATE_FOGENABLE D3DRS_FOGENABLE +#define D3DRENDERSTATE_SPECULARENABLE D3DRS_SPECULARENABLE +#define D3DRENDERSTATE_ZVISIBLE D3DRS_ZVISIBLE +#define D3DRENDERSTATE_FOGCOLOR D3DRS_FOGCOLOR +#define D3DRENDERSTATE_FOGTABLEMODE D3DRS_FOGTABLEMODE +#define D3DRENDERSTATE_FOGSTART D3DRS_FOGSTART +#define D3DRENDERSTATE_FOGEND D3DRS_FOGEND +#define D3DRENDERSTATE_FOGDENSITY D3DRS_FOGDENSITY +#define D3DRENDERSTATE_EDGEANTIALIAS D3DRS_EDGEANTIALIAS +#define D3DRENDERSTATE_ZBIAS D3DRS_ZBIAS +#define D3DRENDERSTATE_RANGEFOGENABLE D3DRS_RANGEFOGENABLE +#define D3DRENDERSTATE_STENCILENABLE D3DRS_STENCILENABLE +#define D3DRENDERSTATE_STENCILFAIL D3DRS_STENCILFAIL +#define D3DRENDERSTATE_STENCILZFAIL D3DRS_STENCILZFAIL +#define D3DRENDERSTATE_STENCILPASS D3DRS_STENCILPASS +#define D3DRENDERSTATE_STENCILFUNC D3DRS_STENCILFUNC +#define D3DRENDERSTATE_STENCILREF D3DRS_STENCILREF +#define D3DRENDERSTATE_STENCILMASK D3DRS_STENCILMASK +#define D3DRENDERSTATE_STENCILWRITEMASK D3DRS_STENCILWRITEMASK +#define D3DRENDERSTATE_TEXTUREFACTOR D3DRS_TEXTUREFACTOR +#define D3DRENDERSTATE_WRAP0 D3DRS_WRAP0 +#define D3DRENDERSTATE_WRAP1 D3DRS_WRAP1 +#define D3DRENDERSTATE_WRAP2 D3DRS_WRAP2 +#define D3DRENDERSTATE_WRAP3 D3DRS_WRAP3 +#define D3DRENDERSTATE_WRAP4 D3DRS_WRAP4 +#define D3DRENDERSTATE_WRAP5 D3DRS_WRAP5 +#define D3DRENDERSTATE_WRAP6 D3DRS_WRAP6 +#define D3DRENDERSTATE_WRAP7 D3DRS_WRAP7 +#define D3DRENDERSTATE_CLIPPING D3DRS_CLIPPING +#define D3DRENDERSTATE_LIGHTING D3DRS_LIGHTING +#define D3DRENDERSTATE_EXTENTS D3DRS_EXTENTS +#define D3DRENDERSTATE_AMBIENT D3DRS_AMBIENT +#define D3DRENDERSTATE_FOGVERTEXMODE D3DRS_FOGVERTEXMODE +#define D3DRENDERSTATE_COLORVERTEX D3DRS_COLORVERTEX +#define D3DRENDERSTATE_LOCALVIEWER D3DRS_LOCALVIEWER +#define D3DRENDERSTATE_NORMALIZENORMALS D3DRS_NORMALIZENORMALS +#define D3DRENDERSTATE_DIFFUSEMATERIALSOURCE D3DRS_DIFFUSEMATERIALSOURCE +#define D3DRENDERSTATE_SPECULARMATERIALSOURCE D3DRS_SPECULARMATERIALSOURCE +#define D3DRENDERSTATE_AMBIENTMATERIALSOURCE D3DRS_AMBIENTMATERIALSOURCE +#define D3DRENDERSTATE_EMISSIVEMATERIALSOURCE D3DRS_EMISSIVEMATERIALSOURCE +#define D3DRENDERSTATE_VERTEXBLEND D3DRS_VERTEXBLEND +#define D3DRENDERSTATE_CLIPPLANEENABLE D3DRS_CLIPPLANEENABLE + +#define RGBA_MAKE D3DCOLOR_RGBA +#define RGB_MAKE D3DCOLOR_XRGB +#define D3DRGBA D3DCOLOR_COLORVALUE +#define D3DRGB(_r,_g,_b) D3DCOLOR_COLORVALUE(_r,_g,_b,1.f) + +#define _DX7TODX8_H_ +#endif //_DX7TODX8_H_ diff --git a/saco/d3d9/include/dxdiag.h b/saco/d3d9/include/dxdiag.h new file mode 100644 index 0000000..602c88f --- /dev/null +++ b/saco/d3d9/include/dxdiag.h @@ -0,0 +1,187 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: dxdiag.h + * Content: DirectX Diagnostic Tool include file + * + ****************************************************************************/ + +#ifndef _DXDIAG_H_ +#define _DXDIAG_H_ + +#include // for DECLARE_INTERFACE_ and HRESULT + +// This identifier is passed to IDxDiagProvider::Initialize in order to ensure that an +// application was built against the correct header files. This number is +// incremented whenever a header (or other) change would require applications +// to be rebuilt. If the version doesn't match, IDxDiagProvider::Initialize will fail. +// (The number itself has no meaning.) +#define DXDIAG_DX9_SDK_VERSION 111 + +#ifdef __cplusplus +extern "C" { +#endif + + +/**************************************************************************** + * + * DxDiag Errors + * + ****************************************************************************/ +#define DXDIAG_E_INSUFFICIENT_BUFFER ((HRESULT)0x8007007AL) // HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) + + +/**************************************************************************** + * + * DxDiag CLSIDs + * + ****************************************************************************/ + +// {A65B8071-3BFE-4213-9A5B-491DA4461CA7} +DEFINE_GUID(CLSID_DxDiagProvider, +0xA65B8071, 0x3BFE, 0x4213, 0x9A, 0x5B, 0x49, 0x1D, 0xA4, 0x46, 0x1C, 0xA7); + + +/**************************************************************************** + * + * DxDiag Interface IIDs + * + ****************************************************************************/ + +// {9C6B4CB0-23F8-49CC-A3ED-45A55000A6D2} +DEFINE_GUID(IID_IDxDiagProvider, +0x9C6B4CB0, 0x23F8, 0x49CC, 0xA3, 0xED, 0x45, 0xA5, 0x50, 0x00, 0xA6, 0xD2); + +// {0x7D0F462F-0x4064-0x4862-BC7F-933E5058C10F} +DEFINE_GUID(IID_IDxDiagContainer, +0x7D0F462F, 0x4064, 0x4862, 0xBC, 0x7F, 0x93, 0x3E, 0x50, 0x58, 0xC1, 0x0F); + + +/**************************************************************************** + * + * DxDiag Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDxDiagProvider *LPDXDIAGPROVIDER, *PDXDIAGPROVIDER; + +typedef struct IDxDiagContainer *LPDXDIAGCONTAINER, *PDXDIAGCONTAINER; + + +/**************************************************************************** + * + * DxDiag Structures + * + ****************************************************************************/ + +typedef struct _DXDIAG_INIT_PARAMS +{ + DWORD dwSize; // Size of this structure. + DWORD dwDxDiagHeaderVersion; // Pass in DXDIAG_DX9_SDK_VERSION. This verifies + // the header and dll are correctly matched. + BOOL bAllowWHQLChecks; // If true, allow dxdiag to check if drivers are + // digital signed as logo'd by WHQL which may + // connect via internet to update WHQL certificates. + VOID* pReserved; // Reserved. Must be NULL. +} DXDIAG_INIT_PARAMS; + + +/**************************************************************************** + * + * DxDiag Application Interfaces + * + ****************************************************************************/ + +// +// COM definition for IDxDiagProvider +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDxDiagProvider +DECLARE_INTERFACE_(IDxDiagProvider,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDxDiagProvider methods ***/ + STDMETHOD(Initialize) (THIS_ DXDIAG_INIT_PARAMS* pParams) PURE; + STDMETHOD(GetRootContainer) (THIS_ IDxDiagContainer **ppInstance) PURE; +}; + + +// +// COM definition for IDxDiagContainer +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDxDiagContainer +DECLARE_INTERFACE_(IDxDiagContainer,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDxDiagContainer methods ***/ + STDMETHOD(GetNumberOfChildContainers) (THIS_ DWORD *pdwCount) PURE; + STDMETHOD(EnumChildContainerNames) (THIS_ DWORD dwIndex, LPWSTR pwszContainer, DWORD cchContainer) PURE; + STDMETHOD(GetChildContainer) (THIS_ LPCWSTR pwszContainer, IDxDiagContainer **ppInstance) PURE; + STDMETHOD(GetNumberOfProps) (THIS_ DWORD *pdwCount) PURE; + STDMETHOD(EnumPropNames) (THIS_ DWORD dwIndex, LPWSTR pwszPropName, DWORD cchPropName) PURE; + STDMETHOD(GetProp) (THIS_ LPCWSTR pwszPropName, VARIANT *pvarProp) PURE; +}; + + +/**************************************************************************** + * + * DxDiag application interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDxDiagProvider_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDxDiagProvider_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDxDiagProvider_Release(p) (p)->lpVtbl->Release(p) +#define IDxDiagProvider_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDxDiagProvider_GetRootContainer(p,a) (p)->lpVtbl->GetRootContainer(p,a) + +#define IDxDiagContainer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDxDiagContainer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDxDiagContainer_Release(p) (p)->lpVtbl->Release(p) +#define IDxDiagContainer_GetNumberOfChildContainers(p,a) (p)->lpVtbl->GetNumberOfChildContainers(p,a) +#define IDxDiagContainer_EnumChildContainerNames(p,a,b,c) (p)->lpVtbl->EnumChildContainerNames(p,a,b,c) +#define IDxDiagContainer_GetChildContainer(p,a,b) (p)->lpVtbl->GetChildContainer(p,a,b) +#define IDxDiagContainer_GetNumberOfProps(p,a) (p)->lpVtbl->GetNumberOfProps(p,a) +#define IDxDiagContainer_EnumProps(p,a,b) (p)->lpVtbl->EnumProps(p,a,b,c) +#define IDxDiagContainer_GetProp(p,a,b) (p)->lpVtbl->GetProp(p,a,b) + +#else /* C++ */ + +#define IDxDiagProvider_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b) +#define IDxDiagProvider_AddRef(p) (p)->AddRef(p) +#define IDxDiagProvider_Release(p) (p)->Release(p) +#define IDxDiagProvider_Initialize(p,a,b) (p)->Initialize(p,a,b) +#define IDxDiagProvider_GetRootContainer(p,a) (p)->GetRootContainer(p,a) + +#define IDxDiagContainer_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b) +#define IDxDiagContainer_AddRef(p) (p)->AddRef(p) +#define IDxDiagContainer_Release(p) (p)->Release(p) +#define IDxDiagContainer_GetNumberOfChildContainers(p,a) (p)->GetNumberOfChildContainers(p,a) +#define IDxDiagContainer_EnumChildContainerNames(p,a,b,c) (p)->EnumChildContainerNames(p,a,b,c) +#define IDxDiagContainer_GetChildContainer(p,a,b) (p)->GetChildContainer(p,a,b) +#define IDxDiagContainer_GetNumberOfProps(p,a) (p)->GetNumberOfProps(p,a) +#define IDxDiagContainer_EnumProps(p,a,b) (p)->EnumProps(p,a,b,c) +#define IDxDiagContainer_GetProp(p,a,b) (p)->GetProp(p,a,b) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _DXDIAG_H_ */ + + diff --git a/saco/d3d9/include/dxerr8.h b/saco/d3d9/include/dxerr8.h new file mode 100644 index 0000000..4f4d848 --- /dev/null +++ b/saco/d3d9/include/dxerr8.h @@ -0,0 +1,99 @@ +/*==========================================================================; + * + * + * File: dxerr8.h + * Content: DirectX Error Library Include File + * + ****************************************************************************/ + +#ifndef _DXERR8_H_ +#define _DXERR8_H_ + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +// +// DXGetErrorString8 +// +// Desc: Converts a DirectX HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: Converted string +// +const char* WINAPI DXGetErrorString8A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorString8W(HRESULT hr); + +#ifdef UNICODE +#define DXGetErrorString8 DXGetErrorString8W +#else +#define DXGetErrorString8 DXGetErrorString8A +#endif + + +// +// DXGetErrorDescription8 +// +// Desc: Returns a string description of a DirectX HRESULT +// +// Args: HRESULT hr Can be any error code from +// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: String description +// +const char* WINAPI DXGetErrorDescription8A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorDescription8W(HRESULT hr); + +#ifdef UNICODE + #define DXGetErrorDescription8 DXGetErrorDescription8W +#else + #define DXGetErrorDescription8 DXGetErrorDescription8A +#endif + + +// +// DXTrace +// +// Desc: Outputs a formatted error message to the debug stream +// +// Args: CHAR* strFile The current file, typically passed in using the +// __FILE__ macro. +// DWORD dwLine The current line number, typically passed in using the +// __LINE__ macro. +// HRESULT hr An HRESULT that will be traced to the debug stream. +// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) +// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. +// +// Return: The hr that was passed in. +// +HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox ); +HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox ); + +#ifdef UNICODE +#define DXTrace DXTraceW +#else +#define DXTrace DXTraceA +#endif + + +// +// Helper macros +// +#if defined(DEBUG) | defined(_DEBUG) +#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) +#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) +#define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#else +#define DXTRACE_MSG(str) (0L) +#define DXTRACE_ERR(str,hr) (hr) +#define DXTRACE_ERR_NOMSGBOX(str,hr) (hr) +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _DXERR8_H_ diff --git a/saco/d3d9/include/dxerr9.h b/saco/d3d9/include/dxerr9.h new file mode 100644 index 0000000..baf6968 --- /dev/null +++ b/saco/d3d9/include/dxerr9.h @@ -0,0 +1,99 @@ +/*==========================================================================; + * + * + * File: dxerr9.h + * Content: DirectX Error Library Include File + * + ****************************************************************************/ + +#ifndef _DXERR9_H_ +#define _DXERR9_H_ + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +// +// DXGetErrorString9 +// +// Desc: Converts a DirectX 9 or earlier HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: Converted string +// +const char* WINAPI DXGetErrorString9A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorString9W(HRESULT hr); + +#ifdef UNICODE +#define DXGetErrorString9 DXGetErrorString9W +#else +#define DXGetErrorString9 DXGetErrorString9A +#endif + + +// +// DXGetErrorDescription9 +// +// Desc: Returns a string description of a DirectX 9 or earlier HRESULT +// +// Args: HRESULT hr Can be any error code from +// D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: String description +// +const char* WINAPI DXGetErrorDescription9A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorDescription9W(HRESULT hr); + +#ifdef UNICODE + #define DXGetErrorDescription9 DXGetErrorDescription9W +#else + #define DXGetErrorDescription9 DXGetErrorDescription9A +#endif + + +// +// DXTrace +// +// Desc: Outputs a formatted error message to the debug stream +// +// Args: CHAR* strFile The current file, typically passed in using the +// __FILE__ macro. +// DWORD dwLine The current line number, typically passed in using the +// __LINE__ macro. +// HRESULT hr An HRESULT that will be traced to the debug stream. +// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) +// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. +// +// Return: The hr that was passed in. +// +HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox ); +HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox ); + +#ifdef UNICODE +#define DXTrace DXTraceW +#else +#define DXTrace DXTraceA +#endif + + +// +// Helper macros +// +#if defined(DEBUG) | defined(_DEBUG) +#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) +#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) +#else +#define DXTRACE_MSG(str) (0L) +#define DXTRACE_ERR(str,hr) (hr) +#define DXTRACE_ERR_MSGBOX(str,hr) (hr) +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _DXERR9_H_ diff --git a/saco/d3d9/include/dxfile.h b/saco/d3d9/include/dxfile.h new file mode 100644 index 0000000..8b5995a --- /dev/null +++ b/saco/d3d9/include/dxfile.h @@ -0,0 +1,240 @@ +/*************************************************************************** + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: dxfile.h + * + * Content: DirectX File public header file + * + ***************************************************************************/ + +#ifndef __DXFILE_H__ +#define __DXFILE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef DWORD DXFILEFORMAT; + +#define DXFILEFORMAT_BINARY 0 +#define DXFILEFORMAT_TEXT 1 +#define DXFILEFORMAT_COMPRESSED 2 + +typedef DWORD DXFILELOADOPTIONS; + +#define DXFILELOAD_FROMFILE 0x00L +#define DXFILELOAD_FROMRESOURCE 0x01L +#define DXFILELOAD_FROMMEMORY 0x02L +#define DXFILELOAD_FROMSTREAM 0x04L +#define DXFILELOAD_FROMURL 0x08L + +typedef struct _DXFILELOADRESOURCE { + HMODULE hModule; + LPCTSTR lpName; + LPCTSTR lpType; +}DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE; + +typedef struct _DXFILELOADMEMORY { + LPVOID lpMemory; + DWORD dSize; +}DXFILELOADMEMORY, *LPDXFILELOADMEMORY; + +/* + * DirectX File object types. + */ + +#ifndef WIN_TYPES +#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype +#endif + +WIN_TYPES(IDirectXFile, DIRECTXFILE); +WIN_TYPES(IDirectXFileEnumObject, DIRECTXFILEENUMOBJECT); +WIN_TYPES(IDirectXFileSaveObject, DIRECTXFILESAVEOBJECT); +WIN_TYPES(IDirectXFileObject, DIRECTXFILEOBJECT); +WIN_TYPES(IDirectXFileData, DIRECTXFILEDATA); +WIN_TYPES(IDirectXFileDataReference, DIRECTXFILEDATAREFERENCE); +WIN_TYPES(IDirectXFileBinary, DIRECTXFILEBINARY); + +/* + * API for creating IDirectXFile interface. + */ + +STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile); + +/* + * The methods for IUnknown + */ + +#define IUNKNOWN_METHODS(kind) \ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD_(ULONG, AddRef) (THIS) kind; \ + STDMETHOD_(ULONG, Release) (THIS) kind + +/* + * The methods for IDirectXFileObject + */ + +#define IDIRECTXFILEOBJECT_METHODS(kind) \ + STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \ + STDMETHOD(GetId) (THIS_ LPGUID) kind + +/* + * DirectX File interfaces. + */ + +#undef INTERFACE +#define INTERFACE IDirectXFile + +DECLARE_INTERFACE_(IDirectXFile, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS, + LPDIRECTXFILEENUMOBJECT *) PURE; + STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT, + LPDIRECTXFILESAVEOBJECT *) PURE; + STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileEnumObject + +DECLARE_INTERFACE_(IDirectXFileEnumObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(GetNextDataObject) (THIS_ LPDIRECTXFILEDATA *) PURE; + STDMETHOD(GetDataObjectById) (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE; + STDMETHOD(GetDataObjectByName) (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileSaveObject + +DECLARE_INTERFACE_(IDirectXFileSaveObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE; + STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *, + DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE; + STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirectXFileObject + +DECLARE_INTERFACE_(IDirectXFileObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileData + +DECLARE_INTERFACE_(IDirectXFileData, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(GetData) (THIS_ LPCSTR, DWORD *, void **) PURE; + STDMETHOD(GetType) (THIS_ const GUID **) PURE; + STDMETHOD(GetNextObject) (THIS_ LPDIRECTXFILEOBJECT *) PURE; + STDMETHOD(AddDataObject) (THIS_ LPDIRECTXFILEDATA) PURE; + STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE; + STDMETHOD(AddBinaryObject) (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileDataReference + +DECLARE_INTERFACE_(IDirectXFileDataReference, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileBinary + +DECLARE_INTERFACE_(IDirectXFileBinary, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(GetSize) (THIS_ DWORD *) PURE; + STDMETHOD(GetMimeType) (THIS_ LPCSTR *) PURE; + STDMETHOD(Read) (THIS_ LPVOID, DWORD, LPDWORD) PURE; +}; + +/* + * DirectXFile Object Class Id (for CoCreateInstance()) + */ + +DEFINE_GUID(CLSID_CDirectXFile, 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); + +/* + * DirectX File Interface GUIDs. + */ + +DEFINE_GUID(IID_IDirectXFile, 0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileEnumObject, 0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileSaveObject, 0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileObject, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileData, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileDataReference, 0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileBinary, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* + * DirectX File Header template's GUID. + */ + +DEFINE_GUID(TID_DXFILEHeader, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + + +/* + * DirectX File errors. + */ + +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +#define DXFILE_OK 0 + +#define DXFILEERR_BADOBJECT MAKE_DDHRESULT(850) +#define DXFILEERR_BADVALUE MAKE_DDHRESULT(851) +#define DXFILEERR_BADTYPE MAKE_DDHRESULT(852) +#define DXFILEERR_BADSTREAMHANDLE MAKE_DDHRESULT(853) +#define DXFILEERR_BADALLOC MAKE_DDHRESULT(854) +#define DXFILEERR_NOTFOUND MAKE_DDHRESULT(855) +#define DXFILEERR_NOTDONEYET MAKE_DDHRESULT(856) +#define DXFILEERR_FILENOTFOUND MAKE_DDHRESULT(857) +#define DXFILEERR_RESOURCENOTFOUND MAKE_DDHRESULT(858) +#define DXFILEERR_URLNOTFOUND MAKE_DDHRESULT(859) +#define DXFILEERR_BADRESOURCE MAKE_DDHRESULT(860) +#define DXFILEERR_BADFILETYPE MAKE_DDHRESULT(861) +#define DXFILEERR_BADFILEVERSION MAKE_DDHRESULT(862) +#define DXFILEERR_BADFILEFLOATSIZE MAKE_DDHRESULT(863) +#define DXFILEERR_BADFILECOMPRESSIONTYPE MAKE_DDHRESULT(864) +#define DXFILEERR_BADFILE MAKE_DDHRESULT(865) +#define DXFILEERR_PARSEERROR MAKE_DDHRESULT(866) +#define DXFILEERR_NOTEMPLATE MAKE_DDHRESULT(867) +#define DXFILEERR_BADARRAYSIZE MAKE_DDHRESULT(868) +#define DXFILEERR_BADDATAREFERENCE MAKE_DDHRESULT(869) +#define DXFILEERR_INTERNALERROR MAKE_DDHRESULT(870) +#define DXFILEERR_NOMOREOBJECTS MAKE_DDHRESULT(871) +#define DXFILEERR_BADINTRINSICS MAKE_DDHRESULT(872) +#define DXFILEERR_NOMORESTREAMHANDLES MAKE_DDHRESULT(873) +#define DXFILEERR_NOMOREDATA MAKE_DDHRESULT(874) +#define DXFILEERR_BADCACHEFILE MAKE_DDHRESULT(875) +#define DXFILEERR_NOINTERNET MAKE_DDHRESULT(876) + + +#ifdef __cplusplus +}; +#endif + +#endif /* _DXFILE_H_ */ + \ No newline at end of file diff --git a/saco/d3d9/include/dxsdkver.h b/saco/d3d9/include/dxsdkver.h new file mode 100644 index 0000000..d7c9a93 --- /dev/null +++ b/saco/d3d9/include/dxsdkver.h @@ -0,0 +1,18 @@ +/*==========================================================================; + * + * + * File: dxsdkver.h + * Content: DirectX SDK Version Include File + * + ****************************************************************************/ + +#ifndef _DXSDKVER_H_ +#define _DXSDKVER_H_ + +#define _DXSDK_PRODUCT_MAJOR 9 +#define _DXSDK_PRODUCT_MINOR 06 +#define _DXSDK_BUILD_MAJOR 168 +#define _DXSDK_BUILD_MINOR 0000 + +#endif // _DXSDKVER_H_ + diff --git a/saco/d3d9/include/dxtrans.h b/saco/d3d9/include/dxtrans.h new file mode 100644 index 0000000..8df2ff7 --- /dev/null +++ b/saco/d3d9/include/dxtrans.h @@ -0,0 +1,5362 @@ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 6.00.0357 */ +/* Compiler settings for dxtrans.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __dxtrans_h__ +#define __dxtrans_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IDXBaseObject_FWD_DEFINED__ +#define __IDXBaseObject_FWD_DEFINED__ +typedef interface IDXBaseObject IDXBaseObject; +#endif /* __IDXBaseObject_FWD_DEFINED__ */ + + +#ifndef __IDXTransformFactory_FWD_DEFINED__ +#define __IDXTransformFactory_FWD_DEFINED__ +typedef interface IDXTransformFactory IDXTransformFactory; +#endif /* __IDXTransformFactory_FWD_DEFINED__ */ + + +#ifndef __IDXTransform_FWD_DEFINED__ +#define __IDXTransform_FWD_DEFINED__ +typedef interface IDXTransform IDXTransform; +#endif /* __IDXTransform_FWD_DEFINED__ */ + + +#ifndef __IDXSurfacePick_FWD_DEFINED__ +#define __IDXSurfacePick_FWD_DEFINED__ +typedef interface IDXSurfacePick IDXSurfacePick; +#endif /* __IDXSurfacePick_FWD_DEFINED__ */ + + +#ifndef __IDXTBindHost_FWD_DEFINED__ +#define __IDXTBindHost_FWD_DEFINED__ +typedef interface IDXTBindHost IDXTBindHost; +#endif /* __IDXTBindHost_FWD_DEFINED__ */ + + +#ifndef __IDXTaskManager_FWD_DEFINED__ +#define __IDXTaskManager_FWD_DEFINED__ +typedef interface IDXTaskManager IDXTaskManager; +#endif /* __IDXTaskManager_FWD_DEFINED__ */ + + +#ifndef __IDXSurfaceFactory_FWD_DEFINED__ +#define __IDXSurfaceFactory_FWD_DEFINED__ +typedef interface IDXSurfaceFactory IDXSurfaceFactory; +#endif /* __IDXSurfaceFactory_FWD_DEFINED__ */ + + +#ifndef __IDXSurfaceModifier_FWD_DEFINED__ +#define __IDXSurfaceModifier_FWD_DEFINED__ +typedef interface IDXSurfaceModifier IDXSurfaceModifier; +#endif /* __IDXSurfaceModifier_FWD_DEFINED__ */ + + +#ifndef __IDXSurface_FWD_DEFINED__ +#define __IDXSurface_FWD_DEFINED__ +typedef interface IDXSurface IDXSurface; +#endif /* __IDXSurface_FWD_DEFINED__ */ + + +#ifndef __IDXSurfaceInit_FWD_DEFINED__ +#define __IDXSurfaceInit_FWD_DEFINED__ +typedef interface IDXSurfaceInit IDXSurfaceInit; +#endif /* __IDXSurfaceInit_FWD_DEFINED__ */ + + +#ifndef __IDXARGBSurfaceInit_FWD_DEFINED__ +#define __IDXARGBSurfaceInit_FWD_DEFINED__ +typedef interface IDXARGBSurfaceInit IDXARGBSurfaceInit; +#endif /* __IDXARGBSurfaceInit_FWD_DEFINED__ */ + + +#ifndef __IDXARGBReadPtr_FWD_DEFINED__ +#define __IDXARGBReadPtr_FWD_DEFINED__ +typedef interface IDXARGBReadPtr IDXARGBReadPtr; +#endif /* __IDXARGBReadPtr_FWD_DEFINED__ */ + + +#ifndef __IDXARGBReadWritePtr_FWD_DEFINED__ +#define __IDXARGBReadWritePtr_FWD_DEFINED__ +typedef interface IDXARGBReadWritePtr IDXARGBReadWritePtr; +#endif /* __IDXARGBReadWritePtr_FWD_DEFINED__ */ + + +#ifndef __IDXDCLock_FWD_DEFINED__ +#define __IDXDCLock_FWD_DEFINED__ +typedef interface IDXDCLock IDXDCLock; +#endif /* __IDXDCLock_FWD_DEFINED__ */ + + +#ifndef __IDXTScaleOutput_FWD_DEFINED__ +#define __IDXTScaleOutput_FWD_DEFINED__ +typedef interface IDXTScaleOutput IDXTScaleOutput; +#endif /* __IDXTScaleOutput_FWD_DEFINED__ */ + + +#ifndef __IDXGradient_FWD_DEFINED__ +#define __IDXGradient_FWD_DEFINED__ +typedef interface IDXGradient IDXGradient; +#endif /* __IDXGradient_FWD_DEFINED__ */ + + +#ifndef __IDXTScale_FWD_DEFINED__ +#define __IDXTScale_FWD_DEFINED__ +typedef interface IDXTScale IDXTScale; +#endif /* __IDXTScale_FWD_DEFINED__ */ + + +#ifndef __IDXEffect_FWD_DEFINED__ +#define __IDXEffect_FWD_DEFINED__ +typedef interface IDXEffect IDXEffect; +#endif /* __IDXEffect_FWD_DEFINED__ */ + + +#ifndef __IDXLookupTable_FWD_DEFINED__ +#define __IDXLookupTable_FWD_DEFINED__ +typedef interface IDXLookupTable IDXLookupTable; +#endif /* __IDXLookupTable_FWD_DEFINED__ */ + + +#ifndef __IDXRawSurface_FWD_DEFINED__ +#define __IDXRawSurface_FWD_DEFINED__ +typedef interface IDXRawSurface IDXRawSurface; +#endif /* __IDXRawSurface_FWD_DEFINED__ */ + + +#ifndef __IHTMLDXTransform_FWD_DEFINED__ +#define __IHTMLDXTransform_FWD_DEFINED__ +typedef interface IHTMLDXTransform IHTMLDXTransform; +#endif /* __IHTMLDXTransform_FWD_DEFINED__ */ + + +#ifndef __ICSSFilterDispatch_FWD_DEFINED__ +#define __ICSSFilterDispatch_FWD_DEFINED__ +typedef interface ICSSFilterDispatch ICSSFilterDispatch; +#endif /* __ICSSFilterDispatch_FWD_DEFINED__ */ + + +#ifndef __DXTransformFactory_FWD_DEFINED__ +#define __DXTransformFactory_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXTransformFactory DXTransformFactory; +#else +typedef struct DXTransformFactory DXTransformFactory; +#endif /* __cplusplus */ + +#endif /* __DXTransformFactory_FWD_DEFINED__ */ + + +#ifndef __DXTaskManager_FWD_DEFINED__ +#define __DXTaskManager_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXTaskManager DXTaskManager; +#else +typedef struct DXTaskManager DXTaskManager; +#endif /* __cplusplus */ + +#endif /* __DXTaskManager_FWD_DEFINED__ */ + + +#ifndef __DXTScale_FWD_DEFINED__ +#define __DXTScale_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXTScale DXTScale; +#else +typedef struct DXTScale DXTScale; +#endif /* __cplusplus */ + +#endif /* __DXTScale_FWD_DEFINED__ */ + + +#ifndef __DXSurface_FWD_DEFINED__ +#define __DXSurface_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXSurface DXSurface; +#else +typedef struct DXSurface DXSurface; +#endif /* __cplusplus */ + +#endif /* __DXSurface_FWD_DEFINED__ */ + + +#ifndef __DXSurfaceModifier_FWD_DEFINED__ +#define __DXSurfaceModifier_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXSurfaceModifier DXSurfaceModifier; +#else +typedef struct DXSurfaceModifier DXSurfaceModifier; +#endif /* __cplusplus */ + +#endif /* __DXSurfaceModifier_FWD_DEFINED__ */ + + +#ifndef __DXGradient_FWD_DEFINED__ +#define __DXGradient_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXGradient DXGradient; +#else +typedef struct DXGradient DXGradient; +#endif /* __cplusplus */ + +#endif /* __DXGradient_FWD_DEFINED__ */ + + +#ifndef __DXTFilter_FWD_DEFINED__ +#define __DXTFilter_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXTFilter DXTFilter; +#else +typedef struct DXTFilter DXTFilter; +#endif /* __cplusplus */ + +#endif /* __DXTFilter_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "comcat.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +void * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void * ); + +/* interface __MIDL_itf_dxtrans_0000 */ +/* [local] */ + +#include +#include +#include +#include +#include +#if 0 +// Bogus definition used to make MIDL compiler happy +typedef void DDSURFACEDESC; + +typedef void D3DRMBOX; + +typedef void D3DVECTOR; + +typedef void D3DRMMATRIX4D; + +typedef void *LPSECURITY_ATTRIBUTES; + +#endif +#ifdef _DXTRANSIMPL + #define _DXTRANS_IMPL_EXT _declspec(dllexport) +#else + #define _DXTRANS_IMPL_EXT _declspec(dllimport) +#endif + + + + + + + + + + + + + + + + +// +// All GUIDs for DXTransform are declared in DXTGUID.C in the SDK include directory +// +EXTERN_C const GUID DDPF_RGB1; +EXTERN_C const GUID DDPF_RGB2; +EXTERN_C const GUID DDPF_RGB4; +EXTERN_C const GUID DDPF_RGB8; +EXTERN_C const GUID DDPF_RGB332; +EXTERN_C const GUID DDPF_ARGB4444; +EXTERN_C const GUID DDPF_RGB565; +EXTERN_C const GUID DDPF_BGR565; +EXTERN_C const GUID DDPF_RGB555; +EXTERN_C const GUID DDPF_ARGB1555; +EXTERN_C const GUID DDPF_RGB24; +EXTERN_C const GUID DDPF_BGR24; +EXTERN_C const GUID DDPF_RGB32; +EXTERN_C const GUID DDPF_BGR32; +EXTERN_C const GUID DDPF_ABGR32; +EXTERN_C const GUID DDPF_ARGB32; +EXTERN_C const GUID DDPF_PMARGB32; +EXTERN_C const GUID DDPF_A1; +EXTERN_C const GUID DDPF_A2; +EXTERN_C const GUID DDPF_A4; +EXTERN_C const GUID DDPF_A8; +EXTERN_C const GUID DDPF_Z8; +EXTERN_C const GUID DDPF_Z16; +EXTERN_C const GUID DDPF_Z24; +EXTERN_C const GUID DDPF_Z32; +// +// Component categories +// +EXTERN_C const GUID CATID_DXImageTransform; +EXTERN_C const GUID CATID_DX3DTransform; +EXTERN_C const GUID CATID_DXAuthoringTransform; +EXTERN_C const GUID CATID_DXSurface; +// +// Service IDs +// +EXTERN_C const GUID SID_SDirectDraw; +EXTERN_C const GUID SID_SDirect3DRM; +#define SID_SDXTaskManager CLSID_DXTaskManager +#define SID_SDXSurfaceFactory IID_IDXSurfaceFactory +#define SID_SDXTransformFactory IID_IDXTransformFactory +// +// DXTransforms Core Type Library Version Info +// +#define DXTRANS_TLB_MAJOR_VER 1 +#define DXTRANS_TLB_MINOR_VER 1 + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0000_v0_0_s_ifspec; + +#ifndef __IDXBaseObject_INTERFACE_DEFINED__ +#define __IDXBaseObject_INTERFACE_DEFINED__ + +/* interface IDXBaseObject */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXBaseObject; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("17B59B2B-9CC8-11d1-9053-00C04FD9189D") + IDXBaseObject : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetGenerationId( + /* [out] */ ULONG *pID) = 0; + + virtual HRESULT STDMETHODCALLTYPE IncrementGenerationId( + /* [in] */ BOOL bRefresh) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetObjectSize( + /* [out] */ ULONG *pcbSize) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXBaseObjectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXBaseObject * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXBaseObject * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXBaseObject * This); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationId )( + IDXBaseObject * This, + /* [out] */ ULONG *pID); + + HRESULT ( STDMETHODCALLTYPE *IncrementGenerationId )( + IDXBaseObject * This, + /* [in] */ BOOL bRefresh); + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + IDXBaseObject * This, + /* [out] */ ULONG *pcbSize); + + END_INTERFACE + } IDXBaseObjectVtbl; + + interface IDXBaseObject + { + CONST_VTBL struct IDXBaseObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXBaseObject_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXBaseObject_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXBaseObject_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXBaseObject_GetGenerationId(This,pID) \ + (This)->lpVtbl -> GetGenerationId(This,pID) + +#define IDXBaseObject_IncrementGenerationId(This,bRefresh) \ + (This)->lpVtbl -> IncrementGenerationId(This,bRefresh) + +#define IDXBaseObject_GetObjectSize(This,pcbSize) \ + (This)->lpVtbl -> GetObjectSize(This,pcbSize) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXBaseObject_GetGenerationId_Proxy( + IDXBaseObject * This, + /* [out] */ ULONG *pID); + + +void __RPC_STUB IDXBaseObject_GetGenerationId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXBaseObject_IncrementGenerationId_Proxy( + IDXBaseObject * This, + /* [in] */ BOOL bRefresh); + + +void __RPC_STUB IDXBaseObject_IncrementGenerationId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXBaseObject_GetObjectSize_Proxy( + IDXBaseObject * This, + /* [out] */ ULONG *pcbSize); + + +void __RPC_STUB IDXBaseObject_GetObjectSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXBaseObject_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0260 */ +/* [local] */ + +typedef +enum DXBNDID + { DXB_X = 0, + DXB_Y = 1, + DXB_Z = 2, + DXB_T = 3 + } DXBNDID; + +typedef +enum DXBNDTYPE + { DXBT_DISCRETE = 0, + DXBT_DISCRETE64 = DXBT_DISCRETE + 1, + DXBT_CONTINUOUS = DXBT_DISCRETE64 + 1, + DXBT_CONTINUOUS64 = DXBT_CONTINUOUS + 1 + } DXBNDTYPE; + +typedef struct DXDBND + { + long Min; + long Max; + } DXDBND; + +typedef DXDBND DXDBNDS[ 4 ]; + +typedef struct DXDBND64 + { + LONGLONG Min; + LONGLONG Max; + } DXDBND64; + +typedef DXDBND64 DXDBNDS64[ 4 ]; + +typedef struct DXCBND + { + float Min; + float Max; + } DXCBND; + +typedef DXCBND DXCBNDS[ 4 ]; + +typedef struct DXCBND64 + { + double Min; + double Max; + } DXCBND64; + +typedef DXCBND64 DXCBNDS64[ 4 ]; + +typedef struct DXBNDS + { + DXBNDTYPE eType; + /* [switch_is] */ /* [switch_type] */ union __MIDL___MIDL_itf_dxtrans_0260_0001 + { + /* [case()] */ DXDBND D[ 4 ]; + /* [case()] */ DXDBND64 LD[ 4 ]; + /* [case()] */ DXCBND C[ 4 ]; + /* [case()] */ DXCBND64 LC[ 4 ]; + } u; + } DXBNDS; + +typedef long DXDVEC[ 4 ]; + +typedef LONGLONG DXDVEC64[ 4 ]; + +typedef float DXCVEC[ 4 ]; + +typedef double DXCVEC64[ 4 ]; + +typedef struct DXVEC + { + DXBNDTYPE eType; + /* [switch_is] */ /* [switch_type] */ union __MIDL___MIDL_itf_dxtrans_0260_0002 + { + /* [case()] */ long D[ 4 ]; + /* [case()] */ LONGLONG LD[ 4 ]; + /* [case()] */ float C[ 4 ]; + /* [case()] */ double LC[ 4 ]; + } u; + } DXVEC; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0260_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0260_v0_0_s_ifspec; + +#ifndef __IDXTransformFactory_INTERFACE_DEFINED__ +#define __IDXTransformFactory_INTERFACE_DEFINED__ + +/* interface IDXTransformFactory */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTransformFactory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6A950B2B-A971-11d1-81C8-0000F87557DB") + IDXTransformFactory : public IServiceProvider + { + public: + virtual HRESULT STDMETHODCALLTYPE SetService( + /* [in] */ REFGUID guidService, + /* [in] */ IUnknown *pUnkService, + /* [in] */ BOOL bWeakReference) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTransform( + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog, + /* [in] */ REFCLSID TransCLSID, + /* [in] */ REFIID TransIID, + /* [iid_is][out] */ void **ppTransform) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitializeTransform( + /* [in] */ IDXTransform *pTransform, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTransformFactoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTransformFactory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTransformFactory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTransformFactory * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *QueryService )( + IDXTransformFactory * This, + /* [in] */ REFGUID guidService, + /* [in] */ REFIID riid, + /* [out] */ void **ppvObject); + + HRESULT ( STDMETHODCALLTYPE *SetService )( + IDXTransformFactory * This, + /* [in] */ REFGUID guidService, + /* [in] */ IUnknown *pUnkService, + /* [in] */ BOOL bWeakReference); + + HRESULT ( STDMETHODCALLTYPE *CreateTransform )( + IDXTransformFactory * This, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog, + /* [in] */ REFCLSID TransCLSID, + /* [in] */ REFIID TransIID, + /* [iid_is][out] */ void **ppTransform); + + HRESULT ( STDMETHODCALLTYPE *InitializeTransform )( + IDXTransformFactory * This, + /* [in] */ IDXTransform *pTransform, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog); + + END_INTERFACE + } IDXTransformFactoryVtbl; + + interface IDXTransformFactory + { + CONST_VTBL struct IDXTransformFactoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTransformFactory_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTransformFactory_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTransformFactory_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTransformFactory_QueryService(This,guidService,riid,ppvObject) \ + (This)->lpVtbl -> QueryService(This,guidService,riid,ppvObject) + + +#define IDXTransformFactory_SetService(This,guidService,pUnkService,bWeakReference) \ + (This)->lpVtbl -> SetService(This,guidService,pUnkService,bWeakReference) + +#define IDXTransformFactory_CreateTransform(This,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,pInitProps,pErrLog,TransCLSID,TransIID,ppTransform) \ + (This)->lpVtbl -> CreateTransform(This,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,pInitProps,pErrLog,TransCLSID,TransIID,ppTransform) + +#define IDXTransformFactory_InitializeTransform(This,pTransform,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,pInitProps,pErrLog) \ + (This)->lpVtbl -> InitializeTransform(This,pTransform,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,pInitProps,pErrLog) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTransformFactory_SetService_Proxy( + IDXTransformFactory * This, + /* [in] */ REFGUID guidService, + /* [in] */ IUnknown *pUnkService, + /* [in] */ BOOL bWeakReference); + + +void __RPC_STUB IDXTransformFactory_SetService_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransformFactory_CreateTransform_Proxy( + IDXTransformFactory * This, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog, + /* [in] */ REFCLSID TransCLSID, + /* [in] */ REFIID TransIID, + /* [iid_is][out] */ void **ppTransform); + + +void __RPC_STUB IDXTransformFactory_CreateTransform_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransformFactory_InitializeTransform_Proxy( + IDXTransformFactory * This, + /* [in] */ IDXTransform *pTransform, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog); + + +void __RPC_STUB IDXTransformFactory_InitializeTransform_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTransformFactory_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0261 */ +/* [local] */ + +typedef +enum DXTMISCFLAGS + { DXTMF_BLEND_WITH_OUTPUT = 1L << 0, + DXTMF_DITHER_OUTPUT = 1L << 1, + DXTMF_OPTION_MASK = 0xffff, + DXTMF_VALID_OPTIONS = DXTMF_BLEND_WITH_OUTPUT | DXTMF_DITHER_OUTPUT, + DXTMF_BLEND_SUPPORTED = 1L << 16, + DXTMF_DITHER_SUPPORTED = 1L << 17, + DXTMF_INPLACE_OPERATION = 1L << 24, + DXTMF_BOUNDS_SUPPORTED = 1L << 25, + DXTMF_PLACEMENT_SUPPORTED = 1L << 26, + DXTMF_QUALITY_SUPPORTED = 1L << 27, + DXTMF_OPAQUE_RESULT = 1L << 28 + } DXTMISCFLAGS; + +typedef +enum DXINOUTINFOFLAGS + { DXINOUTF_OPTIONAL = 1L << 0 + } DXINOUTINFOFLAGS; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0261_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0261_v0_0_s_ifspec; + +#ifndef __IDXTransform_INTERFACE_DEFINED__ +#define __IDXTransform_INTERFACE_DEFINED__ + +/* interface IDXTransform */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTransform; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("30A5FB78-E11F-11d1-9064-00C04FD9189D") + IDXTransform : public IDXBaseObject + { + public: + virtual HRESULT STDMETHODCALLTYPE Setup( + /* [size_is][in] */ IUnknown *const *punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown *const *punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ DWORD dwFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE Execute( + /* [in] */ const GUID *pRequestID, + /* [in] */ const DXBNDS *pClipBnds, + /* [in] */ const DXVEC *pPlacement) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapBoundsIn2Out( + /* [in] */ const DXBNDS *pInBounds, + /* [in] */ ULONG ulNumInBnds, + /* [in] */ ULONG ulOutIndex, + /* [out] */ DXBNDS *pOutBounds) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapBoundsOut2In( + /* [in] */ ULONG ulOutIndex, + /* [in] */ const DXBNDS *pOutBounds, + /* [in] */ ULONG ulInIndex, + /* [out] */ DXBNDS *pInBounds) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetMiscFlags( + /* [in] */ DWORD dwMiscFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMiscFlags( + /* [out] */ DWORD *pdwMiscFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInOutInfo( + /* [in] */ BOOL bIsOutput, + /* [in] */ ULONG ulIndex, + /* [out] */ DWORD *pdwFlags, + /* [size_is][out] */ GUID *pIDs, + /* [out][in] */ ULONG *pcIDs, + /* [out] */ IUnknown **ppUnkCurrentObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetQuality( + /* [in] */ float fQuality) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetQuality( + /* [out] */ float *fQuality) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTransformVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTransform * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTransform * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTransform * This); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationId )( + IDXTransform * This, + /* [out] */ ULONG *pID); + + HRESULT ( STDMETHODCALLTYPE *IncrementGenerationId )( + IDXTransform * This, + /* [in] */ BOOL bRefresh); + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + IDXTransform * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *Setup )( + IDXTransform * This, + /* [size_is][in] */ IUnknown *const *punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown *const *punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ DWORD dwFlags); + + HRESULT ( STDMETHODCALLTYPE *Execute )( + IDXTransform * This, + /* [in] */ const GUID *pRequestID, + /* [in] */ const DXBNDS *pClipBnds, + /* [in] */ const DXVEC *pPlacement); + + HRESULT ( STDMETHODCALLTYPE *MapBoundsIn2Out )( + IDXTransform * This, + /* [in] */ const DXBNDS *pInBounds, + /* [in] */ ULONG ulNumInBnds, + /* [in] */ ULONG ulOutIndex, + /* [out] */ DXBNDS *pOutBounds); + + HRESULT ( STDMETHODCALLTYPE *MapBoundsOut2In )( + IDXTransform * This, + /* [in] */ ULONG ulOutIndex, + /* [in] */ const DXBNDS *pOutBounds, + /* [in] */ ULONG ulInIndex, + /* [out] */ DXBNDS *pInBounds); + + HRESULT ( STDMETHODCALLTYPE *SetMiscFlags )( + IDXTransform * This, + /* [in] */ DWORD dwMiscFlags); + + HRESULT ( STDMETHODCALLTYPE *GetMiscFlags )( + IDXTransform * This, + /* [out] */ DWORD *pdwMiscFlags); + + HRESULT ( STDMETHODCALLTYPE *GetInOutInfo )( + IDXTransform * This, + /* [in] */ BOOL bIsOutput, + /* [in] */ ULONG ulIndex, + /* [out] */ DWORD *pdwFlags, + /* [size_is][out] */ GUID *pIDs, + /* [out][in] */ ULONG *pcIDs, + /* [out] */ IUnknown **ppUnkCurrentObject); + + HRESULT ( STDMETHODCALLTYPE *SetQuality )( + IDXTransform * This, + /* [in] */ float fQuality); + + HRESULT ( STDMETHODCALLTYPE *GetQuality )( + IDXTransform * This, + /* [out] */ float *fQuality); + + END_INTERFACE + } IDXTransformVtbl; + + interface IDXTransform + { + CONST_VTBL struct IDXTransformVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTransform_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTransform_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTransform_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTransform_GetGenerationId(This,pID) \ + (This)->lpVtbl -> GetGenerationId(This,pID) + +#define IDXTransform_IncrementGenerationId(This,bRefresh) \ + (This)->lpVtbl -> IncrementGenerationId(This,bRefresh) + +#define IDXTransform_GetObjectSize(This,pcbSize) \ + (This)->lpVtbl -> GetObjectSize(This,pcbSize) + + +#define IDXTransform_Setup(This,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,dwFlags) \ + (This)->lpVtbl -> Setup(This,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,dwFlags) + +#define IDXTransform_Execute(This,pRequestID,pClipBnds,pPlacement) \ + (This)->lpVtbl -> Execute(This,pRequestID,pClipBnds,pPlacement) + +#define IDXTransform_MapBoundsIn2Out(This,pInBounds,ulNumInBnds,ulOutIndex,pOutBounds) \ + (This)->lpVtbl -> MapBoundsIn2Out(This,pInBounds,ulNumInBnds,ulOutIndex,pOutBounds) + +#define IDXTransform_MapBoundsOut2In(This,ulOutIndex,pOutBounds,ulInIndex,pInBounds) \ + (This)->lpVtbl -> MapBoundsOut2In(This,ulOutIndex,pOutBounds,ulInIndex,pInBounds) + +#define IDXTransform_SetMiscFlags(This,dwMiscFlags) \ + (This)->lpVtbl -> SetMiscFlags(This,dwMiscFlags) + +#define IDXTransform_GetMiscFlags(This,pdwMiscFlags) \ + (This)->lpVtbl -> GetMiscFlags(This,pdwMiscFlags) + +#define IDXTransform_GetInOutInfo(This,bIsOutput,ulIndex,pdwFlags,pIDs,pcIDs,ppUnkCurrentObject) \ + (This)->lpVtbl -> GetInOutInfo(This,bIsOutput,ulIndex,pdwFlags,pIDs,pcIDs,ppUnkCurrentObject) + +#define IDXTransform_SetQuality(This,fQuality) \ + (This)->lpVtbl -> SetQuality(This,fQuality) + +#define IDXTransform_GetQuality(This,fQuality) \ + (This)->lpVtbl -> GetQuality(This,fQuality) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTransform_Setup_Proxy( + IDXTransform * This, + /* [size_is][in] */ IUnknown *const *punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown *const *punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB IDXTransform_Setup_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_Execute_Proxy( + IDXTransform * This, + /* [in] */ const GUID *pRequestID, + /* [in] */ const DXBNDS *pClipBnds, + /* [in] */ const DXVEC *pPlacement); + + +void __RPC_STUB IDXTransform_Execute_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_MapBoundsIn2Out_Proxy( + IDXTransform * This, + /* [in] */ const DXBNDS *pInBounds, + /* [in] */ ULONG ulNumInBnds, + /* [in] */ ULONG ulOutIndex, + /* [out] */ DXBNDS *pOutBounds); + + +void __RPC_STUB IDXTransform_MapBoundsIn2Out_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_MapBoundsOut2In_Proxy( + IDXTransform * This, + /* [in] */ ULONG ulOutIndex, + /* [in] */ const DXBNDS *pOutBounds, + /* [in] */ ULONG ulInIndex, + /* [out] */ DXBNDS *pInBounds); + + +void __RPC_STUB IDXTransform_MapBoundsOut2In_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_SetMiscFlags_Proxy( + IDXTransform * This, + /* [in] */ DWORD dwMiscFlags); + + +void __RPC_STUB IDXTransform_SetMiscFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_GetMiscFlags_Proxy( + IDXTransform * This, + /* [out] */ DWORD *pdwMiscFlags); + + +void __RPC_STUB IDXTransform_GetMiscFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_GetInOutInfo_Proxy( + IDXTransform * This, + /* [in] */ BOOL bIsOutput, + /* [in] */ ULONG ulIndex, + /* [out] */ DWORD *pdwFlags, + /* [size_is][out] */ GUID *pIDs, + /* [out][in] */ ULONG *pcIDs, + /* [out] */ IUnknown **ppUnkCurrentObject); + + +void __RPC_STUB IDXTransform_GetInOutInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_SetQuality_Proxy( + IDXTransform * This, + /* [in] */ float fQuality); + + +void __RPC_STUB IDXTransform_SetQuality_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_GetQuality_Proxy( + IDXTransform * This, + /* [out] */ float *fQuality); + + +void __RPC_STUB IDXTransform_GetQuality_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTransform_INTERFACE_DEFINED__ */ + + +#ifndef __IDXSurfacePick_INTERFACE_DEFINED__ +#define __IDXSurfacePick_INTERFACE_DEFINED__ + +/* interface IDXSurfacePick */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurfacePick; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("30A5FB79-E11F-11d1-9064-00C04FD9189D") + IDXSurfacePick : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE PointPick( + /* [in] */ const DXVEC *pPoint, + /* [out] */ ULONG *pulInputSurfaceIndex, + /* [out] */ DXVEC *pInputPoint) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfacePickVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurfacePick * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurfacePick * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurfacePick * This); + + HRESULT ( STDMETHODCALLTYPE *PointPick )( + IDXSurfacePick * This, + /* [in] */ const DXVEC *pPoint, + /* [out] */ ULONG *pulInputSurfaceIndex, + /* [out] */ DXVEC *pInputPoint); + + END_INTERFACE + } IDXSurfacePickVtbl; + + interface IDXSurfacePick + { + CONST_VTBL struct IDXSurfacePickVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurfacePick_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurfacePick_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurfacePick_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurfacePick_PointPick(This,pPoint,pulInputSurfaceIndex,pInputPoint) \ + (This)->lpVtbl -> PointPick(This,pPoint,pulInputSurfaceIndex,pInputPoint) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurfacePick_PointPick_Proxy( + IDXSurfacePick * This, + /* [in] */ const DXVEC *pPoint, + /* [out] */ ULONG *pulInputSurfaceIndex, + /* [out] */ DXVEC *pInputPoint); + + +void __RPC_STUB IDXSurfacePick_PointPick_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurfacePick_INTERFACE_DEFINED__ */ + + +#ifndef __IDXTBindHost_INTERFACE_DEFINED__ +#define __IDXTBindHost_INTERFACE_DEFINED__ + +/* interface IDXTBindHost */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTBindHost; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D26BCE55-E9DC-11d1-9066-00C04FD9189D") + IDXTBindHost : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetBindHost( + /* [in] */ IBindHost *pBindHost) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTBindHostVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTBindHost * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTBindHost * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTBindHost * This); + + HRESULT ( STDMETHODCALLTYPE *SetBindHost )( + IDXTBindHost * This, + /* [in] */ IBindHost *pBindHost); + + END_INTERFACE + } IDXTBindHostVtbl; + + interface IDXTBindHost + { + CONST_VTBL struct IDXTBindHostVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTBindHost_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTBindHost_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTBindHost_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTBindHost_SetBindHost(This,pBindHost) \ + (This)->lpVtbl -> SetBindHost(This,pBindHost) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTBindHost_SetBindHost_Proxy( + IDXTBindHost * This, + /* [in] */ IBindHost *pBindHost); + + +void __RPC_STUB IDXTBindHost_SetBindHost_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTBindHost_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0264 */ +/* [local] */ + +typedef void __stdcall __stdcall DXTASKPROC( + void *pTaskData, + BOOL *pbContinueProcessing); + +typedef DXTASKPROC *PFNDXTASKPROC; + +typedef void __stdcall __stdcall DXAPCPROC( + DWORD dwData); + +typedef DXAPCPROC *PFNDXAPCPROC; + +#ifdef __cplusplus +typedef struct DXTMTASKINFO +{ + PFNDXTASKPROC pfnTaskProc; // Pointer to function to execute + PVOID pTaskData; // Pointer to argument data + PFNDXAPCPROC pfnCompletionAPC; // Pointer to completion APC proc + DWORD dwCompletionData; // Pointer to APC proc data + const GUID* pRequestID; // Used to identify groups of tasks +} DXTMTASKINFO; +#else +typedef struct DXTMTASKINFO + { + PVOID pfnTaskProc; + PVOID pTaskData; + PVOID pfnCompletionAPC; + DWORD dwCompletionData; + const GUID *pRequestID; + } DXTMTASKINFO; + +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0264_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0264_v0_0_s_ifspec; + +#ifndef __IDXTaskManager_INTERFACE_DEFINED__ +#define __IDXTaskManager_INTERFACE_DEFINED__ + +/* interface IDXTaskManager */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTaskManager; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("254DBBC1-F922-11d0-883A-3C8B00C10000") + IDXTaskManager : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE QueryNumProcessors( + /* [out] */ ULONG *pulNumProc) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetThreadPoolSize( + /* [in] */ ULONG ulNumThreads) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetThreadPoolSize( + /* [out] */ ULONG *pulNumThreads) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetConcurrencyLimit( + /* [in] */ ULONG ulNumThreads) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetConcurrencyLimit( + /* [out] */ ULONG *pulNumThreads) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleTasks( + /* [in] */ DXTMTASKINFO TaskInfo[ ], + /* [in] */ HANDLE Events[ ], + /* [out] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulNumTasks, + /* [in] */ ULONG ulWaitPeriod) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateTasks( + /* [in] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulCount, + /* [in] */ ULONG ulTimeOut) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateRequest( + /* [in] */ REFIID RequestID, + /* [in] */ ULONG ulTimeOut) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTaskManagerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTaskManager * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTaskManager * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTaskManager * This); + + HRESULT ( STDMETHODCALLTYPE *QueryNumProcessors )( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumProc); + + HRESULT ( STDMETHODCALLTYPE *SetThreadPoolSize )( + IDXTaskManager * This, + /* [in] */ ULONG ulNumThreads); + + HRESULT ( STDMETHODCALLTYPE *GetThreadPoolSize )( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumThreads); + + HRESULT ( STDMETHODCALLTYPE *SetConcurrencyLimit )( + IDXTaskManager * This, + /* [in] */ ULONG ulNumThreads); + + HRESULT ( STDMETHODCALLTYPE *GetConcurrencyLimit )( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumThreads); + + HRESULT ( STDMETHODCALLTYPE *ScheduleTasks )( + IDXTaskManager * This, + /* [in] */ DXTMTASKINFO TaskInfo[ ], + /* [in] */ HANDLE Events[ ], + /* [out] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulNumTasks, + /* [in] */ ULONG ulWaitPeriod); + + HRESULT ( STDMETHODCALLTYPE *TerminateTasks )( + IDXTaskManager * This, + /* [in] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulCount, + /* [in] */ ULONG ulTimeOut); + + HRESULT ( STDMETHODCALLTYPE *TerminateRequest )( + IDXTaskManager * This, + /* [in] */ REFIID RequestID, + /* [in] */ ULONG ulTimeOut); + + END_INTERFACE + } IDXTaskManagerVtbl; + + interface IDXTaskManager + { + CONST_VTBL struct IDXTaskManagerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTaskManager_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTaskManager_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTaskManager_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTaskManager_QueryNumProcessors(This,pulNumProc) \ + (This)->lpVtbl -> QueryNumProcessors(This,pulNumProc) + +#define IDXTaskManager_SetThreadPoolSize(This,ulNumThreads) \ + (This)->lpVtbl -> SetThreadPoolSize(This,ulNumThreads) + +#define IDXTaskManager_GetThreadPoolSize(This,pulNumThreads) \ + (This)->lpVtbl -> GetThreadPoolSize(This,pulNumThreads) + +#define IDXTaskManager_SetConcurrencyLimit(This,ulNumThreads) \ + (This)->lpVtbl -> SetConcurrencyLimit(This,ulNumThreads) + +#define IDXTaskManager_GetConcurrencyLimit(This,pulNumThreads) \ + (This)->lpVtbl -> GetConcurrencyLimit(This,pulNumThreads) + +#define IDXTaskManager_ScheduleTasks(This,TaskInfo,Events,TaskIDs,ulNumTasks,ulWaitPeriod) \ + (This)->lpVtbl -> ScheduleTasks(This,TaskInfo,Events,TaskIDs,ulNumTasks,ulWaitPeriod) + +#define IDXTaskManager_TerminateTasks(This,TaskIDs,ulCount,ulTimeOut) \ + (This)->lpVtbl -> TerminateTasks(This,TaskIDs,ulCount,ulTimeOut) + +#define IDXTaskManager_TerminateRequest(This,RequestID,ulTimeOut) \ + (This)->lpVtbl -> TerminateRequest(This,RequestID,ulTimeOut) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_QueryNumProcessors_Proxy( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumProc); + + +void __RPC_STUB IDXTaskManager_QueryNumProcessors_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_SetThreadPoolSize_Proxy( + IDXTaskManager * This, + /* [in] */ ULONG ulNumThreads); + + +void __RPC_STUB IDXTaskManager_SetThreadPoolSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_GetThreadPoolSize_Proxy( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumThreads); + + +void __RPC_STUB IDXTaskManager_GetThreadPoolSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_SetConcurrencyLimit_Proxy( + IDXTaskManager * This, + /* [in] */ ULONG ulNumThreads); + + +void __RPC_STUB IDXTaskManager_SetConcurrencyLimit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_GetConcurrencyLimit_Proxy( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumThreads); + + +void __RPC_STUB IDXTaskManager_GetConcurrencyLimit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_ScheduleTasks_Proxy( + IDXTaskManager * This, + /* [in] */ DXTMTASKINFO TaskInfo[ ], + /* [in] */ HANDLE Events[ ], + /* [out] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulNumTasks, + /* [in] */ ULONG ulWaitPeriod); + + +void __RPC_STUB IDXTaskManager_ScheduleTasks_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_TerminateTasks_Proxy( + IDXTaskManager * This, + /* [in] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulCount, + /* [in] */ ULONG ulTimeOut); + + +void __RPC_STUB IDXTaskManager_TerminateTasks_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_TerminateRequest_Proxy( + IDXTaskManager * This, + /* [in] */ REFIID RequestID, + /* [in] */ ULONG ulTimeOut); + + +void __RPC_STUB IDXTaskManager_TerminateRequest_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTaskManager_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0265 */ +/* [local] */ + +#ifdef __cplusplus +///////////////////////////////////////////////////// + +class DXBASESAMPLE; +class DXSAMPLE; +class DXPMSAMPLE; + +///////////////////////////////////////////////////// + +class DXBASESAMPLE +{ +public: + BYTE Blue; + BYTE Green; + BYTE Red; + BYTE Alpha; + DXBASESAMPLE() {} + DXBASESAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) : + Alpha(alpha), + Red(red), + Green(green), + Blue(blue) {} + DXBASESAMPLE(const DWORD val) { *this = (*(DXBASESAMPLE *)&val); } + operator DWORD () const {return *((DWORD *)this); } + DWORD operator=(const DWORD val) { return *this = *((DXBASESAMPLE *)&val); } +}; // DXBASESAMPLE + +///////////////////////////////////////////////////// + +class DXSAMPLE : public DXBASESAMPLE +{ +public: + DXSAMPLE() {} + DXSAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) : + DXBASESAMPLE(alpha, red, green, blue) {} + DXSAMPLE(const DWORD val) { *this = (*(DXSAMPLE *)&val); } + operator DWORD () const {return *((DWORD *)this); } + DWORD operator=(const DWORD val) { return *this = *((DXSAMPLE *)&val); } + operator DXPMSAMPLE() const; +}; // DXSAMPLE + +///////////////////////////////////////////////////// + +class DXPMSAMPLE : public DXBASESAMPLE +{ +public: + DXPMSAMPLE() {} + DXPMSAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) : + DXBASESAMPLE(alpha, red, green, blue) {} + DXPMSAMPLE(const DWORD val) { *this = (*(DXPMSAMPLE *)&val); } + operator DWORD () const {return *((DWORD *)this); } + DWORD operator=(const DWORD val) { return *this = *((DXPMSAMPLE *)&val); } + operator DXSAMPLE() const; +}; // DXPMSAMPLE + +// +// The following cast operators are to prevent a direct assignment of a DXSAMPLE to a DXPMSAMPLE +// +inline DXSAMPLE::operator DXPMSAMPLE() const { return *((DXPMSAMPLE *)this); } +inline DXPMSAMPLE::operator DXSAMPLE() const { return *((DXSAMPLE *)this); } +#else // !__cplusplus +typedef struct DXBASESAMPLE + { + BYTE Blue; + BYTE Green; + BYTE Red; + BYTE Alpha; + } DXBASESAMPLE; + +typedef struct DXSAMPLE + { + BYTE Blue; + BYTE Green; + BYTE Red; + BYTE Alpha; + } DXSAMPLE; + +typedef struct DXPMSAMPLE + { + BYTE Blue; + BYTE Green; + BYTE Red; + BYTE Alpha; + } DXPMSAMPLE; + +#endif // !__cplusplus +typedef +enum DXRUNTYPE + { DXRUNTYPE_CLEAR = 0, + DXRUNTYPE_OPAQUE = 1, + DXRUNTYPE_TRANS = 2, + DXRUNTYPE_UNKNOWN = 3 + } DXRUNTYPE; + +#define DX_MAX_RUN_INFO_COUNT ( 128 ) + +// Ignore the definition used by MIDL for TLB generation +#if 0 +typedef struct DXRUNINFO + { + ULONG Bitfields; + } DXRUNINFO; + +#endif // 0 +typedef struct DXRUNINFO +{ + ULONG Type : 2; // Type + ULONG Count : 30; // Number of samples in run +} DXRUNINFO; +typedef +enum DXSFCREATE + { DXSF_FORMAT_IS_CLSID = 1L << 0, + DXSF_NO_LAZY_DDRAW_LOCK = 1L << 1 + } DXSFCREATE; + +typedef +enum DXBLTOPTIONS + { DXBOF_DO_OVER = 1L << 0, + DXBOF_DITHER = 1L << 1 + } DXBLTOPTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0265_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0265_v0_0_s_ifspec; + +#ifndef __IDXSurfaceFactory_INTERFACE_DEFINED__ +#define __IDXSurfaceFactory_INTERFACE_DEFINED__ + +/* interface IDXSurfaceFactory */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurfaceFactory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("144946F5-C4D4-11d1-81D1-0000F87557DB") + IDXSurfaceFactory : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateSurface( + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateFromDDSurface( + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadImage( + /* [in] */ const LPWSTR pszFileName, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadImageFromStream( + /* [in] */ IStream *pStream, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE CopySurfaceToNewFormat( + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pDestFormatID, + /* [out] */ IDXSurface **ppNewSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateD3DRMTexture( + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ IUnknown *pD3DRM3, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppTexture3) = 0; + + virtual HRESULT STDMETHODCALLTYPE BitBlt( + /* [in] */ IDXSurface *pDest, + /* [in] */ const DXVEC *pPlacement, + /* [in] */ IDXSurface *pSrc, + /* [in] */ const DXBNDS *pClipBounds, + /* [in] */ DWORD dwFlags) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfaceFactoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurfaceFactory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurfaceFactory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurfaceFactory * This); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDXSurfaceFactory * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + HRESULT ( STDMETHODCALLTYPE *CreateFromDDSurface )( + IDXSurfaceFactory * This, + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + HRESULT ( STDMETHODCALLTYPE *LoadImage )( + IDXSurfaceFactory * This, + /* [in] */ const LPWSTR pszFileName, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + HRESULT ( STDMETHODCALLTYPE *LoadImageFromStream )( + IDXSurfaceFactory * This, + /* [in] */ IStream *pStream, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + HRESULT ( STDMETHODCALLTYPE *CopySurfaceToNewFormat )( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pDestFormatID, + /* [out] */ IDXSurface **ppNewSurface); + + HRESULT ( STDMETHODCALLTYPE *CreateD3DRMTexture )( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ IUnknown *pD3DRM3, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppTexture3); + + HRESULT ( STDMETHODCALLTYPE *BitBlt )( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pDest, + /* [in] */ const DXVEC *pPlacement, + /* [in] */ IDXSurface *pSrc, + /* [in] */ const DXBNDS *pClipBounds, + /* [in] */ DWORD dwFlags); + + END_INTERFACE + } IDXSurfaceFactoryVtbl; + + interface IDXSurfaceFactory + { + CONST_VTBL struct IDXSurfaceFactoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurfaceFactory_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurfaceFactory_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurfaceFactory_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurfaceFactory_CreateSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags,punkOuter,riid,ppDXSurface) \ + (This)->lpVtbl -> CreateSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags,punkOuter,riid,ppDXSurface) + +#define IDXSurfaceFactory_CreateFromDDSurface(This,pDDrawSurface,pFormatID,dwFlags,punkOuter,riid,ppDXSurface) \ + (This)->lpVtbl -> CreateFromDDSurface(This,pDDrawSurface,pFormatID,dwFlags,punkOuter,riid,ppDXSurface) + +#define IDXSurfaceFactory_LoadImage(This,pszFileName,pDirectDraw,pDDSurfaceDesc,pFormatID,riid,ppDXSurface) \ + (This)->lpVtbl -> LoadImage(This,pszFileName,pDirectDraw,pDDSurfaceDesc,pFormatID,riid,ppDXSurface) + +#define IDXSurfaceFactory_LoadImageFromStream(This,pStream,pDirectDraw,pDDSurfaceDesc,pFormatID,riid,ppDXSurface) \ + (This)->lpVtbl -> LoadImageFromStream(This,pStream,pDirectDraw,pDDSurfaceDesc,pFormatID,riid,ppDXSurface) + +#define IDXSurfaceFactory_CopySurfaceToNewFormat(This,pSrc,pDirectDraw,pDDSurfaceDesc,pDestFormatID,ppNewSurface) \ + (This)->lpVtbl -> CopySurfaceToNewFormat(This,pSrc,pDirectDraw,pDDSurfaceDesc,pDestFormatID,ppNewSurface) + +#define IDXSurfaceFactory_CreateD3DRMTexture(This,pSrc,pDirectDraw,pD3DRM3,riid,ppTexture3) \ + (This)->lpVtbl -> CreateD3DRMTexture(This,pSrc,pDirectDraw,pD3DRM3,riid,ppTexture3) + +#define IDXSurfaceFactory_BitBlt(This,pDest,pPlacement,pSrc,pClipBounds,dwFlags) \ + (This)->lpVtbl -> BitBlt(This,pDest,pPlacement,pSrc,pClipBounds,dwFlags) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_CreateSurface_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + +void __RPC_STUB IDXSurfaceFactory_CreateSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_CreateFromDDSurface_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + +void __RPC_STUB IDXSurfaceFactory_CreateFromDDSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_LoadImage_Proxy( + IDXSurfaceFactory * This, + /* [in] */ const LPWSTR pszFileName, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + +void __RPC_STUB IDXSurfaceFactory_LoadImage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_LoadImageFromStream_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IStream *pStream, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + +void __RPC_STUB IDXSurfaceFactory_LoadImageFromStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_CopySurfaceToNewFormat_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pDestFormatID, + /* [out] */ IDXSurface **ppNewSurface); + + +void __RPC_STUB IDXSurfaceFactory_CopySurfaceToNewFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_CreateD3DRMTexture_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ IUnknown *pD3DRM3, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppTexture3); + + +void __RPC_STUB IDXSurfaceFactory_CreateD3DRMTexture_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_BitBlt_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pDest, + /* [in] */ const DXVEC *pPlacement, + /* [in] */ IDXSurface *pSrc, + /* [in] */ const DXBNDS *pClipBounds, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB IDXSurfaceFactory_BitBlt_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurfaceFactory_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0266 */ +/* [local] */ + +typedef +enum DXSURFMODCOMPOP + { DXSURFMOD_COMP_OVER = 0, + DXSURFMOD_COMP_ALPHA_MASK = 1, + DXSURFMOD_COMP_MAX_VALID = 1 + } DXSURFMODCOMPOP; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0266_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0266_v0_0_s_ifspec; + +#ifndef __IDXSurfaceModifier_INTERFACE_DEFINED__ +#define __IDXSurfaceModifier_INTERFACE_DEFINED__ + +/* interface IDXSurfaceModifier */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurfaceModifier; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EA3B637-C37D-11d1-905E-00C04FD9189D") + IDXSurfaceModifier : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFillColor( + /* [in] */ DXSAMPLE Color) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFillColor( + /* [out] */ DXSAMPLE *pColor) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBounds( + /* [in] */ const DXBNDS *pBounds) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBackground( + /* [in] */ IDXSurface *pSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBackground( + /* [out] */ IDXSurface **ppSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCompositeOperation( + /* [in] */ DXSURFMODCOMPOP CompOp) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCompositeOperation( + /* [out] */ DXSURFMODCOMPOP *pCompOp) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetForeground( + /* [in] */ IDXSurface *pSurface, + /* [in] */ BOOL bTile, + /* [in] */ const POINT *pOrigin) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetForeground( + /* [out] */ IDXSurface **ppSurface, + /* [out] */ BOOL *pbTile, + /* [out] */ POINT *pOrigin) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetOpacity( + /* [in] */ float Opacity) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOpacity( + /* [out] */ float *pOpacity) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetLookup( + /* [in] */ IDXLookupTable *pLookupTable) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetLookup( + /* [out] */ IDXLookupTable **ppLookupTable) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfaceModifierVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurfaceModifier * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurfaceModifier * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurfaceModifier * This); + + HRESULT ( STDMETHODCALLTYPE *SetFillColor )( + IDXSurfaceModifier * This, + /* [in] */ DXSAMPLE Color); + + HRESULT ( STDMETHODCALLTYPE *GetFillColor )( + IDXSurfaceModifier * This, + /* [out] */ DXSAMPLE *pColor); + + HRESULT ( STDMETHODCALLTYPE *SetBounds )( + IDXSurfaceModifier * This, + /* [in] */ const DXBNDS *pBounds); + + HRESULT ( STDMETHODCALLTYPE *SetBackground )( + IDXSurfaceModifier * This, + /* [in] */ IDXSurface *pSurface); + + HRESULT ( STDMETHODCALLTYPE *GetBackground )( + IDXSurfaceModifier * This, + /* [out] */ IDXSurface **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *SetCompositeOperation )( + IDXSurfaceModifier * This, + /* [in] */ DXSURFMODCOMPOP CompOp); + + HRESULT ( STDMETHODCALLTYPE *GetCompositeOperation )( + IDXSurfaceModifier * This, + /* [out] */ DXSURFMODCOMPOP *pCompOp); + + HRESULT ( STDMETHODCALLTYPE *SetForeground )( + IDXSurfaceModifier * This, + /* [in] */ IDXSurface *pSurface, + /* [in] */ BOOL bTile, + /* [in] */ const POINT *pOrigin); + + HRESULT ( STDMETHODCALLTYPE *GetForeground )( + IDXSurfaceModifier * This, + /* [out] */ IDXSurface **ppSurface, + /* [out] */ BOOL *pbTile, + /* [out] */ POINT *pOrigin); + + HRESULT ( STDMETHODCALLTYPE *SetOpacity )( + IDXSurfaceModifier * This, + /* [in] */ float Opacity); + + HRESULT ( STDMETHODCALLTYPE *GetOpacity )( + IDXSurfaceModifier * This, + /* [out] */ float *pOpacity); + + HRESULT ( STDMETHODCALLTYPE *SetLookup )( + IDXSurfaceModifier * This, + /* [in] */ IDXLookupTable *pLookupTable); + + HRESULT ( STDMETHODCALLTYPE *GetLookup )( + IDXSurfaceModifier * This, + /* [out] */ IDXLookupTable **ppLookupTable); + + END_INTERFACE + } IDXSurfaceModifierVtbl; + + interface IDXSurfaceModifier + { + CONST_VTBL struct IDXSurfaceModifierVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurfaceModifier_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurfaceModifier_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurfaceModifier_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurfaceModifier_SetFillColor(This,Color) \ + (This)->lpVtbl -> SetFillColor(This,Color) + +#define IDXSurfaceModifier_GetFillColor(This,pColor) \ + (This)->lpVtbl -> GetFillColor(This,pColor) + +#define IDXSurfaceModifier_SetBounds(This,pBounds) \ + (This)->lpVtbl -> SetBounds(This,pBounds) + +#define IDXSurfaceModifier_SetBackground(This,pSurface) \ + (This)->lpVtbl -> SetBackground(This,pSurface) + +#define IDXSurfaceModifier_GetBackground(This,ppSurface) \ + (This)->lpVtbl -> GetBackground(This,ppSurface) + +#define IDXSurfaceModifier_SetCompositeOperation(This,CompOp) \ + (This)->lpVtbl -> SetCompositeOperation(This,CompOp) + +#define IDXSurfaceModifier_GetCompositeOperation(This,pCompOp) \ + (This)->lpVtbl -> GetCompositeOperation(This,pCompOp) + +#define IDXSurfaceModifier_SetForeground(This,pSurface,bTile,pOrigin) \ + (This)->lpVtbl -> SetForeground(This,pSurface,bTile,pOrigin) + +#define IDXSurfaceModifier_GetForeground(This,ppSurface,pbTile,pOrigin) \ + (This)->lpVtbl -> GetForeground(This,ppSurface,pbTile,pOrigin) + +#define IDXSurfaceModifier_SetOpacity(This,Opacity) \ + (This)->lpVtbl -> SetOpacity(This,Opacity) + +#define IDXSurfaceModifier_GetOpacity(This,pOpacity) \ + (This)->lpVtbl -> GetOpacity(This,pOpacity) + +#define IDXSurfaceModifier_SetLookup(This,pLookupTable) \ + (This)->lpVtbl -> SetLookup(This,pLookupTable) + +#define IDXSurfaceModifier_GetLookup(This,ppLookupTable) \ + (This)->lpVtbl -> GetLookup(This,ppLookupTable) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetFillColor_Proxy( + IDXSurfaceModifier * This, + /* [in] */ DXSAMPLE Color); + + +void __RPC_STUB IDXSurfaceModifier_SetFillColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetFillColor_Proxy( + IDXSurfaceModifier * This, + /* [out] */ DXSAMPLE *pColor); + + +void __RPC_STUB IDXSurfaceModifier_GetFillColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetBounds_Proxy( + IDXSurfaceModifier * This, + /* [in] */ const DXBNDS *pBounds); + + +void __RPC_STUB IDXSurfaceModifier_SetBounds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetBackground_Proxy( + IDXSurfaceModifier * This, + /* [in] */ IDXSurface *pSurface); + + +void __RPC_STUB IDXSurfaceModifier_SetBackground_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetBackground_Proxy( + IDXSurfaceModifier * This, + /* [out] */ IDXSurface **ppSurface); + + +void __RPC_STUB IDXSurfaceModifier_GetBackground_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetCompositeOperation_Proxy( + IDXSurfaceModifier * This, + /* [in] */ DXSURFMODCOMPOP CompOp); + + +void __RPC_STUB IDXSurfaceModifier_SetCompositeOperation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetCompositeOperation_Proxy( + IDXSurfaceModifier * This, + /* [out] */ DXSURFMODCOMPOP *pCompOp); + + +void __RPC_STUB IDXSurfaceModifier_GetCompositeOperation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetForeground_Proxy( + IDXSurfaceModifier * This, + /* [in] */ IDXSurface *pSurface, + /* [in] */ BOOL bTile, + /* [in] */ const POINT *pOrigin); + + +void __RPC_STUB IDXSurfaceModifier_SetForeground_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetForeground_Proxy( + IDXSurfaceModifier * This, + /* [out] */ IDXSurface **ppSurface, + /* [out] */ BOOL *pbTile, + /* [out] */ POINT *pOrigin); + + +void __RPC_STUB IDXSurfaceModifier_GetForeground_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetOpacity_Proxy( + IDXSurfaceModifier * This, + /* [in] */ float Opacity); + + +void __RPC_STUB IDXSurfaceModifier_SetOpacity_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetOpacity_Proxy( + IDXSurfaceModifier * This, + /* [out] */ float *pOpacity); + + +void __RPC_STUB IDXSurfaceModifier_GetOpacity_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetLookup_Proxy( + IDXSurfaceModifier * This, + /* [in] */ IDXLookupTable *pLookupTable); + + +void __RPC_STUB IDXSurfaceModifier_SetLookup_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetLookup_Proxy( + IDXSurfaceModifier * This, + /* [out] */ IDXLookupTable **ppLookupTable); + + +void __RPC_STUB IDXSurfaceModifier_GetLookup_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurfaceModifier_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0267 */ +/* [local] */ + +typedef +enum DXSAMPLEFORMATENUM + { DXPF_FLAGSMASK = 0xffff0000, + DXPF_NONPREMULT = 0x10000, + DXPF_TRANSPARENCY = 0x20000, + DXPF_TRANSLUCENCY = 0x40000, + DXPF_2BITERROR = 0x200000, + DXPF_3BITERROR = 0x300000, + DXPF_4BITERROR = 0x400000, + DXPF_5BITERROR = 0x500000, + DXPF_ERRORMASK = 0x700000, + DXPF_NONSTANDARD = 0, + DXPF_PMARGB32 = 1 | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY, + DXPF_ARGB32 = 2 | DXPF_NONPREMULT | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY, + DXPF_ARGB4444 = 3 | DXPF_NONPREMULT | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY | DXPF_4BITERROR, + DXPF_A8 = 4 | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY, + DXPF_RGB32 = 5, + DXPF_RGB24 = 6, + DXPF_RGB565 = 7 | DXPF_3BITERROR, + DXPF_RGB555 = 8 | DXPF_3BITERROR, + DXPF_RGB8 = 9 | DXPF_5BITERROR, + DXPF_ARGB1555 = 10 | DXPF_TRANSPARENCY | DXPF_3BITERROR, + DXPF_RGB32_CK = DXPF_RGB32 | DXPF_TRANSPARENCY, + DXPF_RGB24_CK = DXPF_RGB24 | DXPF_TRANSPARENCY, + DXPF_RGB555_CK = DXPF_RGB555 | DXPF_TRANSPARENCY, + DXPF_RGB565_CK = DXPF_RGB565 | DXPF_TRANSPARENCY, + DXPF_RGB8_CK = DXPF_RGB8 | DXPF_TRANSPARENCY + } DXSAMPLEFORMATENUM; + +typedef +enum DXLOCKSURF + { DXLOCKF_READ = 0, + DXLOCKF_READWRITE = 1 << 0, + DXLOCKF_EXISTINGINFOONLY = 1 << 1, + DXLOCKF_WANTRUNINFO = 1 << 2, + DXLOCKF_NONPREMULT = 1 << 16, + DXLOCKF_VALIDFLAGS = DXLOCKF_READWRITE | DXLOCKF_EXISTINGINFOONLY | DXLOCKF_WANTRUNINFO | DXLOCKF_NONPREMULT + } DXLOCKSURF; + +typedef +enum DXSURFSTATUS + { DXSURF_TRANSIENT = 1 << 0, + DXSURF_READONLY = 1 << 1, + DXSURF_VALIDFLAGS = DXSURF_TRANSIENT | DXSURF_READONLY + } DXSURFSTATUS; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0267_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0267_v0_0_s_ifspec; + +#ifndef __IDXSurface_INTERFACE_DEFINED__ +#define __IDXSurface_INTERFACE_DEFINED__ + +/* interface IDXSurface */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurface; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B39FD73F-E139-11d1-9065-00C04FD9189D") + IDXSurface : public IDXBaseObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetPixelFormat( + /* [out] */ GUID *pFormatID, + /* [out] */ DXSAMPLEFORMATENUM *pSampleFormatEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBounds( + /* [out] */ DXBNDS *pBounds) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatusFlags( + /* [out] */ DWORD *pdwStatusFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetStatusFlags( + /* [in] */ DWORD dwStatusFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE LockSurface( + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppPointer, + /* [out] */ ULONG *pulGenerationId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDirectDrawSurface( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetColorKey( + DXSAMPLE *pColorKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetColorKey( + DXSAMPLE ColorKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE LockSurfaceDC( + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [out] */ IDXDCLock **ppDCLock) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAppData( + DWORD_PTR dwAppData) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAppData( + DWORD_PTR *pdwAppData) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfaceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurface * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurface * This); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationId )( + IDXSurface * This, + /* [out] */ ULONG *pID); + + HRESULT ( STDMETHODCALLTYPE *IncrementGenerationId )( + IDXSurface * This, + /* [in] */ BOOL bRefresh); + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + IDXSurface * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *GetPixelFormat )( + IDXSurface * This, + /* [out] */ GUID *pFormatID, + /* [out] */ DXSAMPLEFORMATENUM *pSampleFormatEnum); + + HRESULT ( STDMETHODCALLTYPE *GetBounds )( + IDXSurface * This, + /* [out] */ DXBNDS *pBounds); + + HRESULT ( STDMETHODCALLTYPE *GetStatusFlags )( + IDXSurface * This, + /* [out] */ DWORD *pdwStatusFlags); + + HRESULT ( STDMETHODCALLTYPE *SetStatusFlags )( + IDXSurface * This, + /* [in] */ DWORD dwStatusFlags); + + HRESULT ( STDMETHODCALLTYPE *LockSurface )( + IDXSurface * This, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppPointer, + /* [out] */ ULONG *pulGenerationId); + + HRESULT ( STDMETHODCALLTYPE *GetDirectDrawSurface )( + IDXSurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *GetColorKey )( + IDXSurface * This, + DXSAMPLE *pColorKey); + + HRESULT ( STDMETHODCALLTYPE *SetColorKey )( + IDXSurface * This, + DXSAMPLE ColorKey); + + HRESULT ( STDMETHODCALLTYPE *LockSurfaceDC )( + IDXSurface * This, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [out] */ IDXDCLock **ppDCLock); + + HRESULT ( STDMETHODCALLTYPE *SetAppData )( + IDXSurface * This, + DWORD_PTR dwAppData); + + HRESULT ( STDMETHODCALLTYPE *GetAppData )( + IDXSurface * This, + DWORD_PTR *pdwAppData); + + END_INTERFACE + } IDXSurfaceVtbl; + + interface IDXSurface + { + CONST_VTBL struct IDXSurfaceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurface_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurface_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurface_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurface_GetGenerationId(This,pID) \ + (This)->lpVtbl -> GetGenerationId(This,pID) + +#define IDXSurface_IncrementGenerationId(This,bRefresh) \ + (This)->lpVtbl -> IncrementGenerationId(This,bRefresh) + +#define IDXSurface_GetObjectSize(This,pcbSize) \ + (This)->lpVtbl -> GetObjectSize(This,pcbSize) + + +#define IDXSurface_GetPixelFormat(This,pFormatID,pSampleFormatEnum) \ + (This)->lpVtbl -> GetPixelFormat(This,pFormatID,pSampleFormatEnum) + +#define IDXSurface_GetBounds(This,pBounds) \ + (This)->lpVtbl -> GetBounds(This,pBounds) + +#define IDXSurface_GetStatusFlags(This,pdwStatusFlags) \ + (This)->lpVtbl -> GetStatusFlags(This,pdwStatusFlags) + +#define IDXSurface_SetStatusFlags(This,dwStatusFlags) \ + (This)->lpVtbl -> SetStatusFlags(This,dwStatusFlags) + +#define IDXSurface_LockSurface(This,pBounds,ulTimeOut,dwFlags,riid,ppPointer,pulGenerationId) \ + (This)->lpVtbl -> LockSurface(This,pBounds,ulTimeOut,dwFlags,riid,ppPointer,pulGenerationId) + +#define IDXSurface_GetDirectDrawSurface(This,riid,ppSurface) \ + (This)->lpVtbl -> GetDirectDrawSurface(This,riid,ppSurface) + +#define IDXSurface_GetColorKey(This,pColorKey) \ + (This)->lpVtbl -> GetColorKey(This,pColorKey) + +#define IDXSurface_SetColorKey(This,ColorKey) \ + (This)->lpVtbl -> SetColorKey(This,ColorKey) + +#define IDXSurface_LockSurfaceDC(This,pBounds,ulTimeOut,dwFlags,ppDCLock) \ + (This)->lpVtbl -> LockSurfaceDC(This,pBounds,ulTimeOut,dwFlags,ppDCLock) + +#define IDXSurface_SetAppData(This,dwAppData) \ + (This)->lpVtbl -> SetAppData(This,dwAppData) + +#define IDXSurface_GetAppData(This,pdwAppData) \ + (This)->lpVtbl -> GetAppData(This,pdwAppData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetPixelFormat_Proxy( + IDXSurface * This, + /* [out] */ GUID *pFormatID, + /* [out] */ DXSAMPLEFORMATENUM *pSampleFormatEnum); + + +void __RPC_STUB IDXSurface_GetPixelFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetBounds_Proxy( + IDXSurface * This, + /* [out] */ DXBNDS *pBounds); + + +void __RPC_STUB IDXSurface_GetBounds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetStatusFlags_Proxy( + IDXSurface * This, + /* [out] */ DWORD *pdwStatusFlags); + + +void __RPC_STUB IDXSurface_GetStatusFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_SetStatusFlags_Proxy( + IDXSurface * This, + /* [in] */ DWORD dwStatusFlags); + + +void __RPC_STUB IDXSurface_SetStatusFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_LockSurface_Proxy( + IDXSurface * This, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppPointer, + /* [out] */ ULONG *pulGenerationId); + + +void __RPC_STUB IDXSurface_LockSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetDirectDrawSurface_Proxy( + IDXSurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + +void __RPC_STUB IDXSurface_GetDirectDrawSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetColorKey_Proxy( + IDXSurface * This, + DXSAMPLE *pColorKey); + + +void __RPC_STUB IDXSurface_GetColorKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_SetColorKey_Proxy( + IDXSurface * This, + DXSAMPLE ColorKey); + + +void __RPC_STUB IDXSurface_SetColorKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_LockSurfaceDC_Proxy( + IDXSurface * This, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [out] */ IDXDCLock **ppDCLock); + + +void __RPC_STUB IDXSurface_LockSurfaceDC_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_SetAppData_Proxy( + IDXSurface * This, + DWORD_PTR dwAppData); + + +void __RPC_STUB IDXSurface_SetAppData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetAppData_Proxy( + IDXSurface * This, + DWORD_PTR *pdwAppData); + + +void __RPC_STUB IDXSurface_GetAppData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurface_INTERFACE_DEFINED__ */ + + +#ifndef __IDXSurfaceInit_INTERFACE_DEFINED__ +#define __IDXSurfaceInit_INTERFACE_DEFINED__ + +/* interface IDXSurfaceInit */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurfaceInit; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EA3B639-C37D-11d1-905E-00C04FD9189D") + IDXSurfaceInit : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InitSurface( + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfaceInitVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurfaceInit * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurfaceInit * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurfaceInit * This); + + HRESULT ( STDMETHODCALLTYPE *InitSurface )( + IDXSurfaceInit * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags); + + END_INTERFACE + } IDXSurfaceInitVtbl; + + interface IDXSurfaceInit + { + CONST_VTBL struct IDXSurfaceInitVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurfaceInit_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurfaceInit_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurfaceInit_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurfaceInit_InitSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags) \ + (This)->lpVtbl -> InitSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurfaceInit_InitSurface_Proxy( + IDXSurfaceInit * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB IDXSurfaceInit_InitSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurfaceInit_INTERFACE_DEFINED__ */ + + +#ifndef __IDXARGBSurfaceInit_INTERFACE_DEFINED__ +#define __IDXARGBSurfaceInit_INTERFACE_DEFINED__ + +/* interface IDXARGBSurfaceInit */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXARGBSurfaceInit; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EA3B63A-C37D-11d1-905E-00C04FD9189D") + IDXARGBSurfaceInit : public IDXSurfaceInit + { + public: + virtual HRESULT STDMETHODCALLTYPE InitFromDDSurface( + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitFromRawSurface( + /* [in] */ IDXRawSurface *pRawSurface) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXARGBSurfaceInitVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXARGBSurfaceInit * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXARGBSurfaceInit * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXARGBSurfaceInit * This); + + HRESULT ( STDMETHODCALLTYPE *InitSurface )( + IDXARGBSurfaceInit * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags); + + HRESULT ( STDMETHODCALLTYPE *InitFromDDSurface )( + IDXARGBSurfaceInit * This, + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags); + + HRESULT ( STDMETHODCALLTYPE *InitFromRawSurface )( + IDXARGBSurfaceInit * This, + /* [in] */ IDXRawSurface *pRawSurface); + + END_INTERFACE + } IDXARGBSurfaceInitVtbl; + + interface IDXARGBSurfaceInit + { + CONST_VTBL struct IDXARGBSurfaceInitVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXARGBSurfaceInit_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXARGBSurfaceInit_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXARGBSurfaceInit_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXARGBSurfaceInit_InitSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags) \ + (This)->lpVtbl -> InitSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags) + + +#define IDXARGBSurfaceInit_InitFromDDSurface(This,pDDrawSurface,pFormatID,dwFlags) \ + (This)->lpVtbl -> InitFromDDSurface(This,pDDrawSurface,pFormatID,dwFlags) + +#define IDXARGBSurfaceInit_InitFromRawSurface(This,pRawSurface) \ + (This)->lpVtbl -> InitFromRawSurface(This,pRawSurface) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXARGBSurfaceInit_InitFromDDSurface_Proxy( + IDXARGBSurfaceInit * This, + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB IDXARGBSurfaceInit_InitFromDDSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXARGBSurfaceInit_InitFromRawSurface_Proxy( + IDXARGBSurfaceInit * This, + /* [in] */ IDXRawSurface *pRawSurface); + + +void __RPC_STUB IDXARGBSurfaceInit_InitFromRawSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXARGBSurfaceInit_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0270 */ +/* [local] */ + +typedef struct tagDXNATIVETYPEINFO + { + BYTE *pCurrentData; + BYTE *pFirstByte; + long lPitch; + DWORD dwColorKey; + } DXNATIVETYPEINFO; + +typedef struct tagDXPACKEDRECTDESC + { + DXBASESAMPLE *pSamples; + BOOL bPremult; + RECT rect; + long lRowPadding; + } DXPACKEDRECTDESC; + +typedef struct tagDXOVERSAMPLEDESC + { + POINT p; + DXPMSAMPLE Color; + } DXOVERSAMPLEDESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0270_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0270_v0_0_s_ifspec; + +#ifndef __IDXARGBReadPtr_INTERFACE_DEFINED__ +#define __IDXARGBReadPtr_INTERFACE_DEFINED__ + +/* interface IDXARGBReadPtr */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXARGBReadPtr; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EAAAC2D6-C290-11d1-905D-00C04FD9189D") + IDXARGBReadPtr : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSurface( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface) = 0; + + virtual DXSAMPLEFORMATENUM STDMETHODCALLTYPE GetNativeType( + /* [out] */ DXNATIVETYPEINFO *pInfo) = 0; + + virtual void STDMETHODCALLTYPE Move( + /* [in] */ long cSamples) = 0; + + virtual void STDMETHODCALLTYPE MoveToRow( + /* [in] */ ULONG y) = 0; + + virtual void STDMETHODCALLTYPE MoveToXY( + /* [in] */ ULONG x, + /* [in] */ ULONG y) = 0; + + virtual ULONG STDMETHODCALLTYPE MoveAndGetRunInfo( + /* [in] */ ULONG Row, + /* [out] */ const DXRUNINFO **ppInfo) = 0; + + virtual DXSAMPLE *STDMETHODCALLTYPE Unpack( + /* [in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove) = 0; + + virtual DXPMSAMPLE *STDMETHODCALLTYPE UnpackPremult( + /* [in] */ DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove) = 0; + + virtual void STDMETHODCALLTYPE UnpackRect( + /* [in] */ const DXPACKEDRECTDESC *pRectDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXARGBReadPtrVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXARGBReadPtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXARGBReadPtr * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXARGBReadPtr * This); + + HRESULT ( STDMETHODCALLTYPE *GetSurface )( + IDXARGBReadPtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + DXSAMPLEFORMATENUM ( STDMETHODCALLTYPE *GetNativeType )( + IDXARGBReadPtr * This, + /* [out] */ DXNATIVETYPEINFO *pInfo); + + void ( STDMETHODCALLTYPE *Move )( + IDXARGBReadPtr * This, + /* [in] */ long cSamples); + + void ( STDMETHODCALLTYPE *MoveToRow )( + IDXARGBReadPtr * This, + /* [in] */ ULONG y); + + void ( STDMETHODCALLTYPE *MoveToXY )( + IDXARGBReadPtr * This, + /* [in] */ ULONG x, + /* [in] */ ULONG y); + + ULONG ( STDMETHODCALLTYPE *MoveAndGetRunInfo )( + IDXARGBReadPtr * This, + /* [in] */ ULONG Row, + /* [out] */ const DXRUNINFO **ppInfo); + + DXSAMPLE *( STDMETHODCALLTYPE *Unpack )( + IDXARGBReadPtr * This, + /* [in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + DXPMSAMPLE *( STDMETHODCALLTYPE *UnpackPremult )( + IDXARGBReadPtr * This, + /* [in] */ DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + void ( STDMETHODCALLTYPE *UnpackRect )( + IDXARGBReadPtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + END_INTERFACE + } IDXARGBReadPtrVtbl; + + interface IDXARGBReadPtr + { + CONST_VTBL struct IDXARGBReadPtrVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXARGBReadPtr_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXARGBReadPtr_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXARGBReadPtr_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXARGBReadPtr_GetSurface(This,riid,ppSurface) \ + (This)->lpVtbl -> GetSurface(This,riid,ppSurface) + +#define IDXARGBReadPtr_GetNativeType(This,pInfo) \ + (This)->lpVtbl -> GetNativeType(This,pInfo) + +#define IDXARGBReadPtr_Move(This,cSamples) \ + (This)->lpVtbl -> Move(This,cSamples) + +#define IDXARGBReadPtr_MoveToRow(This,y) \ + (This)->lpVtbl -> MoveToRow(This,y) + +#define IDXARGBReadPtr_MoveToXY(This,x,y) \ + (This)->lpVtbl -> MoveToXY(This,x,y) + +#define IDXARGBReadPtr_MoveAndGetRunInfo(This,Row,ppInfo) \ + (This)->lpVtbl -> MoveAndGetRunInfo(This,Row,ppInfo) + +#define IDXARGBReadPtr_Unpack(This,pSamples,cSamples,bMove) \ + (This)->lpVtbl -> Unpack(This,pSamples,cSamples,bMove) + +#define IDXARGBReadPtr_UnpackPremult(This,pSamples,cSamples,bMove) \ + (This)->lpVtbl -> UnpackPremult(This,pSamples,cSamples,bMove) + +#define IDXARGBReadPtr_UnpackRect(This,pRectDesc) \ + (This)->lpVtbl -> UnpackRect(This,pRectDesc) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXARGBReadPtr_GetSurface_Proxy( + IDXARGBReadPtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + +void __RPC_STUB IDXARGBReadPtr_GetSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +DXSAMPLEFORMATENUM STDMETHODCALLTYPE IDXARGBReadPtr_GetNativeType_Proxy( + IDXARGBReadPtr * This, + /* [out] */ DXNATIVETYPEINFO *pInfo); + + +void __RPC_STUB IDXARGBReadPtr_GetNativeType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadPtr_Move_Proxy( + IDXARGBReadPtr * This, + /* [in] */ long cSamples); + + +void __RPC_STUB IDXARGBReadPtr_Move_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadPtr_MoveToRow_Proxy( + IDXARGBReadPtr * This, + /* [in] */ ULONG y); + + +void __RPC_STUB IDXARGBReadPtr_MoveToRow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadPtr_MoveToXY_Proxy( + IDXARGBReadPtr * This, + /* [in] */ ULONG x, + /* [in] */ ULONG y); + + +void __RPC_STUB IDXARGBReadPtr_MoveToXY_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +ULONG STDMETHODCALLTYPE IDXARGBReadPtr_MoveAndGetRunInfo_Proxy( + IDXARGBReadPtr * This, + /* [in] */ ULONG Row, + /* [out] */ const DXRUNINFO **ppInfo); + + +void __RPC_STUB IDXARGBReadPtr_MoveAndGetRunInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +DXSAMPLE *STDMETHODCALLTYPE IDXARGBReadPtr_Unpack_Proxy( + IDXARGBReadPtr * This, + /* [in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + +void __RPC_STUB IDXARGBReadPtr_Unpack_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +DXPMSAMPLE *STDMETHODCALLTYPE IDXARGBReadPtr_UnpackPremult_Proxy( + IDXARGBReadPtr * This, + /* [in] */ DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + +void __RPC_STUB IDXARGBReadPtr_UnpackPremult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadPtr_UnpackRect_Proxy( + IDXARGBReadPtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + +void __RPC_STUB IDXARGBReadPtr_UnpackRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXARGBReadPtr_INTERFACE_DEFINED__ */ + + +#ifndef __IDXARGBReadWritePtr_INTERFACE_DEFINED__ +#define __IDXARGBReadWritePtr_INTERFACE_DEFINED__ + +/* interface IDXARGBReadWritePtr */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXARGBReadWritePtr; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EAAAC2D7-C290-11d1-905D-00C04FD9189D") + IDXARGBReadWritePtr : public IDXARGBReadPtr + { + public: + virtual void STDMETHODCALLTYPE PackAndMove( + /* [in] */ const DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples) = 0; + + virtual void STDMETHODCALLTYPE PackPremultAndMove( + /* [in] */ const DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples) = 0; + + virtual void STDMETHODCALLTYPE PackRect( + /* [in] */ const DXPACKEDRECTDESC *pRectDesc) = 0; + + virtual void STDMETHODCALLTYPE CopyAndMoveBoth( + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bIsOpaque) = 0; + + virtual void STDMETHODCALLTYPE CopyRect( + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const RECT *pDestRect, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ const POINT *pSrcOrigin, + /* [in] */ BOOL bIsOpaque) = 0; + + virtual void STDMETHODCALLTYPE FillAndMove( + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bDoOver) = 0; + + virtual void STDMETHODCALLTYPE FillRect( + /* [in] */ const RECT *pRect, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ BOOL bDoOver) = 0; + + virtual void STDMETHODCALLTYPE OverSample( + /* [in] */ const DXOVERSAMPLEDESC *pOverDesc) = 0; + + virtual void STDMETHODCALLTYPE OverArrayAndMove( + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const DXPMSAMPLE *pSrc, + /* [in] */ ULONG cSamples) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXARGBReadWritePtrVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXARGBReadWritePtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXARGBReadWritePtr * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXARGBReadWritePtr * This); + + HRESULT ( STDMETHODCALLTYPE *GetSurface )( + IDXARGBReadWritePtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + DXSAMPLEFORMATENUM ( STDMETHODCALLTYPE *GetNativeType )( + IDXARGBReadWritePtr * This, + /* [out] */ DXNATIVETYPEINFO *pInfo); + + void ( STDMETHODCALLTYPE *Move )( + IDXARGBReadWritePtr * This, + /* [in] */ long cSamples); + + void ( STDMETHODCALLTYPE *MoveToRow )( + IDXARGBReadWritePtr * This, + /* [in] */ ULONG y); + + void ( STDMETHODCALLTYPE *MoveToXY )( + IDXARGBReadWritePtr * This, + /* [in] */ ULONG x, + /* [in] */ ULONG y); + + ULONG ( STDMETHODCALLTYPE *MoveAndGetRunInfo )( + IDXARGBReadWritePtr * This, + /* [in] */ ULONG Row, + /* [out] */ const DXRUNINFO **ppInfo); + + DXSAMPLE *( STDMETHODCALLTYPE *Unpack )( + IDXARGBReadWritePtr * This, + /* [in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + DXPMSAMPLE *( STDMETHODCALLTYPE *UnpackPremult )( + IDXARGBReadWritePtr * This, + /* [in] */ DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + void ( STDMETHODCALLTYPE *UnpackRect )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + void ( STDMETHODCALLTYPE *PackAndMove )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + void ( STDMETHODCALLTYPE *PackPremultAndMove )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + void ( STDMETHODCALLTYPE *PackRect )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + void ( STDMETHODCALLTYPE *CopyAndMoveBoth )( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bIsOpaque); + + void ( STDMETHODCALLTYPE *CopyRect )( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const RECT *pDestRect, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ const POINT *pSrcOrigin, + /* [in] */ BOOL bIsOpaque); + + void ( STDMETHODCALLTYPE *FillAndMove )( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bDoOver); + + void ( STDMETHODCALLTYPE *FillRect )( + IDXARGBReadWritePtr * This, + /* [in] */ const RECT *pRect, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ BOOL bDoOver); + + void ( STDMETHODCALLTYPE *OverSample )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXOVERSAMPLEDESC *pOverDesc); + + void ( STDMETHODCALLTYPE *OverArrayAndMove )( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const DXPMSAMPLE *pSrc, + /* [in] */ ULONG cSamples); + + END_INTERFACE + } IDXARGBReadWritePtrVtbl; + + interface IDXARGBReadWritePtr + { + CONST_VTBL struct IDXARGBReadWritePtrVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXARGBReadWritePtr_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXARGBReadWritePtr_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXARGBReadWritePtr_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXARGBReadWritePtr_GetSurface(This,riid,ppSurface) \ + (This)->lpVtbl -> GetSurface(This,riid,ppSurface) + +#define IDXARGBReadWritePtr_GetNativeType(This,pInfo) \ + (This)->lpVtbl -> GetNativeType(This,pInfo) + +#define IDXARGBReadWritePtr_Move(This,cSamples) \ + (This)->lpVtbl -> Move(This,cSamples) + +#define IDXARGBReadWritePtr_MoveToRow(This,y) \ + (This)->lpVtbl -> MoveToRow(This,y) + +#define IDXARGBReadWritePtr_MoveToXY(This,x,y) \ + (This)->lpVtbl -> MoveToXY(This,x,y) + +#define IDXARGBReadWritePtr_MoveAndGetRunInfo(This,Row,ppInfo) \ + (This)->lpVtbl -> MoveAndGetRunInfo(This,Row,ppInfo) + +#define IDXARGBReadWritePtr_Unpack(This,pSamples,cSamples,bMove) \ + (This)->lpVtbl -> Unpack(This,pSamples,cSamples,bMove) + +#define IDXARGBReadWritePtr_UnpackPremult(This,pSamples,cSamples,bMove) \ + (This)->lpVtbl -> UnpackPremult(This,pSamples,cSamples,bMove) + +#define IDXARGBReadWritePtr_UnpackRect(This,pRectDesc) \ + (This)->lpVtbl -> UnpackRect(This,pRectDesc) + + +#define IDXARGBReadWritePtr_PackAndMove(This,pSamples,cSamples) \ + (This)->lpVtbl -> PackAndMove(This,pSamples,cSamples) + +#define IDXARGBReadWritePtr_PackPremultAndMove(This,pSamples,cSamples) \ + (This)->lpVtbl -> PackPremultAndMove(This,pSamples,cSamples) + +#define IDXARGBReadWritePtr_PackRect(This,pRectDesc) \ + (This)->lpVtbl -> PackRect(This,pRectDesc) + +#define IDXARGBReadWritePtr_CopyAndMoveBoth(This,pScratchBuffer,pSrc,cSamples,bIsOpaque) \ + (This)->lpVtbl -> CopyAndMoveBoth(This,pScratchBuffer,pSrc,cSamples,bIsOpaque) + +#define IDXARGBReadWritePtr_CopyRect(This,pScratchBuffer,pDestRect,pSrc,pSrcOrigin,bIsOpaque) \ + (This)->lpVtbl -> CopyRect(This,pScratchBuffer,pDestRect,pSrc,pSrcOrigin,bIsOpaque) + +#define IDXARGBReadWritePtr_FillAndMove(This,pScratchBuffer,SampVal,cSamples,bDoOver) \ + (This)->lpVtbl -> FillAndMove(This,pScratchBuffer,SampVal,cSamples,bDoOver) + +#define IDXARGBReadWritePtr_FillRect(This,pRect,SampVal,bDoOver) \ + (This)->lpVtbl -> FillRect(This,pRect,SampVal,bDoOver) + +#define IDXARGBReadWritePtr_OverSample(This,pOverDesc) \ + (This)->lpVtbl -> OverSample(This,pOverDesc) + +#define IDXARGBReadWritePtr_OverArrayAndMove(This,pScratchBuffer,pSrc,cSamples) \ + (This)->lpVtbl -> OverArrayAndMove(This,pScratchBuffer,pSrc,cSamples) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_PackAndMove_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + +void __RPC_STUB IDXARGBReadWritePtr_PackAndMove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_PackPremultAndMove_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + +void __RPC_STUB IDXARGBReadWritePtr_PackPremultAndMove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_PackRect_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + +void __RPC_STUB IDXARGBReadWritePtr_PackRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_CopyAndMoveBoth_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bIsOpaque); + + +void __RPC_STUB IDXARGBReadWritePtr_CopyAndMoveBoth_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_CopyRect_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const RECT *pDestRect, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ const POINT *pSrcOrigin, + /* [in] */ BOOL bIsOpaque); + + +void __RPC_STUB IDXARGBReadWritePtr_CopyRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_FillAndMove_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bDoOver); + + +void __RPC_STUB IDXARGBReadWritePtr_FillAndMove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_FillRect_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const RECT *pRect, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ BOOL bDoOver); + + +void __RPC_STUB IDXARGBReadWritePtr_FillRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_OverSample_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const DXOVERSAMPLEDESC *pOverDesc); + + +void __RPC_STUB IDXARGBReadWritePtr_OverSample_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_OverArrayAndMove_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const DXPMSAMPLE *pSrc, + /* [in] */ ULONG cSamples); + + +void __RPC_STUB IDXARGBReadWritePtr_OverArrayAndMove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXARGBReadWritePtr_INTERFACE_DEFINED__ */ + + +#ifndef __IDXDCLock_INTERFACE_DEFINED__ +#define __IDXDCLock_INTERFACE_DEFINED__ + +/* interface IDXDCLock */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXDCLock; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0F619456-CF39-11d1-905E-00C04FD9189D") + IDXDCLock : public IUnknown + { + public: + virtual HDC STDMETHODCALLTYPE GetDC( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXDCLockVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXDCLock * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXDCLock * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXDCLock * This); + + HDC ( STDMETHODCALLTYPE *GetDC )( + IDXDCLock * This); + + END_INTERFACE + } IDXDCLockVtbl; + + interface IDXDCLock + { + CONST_VTBL struct IDXDCLockVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXDCLock_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXDCLock_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXDCLock_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXDCLock_GetDC(This) \ + (This)->lpVtbl -> GetDC(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HDC STDMETHODCALLTYPE IDXDCLock_GetDC_Proxy( + IDXDCLock * This); + + +void __RPC_STUB IDXDCLock_GetDC_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXDCLock_INTERFACE_DEFINED__ */ + + +#ifndef __IDXTScaleOutput_INTERFACE_DEFINED__ +#define __IDXTScaleOutput_INTERFACE_DEFINED__ + +/* interface IDXTScaleOutput */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTScaleOutput; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B2024B50-EE77-11d1-9066-00C04FD9189D") + IDXTScaleOutput : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetOutputSize( + /* [in] */ const SIZE OutSize, + /* [in] */ BOOL bMaintainAspect) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTScaleOutputVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTScaleOutput * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTScaleOutput * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTScaleOutput * This); + + HRESULT ( STDMETHODCALLTYPE *SetOutputSize )( + IDXTScaleOutput * This, + /* [in] */ const SIZE OutSize, + /* [in] */ BOOL bMaintainAspect); + + END_INTERFACE + } IDXTScaleOutputVtbl; + + interface IDXTScaleOutput + { + CONST_VTBL struct IDXTScaleOutputVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTScaleOutput_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTScaleOutput_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTScaleOutput_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTScaleOutput_SetOutputSize(This,OutSize,bMaintainAspect) \ + (This)->lpVtbl -> SetOutputSize(This,OutSize,bMaintainAspect) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTScaleOutput_SetOutputSize_Proxy( + IDXTScaleOutput * This, + /* [in] */ const SIZE OutSize, + /* [in] */ BOOL bMaintainAspect); + + +void __RPC_STUB IDXTScaleOutput_SetOutputSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTScaleOutput_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGradient_INTERFACE_DEFINED__ +#define __IDXGradient_INTERFACE_DEFINED__ + +/* interface IDXGradient */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXGradient; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B2024B51-EE77-11d1-9066-00C04FD9189D") + IDXGradient : public IDXTScaleOutput + { + public: + virtual HRESULT STDMETHODCALLTYPE SetGradient( + DXSAMPLE StartColor, + DXSAMPLE EndColor, + BOOL bHorizontal) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOutputSize( + /* [out] */ SIZE *pOutSize) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGradientVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGradient * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGradient * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGradient * This); + + HRESULT ( STDMETHODCALLTYPE *SetOutputSize )( + IDXGradient * This, + /* [in] */ const SIZE OutSize, + /* [in] */ BOOL bMaintainAspect); + + HRESULT ( STDMETHODCALLTYPE *SetGradient )( + IDXGradient * This, + DXSAMPLE StartColor, + DXSAMPLE EndColor, + BOOL bHorizontal); + + HRESULT ( STDMETHODCALLTYPE *GetOutputSize )( + IDXGradient * This, + /* [out] */ SIZE *pOutSize); + + END_INTERFACE + } IDXGradientVtbl; + + interface IDXGradient + { + CONST_VTBL struct IDXGradientVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGradient_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXGradient_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXGradient_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXGradient_SetOutputSize(This,OutSize,bMaintainAspect) \ + (This)->lpVtbl -> SetOutputSize(This,OutSize,bMaintainAspect) + + +#define IDXGradient_SetGradient(This,StartColor,EndColor,bHorizontal) \ + (This)->lpVtbl -> SetGradient(This,StartColor,EndColor,bHorizontal) + +#define IDXGradient_GetOutputSize(This,pOutSize) \ + (This)->lpVtbl -> GetOutputSize(This,pOutSize) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXGradient_SetGradient_Proxy( + IDXGradient * This, + DXSAMPLE StartColor, + DXSAMPLE EndColor, + BOOL bHorizontal); + + +void __RPC_STUB IDXGradient_SetGradient_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXGradient_GetOutputSize_Proxy( + IDXGradient * This, + /* [out] */ SIZE *pOutSize); + + +void __RPC_STUB IDXGradient_GetOutputSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXGradient_INTERFACE_DEFINED__ */ + + +#ifndef __IDXTScale_INTERFACE_DEFINED__ +#define __IDXTScale_INTERFACE_DEFINED__ + +/* interface IDXTScale */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTScale; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B39FD742-E139-11d1-9065-00C04FD9189D") + IDXTScale : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetScales( + /* [in] */ float Scales[ 2 ]) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetScales( + /* [out] */ float Scales[ 2 ]) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScaleFitToSize( + /* [out][in] */ DXBNDS *pClipBounds, + /* [in] */ SIZE FitToSize, + /* [in] */ BOOL bMaintainAspect) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTScaleVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTScale * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTScale * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTScale * This); + + HRESULT ( STDMETHODCALLTYPE *SetScales )( + IDXTScale * This, + /* [in] */ float Scales[ 2 ]); + + HRESULT ( STDMETHODCALLTYPE *GetScales )( + IDXTScale * This, + /* [out] */ float Scales[ 2 ]); + + HRESULT ( STDMETHODCALLTYPE *ScaleFitToSize )( + IDXTScale * This, + /* [out][in] */ DXBNDS *pClipBounds, + /* [in] */ SIZE FitToSize, + /* [in] */ BOOL bMaintainAspect); + + END_INTERFACE + } IDXTScaleVtbl; + + interface IDXTScale + { + CONST_VTBL struct IDXTScaleVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTScale_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTScale_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTScale_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTScale_SetScales(This,Scales) \ + (This)->lpVtbl -> SetScales(This,Scales) + +#define IDXTScale_GetScales(This,Scales) \ + (This)->lpVtbl -> GetScales(This,Scales) + +#define IDXTScale_ScaleFitToSize(This,pClipBounds,FitToSize,bMaintainAspect) \ + (This)->lpVtbl -> ScaleFitToSize(This,pClipBounds,FitToSize,bMaintainAspect) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTScale_SetScales_Proxy( + IDXTScale * This, + /* [in] */ float Scales[ 2 ]); + + +void __RPC_STUB IDXTScale_SetScales_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTScale_GetScales_Proxy( + IDXTScale * This, + /* [out] */ float Scales[ 2 ]); + + +void __RPC_STUB IDXTScale_GetScales_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTScale_ScaleFitToSize_Proxy( + IDXTScale * This, + /* [out][in] */ DXBNDS *pClipBounds, + /* [in] */ SIZE FitToSize, + /* [in] */ BOOL bMaintainAspect); + + +void __RPC_STUB IDXTScale_ScaleFitToSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTScale_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0276 */ +/* [local] */ + +typedef +enum DISPIDDXEFFECT + { DISPID_DXECAPABILITIES = 10000, + DISPID_DXEPROGRESS = DISPID_DXECAPABILITIES + 1, + DISPID_DXESTEP = DISPID_DXEPROGRESS + 1, + DISPID_DXEDURATION = DISPID_DXESTEP + 1, + DISPID_DXE_NEXT_ID = DISPID_DXEDURATION + 1 + } DISPIDDXBOUNDEDEFFECT; + +typedef +enum DXEFFECTTYPE + { DXTET_PERIODIC = 1 << 0, + DXTET_MORPH = 1 << 1 + } DXEFFECTTYPE; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0276_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0276_v0_0_s_ifspec; + +#ifndef __IDXEffect_INTERFACE_DEFINED__ +#define __IDXEffect_INTERFACE_DEFINED__ + +/* interface IDXEffect */ +/* [dual][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXEffect; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E31FB81B-1335-11d1-8189-0000F87557DB") + IDXEffect : public IDispatch + { + public: + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Capabilities( + /* [retval][out] */ long *pVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Progress( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Progress( + /* [in] */ float newVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_StepResolution( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Duration( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Duration( + /* [in] */ float newVal) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXEffectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXEffect * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXEffect * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXEffect * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + IDXEffect * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + IDXEffect * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + IDXEffect * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + IDXEffect * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Capabilities )( + IDXEffect * This, + /* [retval][out] */ long *pVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Progress )( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Progress )( + IDXEffect * This, + /* [in] */ float newVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StepResolution )( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( + IDXEffect * This, + /* [in] */ float newVal); + + END_INTERFACE + } IDXEffectVtbl; + + interface IDXEffect + { + CONST_VTBL struct IDXEffectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXEffect_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXEffect_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXEffect_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXEffect_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IDXEffect_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IDXEffect_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IDXEffect_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IDXEffect_get_Capabilities(This,pVal) \ + (This)->lpVtbl -> get_Capabilities(This,pVal) + +#define IDXEffect_get_Progress(This,pVal) \ + (This)->lpVtbl -> get_Progress(This,pVal) + +#define IDXEffect_put_Progress(This,newVal) \ + (This)->lpVtbl -> put_Progress(This,newVal) + +#define IDXEffect_get_StepResolution(This,pVal) \ + (This)->lpVtbl -> get_StepResolution(This,pVal) + +#define IDXEffect_get_Duration(This,pVal) \ + (This)->lpVtbl -> get_Duration(This,pVal) + +#define IDXEffect_put_Duration(This,newVal) \ + (This)->lpVtbl -> put_Duration(This,newVal) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE IDXEffect_get_Capabilities_Proxy( + IDXEffect * This, + /* [retval][out] */ long *pVal); + + +void __RPC_STUB IDXEffect_get_Capabilities_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE IDXEffect_get_Progress_Proxy( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB IDXEffect_get_Progress_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE IDXEffect_put_Progress_Proxy( + IDXEffect * This, + /* [in] */ float newVal); + + +void __RPC_STUB IDXEffect_put_Progress_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE IDXEffect_get_StepResolution_Proxy( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB IDXEffect_get_StepResolution_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE IDXEffect_get_Duration_Proxy( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB IDXEffect_get_Duration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE IDXEffect_put_Duration_Proxy( + IDXEffect * This, + /* [in] */ float newVal); + + +void __RPC_STUB IDXEffect_put_Duration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXEffect_INTERFACE_DEFINED__ */ + + +#ifndef __IDXLookupTable_INTERFACE_DEFINED__ +#define __IDXLookupTable_INTERFACE_DEFINED__ + +/* interface IDXLookupTable */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXLookupTable; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("01BAFC7F-9E63-11d1-9053-00C04FD9189D") + IDXLookupTable : public IDXBaseObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetTables( + /* [out] */ BYTE RedLUT[ 256 ], + /* [out] */ BYTE GreenLUT[ 256 ], + /* [out] */ BYTE BlueLUT[ 256 ], + /* [out] */ BYTE AlphaLUT[ 256 ]) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsChannelIdentity( + /* [out] */ DXBASESAMPLE *pSampleBools) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetIndexValues( + /* [in] */ ULONG Index, + /* [out] */ DXBASESAMPLE *pSample) = 0; + + virtual HRESULT STDMETHODCALLTYPE ApplyTables( + /* [out][in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXLookupTableVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXLookupTable * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXLookupTable * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXLookupTable * This); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationId )( + IDXLookupTable * This, + /* [out] */ ULONG *pID); + + HRESULT ( STDMETHODCALLTYPE *IncrementGenerationId )( + IDXLookupTable * This, + /* [in] */ BOOL bRefresh); + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + IDXLookupTable * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *GetTables )( + IDXLookupTable * This, + /* [out] */ BYTE RedLUT[ 256 ], + /* [out] */ BYTE GreenLUT[ 256 ], + /* [out] */ BYTE BlueLUT[ 256 ], + /* [out] */ BYTE AlphaLUT[ 256 ]); + + HRESULT ( STDMETHODCALLTYPE *IsChannelIdentity )( + IDXLookupTable * This, + /* [out] */ DXBASESAMPLE *pSampleBools); + + HRESULT ( STDMETHODCALLTYPE *GetIndexValues )( + IDXLookupTable * This, + /* [in] */ ULONG Index, + /* [out] */ DXBASESAMPLE *pSample); + + HRESULT ( STDMETHODCALLTYPE *ApplyTables )( + IDXLookupTable * This, + /* [out][in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + END_INTERFACE + } IDXLookupTableVtbl; + + interface IDXLookupTable + { + CONST_VTBL struct IDXLookupTableVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXLookupTable_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXLookupTable_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXLookupTable_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXLookupTable_GetGenerationId(This,pID) \ + (This)->lpVtbl -> GetGenerationId(This,pID) + +#define IDXLookupTable_IncrementGenerationId(This,bRefresh) \ + (This)->lpVtbl -> IncrementGenerationId(This,bRefresh) + +#define IDXLookupTable_GetObjectSize(This,pcbSize) \ + (This)->lpVtbl -> GetObjectSize(This,pcbSize) + + +#define IDXLookupTable_GetTables(This,RedLUT,GreenLUT,BlueLUT,AlphaLUT) \ + (This)->lpVtbl -> GetTables(This,RedLUT,GreenLUT,BlueLUT,AlphaLUT) + +#define IDXLookupTable_IsChannelIdentity(This,pSampleBools) \ + (This)->lpVtbl -> IsChannelIdentity(This,pSampleBools) + +#define IDXLookupTable_GetIndexValues(This,Index,pSample) \ + (This)->lpVtbl -> GetIndexValues(This,Index,pSample) + +#define IDXLookupTable_ApplyTables(This,pSamples,cSamples) \ + (This)->lpVtbl -> ApplyTables(This,pSamples,cSamples) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXLookupTable_GetTables_Proxy( + IDXLookupTable * This, + /* [out] */ BYTE RedLUT[ 256 ], + /* [out] */ BYTE GreenLUT[ 256 ], + /* [out] */ BYTE BlueLUT[ 256 ], + /* [out] */ BYTE AlphaLUT[ 256 ]); + + +void __RPC_STUB IDXLookupTable_GetTables_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXLookupTable_IsChannelIdentity_Proxy( + IDXLookupTable * This, + /* [out] */ DXBASESAMPLE *pSampleBools); + + +void __RPC_STUB IDXLookupTable_IsChannelIdentity_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXLookupTable_GetIndexValues_Proxy( + IDXLookupTable * This, + /* [in] */ ULONG Index, + /* [out] */ DXBASESAMPLE *pSample); + + +void __RPC_STUB IDXLookupTable_GetIndexValues_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXLookupTable_ApplyTables_Proxy( + IDXLookupTable * This, + /* [out][in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + +void __RPC_STUB IDXLookupTable_ApplyTables_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXLookupTable_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0278 */ +/* [local] */ + +typedef struct DXRAWSURFACEINFO + { + BYTE *pFirstByte; + long lPitch; + ULONG Width; + ULONG Height; + const GUID *pPixelFormat; + HDC hdc; + DWORD dwColorKey; + DXBASESAMPLE *pPalette; + } DXRAWSURFACEINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0278_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0278_v0_0_s_ifspec; + +#ifndef __IDXRawSurface_INTERFACE_DEFINED__ +#define __IDXRawSurface_INTERFACE_DEFINED__ + +/* interface IDXRawSurface */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXRawSurface; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("09756C8A-D96A-11d1-9062-00C04FD9189D") + IDXRawSurface : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSurfaceInfo( + DXRAWSURFACEINFO *pSurfaceInfo) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXRawSurfaceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXRawSurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXRawSurface * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXRawSurface * This); + + HRESULT ( STDMETHODCALLTYPE *GetSurfaceInfo )( + IDXRawSurface * This, + DXRAWSURFACEINFO *pSurfaceInfo); + + END_INTERFACE + } IDXRawSurfaceVtbl; + + interface IDXRawSurface + { + CONST_VTBL struct IDXRawSurfaceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXRawSurface_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXRawSurface_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXRawSurface_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXRawSurface_GetSurfaceInfo(This,pSurfaceInfo) \ + (This)->lpVtbl -> GetSurfaceInfo(This,pSurfaceInfo) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXRawSurface_GetSurfaceInfo_Proxy( + IDXRawSurface * This, + DXRAWSURFACEINFO *pSurfaceInfo); + + +void __RPC_STUB IDXRawSurface_GetSurfaceInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXRawSurface_INTERFACE_DEFINED__ */ + + +#ifndef __IHTMLDXTransform_INTERFACE_DEFINED__ +#define __IHTMLDXTransform_INTERFACE_DEFINED__ + +/* interface IHTMLDXTransform */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IHTMLDXTransform; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("30E2AB7D-4FDD-4159-B7EA-DC722BF4ADE5") + IHTMLDXTransform : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetHostUrl( + BSTR bstrHostUrl) = 0; + + }; + +#else /* C style interface */ + + typedef struct IHTMLDXTransformVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IHTMLDXTransform * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IHTMLDXTransform * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IHTMLDXTransform * This); + + HRESULT ( STDMETHODCALLTYPE *SetHostUrl )( + IHTMLDXTransform * This, + BSTR bstrHostUrl); + + END_INTERFACE + } IHTMLDXTransformVtbl; + + interface IHTMLDXTransform + { + CONST_VTBL struct IHTMLDXTransformVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IHTMLDXTransform_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IHTMLDXTransform_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IHTMLDXTransform_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IHTMLDXTransform_SetHostUrl(This,bstrHostUrl) \ + (This)->lpVtbl -> SetHostUrl(This,bstrHostUrl) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IHTMLDXTransform_SetHostUrl_Proxy( + IHTMLDXTransform * This, + BSTR bstrHostUrl); + + +void __RPC_STUB IHTMLDXTransform_SetHostUrl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IHTMLDXTransform_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0280 */ +/* [local] */ + +typedef +enum DXTFILTER_STATUS + { DXTFILTER_STATUS_Stopped = 0, + DXTFILTER_STATUS_Applied = DXTFILTER_STATUS_Stopped + 1, + DXTFILTER_STATUS_Playing = DXTFILTER_STATUS_Applied + 1, + DXTFILTER_STATUS_MAX = DXTFILTER_STATUS_Playing + 1 + } DXTFILTER_STATUS; + +typedef +enum DXTFILTER_DISPID + { DISPID_DXTFilter_Percent = 1, + DISPID_DXTFilter_Duration = DISPID_DXTFilter_Percent + 1, + DISPID_DXTFilter_Enabled = DISPID_DXTFilter_Duration + 1, + DISPID_DXTFilter_Status = DISPID_DXTFilter_Enabled + 1, + DISPID_DXTFilter_Apply = DISPID_DXTFilter_Status + 1, + DISPID_DXTFilter_Play = DISPID_DXTFilter_Apply + 1, + DISPID_DXTFilter_Stop = DISPID_DXTFilter_Play + 1, + DISPID_DXTFilter_MAX = DISPID_DXTFilter_Stop + 1 + } DXTFILTER_DISPID; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0280_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0280_v0_0_s_ifspec; + +#ifndef __ICSSFilterDispatch_INTERFACE_DEFINED__ +#define __ICSSFilterDispatch_INTERFACE_DEFINED__ + +/* interface ICSSFilterDispatch */ +/* [dual][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ICSSFilterDispatch; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9519152B-9484-4A6C-B6A7-4F25E92D6C6B") + ICSSFilterDispatch : public IDispatch + { + public: + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Percent( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Percent( + /* [in] */ float newVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Duration( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Duration( + /* [in] */ float newVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Enabled( + /* [retval][out] */ VARIANT_BOOL *pfVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Enabled( + /* [in] */ VARIANT_BOOL fVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Status( + /* [retval][out] */ DXTFILTER_STATUS *peVal) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Apply( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Play( + /* [optional][in] */ VARIANT varDuration) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ICSSFilterDispatchVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICSSFilterDispatch * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICSSFilterDispatch * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ICSSFilterDispatch * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ICSSFilterDispatch * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ICSSFilterDispatch * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ICSSFilterDispatch * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ICSSFilterDispatch * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Percent )( + ICSSFilterDispatch * This, + /* [retval][out] */ float *pVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Percent )( + ICSSFilterDispatch * This, + /* [in] */ float newVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( + ICSSFilterDispatch * This, + /* [retval][out] */ float *pVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( + ICSSFilterDispatch * This, + /* [in] */ float newVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Enabled )( + ICSSFilterDispatch * This, + /* [retval][out] */ VARIANT_BOOL *pfVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Enabled )( + ICSSFilterDispatch * This, + /* [in] */ VARIANT_BOOL fVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ICSSFilterDispatch * This, + /* [retval][out] */ DXTFILTER_STATUS *peVal); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE *Apply )( + ICSSFilterDispatch * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE *Play )( + ICSSFilterDispatch * This, + /* [optional][in] */ VARIANT varDuration); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE *Stop )( + ICSSFilterDispatch * This); + + END_INTERFACE + } ICSSFilterDispatchVtbl; + + interface ICSSFilterDispatch + { + CONST_VTBL struct ICSSFilterDispatchVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICSSFilterDispatch_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ICSSFilterDispatch_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ICSSFilterDispatch_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ICSSFilterDispatch_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ICSSFilterDispatch_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ICSSFilterDispatch_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ICSSFilterDispatch_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ICSSFilterDispatch_get_Percent(This,pVal) \ + (This)->lpVtbl -> get_Percent(This,pVal) + +#define ICSSFilterDispatch_put_Percent(This,newVal) \ + (This)->lpVtbl -> put_Percent(This,newVal) + +#define ICSSFilterDispatch_get_Duration(This,pVal) \ + (This)->lpVtbl -> get_Duration(This,pVal) + +#define ICSSFilterDispatch_put_Duration(This,newVal) \ + (This)->lpVtbl -> put_Duration(This,newVal) + +#define ICSSFilterDispatch_get_Enabled(This,pfVal) \ + (This)->lpVtbl -> get_Enabled(This,pfVal) + +#define ICSSFilterDispatch_put_Enabled(This,fVal) \ + (This)->lpVtbl -> put_Enabled(This,fVal) + +#define ICSSFilterDispatch_get_Status(This,peVal) \ + (This)->lpVtbl -> get_Status(This,peVal) + +#define ICSSFilterDispatch_Apply(This) \ + (This)->lpVtbl -> Apply(This) + +#define ICSSFilterDispatch_Play(This,varDuration) \ + (This)->lpVtbl -> Play(This,varDuration) + +#define ICSSFilterDispatch_Stop(This) \ + (This)->lpVtbl -> Stop(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_get_Percent_Proxy( + ICSSFilterDispatch * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB ICSSFilterDispatch_get_Percent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_put_Percent_Proxy( + ICSSFilterDispatch * This, + /* [in] */ float newVal); + + +void __RPC_STUB ICSSFilterDispatch_put_Percent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_get_Duration_Proxy( + ICSSFilterDispatch * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB ICSSFilterDispatch_get_Duration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_put_Duration_Proxy( + ICSSFilterDispatch * This, + /* [in] */ float newVal); + + +void __RPC_STUB ICSSFilterDispatch_put_Duration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_get_Enabled_Proxy( + ICSSFilterDispatch * This, + /* [retval][out] */ VARIANT_BOOL *pfVal); + + +void __RPC_STUB ICSSFilterDispatch_get_Enabled_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_put_Enabled_Proxy( + ICSSFilterDispatch * This, + /* [in] */ VARIANT_BOOL fVal); + + +void __RPC_STUB ICSSFilterDispatch_put_Enabled_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_get_Status_Proxy( + ICSSFilterDispatch * This, + /* [retval][out] */ DXTFILTER_STATUS *peVal); + + +void __RPC_STUB ICSSFilterDispatch_get_Status_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_Apply_Proxy( + ICSSFilterDispatch * This); + + +void __RPC_STUB ICSSFilterDispatch_Apply_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_Play_Proxy( + ICSSFilterDispatch * This, + /* [optional][in] */ VARIANT varDuration); + + +void __RPC_STUB ICSSFilterDispatch_Play_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_Stop_Proxy( + ICSSFilterDispatch * This); + + +void __RPC_STUB ICSSFilterDispatch_Stop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ICSSFilterDispatch_INTERFACE_DEFINED__ */ + + + +#ifndef __DXTRANSLib_LIBRARY_DEFINED__ +#define __DXTRANSLib_LIBRARY_DEFINED__ + +/* library DXTRANSLib */ +/* [helpstring][version][uuid] */ + + +EXTERN_C const IID LIBID_DXTRANSLib; + +EXTERN_C const CLSID CLSID_DXTransformFactory; + +#ifdef __cplusplus + +class DECLSPEC_UUID("D1FE6762-FC48-11D0-883A-3C8B00C10000") +DXTransformFactory; +#endif + +EXTERN_C const CLSID CLSID_DXTaskManager; + +#ifdef __cplusplus + +class DECLSPEC_UUID("4CB26C03-FF93-11d0-817E-0000F87557DB") +DXTaskManager; +#endif + +EXTERN_C const CLSID CLSID_DXTScale; + +#ifdef __cplusplus + +class DECLSPEC_UUID("555278E2-05DB-11D1-883A-3C8B00C10000") +DXTScale; +#endif + +EXTERN_C const CLSID CLSID_DXSurface; + +#ifdef __cplusplus + +class DECLSPEC_UUID("0E890F83-5F79-11D1-9043-00C04FD9189D") +DXSurface; +#endif + +EXTERN_C const CLSID CLSID_DXSurfaceModifier; + +#ifdef __cplusplus + +class DECLSPEC_UUID("3E669F1D-9C23-11d1-9053-00C04FD9189D") +DXSurfaceModifier; +#endif + +EXTERN_C const CLSID CLSID_DXGradient; + +#ifdef __cplusplus + +class DECLSPEC_UUID("C6365470-F667-11d1-9067-00C04FD9189D") +DXGradient; +#endif + +EXTERN_C const CLSID CLSID_DXTFilter; + +#ifdef __cplusplus + +class DECLSPEC_UUID("385A91BC-1E8A-4e4a-A7A6-F4FC1E6CA1BD") +DXTFilter; +#endif +#endif /* __DXTRANSLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER VARIANT_UserSize( unsigned long *, unsigned long , VARIANT * ); +unsigned char * __RPC_USER VARIANT_UserMarshal( unsigned long *, unsigned char *, VARIANT * ); +unsigned char * __RPC_USER VARIANT_UserUnmarshal(unsigned long *, unsigned char *, VARIANT * ); +void __RPC_USER VARIANT_UserFree( unsigned long *, VARIANT * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/saco/d3d9/include/dxutil.h b/saco/d3d9/include/dxutil.h new file mode 100644 index 0000000..7008a4c --- /dev/null +++ b/saco/d3d9/include/dxutil.h @@ -0,0 +1,181 @@ +//----------------------------------------------------------------------------- +// File: DXUtil.h +// +// Desc: Helper functions and typing shortcuts for DirectX programming. +// +// Copyright (c) Microsoft Corporation. All rights reserved +//----------------------------------------------------------------------------- +#ifndef DXUTIL_H +#define DXUTIL_H + + +//----------------------------------------------------------------------------- +// Miscellaneous helper functions +//----------------------------------------------------------------------------- +#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } } +#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } } +#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } + + +#ifndef UNDER_CE +//----------------------------------------------------------------------------- +// Name: DXUtil_GetDXSDKMediaPath() and DXUtil_FindMediaFile() +// Desc: Returns the DirectX SDK path, as stored in the system registry +// during the SDK install. +//----------------------------------------------------------------------------- +HRESULT DXUtil_GetDXSDKMediaPathCch( TCHAR* strDest, int cchDest ); +HRESULT DXUtil_GetDXSDKMediaPathCb( TCHAR* szDest, int cbDest ); +HRESULT DXUtil_FindMediaFileCch( TCHAR* strDestPath, int cchDest, LPCTSTR strFilename ); +HRESULT DXUtil_FindMediaFileCb( TCHAR* szDestPath, int cbDest, LPCTSTR strFilename ); +#endif // !UNDER_CE + + +//----------------------------------------------------------------------------- +// Name: DXUtil_Read*RegKey() and DXUtil_Write*RegKey() +// Desc: Helper functions to read/write a string registry key +//----------------------------------------------------------------------------- +HRESULT DXUtil_WriteStringRegKey( HKEY hKey, LPCTSTR strRegName, LPCTSTR strValue ); +HRESULT DXUtil_WriteFloatRegKey( HKEY hKey, LPCTSTR strRegName, FLOAT fValue ); +HRESULT DXUtil_WriteIntRegKey( HKEY hKey, LPCTSTR strRegName, DWORD dwValue ); +HRESULT DXUtil_WriteGuidRegKey( HKEY hKey, LPCTSTR strRegName, GUID guidValue ); +HRESULT DXUtil_WriteBoolRegKey( HKEY hKey, LPCTSTR strRegName, BOOL bValue ); + +HRESULT DXUtil_ReadStringRegKeyCch( HKEY hKey, LPCTSTR strRegName, TCHAR* strDest, DWORD cchDest, LPCTSTR strDefault ); +HRESULT DXUtil_ReadStringRegKeyCb( HKEY hKey, LPCTSTR strRegName, TCHAR* strDest, DWORD cbDest, LPCTSTR strDefault ); +HRESULT DXUtil_ReadFloatRegKey( HKEY hKey, LPCTSTR strRegName, FLOAT* fDest, FLOAT fDefault ); +HRESULT DXUtil_ReadIntRegKey( HKEY hKey, LPCTSTR strRegName, DWORD* pdwValue, DWORD dwDefault ); +HRESULT DXUtil_ReadGuidRegKey( HKEY hKey, LPCTSTR strRegName, GUID* pGuidValue, GUID& guidDefault ); +HRESULT DXUtil_ReadBoolRegKey( HKEY hKey, LPCTSTR strRegName, BOOL* pbValue, BOOL bDefault ); + + +//----------------------------------------------------------------------------- +// Name: DXUtil_Timer() +// Desc: Performs timer opertations. Use the following commands: +// TIMER_RESET - to reset the timer +// TIMER_START - to start the timer +// TIMER_STOP - to stop (or pause) the timer +// TIMER_ADVANCE - to advance the timer by 0.1 seconds +// TIMER_GETABSOLUTETIME - to get the absolute system time +// TIMER_GETAPPTIME - to get the current time +// TIMER_GETELAPSEDTIME - to get the time that elapsed between +// TIMER_GETELAPSEDTIME calls +//----------------------------------------------------------------------------- +enum TIMER_COMMAND { TIMER_RESET, TIMER_START, TIMER_STOP, TIMER_ADVANCE, + TIMER_GETABSOLUTETIME, TIMER_GETAPPTIME, TIMER_GETELAPSEDTIME }; +FLOAT __stdcall DXUtil_Timer( TIMER_COMMAND command ); + + +//----------------------------------------------------------------------------- +// UNICODE support for converting between CHAR, TCHAR, and WCHAR strings +//----------------------------------------------------------------------------- +HRESULT DXUtil_ConvertAnsiStringToWideCch( WCHAR* wstrDestination, const CHAR* strSource, int cchDestChar ); +HRESULT DXUtil_ConvertWideStringToAnsiCch( CHAR* strDestination, const WCHAR* wstrSource, int cchDestChar ); +HRESULT DXUtil_ConvertGenericStringToAnsiCch( CHAR* strDestination, const TCHAR* tstrSource, int cchDestChar ); +HRESULT DXUtil_ConvertGenericStringToWideCch( WCHAR* wstrDestination, const TCHAR* tstrSource, int cchDestChar ); +HRESULT DXUtil_ConvertAnsiStringToGenericCch( TCHAR* tstrDestination, const CHAR* strSource, int cchDestChar ); +HRESULT DXUtil_ConvertWideStringToGenericCch( TCHAR* tstrDestination, const WCHAR* wstrSource, int cchDestChar ); +HRESULT DXUtil_ConvertAnsiStringToWideCb( WCHAR* wstrDestination, const CHAR* strSource, int cbDestChar ); +HRESULT DXUtil_ConvertWideStringToAnsiCb( CHAR* strDestination, const WCHAR* wstrSource, int cbDestChar ); +HRESULT DXUtil_ConvertGenericStringToAnsiCb( CHAR* strDestination, const TCHAR* tstrSource, int cbDestChar ); +HRESULT DXUtil_ConvertGenericStringToWideCb( WCHAR* wstrDestination, const TCHAR* tstrSource, int cbDestChar ); +HRESULT DXUtil_ConvertAnsiStringToGenericCb( TCHAR* tstrDestination, const CHAR* strSource, int cbDestChar ); +HRESULT DXUtil_ConvertWideStringToGenericCb( TCHAR* tstrDestination, const WCHAR* wstrSource, int cbDestChar ); + + +//----------------------------------------------------------------------------- +// Readme functions +//----------------------------------------------------------------------------- +VOID DXUtil_LaunchReadme( HWND hWnd, LPCTSTR strLoc = NULL ); + +//----------------------------------------------------------------------------- +// GUID to String converting +//----------------------------------------------------------------------------- +HRESULT DXUtil_ConvertGUIDToStringCch( const GUID* pGuidSrc, TCHAR* strDest, int cchDestChar ); +HRESULT DXUtil_ConvertGUIDToStringCb( const GUID* pGuidSrc, TCHAR* strDest, int cbDestChar ); +HRESULT DXUtil_ConvertStringToGUID( const TCHAR* strIn, GUID* pGuidOut ); + + +//----------------------------------------------------------------------------- +// Debug printing support +// See dxerr9.h for more debug printing support +//----------------------------------------------------------------------------- +VOID DXUtil_Trace( LPCTSTR strMsg, ... ); + +#if defined(DEBUG) | defined(_DEBUG) + #define DXTRACE DXUtil_Trace +#else + #define DXTRACE sizeof +#endif + + +//----------------------------------------------------------------------------- +// Name: ArrayListType +// Desc: Indicates how data should be stored in a CArrayList +//----------------------------------------------------------------------------- +enum ArrayListType +{ + AL_VALUE, // entry data is copied into the list + AL_REFERENCE, // entry pointers are copied into the list +}; + + +//----------------------------------------------------------------------------- +// Name: CArrayList +// Desc: A growable array +//----------------------------------------------------------------------------- +class CArrayList +{ +protected: + ArrayListType m_ArrayListType; + void* m_pData; + UINT m_BytesPerEntry; + UINT m_NumEntries; + UINT m_NumEntriesAllocated; + +public: + CArrayList( ArrayListType Type, UINT BytesPerEntry = 0 ); + ~CArrayList( void ); + HRESULT Add( void* pEntry ); + void Remove( UINT Entry ); + void* GetPtr( UINT Entry ); + UINT Count( void ) { return m_NumEntries; } + bool Contains( void* pEntryData ); + void Clear( void ) { m_NumEntries = 0; } +}; + +//----------------------------------------------------------------------------- +// WinCE build support +//----------------------------------------------------------------------------- + +#ifdef UNDER_CE + +#define CheckDlgButton(hdialog, id, state) ::SendMessage(::GetDlgItem(hdialog, id), BM_SETCHECK, state, 0) +#define IsDlgButtonChecked(hdialog, id) ::SendMessage(::GetDlgItem(hdialog, id), BM_GETCHECK, 0L, 0L) +#define GETTIMESTAMP GetTickCount +#define _TWINCE(x) _T(x) + +__inline int GetScrollPos(HWND hWnd, int nBar) +{ + SCROLLINFO si; + memset(&si, 0, sizeof(si)); + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + if (!GetScrollInfo(hWnd, nBar, &si)) + { + return 0; + } + else + { + return si.nPos; + } +} + +#else // !UNDER_CE + +#define GETTIMESTAMP timeGetTime +#define _TWINCE(x) x + +#endif // UNDER_CE + + +#endif // DXUTIL_H diff --git a/saco/d3d9/include/multimon.h b/saco/d3d9/include/multimon.h new file mode 100644 index 0000000..077b87b --- /dev/null +++ b/saco/d3d9/include/multimon.h @@ -0,0 +1,484 @@ +//============================================================================= +// +// multimon.h -- Stub module that fakes multiple monitor apis on Win32 OSes +// without them. +// +// By using this header your code will get back default values from +// GetSystemMetrics() for new metrics, and the new multimonitor APIs +// will act like only one display is present on a Win32 OS without +// multimonitor APIs. +// +// Exactly one source must include this with COMPILE_MULTIMON_STUBS defined. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +//============================================================================= + +#ifdef __cplusplus +extern "C" { // Assume C declarations for C++ +#endif // __cplusplus + +// +// If we are building with Win95/NT4 headers, we need to declare +// the multimonitor-related metrics and APIs ourselves. +// +#ifndef SM_CMONITORS + +#define SM_XVIRTUALSCREEN 76 +#define SM_YVIRTUALSCREEN 77 +#define SM_CXVIRTUALSCREEN 78 +#define SM_CYVIRTUALSCREEN 79 +#define SM_CMONITORS 80 +#define SM_SAMEDISPLAYFORMAT 81 + +// HMONITOR is already declared if WINVER >= 0x0500 in windef.h +// This is for components built with an older version number. +// +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) +DECLARE_HANDLE(HMONITOR); +#define HMONITOR_DECLARED +#endif + +#define MONITOR_DEFAULTTONULL 0x00000000 +#define MONITOR_DEFAULTTOPRIMARY 0x00000001 +#define MONITOR_DEFAULTTONEAREST 0x00000002 + +#define MONITORINFOF_PRIMARY 0x00000001 + +typedef struct tagMONITORINFO +{ + DWORD cbSize; + RECT rcMonitor; + RECT rcWork; + DWORD dwFlags; +} MONITORINFO, *LPMONITORINFO; + +#ifndef CCHDEVICENAME +#define CCHDEVICENAME 32 +#endif + +#ifdef __cplusplus +typedef struct tagMONITORINFOEXA : public tagMONITORINFO +{ + CHAR szDevice[CCHDEVICENAME]; +} MONITORINFOEXA, *LPMONITORINFOEXA; +typedef struct tagMONITORINFOEXW : public tagMONITORINFO +{ + WCHAR szDevice[CCHDEVICENAME]; +} MONITORINFOEXW, *LPMONITORINFOEXW; +#ifdef UNICODE +typedef MONITORINFOEXW MONITORINFOEX; +typedef LPMONITORINFOEXW LPMONITORINFOEX; +#else +typedef MONITORINFOEXA MONITORINFOEX; +typedef LPMONITORINFOEXA LPMONITORINFOEX; +#endif // UNICODE +#else // ndef __cplusplus +typedef struct tagMONITORINFOEXA +{ + MONITORINFO; + CHAR szDevice[CCHDEVICENAME]; +} MONITORINFOEXA, *LPMONITORINFOEXA; +typedef struct tagMONITORINFOEXW +{ + MONITORINFO; + WCHAR szDevice[CCHDEVICENAME]; +} MONITORINFOEXW, *LPMONITORINFOEXW; +#ifdef UNICODE +typedef MONITORINFOEXW MONITORINFOEX; +typedef LPMONITORINFOEXW LPMONITORINFOEX; +#else +typedef MONITORINFOEXA MONITORINFOEX; +typedef LPMONITORINFOEXA LPMONITORINFOEX; +#endif // UNICODE +#endif + +typedef BOOL (CALLBACK* MONITORENUMPROC)(HMONITOR, HDC, LPRECT, LPARAM); + +#ifndef DISPLAY_DEVICE_ATTACHED_TO_DESKTOP +typedef struct _DISPLAY_DEVICEA { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD StateFlags; + CHAR DeviceID[128]; + CHAR DeviceKey[128]; +} DISPLAY_DEVICEA, *PDISPLAY_DEVICEA, *LPDISPLAY_DEVICEA; +typedef struct _DISPLAY_DEVICEW { + DWORD cb; + WCHAR DeviceName[32]; + WCHAR DeviceString[128]; + DWORD StateFlags; + WCHAR DeviceID[128]; + WCHAR DeviceKey[128]; +} DISPLAY_DEVICEW, *PDISPLAY_DEVICEW, *LPDISPLAY_DEVICEW; +#ifdef UNICODE +typedef DISPLAY_DEVICEW DISPLAY_DEVICE; +typedef PDISPLAY_DEVICEW PDISPLAY_DEVICE; +typedef LPDISPLAY_DEVICEW LPDISPLAY_DEVICE; +#else +typedef DISPLAY_DEVICEA DISPLAY_DEVICE; +typedef PDISPLAY_DEVICEA PDISPLAY_DEVICE; +typedef LPDISPLAY_DEVICEA LPDISPLAY_DEVICE; +#endif // UNICODE + +#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001 +#define DISPLAY_DEVICE_MULTI_DRIVER 0x00000002 +#define DISPLAY_DEVICE_PRIMARY_DEVICE 0x00000004 +#define DISPLAY_DEVICE_MIRRORING_DRIVER 0x00000008 +#define DISPLAY_DEVICE_VGA_COMPATIBLE 0x00000010 +#endif + +#endif // SM_CMONITORS + +#undef GetMonitorInfo +#undef GetSystemMetrics +#undef MonitorFromWindow +#undef MonitorFromRect +#undef MonitorFromPoint +#undef EnumDisplayMonitors +#undef EnumDisplayDevices + +// +// Define COMPILE_MULTIMON_STUBS to compile the stubs; +// otherwise, you get the declarations. +// +#ifdef COMPILE_MULTIMON_STUBS + +//----------------------------------------------------------------------------- +// +// Implement the API stubs. +// +//----------------------------------------------------------------------------- + +#ifndef MULTIMON_FNS_DEFINED + +int (WINAPI* g_pfnGetSystemMetrics)(int) = NULL; +HMONITOR (WINAPI* g_pfnMonitorFromWindow)(HWND, DWORD) = NULL; +HMONITOR (WINAPI* g_pfnMonitorFromRect)(LPCRECT, DWORD) = NULL; +HMONITOR (WINAPI* g_pfnMonitorFromPoint)(POINT, DWORD) = NULL; +BOOL (WINAPI* g_pfnGetMonitorInfo)(HMONITOR, LPMONITORINFO) = NULL; +BOOL (WINAPI* g_pfnEnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARAM) = NULL; +BOOL (WINAPI* g_pfnEnumDisplayDevices)(PVOID, DWORD, PDISPLAY_DEVICE,DWORD) = NULL; +BOOL g_fMultiMonInitDone = FALSE; +BOOL g_fMultimonPlatformNT = FALSE; + +#endif + +BOOL IsPlatformNT() +{ + OSVERSIONINFOA osvi = {0}; + osvi.dwOSVersionInfoSize = sizeof(osvi); + GetVersionExA((OSVERSIONINFOA*)&osvi); + return (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId); +} + +BOOL InitMultipleMonitorStubs(void) +{ + HMODULE hUser32; + if (g_fMultiMonInitDone) + { + return g_pfnGetMonitorInfo != NULL; + } + + g_fMultimonPlatformNT = IsPlatformNT(); + hUser32 = GetModuleHandle(TEXT("USER32")); + if (hUser32 && + (*(FARPROC*)&g_pfnGetSystemMetrics = GetProcAddress(hUser32,"GetSystemMetrics")) != NULL && + (*(FARPROC*)&g_pfnMonitorFromWindow = GetProcAddress(hUser32,"MonitorFromWindow")) != NULL && + (*(FARPROC*)&g_pfnMonitorFromRect = GetProcAddress(hUser32,"MonitorFromRect")) != NULL && + (*(FARPROC*)&g_pfnMonitorFromPoint = GetProcAddress(hUser32,"MonitorFromPoint")) != NULL && + (*(FARPROC*)&g_pfnEnumDisplayMonitors = GetProcAddress(hUser32,"EnumDisplayMonitors")) != NULL && +#ifdef UNICODE + (*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesW")) != NULL && + (*(FARPROC*)&g_pfnGetMonitorInfo = g_fMultimonPlatformNT ? GetProcAddress(hUser32,"GetMonitorInfoW") : + GetProcAddress(hUser32,"GetMonitorInfoA")) != NULL +#else + (*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoA")) != NULL && + (*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesA")) != NULL +#endif + ) { + g_fMultiMonInitDone = TRUE; + return TRUE; + } + else + { + g_pfnGetSystemMetrics = NULL; + g_pfnMonitorFromWindow = NULL; + g_pfnMonitorFromRect = NULL; + g_pfnMonitorFromPoint = NULL; + g_pfnGetMonitorInfo = NULL; + g_pfnEnumDisplayMonitors = NULL; + g_pfnEnumDisplayDevices = NULL; + + g_fMultiMonInitDone = TRUE; + return FALSE; + } +} + +//----------------------------------------------------------------------------- +// +// fake implementations of Monitor APIs that work with the primary display +// no special parameter validation is made since these run in client code +// +//----------------------------------------------------------------------------- + +int WINAPI +xGetSystemMetrics(int nIndex) +{ + if (InitMultipleMonitorStubs()) + return g_pfnGetSystemMetrics(nIndex); + + switch (nIndex) + { + case SM_CMONITORS: + case SM_SAMEDISPLAYFORMAT: + return 1; + + case SM_XVIRTUALSCREEN: + case SM_YVIRTUALSCREEN: + return 0; + + case SM_CXVIRTUALSCREEN: + nIndex = SM_CXSCREEN; + break; + + case SM_CYVIRTUALSCREEN: + nIndex = SM_CYSCREEN; + break; + } + + return GetSystemMetrics(nIndex); +} + +#define xPRIMARY_MONITOR ((HMONITOR)0x12340042) + +HMONITOR WINAPI +xMonitorFromPoint(POINT ptScreenCoords, DWORD dwFlags) +{ + if (InitMultipleMonitorStubs()) + return g_pfnMonitorFromPoint(ptScreenCoords, dwFlags); + + if ((dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) || + ((ptScreenCoords.x >= 0) && + (ptScreenCoords.x < GetSystemMetrics(SM_CXSCREEN)) && + (ptScreenCoords.y >= 0) && + (ptScreenCoords.y < GetSystemMetrics(SM_CYSCREEN)))) + { + return xPRIMARY_MONITOR; + } + + return NULL; +} + +HMONITOR WINAPI +xMonitorFromRect(LPCRECT lprcScreenCoords, DWORD dwFlags) +{ + if (InitMultipleMonitorStubs()) + return g_pfnMonitorFromRect(lprcScreenCoords, dwFlags); + + if ((dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) || + ((lprcScreenCoords->right > 0) && + (lprcScreenCoords->bottom > 0) && + (lprcScreenCoords->left < GetSystemMetrics(SM_CXSCREEN)) && + (lprcScreenCoords->top < GetSystemMetrics(SM_CYSCREEN)))) + { + return xPRIMARY_MONITOR; + } + + return NULL; +} + +HMONITOR WINAPI +xMonitorFromWindow(HWND hWnd, DWORD dwFlags) +{ + WINDOWPLACEMENT wp; + + if (InitMultipleMonitorStubs()) + return g_pfnMonitorFromWindow(hWnd, dwFlags); + + if (dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) + return xPRIMARY_MONITOR; + + if (IsIconic(hWnd) ? + GetWindowPlacement(hWnd, &wp) : + GetWindowRect(hWnd, &wp.rcNormalPosition)) { + + return xMonitorFromRect(&wp.rcNormalPosition, dwFlags); + } + + return NULL; +} + +BOOL WINAPI +xGetMonitorInfo(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo) +{ + RECT rcWork; + + if (InitMultipleMonitorStubs()) + { + BOOL f = g_pfnGetMonitorInfo(hMonitor, lpMonitorInfo); +#ifdef UNICODE + if (f && !g_fMultimonPlatformNT && (lpMonitorInfo->cbSize >= sizeof(MONITORINFOEX))) + { + MultiByteToWideChar(CP_ACP, 0, + (LPSTR)((MONITORINFOEX*)lpMonitorInfo)->szDevice, -1, + ((MONITORINFOEX*)lpMonitorInfo)->szDevice, (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR))); + } +#endif + return f; + } + + if ((hMonitor == xPRIMARY_MONITOR) && + lpMonitorInfo && + (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) && + SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0)) + { + lpMonitorInfo->rcMonitor.left = 0; + lpMonitorInfo->rcMonitor.top = 0; + lpMonitorInfo->rcMonitor.right = GetSystemMetrics(SM_CXSCREEN); + lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN); + lpMonitorInfo->rcWork = rcWork; + lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY; + + if (lpMonitorInfo->cbSize >= sizeof(MONITORINFOEX)) + { +#ifdef UNICODE + MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, ((MONITORINFOEX*)lpMonitorInfo)->szDevice, (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR))); +#else // UNICODE + lstrcpy(((MONITORINFOEX*)lpMonitorInfo)->szDevice, TEXT("DISPLAY")); +#endif // UNICODE + } + + return TRUE; + } + + return FALSE; +} + +BOOL WINAPI +xEnumDisplayMonitors( + HDC hdcOptionalForPainting, + LPCRECT lprcEnumMonitorsThatIntersect, + MONITORENUMPROC lpfnEnumProc, + LPARAM dwData) +{ + RECT rcLimit; + + if (InitMultipleMonitorStubs()) { + return g_pfnEnumDisplayMonitors( + hdcOptionalForPainting, + lprcEnumMonitorsThatIntersect, + lpfnEnumProc, + dwData); + } + + if (!lpfnEnumProc) + return FALSE; + + rcLimit.left = 0; + rcLimit.top = 0; + rcLimit.right = GetSystemMetrics(SM_CXSCREEN); + rcLimit.bottom = GetSystemMetrics(SM_CYSCREEN); + + if (hdcOptionalForPainting) + { + RECT rcClip; + POINT ptOrg; + + switch (GetClipBox(hdcOptionalForPainting, &rcClip)) + { + default: + if (!GetDCOrgEx(hdcOptionalForPainting, &ptOrg)) + return FALSE; + + OffsetRect(&rcLimit, -ptOrg.x, -ptOrg.y); + if (IntersectRect(&rcLimit, &rcLimit, &rcClip) && + (!lprcEnumMonitorsThatIntersect || + IntersectRect(&rcLimit, &rcLimit, lprcEnumMonitorsThatIntersect))) { + + break; + } + //fall thru + case NULLREGION: + return TRUE; + case ERROR: + return FALSE; + } + } else { + if ( lprcEnumMonitorsThatIntersect && + !IntersectRect(&rcLimit, &rcLimit, lprcEnumMonitorsThatIntersect)) { + + return TRUE; + } + } + + return lpfnEnumProc( + xPRIMARY_MONITOR, + hdcOptionalForPainting, + &rcLimit, + dwData); +} + +BOOL WINAPI +xEnumDisplayDevices( + PVOID Unused, + DWORD iDevNum, + PDISPLAY_DEVICE lpDisplayDevice, + DWORD dwFlags) +{ + if (InitMultipleMonitorStubs()) + return g_pfnEnumDisplayDevices(Unused, iDevNum, lpDisplayDevice, dwFlags); + + if (Unused != NULL) + return FALSE; + + if (iDevNum != 0) + return FALSE; + + if (lpDisplayDevice == NULL || lpDisplayDevice->cb < sizeof(DISPLAY_DEVICE)) + return FALSE; + +#ifdef UNICODE + MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, lpDisplayDevice->DeviceName, (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR))); + MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, lpDisplayDevice->DeviceString, (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR))); +#else // UNICODE + lstrcpy((LPTSTR)lpDisplayDevice->DeviceName, TEXT("DISPLAY")); + lstrcpy((LPTSTR)lpDisplayDevice->DeviceString, TEXT("DISPLAY")); +#endif // UNICODE + + lpDisplayDevice->StateFlags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE; + + return TRUE; +} + +#undef xPRIMARY_MONITOR +#undef COMPILE_MULTIMON_STUBS + +#else // COMPILE_MULTIMON_STUBS + +extern int WINAPI xGetSystemMetrics(int); +extern HMONITOR WINAPI xMonitorFromWindow(HWND, DWORD); +extern HMONITOR WINAPI xMonitorFromRect(LPCRECT, DWORD); +extern HMONITOR WINAPI xMonitorFromPoint(POINT, DWORD); +extern BOOL WINAPI xGetMonitorInfo(HMONITOR, LPMONITORINFO); +extern BOOL WINAPI xEnumDisplayMonitors(HDC, LPCRECT, MONITORENUMPROC, LPARAM); +extern BOOL WINAPI xEnumDisplayDevices(PVOID, DWORD, PDISPLAY_DEVICE, DWORD); + +#endif // COMPILE_MULTIMON_STUBS + +// +// build defines that replace the regular APIs with our versions +// +#define GetSystemMetrics GetSystemMetrics +#define MonitorFromWindow xMonitorFromWindow +#define MonitorFromRect xMonitorFromRect +#define MonitorFromPoint xMonitorFromPoint +#define GetMonitorInfo xGetMonitorInfo +#define EnumDisplayMonitors xEnumDisplayMonitors +#define EnumDisplayDevices xEnumDisplayDevices + +#ifdef __cplusplus +} +#endif // __cplusplus + diff --git a/saco/d3d9/include/rmxfguid.h b/saco/d3d9/include/rmxfguid.h new file mode 100644 index 0000000..d3326cc --- /dev/null +++ b/saco/d3d9/include/rmxfguid.h @@ -0,0 +1,223 @@ +/*************************************************************************** + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: rmxfguid.h + * + * Content: Defines GUIDs of D3DRM's templates. + * + ***************************************************************************/ + +#ifndef __RMXFGUID_H_ +#define __RMXFGUID_H_ + +/* {2B957100-9E9A-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMInfo, +0x2b957100, 0x9e9a, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB44-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMesh, +0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMVector, +0x3d82ab5e, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMeshFace, +0x3d82ab5f, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMaterial, +0x3d82ab4d, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {35FF44E1-6C7C-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialArray, +0x35ff44e1, 0x6c7c, 0x11cf, 0x8F, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB46-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMFrame, +0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {F6F23F41-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameTransformMatrix, +0xf6f23f41, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F42-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshMaterialList, +0xf6f23f42, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F40-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshTextureCoords, +0xf6f23f40, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F43-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshNormals, +0xf6f23f43, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F44-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMCoords2d, +0xf6f23f44, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F45-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMatrix4x4, +0xf6f23f45, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMAnimation, +0x3d82ab4f, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB50-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMAnimationSet, +0x3d82ab50, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {10DD46A8-775B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMAnimationKey, +0x10dd46a8, 0x775b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {10DD46A9-775B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFloatKeys, +0x10dd46a9, 0x775b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411840-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialAmbientColor, +0x01411840, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411841-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialDiffuseColor, +0x01411841, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411842-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialSpecularColor, +0x01411842, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {D3E16E80-7835-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialEmissiveColor, +0xd3e16e80, 0x7835, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {01411843-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialPower, +0x01411843, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {35FF44E0-6C7C-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMColorRGBA, +0x35ff44e0, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {D3E16E81-7835-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMColorRGB, +0xd3e16e81, 0x7835, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E0-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMGuid, +0xa42790e0, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E1-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTextureFilename, +0xa42790e1, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E2-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTextureReference, +0xa42790e2, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {1630B820-7842-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMIndexedColor, +0x1630b820, 0x7842, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {1630B821-7842-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshVertexColors, +0x1630b821, 0x7842, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {4885AE60-78E8-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialWrap, +0x4885ae60, 0x78e8, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMBoolean, +0x537da6a0, 0xca37, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMMeshFaceWraps, +0xed1ec5c0, 0xc0a8, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {4885AE63-78E8-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMBoolean2d, +0x4885ae63, 0x78e8, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F406B180-7B3B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTimedFloatKeys, +0xf406b180, 0x7b3b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C0-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMAnimationOptions, +0xe2bf56c0, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C1-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFramePosition, +0xe2bf56c1, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C2-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameVelocity, +0xe2bf56c2, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C3-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameRotation, +0xe2bf56c3, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMLight, +0x3d82ab4a, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB51-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMCamera, +0x3d82ab51, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMAppData, +0xe5745280, 0xb24f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightUmbra, +0xaed22740, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightRange, +0xaed22742, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightPenumbra, +0xaed22741, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMLightAttenuation, +0xa8a98ba0, 0xc5e5, 0x11cf, 0xb9, 0x41, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMInlineData, +0x3a23eea0, 0x94b1, 0x11d0, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMUrl, +0x3a23eea1, 0x94b1, 0x11d0, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {8A63C360-997D-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMProgressiveMesh, +0x8A63C360, 0x997D, 0x11d0, 0x94, 0x1C, 0x0, 0x80, 0xC8, 0x0C, 0xFA, 0x7B); + +/* {98116AA0-BDBA-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMExternalVisual, +0x98116AA0, 0xBDBA, 0x11d1, 0x82, 0xC0, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x71); + +/* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMStringProperty, +0x7f0f21e0, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +/* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMPropertyBag, +0x7f0f21e1, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +// {7F5D5EA0-D53A-11d1-82C0-00A0C9697271} +DEFINE_GUID(TID_D3DRMRightHanded, +0x7f5d5ea0, 0xd53a, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +#endif /* __RMXFGUID_H_ */ + diff --git a/saco/d3d9/include/rmxftmpl.h b/saco/d3d9/include/rmxftmpl.h new file mode 100644 index 0000000..e0018d0 --- /dev/null +++ b/saco/d3d9/include/rmxftmpl.h @@ -0,0 +1,339 @@ +/* D3DRM XFile templates in binary form */ + +#ifndef _RMXFTMPL_H_ +#define _RMXFTMPL_H_ + +unsigned char D3DRM_XTEMPLATES[] = { + 0x78, 0x6f, 0x66, 0x20, 0x30, 0x33, 0x30, 0x32, 0x62, + 0x69, 0x6e, 0x20, 0x30, 0x30, 0x36, 0x34, 0x1f, 0, 0x1, + 0, 0x6, 0, 0, 0, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0xa, 0, 0x5, 0, 0x43, 0xab, 0x82, 0x3d, 0xda, + 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, + 0x33, 0x28, 0, 0x1, 0, 0x5, 0, 0, 0, 0x6d, + 0x61, 0x6a, 0x6f, 0x72, 0x14, 0, 0x28, 0, 0x1, 0, + 0x5, 0, 0, 0, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x14, + 0, 0x29, 0, 0x1, 0, 0x5, 0, 0, 0, 0x66, + 0x6c, 0x61, 0x67, 0x73, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0xa, 0, 0x5, 0, 0x5e, 0xab, 0x82, 0x3d, + 0xda, 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, + 0xe4, 0x33, 0x2a, 0, 0x1, 0, 0x1, 0, 0, 0, + 0x78, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, 0, + 0, 0x79, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, + 0, 0, 0x7a, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6f, 0x72, 0x64, + 0x73, 0x32, 0x64, 0xa, 0, 0x5, 0, 0x44, 0x3f, 0xf2, + 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x2a, 0, 0x1, 0, 0x1, 0, 0, + 0, 0x75, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, + 0, 0, 0x76, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0x9, 0, 0, 0, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x34, 0x78, 0x34, 0xa, 0, 0x5, 0, 0x45, 0x3f, + 0xf2, 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, + 0x33, 0x35, 0x94, 0xa3, 0x34, 0, 0x2a, 0, 0x1, 0, + 0x6, 0, 0, 0, 0x6d, 0x61, 0x74, 0x72, 0x69, 0x78, + 0xe, 0, 0x3, 0, 0x10, 0, 0, 0, 0xf, 0, + 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x9, 0, + 0, 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, + 0x41, 0xa, 0, 0x5, 0, 0xe0, 0x44, 0xff, 0x35, 0x7c, + 0x6c, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, + 0xa3, 0x2a, 0, 0x1, 0, 0x3, 0, 0, 0, 0x72, + 0x65, 0x64, 0x14, 0, 0x2a, 0, 0x1, 0, 0x5, 0, + 0, 0, 0x67, 0x72, 0x65, 0x65, 0x6e, 0x14, 0, 0x2a, + 0, 0x1, 0, 0x4, 0, 0, 0, 0x62, 0x6c, 0x75, + 0x65, 0x14, 0, 0x2a, 0, 0x1, 0, 0x5, 0, 0, + 0, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x8, 0, 0, 0, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0xa, 0, 0x5, 0, + 0x81, 0x6e, 0xe1, 0xd3, 0x35, 0x78, 0xcf, 0x11, 0x8f, 0x52, + 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x2a, 0, 0x1, 0, + 0x3, 0, 0, 0, 0x72, 0x65, 0x64, 0x14, 0, 0x2a, + 0, 0x1, 0, 0x5, 0, 0, 0, 0x67, 0x72, 0x65, + 0x65, 0x6e, 0x14, 0, 0x2a, 0, 0x1, 0, 0x4, 0, + 0, 0, 0x62, 0x6c, 0x75, 0x65, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0xc, 0, 0, 0, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0xa, 0, 0x5, 0, 0x20, 0xb8, 0x30, 0x16, 0x42, 0x78, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0x5, 0, 0, 0, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x14, 0, 0x1, 0, 0x9, 0, 0, + 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0x41, + 0x1, 0, 0xa, 0, 0, 0, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x7, 0, 0, 0, 0x42, 0x6f, + 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0xa, 0, 0x5, 0, 0xa0, + 0xa6, 0x7d, 0x53, 0x37, 0xca, 0xd0, 0x11, 0x94, 0x1c, 0, + 0x80, 0xc8, 0xc, 0xfa, 0x7b, 0x29, 0, 0x1, 0, 0x9, + 0, 0, 0, 0x74, 0x72, 0x75, 0x65, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0x9, 0, 0, 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, + 0x6e, 0x32, 0x64, 0xa, 0, 0x5, 0, 0x63, 0xae, 0x85, + 0x48, 0xe8, 0x78, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x1, 0, 0x7, 0, 0, 0, 0x42, + 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, 0x1, 0, + 0, 0, 0x75, 0x14, 0, 0x1, 0, 0x7, 0, 0, + 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, + 0x1, 0, 0, 0, 0x76, 0x14, 0, 0xb, 0, 0x1f, + 0, 0x1, 0, 0xc, 0, 0, 0, 0x4d, 0x61, 0x74, + 0x65, 0x72, 0x69, 0x61, 0x6c, 0x57, 0x72, 0x61, 0x70, 0xa, + 0, 0x5, 0, 0x60, 0xae, 0x85, 0x48, 0xe8, 0x78, 0xcf, + 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x1, + 0, 0x7, 0, 0, 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, + 0x61, 0x6e, 0x1, 0, 0x1, 0, 0, 0, 0x75, 0x14, + 0, 0x1, 0, 0x7, 0, 0, 0, 0x42, 0x6f, 0x6f, + 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, 0x1, 0, 0, 0, + 0x76, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0xf, + 0, 0, 0, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, + 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0xa, 0, + 0x5, 0, 0xe1, 0x90, 0x27, 0xa4, 0x10, 0x78, 0xcf, 0x11, + 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x31, 0, + 0x1, 0, 0x8, 0, 0, 0, 0x66, 0x69, 0x6c, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x8, 0, 0, 0, 0x4d, 0x61, 0x74, 0x65, + 0x72, 0x69, 0x61, 0x6c, 0xa, 0, 0x5, 0, 0x4d, 0xab, + 0x82, 0x3d, 0xda, 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, + 0xaf, 0x71, 0xe4, 0x33, 0x1, 0, 0x9, 0, 0, 0, + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0x41, 0x1, + 0, 0x9, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0x2a, 0, 0x1, 0, + 0x5, 0, 0, 0, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x14, + 0, 0x1, 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6c, + 0x6f, 0x72, 0x52, 0x47, 0x42, 0x1, 0, 0xd, 0, 0, + 0, 0x73, 0x70, 0x65, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0x1, 0, 0x8, 0, + 0, 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, + 0x1, 0, 0xd, 0, 0, 0, 0x65, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x14, + 0, 0xe, 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, + 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x8, 0, 0, + 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, 0x63, 0x65, 0xa, + 0, 0x5, 0, 0x5f, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0x29, + 0, 0x1, 0, 0x12, 0, 0, 0, 0x6e, 0x46, 0x61, + 0x63, 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e, + 0x64, 0x69, 0x63, 0x65, 0x73, 0x14, 0, 0x34, 0, 0x29, + 0, 0x1, 0, 0x11, 0, 0, 0, 0x66, 0x61, 0x63, + 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e, 0x64, + 0x69, 0x63, 0x65, 0x73, 0xe, 0, 0x1, 0, 0x12, 0, + 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x56, 0x65, 0x72, + 0x74, 0x65, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, + 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xd, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, + 0x63, 0x65, 0x57, 0x72, 0x61, 0x70, 0x73, 0xa, 0, 0x5, + 0, 0xc0, 0xc5, 0x1e, 0xed, 0xa8, 0xc0, 0xd0, 0x11, 0x94, + 0x1c, 0, 0x80, 0xc8, 0xc, 0xfa, 0x7b, 0x29, 0, 0x1, + 0, 0xf, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, + 0x57, 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x14, 0, 0x34, 0, 0x1, 0, 0x9, 0, 0, 0, + 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x32, 0x64, 0x1, + 0, 0xe, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, 0x57, + 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0xe, + 0, 0x1, 0, 0xf, 0, 0, 0, 0x6e, 0x46, 0x61, + 0x63, 0x65, 0x57, 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x11, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6f, + 0x72, 0x64, 0x73, 0xa, 0, 0x5, 0, 0x40, 0x3f, 0xf2, + 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xe, 0, 0, + 0, 0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, + 0x6f, 0x6f, 0x72, 0x64, 0x73, 0x14, 0, 0x34, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6f, 0x72, 0x64, + 0x73, 0x32, 0x64, 0x1, 0, 0xd, 0, 0, 0, 0x74, + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6f, 0x72, + 0x64, 0x73, 0xe, 0, 0x1, 0, 0xe, 0, 0, 0, + 0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, + 0x6f, 0x72, 0x64, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x10, 0, 0, 0, 0x4d, 0x65, + 0x73, 0x68, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, + 0x4c, 0x69, 0x73, 0x74, 0xa, 0, 0x5, 0, 0x42, 0x3f, + 0xf2, 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, + 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xa, 0, + 0, 0, 0x6e, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, + 0x6c, 0x73, 0x14, 0, 0x29, 0, 0x1, 0, 0xc, 0, + 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x65, 0x73, 0x14, 0, 0x34, 0, 0x29, 0, + 0x1, 0, 0xb, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0xe, 0, 0x1, + 0, 0xc, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0xf, 0, 0x14, + 0, 0xe, 0, 0x1, 0, 0x8, 0, 0, 0, 0x4d, + 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xb, 0, 0, 0, 0x4d, + 0x65, 0x73, 0x68, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xa, 0, 0x5, 0, 0x43, 0x3f, 0xf2, 0xf6, 0x86, 0x76, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0x8, 0, 0, 0, 0x6e, 0x4e, + 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, 0x14, 0, 0x34, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x1, 0, 0x7, 0, 0, 0, 0x6e, 0x6f, + 0x72, 0x6d, 0x61, 0x6c, 0x73, 0xe, 0, 0x1, 0, 0x8, + 0, 0, 0, 0x6e, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, + 0x73, 0xf, 0, 0x14, 0, 0x29, 0, 0x1, 0, 0xc, + 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x4e, 0x6f, + 0x72, 0x6d, 0x61, 0x6c, 0x73, 0x14, 0, 0x34, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, + 0x61, 0x63, 0x65, 0x1, 0, 0xb, 0, 0, 0, 0x66, + 0x61, 0x63, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xe, 0, 0x1, 0, 0xc, 0, 0, 0, 0x6e, 0x46, + 0x61, 0x63, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0x10, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x56, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x73, + 0xa, 0, 0x5, 0, 0x21, 0xb8, 0x30, 0x16, 0x42, 0x78, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0xd, 0, 0, 0, 0x6e, 0x56, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x73, 0x14, 0, 0x34, 0, 0x1, 0, 0xc, 0, 0, + 0, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x1, 0, 0xc, 0, 0, 0, 0x76, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x73, 0xe, 0, 0x1, 0, 0xd, 0, 0, 0, 0x6e, + 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, + 0x72, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x4, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, + 0xa, 0, 0x5, 0, 0x44, 0xab, 0x82, 0x3d, 0xda, 0x62, + 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, + 0x29, 0, 0x1, 0, 0x9, 0, 0, 0, 0x6e, 0x56, + 0x65, 0x72, 0x74, 0x69, 0x63, 0x65, 0x73, 0x14, 0, 0x34, + 0, 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x1, 0, 0x8, 0, 0, 0, 0x76, + 0x65, 0x72, 0x74, 0x69, 0x63, 0x65, 0x73, 0xe, 0, 0x1, + 0, 0x9, 0, 0, 0, 0x6e, 0x56, 0x65, 0x72, 0x74, + 0x69, 0x63, 0x65, 0x73, 0xf, 0, 0x14, 0, 0x29, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, + 0x65, 0x73, 0x14, 0, 0x34, 0, 0x1, 0, 0x8, 0, + 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, 0x63, 0x65, + 0x1, 0, 0x5, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, + 0x73, 0xe, 0, 0x1, 0, 0x6, 0, 0, 0, 0x6e, + 0x46, 0x61, 0x63, 0x65, 0x73, 0xf, 0, 0x14, 0, 0xe, + 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0x14, 0, 0, 0, 0x46, + 0x72, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x4d, 0x61, 0x74, 0x72, 0x69, 0x78, 0xa, + 0, 0x5, 0, 0x41, 0x3f, 0xf2, 0xf6, 0x86, 0x76, 0xcf, + 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x1, + 0, 0x9, 0, 0, 0, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x34, 0x78, 0x34, 0x1, 0, 0xb, 0, 0, 0, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x46, 0x72, 0x61, 0x6d, 0x65, 0xa, 0, + 0x5, 0, 0x46, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, 0x11, + 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0xe, 0, + 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x9, 0, 0, 0, 0x46, 0x6c, + 0x6f, 0x61, 0x74, 0x4b, 0x65, 0x79, 0x73, 0xa, 0, 0x5, + 0, 0xa9, 0x46, 0xdd, 0x10, 0x5b, 0x77, 0xcf, 0x11, 0x8f, + 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, + 0, 0x7, 0, 0, 0, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x14, 0, 0x34, 0, 0x2a, 0, 0x1, 0, + 0x6, 0, 0, 0, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0xe, 0, 0x1, 0, 0x7, 0, 0, 0, 0x6e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0xf, 0, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xe, 0, 0, 0, 0x54, + 0x69, 0x6d, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, + 0x65, 0x79, 0x73, 0xa, 0, 0x5, 0, 0x80, 0xb1, 0x6, + 0xf4, 0x3b, 0x7b, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0x4, 0, 0, + 0, 0x74, 0x69, 0x6d, 0x65, 0x14, 0, 0x1, 0, 0x9, + 0, 0, 0, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, 0x65, + 0x79, 0x73, 0x1, 0, 0x6, 0, 0, 0, 0x74, 0x66, + 0x6b, 0x65, 0x79, 0x73, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0xc, 0, 0, 0, 0x41, 0x6e, 0x69, 0x6d, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0xa, 0, + 0x5, 0, 0xa8, 0x46, 0xdd, 0x10, 0x5b, 0x77, 0xcf, 0x11, + 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, + 0x1, 0, 0x7, 0, 0, 0, 0x6b, 0x65, 0x79, 0x54, + 0x79, 0x70, 0x65, 0x14, 0, 0x29, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x14, 0, + 0x34, 0, 0x1, 0, 0xe, 0, 0, 0, 0x54, 0x69, + 0x6d, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, 0x65, + 0x79, 0x73, 0x1, 0, 0x4, 0, 0, 0, 0x6b, 0x65, + 0x79, 0x73, 0xe, 0, 0x1, 0, 0x5, 0, 0, 0, + 0x6e, 0x4b, 0x65, 0x79, 0x73, 0xf, 0, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0x10, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa, 0, 0x5, 0, 0xc0, + 0x56, 0xbf, 0xe2, 0xf, 0x84, 0xcf, 0x11, 0x8f, 0x52, 0, + 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xa, + 0, 0, 0, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, + 0x73, 0x65, 0x64, 0x14, 0, 0x29, 0, 0x1, 0, 0xf, + 0, 0, 0, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x14, 0, + 0xb, 0, 0x1f, 0, 0x1, 0, 0x9, 0, 0, 0, + 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa, + 0, 0x5, 0, 0x4f, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0xe, + 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xc, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x74, 0xa, 0, 0x5, 0, 0x50, 0xab, 0x82, 0x3d, 0xda, + 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, + 0x33, 0xe, 0, 0x1, 0, 0x9, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xf, 0, + 0xb, 0, 0x1f, 0, 0x1, 0, 0xa, 0, 0, 0, + 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, + 0xa, 0, 0x5, 0, 0xa0, 0xee, 0x23, 0x3a, 0xb1, 0x94, + 0xd0, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, + 0xe, 0, 0x1, 0, 0x6, 0, 0, 0, 0x42, 0x49, + 0x4e, 0x41, 0x52, 0x59, 0xf, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x3, 0, 0, 0, 0x55, 0x72, 0x6c, 0xa, + 0, 0x5, 0, 0xa1, 0xee, 0x23, 0x3a, 0xb1, 0x94, 0xd0, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0x29, + 0, 0x1, 0, 0x5, 0, 0, 0, 0x6e, 0x55, 0x72, + 0x6c, 0x73, 0x14, 0, 0x34, 0, 0x31, 0, 0x1, 0, + 0x4, 0, 0, 0, 0x75, 0x72, 0x6c, 0x73, 0xe, 0, + 0x1, 0, 0x5, 0, 0, 0, 0x6e, 0x55, 0x72, 0x6c, + 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0xf, 0, 0, 0, 0x50, 0x72, 0x6f, 0x67, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x68, + 0xa, 0, 0x5, 0, 0x60, 0xc3, 0x63, 0x8a, 0x7d, 0x99, + 0xd0, 0x11, 0x94, 0x1c, 0, 0x80, 0xc8, 0xc, 0xfa, 0x7b, + 0xe, 0, 0x1, 0, 0x3, 0, 0, 0, 0x55, 0x72, + 0x6c, 0x13, 0, 0x1, 0, 0xa, 0, 0, 0, 0x49, + 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, 0xf, + 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x4, 0, 0, + 0, 0x47, 0x75, 0x69, 0x64, 0xa, 0, 0x5, 0, 0xe0, + 0x90, 0x27, 0xa4, 0x10, 0x78, 0xcf, 0x11, 0x8f, 0x52, 0, + 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x64, 0x61, 0x74, 0x61, 0x31, 0x14, 0, + 0x28, 0, 0x1, 0, 0x5, 0, 0, 0, 0x64, 0x61, + 0x74, 0x61, 0x32, 0x14, 0, 0x28, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x64, 0x61, 0x74, 0x61, 0x33, 0x14, 0, + 0x34, 0, 0x2d, 0, 0x1, 0, 0x5, 0, 0, 0, + 0x64, 0x61, 0x74, 0x61, 0x34, 0xe, 0, 0x3, 0, 0x8, + 0, 0, 0, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, + 0, 0x1, 0, 0xe, 0, 0, 0, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, + 0x79, 0xa, 0, 0x5, 0, 0xe0, 0x21, 0xf, 0x7f, 0xe1, + 0xbf, 0xd1, 0x11, 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, + 0x71, 0x31, 0, 0x1, 0, 0x3, 0, 0, 0, 0x6b, + 0x65, 0x79, 0x14, 0, 0x31, 0, 0x1, 0, 0x5, 0, + 0, 0, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xb, 0, 0, 0, 0x50, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x42, 0x61, 0x67, + 0xa, 0, 0x5, 0, 0xe1, 0x21, 0xf, 0x7f, 0xe1, 0xbf, + 0xd1, 0x11, 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, 0x71, + 0xe, 0, 0x1, 0, 0xe, 0, 0, 0, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x79, 0xf, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xe, 0, 0, 0, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x56, 0x69, 0x73, 0x75, 0x61, 0x6c, 0xa, 0, + 0x5, 0, 0xa0, 0x6a, 0x11, 0x98, 0xba, 0xbd, 0xd1, 0x11, + 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, 0x71, 0x1, 0, + 0x4, 0, 0, 0, 0x47, 0x75, 0x69, 0x64, 0x1, 0, + 0x12, 0, 0, 0, 0x67, 0x75, 0x69, 0x64, 0x45, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x56, 0x69, 0x73, 0x75, + 0x61, 0x6c, 0x14, 0, 0xe, 0, 0x12, 0, 0x12, 0, + 0x12, 0, 0xf, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xb, 0, 0, 0, 0x52, 0x69, 0x67, 0x68, 0x74, 0x48, + 0x61, 0x6e, 0x64, 0x65, 0x64, 0xa, 0, 0x5, 0, 0xa0, + 0x5e, 0x5d, 0x7f, 0x3a, 0xd5, 0xd1, 0x11, 0x82, 0xc0, 0, + 0xa0, 0xc9, 0x69, 0x72, 0x71, 0x29, 0, 0x1, 0, 0xc, + 0, 0, 0, 0x62, 0x52, 0x69, 0x67, 0x68, 0x74, 0x48, + 0x61, 0x6e, 0x64, 0x65, 0x64, 0x14, 0, 0xb, 0 +}; + +#define D3DRM_XTEMPLATE_BYTES 3278 + +#endif /* _RMXFTMPL_H_ */ diff --git a/saco/d3d9/include/strsafe.h b/saco/d3d9/include/strsafe.h new file mode 100644 index 0000000..061b3c4 --- /dev/null +++ b/saco/d3d9/include/strsafe.h @@ -0,0 +1,6611 @@ +/****************************************************************** +* * +* strsafe.h -- This module defines safer C library string * +* routine replacements. These are meant to make C * +* a bit more safe in reference to security and * +* robustness * +* * +* Copyright (c) Microsoft Corp. All rights reserved. * +* * +******************************************************************/ +#ifndef _STRSAFE_H_INCLUDED_ +#define _STRSAFE_H_INCLUDED_ +#pragma once + +#include // for _vsnprintf, _vsnwprintf, getc, getwc +#include // for memset +#include // for va_start, etc. + + +#ifndef _SIZE_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 size_t; +#else +typedef __w64 unsigned int size_t; +#endif // !_WIN64 +#define _SIZE_T_DEFINED +#endif // !_SIZE_T_DEFINED + +#if !defined(_WCHAR_T_DEFINED) && !defined(_NATIVE_WCHAR_T_DEFINED) +typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED +typedef long HRESULT; +#endif // !_HRESULT_DEFINED + +#ifndef SUCCEEDED +#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) +#endif + +#ifndef FAILED +#define FAILED(hr) ((HRESULT)(hr) < 0) +#endif + +#ifndef S_OK +#define S_OK ((HRESULT)0x00000000L) +#endif + +#ifdef __cplusplus +#define _STRSAFE_EXTERN_C extern "C" +#else +#define _STRSAFE_EXTERN_C extern +#endif + +// If you do not want to use these functions inline (and instead want to link w/ strsafe.lib), then +// #define STRSAFE_LIB before including this header file. +#if defined(STRSAFE_LIB) +#define STRSAFEAPI _STRSAFE_EXTERN_C HRESULT __stdcall +#pragma comment(lib, "strsafe.lib") +#elif defined(STRSAFE_LIB_IMPL) +#define STRSAFEAPI _STRSAFE_EXTERN_C HRESULT __stdcall +#else +#define STRSAFEAPI __inline HRESULT __stdcall +#define STRSAFE_INLINE +#endif + +// Some functions always run inline because they use stdin and we want to avoid building multiple +// versions of strsafe lib depending on if you use msvcrt, libcmt, etc. +#define STRSAFE_INLINE_API __inline HRESULT __stdcall + +// The user can request no "Cb" or no "Cch" fuctions, but not both! +#if defined(STRSAFE_NO_CB_FUNCTIONS) && defined(STRSAFE_NO_CCH_FUNCTIONS) +#error cannot specify both STRSAFE_NO_CB_FUNCTIONS and STRSAFE_NO_CCH_FUNCTIONS !! +#endif + +// This should only be defined when we are building strsafe.lib +#ifdef STRSAFE_LIB_IMPL +#define STRSAFE_INLINE +#endif + + +// If both strsafe.h and ntstrsafe.h are included, only use definitions from one. +#ifndef _NTSTRSAFE_H_INCLUDED_ + +#define STRSAFE_MAX_CCH 2147483647 // max # of characters we support (same as INT_MAX) + +// Flags for controling the Ex functions +// +// STRSAFE_FILL_BYTE(0xFF) 0x000000FF // bottom byte specifies fill pattern +#define STRSAFE_IGNORE_NULLS 0x00000100 // treat null as TEXT("") -- don't fault on NULL buffers +#define STRSAFE_FILL_BEHIND_NULL 0x00000200 // fill in extra space behind the null terminator +#define STRSAFE_FILL_ON_FAILURE 0x00000400 // on failure, overwrite pszDest with fill pattern and null terminate it +#define STRSAFE_NULL_ON_FAILURE 0x00000800 // on failure, set *pszDest = TEXT('\0') +#define STRSAFE_NO_TRUNCATION 0x00001000 // instead of returning a truncated result, copy/append nothing to pszDest and null terminate it + +#define STRSAFE_VALID_FLAGS (0x000000FF | STRSAFE_IGNORE_NULLS | STRSAFE_FILL_BEHIND_NULL | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION) + +// helper macro to set the fill character and specify buffer filling +#define STRSAFE_FILL_BYTE(x) ((unsigned long)((x & 0x000000FF) | STRSAFE_FILL_BEHIND_NULL)) +#define STRSAFE_FAILURE_BYTE(x) ((unsigned long)((x & 0x000000FF) | STRSAFE_FILL_ON_FAILURE)) + +#define STRSAFE_GET_FILL_PATTERN(dwFlags) ((int)(dwFlags & 0x000000FF)) + +#endif // _NTSTRSAFE_H_INCLUDED_ + +// STRSAFE error return codes +// +#define STRSAFE_E_INSUFFICIENT_BUFFER ((HRESULT)0x8007007AL) // 0x7A = 122L = ERROR_INSUFFICIENT_BUFFER +#define STRSAFE_E_INVALID_PARAMETER ((HRESULT)0x80070057L) // 0x57 = 87L = ERROR_INVALID_PARAMETER +#define STRSAFE_E_END_OF_FILE ((HRESULT)0x80070026L) // 0x26 = 38L = ERROR_HANDLE_EOF + +// prototypes for the worker functions +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCopyWorkerA(char* pszDest, size_t cchDest, const char* pszSrc); +STRSAFEAPI StringCopyWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc); +STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCopyExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc); +STRSAFEAPI StringCopyNWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc); +STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCopyNExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, size_t cchSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc); +STRSAFEAPI StringCatWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc); +STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCatExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend); +STRSAFEAPI StringCatNWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend); +STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCatNExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, size_t cchMaxAppend, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringVPrintfWorkerA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList); +STRSAFEAPI StringVPrintfWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, va_list argList); +STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList); +STRSAFEAPI StringVPrintfExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList); +STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch); +STRSAFEAPI StringLengthWorkerW(const wchar_t* psz, size_t cchMax, size_t* pcch); +#endif // STRSAFE_INLINE + +#ifndef STRSAFE_LIB_IMPL +// these functions are always inline +STRSAFE_INLINE_API StringGetsExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFE_INLINE_API StringGetsExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#endif + +#ifdef _NTSTRSAFE_H_INCLUDED_ +#pragma warning(push) +#pragma warning(disable : 4995) +#endif // _NTSTRSAFE_H_INCLUDED_ + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCopy( + OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcpy'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This routine is not a replacement for strncpy. That function will pad the + destination string with extra null termination characters if the count is + greater than the length of the source string, and it will fail to null + terminate the destination string if the source string length is greater + than or equal to the count. You can not blindly use this instead of strncpy: + it is common for code to use it to "patch" strings and you would introduce + errors if the code started null terminating in the middle of the string. + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was copied without truncation and null terminated, + otherwise it will return a failure code. In failure cases as much of + pszSrc will be copied to pszDest as possible, and pszDest will be null + terminated. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(src) + 1) to hold all of the + source including the null terminator + + pszSrc - source string which must be null terminated + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCchCopyEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCchCopyA(char* pszDest, size_t cchDest, const char* pszSrc); +STRSAFEAPI StringCchCopyW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc); +#ifdef UNICODE +#define StringCchCopy StringCchCopyW +#else +#define StringCchCopy StringCchCopyA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCopyA(char* pszDest, size_t cchDest, const char* pszSrc) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyWorkerA(pszDest, cchDest, pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCchCopyW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyWorkerW(pszDest, cchDest, pszSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCopy( + OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcpy'. + The size of the destination buffer (in bytes) is a parameter and this + function will not write past the end of this buffer and it will ALWAYS + null terminate the destination buffer (unless it is zero length). + + This routine is not a replacement for strncpy. That function will pad the + destination string with extra null termination characters if the count is + greater than the length of the source string, and it will fail to null + terminate the destination string if the source string length is greater + than or equal to the count. You can not blindly use this instead of strncpy: + it is common for code to use it to "patch" strings and you would introduce + errors if the code started null terminating in the middle of the string. + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was copied without truncation and null terminated, + otherwise it will return a failure code. In failure cases as much of pszSrc + will be copied to pszDest as possible, and pszDest will be null terminated. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be = ((_tcslen(src) + 1) * sizeof(TCHAR)) to + hold all of the source including the null terminator + + pszSrc - source string which must be null terminated + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCbCopyEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCbCopyA(char* pszDest, size_t cbDest, const char* pszSrc); +STRSAFEAPI StringCbCopyW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc); +#ifdef UNICODE +#define StringCbCopy StringCbCopyW +#else +#define StringCbCopy StringCbCopyA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCopyA(char* pszDest, size_t cbDest, const char* pszSrc) +{ + HRESULT hr; + size_t cchDest; + + // convert to count of characters + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyWorkerA(pszDest, cchDest, pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCbCopyW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc) +{ + HRESULT hr; + size_t cchDest; + + // convert to count of characters + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyWorkerW(pszDest, cchDest, pszSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCopyEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + IN LPCTSTR pszSrc OPTIONAL, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcpy' with + some additional parameters. In addition to functionality provided by + StringCchCopy, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(pszSrc) + 1) to hold all of + the source including the null terminator + + pszSrc - source string which must be null terminated + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcpy + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCopyExA(char* pszDest, size_t cchDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCchCopyExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchCopyEx StringCchCopyExW +#else +#define StringCchCopyEx StringCchCopyExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCopyExA(char* pszDest, size_t cchDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringCopyExWorkerA(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFEAPI StringCchCopyExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringCopyExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCopyEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + IN LPCTSTR pszSrc OPTIONAL, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcpy' with + some additional parameters. In addition to functionality provided by + StringCbCopy, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszSrc) + 1) * sizeof(TCHAR)) to + hold all of the source including the null terminator + + pszSrc - source string which must be null terminated + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcbRemaining - pcbRemaining is non-null,the function will return the + number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcpy + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCopyExA(char* pszDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +STRSAFEAPI StringCbCopyExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbCopyEx StringCbCopyExW +#else +#define StringCbCopyEx StringCbCopyExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCopyExA(char* pszDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyExWorkerA(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbCopyExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCopyN( + OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszSrc, + IN size_t cchSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncpy'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This routine is meant as a replacement for strncpy, but it does behave + differently. This function will not pad the destination buffer with extra + null termination characters if cchSrc is greater than the length of pszSrc. + + This function returns a hresult, and not a pointer. It returns + S_OK if the entire string or the first cchSrc characters were copied + without truncation and the resultant destination string was null terminated, + otherwise it will return a failure code. In failure cases as much of pszSrc + will be copied to pszDest as possible, and pszDest will be null terminated. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(src) + 1) to hold all of the + source including the null terminator + + pszSrc - source string + + cchSrc - maximum number of characters to copy from source string, + not including the null terminator. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCchCopyNEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCchCopyNA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc); +STRSAFEAPI StringCchCopyNW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc); +#ifdef UNICODE +#define StringCchCopyN StringCchCopyNW +#else +#define StringCchCopyN StringCchCopyNA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCopyNA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc) +{ + HRESULT hr; + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNWorkerA(pszDest, cchDest, pszSrc, cchSrc); + } + + return hr; +} + +STRSAFEAPI StringCchCopyNW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc) +{ + HRESULT hr; + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNWorkerW(pszDest, cchDest, pszSrc, cchSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCopyN( + OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszSrc, + IN size_t cbSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncpy'. + The size of the destination buffer (in bytes) is a parameter and this + function will not write past the end of this buffer and it will ALWAYS + null terminate the destination buffer (unless it is zero length). + + This routine is meant as a replacement for strncpy, but it does behave + differently. This function will not pad the destination buffer with extra + null termination characters if cbSrc is greater than the size of pszSrc. + + This function returns a hresult, and not a pointer. It returns + S_OK if the entire string or the first cbSrc characters were + copied without truncation and the resultant destination string was null + terminated, otherwise it will return a failure code. In failure cases as + much of pszSrc will be copied to pszDest as possible, and pszDest will be + null terminated. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be = ((_tcslen(src) + 1) * sizeof(TCHAR)) to + hold all of the source including the null terminator + + pszSrc - source string + + cbSrc - maximum number of bytes to copy from source string, + not including the null terminator. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCbCopyEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCbCopyNA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbSrc); +STRSAFEAPI StringCbCopyNW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbSrc); +#ifdef UNICODE +#define StringCbCopyN StringCbCopyNW +#else +#define StringCbCopyN StringCbCopyNA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCopyNA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbSrc) +{ + HRESULT hr; + size_t cchDest; + size_t cchSrc; + + // convert to count of characters + cchDest = cbDest / sizeof(char); + cchSrc = cbSrc / sizeof(char); + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNWorkerA(pszDest, cchDest, pszSrc, cchSrc); + } + + return hr; +} + +STRSAFEAPI StringCbCopyNW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbSrc) +{ + HRESULT hr; + size_t cchDest; + size_t cchSrc; + + // convert to count of characters + cchDest = cbDest / sizeof(wchar_t); + cchSrc = cbSrc / sizeof(wchar_t); + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNWorkerW(pszDest, cchDest, pszSrc, cchSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCopyNEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + IN LPCTSTR pszSrc OPTIONAL, + IN size_t cchSrc, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncpy' with + some additional parameters. In addition to functionality provided by + StringCchCopyN, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination + string including the null terminator. The flags parameter allows + additional controls. + + This routine is meant as a replacement for strncpy, but it does behave + differently. This function will not pad the destination buffer with extra + null termination characters if cchSrc is greater than the length of pszSrc. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(pszSrc) + 1) to hold all of + the source including the null terminator + + pszSrc - source string + + cchSrc - maximum number of characters to copy from the source + string + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcpy + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCopyNExA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCchCopyNExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchCopyNEx StringCchCopyNExW +#else +#define StringCchCopyNEx StringCchCopyNExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCopyNExA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringCopyNExWorkerA(pszDest, cchDest, cbDest, pszSrc, cchSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFEAPI StringCchCopyNExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringCopyNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCopyNEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + IN LPCTSTR pszSrc OPTIONAL, + IN size_t cbSrc, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncpy' with + some additional parameters. In addition to functionality provided by + StringCbCopyN, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + + This routine is meant as a replacement for strncpy, but it does behave + differently. This function will not pad the destination buffer with extra + null termination characters if cbSrc is greater than the size of pszSrc. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszSrc) + 1) * sizeof(TCHAR)) to + hold all of the source including the null terminator + + pszSrc - source string + + cbSrc - maximum number of bytes to copy from source string + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcbRemaining - pcbRemaining is non-null,the function will return the + number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcpy + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCopyNExA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +STRSAFEAPI StringCbCopyNExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbCopyNEx StringCbCopyNExW +#else +#define StringCbCopyNEx StringCbCopyNExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCopyNExA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchSrc; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + cchSrc = cbSrc / sizeof(char); + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNExWorkerA(pszDest, cchDest, cbDest, pszSrc, cchSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbCopyNExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchSrc; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + cchSrc = cbSrc / sizeof(wchar_t); + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCat( + IN OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcat'. + The size of the destination buffer (in characters) is a parameter and this + function will not write past the end of this buffer and it will ALWAYS + null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was concatenated without truncation and null terminated, + otherwise it will return a failure code. In failure cases as much of pszSrc + will be appended to pszDest as possible, and pszDest will be null + terminated. + +Arguments: + + pszDest - destination string which must be null terminated + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(pszDest) + _tcslen(pszSrc) + 1) + to hold all of the combine string plus the null + terminator + + pszSrc - source string which must be null terminated + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCchCatEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error occurs, + the destination buffer is modified to contain a truncated + version of the ideal result and is null terminated. This + is useful for situations where truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCatA(char* pszDest, size_t cchDest, const char* pszSrc); +STRSAFEAPI StringCchCatW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc); +#ifdef UNICODE +#define StringCchCat StringCchCatW +#else +#define StringCchCat StringCchCatA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCatA(char* pszDest, size_t cchDest, const char* pszSrc) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatWorkerA(pszDest, cchDest, pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCchCatW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatWorkerW(pszDest, cchDest, pszSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCat( + IN OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcat'. + The size of the destination buffer (in bytes) is a parameter and this + function will not write past the end of this buffer and it will ALWAYS + null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was concatenated without truncation and null terminated, + otherwise it will return a failure code. In failure cases as much of pszSrc + will be appended to pszDest as possible, and pszDest will be null + terminated. + +Arguments: + + pszDest - destination string which must be null terminated + + cbDest - size of destination buffer in bytes. + length must be = ((_tcslen(pszDest) + _tcslen(pszSrc) + 1) * sizeof(TCHAR) + to hold all of the combine string plus the null + terminator + + pszSrc - source string which must be null terminated + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCbCatEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error occurs, + the destination buffer is modified to contain a truncated + version of the ideal result and is null terminated. This + is useful for situations where truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCatA(char* pszDest, size_t cbDest, const char* pszSrc); +STRSAFEAPI StringCbCatW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc); +#ifdef UNICODE +#define StringCbCat StringCbCatW +#else +#define StringCbCat StringCbCatA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCatA(char* pszDest, size_t cbDest, const char* pszSrc) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatWorkerA(pszDest, cchDest, pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCbCatW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatWorkerW(pszDest, cchDest, pszSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCatEx( + IN OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + IN LPCTSTR pszSrc OPTIONAL, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcat' with + some additional parameters. In addition to functionality provided by + StringCchCat, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string which must be null terminated + + cchDest - size of destination buffer in characters + length must be (_tcslen(pszDest) + _tcslen(pszSrc) + 1) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string which must be null terminated + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function appended any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcat + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any pre-existing + or truncated string + + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any pre-existing or + truncated string + + STRSAFE_NO_TRUNCATION + if the function returns STRSAFE_E_INSUFFICIENT_BUFFER, pszDest + will not contain a truncated string, it will remain unchanged. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCatExA(char* pszDest, size_t cchDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCchCatExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchCatEx StringCchCatExW +#else +#define StringCchCatEx StringCchCatExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCatExA(char* pszDest, size_t cchDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringCatExWorkerA(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFEAPI StringCchCatExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringCatExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCatEx( + IN OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + IN LPCTSTR pszSrc OPTIONAL, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcat' with + some additional parameters. In addition to functionality provided by + StringCbCat, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string which must be null terminated + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszDest) + _tcslen(pszSrc) + 1) * sizeof(TCHAR) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string which must be null terminated + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function appended any data, the result will point to the + null termination character + + pcbRemaining - if pcbRemaining is non-null, the function will return + the number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcat + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any pre-existing + or truncated string + + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any pre-existing or + truncated string + + STRSAFE_NO_TRUNCATION + if the function returns STRSAFE_E_INSUFFICIENT_BUFFER, pszDest + will not contain a truncated string, it will remain unchanged. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated + and the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCatExA(char* pszDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +STRSAFEAPI StringCbCatExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbCatEx StringCbCatExW +#else +#define StringCbCatEx StringCbCatExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCatExA(char* pszDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatExWorkerA(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbCatExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCatN( + IN OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszSrc, + IN size_t cchMaxAppend + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncat'. + The size of the destination buffer (in characters) is a parameter as well as + the maximum number of characters to append, excluding the null terminator. + This function will not write past the end of the destination buffer and it will + ALWAYS null terminate pszDest (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if all of pszSrc or the first cchMaxAppend characters were appended + to the destination string and it was null terminated, otherwise it will + return a failure code. In failure cases as much of pszSrc will be appended + to pszDest as possible, and pszDest will be null terminated. + +Arguments: + + pszDest - destination string which must be null terminated + + cchDest - size of destination buffer in characters. + length must be (_tcslen(pszDest) + min(cchMaxAppend, _tcslen(pszSrc)) + 1) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string + + cchMaxAppend - maximum number of characters to append + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCchCatNEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if all of pszSrc or the first cchMaxAppend characters + were concatenated to pszDest and the resultant dest + string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCatNA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend); +STRSAFEAPI StringCchCatNW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend); +#ifdef UNICODE +#define StringCchCatN StringCchCatNW +#else +#define StringCchCatN StringCchCatNA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCatNA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatNWorkerA(pszDest, cchDest, pszSrc, cchMaxAppend); + } + + return hr; +} + +STRSAFEAPI StringCchCatNW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatNWorkerW(pszDest, cchDest, pszSrc, cchMaxAppend); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCatN( + IN OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszSrc, + IN size_t cbMaxAppend + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncat'. + The size of the destination buffer (in bytes) is a parameter as well as + the maximum number of bytes to append, excluding the null terminator. + This function will not write past the end of the destination buffer and it will + ALWAYS null terminate pszDest (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if all of pszSrc or the first cbMaxAppend bytes were appended + to the destination string and it was null terminated, otherwise it will + return a failure code. In failure cases as much of pszSrc will be appended + to pszDest as possible, and pszDest will be null terminated. + +Arguments: + + pszDest - destination string which must be null terminated + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszDest) + min(cbMaxAppend / sizeof(TCHAR), _tcslen(pszSrc)) + 1) * sizeof(TCHAR) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string + + cbMaxAppend - maximum number of bytes to append + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCbCatNEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if all of pszSrc or the first cbMaxAppend bytes were + concatenated to pszDest and the resultant dest string + was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCatNA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbMaxAppend); +STRSAFEAPI StringCbCatNW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbMaxAppend); +#ifdef UNICODE +#define StringCbCatN StringCbCatNW +#else +#define StringCbCatN StringCbCatNA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCatNA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbMaxAppend) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchMaxAppend; + + cchMaxAppend = cbMaxAppend / sizeof(char); + + hr = StringCatNWorkerA(pszDest, cchDest, pszSrc, cchMaxAppend); + } + + return hr; +} + +STRSAFEAPI StringCbCatNW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbMaxAppend) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchMaxAppend; + + cchMaxAppend = cbMaxAppend / sizeof(wchar_t); + + hr = StringCatNWorkerW(pszDest, cchDest, pszSrc, cchMaxAppend); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCatNEx( + IN OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + IN LPCTSTR pszSrc OPTIONAL, + IN size_t cchMaxAppend, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncat', with + some additional parameters. In addition to functionality provided by + StringCchCatN, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string which must be null terminated + + cchDest - size of destination buffer in characters. + length must be (_tcslen(pszDest) + min(cchMaxAppend, _tcslen(pszSrc)) + 1) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string + + cchMaxAppend - maximum number of characters to append + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function appended any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any pre-existing + or truncated string + + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any pre-existing or + truncated string + + STRSAFE_NO_TRUNCATION + if the function returns STRSAFE_E_INSUFFICIENT_BUFFER, pszDest + will not contain a truncated string, it will remain unchanged. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if all of pszSrc or the first cchMaxAppend characters + were concatenated to pszDest and the resultant dest + string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCatNExA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCchCatNExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchCatNEx StringCchCatNExW +#else +#define StringCchCatNEx StringCchCatNExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCatNExA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringCatNExWorkerA(pszDest, cchDest, cbDest, pszSrc, cchMaxAppend, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFEAPI StringCchCatNExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringCatNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchMaxAppend, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCatNEx( + IN OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + IN LPCTSTR pszSrc OPTIONAL, + IN size_t cbMaxAppend, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncat', with + some additional parameters. In addition to functionality provided by + StringCbCatN, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string which must be null terminated + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszDest) + min(cbMaxAppend / sizeof(TCHAR), _tcslen(pszSrc)) + 1) * sizeof(TCHAR) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string + + cbMaxAppend - maximum number of bytes to append + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function appended any data, the result will point to the + null termination character + + pcbRemaining - if pcbRemaining is non-null, the function will return the + number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any pre-existing + or truncated string + + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any pre-existing or + truncated string + + STRSAFE_NO_TRUNCATION + if the function returns STRSAFE_E_INSUFFICIENT_BUFFER, pszDest + will not contain a truncated string, it will remain unchanged. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if all of pszSrc or the first cbMaxAppend bytes were + concatenated to pszDest and the resultant dest string + was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCatNExA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbMaxAppend, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +STRSAFEAPI StringCbCatNExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbMaxAppend, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbCatNEx StringCbCatNExW +#else +#define StringCbCatNEx StringCbCatNExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCatNExA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbMaxAppend, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchMaxAppend; + + cchMaxAppend = cbMaxAppend / sizeof(char); + + hr = StringCatNExWorkerA(pszDest, cchDest, cbDest, pszSrc, cchMaxAppend, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbCatNExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbMaxAppend, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchMaxAppend; + + cchMaxAppend = cbMaxAppend / sizeof(wchar_t); + + hr = StringCatNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchMaxAppend, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchVPrintf( + OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszFormat, + IN va_list argList + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'vsprintf'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was printed without truncation and null terminated, + otherwise it will return a failure code. In failure cases it will return + a truncated version of the ideal result. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters + length must be sufficient to hold the resulting formatted + string, including the null terminator. + + pszFormat - format string which must be null terminated + + argList - va_list from the variable arguments according to the + stdarg.h convention + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL. See StringCchVPrintfEx if you + require the handling of NULL values. + +Return Value: + + S_OK - if there was sufficient space in the dest buffer for + the resultant string and it was null terminated. + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchVPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList); +STRSAFEAPI StringCchVPrintfW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, va_list argList); +#ifdef UNICODE +#define StringCchVPrintf StringCchVPrintfW +#else +#define StringCchVPrintf StringCchVPrintfA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchVPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList); + } + + return hr; +} + +STRSAFEAPI StringCchVPrintfW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbVPrintf( + OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszFormat, + IN va_list argList + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'vsprintf'. + The size of the destination buffer (in bytes) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was printed without truncation and null terminated, + otherwise it will return a failure code. In failure cases it will return + a truncated version of the ideal result. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes + length must be sufficient to hold the resulting formatted + string, including the null terminator. + + pszFormat - format string which must be null terminated + + argList - va_list from the variable arguments according to the + stdarg.h convention + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL. See StringCbVPrintfEx if you + require the handling of NULL values. + + +Return Value: + + S_OK - if there was sufficient space in the dest buffer for + the resultant string and it was null terminated. + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbVPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, va_list argList); +STRSAFEAPI StringCbVPrintfW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszFormat, va_list argList); +#ifdef UNICODE +#define StringCbVPrintf StringCbVPrintfW +#else +#define StringCbVPrintf StringCbVPrintfA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbVPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, va_list argList) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList); + } + + return hr; +} + +STRSAFEAPI StringCbVPrintfW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchPrintf( + OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszFormat, + ... + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'sprintf'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was printed without truncation and null terminated, + otherwise it will return a failure code. In failure cases it will return + a truncated version of the ideal result. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters + length must be sufficient to hold the resulting formatted + string, including the null terminator. + + pszFormat - format string which must be null terminated + + ... - additional parameters to be formatted according to + the format string + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL. See StringCchPrintfEx if you + require the handling of NULL values. + +Return Value: + + S_OK - if there was sufficient space in the dest buffer for + the resultant string and it was null terminated. + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, ...); +STRSAFEAPI StringCchPrintfW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, ...); +#ifdef UNICODE +#define StringCchPrintf StringCchPrintfW +#else +#define StringCchPrintf StringCchPrintfA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, ...) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList); + + va_end(argList); + } + + return hr; +} + +STRSAFEAPI StringCchPrintfW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, ...) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList); + + va_end(argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbPrintf( + OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszFormat, + ... + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'sprintf'. + The size of the destination buffer (in bytes) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was printed without truncation and null terminated, + otherwise it will return a failure code. In failure cases it will return + a truncated version of the ideal result. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes + length must be sufficient to hold the resulting formatted + string, including the null terminator. + + pszFormat - format string which must be null terminated + + ... - additional parameters to be formatted according to + the format string + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL. See StringCbPrintfEx if you + require the handling of NULL values. + + +Return Value: + + S_OK - if there was sufficient space in the dest buffer for + the resultant string and it was null terminated. + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, ...); +STRSAFEAPI StringCbPrintfW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszFormat, ...); +#ifdef UNICODE +#define StringCbPrintf StringCbPrintfW +#else +#define StringCbPrintf StringCbPrintfA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, ...) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList); + + va_end(argList); + } + + return hr; +} + +STRSAFEAPI StringCbPrintfW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszFormat, ...) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList); + + va_end(argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchPrintfEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags, + IN LPCTSTR pszFormat OPTIONAL, + ... + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'sprintf' with + some additional parameters. In addition to functionality provided by + StringCchPrintf, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be sufficient to contain the resulting + formatted string plus the null terminator. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function printed any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return + the number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + + pszFormat - format string which must be null terminated + + ... - additional parameters to be formatted according to + the format string + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS + flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and + pszFormat may be NULL. An error may still be returned even though NULLS + are ignored due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, ...); +STRSAFEAPI StringCchPrintfExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, ...); +#ifdef UNICODE +#define StringCchPrintfEx StringCchPrintfExW +#else +#define StringCchPrintfEx StringCchPrintfExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, ...) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + va_list argList; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + va_start(argList, pszFormat); + + hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList); + + va_end(argList); + } + + return hr; +} + +STRSAFEAPI StringCchPrintfExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, ...) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + va_list argList; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + va_start(argList, pszFormat); + + hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList); + + va_end(argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbPrintfEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags, + IN LPCTSTR pszFormat OPTIONAL, + ... + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'sprintf' with + some additional parameters. In addition to functionality provided by + StringCbPrintf, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be sufficient to contain the resulting + formatted string plus the null terminator. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function printed any data, the result will point to the + null termination character + + pcbRemaining - if pcbRemaining is non-null, the function will return + the number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + + pszFormat - format string which must be null terminated + + ... - additional parameters to be formatted according to + the format string + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS + flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and + pszFormat may be NULL. An error may still be returned even though NULLS + are ignored due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, ...); +STRSAFEAPI StringCbPrintfExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const wchar_t* pszFormat, ...); +#ifdef UNICODE +#define StringCbPrintfEx StringCbPrintfExW +#else +#define StringCbPrintfEx StringCbPrintfExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, ...) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList); + + va_end(argList); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbPrintfExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const wchar_t* pszFormat, ...) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList); + + va_end(argList); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchVPrintfEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags, + IN LPCTSTR pszFormat OPTIONAL, + IN va_list argList + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'vsprintf' with + some additional parameters. In addition to functionality provided by + StringCchVPrintf, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be sufficient to contain the resulting + formatted string plus the null terminator. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function printed any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return + the number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + + pszFormat - format string which must be null terminated + + argList - va_list from the variable arguments according to the + stdarg.h convention + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS + flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and + pszFormat may be NULL. An error may still be returned even though NULLS + are ignored due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchVPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList); +STRSAFEAPI StringCchVPrintfExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList); +#ifdef UNICODE +#define StringCchVPrintfEx StringCchVPrintfExW +#else +#define StringCchVPrintfEx StringCchVPrintfExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchVPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList); + } + + return hr; +} + +STRSAFEAPI StringCchVPrintfExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbVPrintfEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags, + IN LPCTSTR pszFormat OPTIONAL, + IN va_list argList + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'vsprintf' with + some additional parameters. In addition to functionality provided by + StringCbVPrintf, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be sufficient to contain the resulting + formatted string plus the null terminator. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return + a pointer to the end of the destination string. If the + function printed any data, the result will point to the + null termination character + + pcbRemaining - if pcbRemaining is non-null, the function will return + the number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + + pszFormat - format string which must be null terminated + + argList - va_list from the variable arguments according to the + stdarg.h convention + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS + flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and + pszFormat may be NULL. An error may still be returned even though NULLS + are ignored due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbVPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList); +STRSAFEAPI StringCbVPrintfExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList); +#ifdef UNICODE +#define StringCbVPrintfEx StringCbVPrintfExW +#else +#define StringCbVPrintfEx StringCbVPrintfExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbVPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbVPrintfExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchGets( + OUT LPTSTR pszDest, + IN size_t cchDest + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'gets'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This routine is not a replacement for fgets. That function does not replace + newline characters with a null terminator. + + This function returns a hresult, and not a pointer. It returns + S_OK if any characters were read from stdin and copied to pszDest and + pszDest was null terminated, otherwise it will return a failure code. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + +Notes: + pszDest should not be NULL. See StringCchGetsEx if you require the handling + of NULL values. + + cchDest must be > 1 for this function to succeed. + +Return Value: + + S_OK - data was read from stdin and copied, and the resultant + dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_END_OF_FILE / + HRESULT_CODE(hr) == ERROR_HANDLE_EOF + - this return value indicates an error or end-of-file + condition, use feof or ferror to determine which one has + occured. + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that there was + insufficient space in the destination buffer to copy any + data + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringCchGetsA(char* pszDest, size_t cchDest); +STRSAFE_INLINE_API StringCchGetsW(wchar_t* pszDest, size_t cchDest); +#ifdef UNICODE +#define StringCchGets StringCchGetsW +#else +#define StringCchGets StringCchGetsA +#endif // !UNICODE + +STRSAFE_INLINE_API StringCchGetsA(char* pszDest, size_t cchDest) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, NULL, NULL, 0); + } + + return hr; +} + +STRSAFE_INLINE_API StringCchGetsW(wchar_t* pszDest, size_t cchDest) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, NULL, NULL, 0); + } + + return hr; +} +#endif // !STRSAFE_NO_CCH_FUNCTIONS +#endif // !STRSAFE_LIB_IMPL + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbGets( + OUT LPTSTR pszDest, + IN size_t cbDest + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'gets'. + The size of the destination buffer (in bytes) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This routine is not a replacement for fgets. That function does not replace + newline characters with a null terminator. + + This function returns a hresult, and not a pointer. It returns + S_OK if any characters were read from stdin and copied to pszDest + and pszDest was null terminated, otherwise it will return a failure code. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + +Notes: + pszDest should not be NULL. See StringCbGetsEx if you require the handling + of NULL values. + + cbDest must be > sizeof(TCHAR) for this function to succeed. + +Return Value: + + S_OK - data was read from stdin and copied, and the resultant + dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_END_OF_FILE / + HRESULT_CODE(hr) == ERROR_HANDLE_EOF + - this return value indicates an error or end-of-file + condition, use feof or ferror to determine which one has + occured. + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that there was + insufficient space in the destination buffer to copy any + data + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringCbGetsA(char* pszDest, size_t cbDest); +STRSAFE_INLINE_API StringCbGetsW(wchar_t* pszDest, size_t cbDest); +#ifdef UNICODE +#define StringCbGets StringCbGetsW +#else +#define StringCbGets StringCbGetsA +#endif // !UNICODE + +STRSAFE_INLINE_API StringCbGetsA(char* pszDest, size_t cbDest) +{ + HRESULT hr; + size_t cchDest; + + // convert to count of characters + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, NULL, NULL, 0); + } + + return hr; +} + +STRSAFE_INLINE_API StringCbGetsW(wchar_t* pszDest, size_t cbDest) +{ + HRESULT hr; + size_t cchDest; + + // convert to count of characters + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, NULL, NULL, 0); + } + + return hr; +} +#endif // !STRSAFE_NO_CB_FUNCTIONS +#endif // !STRSAFE_LIB_IMPL + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchGetsEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'gets' with + some additional parameters. In addition to functionality provided by + StringCchGets, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. + +Notes: + pszDest should not be NULL unless the STRSAFE_IGNORE_NULLS flag is specified. + If STRSAFE_IGNORE_NULLS is passed and pszDest is NULL, an error may still be + returned even though NULLS are ignored + + cchDest must be > 1 for this function to succeed. + +Return Value: + + S_OK - data was read from stdin and copied, and the resultant + dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_END_OF_FILE / + HRESULT_CODE(hr) == ERROR_HANDLE_EOF + - this return value indicates an error or end-of-file + condition, use feof or ferror to determine which one has + occured. + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that there was + insufficient space in the destination buffer to copy any + data + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringCchGetsExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFE_INLINE_API StringCchGetsExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchGetsEx StringCchGetsExW +#else +#define StringCchGetsEx StringCchGetsExA +#endif // !UNICODE + +STRSAFE_INLINE_API StringCchGetsExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFE_INLINE_API StringCchGetsExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // !STRSAFE_NO_CCH_FUNCTIONS +#endif // !STRSAFE_LIB_IMPL + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbGetsEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'gets' with + some additional parameters. In addition to functionality provided by + StringCbGets, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcbRemaining - if pbRemaining is non-null, the function will return the + number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. + +Notes: + pszDest should not be NULL unless the STRSAFE_IGNORE_NULLS flag is specified. + If STRSAFE_IGNORE_NULLS is passed and pszDest is NULL, an error may still be + returned even though NULLS are ignored + + cbDest must be > sizeof(TCHAR) for this function to succeed + +Return Value: + + S_OK - data was read from stdin and copied, and the resultant + dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_END_OF_FILE / + HRESULT_CODE(hr) == ERROR_HANDLE_EOF + - this return value indicates an error or end-of-file + condition, use feof or ferror to determine which one has + occured. + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that there was + insufficient space in the destination buffer to copy any + data + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringCbGetsExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pbRemaining, unsigned long dwFlags); +STRSAFE_INLINE_API StringCbGetsExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbGetsEx StringCbGetsExW +#else +#define StringCbGetsEx StringCbGetsExA +#endif // !UNICODE + +STRSAFE_INLINE_API StringCbGetsExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || + (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || + (hr == STRSAFE_E_END_OF_FILE)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFE_INLINE_API StringCbGetsExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || + (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || + (hr == STRSAFE_E_END_OF_FILE)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // !STRSAFE_NO_CB_FUNCTIONS +#endif // !STRSAFE_LIB_IMPL + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchLength( + IN LPCTSTR psz, + IN size_t cchMax, + OUT size_t* pcch OPTIONAL + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strlen'. + It is used to make sure a string is not larger than a given length, and + it optionally returns the current length in characters not including + the null terminator. + + This function returns a hresult, and not a pointer. It returns + S_OK if the string is non-null and the length including the null + terminator is less than or equal to cchMax characters. + +Arguments: + + psz - string to check the length of + + cchMax - maximum number of characters including the null terminator + that psz is allowed to contain + + pcch - if the function succeeds and pcch is non-null, the current length + in characters of psz excluding the null terminator will be returned. + This out parameter is equivalent to the return value of strlen(psz) + +Notes: + psz can be null but the function will fail + + cchMax should be greater than zero or the function will fail + +Return Value: + + S_OK - psz is non-null and the length including the null + terminator is less than or equal to cchMax characters + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCchLengthA(const char* psz, size_t cchMax, size_t* pcch); +STRSAFEAPI StringCchLengthW(const wchar_t* psz, size_t cchMax, size_t* pcch); +#ifdef UNICODE +#define StringCchLength StringCchLengthW +#else +#define StringCchLength StringCchLengthA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchLengthA(const char* psz, size_t cchMax, size_t* pcch) +{ + HRESULT hr; + + if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringLengthWorkerA(psz, cchMax, pcch); + } + + return hr; +} + +STRSAFEAPI StringCchLengthW(const wchar_t* psz, size_t cchMax, size_t* pcch) +{ + HRESULT hr; + + if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringLengthWorkerW(psz, cchMax, pcch); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbLength( + IN LPCTSTR psz, + IN size_t cbMax, + OUT size_t* pcb OPTIONAL + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strlen'. + It is used to make sure a string is not larger than a given length, and + it optionally returns the current length in bytes not including + the null terminator. + + This function returns a hresult, and not a pointer. It returns + S_OK if the string is non-null and the length including the null + terminator is less than or equal to cbMax bytes. + +Arguments: + + psz - string to check the length of + + cbMax - maximum number of bytes including the null terminator + that psz is allowed to contain + + pcb - if the function succeeds and pcb is non-null, the current length + in bytes of psz excluding the null terminator will be returned. + This out parameter is equivalent to the return value of strlen(psz) * sizeof(TCHAR) + +Notes: + psz can be null but the function will fail + + cbMax should be greater than or equal to sizeof(TCHAR) or the function will fail + +Return Value: + + S_OK - psz is non-null and the length including the null + terminator is less than or equal to cbMax bytes + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCbLengthA(const char* psz, size_t cchMax, size_t* pcch); +STRSAFEAPI StringCbLengthW(const wchar_t* psz, size_t cchMax, size_t* pcch); +#ifdef UNICODE +#define StringCbLength StringCbLengthW +#else +#define StringCbLength StringCbLengthA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbLengthA(const char* psz, size_t cbMax, size_t* pcb) +{ + HRESULT hr; + size_t cchMax; + size_t cch = 0; + + cchMax = cbMax / sizeof(char); + + if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringLengthWorkerA(psz, cchMax, &cch); + } + + if (SUCCEEDED(hr) && pcb) + { + // safe to multiply cch * sizeof(char) since cch < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcb = cch * sizeof(char); + } + + return hr; +} + +STRSAFEAPI StringCbLengthW(const wchar_t* psz, size_t cbMax, size_t* pcb) +{ + HRESULT hr; + size_t cchMax; + size_t cch = 0; + + cchMax = cbMax / sizeof(wchar_t); + + if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringLengthWorkerW(psz, cchMax, &cch); + } + + if (SUCCEEDED(hr) && pcb) + { + // safe to multiply cch * sizeof(wchar_t) since cch < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcb = cch * sizeof(wchar_t); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +// these are the worker functions that actually do the work +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCopyWorkerA(char* pszDest, size_t cchDest, const char* pszSrc) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + while (cchDest && (*pszSrc != '\0')) + { + *pszDest++ = *pszSrc++; + cchDest--; + } + + if (cchDest == 0) + { + // we are going to truncate pszDest + pszDest--; + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDest= '\0'; + } + + return hr; +} + +STRSAFEAPI StringCopyWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + while (cchDest && (*pszSrc != L'\0')) + { + *pszDest++ = *pszSrc++; + cchDest--; + } + + if (cchDest == 0) + { + // we are going to truncate pszDest + pszDest--; + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDest= L'\0'; + } + + return hr; +} + +STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszSrc == NULL) + { + pszSrc = ""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually src data to copy + if (*pszSrc != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while (cchRemaining && (*pszSrc != '\0')) + { + *pszDestEnd++= *pszSrc++; + cchRemaining--; + } + + if (cchRemaining > 0) + { + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); + } + } + else + { + // we are going to truncate pszDest + pszDestEnd--; + cchRemaining++; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDestEnd = '\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCopyExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszSrc == NULL) + { + pszSrc = L""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually src data to copy + if (*pszSrc != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while (cchRemaining && (*pszSrc != L'\0')) + { + *pszDestEnd++= *pszSrc++; + cchRemaining--; + } + + if (cchRemaining > 0) + { + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + } + } + else + { + // we are going to truncate pszDest + pszDestEnd--; + cchRemaining++; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDestEnd = L'\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + while (cchDest && cchSrc && (*pszSrc != '\0')) + { + *pszDest++= *pszSrc++; + cchDest--; + cchSrc--; + } + + if (cchDest == 0) + { + // we are going to truncate pszDest + pszDest--; + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDest= '\0'; + } + + return hr; +} + +STRSAFEAPI StringCopyNWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + while (cchDest && cchSrc && (*pszSrc != L'\0')) + { + *pszDest++= *pszSrc++; + cchDest--; + cchSrc--; + } + + if (cchDest == 0) + { + // we are going to truncate pszDest + pszDest--; + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDest= L'\0'; + } + + return hr; +} + +STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszSrc == NULL) + { + pszSrc = ""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually src data to copy + if (*pszSrc != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while (cchRemaining && cchSrc && (*pszSrc != '\0')) + { + *pszDestEnd++= *pszSrc++; + cchRemaining--; + cchSrc--; + } + + if (cchRemaining > 0) + { + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); + } + } + else + { + // we are going to truncate pszDest + pszDestEnd--; + cchRemaining++; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDestEnd = '\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCopyNExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, size_t cchSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszSrc == NULL) + { + pszSrc = L""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually src data to copy + if (*pszSrc != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while (cchRemaining && cchSrc && (*pszSrc != L'\0')) + { + *pszDestEnd++= *pszSrc++; + cchRemaining--; + cchSrc--; + } + + if (cchRemaining > 0) + { + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + } + } + else + { + // we are going to truncate pszDest + pszDestEnd--; + cchRemaining++; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDestEnd = L'\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc) +{ + HRESULT hr; + size_t cchDestCurrent; + + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + hr = StringCopyWorkerA(pszDest + cchDestCurrent, + cchDest - cchDestCurrent, + pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCatWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc) +{ + HRESULT hr; + size_t cchDestCurrent; + + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + hr = StringCopyWorkerW(pszDest + cchDestCurrent, + cchDest - cchDestCurrent, + pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchDestCurrent; + + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest == 0) && (cbDest == 0)) + { + cchDestCurrent = 0; + } + else + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + else + { + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (pszSrc == NULL) + { + pszSrc = ""; + } + } + else + { + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + // only fail if there was actually src data to append + if (*pszSrc != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass + // those flags through + hr = StringCopyExWorkerA(pszDestEnd, + cchRemaining, + (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)), + pszSrc, + &pszDestEnd, + &cchRemaining, + dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE))); + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + // STRSAFE_NO_TRUNCATION is taken care of by StringCopyExWorkerA() + + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else + if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & STRSAFE_NULL_ON_FAILURE) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCatExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchDestCurrent; + + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest == 0) && (cbDest == 0)) + { + cchDestCurrent = 0; + } + else + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + else + { + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (pszSrc == NULL) + { + pszSrc = L""; + } + } + else + { + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + // only fail if there was actually src data to append + if (*pszSrc != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass + // those flags through + hr = StringCopyExWorkerW(pszDestEnd, + cchRemaining, + (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)), + pszSrc, + &pszDestEnd, + &cchRemaining, + dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE))); + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + // STRSAFE_NO_TRUNCATION is taken care of by StringCopyExWorkerW() + + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & STRSAFE_NULL_ON_FAILURE) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend) +{ + HRESULT hr; + size_t cchDestCurrent; + + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + hr = StringCopyNWorkerA(pszDest + cchDestCurrent, + cchDest - cchDestCurrent, + pszSrc, + cchMaxAppend); + } + + return hr; +} + +STRSAFEAPI StringCatNWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend) +{ + HRESULT hr; + size_t cchDestCurrent; + + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + hr = StringCopyNWorkerW(pszDest + cchDestCurrent, + cchDest - cchDestCurrent, + pszSrc, + cchMaxAppend); + } + + return hr; +} + +STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + size_t cchDestCurrent = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest == 0) && (cbDest == 0)) + { + cchDestCurrent = 0; + } + else + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + else + { + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (pszSrc == NULL) + { + pszSrc = ""; + } + } + else + { + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + // only fail if there was actually src data to append + if (*pszSrc != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass + // those flags through + hr = StringCopyNExWorkerA(pszDestEnd, + cchRemaining, + (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)), + pszSrc, + cchMaxAppend, + &pszDestEnd, + &cchRemaining, + dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE))); + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + // STRSAFE_NO_TRUNCATION is taken care of by StringCopyNExWorkerA() + + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCatNExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, size_t cchMaxAppend, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + size_t cchDestCurrent = 0; + + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest == 0) && (cbDest == 0)) + { + cchDestCurrent = 0; + } + else + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + else + { + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (pszSrc == NULL) + { + pszSrc = L""; + } + } + else + { + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + // only fail if there was actually src data to append + if (*pszSrc != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass + // those flags through + hr = StringCopyNExWorkerW(pszDestEnd, + cchRemaining, + (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)), + pszSrc, + cchMaxAppend, + &pszDestEnd, + &cchRemaining, + dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE))); + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + // STRSAFE_NO_TRUNCATION is taken care of by StringCopyNExWorkerW() + + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringVPrintfWorkerA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + int iRet; + size_t cchMax; + + // leave the last space for the null terminator + cchMax = cchDest - 1; + + iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList); + // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); + + if ((iRet < 0) || (((size_t)iRet) > cchMax)) + { + // need to null terminate the string + pszDest += cchMax; + *pszDest = '\0'; + + // we have truncated pszDest + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else if (((size_t)iRet) == cchMax) + { + // need to null terminate the string + pszDest += cchMax; + *pszDest = '\0'; + } + } + + return hr; +} + +STRSAFEAPI StringVPrintfWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + int iRet; + size_t cchMax; + + // leave the last space for the null terminator + cchMax = cchDest - 1; + + iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList); + // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); + + if ((iRet < 0) || (((size_t)iRet) > cchMax)) + { + // need to null terminate the string + pszDest += cchMax; + *pszDest = L'\0'; + + // we have truncated pszDest + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else if (((size_t)iRet) == cchMax) + { + // need to null terminate the string + pszDest += cchMax; + *pszDest = L'\0'; + } + } + + return hr; +} + +STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszFormat == NULL) + { + pszFormat = ""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually a non-empty format string + if (*pszFormat != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + int iRet; + size_t cchMax; + + // leave the last space for the null terminator + cchMax = cchDest - 1; + + iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList); + // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); + + if ((iRet < 0) || (((size_t)iRet) > cchMax)) + { + // we have truncated pszDest + pszDestEnd = pszDest + cchMax; + cchRemaining = 1; + + // need to null terminate the string + *pszDestEnd = '\0'; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else if (((size_t)iRet) == cchMax) + { + // string fit perfectly + pszDestEnd = pszDest + cchMax; + cchRemaining = 1; + + // need to null terminate the string + *pszDestEnd = '\0'; + } + else if (((size_t)iRet) < cchMax) + { + // there is extra room + pszDestEnd = pszDest + iRet; + cchRemaining = cchDest - iRet; + + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); + } + } + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringVPrintfExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszFormat == NULL) + { + pszFormat = L""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually a non-empty format string + if (*pszFormat != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + int iRet; + size_t cchMax; + + // leave the last space for the null terminator + cchMax = cchDest - 1; + + iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList); + // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); + + if ((iRet < 0) || (((size_t)iRet) > cchMax)) + { + // we have truncated pszDest + pszDestEnd = pszDest + cchMax; + cchRemaining = 1; + + // need to null terminate the string + *pszDestEnd = L'\0'; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else if (((size_t)iRet) == cchMax) + { + // string fit perfectly + pszDestEnd = pszDest + cchMax; + cchRemaining = 1; + + // need to null terminate the string + *pszDestEnd = L'\0'; + } + else if (((size_t)iRet) < cchMax) + { + // there is extra room + pszDestEnd = pszDest + iRet; + cchRemaining = cchDest - iRet; + + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + } + } + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch) +{ + HRESULT hr = S_OK; + size_t cchMaxPrev = cchMax; + + while (cchMax && (*psz != '\0')) + { + psz++; + cchMax--; + } + + if (cchMax == 0) + { + // the string is longer than cchMax + hr = STRSAFE_E_INVALID_PARAMETER; + } + + if (SUCCEEDED(hr) && pcch) + { + *pcch = cchMaxPrev - cchMax; + } + + return hr; +} + +STRSAFEAPI StringLengthWorkerW(const wchar_t* psz, size_t cchMax, size_t* pcch) +{ + HRESULT hr = S_OK; + size_t cchMaxPrev = cchMax; + + while (cchMax && (*psz != L'\0')) + { + psz++; + cchMax--; + } + + if (cchMax == 0) + { + // the string is longer than cchMax + hr = STRSAFE_E_INVALID_PARAMETER; + } + + if (SUCCEEDED(hr) && pcch) + { + *pcch = cchMaxPrev - cchMax; + } + + return hr; +} +#endif // STRSAFE_INLINE + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringGetsExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest <= 1) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + if (cchDest == 1) + { + *pszDestEnd = '\0'; + } + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else + { + char ch; + + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while ((cchRemaining > 1) && (ch = (char)getc(stdin)) != '\n') + { + if (ch == EOF) + { + if (pszDestEnd == pszDest) + { + // we failed to read anything from stdin + hr = STRSAFE_E_END_OF_FILE; + } + break; + } + + *pszDestEnd = ch; + + pszDestEnd++; + cchRemaining--; + } + + if (cchRemaining > 0) + { + // there is extra room + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); + } + } + + *pszDestEnd = '\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || + (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || + (hr == STRSAFE_E_END_OF_FILE)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFE_INLINE_API StringGetsExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest <= 1) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + if (cchDest == 1) + { + *pszDestEnd = L'\0'; + } + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else + { + wchar_t ch; + + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while ((cchRemaining > 1) && (ch = (wchar_t)getwc(stdin)) != L'\n') + { + if (ch == EOF) + { + if (pszDestEnd == pszDest) + { + // we failed to read anything from stdin + hr = STRSAFE_E_END_OF_FILE; + } + break; + } + + *pszDestEnd = ch; + + pszDestEnd++; + cchRemaining--; + } + + if (cchRemaining > 0) + { + // there is extra room + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + } + } + + *pszDestEnd = L'\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || + (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || + (hr == STRSAFE_E_END_OF_FILE)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} +#endif // !STRSAFE_LIB_IMPL + + +// Do not call these functions, they are worker functions for internal use within this file +#ifdef DEPRECATE_SUPPORTED +#pragma deprecated(StringCopyWorkerA) +#pragma deprecated(StringCopyWorkerW) +#pragma deprecated(StringCopyExWorkerA) +#pragma deprecated(StringCopyExWorkerW) +#pragma deprecated(StringCatWorkerA) +#pragma deprecated(StringCatWorkerW) +#pragma deprecated(StringCatExWorkerA) +#pragma deprecated(StringCatExWorkerW) +#pragma deprecated(StringCatNWorkerA) +#pragma deprecated(StringCatNWorkerW) +#pragma deprecated(StringCatNExWorkerA) +#pragma deprecated(StringCatNExWorkerW) +#pragma deprecated(StringVPrintfWorkerA) +#pragma deprecated(StringVPrintfWorkerW) +#pragma deprecated(StringVPrintfExWorkerA) +#pragma deprecated(StringVPrintfExWorkerW) +#pragma deprecated(StringLengthWorkerA) +#pragma deprecated(StringLengthWorkerW) +#else +#define StringCopyWorkerA StringCopyWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA; +#define StringCopyWorkerW StringCopyWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW; +#define StringCopyExWorkerA StringCopyExWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA; +#define StringCopyExWorkerW StringCopyExWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW; +#define StringCatWorkerA StringCatWorkerA_instead_use_StringCchCatA_or_StringCchCatExA; +#define StringCatWorkerW StringCatWorkerW_instead_use_StringCchCatW_or_StringCchCatExW; +#define StringCatExWorkerA StringCatExWorkerA_instead_use_StringCchCatA_or_StringCchCatExA; +#define StringCatExWorkerW StringCatExWorkerW_instead_use_StringCchCatW_or_StringCchCatExW; +#define StringCatNWorkerA StringCatNWorkerA_instead_use_StringCchCatNA_or_StrincCbCatNA; +#define StringCatNWorkerW StringCatNWorkerW_instead_use_StringCchCatNW_or_StringCbCatNW; +#define StringCatNExWorkerA StringCatNExWorkerA_instead_use_StringCchCatNExA_or_StringCbCatNExA; +#define StringCatNExWorkerW StringCatNExWorkerW_instead_use_StringCchCatNExW_or_StringCbCatNExW; +#define StringVPrintfWorkerA StringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA; +#define StringVPrintfWorkerW StringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW; +#define StringVPrintfExWorkerA StringVPrintfExWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA; +#define StringVPrintfExWorkerW StringVPrintfExWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW; +#define StringLengthWorkerA StringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA; +#define StringLengthWorkerW StringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW; +#endif // !DEPRECATE_SUPPORTED + + +#ifndef STRSAFE_NO_DEPRECATE +// Deprecate all of the unsafe functions to generate compiletime errors. If you do not want +// this then you can #define STRSAFE_NO_DEPRECATE before including this file. +#ifdef DEPRECATE_SUPPORTED + +// First all the names that are a/w variants (or shouldn't be #defined by now anyway). +#pragma deprecated(lstrcpyA) +#pragma deprecated(lstrcpyW) +#pragma deprecated(lstrcatA) +#pragma deprecated(lstrcatW) +#pragma deprecated(wsprintfA) +#pragma deprecated(wsprintfW) + +#pragma deprecated(StrCpyW) +#pragma deprecated(StrCatW) +#pragma deprecated(StrNCatA) +#pragma deprecated(StrNCatW) +#pragma deprecated(StrCatNA) +#pragma deprecated(StrCatNW) +#pragma deprecated(wvsprintfA) +#pragma deprecated(wvsprintfW) + +#pragma deprecated(strcpy) +#pragma deprecated(wcscpy) +#pragma deprecated(strcat) +#pragma deprecated(wcscat) +#pragma deprecated(sprintf) +#pragma deprecated(swprintf) +#pragma deprecated(vsprintf) +#pragma deprecated(vswprintf) +#pragma deprecated(_snprintf) +#pragma deprecated(_snwprintf) +#pragma deprecated(_vsnprintf) +#pragma deprecated(_vsnwprintf) +#pragma deprecated(gets) +#pragma deprecated(_getws) + +// Then all the windows.h names - we need to undef and redef based on UNICODE setting +#undef lstrcpy +#undef lstrcat +#undef wsprintf +#undef wvsprintf +#pragma deprecated(lstrcpy) +#pragma deprecated(lstrcat) +#pragma deprecated(wsprintf) +#pragma deprecated(wvsprintf) +#ifdef UNICODE +#define lstrcpy lstrcpyW +#define lstrcat lstrcatW +#define wsprintf wsprintfW +#define wvsprintf wvsprintfW +#else +#define lstrcpy lstrcpyA +#define lstrcat lstrcatA +#define wsprintf wsprintfA +#define wvsprintf wvsprintfA +#endif + +// Then the shlwapi names - they key off UNICODE also. +#undef StrCpyA +#undef StrCpy +#undef StrCatA +#undef StrCat +#undef StrNCat +#undef StrCatN +#pragma deprecated(StrCpyA) +#pragma deprecated(StrCatA) +#pragma deprecated(StrCatN) +#pragma deprecated(StrCpy) +#pragma deprecated(StrCat) +#pragma deprecated(StrNCat) +#define StrCpyA lstrcpyA +#define StrCatA lstrcatA +#define StrCatN StrNCat +#ifdef UNICODE +#define StrCpy StrCpyW +#define StrCat StrCatW +#define StrNCat StrNCatW +#else +#define StrCpy lstrcpyA +#define StrCat lstrcatA +#define StrNCat StrNCatA +#endif + +// Then all the CRT names - we need to undef/redef based on _UNICODE value. +#undef _tcscpy +#undef _ftcscpy +#undef _tcscat +#undef _ftcscat +#undef _stprintf +#undef _sntprintf +#undef _vstprintf +#undef _vsntprintf +#undef _getts +#pragma deprecated(_tcscpy) +#pragma deprecated(_ftcscpy) +#pragma deprecated(_tcscat) +#pragma deprecated(_ftcscat) +#pragma deprecated(_stprintf) +#pragma deprecated(_sntprintf) +#pragma deprecated(_vstprintf) +#pragma deprecated(_vsntprintf) +#pragma deprecated(_getts) +#ifdef _UNICODE +#define _tcscpy wcscpy +#define _ftcscpy wcscpy +#define _tcscat wcscat +#define _ftcscat wcscat +#define _stprintf swprintf +#define _sntprintf _snwprintf +#define _vstprintf vswprintf +#define _vsntprintf _vsnwprintf +#define _getts _getws +#else +#define _tcscpy strcpy +#define _ftcscpy strcpy +#define _tcscat strcat +#define _ftcscat strcat +#define _stprintf sprintf +#define _sntprintf _snprintf +#define _vstprintf vsprintf +#define _vsntprintf _vsnprintf +#define _getts gets +#endif + +#else // DEPRECATE_SUPPORTED + +#undef strcpy +#define strcpy strcpy_instead_use_StringCbCopyA_or_StringCchCopyA; + +#undef wcscpy +#define wcscpy wcscpy_instead_use_StringCbCopyW_or_StringCchCopyW; + +#undef strcat +#define strcat strcat_instead_use_StringCbCatA_or_StringCchCatA; + +#undef wcscat +#define wcscat wcscat_instead_use_StringCbCatW_or_StringCchCatW; + +#undef sprintf +#define sprintf sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA; + +#undef swprintf +#define swprintf swprintf_instead_use_StringCbPrintfW_or_StringCchPrintfW; + +#undef vsprintf +#define vsprintf vsprintf_instead_use_StringCbVPrintfA_or_StringCchVPrintfA; + +#undef vswprintf +#define vswprintf vswprintf_instead_use_StringCbVPrintfW_or_StringCchVPrintfW; + +#undef _snprintf +#define _snprintf _snprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA; + +#undef _snwprintf +#define _snwprintf _snwprintf_instead_use_StringCbPrintfW_or_StringCchPrintfW; + +#undef _vsnprintf +#define _vsnprintf _vsnprintf_instead_use_StringCbVPrintfA_or_StringCchVPrintfA; + +#undef _vsnwprintf +#define _vsnwprintf _vsnwprintf_instead_use_StringCbVPrintfW_or_StringCchVPrintfW; + +#undef strcpyA +#define strcpyA strcpyA_instead_use_StringCbCopyA_or_StringCchCopyA; + +#undef strcpyW +#define strcpyW strcpyW_instead_use_StringCbCopyW_or_StringCchCopyW; + +#undef lstrcpy +#define lstrcpy lstrcpy_instead_use_StringCbCopy_or_StringCchCopy; + +#undef lstrcpyA +#define lstrcpyA lstrcpyA_instead_use_StringCbCopyA_or_StringCchCopyA; + +#undef lstrcpyW +#define lstrcpyW lstrcpyW_instead_use_StringCbCopyW_or_StringCchCopyW; + +#undef StrCpy +#define StrCpy StrCpy_instead_use_StringCbCopy_or_StringCchCopy; + +#undef StrCpyA +#define StrCpyA StrCpyA_instead_use_StringCbCopyA_or_StringCchCopyA; + +#undef StrCpyW +#define StrCpyW StrCpyW_instead_use_StringCbCopyW_or_StringCchCopyW; + +#undef _tcscpy +#define _tcscpy _tcscpy_instead_use_StringCbCopy_or_StringCchCopy; + +#undef _ftcscpy +#define _ftcscpy _ftcscpy_instead_use_StringCbCopy_or_StringCchCopy; + +#undef lstrcat +#define lstrcat lstrcat_instead_use_StringCbCat_or_StringCchCat; + +#undef lstrcatA +#define lstrcatA lstrcatA_instead_use_StringCbCatA_or_StringCchCatA; + +#undef lstrcatW +#define lstrcatW lstrcatW_instead_use_StringCbCatW_or_StringCchCatW; + +#undef StrCat +#define StrCat StrCat_instead_use_StringCbCat_or_StringCchCat; + +#undef StrCatA +#define StrCatA StrCatA_instead_use_StringCbCatA_or_StringCchCatA; + +#undef StrCatW +#define StrCatW StrCatW_instead_use_StringCbCatW_or_StringCchCatW; + +#undef StrNCat +#define StrNCat StrNCat_instead_use_StringCbCatN_or_StringCchCatN; + +#undef StrNCatA +#define StrNCatA StrNCatA_instead_use_StringCbCatNA_or_StringCchCatNA; + +#undef StrNCatW +#define StrNCatW StrNCatW_instead_use_StringCbCatNW_or_StringCchCatNW; + +#undef StrCatN +#define StrCatN StrCatN_instead_use_StringCbCatN_or_StringCchCatN; + +#undef StrCatNA +#define StrCatNA StrCatNA_instead_use_StringCbCatNA_or_StringCchCatNA; + +#undef StrCatNW +#define StrCatNW StrCatNW_instead_use_StringCbCatNW_or_StringCchCatNW; + +#undef _tcscat +#define _tcscat _tcscat_instead_use_StringCbCat_or_StringCchCat; + +#undef _ftcscat +#define _ftcscat _ftcscat_instead_use_StringCbCat_or_StringCchCat; + +#undef wsprintf +#define wsprintf wsprintf_instead_use_StringCbPrintf_or_StringCchPrintf; + +#undef wsprintfA +#define wsprintfA wsprintfA_instead_use_StringCbPrintfA_or_StringCchPrintfA; + +#undef wsprintfW +#define wsprintfW wsprintfW_instead_use_StringCbPrintfW_or_StringCchPrintfW; + +#undef wvsprintf +#define wvsprintf wvsprintf_instead_use_StringCbVPrintf_or_StringCchVPrintf; + +#undef wvsprintfA +#define wvsprintfA wvsprintfA_instead_use_StringCbVPrintfA_or_StringCchVPrintfA; + +#undef wvsprintfW +#define wvsprintfW wvsprintfW_instead_use_StringCbVPrintfW_or_StringCchVPrintfW; + +#undef _vstprintf +#define _vstprintf _vstprintf_instead_use_StringCbVPrintf_or_StringCchVPrintf; + +#undef _vsntprintf +#define _vsntprintf _vsntprintf_instead_use_StringCbVPrintf_or_StringCchVPrintf; + +#undef _stprintf +#define _stprintf _stprintf_instead_use_StringCbPrintf_or_StringCchPrintf; + +#undef _sntprintf +#define _sntprintf _sntprintf_instead_use_StringCbPrintf_or_StringCchPrintf; + +#undef _getts +#define _getts _getts_instead_use_StringCbGets_or_StringCchGets; + +#undef gets +#define gets _gets_instead_use_StringCbGetsA_or_StringCchGetsA; + +#undef _getws +#define _getws _getws_instead_use_StringCbGetsW_or_StringCchGetsW; + +#endif // !DEPRECATE_SUPPORTED +#endif // !STRSAFE_NO_DEPRECATE + +#ifdef _NTSTRSAFE_H_INCLUDED_ +#pragma warning(pop) +#endif // _NTSTRSAFE_H_INCLUDED_ + +#endif // _STRSAFE_H_INCLUDED_