Subversion Repositories spacemission

Rev

Rev 4 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. (*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1994-1999 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  DirectX header version 98.11.20
  6.  *
  7.  *  Present by Hiroyuki Hori.
  8.  *
  9.  *  E-Mail: hori@ingjapan.ne.jp
  10.  *  Homepage: http://www.ingjapan.ne.jp/hori/index.html
  11.  *  Homepage: http://www.ingjapan.ne.jp/hori/index-e.html
  12.  *
  13.  *  Present unit:
  14.  *    DirectX.pas    DirectX 7 (DirectX 7 SDK)
  15.  *    DShow.pas      DirectShow (DirectX Media SDK 5.1)
  16.  *    DAnim.pas      DirectAnimation (DirectX Media SDK 5.1)
  17.  *
  18.  *--------------------------------------------------------------------------
  19.  *
  20.  *    DirectMusic header version 1.0
  21.  *
  22.  *    Present by Kazuya Yamane
  23.  *
  24.  *    e-mail : kazuya-y@infosakyu.ne.jp
  25.  *    URL    : http://www.infosakyu.ne.jp/~kazuya-y/index.html
  26.  *
  27.  ***************************************************************************)
  28.  
  29. unit DirectX;
  30.  
  31. interface
  32.  
  33. {$Z4}
  34. {$A+}
  35. {$WEAKPACKAGEUNIT}
  36.  
  37. {$IFNDEF DirectX3}
  38. {$IFNDEF DirectX5}
  39. {$IFNDEF DirectX6}
  40. {$IFNDEF DirectX7}
  41.   {$DEFINE DirectX7}
  42. {$ENDIF}
  43. {$ENDIF}
  44. {$ENDIF}
  45. {$ENDIF}
  46.  
  47. {$IFDEF DirectX3}
  48.   {$UNDEF DirectX5}
  49.   {$UNDEF DirectX6}
  50.   {$UNDEF DirectX7}
  51.   {$DEFINE SupportDirectX3}
  52. {$ENDIF}
  53.  
  54. {$IFDEF DirectX5}
  55.   {$UNDEF DirectX3}
  56.   {$UNDEF DirectX6}
  57.   {$UNDEF DirectX7}
  58.   {$DEFINE SupportDirectX3}
  59.   {$DEFINE SupportDirectX5}
  60. {$ENDIF}
  61.  
  62. {$IFDEF DirectX6}
  63.   {$UNDEF DirectX3}
  64.   {$UNDEF DirectX5}
  65.   {$UNDEF DirectX7}
  66.   {$DEFINE SupportDirectX3}
  67.   {$DEFINE SupportDirectX5}
  68.   {$DEFINE SupportDirectX6}
  69. {$ENDIF}
  70.  
  71. {$IFDEF DirectX7}
  72.   {$UNDEF DirectX3}
  73.   {$UNDEF DirectX5}
  74.   {$UNDEF DirectX6}
  75.   {$DEFINE SupportDirectX3}
  76.   {$DEFINE SupportDirectX5}
  77.   {$DEFINE SupportDirectX6}
  78.   {$DEFINE SupportDirectX7}
  79. {$ENDIF}
  80.  
  81. uses Windows, MMSystem, ActiveX;
  82.  
  83. const
  84. {$IFDEF DirectX3}
  85.   DirectXUnitVersion = 3;
  86. {$ENDIF}{$IFDEF DirectX5}
  87.   DirectXUnitVersion = 5;
  88. {$ENDIF}{$IFDEF DirectX6}
  89.   DirectXUnitVersion = 6;
  90. {$ENDIF}{$IFDEF DirectX7}
  91.   DirectXUnitVersion = 7;
  92. {$ENDIF}
  93.  
  94. (*==========================================================================;
  95.  *
  96.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  97.  *
  98.  *  File:       ddraw.h
  99.  *  Content:    DirectDraw include file
  100.  *
  101.  ***************************************************************************)
  102.  
  103. { FOURCC codes for DX compressed-texture pixel formats }
  104.  
  105. const
  106.   FOURCC_DXT1 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('1') shl 24;
  107.   FOURCC_DXT2 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('2') shl 24;
  108.   FOURCC_DXT3 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('3') shl 24;
  109.   FOURCC_DXT4 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('4') shl 24;
  110.   FOURCC_DXT5 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('5') shl 24;
  111.  
  112. { GUIDS used by DirectDraw objects }
  113.  
  114. const
  115.   CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
  116.   CLSID_DirectDraw7: TGUID = '{3C305196-50DB-11D3-9CFE-00C04FD930C5}';
  117.   CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00B93356}';
  118.   IID_IDirectDraw: TGUID = '{6C14DB80-A733-11CE-A521-0020AF0BE560}';
  119.   IID_IDirectDraw2: TGUID = '{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}';
  120.   IID_IDirectDraw4: TGUID = '{9C59509A-39BD-11D1-8C4A-00C04FD930C5}';
  121.   IID_IDirectDraw7: TGUID = '{15E65EC0-3B9C-11D2-B92F-00609797EA5B}';
  122.   IID_IDirectDrawSurface: TGUID = '{6C14DB81-A733-11CE-A521-0020AF0BE560}';
  123.   IID_IDirectDrawSurface2: TGUID = '{57805885-6EEC-11CF-9441-A82303C10E27}';
  124.   IID_IDirectDrawSurface3: TGUID = '{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}';
  125.   IID_IDirectDrawSurface4: TGUID = '{0B2B8630-AD35-11D0-8EA6-00609797EA5B}';
  126.   IID_IDirectDrawSurface7: TGUID = '{06675A80-3B9B-11D2-B92F-00609797EA5B}';
  127.   IID_IDirectDrawPalette: TGUID = '{6C14DB84-A733-11CE-A521-0020AF0BE560}';
  128.   IID_IDirectDrawClipper: TGUID = '{6C14DB85-A733-11CE-A521-0020AF0BE560}';
  129.   IID_IDirectDrawColorControl: TGUID = '{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}';
  130.   IID_IDirectDrawGammaControl: TGUID = '{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}';
  131.  
  132. const
  133.   DD_ROP_SPACE = 256 div 32;       // space required to store ROP array
  134.  
  135.   MAX_DDDEVICEID_STRING = 512;
  136.  
  137. { DirectDraw Structures }
  138.  
  139. type
  140.   IDirectDraw = interface;
  141.   IDirectDraw2 = interface;
  142.   IDirectDraw4 = interface;
  143.   IDirectDraw7 = interface;
  144.   IDirectDrawSurface = interface;
  145.   IDirectDrawSurface2 = interface;
  146.   IDirectDrawSurface3 = interface;
  147.   IDirectDrawSurface4 = interface;
  148.   IDirectDrawSurface7 = interface;
  149.   IDirectDrawPalette = interface;
  150.   IDirectDrawClipper = interface;
  151.   IDirectDrawColorControl = interface;
  152.   IDirectDrawGammaControl = interface;
  153.  
  154. { TDDARGB structure }
  155.  
  156.   PDDARGB = ^TDDARGB;
  157.   TDDARGB = record
  158.     Blue: Byte;
  159.     Green: Byte;
  160.     Red: Byte;
  161.     Alpha: Byte;
  162.   end;
  163.  
  164.   DDARGB = TDDARGB;
  165.   LPDDARGB = PDDARGB;
  166.  
  167. { TDDRGBA structure }
  168.  
  169.   PDDRGBA = ^TDDRGBA;
  170.   TDDRGBA = record
  171.     Red: Byte;
  172.     Green: Byte;
  173.     Blue: Byte;
  174.     Alpha: Byte;
  175.   end;
  176.  
  177.   DDRGBA = TDDRGBA;
  178.   LPDDRGBA = PDDRGBA;
  179.  
  180. { TDDColorKey structure }
  181.  
  182.   PDDColorKey = ^TDDColorKey;
  183.   TDDColorKey = record
  184.     dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to
  185.                                    //  be treated as Color Key, inclusive
  186.     dwColorSpaceHighValue: DWORD;  // high boundary of color space that is
  187.                                    //  to be treated as Color Key, inclusive
  188.   end;
  189.  
  190.   DDCOLORKEY = TDDColorKey;
  191.   LPDDCOLORKEY = PDDColorKey;
  192.  
  193. { TDDBltFX structure }
  194.  
  195.   PDDBltFX = ^TDDBltFX;
  196.   TDDBltFX = record
  197.     dwSize: DWORD;                           // size of structure
  198.     dwDDFX: DWORD;                           // FX operations
  199.     dwROP: DWORD;                            // Win32 raster operations
  200.     dwDDROP: DWORD;                          // Raster operations new for DirectDraw
  201.     dwRotationAngle: DWORD;                  // Rotation angle for blt
  202.     dwZBufferOpCode: DWORD;                  // ZBuffer compares
  203.     dwZBufferLow: DWORD;                     // Low limit of Z buffer
  204.     dwZBufferHigh: DWORD;                    // High limit of Z buffer
  205.     dwZBufferBaseDest: DWORD;                // Destination base value
  206.     dwZDestConstBitDepth: DWORD;             // Bit depth used to specify Z constant for destination
  207.     case Integer of
  208.     0: (
  209.       dwZDestConst: DWORD;                   // Constant to use as Z buffer for dest
  210.       dwZSrcConstBitDepth: DWORD;            // Bit depth used to specify Z constant for source
  211.       dwZSrcConst: DWORD;                    // Constant to use as Z buffer for src
  212.       dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  213.       dwAlphaEdgeBlend: DWORD;               // Alpha for edge blending
  214.       dwReserved: DWORD;
  215.       dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  216.       dwAlphaDestConst: DWORD;               // Constant to use as Alpha Channel
  217.       dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
  218.       dwAlphaSrcConst: DWORD;                // Constant to use as Alpha Channel
  219.       dwFillColor: DWORD;                    // color in RGB or Palettized
  220.       ddckDestColorkey: TDDColorKey;          // DestColorkey override
  221.       ddckSrcColorkey: TDDColorKey;           // SrcColorkey override
  222.       );
  223.     1: (
  224.       lpDDSZBufferDest: Pointer{IDirectDrawSurface};  // Surface to use as Z buffer for dest
  225.       _union1b: DWORD;
  226.       lpDDSZBufferSrc: Pointer{IDirectDrawSurface};   // Surface to use as Z buffer for src
  227.       _union1d: DWORD;
  228.       _union1e: DWORD;
  229.       _union1f: DWORD;
  230.       _union1g: DWORD;
  231.       lpDDSAlphaDest: Pointer{IDirectDrawSurface};    // Surface to use as Alpha Channel
  232.       _union1i: DWORD;
  233.       lpDDSAlphaSrc: Pointer{IDirectDrawSurface};     // Surface to use as Alpha Channel
  234.       dwFillDepth: DWORD;                    // depth value for z-buffer
  235.       );
  236.     2: (
  237.       _union2a: DWORD;
  238.       _union2b: DWORD;
  239.       _union2c: DWORD;
  240.       _union2d: DWORD;
  241.       _union2e: DWORD;
  242.       _union2f: DWORD;
  243.       _union2g: DWORD;
  244.       _union2h: DWORD;
  245.       _union2i: DWORD;
  246.       _union2j: DWORD;
  247.       lpDDSPattern: Pointer{IDirectDrawSurface};       // Surface to use as pattern
  248.       );
  249.   end;
  250.  
  251.   DDBLTFX = TDDBltFX;
  252.   LPDDBLTFX = PDDBltFX;
  253.  
  254. { TDDSCaps structure }
  255.  
  256.   PDDSCaps = ^TDDSCaps;
  257.   TDDSCaps = record
  258.     dwCaps: DWORD;         // capabilities of surface wanted
  259.   end;
  260.  
  261.   DDSCAPS = TDDSCaps;
  262.   LPDDSCAPS = PDDSCaps;
  263. { TDDOSCaps structure }
  264.  
  265.   PDDOSCaps = ^TDDOSCaps;
  266.   TDDOSCaps = record
  267.     dwCaps: DWORD;         // capabilities of surface wanted
  268.   end;
  269.  
  270.   DDOSCAPS = TDDOSCaps;
  271.   LPDDOSCAPS = PDDOSCaps;
  272.  
  273.  
  274. { TDDSCapsEx structure }
  275.  
  276.   PDDSCapsEx = ^TDDSCapsEx;
  277.   TDDSCapsEx = record
  278.     dwCaps2: DWORD;
  279.     dwCaps3: DWORD;
  280.     dwCaps4: DWORD;
  281.   end;
  282.  
  283.   DDSCAPSEX = TDDSCapsEx;
  284.   LPDDSCAPSEX = PDDSCapsEx;
  285.  
  286. { TDDSCaps2 structure }
  287.  
  288.   PDDSCaps2 = ^TDDSCaps2;
  289.   TDDSCaps2 = record
  290.     dwCaps: DWORD;         // capabilities of surface wanted
  291.     dwCaps2: DWORD;
  292.     dwCaps3: DWORD;
  293.     dwCaps4: DWORD;
  294.   end;
  295.  
  296.   DDSCAPS2 = TDDSCaps2;
  297.   LPDDSCAPS2 = PDDSCaps2;
  298.  
  299. { TDDCaps structure }
  300.  
  301.   PDDCaps_DX1 = ^TDDCaps_DX1;
  302.   TDDCaps_DX1 = record
  303.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  304.     dwCaps: DWORD;                 // driver specific capabilities
  305.     dwCaps2: DWORD;                // more driver specific capabilites
  306.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  307.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  308.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  309.     dwPalCaps: DWORD;              // palette capabilities
  310.     dwSVCaps: DWORD;               // stereo vision capabilities
  311.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  312.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  313.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  314.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  315.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  316.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  317.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  318.     dwVidMemTotal: DWORD;          // total amount of video memory
  319.     dwVidMemFree: DWORD;           // amount of free video memory
  320.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  321.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  322.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  323.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  324.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  325.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  326.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  327.     dwAlignStrideAlign: DWORD;     // stride alignment
  328.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  329.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  330.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  331.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  332.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  333.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  334.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  335.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  336.     dwReserved1: DWORD;            // reserved
  337.     dwReserved2: DWORD;            // reserved
  338.     dwReserved3: DWORD;            // reserved
  339.   end;
  340.  
  341.   PDDCaps_DX3 = ^TDDCaps_DX3;
  342.   TDDCaps_DX3 = record
  343.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  344.     dwCaps: DWORD;                 // driver specific capabilities
  345.     dwCaps2: DWORD;                // more driver specific capabilites
  346.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  347.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  348.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  349.     dwPalCaps: DWORD;              // palette capabilities
  350.     dwSVCaps: DWORD;               // stereo vision capabilities
  351.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  352.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  353.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  354.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  355.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  356.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  357.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  358.     dwVidMemTotal: DWORD;          // total amount of video memory
  359.     dwVidMemFree: DWORD;           // amount of free video memory
  360.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  361.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  362.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  363.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  364.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  365.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  366.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  367.     dwAlignStrideAlign: DWORD;     // stride alignment
  368.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  369.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  370.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  371.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  372.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  373.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  374.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  375.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  376.     dwReserved1: DWORD;            // reserved
  377.     dwReserved2: DWORD;            // reserved
  378.     dwReserved3: DWORD;            // reserved
  379.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  380.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  381.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  382.     dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  383.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  384.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  385.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  386.     dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  387.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  388.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  389.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  390.     dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  391.     dwReserved4: DWORD;            // reserved
  392.     dwReserved5: DWORD;            // reserved
  393.     dwReserved6: DWORD;            // reserved
  394.   end;
  395.  
  396.   PDDCaps_DX5 = ^TDDCaps_DX5;
  397.   TDDCaps_DX5 = record
  398.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  399.     dwCaps: DWORD;                 // driver specific capabilities
  400.     dwCaps2: DWORD;                // more driver specific capabilites
  401.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  402.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  403.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  404.     dwPalCaps: DWORD;              // palette capabilities
  405.     dwSVCaps: DWORD;               // stereo vision capabilities
  406.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  407.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  408.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  409.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  410.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  411.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  412.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  413.     dwVidMemTotal: DWORD;          // total amount of video memory
  414.     dwVidMemFree: DWORD;           // amount of free video memory
  415.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  416.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  417.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  418.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  419.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  420.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  421.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  422.     dwAlignStrideAlign: DWORD;     // stride alignment
  423.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  424.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  425.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  426.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  427.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  428.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  429.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  430.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  431.     dwReserved1: DWORD;            // reserved
  432.     dwReserved2: DWORD;            // reserved
  433.     dwReserved3: DWORD;            // reserved
  434.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  435.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  436.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  437.     dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  438.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  439.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  440.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  441.     dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  442.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  443.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  444.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  445.     dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  446.     { Members added for DX5 }
  447.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  448.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  449.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  450.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  451.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  452.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  453.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  454.     dwNLVBRops: array[0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  455.   end;
  456.  
  457.   PDDCaps_DX6 = ^TDDCaps_DX6;
  458.   TDDCaps_DX6 = record
  459.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  460.     dwCaps: DWORD;                 // driver specific capabilities
  461.     dwCaps2: DWORD;                // more driver specific capabilites
  462.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  463.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  464.     dwFXAlphaCaps: DWORD;          // alpha caps
  465.     dwPalCaps: DWORD;              // palette capabilities
  466.     dwSVCaps: DWORD;               // stereo vision capabilities
  467.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  468.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  469.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  470.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  471.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  472.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  473.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  474.     dwVidMemTotal: DWORD;          // total amount of video memory
  475.     dwVidMemFree: DWORD;           // amount of free video memory
  476.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  477.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  478.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  479.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  480.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  481.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  482.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  483.     dwAlignStrideAlign: DWORD;     // stride alignment
  484.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  485.     ddsOldCaps: TDDSCaps;          // Was TDDSCaps ddsCaps. ddsCaps is of type DDSCAPS2 for DX6
  486.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  487.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  488.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  489.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  490.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  491.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  492.     dwReserved1: DWORD;            // reserved
  493.     dwReserved2: DWORD;            // reserved
  494.     dwReserved3: DWORD;            // reserved
  495.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  496.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  497.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  498.     dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  499.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  500.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  501.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  502.     dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  503.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  504.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  505.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  506.     dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  507.     { Members added for DX5 }
  508.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  509.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  510.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  511.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  512.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  513.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  514.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  515.     dwNLVBRops: array[0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  516.     { Members added for DX6 }
  517.     ddsCaps: TDDSCaps2;            // Surface Caps
  518.   end;
  519.  
  520.   PDDCaps_DX7 = ^TDDCaps_DX7;
  521.   TDDCaps_DX7 = record
  522.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  523.     dwCaps: DWORD;                 // driver specific capabilities
  524.     dwCaps2: DWORD;                // more driver specific capabilites
  525.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  526.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  527.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  528.     dwPalCaps: DWORD;              // palette capabilities
  529.     dwSVCaps: DWORD;               // stereo vision capabilities
  530.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  531.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  532.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  533.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  534.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  535.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  536.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  537.     dwVidMemTotal: DWORD;          // total amount of video memory
  538.     dwVidMemFree: DWORD;           // amount of free video memory
  539.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  540.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  541.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  542.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  543.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  544.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  545.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  546.     dwAlignStrideAlign: DWORD;     // stride alignment
  547.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  548.     ddsOldCaps: TDDSCaps;          // Was TDDSCaps ddsCaps. ddsCaps is of type DDSCAPS2 for DX6
  549.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  550.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  551.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  552.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  553.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  554.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  555.     dwReserved1: DWORD;            // reserved
  556.     dwReserved2: DWORD;            // reserved
  557.     dwReserved3: DWORD;            // reserved
  558.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  559.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  560.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  561.     dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  562.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  563.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  564.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  565.     dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  566.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  567.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  568.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  569.     dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  570.     { Members added for DX5 }
  571.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  572.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  573.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  574.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  575.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  576.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  577.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  578.     dwNLVBRops: array[0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  579.     { Members added for DX6 }
  580.     ddsCaps: TDDSCaps2;            // Surface Caps
  581.   end;
  582.  
  583. {$IFDEF DirectX1}
  584.   TDDCaps = TDDCaps_DX1;
  585.   PDDCaps = PDDCaps_DX1;
  586. {$ENDIF}{$IFDEF DirectX3}
  587.   TDDCaps = TDDCaps_DX3;
  588.   PDDCaps = PDDCaps_DX3;
  589. {$ENDIF}{$IFDEF DirectX5}
  590.   TDDCaps = TDDCaps_DX5;
  591.   PDDCaps = PDDCaps_DX5;
  592. {$ENDIF}{$IFDEF DirectX6}
  593.   TDDCaps = TDDCaps_DX6;
  594.   PDDCaps = PDDCaps_DX6;
  595. {$ENDIF}{$IFDEF DirectX7}
  596.   TDDCaps = TDDCaps_DX7;
  597.   PDDCaps = PDDCaps_DX7;
  598. {$ENDIF}
  599.  
  600.   DDCAPS = TDDCaps;
  601.   LPDDCAPS = PDDCaps;
  602.  
  603. { TDDPixelFormat structure }
  604.  
  605.   PDDPixelFormat = ^TDDPixelFormat;
  606.   TDDPixelFormat = record
  607.     dwSize: DWORD;                // size of structure
  608.     dwFlags: DWORD;               // pixel format flags
  609.     dwFourCC: DWORD;              // (FOURCC code)
  610.     case Integer of
  611.       0: (
  612.         dwRGBBitCount: DWORD;          // how many bits per pixel
  613.         dwRBitMask: DWORD;             // mask for red bit
  614.         dwGBitMask: DWORD;             // mask for green bits
  615.         dwBBitMask: DWORD;             // mask for blue bits
  616.         dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
  617.         );
  618.       1: (
  619.         _union1a: DWORD;
  620.         _union1b: DWORD;
  621.         _union1c: DWORD;
  622.         _union1d: DWORD;
  623.         dwRGBZBitMask: DWORD;          // mask for Z channel
  624.         );
  625.       2: (
  626.         dwYUVBitCount: DWORD;          // how many bits per pixel
  627.         dwYBitMask: DWORD;             // mask for Y bits
  628.         dwUBitMask: DWORD;             // mask for U bits
  629.         dwVBitMask: DWORD;             // mask for V bits
  630.         dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
  631.         );
  632.       3: (
  633.         _union3a: DWORD;
  634.         _union3b: DWORD;
  635.         _union3c: DWORD;
  636.         _union3d: DWORD;
  637.         dwYUVZBitMask: DWORD;          // mask for Z channel
  638.         );
  639.       4: (
  640.         dwZBufferBitDepth: DWORD;      // how many bits for z buffers
  641.         dwStencilBitDepth: DWORD;      // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
  642.         dwZBitMask: DWORD;             // mask for Z bits
  643.         dwStencilBitMask: DWORD;       // mask for stencil bits
  644.         );
  645.       5: (
  646.         dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
  647.         );
  648.       6: (
  649.         dwLuminanceBitCount: DWORD;    // how many bits per pixel
  650.         dwLuminanceBitMask: DWORD;     // mask for luminance bits
  651.         _union6c: DWORD;
  652.         _union6d: DWORD;
  653.         dwLuminanceAlphaBitMask: DWORD;
  654.        );
  655.       7: (
  656.         dwBumpBitCount: DWORD;         // how many bits per "buxel", total
  657.         dwBumpDuBitMask: DWORD;        // mask for bump map U delta bits
  658.         dwBumpDvBitMask: DWORD;        // mask for bump map V delta bits
  659.         dwBumpLuminanceBitMask: DWORD; // mask for luminance in bump map
  660.        );
  661.   end;
  662.  
  663.   DDPIXELFORMAT = TDDPixelFormat;
  664.   LPDDPIXELFORMAT = PDDPixelFormat;
  665.  
  666. { DDOVERLAYFX structure }
  667.  
  668.   PDDOverlayFx = ^TDDOverlayFx;
  669.   TDDOverlayFx = record
  670.     dwSize: DWORD;                         // size of structure
  671.     dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  672.     dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
  673.     dwReserved: DWORD;
  674.     dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  675.     case Integer of
  676.     0: (
  677.       dwAlphaDestConst: DWORD;             // Constant to use as alpha channel for dest
  678.       dwAlphaSrcConstBitDepth: DWORD;      // Bit depth used to specify alpha constant for source
  679.       dwAlphaSrcConst: DWORD;              // Constant to use as alpha channel for src
  680.       dckDestColorkey: TDDColorKey;        // DestColorkey override
  681.       dckSrcColorkey: TDDColorKey;         // DestColorkey override
  682.       dwDDFX: DWORD;                       // Overlay FX
  683.       dwFlags: DWORD;                      // flags
  684.       );
  685.     1: (
  686.       lpDDSAlphaDest: Pointer{IDirectDrawSurface};  // Surface to use as alpha channel for dest
  687.       _union1b: DWORD;
  688.       lpDDSAlphaSrc: Pointer{IDirectDrawSurface};   // Surface to use as alpha channel for src
  689.       );
  690.   end;
  691.  
  692.   DDOVERLAYFX = TDDOverlayFx;
  693.   LPDDOVERLAYFX = PDDOverlayFx;
  694.  
  695. { TDDBltBatch structure }
  696.  
  697.   PDDBltBatch = ^TDDBltBatch;
  698.   TDDBltBatch = record
  699.     lprDest: PRect;
  700.     lpDDSSrc: IDirectDrawSurface;
  701.     lprSrc: PRect;
  702.     dwFlags: DWORD;
  703.     lpDDBltFx: PDDBltFX;
  704.   end;
  705.  
  706.   DDBLTBATCH = TDDBltBatch;
  707.   LPDDBLTBATCH = PDDBltBatch;
  708.  
  709. { TDDSurfaceDesc structure }
  710.  
  711.   PDDSurfaceDesc = ^TDDSurfaceDesc;
  712.   TDDSurfaceDesc = record
  713.     dwSize: DWORD;                   // size of the TDDSurfaceDesc structure
  714.     dwFlags: DWORD;                  // determines what fields are valid
  715.     dwHeight: DWORD;                 // height of surface to be created
  716.     dwWidth: DWORD;                  // width of input surface
  717.     case Integer of
  718.       0: (
  719.         lPitch: Longint;
  720.         dwBackBufferCount: DWORD;        // number of back buffers requested
  721.         case Integer of
  722.         0: (
  723.           dwMipMapCount: DWORD;          // number of mip-map levels requested
  724.           dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  725.           dwReserved: DWORD;             // reserved
  726.           lpSurface: Pointer;            // pointer to the associated surface memory
  727.           ddckCKDestOverlay: TDDColorKey;// color key for destination overlay use
  728.           ddckCKDestBlt: TDDColorKey;    // color key for destination blt use
  729.           ddckCKSrcOverlay: TDDColorKey; // color key for source overlay use
  730.           ddckCKSrcBlt: TDDColorKey;     // color key for source blt use
  731.           ddpfPixelFormat: TDDPixelFormat;// pixel format description of the surface
  732.           ddsCaps: TDDSCaps;             // direct draw surface capabilities
  733.           );
  734.         1: (
  735.           dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  736.           );
  737.         2: (
  738.           dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  739.           );
  740.       );
  741.       1: (
  742.         dwLinearSize: DWORD
  743.       );
  744.   end;
  745.  
  746.   DDSURFACEDESC = TDDSurfaceDesc;
  747.   LPDDSURFACEDESC = PDDSurfaceDesc;
  748.  
  749. { TDDSurfaceDesc2 structure }
  750.  
  751.   PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
  752.   TDDSurfaceDesc2 = record
  753.     dwSize: DWORD;                   // size of the TDDSurfaceDesc2 structure
  754.     dwFlags: DWORD;                  // determines what fields are valid
  755.     dwHeight: DWORD;                 // height of surface to be created
  756.     dwWidth: DWORD;                  // width of input surface
  757.     case Integer of
  758.       0: (
  759.         lPitch: Longint;
  760.         dwBackBufferCount: DWORD;        // number of back buffers requested
  761.         case Integer of
  762.         0: (
  763.           dwMipMapCount: DWORD;          // number of mip-map levels requested
  764.           dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  765.           dwReserved: DWORD;             // reserved
  766.           lpSurface: Pointer;            // pointer to the associated surface memory
  767.           ddckCKDestOverlay: TDDColorKey;// color key for destination overlay use
  768.           ddckCKDestBlt: TDDColorKey;    // color key for destination blt use
  769.           ddckCKSrcOverlay: TDDColorKey; // color key for source overlay use
  770.           ddckCKSrcBlt: TDDColorKey;     // color key for source blt use
  771.           ddpfPixelFormat: TDDPixelFormat;// pixel format description of the surface
  772.           ddsCaps: TDDSCaps2;            // direct draw surface capabilities
  773.           dwTextureStage: DWORD;         // stage in multitexture cascade
  774.           );
  775.         1: (
  776.           dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  777.           );
  778.       );
  779.       1: (
  780.         dwLinearSize: DWORD
  781.       );
  782.   end;
  783.  
  784.   DDSURFACEDESC2 = TDDSurfaceDesc2;
  785.   LPDDSURFACEDESC2 = PDDSurfaceDesc2;
  786.  
  787. { TDDOptSurfaceDesc structure }
  788.  
  789.   PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
  790.   TDDOptSurfaceDesc = record
  791.     dwSize: DWORD;             // size of the DDOPTSURFACEDESC structure
  792.     dwFlags: DWORD;            // determines what fields are valid
  793.     ddSCaps: TDDSCaps2;        // Common caps like: Memory type
  794.     ddOSCaps: TDDOSCaps;       // Common caps like: Memory type
  795.     guid: TGUID;               // Compression technique GUID
  796.     dwCompressionRatio: DWORD; // Compression ratio
  797.   end;
  798.  
  799.   DDOPTSURFACEDESC = TDDOptSurfaceDesc;
  800.   LPDDOPTSURFACEDESC = PDDOptSurfaceDesc;
  801.  
  802. { TDDColorControl structure }
  803.  
  804.   PDDColorControl = ^TDDColorControl;
  805.   TDDColorControl = record
  806.     dwSize: DWORD;
  807.     dwFlags: DWORD;
  808.     lBrightness: Longint;
  809.     lContrast: Longint;
  810.     lHue: Longint;
  811.     lSaturation: Longint;
  812.     lSharpness: Longint;
  813.     lGamma: Longint;
  814.     lColorEnable: Longint;
  815.     dwReserved1: DWORD;
  816.   end;
  817.  
  818.   DDCOLORCONTROL = TDDColorControl;
  819.   LPDDCOLORCONTROL = PDDCOLORCONTROL;
  820.  
  821. { TDDGammaRamp structure }
  822.  
  823.   PDDGammaRamp = ^TDDGammaRamp;
  824.   TDDGammaRamp = record
  825.     Red: array[0..255] of Word;
  826.     Green: array[0..255] of Word;
  827.     Blue: array[0..255] of Word;
  828.   end;
  829.  
  830.   DDGAMMARAMP = TDDGammaRamp;
  831.   LPDDGAMMARAMP = PDDGammaRamp;
  832.  
  833. { TDDDeviceIdentifier structure }
  834.  
  835.   PDDDeviceIdentifier = ^TDDDeviceIdentifier;
  836.   TDDDeviceIdentifier = record
  837.     //
  838.     // These elements are for presentation to the user only. They should not be used to identify particular
  839.     // drivers, since this is unreliable and many different strings may be associated with the same
  840.     // device, and the same driver from different vendors.
  841.     //
  842.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  843.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  844.  
  845.     //
  846.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  847.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  848.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  849.     //
  850.     // This version has the form:
  851.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  852.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  853.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  854.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  855.     //
  856.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  857.  
  858.     //
  859.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  860.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  861.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  862.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  863.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  864.     //
  865.     dwVendorId: DWORD;
  866.     dwDeviceId: DWORD;
  867.     dwSubSysId: DWORD;
  868.     dwRevision: DWORD;
  869.  
  870.     //
  871.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  872.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  873.     // reprofile the graphics subsystem.
  874.     // This element can also be used to identify particular problematic drivers.
  875.     //
  876.     guidDeviceIdentifier: TGUID;
  877.   end;
  878.  
  879.   DDDEVICEIDENTIFIER = TDDDeviceIdentifier;
  880.   LPDDDEVICEIDENTIFIER = PDDDeviceIdentifier;
  881.  
  882. { TDDDeviceIdentifier2 structure }
  883.  
  884.   PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;
  885.   TDDDeviceIdentifier2 = record
  886.     //
  887.     // These elements are for presentation to the user only. They should not be used to identify particular
  888.     // drivers, since this is unreliable and many different strings may be associated with the same
  889.     // device, and the same driver from different vendors.
  890.     //
  891.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  892.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  893.  
  894.     //
  895.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  896.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  897.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  898.     //
  899.     // This version has the form:
  900.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  901.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  902.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  903.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  904.     //
  905.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  906.  
  907.     //
  908.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  909.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  910.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  911.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  912.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  913.     //
  914.     dwVendorId: DWORD;
  915.     dwDeviceId: DWORD;
  916.     dwSubSysId: DWORD;
  917.     dwRevision: DWORD;
  918.  
  919.     //
  920.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  921.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  922.     // reprofile the graphics subsystem.
  923.     // This element can also be used to identify particular problematic drivers.
  924.     //
  925.     guidDeviceIdentifier: TGUID;
  926.  
  927.     //
  928.     // This element is used to determine the Windows Hardware Quality Lab (WHQL)
  929.     // certification level for this driver/device pair.
  930.     //
  931.     dwWHQLLevel: DWORD;
  932.   end;
  933.  
  934.   DDDEVICEIDENTIFIER2 = TDDDeviceIdentifier2;
  935.   LPDDDEVICEIDENTIFIER2 = PDDDeviceIdentifier2;
  936.  
  937. { Callbacks }
  938.  
  939.   TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;
  940.       Code: DWORD; lpContext: Pointer): HResult; stdcall;
  941.   LPCLIPPERCALLBACK = TClipperCallback;
  942.  
  943.   TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
  944.   LPSURFACESTREAMINGCALLBACK =TSurfacesStreamingCallback;
  945.  
  946.   TDDEnumModesCallback = function(const lpDDSurfaceDesc: TDDSurfaceDesc;
  947.       lpContext: Pointer): HResult; stdcall;
  948.   LPDDENUMMODESCALLBACK = TDDEnumModesCallback;
  949.  
  950.   TDDEnumModesCallback2 = function(const lpDDSurfaceDesc: TDDSurfaceDesc2;
  951.       lpContext: Pointer): HResult; stdcall;
  952.   LPDDENUMMODESCALLBACK2 = TDDEnumModesCallback2;
  953.  
  954.   TDDEnumSurfacesCallback = function(lpDDSurface: IDirectDrawSurface;
  955.       const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer): HResult; stdcall;
  956.   LPDDENUMSURFACESCALLBACK = TDDEnumSurfacesCallback;
  957.  
  958.   TDDEnumSurfacesCallback2 = function(lpDDSurface: IDirectDrawSurface4;
  959.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall;
  960.   LPDDENUMSURFACESCALLBACK2 = TDDEnumSurfacesCallback2;
  961.  
  962.   TDDEnumSurfacesCallback7 = function(lpDDSurface: IDirectDrawSurface7;
  963.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall;
  964.   LPDDENUMSURFACESCALLBACK7 = TDDEnumSurfacesCallback7;
  965.  
  966. { IDirectDraw Interface }
  967.  
  968.   IDirectDraw = interface(IUnknown)
  969.     ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
  970.     // IDirectDraw methods
  971.     function Compact: HResult; stdcall;
  972.     function CreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  973.         pUnkOuter: IUnknown): HResult; stdcall;
  974.     function CreatePalette(dwFlags: DWORD; lpColorTable: PPaletteEntry;
  975.         out lplpDDPalette: IDirectDrawPalette; pUnkOuter: IUnknown): HResult; stdcall;
  976.     function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc;
  977.         out lplpDDSurface: IDirectDrawSurface; pUnkOuter: IUnknown): HResult; stdcall;
  978.     function DuplicateSurface(lpDDSurface: IDirectDrawSurface;
  979.         out lplpDupDDSurface: IDirectDrawSurface): HResult; stdcall;
  980.     function EnumDisplayModes(dwFlags: DWORD;
  981.         const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer;
  982.         lpEnumModesCallback: TDDEnumModesCallback): HResult; stdcall;
  983.     function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
  984.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  985.     function FlipToGDISurface: HResult; stdcall;
  986.     function GetCaps(var lpDDDriverCaps: TDDCaps; var lpDDHELCaps: TDDCaps): HResult; stdcall;
  987.     function GetDisplayMode(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  988.     function GetFourCCCodes(var lpNumCodes, lpCodes: DWORD): HResult; stdcall;
  989.     function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface): HResult; stdcall;
  990.     function GetMonitorFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  991.     function GetScanLine(var lpdwScanLine: DWORD): HResult; stdcall;
  992.     function GetVerticalBlankStatus(var lpbIsInVB: BOOL): HResult; stdcall;
  993.     function Initialize(lpGUID: PGUID): HResult; stdcall;
  994.     function RestoreDisplayMode: HResult; stdcall;
  995.     function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall;
  996.     function SetDisplayMode(dwWidth, dwHeight, dwBpp: DWORD): HResult; stdcall;
  997.     function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  998.   end;
  999.  
  1000. { IDirectDraw2 Interface }
  1001.  
  1002.   IDirectDraw2 = interface(IUnknown)
  1003.     ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
  1004.     // IDirectDraw methods
  1005.     function Compact: HResult; stdcall;
  1006.     function CreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  1007.         pUnkOuter: IUnknown): HResult; stdcall;
  1008.     function CreatePalette(dwFlags: DWORD; lpColorTable: PPaletteEntry;
  1009.         out lplpDDPalette: IDirectDrawPalette; pUnkOuter: IUnknown): HResult; stdcall;
  1010.     function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc;
  1011.         out lplpDDSurface: IDirectDrawSurface; pUnkOuter: IUnknown): HResult; stdcall;
  1012.     function DuplicateSurface(lpDDSurface: IDirectDrawSurface;
  1013.         out lplpDupDDSurface: IDirectDrawSurface): HResult; stdcall;
  1014.     function EnumDisplayModes(dwFlags: DWORD;
  1015.         const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer;
  1016.         lpEnumModesCallback: TDDEnumModesCallback): HResult; stdcall;
  1017.     function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
  1018.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1019.     function FlipToGDISurface: HResult; stdcall;
  1020.     function GetCaps(var lpDDDriverCaps: TDDCaps; var lpDDHELCaps: TDDCaps): HResult; stdcall;
  1021.     function GetDisplayMode(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1022.     function GetFourCCCodes(var lpNumCodes, lpCodes: DWORD): HResult; stdcall;
  1023.     function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface): HResult; stdcall;
  1024.     function GetMonitorFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  1025.     function GetScanLine(var lpdwScanLine: DWORD): HResult; stdcall;
  1026.     function GetVerticalBlankStatus(var lpbIsInVB: BOOL): HResult; stdcall;
  1027.     function Initialize(lpGUID: PGUID): HResult; stdcall;
  1028.     function RestoreDisplayMode: HResult; stdcall;
  1029.     function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall;
  1030.     function SetDisplayMode(dwWidth, dwHeight, dwBPP, dwRefreshRate: DWORD;
  1031.         dwFlags: DWORD): HResult; stdcall;
  1032.     function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1033.     // IDirectDraw2 methods
  1034.     function GetAvailableVidMem(var lpDDSCaps: TDDSCaps;
  1035.         var lpdwTotal, lpdwFree: DWORD): HResult; stdcall;
  1036.   end;
  1037.  
  1038. { IDirectDraw4 Interface }
  1039.  
  1040.   IDirectDraw4 = interface(IUnknown)
  1041.     ['{9C59509A-39BD-11D1-8C4A-00C04FD930C5}']
  1042.     // IDirectDraw methods
  1043.     function Compact: HResult; stdcall;
  1044.     function CreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  1045.         pUnkOuter: IUnknown): HResult; stdcall;
  1046.     function CreatePalette(dwFlags: DWORD; lpColorTable: PPaletteEntry;
  1047.         out lplpDDPalette: IDirectDrawPalette; pUnkOuter: IUnknown): HResult; stdcall;
  1048.     function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1049.         out lplpDDSurface: IDirectDrawSurface4; pUnkOuter: IUnknown): HResult; stdcall;
  1050.     function DuplicateSurface(lpDDSurface: IDirectDrawSurface4;
  1051.         out lplpDupDDSurface: IDirectDrawSurface4): HResult; stdcall;
  1052.     function EnumDisplayModes(dwFlags: DWORD;
  1053.         const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer;
  1054.         lpEnumModesCallback: TDDEnumModesCallback2): HResult; stdcall;
  1055.     function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1056.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2): HResult; stdcall;
  1057.     function FlipToGDISurface: HResult; stdcall;
  1058.     function GetCaps(var lpDDDriverCaps: TDDCaps; var lpDDHELCaps: TDDCaps): HResult; stdcall;
  1059.     function GetDisplayMode(var lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1060.     function GetFourCCCodes(var lpNumCodes, lpCodes: DWORD): HResult; stdcall;
  1061.     function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface2): HResult; stdcall;
  1062.     function GetMonitorFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  1063.     function GetScanLine(var lpdwScanLine: DWORD): HResult; stdcall;
  1064.     function GetVerticalBlankStatus(var lpbIsInVB: BOOL): HResult; stdcall;
  1065.     function Initialize(lpGUID: PGUID): HResult; stdcall;
  1066.     function RestoreDisplayMode: HResult; stdcall;
  1067.     function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall;
  1068.     function SetDisplayMode(dwWidth, dwHeight, dwBPP, dwRefreshRate: DWORD;
  1069.         dwFlags: DWORD): HResult; stdcall;
  1070.     function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1071.     // IDirectDraw2 methods
  1072.     function GetAvailableVidMem(var lpDDSCaps: TDDSCaps;
  1073.         var lpdwTotal, lpdwFree: DWORD): HResult; stdcall;
  1074.     // IDirectDraw4 methods
  1075.     function GetSurfaceFromDC(hdc: HDC; lpDDS: IDirectDrawSurface4): HResult; stdcall;
  1076.     function RestoreAllSurfaces: HResult; stdcall;
  1077.     function TestCooperativeLevel: HResult; stdcall;
  1078.     function GetDeviceIdentifier(var lpdddi: TDDDeviceIdentifier; dwFlags: DWORD): HResult; stdcall;
  1079.   end;
  1080.  
  1081. { IDirectDraw7 Interface }
  1082.  
  1083.   IDirectDraw7 = interface(IUnknown)
  1084.     ['{15E65EC0-3B9C-11D2-B92F-00609797EA5B}']
  1085.     // IDirectDraw methods
  1086.     function Compact: HResult; stdcall;
  1087.     function CreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  1088.         pUnkOuter: IUnknown): HResult; stdcall;
  1089.     function CreatePalette(dwFlags: DWORD; lpColorTable: PPaletteEntry;
  1090.         out lplpDDPalette: IDirectDrawPalette; pUnkOuter: IUnknown): HResult; stdcall;
  1091.     function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1092.         out lplpDDSurface: IDirectDrawSurface7; pUnkOuter: IUnknown): HResult; stdcall;
  1093.     function DuplicateSurface(lpDDSurface: IDirectDrawSurface7;
  1094.         out lplpDupDDSurface: IDirectDrawSurface7): HResult; stdcall;
  1095.     function EnumDisplayModes(dwFlags: DWORD;
  1096.         const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer;
  1097.         lpEnumModesCallback: TDDEnumModesCallback2): HResult; stdcall;
  1098.     function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1099.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7): HResult; stdcall;
  1100.     function FlipToGDISurface: HResult; stdcall;
  1101.     function GetCaps(var lpDDDriverCaps: TDDCaps; var lpDDHELCaps: TDDCaps): HResult; stdcall;
  1102.     function GetDisplayMode(var lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1103.     function GetFourCCCodes(var lpNumCodes, lpCodes: DWORD): HResult; stdcall;
  1104.     function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface7): HResult; stdcall;
  1105.     function GetMonitorFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  1106.     function GetScanLine(var lpdwScanLine: DWORD): HResult; stdcall;
  1107.     function GetVerticalBlankStatus(var lpbIsInVB: BOOL): HResult; stdcall;
  1108.     function Initialize(lpGUID: PGUID): HResult; stdcall;
  1109.     function RestoreDisplayMode: HResult; stdcall;
  1110.     function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall;
  1111.     function SetDisplayMode(dwWidth, dwHeight, dwBPP, dwRefreshRate: DWORD;
  1112.         dwFlags: DWORD): HResult; stdcall;
  1113.     function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1114.     // IDirectDraw2 methods
  1115.     function GetAvailableVidMem(var lpDDSCaps: TDDSCaps;
  1116.         var lpdwTotal, lpdwFree: DWORD): HResult; stdcall;
  1117.     // IDirectDraw4 methods
  1118.     function GetSurfaceFromDC(hdc: HDC; lpDDS: IDirectDrawSurface4): HResult; stdcall;
  1119.     function RestoreAllSurfaces: HResult; stdcall;
  1120.     function TestCooperativeLevel: HResult; stdcall;
  1121.     function GetDeviceIdentifier(var lpdddi: TDDDeviceIdentifier; dwFlags: DWORD): HResult; stdcall;
  1122.     // IDirectDraw7 methods
  1123.     function StartModeTest(var lpModesToTest: TSize; dwNumEntries: DWORD; dwFlags: DWORD): HResult; stdcall;
  1124.     function EvaluateMode(dwFlags: DWORD; var pSecondsUntilTimeout: DWORD): HResult; stdcall;
  1125.   end;
  1126.  
  1127. { IDirectDrawPalette Interface }
  1128.  
  1129.   IDirectDrawPalette = interface(IUnknown)
  1130.     ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
  1131.     // IDirectDrawPalette methods
  1132.     function GetCaps(varlpdwCaps: DWORD): HResult; stdcall;
  1133.     function GetEntries(dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;
  1134.         lpEntries: PPaletteEntry): HResult; stdcall;
  1135.     function Initialize(lpDD: IDirectDraw; dwFlags: DWORD;
  1136.         lpDDColorTable: PPaletteEntry): HResult; stdcall;
  1137.     function SetEntries(dwFlags: DWORD; dwStartingEntry: DWORD;
  1138.         dwCount: DWORD; lpEntries: PPaletteEntry): HResult; stdcall;
  1139.   end;
  1140.  
  1141. { IDirectDrawClipper Interface }
  1142.  
  1143.   IDirectDrawClipper = interface(IUnknown)
  1144.     ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
  1145.     // IDirectDrawClipper methods
  1146.     function GetClipList(const lpRect: TRect; lpClipList: PRgnData;
  1147.         var lpdwSize: DWORD): HResult; stdcall;
  1148.     function GetHWnd(var lphWnd: HWND): HResult; stdcall;
  1149.     function Initialize(lpDD: IDirectDraw; dwFlags: DWORD): HResult; stdcall;
  1150.     function IsClipListChanged(var lpbChanged: BOOL): HResult; stdcall;
  1151.     function SetClipList(lpClipList: PRgnData; dwFlags: DWORD): HResult; stdcall;
  1152.     function SetHWnd(dwFlags: DWORD; hWnd: HWND): HResult; stdcall;
  1153.   end;
  1154.  
  1155. { IDirectDrawSurface Interface }
  1156.  
  1157.   IDirectDrawSurface = interface(IUnknown)
  1158.     ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
  1159.     // IDirectDrawSurface methods
  1160.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface): HResult; stdcall;
  1161.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1162.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface;
  1163.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1164.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1165.         dwFlags: DWORD): HResult; stdcall;
  1166.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface;
  1167.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1168.     function DeleteAttachedSurface(dwFlags: DWORD;
  1169.         lpDDSAttachedSurface: IDirectDrawSurface): HResult; stdcall;
  1170.     function EnumAttachedSurfaces(lpContext: Pointer;
  1171.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1172.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1173.         lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1174.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface;
  1175.         dwFlags: DWORD): HResult; stdcall;
  1176.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps;
  1177.         out lplpDDAttachedSurface: IDirectDrawSurface): HResult; stdcall;
  1178.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1179.     function GetCaps(var lpDDSCaps: TDDSCaps): HResult; stdcall;
  1180.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1181.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1182.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1183.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1184.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1185.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1186.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1187.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1188.     function Initialize(lpDD: IDirectDraw;
  1189.         const lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1190.     function IsLost: HResult; stdcall;
  1191.     function Lock(lpDestRect: PRect; var lpDDSurfaceDesc: TDDSurfaceDesc;
  1192.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1193.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1194.     function Restore: HResult; stdcall;
  1195.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1196.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1197.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1198.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1199.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1200.     function UpdateOverlay(const lpSrcRect: TRect;
  1201.         lpDDDestSurface: IDirectDrawSurface; const lpDestRect: TRect;
  1202.         dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1203.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1204.     function UpdateOverlayZOrder(dwFlags: DWORD;
  1205.         lpDDSReference: IDirectDrawSurface): HResult; stdcall;
  1206.   end;
  1207.  
  1208. { IDirectDrawSurface2 Interface }
  1209.  
  1210.   IDirectDrawSurface2 = interface(IUnknown)
  1211.     ['{57805885-6EEC-11CF-9441-A82303C10E27}']
  1212.     // IDirectDrawSurface methods
  1213.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface2): HResult; stdcall;
  1214.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1215.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface2;
  1216.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1217.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1218.         dwFlags: DWORD): HResult; stdcall;
  1219.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface2;
  1220.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1221.     function DeleteAttachedSurface(dwFlags: DWORD;
  1222.         lpDDSAttachedSurface: IDirectDrawSurface2): HResult; stdcall;
  1223.     function EnumAttachedSurfaces(lpContext: Pointer;
  1224.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1225.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1226.         lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1227.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface2;
  1228.         dwFlags: DWORD): HResult; stdcall;
  1229.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps;
  1230.         out lplpDDAttachedSurface: IDirectDrawSurface2): HResult; stdcall;
  1231.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1232.     function GetCaps(var lpDDSCaps: TDDSCaps): HResult; stdcall;
  1233.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1234.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1235.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1236.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1237.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1238.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1239.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1240.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1241.     function Initialize(lpDD: IDirectDraw; const lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1242.     function IsLost: HResult; stdcall;
  1243.     function Lock(lpDestRect: PRect; const lpDDSurfaceDesc: TDDSurfaceDesc;
  1244.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1245.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1246.     function Restore: HResult; stdcall;
  1247.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1248.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1249.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1250.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1251.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1252.     function UpdateOverlay(const lpSrcRect: TRect;
  1253.         lpDDDestSurface: IDirectDrawSurface2; const lpDestRect: TRect;
  1254.         dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1255.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1256.     function UpdateOverlayZOrder(dwFlags: DWORD;
  1257.         lpDDSReference: IDirectDrawSurface2): HResult; stdcall;
  1258.     // IDirectDrawSurface2 methods
  1259.     function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall;
  1260.     function PageLock(dwFlags: DWORD): HResult; stdcall;
  1261.     function PageUnlock(dwFlags: DWORD): HResult; stdcall;
  1262.   end;
  1263.  
  1264. { IDirectDrawSurface3 Interface }
  1265.  
  1266.   IDirectDrawSurface3 = interface(IUnknown)
  1267.     ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']
  1268.     // IDirectDrawSurface methods
  1269.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface3): HResult; stdcall;
  1270.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1271.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface3;
  1272.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1273.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1274.         dwFlags: DWORD): HResult; stdcall;
  1275.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface3;
  1276.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1277.     function DeleteAttachedSurface(dwFlags: DWORD;
  1278.         lpDDSAttachedSurface: IDirectDrawSurface3): HResult; stdcall;
  1279.     function EnumAttachedSurfaces(lpContext: Pointer;
  1280.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1281.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1282.         lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1283.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface3;
  1284.         dwFlags: DWORD): HResult; stdcall;
  1285.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps;
  1286.         out lplpDDAttachedSurface: IDirectDrawSurface3): HResult; stdcall;
  1287.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1288.     function GetCaps(var lpDDSCaps: TDDSCaps): HResult; stdcall;
  1289.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1290.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1291.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1292.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1293.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1294.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1295.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1296.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1297.     function Initialize(lpDD: IDirectDraw; const lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1298.     function IsLost: HResult; stdcall;
  1299.     function Lock(lpDestRect: PRect; const lpDDSurfaceDesc: TDDSurfaceDesc;
  1300.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1301.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1302.     function Restore: HResult; stdcall;
  1303.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1304.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1305.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1306.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1307.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1308.     function UpdateOverlay(const lpSrcRect: TRect;
  1309.         lpDDDestSurface: IDirectDrawSurface3; const lpDestRect: TRect;
  1310.         dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1311.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1312.     function UpdateOverlayZOrder(dwFlags: DWORD;
  1313.         lpDDSReference: IDirectDrawSurface3): HResult; stdcall;
  1314.     // IDirectDrawSurface2 methods
  1315.     function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall;
  1316.     function PageLock(dwFlags: DWORD): HResult; stdcall;
  1317.     function PageUnlock(dwFlags: DWORD): HResult; stdcall;
  1318.     // IDirectDrawSurface3 methods
  1319.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD): HResult; stdcall;
  1320.   end;
  1321.  
  1322. { IDirectDrawSurface4 Interface }
  1323.  
  1324.   IDirectDrawSurface4 = interface(IUnknown)
  1325.     ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']
  1326.     // IDirectDrawSurface methods
  1327.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface4): HResult; stdcall;
  1328.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1329.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface4;
  1330.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1331.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1332.         dwFlags: DWORD): HResult; stdcall;
  1333.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface4;
  1334.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1335.     function DeleteAttachedSurface(dwFlags: DWORD;
  1336.         lpDDSAttachedSurface: IDirectDrawSurface4): HResult; stdcall;
  1337.     function EnumAttachedSurfaces(lpContext: Pointer;
  1338.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback2): HResult; stdcall;
  1339.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1340.         lpfnCallback: TDDEnumSurfacesCallback2): HResult; stdcall;
  1341.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface4;
  1342.         dwFlags: DWORD): HResult; stdcall;
  1343.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps2;
  1344.         out lplpDDAttachedSurface: IDirectDrawSurface4): HResult; stdcall;
  1345.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1346.     function GetCaps(var lpDDSCaps: TDDSCaps2): HResult; stdcall;
  1347.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1348.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1349.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1350.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1351.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1352.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1353.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1354.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1355.     function Initialize(lpDD: IDirectDraw; const lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1356.     function IsLost: HResult; stdcall;
  1357.     function Lock(lpDestRect: PRect; const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1358.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1359.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1360.     function Restore: HResult; stdcall;
  1361.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1362.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1363.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1364.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1365.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1366.     function UpdateOverlay(const lpSrcRect: TRect; lpDDDestSurface: IDirectDrawSurface4;
  1367.         const lpDestRect: TRect; dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1368.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1369.     function UpdateOverlayZOrder(dwFlags: DWORD; lpDDSReference: IDirectDrawSurface4): HResult; stdcall;
  1370.     // IDirectDrawSurface2 methods
  1371.     function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall;
  1372.     function PageLock(dwFlags: DWORD): HResult; stdcall;
  1373.     function PageUnlock(dwFlags: DWORD): HResult; stdcall;
  1374.     // IDirectDrawSurface3 methods
  1375.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc2; dwFlags: DWORD): HResult; stdcall;
  1376.     // IDirectDrawSurface4 methods
  1377.     function SetPrivateData(const guidTag: TGUID; lpData: Pointer;
  1378.       cbSize: DWORD; dwFlags: DWORD): HResult; stdcall;
  1379.     function GetPrivateData(const guidTag: TGUID; lpData: Pointer;
  1380.       var cbSize: DWORD): HResult; stdcall;
  1381.     function FreePrivateData(const guidTag: TGUID): HResult; stdcall;
  1382.     function GetUniquenessValue(var lpValue: DWORD): HResult; stdcall;
  1383.     function ChangeUniquenessValue: HResult; stdcall;
  1384.   end;
  1385.  
  1386. { IDirectDrawSurface7 Interface }
  1387.  
  1388.   IDirectDrawSurface7 = interface(IUnknown)
  1389.     ['{06675A80-3B9B-11D2-B92F-00609797EA5B}']
  1390.     // IDirectDrawSurface methods
  1391.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface7): HResult; stdcall;
  1392.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1393.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface7;
  1394.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1395.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1396.         dwFlags: DWORD): HResult; stdcall;
  1397.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface7;
  1398.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1399.     function DeleteAttachedSurface(dwFlags: DWORD;
  1400.         lpDDSAttachedSurface: IDirectDrawSurface7): HResult; stdcall;
  1401.     function EnumAttachedSurfaces(lpContext: Pointer;
  1402.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback7): HResult; stdcall;
  1403.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1404.         lpfnCallback: TDDEnumSurfacesCallback7): HResult; stdcall;
  1405.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface7;
  1406.         dwFlags: DWORD): HResult; stdcall;
  1407.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps2;
  1408.         out lplpDDAttachedSurface: IDirectDrawSurface7): HResult; stdcall;
  1409.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1410.     function GetCaps(var lpDDSCaps: TDDSCaps2): HResult; stdcall;
  1411.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1412.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1413.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1414.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1415.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1416.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1417.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1418.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1419.     function Initialize(lpDD: IDirectDraw; const lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1420.     function IsLost: HResult; stdcall;
  1421.     function Lock(lpDestRect: PRect; const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1422.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1423.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1424.     function Restore: HResult; stdcall;
  1425.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1426.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1427.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1428.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1429.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1430.     function UpdateOverlay(const lpSrcRect: TRect; lpDDDestSurface: IDirectDrawSurface7;
  1431.         const lpDestRect: TRect; dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1432.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1433.     function UpdateOverlayZOrder(dwFlags: DWORD; lpDDSReference: IDirectDrawSurface7): HResult; stdcall;
  1434.     // IDirectDrawSurface2 methods
  1435.     function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall;
  1436.     function PageLock(dwFlags: DWORD): HResult; stdcall;
  1437.     function PageUnlock(dwFlags: DWORD): HResult; stdcall;
  1438.     // IDirectDrawSurface3 methods
  1439.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc2; dwFlags: DWORD): HResult; stdcall;
  1440.     // IDirectDrawSurface4 methods
  1441.     function SetPrivateData(const guidTag: TGUID; lpData: Pointer;
  1442.       cbSize: DWORD; dwFlags: DWORD): HResult; stdcall;
  1443.     function GetPrivateData(const guidTag: TGUID; lpData: Pointer;
  1444.       var cbSize: DWORD): HResult; stdcall;
  1445.     function FreePrivateData(const guidTag: TGUID): HResult; stdcall;
  1446.     function GetUniquenessValue(var lpValue: DWORD): HResult; stdcall;
  1447.     function ChangeUniquenessValue: HResult; stdcall;
  1448.     // Moved Texture7 methods here
  1449.     function SetPriority(dwPriority: DWORD): HResult; stdcall;
  1450.     function GetPriority(var lpdwPriority: DWORD): HResult; stdcall;
  1451.     function SetLOD(dwMaxLOD: DWORD): HResult; stdcall;
  1452.     function GetLOD(var lpdwMaxLOD: DWORD): HResult; stdcall;
  1453.   end;
  1454.  
  1455. { IDirectDrawColorControl Interface }
  1456.  
  1457.   IDirectDrawColorControl = interface(IUnknown)
  1458.     ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
  1459.     // IDirectDrawColorControl methods
  1460.     function GetColorControls(var lpColorControl: TDDColorControl): HResult; stdcall;
  1461.     function SetColorControls(const lpColorControl: TDDColorControl): HResult; stdcall;
  1462.   end;
  1463.  
  1464. { IDirectDrawGammaControl Interface }
  1465.  
  1466.   IDirectDrawGammaControl = interface(IUnknown)
  1467.     ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
  1468.     // IDirectDrawGammaControl methods
  1469.     function GetGammaRamp(dwFlags: DWORD; var lpRampData: TDDGammaRamp): HResult; stdcall;
  1470.     function SetGammaRamp(dwFlags: DWORD; const lpRampData: TDDGammaRamp): HResult; stdcall;
  1471.   end;
  1472.  
  1473. const
  1474. { Flags for DirectDrawEnumerateEx }
  1475.   DDENUM_ATTACHEDSECONDARYDEVICES = $00000001;
  1476.   DDENUM_DETACHEDSECONDARYDEVICES = $00000002;
  1477.   DDENUM_NONDISPLAYDEVICES        = $00000004;
  1478.  
  1479. { Flags for the IDirectDraw4.GetDeviceIdentifier method }
  1480.   DDGDI_GETHOSTIDENTIFIER = $00000001;
  1481.  
  1482. { ddsCaps field is valid. }
  1483.   DDSD_CAPS               = $00000001;     // default
  1484.   DDSD_HEIGHT             = $00000002;
  1485.   DDSD_WIDTH              = $00000004;
  1486.   DDSD_PITCH              = $00000008;
  1487.   DDSD_BACKBUFFERCOUNT    = $00000020;
  1488.   DDSD_ZBUFFERBITDEPTH    = $00000040;
  1489.   DDSD_ALPHABITDEPTH      = $00000080;
  1490.   DDSD_LPSURFACE          = $00000800;
  1491.   DDSD_PIXELFORMAT        = $00001000;
  1492.   DDSD_CKDESTOVERLAY      = $00002000;
  1493.   DDSD_CKDESTBLT          = $00004000;
  1494.   DDSD_CKSRCOVERLAY       = $00008000;
  1495.   DDSD_CKSRCBLT           = $00010000;
  1496.   DDSD_MIPMAPCOUNT        = $00020000;
  1497.   DDSD_REFRESHRATE        = $00040000;
  1498.   DDSD_LINEARSIZE         = $00080000;
  1499.   DDSD_TEXTURESTAGE       = $00100000;
  1500.   DDSD_FVF                = $00200000;
  1501.   DDSD_SRCVBHANDLE        = $00400000;
  1502.   DDSD_ALL                = $007ff9ee;
  1503.  
  1504. { DirectDraw Driver Capability Flags }
  1505.  
  1506.   DDCAPS_3D                   = $00000001;
  1507.   DDCAPS_ALIGNBOUNDARYDEST    = $00000002;
  1508.   DDCAPS_ALIGNSIZEDEST        = $00000004;
  1509.   DDCAPS_ALIGNBOUNDARYSRC     = $00000008;
  1510.   DDCAPS_ALIGNSIZESRC         = $00000010;
  1511.   DDCAPS_ALIGNSTRIDE          = $00000020;
  1512.   DDCAPS_BLT                  = $00000040;
  1513.   DDCAPS_BLTQUEUE             = $00000080;
  1514.   DDCAPS_BLTFOURCC            = $00000100;
  1515.   DDCAPS_BLTSTRETCH           = $00000200;
  1516.   DDCAPS_GDI                  = $00000400;
  1517.   DDCAPS_OVERLAY              = $00000800;
  1518.   DDCAPS_OVERLAYCANTCLIP      = $00001000;
  1519.   DDCAPS_OVERLAYFOURCC        = $00002000;
  1520.   DDCAPS_OVERLAYSTRETCH       = $00004000;
  1521.   DDCAPS_PALETTE              = $00008000;
  1522.   DDCAPS_PALETTEVSYNC         = $00010000;
  1523.   DDCAPS_READSCANLINE         = $00020000;
  1524.   DDCAPS_STEREOVIEW           = $00040000;
  1525.   DDCAPS_VBI                  = $00080000;
  1526.   DDCAPS_ZBLTS                = $00100000;
  1527.   DDCAPS_ZOVERLAYS            = $00200000;
  1528.   DDCAPS_COLORKEY             = $00400000;
  1529.   DDCAPS_ALPHA                = $00800000;
  1530.   DDCAPS_COLORKEYHWASSIST     = $01000000;
  1531.   DDCAPS_NOHARDWARE           = $02000000;
  1532.   DDCAPS_BLTCOLORFILL         = $04000000;
  1533.   DDCAPS_BANKSWITCHED         = $08000000;
  1534.   DDCAPS_BLTDEPTHFILL         = $10000000;
  1535.   DDCAPS_CANCLIP              = $20000000;
  1536.   DDCAPS_CANCLIPSTRETCHED     = $40000000;
  1537.   DDCAPS_CANBLTSYSMEM         = $80000000;
  1538.  
  1539. { More DirectDraw Driver Capability Flags (dwCaps2) }
  1540.  
  1541.   DDCAPS2_CERTIFIED            = $00000001;
  1542.   DDCAPS2_NO2DDURING3DSCENE    = $00000002;
  1543.   DDCAPS2_VIDEOPORT            = $00000004;
  1544.   DDCAPS2_AUTOFLIPOVERLAY      = $00000008;
  1545.   DDCAPS2_CANBOBINTERLEAVED    = $00000010;
  1546.   DDCAPS2_CANBOBNONINTERLEAVED = $00000020;
  1547.   DDCAPS2_COLORCONTROLOVERLAY  = $00000040;
  1548.   DDCAPS2_COLORCONTROLPRIMARY  = $00000080;
  1549.   DDCAPS2_CANDROPZ16BIT        = $00000100;
  1550.   DDCAPS2_NONLOCALVIDMEM       = $00000200;
  1551.   DDCAPS2_NONLOCALVIDMEMCAPS   = $00000400;
  1552.   DDCAPS2_NOPAGELOCKREQUIRED   = $00000800;
  1553.   DDCAPS2_WIDESURFACES         = $00001000;
  1554.   DDCAPS2_CANFLIPODDEVEN       = $00002000;
  1555.   DDCAPS2_CANBOBHARDWARE       = $00004000;
  1556.   DDCAPS2_COPYFOURCC           = $00008000;
  1557.   DDCAPS2_PRIMARYGAMMA         = $00020000;
  1558.   DDCAPS2_CANRENDERWINDOWED    = $00080000;
  1559.   DDCAPS2_CANCALIBRATEGAMMA    = $00100000;
  1560.   DDCAPS2_FLIPINTERVAL         = $00200000;
  1561.   DDCAPS2_FLIPNOVSYNC          = $00400000;
  1562.   DDCAPS2_CANMANAGETEXTURE     = $00800000;
  1563.   DDCAPS2_TEXMANINNONLOCALVIDMEM = $01000000;
  1564.   DDCAPS2_STEREO                 = $02000000;
  1565.   DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL = $04000000;
  1566.  
  1567. { DirectDrawSurface Capability Flags }
  1568.  
  1569.   DDSCAPS_RESERVED1           = $00000001; { DDSCAPS_3D }
  1570.   DDSCAPS_ALPHA               = $00000002;
  1571.   DDSCAPS_BACKBUFFER          = $00000004;
  1572.   DDSCAPS_COMPLEX             = $00000008;
  1573.   DDSCAPS_FLIP                = $00000010;
  1574.   DDSCAPS_FRONTBUFFER         = $00000020;
  1575.   DDSCAPS_OFFSCREENPLAIN      = $00000040;
  1576.   DDSCAPS_OVERLAY             = $00000080;
  1577.   DDSCAPS_PALETTE             = $00000100;
  1578.   DDSCAPS_PRIMARYSURFACE      = $00000200;
  1579.   DDSCAPS_RESERVED3           = $00000400; { DDSCAPS_PRIMARYSURFACELEFT }
  1580.   DDSCAPS_SYSTEMMEMORY        = $00000800;
  1581.   DDSCAPS_TEXTURE             = $00001000;
  1582.   DDSCAPS_3DDEVICE            = $00002000;
  1583.   DDSCAPS_VIDEOMEMORY         = $00004000;
  1584.   DDSCAPS_VISIBLE             = $00008000;
  1585.   DDSCAPS_WRITEONLY           = $00010000;
  1586.   DDSCAPS_ZBUFFER             = $00020000;
  1587.   DDSCAPS_OWNDC               = $00040000;
  1588.   DDSCAPS_LIVEVIDEO           = $00080000;
  1589.   DDSCAPS_HWCODEC             = $00100000;
  1590.   DDSCAPS_MODEX               = $00200000;
  1591.   DDSCAPS_MIPMAP              = $00400000;
  1592.   DDSCAPS_RESERVED2           = $00800000;
  1593.   DDSCAPS_ALLOCONLOAD         = $04000000;
  1594.   DDSCAPS_VIDEOPORT           = $08000000;
  1595.   DDSCAPS_LOCALVIDMEM         = $10000000;
  1596.   DDSCAPS_NONLOCALVIDMEM      = $20000000;
  1597.   DDSCAPS_STANDARDVGAMODE     = $40000000;
  1598.   DDSCAPS_OPTIMIZED           = $80000000;
  1599.  
  1600. { DirectDrawSurface Capability Flags 2 }
  1601.  
  1602.   DDSCAPS2_HARDWAREDEINTERLACE = $00000002;
  1603.   DDSCAPS2_HINTDYNAMIC         = $00000004;
  1604.   DDSCAPS2_HINTSTATIC          = $00000008;
  1605.   DDSCAPS2_TEXTUREMANAGE       = $00000010;
  1606.   DDSCAPS2_RESERVED1           = $00000020;
  1607.   DDSCAPS2_RESERVED2           = $00000040;
  1608.   DDSCAPS2_OPAQUE              = $00000080;
  1609.   DDSCAPS2_HINTANTIALIASING    = $00000100;
  1610.   DDSCAPS2_CUBEMAP             = $00000200;
  1611.   DDSCAPS2_CUBEMAP_POSITIVEX   = $00000400;
  1612.   DDSCAPS2_CUBEMAP_NEGATIVEX   = $00000800;
  1613.   DDSCAPS2_CUBEMAP_POSITIVEY   = $00001000;
  1614.   DDSCAPS2_CUBEMAP_NEGATIVEY   = $00002000;
  1615.   DDSCAPS2_CUBEMAP_POSITIVEZ   = $00004000;
  1616.   DDSCAPS2_CUBEMAP_NEGATIVEZ   = $00008000;
  1617.  
  1618.   DDSCAPS2_CUBEMAP_ALLFACES    =
  1619.     DDSCAPS2_CUBEMAP_POSITIVEX or DDSCAPS2_CUBEMAP_NEGATIVEX or
  1620.     DDSCAPS2_CUBEMAP_POSITIVEY or DDSCAPS2_CUBEMAP_NEGATIVEY or
  1621.     DDSCAPS2_CUBEMAP_POSITIVEZ or DDSCAPS2_CUBEMAP_NEGATIVEZ;
  1622.  
  1623.   DDSCAPS2_MIPMAPSUBLEVEL      = $00010000;
  1624.   DDSCAPS2_D3DTEXTUREMANAGE    = $00020000;
  1625.   DDSCAPS2_DONOTPERSIST        = $00040000;
  1626.   DDSCAPS2_STEREOSURFACELEFT   = $00080000;
  1627.  
  1628. { TDDOptSurfaceDesc flags }
  1629.  
  1630.   DDOSD_GUID              = $00000001;
  1631.   DDOSD_COMPRESSION_RATIO = $00000002;
  1632.   DDOSD_SCAPS             = $00000004;
  1633.   DDOSD_OSCAPS            = $00000008;
  1634.   DDOSD_ALL               = $0000000F;
  1635.  
  1636. { ddOSCaps field is valid. }
  1637.  
  1638.   DDOSDCAPS_OPTCOMPRESSED    = $00000001;
  1639.   DDOSDCAPS_OPTREORDERED     = $00000002;
  1640.   DDOSDCAPS_MONOLITHICMIPMAP = $00000004;
  1641.   DDOSDCAPS_VALIDSCAPS       = $30004800;
  1642.   DDOSDCAPS_VALIDOSCAPS      = $00000007;
  1643.  
  1644. { DirectDraw FX Alpha Capability Flags }
  1645.  
  1646.   DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
  1647.   DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
  1648.   DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
  1649.   DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
  1650.   DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
  1651.   DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
  1652.   DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
  1653.   DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
  1654.   DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
  1655.   DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
  1656.  
  1657. { DirectDraw FX Capability Flags }
  1658.  
  1659.   DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
  1660.   DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
  1661.   DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
  1662.   DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
  1663.   DDFXCAPS_BLTROTATION            = $00000100;
  1664.   DDFXCAPS_BLTROTATION90          = $00000200;
  1665.   DDFXCAPS_BLTSHRINKX             = $00000400;
  1666.   DDFXCAPS_BLTSHRINKXN            = $00000800;
  1667.   DDFXCAPS_BLTSHRINKY             = $00001000;
  1668.   DDFXCAPS_BLTSHRINKYN            = $00002000;
  1669.   DDFXCAPS_BLTSTRETCHX            = $00004000;
  1670.   DDFXCAPS_BLTSTRETCHXN           = $00008000;
  1671.   DDFXCAPS_BLTSTRETCHY            = $00010000;
  1672.   DDFXCAPS_BLTSTRETCHYN           = $00020000;
  1673.   DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
  1674.   DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
  1675.   DDFXCAPS_OVERLAYSHRINKX         = $00080000;
  1676.   DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
  1677.   DDFXCAPS_OVERLAYSHRINKY         = $00200000;
  1678.   DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
  1679.   DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
  1680.   DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
  1681.   DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
  1682.   DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
  1683.   DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
  1684.   DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
  1685.   DDFXCAPS_BLTALPHA               = $00000001;
  1686.   DDFXCAPS_BLTTRANSFORM           = $00000002;
  1687.   DDFXCAPS_BLTFILTER              = DDFXCAPS_BLTARITHSTRETCHY;
  1688.   DDFXCAPS_OVERLAYALPHA           = $00000004;
  1689.   DDFXCAPS_OVERLAYTRANSFORM       = $20000000;
  1690.   DDFXCAPS_OVERLAYFILTER          = DDFXCAPS_OVERLAYARITHSTRETCHY;
  1691.  
  1692. { DirectDraw Stereo View Capabilities }
  1693.  
  1694.   DDSVCAPS_RESERVED1              = $00000001;
  1695.   DDSVCAPS_RESERVED2              = $00000002;
  1696.   DDSVCAPS_RESERVED3              = $00000004;
  1697.   DDSVCAPS_RESERVED4              = $00000008;
  1698.   DDSVCAPS_STEREOSEQUENTIAL       = $00000010;
  1699.  
  1700. { DirectDrawPalette Capabilities }
  1701.  
  1702.   DDPCAPS_4BIT               = $00000001;
  1703.   DDPCAPS_8BITENTRIES        = $00000002;
  1704.   DDPCAPS_8BIT               = $00000004;
  1705.   DDPCAPS_INITIALIZE         = $00000008;
  1706.   DDPCAPS_PRIMARYSURFACE     = $00000010;
  1707.   DDPCAPS_PRIMARYSURFACELEFT = $00000020;
  1708.   DDPCAPS_ALLOW256           = $00000040;
  1709.   DDPCAPS_VSYNC              = $00000080;
  1710.   DDPCAPS_1BIT               = $00000100;
  1711.   DDPCAPS_2BIT               = $00000200;
  1712.   DDPCAPS_ALPHA              = $00000400;
  1713.  
  1714. { DirectDraw BitDepth Constants }
  1715.  
  1716.   DDBD_1  = $00004000;
  1717.   DDBD_2  = $00002000;
  1718.   DDBD_4  = $00001000;
  1719.   DDBD_8  = $00000800;
  1720.   DDBD_16 = $00000400;
  1721.   DDBD_24 = $00000200;
  1722.   DDBD_32 = $00000100;
  1723.  
  1724. { DirectDraw Set/Get Color Key Flags }
  1725.  
  1726.   DDCKEY_COLORSPACE  = $00000001;
  1727.   DDCKEY_DESTBLT     = $00000002;
  1728.   DDCKEY_DESTOVERLAY = $00000004;
  1729.   DDCKEY_SRCBLT      = $00000008;
  1730.   DDCKEY_SRCOVERLAY  = $00000010;
  1731.  
  1732. { DirectDraw Color Key Capability Flags }
  1733.  
  1734.   DDCKEYCAPS_DESTBLT                = $00000001;
  1735.   DDCKEYCAPS_DESTBLTCLRSPACE        = $00000002;
  1736.   DDCKEYCAPS_DESTBLTCLRSPACEYUV     = $00000004;
  1737.   DDCKEYCAPS_DESTBLTYUV             = $00000008;
  1738.   DDCKEYCAPS_DESTOVERLAY            = $00000010;
  1739.   DDCKEYCAPS_DESTOVERLAYCLRSPACE    = $00000020;
  1740.   DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV = $00000040;
  1741.   DDCKEYCAPS_DESTOVERLAYONEACTIVE   = $00000080;
  1742.   DDCKEYCAPS_DESTOVERLAYYUV         = $00000100;
  1743.   DDCKEYCAPS_SRCBLT                 = $00000200;
  1744.   DDCKEYCAPS_SRCBLTCLRSPACE         = $00000400;
  1745.   DDCKEYCAPS_SRCBLTCLRSPACEYUV      = $00000800;
  1746.   DDCKEYCAPS_SRCBLTYUV              = $00001000;
  1747.   DDCKEYCAPS_SRCOVERLAY             = $00002000;
  1748.   DDCKEYCAPS_SRCOVERLAYCLRSPACE     = $00004000;
  1749.   DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV  = $00008000;
  1750.   DDCKEYCAPS_SRCOVERLAYONEACTIVE    = $00010000;
  1751.   DDCKEYCAPS_SRCOVERLAYYUV          = $00020000;
  1752.   DDCKEYCAPS_NOCOSTOVERLAY          = $00040000;
  1753.  
  1754. { DirectDraw PixelFormat Flags }
  1755.  
  1756.   DDPF_ALPHAPIXELS       = $00000001;
  1757.   DDPF_ALPHA             = $00000002;
  1758.   DDPF_FOURCC            = $00000004;
  1759.   DDPF_PALETTEINDEXED4   = $00000008;
  1760.   DDPF_PALETTEINDEXEDTO8 = $00000010;
  1761.   DDPF_PALETTEINDEXED8   = $00000020;
  1762.   DDPF_RGB               = $00000040;
  1763.   DDPF_COMPRESSED        = $00000080;
  1764.   DDPF_RGBTOYUV          = $00000100;
  1765.   DDPF_YUV               = $00000200;
  1766.   DDPF_ZBUFFER           = $00000400;
  1767.   DDPF_PALETTEINDEXED1   = $00000800;
  1768.   DDPF_PALETTEINDEXED2   = $00001000;
  1769.   DDPF_ZPIXELS           = $00002000;
  1770.   DDPF_STENCILBUFFER     = $00004000;
  1771.   DDPF_ALPHAPREMULT      = $00008000;
  1772.   DDPF_LUMINANCE         = $00020000;
  1773.   DDPF_BUMPLUMINANCE     = $00040000;
  1774.   DDPF_BUMPDUDV          = $00080000;
  1775.  
  1776. { DirectDraw SetDisplayMode Flags }
  1777.  
  1778.   DDSDM_STANDARDVGAMODE  = $00000001;
  1779.  
  1780. { DirectDraw EnumDisplayModes Flags }
  1781.  
  1782.   DDEDM_REFRESHRATES     = $00000001;
  1783.   DDEDM_STANDARDVGAMODES = $00000002;
  1784.  
  1785. { DirectDraw EnumSurfaces Flags }
  1786.  
  1787.   DDENUMSURFACES_ALL           = $00000001;
  1788.   DDENUMSURFACES_MATCH         = $00000002;
  1789.   DDENUMSURFACES_NOMATCH       = $00000004;
  1790.   DDENUMSURFACES_CANBECREATED  = $00000008;
  1791.   DDENUMSURFACES_DOESEXIST     = $00000010;
  1792.  
  1793. { DirectDraw SetCooperativeLevel Flags }
  1794.  
  1795.   DDSCL_FULLSCREEN          = $00000001;
  1796.   DDSCL_ALLOWREBOOT         = $00000002;
  1797.   DDSCL_NOWINDOWCHANGES     = $00000004;
  1798.   DDSCL_NORMAL              = $00000008;
  1799.   DDSCL_EXCLUSIVE           = $00000010;
  1800.   DDSCL_ALLOWMODEX          = $00000040;
  1801.   DDSCL_SETFOCUSWINDOW      = $00000080;
  1802.   DDSCL_SETDEVICEWINDOW     = $00000100;
  1803.   DDSCL_CREATEDEVICEWINDOW  = $00000200;
  1804.   DDSCL_MULTITHREADED       = $00000400;
  1805.   DDSCL_FPUSETUP            = $00000800;
  1806.   DDSCL_FPUPRESERVE         = $00001000;
  1807.  
  1808. { DirectDraw Blt Flags }
  1809.  
  1810.   DDBLT_ALPHADEST                = $00000001;
  1811.   DDBLT_ALPHADESTCONSTOVERRIDE   = $00000002;
  1812.   DDBLT_ALPHADESTNEG             = $00000004;
  1813.   DDBLT_ALPHADESTSURFACEOVERRIDE = $00000008;
  1814.   DDBLT_ALPHAEDGEBLEND           = $00000010;
  1815.   DDBLT_ALPHASRC                 = $00000020;
  1816.   DDBLT_ALPHASRCCONSTOVERRIDE    = $00000040;
  1817.   DDBLT_ALPHASRCNEG              = $00000080;
  1818.   DDBLT_ALPHASRCSURFACEOVERRIDE  = $00000100;
  1819.   DDBLT_ASYNC                    = $00000200;
  1820.   DDBLT_COLORFILL                = $00000400;
  1821.   DDBLT_DDFX                     = $00000800;
  1822.   DDBLT_DDROPS                   = $00001000;
  1823.   DDBLT_KEYDEST                  = $00002000;
  1824.   DDBLT_KEYDESTOVERRIDE          = $00004000;
  1825.   DDBLT_KEYSRC                   = $00008000;
  1826.   DDBLT_KEYSRCOVERRIDE           = $00010000;
  1827.   DDBLT_ROP                      = $00020000;
  1828.   DDBLT_ROTATIONANGLE            = $00040000;
  1829.   DDBLT_ZBUFFER                  = $00080000;
  1830.   DDBLT_ZBUFFERDESTCONSTOVERRIDE = $00100000;
  1831.   DDBLT_ZBUFFERDESTOVERRIDE      = $00200000;
  1832.   DDBLT_ZBUFFERSRCCONSTOVERRIDE  = $00400000;
  1833.   DDBLT_ZBUFFERSRCOVERRIDE       = $00800000;
  1834.   DDBLT_WAIT                     = $01000000;
  1835.   DDBLT_DEPTHFILL                = $02000000;
  1836.   DDBLT_DONOTWAIT                = $08000000;
  1837.  
  1838. { BltFast Flags }
  1839.  
  1840.   DDBLTFAST_NOCOLORKEY   = $00000000;
  1841.   DDBLTFAST_SRCCOLORKEY  = $00000001;
  1842.   DDBLTFAST_DESTCOLORKEY = $00000002;
  1843.   DDBLTFAST_WAIT         = $00000010;
  1844.   DDBLTFAST_DONOTWAIT    = $00000020;
  1845.  
  1846. { Flip Flags }
  1847.  
  1848.   DDFLIP_WAIT      = $00000001;
  1849.   DDFLIP_EVEN      = $00000002;
  1850.   DDFLIP_ODD       = $00000004;
  1851.   DDFLIP_NOVSYNC   = $00000008;
  1852.   DDFLIP_INTERVAL2 = $02000000;
  1853.   DDFLIP_INTERVAL3 = $03000000;
  1854.   DDFLIP_INTERVAL4 = $04000000;
  1855.   DDFLIP_STEREO    = $00000010;
  1856.   DDFLIP_DONOTWAIT = $00000020;
  1857.  
  1858. { DirectDraw Surface Overlay Flags }
  1859.  
  1860.   DDOVER_ALPHADEST                = $00000001;
  1861.   DDOVER_ALPHADESTCONSTOVERRIDE   = $00000002;
  1862.   DDOVER_ALPHADESTNEG             = $00000004;
  1863.   DDOVER_ALPHADESTSURFACEOVERRIDE = $00000008;
  1864.   DDOVER_ALPHAEDGEBLEND           = $00000010;
  1865.   DDOVER_ALPHASRC                 = $00000020;
  1866.   DDOVER_ALPHASRCCONSTOVERRIDE    = $00000040;
  1867.   DDOVER_ALPHASRCNEG              = $00000080;
  1868.   DDOVER_ALPHASRCSURFACEOVERRIDE  = $00000100;
  1869.   DDOVER_HIDE                     = $00000200;
  1870.   DDOVER_KEYDEST                  = $00000400;
  1871.   DDOVER_KEYDESTOVERRIDE          = $00000800;
  1872.   DDOVER_KEYSRC                   = $00001000;
  1873.   DDOVER_KEYSRCOVERRIDE           = $00002000;
  1874.   DDOVER_SHOW                     = $00004000;
  1875.   DDOVER_ADDDIRTYRECT             = $00008000;
  1876.   DDOVER_REFRESHDIRTYRECTS        = $00010000;
  1877.   DDOVER_REFRESHALL               = $00020000;
  1878.   DDOVER_DDFX                     = $00080000;
  1879.   DDOVER_AUTOFLIP                 = $00100000;
  1880.   DDOVER_BOB                      = $00200000;
  1881.   DDOVER_OVERRIDEBOBWEAVE         = $00400000;
  1882.   DDOVER_INTERLEAVED              = $00800000;
  1883.   DDOVER_BOBHARDWARE              = $01000000;
  1884.   DDOVER_ARGBSCALEFACTORS         = $02000000;
  1885.   DDOVER_DEGRADEARGBSCALING       = $04000000;
  1886.  
  1887. { DirectDrawSurface Lock Flags }
  1888.  
  1889.   DDLOCK_SURFACEMEMORYPTR  = $00000000;    // default
  1890.   DDLOCK_WAIT              = $00000001;
  1891.   DDLOCK_EVENT             = $00000002;
  1892.   DDLOCK_READONLY          = $00000010;
  1893.   DDLOCK_WRITEONLY         = $00000020;
  1894.   DDLOCK_NOSYSLOCK         = $00000800;
  1895.   DDLOCK_NOOVERWRITE       = $00001000;
  1896.   DDLOCK_DISCARDCONTENTS   = $00002000;
  1897.   DDLOCK_OKTOSWAP          = $00002000;
  1898.   DDLOCK_DONOTWAIT         = $00004000;
  1899.  
  1900. { DirectDrawSurface Blt FX Flags }
  1901.  
  1902.   DDBLTFX_ARITHSTRETCHY    = $00000001;
  1903.   DDBLTFX_MIRRORLEFTRIGHT  = $00000002;
  1904.   DDBLTFX_MIRRORUPDOWN     = $00000004;
  1905.   DDBLTFX_NOTEARING        = $00000008;
  1906.   DDBLTFX_ROTATE180        = $00000010;
  1907.   DDBLTFX_ROTATE270        = $00000020;
  1908.   DDBLTFX_ROTATE90         = $00000040;
  1909.   DDBLTFX_ZBUFFERRANGE     = $00000080;
  1910.   DDBLTFX_ZBUFFERBASEDEST  = $00000100;
  1911.  
  1912. { DirectDrawSurface Overlay FX Flags }
  1913.  
  1914.   DDOVERFX_ARITHSTRETCHY   = $00000001;
  1915.   DDOVERFX_MIRRORLEFTRIGHT = $00000002;
  1916.   DDOVERFX_MIRRORUPDOWN    = $00000004;
  1917.  
  1918. { Flags for dwDDFX member of DDSPRITEFX structure }
  1919.  
  1920.   DDSPRITEFX_AFFINETRANSFORM    = $00000001;
  1921.   DDSPRITEFX_RGBASCALING        = $00000002;
  1922.   DDSPRITEFX_DEGRADERGBASCALING = $00000004;
  1923.   DDSPRITEFX_BILINEARFILTER     = $00000008;
  1924.   DDSPRITEFX_BLURFILTER         = $00000010;
  1925.   DDSPRITEFX_FLATFILTER         = $00000020;
  1926.   DDSPRITEFX_DEGRADEFILTER      = $00000040;
  1927.  
  1928. { DirectDraw WaitForVerticalBlank Flags }
  1929.  
  1930.   DDWAITVB_BLOCKBEGIN      = $00000001;
  1931.   DDWAITVB_BLOCKBEGINEVENT = $00000002;
  1932.   DDWAITVB_BLOCKEND        = $00000004;
  1933.  
  1934. { DirectDraw GetFlipStatus Flags }
  1935.  
  1936.   DDGFS_CANFLIP    = $00000001;
  1937.   DDGFS_ISFLIPDONE = $00000002;
  1938.  
  1939. { DirectDraw GetBltStatus Flags }
  1940.  
  1941.   DDGBS_CANBLT     = $00000001;
  1942.   DDGBS_ISBLTDONE  = $00000002;
  1943.  
  1944. { DirectDraw EnumOverlayZOrder Flags }
  1945.  
  1946.   DDENUMOVERLAYZ_BACKTOFRONT = $00000000;
  1947.   DDENUMOVERLAYZ_FRONTTOBACK = $00000001;
  1948.  
  1949. { DirectDraw UpdateOverlayZOrder Flags }
  1950.  
  1951.   DDOVERZ_SENDTOFRONT     = $00000000;
  1952.   DDOVERZ_SENDTOBACK      = $00000001;
  1953.   DDOVERZ_MOVEFORWARD     = $00000002;
  1954.   DDOVERZ_MOVEBACKWARD    = $00000003;
  1955.   DDOVERZ_INSERTINFRONTOF = $00000004;
  1956.   DDOVERZ_INSERTINBACKOF  = $00000005;
  1957.  
  1958. { DirectDrawSurface SetPrivateData Constants }
  1959.  
  1960.   DDSPD_IUNKNOWNPOINTER   = $00000001;
  1961.   DDSPD_VOLATILE          = $00000002;
  1962.  
  1963. { TDDColorControl flags }
  1964.  
  1965.   DDCOLOR_BRIGHTNESS    = $00000001;
  1966.   DDCOLOR_CONTRAST      = $00000002;
  1967.   DDCOLOR_HUE           = $00000004;
  1968.   DDCOLOR_SATURATION    = $00000008;
  1969.   DDCOLOR_SHARPNESS     = $00000010;
  1970.   DDCOLOR_GAMMA         = $00000020;
  1971.   DDCOLOR_COLORENABLE   = $00000040;
  1972.  
  1973. { DirectDraw SetGammaRamp Flags }
  1974.  
  1975.   DDSGR_CALIBRATE = $00000001;
  1976.  
  1977. { DirectDraw StartModeTest Flags }
  1978.  
  1979.   DDSMT_ISTESTREQUIRED = $00000001;
  1980.  
  1981. { DirectDraw EvaluateMode Flags  }
  1982.  
  1983.   DDEM_MODEPASSED      = $00000001;
  1984.   DDEM_MODEFAILED      = $00000002;
  1985.  
  1986. { DirectDraw Return Codes }
  1987.  
  1988.   DD_OK                                   = HResult(0);
  1989.   DD_FALSE                                = HResult(S_FALSE);
  1990.  
  1991. { DirectDraw EnumCallback Return Values }
  1992.  
  1993.   DDENUMRET_CANCEL = 0;
  1994.   DDENUMRET_OK     = 1;
  1995.  
  1996. { DirectDraw Error Codes }
  1997.  
  1998.   DDERR_ALREADYINITIALIZED                = HResult($88760000 + 5);
  1999.   DDERR_CANNOTATTACHSURFACE               = HResult($88760000 + 10);
  2000.   DDERR_CANNOTDETACHSURFACE               = HResult($88760000 + 20);
  2001.   DDERR_CURRENTLYNOTAVAIL                 = HResult($88760000 + 40);
  2002.   DDERR_EXCEPTION                         = HResult($88760000 + 55);
  2003.   DDERR_GENERIC                           = HResult(E_FAIL);
  2004.   DDERR_HEIGHTALIGN                       = HResult($88760000 + 90);
  2005.   DDERR_INCOMPATIBLEPRIMARY               = HResult($88760000 + 95);
  2006.   DDERR_INVALIDCAPS                       = HResult($88760000 + 100);
  2007.   DDERR_INVALIDCLIPLIST                   = HResult($88760000 + 110);
  2008.   DDERR_INVALIDMODE                       = HResult($88760000 + 120);
  2009.   DDERR_INVALIDOBJECT                     = HResult($88760000 + 130);
  2010.   DDERR_INVALIDPARAMS                     = HResult(E_INVALIDARG);
  2011.   DDERR_INVALIDPIXELFORMAT                = HResult($88760000 + 145);
  2012.   DDERR_INVALIDRECT                       = HResult($88760000 + 150);
  2013.   DDERR_LOCKEDSURFACES                    = HResult($88760000 + 160);
  2014.   DDERR_NO3D                              = HResult($88760000 + 170);
  2015.   DDERR_NOALPHAHW                         = HResult($88760000 + 180);
  2016.   DDERR_NOSTEREOHARDWARE                  = HResult($88760000 + 181);
  2017.   DDERR_NOSURFACELEFT                     = HResult($88760000 + 182);
  2018.   DDERR_NOCLIPLIST                        = HResult($88760000 + 205);
  2019.   DDERR_NOCOLORCONVHW                     = HResult($88760000 + 210);
  2020.   DDERR_NOCOOPERATIVELEVELSET             = HResult($88760000 + 212);
  2021.   DDERR_NOCOLORKEY                        = HResult($88760000 + 215);
  2022.   DDERR_NOCOLORKEYHW                      = HResult($88760000 + 220);
  2023.   DDERR_NODIRECTDRAWSUPPORT               = HResult($88760000 + 222);
  2024.   DDERR_NOEXCLUSIVEMODE                   = HResult($88760000 + 225);
  2025.   DDERR_NOFLIPHW                          = HResult($88760000 + 230);
  2026.   DDERR_NOGDI                             = HResult($88760000 + 240);
  2027.   DDERR_NOMIRRORHW                        = HResult($88760000 + 250);
  2028.   DDERR_NOTFOUND                          = HResult($88760000 + 255);
  2029.   DDERR_NOOVERLAYHW                       = HResult($88760000 + 260);
  2030.   DDERR_OVERLAPPINGRECTS                  = HResult($88760000 + 270);
  2031.   DDERR_NORASTEROPHW                      = HResult($88760000 + 280);
  2032.   DDERR_NOROTATIONHW                      = HResult($88760000 + 290);
  2033.   DDERR_NOSTRETCHHW                       = HResult($88760000 + 310);
  2034.   DDERR_NOT4BITCOLOR                      = HResult($88760000 + 316);
  2035.   DDERR_NOT4BITCOLORINDEX                 = HResult($88760000 + 317);
  2036.   DDERR_NOT8BITCOLOR                      = HResult($88760000 + 320);
  2037.   DDERR_NOTEXTUREHW                       = HResult($88760000 + 330);
  2038.   DDERR_NOVSYNCHW                         = HResult($88760000 + 335);
  2039.   DDERR_NOZBUFFERHW                       = HResult($88760000 + 340);
  2040.   DDERR_NOZOVERLAYHW                      = HResult($88760000 + 350);
  2041.   DDERR_OUTOFCAPS                         = HResult($88760000 + 360);
  2042.   DDERR_OUTOFMEMORY                       = HResult(E_OUTOFMEMORY);
  2043.   DDERR_OUTOFVIDEOMEMORY                  = HResult($88760000 + 380);
  2044.   DDERR_OVERLAYCANTCLIP                   = HResult($88760000 + 382);
  2045.   DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = HResult($88760000 + 384);
  2046.   DDERR_PALETTEBUSY                       = HResult($88760000 + 387);
  2047.   DDERR_COLORKEYNOTSET                    = HResult($88760000 + 400);
  2048.   DDERR_SURFACEALREADYATTACHED            = HResult($88760000 + 410);
  2049.   DDERR_SURFACEALREADYDEPENDENT           = HResult($88760000 + 420);
  2050.   DDERR_SURFACEBUSY                       = HResult($88760000 + 430);
  2051.   DDERR_CANTLOCKSURFACE                   = HResult($88760000 + 435);
  2052.   DDERR_SURFACEISOBSCURED                 = HResult($88760000 + 440);
  2053.   DDERR_SURFACELOST                       = HResult($88760000 + 450);
  2054.   DDERR_SURFACENOTATTACHED                = HResult($88760000 + 460);
  2055.   DDERR_TOOBIGHEIGHT                      = HResult($88760000 + 470);
  2056.   DDERR_TOOBIGSIZE                        = HResult($88760000 + 480);
  2057.   DDERR_TOOBIGWIDTH                       = HResult($88760000 + 490);
  2058.   DDERR_UNSUPPORTED                       = HResult(E_NOTIMPL);
  2059.   DDERR_UNSUPPORTEDFORMAT                 = HResult($88760000 + 510);
  2060.   DDERR_UNSUPPORTEDMASK                   = HResult($88760000 + 520);
  2061.   DDERR_INVALIDSTREAM                     = HResult($88760000 + 521);
  2062.   DDERR_VERTICALBLANKINPROGRESS           = HResult($88760000 + 537);
  2063.   DDERR_WASSTILLDRAWING                   = HResult($88760000 + 540);
  2064.   DDERR_DDSCAPSCOMPLEXREQUIRED            = HResult($88760000 + 542);
  2065.   DDERR_XALIGN                            = HResult($88760000 + 560);
  2066.   DDERR_INVALIDDIRECTDRAWGUID             = HResult($88760000 + 561);
  2067.   DDERR_DIRECTDRAWALREADYCREATED          = HResult($88760000 + 562);
  2068.   DDERR_NODIRECTDRAWHW                    = HResult($88760000 + 563);
  2069.   DDERR_PRIMARYSURFACEALREADYEXISTS       = HResult($88760000 + 564);
  2070.   DDERR_NOEMULATION                       = HResult($88760000 + 565);
  2071.   DDERR_REGIONTOOSMALL                    = HResult($88760000 + 566);
  2072.   DDERR_CLIPPERISUSINGHWND                = HResult($88760000 + 567);
  2073.   DDERR_NOCLIPPERATTACHED                 = HResult($88760000 + 568);
  2074.   DDERR_NOHWND                            = HResult($88760000 + 569);
  2075.   DDERR_HWNDSUBCLASSED                    = HResult($88760000 + 570);
  2076.   DDERR_HWNDALREADYSET                    = HResult($88760000 + 571);
  2077.   DDERR_NOPALETTEATTACHED                 = HResult($88760000 + 572);
  2078.   DDERR_NOPALETTEHW                       = HResult($88760000 + 573);
  2079.   DDERR_BLTFASTCANTCLIP                   = HResult($88760000 + 574);
  2080.   DDERR_NOBLTHW                           = HResult($88760000 + 575);
  2081.   DDERR_NODDROPSHW                        = HResult($88760000 + 576);
  2082.   DDERR_OVERLAYNOTVISIBLE                 = HResult($88760000 + 577);
  2083.   DDERR_NOOVERLAYDEST                     = HResult($88760000 + 578);
  2084.   DDERR_INVALIDPOSITION                   = HResult($88760000 + 579);
  2085.   DDERR_NOTAOVERLAYSURFACE                = HResult($88760000 + 580);
  2086.   DDERR_EXCLUSIVEMODEALREADYSET           = HResult($88760000 + 581);
  2087.   DDERR_NOTFLIPPABLE                      = HResult($88760000 + 582);
  2088.   DDERR_CANTDUPLICATE                     = HResult($88760000 + 583);
  2089.   DDERR_NOTLOCKED                         = HResult($88760000 + 584);
  2090.   DDERR_CANTCREATEDC                      = HResult($88760000 + 585);
  2091.   DDERR_NODC                              = HResult($88760000 + 586);
  2092.   DDERR_WRONGMODE                         = HResult($88760000 + 587);
  2093.   DDERR_IMPLICITLYCREATED                 = HResult($88760000 + 588);
  2094.   DDERR_NOTPALETTIZED                     = HResult($88760000 + 589);
  2095.   DDERR_UNSUPPORTEDMODE                   = HResult($88760000 + 590);
  2096.   DDERR_NOMIPMAPHW                        = HResult($88760000 + 591);
  2097.   DDERR_INVALIDSURFACETYPE                = HResult($88760000 + 592);
  2098.   DDERR_NOOPTIMIZEHW                      = HResult($88760000 + 600);
  2099.   DDERR_NOTLOADED                         = HResult($88760000 + 601);
  2100.   DDERR_NOFOCUSWINDOW                     = HResult($88760000 + 602);
  2101.   DDERR_NOTONMIPMAPSUBLEVEL               = HResult($88760000 + 603);
  2102.   DDERR_DCALREADYCREATED                  = HResult($88760000 + 620);
  2103.   DDERR_NONONLOCALVIDMEM                  = HResult($88760000 + 630);
  2104.   DDERR_CANTPAGELOCK                      = HResult($88760000 + 640);
  2105.   DDERR_CANTPAGEUNLOCK                    = HResult($88760000 + 660);
  2106.   DDERR_NOTPAGELOCKED                     = HResult($88760000 + 680);
  2107.   DDERR_MOREDATA                          = HResult($88760000 + 690);
  2108.   DDERR_EXPIRED                           = HResult($88760000 + 691);
  2109.   DDERR_TESTFINISHED                      = HResult($88760000 + 692);
  2110.   DDERR_NEWMODE                           = HResult($88760000 + 693);
  2111.   DDERR_D3DNOTINITIALIZED                 = HResult($88760000 + 694);
  2112.   DDERR_VIDEONOTACTIVE                    = HResult($88760000 + 695);
  2113.   DDERR_NOMONITORINFORMATION              = HResult($88760000 + 696);
  2114.   DDERR_NODRIVERSUPPORT                   = HResult($88760000 + 697);
  2115.   DDERR_DEVICEDOESNTOWNSURFACE            = HResult($88760000 + 699);
  2116.   DDERR_NOTINITIALIZED                    = HResult(CO_E_NOTINITIALIZED);
  2117.  
  2118. { API's }
  2119.  
  2120. function GET_WHQL_YEAR(dwWHQLLevel: DWORD): DWORD;
  2121. function GET_WHQL_MONTH(dwWHQLLevel: DWORD): DWORD;
  2122. function GET_WHQL_DAY(dwWHQLLevel: DWORD): DWORD;
  2123.  
  2124. type
  2125.   HMonitor = THandle;
  2126.  
  2127.   TDDEnumCallbackA = function(lpGUID: PGUID; lpDriverDescription: LPSTR;
  2128.     lpDriverName: LPSTR; lpContext: Pointer): BOOL; stdcall;
  2129.   LPDDENUMCALLBACKA = TDDEnumCallbackA;
  2130.  
  2131.   TDDEnumCallbackW = function(lpGUID: PGUID; lpDriverDescription: LPWSTR;
  2132.     lpDriverName: LPWSTR; lpContext: Pointer): BOOL; stdcall;
  2133.   LPDDENUMCALLBACKW = TDDEnumCallbackW;
  2134.  
  2135.   TDDEnumCallback = TDDEnumCallbackA;
  2136.   LPDDENUMCALLBACK = TDDEnumCallback;
  2137.  
  2138.   TDDEnumCallbackExA = function(lpGUID: PGUID; lpDriverDescription: LPSTR;
  2139.     lpDriverName: LPSTR; lpContext: Pointer; Monitor: HMonitor): BOOL; stdcall;
  2140.   LPDDENUMCALLBACKEXA = TDDEnumCallbackExA;
  2141.  
  2142.   TDDEnumCallbackExW = function(lpGUID: PGUID; lpDriverDescription: LPWSTR;
  2143.     lpDriverName: LPWSTR; lpContext: Pointer; Monitor: HMonitor): BOOL; stdcall;
  2144.   LPDDENUMCALLBACKEXW = TDDEnumCallbackExW;
  2145.  
  2146.   TDDEnumCallbackEx = TDDEnumCallbackExA;
  2147.   LPDDENUMCALLBACKEX = TDDEnumCallbackEx;
  2148.  
  2149. const
  2150.   REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
  2151.   REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
  2152.   REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
  2153.  
  2154.   DDCREATE_HARDWAREONLY       = $00000001;
  2155.   DDCREATE_EMULATIONONLY      = $00000002;
  2156.  
  2157. function DirectDrawEnumerateA(lpCallback: TDDEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  2158. function DirectDrawEnumerateW(lpCallback: TDDEnumCallbackW; lpContext: Pointer): HResult; stdcall;
  2159. function DirectDrawEnumerate(lpCallback: TDDEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  2160.  
  2161. function DirectDrawEnumerateExA(lpCallback: TDDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  2162. function DirectDrawEnumerateExW(lpCallback: TDDEnumCallbackExW; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  2163. function DirectDrawEnumerateEx(lpCallback: TDDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  2164.  
  2165. function DirectDrawCreate(lpGUID: PGUID; out lplpDD: IDirectDraw;
  2166.   pUnkOuter: IUnknown): HResult; stdcall;
  2167. function DirectDrawCreateEx(lpGUID: PGUID; out lplpDD; const iid: TGUID;
  2168.   pUnkOuter: IUnknown): HResult; stdcall;
  2169. function DirectDrawCreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  2170.   pUnkOuter: IUnknown): HResult; stdcall;
  2171.  
  2172. (*==========================================================================;
  2173.  *
  2174.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  2175.  *
  2176.  *  File:       dvp.h
  2177.  *  Content:    DirectDrawVideoPort include file
  2178.  *
  2179.  ***************************************************************************)
  2180.  
  2181. { GUIDS used by DirectDrawVideoPort objects }
  2182.  
  2183. const
  2184.   IID_IDDVideoPortContainer: TGUID = '{6C142760-A733-11CE-A521-0020AF0BE560}';
  2185.   IID_IDirectDrawVideoPort: TGUID = '{B36D93E0-2B43-11CF-A2DE-00AA00B93356}';
  2186.  
  2187.   DDVPTYPE_E_HREFH_VREFH: TGUID = '{54F39980-DA60-11CF-9B06-00A0C903A3B8}';
  2188.   DDVPTYPE_E_HREFH_VREFL: TGUID = '{92783220-DA60-11CF-9B06-00A0C903A3B8}';
  2189.   DDVPTYPE_E_HREFL_VREFH: TGUID = '{A07A02E0-DA60-11CF-9B06-00A0C903A3B8}';
  2190.   DDVPTYPE_E_HREFL_VREFL: TGUID = '{E09C77E0-DA60-11CF-9B06-00A0C903A3B8}';
  2191.   DDVPTYPE_CCIR656: TGUID = '{FCA326A0-DA60-11CF-9B06-00A0C903A3B8}';
  2192.   DDVPTYPE_BROOKTREE: TGUID = '{1352A560-DA61-11CF-9B06-00A0C903A3B8}';
  2193.   DDVPTYPE_PHILIPS: TGUID = '{332CF160-DA61-11CF-9B06-00A0C903A3B8}';
  2194.  
  2195. { DirectDraw Structures }
  2196.  
  2197. type
  2198.   IDDVideoPortContainer = interface;
  2199.   IDirectDrawVideoPort = interface;
  2200.  
  2201. { TDDVideoportConnect structure }
  2202.  
  2203.   PDDVideoportConnect = ^TDDVideoportConnect;
  2204.   TDDVideoportConnect = record
  2205.     dwSize: DWORD;        // size of the TDDVideoportConnect structure
  2206.     dwPortWidth: DWORD;   // Width of the video port
  2207.     guidTypeID: TGUID;    // Description of video port connection
  2208.     dwFlags: DWORD;       // Connection flags
  2209.     dwReserved1: DWORD;   // Reserved, set to zero.
  2210.   end;
  2211.  
  2212.   DDVIDEOPORTCONNECT = TDDVideoportConnect;
  2213.   LPDDVIDEOPORTCONNECT = PDDVideoportConnect;
  2214.  
  2215. { TDDVideoportCaps structure }
  2216.  
  2217.   PDDVideoportCaps = ^TDDVideoportCaps;
  2218.   TDDVideoportCaps = record
  2219.     dwSize: DWORD;                          // size of the TDDVideoportCaps structure
  2220.     dwFlags: DWORD;                         // indicates which fields contain data
  2221.     dwMaxWidth: DWORD;                      // max width of the video port field
  2222.     dwMaxVBIWidth: DWORD;                   // max width of the VBI data
  2223.     dwMaxHeight: DWORD;                     // max height of the video port field
  2224.     dwVideoPortID: DWORD;                   // Video port ID (0 - (dwMaxVideoPorts -1))
  2225.     dwCaps: DWORD;                          // Video port capabilities
  2226.     dwFX: DWORD;                            // More video port capabilities
  2227.     dwNumAutoFlipSurfaces: DWORD;           // Number of autoflippable surfaces
  2228.     dwAlignVideoPortBoundary: DWORD;        // Byte restriction of placement within the surface
  2229.     dwAlignVideoPortPrescaleWidth: DWORD;   // Byte restriction of width after prescaling
  2230.     dwAlignVideoPortCropBoundary: DWORD;    // Byte restriction of left cropping
  2231.     dwAlignVideoPortCropWidth: DWORD;       // Byte restriction of cropping width
  2232.     dwPreshrinkXStep: DWORD;                // Width can be shrunk in steps of 1/x
  2233.     dwPreshrinkYStep: DWORD;                // Height can be shrunk in steps of 1/x
  2234.     dwNumVBIAutoFlipSurfaces: DWORD;        // Number of VBI autoflippable surfaces
  2235.     dwNumPreferredAutoflip: DWORD;          // Optimal number of autoflippable surfaces for hardware
  2236.     wNumFilterTapsX: WORD;                  // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.)
  2237.     wNumFilterTapsY: WORD;                  // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.)
  2238.   end;
  2239.  
  2240.   DDVIDEOPORTCAPS = TDDVideoportCaps;
  2241.   LPDDVIDEOPORTCAPS = PDDVideoportCaps;
  2242.  
  2243. { TDDVideoportDesc structure }
  2244.  
  2245.   PDDVideoportDesc = ^TDDVideoportDesc;
  2246.   TDDVideoportDesc = record
  2247.     dwSize: DWORD;                       // size of the TDDVideoportDesc structure
  2248.     dwFieldWidth: DWORD;                 // width of the video port field
  2249.     dwVBIWidth: DWORD;                   // width of the VBI data
  2250.     dwFieldHeight: DWORD;                // height of the video port field
  2251.     dwMicrosecondsPerField: DWORD;       // Microseconds per video field
  2252.     dwMaxPixelsPerSecond: DWORD;         // Maximum pixel rate per second
  2253.     dwVideoPortID: DWORD;                // Video port ID (0 - (dwMaxVideoPorts -1))
  2254.     dwReserved1: DWORD;                  // Reserved for future use - set to zero
  2255.     VideoPortType: TDDVideoportConnect;   // Description of video port connection
  2256.     dwReserved2: DWORD;                  // Reserved for future use - set to zero
  2257.     dwReserved3: DWORD;                  // Reserved for future use - set to zero
  2258.   end;
  2259.  
  2260.   DDVIDEOPORTDESC = TDDVideoportDesc;
  2261.   LPDDVIDEOPORTDESC = PDDVideoportDesc;
  2262.  
  2263. { TDDVideoportInfo structure }
  2264.  
  2265.   PDDVideoportInfo = ^TDDVideoportInfo;
  2266.   TDDVideoportInfo = record
  2267.     dwSize: DWORD;                            // Size of the structure
  2268.     dwOriginX: DWORD;                         // Placement of the video data within the surface.
  2269.     dwOriginY: DWORD;                         // Placement of the video data within the surface.
  2270.     dwVPFlags: DWORD;                         // Video port options
  2271.     rCrop: TRect;                             // Cropping rectangle (optional).
  2272.     dwPrescaleWidth: DWORD;                   // Determines pre-scaling/zooming in the X direction (optional).
  2273.     dwPrescaleHeight: DWORD;                  // Determines pre-scaling/zooming in the Y direction (optional).
  2274.     lpddpfInputFormat: PDDPixelFormat;        // Video format written to the video port
  2275.     lpddpfVBIInputFormat: PDDPixelFormat;     // Input format of the VBI data
  2276.     lpddpfVBIOutputFormat: PDDPixelFormat;    // Output format of the data
  2277.     dwVBIHeight: DWORD;                       // Specifies the number of lines of data within the vertical blanking interval.
  2278.     dwReserved1: DWORD;                       // Reserved for future use - set to zero
  2279.     dwReserved2: DWORD;                       // Reserved for future use - set to zero
  2280.   end;
  2281.  
  2282.   DDVIDEOPORTINFO = TDDVideoportInfo;
  2283.   LPDDVIDEOPORTINFO = PDDVideoportInfo;
  2284.  
  2285. { TDDVideoportBandWidth structure }
  2286.  
  2287.   PDDVideoportBandWidth = ^TDDVideoportBandWidth;
  2288.   TDDVideoportBandWidth = record
  2289.     dwSize: DWORD;                 // Size of the structure
  2290.     dwCaps: DWORD;
  2291.     dwOverlay: DWORD;              // Zoom factor at which overlay is supported
  2292.     dwColorkey: DWORD;             // Zoom factor at which overlay w/ colorkey is supported
  2293.     dwYInterpolate: DWORD;         // Zoom factor at which overlay w/ Y interpolation is supported
  2294.     dwYInterpAndColorkey: DWORD;   // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
  2295.     dwReserved1: DWORD;            // Reserved for future use - set to zero
  2296.     dwReserved2: DWORD;            // Reserved for future use - set to zero
  2297.   end;
  2298.  
  2299.   DDVIDEOPORTBANDWIDTH = TDDVideoportBandWidth;
  2300.   LPDDVIDEOPORTBANDWIDTH = PDDVideoportBandWidth;
  2301.  
  2302. { TDDVideoportStatus structure }
  2303.  
  2304.   PDDVideoportStatus = ^TDDVideoportStatus;
  2305.   TDDVideoportStatus = record
  2306.     dwSize: DWORD;                       // Size of the structure
  2307.     bInUse: BOOL;                        // TRUE if video port is currently being used
  2308.     dwFlags: DWORD;                      // Currently not used
  2309.     dwReserved1: DWORD;                  // Reserved for future use
  2310.     VideoPortType: TDDVideoportConnect;   // Information about the connection
  2311.     dwReserved2: DWORD;                  // Reserved for future use
  2312.     dwReserved3: DWORD;                  // Reserved for future use
  2313.   end;
  2314.  
  2315.   DDVIDEOPORTSTATUS = TDDVideoportStatus;
  2316.   LPDDVIDEOPORTSTATUS = PDDVideoportStatus;
  2317.  
  2318. { API's }
  2319.  
  2320.   TDDEnumVideoCallback = function(const lpDDVideoPortCaps: TDDVideoportCaps;
  2321.       lpContext: Pointer): HResult; stdcall;
  2322.   LPDDENUMVIDEOCALLBACK = TDDEnumVideoCallback;
  2323.  
  2324. { IDirectDrawVideoPortContainer Interface }
  2325.  
  2326.   IDDVideoPortContainer = interface(IUnknown)
  2327.     ['{6C142760-A733-11CE-A521-0020AF0BE560}']
  2328.     // IDDVideoPortContainer methods
  2329.     function CreateVideoPort(dwFlags: DWORD; const lpDDVideoPortDesc:
  2330.         TDDVideoportDesc; out lplpDDVideoPort: IDirectDrawVideoPort;
  2331.         pUnkOuter: IUnknown): HResult; stdcall;
  2332.     function EnumVideoPorts(dwFlags: DWORD;
  2333.         const lpDDVideoPortCaps: TDDVideoportCaps; lpContext: Pointer;
  2334.         lpEnumVideoCallback: TDDEnumVideoCallback): HResult; stdcall;
  2335.     function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD;
  2336.         var lpConnectInfo: TDDVideoportConnect): HResult; stdcall;
  2337.     function QueryVideoPortStatus(dwPortId: DWORD;
  2338.         var lpVPStatus: TDDVideoportStatus): HResult; stdcall;
  2339.   end;
  2340.  
  2341. { IDirectDrawVideoPort Interface }
  2342.  
  2343.   IDirectDrawVideoPort = interface(IUnknown)
  2344.     ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}']
  2345.     // IDirectDrawVideoPort methods
  2346.     function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD): HResult; stdcall;
  2347.     function GetBandwidthInfo(const lpddpfFormat: TDDPixelFormat; dwWidth: DWORD;
  2348.         dwHeight: DWORD; dwFlags: DWORD; var lpBandwidth: TDDVideoportBandWidth): HResult; stdcall;
  2349.     function GetColorControls(var lpColorControl: TDDColorControl): HResult; stdcall;
  2350.     function GetInputFormats(var lpNumFormats: DWORD; var lpFormats:
  2351.         TDDPixelFormat; dwFlags: DWORD): HResult; stdcall;
  2352.     function GetOutputFormats(const lpInputFormat: TDDPixelFormat;
  2353.         var lpNumFormats: DWORD; var lpFormats: TDDPixelFormat; dwFlags: DWORD): HResult; stdcall;
  2354.     function GetFieldPolarity(var lpbVideoField: BOOL): HResult; stdcall;
  2355.     function GetVideoLine(var lpdwLine: DWORD): HResult; stdcall;
  2356.     function GetVideoSignalStatus(varlpdwStatus: DWORD): HResult; stdcall;
  2357.     function SetColorControls(const lpColorControl: TDDColorControl): HResult; stdcall;
  2358.     function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD): HResult; stdcall;
  2359.     function StartVideo(const lpVideoInfo: TDDVideoportInfo): HResult; stdcall;
  2360.     function StopVideo: HResult; stdcall;
  2361.     function UpdateVideo(const lpVideoInfo: TDDVideoportInfo): HResult; stdcall;
  2362.     function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD): HResult; stdcall;
  2363.   end;
  2364.  
  2365.  
  2366. const
  2367. { Video Port Flags }
  2368.  
  2369.   DDVPD_WIDTH             = $00000001;
  2370.   DDVPD_HEIGHT            = $00000002;
  2371.   DDVPD_ID                = $00000004;
  2372.   DDVPD_CAPS              = $00000008;
  2373.   DDVPD_FX                = $00000010;
  2374.   DDVPD_AUTOFLIP          = $00000020;
  2375.   DDVPD_ALIGN             = $00000040;
  2376.   DDVPD_PREFERREDAUTOFLIP = $00000080;
  2377.   DDVPD_FILTERQUALITY     = $00000100;
  2378.  
  2379. { TDDVideoportConnect flags }
  2380.  
  2381.   DDVPCONNECT_DOUBLECLOCK      = $00000001;
  2382.   DDVPCONNECT_VACT             = $00000002;
  2383.   DDVPCONNECT_INVERTPOLARITY   = $00000004;
  2384.   DDVPCONNECT_DISCARDSVREFDATA = $00000008;
  2385.   DDVPCONNECT_HALFLINE         = $00000010;
  2386.   DDVPCONNECT_INTERLACED       = $00000020;
  2387.   DDVPCONNECT_SHAREEVEN        = $00000040;
  2388.   DDVPCONNECT_SHAREODD         = $00000080;
  2389.  
  2390. { TDDVideoportDesc caps }
  2391.  
  2392.   DDVPCAPS_AUTOFLIP               = $00000001;
  2393.   DDVPCAPS_INTERLACED             = $00000002;
  2394.   DDVPCAPS_NONINTERLACED          = $00000004;
  2395.   DDVPCAPS_READBACKFIELD          = $00000008;
  2396.   DDVPCAPS_READBACKLINE           = $00000010;
  2397.   DDVPCAPS_SHAREABLE              = $00000020;
  2398.   DDVPCAPS_SKIPEVENFIELDS         = $00000040;
  2399.   DDVPCAPS_SKIPODDFIELDS          = $00000080;
  2400.   DDVPCAPS_SYNCMASTER             = $00000100;
  2401.   DDVPCAPS_VBISURFACE             = $00000200;
  2402.   DDVPCAPS_COLORCONTROL           = $00000400;
  2403.   DDVPCAPS_OVERSAMPLEDVBI         = $00000800;
  2404.   DDVPCAPS_SYSTEMMEMORY           = $00001000;
  2405.   DDVPCAPS_VBIANDVIDEOINDEPENDENT = $00002000;
  2406.   DDVPCAPS_HARDWAREDEINTERLACE    = $00004000;
  2407.  
  2408. { TDDVideoportDesc FX }
  2409.  
  2410.   DDVPFX_CROPTOPDATA     = $00000001;
  2411.   DDVPFX_CROPX           = $00000002;
  2412.   DDVPFX_CROPY           = $00000004;
  2413.   DDVPFX_INTERLEAVE      = $00000008;
  2414.   DDVPFX_MIRRORLEFTRIGHT = $00000010;
  2415.   DDVPFX_MIRRORUPDOWN    = $00000020;
  2416.   DDVPFX_PRESHRINKX      = $00000040;
  2417.   DDVPFX_PRESHRINKY      = $00000080;
  2418.   DDVPFX_PRESHRINKXB     = $00000100;
  2419.   DDVPFX_PRESHRINKYB     = $00000200;
  2420.   DDVPFX_PRESHRINKXS     = $00000400;
  2421.   DDVPFX_PRESHRINKYS     = $00000800;
  2422.   DDVPFX_PRESTRETCHX     = $00001000;
  2423.   DDVPFX_PRESTRETCHY     = $00002000;
  2424.   DDVPFX_PRESTRETCHXN    = $00004000;
  2425.   DDVPFX_PRESTRETCHYN    = $00008000;
  2426.   DDVPFX_VBICONVERT      = $00010000;
  2427.   DDVPFX_VBINOSCALE      = $00020000;
  2428.   DDVPFX_IGNOREVBIXCROP  = $00040000;
  2429.   DDVPFX_VBINOINTERLEAVE = $00080000;
  2430.  
  2431. { TDDVideoportInfo flags }
  2432.  
  2433.   DDVP_AUTOFLIP            = $00000001;
  2434.   DDVP_CONVERT             = $00000002;
  2435.   DDVP_CROP                = $00000004;
  2436.   DDVP_INTERLEAVE          = $00000008;
  2437.   DDVP_MIRRORLEFTRIGHT     = $00000010;
  2438.   DDVP_MIRRORUPDOWN        = $00000020;
  2439.   DDVP_PRESCALE            = $00000040;
  2440.   DDVP_SKIPEVENFIELDS      = $00000080;
  2441.   DDVP_SKIPODDFIELDS       = $00000100;
  2442.   DDVP_SYNCMASTER          = $00000200;
  2443.   DDVP_VBICONVERT          = $00000400;
  2444.   DDVP_VBINOSCALE          = $00000800;
  2445.   DDVP_OVERRIDEBOBWEAVE    = $00001000;
  2446.   DDVP_IGNOREVBIXCROP      = $00002000;
  2447.   DDVP_HARDWAREDEINTERLACE = $00008000;
  2448.  
  2449. { DirectDrawVideoport GetInputFormat/GetOutputFormat flags }
  2450.  
  2451.   DDVPFORMAT_VIDEO = $00000001;
  2452.   DDVPFORMAT_VBI = $00000002;
  2453.  
  2454. { DirectDrawVideoport SetTargetSurface flags }
  2455.  
  2456.   DDVPTARGET_VIDEO = $00000001;
  2457.   DDVPTARGET_VBI = $00000002;
  2458.  
  2459. { DirectDrawVideoport WaitForSync flags }
  2460.  
  2461.   DDVPWAIT_BEGIN = $00000001;
  2462.   DDVPWAIT_END = $00000002;
  2463.   DDVPWAIT_LINE = $00000003;
  2464.  
  2465. { DirectDrawVideoport flip flags }
  2466.  
  2467.   DDVPFLIP_VIDEO = $00000001;
  2468.   DDVPFLIP_VBI = $00000002;
  2469.  
  2470. { DirectDrawVideoport GetVideoSiginalStatus values }
  2471.  
  2472.   DDVPSQ_NOSIGNAL = $00000001;
  2473.   DDVPSQ_SIGNALOK = $00000002;
  2474.  
  2475. { TDDVideoportBandWidth Flags }
  2476.  
  2477.   DDVPB_VIDEOPORT = $00000001;
  2478.   DDVPB_OVERLAY = $00000002;
  2479.   DDVPB_TYPE = $00000004;
  2480.  
  2481. { TDDVideoportBandWidth Caps }
  2482.  
  2483.   DDVPBCAPS_SOURCE = $00000001;
  2484.   DDVPBCAPS_DESTINATION = $00000002;
  2485.  
  2486. { IDDVideoportContainer.CreateVideoPort flags }
  2487.  
  2488.   DDVPCREATE_VBIONLY   = $00000001;
  2489.   DDVPCREATE_VIDEOONLY = $00000002;
  2490.  
  2491. { TDDVideoportStatus flags }
  2492.  
  2493.   DDVPSTATUS_VBIONLY   = $00000001;
  2494.   DDVPSTATUS_VIDEOONLY = $00000002;
  2495.  
  2496. (*==========================================================================;
  2497.  *
  2498.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  2499.  *
  2500.  *  File:       d3dtypes.h
  2501.  *  Content:    Direct3D types include file
  2502.  *
  2503.  ***************************************************************************)
  2504.  
  2505. type
  2506.   TD3DValue = Single;
  2507.   D3DValue = TD3DValue;
  2508.  
  2509.   TD3DFixed = Longint;
  2510.   D3DFIXED = TD3DFixed;
  2511.  
  2512.   TD3DColor = DWORD;
  2513.   D3DCOLOR = TD3DColor;
  2514.  
  2515. function D3DVALP(val: TD3DValue; prec: Integer): TD3DValue;
  2516. function D3DVAL(val: TD3DValue): TD3DValue;
  2517. function D3DDivide(a, b: TD3DValue): TD3DValue;
  2518. function D3DMultiply(a, b: TD3DValue): TD3DValue;
  2519.  
  2520. (*
  2521.  * Format of CI colors is
  2522.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2523.  *  |    alpha      |         color index           |   fraction    |
  2524.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2525.  *)
  2526.  
  2527. function CI_GETALPHA(ci: Integer): Byte;
  2528. function CI_GETINDEX(ci: Integer): Word;
  2529. function CI_GETFRACTION(ci: Integer): Byte;
  2530. function CI_ROUNDINDEX(ci: Integer): Integer;
  2531. function CI_MASKALPHA(ci: Integer): Integer;
  2532. function CI_MAKE(a: Byte; i: Word; f: Byte): Integer;
  2533.  
  2534. (*
  2535.  * Format of RGBA colors is
  2536.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2537.  *  |    alpha      |      red      |     green     |     blue      |
  2538.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2539.  *)
  2540.  
  2541. function RGBA_GETALPHA(rgb: TD3DColor): Byte;
  2542. function RGBA_GETRED(rgb: TD3DColor): Byte;
  2543. function RGBA_GETGREEN(rgb: TD3DColor): Byte;
  2544. function RGBA_GETBLUE(rgb: TD3DColor): Byte;
  2545. function RGBA_MAKE(r, g, b, a: Byte): TD3DColor;
  2546.  
  2547. (* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
  2548.  * The float values must be in the range 0..1
  2549.  *)
  2550.  
  2551. function D3DRGB(r, g, b: TD3DValue): TD3DColor;
  2552. function D3DRGBA(r, g, b, a: TD3DValue): TD3DColor;
  2553.  
  2554. (*
  2555.  * Format of RGB colors is
  2556.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2557.  *  |    ignored    |      red      |     green     |     blue      |
  2558.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2559.  *)
  2560.  
  2561. function RGB_GETRED(rgb: TD3DColor): Byte;
  2562. function RGB_GETGREEN(rgb: TD3DColor): Byte;
  2563. function RGB_GETBLUE(rgb: TD3DColor): Byte;
  2564. function RGBA_SETALPHA(rgba: TD3DColor; x: Byte): TD3DColor;
  2565. function RGB_MAKE(r, g, b: Byte): TD3DColor;
  2566. function RGBA_TORGB(rgba: TD3DColor): TD3DColor;
  2567. function RGB_TORGBA(rgb: TD3DColor): TD3DColor;
  2568.  
  2569. const
  2570. { Flags for Enumerate functions }
  2571.  
  2572.   D3DENUMRET_CANCEL = DDENUMRET_CANCEL;
  2573.   D3DENUMRET_OK     = DDENUMRET_OK;
  2574.  
  2575. type
  2576.   TD3DValidateCallback = function(lpUserArg: Pointer; dwOffset: DWORD): HResult; stdcall;
  2577.   LPD3DVALIDATECALLBACK = TD3DValidateCallback;
  2578.  
  2579.   TD3DEnumTextureFormatsCalback = function(const lpDdsd: TDDSurfaceDesc;
  2580.       lpContext: Pointer): HResult; stdcall;
  2581.   LPD3DENUMTEXTUREFORMATSCALLBACK = TD3DEnumTextureFormatsCalback;
  2582.  
  2583.   TD3DEnumPixelFormatsCallback = function(const lpDDPixFmt: TDDPixelFormat;
  2584.       lpContext: Pointer): HResult; stdcall;
  2585.  
  2586.   TD3DMaterialHandle = DWORD;
  2587.   D3DMATERIALHANDLE = TD3DMaterialHandle;
  2588.  
  2589.   TD3DTextureHandle = DWORD;
  2590.   D3DTEXTUREHANDLE = TD3DTextureHandle;
  2591.  
  2592.   TD3DMatrixHandle = DWORD;
  2593.   D3DMATRIXHANDLE = TD3DMatrixHandle;
  2594.  
  2595. { TD3DColorValue structure }
  2596.  
  2597.   PD3DColorValue = ^TD3DColorValue;
  2598.   TD3DColorValue = record
  2599.     case Integer of
  2600.     0: (
  2601.       r: TD3DValue;
  2602.       g: TD3DValue;
  2603.       b: TD3DValue;
  2604.       a: TD3DValue;
  2605.       );
  2606.     1: (
  2607.       dvR: TD3DValue;
  2608.       dvG: TD3DValue;
  2609.       dvB: TD3DValue;
  2610.       dvA: TD3DValue;
  2611.       );
  2612.   end;
  2613.  
  2614.   D3DCOLORVALUE = TD3DColorValue;
  2615.  
  2616. { TD3DRect structure }
  2617.  
  2618.   PD3DRect = ^TD3DRect;
  2619.   TD3DRect = record
  2620.     case Integer of
  2621.     0: (
  2622.       x1: Longint;
  2623.       y1: Longint;
  2624.       x2: Longint;
  2625.       y2: Longint;
  2626.       );
  2627.     1: (
  2628.       lX1: Longint;
  2629.       lY1: Longint;
  2630.       lX2: Longint;
  2631.       lY2: Longint;
  2632.       );
  2633.   end;
  2634.  
  2635.   D3DRECT = TD3DRect;
  2636.   LPD3DRECT = PD3DRect;
  2637.  
  2638. { TD3DVector structure }
  2639.  
  2640.   PD3DVector = ^TD3DVector;
  2641.   TD3DVector = record
  2642.     case Integer of
  2643.     0: (
  2644.       x: TD3DValue;
  2645.       y: TD3DValue;
  2646.       z: TD3DValue;
  2647.       );
  2648.     1: (
  2649.       dvX: TD3DValue;
  2650.       dvY: TD3DValue;
  2651.       dvZ: TD3DValue;
  2652.       );
  2653.   end;
  2654.  
  2655.   D3DVECTOR = TD3DVector;
  2656.   LPD3DVECTOR = PD3DVector;
  2657.  
  2658. // Addition and subtraction
  2659. function VectorAdd(v1, v2: TD3DVector) : TD3DVector;
  2660. function VectorSub(v1, v2: TD3DVector) : TD3DVector;
  2661. // Scalar multiplication and division
  2662. function VectorMulS(v: TD3DVector; s: TD3DValue) : TD3DVector;
  2663. function VectorDivS(v: TD3DVector; s: TD3DValue) : TD3DVector;
  2664. // Memberwise multiplication and division
  2665. function VectorMul(v1, v2: TD3DVector) : TD3DVector;
  2666. function VectorDiv(v1, v2: TD3DVector) : TD3DVector;
  2667. // Vector dominance
  2668. function VectorSmaller(v1, v2: TD3DVector) : boolean;
  2669. function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
  2670. // Bitwise equality
  2671. function VectorEquel(v1, v2: TD3DVector) : boolean;
  2672. // Length-related functions
  2673. function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
  2674. function VectorMagnitude(v: TD3DVector) : TD3DValue;
  2675. // Returns vector with same direction and unit length
  2676. function VectorNormalize(v: TD3DVector) : TD3DVector;
  2677. // Return min/max component of the input vector
  2678. function VectorMin(v: TD3DVector) : TD3DValue;
  2679. function VectorMax(v: TD3DVector) : TD3DValue;
  2680. // Return memberwise min/max of input vectors
  2681. function VectorMinimize(v1, v2: TD3DVector) : TD3DVector;
  2682. function VectorMaximize(v1, v2: TD3DVector) : TD3DVector;
  2683. // Dot and cross product
  2684. function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
  2685. function VectorCrossProduct(v1, v2: TD3DVector) : TD3DVector;
  2686.  
  2687. type
  2688. { Vertex data types supported in an ExecuteBuffer. }
  2689.  
  2690. { TD3DHVertex structure }
  2691.  
  2692.   PD3DHVertex = ^TD3DHVertex;
  2693.   TD3DHVertex = record
  2694.     dwFlags: DWORD;        // Homogeneous clipping flags
  2695.     case Integer of
  2696.     0: (
  2697.       hx: TD3DValue;
  2698.       hy: TD3DValue;
  2699.       hz: TD3DValue;
  2700.       );
  2701.     1: (
  2702.       dvHX: TD3DValue;
  2703.       dvHY: TD3DValue;
  2704.       dvHZ: TD3DValue;
  2705.       );
  2706.   end;
  2707.  
  2708.   D3DHVERTEX = TD3DHVertex;
  2709.  
  2710. { TD3DTLVertex structure }
  2711.  
  2712.   PD3DTLVertex = ^TD3DTLVertex;
  2713.   TD3DTLVertex = record
  2714.     case Integer of
  2715.     0: (
  2716.       sx: TD3DValue;             // Screen coordinates
  2717.       sy: TD3DValue;
  2718.       sz: TD3DValue;
  2719.       rhw: TD3DValue;            // Reciprocal of homogeneous w
  2720.       color: TD3DColor;          // Vertex color
  2721.       specular: TD3DColor;       // Specular component of vertex
  2722.       tu: TD3DValue;             // Texture coordinates
  2723.       tv: TD3DValue;
  2724.       );
  2725.     1: (
  2726.       dvSX: TD3DValue;
  2727.       dvSY: TD3DValue;
  2728.       dvSZ: TD3DValue;
  2729.       dvRHW: TD3DValue;
  2730.       dcColor: TD3DColor;
  2731.       dcSpecular: TD3DColor;
  2732.       dvTU: TD3DValue;
  2733.       dvTV: TD3DValue;
  2734.       );
  2735.   end;
  2736.  
  2737.   D3DTLVERTEX = TD3DTLVertex;
  2738.  
  2739. { TD3DLVertex structure }
  2740.  
  2741.   PD3DLVertex = ^TD3DLVertex;
  2742.   TD3DLVertex = record
  2743.     case Integer of
  2744.     0: (
  2745.       x: TD3DValue;             // Homogeneous coordinates
  2746.       y: TD3DValue;
  2747.       z: TD3DValue;
  2748.       dwReserved: DWORD;
  2749.       color: TD3DColor;         // Vertex color
  2750.       specular: TD3DColor;      // Specular component of vertex
  2751.       tu: TD3DValue;            // Texture coordinates
  2752.       tv: TD3DValue;
  2753.       );
  2754.     1: (
  2755.       dvX: TD3DValue;
  2756.       dvY: TD3DValue;
  2757.       dvZ: TD3DValue;
  2758.       _union1d: DWORD;
  2759.       dcColor: TD3DColor;
  2760.       dcSpecular: TD3DColor;
  2761.       dvTU: TD3DValue;
  2762.       dvTV: TD3DValue;
  2763.       );
  2764.   end;
  2765.  
  2766.   D3DLVERTEX = TD3DLVertex;
  2767.  
  2768. { TD3DVertex structure }
  2769.  
  2770.   PD3DVertex = ^TD3DVertex;
  2771.   TD3DVertex = record
  2772.     case Integer of
  2773.     0: (
  2774.       x: TD3DValue;             // Homogeneous coordinates
  2775.       y: TD3DValue;
  2776.       z: TD3DValue;
  2777.       nx: TD3DValue;            // Normal
  2778.       ny: TD3DValue;
  2779.       nz: TD3DValue;
  2780.       tu: TD3DValue;            // Texture coordinates
  2781.       tv: TD3DValue;
  2782.       );
  2783.     1: (
  2784.       dvX: TD3DValue;
  2785.       dvY: TD3DValue;
  2786.       dvZ: TD3DValue;
  2787.       dvNX: TD3DValue;
  2788.       dvNY: TD3DValue;
  2789.       dvNZ: TD3DValue;
  2790.       dvTU: TD3DValue;
  2791.       dvTV: TD3DValue;
  2792.       );
  2793.   end;
  2794.  
  2795.   D3DVERTEX = TD3DVertex;
  2796.  
  2797. { TD3DMatrix structure }
  2798.  
  2799.   PD3DMatrix = ^TD3DMatrix;
  2800.   TD3DMatrix = record
  2801.     _11, _12, _13, _14: TD3DValue;
  2802.     _21, _22, _23, _24: TD3DValue;
  2803.     _31, _32, _33, _34: TD3DValue;
  2804.     _41, _42, _43, _44: TD3DValue;
  2805.   end;
  2806.  
  2807.   D3DMATRIX = TD3DMatrix;
  2808.  
  2809. { TD3DViewport structure }
  2810.  
  2811.   PD3DViewport = ^TD3DViewport;
  2812.   TD3DViewport = record
  2813.     dwSize: DWORD;
  2814.     dwX: DWORD;
  2815.     dwY: DWORD;               // Top left
  2816.     dwWidth: DWORD;
  2817.     dwHeight: DWORD;          // Dimensions
  2818.     dvScaleX: TD3DValue;       // Scale homogeneous to screen
  2819.     dvScaleY: TD3DValue;       // Scale homogeneous to screen
  2820.     dvMaxX: TD3DValue;         // Min/max homogeneous x coord
  2821.     dvMaxY: TD3DValue;         // Min/max homogeneous y coord
  2822.     dvMinZ: TD3DValue;
  2823.     dvMaxZ: TD3DValue;         // Min/max homogeneous z coord
  2824.   end;
  2825.  
  2826.   D3DVIEWPORT = TD3DViewport;
  2827.  
  2828. { TD3DViewport2 structure }
  2829.  
  2830.   PD3DViewport2 = ^TD3DViewport2;
  2831.   TD3DViewport2 = record
  2832.     dwSize: DWORD;
  2833.     dwX: DWORD;
  2834.     dwY: DWORD;               // Top left
  2835.     dwWidth: DWORD;
  2836.     dwHeight: DWORD;          // Dimensions
  2837.     dvClipX: TD3DValue;        // Top left of clip volume
  2838.     dvClipY: TD3DValue;
  2839.     dvClipWidth: TD3DValue;    // Clip Volume Dimensions
  2840.     dvClipHeight: TD3DValue;
  2841.     dvMinZ: TD3DValue;
  2842.     dvMaxZ: TD3DValue;         // Min/max homogeneous z coord
  2843.   end;
  2844.  
  2845.   D3DVIEWPORT2 = TD3DViewport2;
  2846.  
  2847. { TD3DViewport2 structure }
  2848.  
  2849.   PD3DViewport7 = ^TD3DViewport7;
  2850.   TD3DViewport7 = record
  2851.     dwX: DWORD;
  2852.     dwY: DWORD;               // Top left
  2853.     dwWidth: DWORD;
  2854.     dwHeight: DWORD;          // Dimensions
  2855.     dvMinZ: TD3DValue;
  2856.     dvMaxZ: TD3DValue;         // Min/max homogeneous z coord
  2857.   end;
  2858.  
  2859.   D3DVIEWPORT7 = TD3DViewport7;
  2860.  
  2861. const
  2862. { Max number of user clipping planes, supported in D3D. }
  2863.   D3DMAXUSERCLIPPLANES = 32;
  2864.  
  2865. { These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE }
  2866.   D3DCLIPPLANE0 = 1 shl 0;
  2867.   D3DCLIPPLANE1 = 1 shl 1;
  2868.   D3DCLIPPLANE2 = 1 shl 2;
  2869.   D3DCLIPPLANE3 = 1 shl 3;
  2870.   D3DCLIPPLANE4 = 1 shl 4;
  2871.   D3DCLIPPLANE5 = 1 shl 5;
  2872.  
  2873. { Values for clip fields. }
  2874.  
  2875.   D3DCLIP_LEFT   = $00000001;
  2876.   D3DCLIP_RIGHT  = $00000002;
  2877.   D3DCLIP_TOP    = $00000004;
  2878.   D3DCLIP_BOTTOM = $00000008;
  2879.   D3DCLIP_FRONT  = $00000010;
  2880.   D3DCLIP_BACK   = $00000020;
  2881.   D3DCLIP_GEN0   = $00000040;
  2882.   D3DCLIP_GEN1   = $00000080;
  2883.   D3DCLIP_GEN2   = $00000100;
  2884.   D3DCLIP_GEN3   = $00000200;
  2885.   D3DCLIP_GEN4   = $00000400;
  2886.   D3DCLIP_GEN5   = $00000800;
  2887.  
  2888. { Values for d3d status. }
  2889.  
  2890.   D3DSTATUS_CLIPUNIONLEFT   = D3DCLIP_LEFT;
  2891.   D3DSTATUS_CLIPUNIONRIGHT  = D3DCLIP_RIGHT;
  2892.   D3DSTATUS_CLIPUNIONTOP    = D3DCLIP_TOP;
  2893.   D3DSTATUS_CLIPUNIONBOTTOM = D3DCLIP_BOTTOM;
  2894.   D3DSTATUS_CLIPUNIONFRONT  = D3DCLIP_FRONT;
  2895.   D3DSTATUS_CLIPUNIONBACK   = D3DCLIP_BACK;
  2896.   D3DSTATUS_CLIPUNIONGEN0   = D3DCLIP_GEN0;
  2897.   D3DSTATUS_CLIPUNIONGEN1   = D3DCLIP_GEN1;
  2898.   D3DSTATUS_CLIPUNIONGEN2   = D3DCLIP_GEN2;
  2899.   D3DSTATUS_CLIPUNIONGEN3   = D3DCLIP_GEN3;
  2900.   D3DSTATUS_CLIPUNIONGEN4   = D3DCLIP_GEN4;
  2901.   D3DSTATUS_CLIPUNIONGEN5   = D3DCLIP_GEN5;
  2902.  
  2903.   D3DSTATUS_CLIPINTERSECTIONLEFT   = $00001000;
  2904.   D3DSTATUS_CLIPINTERSECTIONRIGHT  = $00002000;
  2905.   D3DSTATUS_CLIPINTERSECTIONTOP    = $00004000;
  2906.   D3DSTATUS_CLIPINTERSECTIONBOTTOM = $00008000;
  2907.   D3DSTATUS_CLIPINTERSECTIONFRONT  = $00010000;
  2908.   D3DSTATUS_CLIPINTERSECTIONBACK   = $00020000;
  2909.   D3DSTATUS_CLIPINTERSECTIONGEN0   = $00040000;
  2910.   D3DSTATUS_CLIPINTERSECTIONGEN1   = $00080000;
  2911.   D3DSTATUS_CLIPINTERSECTIONGEN2   = $00100000;
  2912.   D3DSTATUS_CLIPINTERSECTIONGEN3   = $00200000;
  2913.   D3DSTATUS_CLIPINTERSECTIONGEN4   = $00400000;
  2914.   D3DSTATUS_CLIPINTERSECTIONGEN5   = $00800000;
  2915.   D3DSTATUS_ZNOTVISIBLE            = $01000000;
  2916.  
  2917.   D3DSTATUS_CLIPUNIONALL =
  2918.     D3DSTATUS_CLIPUNIONLEFT or
  2919.     D3DSTATUS_CLIPUNIONRIGHT or
  2920.     D3DSTATUS_CLIPUNIONTOP or
  2921.     D3DSTATUS_CLIPUNIONBOTTOM or
  2922.     D3DSTATUS_CLIPUNIONFRONT or
  2923.     D3DSTATUS_CLIPUNIONBACK or
  2924.     D3DSTATUS_CLIPUNIONGEN0 or
  2925.     D3DSTATUS_CLIPUNIONGEN1 or
  2926.     D3DSTATUS_CLIPUNIONGEN2 or
  2927.     D3DSTATUS_CLIPUNIONGEN3 or
  2928.     D3DSTATUS_CLIPUNIONGEN4 or
  2929.     D3DSTATUS_CLIPUNIONGEN5;
  2930.  
  2931.   D3DSTATUS_CLIPINTERSECTIONALL =
  2932.     D3DSTATUS_CLIPINTERSECTIONLEFT or
  2933.     D3DSTATUS_CLIPINTERSECTIONRIGHT or
  2934.     D3DSTATUS_CLIPINTERSECTIONTOP or
  2935.     D3DSTATUS_CLIPINTERSECTIONBOTTOM or
  2936.     D3DSTATUS_CLIPINTERSECTIONFRONT or
  2937.     D3DSTATUS_CLIPINTERSECTIONBACK or
  2938.     D3DSTATUS_CLIPINTERSECTIONGEN0 or
  2939.     D3DSTATUS_CLIPINTERSECTIONGEN1 or
  2940.     D3DSTATUS_CLIPINTERSECTIONGEN2 or
  2941.     D3DSTATUS_CLIPINTERSECTIONGEN3 or
  2942.     D3DSTATUS_CLIPINTERSECTIONGEN4 or
  2943.     D3DSTATUS_CLIPINTERSECTIONGEN5;
  2944.  
  2945.   D3DSTATUS_DEFAULT = (
  2946.     D3DSTATUS_CLIPINTERSECTIONALL or
  2947.     D3DSTATUS_ZNOTVISIBLE );
  2948.  
  2949. { Options for direct transform calls }
  2950.  
  2951.   D3DTRANSFORM_CLIPPED       = $00000001;
  2952.   D3DTRANSFORM_UNCLIPPED     = $00000002;
  2953.  
  2954. type
  2955. { TD3DTransformData structure }
  2956.  
  2957.   PD3DTransformData = ^TD3DTransformData;
  2958.   TD3DTransformData = record
  2959.     dwSize: DWORD;
  2960.     lpIn: Pointer;             // Input vertices
  2961.     dwInSize: DWORD;           // Stride of input vertices
  2962.     lpOut: Pointer;            // Output vertices
  2963.     dwOutSize: DWORD;          // Stride of output vertices
  2964.     lpHOut: PD3DHVertex;       // Output homogeneous vertices
  2965.     dwClip: DWORD;             // Clipping hint
  2966.     dwClipIntersection: DWORD;
  2967.     dwClipUnion: DWORD;        // Union of all clip flags
  2968.     drExtent: TD3DRect;         // Extent of transformed vertices
  2969.   end;
  2970.  
  2971.   D3DTRANSFORMDATA = TD3DTransformData;
  2972.   LPD3DTRANSFORMDATA = PD3DTransformData;
  2973.  
  2974. { TD3DLightingElement structure }
  2975.  
  2976.   PD3DLightingElement = ^TD3DLightingElement;
  2977.   TD3DLightingElement = record
  2978.     dvPosition: TD3DVector;           // Lightable point in model space
  2979.     dvNormal: TD3DVector;             // Normalised unit vector
  2980.   end;
  2981.  
  2982.   D3DLIGHTINGELEMENT = TD3DLightingElement;
  2983.   LPD3DLIGHTINGELEMENT = PD3DLightingElement;
  2984.  
  2985. { TD3DMaterial structure }
  2986.  
  2987.   PD3DMaterial = ^TD3DMaterial;
  2988.   TD3DMaterial = record
  2989.     dwSize: DWORD;
  2990.     case Integer of
  2991.     0: (
  2992.       diffuse: TD3DColorValue;        // Diffuse color RGBA
  2993.       ambient: TD3DColorValue;        // Ambient color RGB
  2994.       specular: TD3DColorValue;       // Specular 'shininess'
  2995.       emissive: TD3DColorValue;       // Emissive color RGB
  2996.       power: TD3DValue;               // Sharpness if specular highlight
  2997.       hTexture: TD3DTextureHandle;    // Handle to texture map
  2998.       dwRampSize: DWORD;
  2999.       );
  3000.     1: (
  3001.       dcvDiffuse: TD3DColorValue;
  3002.       dcvAmbient: TD3DColorValue;
  3003.       dcvSpecular: TD3DColorValue;
  3004.       dcvEmissive: TD3DColorValue;
  3005.       dvPower: TD3DValue;
  3006.       );
  3007.   end;
  3008.  
  3009.   D3DMATERIAL = TD3DMaterial;
  3010.   LPD3DMATERIAL = PD3DMaterial;
  3011.  
  3012. { TD3DMaterial7 structure }
  3013.  
  3014.   PD3DMaterial7 = ^TD3DMaterial7;
  3015.   TD3DMaterial7 = record
  3016.     case Integer of
  3017.     0: (
  3018.       diffuse: TD3DColorValue;        // Diffuse color RGBA
  3019.       ambient: TD3DColorValue;        // Ambient color RGB
  3020.       specular: TD3DColorValue;       // Specular 'shininess'
  3021.       emissive: TD3DColorValue;       // Emissive color RGB
  3022.       power: TD3DValue;               // Sharpness if specular highlight
  3023.       );
  3024.     1: (
  3025.       dcvDiffuse: TD3DColorValue;
  3026.       dcvAmbient: TD3DColorValue;
  3027.       dcvSpecular: TD3DColorValue;
  3028.       dcvEmissive: TD3DColorValue;
  3029.       dvPower: TD3DValue;
  3030.       );
  3031.   end;
  3032.  
  3033.   D3DMATERIAL7 = TD3DMaterial7;
  3034.   LPD3DMATERIAL7 = PD3DMaterial7;
  3035.  
  3036. { TD3DLightType }
  3037.  
  3038.   TD3DLightType = (
  3039.     D3DLIGHT_INVALID_0,
  3040.     D3DLIGHT_POINT,
  3041.     D3DLIGHT_SPOT,
  3042.     D3DLIGHT_DIRECTIONAL,
  3043.     D3DLIGHT_PARALLELPOINT
  3044. {$IFNDEF SupportDirectX5},D3DLIGHT_GLSPOT{$ENDIF}
  3045.   );
  3046.  
  3047.   D3DLIGHTTYPE = TD3DLightType;
  3048.  
  3049. { TD3DLight structure }
  3050.  
  3051.   PD3DLight = ^TD3DLight;
  3052.   TD3DLight = record
  3053.     dwSize: DWORD;
  3054.     dltType: TD3DLightType;     // Type of light source
  3055.     dcvColor: TD3DColorValue;   // Color of light
  3056.     dvPosition: TD3DVector;     // Position in world space
  3057.     dvDirection: TD3DVector;    // Direction in world space
  3058.     dvRange: TD3DValue;         // Cutoff range
  3059.     dvFalloff: TD3DValue;       // Falloff
  3060.     dvAttenuation0: TD3DValue;  // Constant attenuation
  3061.     dvAttenuation1: TD3DValue;  // Linear attenuation
  3062.     dvAttenuation2: TD3DValue;  // Quadratic attenuation
  3063.     dvTheta: TD3DValue;         // Inner angle of spotlight cone
  3064.     dvPhi: TD3DValue;           // Outer angle of spotlight cone
  3065.   end;
  3066.  
  3067.   D3DLIGHT = TD3DLight;
  3068.   LPD3DLIGHT = PD3DLight;
  3069.  
  3070. { TD3DLight7 structure }
  3071.  
  3072.   PD3DLight7 = ^TD3DLight7;
  3073.   TD3DLight7 = record
  3074.     dltType: TD3DLightType;     // Type of light source
  3075.     dcvDiffuse: TD3DColorValue; // Diffuse color of light
  3076.     dcvSpecular: TD3DColorValue;// Specular color of light
  3077.     dcvAmbient: TD3DColorValue; // Ambient color of light
  3078.     dvPosition: TD3DVector;     // Position in world space
  3079.     dvDirection: TD3DVector;    // Direction in world space
  3080.     dvRange: TD3DValue;         // Cutoff range
  3081.     dvFalloff: TD3DValue;       // Falloff
  3082.     dvAttenuation0: TD3DValue;  // Constant attenuation
  3083.     dvAttenuation1: TD3DValue;  // Linear attenuation
  3084.     dvAttenuation2: TD3DValue;  // Quadratic attenuation
  3085.     dvTheta: TD3DValue;         // Inner angle of spotlight cone
  3086.     dvPhi: TD3DValue;           // Outer angle of spotlight cone
  3087.   end;
  3088.  
  3089.   D3DLIGHT7 = TD3DLight7;
  3090.   LPD3DLIGHT7 = PD3DLight7;
  3091.  
  3092. { Structure defining a light source and its properties. }
  3093.  
  3094. const
  3095. { flags bits }
  3096.  
  3097.   D3DLIGHT_ACTIVE                       = $00000001;
  3098.   D3DLIGHT_NO_SPECULAR                  = $00000002;
  3099.   D3DLIGHT_ALL                          = D3DLIGHT_ACTIVE or D3DLIGHT_NO_SPECULAR;
  3100.  
  3101. { maximum valid light range }
  3102.   D3DLIGHT_RANGE_MAX: TD3DValue = 3.4 * 10e+38;
  3103.  
  3104. type
  3105. { TD3DLight2 structure }
  3106.  
  3107.   PD3DLight2 = ^TD3DLight2;
  3108.   TD3DLight2 = record
  3109.     dwSize: DWORD;
  3110.     dltType: TD3DLightType;     // Type of light source
  3111.     dcvColor: TD3DColorValue;   // Color of light
  3112.     dvPosition: TD3DVector;     // Position in world space
  3113.     dvDirection: TD3DVector;    // Direction in world space
  3114.     dvRange: TD3DValue;         // Cutoff range
  3115.     dvFalloff: TD3DValue;       // Falloff
  3116.     dvAttenuation0: TD3DValue;  // Constant attenuation
  3117.     dvAttenuation1: TD3DValue;  // Linear attenuation
  3118.     dvAttenuation2: TD3DValue;  // Quadratic attenuation
  3119.     dvTheta: TD3DValue;         // Inner angle of spotlight cone
  3120.     dvPhi: TD3DValue;           // Outer angle of spotlight cone
  3121.     dwFlags: DWORD;
  3122.   end;
  3123.  
  3124.   D3DLIGHT2 = TD3DLight2;
  3125.   LPD3DLIGHT2 = PD3DLight2;
  3126.  
  3127. { TD3DLightData structure }
  3128.  
  3129.   PD3DLightData = ^TD3DLightData;
  3130.   TD3DLightData = record
  3131.     dwSize: DWORD;
  3132.     lpIn: PD3DLightingElement;   // Input positions and normals
  3133.     dwInSize: DWORD;             // Stride of input elements
  3134.     lpOut: PD3DTLVertex;         // Output colors
  3135.     dwOutSize: DWORD;            // Stride of output colors
  3136.   end;
  3137.  
  3138.   D3DLIGHTDATA = TD3DLightData;
  3139.   LPD3DLIGHTDATA = PD3DLightData;
  3140.  
  3141. (*
  3142.  * Before DX5, these values were in an enum called
  3143.  * D3DCOLORMODEL. This was not correct, since they are
  3144.  * bit flags. A driver can surface either or both flags
  3145.  * in the dcmColorModel member of D3DDEVICEDESC.
  3146.  *)
  3147.  
  3148. type
  3149.   TD3DColorModel = DWORD;
  3150.   D3DCOLORMODEL = TD3DColorModel;
  3151.  
  3152. const
  3153.   D3DCOLOR_INVALID_0 = 0;
  3154.   D3DCOLOR_MONO = 1;
  3155.   D3DCOLOR_RGB = 2;
  3156.  
  3157. { Options for clearing }
  3158.  
  3159. const
  3160.   D3DCLEAR_TARGET  = $00000001; // Clear target surface
  3161.   D3DCLEAR_ZBUFFER = $00000002; // Clear target z buffer
  3162.   D3DCLEAR_STENCIL = $00000004; // Clear stencil planes
  3163.  
  3164. { Supported op codes for execute instructions. }
  3165.  
  3166. type
  3167.   TD3DOpcode = (
  3168.     D3DOP_INVALID_0,
  3169.     D3DOP_POINT,
  3170.     D3DOP_LINE,
  3171.     D3DOP_TRIANGLE,
  3172.     D3DOP_MATRIXLOAD,
  3173.     D3DOP_MATRIXMULTIPLY,
  3174.     D3DOP_STATETRANSFORM,
  3175.     D3DOP_STATELIGHT,
  3176.     D3DOP_STATERENDER,
  3177.     D3DOP_PROCESSVERTICES,
  3178.     D3DOP_TEXTURELOAD,
  3179.     D3DOP_EXIT,
  3180.     D3DOP_BRANCHFORWARD,
  3181.     D3DOP_SPAN,
  3182.     D3DOP_SETSTATUS
  3183.   );
  3184.  
  3185.   D3DOPCODE = TD3DOpcode;
  3186.  
  3187. { TD3DInstruction structure }
  3188.  
  3189.   TD3DInstruction = record
  3190.     bOpcode: Byte;   // Instruction opcode
  3191.     bSize: Byte;     // Size of each instruction data unit
  3192.     wCount: WORD;    // Count of instruction data units to follow
  3193.   end;
  3194.   D3DINSTRUCTION = TD3DInstruction;
  3195.  
  3196. { TD3DTextureLoad structure }
  3197.  
  3198.   TD3DTextureLoad = record
  3199.     hDestTexture: TD3DTextureHandle;
  3200.     hSrcTexture: TD3DTextureHandle;
  3201.   end;
  3202.   D3DTEXTURELOAD = TD3DTextureLoad;
  3203.  
  3204. { TD3DPickRecord structure }
  3205.  
  3206.   TD3DPickRecord = record
  3207.     bOpcode: BYTE;
  3208.     bPad: BYTE;
  3209.     dwOffset: DWORD;
  3210.     dvZ: TD3DValue;
  3211.   end;
  3212.   D3DPICKRECORD = TD3DPickRecord;
  3213.  
  3214. { TD3DShadeMode }
  3215.  
  3216.   TD3DShadeMode = (
  3217.     D3DSHADE_INVALID_0,
  3218.     D3DSHADE_FLAT,
  3219.     D3DSHADE_GOURAUD,
  3220.     D3DSHADE_PHONG
  3221.   );
  3222.  
  3223.   D3DSHADEMODE = TD3DShadeMode;
  3224.  
  3225. { TD3DFillMode }
  3226.  
  3227.   TD3DFillMode = (
  3228.     D3DFILL_INVALID_0,
  3229.     D3DFILL_POINT,
  3230.     D3DFILL_WIREFRAME,
  3231.     D3DFILL_SOLID
  3232.   );
  3233.  
  3234.   D3DFILLMODE = TD3DFillMode;
  3235.  
  3236. { TD3DLinePattern structure }
  3237.  
  3238.   TD3DLinePattern = record
  3239.     wRepeatFactor: WORD;
  3240.     wLinePattern: WORD;
  3241.   end;
  3242.  
  3243.   D3DLINEPATTERN = TD3DLinePattern;
  3244.  
  3245. { TD3DTextureFilter }
  3246.  
  3247.   TD3DTextureFilter = (
  3248.     D3DFILTER_INVALID_0,
  3249.     D3DFILTER_NEAREST,
  3250.     D3DFILTER_LINEAR,
  3251.     D3DFILTER_MIPNEAREST,
  3252.     D3DFILTER_MIPLINEAR,
  3253.     D3DFILTER_LINEARMIPNEAREST,
  3254.     D3DFILTER_LINEARMIPLINEAR
  3255.   );
  3256.  
  3257.   D3DTEXTUREFILTER = TD3DTextureFilter;
  3258.  
  3259. { TD3DBlend }
  3260.  
  3261.   TD3DBlend = (
  3262.     D3DBLEND_INVALID_0,
  3263.     D3DBLEND_ZERO,
  3264.     D3DBLEND_ONE,
  3265.     D3DBLEND_SRCCOLOR,
  3266.     D3DBLEND_INVSRCCOLOR,
  3267.     D3DBLEND_SRCALPHA,
  3268.     D3DBLEND_INVSRCALPHA,
  3269.     D3DBLEND_DESTALPHA,
  3270.     D3DBLEND_INVDESTALPHA,
  3271.     D3DBLEND_DESTCOLOR,
  3272.     D3DBLEND_INVDESTCOLOR,
  3273.     D3DBLEND_SRCALPHASAT,
  3274.     D3DBLEND_BOTHSRCALPHA,
  3275.     D3DBLEND_BOTHINVSRCALPHA
  3276.   );
  3277.  
  3278.   D3DBLEND = TD3DBlend;
  3279.  
  3280. { TD3DTextureBlend }
  3281.  
  3282.   TD3DTextureBlend = (
  3283.     D3DTBLEND_INVALID_0,
  3284.     D3DTBLEND_DECAL,
  3285.     D3DTBLEND_MODULATE,
  3286.     D3DTBLEND_DECALALPHA,
  3287.     D3DTBLEND_MODULATEALPHA,
  3288.     D3DTBLEND_DECALMASK,
  3289.     D3DTBLEND_MODULATEMASK,
  3290.     D3DTBLEND_COPY,
  3291.     D3DTBLEND_ADD
  3292.   );
  3293.  
  3294.   D3DTEXTUREBLEND = TD3DTextureBlend;
  3295.  
  3296. { TD3DTextureAddress }
  3297.  
  3298.   TD3DTextureAddress = (
  3299.     D3DTADDRESS_INVALID_0,
  3300.     D3DTADDRESS_WRAP,
  3301.     D3DTADDRESS_MIRROR,
  3302.     D3DTADDRESS_CLAMP,
  3303.     D3DTADDRESS_BORDER
  3304.   );
  3305.  
  3306.   D3DTEXTUREADDRESS = TD3DTextureAddress;
  3307.  
  3308. { TD3DCull }
  3309.  
  3310.   TD3DCull = (
  3311.     D3DCULL_INVALID_0,
  3312.     D3DCULL_NONE,
  3313.     D3DCULL_CW,
  3314.     D3DCULL_CCW
  3315.   );
  3316.  
  3317.   D3DCULL = TD3DCull;
  3318.  
  3319. { TD3DCmpFunc }
  3320.  
  3321.   TD3DCmpFunc = (
  3322.     D3DCMP_INVALID_0,
  3323.     D3DCMP_NEVER,
  3324.     D3DCMP_LESS,
  3325.     D3DCMP_EQUAL,
  3326.     D3DCMP_LESSEQUAL,
  3327.     D3DCMP_GREATER,
  3328.     D3DCMP_NOTEQUAL,
  3329.     D3DCMP_GREATEREQUAL,
  3330.     D3DCMP_ALWAYS
  3331.   );
  3332.  
  3333.   D3DCMPFUNC = TD3DCmpFunc;
  3334.  
  3335. { TD3DStencilOp }
  3336.  
  3337.   TD3DStencilOp = (
  3338.     D3DSTENCILOP_INVALID_0,
  3339.     D3DSTENCILOP_KEEP,
  3340.     D3DSTENCILOP_ZERO,
  3341.     D3DSTENCILOP_REPLACE,
  3342.     D3DSTENCILOP_INCRSAT,
  3343.     D3DSTENCILOP_DECRSAT,
  3344.     D3DSTENCILOP_INVERT,
  3345.     D3DSTENCILOP_INCR,
  3346.     D3DSTENCILOP_DECR
  3347.   );
  3348.  
  3349.   D3DSTENCILOP = TD3DStencilOp;
  3350.  
  3351. { TD3DFogMode }
  3352.  
  3353.   TD3DFogMode = (
  3354.     D3DFOG_NONE,
  3355.     D3DFOG_EXP,
  3356.     D3DFOG_EXP2,
  3357.     D3DFOG_LINEAR
  3358.   );
  3359.  
  3360.   D3DFOGMODE = TD3DFogMode;
  3361.  
  3362. { TD3DZBufferType }
  3363.  
  3364.   TD3DZBufferType = (
  3365.     D3DZB_FALSE,
  3366.     D3DZB_TRUE,     // Z buffering
  3367.     D3DZB_USEW      // W buffering
  3368.   );
  3369.  
  3370.   D3DZBUFFERTYPE = TD3DZBufferType;
  3371.  
  3372. { TD3DAntialiasMode }
  3373.  
  3374.   TD3DAntialiasMode = (
  3375.     D3DANTIALIAS_NONE,
  3376.     D3DANTIALIAS_SORTDEPENDENT,
  3377.     D3DANTIALIAS_SORTINDEPENDENT
  3378.   );
  3379.  
  3380.   D3DANTIALIASMODE = TD3DAntialiasMode;
  3381.  
  3382. { TD3DVertexType }
  3383.  
  3384.   TD3DVertexType = (
  3385.     D3DVT_INVALID_0,
  3386.     D3DVT_VERTEX,
  3387.     D3DVT_LVERTEX,
  3388.     D3DVT_TLVERTEX
  3389.   );
  3390.  
  3391.   D3DVERTEXTYPE = TD3DVertexType;
  3392.  
  3393. { TD3DPrimitiveType }
  3394.  
  3395.   TD3DPrimitiveType = (
  3396.     D3DPT_INVALID_0,
  3397.     D3DPT_POINTLIST,
  3398.     D3DPT_LINELIST,
  3399.     D3DPT_LINESTRIP,
  3400.     D3DPT_TRIANGLELIST,
  3401.     D3DPT_TRIANGLESTRIP,
  3402.     D3DPT_TRIANGLEFAN
  3403.   );
  3404.  
  3405.   D3DPRIMITIVETYPE = TD3DPrimitiveType;
  3406.  
  3407. { Amount to add to a state to generate the override for that state. }
  3408.  
  3409. const
  3410.   D3DSTATE_OVERRIDE_BIAS = 256;
  3411.  
  3412. function D3DSTATE_OVERRIDE(typ: DWORD): DWORD;
  3413.  
  3414. { A state which sets the override flag for the specified state type. }
  3415.  
  3416. type
  3417. { TD3DTransformStateType }
  3418.  
  3419.   TD3DTransformStateType = (
  3420.     D3DTRANSFORMSTATE_INVALID_0,
  3421.     D3DTRANSFORMSTATE_WORLD,
  3422.     D3DTRANSFORMSTATE_VIEW,
  3423.     D3DTRANSFORMSTATE_PROJECTION,
  3424.  
  3425.     D3DTRANSFORMSTATE_WORLD1,
  3426.     D3DTRANSFORMSTATE_WORLD2,
  3427.     D3DTRANSFORMSTATE_WORLD3,
  3428.     D3DTRANSFORMSTATE_INVALID_7,
  3429.     D3DTRANSFORMSTATE_INVALID_8,
  3430.     D3DTRANSFORMSTATE_INVALID_9,
  3431.     D3DTRANSFORMSTATE_INVALID_10,
  3432.     D3DTRANSFORMSTATE_INVALID_11,
  3433.     D3DTRANSFORMSTATE_INVALID_12,
  3434.     D3DTRANSFORMSTATE_INVALID_13,
  3435.     D3DTRANSFORMSTATE_INVALID_14,
  3436.     D3DTRANSFORMSTATE_INVALID_15,
  3437.     D3DTRANSFORMSTATE_TEXTURE0,
  3438.     D3DTRANSFORMSTATE_TEXTURE1,
  3439.     D3DTRANSFORMSTATE_TEXTURE2,
  3440.     D3DTRANSFORMSTATE_TEXTURE3,
  3441.     D3DTRANSFORMSTATE_TEXTURE4,
  3442.     D3DTRANSFORMSTATE_TEXTURE5,
  3443.     D3DTRANSFORMSTATE_TEXTURE6,
  3444.     D3DTRANSFORMSTATE_TEXTURE7
  3445.   );
  3446.  
  3447.   D3DTRANSFORMSTATETYPE = TD3DTransformStateType;
  3448.  
  3449. { TD3DLightStateType }
  3450.  
  3451.   TD3DLightStateType = (
  3452.     D3DLIGHTSTATE_INVALID_0,
  3453.     D3DLIGHTSTATE_MATERIAL,
  3454.     D3DLIGHTSTATE_AMBIENT,
  3455.     D3DLIGHTSTATE_COLORMODEL,
  3456.     D3DLIGHTSTATE_FOGMODE,
  3457.     D3DLIGHTSTATE_FOGSTART,
  3458.     D3DLIGHTSTATE_FOGEND,
  3459.     D3DLIGHTSTATE_FOGDENSITY,
  3460.     D3DLIGHTSTATE_COLORVERTEX
  3461.   );
  3462.  
  3463.   D3DLIGHTSTATETYPE = TD3DLightStateType;
  3464.  
  3465. { TD3DRenderStateType }
  3466.  
  3467.   TD3DRenderStateType = (
  3468.     D3DRENDERSTATE_INVALID_0,
  3469.     D3DRENDERSTATE_TEXTUREHANDLE,       // Texture handle for legacy interfaces (Texture,Texture2)
  3470.     D3DRENDERSTATE_ANTIALIAS,           // TD3DAntialiasMode
  3471.     D3DRENDERSTATE_TEXTUREADDRESS,      // TD3DTextureAddress
  3472.     D3DRENDERSTATE_TEXTUREPERSPECTIVE,  // TRUE for perspective correction
  3473.     D3DRENDERSTATE_WRAPU,               // TRUE for wrapping in u
  3474.     D3DRENDERSTATE_WRAPV,               // TRUE for wrapping in v
  3475.     D3DRENDERSTATE_ZENABLE,             // TD3DZBufferType (or TRUE/FALSE for legacy)
  3476.     D3DRENDERSTATE_FILLMODE,            // TD3DFillMode
  3477.     D3DRENDERSTATE_SHADEMODE,           // TD3DShadeMode
  3478.     D3DRENDERSTATE_LINEPATTERN,         // TD3DLinePattern
  3479.     D3DRENDERSTATE_MONOENABLE,          // TRUE to enable mono rasterization
  3480.     D3DRENDERSTATE_ROP2,                // ROP2
  3481.     D3DRENDERSTATE_PLANEMASK,           // DWORD physical plane mask
  3482.     D3DRENDERSTATE_ZWRITEENABLE,        // TRUE to enable z writes
  3483.     D3DRENDERSTATE_ALPHATESTENABLE,     // TRUE to enable alpha tests
  3484.     D3DRENDERSTATE_LASTPIXEL,           // TRUE for last-pixel on lines
  3485.     D3DRENDERSTATE_TEXTUREMAG,          // TD3DTextureFilter
  3486.     D3DRENDERSTATE_TEXTUREMIN,          // TD3DTextureFilter
  3487.     D3DRENDERSTATE_SRCBLEND,            // TD3DBlend
  3488.     D3DRENDERSTATE_DESTBLEND,           // TD3DBlend
  3489.     D3DRENDERSTATE_TEXTUREMAPBLEND,     // TD3DTextureBlend
  3490.     D3DRENDERSTATE_CULLMODE,            // TD3DCull
  3491.     D3DRENDERSTATE_ZFUNC,               // TD3DCmpFunc
  3492.     D3DRENDERSTATE_ALPHAREF,            // TD3DFixed
  3493.     D3DRENDERSTATE_ALPHAFUNC,           // TD3DCmpFunc
  3494.     D3DRENDERSTATE_DITHERENABLE,        // TRUE to enable dithering
  3495.     D3DRENDERSTATE_ALPHABLENDENABLE,    // TRUE to enable alpha blending
  3496.     D3DRENDERSTATE_FOGENABLE,           // TRUE to enable fog
  3497.     D3DRENDERSTATE_SPECULARENABLE,      // TRUE to enable specular
  3498.     D3DRENDERSTATE_ZVISIBLE,            // TRUE to enable z checking
  3499.     D3DRENDERSTATE_SUBPIXEL,            // TRUE to enable subpixel correction
  3500.     D3DRENDERSTATE_SUBPIXELX,           // TRUE to enable correction in X only
  3501.     D3DRENDERSTATE_STIPPLEDALPHA,       // TRUE to enable stippled alpha
  3502.     D3DRENDERSTATE_FOGCOLOR,            // TD3DColor
  3503.     D3DRENDERSTATE_FOGTABLEMODE,        // TD3DFogMode
  3504.     D3DRENDERSTATE_FOGSTART,            // Fog start (for both vertex and pixel fog)
  3505.     D3DRENDERSTATE_FOGEND,              // Fog end
  3506.     D3DRENDERSTATE_FOGDENSITY,          // Fog density
  3507.     D3DRENDERSTATE_STIPPLEENABLE,       // TRUE to enable stippling
  3508.     D3DRENDERSTATE_EDGEANTIALIAS,       // TRUE to enable edge antialiasing
  3509.     D3DRENDERSTATE_COLORKEYENABLE,      // TRUE to enable source colorkeyed textures
  3510.     D3DRENDERSTATE_BORDERCOLOR,         // Border color for texturing w/border
  3511.     D3DRENDERSTATE_TEXTUREADDRESSU,     // Texture addressing mode for U coordinate
  3512.     D3DRENDERSTATE_TEXTUREADDRESSV,     // Texture addressing mode for V coordinate
  3513.     D3DRENDERSTATE_MIPMAPLODBIAS,       // TD3DValue Mipmap LOD bias
  3514.     D3DRENDERSTATE_ZBIAS,               // LONG Z bias
  3515.     D3DRENDERSTATE_RANGEFOGENABLE,      // Enables range-based fog
  3516.     D3DRENDERSTATE_ANISOTROPY,          // Max. anisotropy. 1 = no anisotropy
  3517.     D3DRENDERSTATE_FLUSHBATCH,          // Explicit flush for DP batching (DX5 Only)
  3518.     D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT,// BOOL enable sort-independent transparency
  3519.     D3DRENDERSTATE_STENCILENABLE,       // BOOL enable/disable stenciling
  3520.     D3DRENDERSTATE_STENCILFAIL,         // TD3DStencilOp to do if stencil test fails
  3521.     D3DRENDERSTATE_STENCILZFAIL,        // TD3DStencilOp to do if stencil test passes and Z test fails
  3522.     D3DRENDERSTATE_STENCILPASS,         // TD3DStencilOp to do if both stencil and Z tests pass
  3523.     D3DRENDERSTATE_STENCILFUNC ,        // TD3DCmpFunc fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true
  3524.     D3DRENDERSTATE_STENCILREF,          // Reference value used in stencil test
  3525.     D3DRENDERSTATE_STENCILMASK,         // Mask value used in stencil test
  3526.     D3DRENDERSTATE_STENCILWRITEMASK,    // Write mask applied to values written to stencil buffer
  3527.     D3DRENDERSTATE_TEXTUREFACTOR,       // TD3DColor used for multi-texture blend
  3528.     D3DRENDERSTATE_INVALID_61,
  3529.     D3DRENDERSTATE_INVALID_62,
  3530.     D3DRENDERSTATE_INVALID_63,
  3531.     D3DRENDERSTATE_STIPPLEPATTERN00,    // Stipple pattern 01...
  3532.     D3DRENDERSTATE_STIPPLEPATTERN01,
  3533.     D3DRENDERSTATE_STIPPLEPATTERN02,
  3534.     D3DRENDERSTATE_STIPPLEPATTERN03,
  3535.     D3DRENDERSTATE_STIPPLEPATTERN04,
  3536.     D3DRENDERSTATE_STIPPLEPATTERN05,
  3537.     D3DRENDERSTATE_STIPPLEPATTERN06,
  3538.     D3DRENDERSTATE_STIPPLEPATTERN07,
  3539.     D3DRENDERSTATE_STIPPLEPATTERN08,
  3540.     D3DRENDERSTATE_STIPPLEPATTERN09,
  3541.     D3DRENDERSTATE_STIPPLEPATTERN10,
  3542.     D3DRENDERSTATE_STIPPLEPATTERN11,
  3543.     D3DRENDERSTATE_STIPPLEPATTERN12,
  3544.     D3DRENDERSTATE_STIPPLEPATTERN13,
  3545.     D3DRENDERSTATE_STIPPLEPATTERN14,
  3546.     D3DRENDERSTATE_STIPPLEPATTERN15,
  3547.     D3DRENDERSTATE_STIPPLEPATTERN16,
  3548.     D3DRENDERSTATE_STIPPLEPATTERN17,
  3549.     D3DRENDERSTATE_STIPPLEPATTERN18,
  3550.     D3DRENDERSTATE_STIPPLEPATTERN19,
  3551.     D3DRENDERSTATE_STIPPLEPATTERN20,
  3552.     D3DRENDERSTATE_STIPPLEPATTERN21,
  3553.     D3DRENDERSTATE_STIPPLEPATTERN22,
  3554.     D3DRENDERSTATE_STIPPLEPATTERN23,
  3555.     D3DRENDERSTATE_STIPPLEPATTERN24,
  3556.     D3DRENDERSTATE_STIPPLEPATTERN25,
  3557.     D3DRENDERSTATE_STIPPLEPATTERN26,
  3558.     D3DRENDERSTATE_STIPPLEPATTERN27,
  3559.     D3DRENDERSTATE_STIPPLEPATTERN28,
  3560.     D3DRENDERSTATE_STIPPLEPATTERN29,
  3561.     D3DRENDERSTATE_STIPPLEPATTERN30,
  3562.     D3DRENDERSTATE_STIPPLEPATTERN31,
  3563.     D3DRENDERSTATE_INVALID_95,
  3564.     D3DRENDERSTATE_INVALID_96,
  3565.     D3DRENDERSTATE_INVALID_97,
  3566.     D3DRENDERSTATE_INVALID_98,
  3567.     D3DRENDERSTATE_INVALID_99,
  3568.     D3DRENDERSTATE_INVALID_100,
  3569.     D3DRENDERSTATE_INVALID_101,
  3570.     D3DRENDERSTATE_INVALID_102,
  3571.     D3DRENDERSTATE_INVALID_103,
  3572.     D3DRENDERSTATE_INVALID_104,
  3573.     D3DRENDERSTATE_INVALID_105,
  3574.     D3DRENDERSTATE_INVALID_106,
  3575.     D3DRENDERSTATE_INVALID_107,
  3576.     D3DRENDERSTATE_INVALID_108,
  3577.     D3DRENDERSTATE_INVALID_109,
  3578.     D3DRENDERSTATE_INVALID_110,
  3579.     D3DRENDERSTATE_INVALID_111,
  3580.     D3DRENDERSTATE_INVALID_112,
  3581.     D3DRENDERSTATE_INVALID_113,
  3582.     D3DRENDERSTATE_INVALID_114,
  3583.     D3DRENDERSTATE_INVALID_115,
  3584.     D3DRENDERSTATE_INVALID_116,
  3585.     D3DRENDERSTATE_INVALID_117,
  3586.     D3DRENDERSTATE_INVALID_118,
  3587.     D3DRENDERSTATE_INVALID_119,
  3588.     D3DRENDERSTATE_INVALID_120,
  3589.     D3DRENDERSTATE_INVALID_121,
  3590.     D3DRENDERSTATE_INVALID_122,
  3591.     D3DRENDERSTATE_INVALID_123,
  3592.     D3DRENDERSTATE_INVALID_124,
  3593.     D3DRENDERSTATE_INVALID_125,
  3594.     D3DRENDERSTATE_INVALID_126,
  3595.     D3DRENDERSTATE_INVALID_127,
  3596.     //
  3597.     // 128 values [128, 255] are reserved for texture coordinate wrap flags.
  3598.     // These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
  3599.     // a flags word preserves forward compatibility with texture coordinates
  3600.     // that are >2D.
  3601.     //
  3602.     D3DRENDERSTATE_WRAP0,               // wrap for 1st texture coord. set
  3603.     D3DRENDERSTATE_WRAP1,               // wrap for 2nd texture coord. set
  3604.     D3DRENDERSTATE_WRAP2,               // wrap for 3rd texture coord. set
  3605.     D3DRENDERSTATE_WRAP3,               // wrap for 4th texture coord. set
  3606.     D3DRENDERSTATE_WRAP4,               // wrap for 5th texture coord. set
  3607.     D3DRENDERSTATE_WRAP5,               // wrap for 6th texture coord. set
  3608.     D3DRENDERSTATE_WRAP6,               // wrap for 7th texture coord. set
  3609.     D3DRENDERSTATE_WRAP7,               // wrap for 8th texture coord. set
  3610.     D3DRENDERSTATE_CLIPPING,
  3611.     D3DRENDERSTATE_LIGHTING,
  3612.     D3DRENDERSTATE_EXTENTS,
  3613.     D3DRENDERSTATE_AMBIENT,
  3614.     D3DRENDERSTATE_FOGVERTEXMODE,
  3615.     D3DRENDERSTATE_COLORVERTEX,
  3616.     D3DRENDERSTATE_LOCALVIEWER,
  3617.     D3DRENDERSTATE_NORMALIZENORMALS,
  3618.     D3DRENDERSTATE_COLORKEYBLENDENABLE,
  3619.     D3DRENDERSTATE_DIFFUSEMATERIALSOURCE,
  3620.     D3DRENDERSTATE_SPECULARMATERIALSOURCE,
  3621.     D3DRENDERSTATE_AMBIENTMATERIALSOURCE,
  3622.     D3DRENDERSTATE_EMISSIVEMATERIALSOURCE,
  3623.     D3DRENDERSTATE_INVALID_149,
  3624.     D3DRENDERSTATE_INVALID_150,
  3625.     D3DRENDERSTATE_VERTEXBLEND,
  3626.     D3DRENDERSTATE_CLIPPLANEENABLE
  3627.   );
  3628.  
  3629.   D3DRENDERSTATETYPE = TD3DRenderStateType;
  3630.  
  3631.   TD3DMaterialColorSource = (
  3632.     D3DMCS_MATERIAL,                   // Color from material is used
  3633.     D3DMCS_COLOR1,                     // Diffuse vertex color is used
  3634.     D3DMCS_COLOR2                      // Specular vertex color is used
  3635.   );                                   // force 32-bit size enum
  3636.  
  3637. const
  3638. { For back-compatibility with legacy compilations }
  3639.   D3DRENDERSTATE_BLENDENABLE     = D3DRENDERSTATE_ALPHABLENDENABLE;
  3640.   D3DRENDERSTATE_FOGTABLESTART   = D3DRENDERSTATE_FOGSTART;
  3641.   D3DRENDERSTATE_FOGTABLEEND     = D3DRENDERSTATE_FOGEND;
  3642.   D3DRENDERSTATE_FOGTABLEDENSITY = D3DRENDERSTATE_FOGDENSITY;
  3643.  
  3644. { Bias to apply to the texture coordinate set to apply a wrap to. }
  3645.   D3DRENDERSTATE_WRAPBIAS = TD3DRenderStateType(128);
  3646.  
  3647. { Flags to construct the WRAP render states }
  3648.   D3DWRAP_U = $00000001;
  3649.   D3DWRAP_V = $00000002;
  3650.  
  3651. { Flags to construct the WRAP render states for 1D thru 4D texture coordinates }
  3652.   D3DWRAPCOORD_0 = $00000001;    // same as D3DWRAP_U
  3653.   D3DWRAPCOORD_1 = $00000002;    // same as D3DWRAP_V
  3654.   D3DWRAPCOORD_2 = $00000004;
  3655.   D3DWRAPCOORD_3 = $00000008;
  3656.  
  3657. function D3DRENDERSTATE_STIPPLEPATTERN(y: DWORD): TD3DRenderStateType;
  3658.  
  3659. type
  3660.  
  3661.   TD3DState = record
  3662.     case Integer of
  3663.     0: (
  3664.       dtstTransformStateType: TD3DTransformStateType;
  3665.       dwArg: array[0..0] of DWORD;
  3666.       );
  3667.     1: (
  3668.       dlstLightStateType: TD3DLightStateType;
  3669.       dvArg: array[0..0] of TD3DValue;
  3670.       );
  3671.     2: (
  3672.       drstRenderStateType: TD3DRenderStateType;
  3673.       );
  3674.   end;
  3675.  
  3676.   D3DSTATE = TD3DState;
  3677.  
  3678. { TD3DMatrixLoad structure }
  3679.  
  3680.   TD3DMatrixLoad = record
  3681.     hDestMatrix: TD3DMatrixHandle;   // Destination matrix
  3682.     hSrcMatrix: TD3DMatrixHandle;    // Source matrix
  3683.   end;
  3684.  
  3685.   D3DMATRIXLOAD = TD3DMatrixLoad;
  3686.  
  3687. { TD3DMatrixMultiply structure }
  3688.  
  3689.   TD3DMatrixMultiply = record
  3690.     hDestMatrix: TD3DMatrixHandle;   // Destination matrix
  3691.     hSrcMatrix1: TD3DMatrixHandle;   // First source matrix
  3692.     hSrcMatrix2: TD3DMatrixHandle;   // Second source matrix
  3693.   end;
  3694.  
  3695.   D3DMATRIXMULTIPLY = TD3DMatrixMultiply;
  3696.  
  3697. { TD3DProcessVertices structure }
  3698.  
  3699.   TD3DProcessVertices = record
  3700.     dwFlags: DWORD;           // Do we transform or light or just copy?
  3701.     wStart: WORD;             // Index to first vertex in source
  3702.     wDest: WORD;              // Index to first vertex in local buffer
  3703.     dwCount: DWORD;           // Number of vertices to be processed
  3704.     dwReserved: DWORD;        // Must be zero
  3705.   end;
  3706.  
  3707.   D3DPROCESSVERTICES = TD3DProcessVertices;
  3708.  
  3709. const
  3710.   D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
  3711.   D3DPROCESSVERTICES_TRANSFORM            = $00000001;
  3712.   D3DPROCESSVERTICES_COPY                 = $00000002;
  3713.   D3DPROCESSVERTICES_OPMASK               = $00000007;
  3714.  
  3715.   D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
  3716.   D3DPROCESSVERTICES_NOCOLOR              = $00000010;
  3717.  
  3718. { TD3DTextureStagesStateType }
  3719.  
  3720. type
  3721.   TD3DTextureStagesStateType = (
  3722.     D3DTSS_INVALID_0,
  3723.     D3DTSS_COLOROP,           // TD3DTextureOp - per-stage blending controls for color channels
  3724.     D3DTSS_COLORARG1,         // D3DTA_* (texture arg)
  3725.     D3DTSS_COLORARG2,         // D3DTA_* (texture arg)
  3726.     D3DTSS_ALPHAOP,           // TD3DTextureOp - per-stage blending controls for alpha channel
  3727.     D3DTSS_ALPHAARG1,         // D3DTA_* (texture arg)
  3728.     D3DTSS_ALPHAARG2,         // D3DTA_* (texture arg)
  3729.     D3DTSS_BUMPENVMAT00,      // TD3DValue (bump mapping matrix)
  3730.     D3DTSS_BUMPENVMAT01,      // TD3DValue (bump mapping matrix)
  3731.     D3DTSS_BUMPENVMAT10,      // TD3DValue (bump mapping matrix)
  3732.     D3DTSS_BUMPENVMAT11,      // TD3DValue (bump mapping matrix)
  3733.     D3DTSS_TEXCOORDINDEX,     // identifies which set of texture coordinates index this texture
  3734.     D3DTSS_ADDRESS,           // TD3DTextureAddress for both coordinates
  3735.     D3DTSS_ADDRESSU,          // TD3DTextureAddress for U coordinate
  3736.     D3DTSS_ADDRESSV,          // TD3DTextureAddress for V coordinate
  3737.     D3DTSS_BORDERCOLOR,       // TD3DColor
  3738.     D3DTSS_MAGFILTER,         // TD3DTextureMagFilter filter to use for magnification
  3739.     D3DTSS_MINFILTER,         // TD3DTextureMinFilter filter to use for minification
  3740.     D3DTSS_MIPFILTER,         // TD3DTextureMipFilter filter to use between mipmaps during minification
  3741.     D3DTSS_MIPMAPLODBIAS,     // D3DVALUE Mipmap LOD bias
  3742.     D3DTSS_MAXMIPLEVEL,       // DWORD 0..(n-1) LOD index of largest map to use (0 == largest)
  3743.     D3DTSS_MAXANISOTROPY,     // DWORD maximum anisotropy
  3744.     D3DTSS_BUMPENVLSCALE,     // TD3DValue scale for bump map luminance
  3745.     D3DTSS_BUMPENVLOFFSET,    // TD3DValue offset for bump map luminance
  3746.     D3DTSS_TEXTURETRANSFORMFLAGS // D3DTEXTURETRANSFORMFLAGS controls texture transform
  3747.   );
  3748.  
  3749.   D3DTEXTURESTAGESTATETYPE = TD3DTextureStagesStateType;
  3750.  
  3751. const
  3752. { Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position     }
  3753. { and normal in the camera space) should be taken as texture coordinates               }
  3754. { Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from }
  3755.  
  3756.    D3DTSS_TCI_PASSTHRU                    = $00000000;
  3757.    D3DTSS_TCI_CAMERASPACENORMAL           = $00010000;
  3758.    D3DTSS_TCI_CAMERASPACEPOSITION         = $00020000;
  3759.    D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR = $00030000;
  3760.  
  3761. { TD3DTextureOp }
  3762.  
  3763. type
  3764.   TD3DTextureOp = (
  3765.     D3DTOP_INVALID_0,
  3766.     // Control
  3767.     D3DTOP_DISABLE,                    // disables stage
  3768.     D3DTOP_SELECTARG1,                 // the default
  3769.     D3DTOP_SELECTARG2,
  3770.     // Modulate
  3771.     D3DTOP_MODULATE,                   // multiply args together
  3772.     D3DTOP_MODULATE2X,                 // multiply and  1 bit
  3773.     D3DTOP_MODULATE4X,                 // multiply and  2 bits
  3774.     // Add
  3775.     D3DTOP_ADD,                        // add arguments together
  3776.     D3DTOP_ADDSIGNED,                  // add with -0.5 bias
  3777.     D3DTOP_ADDSIGNED2X,                // as above but left  1 bit
  3778.     D3DTOP_SUBTRACT,                   // Arg1 - Arg2, with no saturation
  3779.     D3DTOP_ADDSMOOTH,                  // add 2 args, subtract product
  3780.                                        // Arg1 + Arg2 - Arg1*Arg2
  3781.                                        // = Arg1 + (1-Arg1)*Arg2
  3782.     // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
  3783.     D3DTOP_BLENDDIFFUSEALPHA,          // iterated alpha
  3784.     D3DTOP_BLENDTEXTUREALPHA,          // texture alpha
  3785.     D3DTOP_BLENDFACTORALPHA,           // alpha from D3DRENDERSTATE_TEXTUREFACTOR
  3786.     // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
  3787.     D3DTOP_BLENDTEXTUREALPHAPM,        // texture alpha
  3788.     D3DTOP_BLENDCURRENTALPHA,          // by alpha of current color
  3789.     // Specular mapping
  3790.     D3DTOP_PREMODULATE,                // modulate with next texture before use
  3791.     D3DTOP_MODULATEALPHA_ADDCOLOR,     // Arg1.RGB + Arg1.A*Arg2.RGB
  3792.                                        // COLOROP only
  3793.     D3DTOP_MODULATECOLOR_ADDALPHA,     // Arg1.RGB*Arg2.RGB + Arg1.A
  3794.                                        // COLOROP only
  3795.     D3DTOP_MODULATEINVALPHA_ADDCOLOR,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
  3796.                                        // COLOROP only
  3797.     D3DTOP_MODULATEINVCOLOR_ADDALPHA,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
  3798.                                        // COLOROP only
  3799.     // Bump mapping
  3800.     D3DTOP_BUMPENVMAP,                 // per pixel env map perturbation
  3801.     D3DTOP_BUMPENVMAPLUMINANCE,        // with luminance channel
  3802.     // This can do either diffuse or specular bump mapping with correct input.
  3803.     // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
  3804.     // where each component has been scaled and offset to make it signed.
  3805.     // The result is replicated into all four (including alpha) channels.
  3806.     // This is a valid COLOROP only.
  3807.     D3DTOP_DOTPRODUCT3
  3808.   );
  3809.  
  3810.   D3DTEXTUREOP = TD3DTextureOp;
  3811.  
  3812. { Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
  3813.   set in texture processing stage controls in D3DRENDERSTATE. }
  3814.  
  3815. const
  3816.   D3DTA_SELECTMASK     = $0000000f;  // mask for arg selector
  3817.   D3DTA_DIFFUSE        = $00000000;  // select diffuse color
  3818.   D3DTA_CURRENT        = $00000001;  // select result of previous stage
  3819.   D3DTA_TEXTURE        = $00000002;  // select texture color
  3820.   D3DTA_TFACTOR        = $00000003;  // select RENDERSTATE_TEXTUREFACTOR
  3821.   D3DTA_SPECULAR       = $00000004;  // select specular color
  3822.   D3DTA_COMPLEMENT     = $00000010;  // take 1.0 - x
  3823.   D3DTA_ALPHAREPLICATE = $00000020;  // replicate alpha to color components
  3824.  
  3825. { IDirect3DTexture2 State Filter Types }
  3826.  
  3827. type
  3828.   TD3DTextureMagFilter = (
  3829.     D3DTFG_INVALID_0,
  3830.     D3DTFG_POINT,          // nearest
  3831.     D3DTFG_LINEAR,         // linear interpolation
  3832.     D3DTFG_FLATCUBIC,      // cubic
  3833.     D3DTFG_GAUSSIANCUBIC,  // different cubic kernel
  3834.     D3DTFG_ANISOTROPIC
  3835.   );
  3836.  
  3837.   D3DTEXTUREMAGFILTER = TD3DTextureMagFilter;
  3838.  
  3839.   TD3DTextureMinFilter = (
  3840.     D3DTFN_INVALID_0,
  3841.     D3DTFN_POINT,          // nearest
  3842.     D3DTFN_LINEAR,         // linear interpolation
  3843.     D3DTFN_ANISOTROPIC
  3844.   );
  3845.  
  3846.   D3DTEXTUREMINFILTER = TD3DTextureMinFilter;
  3847.  
  3848.   TD3DTextureMipFilter = (
  3849.     D3DTFP_INVALID_0,
  3850.     D3DTFP_NONE,           // mipmapping disabled (use MAG filter)
  3851.     D3DTFP_POINT,          // nearest
  3852.     D3DTFP_LINEAR          // linear interpolation
  3853.   );
  3854.  
  3855.   D3DTEXTUREMIPFILTER = TD3DTextureMipFilter;
  3856.  
  3857. { Triangle flags }
  3858.  
  3859. const
  3860.   D3DTRIFLAG_START                        = $00000000;
  3861.   D3DTRIFLAG_ODD                          = $0000001e;
  3862.   D3DTRIFLAG_EVEN                         = $0000001f;
  3863.  
  3864. function D3DTRIFLAG_STARTFLAT(len: DWORD): DWORD;
  3865.  
  3866. { Triangle edge flags }
  3867.  
  3868. const
  3869.   D3DTRIFLAG_EDGEENABLE1                  = $00000100; // v0-v1 edge
  3870.   D3DTRIFLAG_EDGEENABLE2                  = $00000200; // v1-v2 edge
  3871.   D3DTRIFLAG_EDGEENABLE3                  = $00000400; // v2-v0 edge
  3872.   D3DTRIFLAG_EDGEENABLETRIANGLE =
  3873.       D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3;
  3874.  
  3875. { TD3DTriangle structure }
  3876.  
  3877. type
  3878.   PD3DTriangle = ^TD3DTriangle;
  3879.   TD3DTriangle = record
  3880.     case Integer of
  3881.     0: (
  3882.       v1: WORD;            // Vertex indices
  3883.       v2: WORD;
  3884.       v3: WORD;
  3885.       wFlags: WORD;        // Edge (and other) flags
  3886.       );
  3887.     1: (
  3888.       wV1: WORD;
  3889.       wV2: WORD;
  3890.       wV3: WORD;
  3891.       );
  3892.   end;
  3893.  
  3894.   D3DTRIANGLE = TD3DTriangle;
  3895.   LPD3DTRIANGLE = PD3DTriangle;
  3896.  
  3897. { TD3DLine structure }
  3898.  
  3899.   PD3DLine = ^TD3DLine;
  3900.   TD3DLine = record
  3901.     case Integer of
  3902.     0: (
  3903.       v1: WORD;            // Vertex indices
  3904.       v2: WORD;
  3905.       );
  3906.     1: (
  3907.       wV1: WORD;
  3908.       wV2: WORD;
  3909.       );
  3910.   end;
  3911.  
  3912.   D3DLINE = TD3DLine;
  3913.   LPD3DLINE = PD3DLine;
  3914.  
  3915. { TD3DSpan structure }
  3916.  
  3917.   PD3DSpan = ^TD3DSpan;
  3918.   TD3DSpan = record
  3919.     wCount: WORD;        // Number of spans
  3920.     wFirst: WORD;        // Index to first vertex
  3921.   end;
  3922.  
  3923.   D3DSPAN = TD3DSpan;
  3924.   LPD3DSPAN = PD3DSpan;
  3925.  
  3926. { TD3DPoint structure }
  3927.  
  3928.   PD3DPoint = ^TD3DPoint;
  3929.   TD3DPoint = record
  3930.     wCount: WORD;        // number of points
  3931.     wFirst: WORD;        // index to first vertex
  3932.   end;
  3933.  
  3934.   D3DPOINT = TD3DPoint;
  3935.   LPD3DPOINT = PD3DPoint;
  3936.  
  3937. { TD3DBranch structure }
  3938.  
  3939.   PD3DBranch = ^TD3DBranch;
  3940.   TD3DBranch = record
  3941.     dwMask: DWORD;         // Bitmask against D3D status
  3942.     dwValue: DWORD;
  3943.     bNegate: BOOL;         // TRUE to negate comparison
  3944.     dwOffset: DWORD;       // How far to branch forward (0 for exit)
  3945.   end;
  3946.  
  3947.   D3DBRANCH = TD3DBranch;
  3948.   LPD3DBRANCH = PD3DBranch;
  3949.  
  3950. { TD3DStatus structure }
  3951.  
  3952.   PD3DStatus = ^TD3DStatus;
  3953.   TD3DStatus = record
  3954.     dwFlags: DWORD;        // Do we set extents or status
  3955.     dwStatus: DWORD;       // D3D status
  3956.     drExtent: TD3DRect;
  3957.   end;
  3958.  
  3959.   D3DSTATUS = TD3DStatus;
  3960.   LPD3DSTATUS = PD3DStatus;
  3961.  
  3962. const
  3963.   D3DSETSTATUS_STATUS   = $00000001;
  3964.   D3DSETSTATUS_EXTENTS  = $00000002;
  3965.   D3DSETSTATUS_ALL      = D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS;
  3966.  
  3967. { TD3DClipStatus structure }
  3968.  
  3969. type
  3970.   PD3DClipStatus = ^TD3DClipStatus;
  3971.   TD3DClipStatus = record
  3972.     dwFlags: DWORD;     // Do we set 2d extents, 3D extents or status
  3973.     dwStatus: DWORD;    // Clip status
  3974.     minx, maxx: Single; // X extents
  3975.     miny, maxy: Single; // Y extents
  3976.     minz, maxz: Single; // Z extents
  3977.   end;
  3978.  
  3979.   D3DCLIPSTATUS = TD3DClipStatus;
  3980.   LPD3DCLIPSTATUS = PD3DClipStatus;
  3981.  
  3982. const
  3983.   D3DCLIPSTATUS_STATUS        = $00000001;
  3984.   D3DCLIPSTATUS_EXTENTS2      = $00000002;
  3985.   D3DCLIPSTATUS_EXTENTS3      = $00000004;
  3986.  
  3987. { TD3DStats structure }
  3988.  
  3989. type
  3990.   PD3DStats = ^TD3DStats;
  3991.   TD3DStats = record
  3992.     dwSize: DWORD;
  3993.     dwTrianglesDrawn: DWORD;
  3994.     dwLinesDrawn: DWORD;
  3995.     dwPointsDrawn: DWORD;
  3996.     dwSpansDrawn: DWORD;
  3997.     dwVerticesProcessed: DWORD;
  3998.   end;
  3999.  
  4000.   D3DSTATS = TD3DStats;
  4001.   LPD3DSTATS = PD3DStats;
  4002.  
  4003. { Execute options. }
  4004.  
  4005. const
  4006.   D3DEXECUTE_CLIPPED       = $00000001;
  4007.   D3DEXECUTE_UNCLIPPED     = $00000002;
  4008.  
  4009. { TD3DExecuteData structure }
  4010.  
  4011. type
  4012.   PD3DExecuteData = ^TD3DExecuteData;
  4013.   TD3DExecuteData = record
  4014.     dwSize: DWORD;
  4015.     dwVertexOffset: DWORD;
  4016.     dwVertexCount: DWORD;
  4017.     dwInstructionOffset: DWORD;
  4018.     dwInstructionLength: DWORD;
  4019.     dwHVertexOffset: DWORD;
  4020.     dsStatus: D3DSTATUS;       // Status after execute
  4021.   end;
  4022.  
  4023.   D3DEXECUTEDATA = TD3DExecuteData;
  4024.   LPD3DEXECUTEDATA = PD3DExecuteData;
  4025.  
  4026. { Palette flags. }
  4027.  
  4028. const
  4029.   D3DPAL_FREE     = $00;    // Renderer may use this entry freely
  4030.   D3DPAL_READONLY = $40;    // Renderer may not set this entry
  4031.   D3DPAL_RESERVED = $80;    // Renderer may not use this entry
  4032.  
  4033. { TD3DVertexBufferDesc structure }
  4034.  
  4035. type
  4036.   PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
  4037.   TD3DVertexBufferDesc = record
  4038.     dwSize: DWORD;
  4039.     dwCaps: DWORD;
  4040.     dwFVF: DWORD;
  4041.     dwNumVertices: DWORD;
  4042.   end;
  4043.  
  4044.   D3DVERTEXBUFFERDESC = TD3DVertexBufferDesc;
  4045.   LPD3DVERTEXBUFFERDESC = PD3DVertexBufferDesc;
  4046.  
  4047. { These correspond to DDSCAPS_* flags }
  4048.  
  4049. const
  4050.   D3DVBCAPS_SYSTEMMEMORY = $00000800;
  4051.   D3DVBCAPS_WRITEONLY    = $00010000;
  4052.   D3DVBCAPS_OPTIMIZED    = $80000000;
  4053.   D3DVBCAPS_DONOTCLIP    = $00000001;
  4054.  
  4055. { Vertex Operations for ProcessVertices }
  4056.  
  4057.   D3DVOP_LIGHT     = 1 shl 10;
  4058.   D3DVOP_TRANSFORM = 1 shl 0;
  4059.   D3DVOP_CLIP      = 1 shl 2;
  4060.   D3DVOP_EXTENTS   = 1 shl 3;
  4061.  
  4062. { The maximum number of vertices user can pass to any d3d
  4063.    drawing function or to create vertex buffer with }
  4064.   D3DMAXNUMVERTICES = (1 shl 16)-1;
  4065.  
  4066. { The maximum number of primitives user can pass to any d3d drawing function. }
  4067.   D3DMAXNUMPRIMITIVES = (1 shl 16)-1;
  4068.  
  4069. { Bits for dwFlags in ProcessVertices call }
  4070.   D3DPV_DONOTCOPYDATA = 1 shl 0;
  4071.  
  4072. { Flexible vertex format bits }
  4073.  
  4074.   D3DFVF_RESERVED0      = $001;
  4075.   D3DFVF_POSITION_MASK  = $00E;
  4076.   D3DFVF_XYZ            = $002;
  4077.   D3DFVF_XYZRHW         = $004;
  4078.   D3DFVF_XYZB1          = $006;
  4079.   D3DFVF_XYZB2          = $008;
  4080.   D3DFVF_XYZB3          = $00a;
  4081.   D3DFVF_XYZB4          = $00c;
  4082.   D3DFVF_XYZB5          = $00e;
  4083.   D3DFVF_NORMAL         = $010;
  4084.   D3DFVF_RESERVED1      = $020;
  4085.   D3DFVF_DIFFUSE        = $040;
  4086.   D3DFVF_SPECULAR       = $080;
  4087.   D3DFVF_TEXCOUNT_MASK  = $f00;
  4088.   D3DFVF_TEXCOUNT_SHIFT = 8;
  4089.   D3DFVF_TEX0           = $000;
  4090.   D3DFVF_TEX1           = $100;
  4091.   D3DFVF_TEX2           = $200;
  4092.   D3DFVF_TEX3           = $300;
  4093.   D3DFVF_TEX4           = $400;
  4094.   D3DFVF_TEX5           = $500;
  4095.   D3DFVF_TEX6           = $600;
  4096.   D3DFVF_TEX7           = $700;
  4097.   D3DFVF_TEX8           = $800;
  4098.  
  4099.   D3DFVF_RESERVED2      = $F000; // 4 reserved bits
  4100.  
  4101.   D3DFVF_VERTEX         = D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1;
  4102.   D3DFVF_LVERTEX        = D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or
  4103.                             D3DFVF_SPECULAR or D3DFVF_TEX1;
  4104.   D3DFVF_TLVERTEX       = D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or
  4105.                             D3DFVF_TEX1;
  4106.  
  4107. { TD3DDP_PtrStride }
  4108.  
  4109. type
  4110.   TD3DDP_PtrStride = record
  4111.     lpvData: Pointer;
  4112.     dwStride: DWORD;
  4113.   end;
  4114.  
  4115.   D3DDP_PTRSTRIDE = TD3DDP_PtrStride;
  4116.  
  4117. const
  4118.   D3DDP_MAXTEXCOORD = 8;
  4119.  
  4120. type
  4121.   PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData;
  4122.   TD3DDrawPrimitiveStridedData = record
  4123.     position: TD3DDP_PtrStride;
  4124.     normal: TD3DDP_PtrStride;
  4125.     diffuse: TD3DDP_PtrStride;
  4126.     specular: TD3DDP_PtrStride;
  4127.     textureCoords: array[0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride;
  4128.   end;
  4129.  
  4130.   D3DDRAWPRIMITIVESTRIDEDDATA = TD3DDrawPrimitiveStridedData;
  4131.   LPD3DDRAWPRIMITIVESTRIDEDDATA = PD3DDrawPrimitiveStridedData;
  4132.  
  4133. { ComputeSphereVisibility return values }
  4134.  
  4135. const
  4136.   D3DVIS_INSIDE_FRUSTUM    = 0;
  4137.   D3DVIS_INTERSECT_FRUSTUM = 1;
  4138.   D3DVIS_OUTSIDE_FRUSTUM   = 2;
  4139.   D3DVIS_INSIDE_LEFT       = 0;
  4140.   D3DVIS_INTERSECT_LEFT    = 1 shl 2;
  4141.   D3DVIS_OUTSIDE_LEFT      = 2 shl 2;
  4142.   D3DVIS_INSIDE_RIGHT      = 0;
  4143.   D3DVIS_INTERSECT_RIGHT   = 1 shl 4;
  4144.   D3DVIS_OUTSIDE_RIGHT     = 2 shl 4;
  4145.   D3DVIS_INSIDE_TOP        = 0;
  4146.   D3DVIS_INTERSECT_TOP     = 1 shl 6;
  4147.   D3DVIS_OUTSIDE_TOP       = 2 shl 6;
  4148.   D3DVIS_INSIDE_BOTTOM     = 0;
  4149.   D3DVIS_INTERSECT_BOTTOM  = 1 shl 8;
  4150.   D3DVIS_OUTSIDE_BOTTOM    = 2 shl 8;
  4151.   D3DVIS_INSIDE_NEAR       = 0;
  4152.   D3DVIS_INTERSECT_NEAR    = 1 shl 10;
  4153.   D3DVIS_OUTSIDE_NEAR      = 2 shl 10;
  4154.   D3DVIS_INSIDE_FAR        = 0;
  4155.   D3DVIS_INTERSECT_FAR     = 1 shl 12;
  4156.   D3DVIS_OUTSIDE_FAR       = 2 shl 12;
  4157.  
  4158.   D3DVIS_MASK_FRUSTUM      = 3 shl 0;
  4159.   D3DVIS_MASK_LEFT         = 3 shl 2;
  4160.   D3DVIS_MASK_RIGHT        = 3 shl 4;
  4161.   D3DVIS_MASK_TOP          = 3 shl 6;
  4162.   D3DVIS_MASK_BOTTOM       = 3 shl 8;
  4163.   D3DVIS_MASK_NEAR         = 3 shl 10;
  4164.   D3DVIS_MASK_FAR          = 3 shl 12;
  4165.  
  4166. { To be used with GetInfo() }
  4167.  
  4168.   D3DDEVINFOID_TEXTUREMANAGER    = 1;
  4169.   D3DDEVINFOID_D3DTEXTUREMANAGER = 2;
  4170.   D3DDEVINFOID_TEXTURING         = 3;
  4171.  
  4172. type
  4173.  
  4174. { TD3DStateBlockType }
  4175.  
  4176.   TD3DStateBlockType = (
  4177.     D3DBST_INVALID_0,
  4178.     D3DSBT_PIXELSTATE,        // capture pixel state
  4179.     D3DSBT_VERTEXSTATE        // capture vertex state
  4180.   );
  4181.  
  4182.   D3DSTATEBLOCKTYPE = TD3DStateBlockType;
  4183.  
  4184. { TD3DVertexBlendFlags }
  4185.  
  4186.   TD3DVertexBlendFlags = (
  4187.     D3DVBLEND_DISABLE,        // Disable vertex blending
  4188.     D3DVBLEND_1WEIGHT,        // blend between 2 matrices
  4189.     D3DVBLEND_2WEIGHTS,       // blend between 3 matrices
  4190.     D3DVBLEND_3WEIGHTS        // blend between 4 matrices
  4191.   );
  4192.  
  4193.   D3DVERTEXBLENDFLAGS = TD3DVertexBlendFlags;
  4194.  
  4195. { TD3DTextureTransformFlags }
  4196.  
  4197.   TD3DTextureTransformFlags = (
  4198.     D3DTTFF_DISABLE,   // texture coordinates are passed directly
  4199.     D3DTTFF_COUNT1,    // rasterizer should expect 1-D texture coords
  4200.     D3DTTFF_COUNT2,    // rasterizer should expect 2-D texture coords
  4201.     D3DTTFF_COUNT3,    // rasterizer should expect 3-D texture coords
  4202.     D3DTTFF_COUNT4,    // rasterizer should expect 4-D texture coords
  4203.     D3DTIFF_INVALID_5,
  4204.     D3DTIFF_INVALID_6,
  4205.     D3DTIFF_INVALID_7,
  4206.     D3DTIFF_INVALID_8,
  4207.     D3DTIFF_INVALID_9,
  4208.     D3DTIFF_INVALID_10,
  4209.     D3DTIFF_INVALID_11,
  4210.     D3DTIFF_INVALID_12,
  4211.     D3DTIFF_INVALID_13,
  4212.     D3DTIFF_INVALID_14,
  4213.     D3DTIFF_INVALID_15,
  4214.     D3DTIFF_INVALID_16,
  4215.     D3DTIFF_INVALID_17,
  4216.     D3DTIFF_INVALID_18,
  4217.     D3DTIFF_INVALID_19,
  4218.     D3DTIFF_INVALID_20,
  4219.     D3DTIFF_INVALID_21,
  4220.     D3DTIFF_INVALID_22,
  4221.     D3DTIFF_INVALID_23,
  4222.     D3DTIFF_INVALID_24,
  4223.     D3DTIFF_INVALID_25,
  4224.     D3DTIFF_INVALID_26,
  4225.     D3DTIFF_INVALID_27,
  4226.     D3DTIFF_INVALID_28,
  4227.     D3DTIFF_INVALID_29,
  4228.     D3DTIFF_INVALID_30,
  4229.     D3DTIFF_INVALID_31,
  4230.     D3DTIFF_INVALID_32,
  4231.     D3DTIFF_INVALID_33,
  4232.     D3DTIFF_INVALID_34,
  4233.     D3DTIFF_INVALID_35,
  4234.     D3DTIFF_INVALID_36,
  4235.     D3DTIFF_INVALID_37,
  4236.     D3DTIFF_INVALID_38,
  4237.     D3DTIFF_INVALID_39,
  4238.     D3DTIFF_INVALID_40,
  4239.     D3DTIFF_INVALID_41,
  4240.     D3DTIFF_INVALID_42,
  4241.     D3DTIFF_INVALID_43,
  4242.     D3DTIFF_INVALID_44,
  4243.     D3DTIFF_INVALID_45,
  4244.     D3DTIFF_INVALID_46,
  4245.     D3DTIFF_INVALID_47,
  4246.     D3DTIFF_INVALID_48,
  4247.     D3DTIFF_INVALID_49,
  4248.     D3DTIFF_INVALID_50,
  4249.     D3DTIFF_INVALID_51,
  4250.     D3DTIFF_INVALID_52,
  4251.     D3DTIFF_INVALID_53,
  4252.     D3DTIFF_INVALID_54,
  4253.     D3DTIFF_INVALID_55,
  4254.     D3DTIFF_INVALID_56,
  4255.     D3DTIFF_INVALID_57,
  4256.     D3DTIFF_INVALID_58,
  4257.     D3DTIFF_INVALID_59,
  4258.     D3DTIFF_INVALID_60,
  4259.     D3DTIFF_INVALID_61,
  4260.     D3DTIFF_INVALID_62,
  4261.     D3DTIFF_INVALID_63,
  4262.     D3DTIFF_INVALID_64,
  4263.     D3DTIFF_INVALID_65,
  4264.     D3DTIFF_INVALID_66,
  4265.     D3DTIFF_INVALID_67,
  4266.     D3DTIFF_INVALID_68,
  4267.     D3DTIFF_INVALID_69,
  4268.     D3DTIFF_INVALID_70,
  4269.     D3DTIFF_INVALID_71,
  4270.     D3DTIFF_INVALID_72,
  4271.     D3DTIFF_INVALID_73,
  4272.     D3DTIFF_INVALID_74,
  4273.     D3DTIFF_INVALID_75,
  4274.     D3DTIFF_INVALID_76,
  4275.     D3DTIFF_INVALID_77,
  4276.     D3DTIFF_INVALID_78,
  4277.     D3DTIFF_INVALID_79,
  4278.     D3DTIFF_INVALID_80,
  4279.     D3DTIFF_INVALID_81,
  4280.     D3DTIFF_INVALID_82,
  4281.     D3DTIFF_INVALID_83,
  4282.     D3DTIFF_INVALID_84,
  4283.     D3DTIFF_INVALID_85,
  4284.     D3DTIFF_INVALID_86,
  4285.     D3DTIFF_INVALID_87,
  4286.     D3DTIFF_INVALID_88,
  4287.     D3DTIFF_INVALID_89,
  4288.     D3DTIFF_INVALID_90,
  4289.     D3DTIFF_INVALID_91,
  4290.     D3DTIFF_INVALID_92,
  4291.     D3DTIFF_INVALID_93,
  4292.     D3DTIFF_INVALID_94,
  4293.     D3DTIFF_INVALID_95,
  4294.     D3DTIFF_INVALID_96,
  4295.     D3DTIFF_INVALID_97,
  4296.     D3DTIFF_INVALID_98,
  4297.     D3DTIFF_INVALID_99,
  4298.     D3DTIFF_INVALID_100,
  4299.     D3DTIFF_INVALID_101,
  4300.     D3DTIFF_INVALID_102,
  4301.     D3DTIFF_INVALID_103,
  4302.     D3DTIFF_INVALID_104,
  4303.     D3DTIFF_INVALID_105,
  4304.     D3DTIFF_INVALID_106,
  4305.     D3DTIFF_INVALID_107,
  4306.     D3DTIFF_INVALID_108,
  4307.     D3DTIFF_INVALID_109,
  4308.     D3DTIFF_INVALID_110,
  4309.     D3DTIFF_INVALID_111,
  4310.     D3DTIFF_INVALID_112,
  4311.     D3DTIFF_INVALID_113,
  4312.     D3DTIFF_INVALID_114,
  4313.     D3DTIFF_INVALID_115,
  4314.     D3DTIFF_INVALID_116,
  4315.     D3DTIFF_INVALID_117,
  4316.     D3DTIFF_INVALID_118,
  4317.     D3DTIFF_INVALID_119,
  4318.     D3DTIFF_INVALID_120,
  4319.     D3DTIFF_INVALID_121,
  4320.     D3DTIFF_INVALID_122,
  4321.     D3DTIFF_INVALID_123,
  4322.     D3DTIFF_INVALID_124,
  4323.     D3DTIFF_INVALID_125,
  4324.     D3DTIFF_INVALID_126,
  4325.     D3DTIFF_INVALID_127,
  4326.     D3DTIFF_INVALID_128,
  4327.     D3DTIFF_INVALID_129,
  4328.     D3DTIFF_INVALID_130,
  4329.     D3DTIFF_INVALID_131,
  4330.     D3DTIFF_INVALID_132,
  4331.     D3DTIFF_INVALID_133,
  4332.     D3DTIFF_INVALID_134,
  4333.     D3DTIFF_INVALID_135,
  4334.     D3DTIFF_INVALID_136,
  4335.     D3DTIFF_INVALID_137,
  4336.     D3DTIFF_INVALID_138,
  4337.     D3DTIFF_INVALID_139,
  4338.     D3DTIFF_INVALID_140,
  4339.     D3DTIFF_INVALID_141,
  4340.     D3DTIFF_INVALID_142,
  4341.     D3DTIFF_INVALID_143,
  4342.     D3DTIFF_INVALID_144,
  4343.     D3DTIFF_INVALID_145,
  4344.     D3DTIFF_INVALID_146,
  4345.     D3DTIFF_INVALID_147,
  4346.     D3DTIFF_INVALID_148,
  4347.     D3DTIFF_INVALID_149,
  4348.     D3DTIFF_INVALID_150,
  4349.     D3DTIFF_INVALID_151,
  4350.     D3DTIFF_INVALID_152,
  4351.     D3DTIFF_INVALID_153,
  4352.     D3DTIFF_INVALID_154,
  4353.     D3DTIFF_INVALID_155,
  4354.     D3DTIFF_INVALID_156,
  4355.     D3DTIFF_INVALID_157,
  4356.     D3DTIFF_INVALID_158,
  4357.     D3DTIFF_INVALID_159,
  4358.     D3DTIFF_INVALID_160,
  4359.     D3DTIFF_INVALID_161,
  4360.     D3DTIFF_INVALID_162,
  4361.     D3DTIFF_INVALID_163,
  4362.     D3DTIFF_INVALID_164,
  4363.     D3DTIFF_INVALID_165,
  4364.     D3DTIFF_INVALID_166,
  4365.     D3DTIFF_INVALID_167,
  4366.     D3DTIFF_INVALID_168,
  4367.     D3DTIFF_INVALID_169,
  4368.     D3DTIFF_INVALID_170,
  4369.     D3DTIFF_INVALID_171,
  4370.     D3DTIFF_INVALID_172,
  4371.     D3DTIFF_INVALID_173,
  4372.     D3DTIFF_INVALID_174,
  4373.     D3DTIFF_INVALID_175,
  4374.     D3DTIFF_INVALID_176,
  4375.     D3DTIFF_INVALID_177,
  4376.     D3DTIFF_INVALID_178,
  4377.     D3DTIFF_INVALID_179,
  4378.     D3DTIFF_INVALID_180,
  4379.     D3DTIFF_INVALID_181,
  4380.     D3DTIFF_INVALID_182,
  4381.     D3DTIFF_INVALID_183,
  4382.     D3DTIFF_INVALID_184,
  4383.     D3DTIFF_INVALID_185,
  4384.     D3DTIFF_INVALID_186,
  4385.     D3DTIFF_INVALID_187,
  4386.     D3DTIFF_INVALID_188,
  4387.     D3DTIFF_INVALID_189,
  4388.     D3DTIFF_INVALID_190,
  4389.     D3DTIFF_INVALID_191,
  4390.     D3DTIFF_INVALID_192,
  4391.     D3DTIFF_INVALID_193,
  4392.     D3DTIFF_INVALID_194,
  4393.     D3DTIFF_INVALID_195,
  4394.     D3DTIFF_INVALID_196,
  4395.     D3DTIFF_INVALID_197,
  4396.     D3DTIFF_INVALID_198,
  4397.     D3DTIFF_INVALID_199,
  4398.     D3DTIFF_INVALID_200,
  4399.     D3DTIFF_INVALID_201,
  4400.     D3DTIFF_INVALID_202,
  4401.     D3DTIFF_INVALID_203,
  4402.     D3DTIFF_INVALID_204,
  4403.     D3DTIFF_INVALID_205,
  4404.     D3DTIFF_INVALID_206,
  4405.     D3DTIFF_INVALID_207,
  4406.     D3DTIFF_INVALID_208,
  4407.     D3DTIFF_INVALID_209,
  4408.     D3DTIFF_INVALID_210,
  4409.     D3DTIFF_INVALID_211,
  4410.     D3DTIFF_INVALID_212,
  4411.     D3DTIFF_INVALID_213,
  4412.     D3DTIFF_INVALID_214,
  4413.     D3DTIFF_INVALID_215,
  4414.     D3DTIFF_INVALID_216,
  4415.     D3DTIFF_INVALID_217,
  4416.     D3DTIFF_INVALID_218,
  4417.     D3DTIFF_INVALID_219,
  4418.     D3DTIFF_INVALID_220,
  4419.     D3DTIFF_INVALID_221,
  4420.     D3DTIFF_INVALID_222,
  4421.     D3DTIFF_INVALID_223,
  4422.     D3DTIFF_INVALID_224,
  4423.     D3DTIFF_INVALID_225,
  4424.     D3DTIFF_INVALID_226,
  4425.     D3DTIFF_INVALID_227,
  4426.     D3DTIFF_INVALID_228,
  4427.     D3DTIFF_INVALID_229,
  4428.     D3DTIFF_INVALID_230,
  4429.     D3DTIFF_INVALID_231,
  4430.     D3DTIFF_INVALID_232,
  4431.     D3DTIFF_INVALID_233,
  4432.     D3DTIFF_INVALID_234,
  4433.     D3DTIFF_INVALID_235,
  4434.     D3DTIFF_INVALID_236,
  4435.     D3DTIFF_INVALID_237,
  4436.     D3DTIFF_INVALID_238,
  4437.     D3DTIFF_INVALID_239,
  4438.     D3DTIFF_INVALID_240,
  4439.     D3DTIFF_INVALID_241,
  4440.     D3DTIFF_INVALID_242,
  4441.     D3DTIFF_INVALID_243,
  4442.     D3DTIFF_INVALID_244,
  4443.     D3DTIFF_INVALID_245,
  4444.     D3DTIFF_INVALID_246,
  4445.     D3DTIFF_INVALID_247,
  4446.     D3DTIFF_INVALID_248,
  4447.     D3DTIFF_INVALID_249,
  4448.     D3DTIFF_INVALID_250,
  4449.     D3DTIFF_INVALID_251,
  4450.     D3DTIFF_INVALID_252,
  4451.     D3DTIFF_INVALID_253,
  4452.     D3DTIFF_INVALID_254,
  4453.     D3DTIFF_INVALID_255,
  4454.     D3DTTFF_PROJECTED  // texcoords to be divided by COUNTth element
  4455.   );
  4456.  
  4457. { Macros to set texture coordinate format bits in the FVF id }
  4458.  
  4459. const
  4460.   D3DFVF_TEXTUREFORMAT2 = 0;         // Two floating point values
  4461.   D3DFVF_TEXTUREFORMAT1 = 3;         // One floating point value
  4462.   D3DFVF_TEXTUREFORMAT3 = 1;         // Three floating point values
  4463.   D3DFVF_TEXTUREFORMAT4 = 2;         // Four floating point values
  4464.  
  4465. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD): DWORD;
  4466. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD): DWORD;
  4467. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD): DWORD;
  4468. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD): DWORD;
  4469.  
  4470. (*==========================================================================;
  4471.  *
  4472.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  4473.  *
  4474.  *  File:       d3dcaps.h
  4475.  *  Content:    Direct3D capabilities include file
  4476.  *
  4477.  ***************************************************************************)
  4478.  
  4479. { Description of capabilities of transform }
  4480.  
  4481. type
  4482.   PD3DTransformCaps = ^TD3DTransformCaps;
  4483.   TD3DTransformCaps = record
  4484.     dwSize: DWORD;
  4485.     dwCaps: DWORD;
  4486.   end;
  4487.  
  4488.   D3DTRANSFORMCAPS = TD3DTransformCaps;
  4489.   LPD3DTRANSFORMCAPS = PD3DTransformCaps;
  4490.  
  4491. const
  4492.   D3DTRANSFORMCAPS_CLIP = $00000001; // Will clip whilst transforming
  4493.  
  4494. { Description of capabilities of lighting }
  4495.  
  4496. type
  4497.   PD3DLightingCaps = ^TD3DLightingCaps;
  4498.   TD3DLightingCaps = record
  4499.     dwSize: DWORD;
  4500.     dwCaps: DWORD;            // Lighting caps
  4501.     dwLightingModel: DWORD;   // Lighting model - RGB or mono
  4502.     dwNumLights: DWORD;       // Number of lights that can be handled
  4503.   end;
  4504.  
  4505.   D3DLIGHTINGCAPS = TD3DLightingCaps;
  4506.   LPD3DLIGHTINGCAPS = PD3DLightingCaps;
  4507.  
  4508. const
  4509.   D3DLIGHTINGMODEL_RGB        = $00000001;
  4510.   D3DLIGHTINGMODEL_MONO       = $00000002;
  4511.  
  4512.   D3DLIGHTCAPS_POINT          = $00000001; // Point lights supported
  4513.   D3DLIGHTCAPS_SPOT           = $00000002; // Spot lights supported
  4514.   D3DLIGHTCAPS_DIRECTIONAL    = $00000004; // Directional lights supported
  4515.   D3DLIGHTCAPS_PARALLELPOINT  = $00000008; // Parallel point lights supported
  4516.   D3DLIGHTCAPS_GLSPOT         = $00000010; // GL syle spot lights supported
  4517.  
  4518. { Description of capabilities for each primitive type }
  4519.  
  4520. type
  4521.   PD3DPrimCaps = ^TD3DPrimCaps;
  4522.   TD3DPrimCaps = record
  4523.     dwSize: DWORD;
  4524.     dwMiscCaps: DWORD;                 // Capability flags
  4525.     dwRasterCaps: DWORD;
  4526.     dwZCmpCaps: DWORD;
  4527.     dwSrcBlendCaps: DWORD;
  4528.     dwDestBlendCaps: DWORD;
  4529.     dwAlphaCmpCaps: DWORD;
  4530.     dwShadeCaps: DWORD;
  4531.     dwTextureCaps: DWORD;
  4532.     dwTextureFilterCaps: DWORD;
  4533.     dwTextureBlendCaps: DWORD;
  4534.     dwTextureAddressCaps: DWORD;
  4535.     dwStippleWidth: DWORD;             // maximum width and height of
  4536.     dwStippleHeight: DWORD;            // of supported stipple (up to 32x32)
  4537.   end;
  4538.  
  4539.   D3DPRIMCAPS = TD3DPrimCaps;
  4540.   LPD3DPRIMCAPS = PD3DPrimCaps;
  4541.  
  4542. { TD3DPrimCaps dwMiscCaps }
  4543.  
  4544. const
  4545.   D3DPMISCCAPS_MASKPLANES         = $00000001;
  4546.   D3DPMISCCAPS_MASKZ              = $00000002;
  4547.   D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
  4548.   D3DPMISCCAPS_CONFORMANT         = $00000008;
  4549.   D3DPMISCCAPS_CULLNONE           = $00000010;
  4550.   D3DPMISCCAPS_CULLCW             = $00000020;
  4551.   D3DPMISCCAPS_CULLCCW            = $00000040;
  4552.  
  4553. { TD3DPrimCaps dwRasterCaps }
  4554.  
  4555.   D3DPRASTERCAPS_DITHER                     = $00000001;
  4556.   D3DPRASTERCAPS_ROP2                       = $00000002;
  4557.   D3DPRASTERCAPS_XOR                        = $00000004;
  4558.   D3DPRASTERCAPS_PAT                        = $00000008;
  4559.   D3DPRASTERCAPS_ZTEST                      = $00000010;
  4560.   D3DPRASTERCAPS_SUBPIXEL                   = $00000020;
  4561.   D3DPRASTERCAPS_SUBPIXELX                  = $00000040;
  4562.   D3DPRASTERCAPS_FOGVERTEX                  = $00000080;
  4563.   D3DPRASTERCAPS_FOGTABLE                   = $00000100;
  4564.   D3DPRASTERCAPS_STIPPLE                    = $00000200;
  4565.   D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT     = $00000400;
  4566.   D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT   = $00000800;
  4567.   D3DPRASTERCAPS_ANTIALIASEDGES             = $00001000;
  4568.   D3DPRASTERCAPS_MIPMAPLODBIAS              = $00002000;
  4569.   D3DPRASTERCAPS_ZBIAS                      = $00004000;
  4570.   D3DPRASTERCAPS_ZBUFFERLESSHSR             = $00008000;
  4571.   D3DPRASTERCAPS_FOGRANGE                   = $00010000;
  4572.   D3DPRASTERCAPS_ANISOTROPY                 = $00020000;
  4573.   D3DPRASTERCAPS_WBUFFER                    = $00040000;
  4574.   D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT = $00080000;
  4575.   D3DPRASTERCAPS_WFOG                       = $00100000;
  4576.   D3DPRASTERCAPS_ZFOG                       = $00200000;
  4577.  
  4578. { TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps }
  4579.  
  4580.   D3DPCMPCAPS_NEVER               = $00000001;
  4581.   D3DPCMPCAPS_LESS                = $00000002;
  4582.   D3DPCMPCAPS_EQUAL               = $00000004;
  4583.   D3DPCMPCAPS_LESSEQUAL           = $00000008;
  4584.   D3DPCMPCAPS_GREATER             = $00000010;
  4585.   D3DPCMPCAPS_NOTEQUAL            = $00000020;
  4586.   D3DPCMPCAPS_GREATEREQUAL        = $00000040;
  4587.   D3DPCMPCAPS_ALWAYS              = $00000080;
  4588.  
  4589. { TD3DPrimCaps dwSourceBlendCaps, dwDestBlendCaps }
  4590.  
  4591.   D3DPBLENDCAPS_ZERO              = $00000001;
  4592.   D3DPBLENDCAPS_ONE               = $00000002;
  4593.   D3DPBLENDCAPS_SRCCOLOR          = $00000004;
  4594.   D3DPBLENDCAPS_INVSRCCOLOR       = $00000008;
  4595.   D3DPBLENDCAPS_SRCALPHA          = $00000010;
  4596.   D3DPBLENDCAPS_INVSRCALPHA       = $00000020;
  4597.   D3DPBLENDCAPS_DESTALPHA         = $00000040;
  4598.   D3DPBLENDCAPS_INVDESTALPHA      = $00000080;
  4599.   D3DPBLENDCAPS_DESTCOLOR         = $00000100;
  4600.   D3DPBLENDCAPS_INVDESTCOLOR      = $00000200;
  4601.   D3DPBLENDCAPS_SRCALPHASAT       = $00000400;
  4602.   D3DPBLENDCAPS_BOTHSRCALPHA      = $00000800;
  4603.   D3DPBLENDCAPS_BOTHINVSRCALPHA   = $00001000;
  4604.  
  4605. { TD3DPrimCaps dwShadeCaps }
  4606.  
  4607.   D3DPSHADECAPS_COLORFLATMONO             = $00000001;
  4608.   D3DPSHADECAPS_COLORFLATRGB              = $00000002;
  4609.   D3DPSHADECAPS_COLORGOURAUDMONO          = $00000004;
  4610.   D3DPSHADECAPS_COLORGOURAUDRGB           = $00000008;
  4611.   D3DPSHADECAPS_COLORPHONGMONO            = $00000010;
  4612.   D3DPSHADECAPS_COLORPHONGRGB             = $00000020;
  4613.  
  4614.   D3DPSHADECAPS_SPECULARFLATMONO          = $00000040;
  4615.   D3DPSHADECAPS_SPECULARFLATRGB           = $00000080;
  4616.   D3DPSHADECAPS_SPECULARGOURAUDMONO       = $00000100;
  4617.   D3DPSHADECAPS_SPECULARGOURAUDRGB        = $00000200;
  4618.   D3DPSHADECAPS_SPECULARPHONGMONO         = $00000400;
  4619.   D3DPSHADECAPS_SPECULARPHONGRGB          = $00000800;
  4620.  
  4621.   D3DPSHADECAPS_ALPHAFLATBLEND            = $00001000;
  4622.   D3DPSHADECAPS_ALPHAFLATSTIPPLED         = $00002000;
  4623.   D3DPSHADECAPS_ALPHAGOURAUDBLEND         = $00004000;
  4624.   D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED      = $00008000;
  4625.   D3DPSHADECAPS_ALPHAPHONGBLEND           = $00010000;
  4626.   D3DPSHADECAPS_ALPHAPHONGSTIPPLED        = $00020000;
  4627.  
  4628.   D3DPSHADECAPS_FOGFLAT                   = $00040000;
  4629.   D3DPSHADECAPS_FOGGOURAUD                = $00080000;
  4630.   D3DPSHADECAPS_FOGPHONG                  = $00100000;
  4631.  
  4632. { TD3DPrimCaps dwTextureCaps }
  4633.  
  4634.   D3DPTEXTURECAPS_PERSPECTIVE              = $00000001;
  4635.   D3DPTEXTURECAPS_POW2                     = $00000002;
  4636.   D3DPTEXTURECAPS_ALPHA                    = $00000004;
  4637.   D3DPTEXTURECAPS_TRANSPARENCY             = $00000008;
  4638.   D3DPTEXTURECAPS_BORDER                   = $00000010;
  4639.   D3DPTEXTURECAPS_SQUAREONLY               = $00000020;
  4640.   D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040;
  4641.   D3DPTEXTURECAPS_ALPHAPALETTE             = $00000080;
  4642.   D3DPTEXTURECAPS_NONPOW2CONDITIONAL       = $00000100;
  4643.   D3DPTEXTURECAPS_PROJECTED                = $00000400;
  4644.   D3DPTEXTURECAPS_CUBEMAP                  = $00000800;
  4645.   D3DPTEXTURECAPS_COLORKEYBLEND            = $00001000;
  4646.  
  4647. { TD3DPrimCaps dwTextureFilterCaps }
  4648.  
  4649.   D3DPTFILTERCAPS_NEAREST          = $00000001;
  4650.   D3DPTFILTERCAPS_LINEAR           = $00000002;
  4651.   D3DPTFILTERCAPS_MIPNEAREST       = $00000004;
  4652.   D3DPTFILTERCAPS_MIPLINEAR        = $00000008;
  4653.   D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010;
  4654.   D3DPTFILTERCAPS_LINEARMIPLINEAR  = $00000020;
  4655.  
  4656. { Device3 Min Filter }
  4657.  
  4658.   D3DPTFILTERCAPS_MINFPOINT       = $00000100;
  4659.   D3DPTFILTERCAPS_MINFLINEAR      = $00000200;
  4660.   D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400;
  4661.  
  4662. { Device3 Mip Filter }
  4663.  
  4664.   D3DPTFILTERCAPS_MIPFPOINT       = $00010000;
  4665.   D3DPTFILTERCAPS_MIPFLINEAR      = $00020000;
  4666.  
  4667. { Device3 Mag Filter }
  4668.  
  4669.   D3DPTFILTERCAPS_MAGFPOINT         = $01000000;
  4670.   D3DPTFILTERCAPS_MAGFLINEAR        = $02000000;
  4671.   D3DPTFILTERCAPS_MAGFANISOTROPIC   = $04000000;
  4672.   D3DPTFILTERCAPS_MAGFAFLATCUBIC    = $08000000;
  4673.   D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000;
  4674.  
  4675. { TD3DPrimCaps dwTextureBlendCaps }
  4676.  
  4677.   D3DPTBLENDCAPS_DECAL            = $00000001;
  4678.   D3DPTBLENDCAPS_MODULATE         = $00000002;
  4679.   D3DPTBLENDCAPS_DECALALPHA       = $00000004;
  4680.   D3DPTBLENDCAPS_MODULATEALPHA    = $00000008;
  4681.   D3DPTBLENDCAPS_DECALMASK        = $00000010;
  4682.   D3DPTBLENDCAPS_MODULATEMASK     = $00000020;
  4683.   D3DPTBLENDCAPS_COPY             = $00000040;
  4684.   D3DPTBLENDCAPS_ADD              = $00000080;
  4685.  
  4686. { TD3DPrimCaps dwTextureAddressCaps }
  4687.  
  4688.   D3DPTADDRESSCAPS_WRAP           = $00000001;
  4689.   D3DPTADDRESSCAPS_MIRROR         = $00000002;
  4690.   D3DPTADDRESSCAPS_CLAMP          = $00000004;
  4691.   D3DPTADDRESSCAPS_BORDER         = $00000008;
  4692.   D3DPTADDRESSCAPS_INDEPENDENTUV  = $00000010;
  4693.  
  4694. { D3DDEVICEDESC dwStencilCaps }
  4695.  
  4696.   D3DSTENCILCAPS_KEEP    = $00000001;
  4697.   D3DSTENCILCAPS_ZERO    = $00000002;
  4698.   D3DSTENCILCAPS_REPLACE = $00000004;
  4699.   D3DSTENCILCAPS_INCRSAT = $00000008;
  4700.   D3DSTENCILCAPS_DECRSAT = $00000010;
  4701.   D3DSTENCILCAPS_INVERT  = $00000020;
  4702.   D3DSTENCILCAPS_INCR    = $00000040;
  4703.   D3DSTENCILCAPS_DECR    = $00000080;
  4704.  
  4705. { D3DDEVICEDESC dwTextureOpCaps }
  4706.  
  4707.   D3DTEXOPCAPS_DISABLE                    = $00000001;
  4708.   D3DTEXOPCAPS_SELECTARG1                 = $00000002;
  4709.   D3DTEXOPCAPS_SELECTARG2                 = $00000004;
  4710.   D3DTEXOPCAPS_MODULATE                   = $00000008;
  4711.   D3DTEXOPCAPS_MODULATE2X                 = $00000010;
  4712.   D3DTEXOPCAPS_MODULATE4X                 = $00000020;
  4713.   D3DTEXOPCAPS_ADD                        = $00000040;
  4714.   D3DTEXOPCAPS_ADDSIGNED                  = $00000080;
  4715.   D3DTEXOPCAPS_ADDSIGNED2X                = $00000100;
  4716.   D3DTEXOPCAPS_SUBTRACT                   = $00000200;
  4717.   D3DTEXOPCAPS_ADDSMOOTH                  = $00000400;
  4718.   D3DTEXOPCAPS_BLENDDIFFUSEALPHA          = $00000800;
  4719.   D3DTEXOPCAPS_BLENDTEXTUREALPHA          = $00001000;
  4720.   D3DTEXOPCAPS_BLENDFACTORALPHA           = $00002000;
  4721.   D3DTEXOPCAPS_BLENDTEXTUREALPHAPM        = $00004000;
  4722.   D3DTEXOPCAPS_BLENDCURRENTALPHA          = $00008000;
  4723.   D3DTEXOPCAPS_PREMODULATE                = $00010000;
  4724.   D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR     = $00020000;
  4725.   D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA     = $00040000;
  4726.   D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR  = $00080000;
  4727.   D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA  = $00100000;
  4728.   D3DTEXOPCAPS_BUMPENVMAP                 = $00200000;
  4729.   D3DTEXOPCAPS_BUMPENVMAPLUMINANCE        = $00400000;
  4730.   D3DTEXOPCAPS_DOTPRODUCT3                = $00800000;
  4731.  
  4732. { D3DDEVICEDESC dwFVFCaps flags }
  4733.  
  4734.   D3DFVFCAPS_TEXCOORDCOUNTMASK  = $0000ffff; // mask for texture coordinate count field
  4735.   D3DFVFCAPS_DONOTSTRIPELEMENTS = $00080000; // Device prefers that vertex elements not be stripped
  4736.  
  4737. { Description for a device. }
  4738.  
  4739. type
  4740.   PD3DDeviceDesc_DX3 = ^TD3DDeviceDesc_DX3;
  4741.   TD3DDeviceDesc_DX3 = record
  4742.     dwSize: DWORD;                       // Size of D3DDEVICEDESC structure
  4743.     dwFlags: DWORD;                      // Indicates which fields have valid data
  4744.     dcmColorModel: TD3DColorModel;        // Color model of device
  4745.     dwDevCaps: DWORD;                    // Capabilities of device
  4746.     dtcTransformCaps: TD3DTransformCaps; // Capabilities of transform
  4747.     bClipping: BOOL;                     // Device can do 3D clipping
  4748.     dlcLightingCaps: TD3DLightingCaps;   // Capabilities of lighting
  4749.     dpcLineCaps: TD3DPrimCaps;
  4750.     dpcTriCaps: TD3DPrimCaps;
  4751.     dwDeviceRenderBitDepth: DWORD;       // One of DDBB_8, 16, etc..
  4752.     dwDeviceZBufferBitDepth: DWORD;      // One of DDBD_16, 32, etc..
  4753.     dwMaxBufferSize: DWORD;              // Maximum execute buffer size
  4754.     dwMaxVertexCount: DWORD;             // Maximum vertex count
  4755.   end;
  4756.  
  4757.   PD3DDeviceDesc_DX5 = ^TD3DDeviceDesc_DX5;
  4758.   TD3DDeviceDesc_DX5 = record
  4759.     dwSize: DWORD;                       // Size of D3DDEVICEDESC structure
  4760.     dwFlags: DWORD;                      // Indicates which fields have valid data
  4761.     dcmColorModel: TD3DColorModel;        // Color model of device
  4762.     dwDevCaps: DWORD;                    // Capabilities of device
  4763.     dtcTransformCaps: TD3DTransformCaps; // Capabilities of transform
  4764.     bClipping: BOOL;                     // Device can do 3D clipping
  4765.     dlcLightingCaps: TD3DLightingCaps;   // Capabilities of lighting
  4766.     dpcLineCaps: TD3DPrimCaps;
  4767.     dpcTriCaps: TD3DPrimCaps;
  4768.     dwDeviceRenderBitDepth: DWORD;       // One of DDBB_8, 16, etc..
  4769.     dwDeviceZBufferBitDepth: DWORD;      // One of DDBD_16, 32, etc..
  4770.     dwMaxBufferSize: DWORD;              // Maximum execute buffer size
  4771.     dwMaxVertexCount: DWORD;             // Maximum vertex count
  4772.     // New fields for DX5
  4773.     // Width and height caps are 0 for legacy HALs.
  4774.     dwMinTextureWidth, dwMinTextureHeight  : DWORD;
  4775.     dwMaxTextureWidth, dwMaxTextureHeight  : DWORD;
  4776.     dwMinStippleWidth, dwMaxStippleWidth   : DWORD;
  4777.     dwMinStippleHeight, dwMaxStippleHeight : DWORD;
  4778.   end;
  4779.  
  4780.   PD3DDeviceDesc_DX6 = ^TD3DDeviceDesc_DX6;
  4781.   TD3DDeviceDesc_DX6 = record
  4782.     dwSize: DWORD;                       // Size of D3DDEVICEDESC structure
  4783.     dwFlags: DWORD;                      // Indicates which fields have valid data
  4784.     dcmColorModel: TD3DColorModel;        // Color model of device
  4785.     dwDevCaps: DWORD;                    // Capabilities of device
  4786.     dtcTransformCaps: TD3DTransformCaps; // Capabilities of transform
  4787.     bClipping: BOOL;                     // Device can do 3D clipping
  4788.     dlcLightingCaps: TD3DLightingCaps;   // Capabilities of lighting
  4789.     dpcLineCaps: TD3DPrimCaps;
  4790.     dpcTriCaps: TD3DPrimCaps;
  4791.     dwDeviceRenderBitDepth: DWORD;       // One of DDBB_8, 16, etc..
  4792.     dwDeviceZBufferBitDepth: DWORD;      // One of DDBD_16, 32, etc..
  4793.     dwMaxBufferSize: DWORD;              // Maximum execute buffer size
  4794.     dwMaxVertexCount: DWORD;             // Maximum vertex count
  4795.  
  4796.     // New fields for DX5
  4797.     // Width and height caps are 0 for legacy HALs.
  4798.     dwMinTextureWidth, dwMinTextureHeight  : DWORD;
  4799.     dwMaxTextureWidth, dwMaxTextureHeight  : DWORD;
  4800.     dwMinStippleWidth, dwMaxStippleWidth   : DWORD;
  4801.     dwMinStippleHeight, dwMaxStippleHeight : DWORD;
  4802.  
  4803.     // New fields for DX6
  4804.     dwMaxTextureRepeat: DWORD;
  4805.     dwMaxTextureAspectRatio: DWORD;
  4806.     dwMaxAnisotropy: DWORD;
  4807.  
  4808.     // Guard band that the rasterizer can accommodate
  4809.     // Screen-space vertices inside this space but outside the viewport
  4810.     // will get clipped properly.
  4811.     dvGuardBandLeft: TD3DValue;
  4812.     dvGuardBandTop: TD3DValue;
  4813.     dvGuardBandRight: TD3DValue;
  4814.     dvGuardBandBottom: TD3DValue;
  4815.     dvExtentsAdjust: TD3DValue;
  4816.     dwStencilCaps: DWORD;
  4817.     dwFVFCaps: DWORD;           // low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware
  4818.     dwTextureOpCaps: DWORD;
  4819.     wMaxTextureBlendStages: Word;
  4820.     wMaxSimultaneousTextures: Word;
  4821.   end;
  4822.  
  4823. {$IFDEF DirectX3}
  4824.   TD3DDeviceDesc = TD3DDeviceDesc_DX3;
  4825.   PD3DDeviceDesc = PD3DDeviceDesc_DX3;
  4826. {$ENDIF}{$IFDEF DirectX5}
  4827.   TD3DDeviceDesc = TD3DDeviceDesc_DX5;
  4828.   PD3DDeviceDesc = PD3DDeviceDesc_DX5;
  4829. {$ENDIF}{$IFDEF DirectX6}
  4830.   TD3DDeviceDesc = TD3DDeviceDesc_DX6;
  4831.   PD3DDeviceDesc = PD3DDeviceDesc_DX6;
  4832. {$ENDIF}{$IFDEF DirectX7}
  4833.   TD3DDeviceDesc = TD3DDeviceDesc_DX6;
  4834.   PD3DDeviceDesc = PD3DDeviceDesc_DX6;
  4835. {$ENDIF}
  4836.  
  4837.   D3DDEVICEDESC = TD3DDeviceDesc;
  4838.   LPD3DDEVICEDESC = PD3DDeviceDesc;
  4839.  
  4840.   PD3DDeviceDesc7 = ^TD3DDeviceDesc7;
  4841.   TD3DDeviceDesc7 = record
  4842.     dwDevCaps: DWORD;
  4843.     dpcLineCaps: TD3DPrimCaps;
  4844.     dpcTriCaps: TD3DPrimCaps;
  4845.     dwDeviceRenderBitDepth: DWORD;
  4846.     dwDeviceZBufferBitDepth: DWORD;
  4847.  
  4848.     dwMinTextureWidth: DWORD;
  4849.     dwMinTextureHeight: DWORD;
  4850.     dwMaxTextureWidth: DWORD;
  4851.     dwMaxTextureHeight: DWORD;
  4852.  
  4853.     dwMaxTextureRepeat: DWORD;
  4854.     dwMaxTextureAspectRatio: DWORD;
  4855.     dwMaxAnisotropy: DWORD;
  4856.  
  4857.     dvGuardBandLeft: TD3DValue;
  4858.     dvGuardBandTop: TD3DValue;
  4859.     dvGuardBandRight: TD3DValue;
  4860.     dvGuardBandBottom: TD3DValue;
  4861.  
  4862.     dvExtentsAdjust: TD3DValue;
  4863.     dwStencilCaps: DWORD;
  4864.  
  4865.     dwFVFCaps: DWORD;
  4866.     dwTextureOpCaps: DWORD;
  4867.     wMaxTextureBlendStages: Word;
  4868.     wMaxSimultaneousTextures: Word;
  4869.  
  4870.     dwMaxActiveLights: DWORD;
  4871.     dvMaxVertexW: TD3DValue;
  4872.     deviceGUID: TGUID;
  4873.  
  4874.     wMaxUserClipPlanes: Word;
  4875.     wMaxVertexBlendMatrices: Word;
  4876.  
  4877.     dwVertexProcessingCaps: DWORD;
  4878.  
  4879.     dwReserved1: DWORD;
  4880.     dwReserved2: DWORD;
  4881.     dwReserved3: DWORD;
  4882.     dwReserved4: DWORD;
  4883.   end;
  4884.  
  4885.  
  4886. type
  4887.   TD3DEnumDevicesCallback = function(const lpGuid: TGUID;
  4888.       lpDeviceDescription: LPSTR; lpDeviceName: LPSTR;
  4889.       const lpD3DHWDeviceDesc: TD3DDeviceDesc;
  4890.       const lpD3DHELDeviceDesc: TD3DDeviceDesc;
  4891.       lpUserArg: Pointer): HResult; stdcall;
  4892.  
  4893.   LPD3DENUMDEVICESCALLBACK = TD3DEnumDevicesCallback;
  4894.  
  4895.   TD3DEnumDevicesCallback7 = function(lpDeviceDescription: LPSTR; lpDeviceName: LPSTR;
  4896.       const lpD3DDeviceDesc: TD3DDeviceDesc7; lpUserArg: Pointer): HResult; stdcall;
  4897.  
  4898.   LPD3DENUMDEVICESCALLBACK7 = TD3DEnumDevicesCallback7;
  4899.  
  4900. { TD3DDeviceDesc dwFlags indicating valid fields }
  4901.  
  4902. const
  4903.   D3DDD_COLORMODEL            = $00000001; // dcmColorModel is valid
  4904.   D3DDD_DEVCAPS               = $00000002; // dwDevCaps is valid
  4905.   D3DDD_TRANSFORMCAPS         = $00000004; // dtcTransformCaps is valid
  4906.   D3DDD_LIGHTINGCAPS          = $00000008; // dlcLightingCaps is valid
  4907.   D3DDD_BCLIPPING             = $00000010; // bClipping is valid
  4908.   D3DDD_LINECAPS              = $00000020; // dpcLineCaps is valid
  4909.   D3DDD_TRICAPS               = $00000040; // dpcTriCaps is valid
  4910.   D3DDD_DEVICERENDERBITDEPTH  = $00000080; // dwDeviceRenderBitDepth is valid
  4911.   D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; // dwDeviceZBufferBitDepth is valid
  4912.   D3DDD_MAXBUFFERSIZE         = $00000200; // dwMaxBufferSize is valid
  4913.   D3DDD_MAXVERTEXCOUNT        = $00000400; // dwMaxVertexCount is valid
  4914.  
  4915. { TD3DDeviceDesc dwDevCaps flags }
  4916.  
  4917.   D3DDEVCAPS_FLOATTLVERTEX           = $00000001; // Device accepts floating point
  4918.                                                  // for post-transform vertex data
  4919.   D3DDEVCAPS_SORTINCREASINGZ         = $00000002; // Device needs data sorted for increasing Z
  4920.   D3DDEVCAPS_SORTDECREASINGZ         = $00000004; // Device needs data sorted for decreasing Z
  4921.   D3DDEVCAPS_SORTEXACT               = $00000008; // Device needs data sorted exactly
  4922.  
  4923.   D3DDEVCAPS_EXECUTESYSTEMMEMORY     = $00000010; // Device can use execute buffers from system memory
  4924.   D3DDEVCAPS_EXECUTEVIDEOMEMORY      = $00000020; // Device can use execute buffers from video memory
  4925.   D3DDEVCAPS_TLVERTEXSYSTEMMEMORY    = $00000040; // Device can use TL buffers from system memory
  4926.   D3DDEVCAPS_TLVERTEXVIDEOMEMORY     = $00000080; // Device can use TL buffers from video memory
  4927.   D3DDEVCAPS_TEXTURESYSTEMMEMORY     = $00000100; // Device can texture from system memory
  4928.   D3DDEVCAPS_TEXTUREVIDEOMEMORY      = $00000200; // Device can texture from device memory
  4929.   D3DDEVCAPS_DRAWPRIMTLVERTEX        = $00000400; // Device can draw TLVERTEX primitives
  4930.   D3DDEVCAPS_CANRENDERAFTERFLIP      = $00000800; // Device can render without waiting for flip to complete
  4931.   D3DDEVCAPS_TEXTURENONLOCALVIDMEM   = $00001000; // Device can texture from nonlocal video memory
  4932.   D3DDEVCAPS_DRAWPRIMITIVES2         = $00002000; // Device can support DrawPrimitives2
  4933.   D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; // Device is texturing from separate memory pools
  4934.   D3DDEVCAPS_DRAWPRIMITIVES2EX       = $00008000; // Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver
  4935.   D3DDEVCAPS_HWTRANSFORMANDLIGHT     = $00010000; // Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also
  4936.   D3DDEVCAPS_CANBLTSYSTONONLOCAL     = $00020000; // Device supports a Tex Blt from system memory to non-local vidmem
  4937.   D3DDEVCAPS_HWRASTERIZATION         = $00080000; // Device has HW acceleration for rasterization
  4938.  
  4939. { TD3DDeviceDesc7.dwVertexProcessingCaps field }
  4940.  
  4941.   D3DVTXPCAPS_TEXGEN            = $00000001;
  4942.   D3DVTXPCAPS_MATERIALSOURCE7   = $00000002;
  4943.   D3DVTXPCAPS_VERTEXFOG         = $00000004;
  4944.   D3DVTXPCAPS_DIRECTIONALLIGHTS = $00000008;
  4945.   D3DVTXPCAPS_POSITIONALLIGHTS  = $00000010;
  4946.   D3DVTXPCAPS_LOCALVIEWER       = $00000020;
  4947.  
  4948.   D3DFDS_COLORMODEL         = $00000001; // Match color model
  4949.   D3DFDS_GUID               = $00000002; // Match guid
  4950.   D3DFDS_HARDWARE           = $00000004; // Match hardware/software
  4951.   D3DFDS_TRIANGLES          = $00000008; // Match in triCaps
  4952.   D3DFDS_LINES              = $00000010; // Match in lineCaps
  4953.   D3DFDS_MISCCAPS           = $00000020; // Match primCaps.dwMiscCaps
  4954.   D3DFDS_RASTERCAPS         = $00000040; // Match primCaps.dwRasterCaps
  4955.   D3DFDS_ZCMPCAPS           = $00000080; // Match primCaps.dwZCmpCaps
  4956.   D3DFDS_ALPHACMPCAPS       = $00000100; // Match primCaps.dwAlphaCmpCaps
  4957.   D3DFDS_SRCBLENDCAPS       = $00000200; // Match primCaps.dwSourceBlendCaps
  4958.   D3DFDS_DSTBLENDCAPS       = $00000400; // Match primCaps.dwDestBlendCaps
  4959.   D3DFDS_SHADECAPS          = $00000800; // Match primCaps.dwShadeCaps
  4960.   D3DFDS_TEXTURECAPS        = $00001000; // Match primCaps.dwTextureCaps
  4961.   D3DFDS_TEXTUREFILTERCAPS  = $00002000; // Match primCaps.dwTextureFilterCaps
  4962.   D3DFDS_TEXTUREBLENDCAPS   = $00004000; // Match primCaps.dwTextureBlendCaps
  4963.   D3DFDS_TEXTUREADDRESSCAPS = $00008000; // Match primCaps.dwTextureBlendCaps
  4964.  
  4965. { FindDevice arguments }
  4966.  
  4967. type
  4968.   PD3DFindDeviceSearch = ^TD3DFindDeviceSearch;
  4969.   TD3DFindDeviceSearch = record
  4970.     dwSize: DWORD;
  4971.     dwFlags: DWORD;
  4972.     bHardware: BOOL;
  4973.     dcmColorModel: TD3DColorModel;
  4974.     guid: TGUID;
  4975.     dwCaps: DWORD;
  4976.     dpcPrimCaps: TD3DPrimCaps;
  4977.   end;
  4978.  
  4979.   D3DFINDDEVICESEARCH = TD3DFindDeviceSearch;
  4980.   LPD3DFINDDEVICESEARCH = PD3DFindDeviceSearch;
  4981.  
  4982.   PD3DFindDeviceResult = ^TD3DFindDeviceResult;
  4983.   TD3DFindDeviceResult = record
  4984.     dwSize: DWORD;
  4985.     guid: TGUID;               // guid which matched
  4986.     ddHwDesc: TD3DDeviceDesc;   // hardware TD3DDeviceDesc
  4987.     ddSwDesc: TD3DDeviceDesc;   // software TD3DDeviceDesc
  4988.   end;
  4989.  
  4990.   D3DFINDDEVICERESULT = TD3DFindDeviceResult;
  4991.   LPD3DFINDDEVICERESULT = PD3DFindDeviceResult;
  4992.  
  4993. { Description of execute buffer. }
  4994.  
  4995.   PD3DExecuteBufferDesc = ^TD3DExecuteBufferDesc;
  4996.   TD3DExecuteBufferDesc = record
  4997.     dwSize: DWORD;         // size of this structure
  4998.     dwFlags: DWORD;        // flags indicating which fields are valid
  4999.     dwCaps: DWORD;         // capabilities of execute buffer
  5000.     dwBufferSize: DWORD;   // size of execute buffer data
  5001.     lpData: Pointer;       // pointer to actual data
  5002.   end;
  5003.  
  5004.   D3DEXECUTEBUFFERDESC = TD3DExecuteBufferDesc;
  5005.   LPD3DEXECUTEBUFFERDESC = PD3DExecuteBufferDesc;
  5006.  
  5007. { D3DEXECUTEBUFFER dwFlags indicating valid fields }
  5008.  
  5009. const
  5010.   D3DDEB_BUFSIZE          = $00000001;     // buffer size valid
  5011.   D3DDEB_CAPS             = $00000002;     // caps valid
  5012.   D3DDEB_LPDATA           = $00000004;     // lpData valid
  5013.  
  5014. { D3DEXECUTEBUFFER dwCaps }
  5015.  
  5016.   D3DDEBCAPS_SYSTEMMEMORY = $00000001;     // buffer in system memory
  5017.   D3DDEBCAPS_VIDEOMEMORY  = $00000002;     // buffer in device memory
  5018.   D3DDEBCAPS_MEM          = D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY;
  5019.  
  5020. type
  5021.  
  5022. {  TD3DDevInfo_TextureManager  }
  5023.  
  5024.   PD3DDevInfo_TextureManager = ^TD3DDevInfo_TextureManager;
  5025.   TD3DDevInfo_TextureManager = record
  5026.     bThrashing: BOOL;                // indicates if thrashing
  5027.     dwApproxBytesDownloaded: DWORD;  // Approximate number of bytes downloaded by texture manager
  5028.     dwNumEvicts: DWORD;              // number of textures evicted
  5029.     dwNumVidCreates: DWORD;          // number of textures created in video memory
  5030.     dwNumTexturesUsed: DWORD;        // number of textures used
  5031.     dwNumUsedTexInVid: DWORD;        // number of used textures present in video memory
  5032.     dwWorkingSet: DWORD;             // number of textures in video memory
  5033.     dwWorkingSetBytes: DWORD;        // number of bytes in video memory
  5034.     dwTotalManaged: DWORD;           // total number of managed textures
  5035.     dwTotalBytes: DWORD;             // total number of bytes of managed textures
  5036.     dwLastPri: DWORD;                // priority of last texture evicted
  5037.   end;
  5038.  
  5039.   D3DDEVINFO_TEXTUREMANAGER = TD3DDevInfo_TextureManager;
  5040.   LPD3DDEVINFO_TEXTUREMANAGER = PD3DDevInfo_TextureManager;
  5041.  
  5042. { TD3DDevInfo_Texturing }
  5043.  
  5044.   PD3DDevInfo_Texturing = ^TD3DDevInfo_Texturing;
  5045.   TD3DDevInfo_Texturing = record
  5046.     dwNumLoads: DWORD;           // counts Load() API calls
  5047.     dwApproxBytesLoaded: DWORD;  // Approximate number bytes loaded via Load()
  5048.     dwNumPreLoads: DWORD;        // counts PreLoad() API calls
  5049.     dwNumSet: DWORD;             // counts SetTexture() API calls
  5050.     dwNumCreates: DWORD;         // counts texture creates
  5051.     dwNumDestroys: DWORD;        // counts texture destroys
  5052.     dwNumSetPriorities: DWORD;   // counts SetPriority() API calls
  5053.     dwNumSetLODs: DWORD;         // counts SetLOD() API calls
  5054.     dwNumLocks: DWORD;           // counts number of texture locks
  5055.     dwNumGetDCs: DWORD;          // counts number of GetDCs to textures
  5056.   end;
  5057.  
  5058.   D3DDEVINFO_TEXTURING = TD3DDevInfo_Texturing;
  5059.   LPD3DDEVINFO_TEXTURING = PD3DDevInfo_Texturing;
  5060.  
  5061. (*==========================================================================;
  5062.  *
  5063.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  5064.  *
  5065.  *  File:       d3d.h
  5066.  *  Content:    Direct3D include file
  5067.  *
  5068.  ***************************************************************************)
  5069.  
  5070. { Interface IID's }
  5071.  
  5072. const
  5073.   IID_IDirect3D: TGUID = '{3BBA0080-2421-11CF-A31A-00AA00B93356}';
  5074.   IID_IDirect3D2: TGUID = '{6AAE1EC1-662A-11D0-889D-00AA00BBB76A}';
  5075.   IID_IDirect3D3: TGUID = '{BB223240-E72B-11D0-A9B4-00AA00C0993E}';
  5076.   IID_IDirect3D7: TGUID = '{F5049E77-4861-11D2-A407-00A0C90629A8}';
  5077.  
  5078.   IID_IDirect3DRampDevice: TGUID = '{F2086B20-259F-11CF-A31A-00AA00B93356}';
  5079.   IID_IDirect3DRGBDevice: TGUID = '{A4665C60-2673-11CF-A31A-00AA00B93356}';
  5080.   IID_IDirect3DHALDevice: TGUID = '{84E63DE0-46AA-11CF-816F-0000C020156E}';
  5081.   IID_IDirect3DMMXDevice: TGUID = '{881949A1-D6F3-11D0-89AB-00A0C9054129}';
  5082.   IID_IDirect3DRefDevice: TGUID = '{50936643-13E9-11D1-89AA-00A0C9054129}';
  5083.   IID_IDirect3DNullDevice: TGUID = '{8767DF22-BACC-11D1-8969-00A0C90629A8}';
  5084.   IID_IDirect3DTnLHalDevice: TGUID = '{F5049E78-4861-11D2-A407-00A0C90629A8}';
  5085.  
  5086.   IID_IDirect3DDevice: TGUID = '{64108800-957D-11D0-89AB-00A0C9054129}';
  5087.   IID_IDirect3DDevice2: TGUID = '{93281501-8CF8-11D0-89AB-00A0C9054129}';
  5088.   IID_IDirect3DDevice3: TGUID = '{B0AB3B60-33D7-11D1-A981-00C04FD7B174}';
  5089.   IID_IDirect3DDevice7: TGUID = '{F5049E79-4861-11D2-A407-00A0C90629A8}';
  5090.  
  5091.   IID_IDirect3DTexture: TGUID ='{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}';
  5092.   IID_IDirect3DTexture2: TGUID = '{93281502-8CF8-11D0-89AB-00A0C9054129}';
  5093.   IID_IDirect3DLight: TGUID = '{4417C142-33AD-11CF-816F-0000C020156E}';
  5094.   IID_IDirect3DMaterial: TGUID = '{4417C144-33AD-11CF-816F-0000C020156E}';
  5095.   IID_IDirect3DMaterial2: TGUID = '{93281503-8CF8-11D0-89AB-00A0C9054129}';
  5096.   IID_IDirect3DMaterial3: TGUID = '{CA9C46F4-D3C5-11D1-B75A-00600852B312}';
  5097.   IID_IDirect3DExecuteBuffer: TGUID = '{4417C145-33AD-11CF-816F-0000C020156E}';
  5098.   IID_IDirect3DViewport: TGUID = '{4417C146-33AD-11CF-816F-0000C020156E}';
  5099.   IID_IDirect3DViewport2: TGUID = '{93281500-8CF8-11D0-89AB-00A0C9054129}';
  5100.   IID_IDirect3DViewport3: TGUID = '{B0AB3B61-33D7-11D1-A981-00C04FD7B174}';
  5101.   IID_IDirect3DVertexBuffer: TGUID = '{7A503555-4A83-11D1-A5DB-00A0C90367F8}';
  5102.   IID_IDirect3DVertexBuffer7: TGUID = '{F5049E7D-4861-11D2-A407-00A0C90629A8}';
  5103.  
  5104. { Data structures }
  5105.  
  5106. type
  5107.   IDirect3D = interface;
  5108.   IDirect3D2 = interface;
  5109.   IDirect3D3 = interface;
  5110.   IDirect3D7 = interface;
  5111.   IDirect3DDevice = interface;
  5112.   IDirect3DDevice2 = interface;
  5113.   IDirect3DDevice3 = interface;
  5114.   IDirect3DDevice7 = interface;
  5115.   IDirect3DExecuteBuffer = interface;
  5116.   IDirect3DLight = interface;
  5117.   IDirect3DMaterial = interface;
  5118.   IDirect3DMaterial2 = interface;
  5119.   IDirect3DMaterial3 = interface;
  5120.   IDirect3DTexture = interface;
  5121.   IDirect3DTexture2 = interface;
  5122.   IDirect3DViewport = interface;
  5123.   IDirect3DViewport2 = interface;
  5124.   IDirect3DViewport3 = interface;
  5125.   IDirect3DVertexBuffer = interface;
  5126.   IDirect3DVertexBuffer7 = interface;
  5127.  
  5128.   IDirect3D = interface(IUnknown)
  5129.     ['{3BBA0080-2421-11CF-A31A-00AA00B93356}']
  5130.     // IDirect3D methods
  5131.     function Initialize(const lpREFIID: TGUID): HResult; stdcall;
  5132.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  5133.         lpUserArg: Pointer): HResult; stdcall;
  5134.     function CreateLight(out lplpDirect3Dlight: IDirect3DLight;
  5135.         pUnkOuter: IUnknown): HResult; stdcall;
  5136.     function CreateMaterial(out lplpDirect3DMaterial: IDirect3DMaterial;
  5137.         pUnkOuter: IUnknown): HResult; stdcall;
  5138.     function CreateViewport(out lplpD3DViewport: IDirect3DViewport;
  5139.         pUnkOuter: IUnknown): HResult; stdcall;
  5140.     function FindDevice(const lpD3DFDS: TD3DFindDeviceSearch;
  5141.         var lpD3DFDR: TD3DFindDeviceResult): HResult; stdcall;
  5142.   end;
  5143.  
  5144.   IDirect3D2 = interface(IUnknown)
  5145.     ['{6AAE1EC1-662A-11D0-889D-00AA00BBB76A}']
  5146.     // IDirect3D methods
  5147.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  5148.         lpUserArg: Pointer): HResult; stdcall;
  5149.     function CreateLight(out lplpDirect3Dlight: IDirect3DLight;
  5150.         pUnkOuter: IUnknown): HResult; stdcall;
  5151.     function CreateMaterial(out lplpDirect3DMaterial: IDirect3DMaterial2;
  5152.         pUnkOuter: IUnknown): HResult; stdcall;
  5153.     function CreateViewport(out lplpD3DViewport: IDirect3DViewport2;
  5154.         pUnkOuter: IUnknown ): HResult; stdcall;
  5155.     function FindDevice(const lpD3DFDS: TD3DFindDeviceSearch;
  5156.         var lpD3DFDR: TD3DFindDeviceResult): HResult; stdcall;
  5157.     // IDirect3D2 methods
  5158.     function CreateDevice(const rclsid: TGUID; lpDDS: IDirectDrawSurface;
  5159.         out lplpD3DDevice2: IDirect3DDevice2): HResult; stdcall;
  5160.   end;
  5161.  
  5162.   IDirect3D3 = interface(IUnknown)
  5163.     ['{BB223240-E72B-11D0-A9B4-00AA00C0993E}']
  5164.     // IDirect3D methods
  5165.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  5166.         lpUserArg: Pointer): HResult; stdcall;
  5167.     function CreateLight(out lplpDirect3Dlight: IDirect3DLight;
  5168.         pUnkOuter: IUnknown): HResult; stdcall;
  5169.     function CreateMaterial(out lplpDirect3DMaterial: IDirect3DMaterial3;
  5170.         pUnkOuter: IUnknown): HResult; stdcall;
  5171.     function CreateViewport(out lplpD3DViewport: IDirect3DViewport3;
  5172.         pUnkOuter: IUnknown ): HResult; stdcall;
  5173.     function FindDevice(const lpD3DFDS: TD3DFindDeviceSearch;
  5174.         var lpD3DFDR: TD3DFindDeviceResult): HResult; stdcall;
  5175.     // IDirect3D2 methods
  5176.     function CreateDevice(const rclsid: TGUID; lpDDS: IDirectDrawSurface4;
  5177.         out lplpD3DDevice2: IDirect3DDevice3; pUnkOuter: IUnknown): HResult; stdcall;
  5178.     // IDirect3D3 methods                            
  5179.     function CreateVertexBuffer(const lpVBDesc: TD3DVertexBufferDesc;
  5180.         out lpD3DVertexBuffer: IDirect3DVertexBuffer; dwFlags: DWORD; pUnkOuter: IUnknown): HResult; stdcall;
  5181.     function EnumZBufferFormats(const riidDevice: TGUID; lpEnumCallback: TD3DEnumPixelFormatsCallback;
  5182.       lpContext: Pointer): HResult; stdcall;
  5183.     function EvictManagedTextures: HResult; stdcall;
  5184.   end;
  5185.  
  5186.   IDirect3D7 = interface(IUnknown)
  5187.     ['{F5049E77-4861-11D2-A407-00A0C90629A8}']
  5188.     // IDirect3D7 methods
  5189.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback7;
  5190.         lpUserArg: Pointer): HResult; stdcall;
  5191.     function CreateDevice(const rclsid: TGUID; lpDDS: IDirectDrawSurface7;
  5192.         out lplpD3DDevice7: IDirect3DDevice7): HResult; stdcall;
  5193.     function CreateVertexBuffer(const lpVBDesc: TD3DVertexBufferDesc;
  5194.         out lpD3DVertexBuffer: IDirect3DVertexBuffer7; dwFlags: DWORD): HResult; stdcall;
  5195.     function EnumZBufferFormats(const riidDevice: TGUID; lpEnumCallback: TD3DEnumPixelFormatsCallback;
  5196.       lpContext: Pointer): HResult; stdcall;
  5197.     function EvictManagedTextures: HResult; stdcall;
  5198.   end;
  5199.  
  5200.   IDirect3DDevice = interface(IUnknown)
  5201.     ['{64108800-957D-11D0-89AB-00A0C9054129}']
  5202.     // IDirect3DDevice methods
  5203.     function Initialize(lpd3d: IDirect3D; const lpGUID: TGUID;
  5204.         const lpd3ddvdesc: TD3DDeviceDesc): HResult; stdcall;
  5205.     function GetCaps(var lpD3DHWDevDesc: TD3DDeviceDesc;
  5206.         var lpD3DHELDevDesc: TD3DDeviceDesc): HResult; stdcall;
  5207.     function SwapTextureHandles(lpD3DTex1: IDirect3DTexture;
  5208.         lpD3DTex2: IDirect3DTexture): HResult; stdcall;
  5209.     function CreateExecuteBuffer(const lpDesc: TD3DExecuteBufferDesc;
  5210.         out lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  5211.         pUnkOuter: IUnknown): HResult; stdcall;
  5212.     function GetStats(var lpD3DStats: TD3DStats): HResult; stdcall;
  5213.     function Execute(lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  5214.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD): HResult; stdcall;
  5215.     function AddViewport(lpDirect3DViewport: IDirect3DViewport): HResult; stdcall;
  5216.     function DeleteViewport(lpDirect3DViewport: IDirect3DViewport): HResult; stdcall;
  5217.     function NextViewport(lpDirect3DViewport: IDirect3DViewport;
  5218.         out lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD): HResult; stdcall;
  5219.     function Pick(lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  5220.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD;
  5221.         const lpRect: TD3DRect): HResult; stdcall;
  5222.     function GetPickRecords(var lpCount: DWORD;
  5223.         var lpD3DPickRec: TD3DPickRecord): HResult; stdcall;
  5224.     function EnumTextureFormats(lpd3dEnumTextureProc: TD3DEnumTextureFormatsCalback;
  5225.         lpArg: Pointer): HResult; stdcall;
  5226.     function CreateMatrix(var lpD3DMatHandle: TD3DMatrixHandle): HResult; stdcall;
  5227.     function SetMatrix(d3dMatHandle: TD3DMatrixHandle;
  5228.         const lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5229.     function GetMatrix(lpD3DMatHandle: TD3DMatrixHandle;
  5230.         var lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5231.     function DeleteMatrix(d3dMatHandle: TD3DMatrixHandle): HResult; stdcall;
  5232.     function BeginScene: HResult; stdcall;
  5233.     function EndScene: HResult; stdcall;
  5234.     function GetDirect3D(out lpD3D: IDirect3D): HResult; stdcall;
  5235.   end;
  5236.  
  5237.   IDirect3DDevice2 = interface(IUnknown)
  5238.     ['{93281501-8CF8-11D0-89AB-00A0C9054129}']
  5239.     // IDirect3DDevice2 methods
  5240.     function GetCaps(var lpD3DHWDevDesc: TD3DDeviceDesc;
  5241.         var lpD3DHELDevDesc: TD3DDeviceDesc): HResult; stdcall;
  5242.     function SwapTextureHandles(lpD3DTex1: IDirect3DTexture2;
  5243.         lpD3DTex2: IDirect3DTexture2): HResult; stdcall;
  5244.     function GetStats(var lpD3DStats: TD3DStats): HResult; stdcall;
  5245.     function AddViewport(lpDirect3DViewport: IDirect3DViewport2): HResult; stdcall;
  5246.     function DeleteViewport(lpDirect3DViewport: IDirect3DViewport2): HResult; stdcall;
  5247.     function NextViewport(lpDirect3DViewport: IDirect3DViewport2;
  5248.         out lplpDirect3DViewport: IDirect3DViewport2; dwFlags: DWORD): HResult; stdcall;
  5249.     function EnumTextureFormats(lpd3dEnumTextureProc: TD3DEnumTextureFormatsCalback;
  5250.         lpArg: Pointer): HResult; stdcall;
  5251.     function BeginScene: HResult; stdcall;
  5252.     function EndScene: HResult; stdcall;
  5253.     function GetDirect3D(out lpD3D: IDirect3D2): HResult; stdcall;
  5254.     function SetCurrentViewport(lpd3dViewport2: IDirect3DViewport2): HResult; stdcall;
  5255.     function GetCurrentViewport(out lplpd3dViewport2: IDirect3DViewport2): HResult; stdcall;
  5256.     function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface): HResult; stdcall;
  5257.     function GetRenderTarget(out lplpNewRenderTarget: IDirectDrawSurface): HResult; stdcall;
  5258.     function Begin_(d3dpt: TD3DPrimitiveType; d3dvt: TD3DVertexType;
  5259.         dwFlags: DWORD): HResult; stdcall;
  5260.     function BeginIndexed(dptPrimitiveType: TD3DPrimitiveType; dvtVertexType:
  5261.         TD3DVertexType; const lpvVertices; dwNumVertices: DWORD;
  5262.         dwFlags: DWORD): HResult; stdcall;
  5263.     function Vertex(const lpVertexType): HResult; stdcall;
  5264.     function Index(wVertexIndex: WORD): HResult; stdcall;
  5265.     function End_(dwFlags: DWORD): HResult; stdcall;
  5266.     function GetRenderState(dwRenderStateType: TD3DRenderStateType;
  5267.         var lpdwRenderState: DWORD): HResult; stdcall;
  5268.     function SetRenderState(dwRenderStateType: TD3DRenderStateType;
  5269.         dwRenderState: DWORD): HResult; stdcall;
  5270.     function GetLightState(dwLightStateType: TD3DLightStateType;
  5271.         var lpdwLightState: DWORD): HResult; stdcall;
  5272.     function SetLightState(dwLightStateType: TD3DLightStateType;
  5273.         dwLightState: DWORD): HResult; stdcall;
  5274.     function SetTransform(dtstTransformStateType: TD3DTransformStateType;
  5275.         const lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5276.     function GetTransform(dtstTransformStateType: TD3DTransformStateType;
  5277.         var lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5278.     function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType;
  5279.         var lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5280.     function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  5281.         dvtVertexType: TD3DVertexType; const lpvVertices; dwVertexCount,
  5282.         dwFlags: DWORD): HResult; stdcall;
  5283.     function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  5284.         dvtVertexType: TD3DVertexType; const lpvVertices;
  5285.         dwVertexCount: DWORD; const dwIndices; dwIndexCount: DWORD;
  5286.         dwFlags: DWORD): HResult; stdcall;
  5287.     function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus): HResult; stdcall;
  5288.     function GetClipStatus(var lpD3DClipStatus: TD3DClipStatus): HResult; stdcall;
  5289.   end;
  5290.  
  5291.   IDirect3DDevice3 = interface(IUnknown)
  5292.     ['{B0AB3B60-33D7-11D1-A981-00C04FD7B174}']
  5293.     // IDirect3DDevice3 methods
  5294.     function GetCaps(var lpD3DHWDevDesc: TD3DDeviceDesc;
  5295.         var lpD3DHELDevDesc: TD3DDeviceDesc): HResult; stdcall;
  5296.     function GetStats(var lpD3DStats: TD3DStats): HResult; stdcall;
  5297.     function AddViewport(lpDirect3DViewport: IDirect3DViewport3): HResult; stdcall;
  5298.     function DeleteViewport(lpDirect3DViewport: IDirect3DViewport3): HResult; stdcall;
  5299.     function NextViewport(lpDirect3DViewport: IDirect3DViewport3;
  5300.         out lplpDirect3DViewport: IDirect3DViewport3; dwFlags: DWORD): HResult; stdcall;
  5301.     function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback;
  5302.         lpArg: Pointer): HResult; stdcall;
  5303.     function BeginScene: HResult; stdcall;
  5304.     function EndScene: HResult; stdcall;
  5305.     function GetDirect3D(out lpD3D: IDirect3D3): HResult; stdcall;
  5306.     function SetCurrentViewport(lpd3dViewport: IDirect3DViewport3): HResult; stdcall;
  5307.     function GetCurrentViewport(out lplpd3dViewport: IDirect3DViewport3): HResult; stdcall;
  5308.     function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface4): HResult; stdcall;
  5309.     function GetRenderTarget(out lplpNewRenderTarget: IDirectDrawSurface4): HResult; stdcall;
  5310.     function Begin_(d3dpt: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  5311.         dwFlags: DWORD): HResult; stdcall;
  5312.     function BeginIndexed(dptPrimitiveType: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  5313.       const lpvVertices; dwNumVertices: DWORD; dwFlags: DWORD): HResult; stdcall;
  5314.     function Vertex(const lpVertexType): HResult; stdcall;
  5315.     function Index(wVertexIndex: WORD): HResult; stdcall;
  5316.     function End_(dwFlags: DWORD): HResult; stdcall;
  5317.     function GetRenderState(dwRenderStateType: TD3DRenderStateType;
  5318.         var lpdwRenderState: DWORD): HResult; stdcall;
  5319.     function SetRenderState(dwRenderStateType: TD3DRenderStateType;
  5320.         dwRenderState: DWORD): HResult; stdcall;
  5321.     function GetLightState(dwLightStateType: TD3DLightStateType;
  5322.         var lpdwLightState: DWORD): HResult; stdcall;
  5323.     function SetLightState(dwLightStateType: TD3DLightStateType;
  5324.         dwLightState: DWORD): HResult; stdcall;
  5325.     function SetTransform(dtstTransformStateType: TD3DTransformStateType;
  5326.         const lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5327.     function GetTransform(dtstTransformStateType: TD3DTransformStateType;
  5328.         var lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5329.     function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType;
  5330.         var lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5331.     function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  5332.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount,
  5333.         dwFlags: DWORD): HResult; stdcall;
  5334.     function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  5335.         dwVertexTypeDesc: DWORD; const lpvVertices;
  5336.         dwVertexCount: DWORD; const dwIndices; dwIndexCount: DWORD;
  5337.         dwFlags: DWORD): HResult; stdcall;
  5338.     function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus): HResult; stdcall;
  5339.     function GetClipStatus(var lpD3DClipStatus: TD3DClipStatus): HResult; stdcall;
  5340.     function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  5341.         dwVertexTypeDesc: DWORD; const lpVertexArray;
  5342.         dwVertexCount: DWORD; dwFlags: DWORD): HResult; stdcall;
  5343.     function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  5344.         dwVertexTypeDesc: DWORD; const lpVertexArray;
  5345.         dwVertexCount: DWORD; const lpwIndices; dwIndexCount: DWORD; dwFlags: DWORD): HResult; stdcall;
  5346.     function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  5347.         lpd3dVertexBuffer: IDirect3DVertexBuffer; dwStartVertex, dwNumVertices: DWORD;
  5348.         dwFlags: DWORD): HResult; stdcall;
  5349.     function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  5350.         lpd3dVertexBuffer: IDirect3DVertexBuffer; const lpwIndices; dwIndexCount: DWORD;
  5351.         dwFlags: DWORD): HResult; stdcall;
  5352.     function ComputeSphereVisibility(const lpCenters; const lpRadii;
  5353.         dwNumSpheres: DWORD; dwFlags: DWORD; var lpdwReturnValues): HResult; stdcall;
  5354.     function GetTexture(dwStage: DWORD; out lplpTexture: IDirect3DTexture2): HResult; stdcall;
  5355.     function SetTexture(dwStage: DWORD; lpTexture: IDirect3DTexture2): HResult; stdcall;
  5356.     function GetTextureStageState(dwStage: DWORD; dwState: TD3DTextureStagesStateType;
  5357.        var lpdwValue: DWORD): HResult; stdcall;
  5358.     function SetTextureStageState(dwStage: DWORD; dwState: TD3DTextureStagesStateType;
  5359.        lpdwValue: DWORD): HResult; stdcall;
  5360.     function ValidateDevice(var lpdwPasses: DWORD): HResult; stdcall;
  5361.   end;
  5362.  
  5363.   IDirect3DDevice7 = interface(IUnknown)
  5364.     ['{F5049E79-4861-11D2-A407-00A0C90629A8}']
  5365.     // IDirect3DDevice7 methods
  5366.     function GetCaps(var lpD3DDeviceDesc: TD3DDeviceDesc7): HResult; stdcall;
  5367.     function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback;
  5368.         lpArg: Pointer): HResult; stdcall;
  5369.     function BeginScene: HResult; stdcall;
  5370.     function EndScene: HResult; stdcall;
  5371.     function GetDirect3D(out lplpD3D: IDirect3D7): HResult; stdcall;
  5372.     function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface7; dwFlags: DWORD): HResult; stdcall;
  5373.     function GetRenderTarget(out lplpRenderTarget: IDirectDrawSurface7): HResult; stdcall;
  5374.     function Clear(dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD; dwColor: TD3DColor;
  5375.         dvZ: TD3DValue; dwStencil: DWORD): HResult; stdcall;
  5376.     function SetTransform(dtstTransformStateType: TD3DTransformStateType; const lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5377.     function GetTransform(dtstTransformStateType: TD3DTransformStateType; var lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5378.     function SetViewport(const lpViewport: TD3DViewport7): HResult; stdcall;
  5379.     function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType; const lpD3DMatrix: TD3DMatrix): HResult; stdcall;
  5380.     function GetViewport(var lpViewport: TD3DViewport7): HResult; stdcall;
  5381.     function SetMaterial(const lpMaterial: TD3DMaterial7): HResult; stdcall;
  5382.     function GetMaterial(var lpMaterial: TD3DMaterial7): HResult; stdcall;
  5383.     function SetLight(dwLightIndex: DWORD; const lpLight: TD3DLight7): HResult; stdcall;
  5384.     function GetLight(dwLightIndex: DWORD; var lpLight: TD3DLight7): HResult; stdcall;
  5385.     function SetRenderState(dwRenderStateType: TD3DRenderStateType; dwRenderState: DWORD): HResult; stdcall;
  5386.     function GetRenderState(dwRenderStateType: TD3DRenderStateType; var lpdwRenderState: DWORD): HResult; stdcall;
  5387.     function BeginStateBlock: HResult; stdcall;
  5388.     function EndStateBlock(var lpdwBlockHandle: DWORD): HResult; stdcall;
  5389.     function PreLoad(lpddsTexture: IDirectDrawSurface7): HResult; stdcall;
  5390.     function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  5391.         const lpvVertices; dwVertexCount: DWORD; dwFlags: DWORD): HResult; stdcall;
  5392.     function DrawIndexedPrimitive(d3dptPrimitiveType: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  5393.         const lpvVertices; dwVertexCount: DWORD; const lpwIndices; dwIndexCount: DWORD; dwFlags: DWORD): HResult; stdcall;
  5394.     function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus): HResult; stdcall;
  5395.     function GetClipStatus(var lpD3DClipStatus: TD3DClipStatus): HResult; stdcall;
  5396.     function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  5397.         const lpVertexArray; dwVertexCount: DWORD; dwFlags: DWORD): HResult; stdcall;
  5398.     function DrawIndexedPrimitiveStrided(d3dptPrimitiveType: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  5399.         const lpVertexArray; dwVertexCount: DWORD; const lpwIndices; dwIndexCount: DWORD; dwFlags: DWORD): HResult; stdcall;
  5400.     function DrawPrimitiveVB(d3dptPrimitiveType: TD3DPrimitiveType; lpd3dVertexBuffer: IDirect3DVertexBuffer7;
  5401.         dwStartVertex: DWORD; dwNumVertices: DWORD; dwFlags: DWORD): HResult; stdcall;
  5402.     function DrawIndexedPrimitiveVB(d3dptPrimitiveType: TD3DPrimitiveType; lpd3dVertexBuffer: IDirect3DVertexBuffer7;
  5403.         dwStartVertex: DWORD; dwNumVertices: DWORD; const lpwIndices; dwIndexCount: DWORD; dwFlags: DWORD): HResult; stdcall;
  5404.     function ComputeSphereVisibility(const lpCenters; const lpRadii; dwNumSpheres: DWORD; dwFlags: DWORD; var lpdwReturnValue): HResult; stdcall;
  5405.     function GetTexture(dwStage: DWORD; out lplpTexture: IDirectDrawSurface7): HResult; stdcall;
  5406.     function SetTexture(dwStage: DWORD; lpTexture: IDirectDrawSurface7): HResult; stdcall;
  5407.     function GetTextureStageState(dwStage: DWORD; dwState: TD3DTextureStagesStateType; var lpdwValue: DWORD): HResult; stdcall;
  5408.     function SetTextureStageState(dwStage: DWORD; dwState: TD3DTextureStagesStateType; dwValue: DWORD): HResult; stdcall;
  5409.     function ValidateDevice(var lpdwPasses: DWORD): HResult; stdcall;
  5410.     function ApplyStateBlock(dwBlockHandle: DWORD): HResult; stdcall;
  5411.     function CaptureStateBlock(dwBlockHandle: DWORD): HResult; stdcall;
  5412.     function DeleteStateBlock(dwBlockHandle: DWORD): HResult; stdcall;
  5413.     function CreateStateBlock(d3dsbType: TD3DSTATEBLOCKTYPE; var lpdwBlockHandle: DWORD): HResult; stdcall;
  5414.     function Load(lpDestTex: IDirectDrawSurface7; const lpDestPoint: TPoint; lpSrcTex: IDirectDrawSurface7; const lprcSrcRect: TRect; dwFlags: DWORD): HResult; stdcall;
  5415.     function LightEnable(dwLightIndex: DWORD; bEnable: BOOL): HResult; stdcall;
  5416.     function GetLightEnable(dwLightIndex: DWORD; var pbEnable: BOOL): HResult; stdcall;
  5417.     function SetClipPlane(dwIndex: DWORD; const pPlaneEquation): HResult; stdcall;
  5418.     function GetClipPlane(dwIndex: DWORD; var pPlaneEquation): HResult; stdcall;
  5419.     function GetInfo(dwDevInfoID: DWORD; pDevInfoStruct: Pointer; dwSize: DWORD): HResult; stdcall;
  5420.   end;
  5421.  
  5422.   IDirect3DExecuteBuffer = interface(IUnknown)
  5423.     ['{4417C145-33AD-11CF-816F-0000C020156E}']
  5424.     // IDirect3DExecuteBuffer methods
  5425.     function Initialize(lpDirect3DDevice: IDirect3DDevice;
  5426.         const lpDesc: TD3DExecuteBufferDesc): HResult; stdcall;
  5427.     function Lock(var lpDesc: TD3DExecuteBufferDesc): HResult; stdcall;
  5428.     function Unlock: HResult; stdcall;
  5429.     function SetExecuteData(const lpData: TD3DExecuteData): HResult; stdcall;
  5430.     function GetExecuteData(var lpData: TD3DExecuteData): HResult; stdcall;
  5431.     function Validate(var lpdwOffset: DWORD; lpFunc: TD3DValidateCallback;
  5432.         lpUserArg: Pointer; dwReserved: DWORD): HResult; stdcall;
  5433.     function Optimize(dwFlags: DWORD): HResult; stdcall;
  5434.   end;
  5435.  
  5436.   IDirect3DLight = interface(IUnknown)
  5437.     ['{4417C142-33AD-11CF-816F-0000C020156E}']
  5438.     // IDirect3DLight methods
  5439.     function Initialize(lpDirect3D: IDirect3D): HResult; stdcall;
  5440.     function SetLight(const lpLight: TD3DLight): HResult; stdcall;
  5441.     function GetLight(var lpLight: TD3DLight): HResult; stdcall;
  5442.   end;
  5443.  
  5444.   IDirect3DMaterial = interface(IUnknown)
  5445.     ['{4417C144-33AD-11CF-816F-0000C020156E}']
  5446.     // IDirect3DMaterial methods
  5447.     function Initialize(lpDirect3D: IDirect3D): HResult; stdcall;
  5448.     function SetMaterial(const lpMat: TD3DMaterial): HResult; stdcall;
  5449.     function GetMaterial(var lpMat: TD3DMaterial): HResult; stdcall;
  5450.     function GetHandle(lpDirect3DDevice: IDirect3DDevice;
  5451.         var lpHandle: TD3DMaterialHandle): HResult; stdcall;
  5452.     function Reserve: HResult; stdcall;
  5453.     function Unreserve: HResult; stdcall;
  5454.   end;
  5455.  
  5456.   IDirect3DMaterial2 = interface(IUnknown)
  5457.     ['{93281503-8CF8-11D0-89AB-00A0C9054129}']
  5458.     // IDirect3DMaterial2 methods
  5459.     function SetMaterial(const lpMat: TD3DMaterial): HResult; stdcall;
  5460.     function GetMaterial(var lpMat: TD3DMaterial): HResult; stdcall;
  5461.     function GetHandle(lpDirect3DDevice: IDirect3DDevice2;
  5462.         var lpHandle: TD3DMaterialHandle): HResult; stdcall;
  5463.   end;
  5464.  
  5465.   IDirect3DMaterial3 = interface(IUnknown)
  5466.     ['{CA9C46F4-D3C5-11D1-B75A-00600852B312}']
  5467.     // IDirect3DMaterial3 methods
  5468.     function SetMaterial(const lpMat: TD3DMaterial): HResult; stdcall;
  5469.     function GetMaterial(var lpMat: TD3DMaterial): HResult; stdcall;
  5470.     function GetHandle(lpDirect3DDevice: IDirect3DDevice3;
  5471.         var lpHandle: TD3DMaterialHandle): HResult; stdcall;
  5472.   end;
  5473.  
  5474.   IDirect3DTexture = interface(IUnknown)
  5475.     ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}']
  5476.     // IDirect3DTexture methods
  5477.     function Initialize(lpD3DDevice: IDirect3DDevice;
  5478.         lpDDSurface: IDirectDrawSurface): HResult; stdcall;
  5479.     function GetHandle(lpDirect3DDevice: IDirect3DDevice;
  5480.         var lpHandle: TD3DTextureHandle): HResult; stdcall;
  5481.     function PaletteChanged(dwStart: DWORD; dwCount: DWORD): HResult; stdcall;
  5482.     function Load(lpD3DTexture: IDirect3DTexture): HResult; stdcall;
  5483.     function Unload: HResult; stdcall;
  5484.   end;
  5485.  
  5486.   IDirect3DTexture2 = interface(IUnknown)
  5487.     ['{93281502-8CF8-11D0-89AB-00A0C9054129}']
  5488.     // IDirect3DTexture2 methods
  5489.     function GetHandle(lpDirect3DDevice2: IDirect3DDevice2;
  5490.         var lpHandle: TD3DTextureHandle): HResult; stdcall;
  5491.     function PaletteChanged(dwStart: DWORD; dwCount: DWORD): HResult; stdcall;
  5492.     function Load(lpD3DTexture2: IDirect3DTexture2): HResult; stdcall;
  5493.   end;
  5494.  
  5495.   IDirect3DViewport = interface(IUnknown)
  5496.     ['{4417C146-33AD-11CF-816F-0000C020156E}']
  5497.     // IDirect3DViewport methods
  5498.     function Initialize(lpDirect3D: IDirect3D): HResult; stdcall;
  5499.     function GetViewport(var lpData: TD3DViewport): HResult; stdcall;
  5500.     function SetViewport(const lpData: TD3DViewport): HResult; stdcall;
  5501.     function TransformVertices(dwVertexCount: DWORD;
  5502.         var lpData: TD3DTransformData; dwFlags: DWORD;
  5503.         var lpOffscreen: DWORD): HResult; stdcall;
  5504.     function LightElements(dwElementCount: DWORD;
  5505.         var lpData: TD3DLightData): HResult; stdcall;
  5506.     function SetBackground(hMat: TD3DMaterialHandle): HResult; stdcall;
  5507.     function GetBackground(hMat: TD3DMaterialHandle): HResult; stdcall;
  5508.     function SetBackgroundDepth(lpDDSurface: IDirectDrawSurface): HResult; stdcall;
  5509.     function GetBackgroundDepth(out lplpDDSurface: IDirectDrawSurface;
  5510.         var lpValid: BOOL): HResult; stdcall;
  5511.     function Clear(dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD): HResult; stdcall;
  5512.     function AddLight(lpDirect3DLight: IDirect3DLight): HResult; stdcall;
  5513.     function DeleteLight(lpDirect3DLight: IDirect3DLight): HResult; stdcall;
  5514.     function NextLight(lpDirect3DLight: IDirect3DLight;
  5515.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD): HResult; stdcall;
  5516.   end;
  5517.  
  5518.   IDirect3DViewport2 = interface(IDirect3DViewport)
  5519.     ['{93281500-8CF8-11D0-89AB-00A0C9054129}']
  5520.     // IDirect3DViewport2 methods
  5521.     function GetViewport2(var lpData: TD3DViewport2): HResult; stdcall;
  5522.     function SetViewport2(const lpData: TD3DViewport2): HResult; stdcall;
  5523.   end;
  5524.  
  5525.   IDirect3DViewport3 = interface(IDirect3DViewport2)
  5526.     ['{B0AB3B61-33D7-11D1-A981-00C04FD7B174}']
  5527.     // IDirect3DViewport3 methods
  5528.     function SetBackgroundDepth2(lpDDS: IDirectDrawSurface4): HResult; stdcall;
  5529.     function GetBackgroundDepth2(out lplpDDS: IDirectDrawSurface4; var lpValid: BOOL): HResult; stdcall;
  5530.     function Clear2(dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD;
  5531.         dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD): HResult; stdcall;
  5532.   end;
  5533.  
  5534.   IDirect3DVertexBuffer = interface(IUnknown)
  5535.     ['{7A503555-4A83-11D1-A5DB-00A0C90367F8}']
  5536.     // IDirect3DVertexBuffer methods
  5537.     function Lock(dwFlags: DWORD; var lplpData: Pointer; var lpdwSize: DWORD): HResult; stdcall;
  5538.     function Unlock: HResult; stdcall;
  5539.     function ProcessVertices(dwVertexOp: DWORD; dwDestIndex: DWORD; dwCount: DWORD;
  5540.       lpSrcBuffer: IDirect3DVertexBuffer; dwSrcIndex: DWORD;
  5541.       lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD): HResult; stdcall;
  5542.     function GetVertexBufferDesc(var lpVBDesc: TD3DVertexBufferDesc): HResult; stdcall;
  5543.     function Optimize(lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD): HResult; stdcall;
  5544.   end;
  5545.  
  5546.   IDirect3DVertexBuffer7 = interface(IUnknown)
  5547.     ['{F5049E7D-4861-11D2-A407-00A0C90629A8}']
  5548.     // IDirect3DVertexBuffer7 methods
  5549.     function Lock(dwFlags: DWORD; var lplpData: Pointer; var lpdwSize: DWORD): HResult; stdcall;
  5550.     function Unlock: HResult; stdcall;
  5551.     function ProcessVertices(dwVertexOp: DWORD; dwDestIndex: DWORD; dwCount: DWORD;
  5552.       lpSrcBuffer: IDirect3DVertexBuffer7; dwSrcIndex: DWORD; lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD): HResult; stdcall;
  5553.     function GetVertexBufferDesc(var lpVBDesc: TD3DVertexBufferDesc): HResult; stdcall;
  5554.     function Optimize(lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD): HResult; stdcall;
  5555.     function ProcessVerticesStrided(dwVertexOp: DWORD; dwDestIndex: DWORD; dwCount: DWORD;
  5556.       const lpVertexArray; dwSrcIndex: DWORD; lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD): HResult; stdcall;
  5557.   end;
  5558.  
  5559. const
  5560.  
  5561. { Flags for IDirect3DDevice::NextViewport }
  5562.  
  5563.   D3DNEXT_NEXT = $00000001;
  5564.   D3DNEXT_HEAD = $00000002;
  5565.   D3DNEXT_TAIL = $00000004;
  5566.  
  5567. { Flags for DrawPrimitive/DrawIndexedPrimitive
  5568.    Also valid for Begin/BeginIndexed }
  5569.  
  5570.   D3DDP_WAIT               = $00000001;
  5571.   D3DDP_OUTOFORDER         = $00000002;
  5572.   D3DDP_DONOTCLIP          = $00000004;
  5573.   D3DDP_DONOTUPDATEEXTENTS = $00000008;
  5574.   D3DDP_DONOTLIGHT         = $00000010;
  5575.  
  5576. { Direct3D Errors }
  5577.  
  5578. const
  5579.   D3D_OK                  = HResult(DD_OK);
  5580.   D3DERR_BADMAJORVERSION  = HResult($88760000 + 700);
  5581.   D3DERR_BADMINORVERSION  = HResult($88760000 + 701);
  5582.  
  5583. { An invalid device was requested by the application. }
  5584.  
  5585.   D3DERR_INVALID_DEVICE   = HResult($88760000 + 705);
  5586.   D3DERR_INITFAILED       = HResult($88760000 + 706);
  5587.  
  5588. { SetRenderTarget attempted on a device that was
  5589.   QI'd off the render target. }
  5590.  
  5591.   D3DERR_DEVICEAGGREGATED          = HResult($88760000 + 707);
  5592.  
  5593.   D3DERR_EXECUTE_CREATE_FAILED     = HResult($88760000 + 710);
  5594.   D3DERR_EXECUTE_DESTROY_FAILED    = HResult($88760000 + 711);
  5595.   D3DERR_EXECUTE_LOCK_FAILED       = HResult($88760000 + 712);
  5596.   D3DERR_EXECUTE_UNLOCK_FAILED     = HResult($88760000 + 713);
  5597.   D3DERR_EXECUTE_LOCKED            = HResult($88760000 + 714);
  5598.   D3DERR_EXECUTE_NOT_LOCKED        = HResult($88760000 + 715);
  5599.  
  5600.   D3DERR_EXECUTE_FAILED            = HResult($88760000 + 716);
  5601.   D3DERR_EXECUTE_CLIPPED_FAILED    = HResult($88760000 + 717);
  5602.  
  5603.   D3DERR_TEXTURE_NO_SUPPORT        = HResult($88760000 + 720);
  5604.   D3DERR_TEXTURE_CREATE_FAILED     = HResult($88760000 + 721);
  5605.   D3DERR_TEXTURE_DESTROY_FAILED    = HResult($88760000 + 722);
  5606.   D3DERR_TEXTURE_LOCK_FAILED       = HResult($88760000 + 723);
  5607.   D3DERR_TEXTURE_UNLOCK_FAILED     = HResult($88760000 + 724);
  5608.   D3DERR_TEXTURE_LOAD_FAILED       = HResult($88760000 + 725);
  5609.   D3DERR_TEXTURE_SWAP_FAILED       = HResult($88760000 + 726);
  5610.   D3DERR_TEXTURE_LOCKED            = HResult($88760000 + 727);
  5611.   D3DERR_TEXTURE_NOT_LOCKED        = HResult($88760000 + 728);
  5612.   D3DERR_TEXTURE_GETSURF_FAILED    = HResult($88760000 + 729);
  5613.  
  5614.   D3DERR_MATRIX_CREATE_FAILED      = HResult($88760000 + 730);
  5615.   D3DERR_MATRIX_DESTROY_FAILED     = HResult($88760000 + 731);
  5616.   D3DERR_MATRIX_SETDATA_FAILED     = HResult($88760000 + 732);
  5617.   D3DERR_MATRIX_GETDATA_FAILED     = HResult($88760000 + 733);
  5618.   D3DERR_SETVIEWPORTDATA_FAILED    = HResult($88760000 + 734);
  5619.  
  5620.   D3DERR_INVALIDCURRENTVIEWPORT    = HResult($88760000 + 735);
  5621.   D3DERR_INVALIDPRIMITIVETYPE      = HResult($88760000 + 736);
  5622.   D3DERR_INVALIDVERTEXTYPE         = HResult($88760000 + 737);
  5623.   D3DERR_TEXTURE_BADSIZE           = HResult($88760000 + 738);
  5624.   D3DERR_INVALIDRAMPTEXTURE        = HResult($88760000 + 739);
  5625.  
  5626.   D3DERR_MATERIAL_CREATE_FAILED    = HResult($88760000 + 740);
  5627.   D3DERR_MATERIAL_DESTROY_FAILED   = HResult($88760000 + 741);
  5628.   D3DERR_MATERIAL_SETDATA_FAILED   = HResult($88760000 + 742);
  5629.   D3DERR_MATERIAL_GETDATA_FAILED   = HResult($88760000 + 743);
  5630.  
  5631.   D3DERR_INVALIDPALETTE            = HResult($88760000 + 744);
  5632.  
  5633.   D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY  = HResult($88760000 + 745);
  5634.   D3DERR_ZBUFF_NEEDS_VIDEOMEMORY   = HResult($88760000 + 746);
  5635.   D3DERR_SURFACENOTINVIDMEM        = HResult($88760000 + 747);
  5636.  
  5637.   D3DERR_LIGHT_SET_FAILED          = HResult($88760000 + 750);
  5638.   D3DERR_LIGHTHASVIEWPORT          = HResult($88760000 + 751);
  5639.   D3DERR_LIGHTNOTINTHISVIEWPORT    = HResult($88760000 + 752);
  5640.  
  5641.   D3DERR_SCENE_IN_SCENE            = HResult($88760000 + 760);
  5642.   D3DERR_SCENE_NOT_IN_SCENE        = HResult($88760000 + 761);
  5643.   D3DERR_SCENE_BEGIN_FAILED        = HResult($88760000 + 762);
  5644.   D3DERR_SCENE_END_FAILED          = HResult($88760000 + 763);
  5645.  
  5646.   D3DERR_INBEGIN                   = HResult($88760000 + 770);
  5647.   D3DERR_NOTINBEGIN                = HResult($88760000 + 771);
  5648.   D3DERR_NOVIEWPORTS               = HResult($88760000 + 772);
  5649.   D3DERR_VIEWPORTDATANOTSET        = HResult($88760000 + 773);
  5650.   D3DERR_VIEWPORTHASNODEVICE       = HResult($88760000 + 774);
  5651.   D3DERR_NOCURRENTVIEWPORT         = HResult($88760000 + 775);
  5652.  
  5653.   D3DERR_INVALIDVERTEXFORMAT       = HResult($88760000 + 2048);
  5654.  
  5655.   D3DERR_COLORKEYATTACHED          = HResult($88760000 + 2050);
  5656.  
  5657.   D3DERR_VERTEXBUFFEROPTIMIZED     = HResult($88760000 + 2060);
  5658.   D3DERR_VBUF_CREATE_FAILED        = HResult($88760000 + 2061);
  5659.   D3DERR_VERTEXBUFFERLOCKED        = HResult($88760000 + 2062);
  5660.   D3DERR_VERTEXBUFFERUNLOCKFAILED  = HResult($88760000 + 2063);
  5661.  
  5662.   D3DERR_ZBUFFER_NOTPRESENT        = HResult($88760000 + 2070);
  5663.   D3DERR_STENCILBUFFER_NOTPRESENT  = HResult($88760000 + 2071);
  5664.  
  5665.   D3DERR_WRONGTEXTUREFORMAT        = HResult($88760000 + 2072);
  5666.   D3DERR_UNSUPPORTEDCOLOROPERATION = HResult($88760000 + 2073);
  5667.   D3DERR_UNSUPPORTEDCOLORARG       = HResult($88760000 + 2074);
  5668.   D3DERR_UNSUPPORTEDALPHAOPERATION = HResult($88760000 + 2075);
  5669.   D3DERR_UNSUPPORTEDALPHAARG       = HResult($88760000 + 2076);
  5670.   D3DERR_TOOMANYOPERATIONS         = HResult($88760000 + 2077);
  5671.   D3DERR_CONFLICTINGTEXTUREFILTER  = HResult($88760000 + 2078);
  5672.   D3DERR_UNSUPPORTEDFACTORVALUE    = HResult($88760000 + 2079);
  5673.   D3DERR_CONFLICTINGRENDERSTATE    = HResult($88760000 + 2081);
  5674.   D3DERR_UNSUPPORTEDTEXTUREFILTER  = HResult($88760000 + 2082);
  5675.   D3DERR_TOOMANYPRIMITIVES         = HResult($88760000 + 2083);
  5676.   D3DERR_INVALIDMATRIX             = HResult($88760000 + 2084);
  5677.   D3DERR_TOOMANYVERTICES           = HResult($88760000 + 2085);
  5678.   D3DERR_CONFLICTINGTEXTUREPALETTE = HResult($88760000 + 2086);
  5679.  
  5680.   D3DERR_INVALIDSTATEBLOCK         = HResult($88760000 + 2100);
  5681.   D3DERR_INBEGINSTATEBLOCK         = HResult($88760000 + 2101);
  5682.   D3DERR_NOTINBEGINSTATEBLOCK      = HResult($88760000 + 2102);
  5683.  
  5684. (*==========================================================================;
  5685.  *
  5686.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  5687.  *
  5688.  *  File:       d3drmdef.h
  5689.  *  Content:    Direct3DRM include file
  5690.  *
  5691.  ***************************************************************************)
  5692.  
  5693. { TD3DRMVector4D structure }
  5694.  
  5695. type
  5696.   PD3DRMVector4D = ^TD3DRMVector4D;
  5697.   TD3DRMVector4D = record
  5698.     x, y, z, w: TD3DValue;
  5699.   end;
  5700.  
  5701.   D3DRMVECTOR4D = TD3DRMVector4D;
  5702.   LPD3DRMVECTOR4D = PD3DRMVector4D;
  5703.  
  5704. { TD3DRMMatrix4D structure }
  5705.  
  5706.   TD3DRMMatrix4D = array[0..3, 0..3] of TD3DValue;
  5707.   D3DRMMATRIX4D = TD3DRMMatrix4D;
  5708.  
  5709. { TD3DRMQuaternion structure }
  5710.  
  5711.   PD3DRMQuaternion = ^TD3DRMQuaternion;
  5712.   TD3DRMQuaternion = record
  5713.     s: TD3DValue;
  5714.     v: TD3DVector;
  5715.   end;
  5716.  
  5717.   D3DRMQUATERNION = TD3DRMQuaternion;
  5718.   LPD3DRMQUATERNION = PD3DRMQUATERNION;
  5719.  
  5720. { TD3DRMRay structure }
  5721.  
  5722.   PD3DRMRay = ^TD3DRMRay;
  5723.   TD3DRMRay = record
  5724.     dvDir: TD3DVector;
  5725.     dvPos: TD3DVector;
  5726.   end;
  5727.  
  5728.   D3DRMRAY = TD3DRMRay;
  5729.   LPD3DRMRAY = PD3DRMRay;
  5730.  
  5731. { TD3DRMBox structure }
  5732.  
  5733.   PD3DRMBox = ^TD3DRMBox;
  5734.   TD3DRMBox = record
  5735.     min, max: TD3DVector;
  5736.   end;
  5737.  
  5738.   D3DRMBOX = TD3DRMBox;
  5739.   LPD3DRMBOX = PD3DRMBox;
  5740.  
  5741. { TD3DRMWrapCallback }
  5742.  
  5743.   TD3DRMWrapCallback = procedure(var lpD3DVector: TD3DVector; var lpU: Integer;
  5744.       var lpV: Integer; var lpD3DRMVA: TD3DVector; lpD3DRMVB: TD3DVector;
  5745.       lpArg: Pointer); stdcall;
  5746.  
  5747.   D3DRMWRAPCALLBACK = TD3DRMWrapCallback;
  5748.  
  5749. {  TD3DRMLightType  }
  5750.  
  5751.   TD3DRMLightType = (
  5752.     D3DRMLIGHT_AMBIENT,
  5753.     D3DRMLIGHT_POINT,
  5754.     D3DRMLIGHT_SPOT,
  5755.     D3DRMLIGHT_DIRECTIONAL,
  5756.     D3DRMLIGHT_PARALLELPOINT
  5757.   );
  5758.  
  5759.   D3DRMLIGHTTYPE = TD3DRMLightType;
  5760.  
  5761. { TD3DRMShadeMode }
  5762.  
  5763.   TD3DRMShadeMode = Word;
  5764.   D3DRMSHADEMODE = TD3DRMShadeMode;
  5765.  
  5766. const
  5767.   D3DRMSHADE_FLAT = 0;
  5768.   D3DRMSHADE_GOURAUD = 1;
  5769.   D3DRMSHADE_PHONG = 2;
  5770.   D3DRMSHADE_MASK = 7;
  5771.   D3DRMSHADE_MAX = 8;
  5772.  
  5773. { TD3DRMLightMode }
  5774.  
  5775. type
  5776.   TD3DRMLightMode = Word;
  5777.   D3DRMLIGHTMODE = TD3DRMLightMode;
  5778.  
  5779. const
  5780.   D3DRMLIGHT_OFF  = 0 * D3DRMSHADE_MAX;
  5781.   D3DRMLIGHT_ON   = 1 * D3DRMSHADE_MAX;
  5782.   D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX;
  5783.   D3DRMLIGHT_MAX  = 8 * D3DRMSHADE_MAX;
  5784.  
  5785. { TD3DRMFillMode }
  5786.  
  5787. type
  5788.   TD3DRMFillMode = Word;
  5789.   D3DRMFILLMODE = TD3DRMFillMode;
  5790.  
  5791. const
  5792.   D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX;
  5793.   D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX;
  5794.   D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX;
  5795.   D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX;
  5796.   D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX;
  5797.  
  5798. { TD3DRMRenderQuality }
  5799.  
  5800. type
  5801.   TD3DRMRenderQuality = DWORD;
  5802.   D3DRMRENDERQUALITY = TD3DRMRenderQuality;
  5803.  
  5804. const
  5805.   D3DRMRENDER_WIREFRAME   = D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_WIREFRAME;
  5806.   D3DRMRENDER_UNLITFLAT   = D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_SOLID;
  5807.   D3DRMRENDER_FLAT        = D3DRMSHADE_FLAT + D3DRMLIGHT_ON + D3DRMFILL_SOLID;
  5808.   D3DRMRENDER_GOURAUD     = D3DRMSHADE_GOURAUD + D3DRMLIGHT_ON + D3DRMFILL_SOLID;
  5809.   D3DRMRENDER_PHONG       = D3DRMSHADE_PHONG + D3DRMLIGHT_ON + D3DRMFILL_SOLID;
  5810.  
  5811.   D3DRMRENDERMODE_BLENDEDTRANSPARENCY      = 1;
  5812.   D3DRMRENDERMODE_SORTEDTRANSPARENCY       = 2;
  5813.   D3DRMRENDERMODE_LIGHTINMODELSPACE        = 8;
  5814.   D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR    = 16;
  5815.   D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE = 32;
  5816.  
  5817. { TD3DRMTextureQuality }
  5818.  
  5819. type
  5820.   TD3DRMTextureQuality = (
  5821.     D3DRMTEXTURE_NEAREST,               // choose nearest texel
  5822.     D3DRMTEXTURE_LINEAR,                // interpolate 4 texels
  5823.     D3DRMTEXTURE_MIPNEAREST,            // nearest texel in nearest mipmap
  5824.     D3DRMTEXTURE_MIPLINEAR,             // interpolate 2 texels from 2 mipmaps
  5825.     D3DRMTEXTURE_LINEARMIPNEAREST,      // interpolate 4 texels in nearest mipmap
  5826.     D3DRMTEXTURE_LINEARMIPLINEAR        // interpolate 8 texels from 2 mipmaps
  5827.   );
  5828.  
  5829.   D3DRMTEXTUREQUALITY = TD3DRMTextureQuality;
  5830.  
  5831. { Texture flags }
  5832.  
  5833. const
  5834.   D3DRMTEXTURE_FORCERESIDENT          = $00000001; // texture should be kept in video memory
  5835.   D3DRMTEXTURE_STATIC                 = $00000002; // texture will not change
  5836.   D3DRMTEXTURE_DOWNSAMPLEPOINT        = $00000004; // point filtering should be used when downsampling
  5837.   D3DRMTEXTURE_DOWNSAMPLEBILINEAR     = $00000008; // bilinear filtering should be used when downsampling
  5838.   D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH  = $00000010; // reduce bit depth when downsampling
  5839.   D3DRMTEXTURE_DOWNSAMPLENONE         = $00000020; // texture should never be downsampled
  5840.   D3DRMTEXTURE_CHANGEDPIXELS          = $00000040; // pixels have changed
  5841.   D3DRMTEXTURE_CHANGEDPALETTE         = $00000080; // palette has changed
  5842.   D3DRMTEXTURE_INVALIDATEONLY         = $00000100; // dirty regions are invalid
  5843.  
  5844. { Shadow flags }
  5845.  
  5846. const
  5847.   D3DRMSHADOW_TRUEALPHA = $00000001; // shadow should render without artifacts when true alpha is on
  5848.  
  5849. { TD3DRMCombineType }
  5850.  
  5851. type
  5852.   TD3DRMCombineType = (
  5853.      D3DRMCOMBINE_REPLACE,
  5854.      D3DRMCOMBINE_BEFORE,
  5855.      D3DRMCOMBINE_AFTER
  5856.   );
  5857.  
  5858.   D3DRMCOMBINETYPE = TD3DRMCombineType;
  5859.  
  5860. { TD3DRMColorModel }
  5861.  
  5862.   TD3DRMColorModel = TD3DColorModel;
  5863.   D3DRMCOLORMODEL = TD3DRMColorModel;
  5864.  
  5865. { TD3DRMPaletteFlags }
  5866.  
  5867.   TD3DRMPaletteFlags = (
  5868.     D3DRMPALETTE_FREE,                  // renderer may use this entry freely
  5869.     D3DRMPALETTE_READONLY,              // fixed but may be used by renderer
  5870.     D3DRMPALETTE_RESERVED               // may not be used by renderer
  5871.   );
  5872.  
  5873.   D3DRMPALETTEFLAGS = TD3DRMPaletteFlags;
  5874.  
  5875. { TD3DRMPaletteEntry structure }
  5876.  
  5877.   PD3DRMPaletteEntry = ^TD3DRMPaletteEntry;
  5878.   TD3DRMPaletteEntry = record
  5879.     red: Byte;          // 0 .. 255
  5880.     green: Byte;        // 0 .. 255
  5881.     blue: Byte;         // 0 .. 255
  5882.     flags: Byte;        // one of TD3DRMPaletteFlags
  5883.   end;
  5884.  
  5885.   D3DRMPALETTEENTRY = TD3DRMPaletteEntry;
  5886.   LPD3DRMPALETTEENTRY = PD3DRMPaletteEntry;
  5887.  
  5888. { TD3DRMImage structure }
  5889.  
  5890.   PD3DRMImage = ^TD3DRMImage;
  5891.   TD3DRMImage = record
  5892.     width, height: Integer;    (* width and height in pixels *)
  5893.     aspectx, aspecty: Integer; (* aspect ratio for non-square pixels *)
  5894.     depth: Integer;            (* bits per pixel *)
  5895.     rgb: Integer;              (* if false, pixels are indices into a
  5896.                                    palette otherwise, pixels encode
  5897.                                    RGB values. *)
  5898.     bytes_per_line: Integer;   (* number of bytes of memory for a
  5899.                                    scanline. This must be a multiple
  5900.                                    of 4. *)
  5901.     buffer1: Pointer;          (* memory to render into (first buffer). *)
  5902.     buffer2: Pointer;          (* second rendering buffer for double
  5903.                                    buffering, set to NULL for single
  5904.                                    buffering. *)
  5905.     red_mask: Longint;
  5906.     green_mask: Longint;
  5907.     blue_mask: Longint;
  5908.     alpha_mask: Longint;       (* if rgb is true, these are masks for
  5909.                                    the red, green and blue parts of a
  5910.                                    pixel.  Otherwise, these are masks
  5911.                                    for the significant bits of the
  5912.                                    red, green and blue elements in the
  5913.                                    palette.  For instance, most SVGA
  5914.                                    displays use 64 intensities of red,
  5915.                                    green and blue, so the masks should
  5916.                                    all be set to = $fc. *)
  5917.     palette_size: Integer;     (* number of entries in palette *)
  5918.     palette: PD3DRMPaletteEntry; (* description of the palette (only if
  5919.                                    rgb is false).  Must be (1<<depth)
  5920.                                    elements. *)
  5921.   end;
  5922.  
  5923.   D3DRMIMAGE = TD3DRMImage;
  5924.   LPD3DRMIMAGE = PD3DRMImage;
  5925.  
  5926. { TD3DRMWrapType }
  5927.  
  5928.   TD3DRMWrapType = (
  5929.     D3DRMWRAP_FLAT,
  5930.     D3DRMWRAP_CYLINDER,
  5931.     D3DRMWRAP_SPHERE,
  5932.     D3DRMWRAP_CHROME,
  5933.     D3DRMWRAP_SHEET,
  5934.     D3DRMWRAP_BOX
  5935.   );
  5936.  
  5937.   D3DRMWRAPTYPE = TD3DRMWrapType;
  5938.  
  5939. const
  5940.   D3DRMWIREFRAME_CULL             = 1; // cull backfaces
  5941.   D3DRMWIREFRAME_HIDDENLINE       = 2; // lines are obscured by closer objects
  5942.  
  5943. { TD3DRMProjectionType }
  5944.  
  5945. type
  5946.   TD3DRMProjectionType = (
  5947.     D3DRMPROJECT_PERSPECTIVE,
  5948.     D3DRMPROJECT_ORTHOGRAPHIC,
  5949.     D3DRMPROJECT_RIGHTHANDPERSPECTIVE,  // Only valid pre-DX6
  5950.     D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC  // Only valid pre-DX6
  5951.   );
  5952.  
  5953.   D3DRMPROJECTIONTYPE = TD3DRMProjectionType;
  5954.  
  5955. const
  5956.   D3DRMOPTIONS_LEFTHANDED  = $00000001; // Default
  5957.   D3DRMOPTIONS_RIGHTHANDED = $00000002;
  5958.  
  5959. { TD3DRMXOFFormat }
  5960.  
  5961. type
  5962.   TD3DRMXOFFormat = (
  5963.     D3DRMXOF_BINARY,
  5964.     D3DRMXOF_COMPRESSED,
  5965.     D3DRMXOF_TEXT
  5966.   );
  5967.  
  5968.   D3DRMXOFFORMAT = TD3DRMXOFFormat;
  5969.  
  5970. { TD3DRMSaveOptions }
  5971.  
  5972.   TD3DRMSaveOptions = DWORD;
  5973.   D3DRMSAVEOPTIONS = TD3DRMSaveOptions;
  5974.  
  5975. const
  5976.   D3DRMXOFSAVE_NORMALS = 1;
  5977.   D3DRMXOFSAVE_TEXTURECOORDINATES = 2;
  5978.   D3DRMXOFSAVE_MATERIALS = 4;
  5979.   D3DRMXOFSAVE_TEXTURENAMES = 8;
  5980.   D3DRMXOFSAVE_ALL = 15;
  5981.   D3DRMXOFSAVE_TEMPLATES = 16;
  5982.   D3DRMXOFSAVE_TEXTURETOPOLOGY = 32;
  5983.  
  5984. { TD3DRMColorSource }
  5985.  
  5986. type
  5987.   TD3DRMColorSource = (
  5988.     D3DRMCOLOR_FROMFACE,
  5989.     D3DRMCOLOR_FROMVERTEX
  5990.   );
  5991.  
  5992.   D3DRMCOLORSOURCE = TD3DRMColorSource;
  5993.  
  5994. { TD3DRMFrameConstraint }
  5995.  
  5996.   TD3DRMFrameConstraint = (
  5997.     D3DRMCONSTRAIN_Z,           // use only X and Y rotations
  5998.     D3DRMCONSTRAIN_Y,           // use only X and Z rotations
  5999.     D3DRMCONSTRAIN_X            // use only Y and Z rotations
  6000.   );
  6001.  
  6002.   D3DRMFRAMECONSTRAINT = TD3DRMFrameConstraint;
  6003.  
  6004. { TD3DRMMaterialMode }
  6005.  
  6006.   TD3DRMMaterialMode = (
  6007.     D3DRMMATERIAL_FROMMESH,
  6008.     D3DRMMATERIAL_FROMPARENT,
  6009.     D3DRMMATERIAL_FROMFRAME
  6010.   );
  6011.  
  6012.   D3DRMMATERIALMODE = TD3DRMMaterialMode;
  6013.  
  6014. { TD3DRMFogMode }
  6015.  
  6016.   TD3DRMFogMode = (
  6017.     D3DRMFOG_LINEAR,            // linear between start and end
  6018.     D3DRMFOG_EXPONENTIAL,       // density * exp(-distance)
  6019.     D3DRMFOG_EXPONENTIALSQUARED // density * exp(-distance*distance)
  6020.   );
  6021.  
  6022.   D3DRMFOGMODE = TD3DRMFogMode;
  6023.  
  6024. { TD3DRMZBufferMode }
  6025.  
  6026.   TD3DRMZBufferMode = (
  6027.     D3DRMZBUFFER_FROMPARENT,    // default
  6028.     D3DRMZBUFFER_ENABLE,        // enable zbuffering
  6029.     D3DRMZBUFFER_DISABLE        // disable zbuffering
  6030.   );
  6031.  
  6032.   D3DRMZBUFFERMODE = TD3DRMZBufferMode;
  6033.  
  6034. { TD3DRMSortMode }
  6035.  
  6036.   TD3DRMSortMode = (
  6037.     D3DRMSORT_FROMPARENT,       // default
  6038.     D3DRMSORT_NONE,             // don't sort child frames
  6039.     D3DRMSORT_FRONTTOBACK,      // sort child frames front-to-back
  6040.     D3DRMSORT_BACKTOFRONT       // sort child frames back-to-front
  6041.   );
  6042.  
  6043.   D3DRMSORTMODE = TD3DRMSortMode;
  6044.  
  6045. { TD3DRMMaterialOverride structure }
  6046.  
  6047.   PD3DRMMaterialOverride = ^TD3DRMMaterialOverride;
  6048.   TD3DRMMaterialOverride = record
  6049.     dwSize: DWORD;              // Size of this structure
  6050.     dwFlags: DWORD;             // Indicate which fields are valid
  6051.     dcDiffuse: TD3DColorValue;  // RGBA
  6052.     dcAmbient: TD3DColorValue;  // RGB
  6053.     dcEmissive: TD3DColorValue; // RGB
  6054.     dcSpecular: TD3DColorValue; // RGB
  6055.     dvPower: TD3DValue;
  6056.     lpD3DRMTex: IUnknown;
  6057.   end;
  6058.  
  6059.   D3DRMMATERIALOVERRIDE = TD3DRMMaterialOverride;
  6060.   LPD3DRMMATERIALOVERRIDE = PD3DRMMaterialOverride;
  6061.  
  6062. const
  6063.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY     = $00000001;
  6064.   D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY       = $00000002;
  6065.   D3DRMMATERIALOVERRIDE_DIFFUSE               = $00000003;
  6066.   D3DRMMATERIALOVERRIDE_AMBIENT               = $00000004;
  6067.   D3DRMMATERIALOVERRIDE_EMISSIVE              = $00000008;
  6068.   D3DRMMATERIALOVERRIDE_SPECULAR              = $00000010;
  6069.   D3DRMMATERIALOVERRIDE_POWER                 = $00000020;
  6070.   D3DRMMATERIALOVERRIDE_TEXTURE               = $00000040;
  6071.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY = $00000080;
  6072.   D3DRMMATERIALOVERRIDE_ALL                   = $000000FF;
  6073.  
  6074.   D3DRMFPTF_ALPHA         = $00000001;
  6075.   D3DRMFPTF_NOALPHA       = $00000002;
  6076.   D3DRMFPTF_PALETTIZED    = $00000004;
  6077.   D3DRMFPTF_NOTPALETTIZED = $00000008;
  6078.  
  6079.   D3DRMSTATECHANGE_UPDATEONLY  = $000000001;
  6080.   D3DRMSTATECHANGE_VOLATILE    = $000000002;
  6081.   D3DRMSTATECHANGE_NONVOLATILE = $000000004;
  6082.   D3DRMSTATECHANGE_RENDER      = $000000020;
  6083.   D3DRMSTATECHANGE_LIGHT       = $000000040;
  6084.  
  6085. { Values for flags in RM3::CreateDeviceFromSurface }
  6086.  
  6087.   D3DRMDEVICE_NOZBUFFER = $00000001;
  6088.  
  6089. { Values for flags in Object2::SetClientData }
  6090.  
  6091.   D3DRMCLIENTDATA_NONE      = $00000001;
  6092.   D3DRMCLIENTDATA_LOCALFREE = $00000002;
  6093.   D3DRMCLIENTDATA_IUNKNOWN  = $00000004;
  6094.  
  6095. { Values for flags in Frame2::AddMoveCallback. }
  6096.  
  6097.   D3DRMCALLBACK_PREORDER  = 0;
  6098.   D3DRMCALLBACK_POSTORDER = 1;
  6099.  
  6100. { Values for flags in MeshBuilder2::RayPick. }
  6101.  
  6102.   D3DRMRAYPICK_ONLYBOUNDINGBOXES       = 1;
  6103.   D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES = 2;
  6104.   D3DRMRAYPICK_INTERPOLATEUV           = 4;
  6105.   D3DRMRAYPICK_INTERPOLATECOLOR        = 8;
  6106.   D3DRMRAYPICK_INTERPOLATENORMAL       = $10;
  6107.  
  6108. { Values for flags in MeshBuilder3::AddFacesIndexed. }
  6109.  
  6110.   D3DRMADDFACES_VERTICESONLY = 1;
  6111.  
  6112.  
  6113. { Values for flags in MeshBuilder2::GenerateNormals. }
  6114.  
  6115.   D3DRMGENERATENORMALS_PRECOMPACT     = 1;
  6116.   D3DRMGENERATENORMALS_USECREASEANGLE = 2;
  6117.  
  6118. { Values for MeshBuilder3::GetParentMesh }
  6119.  
  6120.   D3DRMMESHBUILDER_DIRECTPARENT = 1;
  6121.   D3DRMMESHBUILDER_ROOTMESH     = 2;
  6122.  
  6123. { Flags for MeshBuilder3::Enable }
  6124.   D3DRMMESHBUILDER_RENDERENABLE = $00000001;
  6125.   D3DRMMESHBUILDER_PICKENABLE   = $00000002;
  6126.  
  6127. { Flags for MeshBuilder3::AddMeshBuilder }
  6128.   D3DRMADDMESHBUILDER_DONTCOPYAPPDATA  = 1;
  6129.   D3DRMADDMESHBUILDER_FLATTENSUBMESHES = 2;
  6130.   D3DRMADDMESHBUILDER_NOSUBMESHES      = 4;
  6131.  
  6132. { Flags for Object2::GetAge when used with MeshBuilders }
  6133.   D3DRMMESHBUILDERAGE_GEOMETRY  = $00000001;
  6134.   D3DRMMESHBUILDERAGE_MATERIALS = $00000002;
  6135.   D3DRMMESHBUILDERAGE_TEXTURES  = $00000004;
  6136.  
  6137. { Format flags for MeshBuilder3::AddTriangles. }
  6138.  
  6139.   D3DRMFVF_TYPE          = $00000001;
  6140.   D3DRMFVF_NORMAL        = $00000002;
  6141.   D3DRMFVF_COLOR         = $00000004;
  6142.   D3DRMFVF_TEXTURECOORDS = $00000008;
  6143.  
  6144.   D3DRMVERTEX_STRIP = $00000001;
  6145.   D3DRMVERTEX_FAN   = $00000002;
  6146.   D3DRMVERTEX_LIST  = $00000004;
  6147.  
  6148. { Values for flags in Viewport2::Clear2 }
  6149.  
  6150.   D3DRMCLEAR_TARGET     = $00000001;
  6151.   D3DRMCLEAR_ZBUFFER    = $00000002;
  6152.   D3DRMCLEAR_DIRTYRECTS = $00000004;
  6153.   D3DRMCLEAR_ALL        = D3DRMCLEAR_TARGET or D3DRMCLEAR_ZBUFFER or D3DRMCLEAR_DIRTYRECTS;
  6154.  
  6155. { Values for flags in Frame3::SetSceneFogMethod }
  6156.  
  6157.   D3DRMFOGMETHOD_VERTEX = $00000001;
  6158.   D3DRMFOGMETHOD_TABLE  = $00000002;
  6159.   D3DRMFOGMETHOD_ANY    = $00000004;
  6160.  
  6161. { Values for flags in Frame3::SetTraversalOptions }
  6162.  
  6163.   D3DRMFRAME_RENDERENABLE = $00000001;
  6164.   D3DRMFRAME_PICKENABLE   = $00000002;
  6165.  
  6166. { TD3DRMAnimationOptions }
  6167.  
  6168. type
  6169.   TD3DRMAnimationOptions = DWORD;
  6170.   D3DRMANIMATIONOPTIONS = TD3DRMAnimationOptions;
  6171.  
  6172. const
  6173.   D3DRMANIMATION_OPEN             = $01;
  6174.   D3DRMANIMATION_CLOSED           = $02;
  6175.   D3DRMANIMATION_LINEARPOSITION   = $04;
  6176.   D3DRMANIMATION_SPLINEPOSITION   = $08;
  6177.   D3DRMANIMATION_SCALEANDROTATION = $00000010;
  6178.   D3DRMANIMATION_POSITION         = $00000020;
  6179.  
  6180. { TD3DRMInterpolationOptions }
  6181.  
  6182. type
  6183.   TD3DRMInterpolationOptions = DWORD;
  6184.   D3DRMINTERPOLATIONOPTIONS = TD3DRMInterpolationOptions;
  6185.  
  6186. const
  6187.   D3DRMINTERPOLATION_OPEN         = $01;
  6188.   D3DRMINTERPOLATION_CLOSED       = $02;
  6189.   D3DRMINTERPOLATION_NEAREST      = $0100;
  6190.   D3DRMINTERPOLATION_LINEAR       = $04;
  6191.   D3DRMINTERPOLATION_SPLINE       = $08;
  6192.   D3DRMINTERPOLATION_VERTEXCOLOR  = $40;
  6193.   D3DRMINTERPOLATION_SLERPNORMALS = $80;
  6194.  
  6195. { TD3DRMLoadOptions }
  6196.  
  6197. type
  6198.   TD3DRMLoadOptions = DWORD;
  6199.   D3DRMLOADOPTIONS = TD3DRMLoadOptions;
  6200.  
  6201. const
  6202.   D3DRMLOAD_FROMFILE  = $00;
  6203.   D3DRMLOAD_FROMRESOURCE = $01;
  6204.   D3DRMLOAD_FROMMEMORY = $02;
  6205.   D3DRMLOAD_FROMSTREAM = $04;
  6206.   D3DRMLOAD_FROMURL = $08;
  6207.  
  6208.   D3DRMLOAD_BYNAME = $10;
  6209.   D3DRMLOAD_BYPOSITION = $20;
  6210.   D3DRMLOAD_BYGUID = $40;
  6211.   D3DRMLOAD_FIRST = $80;
  6212.  
  6213.   D3DRMLOAD_INSTANCEBYREFERENCE = $100;
  6214.   D3DRMLOAD_INSTANCEBYCOPYING = $200;
  6215.  
  6216.   D3DRMLOAD_ASYNCHRONOUS = $400;
  6217.  
  6218. { TD3DRMLoadReource }
  6219.  
  6220. type
  6221.   PD3DRMLoadReource = ^TD3DRMLoadReource;
  6222.   TD3DRMLoadReource = record
  6223.     hModule: HMODULE;
  6224.     lpName: PChar;
  6225.     lpType: PChar;
  6226.   end;
  6227.  
  6228.   D3DRMLOADRESOURCE = TD3DRMLoadReource;
  6229.   LPD3DRMLOADRESOURCE = PD3DRMLoadReource;
  6230.  
  6231. { TD3DRMLoadMemory }
  6232.  
  6233.   PD3DRMLoadMemory = ^TD3DRMLoadMemory;
  6234.   TD3DRMLoadMemory = record
  6235.     lpMemory: Pointer;
  6236.     dSize: DWORD;
  6237.   end;
  6238.  
  6239.   D3DRMLOADMEMORY = TD3DRMLoadMemory;
  6240.   LPD3DRMLOADMEMORY = PD3DRMLoadMemory;
  6241.  
  6242. const
  6243.   D3DRMPMESHSTATUS_VALID            = $01;
  6244.   D3DRMPMESHSTATUS_INTERRUPTED      = $02;
  6245.   D3DRMPMESHSTATUS_BASEMESHCOMPLETE = $04;
  6246.   D3DRMPMESHSTATUS_COMPLETE         = $08;
  6247.   D3DRMPMESHSTATUS_RENDERABLE       = $10;
  6248.  
  6249.   D3DRMPMESHEVENT_BASEMESH = $01;
  6250.   D3DRMPMESHEVENT_COMPLETE = $02;
  6251.  
  6252. { TD3DRMPMeshLoadStatus }
  6253.  
  6254. type
  6255.   PD3DRMPMeshLoadStatus = ^TD3DRMPMeshLoadStatus;
  6256.   TD3DRMPMeshLoadStatus = record
  6257.     dwSize: DWORD;           // Size of this structure
  6258.     dwPMeshSize: DWORD;      // Total Size (bytes)
  6259.     dwBaseMeshSize: DWORD;   // Total Size of the Base Mesh
  6260.     dwBytesLoaded: DWORD;    // Total bytes loaded
  6261.     dwVerticesLoaded: DWORD; // Number of vertices loaded
  6262.     dwFacesLoaded: DWORD;    // Number of faces loaded
  6263.     dwLoadResult: HResult;   // Result of the load operation
  6264.     dwFlags: DWORD;
  6265.   end;
  6266.  
  6267.   D3DRMPMESHLOADSTATUS = TD3DRMPMeshLoadStatus;
  6268.   LPD3DRMPMESHLOADSTATUS = PD3DRMPMeshLoadStatus;
  6269.  
  6270. { TD3DRMUserVisualReason }
  6271.  
  6272.   TD3DRMUserVisualReason = (
  6273.     D3DRMUSERVISUAL_CANSEE,
  6274.     D3DRMUSERVISUAL_RENDER
  6275.   );
  6276.  
  6277.   D3DRMUSERVISUALREASON = TD3DRMUserVisualReason;
  6278.  
  6279. { TD3DRMAnimationKey }
  6280.  
  6281.   PD3DRMAnimationKey = ^TD3DRMAnimationKey;
  6282.   TD3DRMAnimationKey = record
  6283.     dwSize: DWORD;
  6284.     dwKeyType: DWORD;
  6285.     dvTime: TD3DValue;
  6286.     dwID: DWORD;
  6287.  
  6288.     case Integer of
  6289.       0: (dqRotateKey: TD3DRMQuaternion);
  6290.       1: (dvScaleKey: TD3DVector);
  6291.       2: (dvPositionKey: TD3DVector);
  6292.       3: (dvK: array[0..3] of TD3DValue);
  6293.     end;
  6294.  
  6295.   D3DRMANIMATIONKEY = TD3DRMAnimationKey;
  6296.   LPD3DRMANIMATIONKEY = PD3DRMAnimationKey;
  6297.  
  6298. procedure D3DRMAnimationGetRotateKey(const rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  6299. procedure D3DRMAnimationGetScaleKey(const rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  6300. procedure D3DRMAnimationGetPositionKey(const rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  6301. procedure D3DRMAnimationSetRotateKey(var rmKey: TD3DRMAnimationKey; const rmQuat: TD3DRMQuaternion);
  6302. procedure D3DRMAnimationSetScaleKey(var rmKey: TD3DRMAnimationKey; const dvVec: TD3DVector);
  6303. procedure D3DRMAnimationSetPositionKey(var rmKey: TD3DRMAnimationKey; const dvVec: TD3DVector);
  6304.  
  6305. const
  6306.   D3DRMANIMATION_ROTATEKEY   = $01;
  6307.   D3DRMANIMATION_SCALEKEY    = $02;
  6308.   D3DRMANIMATION_POSITIONKEY = $03;
  6309.  
  6310. { TD3DRMMapping }
  6311.  
  6312. type
  6313.   TD3DRMMapping = DWORD;
  6314.   D3DRMMAPPING = TD3DRMMapping;
  6315.  
  6316. { TD3DRMMappingFlag }
  6317.  
  6318.   TD3DRMMappingFlag = DWORD;
  6319.   D3DRMMAPPINGFLAG = TD3DRMMappingFlag;
  6320.  
  6321. const
  6322.   D3DRMMAP_WRAPU        = 1;
  6323.   D3DRMMAP_WRAPV        = 2;
  6324.   D3DRMMAP_PERSPCORRECT = 4;
  6325.  
  6326. { TD3DRMVertex }
  6327.  
  6328. type
  6329.   PD3DRMVertex = ^TD3DRMVertex;
  6330.   TD3DRMVertex = record
  6331.     position: TD3DVector;
  6332.     normal: TD3DVector;
  6333.     tu, tv: TD3DValue;
  6334.     color: TD3DColor;
  6335.   end;
  6336.  
  6337.   D3DRMVERTEX = TD3DRMVertex;
  6338.   LPD3DRMVERTEX = PD3DRMVertex;
  6339.  
  6340. { TD3DRMGroupIndex }
  6341.  
  6342.   TD3DRMGroupIndex = Longint;
  6343.   D3DRMGROUPINDEX = TD3DRMGroupIndex; // group indexes begin a 0
  6344.  
  6345. const
  6346.   D3DRMGROUP_ALLGROUPS = -1;
  6347.  
  6348. { Create a color from three components in the range 0-1 inclusive. }
  6349. function D3DRMCreateColorRGB(red, green, blue: TD3DValue): TD3DColor; stdcall;
  6350.  
  6351. { Create a color from four components in the range 0-1 inclusive. }
  6352. function D3DRMCreateColorRGBA(red, green, blue, alpha: TD3DValue): TD3DColor; stdcall;
  6353.  
  6354. { Get the red component of a color. }
  6355. function D3DRMColorGetRed(d3drmc: TD3DColor): TD3DValue; stdcall;
  6356.  
  6357. { Get the green component of a color. }
  6358. function D3DRMColorGetGreen(d3drmc: TD3DColor): TD3DValue; stdcall;
  6359.  
  6360. { Get the blue component of a color. }
  6361. function D3DRMColorGetBlue(d3drmc: TD3DColor): TD3DValue; stdcall;
  6362.  
  6363. { Get the alpha component of a color. }
  6364. function D3DRMColorGetAlpha(d3drmc: TD3DColor): TD3DValue; stdcall;
  6365.  
  6366. { Add two vectors.  Returns its first argument. }
  6367. function D3DRMVectorAdd(var d, s1, s2: TD3DVector): PD3DVector; stdcall;
  6368.  
  6369. { Subtract two vectors.  Returns its first argument. }
  6370. function D3DRMVectorSubtract(var d, s1, s2: TD3DVector): PD3DVector; stdcall;
  6371.  
  6372. { Reflect a ray about a given normal.  Returns its first argument. }
  6373. function D3DRMVectorReflect(var d, ray, norm: TD3DVector): PD3DVector; stdcall;
  6374.  
  6375. { Calculate the vector cross product.  Returns its first argument. }
  6376. function D3DRMVectorCrossProduct(var d, s1, s2: TD3DVector): PD3DVector; stdcall;
  6377.  
  6378. { Return the vector dot product. }
  6379. function D3DRMVectorDotProduct(var s1, s2: TD3DVector): TD3DValue; stdcall;
  6380.  
  6381. { Scale a vector so that its modulus is 1.  Returns its argument or
  6382.   NULL if there was an error (e.g. a zero vector was passed). }
  6383. function D3DRMVectorNormalize(var lpv: TD3DVector): PD3DVector; stdcall;
  6384.  
  6385. { Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)). }
  6386. function D3DRMVectorModulus(var v: TD3DVector): TD3DValue; stdcall;
  6387.  
  6388. { Set the rotation part of a matrix to be a rotation of theta radians
  6389.   around the given axis. }
  6390. function D3DRMVectorRotate(var r, v, axis: TD3DVector; theta: TD3DValue): PD3DVector; stdcall;
  6391.  
  6392. { Scale a vector uniformly in all three axes }
  6393. function D3DRMVectorScale( var d, s: TD3DVector; factor: TD3DValue): PD3DVector; stdcall;
  6394.  
  6395. { Return a random unit vector }
  6396. function D3DRMVectorRandom(var d: TD3DVector): PD3DVector; stdcall;
  6397.  
  6398. { Returns a unit quaternion that represents a rotation of theta radians
  6399.   around the given axis. }
  6400. function D3DRMQuaternionFromRotation(var quat: PD3DRMQuaternion;
  6401.     var v: TD3DVector; theta: TD3DValue): PD3DRMQuaternion; stdcall;
  6402.  
  6403. { Calculate the product of two quaternions }
  6404. function D3DRMQuaternionMultiply(var q, a, b: TD3DRMQuaternion): PD3DRMQuaternion; stdcall;
  6405.  
  6406. { Interpolate between two quaternions }
  6407. function D3DRMQuaternionSlerp(var q, a, b: TD3DRMQuaternion; alpha: TD3DValue): PD3DRMQuaternion; stdcall;
  6408.  
  6409. { Calculate the matrix for the rotation that a unit quaternion represents }
  6410. procedure D3DRMMatrixFromQuaternion(dmMat: TD3DRMMatrix4D; var lpDqQuat: TD3DRMQuaternion); stdcall;
  6411.  
  6412. { Calculate the quaternion that corresponds to a rotation matrix }
  6413. function D3DRMQuaternionFromMatrix(var lpQuat: TD3DRMQuaternion; Mat: TD3DRMMatrix4D): PD3DRMQuaternion;
  6414.  
  6415. (*==========================================================================;
  6416.  *
  6417.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  6418.  *
  6419.  *  File:       d3drm.h, d3drmobj.h, d3drmwin.h
  6420.  *  Content:    Direct3DRM include file
  6421.  *
  6422.  ***************************************************************************)
  6423.  
  6424. { Direct3DRM Object classes }
  6425. const
  6426.   CLSID_CDirect3DRMDevice: TGUID = '{4FA3568E-623F-11CF-AC4A-0000C03825A1}';
  6427.   CLSID_CDirect3DRMViewport: TGUID = '{4FA3568F-623F-11CF-AC4A-0000C03825A1}';
  6428.   CLSID_CDirect3DRMFrame: TGUID = '{4FA35690-623F-11CF-AC4A-0000C03825A1}';
  6429.   CLSID_CDirect3DRMMesh: TGUID = '{4FA35691-623F-11CF-AC4A-0000C03825A1}';
  6430.   CLSID_CDirect3DRMMeshBuilder: TGUID = '{4FA35692-623F-11CF-AC4A-0000C03825A1}';
  6431.   CLSID_CDirect3DRMFace: TGUID = '{4FA35693-623F-11CF-AC4A-0000C03825A1}';
  6432.   CLSID_CDirect3DRMLight: TGUID = '{4FA35694-623F-11CF-AC4A-0000C03825A1}';
  6433.   CLSID_CDirect3DRMTexture: TGUID = '{4FA35695-623F-11CF-AC4A-0000C03825A1}';
  6434.   CLSID_CDirect3DRMWrap: TGUID = '{4FA35696-623F-11CF-AC4A-0000C03825A1}';
  6435.   CLSID_CDirect3DRMMaterial: TGUID = '{4FA35697-623F-11CF-AC4A-0000C03825A1}';
  6436.   CLSID_CDirect3DRMAnimation: TGUID = '{4FA35698-623F-11CF-AC4A-0000C03825A1}';
  6437.   CLSID_CDirect3DRMAnimationSet: TGUID = '{4FA35699-623F-11CF-AC4A-0000C03825A1}';
  6438.   CLSID_CDirect3DRMUserVisual: TGUID = '{4FA3569A-623F-11CF-AC4A-0000C03825A1}';
  6439.   CLSID_CDirect3DRMShadow: TGUID = '{4FA3569B-623F-11CF-AC4A-0000C03825A1}';
  6440.   CLSID_CDirect3DRMViewportInterpolator: TGUID = '{0DE9EAA1-3B84-11D0-9B6D-0000C0781BC3}';
  6441.   CLSID_CDirect3DRMFrameInterpolator: TGUID = '{0DE9EAA2-3B84-11D0-9B6D-0000C0781BC3}';
  6442.   CLSID_CDirect3DRMMeshInterpolator: TGUID = '{0DE9EAA3-3B84-11D0-9B6D-0000C0781BC3}';
  6443.   CLSID_CDirect3DRMLightInterpolator: TGUID = '{0DE9EAA6-3B84-11D0-9B6D-0000C0781BC3}';
  6444.   CLSID_CDirect3DRMMaterialInterpolator: TGUID = '{0DE9EAA7-3B84-11D0-9B6D-0000C0781BC3}';
  6445.   CLSID_CDirect3DRMTextureInterpolator: TGUID = '{0DE9EAA8-3B84-11D0-9B6D-0000C0781BC3}';
  6446.   CLSID_CDirect3DRMProgressiveMesh: TGUID = '{4516EC40-8F20-11D0-9B6D-0000C0781BC3}';
  6447.   CLSID_CDirect3DRMClippedVisual: TGUID = '{5434E72D-6D66-11D1-BB0B-0000F875865A}';
  6448.  
  6449. { Direct3DRM Object interfaces }
  6450.  
  6451.   IID_IDirect3DRMObject: TGUID = '{EB16CB00-D271-11CE-AC48-0000C03825A1}';
  6452.   IID_IDirect3DRMObject2: TGUID = '{4516EC7C-8F20-11D0-9B6D-0000C0781BC3}';
  6453.   IID_IDirect3DRMDevice: TGUID = '{E9E19280-6E05-11CF-AC4A-0000C03825A1}';
  6454.   IID_IDirect3DRMDevice2: TGUID = '{4516EC78-8F20-11D0-9B6D-0000C0781BC3}';
  6455.   IID_IDirect3DRMDevice3: TGUID = '{549F498B-BFEB-11D1-8ED8-00A0C967A482}';
  6456.   IID_IDirect3DRMViewport: TGUID = '{EB16CB02-D271-11CE-AC48-0000C03825A1}';
  6457.   IID_IDirect3DRMViewport2: TGUID = '{4A1B1BE6-BFED-11D1-8ED8-00A0C967A482}';
  6458.   IID_IDirect3DRMFrame: TGUID = '{EB16CB03-D271-11CE-AC48-0000C03825A1}';
  6459.   IID_IDirect3DRMFrame2: TGUID = '{C3DFBD60-3988-11D0-9EC2-0000C0291AC3}';
  6460.   IID_IDirect3DRMFrame3: TGUID = '{FF6B7F70-A40E-11D1-91F9-0000F8758E66}';
  6461.   IID_IDirect3DRMVisual: TGUID = '{EB16CB04-D271-11CE-AC48-0000C03825A1}';
  6462.   IID_IDirect3DRMMesh: TGUID = '{A3A80D01-6E12-11CF-AC4A-0000C03825A1}';
  6463.   IID_IDirect3DRMMeshBuilder: TGUID = '{A3A80D02-6E12-11CF-AC4A-0000C03825A1}';
  6464.   IID_IDirect3DRMMeshBuilder2: TGUID = '{4516EC77-8F20-11D0-9B6D-0000C0781BC3}';
  6465.   IID_IDirect3DRMMeshBuilder3: TGUID = '{4516EC82-8F20-11D0-9B6D-0000C0781BC3}';
  6466.   IID_IDirect3DRMFace: TGUID = '{EB16CB07-D271-11CE-AC48-0000C03825A1}';
  6467.   IID_IDirect3DRMFace2: TGUID = '{4516EC81-8F20-11D0-9B6D-0000C0781BC3}';
  6468.   IID_IDirect3DRMLight: TGUID = '{EB16CB08-D271-11CE-AC48-0000C03825A1}';
  6469.   IID_IDirect3DRMTexture: TGUID = '{EB16CB09-D271-11CE-AC48-0000C03825A1}';
  6470.   IID_IDirect3DRMTexture2: TGUID = '{120F30C0-1629-11D0-941C-0080C80CFA7B}';
  6471.   IID_IDirect3DRMTexture3: TGUID = '{FF6B7F73-A40E-11D1-91F9-0000F8758E66}';
  6472.   IID_IDirect3DRMWrap: TGUID = '{EB16CB0A-D271-11CE-AC48-0000C03825A1}';
  6473.   IID_IDirect3DRMMaterial: TGUID = '{EB16CB0B-D271-11CE-AC48-0000C03825A1}';
  6474.   IID_IDirect3DRMMaterial2: TGUID = '{FF6B7F75-A40E-11D1-91F9-0000F8758E66}';
  6475.   IID_IDirect3DRMAnimation: TGUID = '{EB16CB0D-D271-11CE-AC48-0000C03825A1}';
  6476.   IID_IDirect3DRMAnimation2: TGUID = '{FF6B7F77-A40E-11D1-91F9-0000F8758E66}';
  6477.   IID_IDirect3DRMAnimationSet: TGUID = '{EB16CB0E-D271-11CE-AC48-0000C03825A1}';
  6478.   IID_IDirect3DRMAnimationSet2: TGUID = '{FF6B7F79-A40E-11D1-91F9-0000F8758E66}';
  6479.   IID_IDirect3DRMObjectArray: TGUID = '{242F6BC2-3849-11D0-9B6D-0000C0781BC3}';
  6480.   IID_IDirect3DRMDeviceArray: TGUID = '{EB16CB10-D271-11CE-AC48-0000C03825A1}';
  6481.   IID_IDirect3DRMViewportArray: TGUID = '{EB16CB11-D271-11CE-AC48-0000C03825A1}';
  6482.   IID_IDirect3DRMFrameArray: TGUID = '{EB16CB12-D271-11CE-AC48-0000C03825A1}';
  6483.   IID_IDirect3DRMVisualArray: TGUID = '{EB16CB13-D271-11CE-AC48-0000C03825A1}';
  6484.   IID_IDirect3DRMLightArray: TGUID = '{EB16CB14-D271-11CE-AC48-0000C03825A1}';
  6485.   IID_IDirect3DRMPickedArray: TGUID = '{EB16CB16-D271-11CE-AC48-0000C03825A1}';
  6486.   IID_IDirect3DRMFaceArray: TGUID = '{EB16CB17-D271-11CE-AC48-0000C03825A1}';
  6487.   IID_IDirect3DRMAnimationArray: TGUID = '{D5F1CAE0-4BD7-11D1-B974-0060083E45F3}';
  6488.   IID_IDirect3DRMUserVisual: TGUID = '{59163DE0-6D43-11CF-AC4A-0000C03825A1}';
  6489.   IID_IDirect3DRMShadow: TGUID = '{AF359780-6BA3-11CF-AC4A-0000C03825A1}';
  6490.   IID_IDirect3DRMShadow2: TGUID = '{86B44E25-9C82-11D1-BB0B-00A0C981A0A6}';
  6491.   IID_IDirect3DRMInterpolator: TGUID = '{242F6BC1-3849-11D0-9B6D-0000C0781BC3}';
  6492.   IID_IDirect3DRMProgressiveMesh: TGUID = '{4516EC79-8F20-11D0-9B6D-0000C0781BC3}';
  6493.   IID_IDirect3DRMPicked2Array: TGUID = '{4516EC7B-8F20-11D0-9B6D-0000C0781BC3}';
  6494.   IID_IDirect3DRMClippedVisual: TGUID = '{5434E733-6D66-11D1-BB0B-0000F875865A}';
  6495.  
  6496.   IID_IDirect3DRMWinDevice: TGUID = '{C5016CC0-D273-11CE-AC48-0000C03825A1}';
  6497.   IID_IDirect3DRM: TGUID = '{2BC49361-8327-11CF-AC4A-0000C03825A1}';
  6498.   IID_IDirect3DRM2: TGUID = '{4516ECC8-8F20-11D0-9B6D-0000C0781BC3}';
  6499.   IID_IDirect3DRM3: TGUID = '{4516EC83-8F20-11D0-9B6D-0000C0781BC3}';
  6500.  
  6501. type
  6502.   IDirect3DRMObject = interface;
  6503.   IDirect3DRMObject2 = interface;
  6504.   IDirect3DRMDevice = interface;
  6505.   IDirect3DRMDevice2 = interface;
  6506.   IDirect3DRMDevice3 = interface;
  6507.   IDirect3DRMViewport = interface;
  6508.   IDirect3DRMViewport2 = interface;
  6509.   IDirect3DRMFrame = interface;
  6510.   IDirect3DRMFrame2 = interface;
  6511.   IDirect3DRMFrame3 = interface;
  6512.   IDirect3DRMVisual = interface;
  6513.   IDirect3DRMMesh = interface;
  6514.   IDirect3DRMMeshBuilder = interface;
  6515.   IDirect3DRMMeshBuilder2 = interface;
  6516.   IDirect3DRMMeshBuilder3 = interface;
  6517.   IDirect3DRMFace = interface;
  6518.   IDirect3DRMFace2 = interface;
  6519.   IDirect3DRMLight = interface;
  6520.   IDirect3DRMTexture = interface;
  6521.   IDirect3DRMTexture2 = interface;
  6522.   IDirect3DRMTexture3 = interface;
  6523.   IDirect3DRMWrap = interface;
  6524.   IDirect3DRMMaterial = interface;
  6525.   IDirect3DRMMaterial2 = interface;
  6526.   IDirect3DRMInterpolator = interface;
  6527.   IDirect3DRMAnimation = interface;
  6528.   IDirect3DRMAnimation2 = interface;
  6529.   IDirect3DRMAnimationSet = interface;
  6530.   IDirect3DRMAnimationSet2 = interface;
  6531.   IDirect3DRMUserVisual = interface;
  6532.   IDirect3DRMShadow = interface;
  6533.   IDirect3DRMShadow2 = interface;
  6534.   IDirect3DRMArray= interface;
  6535.   IDirect3DRMObjectArray = interface;
  6536.   IDirect3DRMDeviceArray = interface;
  6537.   IDirect3DRMFaceArray = interface;
  6538.   IDirect3DRMViewportArray = interface;
  6539.   IDirect3DRMFrameArray = interface;
  6540.   IDirect3DRMAnimationArray = interface;
  6541.   IDirect3DRMVisualArray = interface;
  6542.   IDirect3DRMPickedArray = interface;
  6543.   IDirect3DRMPicked2Array = interface;
  6544.   IDirect3DRMLightArray = interface;
  6545.   IDirect3DRMProgressiveMesh = interface;
  6546.   IDirect3DRMClippedVisual = interface;
  6547.  
  6548.   IDirect3DRMWinDevice = interface;
  6549.   IDirect3DRM = interface;
  6550.   IDirect3DRM2 = interface;
  6551.   IDirect3DRM3 = interface;
  6552.  
  6553.   TD3DRMObjectCallback = procedure(obj: IDirect3DRMObject; arg: Pointer); cdecl;
  6554.   D3DRMOBJECTCALLBACK = TD3DRMObjectCallback;
  6555.  
  6556.   TD3DRMFrameMoveCallback = procedure(obj: IDirect3DRMFrame; arg: Pointer; delta: TD3DValue); cdecl;
  6557.   D3DRMFRAMEMOVECALLBACK = TD3DRMFrameMoveCallback;
  6558.  
  6559.   TD3DRMFrame3MoveCallback = procedure(obj: IDirect3DRMFrame3; arg: Pointer; delta: TD3DValue); cdecl;
  6560.   D3DRMFRAME3MOVECALLBACK = TD3DRMFrame3MoveCallback;
  6561.  
  6562.   TD3DRMUpdateCallback = procedure(obj: IDirect3DRMDevice; arg: Pointer;
  6563.       iRectCount: DWORD; d3dRectUpdate: PD3DRect); cdecl;
  6564.   D3DRMUPDATECALLBACK = TD3DRMUpdateCallback;
  6565.  
  6566.   TD3DRMDevice3UpdateCallback = procedure(obj: IDirect3DRMDevice3; arg: Pointer;
  6567.       iRectCount: DWORD; d3dRectUpdate: PD3DRect); cdecl;
  6568.   D3DRMDEVICE3UPDATECALLBACK = TD3DRMDevice3UpdateCallback;
  6569.  
  6570.   TD3DRMUserVisualCallback = function(lpD3DRMUV: IDirect3DRMUserVisual;
  6571.       lpArg: Pointer; lpD3DRMUVreason: TD3DRMUserVisualReason;
  6572.       lpD3DRMDev: IDirect3DRMDevice;
  6573.       lpD3DRMview: IDirect3DRMViewport): Longint; cdecl;
  6574.   D3DRMUSERVISUALCALLBACK = TD3DRMUserVisualCallback;
  6575.  
  6576.   TD3DRMLoadTextureCallback = function(tex_name: PChar; arg: Pointer;
  6577.     out lpD3DRMTex: IDirect3DRMTexture): HResult; cdecl;
  6578.   D3DRMLOADTEXTURECALLBACK = TD3DRMLoadTextureCallback;
  6579.  
  6580.   TD3DRMLoadTexture3Callback = function(tex_name: PChar; arg: Pointer;
  6581.     out lpD3DRMTex: IDirect3DRMTexture3): HResult; cdecl;
  6582.   D3DRMLOADTEXTURE3CALLBACK = TD3DRMLoadTexture3Callback;
  6583.  
  6584.   TD3DRMLoadCallback = procedure(lpObject: IDirect3DRMObject; const ObjectGuid: TGUID;
  6585.      lpArg: Pointer); cdecl;
  6586.   D3DRMLOADCALLBACK = TD3DRMLoadCallback;
  6587.  
  6588.   TD3DRMDownSampleCallback = function(lpDirect3DRMTexture: IDirect3DRMTexture3;
  6589.     pArg: Pointer; pDDSSrc, pDDSDst: IDirectDrawSurface): HResult; cdecl;
  6590.   D3DRMDOWNSAMPLECALLBACK = TD3DRMDownSampleCallback;
  6591.  
  6592.   TD3DRMValidationCallback = function(lpDirect3DRMTexture: IDirect3DRMTexture3;
  6593.     pArg: Pointer; dwFlags: DWORD; dwcRects: DWORD; pRects: PRect): HResult; cdecl;
  6594.   D3DRMVALIDATIONCALLBACK = TD3DRMValidationCallback;
  6595.  
  6596. { TD3DRMPickDesc }
  6597.  
  6598.   PD3DRMPickDesc = ^TD3DRMPickDesc;
  6599.   TD3DRMPickDesc = record
  6600.     ulFaceIdx: Longint;
  6601.     lGroupIdx: Longint;
  6602.     vPosition: TD3DVector;
  6603.   end;
  6604.  
  6605.   D3DRMPICKDESC = TD3DRMPickDesc;
  6606.   LPD3DRMPICKDESC = PD3DRMPickDesc;
  6607.  
  6608. { TD3DRMPickDesc2 }
  6609.  
  6610.   PD3DRMPickDesc2 = ^TD3DRMPickDesc2;
  6611.   TD3DRMPickDesc2 = record
  6612.     ulFaceIdx: Longint;
  6613.     lGroupIdx: Longint;
  6614.     dvPosition: TD3DVector;
  6615.     tu, tv: TD3DValue;
  6616.     dvNormal: TD3DVector;
  6617.     dcColor: TD3DColor;
  6618.   end;
  6619.  
  6620.   D3DRMPICKDESC2 = TD3DRMPickDesc2;
  6621.   LPD3DRMPICKDESC2 = PD3DRMPickDesc2;
  6622.  
  6623.   IDirect3DRMObject = interface(IUnknown)
  6624.     ['{EB16CB00-D271-11CE-AC48-0000C03825A1}']
  6625.     // IDirect3DRMObject methods
  6626.     function Clone(pUnkOuter: IUnknown; const riid: TGUID; out ppvObj): HResult; stdcall;
  6627.     function AddDestroyCallback(lpCallback: TD3DRMObjectCallback;
  6628.         lpArg: Pointer): HResult; stdcall;
  6629.     function DeleteDestroyCallback(d3drmObjProc: TD3DRMObjectCallback;
  6630.         lpArg: Pointer): HResult; stdcall;
  6631.     function SetAppData(ulData: DWORD): HResult; stdcall;
  6632.     function GetAppData: DWORD; stdcall;
  6633.     function SetName(lpName: PChar): HResult; stdcall;
  6634.     function GetName(var lpdwSize: DWORD; lpName: PChar): HResult; stdcall;
  6635.     function GetClassName(var lpdwSize: DWORD; lpName: PChar): HResult; stdcall;
  6636.   end;
  6637.  
  6638.   IDirect3DRMObject2 = interface(IUnknown)
  6639.     ['{EB16CB00-D271-11CE-AC48-0000C03825A1}']
  6640.     // IDirect3DRMObject2 methods
  6641.     function AddDestroyCallback(lpCallback: TD3DRMObjectCallback; lpArg: Pointer): HResult; stdcall;
  6642.     function Clone(pUnkOuter: IUnknown; const riid: TGUID;
  6643.         out ppvObj): HResult; stdcall;
  6644.     function DeleteDestroyCallback(d3drmObjProc: TD3DRMObjectCallback;
  6645.         lpArg: Pointer): HResult; stdcall;
  6646.     function GetClientData(dwID: DWORD; var lplpvData: Pointer): HResult; stdcall;
  6647.     function GetDirect3DRM(out lplpDirect3DRM: IDirect3DRM): HResult; stdcall;
  6648.     function GetName(var lpdwSize: DWORD; lpName: LPSTR): HResult; stdcall;
  6649.     function SetClientData(dwID: DWORD; lplpvData: Pointer; dwFlags: DWORD): HResult; stdcall;
  6650.     function SetName(lpName: PChar): HResult; stdcall;
  6651.     function GetAge(dwFlags: DWORD; var pdwAge: DWORD): HResult; stdcall;
  6652.   end;
  6653.  
  6654.   IDirect3DRMVisual = interface(IDirect3DRMObject)
  6655.     ['{EB16CB04-D271-11CE-AC48-0000C03825A1}']
  6656.   end;
  6657.  
  6658.   IDirect3DRMDevice = interface(IDirect3DRMObject)
  6659.     ['{E9E19280-6E05-11CF-AC4A-0000C03825A1}']
  6660.     // IDirect3DRMDevice methods
  6661.     function Init(width, height: DWORD): HResult; stdcall;
  6662.     function InitFromD3D(lpD3D: IDirect3D; lpD3DIMDev: IDirect3DDevice): HResult; stdcall;
  6663.     function InitFromClipper(lpDDClipper: IDirectDrawClipper;
  6664.         const lpGUID: TGUID; width, height: DWORD): HResult; stdcall;
  6665.     function Update: HResult; stdcall;
  6666.     function AddUpdateCallback(d3drmUpdateProc: TD3DRMUpdateCallback;
  6667.         arg: Pointer): HResult; stdcall;
  6668.     function DeleteUpdateCallback(d3drmUpdateProc: TD3DRMUpdateCallback;
  6669.         arg: Pointer): HResult; stdcall;
  6670.     function SetBufferCount(dwCount: DWORD): HResult; stdcall;
  6671.     function GetBufferCount: DWORD; stdcall;
  6672.     function SetDither(bDither: BOOL): HResult; stdcall;
  6673.     function SetShades(ulShades: DWORD): HResult; stdcall;
  6674.     function SetQuality(rqQuality: TD3DRMRenderQuality): HResult; stdcall;
  6675.     function SetTextureQuality(tqTextureQuality: TD3DRMTextureQuality): HResult; stdcall;
  6676.     function GetViewports(out lplpViewports: IDirect3DRMViewportArray): HResult; stdcall;
  6677.     function GetDither: BOOL; stdcall;
  6678.     function GetShades: DWORD; stdcall;
  6679.     function GetHeight: DWORD; stdcall;
  6680.     function GetWidth: DWORD; stdcall;
  6681.     function GetTrianglesDrawn: DWORD; stdcall;
  6682.     function GetWireframeOptions: DWORD; stdcall;
  6683.     function GetQuality: TD3DRMRenderQuality; stdcall;
  6684.     function GetColorModel: TD3DColorModel; stdcall;
  6685.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  6686.     function GetDirect3DDevice(out lplpD3DDevice: IDirect3DDevice): HResult; stdcall;
  6687.   end;
  6688.  
  6689.   IDirect3DRMDevice2 = interface(IDirect3DRMDevice)
  6690.     ['{4516EC78-8F20-11D0-9B6D-0000C0781BC3}']
  6691.     // IDirect3DRMDevice2 methods
  6692.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2): HResult; stdcall;
  6693.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
  6694.         lpDDSBack: IDirectDrawSurface): HResult; stdcall;
  6695.     function SetRenderMode(dwFlags: DWORD): HResult; stdcall;
  6696.     function GetRenderMode: DWORD; stdcall;
  6697.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2): HResult; stdcall;
  6698.   end;
  6699.  
  6700.   IDirect3DRMDevice3 = interface(IDirect3DRMDevice2)
  6701.     ['{549F498B-BFEB-11D1-8ED8-00A0C967A482}']
  6702.     // IDirect3DRMDevice3 methods
  6703.     function FindPreferredTextureFormat(dwBitDepths: DWORD; dwFlags: DWORD;
  6704.         var lpDDPF: TDDPixelFormat): HResult; stdcall;
  6705.     function RenderStateChange(drsType: TD3DRenderStateType; dwVal: DWORD;
  6706.         dwFlags: DWORD): HResult; stdcall;
  6707.     function LightStateChange(drsType: TD3DLightStateType; dwVal: DWORD;
  6708.         dwFlags: DWORD): HResult; stdcall;
  6709.     function GetStateChangeOptions(dwStateClass: DWORD; dwStateNum: DWORD;
  6710.         var pdwFlags: DWORD): HResult; stdcall;
  6711.     function SetStateChangeOptions(dwStateClass: DWORD; dwStateNum: DWORD;
  6712.         dwFlags: DWORD): HResult; stdcall;
  6713.   end;
  6714.  
  6715.   IDirect3DRMViewport = interface(IDirect3DRMObject)
  6716.     ['{EB16CB02-D271-11CE-AC48-0000C03825A1}']
  6717.     // IDirect3DRMViewport methods
  6718.     function Init(lpD3DRMDevice: IDirect3DRMDevice;
  6719.         lpD3DRMFrameCamera: IDirect3DRMFrame; xpos, ypos, width, height: DWORD): HResult; stdcall;
  6720.     function Clear: HResult; stdcall;
  6721.     function Render(lpD3DRMFrame: IDirect3DRMFrame): HResult; stdcall;
  6722.     function SetFront(rvFront: TD3DValue): HResult; stdcall;
  6723.     function SetBack(rvBack: TD3DValue): HResult; stdcall;
  6724.     function SetField(rvField: TD3DValue): HResult; stdcall;
  6725.     function SetUniformScaling(bScale: BOOL): HResult; stdcall;
  6726.     function SetCamera(lpCamera: IDirect3DRMFrame): HResult; stdcall;
  6727.     function SetProjection(rptType: TD3DRMProjectionType): HResult; stdcall;
  6728.     function Transform(var lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector): HResult; stdcall;
  6729.     function InverseTransform(var lprvDst: TD3DVector;
  6730.         var lprvSrc: TD3DRMVector4D): HResult; stdcall;
  6731.     function Configure(lX, lY: Longint; dwWidth, dwHeight: DWORD): HResult; stdcall;
  6732.     function ForceUpdate(dwX1, dwY1, dwX2, dwY2: DWORD): HResult; stdcall;
  6733.     function SetPlane(rvLeft, rvRight, rvBottom, rvTop: TD3DValue): HResult; stdcall;
  6734.     function GetCamera(out lpCamera: IDirect3DRMFrame): HResult; stdcall;
  6735.     function GetDevice(out lpD3DRMDevice: IDirect3DRMDevice): HResult;  stdcall;
  6736.     function GetPlane(var lpd3dvLeft, lpd3dvRight, lpd3dvBottom,
  6737.         lpd3dvTop: TD3DValue): HResult; stdcall;
  6738.     function Pick(lX, lY: Longint; out lplpVisuals: IDirect3DRMPickedArray): HResult; stdcall;
  6739.     function GetUniformScaling: BOOL; stdcall;
  6740.     function GetX: Longint; stdcall;
  6741.     function GetY: Longint; stdcall;
  6742.     function GetWidth: DWORD; stdcall;
  6743.     function GetHeight: DWORD; stdcall;
  6744.     function GetField: TD3DValue; stdcall;
  6745.     function GetBack: TD3DValue; stdcall;
  6746.     function GetFront: TD3DValue; stdcall;
  6747.     function GetProjection: TD3DRMProjectionType; stdcall;
  6748.     function GetDirect3DViewport(out lplpD3DViewport: IDirect3DViewport): HResult; stdcall;
  6749.   end;
  6750.  
  6751.   IDirect3DRMViewport2 = interface(IDirect3DRMObject)
  6752.     ['{4A1B1BE6-BFED-11D1-8ED8-00A0C967A482}']
  6753.     // IDirect3DRMViewport2 methods
  6754.     function Init(dec: IDirect3DRMDevice3; camera: IDirect3DRMFrame3;
  6755.         xpos, ypos: DWORD; width, height: DWORD): HResult; stdcall;
  6756.     function Clear(dwFlags: DWORD): HResult; stdcall;
  6757.     function Render(lpD3DRMFrame: IDirect3DRMFrame3): HResult; stdcall;
  6758.     function SetFront(rvFront: TD3DValue): HResult; stdcall;
  6759.     function SetBack(rvBack: TD3DValue): HResult; stdcall;
  6760.     function SetField(rvField: TD3DValue): HResult; stdcall;
  6761.     function SetUniformScaling(bScale: BOOL): HResult; stdcall;
  6762.     function SetCamera(lpCamera: IDirect3DRMFrame3): HResult; stdcall;
  6763.     function SetProjection(rptType: TD3DRMProjectionType): HResult; stdcall;
  6764.     function Transform(var lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector): HResult; stdcall;
  6765.     function InverseTransform(var lprvDst: TD3DVector;
  6766.         const lprvSrc: TD3DRMVector4D): HResult; stdcall;
  6767.     function Configure(lX, lY: Longint; dwWidth, dwHeight: DWORD): HResult; stdcall;
  6768.     function ForceUpdate(dwX1, dwY1, dwX2, dwY2: DWORD): HResult; stdcall;
  6769.     function SetPlane(rvLeft, rvRight, rvBottom, rvTop: TD3DValue): HResult; stdcall;
  6770.     function GetCamera(out lpCamera: IDirect3DRMFrame3): HResult; stdcall;
  6771.     function GetDevice(out lpD3DRMDevice: IDirect3DRMDevice3): HResult;  stdcall;
  6772.     function GetPlane(var lpd3dvLeft, lpd3dvRight, lpd3dvBottom,
  6773.         lpd3dvTop: TD3DValue): HResult; stdcall;
  6774.     function Pick(lX, lY: Longint; out lplpVisuals: IDirect3DRMPickedArray): HResult; stdcall;
  6775.     function GetUniformScaling: BOOL; stdcall;
  6776.     function GetX: Longint; stdcall;
  6777.     function GetY: Longint; stdcall;
  6778.     function GetWidth: DWORD; stdcall;
  6779.     function GetHeight: DWORD; stdcall;
  6780.     function GetField: TD3DValue; stdcall;
  6781.     function GetBack: TD3DValue; stdcall;
  6782.     function GetFront: TD3DValue; stdcall;
  6783.     function GetProjection: TD3DRMProjectionType; stdcall;
  6784.     function GetDirect3DViewport(out lplpD3DViewport: IDirect3DViewport): HResult; stdcall;
  6785.     function TransformVectors(dwNumVectors: DWORD; var lpDstVectors: TD3DRMVector4D;
  6786.         const lpSrcVectors: TD3DVector): HResult; stdcall;
  6787.     function InverseTransformVectors(dwNumVectors: DWORD; var lpDstVectors: TD3DVector;
  6788.         const lpSrcVectors: TD3DRMVector4D): HResult; stdcall;
  6789.   end;
  6790.  
  6791.   IDirect3DRMFrame = interface(IDirect3DRMVisual)
  6792.     ['{EB16CB03-D271-11CE-AC48-0000C03825A1}']
  6793.     // IDirect3DRMFrame methods
  6794.     function AddChild(lpD3DRMFrameChild: IDirect3DRMFrame): HResult; stdcall;
  6795.     function AddLight(lpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  6796.     function AddMoveCallback(d3drmFMC: TD3DRMFrameMoveCallback;
  6797.         lpArg: Pointer): HResult; stdcall;
  6798.     function AddTransform(rctCombine: TD3DRMCombineType;
  6799.         rmMatrix: TD3DRMMatrix4D): HResult; stdcall;
  6800.     function AddTranslation(rctCombine: TD3DRMCombineType; rvX, rvY,
  6801.         rvZ: TD3DValue): HResult; stdcall;
  6802.     function AddScale(rctCombine: TD3DRMCombineType; rvX, rvY,
  6803.         rvZ: TD3DValue): HResult; stdcall;
  6804.     function AddRotation(rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  6805.         rvTheta: TD3DValue): HResult; stdcall;
  6806.     function AddVisual(lpD3DRMVisual: IDirect3DRMVisual): HResult; stdcall;
  6807.     function GetChildren(out lplpChildren: IDirect3DRMFrameArray): HResult; stdcall;
  6808.     function GetColor: TD3DColor; stdcall;
  6809.     function GetLights(out lplpLights: IDirect3DRMLightArray): HResult; stdcall;
  6810.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  6811.     function GetParent(out lplpParent: IDirect3DRMFrame): HResult; stdcall;
  6812.     function GetPosition(lpRef: IDirect3DRMFrame; var lprvPos: TD3DVector): HResult; stdcall;
  6813.     function GetRotation(lpRef: IDirect3DRMFrame; var lprvAxis: TD3DVector;
  6814.         var lprvTheta: TD3DValue): HResult; stdcall;
  6815.     function GetScene(out lplpRoot: IDirect3DRMFrame): HResult; stdcall;
  6816.     function GetSortMode: TD3DRMSortMode; stdcall;
  6817.     function GetTexture(out lplpTexture: IDirect3DRMTexture): HResult; stdcall;
  6818.     function GetTransform(var rmMatrix: TD3DRMMatrix4D): HResult; stdcall;
  6819.     function GetVelocity(lpRef: IDirect3DRMFrame; var lprvVel: TD3DVector;
  6820.         fRotVel: BOOL): HResult; stdcall;
  6821.     function GetOrientation(lpRef: IDirect3DRMFrame; var lprvDir: TD3DVector;
  6822.         var lprvUp: TD3DVector): HResult; stdcall;
  6823.     function GetVisuals(out lplpVisuals: IDirect3DRMVisualArray): HResult; stdcall;
  6824.     function GetTextureTopology(var lpU, lpV: BOOL): HResult; stdcall;
  6825.     function InverseTransform(var lprvDst, lprvSrc: TD3DVector): HResult; stdcall;
  6826.     function Load(lpvObjSource: Pointer; lpvObjID: Pointer;
  6827.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  6828.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer): HResult; stdcall;
  6829.     function LookAt(lpTarget, lpRef: IDirect3DRMFrame;
  6830.         rfcConstraint: TD3DRMFrameConstraint ): HResult; stdcall;
  6831.     function Move(delta: TD3DValue): HResult; stdcall;
  6832.     function DeleteChild(lpChild: IDirect3DRMFrame): HResult; stdcall;
  6833.     function DeleteLight(lpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  6834.     function DeleteMoveCallback(d3drmFMC: TD3DRMFrameMoveCallback;
  6835.         lpArg: Pointer): HResult; stdcall;
  6836.     function DeleteVisual(lpD3DRMVisual: IDirect3DRMVisual): HResult; stdcall;
  6837.     function GetSceneBackground: TD3DColor; stdcall;
  6838.     function GetSceneBackgroundDepth(out lplpDDSurface: IDirectDrawSurface): HResult; stdcall;
  6839.     function GetSceneFogColor: TD3DColor; stdcall;
  6840.     function GetSceneFogEnable: BOOL; stdcall;
  6841.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  6842.     function GetSceneFogParams(var lprvStart, lprvEnd, lprvDensity: TD3DValue): HResult; stdcall;
  6843.     function SetSceneBackground(rcColor: TD3DColor): HResult; stdcall;
  6844.     function SetSceneBackgroundRGB(rvRed, rvGreen, rvBlue: TD3DValue): HResult; stdcall;
  6845.     function SetSceneBackgroundDepth(lpImage: IDirectDrawSurface): HResult; stdcall;
  6846.     function SetSceneBackgroundImage(lpTexture: IDirect3DRMTexture): HResult; stdcall;
  6847.     function SetSceneFogEnable(bEnable: BOOL): HResult; stdcall;
  6848.     function SetSceneFogColor(rcColor: TD3DColor): HResult; stdcall;
  6849.     function SetSceneFogMode(rfMode: TD3DRMFogMode): HResult; stdcall;
  6850.     function SetSceneFogParams(rvStart, rvEnd, rvDensity: TD3DValue): HResult; stdcall;
  6851.     function SetColor(rcColor: TD3DColor): HResult; stdcall;
  6852.     function SetColorRGB(rvRed, rvGreen, rvBlue: TD3DValue): HResult; stdcall;
  6853.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  6854.     function SetMaterialMode(rmmMode: TD3DRMMaterialMode): HResult; stdcall;
  6855.     function SetOrientation(lpRef: IDirect3DRMFrame; rvDx, rvDy, rvDz, rvUx,
  6856.         rvUy, rvUz: TD3DValue): HResult; stdcall;
  6857.     function SetPosition(lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue): HResult; stdcall;
  6858.     function SetRotation(lpRef: IDirect3DRMFrame; rvX, rvY, rvZ,
  6859.         rvTheta: TD3DValue): HResult; stdcall;
  6860.     function SetSortMode(d3drmSM: TD3DRMSortMode): HResult; stdcall;
  6861.     function SetTexture(lpD3DRMTexture: IDirect3DRMTexture): HResult; stdcall;
  6862.     function SetTextureTopology(cylU, cylV: BOOL): HResult; stdcall;
  6863.     function SetVelocity(lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue;
  6864.         fRotVel: BOOL): HResult; stdcall;
  6865.     function SetZbufferMode(d3drmZBM: TD3DRMZBufferMode): HResult; stdcall;
  6866.     function Transform(var lpd3dVDst, lpd3dVSrc: TD3DVector): HResult; stdcall;
  6867.   end;
  6868.  
  6869.   IDirect3DRMFrame2 = interface(IDirect3DRMFrame)
  6870.     ['{C3DFBD60-3988-11D0-9EC2-0000C0291AC3}']
  6871.     // IDirect3DRMFrame2 methods
  6872.     function AddMoveCallback2(d3drmFMC: TD3DRMFrameMoveCallback; lpArg:
  6873.         Pointer; dwFlags: DWORD): HResult; stdcall;
  6874.     function GetBox(var lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  6875.     function GetBoxEnable: BOOL; stdcall;
  6876.     function GetAxes(var dir, up: TD3DVector): HResult; stdcall;
  6877.     function GetMaterial(out lplpMaterial: IDirect3DRMMaterial): HResult; stdcall;
  6878.     function GetInheritAxes: BOOL; stdcall;
  6879.     function GetHierarchyBox(var lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  6880.     function SetBox(const lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  6881.     function SetBoxEnable(bEnableFlag: BOOL): HResult; stdcall;
  6882.     function SetAxes(dx, dy, dz, ux, uy, uz: TD3DValue): HResult; stdcall;
  6883.     function SetInheritAxes(inherit_from_parent: BOOL): HResult; stdcall;
  6884.     function SetMaterial(lplpMaterial: IDirect3DRMMaterial): HResult; stdcall;
  6885.     function SetQuaternion(lpRef: IDirect3DRMFrame2; var quat: TD3DRMQuaternion): HResult; stdcall;
  6886.     function RayPick(lpRefFrame: IDirect3DRMFrame; const ray: TD3DRMRay;
  6887.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array): HResult; stdcall;
  6888.     function Save(lpFilename: PChar; d3dFormat: TD3DRMXOFFormat;
  6889.         d3dSaveFlags: TD3DRMSaveOptions): HResult; stdcall;
  6890.   end;
  6891.  
  6892.   IDirect3DRMFrame3 = interface(IDirect3DRMVisual)
  6893.     ['{FF6B7F70-A40E-11D1-91F9-0000F8758E66}']
  6894.     function AddChild(lpD3DRMFrameChild: IDirect3DRMFrame3): HResult; stdcall;
  6895.     function AddLight(lpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  6896.     function AddMoveCallback(d3drmFMC: TD3DRMFrame3MoveCallback;
  6897.         lpArg: Pointer; dwFlags: DWORD): HResult; stdcall;
  6898.     function AddTransform(rctCombine: TD3DRMCombineType;
  6899.         rmMatrix: TD3DRMMatrix4D): HResult; stdcall;
  6900.     function AddTranslation(rctCombine: TD3DRMCombineType; rvX, rvY,
  6901.         rvZ: TD3DValue): HResult; stdcall;
  6902.     function AddScale(rctCombine: TD3DRMCombineType; rvX, rvY,
  6903.         rvZ: TD3DValue): HResult; stdcall;
  6904.     function AddRotation(rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  6905.         rvTheta: TD3DValue): HResult; stdcall;
  6906.     function AddVisual(lpD3DRMVisual: IDirect3DRMVisual): HResult; stdcall;
  6907.     function GetChildren(out lplpChildren: IDirect3DRMFrameArray): HResult; stdcall;
  6908.     function GetColor: TD3DColor; stdcall;
  6909.     function GetLights(out lplpLights: IDirect3DRMLightArray): HResult; stdcall;
  6910.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  6911.     function GetParent(out lplpParent: IDirect3DRMFrame3): HResult; stdcall;
  6912.     function GetPosition(lpRef: IDirect3DRMFrame3; var lprvPos: TD3DVector): HResult; stdcall;
  6913.     function GetRotation(lpRef: IDirect3DRMFrame3; var lprvAxis: TD3DVector;
  6914.         var lprvTheta: TD3DValue): HResult; stdcall;
  6915.     function GetScene(out lplpRoot: IDirect3DRMFrame3): HResult; stdcall;
  6916.     function GetSortMode: TD3DRMSortMode; stdcall;
  6917.     function GetTexture(out lplpTexture: IDirect3DRMTexture3): HResult; stdcall;
  6918.     function GetTransform(RefFrame: IDirect3DRMFrame3; var rmMatrix: TD3DRMMatrix4D): HResult; stdcall;
  6919.     function GetVelocity(lpRef: IDirect3DRMFrame3; var lprvVel: TD3DVector;
  6920.         fRotVel: BOOL): HResult; stdcall;
  6921.     function GetOrientation(lpRef: IDirect3DRMFrame3; var lprvDir: TD3DVector;
  6922.         var lprvUp: TD3DVector): HResult; stdcall;
  6923.     function GetVisuals(var pdwNumVisuals: DWORD; var lplpVisuals: Pointer): HResult; stdcall;
  6924.     function InverseTransform(var lprvDst, lprvSrc: TD3DVector): HResult; stdcall;
  6925.     function Load(lpvObjSource: Pointer; lpvObjID: Pointer;
  6926.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  6927.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer): HResult; stdcall;
  6928.     function LookAt(lpTarget, lpRef: IDirect3DRMFrame3;
  6929.         rfcConstraint: TD3DRMFrameConstraint): HResult; stdcall;
  6930.     function Move(delta: TD3DValue): HResult; stdcall;
  6931.     function DeleteChild(lpChild: IDirect3DRMFrame3): HResult; stdcall;
  6932.     function DeleteLight(lpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  6933.     function DeleteMoveCallback(d3drmFMC: TD3DRMFrame3MoveCallback; lpArg: Pointer): HResult; stdcall;
  6934.     function DeleteVisual(lpD3DRMVisual: IDirect3DRMVisual): HResult; stdcall;
  6935.     function GetSceneBackground: TD3DColor; stdcall;
  6936.     function GetSceneBackgroundDepth(out lplpDDSurface: IDirectDrawSurface): HResult; stdcall;
  6937.     function GetSceneFogColor: TD3DColor; stdcall;
  6938.     function GetSceneFogEnable: BOOL; stdcall;
  6939.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  6940.     function GetSceneFogParams(var lprvStart, lprvEnd, lprvDensity: TD3DValue): HResult; stdcall;
  6941.     function SetSceneBackground(rcColor: TD3DColor): HResult; stdcall;
  6942.     function SetSceneBackgroundRGB(rvRed, rvGreen, rvBlue: TD3DValue): HResult; stdcall;
  6943.     function SetSceneBackgroundDepth(lpImage: IDirectDrawSurface): HResult; stdcall;
  6944.     function SetSceneBackgroundImage(lpTexture: IDirect3DRMTexture3): HResult; stdcall;
  6945.     function SetSceneFogEnable(bEnable: BOOL): HResult; stdcall;
  6946.     function SetSceneFogColor(rcColor: TD3DColor): HResult; stdcall;
  6947.     function SetSceneFogMode(rfMode: TD3DRMFogMode): HResult; stdcall;
  6948.     function SetSceneFogParams(rvStart, rvEnd, rvDensity: TD3DValue): HResult; stdcall;
  6949.     function SetColor(rcColor: TD3DColor): HResult; stdcall;
  6950.     function SetColorRGB(rvRed, rvGreen, rvBlue: TD3DValue): HResult; stdcall;
  6951.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  6952.     function SetMaterialMode(rmmMode: TD3DRMMaterialMode): HResult; stdcall;
  6953.     function SetOrientation(lpRef: IDirect3DRMFrame3; rvDx, rvDy, rvDz, rvUx,
  6954.         rvUy, rvUz: TD3DValue): HResult; stdcall;
  6955.     function SetPosition(lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue): HResult; stdcall;
  6956.     function SetRotation(lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ, rvTheta: TD3DValue): HResult; stdcall;
  6957.     function SetSortMode(d3drmSM: TD3DRMSortMode): HResult; stdcall;
  6958.     function SetTexture(lpD3DRMTexture: IDirect3DRMTexture3): HResult; stdcall;
  6959.     function SetVelocity(lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue;
  6960.         fRotVel: BOOL): HResult; stdcall;
  6961.     function SetZbufferMode(d3drmZBM: TD3DRMZBufferMode): HResult; stdcall;
  6962.     function Transform(var lpd3dVDst, lpd3dVSrc: TD3DVector): HResult; stdcall;
  6963.     function GetBox(var lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  6964.     function GetBoxEnable: BOOL; stdcall;
  6965.     function GetAxes(var dir, up: TD3DVector): HResult; stdcall;
  6966.     function GetMaterial(out lplpMaterial: IDirect3DRMMaterial2): HResult; stdcall;
  6967.     function GetInheritAxes: BOOL; stdcall;
  6968.     function GetHierarchyBox(var lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  6969.     function SetBox(const lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  6970.     function SetBoxEnable(bEnableFlag: BOOL): HResult; stdcall;
  6971.     function SetAxes(dx, dy, dz, ux, uy, uz: TD3DValue): HResult; stdcall;
  6972.     function SetInheritAxes(inherit_from_parent: BOOL): HResult; stdcall;
  6973.     function SetMaterial(lplpMaterial: IDirect3DRMMaterial2): HResult; stdcall;
  6974.     function SetQuaternion(lpRef: IDirect3DRMFrame3; var quat: TD3DRMQuaternion): HResult; stdcall;
  6975.     function RayPick(lpRefFrame: IDirect3DRMFrame3; const ray: TD3DRMRay;
  6976.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array): HResult; stdcall;
  6977.     function Save(lpFilename: PChar; d3dFormat: TD3DRMXOFFormat;
  6978.         d3dSaveFlags: TD3DRMSaveOptions): HResult; stdcall;
  6979.     function TransformVectors(reference: IDirect3DRMFrame3; dwNumVectors: DWORD;
  6980.         var lpDstVectors: TD3DVector; const lpSrcVectors: TD3DVector): HResult; stdcall;
  6981.     function InverseTransformVectors(reference: IDirect3DRMFrame3; dwNumVectors: DWORD;
  6982.         var lpDstVectors: TD3DVector; const lpSrcVectors: TD3DVector): HResult; stdcall;
  6983.     function SetTraversalOptions(dwFlags: DWORD): HResult; stdcall;
  6984.     function GetTraversalOptions(var lpdwFlags: DWORD): HResult; stdcall;
  6985.     function SetSceneFogMethod(dwFlags: DWORD): HResult; stdcall;
  6986.     function GetSceneFogMethod(var lpdwFlags: DWORD): HResult; stdcall;
  6987.     function SetMaterialOverride(lpdmOverride: TD3DRMMaterialOverride): HResult; stdcall;
  6988.     function GetMaterialOverride(var lplpdmOverride: TD3DRMMaterialOverride): HResult; stdcall;
  6989.   end;
  6990.  
  6991.   IDirect3DRMMesh = interface(IDirect3DRMVisual)
  6992.     ['{A3A80D01-6E12-11CF-AC4A-0000C03825A1}']
  6993.     // IDirect3DRMMesh methods
  6994.     function Scale(sx, sy, sz: TD3DValue): HResult; stdcall;
  6995.     function Translate(tx, ty, tz: TD3DValue): HResult; stdcall;
  6996.     function GetBox(var lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  6997.     function AddGroup(vCount, fCount, vPerFace: DWORD; var fData: DWORD;
  6998.         var returnId: TD3DRMGroupIndex): HResult; stdcall;
  6999.     function SetVertices(id: TD3DRMGroupIndex; index, count: DWORD;
  7000.         var values: TD3DRMVertex): HResult; stdcall;
  7001.     function SetGroupColor(id: TD3DRMGroupIndex; value: TD3DColor): HResult; stdcall;
  7002.     function SetGroupColorRGB(id: TD3DRMGroupIndex; red, green,
  7003.         blue: TD3DValue): HResult; stdcall;
  7004.     function SetGroupMapping(id: TD3DRMGroupIndex;
  7005.         value: TD3DRMMapping): HResult; stdcall;
  7006.     function SetGroupQuality(id: TD3DRMGroupIndex;
  7007.         value: TD3DRMRenderQuality): HResult; stdcall;
  7008.     function SetGroupMaterial(id: TD3DRMGroupIndex; value:
  7009.         IDirect3DRMMaterial): HResult; stdcall;
  7010.     function SetGroupTexture(id: TD3DRMGroupIndex; value: IDirect3DRMTexture): HResult; stdcall;
  7011.     function GetGroupCount: DWORD; stdcall;
  7012.     function GetGroup(id: TD3DRMGroupIndex; var vCount, fCount, vPerFace,
  7013.         fDataSize, fData: DWORD): HResult; stdcall;
  7014.     function GetVertices(id: TD3DRMGroupIndex; index: DWORD; count: DWORD;
  7015.         var returnPtr: TD3DRMVertex): HResult; stdcall;
  7016.     function GetGroupColor(id: TD3DRMGroupIndex): TD3DColor; stdcall;
  7017.     function GetGroupMapping(id: TD3DRMGroupIndex): TD3DRMMapping; stdcall;
  7018.     function GetGroupQuality(id: TD3DRMGroupIndex): TD3DRMRenderQuality; stdcall;
  7019.     function GetGroupMaterial(id: TD3DRMGroupIndex;
  7020.         out returnPtr: IDirect3DRMMaterial): HResult; stdcall;
  7021.     function GetGroupTexture(id: TD3DRMGroupIndex;
  7022.         out returnPtr: IDirect3DRMTexture): HResult; stdcall;
  7023.   end;
  7024.  
  7025.   IDirect3DRMProgressiveMesh = interface(IDirect3DRMVisual)
  7026.     ['{4516EC79-8F20-11D0-9B6D-0000C0781BC3}']
  7027.     // IDirect3DRMProgressiveMesh methods
  7028.     function Load(lpSource, lpObjID: pointer; dloLoadflags: TD3DRMLoadOptions;
  7029.         lpCallback: TD3DRMLoadTextureCallback; lpArg: pointer): HResult; stdcall;
  7030.     function GetLoadStatus(var lpStatus: TD3DRMPMeshLoadStatus): HResult; stdcall;
  7031.     function SetMinRenderDetail(d3dVal: TD3DValue): HResult; stdcall;
  7032.     function Abort(dwFlags: DWORD): HResult; stdcall;
  7033.     function GetFaceDetail(var lpdwCount: DWORD): HResult; stdcall;
  7034.     function GetVertexDetail(var lpdwCount: DWORD): HResult; stdcall;
  7035.     function SetFaceDetail(dwCount: DWORD): HResult; stdcall;
  7036.     function SetVertexDetail(dwCount: DWORD): HResult; stdcall;
  7037.     function GetFaceDetailRange(var lpdwMin, lpdwMax: DWORD): HResult; stdcall;
  7038.     function GetVertexDetailRange(var lpdwMin, lpdwMax: DWORD): HResult; stdcall;
  7039.     function GetDetail(var lpdvVal: TD3DValue): HResult; stdcall;
  7040.     function SetDetail(lpdvVal: TD3DValue): HResult; stdcall;
  7041.     function RegisterEvents(hEvent: THANDLE; dwFlags, dwReserved: DWORD): HResult; stdcall;
  7042.     function CreateMesh(out lplpD3DRMMesh: IDirect3DRMMesh): HResult; stdcall;
  7043.     function Duplicate(out lplpD3DRMPMesh: IDirect3DRMProgressiveMesh): HResult; stdcall;
  7044.     function GetBox(var lpBBox: TD3DRMBox): HResult; stdcall;
  7045.     function SetQuality(quality: TD3DRMRenderQuality): HResult; stdcall;
  7046.     function GetQuality(var lpdwquality: TD3DRMRenderQuality): HResult; stdcall;
  7047.   end;
  7048.  
  7049.   IDirect3DRMShadow = interface(IDirect3DRMVisual)
  7050.     ['{AF359780-6BA3-11CF-AC4A-0000C03825A1}']
  7051.     // IDirect3DRMShadow methods
  7052.     function Init(lpD3DRMVisual: IDirect3DRMVisual;
  7053.         lpD3DRMLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue): HResult; stdcall;
  7054.   end;
  7055.  
  7056.   IDirect3DRMShadow2 = interface(IDirect3DRMShadow)
  7057.     ['{86B44E25-9C82-11D1-BB0B-00A0C981A0A6}']
  7058.     // IDirect3DRMShadow2 methods
  7059.     function GetVisual(out lplpDirect3DRMVisual: IDirect3DRMVisual): HResult; stdcall;
  7060.     function SetVisual(pUNK: IUnknown; dwFlags: DWORD): HResult; stdcall;
  7061.     function GetLight(out lplpDirect3DRMLight: IDirect3DRMLight): HResult; stdcall;
  7062.     function SetLight(lpDirect3DRMLight: IDirect3DRMLight; dwFlags: DWORD): HResult; stdcall;
  7063.     function GetPlane(var px, py, pz: TD3DValue; var nx, ny, nz: TD3DValue): HResult; stdcall;
  7064.     function SetPlane(px, py, pz: TD3DValue; nx, ny, nz: TD3DValue): HResult; stdcall;
  7065.     function GetOptions(var pdwOptions: DWORD): HResult; stdcall;
  7066.     function SetOptions(dwOptions: DWORD): HResult; stdcall;
  7067.   end;
  7068.  
  7069.   IDirect3DRMFace = interface(IDirect3DRMObject)
  7070.     ['{EB16CB07-D271-11CE-AC48-0000C03825A1}']
  7071.     // IDirect3DRMFace methods
  7072.     function AddVertex(x, y, z: TD3DValue): HResult; stdcall;
  7073.     function AddVertexAndNormalIndexed(vertex: DWORD; normal: DWORD): HResult; stdcall;
  7074.     function SetColorRGB(red, green, blue: TD3DValue): HResult; stdcall;
  7075.     function SetColor(color: TD3DColor): HResult; stdcall;
  7076.     function SetTexture(lpD3DRMTexture: IDirect3DRMTexture): HResult; stdcall;
  7077.     function SetTextureCoordinates(vertex: DWORD; u, v: TD3DValue): HResult; stdcall;
  7078.     function SetMaterial(lpMat: IDirect3DRMMaterial): HResult; stdcall;
  7079.     function SetTextureTopology(cylU, cylV: BOOL): HResult; stdcall;
  7080.     function GetVertex(index: DWORD; var lpPosition: TD3DVector; var lpNormal: TD3DVector): HResult; stdcall;
  7081.     function GetVertices(var lpdwVertexCount: DWORD; var lpPosition, lpNormal: TD3DVector): HResult; stdcall;
  7082.     function GetTextureCoordinates(index: DWORD; var lpU, lpV: TD3DValue): HResult; stdcall;
  7083.     function GetTextureTopology(var lpU, lpV: BOOL): HResult; stdcall;
  7084.     function GetNormal(var lpNormal: TD3DVector): HResult; stdcall;
  7085.     function GetTexture(out lplpTexture: IDirect3DRMTexture): HResult; stdcall;
  7086.     function GetMaterial(out lpMat: IDirect3DRMMaterial): HResult; stdcall;
  7087.     function GetVertexCount: Longint; stdcall;
  7088.     function GetVertexIndex(dwIndex: DWORD): Longint; stdcall;
  7089.     function GetTextureCoordinateIndex(dwIndex: DWORD): Longint; stdcall;
  7090.     function GetColor: TD3DColor; stdcall;
  7091.   end;
  7092.  
  7093.   IDirect3DRMFace2 = interface(IDirect3DRMObject)
  7094.     ['{4516EC81-8F20-11D0-9B6D-0000C0781BC3}']
  7095.     // IDirect3DRMFace methods
  7096.     function AddVertex(x, y, z: TD3DValue): HResult; stdcall;
  7097.     function AddVertexAndNormalIndexed(vertex: DWORD; normal: DWORD): HResult; stdcall;
  7098.     function SetColorRGB(red, green, blue: TD3DValue): HResult; stdcall;
  7099.     function SetColor(color: TD3DColor): HResult; stdcall;
  7100.     function SetTexture(lpD3DRMTexture: IDirect3DRMTexture3): HResult; stdcall;
  7101.     function SetTextureCoordinates(vertex: DWORD; u, v: TD3DValue): HResult; stdcall;
  7102.     function SetMaterial(lpMat: IDirect3DRMMaterial2): HResult; stdcall;
  7103.     function SetTextureTopology(cylU, cylV: BOOL): HResult; stdcall;
  7104.     function GetVertex(index: DWORD; var lpPosition: TD3DVector; var lpNormal: TD3DVector): HResult; stdcall;
  7105.     function GetVertices(var lpdwVertexCount: DWORD; var lpPosition, lpNormal: TD3DVector): HResult; stdcall;
  7106.     function GetTextureCoordinates(index: DWORD; var lpU, lpV: TD3DValue): HResult; stdcall;
  7107.     function GetTextureTopology(var lpU, lpV: BOOL): HResult; stdcall;
  7108.     function GetNormal(var lpNormal: TD3DVector): HResult; stdcall;
  7109.     function GetTexture(out lplpTexture: IDirect3DRMTexture3): HResult; stdcall;
  7110.     function GetMaterial(out lpMat: IDirect3DRMMaterial2): HResult; stdcall;
  7111.     function GetVertexCount: Longint; stdcall;
  7112.     function GetVertexIndex(dwIndex: DWORD): Longint; stdcall;
  7113.     function GetTextureCoordinateIndex(dwIndex: DWORD): Longint; stdcall;
  7114.     function GetColor: TD3DColor; stdcall;
  7115.   end;
  7116.  
  7117.   IDirect3DRMMeshBuilder = interface(IDirect3DRMVisual)
  7118.     ['{A3A80D02-6E12-11CF-AC4A-0000C03825A1}']
  7119.     // IDirect3DRMMeshBuilder methods
  7120.     function Load(lpvObjSource, lpvObjID: Pointer; d3drmLOFlags: TD3DRMLoadOptions;
  7121.         d3drmLoadTextureProc: TD3DRMLoadTextureCallback; lpvArg: Pointer): HResult; stdcall;
  7122.     function Save(lpFilename: PChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  7123.         d3drmSOContents: TD3DRMSaveOptions): HResult; stdcall;
  7124.     function Scale(sx, sy, sz: TD3DValue): HResult; stdcall;
  7125.     function Translate(tx, ty, tz: TD3DValue): HResult; stdcall;
  7126.     function SetColorSource(source: TD3DRMColorSource): HResult; stdcall;
  7127.     function GetBox(var lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  7128.     function GenerateNormals: HResult; stdcall;
  7129.     function GetColorSource: TD3DRMColorSource; stdcall;
  7130.     function AddMesh(lpD3DRMMesh: IDirect3DRMMesh): HResult; stdcall;
  7131.     function AddMeshBuilder(lpD3DRMMeshBuild: IDirect3DRMMeshBuilder): HResult; stdcall;
  7132.     function AddFrame(lpD3DRMFrame: IDirect3DRMFrame): HResult; stdcall;
  7133.     function AddFace(lpD3DRMFace: IDirect3DRMFace): HResult; stdcall;
  7134.     function AddFaces(dwVertexCount: DWORD; var lpD3DVertices: TD3DVector;
  7135.         normalCount: DWORD; var lpNormals: TD3DVector; var lpFaceData: DWORD;
  7136.         out lplpD3DRMFaceArray: IDirect3DRMFaceArray): HResult; stdcall;
  7137.     function ReserveSpace(vertexCount, normalCount, faceCount: DWORD): HResult; stdcall;
  7138.     function SetColorRGB(red, green, blue: TD3DValue): HResult; stdcall;
  7139.     function SetColor(color: TD3DColor): HResult; stdcall;
  7140.     function SetTexture(lpD3DRMTexture: IDirect3DRMTexture): HResult; stdcall;
  7141.     function SetMaterial(lpIDirect3DRMmaterial: IDirect3DRMMaterial): HResult; stdcall;
  7142.     function SetTextureTopology(cylU, cylV: BOOL): HResult; stdcall;
  7143.     function SetQuality(quality: TD3DRMRenderQuality): HResult; stdcall;
  7144.     function SetPerspective(perspective: BOOL): HResult; stdcall;
  7145.     function SetVertex(index: DWORD; x, y, z: TD3DValue): HResult; stdcall;
  7146.     function SetNormal(index: DWORD; x, y, z: TD3DValue): HResult; stdcall;
  7147.     function SetTextureCoordinates(index: DWORD; u, v: TD3DValue): HResult; stdcall;
  7148.     function SetVertexColor(index: DWORD; color: TD3DColor): HResult; stdcall;
  7149.     function SetVertexColorRGB(index: DWORD; red, green, blue: TD3DValue): HResult; stdcall;
  7150.     function GetFaces(out lplpD3DRMFaceArray: IDirect3DRMFaceArray): HResult; stdcall;
  7151.     function GetVertices(var vcount: DWORD; var vertices: TD3DVector;
  7152.         var ncount: DWORD; var normals: TD3DVector; var face_data_size: DWORD;
  7153.         var face_data: DWORD): HResult; stdcall;
  7154.     function GetTextureCoordinates(index: DWORD; var u, v: TD3DValue): HResult; stdcall;
  7155.     function AddVertex(x, y, z: TD3DValue): Longint; stdcall;
  7156.     function AddNormal(x, y, z: TD3DValue): Longint; stdcall;
  7157.     function CreateFace(out lplpd3drmFace: IDirect3DRMFace): HResult; stdcall;
  7158.     function GetQuality: TD3DRMRenderQuality; stdcall;
  7159.     function GetPerspective: BOOL; stdcall;
  7160.     function GetFaceCount: Longint; stdcall;
  7161.     function GetVertexCount: Longint; stdcall;
  7162.     function GetVertexColor(index: DWORD): TD3DColor; stdcall;
  7163.     function CreateMesh(out lplpD3DRMMesh: IDirect3DRMMesh): HResult; stdcall;
  7164.   end;
  7165.  
  7166.   IDirect3DRMMeshBuilder2 = interface(IDirect3DRMMeshBuilder)
  7167.     ['{4516EC77-8F20-11D0-9B6D-0000C0781BC3}']
  7168.     // IDirect3DRMMeshBuilder2 methods
  7169.     function GenerateNormals2(dvCreaseAngle: TD3DValue; dwFlags: DWORD): HResult; stdcall;
  7170.     function GetFace(dwIndex: DWORD; out lplpD3DRMFace: IDirect3DRMFace): HResult; stdcall;
  7171.   end;
  7172.  
  7173.   IDirect3DRMMeshBuilder3 = interface(IDirect3DRMVisual)
  7174.     ['{4516EC82-8F20-11D0-9B6D-0000C0781BC3}']
  7175.     // IDirect3DRMMeshBuilder methods
  7176.     function Load(lpvObjSource, lpvObjID: Pointer; d3drmLOFlags: TD3DRMLoadOptions;
  7177.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback; lpvArg: Pointer): HResult; stdcall;
  7178.     function Save(lpFilename: PChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  7179.         d3drmSOContents: TD3DRMSaveOptions): HResult; stdcall;
  7180.     function Scale(sx, sy, sz: TD3DValue): HResult; stdcall;
  7181.     function Translate(tx, ty, tz: TD3DValue): HResult; stdcall;
  7182.     function SetColorSource(source: TD3DRMColorSource): HResult; stdcall;
  7183.     function GetBox(var lpD3DRMBox: TD3DRMBox): HResult; stdcall;
  7184.     function GenerateNormals(dvCreaseAngle: TD3DValue; dwFlags: DWORD): HResult; stdcall;
  7185.     function GetColorSource: TD3DRMColorSource; stdcall;
  7186.     function AddMesh(lpD3DRMMesh: IDirect3DRMMesh): HResult; stdcall;
  7187.     function AddMeshBuilder(lpD3DRMMeshBuild: IDirect3DRMMeshBuilder3): HResult; stdcall;
  7188.     function AddFrame(lpD3DRMFrame: IDirect3DRMFrame3): HResult; stdcall;
  7189.     function AddFace(lpD3DRMFace: IDirect3DRMFace2): HResult; stdcall;
  7190.     function AddFaces(dwVertexCount: DWORD; var lpD3DVertices: TD3DVector;
  7191.         normalCount: DWORD; var lpNormals: TD3DVector; var lpFaceData: DWORD;
  7192.         out lplpD3DRMFaceArray: IDirect3DRMFaceArray): HResult; stdcall;
  7193.     function ReserveSpace(vertexCount, normalCount, faceCount: DWORD): HResult; stdcall;
  7194.     function SetColorRGB(red, green, blue: TD3DValue): HResult; stdcall;
  7195.     function SetColor(color: TD3DColor): HResult; stdcall;
  7196.     function SetTexture(lpD3DRMTexture: IDirect3DRMTexture3): HResult; stdcall;
  7197.     function SetMaterial(lpDirect3DRMMaterial: IDirect3DRMMaterial2): HResult; stdcall;
  7198.     function SetTextureTopology(cylU, cylV: BOOL): HResult; stdcall;
  7199.     function SetQuality(quality: TD3DRMRenderQuality): HResult; stdcall;
  7200.     function SetPerspective(perspective: BOOL): HResult; stdcall;
  7201.     function SetVertex(index: DWORD; x, y, z: TD3DValue): HResult; stdcall;
  7202.     function SetNormal(index: DWORD; x, y, z: TD3DValue): HResult; stdcall;
  7203.     function SetTextureCoordinates(index: DWORD; u, v: TD3DValue): HResult; stdcall;
  7204.     function SetVertexColor(index: DWORD; color: TD3DColor): HResult; stdcall;
  7205.     function SetVertexColorRGB(index: DWORD; red, green, blue: TD3DValue): HResult; stdcall;
  7206.     function GetFaces(out lplpD3DRMFaceArray: IDirect3DRMFaceArray): HResult; stdcall;
  7207.     function GetGeometry(var vcount: DWORD; var vertices; var ncount: DWORD; var normals;
  7208.       var face_data_size: DWORD; var face_data): HResult; stdcall;
  7209.     function GetTextureCoordinates(index: DWORD; var u, v: TD3DValue): HResult; stdcall;
  7210.     function AddVertex(x, y, z: TD3DValue): Longint; stdcall;
  7211.     function AddNormal(x, y, z: TD3DValue): Longint; stdcall;
  7212.     function CreateFace(out lplpd3drmFace: IDirect3DRMFace2): HResult; stdcall;
  7213.     function GetQuality: TD3DRMRenderQuality; stdcall;
  7214.     function GetPerspective: BOOL; stdcall;
  7215.     function GetFaceCount: Longint; stdcall;
  7216.     function GetVertexCount: Longint; stdcall;
  7217.     function GetVertexColor(index: DWORD): TD3DColor; stdcall;
  7218.     function CreateMesh(out lplpD3DRMMesh: IDirect3DRMMesh): HResult; stdcall;
  7219.     function GetFace(dwIndex: DWORD; out lplpD3DRMFace: IDirect3DRMFace2): HResult; stdcall;
  7220.     function GetVertex(dwIndex: DWORD; var lpVector: TD3DVector): HResult; stdcall;
  7221.     function GetNormal(dwIndex: DWORD; var lpVector: TD3DVector): HResult; stdcall;
  7222.     function DeleteVertices(dwIndexFirst: DWORD; dwCount: DWORD): HResult; stdcall;
  7223.     function DeleteNormals(dwIndexFirst: DWORD; dwCount: DWORD): HResult; stdcall;
  7224.     function DeleteFace(lpD3DRMFace: IDirect3DRMFace2): HResult; stdcall;
  7225.     function Empty(dwFlags: DWORD): HResult; stdcall;
  7226.     function Optimize(dwFlags: DWORD): HResult; stdcall;
  7227.     function AddFacesIndexed(dwFlags: DWORD; var lpdwvIndices: DWORD;
  7228.         var dwIndexFirst: DWORD; var dwCount: DWORD): HResult; stdcall;
  7229.     function CreateSubMesh(out lplpUnk: IUnknown): HResult; stdcall;
  7230.     function GetParentMesh(dwFlags: DWORD; out lplpUnk: IUnknown): HResult; stdcall;
  7231.     function GetSubMeshes(var lpdwCount: DWORD; out lplpUnk: IUnknown): HResult; stdcall;
  7232.     function DeleteSubMesh(lpUnk: IUnknown): HResult; stdcall;
  7233.     function Enable(dwFlags: DWORD): HResult; stdcall;
  7234.     function GetEnable(var lpdwFlags: DWORD): HResult; stdcall;
  7235.     function AddTriangles(dwFlags: DWORD; dwFormat: DWORD; dwVertexCount: DWORD;
  7236.         lpvData: Pointer): HResult; stdcall;
  7237.     function SetVertices(dwIndexFirst: DWORD; dwCount: DWORD;
  7238.         const lpdvVector: TD3DVector): HResult; stdcall;
  7239.     function GetVertices(dwIndexFirst: DWORD; var lpdwCount: DWORD;
  7240.         var lpdvVector: TD3DVector): HResult; stdcall;
  7241.     function SetNormals(dwIndexFirst: DWORD; dwCount: DWORD;
  7242.         const lpdvVector: TD3DVector): HResult; stdcall;
  7243.     function GetNormals(dwIndexFirst: DWORD; var lpdwCount: DWORD;
  7244.         var lpdvVector: TD3DVector): HResult; stdcall;
  7245.     function GetNormalCount: Longint; stdcall;
  7246.   end;
  7247.  
  7248.   IDirect3DRMLight = interface(IDirect3DRMObject)
  7249.     ['{EB16CB08-D271-11CE-AC48-0000C03825A1}']
  7250.     // IDirect3DRMLight methods
  7251.     function SetType(d3drmtType: TD3DRMLightType): HResult; stdcall;
  7252.     function SetColor(rcColor: TD3DColor): HResult; stdcall;
  7253.     function SetColorRGB(rvRed, rvGreen, rvBlue: TD3DValue): HResult; stdcall;
  7254.     function SetRange(rvRange: TD3DValue): HResult; stdcall;
  7255.     function SetUmbra(rvAngle: TD3DValue): HResult; stdcall;
  7256.     function SetPenumbra(rvAngle: TD3DValue): HResult; stdcall;
  7257.     function SetConstantAttenuation(rvAtt: TD3DValue): HResult; stdcall;
  7258.     function SetLinearAttenuation(rvAtt: TD3DValue): HResult; stdcall;
  7259.     function SetQuadraticAttenuation(rvAtt: TD3DValue): HResult; stdcall;
  7260.     function GetRange: TD3DValue; stdcall;
  7261.     function GetUmbra: TD3DValue; stdcall;
  7262.     function GetPenumbra: TD3DValue; stdcall;
  7263.     function GetConstantAttenuation: TD3DValue; stdcall;
  7264.     function GetLinearAttenuation: TD3DValue; stdcall;
  7265.     function GetQuadraticAttenuation: TD3DValue; stdcall;
  7266.     function GetColor: TD3DColor; stdcall;
  7267.     function GetType: TD3DRMLightType; stdcall;
  7268.     function SetEnableFrame(lpEnableFrame: IDirect3DRMFrame): HResult; stdcall;
  7269.     function GetEnableFrame(out lplpEnableFrame: IDirect3DRMFrame): HResult; stdcall;
  7270.   end;
  7271.  
  7272.   IDirect3DRMTexture = interface(IDirect3DRMVisual)
  7273.     ['{EB16CB09-D271-11CE-AC48-0000C03825A1}']
  7274.     // IDirect3DRMTexture methods
  7275.     function InitFromFile(filename: PChar): HResult; stdcall;
  7276.     function InitFromSurface(lpDDS: IDirectDrawSurface): HResult; stdcall;
  7277.     function InitFromResource(rs: HRSRC): HResult; stdcall;
  7278.     function Changed(bPixels, bPalette: BOOL): HResult; stdcall;
  7279.     function SetColors(ulColors: DWORD): HResult; stdcall;
  7280.     function SetShades(ulShades: DWORD): HResult; stdcall;
  7281.     function SetDecalSize(rvWidth, rvHeight: TD3DValue): HResult; stdcall;
  7282.     function SetDecalOrigin(lX, lY: Longint): HResult; stdcall;
  7283.     function SetDecalScale(dwScale: DWORD): HResult; stdcall;
  7284.     function SetDecalTransparency(bTransp: BOOL): HResult; stdcall;
  7285.     function SetDecalTransparentColor(rcTransp: TD3DColor): HResult; stdcall;
  7286.     function GetDecalSize(var lprvWidth, lprvHeight: TD3DValue): HResult; stdcall;
  7287.     function GetDecalOrigin(var lplX, lplY: Longint): HResult; stdcall;
  7288.     function GetImage: PD3DRMImage; stdcall;
  7289.     function GetShades: DWORD; stdcall;
  7290.     function GetColors: DWORD; stdcall;
  7291.     function GetDecalScale: DWORD; stdcall;
  7292.     function GetDecalTransparency: BOOL; stdcall;
  7293.     function GetDecalTransparentColor: TD3DColor; stdcall;
  7294.   end;
  7295.  
  7296.   IDirect3DRMTexture2 = interface(IDirect3DRMTexture)
  7297.     ['{120F30C0-1629-11D0-941C-0080C80CFA7B}']
  7298.     // IDirect3DRMTexture2 methods
  7299.     function InitFromImage(const lpImage: TD3DRMImage): HResult; stdcall;
  7300.     function InitFromResource2(hModule: HModule; strName, strType: PChar): HResult; stdcall;
  7301.     function GenerateMIPMap(dwFlags: DWORD): HResult; stdcall;
  7302.   end;
  7303.  
  7304.   IDirect3DRMTexture3 = interface(IDirect3DRMTexture2)
  7305.     ['{FF6B7F73-A40E-11D1-91F9-0000F8758E66}']
  7306.     // IDirect3DRMTexture3 methods
  7307.     function GetSurface(dwFlags: DWORD; out lplpDDS: IDirectDrawSurface): HResult; stdcall;
  7308.     function SetCacheOptions(lImportance: Longint; dwFlags: DWORD): HResult; stdcall;
  7309.     function GetCacheOptions(var lplImportance: Longint; var lpdwFlags: DWORD): HResult; stdcall;
  7310.     function SetDownsampleCallback(pCallback: TD3DRMDownSampleCallback; pArg: Pointer): HResult; stdcall;
  7311.     function SetValidationCallback(pCallback: TD3DRMValidationCallback; pArg: Pointer): HResult; stdcall;
  7312.   end;
  7313.  
  7314.   IDirect3DRMWrap = interface(IDirect3DRMObject)
  7315.     ['{EB16CB0A-D271-11CE-AC48-0000C03825A1}']
  7316.     // IDirect3DRMWrap methods
  7317.     function Init(d3drmwt: TD3DRMWrapType; lpd3drmfRef: IDirect3DRMFrame;
  7318.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue): HResult; stdcall;
  7319.     function Apply(lpObject: IDirect3DRMObject): HResult; stdcall;
  7320.     function ApplyRelative(frame: IDirect3DRMFrame; mesh: IDirect3DRMObject): HResult; stdcall;
  7321.   end;
  7322.  
  7323.   IDirect3DRMMaterial = interface(IDirect3DRMObject)
  7324.     ['{EB16CB0B-D271-11CE-AC48-0000C03825A1}']
  7325.     // IDirect3DRMMaterial methods
  7326.     function SetPower(rvPower: TD3DValue): HResult; stdcall;
  7327.     function SetSpecular(r, g, b: TD3DValue): HResult; stdcall;
  7328.     function SetEmissive(r, g, b: TD3DValue): HResult; stdcall;
  7329.     function GetPower: TD3DValue; stdcall;
  7330.     function GetSpecular(var r, g, b: TD3DValue): HResult; stdcall;
  7331.     function GetEmissive(var r, g, b: TD3DValue): HResult; stdcall;
  7332.   end;
  7333.  
  7334.   IDirect3DRMMaterial2 = interface(IDirect3DRMMaterial)
  7335.     ['{FF6B7F75-A40E-11D1-91F9-0000F8758E66}']
  7336.     // IDirect3DRMMaterial2 methods
  7337.     function GetAmbient(var r, g, b: TD3DValue): HResult; stdcall;
  7338.     function SetAmbient(r, g, b: TD3DValue): HResult; stdcall;
  7339.   end;
  7340.  
  7341.   IDirect3DRMAnimation = interface(IDirect3DRMObject)
  7342.     ['{EB16CB0D-D271-11CE-AC48-0000C03825A1}']
  7343.     // IDirect3DRMAnimation methods
  7344.     function SetOptions(d3drmanimFlags: TD3DRMAnimationOptions): HResult; stdcall;
  7345.     function AddRotateKey(rvTime: TD3DValue; const rqQuat: TD3DRMQuaternion): HResult; stdcall;
  7346.     function AddPositionKey(rvTime, rvX, rvY, rvZ: TD3DValue): HResult; stdcall;
  7347.     function AddScaleKey(time, x, y, z: TD3DValue): HResult; stdcall;
  7348.     function DeleteKey(time: TD3DValue): HResult; stdcall;
  7349.     function SetFrame(lpD3DRMFrame: IDirect3DRMFrame): HResult; stdcall;
  7350.     function SetTime(rvTime: TD3DValue): HResult; stdcall;
  7351.     function GetOptions: TD3DRMAnimationOptions; stdcall;
  7352.   end;
  7353.  
  7354.   IDirect3DRMAnimation2 = interface(IDirect3DRMObject)
  7355.     ['{FF6B7F77-A40E-11D1-91F9-0000F8758E66}']
  7356.     // IDirect3DRMAnimation2 methods
  7357.     function SetOptions(d3drmanimFlags: TD3DRMAnimationOptions): HResult; stdcall;
  7358.     function AddRotateKey(rvTime: TD3DValue; const rqQuat: TD3DRMQuaternion): HResult; stdcall;
  7359.     function AddPositionKey(rvTime, rvX, rvY, rvZ: TD3DValue): HResult; stdcall;
  7360.     function AddScaleKey(time, x, y, z: TD3DValue): HResult; stdcall;
  7361.     function DeleteKey(time: TD3DValue): HResult; stdcall;
  7362.     function SetFrame(lpD3DRMFrame: IDirect3DRMFrame3): HResult; stdcall;
  7363.     function SetTime(rvTime: TD3DValue): HResult; stdcall;
  7364.     function GetOptions: TD3DRMAnimationOptions; stdcall;
  7365.     function GetFrame(out lpD3DFrame: IDirect3DRMFrame3): HResult; stdcall;
  7366.     function DeleteKeyByID(dwID: DWORD): HResult; stdcall;
  7367.     function AddKey(const lpKey: TD3DRMAnimationKey): HResult; stdcall;
  7368.     function ModifyKey(const lpKey: TD3DRMAnimationKey): HResult; stdcall;
  7369.     function GetKeys(dvTimeMin, dvTimeMax: TD3DValue; var lpdwNumKeys: DWORD;
  7370.         var lpKey: TD3DRMAnimationKey): HResult; stdcall;
  7371.   end;
  7372.  
  7373.   IDirect3DRMAnimationSet = interface(IDirect3DRMObject)
  7374.     ['{EB16CB0E-D271-11CE-AC48-0000C03825A1}']
  7375.     // IDirect3DRMAnimationSet methods
  7376.     function AddAnimation(lpD3DRMAnimation: IDirect3DRMAnimation): HResult; stdcall;
  7377.     function Load(lpvObjSource, lpvObjID: Pointer; d3drmLOFlags: TD3DRMLoadOptions;
  7378.         d3drmLoadTextureProc: TD3DRMLoadTextureCallback; lpArgLTP: Pointer;
  7379.         lpParentFrame: IDirect3DRMFrame): HResult; stdcall;
  7380.     function DeleteAnimation(lpD3DRMAnimation: IDirect3DRMAnimation): HResult; stdcall;
  7381.     function SetTime(rvTime: TD3DValue): HResult; stdcall;
  7382.   end;
  7383.  
  7384.   IDirect3DRMAnimationSet2 = interface(IDirect3DRMObject)
  7385.     ['{FF6B7F79-A40E-11D1-91F9-0000F8758E66}']
  7386.     // IDirect3DRMAnimationSet2 methods
  7387.     function AddAnimation(aid: IDirect3DRMAnimation2): HResult; stdcall;
  7388.     function Load(filename, name: Pointer; loadflags: TD3DRMLoadOptions;
  7389.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback; lpArg: Pointer;
  7390.         lpParentFrame: IDirect3DRMFrame3): HResult; stdcall;
  7391.     function DeleteAnimation(aid: IDirect3DRMAnimation2): HResult; stdcall;
  7392.     function SetTime(time: TD3DValue): HResult; stdcall;
  7393.     function GetAnimations(out lpAnimationArray: IDirect3DRMAnimationArray): HResult; stdcall;
  7394.   end;
  7395.  
  7396.   IDirect3DRMUserVisual = interface(IDirect3DRMVisual)
  7397.     ['{59163DE0-6D43-11CF-AC4A-0000C03825A1}']
  7398.     // IDirect3DRMUserVisual methods
  7399.     function Init(d3drmUVProc: TD3DRMUserVisualCallback; lpArg: Pointer): HResult; stdcall;
  7400.   end;
  7401.  
  7402.   IDirect3DRMArray = interface(IUnknown)
  7403.     function GetSize: DWORD; stdcall;
  7404.     (* No GetElement method as it would get overloaded
  7405.      * in derived classes, and overloading is
  7406.      * a no-no in COM
  7407.      *)
  7408.   end;
  7409.  
  7410.   IDirect3DRMObjectarray = interface(IDirect3DRMArray)
  7411.     function GetElement(index: DWORD; out lplpD3DRMObject: IDirect3DRMObject): HResult; stdcall;
  7412.   end;
  7413.  
  7414.   IDirect3DRMDeviceArray = interface(IDirect3DRMArray)
  7415.     ['{EB16CB10-D271-11CE-AC48-0000C03825A1}']
  7416.     // IDirect3DRMDevicearraymethods
  7417.     function GetElement(index: DWORD; out lplpD3DRMDevice: IDirect3DRMDevice): HResult; stdcall;
  7418.   end;
  7419.  
  7420.   IDirect3DRMFrameArray = interface(IDirect3DRMArray)
  7421.     ['{EB16CB12-D271-11CE-AC48-0000C03825A1}']
  7422.     // IDirect3DRMFramearraymethods
  7423.     function GetElement(index: DWORD; out lplpD3DRMFrame: IDirect3DRMFrame): HResult; stdcall;
  7424.   end;
  7425.  
  7426.   IDirect3DRMViewportArray = interface(IDirect3DRMArray)
  7427.     ['{EB16CB11-D271-11CE-AC48-0000C03825A1}']
  7428.     // IDirect3DRMViewportarraymethods
  7429.     function GetElement(index: DWORD; out lplpD3DRMViewport: IDirect3DRMViewport): HResult; stdcall;
  7430.   end;
  7431.  
  7432.   IDirect3DRMVisualArray = interface(IDirect3DRMArray)
  7433.     ['{EB16CB13-D271-11CE-AC48-0000C03825A1}']
  7434.     // IDirect3DRMVisualarraymethods
  7435.     function GetElement(index: DWORD; out lplpD3DRMVisual: IDirect3DRMVisual): HResult; stdcall;
  7436.   end;
  7437.  
  7438.   IDirect3DRMAnimationArray = interface(IDirect3DRMArray)
  7439.     ['{D5F1CAE0-4BD7-11D1-B974-0060083E45F3}']
  7440.     function GetElement(index: DWORD; out lplpD3DRMAnimation: IDirect3DRMAnimation2): HResult; stdcall;
  7441.   end;
  7442.  
  7443.   IDirect3DRMPickedArray = interface(IDirect3DRMArray)
  7444.     ['{EB16CB16-D271-11CE-AC48-0000C03825A1}']
  7445.     // IDirect3DRMPickedarraymethods
  7446.     function GetPick(index: DWORD; out lplpVisual: IDirect3DRMVisual;
  7447.         out lplpFrameArray: IDirect3DRMFrameArray;
  7448.         var lpD3DRMPickDesc: TD3DRMPickDesc): HResult; stdcall;
  7449.   end;
  7450.  
  7451.   IDirect3DRMLightArray = interface(IDirect3DRMArray)
  7452.     ['{EB16CB14-D271-11CE-AC48-0000C03825A1}']
  7453.     // IDirect3DRMLightarraymethods
  7454.     function GetElement(index: DWORD; out lplpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  7455.   end;
  7456.  
  7457.   IDirect3DRMFaceArray = interface(IDirect3DRMArray)
  7458.     ['{EB16CB17-D271-11CE-AC48-0000C03825A1}']
  7459.     // IDirect3DRMFacearraymethods
  7460.     function GetElement(index: DWORD; out lplpD3DRMFace: IDirect3DRMFace): HResult; stdcall;
  7461.   end;
  7462.  
  7463.   IDirect3DRMPicked2Array = interface(IDirect3DRMArray)
  7464.     ['{4516EC7B-8F20-11D0-9B6D-0000C0781BC3}']
  7465.     // IDirect3DRMPicked2arraymethods
  7466.     function GetPick(index: DWORD; out lplpVisual: IDirect3DRMVisual;
  7467.         out lplpFrameArray: IDirect3DRMFrameArray;
  7468.         const lpD3DRMPickDesc2: D3DRMPICKDESC2): HResult; stdcall;
  7469.   end;
  7470.  
  7471.   IDirect3DRMInterpolator = interface(IDirect3DRMObject)
  7472.     ['{242F6BC1-3849-11D0-9B6D-0000C0781BC3}']
  7473.     // IDirect3DRMInterpolator methods
  7474.     function AttachObject(lpD3DRMObject: IDirect3DRMObject): HResult; stdcall;
  7475.     function GetAttachedObjects(lpD3DRMObjectArray: IDirect3DRMObjectArray): HResult; stdcall;
  7476.     function DetachObject(lpD3DRMObject: IDirect3DRMObject): HResult; stdcall;
  7477.     function SetIndex(d3dVal: TD3DValue): HResult; stdcall;
  7478.     function GetIndex: TD3DValue; stdcall;
  7479.     function Interpolate(d3dVal: TD3DValue; lpD3DRMObject: IDirect3DRMObject;
  7480.         d3drmInterpFlags: TD3DRMInterpolationOptions): HResult; stdcall;
  7481.   end;
  7482.  
  7483.   IDirect3DRMClippedVisual = interface(IDirect3DRMVisual)
  7484.     ['{5434E733-6D66-11D1-BB0B-0000F875865A}']
  7485.     // IDirect3DRMClippedVisual methods
  7486.     function Init(lpD3DRMVisual: IDirect3DRMVisual): HResult; stdcall;
  7487.     function AddPlane(lpRef: IDirect3DRMFrame3; const lpdvPoint, lpdvNormal: TD3DVector;
  7488.         dwFlags: DWORD; var lpdwReturnID: DWORD): HResult; stdcall;
  7489.     function DeletePlane(dwID, dwFlags: DWORD): HResult; stdcall;
  7490.     function GetPlaneIDs(var lpdwCount, lpdwID: DWORD; dwFlags: DWORD): HResult; stdcall;
  7491.     function GetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  7492.         var lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD): HResult; stdcall;
  7493.     function SetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  7494.         const lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD): HResult; stdcall;
  7495.   end;
  7496.  
  7497.   IDirect3DRMWinDevice = interface(IDirect3DRMObject)
  7498.     ['{C5016CC0-D273-11CE-AC48-0000C03825A1}']
  7499.     // IDirect3DRMWinDevice methods
  7500.     function HandlePaint(hDC: HDC): HResult; stdcall;
  7501.     function HandleActivate(wparam: WORD): HResult; stdcall;
  7502.   end;
  7503.  
  7504.   IDirect3DRM = interface(IUnknown)
  7505.     ['{2BC49361-8327-11CF-AC4A-0000C03825A1}']
  7506.     // IDirect3DRM methods
  7507.     function CreateObject(const rclsid: TGUID; pUnkOuter: IUnknown;
  7508.         const riid: TGUID; out ppv): HResult; stdcall;
  7509.     function CreateFrame(lpD3DRMFrame: IDirect3DRMFrame;
  7510.         out lplpD3DRMFrame: IDirect3DRMFrame): HResult; stdcall;
  7511.     function CreateMesh(out lplpD3DRMMesh: IDirect3DRMMesh): HResult; stdcall;
  7512.     function CreateMeshBuilder(out lplpD3DRMMeshBuilder:
  7513.         IDirect3DRMMeshBuilder): HResult; stdcall;
  7514.     function CreateFace(out lplpd3drmFace: IDirect3DRMFace): HResult; stdcall;
  7515.     function CreateAnimation(out lplpD3DRMAnimation: IDirect3DRMAnimation): HResult; stdcall;
  7516.     function CreateAnimationSet(out lplpD3DRMAnimationSet:
  7517.         IDirect3DRMAnimationSet): HResult; stdcall;
  7518.     function CreateTexture(const lpImage: TD3DRMImage;
  7519.         out lplpD3DRMTexture: IDirect3DRMTexture): HResult; stdcall;
  7520.     function CreateLight(d3drmltLightType: TD3DRMLightType;
  7521.         cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  7522.     function CreateLightRGB(ltLightType: TD3DRMLightType; vRed, vGreen, vBlue:
  7523.         TD3DValue; out lplpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  7524.     function CreateMaterial(vPower: TD3DValue; out lplpD3DRMMaterial:
  7525.         IDirect3DRMMaterial): HResult; stdcall;
  7526.     function CreateDevice(dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
  7527.         IDirect3DRMDevice): HResult; stdcall;
  7528.     function CreateDeviceFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
  7529.         lpDDSBack: IDirectDrawSurface; out lplpD3DRMDevice: IDirect3DRMDevice): HResult; stdcall;
  7530.     function CreateDeviceFromD3D(lpD3D: IDirect3D; lpD3DDev: IDirect3DDevice;
  7531.         out lplpD3DRMDevice: IDirect3DRMDevice): HResult; stdcall;
  7532.     function CreateDeviceFromClipper(lpDDClipper: IDirectDrawClipper;
  7533.         const lpGUID: TGUID; width, height: DWORD; out lplpD3DRMDevice:
  7534.         IDirect3DRMDevice): HResult; stdcall;
  7535.     function CreateTextureFromSurface(lpDDS: IDirectDrawSurface;
  7536.         out lplpD3DRMTexture: IDirect3DRMTexture): HResult; stdcall;
  7537.     function CreateShadow(lpVisual: IDirect3DRMVisual;
  7538.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  7539.         out lplpShadow: IDirect3DRMVisual): HResult; stdcall;
  7540.     function CreateViewport(lpDev: IDirect3DRMDevice;
  7541.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  7542.         out lplpD3DRMViewport: IDirect3DRMViewport): HResult; stdcall;
  7543.     function CreateWrap(wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  7544.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  7545.         out lplpD3DRMWrap: IDirect3DRMWrap): HResult; stdcall;
  7546.     function CreateUserVisual(fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  7547.         out lplpD3DRMUV: IDirect3DRMUserVisual): HResult; stdcall;
  7548.     function LoadTexture(lpFileName: LPSTR; out lplpD3DRMTexture:
  7549.         IDirect3DRMTexture): HResult; stdcall;
  7550.     function LoadTextureFromResource(rs: HRSRC; out lplpD3DRMTexture:
  7551.         IDirect3DRMTexture): HResult; stdcall;
  7552.     function SetSearchPath(lpPath: LPSTR): HResult; stdcall;
  7553.     function AddSearchPath(lpPath: LPSTR): HResult; stdcall;
  7554.     function GetSearchPath(var lpdwSize: DWORD; lpszPath: LPSTR): HResult; stdcall;
  7555.     function SetDefaultTextureColors(dwColors: DWORD): HResult; stdcall;
  7556.     function SetDefaultTextureShades(dwShades: DWORD): HResult; stdcall;
  7557.     function GetDevices(out lplpDevArray: IDirect3DRMDeviceArray): HResult; stdcall;
  7558.     function GetNamedObject(lpName: LPSTR; out lplpD3DRMObject:
  7559.         IDirect3DRMObject): HResult; stdcall;
  7560.     function EnumerateObjects(func: TD3DRMObjectCallback; lpArg: Pointer): HResult; stdcall;
  7561.     function Load(lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  7562.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  7563.         D3DRMLOADCALLBACK; lpArgLP: Pointer; d3drmLoadTextureProc:
  7564.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer;
  7565.         lpParentFrame: IDirect3DRMFrame): HResult; stdcall;
  7566.     function Tick(d3dvalTick: TD3DValue): HResult; stdcall;
  7567.   end;
  7568.  
  7569.   IDirect3DRM2 = interface(IUnknown)
  7570.     ['{4516ECC8-8F20-11D0-9B6D-0000C0781BC3}']
  7571.     // IDirect3DRM2 methods
  7572.     function CreateObject(const rclsid: TGUID; pUnkOuter: IUnknown;
  7573.         const riid: TGUID; out ppv): HResult; stdcall;
  7574.     function CreateFrame(lpD3DRMFrame: IDirect3DRMFrame2;
  7575.         out lplpD3DRMFrame: IDirect3DRMFrame2): HResult; stdcall;
  7576.     function CreateMesh(out lplpD3DRMMesh: IDirect3DRMMesh): HResult; stdcall;
  7577.     function CreateMeshBuilder(out lplpD3DRMMeshBuilder:
  7578.         IDirect3DRMMeshBuilder2): HResult; stdcall;
  7579.     function CreateFace(out lplpd3drmFace: IDirect3DRMFace): HResult; stdcall;
  7580.     function CreateAnimation(out lplpD3DRMAnimation: IDirect3DRMAnimation): HResult; stdcall;
  7581.     function CreateAnimationSet(out lplpD3DRMAnimationSet:
  7582.         IDirect3DRMAnimationSet): HResult; stdcall;
  7583.     function CreateTexture(const lpImage: TD3DRMImage;
  7584.         out lplpD3DRMTexture: IDirect3DRMTexture2): HResult; stdcall;
  7585.     function CreateLight(d3drmltLightType: TD3DRMLightType;
  7586.         cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  7587.     function CreateLightRGB(ltLightType: TD3DRMLightType; vRed,
  7588.         vGreen, vBlue: TD3DValue; out lplpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  7589.     function CreateMaterial(vPower: TD3DValue; out lplpD3DRMMaterial:
  7590.         IDirect3DRMMaterial): HResult; stdcall;
  7591.     function CreateDevice(dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
  7592.         IDirect3DRMDevice2): HResult; stdcall;
  7593.     function CreateDeviceFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
  7594.         lpDDSBack: IDirectDrawSurface; out lplpD3DRMDevice: IDirect3DRMDevice2): HResult; stdcall;
  7595.     function CreateDeviceFromD3D(lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  7596.         out lplpD3DRMDevice: IDirect3DRMDevice2): HResult; stdcall;
  7597.     function CreateDeviceFromClipper(lpDDClipper: IDirectDrawClipper;
  7598.         const lpGUID: TGUID; width, height: DWORD; out lplpD3DRMDevice:
  7599.         IDirect3DRMDevice2): HResult; stdcall;
  7600.     function CreateTextureFromSurface( lpDDS: IDirectDrawSurface;
  7601.         out lplpD3DRMTexture: IDirect3DRMTexture2): HResult; stdcall;
  7602.     function CreateShadow(lpVisual: IDirect3DRMVisual;
  7603.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  7604.         out lplpShadow: IDirect3DRMVisual): HResult; stdcall;
  7605.     function CreateViewport(lpDev: IDirect3DRMDevice;
  7606.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  7607.         out lplpD3DRMViewport: IDirect3DRMViewport): HResult; stdcall;
  7608.     function CreateWrap(wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  7609.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  7610.         out lplpD3DRMWrap: IDirect3DRMWrap): HResult; stdcall;
  7611.     function CreateUserVisual(fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  7612.         out lplpD3DRMUV: IDirect3DRMUserVisual): HResult; stdcall;
  7613.     function LoadTexture(lpFileName: LPSTR; out lplpD3DRMTexture:
  7614.         IDirect3DRMTexture2): HResult; stdcall;
  7615.     function LoadTextureFromResource(hModule: HModule; str: LPCSTR; out lplpD3DRMTexture:
  7616.         IDirect3DRMTexture2): HResult; stdcall;
  7617.     function SetSearchPath(lpPath: LPSTR): HResult; stdcall;
  7618.     function AddSearchPath(lpPath: LPSTR): HResult; stdcall;
  7619.     function GetSearchPath(var lpdwSize: DWORD; lpszPath: LPSTR): HResult; stdcall;
  7620.     function SetDefaultTextureColors(dwColors: DWORD): HResult; stdcall;
  7621.     function SetDefaultTextureShades(dwShades: DWORD): HResult; stdcall;
  7622.     function GetDevices(out lplpDevArray: IDirect3DRMDeviceArray): HResult; stdcall;
  7623.     function GetNamedObject(lpName: LPSTR; out lplpD3DRMObject:
  7624.         IDirect3DRMObject): HResult; stdcall;
  7625.     function EnumerateObjects(func: TD3DRMObjectCallback; lpArg: Pointer): HResult; stdcall;
  7626.     function Load(lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  7627.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  7628.         D3DRMLOADCALLBACK; lpArgLP: Pointer; d3drmLoadTextureProc:
  7629.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  7630.         IDirect3DRMFrame): HResult; stdcall;
  7631.     function Tick(d3dvalTick: TD3DValue): HResult; stdcall;
  7632.     function CreateProgressiveMesh(out lplpD3DRMProgressiveMesh:
  7633.         IDirect3DRMProgressiveMesh): HResult; stdcall;
  7634.   end;
  7635.  
  7636.   IDirect3DRM3 = interface(IUnknown)
  7637.     ['{4516EC83-8F20-11D0-9B6D-0000C0781BC3}']
  7638.     // IDirect3DRM2 methods
  7639.     function CreateObject(const rclsid: TGUID; pUnkOuter: IUnknown;
  7640.         const riid: TGUID; out ppv): HResult; stdcall;
  7641.     function CreateFrame(lpD3DRMFrame: IDirect3DRMFrame3;
  7642.         out lplpD3DRMFrame: IDirect3DRMFrame3): HResult; stdcall;
  7643.     function CreateMesh(out lplpD3DRMMesh: IDirect3DRMMesh): HResult; stdcall;
  7644.     function CreateMeshBuilder(out lplpD3DRMMeshBuilder:
  7645.         IDirect3DRMMeshBuilder3): HResult; stdcall;
  7646.     function CreateFace(out lplpd3drmFace: IDirect3DRMFace2): HResult; stdcall;
  7647.     function CreateAnimation(out lplpD3DRMAnimation: IDirect3DRMAnimation2): HResult; stdcall;
  7648.     function CreateAnimationSet(out lplpD3DRMAnimationSet:
  7649.         IDirect3DRMAnimationSet2): HResult; stdcall;
  7650.     function CreateTexture(const lpImage: TD3DRMImage;
  7651.         out lplpD3DRMTexture: IDirect3DRMTexture3): HResult; stdcall;
  7652.     function CreateLight(d3drmltLightType: TD3DRMLightType;
  7653.         cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  7654.     function CreateLightRGB(ltLightType: TD3DRMLightType; vRed,
  7655.         vGreen, vBlue: TD3DValue; out lplpD3DRMLight: IDirect3DRMLight): HResult; stdcall;
  7656.     function CreateMaterial(vPower: TD3DValue; out lplpD3DRMMaterial:
  7657.         IDirect3DRMMaterial2): HResult; stdcall;
  7658.     function CreateDevice(dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
  7659.         IDirect3DRMDevice3): HResult; stdcall;
  7660.     function CreateDeviceFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
  7661.         lpDDSBack: IDirectDrawSurface; out lplpD3DRMDevice: IDirect3DRMDevice3): HResult; stdcall;
  7662.     function CreateDeviceFromD3D(lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  7663.         out lplpD3DRMDevice: IDirect3DRMDevice3): HResult; stdcall;
  7664.     function CreateDeviceFromClipper(lpDDClipper: IDirectDrawClipper;
  7665.         const lpGUID: TGUID; width, height: DWORD; out lplpD3DRMDevice:
  7666.         IDirect3DRMDevice3): HResult; stdcall;
  7667.     function CreateTextureFromSurface( lpDDS: IDirectDrawSurface;
  7668.         out lplpD3DRMTexture: IDirect3DRMTexture3): HResult; stdcall;
  7669.     function CreateShadow(lpVisual: IDirect3DRMVisual;
  7670.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  7671.         out lplpShadow: IDirect3DRMShadow): HResult; stdcall;
  7672.     function CreateViewport(lpDev: IDirect3DRMDevice3;
  7673.         lpCamera: IDirect3DRMFrame3; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  7674.         out lplpD3DRMViewport: IDirect3DRMViewport2): HResult; stdcall;
  7675.     function CreateWrap(wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame3;
  7676.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  7677.         out lplpD3DRMWrap: IDirect3DRMWrap): HResult; stdcall;
  7678.     function CreateUserVisual(fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  7679.         out lplpD3DRMUV: IDirect3DRMUserVisual): HResult; stdcall;
  7680.     function LoadTexture(lpFileName: LPSTR; out lplpD3DRMTexture:
  7681.         IDirect3DRMTexture3): HResult; stdcall;
  7682.     function LoadTextureFromResource(hModule: HModule; str: LPCSTR; out lplpD3DRMTexture:
  7683.         IDirect3DRMTexture3): HResult; stdcall;
  7684.  
  7685.     function SetSearchPath(lpPath: LPSTR): HResult; stdcall;
  7686.     function AddSearchPath(lpPath: LPSTR): HResult; stdcall;
  7687.     function GetSearchPath(var lpdwSize: DWORD; lpszPath: LPSTR): HResult; stdcall;
  7688.     function SetDefaultTextureColors(dwColors: DWORD): HResult; stdcall;
  7689.     function SetDefaultTextureShades(dwShades: DWORD): HResult; stdcall;
  7690.     function GetDevices(out lplpDevArray: IDirect3DRMDeviceArray): HResult; stdcall;
  7691.     function GetNamedObject(lpName: LPSTR; out lplpD3DRMObject:
  7692.         IDirect3DRMObject): HResult; stdcall;
  7693.     function EnumerateObjects(func: TD3DRMObjectCallback; lpArg: Pointer): HResult; stdcall;
  7694.     function Load(lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  7695.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  7696.         D3DRMLOADCALLBACK; lpArgLP: Pointer; d3drmLoadTextureProc:
  7697.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer; lpParentFrame:
  7698.         IDirect3DRMFrame3): HResult; stdcall;
  7699.     function Tick(d3dvalTick: TD3DValue): HResult; stdcall;
  7700.     function CreateProgressiveMesh(out lplpD3DRMProgressiveMesh:
  7701.         IDirect3DRMProgressiveMesh): HResult; stdcall;
  7702.     // IDirect3RM3 methods
  7703.     function RegisterClient(const rguid: TGUID; var lpdwID: DWORD): HResult; stdcall;
  7704.     function UnregisterClient(const rguid: TGUID): HResult; stdcall;
  7705.     function CreateClippedVisual(lpVisual: IDirect3DRMVisual;
  7706.         out lpClippedVisual: IDirect3DRMVisual): HResult; stdcall;
  7707.     function SetOptions(lpdwOptions: DWORD): HResult; stdcall;
  7708.     function GetOptions(var lpdwOptions: DWORD): HResult; stdcall;
  7709.   end;
  7710.  
  7711. const
  7712.   D3DRM_OK                        = HResult(DD_OK);
  7713.   D3DRMERR_BADOBJECT              = HResult($88760000 + 781);
  7714.   D3DRMERR_BADTYPE                = HResult($88760000 + 782);
  7715.   D3DRMERR_BADALLOC               = HResult($88760000 + 783);
  7716.   D3DRMERR_FACEUSED               = HResult($88760000 + 784);
  7717.   D3DRMERR_NOTFOUND               = HResult($88760000 + 785);
  7718.   D3DRMERR_NOTDONEYET             = HResult($88760000 + 786);
  7719.   D3DRMERR_FILENOTFOUND           = HResult($88760000 + 787);
  7720.   D3DRMERR_BADFILE                = HResult($88760000 + 788);
  7721.   D3DRMERR_BADDEVICE              = HResult($88760000 + 789);
  7722.   D3DRMERR_BADVALUE               = HResult($88760000 + 790);
  7723.   D3DRMERR_BADMAJORVERSION        = HResult($88760000 + 791);
  7724.   D3DRMERR_BADMINORVERSION        = HResult($88760000 + 792);
  7725.   D3DRMERR_UNABLETOEXECUTE        = HResult($88760000 + 793);
  7726.   D3DRMERR_LIBRARYNOTFOUND        = HResult($88760000 + 794);
  7727.   D3DRMERR_INVALIDLIBRARY         = HResult($88760000 + 795);
  7728.   D3DRMERR_PENDING                = HResult($88760000 + 796);
  7729.   D3DRMERR_NOTENOUGHDATA          = HResult($88760000 + 797);
  7730.   D3DRMERR_REQUESTTOOLARGE        = HResult($88760000 + 798);
  7731.   D3DRMERR_REQUESTTOOSMALL        = HResult($88760000 + 799);
  7732.   D3DRMERR_CONNECTIONLOST         = HResult($88760000 + 800);
  7733.   D3DRMERR_LOADABORTED            = HResult($88760000 + 801);
  7734.   D3DRMERR_NOINTERNET             = HResult($88760000 + 802);
  7735.   D3DRMERR_BADCACHEFILE           = HResult($88760000 + 803);
  7736.   D3DRMERR_BOXNOTSET              = HResult($88760000 + 804);
  7737.   D3DRMERR_BADPMDATA              = HResult($88760000 + 805);
  7738.   D3DRMERR_CLIENTNOTREGISTERED    = HResult($88760000 + 806);
  7739.   D3DRMERR_NOTCREATEDFROMDDS      = HResult($88760000 + 807);
  7740.   D3DRMERR_NOSUCHKEY              = HResult($88760000 + 808);
  7741.   D3DRMERR_INCOMPATABLEKEY        = HResult($88760000 + 809);
  7742.   D3DRMERR_ELEMENTINUSE           = HResult($88760000 + 810);
  7743.   D3DRMERR_TEXTUREFORMATNOTFOUND  = HResult($88760000 + 811);
  7744.   D3DRMERR_NOTAGGREGATED          = HResult($88760000 + 812);
  7745.  
  7746. { Create a Direct3DRM API }
  7747. function Direct3DRMCreate(out lplpDirect3DRM: IDirect3DRM): HResult; stdcall;
  7748.  
  7749. (***************************************************************************
  7750.  *
  7751.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  7752.  *
  7753.  *  File:       dxfile.h
  7754.  *
  7755.  *  Content:    DirectX File public header file
  7756.  *
  7757.  ***************************************************************************)
  7758.  
  7759. { DirectXFile Object Class Id (for CoCreateInstance()) }
  7760.  
  7761. const
  7762.   CLSID_CDirectXFile: TGUID = '{4516EC43-8F20-11D0-9B6D-0000C0781BC3}';
  7763.  
  7764. { DirectX File Interface GUIDs. }
  7765.  
  7766.   IID_IDirectXFile: TGUID = '{3D82AB40-62DA-11CF-AB39-0020AF71E433}';
  7767.   IID_IDirectXFileEnumObject: TGUID = '{3D82AB41-62DA-11CF-AB39-0020AF71E433}';
  7768.   IID_IDirectXFileSaveObject: TGUID = '{3D82AB42-62DA-11CF-AB39-0020AF71E433}';
  7769.   IID_IDirectXFileObject: TGUID = '{3D82AB43-62DA-11CF-AB39-0020AF71E433}';
  7770.   IID_IDirectXFileData: TGUID = '{3D82AB44-62DA-11CF-AB39-0020AF71E433}';
  7771.   IID_IDirectXFileDataReference: TGUID = '{3D82AB45-62DA-11CF-AB39-0020AF71E433}';
  7772.   IID_IDirectXFileBinary: TGUID = '{3D82AB46-62DA-11CF-AB39-0020AF71E433}';
  7773.  
  7774. type
  7775.   TDXFileFormat = DWORD;
  7776.   DXFILEFORMAT = TDXFileFormat;
  7777.  
  7778. const
  7779.   DXFILEFORMAT_BINARY     = 0;
  7780.   DXFILEFORMAT_TEXT       = 1;
  7781.   DXFILEFORMAT_COMPRESSED = 2;
  7782.  
  7783. type
  7784.   TDXFileLoadOptions = DWORD;
  7785.   DXFILELOADOPTIONS = TDXFileLoadOptions;
  7786.  
  7787. const
  7788.   DXFILELOAD_FROMFILE     = $00;
  7789.   DXFILELOAD_FROMRESOURCE = $01;
  7790.   DXFILELOAD_FROMMEMORY   = $02;
  7791.   DXFILELOAD_FROMSTREAM   = $04;
  7792.   DXFILELOAD_FROMURL      = $08;
  7793.  
  7794. type
  7795.   PDXFileLoadResource = ^TDXFileLoadResource;
  7796.   TDXFileLoadResource = record
  7797.     hModule: HModule;
  7798.     lpName: PChar;
  7799.     lpType: PChar;
  7800.   end;
  7801.  
  7802.   DXFILELOADRESOURCE = TDXFileLoadResource;
  7803.   LPDXFILELOADRESOURCE = PDXFileLoadResource;
  7804.  
  7805.   PDXFileLoadMemory = ^TDXFileLoadMemory;
  7806.   TDXFileLoadMemory = record
  7807.     lpMemory: Pointer;
  7808.     dSize: DWORD;
  7809.   end;
  7810.  
  7811.   DXFILELOADMEMORY = TDXFileLoadMemory;
  7812.   LPDXFILELOADMEMORY = PDXFileLoadMemory;
  7813.  
  7814. { DirectX File object types. }
  7815.  
  7816. type
  7817.   IDirectXFile = interface;
  7818.   IDirectXFileEnumObject = interface;
  7819.   IDirectXFileSaveObject = interface;
  7820.   IDirectXFileObject = interface;
  7821.   IDirectXFileData = interface;
  7822.   IDirectXFileDataReference = interface;
  7823.   IDirectXFileBinary = interface;
  7824.  
  7825.   IDirectXFile = interface(IUnknown)
  7826.     ['{3D82AB40-62DA-11CF-AB39-0020AF71E433}']
  7827.     function CreateEnumObject(pvSource: Pointer; dwLoadOptions: TDXFileLoadOptions;
  7828.         out ppEnumObj: IDirectXFileEnumObject): HResult; stdcall;
  7829.     function CreateSaveObject(szFileName: PChar; dwFileFormat: TDXFileFormat;
  7830.         out ppSaveObj: IDirectXFileSaveObject): HResult; stdcall;
  7831.     function RegisterTemplates(pvData: Pointer; cbSize: DWORD): HResult; stdcall;
  7832.   end;
  7833.  
  7834.   IDirectXFileEnumObject = interface(IUnknown)
  7835.     ['{3D82AB41-62DA-11CF-AB39-0020AF71E433}']
  7836.     function GetNextDataObject(out ppDataObj: IDirectXFileData): HResult; stdcall;
  7837.     function GetDataObjectById(const rguid: TGUID; out ppDataObj: IDirectXFileData): HResult; stdcall;
  7838.     function GetDataObjectByName(szName: PChar; out ppDataObj: IDirectXFileData): HResult; stdcall;
  7839.   end;
  7840.  
  7841.   IDirectXFileSaveObject = interface(IUnknown)
  7842.     ['{3D82AB42-62DA-11CF-AB39-0020AF71E433}']
  7843.     function SaveTemplates(cTemplates: DWORD; var ppguidTemplates: PGUID): HResult; stdcall;
  7844.     function CreateDataObject(const rguidTemplate: TGUID; szName: PChar;
  7845.         const pguid: TGUID; cbSize: DWORD; pvData: Pointer;
  7846.         out ppDataObj: IDirectXFileData): HResult; stdcall;
  7847.     function SaveData(pDataObj: IDirectXFileData): HResult; stdcall;
  7848.   end;
  7849.  
  7850.   IDirectXFileObject = interface(IUnknown)
  7851.     ['{3D82AB43-62DA-11CF-AB39-0020AF71E433}']
  7852.     function GetName(pstrNameBuf: PChar; var dwBufLen: DWORD): HResult; stdcall;
  7853.     function GetId (var pGuidBuf: TGUID): HResult; stdcall;
  7854.   end;
  7855.  
  7856.   IDirectXFileData = interface(IDirectXFileObject)
  7857.     ['{3D82AB44-62DA-11CF-AB39-0020AF71E433}']
  7858.     function GetData(szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer): HResult; stdcall;
  7859.     function GetType(var ppguid: PGUID): HResult; stdcall;
  7860.     function GetNextObject(out ppChildObj: IDirectXFileObject): HResult; stdcall;
  7861.     function AddDataObject(pDataObj: IDirectXFileData): HResult; stdcall;
  7862.     function AddDataReference(szRef: PChar; pguidRef: PGUID): HResult; stdcall;
  7863.     function AddBinaryObjec (szName: PChar; pguid: PGUID; szMimeType: PChar;
  7864.         pvData: Pointer; cbSize: DWORD): HResult; stdcall;
  7865.   end;
  7866.  
  7867.   IDirectXFileDataReference = interface(IDirectXFileObject)
  7868.     ['{3D82AB45-62DA-11CF-AB39-0020AF71E433}']
  7869.     function Resolve(out ppDataObj: IDirectXFileData): HResult; stdcall;
  7870.   end;
  7871.  
  7872.   IDirectXFileBinary = interface(IDirectXFileObject)
  7873.     ['{3D82AB46-62DA-11CF-AB39-0020AF71E433}']
  7874.     function GetSize(var pcbSize: DWORD): HResult; stdcall;
  7875.     function GetMimeType(var pszMimeType: PChar): HResult; stdcall;
  7876.     function Read(pvData: Pointer; cbSize: DWORD; var pcbRead: DWORD): HResult; stdcall;
  7877.   end;
  7878.  
  7879. { DirectX File Header template's GUID. }
  7880.  
  7881. const
  7882.   TID_DXFILEHeader: TGUID = '{3D82AB43-62DA-11CF-AB39-0020AF71E433}';
  7883.  
  7884. { DirectX File errors. }
  7885.  
  7886. const
  7887.   DXFILE_OK                         = HResult(0);
  7888.  
  7889.   DXFILEERR_BADOBJECT               = HResult($88760000 + 850);
  7890.   DXFILEERR_BADVALUE                = HResult($88760000 + 851);
  7891.   DXFILEERR_BADTYPE                 = HResult($88760000 + 852);
  7892.   DXFILEERR_BADSTREAMHANDLE         = HResult($88760000 + 853);
  7893.   DXFILEERR_BADALLOC                = HResult($88760000 + 854);
  7894.   DXFILEERR_NOTFOUND                = HResult($88760000 + 855);
  7895.   DXFILEERR_NOTDONEYET              = HResult($88760000 + 856);
  7896.   DXFILEERR_FILENOTFOUND            = HResult($88760000 + 857);
  7897.   DXFILEERR_RESOURCENOTFOUND        = HResult($88760000 + 858);
  7898.   DXFILEERR_URLNOTFOUND             = HResult($88760000 + 859);
  7899.   DXFILEERR_BADRESOURCE             = HResult($88760000 + 860);
  7900.   DXFILEERR_BADFILETYPE             = HResult($88760000 + 861);
  7901.   DXFILEERR_BADFILEVERSION          = HResult($88760000 + 862);
  7902.   DXFILEERR_BADFILEFLOATSIZE        = HResult($88760000 + 863);
  7903.   DXFILEERR_BADFILECOMPRESSIONTYPE  = HResult($88760000 + 864);
  7904.   DXFILEERR_BADFILE                 = HResult($88760000 + 865);
  7905.   DXFILEERR_PARSEERROR              = HResult($88760000 + 866);
  7906.   DXFILEERR_NOTEMPLATE              = HResult($88760000 + 867);
  7907.   DXFILEERR_BADARRAYSIZE            = HResult($88760000 + 868);
  7908.   DXFILEERR_BADDATAREFERENCE        = HResult($88760000 + 869);
  7909.   DXFILEERR_INTERNALERROR           = HResult($88760000 + 870);
  7910.   DXFILEERR_NOMOREOBJECTS           = HResult($88760000 + 871);
  7911.   DXFILEERR_BADINTRINSICS           = HResult($88760000 + 872);
  7912.   DXFILEERR_NOMORESTREAMHANDLES     = HResult($88760000 + 873);
  7913.   DXFILEERR_NOMOREDATA              = HResult($88760000 + 874);
  7914.   DXFILEERR_BADCACHEFILE            = HResult($88760000 + 875);
  7915.   DXFILEERR_NOINTERNET              = HResult($88760000 + 876);
  7916.  
  7917. { API for creating IDirectXFile interface. }
  7918.  
  7919. function DirectXFileCreate(out lplpDirectXFile: IDirectXFile): HResult; stdcall;
  7920.  
  7921. (***************************************************************************
  7922.  *
  7923.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  7924.  *
  7925.  *  File:       rmxfguid.h
  7926.  *
  7927.  *  Content:    Defines GUIDs of D3DRM's templates.
  7928.  *
  7929.  ***************************************************************************)
  7930.  
  7931. const
  7932.   TID_D3DRMInfo: TGUID = '{2B957100-9E9A-11cf-AB39-0020AF71E433}';
  7933.   TID_D3DRMMesh: TGUID = '{3D82AB44-62DA-11cf-AB39-0020AF71E433}';
  7934.   TID_D3DRMVector: TGUID = '{3D82AB5E-62DA-11cf-AB39-0020AF71E433}';
  7935.   TID_D3DRMMeshFace: TGUID = '{3D82AB5F-62DA-11cf-AB39-0020AF71E433}';
  7936.   TID_D3DRMMaterial: TGUID = '{3D82AB4D-62DA-11cf-AB39-0020AF71E433}';
  7937.   TID_D3DRMMaterialArray: TGUID = '{35FF44E1-6C7C-11cf-8F52-0040333594A3}';
  7938.   TID_D3DRMFrame: TGUID = '{3D82AB46-62DA-11cf-AB39-0020AF71E433}';
  7939.   TID_D3DRMFrameTransformMatrix: TGUID = '{F6F23F41-7686-11cf-8F52-0040333594A3}';
  7940.   TID_D3DRMMeshMaterialList: TGUID = '{F6F23F42-7686-11cf-8F52-0040333594A3}';
  7941.   TID_D3DRMMeshTextureCoords: TGUID = '{F6F23F40-7686-11cf-8F52-0040333594A3}';
  7942.   TID_D3DRMMeshNormals: TGUID = '{F6F23F43-7686-11cf-8F52-0040333594A3}';
  7943.   TID_D3DRMCoords2d: TGUID = '{F6F23F44-7686-11cf-8F52-0040333594A3}';
  7944.   TID_D3DRMMatrix4x4: TGUID = '{F6F23F45-7686-11cf-8F52-0040333594A3}';
  7945.   TID_D3DRMAnimation: TGUID = '{3D82AB4F-62DA-11cf-AB39-0020AF71E433}';
  7946.   TID_D3DRMAnimationSet: TGUID = '{3D82AB50-62DA-11cf-AB39-0020AF71E433}';
  7947.   TID_D3DRMAnimationKey: TGUID = '{10DD46A8-775B-11cf-8F52-0040333594A3}';
  7948.   TID_D3DRMFloatKeys: TGUID = '{10DD46A9-775B-11cf-8F52-0040333594A3}';
  7949.   TID_D3DRMMaterialAmbientColor: TGUID = '{01411840-7786-11cf-8F52-0040333594A3}';
  7950.   TID_D3DRMMaterialDiffuseColor: TGUID = '{01411841-7786-11cf-8F52-0040333594A3}';
  7951.   TID_D3DRMMaterialSpecularColor: TGUID = '{01411842-7786-11cf-8F52-0040333594A3}';
  7952.   TID_D3DRMMaterialEmissiveColor: TGUID = '{D3E16E80-7835-11cf-8F52-0040333594A3}';
  7953.   TID_D3DRMMaterialPower: TGUID = '{01411843-7786-11cf-8F52-0040333594A3}';
  7954.   TID_D3DRMColorRGBA: TGUID = '{35FF44E0-6C7C-11cf-8F52-0040333594A3}';
  7955.   TID_D3DRMColorRGB: TGUID = '{D3E16E81-7835-11cf-8F52-0040333594A3}';
  7956.   TID_D3DRMGuid: TGUID = '{A42790E0-7810-11cf-8F52-0040333594A3}';
  7957.   TID_D3DRMTextureFilename: TGUID = '{A42790E1-7810-11cf-8F52-0040333594A3}';
  7958.   TID_D3DRMTextureReference: TGUID = '{A42790E2-7810-11cf-8F52-0040333594A3}';
  7959.   TID_D3DRMIndexedColor: TGUID = '{1630B820-7842-11cf-8F52-0040333594A3}';
  7960.   TID_D3DRMMeshVertexColors: TGUID = '{1630B821-7842-11cf-8F52-0040333594A3}';
  7961.   TID_D3DRMMaterialWrap: TGUID = '{4885AE60-78E8-11cf-8F52-0040333594A3}';
  7962.   TID_D3DRMBoolean: TGUID = '{537DA6A0-CA37-11d0-941C-0080C80CFA7B}';
  7963.   TID_D3DRMMeshFaceWraps: TGUID = '{ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B}';
  7964.   TID_D3DRMBoolean2d: TGUID = '{4885AE63-78E8-11cf-8F52-0040333594A3}';
  7965.   TID_D3DRMTimedFloatKeys: TGUID = '{F406B180-7B3B-11cf-8F52-0040333594A3}';
  7966.   TID_D3DRMAnimationOptions: TGUID = '{E2BF56C0-840F-11cf-8F52-0040333594A3}';
  7967.   TID_D3DRMFramePosition: TGUID = '{E2BF56C1-840F-11cf-8F52-0040333594A3}';
  7968.   TID_D3DRMFrameVelocity: TGUID = '{E2BF56C2-840F-11cf-8F52-0040333594A3}';
  7969.   TID_D3DRMFrameRotation: TGUID = '{E2BF56C3-840F-11cf-8F52-0040333594A3}';
  7970.   TID_D3DRMLight: TGUID = '{3D82AB4A-62DA-11cf-AB39-0020AF71E433}';
  7971.   TID_D3DRMCamera: TGUID = '{3D82AB51-62DA-11cf-AB39-0020AF71E433}';
  7972.   TID_D3DRMAppData: TGUID = '{E5745280-B24F-11cf-9DD5-00AA00A71A2F}';
  7973.   TID_D3DRMLightUmbra: TGUID = '{AED22740-B31F-11cf-9DD5-00AA00A71A2F}';
  7974.   TID_D3DRMLightRange: TGUID = '{AED22742-B31F-11cf-9DD5-00AA00A71A2F}';
  7975.   TID_D3DRMLightPenumbra: TGUID = '{AED22741-B31F-11cf-9DD5-00AA00A71A2F}';
  7976.   TID_D3DRMLightAttenuation: TGUID = '{A8A98BA0-C5E5-11cf-B941-0080C80CFA7B}';
  7977.   TID_D3DRMInlineData: TGUID = '{3A23EEA0-94B1-11d0-AB39-0020AF71E433}';
  7978.   TID_D3DRMUrl: TGUID = '{3A23EEA1-94B1-11d0-AB39-0020AF71E433}';
  7979.  
  7980.   TID_D3DRMProgressiveMesh: TGUID = '{8A63C360-997D-11d0-941C-0080C80CFA7B}';
  7981.   TID_D3DRMExternalVisual: TGUID = '{98116AA0-BDBA-11d1-82C0-00A0C9697271}';
  7982.   TID_D3DRMStringProperty: TGUID = '{7F0F21E0-BFE1-11d1-82C0-00A0C9697271}';
  7983.   TID_D3DRMPropertyBag: TGUID = '{7F0F21E1-BFE1-11d1-82C0-00A0C9697271}';
  7984.   TID_D3DRMRightHanded: TGUID = '{7F5D5EA0-D53A-11d1-82C0-00A0C9697271}';
  7985.  
  7986. (***************************************************************************
  7987.  *
  7988.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  7989.  *
  7990.  *  File:       rmxftmpl.h
  7991.  *
  7992.  *  Content:    D3DRM XFile templates in binary form.
  7993.  *
  7994.  ***************************************************************************)
  7995.  
  7996. const
  7997.   D3DRM_XTEMPLATES: array [0..3214] of byte = (
  7998.         $78, $6f, $66, $20, $30, $33, $30, $32, $62,
  7999.         $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  8000.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65,
  8001.         $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  8002.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  8003.         $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  8004.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0,
  8005.         $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  8006.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66,
  8007.         $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  8008.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  8009.         $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  8010.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71,
  8011.         $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  8012.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0,
  8013.         0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  8014.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1,
  8015.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  8016.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2,
  8017.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  8018.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0,
  8019.         0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  8020.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1,
  8021.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  8022.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f,
  8023.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  8024.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0,
  8025.         $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  8026.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0,
  8027.         $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  8028.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  8029.         $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  8030.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94,
  8031.         $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  8032.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0,
  8033.         0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  8034.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75,
  8035.         $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  8036.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0,
  8037.         $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  8038.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0,
  8039.         $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  8040.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0,
  8041.         $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  8042.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65,
  8043.         $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  8044.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0,
  8045.         $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  8046.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72,
  8047.         $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  8048.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  8049.         $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  8050.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0,
  8051.         0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  8052.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65,
  8053.         $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  8054.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f,
  8055.         $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  8056.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0,
  8057.         $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  8058.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c,
  8059.         $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  8060.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61,
  8061.         $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  8062.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33,
  8063.         $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  8064.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0,
  8065.         0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  8066.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0,
  8067.         $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  8068.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74,
  8069.         $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  8070.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf,
  8071.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  8072.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65,
  8073.         $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  8074.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f,
  8075.         $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  8076.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f,
  8077.         0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  8078.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0,
  8079.         $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  8080.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0,
  8081.         $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  8082.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0,
  8083.         $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  8084.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab,
  8085.         $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  8086.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0,
  8087.         $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  8088.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43,
  8089.         $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  8090.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14,
  8091.         0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  8092.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0,
  8093.         0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  8094.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0,
  8095.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  8096.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73,
  8097.         $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  8098.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f,
  8099.         0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  8100.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a,
  8101.         0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  8102.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  8103.         0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  8104.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e,
  8105.         $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  8106.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63,
  8107.         $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  8108.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0,
  8109.         0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  8110.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73,
  8111.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  8112.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61,
  8113.         $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  8114.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94,
  8115.         $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  8116.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65,
  8117.         $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  8118.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0,
  8119.         $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  8120.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57,
  8121.         $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  8122.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61,
  8123.         $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  8124.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  8125.         $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  8126.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f,
  8127.         $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  8128.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  8129.         $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  8130.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43,
  8131.         $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  8132.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  8133.         $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  8134.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72,
  8135.         $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  8136.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f,
  8137.         $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  8138.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65,
  8139.         $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  8140.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f,
  8141.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  8142.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0,
  8143.         0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  8144.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0,
  8145.         0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  8146.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0,
  8147.         $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  8148.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1,
  8149.         0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  8150.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14,
  8151.         0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  8152.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b,
  8153.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  8154.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73,
  8155.         $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  8156.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  8157.         $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  8158.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0,
  8159.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  8160.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f,
  8161.         $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  8162.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c,
  8163.         $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  8164.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f,
  8165.         $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  8166.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46,
  8167.         $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  8168.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  8169.         $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  8170.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  8171.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  8172.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65,
  8173.         $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  8174.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78,
  8175.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  8176.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56,
  8177.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  8178.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0,
  8179.         0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  8180.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76,
  8181.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  8182.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e,
  8183.         $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  8184.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  8185.         $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  8186.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62,
  8187.         $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  8188.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56,
  8189.         $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  8190.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63,
  8191.         $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  8192.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1,
  8193.         0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  8194.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0,
  8195.         $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  8196.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0,
  8197.         0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  8198.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65,
  8199.         $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  8200.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e,
  8201.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  8202.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46,
  8203.         $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  8204.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a,
  8205.         0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  8206.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  8207.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  8208.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0,
  8209.         $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  8210.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5,
  8211.         0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  8212.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11,
  8213.         $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  8214.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0,
  8215.         $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  8216.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5,
  8217.         0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  8218.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1,
  8219.         0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  8220.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0,
  8221.         $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  8222.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56,
  8223.         $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  8224.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54,
  8225.         $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  8226.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6,
  8227.         $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  8228.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0,
  8229.         0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  8230.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65,
  8231.         $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  8232.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0,
  8233.         $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  8234.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0,
  8235.         $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  8236.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0,
  8237.         $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  8238.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5,
  8239.         0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  8240.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69,
  8241.         $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  8242.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65,
  8243.         $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  8244.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b,
  8245.         0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  8246.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70,
  8247.         $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  8248.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0,
  8249.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  8250.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f,
  8251.         $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  8252.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f,
  8253.         $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  8254.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0,
  8255.         $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  8256.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf,
  8257.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  8258.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  8259.         0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  8260.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65,
  8261.         $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  8262.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  8263.         $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  8264.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0,
  8265.         $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  8266.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61,
  8267.         $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  8268.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  8269.         $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  8270.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0,
  8271.         $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  8272.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0,
  8273.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  8274.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72,
  8275.         $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  8276.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0,
  8277.         $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  8278.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1,
  8279.         0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  8280.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68,
  8281.         $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  8282.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b,
  8283.         $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  8284.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49,
  8285.         $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  8286.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0,
  8287.         0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  8288.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0,
  8289.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  8290.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0,
  8291.         $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  8292.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5,
  8293.         0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  8294.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0,
  8295.         $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  8296.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f,
  8297.         0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  8298.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74,
  8299.         $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  8300.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72,
  8301.         $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  8302.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0,
  8303.         0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  8304.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50,
  8305.         $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  8306.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf,
  8307.         $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  8308.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74,
  8309.         $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  8310.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0,
  8311.         $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  8312.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0,
  8313.         $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  8314.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0,
  8315.         $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  8316.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78,
  8317.         $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  8318.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0,
  8319.         $12, 0, $f, 0, $b, 0);
  8320.  
  8321.   D3DRM_XTEMPLATE_BYTES = 3278;
  8322.  
  8323. (*==========================================================================;
  8324.  *
  8325.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  8326.  *
  8327.  *  File:       dinput.h
  8328.  *  Content:    DirectInput include file
  8329.  *
  8330.  ****************************************************************************)
  8331.  
  8332. const
  8333. {$IFDEF DirectX3}
  8334.   DIRECTINPUT_VERSION = $0300;
  8335. {$ENDIF}{$IFDEF DirectX5}
  8336.   DIRECTINPUT_VERSION = $0500;
  8337. {$ENDIF}{$IFDEF DirectX6}
  8338.   DIRECTINPUT_VERSION = $0500;
  8339. {$ENDIF}{$IFDEF DirectX7}
  8340.   DIRECTINPUT_VERSION = $0700;
  8341. {$ENDIF}
  8342.  
  8343. { Class IDs }
  8344.  
  8345. const
  8346.   CLSID_DirectInput: TGUID = '{25E609E0-B259-11CF-BFC7-444553540000}';
  8347.   CLSID_DirectInputDevice: TGUID = '{25E609E1-B259-11CF-BFC7-444553540000}';
  8348.  
  8349. { Interfaces }
  8350.  
  8351. const
  8352.   IID_IDirectInputA: TGUID = '{89521360-AA8A-11CF-BFC7-444553540000}';
  8353.   IID_IDirectInputW: TGUID = '{89521361-AA8A-11CF-BFC7-444553540000}';
  8354.   IID_IDirectInput2A: TGUID = '{5944E662-AA8A-11CF-BFC7-444553540000}';
  8355.   IID_IDirectInput2W: TGUID = '{5944E663-AA8A-11CF-BFC7-444553540000}';
  8356.   IID_IDirectInput7A: TGUID = '{9A4CB684-236D-11D3-8E9D-00C04F6844AE}';
  8357.   IID_IDirectInput7W: TGUID = '{9A4CB685-236D-11D3-8E9D-00C04F6844AE}';
  8358.   IID_IDirectInputDeviceA: TGUID = '{5944E680-C92E-11CF-BFC7-444553540000}';
  8359.   IID_IDirectInputDeviceW: TGUID = '{5944E681-C92E-11CF-BFC7-444553540000}';
  8360.   IID_IDirectInputDevice2A: TGUID = '{5944E682-C92E-11CF-BFC7-444553540000}';
  8361.   IID_IDirectInputDevice2W: TGUID = '{5944E683-C92E-11CF-BFC7-444553540000}';
  8362.   IID_IDirectInputDevice7A: TGUID = '{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}';
  8363.   IID_IDirectInputDevice7W: TGUID = '{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}';
  8364.   IID_IDirectInputEffect: TGUID = '{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}';
  8365.  
  8366. { Predefined object types }
  8367.  
  8368.   GUID_XAxis: TGUID = '{A36D02E0-C9F3-11CF-BFC7-444553540000}';
  8369.   GUID_YAxis: TGUID = '{A36D02E1-C9F3-11CF-BFC7-444553540000}';
  8370.   GUID_ZAxis: TGUID = '{A36D02E2-C9F3-11CF-BFC7-444553540000}';
  8371.   GUID_RxAxis: TGUID = '{A36D02F4-C9F3-11CF-BFC7-444553540000}';
  8372.   GUID_RyAxis: TGUID = '{A36D02F5-C9F3-11CF-BFC7-444553540000}';
  8373.   GUID_RzAxis: TGUID = '{A36D02E3-C9F3-11CF-BFC7-444553540000}';
  8374.   GUID_Slider: TGUID = '{A36D02E4-C9F3-11CF-BFC7-444553540000}';
  8375.   GUID_Button: TGUID = '{A36D02F0-C9F3-11CF-BFC7-444553540000}';
  8376.   GUID_Key: TGUID = '{55728220-D33C-11CF-BFC7-444553540000}';
  8377.   GUID_POV: TGUID = '{A36D02F2-C9F3-11CF-BFC7-444553540000}';
  8378.   GUID_Unknown: TGUID = '{A36D02F3-C9F3-11CF-BFC7-444553540000}';
  8379.  
  8380. { Predefined product GUIDs }
  8381.  
  8382.   GUID_SysMouse: TGUID = '{6F1D2B60-D5A0-11CF-BFC7-444553540000}';
  8383.   GUID_SysKeyboard: TGUID = '{6F1D2B61-D5A0-11CF-BFC7-444553540000}';
  8384.   GUID_Joystick: TGUID = '{6F1D2B70-D5A0-11CF-BFC7-444553540000}';
  8385.   GUID_SysMouseEm: TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}';
  8386.   GUID_SysMouseEm2: TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}';
  8387.   GUID_SysKeyboardEm: TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}';
  8388.   GUID_SysKeyboardEm2: TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}';
  8389.  
  8390. { Predefined force feedback effects }
  8391.  
  8392.   GUID_ConstantForce: TGUID = '{13541C20-8E33-11D0-9AD0-00A0C9A06E35}';
  8393.   GUID_RampForce: TGUID = '{13541C21-8E33-11D0-9AD0-00A0C9A06E35}';
  8394.   GUID_Square: TGUID = '{13541C22-8E33-11D0-9AD0-00A0C9A06E35}';
  8395.   GUID_Sine: TGUID = '{13541C23-8E33-11D0-9AD0-00A0C9A06E35}';
  8396.   GUID_Triangle: TGUID = '{13541C24-8E33-11D0-9AD0-00A0C9A06E35}';
  8397.   GUID_SawtoothUp: TGUID = '{13541C25-8E33-11D0-9AD0-00A0C9A06E35}';
  8398.   GUID_SawtoothDown: TGUID = '{13541C26-8E33-11D0-9AD0-00A0C9A06E35}';
  8399.   GUID_Spring: TGUID = '{13541C27-8E33-11D0-9AD0-00A0C9A06E35}';
  8400.   GUID_Damper: TGUID = '{13541C28-8E33-11D0-9AD0-00A0C9A06E35}';
  8401.   GUID_Inertia: TGUID = '{13541C29-8E33-11D0-9AD0-00A0C9A06E35}';
  8402.   GUID_Friction: TGUID = '{13541C2A-8E33-11D0-9AD0-00A0C9A06E35}';
  8403.   GUID_CustomForce: TGUID = '{13541C2B-8E33-11D0-9AD0-00A0C9A06E35}';
  8404.  
  8405. { IDirectInputEffect }
  8406.  
  8407. const
  8408.   DIEFT_ALL                = $00000000;
  8409.  
  8410.   DIEFT_CONSTANTFORCE      = $00000001;
  8411.   DIEFT_RAMPFORCE          = $00000002;
  8412.   DIEFT_PERIODIC           = $00000003;
  8413.   DIEFT_CONDITION          = $00000004;
  8414.   DIEFT_CUSTOMFORCE        = $00000005;
  8415.   DIEFT_HARDWARE           = $000000FF;
  8416.  
  8417.   DIEFT_FFATTACK           = $00000200;
  8418.   DIEFT_FFFADE             = $00000400;
  8419.   DIEFT_SATURATION         = $00000800;
  8420.   DIEFT_POSNEGCOEFFICIENTS = $00001000;
  8421.   DIEFT_POSNEGSATURATION   = $00002000;
  8422.   DIEFT_DEADBAND           = $00004000;
  8423.   DIEFT_STARTDELAY         = $00008000;
  8424.  
  8425. function DIEFT_GETTYPE(n: DWORD): DWORD;
  8426.  
  8427. const
  8428.   DI_DEGREES               = 100;
  8429.   DI_FFNOMINALMAX          = 10000;
  8430.   DI_SECONDS               = 1000000;
  8431.  
  8432. type
  8433.   PDIConstantForce = ^TDIConstantForce;
  8434.   TDIConstantForce = record
  8435.     lMagnitude: Longint;
  8436.   end;
  8437.  
  8438.   DICONSTANTFORCE = TDIConstantForce;
  8439.   LPDICONSTANTFORCE = PDIConstantForce;
  8440.  
  8441.   PDIRampForce = ^TDIRampForce;
  8442.   TDIRampForce = record
  8443.     lStart: Longint;
  8444.     lEnd: Longint;
  8445.   end;
  8446.  
  8447.   DIRAMPFORCE = TDIRampForce;
  8448.   LPDIRAMPFORCE = PDIRampForce;
  8449.  
  8450.   PDIPeriodic = ^TDIPeriodic;
  8451.   TDIPeriodic = record
  8452.     dwMagnitude: DWORD;
  8453.     lOffset: Longint;
  8454.     dwPhase: DWORD;
  8455.     dwPeriod: DWORD;
  8456.   end;
  8457.  
  8458.   DIPERIODIC = TDIPeriodic;
  8459.   LPDIPERIODIC = PDIPeriodic;
  8460.  
  8461.   PDICondition = ^TDICondition;
  8462.   TDICondition = record
  8463.     lOffset: Longint;
  8464.     lPositiveCoefficient: Longint;
  8465.     lNegativeCoefficient: Longint;
  8466.     dwPositiveSaturation: DWORD;
  8467.     dwNegativeSaturation: DWORD;
  8468.     lDeadBand: Longint;
  8469.   end;
  8470.  
  8471.   DICONDITION = TDICondition;
  8472.   LPDICONDITION = PDICondition;
  8473.  
  8474.   PDICustomForce = ^TDICustomForce;
  8475.   TDICustomForce = record
  8476.     cChannels: DWORD;
  8477.     dwSamplePeriod: DWORD;
  8478.     cSamples: DWORD;
  8479.     rglForceData: PLongint;
  8480.   end;
  8481.  
  8482.   DICUSTOMFORCE = TDICustomForce;
  8483.   LPDICUSTOMFORCE = PDICustomForce;
  8484.  
  8485.   PDIEnvelope = ^TDIEnvelope;
  8486.   TDIEnvelope = record
  8487.     dwSize: DWORD;                   // sizeof(DIENVELOPE)
  8488.     dwAttackLevel: DWORD;
  8489.     dwAttackTime: DWORD;             // Microseconds
  8490.     dwFadeLevel: DWORD;
  8491.     dwFadeTime: DWORD;               // Microseconds
  8492.   end;
  8493.  
  8494.   DIENVELOPE = TDIEnvelope;
  8495.   LPDIENVELOPE = PDIEnvelope;
  8496.  
  8497.   PDIEffect_DX5 = ^TDIEffect_DX5;
  8498.   TDIEffect_DX5 = record
  8499.     dwSize: DWORD;                   // sizeof(DIEFFECT)
  8500.     dwFlags: DWORD;                  // DIEFF_*
  8501.     dwDuration: DWORD;               // Microseconds
  8502.     dwSamplePeriod: DWORD;           // Microseconds
  8503.     dwGain: DWORD;
  8504.     dwTriggerButton: DWORD;          // or DIEB_NOTRIGGER
  8505.     dwTriggerRepeatInterval: DWORD;  // Microseconds
  8506.     cAxes: DWORD;                    // Number of axes
  8507.     rgdwAxes: PDWORD;                // arrayof axes
  8508.     rglDirection: PLongint;          // arrayof directions
  8509.     lpEnvelope: PDIEnvelope;         // Optional
  8510.     cbTypeSpecificParams: DWORD;     // Size of params
  8511.     lpvTypeSpecificParams: Pointer;  // Pointer to params
  8512.   end;
  8513.  
  8514.   PDIEffect_DX6 = ^TDIEffect_DX6;
  8515.   TDIEffect_DX6 = record
  8516.     dwSize: DWORD;                   // sizeof(DIEFFECT)
  8517.     dwFlags: DWORD;                  // DIEFF_*
  8518.     dwDuration: DWORD;               // Microseconds
  8519.     dwSamplePeriod: DWORD;           // Microseconds
  8520.     dwGain: DWORD;
  8521.     dwTriggerButton: DWORD;          // or DIEB_NOTRIGGER
  8522.     dwTriggerRepeatInterval: DWORD;  // Microseconds
  8523.     cAxes: DWORD;                    // Number of axes
  8524.     rgdwAxes: PDWORD;                // arrayof axes
  8525.     rglDirection: PLongint;          // arrayof directions
  8526.     lpEnvelope: PDIEnvelope;         // Optional
  8527.     cbTypeSpecificParams: DWORD;     // Size of params
  8528.     lpvTypeSpecificParams: Pointer;  // Pointer to params
  8529.     dwStartDelay: DWORD;             // Microseconds
  8530.   end;
  8531.  
  8532. {$IFDEF SupportDirectX6}
  8533.   PDIEffect = PDIEffect_DX6;
  8534.   TDIEffect = TDIEffect_DX6;
  8535. {$ELSE}
  8536.   PDIEffect = PDIEffect_DX5;
  8537.   TDIEffect = TDIEffect_DX5;
  8538. {$ENDIF}
  8539.  
  8540.   DIEFFECT = TDIEFFECT;
  8541.   LPDIEFFECT = PDIEFFECT;
  8542.  
  8543.   PDIFileEffect = ^TDIFileEffect;
  8544.   TDIFileEffect = record
  8545.     dwSize: DWORD;
  8546.     GuidEffect: TGUID;
  8547.     lpDiEffect: PDIEffect;
  8548.     szFriendlyName: array[0..MAX_PATH-1] of Char;
  8549.   end;
  8550.  
  8551.   DIFILEEFFECT = TDIFileEffect;
  8552.   LPDIFILEEFFECT = PDIFileEffect;
  8553.  
  8554.   TDIEnumEffectsInFileCallback = function(const lpDiFileEf: TDIFileEffect; pvRef: Pointer): BOOL; far pascal;
  8555.   LPDIENUMEFFECTSINFILECALLBACK = TDIEnumEffectsInFileCallback;
  8556.  
  8557. const
  8558.   DIEFF_OBJECTIDS             = $00000001;
  8559.   DIEFF_OBJECTOFFSETS         = $00000002;
  8560.   DIEFF_CARTESIAN             = $00000010;
  8561.   DIEFF_POLAR                 = $00000020;
  8562.   DIEFF_SPHERICAL             = $00000040;
  8563.  
  8564.   DIEP_DURATION               = $00000001;
  8565.   DIEP_SAMPLEPERIOD           = $00000002;
  8566.   DIEP_GAIN = $00000004;
  8567.   DIEP_TRIGGERBUTTON          = $00000008;
  8568.   DIEP_TRIGGERREPEATINTERVAL  = $00000010;
  8569.   DIEP_AXES                   = $00000020;
  8570.   DIEP_DIRECTION              = $00000040;
  8571.   DIEP_ENVELOPE               = $00000080;
  8572.   DIEP_TYPESPECIFICPARAMS     = $00000100;
  8573.   DIEP_STARTDELAY             = $00000200;
  8574.   DIEP_ALLPARAMS_DX5          = $000001FF;
  8575. {$IFDEF SupportDirectX6}
  8576.   DIEP_ALLPARAMS              = $000003FF;
  8577. {$ELSE}
  8578.   DIEP_ALLPARAMS              = $000001FF;
  8579. {$ENDIF}
  8580.   DIEP_START                  = $20000000;
  8581.   DIEP_NORESTART              = $40000000;
  8582.   DIEP_NODOWNLOAD             = $80000000;
  8583.   DIEB_NOTRIGGER              = $FFFFFFFF;
  8584.  
  8585.   DIES_SOLO                   = $00000001;
  8586.   DIES_NODOWNLOAD             = $80000000;
  8587.  
  8588.   DIEGES_PLAYING              = $00000001;
  8589.   DIEGES_EMULATED             = $00000002;
  8590.  
  8591. type
  8592.   PDIEffEscape = ^TDIEffEscape;
  8593.   TDIEffEscape = record
  8594.     dwSize: DWORD;
  8595.     dwCommand: DWORD;
  8596.     lpvInBuffer: Pointer;
  8597.     cbInBuffer: DWORD;
  8598.     lpvOutBuffer: Pointer;
  8599.     cbOutBuffer: DWORD;
  8600.   end;
  8601.  
  8602.   DIEFFESCAPE = TDIEffEscape;
  8603.   LPDIEFFESCAPE = PDIEffEscape;
  8604.  
  8605.   IDirectInputEffect = interface(IUnknown)
  8606.     ['{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}']
  8607.     // IDirectInputEffect methods
  8608.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall;
  8609.     function GetEffectGuid(var pguid: TGUID): HResult; stdcall;
  8610.     function GetParameters(var peff: TDIEffect; dwFlags: DWORD): HResult; stdcall;
  8611.     function SetParameters(const peff: TDIEffect; dwFlags: DWORD): HResult; stdcall;
  8612.     function Start(dwIterations: DWORD; dwFlags: DWORD): HResult; stdcall;
  8613.     function Stop: HResult; stdcall;
  8614.     function GetEffectStatus(var pdwFlags: DWORD): HResult; stdcall;
  8615.     function DownLoad: HResult; stdcall;
  8616.     function Unload: HResult; stdcall;
  8617.     function Escape(const pesc: TDIEffEscape): HResult; stdcall;
  8618.   end;
  8619.  
  8620. { IDirectInputDevice }
  8621.  
  8622. const
  8623.   DIDEVTYPE_DEVICE   = 1;
  8624.   DIDEVTYPE_MOUSE    = 2;
  8625.   DIDEVTYPE_KEYBOARD = 3;
  8626.   DIDEVTYPE_JOYSTICK = 4;
  8627.   DIDEVTYPE_HID      = $00010000;
  8628.  
  8629.   DIDEVTYPEMOUSE_UNKNOWN     = 1;
  8630.   DIDEVTYPEMOUSE_TRADITIONAL = 2;
  8631.   DIDEVTYPEMOUSE_FINGERSTICK = 3;
  8632.   DIDEVTYPEMOUSE_TOUCHPAD    = 4;
  8633.   DIDEVTYPEMOUSE_TRACKBALL   = 5;
  8634.  
  8635.   DIDEVTYPEKEYBOARD_UNKNOWN     = 0;
  8636.   DIDEVTYPEKEYBOARD_PCXT        = 1;
  8637.   DIDEVTYPEKEYBOARD_OLIVETTI    = 2;
  8638.   DIDEVTYPEKEYBOARD_PCAT        = 3;
  8639.   DIDEVTYPEKEYBOARD_PCENH       = 4;
  8640.   DIDEVTYPEKEYBOARD_NOKIA1050   = 5;
  8641.   DIDEVTYPEKEYBOARD_NOKIA9140   = 6;
  8642.   DIDEVTYPEKEYBOARD_NEC98       = 7;
  8643.   DIDEVTYPEKEYBOARD_NEC98LAPTOP = 8;
  8644.   DIDEVTYPEKEYBOARD_NEC98106    = 9;
  8645.   DIDEVTYPEKEYBOARD_JAPAN106    = 10;
  8646.   DIDEVTYPEKEYBOARD_JAPANAX     = 11;
  8647.   DIDEVTYPEKEYBOARD_J3100       = 12;
  8648.  
  8649.   DIDEVTYPEJOYSTICK_UNKNOWN     = 1;
  8650.   DIDEVTYPEJOYSTICK_TRADITIONAL = 2;
  8651.   DIDEVTYPEJOYSTICK_FLIGHTSTICK = 3;
  8652.   DIDEVTYPEJOYSTICK_GAMEPAD     = 4;
  8653.   DIDEVTYPEJOYSTICK_RUDDER      = 5;
  8654.   DIDEVTYPEJOYSTICK_WHEEL       = 6;
  8655.   DIDEVTYPEJOYSTICK_HEADTRACKER = 7;
  8656.  
  8657. function GET_DIDEVICE_TYPE(dwDevType: DWORD): DWORD;
  8658. function GET_DIDEVICE_SUBTYPE(dwDevType: DWORD): DWORD;
  8659.  
  8660. type
  8661.   PDIDevCaps_DX3 = ^TDIDevCaps_DX3;
  8662.   TDIDevCaps_DX3 = record
  8663.     dwSize: DWORD;
  8664.     dwFlags: DWORD;
  8665.     dwDevType: DWORD;
  8666.     dwAxes: DWORD;
  8667.     dwButtons: DWORD;
  8668.     dwPOVs: DWORD;
  8669.   end;
  8670.  
  8671.   PDIDevCaps_DX5 = ^TDIDevCaps_DX5;
  8672.   TDIDevCaps_DX5 = record
  8673.     dwSize: DWORD;
  8674.     dwFlags: DWORD;
  8675.     dwDevType: DWORD;
  8676.     dwAxes: DWORD;
  8677.     dwButtons: DWORD;
  8678.     dwPOVs: DWORD;
  8679.     dwFFSamplePeriod: DWORD;
  8680.     dwFFMinTimeResolution: DWORD;
  8681.     dwFirmwareRevision: DWORD;
  8682.     dwHardwareRevision: DWORD;
  8683.     dwFFDriverVersion: DWORD;
  8684.   end;
  8685.  
  8686. {$IFDEF DirectX3}
  8687.   TDIDevCaps = TDIDevCaps_DX3;
  8688.   PDIDevCaps = PDIDevCaps_DX3;
  8689. {$ENDIF}{$IFDEF DirectX5}
  8690.   TDIDevCaps = TDIDevCaps_DX5;
  8691.   PDIDevCaps = PDIDevCaps_DX5;
  8692. {$ENDIF}{$IFDEF DirectX6}
  8693.   TDIDevCaps = TDIDevCaps_DX5;
  8694.   PDIDevCaps = PDIDevCaps_DX5;
  8695. {$ENDIF}{$IFDEF DirectX7}
  8696.   TDIDevCaps = TDIDevCaps_DX5;
  8697.   PDIDevCaps = PDIDevCaps_DX5;
  8698. {$ENDIF}
  8699.  
  8700.   DIDEVCAPS = TDIDevCaps;
  8701.   LPDIDEVCAPS = PDIDevCaps;
  8702.  
  8703. const
  8704.   DIDC_ATTACHED           = $00000001;
  8705.   DIDC_POLLEDDEVICE       = $00000002;
  8706.   DIDC_EMULATED           = $00000004;
  8707.   DIDC_POLLEDDATAFORMAT   = $00000008;
  8708.  
  8709.   DIDC_FORCEFEEDBACK      = $00000100;
  8710.   DIDC_FFATTACK           = $00000200;
  8711.   DIDC_FFFADE             = $00000400;
  8712.   DIDC_SATURATION         = $00000800;
  8713.   DIDC_POSNEGCOEFFICIENTS = $00001000;
  8714.   DIDC_POSNEGSATURATION   = $00002000;
  8715.   DIDC_DEADBAND           = $00004000;
  8716.   DIDC_STARTDELAY         = $00008000;
  8717.   DIDC_ALIAS              = $00010000;
  8718.   DIDC_PHANTOM            = $00020000;
  8719.  
  8720.   DIDFT_ALL        = $00000000;
  8721.  
  8722.   DIDFT_RELAXIS    = $00000001;
  8723.   DIDFT_ABSAXIS    = $00000002;
  8724.   DIDFT_AXIS       = $00000003;
  8725.  
  8726.   DIDFT_PSHBUTTON  = $00000004;
  8727.   DIDFT_TGLBUTTON  = $00000008;
  8728.   DIDFT_BUTTON     = $0000000C;
  8729.  
  8730.   DIDFT_POV        = $00000010;
  8731.   DIDFT_COLLECTION = $00000040;
  8732.   DIDFT_NODATA     = $00000080;
  8733.  
  8734.   DIDFT_ANYINSTANCE  = $00FFFF00;
  8735.   DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE;
  8736.  
  8737.   DIDFT_FFACTUATOR       = $01000000;
  8738.   DIDFT_FFEFFECTTRIGGER  = $02000000;
  8739.   DIDFT_OUTPUT           = $10000000;
  8740.   DIDFT_VENDORDEFINED    = $04000000;
  8741.   DIDFT_ALIAS            = $08000000;
  8742.   DIDFT_NOCOLLECTION     = $00FFFF00;
  8743.  
  8744. function DIDFT_MAKEINSTANCE(n: WORD): DWORD;
  8745. function DIDFT_GETTYPE(n: DWORD): DWORD;
  8746. function DIDFT_GETINSTANCE(n: DWORD): WORD;
  8747. function DIDFT_ENUMCOLLECTION(n: WORD): DWORD;
  8748.  
  8749. type
  8750.   PDIObjectDataFormat = ^TDIObjectDataFormat;
  8751.   TDIObjectDataFormat = record
  8752.     pguid: PGUID;
  8753.     dwOfs: DWORD;
  8754.     dwType: DWORD;
  8755.     dwFlags: DWORD;
  8756.   end;
  8757.  
  8758.   DIOBJECTDATAFORMAT = TDIObjectDataFormat;
  8759.   LPDIOBJECTDATAFORMAT = PDIObjectDataFormat;
  8760.  
  8761.   PDIDataFormat = ^TDIDataFormat;
  8762.   TDIDataFormat = record
  8763.     dwSize: DWORD;
  8764.     dwObjSize: DWORD;
  8765.     dwFlags: DWORD;
  8766.     dwDataSize: DWORD;
  8767.     dwNumObjs: DWORD;
  8768.     rgodf: PDIObjectDataFormat;
  8769.   end;
  8770.  
  8771.   DIDATAFORMAT = TDIDataFormat;
  8772.   LPDIDATAFORMAT = PDIDataFormat;
  8773.  
  8774. const
  8775.   DIDF_ABSAXIS = $00000001;
  8776.   DIDF_RELAXIS = $00000002;
  8777.  
  8778. type
  8779.   PDIDeviceObjectInstanceA_DX3 = ^TDIDeviceObjectInstanceA_DX3;
  8780.   TDIDeviceObjectInstanceA_DX3 = record
  8781.     dwSize: DWORD;
  8782.     guidType: TGUID;
  8783.     dwOfs: DWORD;
  8784.     dwType: DWORD;
  8785.     dwFlags: DWORD;
  8786.     tszName: array[0..MAX_PATH-1] of CHAR;
  8787.   end;
  8788.  
  8789.   PDIDeviceObjectInstanceA_DX5 = ^TDIDeviceObjectInstanceA_DX5;
  8790.   TDIDeviceObjectInstanceA_DX5 = record
  8791.     dwSize: DWORD;
  8792.     guidType: TGUID;
  8793.     dwOfs: DWORD;
  8794.     dwType: DWORD;
  8795.     dwFlags: DWORD;
  8796.     tszName: array[0..MAX_PATH-1] of CHAR;
  8797.     dwFFMaxForce: DWORD;
  8798.     dwFFForceResolution: DWORD;
  8799.     wCollectionNumber: WORD;
  8800.     wDesignatorIndex: WORD;
  8801.     wUsagePage: WORD;
  8802.     wUsage: WORD;
  8803.     dwDimension: DWORD;
  8804.     wExponent: WORD;
  8805.     wReserved: WORD;
  8806.   end;
  8807.  
  8808. {$IFDEF DirectX3}
  8809.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstanceA_DX3;
  8810.   PDIDeviceObjectInstanceA = PDIDeviceObjectInstanceA_DX3;
  8811. {$ENDIF}{$IFDEF DirectX5}
  8812.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstanceA_DX5;
  8813.   PDIDeviceObjectInstanceA = PDIDeviceObjectInstanceA_DX5;
  8814. {$ENDIF}{$IFDEF DirectX6}
  8815.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstanceA_DX5;
  8816.   PDIDeviceObjectInstanceA = PDIDeviceObjectInstanceA_DX5;
  8817. {$ENDIF}{$IFDEF DirectX7}
  8818.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstanceA_DX5;
  8819.   PDIDeviceObjectInstanceA = PDIDeviceObjectInstanceA_DX5;
  8820. {$ENDIF}
  8821.  
  8822.   DIDEVICEOBJECTINSTANCEA = TDIDeviceObjectInstanceA;
  8823.   LPDIDEVICEOBJECTINSTANCEA = PDIDeviceObjectInstanceA;
  8824.  
  8825.   PDIDeviceObjectInstanceW_DX3 = ^TDIDeviceObjectInstanceW_DX3;
  8826.   TDIDeviceObjectInstanceW_DX3 = record
  8827.     dwSize: DWORD;
  8828.     guidType: TGUID;
  8829.     dwOfs: DWORD;
  8830.     dwType: DWORD;
  8831.     dwFlags: DWORD;
  8832.     tszName: array[0..MAX_PATH-1] of WCHAR;
  8833.   end;
  8834.  
  8835.   PDIDeviceObjectInstanceW_DX5 = ^TDIDeviceObjectInstanceW_DX5;
  8836.   TDIDeviceObjectInstanceW_DX5 = record
  8837.     dwSize: DWORD;
  8838.     guidType: TGUID;
  8839.     dwOfs: DWORD;
  8840.     dwType: DWORD;
  8841.     dwFlags: DWORD;
  8842.     tszName: array[0..MAX_PATH-1] of WCHAR;
  8843.     dwFFMaxForce: DWORD;
  8844.     dwFFForceResolution: DWORD;
  8845.     wCollectionNumber: WORD;
  8846.     wDesignatorIndex: WORD;
  8847.     wUsagePage: WORD;
  8848.     wUsage: WORD;
  8849.     dwDimension: DWORD;
  8850.     wExponent: WORD;
  8851.     wReserved: WORD;
  8852.   end;
  8853.  
  8854. {$IFDEF DirectX3}
  8855.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstanceW_DX3;
  8856.   PDIDeviceObjectInstanceW = PDIDeviceObjectInstanceW_DX3;
  8857. {$ENDIF}{$IFDEF DirectX5}
  8858.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstanceW_DX5;
  8859.   PDIDeviceObjectInstanceW = PDIDeviceObjectInstanceW_DX5;
  8860. {$ENDIF}{$IFDEF DirectX6}
  8861.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstanceW_DX5;
  8862.   PDIDeviceObjectInstanceW = PDIDeviceObjectInstanceW_DX5;
  8863. {$ENDIF}{$IFDEF DirectX7}
  8864.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstanceW_DX5;
  8865.   PDIDeviceObjectInstanceW = PDIDeviceObjectInstanceW_DX5;
  8866. {$ENDIF}
  8867.  
  8868.   DIDEVICEOBJECTINSTANCEW = TDIDeviceObjectInstanceW;
  8869.   LPDIDEVICEOBJECTINSTANCEW = PDIDeviceObjectInstanceW;
  8870.  
  8871.   TDIDeviceObjectInstance = TDIDeviceObjectInstanceA;
  8872.   PDIDeviceObjectInstance = PDIDeviceObjectInstanceA;
  8873.  
  8874.   DIDEVICEOBJECTINSTANCE = TDIDeviceObjectInstance;
  8875.   LPDIDEVICEOBJECTINSTANCE = PDIDeviceObjectInstance;
  8876.  
  8877.   TDIEnumDeviceObjectsCallbackA = function(const peff: TDIDeviceObjectInstanceA;
  8878.       pvRef: Pointer): HResult; stdcall;
  8879.   LPDIENUMDEVICEOBJECTSCALLBACKA = TDIEnumDeviceObjectsCallbackA;
  8880.  
  8881.   TDIEnumDeviceObjectsCallbackW = function(const peff: TDIDeviceObjectInstanceW;
  8882.       pvRef: Pointer): HResult; stdcall;
  8883.   LPDIENUMDEVICEOBJECTSCALLBACKW = TDIEnumDeviceObjectsCallbackW;
  8884.  
  8885.   TDIEnumDeviceObjectsCallback = TDIEnumDeviceObjectsCallbackA;
  8886.   LPDIENUMDEVICEOBJECTSCALLBACK = TDIEnumDeviceObjectsCallback;
  8887.  
  8888. const
  8889.   DIDOI_FFACTUATOR      = $00000001;
  8890.   DIDOI_FFEFFECTTRIGGER = $00000002;
  8891.   DIDOI_POLLED          = $00008000;
  8892.   DIDOI_ASPECTPOSITION  = $00000100;
  8893.   DIDOI_ASPECTVELOCITY  = $00000200;
  8894.   DIDOI_ASPECTACCEL     = $00000300;
  8895.   DIDOI_ASPECTFORCE     = $00000400;
  8896.   DIDOI_ASPECTMASK      = $00000F00;
  8897.   DIDOI_GUIDISUSAGE     = $00010000;
  8898.  
  8899. type
  8900.   PDIPropHeader = ^TDIPropHeader;
  8901.   TDIPropHeader = record
  8902.     dwSize: DWORD;
  8903.     dwHeaderSize: DWORD;
  8904.     dwObj: DWORD;
  8905.     dwHow: DWORD;
  8906.   end;
  8907.  
  8908.   DIPROPHEADER = TDIPropHeader;
  8909.   LPDIPROPHEADER = PDIPropHeader;
  8910.  
  8911. const
  8912.   DIPH_DEVICE   = 0;
  8913.   DIPH_BYOFFSET = 1;
  8914.   DIPH_BYID     = 2;
  8915.   DIPH_BYUSAGE  = 3;
  8916.  
  8917. function DIMAKEUSAGEDWORD(UsagePage, Usage: Word): DWORD;
  8918.  
  8919. type
  8920.   PDIPropDWORD = ^TDIPropDWORD;
  8921.   TDIPropDWORD = record
  8922.     diph: TDIPropHeader;
  8923.     dwData: DWORD;
  8924.   end;
  8925.  
  8926.   DIPROPDWORD = TDIPropDWORD;
  8927.   LPDIPROPDWORD = PDIPropDWORD;
  8928.  
  8929.   PDIPropRange = ^TDIPropRange;
  8930.   TDIPropRange = record
  8931.     diph: TDIPropHeader;
  8932.     lMin: Longint;
  8933.     lMax: Longint;
  8934.   end;
  8935.  
  8936.   DIPROPRANGE = TDIPropRange;
  8937.   LPDIPROPRANGE = PDIPropRange;
  8938.  
  8939.   PDIPropCal = ^TDIPropCal;
  8940.   TDIPropCal = record
  8941.     diph: TDIPropHeader;
  8942.     lMin: Longint;
  8943.     lCenter: Longint;
  8944.     lMax: Longint;
  8945.   end;
  8946.  
  8947.   DIPROPCAL = TDIPropCal;
  8948.   LPDIPROPCAL = PDIPropCal;
  8949.  
  8950.   PDIPropGUIDAndPath = ^TDIPropGUIDAndPath;
  8951.   TDIPropGUIDAndPath = record
  8952.     diph: TDIPropHeader;
  8953.     guidClass: TGUID;
  8954.     wszPath: array[0..MAX_PATH-1] of WCHAR;
  8955.   end;
  8956.  
  8957.   DIPROPGUIDANDPATH = TDIPropGUIDAndPath;
  8958.   LPDIPROPGUIDANDPATH = PDIPropGUIDAndPath;
  8959.  
  8960.   PDIPropString = ^TDIPropString;
  8961.   TDIPropString = record
  8962.     diph: TDIPropHeader;
  8963.     wsz: array[0..MAX_PATH-1] of WCHAR;
  8964.   end;
  8965.  
  8966.   DIPROPSTRING = TDIPropString;
  8967.   LPDIPROPSTRING = PDIPropString;
  8968.  
  8969. const            
  8970.   DIPROPRANGE_NOMIN   = $80000000;
  8971.   DIPROPRANGE_NOMAX   = $7FFFFFFF;
  8972.  
  8973.   DIPROP_BUFFERSIZE   = PGUID(1);
  8974.   DIPROP_AXISMODE     = PGUID(2);
  8975.  
  8976.   DIPROPAXISMODE_ABS  = 0;
  8977.   DIPROPAXISMODE_REL  = 1;
  8978.  
  8979.   DIPROP_GRANULARITY  = PGUID(3);
  8980.   DIPROP_RANGE        = PGUID(4);
  8981.   DIPROP_DEADZONE     = PGUID(5);
  8982.   DIPROP_SATURATION   = PGUID(6);
  8983.   DIPROP_FFGAIN       = PGUID(7);
  8984.   DIPROP_FFLOAD       = PGUID(8);
  8985.   DIPROP_AUTOCENTER   = PGUID(9);
  8986.  
  8987.   DIPROPAUTOCENTER_OFF = 0;
  8988.   DIPROPAUTOCENTER_ON  = 1;
  8989.  
  8990.   DIPROP_CALIBRATIONMODE = PGUID(10);
  8991.  
  8992.   DIPROPCALIBRATIONMODE_COOKED = 0;
  8993.   DIPROPCALIBRATIONMODE_RAW    = 1;
  8994.  
  8995.   DIPROP_CALIBRATION        = PGUID(11);
  8996.   DIPROP_GUIDANDPATH        = PGUID(12);
  8997.   DIPROP_INSTANCENAME       = PGUID(13);
  8998.   DIPROP_PRODUCTNAME        = PGUID(14);
  8999.   DIPROP_JOYSTICKID         = PGUID(15);
  9000.   DIPROP_GETPORTDISPLAYNAME = PGUID(16);
  9001.   DIPROP_ENABLEREPORTID     = PGUID(17);
  9002.   DIPROP_GETPHYSICALRANGE   = PGUID(18);
  9003.   DIPROP_GETLOGICALRANGE    = PGUID(19);
  9004.  
  9005. type
  9006.   PDIDeviceObjectData = ^TDIDeviceObjectData;
  9007.   TDIDeviceObjectData = record
  9008.     dwOfs: DWORD;
  9009.     dwData: DWORD;
  9010.     dwTimeStamp: DWORD;
  9011.     dwSequence: DWORD;
  9012.   end;
  9013.  
  9014.   DIDEVICEOBJECTDATA = TDIDeviceObjectData;
  9015.   LPDIDEVICEOBJECTDATA = PDIDeviceObjectData;
  9016.  
  9017. const
  9018.   DIGDD_PEEK = $00000001;
  9019.  
  9020.   DISCL_EXCLUSIVE    = $00000001;
  9021.   DISCL_NONEXCLUSIVE = $00000002;
  9022.   DISCL_FOREGROUND   = $00000004;
  9023.   DISCL_BACKGROUND   = $00000008;
  9024.   DISCL_NOWINKEY     = $00000010;
  9025.  
  9026. type
  9027.   PDIDeviceInstanceA_DX3 = ^TDIDeviceInstanceA_DX3;
  9028.   TDIDeviceInstanceA_DX3 = record
  9029.     dwSize: DWORD;
  9030.     guidInstance: TGUID;
  9031.     guidProduct: TGUID;
  9032.     dwDevType: DWORD;
  9033.     tszInstanceName: array[0..MAX_PATH-1] of CHAR;
  9034.     tszProductName: array[0..MAX_PATH-1] of CHAR;
  9035.   end;
  9036.  
  9037.   PDIDeviceInstanceA_DX5 = ^TDIDeviceInstanceA_DX5;
  9038.   TDIDeviceInstanceA_DX5 = record
  9039.     dwSize: DWORD;
  9040.     guidInstance: TGUID;
  9041.     guidProduct: TGUID;
  9042.     dwDevType: DWORD;
  9043.     tszInstanceName: array[0..MAX_PATH-1] of CHAR;
  9044.     tszProductName: array[0..MAX_PATH-1] of CHAR;
  9045.     guidFFDriver: TGUID;
  9046.     wUsagePage: WORD;
  9047.     wUsage: WORD;
  9048.   end;
  9049.  
  9050. {$IFDEF DirectX3}
  9051.   TDIDeviceInstanceA = TDIDeviceInstanceA_DX3;
  9052.   PDIDeviceInstanceA = PDIDeviceInstanceA_DX3;
  9053. {$ENDIF}{$IFDEF DirectX5}
  9054.   TDIDeviceInstanceA = TDIDeviceInstanceA_DX5;
  9055.   PDIDeviceInstanceA = PDIDeviceInstanceA_DX5;
  9056. {$ENDIF}{$IFDEF DirectX6}
  9057.   TDIDeviceInstanceA = TDIDeviceInstanceA_DX5;
  9058.   PDIDeviceInstanceA = PDIDeviceInstanceA_DX5;
  9059. {$ENDIF}{$IFDEF DirectX7}
  9060.   TDIDeviceInstanceA = TDIDeviceInstanceA_DX5;
  9061.   PDIDeviceInstanceA = PDIDeviceInstanceA_DX5;
  9062. {$ENDIF}
  9063.  
  9064.   DIDEVICEINSTANCEA = TDIDeviceInstanceA;
  9065.   LPDIDEVICEINSTANCEA = PDIDeviceInstanceA;
  9066.  
  9067.   PDIDeviceInstanceW_DX3 = ^TDIDeviceInstanceW_DX3;
  9068.   TDIDeviceInstanceW_DX3 = record
  9069.     dwSize: DWORD;
  9070.     guidInstance: TGUID;
  9071.     guidProduct: TGUID;
  9072.     dwDevType: DWORD;
  9073.     tszInstanceName: array[0..MAX_PATH-1] of WCHAR;
  9074.     tszProductName: array[0..MAX_PATH-1] of WCHAR;
  9075.   end;
  9076.  
  9077.   PDIDeviceInstanceW_DX5 = ^TDIDeviceInstanceW_DX5;
  9078.   TDIDeviceInstanceW_DX5 = record
  9079.     dwSize: DWORD;
  9080.     guidInstance: TGUID;
  9081.     guidProduct: TGUID;
  9082.     dwDevType: DWORD;
  9083.     tszInstanceName: array[0..MAX_PATH-1] of WCHAR;
  9084.     tszProductName: array[0..MAX_PATH-1] of WCHAR;
  9085.     guidFFDriver: TGUID;
  9086.     wUsagePage: WORD;
  9087.     wUsage: WORD;
  9088.   end;
  9089.  
  9090. {$IFDEF DirectX3}
  9091.   TDIDeviceInstanceW = TDIDeviceInstanceW_DX3;
  9092.   PDIDeviceInstanceW = PDIDeviceInstanceW_DX3;
  9093. {$ENDIF}{$IFDEF DirectX5}
  9094.   TDIDeviceInstanceW = TDIDeviceInstanceW_DX5;
  9095.   PDIDeviceInstanceW = PDIDeviceInstanceW_DX5;
  9096. {$ENDIF}{$IFDEF DirectX6}
  9097.   TDIDeviceInstanceW = TDIDeviceInstanceW_DX5;
  9098.   PDIDeviceInstanceW = PDIDeviceInstanceW_DX5;
  9099. {$ENDIF}{$IFDEF DirectX7}
  9100.   TDIDeviceInstanceW = TDIDeviceInstanceW_DX5;
  9101.   PDIDeviceInstanceW = PDIDeviceInstanceW_DX5;
  9102. {$ENDIF}
  9103.  
  9104.   DIDEVICEINSTANCEW = TDIDeviceInstanceW;
  9105.   LPDIDEVICEINSTANCEW = PDIDeviceInstanceW;
  9106.  
  9107.   TDIDeviceInstance = TDIDeviceInstanceA;
  9108.   PDIDeviceInstance = PDIDeviceInstanceA;
  9109.  
  9110.   DIDEVICEINSTANCE = TDIDeviceInstance;
  9111.   LPDIDEVICEINSTANCE = PDIDeviceInstance;
  9112.  
  9113.   IDirectInputDeviceW = interface(IUnknown)
  9114.     ['{5944E681-C92E-11CF-BFC7-444553540000}']
  9115.     // IDirectInputDeviceW methods
  9116.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps): HResult; stdcall;
  9117.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW;
  9118.         pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  9119.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader): HResult; stdcall;
  9120.     function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader): HResult; stdcall;
  9121.     function Acquire: HResult; stdcall;
  9122.     function Unacquire: HResult; stdcall;
  9123.     function GetDeviceState(cbData: DWORD; var lpvData): HResult; stdcall;
  9124.     function GetDeviceData(cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  9125.         var pdwInOut: DWORD; dwFlags: DWORD): HResult; stdcall;
  9126.     function SetDataFormat(const lpdf: TDIDataFormat): HResult; stdcall;
  9127.     function SetEventNotification(hEvent: THandle): HResult; stdcall;
  9128.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD): HResult; stdcall;
  9129.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj: DWORD;
  9130.         dwHow: DWORD): HResult; stdcall;
  9131.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceW): HResult; stdcall;
  9132.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall;
  9133.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall;
  9134.   end;
  9135.  
  9136.   IDirectInputDeviceA = interface(IUnknown)
  9137.     ['{5944E680-C92E-11CF-BFC7-444553540000}']
  9138.     // IDirectInputDeviceA methods
  9139.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps): HResult; stdcall;
  9140.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA;
  9141.         pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  9142.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader): HResult; stdcall;
  9143.     function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader): HResult; stdcall;
  9144.     function Acquire: HResult; stdcall;
  9145.     function Unacquire: HResult; stdcall;
  9146.     function GetDeviceState(cbData: DWORD; var lpvData): HResult; stdcall;
  9147.     function GetDeviceData(cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  9148.         var pdwInOut: DWORD; dwFlags: DWORD): HResult; stdcall;
  9149.     function SetDataFormat(const lpdf: TDIDataFormat): HResult; stdcall;
  9150.     function SetEventNotification(hEvent: THandle): HResult; stdcall;
  9151.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD): HResult; stdcall;
  9152.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj: DWORD;
  9153.         dwHow: DWORD): HResult; stdcall;
  9154.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceA): HResult; stdcall;
  9155.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall;
  9156.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall;
  9157.   end;
  9158.  
  9159.   IDirectInputDevice = IDirectInputDeviceA;
  9160.  
  9161. const
  9162.   DISFFC_RESET           = $00000001;
  9163.   DISFFC_STOPALL         = $00000002;
  9164.   DISFFC_PAUSE           = $00000004;
  9165.   DISFFC_CONTINUE        = $00000008;
  9166.   DISFFC_SETACTUATORSON  = $00000010;
  9167.   DISFFC_SETACTUATORSOFF = $00000020;
  9168.  
  9169.   DIGFFS_EMPTY           = $00000001;
  9170.   DIGFFS_STOPPED         = $00000002;
  9171.   DIGFFS_PAUSED          = $00000004;
  9172.   DIGFFS_ACTUATORSON     = $00000010;
  9173.   DIGFFS_ACTUATORSOFF    = $00000020;
  9174.   DIGFFS_POWERON         = $00000040;
  9175.   DIGFFS_POWEROFF        = $00000080;
  9176.   DIGFFS_SAFETYSWITCHON  = $00000100;
  9177.   DIGFFS_SAFETYSWITCHOFF = $00000200;
  9178.   DIGFFS_USERFFSWITCHON  = $00000400;
  9179.   DIGFFS_USERFFSWITCHOFF = $00000800;
  9180.   DIGFFS_DEVICELOST      = $80000000;
  9181.  
  9182.   DISDD_CONTINUE         = 1;
  9183.  
  9184.   DIFEF_DEFAULT            = $00000000;
  9185.   DIFEF_INCLUDENONSTANDARD = $00000001;
  9186.   DIFEF_MODIFYIFNEEDED     = $00000010;
  9187.  
  9188. type
  9189.   PDIEffectInfoA = ^TDIEffectInfoA;
  9190.   TDIEffectInfoA = record
  9191.     dwSize: DWORD;
  9192.     guid: TGUID;
  9193.     dwEffType: DWORD;
  9194.     dwStaticParams: DWORD;
  9195.     dwDynamicParams: DWORD;
  9196.     tszName: array[0..MAX_PATH-1] of CHAR;
  9197.   end;
  9198.  
  9199.   DIEFFECTINFOA = TDIEffectInfoA;
  9200.   LPDIEFFECTINFOA = PDIEffectInfoA;
  9201.  
  9202.   PDIEffectInfoW = ^TDIEffectInfoW;
  9203.   TDIEffectInfoW = record
  9204.     dwSize: DWORD;
  9205.     guid: TGUID;
  9206.     dwEffType: DWORD;
  9207.     dwStaticParams: DWORD;
  9208.     dwDynamicParams: DWORD;
  9209.     tszName: array[0..MAX_PATH-1] of WCHAR;
  9210.   end;
  9211.  
  9212.   DIEFFECTINFOW = TDIEffectInfoW;
  9213.   LPDIEFFECTINFOW = PDIEffectInfoW;
  9214.  
  9215.   DIEFFECTINFO = TDIEffectInfoA;
  9216.   LPDIEFFECTINFO = PDIEffectInfoA;
  9217.  
  9218.   TDIEnumEffectsCallbackA = function(const pdei: TDIEffectInfoA;
  9219.       pvRef: Pointer): HResult; stdcall;
  9220.   LPDIENUMEFFECTSCALLBACKA = TDIEnumEffectsCallbackA;
  9221.  
  9222.   TDIEnumEffectsCallbackW = function(const pdei: TDIEffectInfoW;
  9223.       pvRef: Pointer): HResult; stdcall;
  9224.   LPDIENUMEFFECTSCALLBACKW = TDIEnumEffectsCallbackW;
  9225.  
  9226.   TDIEnumEffectsCallback = TDIEnumEffectsCallbackA;
  9227.   LPDIENUMEFFECTSCALLBACK = TDIEnumEffectsCallback;
  9228.  
  9229.   LPDIENUMCREATEDEFFECTOBJECTSCALLBACK = function(const peff:
  9230.       IDirectInputEffect; pvRef: Pointer): HResult; stdcall;
  9231.  
  9232.   IDirectInputDevice2W = interface(IDirectInputDeviceW)
  9233.     ['{5944E683-C92E-11CF-BFC7-444553540000}']
  9234.     // IDirectInputDevice2W methods
  9235.     function CreateEffect(const rguid: TGUID; const lpeff: TDIEffect;
  9236.         out ppdeff: IDirectInputEffect; punkOuter: IUnknown): HResult; stdcall;
  9237.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackW; pvRef: Pointer;
  9238.         dwEffType: DWORD): HResult; stdcall;
  9239.     function GetEffectInfo(var pdei: TDIEffectInfoW; const rguid: TGUID): HResult; stdcall;
  9240.     function GetForceFeedbackState(var pdwOut: DWORD): HResult; stdcall;
  9241.     function SendForceFeedbackCommand(dwFlags: DWORD): HResult; stdcall;
  9242.     function EnumCreatedEffectObjects(lpCallback:
  9243.         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK; pvRef: Pointer; fl: DWORD): HResult; stdcall;
  9244.     function Escape(const pesc: TDIEffEscape): HResult; stdcall;
  9245.     function Poll: HResult; stdcall;
  9246.     function SendDeviceData(cbObjectData: DWORD; const rgdod: TDIDeviceObjectData;
  9247.         var pdwInOut: DWORD; fl: DWORD): HResult; stdcall;
  9248.   end;
  9249.  
  9250.   IDirectInputDevice2A = interface(IDirectInputDeviceA)
  9251.     ['{5944E682-C92E-11CF-BFC7-444553540000}']
  9252.     // IDirectInputDevice2A methods
  9253.     function CreateEffect(const rguid: TGUID; const lpeff: TDIEffect;
  9254.         out ppdeff: IDirectInputEffect; punkOuter: IUnknown): HResult; stdcall;
  9255.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackA; pvRef: Pointer;
  9256.         dwEffType: DWORD): HResult; stdcall;
  9257.     function GetEffectInfo(var pdei: TDIEffectInfoA; const rguid: TGUID): HResult; stdcall;
  9258.     function GetForceFeedbackState(var pdwOut: DWORD): HResult; stdcall;
  9259.     function SendForceFeedbackCommand(dwFlags: DWORD): HResult; stdcall;
  9260.     function EnumCreatedEffectObjects(lpCallback:
  9261.         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK; pvRef: Pointer; fl: DWORD): HResult; stdcall;
  9262.     function Escape(const pesc: TDIEffEscape): HResult; stdcall;
  9263.     function Poll: HResult; stdcall;
  9264.     function SendDeviceData(cbObjectData: DWORD; const rgdod: TDIDeviceObjectData;
  9265.         var pdwInOut: DWORD; fl: DWORD): HResult; stdcall;
  9266.   end;
  9267.  
  9268.   IDirectInputDevice2 = IDirectInputDevice2A;
  9269.  
  9270.   IDirectInputDevice7W = interface(IDirectInputDevice2W)
  9271.     ['{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}']
  9272.     // IDirectInputDevice7W methods
  9273.     function EnumEffectsInFile(lpszFileName: LPCWSTR; pec: TDIEnumEffectsInFileCallback;
  9274.       pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  9275.     function WriteEffectToFile(lpszFileName: LPCWSTR; dwEntries: DWORD;
  9276.       const rgDiFileEft: TDIFileEffect; dwFlags: DWORD): HResult; stdcall;
  9277.   end;
  9278.  
  9279.   IDirectInputDevice7A = interface(IDirectInputDevice2A)
  9280.     ['{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}']
  9281.     // IDirectInputDevice7A methods
  9282.     function EnumEffectsInFile(lpszFileName: LPCSTR; pec: TDIEnumEffectsInFileCallback;
  9283.       pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  9284.     function WriteEffectToFile(lpszFileName: LPCSTR; dwEntries: DWORD;
  9285.       const rgDiFileEft: TDIFileEffect; dwFlags: DWORD): HResult; stdcall;
  9286.   end;
  9287.  
  9288.   IDirectInputDevice7 = IDirectInputDevice7A;
  9289.  
  9290. { Mouse }
  9291.  
  9292. type
  9293.   TDIMouseState = record
  9294.     lX: Longint;
  9295.     lY: Longint;
  9296.     lZ: Longint;
  9297.     rgbButtons: array[0..3] of BYTE;
  9298.   end;
  9299.  
  9300.   DIMOUSESTATE = TDIMouseState;
  9301.  
  9302.   TDIMouseState2 = record
  9303.     lX: Longint;
  9304.     lY: Longint;
  9305.     lZ: Longint;
  9306.     rgbButtons: array[0..7] of BYTE;
  9307.   end;
  9308.  
  9309.   DIMOUSESTATE2 = TDIMouseState2;
  9310.  
  9311. const
  9312.   _c_dfDIMouse_Objects: array[0..1] of TDIObjectDataFormat = (
  9313.     (pguid: nil;          dwOfs: 0;  dwType: DIDFT_RELAXIS or DIDFT_ANYINSTANCE; dwFlags: 0),
  9314.     (pguid: @GUID_Button; dwOfs: 12; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE;  dwFlags: 0)
  9315.   );
  9316.  
  9317.   c_dfDIMouse: TDIDataFormat = (
  9318.     dwSize: Sizeof(c_dfDIMouse);
  9319.     dwObjSize: Sizeof(TDIObjectDataFormat);
  9320.     dwFlags: DIDF_RELAXIS;
  9321.     dwDataSize: Sizeof(TDIMouseState);
  9322.     dwNumObjs: High(_c_dfDIMouse_Objects)+1;
  9323.     rgodf: @_c_dfDIMouse_Objects
  9324.   );
  9325.  
  9326. { Keyboard }
  9327.  
  9328. type
  9329.   TDIKeyboardState = array[0..255] of Byte;
  9330.   DIKEYBOARDSTATE = TDIKeyboardState;
  9331.  
  9332. const
  9333.   _c_dfDIKeyboard_Objects: array[0..0] of TDIObjectDataFormat = (
  9334.     (pguid: @GUID_Key; dwOfs: 1; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE; dwFlags: 0)
  9335.   );
  9336.  
  9337.   c_dfDIKeyboard: TDIDataFormat = (
  9338.     dwSize: Sizeof(c_dfDIKeyboard);
  9339.     dwObjSize: Sizeof(TDIObjectDataFormat);
  9340.     dwFlags: 0;
  9341.     dwDataSize: SizeOf(TDIKeyboardState);
  9342.     dwNumObjs: High(_c_dfDIKeyboard_Objects)+1;
  9343.     rgodf: @_c_dfDIKeyboard_Objects
  9344.   );
  9345.  
  9346. { DirectInput keyboard scan codes }
  9347.  
  9348. const
  9349.   DIK_ESCAPE          = $01;
  9350.   DIK_1               = $02;
  9351.   DIK_2               = $03;
  9352.   DIK_3               = $04;
  9353.   DIK_4               = $05;
  9354.   DIK_5               = $06;
  9355.   DIK_6               = $07;
  9356.   DIK_7               = $08;
  9357.   DIK_8               = $09;
  9358.   DIK_9               = $0A;
  9359.   DIK_0               = $0B;
  9360.   DIK_MINUS           = $0C;    // - on main keyboard
  9361.   DIK_EQUALS          = $0D;
  9362.   DIK_BACK            = $0E;    // backspace
  9363.   DIK_TAB             = $0F;
  9364.   DIK_Q               = $10;
  9365.   DIK_W               = $11;
  9366.   DIK_E               = $12;
  9367.   DIK_R               = $13;
  9368.   DIK_T               = $14;
  9369.   DIK_Y               = $15;
  9370.   DIK_U               = $16;
  9371.   DIK_I               = $17;
  9372.   DIK_O               = $18;
  9373.   DIK_P               = $19;
  9374.   DIK_LBRACKET        = $1A;
  9375.   DIK_RBRACKET        = $1B;
  9376.   DIK_RETURN          = $1C;    // Enter on main keyboard
  9377.   DIK_LCONTROL        = $1D;
  9378.   DIK_A               = $1E;
  9379.   DIK_S               = $1F;
  9380.   DIK_D               = $20;
  9381.   DIK_F               = $21;
  9382.   DIK_G               = $22;
  9383.   DIK_H               = $23;
  9384.   DIK_J               = $24;
  9385.   DIK_K               = $25;
  9386.   DIK_L               = $26;
  9387.   DIK_SEMICOLON       = $27;
  9388.   DIK_APOSTROPHE      = $28;
  9389.   DIK_GRAVE           = $29;    // accent grave
  9390.   DIK_LSHIFT          = $2A;
  9391.   DIK_BACKSLASH       = $2B;
  9392.   DIK_Z               = $2C;
  9393.   DIK_X               = $2D;
  9394.   DIK_C               = $2E;
  9395.   DIK_V               = $2F;
  9396.   DIK_B               = $30;
  9397.   DIK_N               = $31;
  9398.   DIK_M               = $32;
  9399.   DIK_COMMA           = $33;
  9400.   DIK_PERIOD          = $34;    // . on main keyboard
  9401.   DIK_SLASH           = $35;    // / on main keyboard
  9402.   DIK_RSHIFT          = $36;
  9403.   DIK_MULTIPLY        = $37;    // * on numeric keypad
  9404.   DIK_LMENU           = $38;    // left Alt
  9405.   DIK_SPACE           = $39;
  9406.   DIK_CAPITAL         = $3A;
  9407.   DIK_F1              = $3B;
  9408.   DIK_F2              = $3C;
  9409.   DIK_F3              = $3D;
  9410.   DIK_F4              = $3E;
  9411.   DIK_F5              = $3F;
  9412.   DIK_F6              = $40;
  9413.   DIK_F7              = $41;
  9414.   DIK_F8              = $42;
  9415.   DIK_F9              = $43;
  9416.   DIK_F10             = $44;
  9417.   DIK_NUMLOCK         = $45;
  9418.   DIK_SCROLL          = $46;    // Scroll Lock
  9419.   DIK_NUMPAD7         = $47;
  9420.   DIK_NUMPAD8         = $48;
  9421.   DIK_NUMPAD9         = $49;
  9422.   DIK_SUBTRACT        = $4A;    // - on numeric keypad
  9423.   DIK_NUMPAD4         = $4B;
  9424.   DIK_NUMPAD5         = $4C;
  9425.   DIK_NUMPAD6         = $4D;
  9426.   DIK_ADD             = $4E;    // + on numeric keypad
  9427.   DIK_NUMPAD1         = $4F;
  9428.   DIK_NUMPAD2         = $50;
  9429.   DIK_NUMPAD3         = $51;
  9430.   DIK_NUMPAD0         = $52;
  9431.   DIK_DECIMAL         = $53;    // . on numeric keypad
  9432.   DIK_F11             = $57;
  9433.   DIK_F12             = $58;
  9434.  
  9435.   DIK_F13             = $64;    //                     (NEC PC98)
  9436.   DIK_F14             = $65;    //                     (NEC PC98)
  9437.   DIK_F15             = $66;    //                     (NEC PC98)
  9438.  
  9439.   DIK_KANA            = $70;    // (Japanese keyboard)
  9440.   DIK_CONVERT         = $79;    // (Japanese keyboard)
  9441.   DIK_NOCONVERT       = $7B;    // (Japanese keyboard)
  9442.   DIK_YEN             = $7D;    // (Japanese keyboard)
  9443.   DIK_NUMPADEQUALS    = $8D;    // = on numeric keypad (NEC PC98)
  9444.   DIK_CIRCUMFLEX      = $90;    // (Japanese keyboard)
  9445.   DIK_AT              = $91;    //                     (NEC PC98)
  9446.   DIK_COLON           = $92;    //                     (NEC PC98)
  9447.   DIK_UNDERLINE       = $93;    //                     (NEC PC98)
  9448.   DIK_KANJI           = $94;    // (Japanese keyboard)
  9449.   DIK_STOP            = $95;    //                     (NEC PC98)
  9450.   DIK_AX              = $96;    //                     (Japan AX)
  9451.   DIK_UNLABELED       = $97;    //                        (J3100)
  9452.   DIK_NUMPADENTER     = $9C;    // Enter on numeric keypad
  9453.   DIK_RCONTROL        = $9D;
  9454.   DIK_NUMPADCOMMA     = $B3;    // , on numeric keypad (NEC PC98)
  9455.   DIK_DIVIDE          = $B5;    // / on numeric keypad
  9456.   DIK_SYSRQ           = $B7;
  9457.   DIK_RMENU           = $B8;    // right Alt
  9458.   DIK_HOME            = $C7;    // Home on arrow keypad
  9459.   DIK_UP              = $C8;    // UpArrow on arrow keypad
  9460.   DIK_PRIOR           = $C9;    // PgUp on arrow keypad
  9461.   DIK_LEFT            = $CB;    // LeftArrow on arrow keypad
  9462.   DIK_RIGHT           = $CD;    // RightArrow on arrow keypad
  9463.   DIK_END             = $CF;    // End on arrow keypad
  9464.   DIK_DOWN            = $D0;    // DownArrow on arrow keypad
  9465.   DIK_NEXT            = $D1;    // PgDn on arrow keypad
  9466.   DIK_INSERT          = $D2;    // Insert on arrow keypad
  9467.   DIK_DELETE          = $D3;    // Delete on arrow keypad
  9468.   DIK_LWIN            = $DB;    // Left Windows key
  9469.   DIK_RWIN            = $DC;    // Right Windows key
  9470.   DIK_APPS            = $DD;    // AppMenu key
  9471.  
  9472. //
  9473. //  Alternate names for keys, to facilitate transition from DOS.
  9474. //
  9475.   DIK_BACKSPACE       = DIK_BACK;            // backspace
  9476.   DIK_NUMPADSTAR      = DIK_MULTIPLY;        // * on numeric keypad
  9477.   DIK_LALT            = DIK_LMENU;           // left Alt
  9478.   DIK_CAPSLOCK        = DIK_CAPITAL;         // CapsLock
  9479.   DIK_NUMPADMINUS     = DIK_SUBTRACT;        // - on numeric keypad
  9480.   DIK_NUMPADPLUS      = DIK_ADD;             // + on numeric keypad
  9481.   DIK_NUMPADPERIOD    = DIK_DECIMAL;         // . on numeric keypad
  9482.   DIK_NUMPADSLASH     = DIK_DIVIDE;          // / on numeric keypad
  9483.   DIK_RALT            = DIK_RMENU;           // right Alt
  9484.   DIK_UPARROW         = DIK_UP;              // UpArrow on arrow keypad
  9485.   DIK_PGUP            = DIK_PRIOR;           // PgUp on arrow keypad
  9486.   DIK_LEFTARROW       = DIK_LEFT;            // LeftArrow on arrow keypad
  9487.   DIK_RIGHTARROW      = DIK_RIGHT;           // RightArrow on arrow keypad
  9488.   DIK_DOWNARROW       = DIK_DOWN;            // DownArrow on arrow keypad
  9489.   DIK_PGDN            = DIK_NEXT;            // PgDn on arrow keypad
  9490.  
  9491. { Joystick }
  9492.  
  9493. type
  9494.   PDIJoyState = ^TDIJoyState;
  9495.   TDIJoyState = record
  9496.     lX: Longint;                        // x-axis position
  9497.     lY: Longint;                        // y-axis position
  9498.     lZ: Longint;                        // z-axis position
  9499.     lRx: Longint;                       // x-axis rotation
  9500.     lRy: Longint;                       // y-axis rotation
  9501.     lRz: Longint;                       // z-axis rotation
  9502.     rglSlider: array[0..1] of Longint;  // extra axes positions
  9503.     rgdwPOV: array[0..3] of DWORD;      // POV directions
  9504.     rgbButtons: array[0..31] of BYTE;   // 32 buttons
  9505.   end;
  9506.  
  9507.   DIJOYSTATE = TDIJoyState;
  9508.  
  9509.   PDIJOYSTATE2 = ^TDIJoyState2;
  9510.   TDIJoyState2 = record
  9511.     lX: Longint;                        // x-axis position
  9512.     lY: Longint;                        // y-axis position
  9513.     lZ: Longint;                        // z-axis position
  9514.     lRx: Longint;                       // x-axis rotation
  9515.     lRy: Longint;                       // y-axis rotation
  9516.     lRz: Longint;                       // z-axis rotation
  9517.     rglSlider: array[0..1] of Longint;  // extra axes positions
  9518.     rgdwPOV: array[0..3] of DWORD;      // POV directions
  9519.     rgbButtons: array[0..127] of BYTE;  // 128 buttons
  9520.     lVX: Longint;                       // x-axis velocity
  9521.     lVY: Longint;                       // y-axis velocity
  9522.     lVZ: Longint;                       // z-axis velocity
  9523.     lVRx: Longint;                      // x-axis angular velocity
  9524.     lVRy: Longint;                      // y-axis angular velocity
  9525.     lVRz: Longint;                      // z-axis angular velocity
  9526.     rglVSlider: array[0..1] of Longint; // extra axes velocities
  9527.     lAX: Longint;                       // x-axis acceleration
  9528.     lAY: Longint;                       // y-axis acceleration
  9529.     lAZ: Longint;                       // z-axis acceleration
  9530.     lARx: Longint;                      // x-axis angular acceleration
  9531.     lARy: Longint;                      // y-axis angular acceleration
  9532.     lARz: Longint;                      // z-axis angular acceleration
  9533.     rglASlider: array[0..1] of Longint; // extra axes accelerations
  9534.     lFX: Longint;                       // x-axis force
  9535.     lFY: Longint;                       // y-axis force
  9536.     lFZ: Longint;                       // z-axis force
  9537.     lFRx: Longint;                      // x-axis torque
  9538.     lFRy: Longint;                      // y-axis torque
  9539.     lFRz: Longint;                      // z-axis torque
  9540.     rglFSlider: array[0..1] of Longint; // extra axes forces
  9541.   end;
  9542.  
  9543.   DIJOYSTATE2 = TDIJoyState2;
  9544.  
  9545. {const
  9546.   _c_dfDIJoystick_Objects: array[0..1] of TDIObjectDataFormat = (
  9547.     (  pguid: nil;
  9548.        dwOfs: 0;
  9549.        dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE;
  9550.        dwFlags: 0),
  9551.     (  pguid: nil;
  9552.        dwOfs: 48;
  9553.        dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE;
  9554.        dwFlags: 0)
  9555.   );
  9556.  
  9557.   c_dfDIJoystick: TDIDataFormat = (
  9558.       dwSize: Sizeof(c_dfDIJoystick);
  9559.       dwObjSize: Sizeof(TDIObjectDataFormat);
  9560.       dwFlags: DIDF_ABSAXIS;
  9561.       dwDataSize: SizeOf(DIJOYSTATE);
  9562.       dwNumObjs: High(_c_dfDIJoystick_Objects)+1;
  9563.       rgodf: @_c_dfDIJoystick_Objects);
  9564.  }
  9565. const
  9566.   DIJOFS_X            = 0;
  9567.   DIJOFS_Y            = 4;
  9568.   DIJOFS_Z            = 8;
  9569.   DIJOFS_RX           = 12;
  9570.   DIJOFS_RY           = 16;
  9571.   DIJOFS_RZ           = 20;
  9572.   DIJOFS_SLIDER       = 24;
  9573.   DIJOFS_POV          = 32;
  9574.   DIJOFS_BUTTON       = 48;
  9575.  
  9576. { IDirectInput }
  9577.  
  9578. const
  9579.   DIENUM_STOP     = 0;
  9580.   DIENUM_CONTINUE = 1;
  9581.  
  9582. type
  9583.  
  9584.   TDIEnumDevicesCallbackA = function(const lpddi: TDIDeviceInstanceA;
  9585.       pvRef: Pointer): HResult; stdcall;
  9586.   LPDIENUMDEVICESCALLBACKA = TDIEnumDevicesCallbackA;
  9587.  
  9588.   TDIEnumDevicesCallbackW = function(const lpddi: TDIDeviceInstanceW;
  9589.       pvRef: Pointer): HResult; stdcall;
  9590.   LPDIENUMDEVICESCALLBACKW = TDIEnumDevicesCallbackW;
  9591.  
  9592.   TDIEnumDevicesCallback = TDIEnumDevicesCallbackA;
  9593.   LPDIENUMDEVICESCALLBACK = TDIEnumDevicesCallback;
  9594.  
  9595. const
  9596.   DIEDFL_ALLDEVICES      = $00000000;
  9597.   DIEDFL_ATTACHEDONLY    = $00000001;
  9598.   DIEDFL_FORCEFEEDBACK   = $00000100;
  9599.   DIEDFL_INCLUDEALIASES  = $00010000;
  9600.   DIEDFL_INCLUDEPHANTOMS = $00020000;
  9601.  
  9602. type
  9603.   IDirectInputW = interface(IUnknown)
  9604.     ['{89521361-AA8A-11CF-BFC7-444553540000}']
  9605.     // IDirectInputW methods
  9606.     function CreateDevice(const rguid: TGUID;
  9607.         out lplpDirectInputDevice: IDirectInputDeviceW; pUnkOuter: IUnknown): HResult; stdcall;
  9608.     function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackW;
  9609.         pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  9610.     function GetDeviceStatus(var rguidInstance: TGUID): HResult; stdcall;
  9611.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall;
  9612.     function Initialize(hinst: THandle; dwVersion: DWORD): HResult; stdcall;
  9613.   end;
  9614.  
  9615.   IDirectInputA = interface(IUnknown)
  9616.     ['{89521360-AA8A-11CF-BFC7-444553540000}']
  9617.     // IDirectInputA methods
  9618.     function CreateDevice(const rguid: TGUID;
  9619.         out lplpDirectInputDevice: IDirectInputDeviceA; pUnkOuter: IUnknown): HResult; stdcall;
  9620.     function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackA;
  9621.         pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  9622.     function GetDeviceStatus(const rguidInstance: TGUID): HResult; stdcall;
  9623.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall;
  9624.     function Initialize(hinst: THandle; dwVersion: DWORD): HResult; stdcall;
  9625.   end;
  9626.  
  9627.   IDirectInput = IDirectInputA;
  9628.  
  9629.   IDirectInput2W = interface(IDirectInputW)
  9630.     ['{5944E663-AA8A-11CF-BFC7-444553540000}']
  9631.     // IDirectInput2W methods
  9632.     function FindDevice(Arg1: PGUID; Arg2: PWideChar; Arg3: PGUID): HResult; stdcall;
  9633.   end;
  9634.  
  9635.   IDirectInput2A = interface(IDirectInputA)
  9636.     ['{5944E662-AA8A-11CF-BFC7-444553540000}']
  9637.     // IDirectInput2A methods
  9638.     function FindDevice(Arg1: PGUID; Arg2: PAnsiChar; Arg3: PGUID): HResult; stdcall;
  9639.   end;
  9640.  
  9641.   IDirectInput2 = IDirectInput2A;
  9642.  
  9643.   IDirectInput7W = interface(IDirectInput2W)
  9644.     ['{9A4CB685-236D-11D3-8E9D-00C04F6844AE}']
  9645.     // IDirectInput7W methods
  9646.     function CreateDeviceEx(const rguid: TGUID; const riid: TGUID;
  9647.       out pvOut; pUnkOuter: IUnknown): HResult; stdcall;
  9648.   end;
  9649.  
  9650.   IDirectInput7A = interface(IDirectInput2A)
  9651.     ['{9A4CB684-236D-11D3-8E9D-00C04F6844AE}']
  9652.     // IDirectInput7A methods
  9653.     function CreateDeviceEx(const rguid: TGUID; const riid: TGUID;
  9654.       out pvOut; pUnkOuter: IUnknown): HResult; stdcall;
  9655.   end;
  9656.  
  9657.   IDirectInput7 = IDirectInput7A;
  9658.  
  9659. { Return Codes }
  9660.  
  9661. const
  9662.   DI_OK                         = HResult(S_OK);
  9663.   DI_NOTATTACHED                = HResult(S_FALSE);
  9664.   DI_BUFFEROVERFLOW             = HResult(S_FALSE);
  9665.   DI_PROPNOEFFECT               = HResult(S_FALSE);
  9666.   DI_NOEFFECT                   = HResult(S_FALSE);
  9667.   DI_POLLEDDEVICE               = HResult($00000002);
  9668.   DI_DOWNLOADSKIPPED            = HResult($00000003);
  9669.   DI_EFFECTRESTARTED            = HResult($00000004);
  9670.   DI_TRUNCATED                  = HResult($00000008);
  9671.   DI_TRUNCATEDANDRESTARTED      = HResult($0000000C);
  9672.  
  9673.   DIERR_OLDDIRECTINPUTVERSION   = HResult($8007047E);
  9674.   DIERR_BETADIRECTINPUTVERSION  = HResult($80070481);
  9675.   DIERR_BADDRIVERVER            = HResult($80070077);
  9676.   DIERR_DEVICENOTREG            = HResult(REGDB_E_CLASSNOTREG);
  9677.   DIERR_NOTFOUND                = HResult($80070002);
  9678.   DIERR_OBJECTNOTFOUND          = HResult($80070002);
  9679.   DIERR_INVALIDPARAM            = HResult(E_INVALIDARG);
  9680.   DIERR_NOINTERFACE             = HResult(E_NOINTERFACE);
  9681.   DIERR_GENERIC                 = HResult(E_FAIL);
  9682.   DIERR_OUTOFMEMORY             = HResult(E_OUTOFMEMORY);
  9683.   DIERR_UNSUPPORTED             = HResult(E_NOTIMPL);
  9684.   DIERR_NOTINITIALIZED          = HResult($80070015);
  9685.   DIERR_ALREADYINITIALIZED      = HResult($800704DF);
  9686.   DIERR_NOAGGREGATION           = HResult(CLASS_E_NOAGGREGATION);
  9687.   DIERR_OTHERAPPHASPRIO         = HResult(E_ACCESSDENIED);
  9688.   DIERR_INPUTLOST               = HResult($8007001E);
  9689.   DIERR_ACQUIRED                = HResult($800700AA);
  9690.   DIERR_NOTACQUIRED             = HResult($8007000C);
  9691.   DIERR_READONLY                = HResult(E_ACCESSDENIED);
  9692.   DIERR_HANDLEEXISTS            = HResult(E_ACCESSDENIED);
  9693.   DIERR_PENDING                 = HResult($80070007);
  9694.   DIERR_INSUFFICIENTPRIVS       = HResult($80040200);
  9695.   DIERR_DEVICEFULL              = HResult($80040201);
  9696.   DIERR_MOREDATA                = HResult($80040202);
  9697.   DIERR_NOTDOWNLOADED           = HResult($80040203);
  9698.   DIERR_HASEFFECTS              = HResult($80040204);
  9699.   DIERR_NOTEXCLUSIVEACQUIRED    = HResult($80040205);
  9700.   DIERR_INCOMPLETEEFFECT        = HResult($80040206);
  9701.   DIERR_NOTBUFFERED             = HResult($80040207);
  9702.   DIERR_EFFECTPLAYING           = HResult($80040208);
  9703.   DIERR_UNPLUGGED               = HResult($80040209);
  9704.   DIERR_REPORTFULL              = HResult($8004020A);
  9705.  
  9706.  
  9707. { Definitions for non-IDirectInput (VJoyD) features defined more recently
  9708.   than the current sdk files }
  9709.  
  9710.   JOY_PASSDRIVERDATA         = $10000000;
  9711.   JOY_HWS_ISHEADTRACKER      = $02000000;
  9712.   JOY_HWS_ISGAMEPORTDRIVER   = $04000000;
  9713.   JOY_HWS_ISANALOGPORTDRIVER = $08000000;
  9714.   JOY_HWS_AUTOLOAD           = $10000000;
  9715.   JOY_HWS_NODEVNODE          = $20000000;
  9716.   JOY_HWS_ISGAMEPORTEMULATOR = $40000000;
  9717.   JOY_US_VOLATILE            = $00000008;
  9718.  
  9719. { Definitions for non-IDirectInput (VJoyD) features defined more recently
  9720.   than the current ddk files }
  9721.  
  9722.   JOY_OEMPOLL_PASSDRIVERDATA = 7;
  9723.  
  9724. function DirectInputCreate(hinst: THandle; dwVersion: DWORD;
  9725.   out ppDI: IDirectInputA; punkOuter: IUnknown): HResult; stdcall;
  9726. function DirectInputCreateEx(hinst: THandle; dwVersion: DWORD;
  9727.   const riidltf: TGUID; out ppDI: IDirectInputA; punkOuter: IUnknown): HResult; stdcall;
  9728.  
  9729. (*==========================================================================;
  9730.  *
  9731.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  9732.  *
  9733.  *  File:       dplay.h
  9734.  *  Content:    DirectPlay include file
  9735.  *
  9736.  ***************************************************************************)
  9737.  
  9738. const
  9739. { GUIDS used by DirectPlay objects }
  9740.  
  9741.   CLSID_DirectPlay: TGUID = '{D1EB6D20-8923-11D0-9D97-00A0C90A43CB}';
  9742.  
  9743.   IID_IDirectPlay: TGUID = '{5454E9A0-DB65-11CE-921C-00AA006C4972}';
  9744.   IID_IDirectPlay2: TGUID = '{2B74F7C0-9154-11CF-A9CD-00AA006886E3}';
  9745.   IID_IDirectPlay2A: TGUID = '{9D460580-A822-11CF-960C-0080C7534E82}';
  9746.   IID_IDirectPlay3: TGUID = '{133EFE40-32DC-11D0-9CFB-00A0C90A43CB}';
  9747.   IID_IDirectPlay3A: TGUID = '{133EFE41-32DC-11D0-9CFB-00A0C90A43CB}';
  9748.   IID_IDirectPlay4: TGUID = '{0AB1C530-4745-11D1-A7A1-0000F803ABFC}';
  9749.   IID_IDirectPlay4A: TGUID = '{0AB1C531-4745-11D1-A7A1-0000F803ABFC}';
  9750.  
  9751. { GUIDS used by Service Providers shipped with DirectPlay
  9752.   Use these to identify Service Provider returned by EnumConnections }
  9753.  
  9754.   DPSPGUID_IPX: TGUID = '{685BC400-9D2C-11CF-A9CD-00AA006886E3}';
  9755.   DPSPGUID_TCPIP: TGUID = '{36E95EE0-8577-11CF-960C-0080C7534E82}';
  9756.   DPSPGUID_SERIAL: TGUID = '{0F1D6860-88D9-11CF-9C4E-00A0C905425E}';
  9757.   DPSPGUID_MODEM: TGUID = '{44EAA760-CB68-11CF-9C4E-00A0C905425E}';
  9758.  
  9759. { DirectPlay Structures }
  9760.  
  9761. type
  9762.   PDPID = ^TDPID;
  9763.   TDPID = DWORD;
  9764.  
  9765.   DPID = TDPID;
  9766.   LPDPID = PDPID;
  9767.  
  9768. const
  9769.   DPID_SYSMSG        = 0;          // DPID that system messages come from
  9770.   DPID_ALLPLAYERS    = 0;          // DPID representing all players in the session
  9771.   DPID_SERVERPLAYER  = 1;          // DPID representing the server player
  9772.   DPID_RESERVEDRANGE = 100;        // DPID representing the maxiumum ID in the range of DPID's reserved for
  9773.                                    // use by DirectPlay.
  9774.   DPID_UNKNOWN       = $FFFFFFFF;  // The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID)
  9775.  
  9776. type
  9777.   PDPCaps = ^TDPCaps;
  9778.   TDPCaps = record
  9779.     dwSize: DWORD;              // Size of structure, in bytes
  9780.     dwFlags: DWORD;             // DPCAPS_xxx flags
  9781.     dwMaxBufferSize: DWORD;     // Maximum message size, in bytes,  for this service provider
  9782.     dwMaxQueueSize: DWORD;      // Obsolete.
  9783.     dwMaxPlayers: DWORD;        // Maximum players/groups (local + remote)
  9784.     dwHundredBaud: DWORD;       // Bandwidth in 100 bits per second units;
  9785.                                 // i.e. 24 is 2400, 96 is 9600, etc.
  9786.     dwLatency: DWORD;           // Estimated latency; 0 = unknown
  9787.     dwMaxLocalPlayers: DWORD;   // Maximum # of locally created players allowed
  9788.     dwHeaderLength: DWORD;      // Maximum header length, in bytes, on messages
  9789.                                 // added by the service provider
  9790.     dwTimeout: DWORD;           // Service provider's suggested timeout value
  9791.                                 // This is how long DirectPlay will wait for
  9792.                                 // responses to system messages
  9793.   end;
  9794.  
  9795.   DPCAPS = TDPCaps;
  9796.   LPDPCAPS = PDPCaps;
  9797.  
  9798. const
  9799.   DPCAPS_ISHOST                  = $00000002;
  9800.   DPCAPS_GROUPOPTIMIZED          = $00000008;
  9801.   DPCAPS_KEEPALIVEOPTIMIZED      = $00000010;
  9802.   DPCAPS_GUARANTEEDOPTIMIZED     = $00000020;
  9803.   DPCAPS_GUARANTEEDSUPPORTED     = $00000040;
  9804.   DPCAPS_SIGNINGSUPPORTED        = $00000080;
  9805.   DPCAPS_ENCRYPTIONSUPPORTED     = $00000100;
  9806.   DPPLAYERCAPS_LOCAL             = $00000800;
  9807.   DPCAPS_ASYNCCANCELSUPPORTED    = $00001000;
  9808.   DPCAPS_ASYNCCANCELALLSUPPORTED = $00002000;
  9809.   DPCAPS_SENDTIMEOUTSUPPORTED    = $00004000;
  9810.   DPCAPS_SENDPRIORITYSUPPORTED   = $00008000;
  9811.   DPCAPS_ASYNCSUPPORTED          = $00010000;
  9812.  
  9813. type
  9814.   PDPSessionDesc2 = ^TDPSessionDesc2;
  9815.   TDPSessionDesc2 = record
  9816.     dwSize: DWORD;               // Size of structure
  9817.     dwFlags: DWORD;              // DPSESSION_xxx flags
  9818.     guidInstance: TGUID;         // ID for the session instance
  9819.     guidApplication: TGUID;      // GUID of the DirectPlay application.
  9820.                                  // GUID_NULL for all applications.
  9821.     dwMaxPlayers: DWORD;         // Maximum # players allowed in session
  9822.     dwCurrentPlayers: DWORD;     // Current # players in session (read only)
  9823.  
  9824.     case Integer of
  9825.       0: (
  9826.         lpszSessionName: LPWSTR; // Name of the session - Unicode
  9827.         lpszPassword: LPWSTR;    // Password of the session (optional) - Unicode
  9828.         dwReserved1: DWORD;      // Reserved for future MS use.
  9829.         dwReserved2: DWORD;
  9830.         dwUser1: DWORD;          // For use by the application
  9831.         dwUser2: DWORD;
  9832.         dwUser3: DWORD;
  9833.         dwUser4: DWORD;
  9834.         );
  9835.       1: (
  9836.         lpszSessionNameA: LPSTR; // Name of the session - ANSI
  9837.         lpszPasswordA: LPSTR;    // Password of the session (optional) - ANSI
  9838.         );
  9839.   end;
  9840.  
  9841.   DPSESSIONDESC2 = TDPSessionDesc2;
  9842.   LPDPSESSIONDESC2 = PDPSessionDesc2;
  9843.  
  9844. const
  9845.   DPSESSION_NEWPLAYERSDISABLED = $00000001;
  9846.   DPSESSION_MIGRATEHOST        = $00000004;
  9847.   DPSESSION_NOMESSAGEID        = $00000008;
  9848.   DPSESSION_JOINDISABLED       = $00000020;
  9849.   DPSESSION_KEEPALIVE          = $00000040;
  9850.   DPSESSION_NODATAMESSAGES     = $00000080;
  9851.   DPSESSION_SECURESERVER       = $00000100;
  9852.   DPSESSION_PRIVATE            = $00000200;
  9853.   DPSESSION_PASSWORDREQUIRED   = $00000400;
  9854.   DPSESSION_MULTICASTSERVER    = $00000800;
  9855.   DPSESSION_CLIENTSERVER       = $00001000;
  9856.   DPSESSION_DIRECTPLAYPROTOCOL = $00002000;
  9857.   DPSESSION_NOPRESERVEORDER    = $00004000;
  9858.   DPSESSION_OPTIMIZELATENCY    = $00008000;
  9859.  
  9860. type
  9861.   PDPName = ^TDPName;
  9862.   TDPName = record
  9863.     dwSize: DWORD;    // Size of structure
  9864.     dwFlags: DWORD;   // Not used. Must be zero.
  9865.     case Integer of
  9866.       0: (
  9867.         lpszShortName: LPWSTR; // The short or friendly name - Unicode
  9868.         lpszLongName: LPWSTR   // The long or formal name - Unicode
  9869.         );
  9870.       1: (
  9871.         lpszShortNameA: LPSTR; // The short or friendly name - ANSI
  9872.         lpszLongNameA: LPSTR   // The long or formal name - ANSI
  9873.         );
  9874.   end;
  9875.  
  9876.   DPNAME = TDPName;
  9877.   LPDPNAME = PDPName;
  9878.  
  9879. (*
  9880.  * TDPCredentials
  9881.  * Used to hold the user name and password of a DirectPlay user
  9882.  *)
  9883.  
  9884.   PDPCredentials = ^TDPCredentials;
  9885.   TDPCredentials = record
  9886.     dwSize: DWORD;    // Size of structure
  9887.     dwFlags: DWORD;   // Not used. Must be zero.
  9888.     case Integer of
  9889.       0: (
  9890.         lpszUsername: LPWSTR;   // User name of the account - Unicode
  9891.         lpszPassword: LPWSTR;   // Password of the account - Unicode
  9892.         lpszDomain: LPWSTR;     // Domain name of the account - Unicode
  9893.         );
  9894.       1: (
  9895.         lpszUsernameA: LPSTR;   // User name of the account - ANSI
  9896.         lpszPasswordA: LPSTR;   // Password of the account - ANSI
  9897.         lpszDomainA: LPSTR      // Domain name of the account - ANSI
  9898.         );
  9899.   end;
  9900.  
  9901.   DPCREDENTIALS = TDPCredentials;
  9902.   LPDPCREDENTIALS = PDPCredentials;
  9903.  
  9904. (*
  9905.  * DPSECURITYDESC
  9906.  * Used to describe the security properties of a DirectPlay
  9907.  * session instance
  9908.  *)
  9909.  
  9910.   PDPSecurityDesc = ^TDPSecurityDesc;
  9911.   TDPSecurityDesc = record
  9912.     dwSize: DWORD;                  // Size of structure
  9913.     dwFlags: DWORD;                 // Not used. Must be zero.
  9914.     case Integer of
  9915.       0: (
  9916.         lpszSSPIProvider: LPWSTR;     // SSPI provider name - Unicode
  9917.         lpszCAPIProvider: LPWSTR;     // CAPI provider name - Unicode
  9918.         dwCAPIProviderType: DWORD;    // Crypto Service Provider type
  9919.         dwEncryptionAlgorithm: DWORD; // Encryption Algorithm type
  9920.         );
  9921.       1: (
  9922.         lpszSSPIProviderA: LPSTR;     // SSPI provider name - ANSI
  9923.         lpszCAPIProviderA: LPSTR;     // CAPI provider name - ANSI
  9924.         );
  9925.   end;
  9926.  
  9927.   DPSECURITYDESC = TDPSecurityDesc;
  9928.   LPDPSECURITYDESC = PDPSecurityDesc;
  9929.  
  9930. (*
  9931.  * TDPAccountDesc
  9932.  * Used to describe a user membership account
  9933.  *)
  9934.   PDPAccountDesc = ^TDPAccountDesc;
  9935.   TDPAccountDesc = record
  9936.     dwSize: DWORD;    // Size of structure
  9937.     dwFlags: DWORD;   // Not used. Must be zero.
  9938.     case Integer of
  9939.       0: (
  9940.         lpszAccountID: LPWSTR;  // Account identifier - Unicode
  9941.         );
  9942.       1: (
  9943.         lpszAccountIDA: LPSTR;  // Account identifier - ANSI
  9944.         );
  9945.   end;
  9946.  
  9947.   DPACCOUNTDESC = TDPAccountDesc;
  9948.   LPDPACCOUNTDESC = PDPAccountDesc;
  9949.  
  9950. (*
  9951.  * TDPLConnection
  9952.  * Used to hold all in the informaion needed to connect
  9953.  * an application to a session or create a session
  9954.  *)
  9955.  
  9956.   PDPLConnection = ^TDPLConnection;
  9957.   TDPLConnection = record
  9958.     dwSize: DWORD;                     // Size of this structure
  9959.     dwFlags: DWORD;                    // Flags specific to this structure
  9960.     lpSessionDesc: PDPSessionDesc2;    // Pointer to session desc to use on connect
  9961.     lpPlayerName: PDPName;             // Pointer to Player name structure
  9962.     guidSP: TGUID;                     // GUID of the DPlay SP to use
  9963.     lpAddress: Pointer;                // Address for service provider
  9964.     dwAddressSize: DWORD;              // Size of address data
  9965.   end;
  9966.  
  9967.   DPLCONNECTION = TDPLConnection;
  9968.   LPDPLCONNECTION = PDPLConnection;
  9969.  
  9970. (*
  9971.  * TDPChat
  9972.  * Used to hold the a DirectPlay chat message
  9973.  *)
  9974.  
  9975.   PDPChat = ^TDPChat;
  9976.   TDPChat = record
  9977.     dwSize: DWORD;
  9978.     dwFlags: DWORD;
  9979.     case Integer of
  9980.       0: (
  9981.         lpszMessage: LPWSTR;  // Message string - Unicode
  9982.         );
  9983.       1: (
  9984.         lpszMessageA: LPSTR;  // Message string - ANSI
  9985.         );
  9986.   end;
  9987.  
  9988.   DPCHAT = TDPChat;
  9989.   LPDPCHAT = PDPChat;
  9990.  
  9991. (*
  9992.  * SGBUFFER
  9993.  * Scatter Gather Buffer used for SendEx
  9994.  *)
  9995.  
  9996.   PSGBuffer = ^TSGBuffer;
  9997.   TSGBuffer = record
  9998.     len: UINT;      // length of buffer data
  9999.     pData: PUChar;  // pointer to buffer data
  10000.   end;
  10001.  
  10002.   SGBUFFER = TSGBuffer;
  10003.   LPSGBUFFER = PSGBuffer;
  10004.  
  10005. { Prototypes for DirectPlay callback functions }
  10006.  
  10007. { Callback for IDirectPlay2::EnumSessions }
  10008.  
  10009.   TDPEnumSessionsCallback2 = function(const lpThisSD: TDPSessionDesc2;
  10010.       var lpdwTimeOut: DWORD; dwFlags: DWORD; lpContext: Pointer): BOOL; stdcall;
  10011.   LPDPENUMSESSIONSCALLBACK2 = TDPEnumSessionsCallback2;
  10012.  
  10013. const
  10014.   DPESC_TIMEDOUT = $00000001;
  10015.  
  10016. type
  10017.   TDPEnumPlayersCallback2 = function(dpId: TDPID; dwPlayerType: DWORD;
  10018.       const lpName: TDPName; dwFlags: DWORD; lpContext: Pointer): BOOL; stdcall;
  10019.   LPDPENUMPLAYERSCALLBACK2 = TDPEnumPlayersCallback2;
  10020.  
  10021.   TDPEnumDPCallback = function(const lpguidSP: TGUID; lpSPName: LPWSTR;
  10022.       dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer): BOOL; stdcall;
  10023.   LPDPENUMDPCALLBACK = TDPEnumDPCallback;
  10024.  
  10025.   TDPEnumDPCallbackA = function(const lpguidSP: TGUID; lpSPName: LPSTR;
  10026.       dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer): BOOL; stdcall;
  10027.   LPDPENUMDPCALLBACKA = TDPEnumDPCallbackA;
  10028.  
  10029.   TDPEnumConnectionsCallback = function(const lpguidSP: TGUID;
  10030.       lpConnection: Pointer; dwConnectionSize: DWORD; const lpName: TDPName;
  10031.       dwFlags: DWORD; lpContext: Pointer): BOOL; stdcall;
  10032.   LPDPENUMCONNECTIONSCALLBACK = TDPEnumConnectionsCallback;
  10033.  
  10034. { API's }
  10035.  
  10036. function DirectPlayEnumerateA(lpEnumDPCallback: TDPEnumDPCallbackA;
  10037.     lpContext: Pointer): HResult; stdcall;
  10038. function DirectPlayEnumerateW(lpEnumDPCallback: TDPEnumDPCallback;
  10039.     lpContext: Pointer): HResult; stdcall;
  10040. function DirectPlayEnumerate(lpEnumDPCallback: TDPEnumDPCallbackA;
  10041.     lpContext: Pointer): HResult; stdcall;
  10042.  
  10043.  
  10044. { IDirectPlay2 (and IDirectPlay2A) Interface }
  10045.  
  10046. type
  10047.   IDirectPlay2 = interface(IUnknown)
  10048.     ['{2B74F7C0-9154-11CF-A9CD-00AA006886E3}']
  10049.     // IDirectPlay2 methods
  10050.     function AddPlayerToGroup(idGroup: TDPID; idPlayer: TDPID): HResult; stdcall;
  10051.     function Close: HResult; stdcall;
  10052.     function CreateGroup(var lpidGroup: TDPID; const lpGroupName: TDPName;
  10053.         const lpData; dwDataSize: DWORD; dwFlags: DWORD): HResult; stdcall;
  10054.     function CreatePlayer(var lpidPlayer: TDPID; const pPlayerName: TDPName;
  10055.         hEvent: THandle; const lpData; dwDataSize: DWORD; dwFliags: DWORD): HResult; stdcall;
  10056.     function DeletePlayerFromGroup(idGroup: TDPID; idPlayer: TDPID): HResult; stdcall;
  10057.     function DestroyGroup(idGroup: TDPID): HResult; stdcall;
  10058.     function DestroyPlayer(idPlayer: TDPID): HResult; stdcall;
  10059.     function EnumGroupPlayers(idGroup: TDPID; const lpguidInstance: TGUID;
  10060.         lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
  10061.         dwFlags: DWORD): HResult; stdcall;
  10062.     function EnumGroups(const lpguidInstance: TGUID; lpEnumPlayersCallback2:
  10063.         LPDPENUMPLAYERSCALLBACK2; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  10064.     function EnumPlayers(const lpguidInstance: TGUID; lpEnumPlayersCallback2:
  10065.         LPDPENUMPLAYERSCALLBACK2; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  10066.     function EnumSessions(const lpsd: TDPSessionDesc2; dwTimeout: DWORD;
  10067.         lpEnumSessionsCallback2: TDPEnumSessionsCallback2; lpContext: Pointer;
  10068.         dwFlags: DWORD): HResult; stdcall;
  10069.     function GetCaps(var lpDPCaps: TDPCaps; dwFlags: DWORD): HResult; stdcall;
  10070.     function GetGroupData(idGroup: TDPID; var lpData; var lpdwDataSize: DWORD;
  10071.         dwFlags: DWORD): HResult; stdcall;
  10072.     function GetGroupName(idGroup: TDPID; var lpData; var lpdwDataSize: DWORD): HResult; stdcall;
  10073.     function GetMessageCount(idPlayer: TDPID; var lpdwCount: DWORD): HResult; stdcall;
  10074.     function GetPlayerAddress(idPlayer: TDPID; var lpAddress;
  10075.         var lpdwAddressSize: DWORD): HResult; stdcall;
  10076.     function GetPlayerCaps(idPlayer: TDPID; var lpPlayerCaps: TDPCaps;
  10077.         dwFlags: DWORD): HResult; stdcall;
  10078.     function GetPlayerData(idPlayer: TDPID; var lpData; var lpdwDataSize: DWORD;
  10079.         dwFlags: DWORD): HResult; stdcall;
  10080.     function GetPlayerName(idPlayer: TDPID; var lpData; var lpdwDataSize: DWORD): HResult; stdcall;
  10081.     function GetSessionDesc(var lpData; var lpdwDataSize: DWORD): HResult; stdcall;
  10082.     function Initialize(const lpGUID: TGUID): HResult; stdcall;
  10083.     function Open(var lpsd: TDPSessionDesc2; dwFlags: DWORD): HResult; stdcall;
  10084.     function Receive(var lpidFrom: TDPID; var lpidTo: TDPID; dwFlags: DWORD;
  10085.         var lpData; var lpdwDataSize: DWORD): HResult; stdcall;
  10086.     function Send(idFrom: TDPID; lpidTo: TDPID; dwFlags: DWORD; const lpData;
  10087.         lpdwDataSize: DWORD): HResult; stdcall;
  10088.     function SetGroupData(idGroup: TDPID; const lpData; dwDataSize: DWORD;
  10089.         dwFlags: DWORD): HResult; stdcall;
  10090.     function SetGroupName(idGroup: TDPID; const lpGroupName: TDPName;
  10091.         dwFlags: DWORD): HResult; stdcall;
  10092.     function SetPlayerData(idPlayer: TDPID; const lpData; dwDataSize: DWORD;
  10093.         dwFlags: DWORD): HResult; stdcall;
  10094.     function SetPlayerName(idPlayer: TDPID; const lpPlayerName: TDPName;
  10095.         dwFlags: DWORD): HResult; stdcall;
  10096.     function SetSessionDesc(const lpSessDesc: TDPSessionDesc2; dwFlags: DWORD): HResult; stdcall;
  10097.   end;
  10098.  
  10099.   IDirectPlay2A = interface(IDirectPlay2)
  10100.     ['{9D460580-A822-11CF-960C-0080C7534E82}']
  10101.   end;
  10102.  
  10103. { IDirectPlay3 (and IDirectPlay3A) Interface }
  10104.  
  10105.   IDirectPlay3 = interface(IDirectPlay2)
  10106.     ['{133EFE40-32DC-11D0-9CFB-00A0C90A43CB}']
  10107.     // IDirectPlay3 methods
  10108.     function AddGroupToGroup(idParentGroup: TDPID; idGroup: TDPID): HResult; stdcall;
  10109.     function CreateGroupInGroup(idParentGroup: TDPID; var lpidGroup: TDPID;
  10110.         var lpGroupName: TDPName; const lpData; dwDataSize: DWORD;
  10111.         dwFlags: DWORD): HResult; stdcall;
  10112.     function DeleteGroupFromGroup(idParentGroup: TDPID; idGroup: TDPID): HResult; stdcall;
  10113.     function EnumConnections(const lpguidApplication: TGUID;
  10114.         lpEnumCallback: TDPEnumConnectionsCallback; lpContext: Pointer;
  10115.         dwFlags: DWORD): HResult; stdcall;
  10116.     function EnumGroupsInGroup(idGroup: TDPID; const lpguidInstance: TGUID;
  10117.         lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
  10118.         dwFlags: DWORD): HResult; stdcall;
  10119.     function GetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
  10120.         var lpData; var lpdwDataSize: DWORD): HResult; stdcall;
  10121.     function InitializeConnection(lpConnection: Pointer; dwFlags: DWORD): HResult; stdcall;
  10122.     function SecureOpen(const lpsd: TDPSessionDesc2; dwFlags: DWORD;
  10123.         const lpSecurity: TDPSecurityDesc; const lpCredentials: TDPCredentials): HResult; stdcall;
  10124.     function SendChatMessage(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
  10125.         const lpChatMessage: TDPChat): HResult; stdcall;
  10126.     function SetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
  10127.         const lpConnection: TDPLConnection): HResult; stdcall;
  10128.     function StartSession(dwFlags: DWORD; idGroup: TDPID): HResult; stdcall;
  10129.     function GetGroupFlags(idGroup: TDPID; var lpdwFlags: DWORD): HResult; stdcall;
  10130.     function GetGroupParent(idGroup: TDPID; var lpidParent: TDPID): HResult; stdcall;
  10131.     function GetPlayerAccount(idPlayer: TDPID; dwFlags: DWORD; var lpData;
  10132.         var lpdwDataSize: DWORD): HResult; stdcall;
  10133.     function GetPlayerFlags(idPlayer: TDPID; var lpdwFlags: DWORD): HResult; stdcall;
  10134.   end;
  10135.  
  10136.   IDirectPlay3A = interface(IDirectPlay3)
  10137.     ['{133EFE41-32DC-11D0-9CFB-00A0C90A43CB}']
  10138.   end;
  10139.  
  10140. { IDirectPlay4 (and IDirectPlay4A) Interface }
  10141.  
  10142.   IDirectPlay4 = interface(IDirectPlay3)
  10143.     ['{0AB1C530-4745-11D1-A7A1-0000F803ABFC}']
  10144.     // IDirectPlay4 methods
  10145.     function GetGroupOwner(idGroup: TDPID; var idOwner: TDPID): HResult; stdcall;
  10146.     function SetGroupOwner(idGroup: TDPID; idOwner: TDPID): HResult; stdcall;
  10147.     function SendEx(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD; const pData;
  10148.         dwDataSize: DWORD; dwPriority: DWORD; dwTimeout: DWORD;
  10149.         lpContext: Pointer; lpdwMsgId: PDWORD): HResult; stdcall;
  10150.     function GetMessageQueue(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
  10151.         var lpdwNumMsgs: DWORD; var lpdwNumBytes: DWORD): HResult; stdcall;
  10152.     function CancelMessage(dwMessageID: DWORD; dwFlags: DWORD): HResult; stdcall;
  10153.     function CancelPriority(dwMinPriority: DWORD; dwMaxPriority: DWORD; dwFlags: DWORD): HResult; stdcall;
  10154.  end;
  10155.  
  10156.   IDirectPlay4A = interface(IDirectPlay4)
  10157.     ['{0AB1C531-4745-11D1-A7A1-0000F803ABFC}']
  10158.   end;
  10159.  
  10160. const
  10161. { EnumConnections API flags }
  10162.  
  10163.   DPCONNECTION_DIRECTPLAY      = $00000001;
  10164.   DPCONNECTION_DIRECTPLAYLOBBY = $00000002;
  10165.  
  10166. { EnumPlayers API flags }
  10167.  
  10168.   DPENUMPLAYERS_ALL          = $00000000;
  10169.   DPENUMGROUPS_ALL           = DPENUMPLAYERS_ALL;
  10170.   DPENUMPLAYERS_LOCAL        = $00000008;
  10171.   DPENUMGROUPS_LOCAL         = DPENUMPLAYERS_LOCAL;
  10172.   DPENUMPLAYERS_REMOTE       = $00000010;
  10173.   DPENUMGROUPS_REMOTE        = DPENUMPLAYERS_REMOTE;
  10174.   DPENUMPLAYERS_GROUP        = $00000020;
  10175.   DPENUMPLAYERS_SESSION      = $00000080;
  10176.   DPENUMGROUPS_SESSION       = DPENUMPLAYERS_SESSION;
  10177.   DPENUMPLAYERS_SERVERPLAYER = $00000100;
  10178.   DPENUMPLAYERS_SPECTATOR    = $00000200;
  10179.   DPENUMGROUPS_SHORTCUT      = $00000400;
  10180.   DPENUMGROUPS_STAGINGAREA   = $00000800;
  10181.   DPENUMGROUPS_HIDDEN        = $00001000;
  10182.   DPENUMPLAYERS_OWNER        = $00002000;
  10183.  
  10184. { CreatePlayer API flags }
  10185.  
  10186.   DPPLAYER_SERVERPLAYER = DPENUMPLAYERS_SERVERPLAYER;
  10187.   DPPLAYER_SPECTATOR    = DPENUMPLAYERS_SPECTATOR;
  10188.   DPPLAYER_LOCAL        = DPENUMPLAYERS_LOCAL;
  10189.   DPPLAYER_OWNER        = DPENUMPLAYERS_OWNER;
  10190.  
  10191. { CreateGroup API flags }
  10192.  
  10193.   DPGROUP_STAGINGAREA = DPENUMGROUPS_STAGINGAREA;
  10194.   DPGROUP_LOCAL       = DPENUMGROUPS_LOCAL;
  10195.   DPGROUP_HIDDEN      = DPENUMGROUPS_HIDDEN;
  10196.  
  10197. { EnumSessions API flags }
  10198.  
  10199.   DPENUMSESSIONS_AVAILABLE        = $00000001;
  10200.   DPENUMSESSIONS_ALL              = $00000002;
  10201.   DPENUMSESSIONS_ASYNC            = $00000010;
  10202.   DPENUMSESSIONS_STOPASYNC        = $00000020;
  10203.   DPENUMSESSIONS_PASSWORDREQUIRED = $00000040;
  10204.   DPENUMSESSIONS_RETURNSTATUS     = $00000080;
  10205.  
  10206. { GetCaps and GetPlayerCaps API flags }
  10207.  
  10208.   DPGETCAPS_GUARANTEED = $00000001;
  10209.  
  10210. { GetGroupData, GetPlayerData API flags }
  10211.  
  10212.   DPGET_REMOTE = $00000000;
  10213.   DPGET_LOCAL  = $00000001;
  10214.  
  10215. { Open API flags }
  10216.  
  10217.   DPOPEN_JOIN         = $00000001;
  10218.   DPOPEN_CREATE       = $00000002;
  10219.   DPOPEN_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
  10220.  
  10221. { TDPLConnection flags }
  10222.  
  10223.   DPLCONNECTION_CREATESESSION = DPOPEN_CREATE;
  10224.   DPLCONNECTION_JOINSESSION   = DPOPEN_JOIN;
  10225.  
  10226. { Receive API flags }
  10227.  
  10228.   DPRECEIVE_ALL        = $00000001;
  10229.   DPRECEIVE_TOPLAYER   = $00000002;
  10230.   DPRECEIVE_FROMPLAYER = $00000004;
  10231.   DPRECEIVE_PEEK       = $00000008;
  10232.  
  10233. { Send API flags }
  10234.  
  10235.   DPSEND_GUARANTEED         = $00000001;
  10236.   DPSEND_HIGHPRIORITY       = $00000002;
  10237.   DPSEND_OPENSTREAM         = $00000008;
  10238.   DPSEND_CLOSESTREAM        = $00000010;
  10239.   DPSEND_SIGNED             = $00000020;
  10240.   DPSEND_ENCRYPTED          = $00000040;
  10241.   DPSEND_LOBBYSYSTEMMESSAGE = $00000080;
  10242.   DPSEND_ASYNC              = $00000200;
  10243.   DPSEND_NOSENDCOMPLETEMSG  = $00000400;
  10244.   DPSEND_MAX_PRI            = $0000FFFF;
  10245.   DPSEND_MAX_PRIORITY       = DPSEND_MAX_PRI;
  10246.  
  10247. { SetGroupData, SetGroupName, SetPlayerData, SetPlayerName,
  10248.   SetSessionDesc API flags. }
  10249.  
  10250.   DPSET_REMOTE     = $00000000;
  10251.   DPSET_LOCAL      = $00000001;
  10252.   DPSET_GUARANTEED = $00000002;
  10253.  
  10254. { GetMessageQueue API flags. }
  10255.  
  10256.   DPMESSAGEQUEUE_SEND    = $00000001; // Default
  10257.   DPMESSAGEQUEUE_RECEIVE = $00000002; // Default
  10258.  
  10259. { Connect API flags }
  10260.  
  10261.   DPCONNECT_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
  10262.  
  10263. { DirectPlay system messages and message data structures }
  10264.  
  10265.   DPSYS_CREATEPLAYERORGROUP   = $0003;
  10266.   DPSYS_DESTROYPLAYERORGROUP  = $0005;
  10267.   DPSYS_ADDPLAYERTOGROUP      = $0007;
  10268.   DPSYS_DELETEPLAYERFROMGROUP = $0021;
  10269.   DPSYS_SESSIONLOST           = $0031;
  10270.   DPSYS_HOST                  = $0101;
  10271.   DPSYS_SETPLAYERORGROUPDATA  = $0102;
  10272.   DPSYS_SETPLAYERORGROUPNAME  = $0103;
  10273.   DPSYS_SETSESSIONDESC        = $0104;
  10274.   DPSYS_ADDGROUPTOGROUP       = $0105;
  10275.   DPSYS_DELETEGROUPFROMGROUP  = $0106;
  10276.   DPSYS_SECUREMESSAGE         = $0107;
  10277.   DPSYS_STARTSESSION          = $0108;
  10278.   DPSYS_CHAT                  = $0109;
  10279.   DPSYS_SETGROUPOWNER         = $010A;
  10280.   DPSYS_SENDCOMPLETE          = $010d;
  10281.  
  10282.  
  10283. { Used in the dwPlayerType field to indicate if it applies to a group or a player}
  10284.  
  10285.   DPPLAYERTYPE_GROUP          = $00000000;
  10286.   DPPLAYERTYPE_PLAYER         = $00000001;
  10287.  
  10288. { TDPMsg_Generic }
  10289.  
  10290. type
  10291.   PDPMsg_Generic = ^TDPMsg_Generic;
  10292.   TDPMsg_Generic = record
  10293.     dwType: DWORD;   // Message type
  10294.   end;
  10295.  
  10296.   DPMSG_GENERIC = TDPMsg_Generic;
  10297.   LPDPMSG_GENERIC = PDPMsg_Generic;
  10298.  
  10299. { TDPMsg_CreatePlayerOrGroup }
  10300.  
  10301.   PDPMsg_CreatePlayerOrGroup = ^TDPMsg_CreatePlayerOrGroup;
  10302.   TDPMsg_CreatePlayerOrGroup = record
  10303.     dwType: DWORD;             // Message type
  10304.     dwPlayerType: DWORD;       // Is it a player or group
  10305.     dpId: TDPID;                // ID of the player or group
  10306.     dwCurrentPlayers: DWORD;   // current # players & groups in session
  10307.     lpData: Pointer;           // pointer to remote data
  10308.     dwDataSize: DWORD;         // size of remote data
  10309.     dpnName: TDPName;           // structure with name info
  10310.                                // the following fields are only available when using
  10311.                                // the IDirectPlay3 interface or greater
  10312.     dpIdParent: TDPID;          // id of parent group
  10313.     dwFlags: DWORD;            // player or group flags
  10314.   end;
  10315.  
  10316.   DPMSG_CREATEPLAYERORGROUP = TDPMsg_CreatePlayerOrGroup;
  10317.   LPDPMSG_CREATEPLAYERORGROUP = PDPMsg_CreatePlayerOrGroup;
  10318.  
  10319. { TDPMsg_DestroyPlayerOrGroup }
  10320.  
  10321.   PDPMsg_DestroyPlayerOrGroup = ^TDPMsg_DestroyPlayerOrGroup;
  10322.   TDPMsg_DestroyPlayerOrGroup = record
  10323.     dwType: DWORD;             // Message type
  10324.     dwPlayerType: DWORD;       // Is it a player or group
  10325.     dpId: TDPID;                // player ID being deleted
  10326.     lpLocalData: Pointer;      // copy of players local data
  10327.     dwLocalDataSize: DWORD;    // sizeof local data
  10328.     lpRemoteData: Pointer;     // copy of players remote data
  10329.     dwRemoteDataSize: DWORD;   // sizeof remote data
  10330.                                // the following fields are only available when using
  10331.                                // the IDirectPlay3 interface or greater
  10332.     dpnName: TDPName;           // structure with name info
  10333.     dpIdParent: TDPID;          // id of parent group
  10334.     dwFlags: DWORD;            // player or group flags
  10335.   end;
  10336.  
  10337.   DPMSG_DESTROYPLAYERORGROUP = TDPMsg_DestroyPlayerOrGroup;
  10338.   LPDPMSG_DESTROYPLAYERORGROUP = PDPMsg_DestroyPlayerOrGroup;
  10339.  
  10340. { TDPMsg_AddPlayerOrGroup }
  10341.  
  10342.   PDPMsg_AddPlayerOrGroup = ^TDPMsg_AddPlayerOrGroup;
  10343.   TDPMsg_AddPlayerOrGroup = record
  10344.     dwType: DWORD;      // Message type
  10345.     dpIdGroup: TDPID;    // group ID being added to
  10346.     dpIdPlayer: TDPID;   // player ID being added
  10347.   end;
  10348.  
  10349.   DPMSG_ADDPLAYERTOGROUP = TDPMsg_AddPlayerOrGroup;
  10350.   LPDPMSG_ADDPLAYERTOGROUP = PDPMsg_AddPlayerOrGroup;
  10351.  
  10352. { TDPMsg_DeletePlayerFromGroup }
  10353.  
  10354.   TDPMsg_DeletePlayerFromGroup = TDPMsg_AddPlayerOrGroup;
  10355.   PDPMsg_DeletePlayerFromGroup = PDPMsg_AddPlayerOrGroup;
  10356.  
  10357.   DPMSG_DELETEPLAYERFROMGROUP = TDPMsg_DeletePlayerFromGroup;
  10358.   LPDPMSG_DELETEPLAYERFROMGROUP = PDPMsg_DeletePlayerFromGroup;
  10359.  
  10360. { TDPMsg_AddGroupToGroup }
  10361.  
  10362.   PDPMsg_AddGroupToGroup = ^TDPMsg_AddGroupToGroup;
  10363.   TDPMsg_AddGroupToGroup = record
  10364.     dwType: DWORD;           // Message type
  10365.     dpIdParentGroup: TDPID;   // group ID being added to
  10366.     dpIdGroup: TDPID;         // group ID being added
  10367.   end;
  10368.  
  10369.   DPMSG_ADDGROUPTOGROUP = TDPMsg_AddGroupToGroup;
  10370.   LPDPMSG_ADDGROUPTOGROUP = PDPMsg_AddGroupToGroup;
  10371.  
  10372. { TDPMsg_DeleteGroupFromGroup }
  10373.  
  10374.   TDPMsg_DeleteGroupFromGroup = TDPMsg_AddGroupToGroup;
  10375.   PDPMsg_DeleteGroupFromGroup = PDPMsg_AddGroupToGroup;
  10376.  
  10377.   DPMSG_DELETEGROUPFROMGROUP = TDPMsg_DeleteGroupFromGroup;
  10378.   LPDPMSG_DELETEGROUPFROMGROUP = PDPMsg_DeleteGroupFromGroup;
  10379.  
  10380. { TDPMsg_SetPlayerOrGroupData }
  10381.  
  10382.   PDPMsg_SetPlayerOrGroupData = ^TDPMsg_SetPlayerOrGroupData;
  10383.   TDPMsg_SetPlayerOrGroupData = record
  10384.     dwType: DWORD;         // Message type
  10385.     dwPlayerType: DWORD;   // Is it a player or group
  10386.     dpId: TDPID;            // ID of player or group
  10387.     lpData: Pointer;       // pointer to remote data
  10388.     dwDataSize: DWORD;     // size of remote data
  10389.   end;
  10390.  
  10391.   DPMSG_SETPLAYERORGROUPDATA = TDPMsg_SetPlayerOrGroupData;
  10392.   LPDPMSG_SETPLAYERORGROUPDATA = PDPMsg_SetPlayerOrGroupData;
  10393.  
  10394. { TDPMsg_SetPlayerOrGroupName }
  10395.  
  10396.   PDPMsg_SetPlayerOrGroupName = ^TDPMsg_SetPlayerOrGroupName;
  10397.   TDPMsg_SetPlayerOrGroupName = record
  10398.     dwType: DWORD;         // Message type
  10399.     dwPlayerType: DWORD;   // Is it a player or group
  10400.     dpId: TDPID;            // ID of player or group
  10401.     dpnName: TDPName;       // structure with new name info
  10402.   end;
  10403.  
  10404.   DPMSG_SETPLAYERORGROUPNAME = TDPMsg_SetPlayerOrGroupName;
  10405.   LPDPMSG_SETPLAYERORGROUPNAME = PDPMsg_SetPlayerOrGroupName;
  10406.  
  10407. { TDPMsg_SetSessionDesc }
  10408.  
  10409.   PDPMsg_SetSessionDesc = ^TDPMsg_SetSessionDesc;
  10410.   TDPMsg_SetSessionDesc = record
  10411.     dwType: DWORD;            // Message type
  10412.     dpDesc: TDPSessionDesc2;   // Session desc
  10413.   end;
  10414.  
  10415.   DPMSG_SETSESSIONDESC = TDPMsg_SetSessionDesc;
  10416.   LPDPMSG_SETSESSIONDESC = PDPMsg_SetSessionDesc;
  10417.  
  10418. { TDPMsg_Host }
  10419.  
  10420.   PDPMsg_Host = ^TDPMsg_Host;
  10421.   TDPMsg_Host = TDPMsg_Generic;
  10422.  
  10423.   DPMSG_HOST = TDPMsg_Host;
  10424.   LPDPMSG_HOST = PDPMsg_Host;
  10425.  
  10426. { TDPMsg_SessionLost }
  10427.  
  10428.   PDPMsg_SessionLost = ^TDPMsg_SessionLost;
  10429.   TDPMsg_SessionLost = TDPMsg_Generic;
  10430.  
  10431.   DPMSG_SESSIONLOST = TDPMsg_SessionLost;
  10432.   LPDPMSG_SESSIONLOST = PDPMsg_SessionLost;
  10433.  
  10434. { TDPMsg_SecureMessage }
  10435.  
  10436.   PDPMsg_SecureMessage = ^TDPMsg_SecureMessage;
  10437.   TDPMsg_SecureMessage = record
  10438.     dwType: DWORD;       // Message Type
  10439.     dwFlags: DWORD;      // Signed/Encrypted
  10440.     dpIdFrom: TDPID;      // ID of Sending Player
  10441.     lpData: Pointer;     // Player message
  10442.     dwDataSize: DWORD;   // Size of player message
  10443.   end;
  10444.  
  10445.   DPMSG_SECUREMESSAGE = TDPMsg_SecureMessage;
  10446.   LPDPMSG_SECUREMESSAGE = PDPMsg_SecureMessage;
  10447.  
  10448. { TDPMsg_StartSession }
  10449.  
  10450.   PDPMsg_StartSession = ^TDPMsg_StartSession;
  10451.   TDPMsg_StartSession = record
  10452.     dwType: DWORD;             // Message type
  10453.     lpConn: PDPLConnection;    // TDPLConnection structure
  10454.   end;
  10455.  
  10456.   DPMSG_STARTSESSION = TDPMsg_StartSession;
  10457.   LPDPMSG_STARTSESSION = PDPMsg_StartSession;
  10458.  
  10459. { TDPMsg_Chat }
  10460.  
  10461.   PDPMsg_Chat = ^TDPMsg_Chat;
  10462.   TDPMsg_Chat = record
  10463.     dwType: DWORD;        // Message type
  10464.     dwFlags: DWORD;       // Message flags
  10465.     idFromPlayer: TDPID;  // ID of the Sending Player
  10466.     idToPlayer: TDPID;    // ID of the To Player
  10467.     idToGroup: TDPID;     // ID of the To Group
  10468.     lpChat: PDPChat;      // Pointer to a structure containing the chat message
  10469.   end;
  10470.  
  10471.   DPMSG_CHAT = TDPMsg_Chat;
  10472.   LPDPMSG_CHAT = PDPMsg_Chat;
  10473.  
  10474. { TDPMsg_SetGroupOwner }
  10475.  
  10476.   PDPMsg_SetGroupOwner = ^TDPMsg_SetGroupOwner;
  10477.   TDPMsg_SetGroupOwner = record
  10478.     dwType: DWORD;        // Message type
  10479.     idGroup: TDPID;       // ID of the group
  10480.     idNewOwner: TDPID;    // ID of the player that is the new owner
  10481.     idOldOwner: TDPID;    // ID of the player that used to be the owner
  10482.   end;
  10483.  
  10484.   DPMSG_SETGROUPOWNER = TDPMsg_SetGroupOwner;
  10485.   LPDPMSG_SETGROUPOWNER = PDPMsg_SetGroupOwner;
  10486.  
  10487. { TDPMsg_SendComplete }
  10488.  
  10489.   PDPMsg_SendComplete= ^TDPMsg_SendComplete;
  10490.   TDPMsg_SendComplete = record
  10491.     dwType: DWORD;        // Message type
  10492.     idFrom: TDPID;
  10493.     idTo: TDPID;
  10494.     dwFlags: DWORD;
  10495.     dwPriority: DWORD;
  10496.     dwTimeout: DWORD;
  10497.     lpvContext: Pointer;
  10498.     dwMsgID: DWORD;
  10499.     hr: HRESULT;
  10500.     dwSendTime: DWORD;
  10501.   end;
  10502.  
  10503.   DPMSG_SENDCOMPLETE = TDPMsg_SendComplete;
  10504.   LPDPMSG_SENDCOMPLETE = PDPMsg_SendComplete;
  10505.  
  10506. { DIRECTPLAY ERRORS }
  10507. const
  10508.   DP_OK                         = HResult(S_OK);
  10509.   DPERR_ALREADYINITIALIZED      = HResult($88770000 + 5);
  10510.   DPERR_ACCESSDENIED            = HResult($88770000 + 10);
  10511.   DPERR_ACTIVEPLAYERS           = HResult($88770000 + 20);
  10512.   DPERR_BUFFERTOOSMALL          = HResult($88770000 + 30);
  10513.   DPERR_CANTADDPLAYER           = HResult($88770000 + 40);
  10514.   DPERR_CANTCREATEGROUP         = HResult($88770000 + 50);
  10515.   DPERR_CANTCREATEPLAYER        = HResult($88770000 + 60);
  10516.   DPERR_CANTCREATESESSION       = HResult($88770000 + 70);
  10517.   DPERR_CAPSNOTAVAILABLEYET     = HResult($88770000 + 80);
  10518.   DPERR_EXCEPTION               = HResult($88770000 + 90);
  10519.   DPERR_GENERIC                 = HResult(E_FAIL);
  10520.   DPERR_INVALIDFLAGS            = HResult($88770000 + 120);
  10521.   DPERR_INVALIDOBJECT           = HResult($88770000 + 130);
  10522.   DPERR_INVALIDPARAM            = HResult(E_INVALIDARG);
  10523.   DPERR_INVALIDPARAMS           = HResult(DPERR_INVALIDPARAM);
  10524.   DPERR_INVALIDPLAYER           = HResult($88770000 + 150);
  10525.   DPERR_INVALIDGROUP            = HResult($88770000 + 155);
  10526.   DPERR_NOCAPS                  = HResult($88770000 + 160);
  10527.   DPERR_NOCONNECTION            = HResult($88770000 + 170);
  10528.   DPERR_NOMEMORY                = HResult(E_OUTOFMEMORY);
  10529.   DPERR_OUTOFMEMORY             = HResult(DPERR_NOMEMORY);
  10530.   DPERR_NOMESSAGES              = HResult($88770000 + 190);
  10531.   DPERR_NONAMESERVERFOUND       = HResult($88770000 + 200);
  10532.   DPERR_NOPLAYERS               = HResult($88770000 + 210);
  10533.   DPERR_NOSESSIONS              = HResult($88770000 + 220);
  10534.   DPERR_PENDING                 = HResult(E_PENDING);
  10535.   DPERR_SENDTOOBIG              = HResult($88770000 + 230);
  10536.   DPERR_TIMEOUT                 = HResult($88770000 + 240);
  10537.   DPERR_UNAVAILABLE             = HResult($88770000 + 250);
  10538.   DPERR_UNSUPPORTED             = HResult(E_NOTIMPL);
  10539.   DPERR_BUSY                    = HResult($88770000 + 270);
  10540.   DPERR_USERCANCEL              = HResult($88770000 + 280);
  10541.   DPERR_NOINTERFACE             = HResult(E_NOINTERFACE);
  10542.   DPERR_CANNOTCREATESERVER      = HResult($88770000 + 290);
  10543.   DPERR_PLAYERLOST              = HResult($88770000 + 300);
  10544.   DPERR_SESSIONLOST             = HResult($88770000 + 310);
  10545.   DPERR_UNINITIALIZED           = HResult($88770000 + 320);
  10546.   DPERR_NONEWPLAYERS            = HResult($88770000 + 330);
  10547.   DPERR_INVALIDPASSWORD         = HResult($88770000 + 340);
  10548.   DPERR_CONNECTING              = HResult($88770000 + 350);
  10549.   DPERR_CONNECTIONLOST          = HResult($88770000 + 360);
  10550.   DPERR_UNKNOWNMESSAGE          = HResult($88770000 + 370);
  10551.   DPERR_CANCELFAILED            = HResult($88770000 + 380);
  10552.   DPERR_INVALIDPRIORITY         = HResult($88770000 + 390);
  10553.   DPERR_NOTHANDLED              = HResult($88770000 + 400);
  10554.   DPERR_CANCELLED               = HResult($88770000 + 410);
  10555.   DPERR_ABORTED                 = HResult($88770000 + 420);
  10556.   DPERR_BUFFERTOOLARGE          = HResult($88770000 + 1000);
  10557.   DPERR_CANTCREATEPROCESS       = HResult($88770000 + 1010);
  10558.   DPERR_APPNOTSTARTED           = HResult($88770000 + 1020);
  10559.   DPERR_INVALIDINTERFACE        = HResult($88770000 + 1030);
  10560.   DPERR_NOSERVICEPROVIDER       = HResult($88770000 + 1040);
  10561.   DPERR_UNKNOWNAPPLICATION      = HResult($88770000 + 1050);
  10562.   DPERR_NOTLOBBIED              = HResult($88770000 + 1070);
  10563.   DPERR_SERVICEPROVIDERLOADED   = HResult($88770000 + 1080);
  10564.   DPERR_ALREADYREGISTERED       = HResult($88770000 + 1090);
  10565.   DPERR_NOTREGISTERED           = HResult($88770000 + 1100);
  10566.  
  10567. { Security related errors }
  10568.  
  10569.   DPERR_AUTHENTICATIONFAILED    = HResult($88770000 + 2000);
  10570.   DPERR_CANTLOADSSPI            = HResult($88770000 + 2010);
  10571.   DPERR_ENCRYPTIONFAILED        = HResult($88770000 + 2020);
  10572.   DPERR_SIGNFAILED              = HResult($88770000 + 2030);
  10573.   DPERR_CANTLOADSECURITYPACKAGE = HResult($88770000 + 2040);
  10574.   DPERR_ENCRYPTIONNOTSUPPORTED  = HResult($88770000 + 2050);
  10575.   DPERR_CANTLOADCAPI            = HResult($88770000 + 2060);
  10576.   DPERR_NOTLOGGEDIN             = HResult($88770000 + 2070);
  10577.   DPERR_LOGONDENIED             = HResult($88770000 + 2080);
  10578.  
  10579. // define this to ignore obsolete interfaces and constants
  10580.  
  10581.   DPOPEN_OPENSESSION   = DPOPEN_JOIN;
  10582.   DPOPEN_CREATESESSION = DPOPEN_CREATE;
  10583.  
  10584.   DPENUMSESSIONS_PREVIOUS = $00000004;
  10585.  
  10586.   DPENUMPLAYERS_PREVIOUS = $00000004;
  10587.  
  10588.   DPSEND_GUARANTEE = DPSEND_GUARANTEED;
  10589.   DPSEND_TRYONCE   = $00000004;
  10590.  
  10591.   DPCAPS_NAMESERVICE = $00000001;
  10592.   DPCAPS_NAMESERVER  = DPCAPS_ISHOST;
  10593.   DPCAPS_GUARANTEED  = $00000004;
  10594.  
  10595.   DPLONGNAMELEN    = 52;
  10596.   DPSHORTNAMELEN   = 20;
  10597.   DPSESSIONNAMELEN = 32;
  10598.   DPPASSWORDLEN    = 16;
  10599.   DPUSERRESERVED   = 16;
  10600.  
  10601.   DPSYS_ADDPLAYER    = $0003;
  10602.   DPSYS_DELETEPLAYER = $0005;
  10603.  
  10604.   DPSYS_DELETEGROUP         = $0020;
  10605.   DPSYS_DELETEPLAYERFROMGRP = $0021;
  10606.   DPSYS_CONNECT             = $484b;
  10607.  
  10608. { TDPMsg_AddPlayer }
  10609.  
  10610. type
  10611.   PDPMsg_AddPlayer = ^TDPMsg_AddPlayer;
  10612.   TDPMsg_AddPlayer = record
  10613.     dwType: DWORD;
  10614.     dwPlayerType: DWORD;
  10615.     dpId: TDPID;
  10616.     szLongName: array[0..DPLONGNAMELEN-1] of Char;
  10617.     szShortName: array[0..DPSHORTNAMELEN-1] of Char;
  10618.     dwCurrentPlayers: DWORD;
  10619.   end;
  10620.  
  10621.   DPMSG_ADDPLAYER = TDPMsg_AddPlayer;
  10622.   LPDPMSG_ADDPLAYER = PDPMsg_AddPlayer;
  10623.  
  10624. { TDPMsg_AddGroup }
  10625.  
  10626.   PDPMsg_AddGroup = ^TDPMsg_AddGroup;
  10627.   TDPMsg_AddGroup = TDPMsg_AddPlayer;
  10628.  
  10629.   DPMSG_ADDGROUP = TDPMsg_AddGroup;
  10630.   LPDPMSG_ADDGROUP = PDPMsg_AddGroup;
  10631.  
  10632. { TDPMsg_GroupAdd }
  10633.  
  10634.   PDPMsg_GroupAdd = ^TDPMsg_GroupAdd;
  10635.   TDPMsg_GroupAdd = record
  10636.     dwType: DWORD;
  10637.     dpIdGroup: TDPID;
  10638.     dpIdPlayer: TDPID;
  10639.   end;
  10640.  
  10641.   DPMSG_GROUPADD = TDPMsg_GroupAdd;
  10642.   LPDPMSG_GROUPADD = PDPMsg_GroupAdd;
  10643.  
  10644. { TDPMsg_GroupDelete }
  10645.  
  10646.   PDPMsg_GroupDelete = ^TDPMsg_GroupDelete;
  10647.   TDPMsg_GroupDelete = TDPMsg_GroupAdd;
  10648.  
  10649.   DPMSG_GROUPDELETE = TDPMsg_GroupDelete;
  10650.   LPDPMSG_GROUPDELETE = PDPMsg_GroupDelete;
  10651.  
  10652. { TDPMsg_DeletePlayer }
  10653.  
  10654.   PDPMsg_DeletePlayer = ^TDPMsg_DeletePlayer;
  10655.   TDPMsg_DeletePlayer = record
  10656.     dwType: DWORD;
  10657.     dpId: TDPID;
  10658.   end;
  10659.  
  10660.   DPMSG_DELETEPLAYER = TDPMsg_DeletePlayer;
  10661.   LPDPMSG_DELETEPLAYER = PDPMsg_DeletePlayer;
  10662.  
  10663. { TDPEnumPlayersCallback }
  10664.  
  10665.   TDPEnumPlayersCallback = function(dpId: TDPID; lpFriendlyName: LPSTR;
  10666.       lpFormalName: LPSTR; dwFlags: DWORD; lpContext: Pointer): BOOL; stdcall;
  10667.   LPDPENUMPLAYERSCALLBACK = TDPEnumPlayersCallback;
  10668.  
  10669. { TDPSessionDesc }
  10670.  
  10671.   PDPSessionDesc = ^TDPSessionDesc;
  10672.   TDPSessionDesc = record
  10673.     dwSize: DWORD;
  10674.     guidSession: TGUID;
  10675.     dwSession: DWORD;
  10676.     dwMaxPlayers: DWORD;
  10677.     dwCurrentPlayers: DWORD;
  10678.     dwFlags: DWORD;
  10679.     szSessionName: array[0..DPSESSIONNAMELEN-1] of char;
  10680.     szUserField: array[0..DPUSERRESERVED-1] of char;
  10681.     dwReserved1: DWORD;
  10682.     szPassword: array[0..DPPASSWORDLEN-1] of char;
  10683.     dwReserved2: DWORD;
  10684.     dwUser1: DWORD;
  10685.     dwUser2: DWORD;
  10686.     dwUser3: DWORD;
  10687.     dwUser4: DWORD;
  10688.   end;
  10689.  
  10690.   DPSESSIONDESC = TDPSessionDesc;
  10691.   LPDPSESSIONDESC = PDPSessionDesc;
  10692.  
  10693. { TDPEnumSessionsCallback }
  10694.  
  10695.   TDPEnumSessionsCallback = function(var lpDPSessionDesc: TDPSessionDesc;
  10696.       lpContext: Pointer; var lpdwTimeOut: DWORD; dwFlags: DWORD): BOOL; stdcall;
  10697.   LPDPENUMSESSIONSCALLBACK = TDPEnumSessionsCallback;
  10698.  
  10699. type
  10700.   IDirectPlay = interface(IUnknown)
  10701.     // IDirectPlay methods
  10702.     function AddPlayerToGroup(pidGroup: TDPID; pidPlayer: TDPID): HResult; stdcall;
  10703.     function Close: HResult; stdcall;
  10704.     function CreatePlayer(var lppidID: TDPID; lpPlayerFriendlyName: LPSTR;
  10705.         lpPlayerFormalName: LPSTR; lpEvent: PHandle): HResult; stdcall;
  10706.     function CreateGroup(var lppidID: TDPID; lpGroupFriendlyName: LPSTR;
  10707.         lpGroupFormalName: LPSTR): HResult; stdcall;
  10708.     function DeletePlayerFromGroup(pidGroup: TDPID; pidPlayer: TDPID): HResult; stdcall;
  10709.     function DestroyPlayer(pidID: TDPID): HResult; stdcall;
  10710.     function DestroyGroup(pidID: TDPID): HResult; stdcall;
  10711.     function EnableNewPlayers(bEnable: BOOL): HResult; stdcall;
  10712.     function EnumGroupPlayers(pidGroupPID: TDPID; lpEnumPlayersCallback:
  10713.         LPDPENUMPLAYERSCALLBACK; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  10714.     function EnumGroups(dwSessionID: DWORD; lpEnumPlayersCallback:
  10715.         LPDPENUMPLAYERSCALLBACK; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  10716.     function EnumPlayers(dwSessionId: DWORD; lpEnumPlayersCallback:
  10717.         LPDPENUMPLAYERSCALLBACK; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  10718.     function EnumSessions(const lpSDesc: TDPSessionDesc; dwTimeout: DWORD;
  10719.         lpEnumSessionsCallback: TDPEnumPlayersCallback; lpContext: Pointer;
  10720.         dwFlags: DWORD): HResult; stdcall;
  10721.     function GetCaps(const lpDPCaps: TDPCaps): HResult; stdcall;
  10722.     function GetMessageCount(pidID: TDPID; var lpdwCount: DWORD): HResult; stdcall;
  10723.     function GetPlayerCaps(pidID: TDPID; const lpDPPlayerCaps: TDPCaps): HResult; stdcall;
  10724.     function GetPlayerName(pidID: TDPID; lpPlayerFriendlyName: LPSTR;
  10725.         var lpdwFriendlyNameLength: DWORD; lpPlayerFormalName: LPSTR;
  10726.         var lpdwFormalNameLength: DWORD): HResult; stdcall;
  10727.     function Initialize(const lpGUID: TGUID): HResult; stdcall;
  10728.     function Open(const lpSDesc: TDPSessionDesc): HResult; stdcall;
  10729.     function Receive(var lppidFrom, lppidTo: TDPID; dwFlags: DWORD;
  10730.         var lpvBuffer; var lpdwSize: DWORD): HResult; stdcall;
  10731.     function SaveSession(lpSessionName: LPSTR): HResult; stdcall;
  10732.     function Send(pidFrom: TDPID; pidTo: TDPID; dwFlags: DWORD;
  10733.         const lpvBuffer; dwBuffSize: DWORD): HResult; stdcall;
  10734.     function SetPlayerName(pidID: TDPID; lpPlayerFriendlyName: LPSTR;
  10735.         lpPlayerFormalName: LPSTR): HResult; stdcall;
  10736.   end;
  10737.  
  10738. { API's (cont.) }
  10739.  
  10740. function DirectPlayCreate(const lpGUID: TGUID; out lplpDP: IDirectPlay;
  10741.     pUnk: IUnknown): HResult; stdcall;
  10742.  
  10743. (*==========================================================================;
  10744.  *
  10745.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  10746.  *
  10747.  *  File:       dplobby.h
  10748.  *  Content:    DirectPlayLobby include file
  10749.  *
  10750.  ***************************************************************************)
  10751.  
  10752. { GUIDS used by DirectPlay objects }
  10753.  
  10754. const
  10755.   CLSID_DirectPlayLobby: TGUID = '{2FE8F810-B2A5-11D0-A787-0000F803ABFC}';
  10756.  
  10757.   IID_IDirectPlayLobby: TGUID = '{AF465C71-9588-11cf-A020-00AA006157AC}';
  10758.   IID_IDirectPlayLobbyA: TGUID = '{26C66A70-B367-11cf-A024-00AA006157AC}';
  10759.   IID_IDirectPlayLobby2: TGUID = '{0194C220-A303-11d0-9C4F-00A0C905425E}';
  10760.   IID_IDirectPlayLobby2A: TGUID = '{1BB4AF80-A303-11d0-9C4F-00A0C905425E}';
  10761.   IID_IDirectPlayLobby3: TGUID = '{2DB72490-652C-11d1-A7A8-0000F803ABFC}';
  10762.   IID_IDirectPlayLobby3A: TGUID = '{2DB72491-652C-11d1-A7A8-0000F803ABFC}';
  10763.  
  10764. { IDirectPlayLobby Structures }
  10765.  
  10766. { TDPLAppInfo }
  10767.  
  10768. type
  10769.   PDPLAppInfo = ^TDPLAppInfo;
  10770.   TDPLAppInfo = record
  10771.     dwSize: DWORD;            // Size of this structure
  10772.     guidApplication: TGUID;   // GUID of the Application
  10773.     case Integer of           // Pointer to the Application Name
  10774.       0: (lpszAppNameA: LPSTR);
  10775.       1: (lpszAppName: LPWSTR);
  10776.   end;
  10777.  
  10778.   DPLAPPINFO = TDPLAppInfo;
  10779.   LPDPLAPPINFO = PDPLAppInfo;
  10780.  
  10781. { TDPCompoundAddressElement }
  10782.  
  10783.   PDPCompoundAddressElement = ^TDPCompoundAddressElement;
  10784.   TDPCompoundAddressElement = record
  10785.     guidDataType: TGUID;
  10786.     dwDataSize: DWORD;
  10787.     lpData: Pointer;
  10788.   end;
  10789.  
  10790.   DPCOMPOUNDADDRESSELEMENT = TDPCompoundAddressElement;
  10791.   LPDPCOMPOUNDADDRESSELEMENT = PDPCompoundAddressElement;
  10792.  
  10793. { TDPApplicationDesc }
  10794.  
  10795.   PDPApplicationDesc = ^TDPApplicationDesc;
  10796.   TDPApplicationDesc = record
  10797.     dwSize: DWORD;
  10798.     dwFlags: DWORD;
  10799.     case Integer of
  10800.       0: (
  10801.         lpszApplicationNameA: LPSTR;  // ANSI
  10802.         guidApplication: TGUID;
  10803.         lpszFilenameA: LPSTR;
  10804.         lpszCommandLineA: LPSTR;
  10805.         lpszPathA: LPSTR;
  10806.         lpszCurrentDirectoryA: LPSTR;
  10807.         lpszDescriptionA: LPSTR;
  10808.         lpszDescriptionW: LPWSTR;
  10809.         );
  10810.       1: (
  10811.         lpszApplicationName: LPWSTR;  // Unicode
  10812.         _union1b: TGUID;
  10813.         lpszFilename: LPWSTR;
  10814.         lpszCommandLine: LPWSTR;
  10815.         lpszPath: LPWSTR;
  10816.         lpszCurrentDirectory: LPWSTR;
  10817.         _union1g: LPWSTR;
  10818.         );
  10819.   end;
  10820.  
  10821.   DPAPPLICATIONDESC = TDPApplicationDesc;
  10822.   LPDPAPPLICATIONDESC = PDPApplicationDesc;
  10823.  
  10824. { TDPApplicationDesc2 }
  10825.  
  10826.   PDPApplicationDesc2 = ^TDPApplicationDesc2;
  10827.   TDPApplicationDesc2 = record
  10828.     dwSize: DWORD;
  10829.     dwFlags: DWORD;
  10830.     case Integer of
  10831.       0: (
  10832.         lpszApplicationNameA: LPSTR;  // ANSI
  10833.         guidApplication: TGUID;
  10834.         lpszFilenameA: LPSTR;
  10835.         lpszCommandLineA: LPSTR;
  10836.         lpszPathA: LPSTR;
  10837.         lpszCurrentDirectoryA: LPSTR;
  10838.         lpszDescriptionA: LPSTR;
  10839.         lpszDescriptionW: LPWSTR;
  10840.         lpszAppLauncherNameA: LPSTR;
  10841.         );
  10842.       1: (
  10843.         lpszApplicationName: LPWSTR;  // Unicode
  10844.         _union1b: TGUID;
  10845.         lpszFilename: LPWSTR;
  10846.         lpszCommandLine: LPWSTR;
  10847.         lpszPath: LPWSTR;
  10848.         lpszCurrentDirectory: LPWSTR;
  10849.         _union1g: LPWSTR;
  10850.         lpszAppLauncherName: LPWSTR;
  10851.         );
  10852.   end;
  10853.  
  10854.   DPAPPLICATIONDESC2 = TDPApplicationDesc2;
  10855.   LPDPAPPLICATIONDESC2 = PDPApplicationDesc2;
  10856.  
  10857. { Enumeration Method Callback Prototypes }
  10858.  
  10859.   TDPEnumAddressCallback = function(const guidDataType: TGUID;
  10860.       dwDataSize: DWORD; lpData: Pointer; lpContext: Pointer): BOOL; stdcall;
  10861.   LPDPENUMADDRESSCALLBACK = TDPEnumAddressCallback;
  10862.  
  10863.   TDPLEnumAddressTypesCallback = function(const guidDataType: TGUID;
  10864.       lpContext: Pointer; dwFlags: DWORD): BOOL; stdcall;
  10865.   LPDPLENUMADDRESSTYPESCALLBACK = TDPLEnumAddressTypesCallback;
  10866.  
  10867.   TDPLEnumLocalApplicationsCallback = function(const lpAppInfo: TDPLAppInfo;
  10868.       lpContext: Pointer; dwFlags: DWORD): BOOL; stdcall;
  10869.   LPDPLENUMLOCALAPPLICATIONSCALLBACK = TDPLEnumLocalApplicationsCallback;
  10870.  
  10871. { IDirectPlayLobby (and IDirectPlayLobbyA) Interface }
  10872.  
  10873. type
  10874.   IDirectPlayLobby = interface(IUnknown)
  10875.     ['{AF465C71-9588-11CF-A020-00AA006157AC}']
  10876.     // IDirectPlayLobby methods
  10877.     function Connect(dwFlags: DWORD; out lplpDP: IDirectPlay2;
  10878.         pUnk: IUnknown): HResult; stdcall;
  10879.     function CreateAddress(const guidSP, guidDataType: TGUID; const lpData;
  10880.         dwDataSize: DWORD; var lpAddress; var lpdwAddressSize: DWORD): HResult; stdcall;
  10881.     function EnumAddress(lpEnumAddressCallback: TDPEnumAddressCallback;
  10882.         const lpAddress; dwAddressSize: DWORD; lpContext : Pointer): HResult; stdcall;
  10883.     function EnumAddressTypes(lpEnumAddressTypeCallback:
  10884.         TDPLEnumAddressTypesCallback; const guidSP: TGUID; lpContext: Pointer;
  10885.         dwFlags: DWORD): HResult; stdcall;
  10886.     function EnumLocalApplications(lpEnumLocalAppCallback:
  10887.         TDPLEnumLocalApplicationsCallback; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  10888.     function GetConnectionSettings(dwAppID: DWORD; var lpData: TDPLConnection;
  10889.         var lpdwDataSize: DWORD): HResult; stdcall;
  10890.     function ReceiveLobbyMessage(dwFlags: DWORD; dwAppID: DWORD;
  10891.         var lpdwMessageFlags: DWORD; var lpData; var lpdwDataSize: DWORD): HResult; stdcall;
  10892.     function RunApplication(dwFlags: DWORD; var lpdwAppId: DWORD;
  10893.         const lpConn: TDPLConnection; hReceiveEvent: THandle): HResult; stdcall;
  10894.     function SendLobbyMessage(dwFlags: DWORD; dwAppID: DWORD; const lpData;
  10895.         dwDataSize: DWORD): HResult; stdcall;
  10896.     function SetConnectionSettings(dwFlags: DWORD; dwAppID: DWORD;
  10897.         const lpConn: TDPLConnection): HResult; stdcall;
  10898.     function SetLobbyMessageEvent(dwFlags: DWORD; dwAppID: DWORD;
  10899.         hReceiveEvent: THandle): HResult; stdcall;
  10900.   end;
  10901.  
  10902.   IDirectPlayLobbyA = interface(IDirectPlayLobby)
  10903.     ['{26C66A70-B367-11CF-A024-00AA006157AC}']
  10904.   end;
  10905.  
  10906. { IDirectPlayLobby2 (and IDirectPlayLobby2A) Interface }
  10907.  
  10908.   IDirectPlayLobby2 = interface(IDirectPlayLobby)
  10909.     ['{0194C220-A303-11D0-9C4F-00A0C905425E}']
  10910.     // IDirectPlayLobby2 methods
  10911.     function CreateCompoundAddress(const lpElements: TDPCompoundAddressElement;
  10912.         dwElementCount: DWORD; var lpAddress; var lpdwAddressSize: DWORD): HResult; stdcall;
  10913.   end;
  10914.  
  10915.   IDirectPlayLobby2A = interface(IDirectPlayLobby2)
  10916.     ['{1BB4AF80-A303-11D0-9C4F-00A0C905425E}']
  10917.   end;
  10918.  
  10919. { IDirectPlayLobby3 (and IDirectPlayLobby3A) Interface }
  10920.  
  10921.   IDirectPlayLobby3 = interface(IDirectPlayLobby2)
  10922.     ['{2DB72490-652C-11d1-A7A8-0000F803ABFC}']
  10923.     // IDirectPlayLobby3 Methods
  10924.     function ConnectEx(dwFlags: DWORD; const riid: TGUID; var lplpDP: Pointer;
  10925.         pUnk: IUnknown): HResult; stdcall;
  10926.     function RegisterApplication(dwFlags: DWORD; const lpAppDesc: TDPApplicationDesc): HResult; stdcall;
  10927.     function UnRegisterApplication(dwFlags: DWORD; const guidApplication: TGUID): HResult; stdcall;
  10928.     function WaitForConnectionSettings(dwFlags: DWORD): HResult; stdcall;
  10929.   end;
  10930.  
  10931.   IDirectPlayLobby3A = interface(IDirectPlayLobby3)
  10932.     ['{2DB72491-652C-11d1-A7A8-0000F803ABFC}']
  10933.   end;
  10934.  
  10935. { DirectPlayLobby API Prototypes }
  10936.  
  10937. function DirectPlayLobbyCreateW(const lpguidSP: TGUID; out lplpDPL: IDirectPlayLobby;
  10938.     lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD): HResult; stdcall;
  10939. function DirectPlayLobbyCreateA(const lpguidSP: TGUID; out lplpDPL: IDirectPlayLobbyA;
  10940.     lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD): HResult; stdcall;
  10941. function DirectPlayLobbyCreate(const lpguidSP: TGUID; out lplpDPL: IDirectPlayLobbyA;
  10942.     lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD): HResult; stdcall;
  10943.  
  10944. { DirectPlayLobby Flags }
  10945.  
  10946. const
  10947.   DPLWAIT_CANCEL  = $00000001;
  10948.  
  10949.   DPLMSG_SYSTEM   = $00000001;
  10950.   DPLMSG_STANDARD = $00000002;
  10951.  
  10952.  
  10953. { DirectPlayLobby messages and message data structures }
  10954.  
  10955. { TDPLMsg_Generic }
  10956.  
  10957. type
  10958.   PDPLMsg_Generic = ^TDPLMsg_Generic;
  10959.   TDPLMsg_Generic = record
  10960.     dwType: DWORD;   // Message type
  10961.   end;
  10962.  
  10963.   DPLMSG_GENERIC = TDPLMsg_Generic;
  10964.   LPDPLMSG_GENERIC = PDPLMsg_Generic;
  10965.  
  10966. { TDPLMsg_SystemMessage }
  10967.  
  10968.   PDPLMsg_SystemMessage = ^TDPLMsg_SystemMessage;
  10969.   TDPLMsg_SystemMessage = record
  10970.     dwType: DWORD;        // Message type
  10971.     guidInstance: TGUID;  // Instance GUID of the dplay session the message corresponds to
  10972.   end;
  10973.  
  10974.   DPLMSG_SYSTEMMESSAGE = TDPLMsg_SystemMessage;
  10975.   LPDPLMSG_SYSTEMMESSAGE = PDPLMsg_SystemMessage;
  10976.  
  10977. { TDPLMsg_SetProperty }
  10978.  
  10979.   PDPLMsg_SetProperty = ^TDPLMsg_SetProperty;
  10980.   TDPLMsg_SetProperty = record
  10981.     dwType: DWORD;                           // Message type
  10982.     dwRequestID: DWORD;                      // Request ID (DPL_NOCONFIRMATION if no confirmation desired)
  10983.     guidPlayer: TGUID;                       // Player GUID
  10984.     guidPropertyTag: TGUID;                  // Property GUID
  10985.     dwDataSize: DWORD;                       // Size of data
  10986.     dwPropertyData: array[0..0] of DWORD;   // Buffer containing data
  10987.   end;
  10988.  
  10989.   DPLMSG_SETPROPERTY = TDPLMsg_SetProperty;
  10990.   LPDPLMSG_SETPROPERTY = PDPLMsg_SetProperty;
  10991.  
  10992. const
  10993.   DPL_NOCONFIRMATION = 0;
  10994.  
  10995. { TDPLMsg_SetPropertyResponse }
  10996.  
  10997. type
  10998.   PDPLMsg_SetPropertyResponse = ^TDPLMsg_SetPropertyResponse;
  10999.   TDPLMsg_SetPropertyResponse = record
  11000.     dwType: DWORD;            // Message type
  11001.     dwRequestID: DWORD;       // Request ID
  11002.     guidPlayer: TGUID;        // Player GUID
  11003.     guidPropertyTag: TGUID;   // Property GUID
  11004.     hr: HResult;              // Return Code
  11005.   end;
  11006.  
  11007.   DPLMSG_SETPROPERTYRESPONSE = TDPLMsg_SetPropertyResponse;
  11008.   LPDPLMSG_SETPROPERTYRESPONSE = PDPLMsg_SetPropertyResponse;
  11009.  
  11010. { TDPLMsg_GetProperty }
  11011.  
  11012.   PDPLMsg_GetProperty = ^TDPLMsg_GetProperty;
  11013.   TDPLMsg_GetProperty = record
  11014.     dwType: DWORD;            // Message type
  11015.     dwRequestID: DWORD;       // Request ID
  11016.     guidPlayer: TGUID;        // Player GUID
  11017.     guidPropertyTag: TGUID;   // Property GUID
  11018.   end;
  11019.  
  11020.   DPLMSG_GETPROPERTY = TDPLMsg_GetProperty;
  11021.   LPDPLMSG_GETPROPERTY = PDPLMsg_GetProperty;
  11022.  
  11023. { TDPLMsg_GetPropertyResponse }
  11024.  
  11025.   PDPLMsg_GetPropertyResponse = ^TDPLMsg_GetPropertyResponse;
  11026.   TDPLMsg_GetPropertyResponse = record
  11027.     dwType: DWORD;                           // Message type
  11028.     dwRequestID: DWORD;                      // Request ID
  11029.     guidPlayer: TGUID;                       // Player GUID
  11030.     guidPropertyTag: TGUID;                  // Property GUID
  11031.     hr: HResult;                             // Return Code
  11032.     dwDataSize: DWORD;                       // Size of data
  11033.     dwPropertyData: array[0..0] of DWORD;    // Buffer containing data
  11034.   end;
  11035.  
  11036.   DPLMSG_GETPROPERTYRESPONSE = TDPLMsg_GetPropertyResponse;
  11037.   LPDPLMSG_GETPROPERTYRESPONSE = PDPLMsg_GetPropertyResponse;
  11038.  
  11039. { TDPLMsg_NewSessionHost }
  11040.  
  11041.   PDPLMsg_NewSessionHost = ^TDPLMsg_NewSessionHost;
  11042.   TDPLMsg_NewSessionHost = record
  11043.     dwType: DWORD;            // Message type
  11044.     guidInstance: TGUID;      // GUID Instance of the session
  11045.   end;
  11046.  
  11047.   DPLMSG_NEWSESSIONHOST = TDPLMsg_NewSessionHost;
  11048.   LPDPLMSG_NEWSESSIONHOST = PDPLMsg_NewSessionHost;
  11049.  
  11050. { DirectPlay Lobby message dwType values }
  11051.  
  11052. const
  11053.   DPLSYS_CONNECTIONSETTINGSREAD = $00000001;
  11054.   DPLSYS_DPLAYCONNECTFAILED     = $00000002;
  11055.   DPLSYS_DPLAYCONNECTSUCCEEDED  = $00000003;
  11056.   DPLSYS_APPTERMINATED          = $00000004;
  11057.   DPLSYS_SETPROPERTY            = $00000005;
  11058.   DPLSYS_SETPROPERTYRESPONSE    = $00000006;
  11059.   DPLSYS_GETPROPERTY            = $00000007;
  11060.   DPLSYS_GETPROPERTYRESPONSE    = $00000008;
  11061.   DPLSYS_NEWSESSIONHOST         = $00000009;
  11062.   DPLSYS_NEWCONNECTIONSETTINGS  = $0000000A;
  11063.  
  11064. { DirectPlay defined property GUIDs and associated data structures }
  11065.  
  11066.   DPLPROPERTY_MessagesSupported: TGUID = '{762CCDA1-D916-11d0-BA39-00C04FD7ED67}';
  11067.   DPLPROPERTY_LobbyGuid: TGUID = '{F56920A0-D218-11d0-BA39-00C04FD7ED67}';
  11068.   DPLPROPERTY_PlayerGuid: TGUID = '{B4319322-D20D-11d0-BA39-00C04FD7ED67}';
  11069.  
  11070. { TDPLData_PlayerGUID }
  11071.  
  11072. type
  11073.   PDPLData_PlayerGUID = ^TDPLData_PlayerGUID;
  11074.   TDPLData_PlayerGUID = record
  11075.     guidPlayer: TGUID;
  11076.     dwPlayerFlags: DWORD;
  11077.   end;
  11078.  
  11079.   DPLDATA_PLAYERGUID = TDPLData_PlayerGUID;
  11080.   LPDPLDATA_PLAYERGUID = PDPLData_PlayerGUID;
  11081.  
  11082. { DPLPROPERTY_PlayerScore }
  11083.  
  11084. const
  11085.   DPLPROPERTY_PlayerScore: TGUID = '{48784000-D219-11d0-BA39-00C04FD7ED67}';
  11086.  
  11087. { TDPLData_PlayerScore }
  11088.  
  11089. type
  11090.   PDPLData_PlayerScore = ^TDPLData_PlayerScore;
  11091.   TDPLData_PlayerScore = record
  11092.     dwScoreCount: DWORD;
  11093.     Score: array[0..0] of Longint;
  11094.   end;
  11095.  
  11096.   DPLDATA_PLAYERSCORE = TDPLData_PlayerScore;
  11097.   LPDPLDATA_PLAYERSCORE = PDPLData_PlayerScore;
  11098.  
  11099. { DirectPlay Address ID's }
  11100.  
  11101. type
  11102.   PDPAddress = ^TDPAddress;
  11103.   TDPAddress = record
  11104.     guidDataType: TGUID;
  11105.     dwDataSize: DWORD;
  11106.   end;
  11107.  
  11108.   DPADDRESS = TDPAddress;
  11109.   LPDPADDRESS = PDPAddress;
  11110.  
  11111. const
  11112.   DPAID_TotalSize: TGUID = '{1318F560-912C-11d0-9DAA-00A0C90A43CB}';
  11113.   DPAID_ServiceProvider: TGUID = '{07D916C0-E0AF-11cf-9C4E-00A0C905425E}';
  11114.   DPAID_LobbyProvider: TGUID = '{59B95640-9667-11d0-A77D-0000F803ABFC}';
  11115.   DPAID_Phone: TGUID = '{78EC89A0-E0AF-11cf-9C4E-00A0C905425E}';
  11116.   DPAID_PhoneW: TGUID = '{BA5A7A70-9DBF-11d0-9CC1-00A0C905425E}';
  11117.   DPAID_Modem: TGUID = '{F6DCC200-A2FE-11d0-9C4F-00A0C905425E}';
  11118.   DPAID_ModemW: TGUID = '{01FD92E0-A2FF-11d0-9C4F-00A0C905425E}';
  11119.   DPAID_INet: TGUID = '{C4A54DA0-E0AF-11cf-9C4E-00A0C905425E}';
  11120.   DPAID_INetW: TGUID = '{E63232A0-9DBF-11d0-9CC1-00A0C905425E}';
  11121.   DPAID_INetPort: TGUID = '{E4524541-8EA5-11d1-8A96-006097B01411}';
  11122.   DPAID_MaxMessageSize: TGUID = '{F5D09980-F0C4-11d1-8326-006097B01411}';
  11123.  
  11124. { TDPComPortAddress }
  11125.  
  11126. const
  11127.   DPCPA_NOFLOW      = 0;  // no flow control
  11128.   DPCPA_XONXOFFFLOW = 1;  // software flow control
  11129.   DPCPA_RTSFLOW     = 2;  // hardware flow control with RTS
  11130.   DPCPA_DTRFLOW     = 3;  // hardware flow control with DTR
  11131.   DPCPA_RTSDTRFLOW  = 4;  // hardware flow control with RTS and DTR
  11132.  
  11133. type
  11134.   PDPComPortAddress = ^TDPComPortAddress;
  11135.   TDPComPortAddress = record
  11136.     dwComPort: DWORD;       // COM port to use (1-4)
  11137.     dwBaudRate: DWORD;      // baud rate (100-256k)
  11138.     dwStopBits: DWORD;      // no. stop bits (1-2)
  11139.     dwParity: DWORD;        // parity (none, odd, even, mark)
  11140.     dwFlowControl: DWORD;   // flow control (none, xon/xoff, rts, dtr)
  11141.   end;
  11142.  
  11143.   DPCOMPORTADDRESS = TDPComPortAddress;
  11144.   LPDPCOMPORTADDRESS = PDPComPortAddress;
  11145.  
  11146. const
  11147.   DPAID_ComPort: TGUID = '{F2F0CE00-E0AF-11cf-9C4E-00A0C905425E}';
  11148.  
  11149. { dplobby 1.0 obsolete definitions }
  11150.  
  11151.   DPLAD_SYSTEM = DPLMSG_SYSTEM;
  11152.  
  11153. (*==========================================================================
  11154.  *
  11155.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11156.  *
  11157.  *  File:       dsetup.h
  11158.  *  Content:    DirectXSetup, error codes and flags
  11159.  *
  11160.  ***************************************************************************)
  11161.  
  11162. const
  11163.   FOURCC_VERS = Ord('v') + Ord('e')*$100 + Ord('r')*$10000 + Ord('s')*$1000000;
  11164.  
  11165. // DSETUP Error Codes, must remain compatible with previous setup.
  11166.   DSETUPERR_SUCCESS_RESTART     = HResult(1);
  11167.   DSETUPERR_SUCCESS             = HResult(0);
  11168.   DSETUPERR_BADWINDOWSVERSION   = HResult(-1);
  11169.   DSETUPERR_SOURCEFILENOTFOUND  = HResult(-2);
  11170.   DSETUPERR_BADSOURCESIZE       = HResult(-3);
  11171.   DSETUPERR_BADSOURCETIME       = HResult(-4);
  11172.   DSETUPERR_NOCOPY              = HResult(-5);
  11173.   DSETUPERR_OUTOFDISKSPACE      = HResult(-6);
  11174.   DSETUPERR_CANTFINDINF         = HResult(-7);
  11175.   DSETUPERR_CANTFINDDIR         = HResult(-8);
  11176.   DSETUPERR_INTERNAL            = HResult(-9);
  11177.   DSETUPERR_UNKNOWNOS           = HResult(-11);
  11178.   DSETUPERR_USERHITCANCEL       = HResult(-12);
  11179.   DSETUPERR_NOTPREINSTALLEDONNT = HResult(-13);
  11180.   DSETUPERR_NEWERVERSION        = HResult(-14);
  11181.  
  11182. // DSETUP flags. DirectX 5.0 apps should use these flags only.
  11183.   DSETUP_DDRAWDRV     = $00000008;   (* install DirectDraw Drivers           *)
  11184.   DSETUP_DSOUNDDRV    = $00000010;   (* install DirectSound Drivers          *)
  11185.   DSETUP_DXCORE       = $00010000;   (* install DirectX runtime              *)
  11186.   DSETUP_DIRECTX = DSETUP_DXCORE or DSETUP_DDRAWDRV or DSETUP_DSOUNDDRV;
  11187.   DSETUP_TESTINSTALL  = $00020000;   (* just test install, don't do anything *)
  11188.   DSETUP_USEROLDERFLAG = $02000000;  (* enable return DSETUPERR_NEWERVERSION *)
  11189.  
  11190. // These OBSOLETE flags are here for compatibility with pre-DX5 apps only.
  11191. // They are present to allow DX3 apps to be recompiled with DX5 and still work.
  11192. // DO NOT USE THEM for DX5. They will go away in future DX releases.
  11193.  
  11194.   DSETUP_DDRAW         = $00000001; (* OBSOLETE. install DirectDraw           *)
  11195.   DSETUP_DSOUND        = $00000002; (* OBSOLETE. install DirectSound          *)
  11196.   DSETUP_DPLAY         = $00000004; (* OBSOLETE. install DirectPlay           *)
  11197.   DSETUP_DPLAYSP       = $00000020; (* OBSOLETE. install DirectPlay Providers *)
  11198.   DSETUP_DVIDEO        = $00000040; (* OBSOLETE. install DirectVideo          *)
  11199.   DSETUP_D3D           = $00000200; (* OBSOLETE. install Direct3D             *)
  11200.   DSETUP_DINPUT        = $00000800; (* OBSOLETE. install DirectInput          *)
  11201.   DSETUP_DIRECTXSETUP  = $00001000; (* OBSOLETE. install DirectXSetup DLL's   *)
  11202.   DSETUP_NOUI          = $00002000; (* OBSOLETE. install DirectX with NO UI   *)
  11203.   DSETUP_PROMPTFORDRIVERS = $10000000; (* OBSOLETE. prompt when replacing display/audio drivers *)
  11204.   DSETUP_RESTOREDRIVERS = $20000000;(* OBSOLETE. restore display/audio drivers *)
  11205.  
  11206. //******************************************************************
  11207. // DirectX Setup Callback mechanism
  11208. //******************************************************************
  11209.  
  11210. // DSETUP Message Info Codes, passed to callback as Reason parameter.
  11211.   DSETUP_CB_MSG_NOMESSAGE                 = 0;
  11212.   DSETUP_CB_MSG_CANTINSTALL_UNKNOWNOS     = 1;
  11213.   DSETUP_CB_MSG_CANTINSTALL_NT            = 2;
  11214.   DSETUP_CB_MSG_CANTINSTALL_BETA          = 3;
  11215.   DSETUP_CB_MSG_CANTINSTALL_NOTWIN32      = 4;
  11216.   DSETUP_CB_MSG_CANTINSTALL_WRONGLANGUAGE = 5;
  11217.   DSETUP_CB_MSG_CANTINSTALL_WRONGPLATFORM = 6;
  11218.   DSETUP_CB_MSG_PREINSTALL_NT             = 7;
  11219.   DSETUP_CB_MSG_NOTPREINSTALLEDONNT       = 8;
  11220.   DSETUP_CB_MSG_SETUP_INIT_FAILED         = 9;
  11221.   DSETUP_CB_MSG_INTERNAL_ERROR            = 10;
  11222.   DSETUP_CB_MSG_CHECK_DRIVER_UPGRADE      = 11;
  11223.   DSETUP_CB_MSG_OUTOFDISKSPACE            = 12;
  11224.   DSETUP_CB_MSG_BEGIN_INSTALL             = 13;
  11225.   DSETUP_CB_MSG_BEGIN_INSTALL_RUNTIME     = 14;
  11226.   DSETUP_CB_MSG_BEGIN_INSTALL_DRIVERS     = 15;
  11227.   DSETUP_CB_MSG_BEGIN_RESTORE_DRIVERS     = 16;
  11228.   DSETUP_CB_MSG_FILECOPYERROR             = 17;
  11229.  
  11230.  
  11231.   DSETUP_CB_UPGRADE_TYPE_MASK      = $000F;
  11232.   DSETUP_CB_UPGRADE_KEEP           = $0001;
  11233.   DSETUP_CB_UPGRADE_SAFE           = $0002;
  11234.   DSETUP_CB_UPGRADE_FORCE          = $0004;
  11235.   DSETUP_CB_UPGRADE_UNKNOWN        = $0008;
  11236.  
  11237.   DSETUP_CB_UPGRADE_HASWARNINGS    = $0100;
  11238.   DSETUP_CB_UPGRADE_CANTBACKUP     = $0200;
  11239.  
  11240.   DSETUP_CB_UPGRADE_DEVICE_ACTIVE  = $0800;
  11241.  
  11242.   DSETUP_CB_UPGRADE_DEVICE_DISPLAY = $1000;
  11243.   DSETUP_CB_UPGRADE_DEVICE_MEDIA   = $2000;
  11244.  
  11245. type
  11246.  
  11247. { TDLSVersion }
  11248.  
  11249.   PDLSVersion = ^TDLSVersion;
  11250.   TDLSVersion = record
  11251.     dwVersionMS: DWORD;
  11252.     dwVersionLS: WORD;
  11253.   end;
  11254.  
  11255.   DLSVERSION = TDLSVersion;
  11256.   LPDLSVERSION = PDLSVersion;
  11257.  
  11258. { TDSetup_CB_UpgradeInfo }
  11259.  
  11260.   PDSetup_CB_UpgradeInfo = ^TDSetup_CB_UpgradeInfo;
  11261.   TDSetup_CB_UpgradeInfo = record
  11262.     UpgradeFlags: DWORD;
  11263.   end;
  11264.  
  11265.   DSETUP_CB_UPGRADEINFO = TDSetup_CB_UpgradeInfo;
  11266.   LPDSETUP_CB_UPGRADEINFO = PDSetup_CB_UpgradeInfo;
  11267.  
  11268. { TDSetup_CB_FileCopyError }
  11269.  
  11270.   PDSetup_CB_FileCopyError = ^TDSetup_CB_FileCopyError;
  11271.   TDSetup_CB_FileCopyError = record
  11272.     dwError: DWORD;
  11273.   end;
  11274.  
  11275.   DSETUP_CB_FILECOPYERROR = TDSetup_CB_FileCopyError;
  11276.   LPDSETUP_CB_FILECOPYERROR = PDSetup_CB_FileCopyError;
  11277.  
  11278. //
  11279. // Data Structures
  11280. //
  11281.  
  11282. { TDirectXRegisterAppA }
  11283.  
  11284.   PDirectXRegisterAppA = ^TDirectXRegisterAppA;
  11285.   TDirectXRegisterAppA = record
  11286.     dwSize: DWORD;
  11287.     dwFlags: DWORD;
  11288.     lpszApplicationName: PAnsiChar;
  11289.     lpGUID: PGUID;
  11290.     lpszFilename: PAnsiChar;
  11291.     lpszCommandLine: PAnsiChar;
  11292.     lpszPath: PAnsiChar;
  11293.     lpszCurrentDirectory: PAnsiChar;
  11294.   end;
  11295.  
  11296.   DIRECTXREGISTERAPPA = TDirectXRegisterAppA;
  11297.   LPDIRECTXREGISTERAPPA = PDirectXRegisterAppA;
  11298.  
  11299. { TDirectXRegisterApp2A }
  11300.  
  11301.   PDirectXRegisterApp2A = ^TDirectXRegisterApp2A;
  11302.   TDirectXRegisterApp2A = record
  11303.     dwSize: DWORD;
  11304.     dwFlags: DWORD;
  11305.     lpszApplicationName: PAnsiChar;
  11306.     lpGUID: PGUID;
  11307.     lpszFilename: PAnsiChar;
  11308.     lpszCommandLine: PAnsiChar;
  11309.     lpszPath: PAnsiChar;
  11310.     lpszCurrentDirectory: PAnsiChar;
  11311.     lpszLauncherName: PAnsiChar;
  11312.   end;
  11313.  
  11314.   DIRECTXREGISTERAPP2A = TDirectXRegisterApp2A;
  11315.   LPDIRECTXREGISTERAPP2A = PDirectXRegisterApp2A;
  11316.  
  11317. { TDirectXRegisterAppW }
  11318.  
  11319.   PDirectXRegisterAppW = ^TDirectXRegisterAppW;
  11320.   TDirectXRegisterAppW = record
  11321.     dwSize: DWORD;
  11322.     dwFlags: DWORD;
  11323.     lpszApplicationName: PWideChar;
  11324.     lpGUID: PGUID;
  11325.     lpszFilename: PWideChar;
  11326.     lpszCommandLine: PWideChar;
  11327.     lpszPath: PWideChar;
  11328.     lpszCurrentDirectory: PWideChar;
  11329.   end;
  11330.  
  11331.   DIRECTXREGISTERAPPW = TDirectXRegisterAppW;
  11332.   LPDIRECTXREGISTERAPPW = PDirectXRegisterAppW;
  11333.  
  11334. { TDirectXRegisterApp2W }
  11335.  
  11336.   PDirectXRegisterApp2W = ^TDirectXRegisterApp2W;
  11337.   TDirectXRegisterApp2W = record
  11338.     dwSize: DWORD;
  11339.     dwFlags: DWORD;
  11340.     lpszApplicationName: PWideChar;
  11341.     lpGUID: PGUID;
  11342.     lpszFilename: PWideChar;
  11343.     lpszCommandLine: PWideChar;
  11344.     lpszPath: PWideChar;
  11345.     lpszCurrentDirectory: PWideChar;
  11346.     lpszLauncherName: PWideChar;
  11347.   end;
  11348.  
  11349.   DIRECTXREGISTERAPP2W = TDirectXRegisterApp2W;
  11350.   LPDIRECTXREGISTERAPP2W = PDirectXRegisterApp2W;
  11351.  
  11352. { TDirectXRegisterApp }
  11353.  
  11354.   PDirectXRegisterApp = PDirectXRegisterAppA;
  11355.   TDirectXRegisterApp = TDirectXRegisterAppA;
  11356.  
  11357.   PDirectXRegisterApp2 = PDirectXRegisterApp2A;
  11358.   TDirectXRegisterApp2 = TDirectXRegisterApp2A;
  11359.  
  11360.   DIRECTXREGISTERAPP = TDirectXRegisterApp;
  11361.   LPDIRECTXREGISTERAPP = PDirectXRegisterApp;
  11362.  
  11363.   DIRECTXREGISTERAPP2 = TDirectXRegisterApp2;
  11364.   LPDIRECTXREGISTERAPP2 = PDirectXRegisterApp2;
  11365.  
  11366. { API }
  11367.  
  11368. function DirectXSetupA(hWnd: HWND; lpszRootPath: PAnsiChar; dwFlags: DWORD): Longint; stdcall;
  11369. function DirectXSetupW(hWnd: HWND; lpszRootPath: PWideChar; dwFlags: DWORD): Longint; stdcall;
  11370. function DirectXSetup(hWnd: HWND; lpszRootPath: PAnsiChar; dwFlags: DWORD): Longint; stdcall;
  11371.  
  11372. function DirectXDeviceDriverSetupA(hWnd: HWND; lpszDriverClass: PAnsiChar;
  11373.     lpszDriverPath: PAnsiChar; dwFlags: DWORD): Longint; stdcall;
  11374. function DirectXDeviceDriverSetupW(hWnd: HWND; lpszDriverClass: PWideChar;
  11375.     lpszDriverPath: PWideChar; dwFlags: DWORD): Longint; stdcall;
  11376. function DirectXDeviceDriverSetup(hWnd: HWND; lpszDriverClass: PAnsiChar;
  11377.     lpszDriverPath: PAnsiChar; dwFlags: DWORD): Longint; stdcall;
  11378.  
  11379. function DirectXRegisterApplicationA(hWnd: HWND; const lpDXRegApp: TDirectXRegisterAppA): Longint; stdcall;
  11380. function DirectXRegisterApplicationW(hWnd: HWND; const lpDXRegApp: TDirectXRegisterAppW): Longint; stdcall;
  11381. function DirectXRegisterApplication(hWnd: HWND; const lpDXRegApp: TDirectXRegisterAppA): Longint; stdcall;
  11382. function DirectXUnRegisterApplication(hWnd: HWND; const lpGUID: TGUID): Longint; stdcall;
  11383.  
  11384. type
  11385.   TDSetup_Callback = function (Reason: DWORD; MsgType: DWORD;
  11386.       szMessage: PAnsiChar; szName: PAnsiChar; pInfo: Pointer): DWORD; stdcall;
  11387.   DSETUP_CALLBACK = TDSetup_Callback;
  11388.  
  11389. function DirectXSetupSetCallback(Callback: TDSetup_Callback): Longint; stdcall;
  11390. function DirectXSetupGetVersion(var lpdwVersion, lpdwMinorVersion: DWORD): Longint; stdcall;
  11391.  
  11392. (*==========================================================================;
  11393.  *
  11394.  *  Copyright (C) 1995,1996 Microsoft Corporation.  All Rights Reserved.
  11395.  *
  11396.  *  File:       dsound.h
  11397.  *  Content:    DirectSound include file
  11398.  *
  11399.  **************************************************************************)
  11400.  
  11401. { GUIDS used by DirectDraw objects }
  11402.  
  11403. const
  11404.   CLSID_DirectSound: TGUID = '{47D4D946-62E8-11cf-93BC-444553540000}';
  11405.   CLSID_DirectSoundCapture: TGUID = '{B0210780-89CD-11d0-AF08-00A0C925CD16}';
  11406.  
  11407.   IID_IDirectSound: TGUID = '{279AFA83-4981-11CE-A521-0020AF0BE560}';
  11408.   IID_IDirectSoundBuffer: TGUID = '{279AFA85-4981-11CE-A521-0020AF0BE560}';
  11409.   IID_IDirectSound3DListener: TGUID = '{279AFA84-4981-11CE-A521-0020AF0BE560}';
  11410.   IID_IDirectSound3DBuffer: TGUID = '{279AFA86-4981-11CE-A521-0020AF0BE560}';
  11411.   IID_IDirectSoundCapture: TGUID = '{B0210781-89CD-11D0-AF08-00A0C925CD16}';
  11412.   IID_IDirectSoundCaptureBuffer: TGUID = '{B0210782-89CD-11D0-AF08-00A0C925CD16}';
  11413.  
  11414.   IID_IDirectSoundNotify: TGUID = '{B0210783-89CD-11D0-AF08-00A0C925CD16}';
  11415.  
  11416. { DirectSound Structures }
  11417.  
  11418. type
  11419.   IDirectSound = interface;
  11420.   IDirectSoundBuffer = interface;
  11421.   IDirectSound3DListener = interface;
  11422.   IDirectSound3DBuffer = interface;
  11423.   IDirectSoundCapture = interface;
  11424.   IDirectSoundCaptureBuffer = interface;
  11425.   IDirectSoundNotify = interface;
  11426.  
  11427. { TDSCaps }
  11428.  
  11429.   PDSCaps = ^TDSCaps;
  11430.   TDSCaps = record
  11431.     dwSize: DWORD;
  11432.     dwFlags: DWORD;
  11433.     dwMinSecondarySampleRate: DWORD;
  11434.     dwMaxSecondarySampleRate: DWORD;
  11435.     dwPrimaryBuffers: DWORD;
  11436.     dwMaxHwMixingAllBuffers: DWORD;
  11437.     dwMaxHwMixingStaticBuffers: DWORD;
  11438.     dwMaxHwMixingStreamingBuffers: DWORD;
  11439.     dwFreeHwMixingAllBuffers: DWORD;
  11440.     dwFreeHwMixingStaticBuffers: DWORD;
  11441.     dwFreeHwMixingStreamingBuffers: DWORD;
  11442.     dwMaxHw3DAllBuffers: DWORD;
  11443.     dwMaxHw3DStaticBuffers: DWORD;
  11444.     dwMaxHw3DStreamingBuffers: DWORD;
  11445.     dwFreeHw3DAllBuffers: DWORD;
  11446.     dwFreeHw3DStaticBuffers: DWORD;
  11447.     dwFreeHw3DStreamingBuffers: DWORD;
  11448.     dwTotalHwMemBytes: DWORD;
  11449.     dwFreeHwMemBytes: DWORD;
  11450.     dwMaxContigFreeHwMemBytes: DWORD;
  11451.     dwUnlockTransferRateHwBuffers: DWORD;
  11452.     dwPlayCpuOverheadSwBuffers: DWORD;
  11453.     dwReserved1: DWORD;
  11454.     dwReserved2: DWORD;
  11455.   end;
  11456.  
  11457.   DSCAPS = TDSCaps;
  11458.   LPDSCAPS = PDSCaps;
  11459.  
  11460. { TDSBCaps }
  11461.  
  11462.   PDSBCaps = ^TDSBCaps;
  11463.   TDSBCaps = record
  11464.     dwSize: DWORD;
  11465.     dwFlags: DWORD;
  11466.     dwBufferBytes: DWORD;
  11467.     dwUnlockTransferRate: DWORD;
  11468.     dwPlayCpuOverhead: DWORD;
  11469.   end;
  11470.  
  11471.   DSBCAPS = TDSBCaps;
  11472.   LPDSBCAPS = DSBCAPS;
  11473.  
  11474. { TDSBufferDesc }
  11475.  
  11476.   PDSBufferDesc = ^TDSBufferDesc;
  11477.   TDSBufferDesc = record
  11478.     dwSize: DWORD;
  11479.     dwFlags: DWORD;
  11480.     dwBufferBytes: DWORD;
  11481.     dwReserved: DWORD;
  11482.     lpwfxFormat: PWaveFormatEx;
  11483. {$IFDEF SupportDirectX7}
  11484.     guid3DAlgorithm: TGUID;
  11485. {$ENDIF}
  11486.   end;
  11487.  
  11488.   DSBUFFERDESC = TDSBufferDesc;
  11489.   LPDSBUFFERDESC = PDSBufferDesc;
  11490.  
  11491. { TDSBufferDesc1 }
  11492.  
  11493.   PDSBufferDesc1 = ^TDSBufferDesc1;
  11494.   TDSBufferDesc1 = record
  11495.     dwSize: DWORD;
  11496.     dwFlags: DWORD;
  11497.     dwBufferBytes: DWORD;
  11498.     dwReserved: DWORD;
  11499.     lpwfxFormat: PWaveFormatEx;
  11500.   end;
  11501.  
  11502.   DSBUFFERDESC1 = TDSBufferDesc1;
  11503.   LPDSBUFFERDESC1 = PDSBufferDesc1;
  11504.  
  11505. { TDS3DBuffer }
  11506.  
  11507.   PDS3DBuffer = ^TDS3DBuffer;
  11508.   TDS3DBuffer = record
  11509.     dwSize: DWORD;
  11510.     vPosition: TD3DVector;
  11511.     vVelocity: TD3DVector;
  11512.     dwInsideConeAngle: DWORD;
  11513.     dwOutsideConeAngle: DWORD;
  11514.     vConeOrientation: TD3DVector;
  11515.     lConeOutsideVolume: Longint;
  11516.     flMinDistance: TD3DValue;
  11517.     flMaxDistance: TD3DValue;
  11518.     dwMode: DWORD;
  11519.   end;
  11520.  
  11521.   DS3DBUFFER = TDS3DBuffer;
  11522.   LPDS3DBUFFER = PDS3DBuffer;
  11523.  
  11524. { TDS3DListener }
  11525.  
  11526.   PDS3DListener = ^TDS3DListener;
  11527.   TDS3DListener = record
  11528.     dwSize: DWORD;
  11529.     vPosition: TD3DVector;
  11530.     vVelocity: TD3DVector;
  11531.     vOrientFront: TD3DVector;
  11532.     vOrientTop: TD3DVector;
  11533.     flDistanceFactor: TD3DValue;
  11534.     flRolloffFactor: TD3DValue;
  11535.     flDopplerFactor: TD3DValue;
  11536.   end;
  11537.  
  11538.   DS3DLISTENER = TDS3DListener;
  11539.   LPDS3DLISTENER = PDS3DListener;
  11540.  
  11541. { TDSCCaps }
  11542.  
  11543.   PDSCCaps = ^TDSCCaps;
  11544.   TDSCCaps = record
  11545.     dwSize: DWORD;
  11546.     dwFlags: DWORD;
  11547.     dwFormats: DWORD;
  11548.     dwChannels: DWORD;
  11549.   end;
  11550.  
  11551.   DSCCAPS = TDSCCaps;
  11552.   LPDSCCAPS = PDSCCaps;
  11553.  
  11554. { TDSCBufferDesc }
  11555.  
  11556.   PDSCBufferDesc = ^TDSCBufferDesc;
  11557.   TDSCBufferDesc = record
  11558.     dwSize: DWORD;
  11559.     dwFlags: DWORD;
  11560.     dwBufferBytes: DWORD;
  11561.     dwReserved: DWORD;
  11562.     lpwfxFormat: PWaveFormatEx;
  11563.   end;
  11564.  
  11565.   DSCBUFFERDESC = TDSCBufferDesc;
  11566.   LPDSCBUFFERDESC = PDSCBufferDesc;
  11567.  
  11568. { TDSCBCaps }
  11569.  
  11570.   PDSCBCaps = ^TDSCBCaps;
  11571.   TDSCBCaps = record
  11572.     dwSize: DWORD;
  11573.     dwFlags: DWORD;
  11574.     dwBufferBytes: DWORD;
  11575.     dwReserved: DWORD;
  11576.   end;
  11577.  
  11578.   DSCBCAPS = TDSCBCaps;
  11579.   LPDSCBCAPS = PDSCBCaps;
  11580.  
  11581. { TDSBPositionNotify }
  11582.  
  11583.   PDSBPositionNotify = ^TDSBPositionNotify;
  11584.   TDSBPositionNotify = record
  11585.     dwOffset: DWORD;
  11586.     hEventNotify: THandle;
  11587.   end;
  11588.  
  11589.   DSBPOSITIONNOTIFY = TDSBPositionNotify;
  11590.   LPDSBPOSITIONNOTIFY = PDSBPositionNotify;
  11591.  
  11592. { IDirectSound }
  11593.  
  11594.   IDirectSound = interface(IUnknown)
  11595.     ['{279AFA83-4981-11CE-A521-0020AF0BE560}']
  11596.     // IDirectSound methods
  11597.     function CreateSoundBuffer(const lpDSBufferDesc: TDSBufferDesc;
  11598.         out lplpDirectSoundBuffer: IDirectSoundBuffer;
  11599.         pUnkOuter: IUnknown): HResult; stdcall;
  11600.     function GetCaps(var lpDSCaps: TDSCaps): HResult; stdcall;
  11601.     function DuplicateSoundBuffer(lpDsbOriginal: IDirectSoundBuffer;
  11602.         out lpDsbDuplicate: IDirectSoundBuffer): HResult; stdcall;
  11603.     function SetCooperativeLevel(hwnd: HWND; dwLevel: DWORD): HResult; stdcall;
  11604.     function Compact: HResult; stdcall;
  11605.     function GetSpeakerConfig(var lpdwSpeakerConfig: DWORD): HResult; stdcall;
  11606.     function SetSpeakerConfig(dwSpeakerConfig: DWORD): HResult; stdcall;
  11607.     function Initialize(lpGuid: PGUID): HResult; stdcall;
  11608.   end;
  11609.  
  11610. { IDirectSoundBuffer }
  11611.  
  11612.   IDirectSoundBuffer = interface(IUnknown)
  11613.     ['{279AFA85-4981-11CE-A521-0020AF0BE560}']
  11614.     // IDirectSoundBuffer methods
  11615.     function GetCaps(var lpDSBufferCaps: TDSBCaps): HResult; stdcall;
  11616.     function GetCurrentPosition(var lpdwCurrentPlayCursor,
  11617.         lpdwCurrentWriteCursor: DWORD): HResult; stdcall;
  11618.     function GetFormat(var lpwfxFormat: TWaveFormatEx; dwSizeAllocated: DWORD;
  11619.         var lpdwSizeWritten: DWORD): HResult; stdcall;
  11620.     function GetVolume(var lplVolume: Longint): HResult; stdcall;
  11621.     function GetPan(var lplPan: Longint): HResult; stdcall;
  11622.     function GetFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  11623.     function GetStatus(var lpdwStatus: DWORD): HResult; stdcall;
  11624.     function Initialize(lpDirectSound: IDirectSound; const
  11625.         lpDSBufferDesc: TDSBufferDesc): HResult; stdcall;
  11626.     function Lock(dwWriteCursor: DWORD; dwWriteBytes: DWORD;
  11627.         var lplpvAudioPtr1: Pointer; var lpdwAudioBytes1: DWORD;
  11628.         var lplpvAudioPtr2: Pointer; var lpdwAudioBytes2: DWORD;
  11629.         dwFlags: DWORD): HResult; stdcall;
  11630.     function Play(dwReserved1, dwReserved2: DWORD; dwFlags: DWORD): HResult; stdcall;
  11631.     function SetCurrentPosition(dwNewPosition: DWORD): HResult; stdcall;
  11632.     function SetFormat(const lpfxFormat: TWaveFormatEx): HResult; stdcall;
  11633.     function SetVolume(lVolume: Longint): HResult; stdcall;
  11634.     function SetPan(lPan: Longint): HResult; stdcall;
  11635.     function SetFrequency(dwFrequency: DWORD): HResult; stdcall;
  11636.     function Stop: HResult; stdcall;
  11637.     function Unlock(lpvAudioPtr1: Pointer; dwAudioBytes1: DWORD;
  11638.         lpvAudioPtr2: Pointer; dwAudioBytes2: DWORD): HResult; stdcall;
  11639.     function Restore: HResult; stdcall;
  11640.   end;
  11641.  
  11642. { IDirectSound3DListener }
  11643.  
  11644.   IDirectSound3DListener = interface(IUnknown)
  11645.     ['{279AFA84-4981-11CE-A521-0020AF0BE560}']
  11646.     // IDirectSound3DListener methods
  11647.     function GetAllParameters(var lpListener: TDS3DListener): HResult; stdcall;
  11648.     function GetDistanceFactor(var lpflDistanceFactor: TD3DValue): HResult; stdcall;
  11649.     function GetDopplerFactor(var lpflDopplerFactor: TD3DValue): HResult; stdcall;
  11650.     function GetOrientation(var lpvOrientFront, lpvOrientTop: TD3DVector): HResult; stdcall;
  11651.     function GetPosition(var lpvPosition: TD3DVector): HResult; stdcall;
  11652.     function GetRolloffFactor(var lpflRolloffFactor: TD3DValue): HResult; stdcall;
  11653.     function GetVelocity(var lpvVelocity: TD3DVector): HResult; stdcall;
  11654.     function SetAllParameters(const lpListener: TDS3DListener; dwApply: DWORD): HResult; stdcall;
  11655.     function SetDistanceFactor(flDistanceFactor: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11656.     function SetDopplerFactor(flDopplerFactor: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11657.     function SetOrientation(xFront, yFront, zFront, xTop, yTop, zTop: TD3DValue;
  11658.         dwApply: DWORD): HResult; stdcall;
  11659.     function SetPosition(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11660.     function SetRolloffFactor(flRolloffFactor: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11661.     function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11662.     function CommitDeferredSettings: HResult; stdcall;
  11663.   end;
  11664.  
  11665. { IDirectSound3DBuffer }
  11666.  
  11667.   IDirectSound3DBuffer = interface(IUnknown)
  11668.     ['{279AFA86-4981-11CE-A521-0020AF0BE560}']
  11669.     // IDirectSound3DBuffer methods
  11670.     function GetAllParameters(var lpDs3dBuffer: TDS3DBuffer): HResult; stdcall;
  11671.     function GetConeAngles(var lpdwInsideConeAngle: DWORD;
  11672.         var lpdwOutsideConeAngle: DWORD): HResult; stdcall;
  11673.     function GetConeOrientation(var lpvOrientation: TD3DVector): HResult; stdcall;
  11674.     function GetConeOutsideVolume(var lplConeOutsideVolume: Longint): HResult; stdcall;
  11675.     function GetMaxDistance(var lpflMaxDistance: TD3DValue): HResult; stdcall;
  11676.     function GetMinDistance(var lpflMinDistance: TD3DValue): HResult; stdcall;
  11677.     function GetMode(var lpdwMod: DWORD): HResult; stdcall;
  11678.     function GetPosition(var lpvPosition: TD3DVector): HResult; stdcall;
  11679.     function GetVelocity(var lpvVelocity: TD3DVector): HResult; stdcall;
  11680.     function SetAllParameters(const lpDs3dBuffer: TDS3DBuffer; dwApply: DWORD): HResult; stdcall;
  11681.     function SetConeAngles(dwInsideConeAngle: DWORD; dwOutsideConeAngle: DWORD;
  11682.         dwApply: DWORD): HResult; stdcall;
  11683.     function SetConeOrientation(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11684.     function SetConeOutsideVolume(lConeOutsideVolume: Longint; dwApply: DWORD): HResult; stdcall;
  11685.     function SetMaxDistance(flMaxDistance: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11686.     function SetMinDistance(flMinDistance: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11687.     function SetMode(dwMode: DWORD; dwApply: DWORD): HResult; stdcall;
  11688.     function SetPosition(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11689.     function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
  11690.   end;
  11691.  
  11692. { IDirectSoundCapture }
  11693.  
  11694.   IDirectSoundCapture = interface(IUnknown)
  11695.     ['{B0210781-89CD-11D0-AF08-00A0C925CD16}']
  11696.     // IDirectSoundCapture methods
  11697.     function CreateCaptureBuffer(const lpDSCBufferDesc: TDSCBufferDesc;
  11698.         out lplpDirectSoundCaptureBuffer: IDirectSoundCaptureBuffer;
  11699.         pUnkOuter: IUnknown): HResult; stdcall;
  11700.     function GetCaps(var lpDSCCaps: TDSCCaps): HResult; stdcall;
  11701.     function Initialize(lpGuid: PGUID): HResult; stdcall;
  11702.   end;
  11703.  
  11704. { IDirectSoundCaptureBuffer }
  11705.  
  11706.   IDirectSoundCaptureBuffer = interface(IUnknown)
  11707.     ['{B0210782-89CD-11D0-AF08-00A0C925CD16}']
  11708.     // IDirectSoundCaptureBuffer methods
  11709.     function GetCaps(var lpDSCBCaps: TDSCBCaps): HResult; stdcall;
  11710.     function GetCurrentPosition(var lpdwCapturePosition,
  11711.         lpdwReadPosition: DWORD): HResult; stdcall;
  11712.     function GetFormat(var lpwfxFormat: TWaveFormatEx; dwSizeAllocated: DWORD;
  11713.         var lpdwSizeWritten: DWORD): HResult; stdcall;
  11714.     function GetStatus(var lpdwStatus: DWORD): HResult; stdcall;
  11715.     function Initialize(lpDirectSoundCapture: IDirectSoundCapture;
  11716.         const lpcDSBufferDesc: TDSCBufferDesc): HResult; stdcall;
  11717.     function Lock(dwReadCursor: DWORD; dwReadBytes: DWORD;
  11718.         var lplpvAudioPtr1: Pointer; var lpdwAudioBytes1: DWORD;
  11719.         var lplpvAudioPtr2: Pointer; var lpdwAudioBytes2: DWORD;
  11720.         dwFlags: DWORD): HResult; stdcall;
  11721.     function Start(dwFlags: DWORD): HResult; stdcall;
  11722.     function Stop: HResult; stdcall;
  11723.     function Unlock(lpvAudioPtr1: Pointer; dwAudioBytes1: DWORD;
  11724.         lpvAudioPtr2: Pointer; dwAudioBytes2: DWORD): HResult; stdcall;
  11725.   end;
  11726.  
  11727. { IDirectSoundNotify }
  11728.  
  11729.   IDirectSoundNotify = interface(IUnknown)
  11730.     ['{B0210783-89CD-11D0-AF08-00A0C925CD16}']
  11731.     // IDirectSoundNotify methods
  11732.     function SetNotificationPositions(cPositionNotifies: DWORD;
  11733.         const lpcPositionNotifies): HResult; stdcall;
  11734.   end;
  11735.  
  11736. { IKsPropertySet }
  11737.  
  11738. const
  11739.   KSPROPERTY_SUPPORT_GET = $00000001;
  11740.   KSPROPERTY_SUPPORT_SET = $00000002;
  11741.  
  11742.   IID_IKsPropertySet: TGUID = (D1:$31efac30;D2:$515c;D3:$11d0;D4:($a9,$aa,$00,$aa,$00,$61,$be,$93));
  11743.  
  11744. type
  11745.   IKsPropertySet = interface;
  11746.  
  11747.   IKsPropertySet = interface(IUnknown)
  11748.     ['{31EFAC30-515C-11D0-A9AA-00AA0061BE93}']
  11749.     // IKsPropertySet methods
  11750.     function GetProperty(const PropertySetId: TGUID; PropertyId: DWORD;
  11751.         var pPropertyParams; cbPropertyParams: DWORD;
  11752.         var pPropertyData; cbPropertyData: DWORD;
  11753.         var pcbReturnedData: ULONG): HResult; stdcall;
  11754.     function SetProperty(const PropertySetId: TGUID; PropertyId: DWORD;
  11755.         const pPropertyParams; cbPropertyParams: DWORD;
  11756.         const pPropertyData; cbPropertyData: DWORD): HResult; stdcall;
  11757.     function QuerySupport(const PropertySetId: TGUID; PropertyId: DWORD;
  11758.         var pSupport: ULONG): HResult; stdcall;
  11759.   end;
  11760.  
  11761. { Return Codes }
  11762.  
  11763. const
  11764.   DS_OK                         = HResult(S_OK);
  11765.   DS_NO_VIRTUALIZATION          = HResult($878000A);
  11766.   DSERR_ALLOCATED               = HResult($88780000 + 10);
  11767.   DSERR_CONTROLUNAVAIL          = HResult($88780000 + 30);
  11768.   DSERR_INVALIDPARAM            = HResult(E_INVALIDARG);
  11769.   DSERR_INVALIDCALL             = HResult($88780000 + 50);
  11770.   DSERR_GENERIC                 = HResult(E_FAIL);
  11771.   DSERR_PRIOLEVELNEEDED         = HResult($88780000 + 70);
  11772.   DSERR_OUTOFMEMORY             = HResult(E_OUTOFMEMORY);
  11773.   DSERR_BADFORMAT               = HResult($88780000 + 100);
  11774.   DSERR_UNSUPPORTED             = HResult(E_NOTIMPL);
  11775.   DSERR_NODRIVER                = HResult($88780000 + 120);
  11776.   DSERR_ALREADYINITIALIZED      = HResult($88780000 + 130);
  11777.   DSERR_NOAGGREGATION           = HResult(CLASS_E_NOAGGREGATION);
  11778.   DSERR_BUFFERLOST              = HResult($88780000 + 150);
  11779.   DSERR_OTHERAPPHASPRIO         = HResult($88780000 + 160);
  11780.   DSERR_UNINITIALIZED           = HResult($88780000 + 170);
  11781.   DSERR_NOINTERFACE             = HResult(E_NOINTERFACE);
  11782.   DSERR_ACCESSDENIED            = HResult(E_ACCESSDENIED);
  11783.  
  11784. { Flags }
  11785.  
  11786.   DSCAPS_PRIMARYMONO      = $00000001;
  11787.   DSCAPS_PRIMARYSTEREO    = $00000002;
  11788.   DSCAPS_PRIMARY8BIT      = $00000004;
  11789.   DSCAPS_PRIMARY16BIT     = $00000008;
  11790.   DSCAPS_CONTINUOUSRATE   = $00000010;
  11791.   DSCAPS_EMULDRIVER       = $00000020;
  11792.   DSCAPS_CERTIFIED        = $00000040;
  11793.   DSCAPS_SECONDARYMONO    = $00000100;
  11794.   DSCAPS_SECONDARYSTEREO  = $00000200;
  11795.   DSCAPS_SECONDARY8BIT    = $00000400;
  11796.   DSCAPS_SECONDARY16BIT   = $00000800;
  11797.  
  11798.   DSSCL_NORMAL            = $00000001;
  11799.   DSSCL_PRIORITY          = $00000002;
  11800.   DSSCL_EXCLUSIVE         = $00000003;
  11801.   DSSCL_WRITEPRIMARY      = $00000004;
  11802.  
  11803.   DSSPEAKER_HEADPHONE = $00000001;
  11804.   DSSPEAKER_MONO      = $00000002;
  11805.   DSSPEAKER_QUAD      = $00000003;
  11806.   DSSPEAKER_STEREO    = $00000004;
  11807.   DSSPEAKER_SURROUND  = $00000005;
  11808.   DSSPEAKER_5POINT1   = $00000006;
  11809.  
  11810.   DSSPEAKER_GEOMETRY_MIN    = $00000005;
  11811.   DSSPEAKER_GEOMETRY_NARROW = $0000000A;
  11812.   DSSPEAKER_GEOMETRY_WIDE   = $00000014;
  11813.   DSSPEAKER_GEOMETRY_MAX    = $000000B4;
  11814.  
  11815.   DSBCAPS_PRIMARYBUFFER       = $00000001;
  11816.   DSBCAPS_STATIC              = $00000002;
  11817.   DSBCAPS_LOCHARDWARE         = $00000004;
  11818.   DSBCAPS_LOCSOFTWARE         = $00000008;
  11819.   DSBCAPS_CTRL3D              = $00000010;
  11820.   DSBCAPS_CTRLFREQUENCY       = $00000020;
  11821.   DSBCAPS_CTRLPAN             = $00000040;
  11822.   DSBCAPS_CTRLVOLUME          = $00000080;
  11823.   DSBCAPS_CTRLPOSITIONNOTIFY  = $00000100;
  11824.   DSBCAPS_CTRLDEFAULT         = $000000E0;
  11825.   DSBCAPS_CTRLALL             = $000001F0;
  11826.   DSBCAPS_STICKYFOCUS         = $00004000;
  11827.   DSBCAPS_GLOBALFOCUS         = $00008000;
  11828.   DSBCAPS_GETCURRENTPOSITION2 = $00010000;
  11829.   DSBCAPS_MUTE3DATMAXDISTANCE = $00020000;
  11830.   DSBCAPS_LOCDEFER            = $00040000;
  11831.  
  11832.   DSBPLAY_LOOPING              = $00000001;
  11833.   DSBPLAY_LOCHARDWARE          = $00000002;
  11834.   DSBPLAY_LOCSOFTWARE          = $00000004;
  11835.   DSBPLAY_TERMINATEBY_TIME     = $00000008;
  11836.   DSBPLAY_TERMINATEBY_DISTANCE = $00000010;
  11837.   DSBPLAY_TERMINATEBY_PRIORITY = $00000020;
  11838.  
  11839.   DSBSTATUS_PLAYING       = $00000001;
  11840.   DSBSTATUS_BUFFERLOST    = $00000002;
  11841.   DSBSTATUS_LOOPING       = $00000004;
  11842.   DSBSTATUS_LOCHARDWARE   = $00000008;
  11843.   DSBSTATUS_LOCSOFTWARE   = $00000010;
  11844.   DSBSTATUS_TERMINATED    = $00000020;
  11845.  
  11846.   DSBLOCK_FROMWRITECURSOR = $00000001;
  11847.   DSBLOCK_ENTIREBUFFER    = $00000002;
  11848.  
  11849.   DSBFREQUENCY_MIN        = 100;
  11850.   DSBFREQUENCY_MAX        = 100000;
  11851.   DSBFREQUENCY_ORIGINAL   = 0;
  11852.  
  11853.   DSBPAN_LEFT             = -10000;
  11854.   DSBPAN_CENTER           = 0;
  11855.   DSBPAN_RIGHT            = 10000;
  11856.  
  11857.   DSBVOLUME_MIN           = -10000;
  11858.   DSBVOLUME_MAX           = 0;
  11859.  
  11860.   DSBSIZE_MIN             = 4;
  11861.   DSBSIZE_MAX             = $0FFFFFFF;
  11862.  
  11863.   DS3DMODE_NORMAL         = $00000000;
  11864.   DS3DMODE_HEADRELATIVE   = $00000001;
  11865.   DS3DMODE_DISABLE        = $00000002;
  11866.  
  11867.   DS3D_IMMEDIATE          = $00000000;
  11868.   DS3D_DEFERRED           = $00000001;
  11869.  
  11870.   DS3D_MINDISTANCEFACTOR     = 0.0;
  11871.   DS3D_MAXDISTANCEFACTOR     = 10.0;
  11872.   DS3D_DEFAULTDISTANCEFACTOR = 1.0;
  11873.  
  11874.   DS3D_MINROLLOFFFACTOR      = 0.0;
  11875.   DS3D_MAXROLLOFFFACTOR      = 10.0;
  11876.   DS3D_DEFAULTROLLOFFFACTOR  = 1.0;
  11877.  
  11878.   DS3D_MINDOPPLERFACTOR      = 0.0;
  11879.   DS3D_MAXDOPPLERFACTOR      = 10.0;
  11880.   DS3D_DEFAULTDOPPLERFACTOR  = 1.0;
  11881.  
  11882.   DS3D_DEFAULTMINDISTANCE    = 1.0;
  11883.   DS3D_DEFAULTMAXDISTANCE    = 1000000000.0;
  11884.  
  11885.   DS3D_MINCONEANGLE          = 0;
  11886.   DS3D_MAXCONEANGLE          = 360;
  11887.   DS3D_DEFAULTCONEANGLE      = 360;
  11888.  
  11889.   DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX;
  11890.  
  11891.   DSCCAPS_EMULDRIVER          = DSCAPS_EMULDRIVER;
  11892.   DSCCAPS_CERTIFIED           = DSCAPS_CERTIFIED;
  11893.  
  11894.   DSCBCAPS_WAVEMAPPED         = $80000000;
  11895.  
  11896.   DSCBLOCK_ENTIREBUFFER       = $00000001;
  11897.  
  11898.   DSCBSTATUS_CAPTURING        = $00000001;
  11899.   DSCBSTATUS_LOOPING          = $00000002;
  11900.  
  11901.   DSCBSTART_LOOPING           = $00000001;
  11902.  
  11903.   DSBPN_OFFSETSTOP            = $FFFFFFFF;
  11904.  
  11905.   DS3DALG_DEFAULT: TGUID = '{00000000-0000-0000-0000-000000000000}';
  11906.   DS3DALG_NO_VIRTUALIZATION: TGUID = '{C241333F-1C1B-11D2-94F5-00C04FC28ACA}';
  11907.   DS3DALG_HRTF_FULL: TGUID = '{C2413340-1C1B-11D2-94F5-00C04FC28ACA}';
  11908.   DS3DALG_HRTF_LIGHT: TGUID = '{C2413342-1C1B-11D2-94F5-00C04FC28ACA}';
  11909.  
  11910. function DSSPEAKER_COMBINED(c, g: Byte): DWORD;
  11911. function DSSPEAKER_CONFIG(a: DWORD): Byte;
  11912. function DSSPEAKER_GEOMETRY(a: DWORD): Byte;
  11913.  
  11914. { DirectSound API }
  11915.  
  11916. type
  11917.   TDSEnumCallbackW = function(lpGuid: PGUID; lpstrDescription: LPCWSTR;
  11918.     lpstrModule: LPCWSTR; lpContext: Pointer): BOOL; stdcall;
  11919.   LPDSENUMCALLBACKW = TDSEnumCallbackW;
  11920.  
  11921.   TDSEnumCallbackA = function(lpGuid: PGUID; lpstrDescription: LPCSTR;
  11922.     lpstrModule: LPCSTR; lpContext: Pointer): BOOL; stdcall;
  11923.   LPDSENUMCALLBACKA = TDSEnumCallbackA;
  11924.  
  11925.   TDSEnumCallback = TDSEnumCallbackA;
  11926.   LPDSENUMCALLBACK = TDSEnumCallback;
  11927.  
  11928. function DirectSoundCreate(lpGUID: PGUID; out lpDS: IDirectSound; pUnkOuter: IUnknown): HResult; stdcall;
  11929. function DirectSoundEnumerateA(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  11930. function DirectSoundEnumerateW(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall;
  11931. function DirectSoundEnumerate(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  11932.  
  11933. function DirectSoundCaptureCreate(lpGUID: PGUID; out lplpDSC: IDirectSoundCapture; pUnkOuter: IUnknown): HResult; stdcall;
  11934. function DirectSoundCaptureEnumerateA(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  11935. function DirectSoundCaptureEnumerateW(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall;
  11936. function DirectSoundCaptureEnumerate(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  11937.  
  11938. //==========================================================================;
  11939. //
  11940. //  dls1.h
  11941. //
  11942. //
  11943. //  Description:
  11944. //
  11945. //  Interface defines and structures for the Instrument Collection Form
  11946. //  RIFF DLS.
  11947. //
  11948. //
  11949. //  Written by Sonic Foundry 1996.  Released for public use.
  11950. //
  11951. //=========================================================================
  11952.  
  11953. ////////////////////////////////////////////////////////////////////////////
  11954. //
  11955. //
  11956. // Layout of an instrument collection:
  11957. //
  11958. //
  11959. // RIFF [] 'DLS ' [dlid,colh,INSTLIST,WAVEPOOL,INFOLIST]
  11960. //
  11961. // INSTLIST
  11962. // LIST [] 'lins'
  11963. //               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  11964. //               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  11965. //               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  11966. //
  11967. // RGNLIST
  11968. // LIST [] 'lrgn'
  11969. //               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  11970. //               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  11971. //               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  11972. //
  11973. // ARTLIST
  11974. // LIST [] 'lart'
  11975. //         'art1' level 1 Articulation connection graph
  11976. //         'art2' level 2 Articulation connection graph
  11977. //         '3rd1' Possible 3rd party articulation structure 1
  11978. //         '3rd2' Possible 3rd party articulation structure 2 .... and so on
  11979. //
  11980. // WAVEPOOL
  11981. // ptbl [] [pool table]
  11982. // LIST [] 'wvpl'
  11983. //               [path],
  11984. //               [path],
  11985. //               LIST [] 'wave' [dlid,RIFFWAVE]
  11986. //               LIST [] 'wave' [dlid,RIFFWAVE]
  11987. //               LIST [] 'wave' [dlid,RIFFWAVE]
  11988. //               LIST [] 'wave' [dlid,RIFFWAVE]
  11989. //               LIST [] 'wave' [dlid,RIFFWAVE]
  11990. //
  11991. // INFOLIST
  11992. // LIST [] 'INFO'
  11993. //               'icmt' 'One of those crazy comments.'
  11994. //               'icop' 'Copyright (C) 1996 Sonic Foundry'
  11995. //
  11996. //////////////////////////////////////////////////////////////////////////
  11997.  
  11998.  
  11999. ///////////////////////////////////////////////////////////////////////////
  12000. // FOURCC's used in the DLS file
  12001. //////////////////////////////////////////////////////////////////////////
  12002. const
  12003.   FOURCC_DLS  = Ord('D') + Ord('L') shl 8 + Ord('S') shl 16 + Ord(' ') shl 24;
  12004.   FOURCC_DLID = Ord('d') + Ord('l') shl 8 + Ord('i') shl 16 + Ord('d') shl 24;
  12005.   FOURCC_COLH = Ord('c') + Ord('o') shl 8 + Ord('l') shl 16 + Ord('h') shl 24;
  12006.   FOURCC_WVPL = Ord('w') + Ord('v') shl 8 + Ord('p') shl 16 + Ord('l') shl 24;
  12007.   FOURCC_PTBL = Ord('p') + Ord('t') shl 8 + Ord('b') shl 16 + Ord('l') shl 24;
  12008.   FOURCC_PATH = Ord('p') + Ord('a') shl 8 + Ord('t') shl 16 + Ord('h') shl 24;
  12009.   FOURCC_wave = Ord('w') + Ord('a') shl 8 + Ord('v') shl 16 + Ord('e') shl 24;
  12010.   FOURCC_LINS = Ord('l') + Ord('i') shl 8 + Ord('n') shl 16 + Ord('s') shl 24;
  12011.   FOURCC_INS  = Ord('i') + Ord('n') shl 8 + Ord('s') shl 16 + Ord(' ') shl 24;
  12012.   FOURCC_INSH = Ord('i') + Ord('n') shl 8 + Ord('s') shl 16 + Ord('h') shl 24;
  12013.   FOURCC_LRGN = Ord('l') + Ord('r') shl 8 + Ord('g') shl 16 + Ord('n') shl 24;
  12014.   FOURCC_RGN  = Ord('r') + Ord('g') shl 8 + Ord('n') shl 16 + Ord(' ') shl 24;
  12015.   FOURCC_RGNH = Ord('r') + Ord('g') shl 8 + Ord('n') shl 16 + Ord('h') shl 24;
  12016.   FOURCC_LART = Ord('l') + Ord('a') shl 8 + Ord('r') shl 16 + Ord('t') shl 24;
  12017.   FOURCC_ART1 = Ord('a') + Ord('r') shl 8 + Ord('t') shl 16 + Ord('1') shl 24;
  12018.   FOURCC_WLNK = Ord('w') + Ord('l') shl 8 + Ord('n') shl 16 + Ord('k') shl 24;
  12019.   FOURCC_WSMP = Ord('w') + Ord('s') shl 8 + Ord('m') shl 16 + Ord('p') shl 24;
  12020.   //FOURCC_VERS = Ord('v') + Ord('e') shl 8 + Ord('r') shl 16 + Ord('s') shl 24;
  12021.  
  12022. ///////////////////////////////////////////////////////////////////////////
  12023. // Articulation connection graph definitions
  12024. //////////////////////////////////////////////////////////////////////////
  12025.  
  12026. // Generic Sources
  12027.   CONN_SRC_NONE           = $0000;
  12028.   CONN_SRC_LFO            = $0001;
  12029.   CONN_SRC_KEYONVELOCITY  = $0002;
  12030.   CONN_SRC_KEYNUMBER      = $0003;
  12031.   CONN_SRC_EG1            = $0004;
  12032.   CONN_SRC_EG2            = $0005;
  12033.   CONN_SRC_PITCHWHEEL     = $0006;
  12034.  
  12035. // Midi Controllers 0-127
  12036.   CONN_SRC_CC1            = $0081;
  12037.   CONN_SRC_CC7            = $0087;
  12038.   CONN_SRC_CC10           = $008A;
  12039.   CONN_SRC_CC11           = $008B;
  12040.  
  12041. // Generic Destinations
  12042.   CONN_DST_NONE           = $0000;
  12043.   CONN_DST_ATTENUATION    = $0001;
  12044.   CONN_DST_PITCH          = $0003;
  12045.   CONN_DST_PAN            = $0004;
  12046.  
  12047. // LFO Destinations
  12048.   CONN_DST_LFO_FREQUENCY  = $0104;
  12049.   CONN_DST_LFO_STARTDELAY = $0105;
  12050.  
  12051. // EG1 Destinations
  12052.   CONN_DST_EG1_ATTACKTIME   = $0206;
  12053.   CONN_DST_EG1_DECAYTIME    = $0207;
  12054.   CONN_DST_EG1_RELEASETIME  = $0209;
  12055.   CONN_DST_EG1_SUSTAINLEVEL = $020A;
  12056.  
  12057. // EG2 Destinations
  12058.   CONN_DST_EG2_ATTACKTIME   = $030A;
  12059.   CONN_DST_EG2_DECAYTIME    = $030B;
  12060.   CONN_DST_EG2_RELEASETIME  = $030D;
  12061.   CONN_DST_EG2_SUSTAINLEVEL = $030E;
  12062.  
  12063.   CONN_TRN_NONE             = $0000;
  12064.   CONN_TRN_CONCAVE          = $0001;
  12065.  
  12066. type
  12067.   TDLSID = record
  12068.     ulData1 : Cardinal;
  12069.     usData2 : Word;
  12070.     usData3 : Word;
  12071.     abData4 : array[0..7] of Byte;
  12072.   end;
  12073.   DLSID   = TDLSID;
  12074.   LPDLSID = ^DLSID;
  12075.  
  12076.   {TDLSVERSION = record
  12077.     dwVersionMS : DWORD;
  12078.     dwVersionLS : DWORD;
  12079.   end;
  12080.   DLSVERSION   = TDLSVERSION;
  12081.   LPDLSVERSION = ^DLSVERSION;
  12082.    }
  12083.   TCONNECTION = record
  12084.     usSource      : Word;
  12085.     usControl     : Word;
  12086.     usDestination : Word;
  12087.     usTransform   : Word;
  12088.     lScale        : Cardinal;
  12089.   end;
  12090.   CONNECTION   = TCONNECTION;
  12091.   LPCONNECTION = ^CONNECTION;
  12092.  
  12093. // Level 1 Articulation Data
  12094.  
  12095.   TCONNECTIONLIST = record
  12096.     cbSize       : Cardinal;      // size of the connection list structure
  12097.     cConnections : Cardinal;      // count of connections in the list
  12098.   end;
  12099.   CONNECTIONLIST   = TCONNECTIONLIST;
  12100.   LPCONNECTIONLIST = ^CONNECTIONLIST;
  12101.  
  12102. ///////////////////////////////////////////////////////////////////////////
  12103. // Generic type defines for regions and instruments
  12104. //////////////////////////////////////////////////////////////////////////
  12105. type
  12106.   TRGNRANGE = record
  12107.     usLow  : Word;
  12108.     usHigh : Word;
  12109.   end;
  12110.   RGNRANGE   = TRGNRANGE;
  12111.   LPRGNRANGE = ^RGNRANGE;
  12112.  
  12113. const
  12114.   FTINSTRUMENTTDRUMS = $80000000;
  12115.  
  12116. type
  12117.   TMIDILOCALE = record
  12118.     ulBank       : Cardinal;
  12119.     ulInstrument : Cardinal;
  12120.   end;
  12121.   MIDILOCALE   = TMIDILOCALE;
  12122.   LPMIDILOCALE = ^MIDILOCALE;
  12123.  
  12124. ///////////////////////////////////////////////////////////////////////////
  12125. // Header structures found in an DLS file for collection, instruments, and
  12126. // regions.
  12127. //////////////////////////////////////////////////////////////////////////
  12128. const
  12129.   F_RGN_OPTION_SELFNONEXCLUSIVE = $0001;
  12130.  
  12131. type
  12132.   TRGNHEADER = record
  12133.     RangeKey      : RGNRANGE;       // Key range  
  12134.     RangeVelocity : RGNRANGE;       // Velocity Range  
  12135.     fusOptions    : Word;           // Synthesis options for this range
  12136.     usKeyGroup    : Word;           // Key grouping for non simultaneous play
  12137.   end;                              // 0 = no group, 1 up is group
  12138.                                     // for Level 1 only groups 1-15 are allowed
  12139.   RGNHEADER   = TRGNHEADER;
  12140.   LPRGNHEADER = ^RGNHEADER;
  12141.  
  12142.   TINSTHEADER = record
  12143.     cRegions : Cardinal;            // Count of regions in this instrument
  12144.     Locale : MIDILOCALE;            // Intended MIDI locale of this instrument
  12145.   end;
  12146.   INSTHEADER   = TINSTHEADER;
  12147.   LPINSTHEADER = ^INSTHEADER;
  12148.  
  12149.   TDLSHEADER = record
  12150.     cInstruments : Cardinal;        // Count of instruments in the collection
  12151.   end;
  12152.   DLSHEADER = TDLSHEADER;
  12153.   LPDLSHEADER = ^DLSHEADER;
  12154.  
  12155. //////////////////////////////////////////////////////////////////////////////
  12156. // definitions for the Wave link structure
  12157. /////////////////////////////////////////////////////////////////////////////
  12158.  
  12159. // ****  For level 1 only WAVELINK_CHANNEL_MONO is valid  ****
  12160. // ulChannel allows for up to 32 channels of audio with each bit position
  12161. // specifiying a channel of playback
  12162.  
  12163. const
  12164.   WAVELINK_CHANNEL_LEFT   = $0001;
  12165.   WAVELINK_CHANNEL_RIGHT  = $0002;
  12166.  
  12167.   F_WAVELINK_PHASE_MASTER = $0001;
  12168.  
  12169. type
  12170.   TWAVELINK = record           // any paths or links are stored right after struct
  12171.     fusOptions   : Word;       // options flags for this wave
  12172.     usPhaseGroup : Word;       // Phase grouping for locking channels
  12173.     ulChannel    : Cardinal;   // channel placement
  12174.     ulTableIndex : Cardinal;   // index into the wave pool table, 0 based
  12175.   end;
  12176.   WAVELINK   = TWAVELINK;
  12177.   LPWAVELINK = ^WAVELINK;
  12178.  
  12179. const
  12180.   POOL_CUE_NULL = $FFFFFFFF;
  12181.  
  12182. type
  12183.   TPOOLCUE = record
  12184.     ulOffset : Cardinal;       // Offset to the entry in the list
  12185.   end;
  12186.   POOLCUE   = TPOOLCUE;
  12187.   LPPOOLCUE = ^POOLCUE;
  12188.  
  12189.   TPOOLTABLE = record
  12190.     cbSize : Cardinal;         // size of the pool table structure
  12191.     cCues  : Cardinal;         // count of cues in the list
  12192.   end;
  12193.   POOLTABLE   = TPOOLTABLE;
  12194.   LPPOOLTABLE = ^POOLTABLE;
  12195.  
  12196. //////////////////////////////////////////////////////////////////////////////
  12197. // Structures for the "wsmp" chunk
  12198. /////////////////////////////////////////////////////////////////////////////
  12199. const
  12200.   F_WSMP_NO_TRUNCATION  = $0001;
  12201.   F_WSMP_NO_COMPRESSION = $0002;
  12202.  
  12203. type
  12204.   Trwsmp = record
  12205.     cbSize       : Cardinal;
  12206.     usUnityNote  : Word;         // MIDI Unity Playback Note
  12207.     sFineTune    : Smallint;     // Fine Tune in log tuning
  12208.     lAttenuation : Longint;      // Overall Attenuation to be applied to data
  12209.     fulOptions   : Cardinal;     // Flag options  
  12210.     cSampleLoops : Cardinal;     // Count of Sample loops, 0 loops is one shot
  12211.   end;
  12212.   WSMPL   = Trwsmp;
  12213.   LPWSMPL = ^WSMPL;
  12214.  
  12215.  
  12216. // This loop type is a normal forward playing loop which is continually
  12217. // played until the envelope reaches an off threshold in the release
  12218. // portion of the volume envelope
  12219. const
  12220.  WLOOP_TYPE_FORWARD = 0;
  12221.  
  12222. type
  12223.   Trloop = record
  12224.     cbSize   : Cardinal;
  12225.     ulType   : Cardinal;           // Loop Type
  12226.     ulStart  : Cardinal;           // Start of loop in samples
  12227.     ulLength : Cardinal;           // Length of loop in samples
  12228.   end;
  12229.   WLOOP = Trloop;
  12230.   LPWLOOP = ^WLOOP;
  12231.  
  12232. {/*
  12233.  
  12234. dls2.h
  12235.  
  12236. Description:
  12237.  
  12238. Interface defines and structures for the DLS2 extensions of DLS.
  12239.  
  12240.  
  12241.   Written by Microsoft 1998.  Released for public use.
  12242.  
  12243. }
  12244.  
  12245. const
  12246. //
  12247. //  FOURCC's used in the DLS2 file, in addition to DLS1 chunks
  12248. ///
  12249.  
  12250.   FOURCC_RGN2  = Ord('r') + Ord('g') shl 8 + Ord('n') shl 16 + Ord('2') shl 24;
  12251.   FOURCC_LAR2  = Ord('l') + Ord('a') shl 8 + Ord('r') shl 16 + Ord('2') shl 24;
  12252.   FOURCC_ART2  = Ord('a') + Ord('r') shl 8 + Ord('t') shl 16 + Ord('2') shl 24;
  12253.   FOURCC_CDL   = Ord('c') + Ord('d') shl 8 + Ord('l') shl 16 + Ord(' ') shl 24;
  12254.   //FOURCC_DLID  = Ord('d') + Ord('l') shl 8 + Ord('i') shl 16 + Ord('d') shl 24;
  12255.  
  12256. //
  12257. //  Articulation connection graph definitions. These are in addition to
  12258. //  the definitions in the DLS1 header.
  12259. ///
  12260.  
  12261. // Generic Sources (in addition to DLS1 sources.
  12262.   CONN_SRC_POLYPRESSURE        = $0007;         // Polyphonic Pressure
  12263.   CONN_SRC_CHANNELPRESSURE     = $0008;         // Channel Pressure
  12264.   CONN_SRC_VIBRATO             = $0009;         // Vibrato LFO
  12265.   CONN_SRC_MONOPRESSURE        = $000a;         // MIDI Mono pressure
  12266.  
  12267.  
  12268. // Midi Controllers
  12269.   CONN_SRC_CC91                = $00db;         // Reverb Send
  12270.   CONN_SRC_CC93                = $00dd;         // Chorus Send
  12271.  
  12272.  
  12273. // Generic Destinations
  12274.   CONN_DST_GAIN                = $0001;         // Same as CONN_DST_ ATTENUATION
  12275.   CONN_DST_KEYNUMBER           = $0005;         // Key Number Generator
  12276.  
  12277. // Audio Channel Output Destinations
  12278.   CONN_DST_LEFT                = $0010;         // Left Channel Send
  12279.   CONN_DST_RIGHT               = $0011;         // Right Channel Send
  12280.   CONN_DST_CENTER              = $0012;         // Center Channel Send
  12281.   CONN_DST_LEFTREAR            = $0013;         // Left Rear Channel Send
  12282.   CONN_DST_RIGHTREAR           = $0014;         // Right Rear Channel Send
  12283.   CONN_DST_LFE_CHANNEL         = $0015;         // LFE Channel Send
  12284.   CONN_DST_CHORUS              = $0080;         // Chorus Send
  12285.   CONN_DST_REVERB              = $0081;         // Reverb Send
  12286.  
  12287. // Vibrato LFO Destinations
  12288.   CONN_DST_VIB_FREQUENCY       = $0114;         // Vibrato Frequency
  12289.   CONN_DST_VIB_STARTDELAY      = $0115;         // Vibrato Start Delay
  12290.  
  12291. // EG1 Destinations
  12292.   CONN_DST_EG1_DELAYTIME       = $020B;         // EG1 Delay Time
  12293.   CONN_DST_EG1_HOLDTIME        = $020C;         // EG1 Hold Time
  12294.  
  12295.  
  12296. //      EG2 Destinations
  12297.   CONN_DST_EG2_DELAYTIME       = $030F;         // EG2 Delay Time
  12298.   CONN_DST_EG2_HOLDTIME        = $0310;         // EG2 Hold Time
  12299.  
  12300.  
  12301. // Filter Destinations
  12302.   CONN_DST_FILTER_CUTOFF       = $0500;         // Filter Cutoff Frequency
  12303.   CONN_DST_FILTER_Q            = $0501;         // Filter Resonance
  12304.  
  12305.  
  12306. // Transforms
  12307.   CONN_TRN_CONVEX              = $0002;         // Convex Transform
  12308.   CONN_TRN_SWITCH              = $0003;         // Switch Transform
  12309.  
  12310.  
  12311. //      Conditional chunk operators
  12312.   DLS_CDL_AND                  = $0001;         // X = X & Y
  12313.   DLS_CDL_OR                   = $0002;         // X = X | Y
  12314.   DLS_CDL_XOR                  = $0003;         // X = X ^ Y
  12315.   DLS_CDL_ADD                  = $0004;         // X = X + Y
  12316.   DLS_CDL_SUBTRACT             = $0005;         // X = X - Y
  12317.   DLS_CDL_MULTIPLY             = $0006;         // X = X * Y
  12318.   DLS_CDL_DIVIDE               = $0007;         // X = X / Y
  12319.   DLS_CDL_LOGICAL_AND          = $0008;         // X = X && Y
  12320.   DLS_CDL_LOGICAL_OR           = $0009;         // X = X || Y
  12321.   DLS_CDL_LT                   = $000A;         // X = (X < Y)
  12322.   DLS_CDL_LE                   = $000B;         // X = (X <= Y)
  12323.   DLS_CDL_GT                   = $000C;         // X = (X > Y)
  12324.   DLS_CDL_GE                   = $000D;         // X = (X >= Y)
  12325.   DLS_CDL_EQ                   = $000E;         // X = (X == Y)
  12326.   DLS_CDL_NOT                  = $000F;         // X = !X
  12327.   DLS_CDL_CONST                = $0010;         // 32-bit constant
  12328.   DLS_CDL_QUERY                = $0011;         // 32-bit value returned from query
  12329.   DLS_CDL_QUERYSUPPORTED       = $0012;         // Test to see if DLSID Query is supported
  12330.  
  12331. //Loop and release
  12332.  
  12333.   WLOOP_TYPE_RELEASE           = 2;
  12334.  
  12335. //DLSID queries for <cdl-ck>
  12336.  
  12337.   DLSID_GMInHardware       : TGUID = '{178F2F24-C364-11D1-A760-0000F875AC12}';
  12338.   DLSID_GSInHardware       : TGUID = '{178F2F25-C364-11D1-A760-0000F875AC12}';
  12339.   DLSID_XGInHardware       : TGUID = '{178F2F26-C364-11D1-A760-0000F875AC12}';
  12340.   DLSID_SupportsDLS1       : TGUID = '{178F2F27-C364-11D1-A760-0000F875AC12}';
  12341.   DLSID_SupportsDLS2       : TGUID = '{F14599E5-4689-11D2-AFA6-00AA0024D8B6}';
  12342.   DLSID_SampleMemorySize   : TGUID = '{178F2F28-C364-11D1-A760-0000F875AC12}';
  12343.   DLSID_ManufacturersID    : TGUID = '{B03E1181-8095-11D2-A1EF-00600833DBD8}';
  12344.   DLSID_ProductID          : TGUID = '{B03E1182-8095-11D2-A1EF-00600833DBD8}';
  12345.   DLSID_SamplePlaybackRate : TGUID = '{2A91F713-A4BF-11D2-BBDF-00600833DBD8}';
  12346.  
  12347. //***********************************************************************
  12348. //                                                                      *
  12349. //   dmdls.h -- DLS download definitions for DirectMusic API's          *
  12350. //                                                                      *
  12351. //   Copyright (c) 1998, Microsoft Corp. All rights reserved.           *
  12352. //                                                                      *
  12353. //**********************************************************************
  12354.  
  12355. type
  12356.   PCENT   = Longint;     // Pitch cents
  12357.   GCENT   = Longint;     // Gain cents
  12358.   TCENT   = Longint;     // Time cents
  12359.   PERCENT = Longint;     // Per.. cent!
  12360.  
  12361.   PReference_Time = ^TReference_Time;
  12362.   TReference_Time  = LONGLONG;
  12363.  
  12364.   Reference_Time   = TReference_Time;
  12365.   LPREFERENCE_TIME = PReference_Time;
  12366.  
  12367. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
  12368.  
  12369. type
  12370.   FOURCC = DWORD;         // a four character code
  12371.  
  12372.   TDMUS_DOWNLOADINFO = record
  12373.     dwDLType                : DWORD;      // Instrument or Wave
  12374.     dwDLId                  : DWORD;      // Unique identifier to tag this download.
  12375.     dwNumOffsetTableEntries : DWORD;      // Number of index in the offset address table.
  12376.     cbSize                  : DWORD;      // Total size of this memory chunk.
  12377.   end;
  12378.   DMUS_DOWNLOADINFO = TDMUS_DOWNLOADINFO;
  12379.  
  12380. const
  12381.   DMUS_DOWNLOADINFO_INSTRUMENT = 1;
  12382.   DMUS_DOWNLOADINFO_WAVE       = 2;
  12383.  
  12384.   DMUS_DEFAULT_SIZE_OFFSETTABLE = 1;
  12385.  
  12386. // Flags for DMUS_INSTRUMENT's ulFlags member
  12387.  
  12388.   DMUS_INSTRUMENT_GM_INSTRUMENT = 1; //   (1 << 0) ????
  12389.  
  12390. type
  12391.   TDMUS_OFFSETTABLE = record
  12392.     ulOffsetTable : array [0..DMUS_DEFAULT_SIZE_OFFSETTABLE] of Cardinal;
  12393.   end;
  12394.   DMUS_OFFSETTABLE = TDMUS_OFFSETTABLE;
  12395.  
  12396.   TDMUS_INSTRUMENT = record
  12397.     ulPatch          : Cardinal;
  12398.     ulFirstRegionIdx : Cardinal;
  12399.     ulGlobalArtIdx   : Cardinal;        // If zero the instrument does not have an articulation
  12400.     ulFirstExtCkIdx  : Cardinal;        // If zero no 3rd party entenstion chunks associated with the instrument
  12401.     ulCopyrightIdx   : Cardinal;        // If zero no Copyright information associated with the instrument
  12402.     ulFlags          : Cardinal;
  12403.   end;
  12404.   DMUS_INSTRUMENT = TDMUS_INSTRUMENT;
  12405.  
  12406.   TDMUS_REGION = record
  12407.     RangeKey        : RGNRANGE;
  12408.     RangeVelocity   : RGNRANGE;
  12409.     fusOptions      : Word;
  12410.     usKeyGroup      : Word;
  12411.     ulRegionArtIdx  : Cardinal;                // If zero the region does not have an articulation
  12412.     ulNextRegionIdx : Cardinal;                // If zero no more regions
  12413.     ulFirstExtCkIdx : Cardinal;                // If zero no 3rd party entenstion chunks associated with the region
  12414.     WaveLink        : WAVELINK;
  12415.     WSMP            : WSMPL;                   //  If WSMP.cSampleLoops > 1 then a WLOOP is included
  12416.     WLOOP           : array[0..0] of WLOOP;
  12417.   end;
  12418.   DMUS_REGION = TDMUS_REGION;
  12419.  
  12420.   TDMUS_LFOPARAMS = record
  12421.     pcFrequency   : PCENT;
  12422.     tcDelay       : TCENT;
  12423.     gcVolumeScale : GCENT;
  12424.     pcPitchScale  : PCENT;
  12425.     gcMWToVolume  : GCENT;
  12426.     pcMWToPitch   : PCENT;
  12427.   end;
  12428.   DMUS_LFOPARAMS = TDMUS_LFOPARAMS;
  12429.  
  12430.   TDMUS_VEGPARAMS = record
  12431.     tcAttack     : TCENT;
  12432.     tcDecay      : TCENT;
  12433.     ptSustain    : PERCENT;
  12434.     tcRelease    : TCENT;
  12435.     tcVel2Attack : TCENT;
  12436.     tcKey2Decay  : TCENT;
  12437.   end;
  12438.   DMUS_VEGPARAMS = TDMUS_VEGPARAMS;
  12439.  
  12440.   TDMUS_PEGPARAMS = record
  12441.     tcAttack     : TCENT;
  12442.     tcDecay      : TCENT;
  12443.     ptSustain    : PERCENT;
  12444.     tcRelease    : TCENT;
  12445.     tcVel2Attack : TCENT;
  12446.     tcKey2Decay  : TCENT;
  12447.     pcRange      : PCENT;
  12448.   end;
  12449.   DMUS_PEGPARAMS = TDMUS_PEGPARAMS;
  12450.  
  12451.   TDMUS_MSCPARAMS = record
  12452.     ptDefaultPan : PERCENT;
  12453.   end;
  12454.   DMUS_MSCPARAMS = TDMUS_MSCPARAMS;
  12455.  
  12456.   TDMUS_ARTICPARAMS = record
  12457.     LFO     : DMUS_LFOPARAMS;
  12458.     VolEG   : DMUS_VEGPARAMS;
  12459.     PitchEG : DMUS_PEGPARAMS;
  12460.     Misc    : DMUS_MSCPARAMS;
  12461.   end;
  12462.   DMUS_ARTICPARAMS = TDMUS_ARTICPARAMS;
  12463.  
  12464.   TDMUS_ARTICULATION = record
  12465.     ulArt1Idx       : Cardinal;        // If zero no DLS Level 1 articulation chunk
  12466.     ulFirstExtCkIdx : Cardinal;        // If zero no 3rd party entenstion chunks associated with the articulation
  12467.     ulNextArtIdx    : Cardinal;        // Additional articulation chunks
  12468.   end;
  12469.   DMUS_ARTICULATION = TDMUS_ARTICULATION;
  12470.  
  12471.   TDMUS_ARTICULATION2 = record
  12472.     ulArt1Idx       : Cardinal;        // If zero no DLS Level 1 articulation chunk
  12473.     ulFirstExtCkIdx : Cardinal;        // If zero no 3rd party entenstion chunks associated with the articulation
  12474.   end;
  12475.   DMUS_ARTICULATION2 = TDMUS_ARTICULATION2;
  12476.  
  12477. const
  12478.   DMUS_MIN_DATA_SIZE = 4;
  12479. //  The actual number is determined by cbSize of struct _DMUS_EXTENSIONCHUNK
  12480.  
  12481. type
  12482.   TDMUS_EXTENSIONCHUNK = record
  12483.     cbSize : Cardinal;                                  //  Size of extension chunk  
  12484.     ulNextExtCkIdx : Cardinal;                          //  If zero no more 3rd party entenstion chunks
  12485.     ExtCkID : FOURCC;
  12486.     byExtCk : array[0..DMUS_MIN_DATA_SIZE - 1] of Byte; //  The actual number that follows is determined by cbSize
  12487.   end;
  12488.   DMUS_EXTENSIONCHUNK = TDMUS_EXTENSIONCHUNK;
  12489.  
  12490. //  The actual number is determined by cbSize of struct TDMUS_COPYRIGHT
  12491.  
  12492.   TDMUS_COPYRIGHT = record
  12493.     cbSize      : Cardinal;                                    //  Size of copyright information
  12494.     byCopyright : array[0..DMUS_MIN_DATA_SIZE - 1] of Byte;    //  The actual number that follows is determined by cbSize
  12495.   end;
  12496.   DMUS_COPYRIGHT = TDMUS_COPYRIGHT;
  12497.  
  12498.   TDMUS_WAVEDATA = record
  12499.     cbSize : Cardinal;
  12500.     byData : array[0..DMUS_MIN_DATA_SIZE - 1] of Byte;
  12501.   end;
  12502.   DMUS_WAVEDATA = TDMUS_WAVEDATA;
  12503.  
  12504.   TDMUS_WAVE = record
  12505.     ulFirstExtCkIdx : Cardinal;      // If zero no 3rd party entenstion chunks associated with the wave
  12506.     ulCopyrightIdx  : Cardinal;      // If zero no Copyright information associated with the wave
  12507.     ulWaveDataIdx   : Cardinal;      // Location of actual wave data.
  12508.     WaveformatEx    : TWAVEFORMATEX;
  12509.   end;
  12510.   DMUS_WAVE = TDMUS_WAVE;
  12511.  
  12512.   LPDMUS_NOTERANGE = ^TDMUS_NOTERANGE;
  12513.   TDMUS_NOTERANGE = record
  12514.     dwLowNote  : DWORD;  // Sets the low note for the range of MIDI note events to which the instrument responds.
  12515.     dwHighNote : DWORD;  // Sets the high note for the range of MIDI note events to which the instrument responds.
  12516.   end;
  12517.   DMUS_NOTERANGE = TDMUS_NOTERANGE;
  12518.  
  12519.  
  12520.  
  12521.  
  12522.  
  12523. //***********************************************************************
  12524. //                                                                      *
  12525. //   dmerror.h -- Error code returned by DirectMusic API's              *
  12526. //                                                                      *
  12527. //   Copyright (c) 1998, Microsoft Corp. All rights reserved.           *
  12528. //                                                                      *
  12529. //**********************************************************************
  12530.  
  12531. const
  12532.   FACILITY_DIRECTMUSIC = $878;       // Shared with DirectSound
  12533.   DMUS_ERRBASE         = $1000;      // Make error codes human readable in hex
  12534.  
  12535.   function MAKE_DMHRESULTSUCCESS(code: Cardinal) : HResult;
  12536.   function MAKE_DMHRESULTERROR(code: Cardinal) : HResult;
  12537.  
  12538. // DMUS_S_PARTIALLOAD
  12539. //
  12540. // The object could only load partially. This can happen if some components are
  12541. // not registered properly, such as embedded tracks and tools.
  12542. ///
  12543. const
  12544.   DMUS_S_PARTIALLOAD = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $091;// MAKE_DMHRESULTSUCCESS($091);
  12545.  
  12546. // DMUS_S_REQUEUE
  12547. //
  12548. // Return value from IDirectMusicTool::ProcessPMsg() which indicates to the
  12549. // performance that it should cue the PMsg again automatically.
  12550. ///
  12551.   DMUS_S_REQUEUE = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $200;//MAKE_DMHRESULTSUCCESS(0x200)
  12552.  
  12553. // DMUS_S_FREE
  12554. //
  12555. // Return value from IDirectMusicTool::ProcessPMsg() which indicates to the
  12556. // performance that it should free the PMsg automatically.
  12557. ///
  12558.   DMUS_S_FREE = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $201;//MAKE_DMHRESULTSUCCESS(0x201)
  12559.  
  12560. // DMUS_S_END
  12561. //
  12562. // Return value from IDirectMusicTrack::Play() which indicates to the
  12563. // segment that the track has no more data after mtEnd.
  12564. ///
  12565.   DMUS_S_END = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $202;//MAKE_DMHRESULTSUCCESS(0x202)
  12566.  
  12567. // DMUS_S_STRING_TRUNCATED
  12568. //
  12569. // Returned string has been truncated to fit the buffer size.
  12570. ///
  12571.   DMUS_S_STRING_TRUNCATED = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $210;//MAKE_DMHRESULTSUCCESS(0x210)
  12572.  
  12573. // DMUS_S_LAST_TOOL
  12574. //
  12575. // Returned from IDirectMusicGraph::StampPMsg(), this indicates that the PMsg
  12576. // is already stamped with the last tool in the graph. The returned PMsg's
  12577. // tool pointer is now NULL.
  12578. ///
  12579.   DMUS_S_LAST_TOOL = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $211;//MAKE_DMHRESULTSUCCESS(0x211)
  12580.  
  12581. // DMUS_S_OVER_CHORD
  12582. //
  12583. // Returned from IDirectMusicPerformance::MusicToMIDI(), this indicates
  12584. // that no note has been calculated because the music value has the note
  12585. // at a position higher than the top note of the chord. This applies only
  12586. // to DMUS_PLAYMODE_NORMALCHORD play mode. This success code indicates
  12587. // that the caller should not do anything with the note. It is not meant
  12588. // to be played against this chord.
  12589. ///
  12590.   DMUS_S_OVER_CHORD = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $212;//MAKE_DMHRESULTSUCCESS(0x212)
  12591.  
  12592. // DMUS_S_UP_OCTAVE
  12593. //
  12594. // Returned from IDirectMusicPerformance::MIDIToMusic(),  and
  12595. // IDirectMusicPerformance::MusicToMIDI(), this indicates
  12596. // that the note conversion generated a note value that is below 0,
  12597. // so it has been bumped up one or more octaves to be in the proper
  12598. // MIDI range of 0 through 127.
  12599. // Note that this is valid for MIDIToMusic() when using play modes
  12600. // DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of
  12601. // which store MIDI values in wMusicValue. With MusicToMIDI(), it is
  12602. // valid for all play modes.
  12603. // Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code.
  12604. ///
  12605.   DMUS_S_UP_OCTAVE = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $213;//MAKE_DMHRESULTSUCCESS(0x213)
  12606.  
  12607. // DMUS_S_DOWN_OCTAVE
  12608. //
  12609. // Returned from IDirectMusicPerformance::MIDIToMusic(),  and
  12610. // IDirectMusicPerformance::MusicToMIDI(), this indicates
  12611. // that the note conversion generated a note value that is above 127,
  12612. // so it has been bumped down one or more octaves to be in the proper
  12613. // MIDI range of 0 through 127.
  12614. // Note that this is valid for MIDIToMusic() when using play modes
  12615. // DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of
  12616. // which store MIDI values in wMusicValue. With MusicToMIDI(), it is
  12617. // valid for all play modes.
  12618. // Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code.
  12619. ///
  12620.   DMUS_S_DOWN_OCTAVE = (0 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $214;//MAKE_DMHRESULTSUCCESS(0x214)
  12621.  
  12622. // DMUS_E_DRIVER_FAILED
  12623. //
  12624. // An unexpected error was returned from a device driver, indicating
  12625. // possible failure of the driver or hardware.
  12626. ///
  12627.   DMUS_E_DRIVER_FAILED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0101;//MAKE_DMHRESULTERROR(0x0101)
  12628.  
  12629. // DMUS_E_PORTS_OPEN
  12630. //
  12631. // The requested operation cannot be performed while there are
  12632. // instantiated ports in any process in the system.
  12633. ///
  12634.   DMUS_E_PORTS_OPEN = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0102;//MAKE_DMHRESULTERROR(0x0102)
  12635.  
  12636. // DMUS_E_DEVICE_IN_USE
  12637. //
  12638. // The requested device is already in use (possibly by a non-DirectMusic
  12639. // client) and cannot be opened again.
  12640. ///
  12641.   DMUS_E_DEVICE_IN_USE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0103;//MAKE_DMHRESULTERROR(0x0103)
  12642.  
  12643. // DMUS_E_INSUFFICIENTBUFFER
  12644. //
  12645. // Buffer is not large enough for requested operation.
  12646. ///
  12647.   DMUS_E_INSUFFICIENTBUFFER = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0104;//MAKE_DMHRESULTERROR(0x0104)
  12648.  
  12649. // DMUS_E_BUFFERNOTSET
  12650. //
  12651. // No buffer was prepared for the download data.
  12652. ///
  12653.   DMUS_E_BUFFERNOTSET = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0105;//MAKE_DMHRESULTERROR(0x0105)
  12654.  
  12655. // DMUS_E_BUFFERNOTAVAILABLE
  12656. //
  12657. // Download failed due to inability to access or create download buffer.
  12658. ///
  12659.   DMUS_E_BUFFERNOTAVAILABLE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0106;//MAKE_DMHRESULTERROR(0x0106)
  12660.  
  12661. // DMUS_E_NOTADLSCOL
  12662. //
  12663. // Error parsing DLS collection. File is corrupt.
  12664. ///
  12665.   DMUS_E_NOTADLSCOL = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0108;//MAKE_DMHRESULTERROR(0x0108)
  12666.  
  12667. // DMUS_E_INVALIDOFFSET
  12668. //
  12669. // Wave chunks in DLS collection file are at incorrect offsets.
  12670. ///
  12671.   DMUS_E_INVALIDOFFSET = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0109;//MAKE_DMHRESULTERROR(0x0109)
  12672.  
  12673. // DMUS_E_ALREADY_LOADED
  12674. //
  12675. // Second attempt to load a DLS collection that is currently open.
  12676. ///
  12677.   DMUS_E_ALREADY_LOADED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0111;//MAKE_DMHRESULTERROR(0x0111)
  12678.  
  12679. // DMUS_E_INVALIDPOS
  12680. //
  12681. // Error reading wave data from DLS collection. Indicates bad file.
  12682. ///
  12683.   DMUS_E_INVALIDPOS = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0113;//MAKE_DMHRESULTERROR(0x0113)
  12684.  
  12685. // DMUS_E_INVALIDPATCH
  12686. //
  12687. // There is no instrument in the collection that matches patch number.
  12688. ///
  12689.   DMUS_E_INVALIDPATCH = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0114;//MAKE_DMHRESULTERROR(0x0114)
  12690.  
  12691. // DMUS_E_CANNOTSEEK
  12692. //
  12693. // The IStream* doesn't support Seek().
  12694. ///
  12695.   DMUS_E_CANNOTSEEK = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0115;//MAKE_DMHRESULTERROR(0x0115)
  12696.  
  12697. // DMUS_E_CANNOTWRITE
  12698. //
  12699. // The IStream* doesn't support Write().
  12700. ///
  12701.   DMUS_E_CANNOTWRITE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0116;//MAKE_DMHRESULTERROR(0x0116)
  12702.  
  12703. // DMUS_E_CHUNKNOTFOUND
  12704. //
  12705. // The RIFF parser doesn't contain a required chunk while parsing file.
  12706. ///
  12707.   DMUS_E_CHUNKNOTFOUND = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0117;//MAKE_DMHRESULTERROR(0x0117)
  12708.  
  12709. // DMUS_E_INVALID_DOWNLOADID
  12710. //
  12711. // Invalid download id was used in the process of creating a download buffer.
  12712. ///
  12713.   DMUS_E_INVALID_DOWNLOADID = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0119;//MAKE_DMHRESULTERROR(0x0119)
  12714.  
  12715. // DMUS_E_NOT_DOWNLOADED_TO_PORT
  12716. //
  12717. // Tried to unload an object that was not downloaded or previously unloaded.
  12718. ///
  12719.   DMUS_E_NOT_DOWNLOADED_TO_PORT = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0120;//MAKE_DMHRESULTERROR(0x0120)
  12720.  
  12721. // DMUS_E_ALREADY_DOWNLOADED
  12722. //
  12723. // Buffer was already downloaded to synth.
  12724. ///
  12725.   DMUS_E_ALREADY_DOWNLOADED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0121;//MAKE_DMHRESULTERROR(0x0121)
  12726.  
  12727. // DMUS_E_UNKNOWN_PROPERTY
  12728. //
  12729. // The specified property item was not recognized by the target object.
  12730. ///
  12731.   DMUS_E_UNKNOWN_PROPERTY = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0122;//MAKE_DMHRESULTERROR(0x0122)
  12732.  
  12733. // DMUS_E_SET_UNSUPPORTED
  12734. //
  12735. // The specified property item may not be set on the target object.
  12736. ///
  12737.   DMUS_E_SET_UNSUPPORTED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0123;//MAKE_DMHRESULTERROR(0x0123)
  12738.  
  12739. // DMUS_E_GET_UNSUPPORTED
  12740. //
  12741. // The specified property item may not be retrieved from the target object.
  12742. ///
  12743.   DMUS_E_GET_UNSUPPORTED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0124;//MAKE_DMHRESULTERROR(0x0124)
  12744.  
  12745. // DMUS_E_NOTMONO
  12746. //
  12747. // Wave chunk has more than one interleaved channel. DLS format requires MONO.
  12748. ///
  12749.   DMUS_E_NOTMONO = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0125;//MAKE_DMHRESULTERROR(0x0125)
  12750.  
  12751. // DMUS_E_BADARTICULATION
  12752. //
  12753. // Invalid articulation chunk in DLS collection.
  12754. ///
  12755.   DMUS_E_BADARTICULATION = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0126;//MAKE_DMHRESULTERROR(0x0126)
  12756.  
  12757. // DMUS_E_BADINSTRUMENT
  12758. //
  12759. // Invalid instrument chunk in DLS collection.
  12760. ///
  12761.   DMUS_E_BADINSTRUMENT = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0127;//MAKE_DMHRESULTERROR(0x0127)
  12762.  
  12763. // DMUS_E_BADWAVELINK
  12764. //
  12765. // Wavelink chunk in DLS collection points to invalid wave.
  12766. ///
  12767.   DMUS_E_BADWAVELINK = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0128;//MAKE_DMHRESULTERROR(0x0128)
  12768.  
  12769. // DMUS_E_NOARTICULATION
  12770. //
  12771. // Articulation missing from instrument in DLS collection.
  12772. ///
  12773.   DMUS_E_NOARTICULATION = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0129;//MAKE_DMHRESULTERROR(0x0129)
  12774.  
  12775. // DMUS_E_NOTPCM
  12776. //
  12777. // Downoaded DLS wave is not in PCM format.
  12778. ///
  12779.   DMUS_E_NOTPCM = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $012A;//MAKE_DMHRESULTERROR(0x012A)
  12780.  
  12781. // DMUS_E_BADWAVE
  12782. //
  12783. // Bad wave chunk in DLS collection
  12784. ///
  12785.   DMUS_E_BADWAVE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $012B;//MAKE_DMHRESULTERROR(0x012B)
  12786.  
  12787. // DMUS_E_BADOFFSETTABLE
  12788. //
  12789. // Offset Table for download buffer has errors.
  12790. ///
  12791.   DMUS_E_BADOFFSETTABLE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $012C;//MAKE_DMHRESULTERROR(0x012C)
  12792.  
  12793. // DMUS_E_UNKNOWNDOWNLOAD
  12794. //
  12795. // Attempted to download unknown data type.
  12796. ///
  12797.   DMUS_E_UNKNOWNDOWNLOAD = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $012D;//MAKE_DMHRESULTERROR(0x012D)
  12798.  
  12799. // DMUS_E_NOSYNTHSINK
  12800. //
  12801. // The operation could not be completed because no sink was connected to
  12802. // the synthesizer.
  12803. ///
  12804.   DMUS_E_NOSYNTHSINK = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $012E;//MAKE_DMHRESULTERROR(0x012E)
  12805.  
  12806. // DMUS_E_ALREADYOPEN
  12807. //
  12808. // An attempt was made to open the software synthesizer while it was already
  12809. // open.
  12810. // ASSERT?
  12811. ///
  12812.   DMUS_E_ALREADYOPEN = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $012F;//MAKE_DMHRESULTERROR(0x012F)
  12813.  
  12814. // DMUS_E_ALREADYCLOSE
  12815. //
  12816. // An attempt was made to close the software synthesizer while it was already
  12817. // open.
  12818. // ASSERT?
  12819. ///
  12820.   DMUS_E_ALREADYCLOSED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0130;//MAKE_DMHRESULTERROR(0x0130)
  12821.  
  12822. // DMUS_E_SYNTHNOTCONFIGURED
  12823. //
  12824. // The operation could not be completed because the software synth has not
  12825. // yet been fully configured.
  12826. // ASSERT?
  12827. ///
  12828.   DMUS_E_SYNTHNOTCONFIGURED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0131;//MAKE_DMHRESULTERROR(0x0131)
  12829.  
  12830. // DMUS_E_SYNTHACTIVE
  12831. //
  12832. // The operation cannot be carried out while the synthesizer is active.
  12833. ///
  12834.   DMUS_E_SYNTHACTIVE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0132;//MAKE_DMHRESULTERROR(0x0132)
  12835.  
  12836. // DMUS_E_CANNOTREAD
  12837. //
  12838. // An error occurred while attempting to read from the IStream* object.
  12839. ///
  12840.   DMUS_E_CANNOTREAD = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0133;//MAKE_DMHRESULTERROR(0x0133)
  12841.  
  12842. // DMUS_E_DMUSIC_RELEASED
  12843. //
  12844. // The operation cannot be performed because the final instance of the
  12845. // DirectMusic object was released. Ports cannot be used after final
  12846. // release of the DirectMusic object.
  12847. ///
  12848.   DMUS_E_DMUSIC_RELEASED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0134;//MAKE_DMHRESULTERROR(0x0134)
  12849.  
  12850. // DMUS_E_BUFFER_EMPTY
  12851. //
  12852. // There was no data in the referenced buffer.
  12853. ///
  12854.   DMUS_E_BUFFER_EMPTY = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0135;//MAKE_DMHRESULTERROR(0x0135)
  12855.  
  12856. // DMUS_E_BUFFER_FULL
  12857. //
  12858. // There is insufficient space to insert the given event into the buffer.
  12859. ///
  12860.   DMUS_E_BUFFER_FULL = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0136;//MAKE_DMHRESULTERROR(0x0136)
  12861.  
  12862. // DMUS_E_PORT_NOT_CAPTURE
  12863. //
  12864. // The given operation could not be carried out because the port is a
  12865. // capture port.
  12866. ///
  12867.   DMUS_E_PORT_NOT_CAPTURE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0137;//MAKE_DMHRESULTERROR(0x0137)
  12868.  
  12869. // DMUS_E_PORT_NOT_RENDER
  12870. //
  12871. // The given operation could not be carried out because the port is a
  12872. // render port.
  12873. ///
  12874.   DMUS_E_PORT_NOT_RENDER = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0138;//MAKE_DMHRESULTERROR(0x0138)
  12875.  
  12876. // DMUS_E_DSOUND_NOT_SET
  12877. //
  12878. // The port could not be created because no DirectSound has been specified.
  12879. // Specify a DirectSound interface via the IDirectMusic::SetDirectSound
  12880. // method; pass NULL to have DirectMusic manage usage of DirectSound.
  12881. ///
  12882.   DMUS_E_DSOUND_NOT_SET = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0139;//MAKE_DMHRESULTERROR(0x0139)
  12883.  
  12884. // DMUS_E_ALREADY_ACTIVATED
  12885. //
  12886. // The operation cannot be carried out while the port is active.
  12887. ///
  12888.   DMUS_E_ALREADY_ACTIVATED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $013A;//MAKE_DMHRESULTERROR(0x013A)
  12889.  
  12890. // DMUS_E_INVALIDBUFFER
  12891. //
  12892. // Invalid DirectSound buffer was handed to port.
  12893. ///
  12894.   DMUS_E_INVALIDBUFFER = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $013B;//MAKE_DMHRESULTERROR(0x013B)
  12895.  
  12896. // DMUS_E_WAVEFORMATNOTSUPPORTED
  12897. //
  12898. // Invalid buffer format was handed to the synth sink.
  12899. ///
  12900.   DMUS_E_WAVEFORMATNOTSUPPORTED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $013C;//MAKE_DMHRESULTERROR(0x013C)
  12901.  
  12902. // DMUS_E_SYNTHINACTIVE
  12903. //
  12904. // The operation cannot be carried out while the synthesizer is inactive.
  12905. ///
  12906.   DMUS_E_SYNTHINACTIVE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $013D;//MAKE_DMHRESULTERROR(0x013D)
  12907.  
  12908. // DMUS_E_DSOUND_ALREADY_SET
  12909. //
  12910. // IDirectMusic::SetDirectSound has already been called. It may not be
  12911. // changed while in use.
  12912. ///
  12913.   DMUS_E_DSOUND_ALREADY_SET = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $013E;//MAKE_DMHRESULTERROR(0x013E)
  12914.  
  12915. // DMUS_E_INVALID_EVENT
  12916. //
  12917. // The given event is invalid (either it is not a valid MIDI message
  12918. // or it makes use of running status). The event cannot be packed
  12919. // into the buffer.
  12920. ///
  12921.   DMUS_E_INVALID_EVENT = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $013F;//MAKE_DMHRESULTERROR(0x013F)
  12922.  
  12923. // DMUS_E_UNSUPPORTED_STREAM
  12924. //
  12925. // The IStream* object does not contain data supported by the loading object.
  12926. ///
  12927.   DMUS_E_UNSUPPORTED_STREAM = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0150;//MAKE_DMHRESULTERROR(0x0150)
  12928.  
  12929. // DMUS_E_ALREADY_INITED
  12930. //
  12931. // The object has already been initialized.
  12932. ///
  12933.   DMUS_E_ALREADY_INITED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0151;//MAKE_DMHRESULTERROR(0x0151)
  12934.  
  12935. // DMUS_E_INVALID_BAND
  12936. //
  12937. // The file does not contain a valid band.
  12938. ///
  12939.   DMUS_E_INVALID_BAND = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0152;//MAKE_DMHRESULTERROR(0x0152)
  12940.  
  12941. // DMUS_E_TRACK_HDR_NOT_FIRST_CK
  12942. //
  12943. // The IStream* object's data does not have a track header as the first chunk,
  12944. // and therefore can not be read by the segment object.
  12945. ///
  12946.   DMUS_E_TRACK_HDR_NOT_FIRST_CK = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0155;//MAKE_DMHRESULTERROR(0x0155)
  12947.  
  12948. // DMUS_E_TOOL_HDR_NOT_FIRST_CK
  12949. //
  12950. // The IStream* object's data does not have a tool header as the first chunk,
  12951. // and therefore can not be read by the graph object.
  12952. ///
  12953.   DMUS_E_TOOL_HDR_NOT_FIRST_CK = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0156;//MAKE_DMHRESULTERROR(0x0156)
  12954.  
  12955. // DMUS_E_INVALID_TRACK_HDR
  12956. //
  12957. // The IStream* object's data contains an invalid track header (ckid is 0 and
  12958. // fccType is NULL,) and therefore can not be read by the segment object.
  12959. ///
  12960.   DMUS_E_INVALID_TRACK_HDR = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0157;//MAKE_DMHRESULTERROR(0x0157)
  12961.  
  12962. // DMUS_E_INVALID_TOOL_HDR
  12963. //
  12964. // The IStream* object's data contains an invalid tool header (ckid is 0 and
  12965. // fccType is NULL,) and therefore can not be read by the graph object.
  12966. ///
  12967.   DMUS_E_INVALID_TOOL_HDR = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0158;//MAKE_DMHRESULTERROR(0x0158)
  12968.  
  12969. // DMUS_E_ALL_TOOLS_FAILED
  12970. //
  12971. // The graph object was unable to load all tools from the IStream* object data.
  12972. // This may be due to errors in the stream, or the tools being incorrectly
  12973. // registered on the client.
  12974. ///
  12975.   DMUS_E_ALL_TOOLS_FAILED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0159;//MAKE_DMHRESULTERROR(0x0159)
  12976.  
  12977. // DMUS_E_ALL_TRACKS_FAILED
  12978. //
  12979. // The segment object was unable to load all tracks from the IStream* object data.
  12980. // This may be due to errors in the stream, or the tracks being incorrectly
  12981. // registered on the client.
  12982. ///
  12983.   DMUS_E_ALL_TRACKS_FAILED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0160;//MAKE_DMHRESULTERROR(0x0160)
  12984.  
  12985. // DMUS_E_NOT_FOUND
  12986. //
  12987. // The requested item was not contained by the object.
  12988. ///
  12989.   DMUS_E_NOT_FOUND = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0161;//MAKE_DMHRESULTERROR(0x0161)
  12990.  
  12991. // DMUS_E_NOT_INIT
  12992. //
  12993. // A required object is not initialized or failed to initialize.
  12994. ///
  12995.   DMUS_E_NOT_INIT = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0162;//MAKE_DMHRESULTERROR(0x0162)
  12996.  
  12997. // DMUS_E_TYPE_DISABLED
  12998. //
  12999. // The requested parameter type is currently disabled. Parameter types may
  13000. // be enabled and disabled by certain calls to SetParam().
  13001. ///
  13002.   DMUS_E_TYPE_DISABLED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0163;//MAKE_DMHRESULTERROR(0x0163)
  13003.  
  13004. // DMUS_E_TYPE_UNSUPPORTED
  13005. //
  13006. // The requested parameter type is not supported on the object.
  13007. ///
  13008.   DMUS_E_TYPE_UNSUPPORTED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0164;//MAKE_DMHRESULTERROR(0x0164)
  13009.  
  13010. // DMUS_E_TIME_PAST
  13011. //
  13012. // The time is in the past, and the operation can not succeed.
  13013. ///
  13014.   DMUS_E_TIME_PAST = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0165;//MAKE_DMHRESULTERROR(0x0165)
  13015.  
  13016. // DMUS_E_TRACK_NOT_FOUND
  13017. //
  13018. // The requested track is not contained by the segment.
  13019. ///
  13020.   DMUS_E_TRACK_NOT_FOUND = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0166;//MAKE_DMHRESULTERROR(0x0166)
  13021.  
  13022. // DMUS_E_NO_MASTER_CLOCK
  13023. //
  13024. // There is no master clock in the performance. Be sure to call
  13025. // IDirectMusicPerformance::Init().
  13026. ///
  13027.   DMUS_E_NO_MASTER_CLOCK = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0170;//MAKE_DMHRESULTERROR(0x0170)
  13028.  
  13029. // DMUS_E_LOADER_NOCLASSID
  13030. //
  13031. // The class id field is required and missing in the DMUS_OBJECTDESC.
  13032. ///
  13033.   DMUS_E_LOADER_NOCLASSID = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0180;//MAKE_DMHRESULTERROR(0x0180)
  13034.  
  13035. // DMUS_E_LOADER_BADPATH
  13036. //
  13037. // The requested file path is invalid.
  13038. ///
  13039.   DMUS_E_LOADER_BADPATH = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0181;//MAKE_DMHRESULTERROR(0x0181)
  13040.  
  13041. // DMUS_E_LOADER_FAILEDOPEN
  13042. //
  13043. // File open failed - either file doesn't exist or is locked.
  13044. ///
  13045.   DMUS_E_LOADER_FAILEDOPEN = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0182;//MAKE_DMHRESULTERROR(0x0182)
  13046.  
  13047. // DMUS_E_LOADER_FORMATNOTSUPPORTED
  13048. //
  13049. // Search data type is not supported.
  13050. ///
  13051.   DMUS_E_LOADER_FORMATNOTSUPPORTED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0183;//MAKE_DMHRESULTERROR(0x0183)
  13052.  
  13053. // DMUS_E_LOADER_FAILEDCREATE
  13054. //
  13055. // Unable to find or create object.
  13056. ///
  13057.   DMUS_E_LOADER_FAILEDCREATE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0184;//MAKE_DMHRESULTERROR(0x0184)
  13058.  
  13059. // DMUS_E_LOADER_OBJECTNOTFOUND
  13060. //
  13061. // Object was not found.
  13062. ///
  13063.   DMUS_E_LOADER_OBJECTNOTFOUND = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0185;//MAKE_DMHRESULTERROR(0x0185)
  13064.  
  13065. // DMUS_E_LOADER_NOFILENAME
  13066. //
  13067. // The file name is missing from the DMUS_OBJECTDESC.
  13068. ///
  13069.   DMUS_E_LOADER_NOFILENAME = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0186;//MAKE_DMHRESULTERROR(0x0186)
  13070.  
  13071. // DMUS_E_INVALIDFILE
  13072. //
  13073. // The file requested is not a valid file.
  13074. ///
  13075.   DMUS_E_INVALIDFILE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0200;//MAKE_DMHRESULTERROR(0x0200)
  13076.  
  13077. // DMUS_E_ALREADY_EXISTS
  13078. //
  13079. // The tool is already contained in the graph. Create a new instance.
  13080. ///
  13081.   DMUS_E_ALREADY_EXISTS = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0201;//MAKE_DMHRESULTERROR(0x0201)
  13082.  
  13083. // DMUS_E_OUT_OF_RANGE
  13084. //
  13085. // Value is out of range, for instance the requested length is longer than
  13086. // the segment.
  13087. ///
  13088.   DMUS_E_OUT_OF_RANGE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0202;//MAKE_DMHRESULTERROR(0x0202)
  13089.  
  13090. // DMUS_E_SEGMENT_INIT_FAILED
  13091. //
  13092. // Segment initialization failed, most likely due to a critical memory situation.
  13093. ///
  13094.   DMUS_E_SEGMENT_INIT_FAILED = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0203;//MAKE_DMHRESULTERROR(0x0203)
  13095.  
  13096. // DMUS_E_ALREADY_SENT
  13097. //
  13098. // The DMUS_PMSG has already been sent to the performance object via
  13099. // IDirectMusicPerformance::SendPMsg().
  13100. ///
  13101.   DMUS_E_ALREADY_SENT = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0204;//MAKE_DMHRESULTERROR(0x0204)
  13102.  
  13103. // DMUS_E_CANNOT_FREE
  13104. //
  13105. // The DMUS_PMSG was either not allocated by the performance via
  13106. // IDirectMusicPerformance::AllocPMsg(), or it was already freed via
  13107. // IDirectMusicPerformance::FreePMsg().
  13108. ///
  13109.   DMUS_E_CANNOT_FREE = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0205;//MAKE_DMHRESULTERROR(0x0205)
  13110.  
  13111. // DMUS_E_CANNOT_OPEN_PORT
  13112. //
  13113. // The default system port could not be opened.
  13114. ///
  13115.   DMUS_E_CANNOT_OPEN_PORT = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0206;//MAKE_DMHRESULTERROR(0x0206)
  13116.  
  13117. // DMUS_E_CONNOT_CONVERT
  13118. //
  13119. // A call to MIDIToMusic() or MusicToMIDI() resulted in an error because
  13120. // the requested conversion could not happen. This usually occurs when the
  13121. // provided DMUS_CHORD_KEY structure has an invalid chord or scale pattern.
  13122. ///
  13123.   DMUS_E_CONNOT_CONVERT = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0207;//MAKE_DMHRESULTERROR(0x0207)
  13124.  
  13125. // DMUS_E_DESCEND_CHUNK_FAIL
  13126. //
  13127. // DMUS_E_DESCEND_CHUNK_FAIL is returned when the end of the file
  13128. // was reached before the desired chunk was found.
  13129. ///
  13130.   DMUS_E_DESCEND_CHUNK_FAIL = (1 shl 31) + (FACILITY_DIRECTMUSIC shl 16) + DMUS_ERRBASE + $0210;//MAKE_DMHRESULTERROR(0x0210)
  13131.  
  13132.  
  13133. //************************************************************************
  13134. //                                                                       *
  13135. //   dmksctrl.h -- Definition of IKsControl                              *
  13136. //                                                                       *
  13137. //   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  13138. //                                                                       *
  13139. //                                                                       *
  13140. //   This header file contains the definition of IKsControl, which       *
  13141. //   duplicates definitions from ks.h and ksproxy.h. Your code should    *
  13142. //   include ks.h and ksproxy.h directly if you have them (they are      *
  13143. //   provided in the Windows 98 DDK and will be in the Windows NT 5      *
  13144. //   SDK).                                                               *
  13145. //                                                                       *
  13146. //**********************************************************************
  13147.  
  13148. //
  13149. // Warning: This will prevent the rest of ks.h from being pulled in if ks.h is
  13150. // included after dmksctrl.h. Make sure you do not include both headers in
  13151. // the same source file.
  13152. ///
  13153. type
  13154.   TData = record
  13155.     _Set      : TGUID;
  13156.     Id        : Cardinal;
  13157.     Flags     : Cardinal;
  13158.   end;
  13159.  
  13160.   TKSIDENTIFIER = record
  13161.     Data      : TData;
  13162.     Alignment : LONGLONG;
  13163.   end;
  13164.  
  13165.   KSIDENTIFIER = TKSIDENTIFIER;
  13166.   PKSIDENTIFIER = ^KSIDENTIFIER;
  13167.  
  13168.   TKSPROPERTY = KSIDENTIFIER;
  13169.   KSPROPERTY  = KSIDENTIFIER;
  13170.   PKSPROPERTY = ^KSIDENTIFIER;
  13171.   TKSMETHOD   = KSIDENTIFIER;
  13172.   KSMETHOD    = KSIDENTIFIER;
  13173.   PKSMETHOD   = ^KSIDENTIFIER;
  13174.   TKSEVENT    = KSIDENTIFIER;
  13175.   KSEVENT     = KSIDENTIFIER;
  13176.   PKSEVENT    = ^KSIDENTIFIER;
  13177.  
  13178. const
  13179.   KSMETHOD_TYPE_NONE             = $00000000;
  13180.   KSMETHOD_TYPE_READ             = $00000001;
  13181.   KSMETHOD_TYPE_WRITE            = $00000002;
  13182.   KSMETHOD_TYPE_MODIFY           = $00000003;
  13183.   KSMETHOD_TYPE_SOURCE           = $00000004;
  13184.  
  13185.   KSMETHOD_TYPE_SEND             = $00000001;
  13186.   KSMETHOD_TYPE_SETSUPPORT       = $00000100;
  13187.   KSMETHOD_TYPE_BASICSUPPORT     = $00000200;
  13188.  
  13189.   KSPROPERTY_TYPE_GET            = $00000001;
  13190.   KSPROPERTY_TYPE_SET            = $00000002;
  13191.   KSPROPERTY_TYPE_SETSUPPORT     = $00000100;
  13192.   KSPROPERTY_TYPE_BASICSUPPORT   = $00000200;
  13193.   KSPROPERTY_TYPE_RELATIONS      = $00000400;
  13194.   KSPROPERTY_TYPE_SERIALIZESET   = $00000800;
  13195.   KSPROPERTY_TYPE_UNSERIALIZESET = $00001000;
  13196.   KSPROPERTY_TYPE_SERIALIZERAW   = $00002000;
  13197.   KSPROPERTY_TYPE_UNSERIALIZERAW = $00004000;
  13198.   KSPROPERTY_TYPE_SERIALIZESIZE  = $00008000;
  13199.   KSPROPERTY_TYPE_DEFAULTVALUES  = $00010000;
  13200.  
  13201.   KSPROPERTY_TYPE_TOPOLOGY       = $10000000;
  13202.  
  13203. type
  13204.   IKsControl = interface(IUnknown)
  13205.   ['{28F54685-06FD-11D2-B27A-00A0C9223196}']
  13206.     //IKsControl
  13207.     function KsProperty(const _Property: TKSPROPERTY; PropertyLength: Cardinal; var PropertyData;
  13208.                         DataLength: Cardinal; var BytesReturned: Cardinal) : HResult; stdcall;
  13209.     function KsMethod(const Method: TKSMETHOD; MethodLength: Cardinal; var PropertyData;
  13210.                       DataLength: Cardinal; var BytesReturned: Cardinal) : HResult; stdcall;
  13211.     function KsEvent(const Event: TKSEVENT; EventLength: Cardinal; var EventData;
  13212.                      DataLength: Cardinal; var BytesReturned: Cardinal) : HResult; stdcall;
  13213.   end;
  13214.  
  13215. const
  13216.   IID_IKsControl : TGUID = '{28F54685-06FD-11D2-B27A-00A0C9223196}';
  13217.  
  13218.   // These formats are in ksmedia.h
  13219.   KSDATAFORMAT_SUBTYPE_MIDI        : TGUID = '{1D262760-E957-11CF-A5D6-28DB04C10000}';
  13220.   KSDATAFORMAT_SUBTYPE_DIRECTMUSIC : TGUID = '{1A82F8BC-3F8B-11D2-B774-0060083316C1}';
  13221.  
  13222. //**************************************************************************
  13223. //                                                                          *
  13224. //   DMusBuff.h -- This module defines the buffer format for DirectMusic    *
  13225. //                 Shared file between user mode and kernel mode components *
  13226. //                                                                          *
  13227. //   Copyright (c) 1998, Microsoft Corp. All rights reserved.               *
  13228. //                                                                          *
  13229. //*************************************************************************
  13230.  
  13231. // Format of DirectMusic events in a buffer
  13232. //
  13233. // A buffer contains 1 or more events, each with the following header.
  13234. // Immediately following the header is the event data. The header+data
  13235. // size is rounded to the nearest quadword (8 bytes).
  13236. ///
  13237.  
  13238. // Do not pad at end - that's where the data is
  13239. type
  13240.   TDMUS_EVENTHEADER = record
  13241.     cbEvent        : DWORD;                // Unrounded bytes in event
  13242.     dwChannelGroup : DWORD;                // Channel group of event
  13243.     rtDelta        : REFERENCE_TIME;       // Delta from start time of entire buffer
  13244.     dwFlags        : DWORD;                // Flags DMUS_EVENT_xxx
  13245.   end;
  13246.   DMUS_EVENTHEADER = TDMUS_EVENTHEADER;
  13247.   LPDMUS_EVENTHEADER = ^TDMUS_EVENTHEADER;
  13248.  
  13249. const
  13250.   DMUS_EVENT_STRUCTURED  = $00000001;  // Unstructured data (SysEx, etc.)
  13251.  
  13252. // The number of bytes to allocate for an event with 'cb' data bytes.
  13253. //
  13254.   function QWORD_ALIGN(x: LONGLONG) : LONGLONG; //(((x) + 7) & ~7)
  13255.   function DMUS_EVENT_SIZE(cb: LONGLONG) : LONGLONG; //QWORD_ALIGN(sizeof(DMUS_EVENTHEADER) + cb)
  13256.  
  13257. //***********************************************************************
  13258. //                                                                      *
  13259. //   dmusicc.h -- This module defines the DirectMusic core API's        *
  13260. //                                                                      *
  13261. //   Copyright (c) 1998, Microsoft Corp. All rights reserved.           *
  13262. //                                                                      *
  13263. //**********************************************************************
  13264.  
  13265. const
  13266.   DMUS_MAX_DESCRIPTION = 128;
  13267.   DMUS_MAX_DRIVER      = 128;
  13268.  
  13269. type
  13270.   TDMUS_BUFFERDESC = record
  13271.     dwSize           : DWORD;
  13272.     dwFlags          : DWORD;
  13273.     guidBufferFormat : TGUID;
  13274.     cbBuffer         : DWORD;
  13275.   end;
  13276.   DMUS_BUFFERDESC   = TDMUS_BUFFERDESC;
  13277.   LPDMUS_BUFFERDESC = ^TDMUS_BUFFERDESC;
  13278.  
  13279. // DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS
  13280. // and DMUS_PORTPARAMS.
  13281. ///
  13282. const
  13283.   DMUS_EFFECT_NONE           = $00000000;
  13284.   DMUS_EFFECT_REVERB         = $00000001;
  13285.   DMUS_EFFECT_CHORUS         = $00000002;
  13286.  
  13287. // For DMUS_PORTCAPS dwClass
  13288. //
  13289.   DMUS_PC_INPUTCLASS     = (0);
  13290.   DMUS_PC_OUTPUTCLASS    = (1);
  13291.  
  13292. // For DMUS_PORTCAPS dwFlags
  13293. //
  13294.   DMUS_PC_DLS             = ($00000001);
  13295.   DMUS_PC_EXTERNAL        = ($00000002);
  13296.   DMUS_PC_SOFTWARESYNTH   = ($00000004);
  13297.   DMUS_PC_MEMORYSIZEFIXED = ($00000008);
  13298.   DMUS_PC_GMINHARDWARE    = ($00000010);
  13299.   DMUS_PC_GSINHARDWARE    = ($00000020);
  13300.   DMUS_PC_XGINHARDWARE    = ($00000040);
  13301.   DMUS_PC_DIRECTSOUND     = ($00000080);
  13302.   DMUS_PC_SHAREABLE       = ($00000100);
  13303.   DMUS_PC_SYSTEMMEMORY    = ($7FFFFFFF);
  13304.  
  13305. type
  13306.  
  13307.   TDMUS_PORTCAPS = record
  13308.     dwSize             : DWORD;
  13309.     dwFlags            : DWORD;
  13310.     guidPort           : TGUID;
  13311.     dwClass            : DWORD;
  13312.     dwType             : DWORD;
  13313.     dwMemorySize       : DWORD;
  13314.     dwMaxChannelGroups : DWORD;
  13315.     dwMaxVoices        : DWORD;
  13316.     dwMaxAudioChannels : DWORD;
  13317.     dwEffectFlags      : DWORD;
  13318.     wszDescription     : array[0..DMUS_MAX_DESCRIPTION - 1] of WCHAR;
  13319.   end;
  13320.   DMUS_PORTCAPS   = TDMUS_PORTCAPS;
  13321.   LPDMUS_PORTCAPS = ^TDMUS_PORTCAPS;
  13322.  
  13323. // Values for DMUS_PORTCAPS dwType. This field indicates the underlying
  13324. // driver type of the port.
  13325. ///
  13326. const
  13327.   DMUS_PORT_WINMM_DRIVER     = (0);
  13328.   DMUS_PORT_USER_MODE_SYNTH  = (1);
  13329.   DMUS_PORT_KERNEL_MODE      = (2);
  13330.  
  13331. // These flags (set in dwValidParams) indicate which other members of the
  13332. // DMUS_PORTPARAMS are valid.
  13333. //
  13334.   DMUS_PORTPARAMS_VOICES          = $00000001;
  13335.   DMUS_PORTPARAMS_CHANNELGROUPS   = $00000002;
  13336.   DMUS_PORTPARAMS_AUDIOCHANNELS   = $00000004;
  13337.   DMUS_PORTPARAMS_SAMPLERATE      = $00000008;
  13338.   DMUS_PORTPARAMS_EFFECTS         = $00000020;
  13339.   DMUS_PORTPARAMS_SHARE           = $00000040;
  13340.  
  13341. type
  13342.   TDMUS_PORTPARAMS = record
  13343.     dwSize          : DWORD;
  13344.     dwValidParams   : DWORD;
  13345.     dwVoices        : DWORD;
  13346.     dwChannelGroups : DWORD;
  13347.     dwAudioChannels : DWORD;
  13348.     dwSampleRate    : DWORD;
  13349.     dwEffectFlags   : DWORD;
  13350.     fShare          : BOOL;
  13351.   end;
  13352.   DMUS_PORTPARAMS = TDMUS_PORTPARAMS;
  13353.   LPDMUS_PORTPARAMS = ^TDMUS_PORTPARAMS;
  13354.  
  13355.   TDMUS_SYNTHSTATS = record
  13356.     dwSize        : DWORD;      // Size in bytes of the structure
  13357.     dwValidStats  : DWORD;      // Flags indicating which fields below are valid.
  13358.     dwVoices      : DWORD;      // Average number of voices playing.
  13359.     dwTotalCPU    : DWORD;      // Total CPU usage as percent * 100.
  13360.     dwCPUPerVoice : DWORD;      // CPU per voice as percent * 100.
  13361.     dwLostNotes   : DWORD;      // Number of notes lost in 1 second.
  13362.     dwFreeMemory  : DWORD;      // Free memory in bytes
  13363.     lPeakVolume   : Longint;    // Decibel level * 100.
  13364.   end;
  13365.   DMUS_SYNTHSTATS = TDMUS_SYNTHSTATS;
  13366.   LPDMUS_SYNTHSTATS = ^TDMUS_SYNTHSTATS;
  13367.  
  13368. const
  13369.   DMUS_SYNTHSTATS_VOICES        = 1;
  13370.   DMUS_SYNTHSTATS_TOTAL_CPU     = 2;
  13371.   DMUS_SYNTHSTATS_CPU_PER_VOICE = 4;
  13372.   DMUS_SYNTHSTATS_LOST_NOTES    = 8;
  13373.   DMUS_SYNTHSTATS_PEAK_VOLUME   = 16;
  13374.   DMUS_SYNTHSTATS_FREE_MEMORY   = 32;
  13375.  
  13376.   DMUS_SYNTHSTATS_SYSTEMMEMORY  = DMUS_PC_SYSTEMMEMORY;
  13377.  
  13378. type
  13379.   TDMUS_WAVES_REVERB_PARAMS = record
  13380.     fInGain          : Single;     // Input gain in dB (to avoid output overflows)
  13381.     fReverbMix       : Single;     // Reverb mix in dB. 0dB means 100% wet reverb (no direct signal)
  13382.                                    //Negative values gives less wet signal.
  13383.                                    //The coeficients are calculated so that the overall output level stays
  13384.                                    //(approximately) constant regardless of the ammount of reverb mix.
  13385.     fReverbTime      : Single;     // The reverb decay time, in milliseconds.
  13386.     fHighFreqRTRatio : Single;     // The ratio of the high frequencies to the global reverb time.
  13387.                                    //Unless very 'splashy-bright' reverbs are wanted, this should be set to
  13388.                                    //a value < 1.0.
  13389.                                    //For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the
  13390.                                    //decay time for high frequencies will be 100ms.
  13391.   end;
  13392.   DMUS_WAVES_REVERB_PARAMS = TDMUS_WAVES_REVERB_PARAMS;
  13393.  
  13394. //  Note: Default values for Reverb are:
  13395. //    fInGain             = 0.0dB   (no change in level)
  13396. //    fReverbMix          = -10.0dB   (a reasonable reverb mix)
  13397. //    fReverbTime         = 1000.0ms (one second global reverb time)
  13398. //    fHighFreqRTRatio    = 0.001    (the ratio of the high frequencies to the global reverb time)
  13399. ///
  13400.  
  13401.   DMUS_CLOCKTYPE = (DMUS_CLOCK_SYSTEM, DMUS_CLOCK_WAVE);  //DMUS_CLOCK_SYSTEM = 0,
  13402.                                                           //DMUS_CLOCK_WAVE = 1
  13403.  
  13404.   TDMUS_CLOCKINFO = record
  13405.     dwSize         : DWORD;
  13406.     ctType         : DMUS_CLOCKTYPE;
  13407.     guidClock      : TGUID;          // Identifies this time source
  13408.     wszDescription : array[0..DMUS_MAX_DESCRIPTION - 1] of WCHAR;
  13409.   end;
  13410.   DMUS_CLOCKINFO   = TDMUS_CLOCKINFO;
  13411.   LPDMUS_CLOCKINFO = ^TDMUS_CLOCKINFO;
  13412.  
  13413. type
  13414.   IDirectMusicBuffer = interface;
  13415.   IDirectMusicPort   = interface;
  13416.   IDirectMusicThru   = interface;
  13417.   IReferenceClock    = interface;
  13418.  
  13419.   LPDIRECTMUSICBUFFER = IDirectMusicBuffer;
  13420.   LPDIRECTMUSICPORT = IDirectMusicPort;
  13421.  
  13422.   IDirectMusic = interface(IUnknown)
  13423.     ['{6536115A-7B2D-11D2-BA18-0000F875AC12}']
  13424.     //  IDirectMusic
  13425.     function EnumPort(dwIndex: DWORD; var pPortCaps: TDMUS_PORTCAPS) : HResult; stdcall;
  13426.     function CreateMusicBuffer(const pBufferDesc: TDMUS_BUFFERDESC; out ppBuffer: IDirectMusicBuffer;
  13427.                                pUnkOuter: IUnknown) : HResult; stdcall;
  13428.     function CreatePort(const rclsidPort: TGUID; const pPortParams: TDMUS_PORTPARAMS;
  13429.                         out ppPort: IDirectMusicPort; pUnkOuter: IUnknown) : HResult; stdcall;
  13430.     function EnumMasterClock(dwIndex: DWORD; var lpClockInfo: TDMUS_CLOCKINFO) : HResult; stdcall;
  13431.     function GetMasterClock(pguidClock: PGUID; out ppReferenceClock: IReferenceClock) : HResult; stdcall;
  13432.     function SetMasterClock(const rguidClock: TGUID) : HResult; stdcall;
  13433.     function Activate(fEnable: BOOL) : HResult; stdcall;
  13434.     function GetDefaultPort(var pguidPort: TGUID) : HResult; stdcall;
  13435.     function SetDirectSound(pDirectSound: IDirectSound; hWnd: HWND) : HResult; stdcall;
  13436.   end;
  13437.  
  13438.   IDirectMusicBuffer = interface(IUnknown)
  13439.     ['{D2AC2878-B39B-11D1-8704-00600893B1BD}']
  13440.     //  IDirectMusicBuffer
  13441.     function Flush : HResult; stdcall;
  13442.     function TotalTime(var prtTime: TREFERENCE_TIME) : HResult; stdcall;
  13443.     function PackStructured(rt: TREFERENCE_TIME; dwChannelGroup: DWORD;
  13444.                             dwChannelMessage: DWORD) : HResult; stdcall;
  13445.     function PackUnstructured(rt: TREFERENCE_TIME; dwChannelGroup: DWORD;
  13446.                               cb: DWORD; const lpb) : HResult; stdcall;
  13447.     function ResetReadPtr : HResult; stdcall;
  13448.     function GetNextEvent(var prt: TREFERENCE_TIME; var pdwChannelGroup: DWORD;
  13449.                           var pdwLength: DWORD; var ppData: Pointer) : HResult; stdcall;
  13450.     function GetRawBufferPtr(var ppData: Pointer) : HResult; stdcall;
  13451.     function GetStartTime(var prt: TREFERENCE_TIME) : HResult; stdcall;
  13452.     function GetUsedBytes(var pcb: DWORD) : HResult; stdcall;
  13453.     function GetMaxBytes(var pcb: DWORD) : HResult; stdcall;
  13454.     function GetBufferFormat(var pGuidFormat: TGUID) : HResult; stdcall;
  13455.     function SetStartTime(rt: TREFERENCE_TIME) : HResult; stdcall;
  13456.     function SetUsedBytes(cb: DWORD) : HResult; stdcall;
  13457.   end;
  13458.                      
  13459. // Format of DirectMusic events in a buffer
  13460. //
  13461. // A buffer contains 1 or more events, each with the following header.
  13462. // Immediately following the header is the event data. The header+data
  13463. // size is rounded to the nearest quadword (8 bytes).
  13464. ///
  13465.   {TDMUS_EVENTHEADER = record
  13466.     cbEvent        : DWORD;                // Unrounded bytes in event
  13467.     dwChannelGroup : DWORD;                // Channel group of event
  13468.     rtDelta        : REFERENCE_TIME;       // Delta from start time of entire buffer
  13469.     dwFlags        : DWORD;                // Flags DMUS_EVENT_xxx
  13470.   end;
  13471.   DMUS_EVENTHEADER   = TDMUS_EVENTHEADER;
  13472.   LPDMUS_EVENTHEADER = ^TDMUS_EVENTHEADER;}
  13473.  
  13474.   IDirectMusicInstrument = interface(IUnknown)
  13475.     ['{D2AC287D-B39B-11D1-8704-00600893B1BD}']
  13476.     // IDirectMusicInstrument
  13477.     function GetPatch(var pdwPatch: DWORD) : HResult; stdcall;
  13478.     function SetPatch(dwPatch: DWORD) : HResult; stdcall;
  13479.   end;
  13480.  
  13481.  
  13482.   IDirectMusicDownloadedInstrument = interface(IUnknown)
  13483.     ['{D2AC287E-B39B-11D1-8704-00600893B1BD}']
  13484.     // IDirectMusicDownloadedInstrument
  13485.     // None at this time
  13486.   end;
  13487.  
  13488.   IDirectMusicCollection = interface(IUnknown)
  13489.     ['{D2AC287C-B39B-11D1-8704-00600893B1BD}']
  13490.     // IDirectMusicCollection
  13491.     function GetInstrument(dwPatch: DWORD; out ppInstrument: IDirectMusicInstrument) : HResult; stdcall;
  13492.     function EnumInstrument(dwIndex: DWORD; var pdwPatch: DWORD;
  13493.                             pwszName: LPWSTR; dwNameLen: DWORD) : HResult; stdcall;
  13494.   end;
  13495.  
  13496.   IDirectMusicDownload = interface(IUnknown)
  13497.     ['{D2AC287B-B39B-11D1-8704-00600893B1BD}']
  13498.     // IDirectMusicDownload
  13499.     function GetBuffer(var ppvBuffer: Pointer; var pdwSize: DWORD) : HResult; stdcall;
  13500.   end;
  13501.  
  13502.   IDirectMusicPortDownload = interface(IUnknown)
  13503.     ['{D2AC287A-B39B-11D1-8704-00600893B1BD}']
  13504.     // IDirectMusicPortDownload
  13505.     function GetBuffer(dwDLId: DWORD; out ppIDMDownload: IDirectMusicDownload) : HResult; stdcall;
  13506.     function AllocateBuffer(dwSize: DWORD; out ppIDMDownload: IDirectMusicDownload) : HResult; stdcall;
  13507.     function GetDLId(var pdwStartDLId; dwCount: DWORD) : HResult; stdcall;
  13508.     function GetAppend(var pdwAppend: DWORD) : HResult; stdcall;
  13509.     function Download(pIDMDownload: IDirectMusicDownload) : HResult; stdcall;
  13510.     function Unload(pIDMDownload: IDirectMusicDownload) : HResult; stdcall;
  13511.   end;
  13512.  
  13513. // These are the default priorities assigned if not overridden. By default priorities are
  13514. // equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as
  13515. // channel 5 on channel group 2).
  13516. //
  13517. // In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16
  13518. // except for 10.
  13519. ///
  13520.  
  13521.   IDirectMusicPort = interface(IUnknown)
  13522.     ['{08F2D8C9-37C2-11D2-B9F9-0000F875AC12}']
  13523.     //  IDirectMusicPort
  13524.     //
  13525.     function PlayBuffer(pBuffer: IDirectMusicBuffer) : HResult; stdcall;
  13526.     function SetReadNotificationHandle(hEvent: THandle) : HResult; stdcall;
  13527.     function Read(pBuffer: IDirectMusicBuffer) : HResult; stdcall;
  13528.     function DownloadInstrument(pInstrument: IDirectMusicInstrument;
  13529.                                 out ppDownloadedInstrument: IDirectMusicDownloadedInstrument;
  13530.                                 const pNoteRanges;
  13531.                                 dwNumNoteRanges: DWORD) : HResult; stdcall;
  13532.     function UnloadInstrument(pDownloadedInstrument: IDirectMusicDownloadedInstrument) : HResult; stdcall;
  13533.     function GetLatencyClock(out ppClock: IReferenceClock) : HResult; stdcall;
  13534.     function GetRunningStats(var pStats: TDMUS_SYNTHSTATS) : HResult stdcall;
  13535.     function Compact : HResult; stdcall;
  13536.     function GetCaps(var pPortCaps: TDMUS_PORTCAPS) : HResult; stdcall;
  13537.     function DeviceIoControl(dwIoControlCode: DWORD;
  13538.                              const lpInBuffer;
  13539.                              nInBufferSize: DWORD;
  13540.                              var lpOutBuffer;
  13541.                              nOutBufferSize: DWORD;
  13542.                              var lpBytesReturned: DWORD;
  13543.                              var lpOverlapped: TOVERLAPPED) : HResult; stdcall;
  13544.     function SetNumChannelGroups(dwChannelGroups: DWORD) : HResult; stdcall;
  13545.     function GetNumChannelGroups(var pdwChannelGroups: DWORD) : HResult; stdcall;
  13546.     function Activate(fActive: BOOL) : HResult; stdcall;
  13547.     function SetChannelPriority(dwChannelGroup: DWORD; dwChannel:  DWORD; dwPriority: DWORD) : HResult; stdcall;
  13548.     function GetChannelPriority(dwChannelGroup: DWORD; dwChannel: DWORD; var pdwPriority: DWORD) : HResult; stdcall;
  13549.     function SetDirectSound(pDirectSound: IDirectSound; pDirectSoundBuffer: IDirectSoundBuffer) : HResult; stdcall;
  13550.     function GetFormat(var pWaveFormatEx: TWAVEFORMATEX; var pdwWaveFormatExSize: DWORD; var pdwBufferSize: DWORD) : HResult; stdcall;
  13551.   end;
  13552.  
  13553.   IDirectMusicThru = interface(IUnknown)
  13554.     ['{CED153E7-3606-11D2-B9F9-0000F875AC12}']
  13555.     // IDirectMusicThru
  13556.     ///
  13557.     function ThruChannel(dwSourceChannelGroup: DWORD;
  13558.                          dwSourceChannel: DWORD;
  13559.                          dwDestinationChannelGroup: DWORD;
  13560.                          dwDestinationChannel: DWORD;
  13561.                          pDestinationPort: IDirectMusicPort) : HResult; stdcall;
  13562.   end;
  13563.  
  13564.   IReferenceClock = interface(IUnknown)
  13565.     ['{56A86897-0AD4-11CE-B03A-0020AF0BA770}']
  13566.     //  IReferenceClock
  13567.     //
  13568.  
  13569.     //  get the time now
  13570.     function GetTime(var pTime: TREFERENCE_TIME) : HResult; stdcall;
  13571.  
  13572.     //  ask for an async notification that a time has elapsed
  13573.     function AdviseTime(baseTime: TREFERENCE_TIME;         //  base time
  13574.                         streamTime: TREFERENCE_TIME;       //  stream offset time
  13575.                         hEvent: THandle;                   //  advise via this event
  13576.                         var pdwAdviseCookie: DWORD) : HResult; stdcall;   //  where your cookie goes
  13577.  
  13578.     //  ask for an async periodic notification that a time has elapsed
  13579.     function AdvisePeriodic(startTime: REFERENCE_TIME;        //  starting at this time
  13580.                             periodTime: REFERENCE_TIME;       //  time between notifications
  13581.                             hSemaphore: THandle;              //  advise via a semaphore
  13582.                             var pdwAdviseCookie: DWORD) : HResult; stdcall;   //  where your cookie goes
  13583.  
  13584.     //  cancel a request for notification
  13585.     function Unadvise(dwAdviseCookie: DWORD) : HResult; stdcall;
  13586.   end;
  13587.  
  13588. // Delphi‚̐«ŠiãAéŒ¾‚ðˆÚ“®‚³‚¹‚½‚à‚́BinterfaceAclassŒ^‚ÌforwardéŒ¾‚Í“¯‚¶typeƒ†ƒjƒbƒg“à‚ōĐ錾‚³‚ê‚È‚­‚Ä‚Í‚È‚ç‚È‚¢I
  13589. //const
  13590. // Format of DirectMusic events in a buffer
  13591. //
  13592. // A buffer contains 1 or more events, each with the following header.
  13593. // Immediately following the header is the event data. The header+data
  13594. // size is rounded to the nearest quadword (8 bytes).
  13595. ///
  13596.  
  13597.   //DMUS_EVENT_STRUCTURED = $00000001;  // Unstructured data (SysEx, etc.)
  13598.  
  13599. // The number of bytes to allocate for an event with 'cb' data bytes.
  13600. ///
  13601.   //function QWORD_ALIGN(x: Cardinal) : Cardinal;
  13602.   //function DMUS_EVENT_SIZE(cb: Cardinal) : Cardinal;
  13603.  
  13604. // Standard values for voice priorities. Numerically higher priorities are higher in priority.
  13605. // These priorities are used to set the voice priority for all voices on a channel. They are
  13606. // used in the dwPriority parameter of IDirectMusicPort::GetPriority and returned in the
  13607. // lpwPriority parameter of pdwPriority.
  13608. //
  13609. // These priorities are shared with DirectSound.
  13610. ///
  13611.  
  13612. const
  13613.   DAUD_CRITICAL_VOICE_PRIORITY = $F0000000;
  13614.   DAUD_HIGH_VOICE_PRIORITY     = $C0000000;
  13615.   DAUD_STANDARD_VOICE_PRIORITY = $80000000;
  13616.   DAUD_LOW_VOICE_PRIORITY      = $40000000;
  13617.   DAUD_PERSIST_VOICE_PRIORITY  = $10000000;
  13618.  
  13619. // These are the default priorities assigned if not overridden. By default priorities are
  13620. // equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as
  13621. // channel 5 on channel group 2).
  13622. //
  13623. // In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16
  13624. // except for 10.
  13625. ///
  13626.  
  13627.   DAUD_CHAN1_VOICE_PRIORITY_OFFSET = $0000000E;
  13628.   DAUD_CHAN2_VOICE_PRIORITY_OFFSET = $0000000D;
  13629.   DAUD_CHAN3_VOICE_PRIORITY_OFFSET = $0000000C;
  13630.   DAUD_CHAN4_VOICE_PRIORITY_OFFSET = $0000000B;
  13631.   DAUD_CHAN5_VOICE_PRIORITY_OFFSET = $0000000A;
  13632.   DAUD_CHAN6_VOICE_PRIORITY_OFFSET = $00000009;
  13633.   DAUD_CHAN7_VOICE_PRIORITY_OFFSET = $00000008;
  13634.   DAUD_CHAN8_VOICE_PRIORITY_OFFSET = $00000007;
  13635.   DAUD_CHAN9_VOICE_PRIORITY_OFFSET = $00000006;
  13636.   DAUD_CHAN10_VOICE_PRIORITY_OFFSET = $0000000F;
  13637.   DAUD_CHAN11_VOICE_PRIORITY_OFFSET = $00000005;
  13638.   DAUD_CHAN12_VOICE_PRIORITY_OFFSET = $00000004;
  13639.   DAUD_CHAN13_VOICE_PRIORITY_OFFSET = $00000003;
  13640.   DAUD_CHAN14_VOICE_PRIORITY_OFFSET = $00000002;
  13641.   DAUD_CHAN15_VOICE_PRIORITY_OFFSET = $00000001;
  13642.   DAUD_CHAN16_VOICE_PRIORITY_OFFSET = $00000000;
  13643.  
  13644.  
  13645.   DAUD_CHAN1_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN1_VOICE_PRIORITY_OFFSET);
  13646.   DAUD_CHAN2_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN2_VOICE_PRIORITY_OFFSET);
  13647.   DAUD_CHAN3_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN3_VOICE_PRIORITY_OFFSET);
  13648.   DAUD_CHAN4_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN4_VOICE_PRIORITY_OFFSET);
  13649.   DAUD_CHAN5_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN5_VOICE_PRIORITY_OFFSET);
  13650.   DAUD_CHAN6_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN6_VOICE_PRIORITY_OFFSET);
  13651.   DAUD_CHAN7_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN7_VOICE_PRIORITY_OFFSET);
  13652.   DAUD_CHAN8_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN8_VOICE_PRIORITY_OFFSET);
  13653.   DAUD_CHAN9_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN9_VOICE_PRIORITY_OFFSET);
  13654.   DAUD_CHAN10_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN10_VOICE_PRIORITY_OFFSET);
  13655.   DAUD_CHAN11_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN11_VOICE_PRIORITY_OFFSET);
  13656.   DAUD_CHAN12_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN12_VOICE_PRIORITY_OFFSET);
  13657.   DAUD_CHAN13_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN13_VOICE_PRIORITY_OFFSET);
  13658.   DAUD_CHAN14_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN14_VOICE_PRIORITY_OFFSET);
  13659.   DAUD_CHAN15_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN15_VOICE_PRIORITY_OFFSET);
  13660.   DAUD_CHAN16_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN16_VOICE_PRIORITY_OFFSET);
  13661.  
  13662.  
  13663. //GUID definition
  13664.   IID_IReferenceClock         : TGUID = '{56A86897-0AD4-11CE-B03A-0020AF0BA770}';
  13665.  
  13666.   CLSID_DirectMusic           : TGUID = '{636B9F10-0C7D-11D1-95B2-0020AFDC7421}';
  13667.   CLSID_DirectMusicCollection : TGUID = '{480FF4B0-28B2-11D1-BEF7-00C04FBF8FEF}';
  13668.   CLSID_DirectMusicSynth      : TGUID = '{58C2B4D0-46E7-11D1-89AC-00A0C9054129}';
  13669.  
  13670.   IID_IDirectMusic            : TGUID = '{6536115A-7B2D-11D2-BA18-0000F875AC12}';
  13671.   IID_IDirectMusicBuffer      : TGUID = '{D2AC2878-B39B-11D1-8704-00600893B1BD}';
  13672.   IID_IDirectMusicPort        : TGUID = '{08F2D8C9-37C2-11D2-B9F9-0000F875AC12}';
  13673.   IID_IDirectMusicThru        : TGUID = '{CED153E7-3606-11D2-B9F9-0000F875AC12}';
  13674.   IID_IDirectMusicPortDownload: TGUID = '{D2AC287A-B39B-11D1-8704-00600893B1BD}';
  13675.   IID_IDirectMusicDownload    : TGUID = '{D2AC287B-B39B-11D1-8704-00600893B1BD}';
  13676.   IID_IDirectMusicCollection  : TGUID = '{D2AC287C-B39B-11D1-8704-00600893B1BD}';
  13677.   IID_IDirectMusicInstrument  : TGUID = '{D2AC287D-B39B-11D1-8704-00600893B1BD}';
  13678.   IID_IDirectMusicDownloadedInstrument: TGUID = '{D2AC287E-B39B-11D1-8704-00600893B1BD}';
  13679.  
  13680. // Alternate interface ID for IID_IDirectMusic, available in DX7 release and after.
  13681.   IID_IDirectMusic2           : TGUID = '{6FC2CAE1-BC78-11D2-AFA6-00AA0024D8B6}';
  13682.  
  13683. // Property Query GUID_DMUS_PROP_GM_Hardware - Local GM set, no need to download
  13684. // Property Query GUID_DMUS_PROP_GS_Hardware - Local GS set, no need to download
  13685. // Property Query GUID_DMUS_PROP_XG_Hardware - Local XG set, no need to download
  13686. // Property Query GUID_DMUS_PROP_DLS1        - Support DLS level 1
  13687. // Property Query GUID_DMUS_PROP_XG_Capable  - Support minimum requirements of XG
  13688. // Property Query GUID_DMUS_PROP_GS_Capable  - Support minimum requirements of GS
  13689. // Property Query GUID_DMUS_PROP_SynthSink_DSOUND - Synthsink talks to DSound
  13690. // Property Query GUID_DMUS_PROP_SynthSink_WAVE - Synthsink talks to Wave device
  13691. //
  13692. // Item 0: Supported
  13693. // Returns a DWORD which is non-zero if the feature is supported
  13694. ///
  13695.   GUID_DMUS_PROP_GM_Hardware     : TGUID = '{178F2F24-C364-11D1-A760-0000F875AC12}';
  13696.   GUID_DMUS_PROP_GS_Hardware     : TGUID = '{178F2F25-C364-11D1-A760-0000F875AC12}';
  13697.   GUID_DMUS_PROP_XG_Hardware     : TGUID = '{178F2F26-C364-11D1-A760-0000F875AC12}';
  13698.   GUID_DMUS_PROP_XG_Capable      : TGUID = '{6496ABA1-61B0-11D2-AFA6-00AA0024D8B6}';
  13699.   GUID_DMUS_PROP_GS_Capable      : TGUID = '{6496ABA2-61B0-11D2-AFA6-00AA0024D8B6}';
  13700.   GUID_DMUS_PROP_DLS1            : TGUID = '{178F2F27-C364-11D1-A760-0000F875AC12}';
  13701.   GUID_DMUS_PROP_SynthSink_DSOUND: TGUID = '{0AA97844-C877-11D1-870C-00600893B1BD}';
  13702.   GUID_DMUS_PROP_SynthSink_WAVE  : TGUID = '{0AA97845-C877-11D1-870C-00600893B1BD}';
  13703.  
  13704. // Property Get/Set GUID_DMUS_PROP_WriteLatency
  13705. //
  13706. // Item 0: Synth buffer write latency, in milliseconds
  13707. // Get/Set SynthSink latency, the average time after the play head that the next buffer gets written.
  13708. ///
  13709.   GUID_DMUS_PROP_WriteLatency    : TGUID = '{268A0FA0-60F2-11D2-AFA6-00AA0024D8B6}';
  13710.  
  13711. // Property Get/Set GUID_DMUS_PROP_WritePeriod
  13712. //
  13713. // Item 0: Synth buffer write period, in milliseconds
  13714. // Get/Set SynthSink buffer write period, time span between successive writes.
  13715. ///
  13716.   GUID_DMUS_PROP_WritePeriod     : TGUID = '{268A0FA1-60F2-11D2-AFA6-00AA0024D8B6}';
  13717.  
  13718. // Property Get GUID_DMUS_PROP_MemorySize
  13719. //
  13720. // Item 0: Memory size
  13721. // Returns a DWORD containing the total number of bytes of sample RAM
  13722. ///
  13723.   GUID_DMUS_PROP_MemorySize      : TGUID = '{178F2F28-C364-11D1-A760-0000F875AC12}';
  13724.  
  13725. // Property Set GUID_DMUS_PROP_WavesReverb
  13726. //
  13727. // Item 0: DMUS_WAVES_REVERB structure
  13728. // Sets reverb parameters
  13729. ///
  13730.   GUID_DMUS_PROP_WavesReverb     : TGUID = '{04CB5622-32E5-11D2-AFA6-00AA0024D8B6}';
  13731.  
  13732. // Property Set GUID_DMUS_PROP_Effects
  13733. //
  13734. // Item 0: DWORD with effects flags.
  13735. // Get/Set effects bits, same as dwEffectFlags in DMUS_PORTPARAMS and DMUS_PORTCAPS:
  13736. // DMUS_EFFECT_NONE
  13737. // DMUS_EFFECT_REVERB
  13738. // DMUS_EFFECT_CHORUS
  13739. ///
  13740.   GUID_DMUS_PROP_Effects         : TGUID = '{CDA8D611-684A-11D2-871E-00600893B1BD}';
  13741.  
  13742. // Property Set GUID_DMUS_PROP_LegacyCaps
  13743. //
  13744. // Item 0: The MIDINCAPS or MIDIOUTCAPS which describes the port's underlying WinMM device. This property is only supported
  13745. // by ports which wrap WinMM devices.
  13746. ///
  13747.  
  13748.   GUID_DMUS_PROP_LegacyCaps      : TGUID = '{CFA7CDC2-00A1-11D2-AAD5-0000F875AC12}';
  13749.  
  13750. // Property Set GUID_DMUS_Volume
  13751. //
  13752. // Item 0: A long which contains an offset, in 1/100 dB, to be added to the final volume
  13753. //
  13754. ///
  13755.   GUID_DMUS_PROP_Volume          : TGUID = '{FEDFAE25-E46E-11D1-AACE-0000F875AC12}';
  13756.  
  13757.  
  13758.  
  13759.  
  13760.  
  13761. //***********************************************************************
  13762. //                                                                      *
  13763. //   dmusici.h -- This module contains the API for the                  *
  13764. //                DirectMusic performance layer                         *
  13765. //                                                                      *
  13766. //   Copyright (c) 1998, Microsoft Corp. All rights reserved.           *
  13767. //                                                                      *
  13768. //**********************************************************************
  13769. type
  13770.   TRANSITION_TYPE = Word;
  13771.   MUSIC_TIME      = Longint;
  13772.  
  13773. const
  13774.   DMUS_PPQ        = 768;     // parts per quarter note
  13775.  
  13776. const
  13777.   DMUS_MAX_NAME          = 64;         // Maximum object name length.
  13778.   DMUS_MAX_CATEGORY      = 64;         // Maximum object category name length.
  13779.   DMUS_MAX_FILENAME      = MAX_PATH;
  13780.  
  13781.  
  13782.  
  13783. const
  13784.   DMUS_COMMANDT_GROOVE            = 0;
  13785.   DMUS_COMMANDT_FILL              = 1;
  13786.   DMUS_COMMANDT_INTRO             = 2;
  13787.   DMUS_COMMANDT_BREAK             = 3;
  13788.   DMUS_COMMANDT_END               = 4;
  13789.   DMUS_COMMANDT_ENDANDINTRO       = 5;
  13790. {typedef enum enumDMUS_COMMANDT_TYPES
  13791. {
  13792.     DMUS_COMMANDT_GROOVE            = 0,
  13793.     DMUS_COMMANDT_FILL              = 1,
  13794.     DMUS_COMMANDT_INTRO             = 2,
  13795.     DMUS_COMMANDT_BREAK             = 3,
  13796.     DMUS_COMMANDT_END               = 4,
  13797.     DMUS_COMMANDT_ENDANDINTRO       = 5
  13798.  DMUS_COMMANDT_TYPES;}
  13799.  
  13800.   DMUS_SHAPET_FALLING             = 0;
  13801.   DMUS_SHAPET_LEVEL               = 1;
  13802.   DMUS_SHAPET_LOOPABLE            = 2;
  13803.   DMUS_SHAPET_LOUD                = 3;
  13804.   DMUS_SHAPET_QUIET               = 4;
  13805.   DMUS_SHAPET_PEAKING             = 5;
  13806.   DMUS_SHAPET_RANDOM              = 6;
  13807.   DMUS_SHAPET_RISING              = 7;
  13808.   DMUS_SHAPET_SONG                = 8;
  13809. {typedef enum enumDMUS_SHAPET_TYPES
  13810. {
  13811.     DMUS_SHAPET_FALLING             = 0,
  13812.     DMUS_SHAPET_LEVEL               = 1,
  13813.     DMUS_SHAPET_LOOPABLE            = 2,
  13814.     DMUS_SHAPET_LOUD                = 3,
  13815.     DMUS_SHAPET_QUIET               = 4,
  13816.     DMUS_SHAPET_PEAKING             = 5,
  13817.     DMUS_SHAPET_RANDOM              = 6,
  13818.     DMUS_SHAPET_RISING              = 7,
  13819.     DMUS_SHAPET_SONG                = 8
  13820.    DMUS_SHAPET_TYPES;}
  13821.  
  13822.   DMUS_COMPOSEF_NONE              = 0;
  13823.   DMUS_COMPOSEF_ALIGN             = $1;
  13824.   DMUS_COMPOSEF_OVERLAP           = $2;
  13825.   DMUS_COMPOSEF_IMMEDIATE         = $4;
  13826.   DMUS_COMPOSEF_GRID              = $8;
  13827.   DMUS_COMPOSEF_BEAT              = $10;
  13828.   DMUS_COMPOSEF_MEASURE           = $20;
  13829.   DMUS_COMPOSEF_AFTERPREPARETIME  = $40;
  13830.   DMUS_COMPOSEF_MODULATE          = $1000;
  13831.   DMUS_COMPOSEF_LONG              = $2000;
  13832. {typedef enum enumDMUS_COMPOSEF_FLAGS
  13833. {
  13834.     DMUS_COMPOSEF_NONE              = 0,
  13835.     DMUS_COMPOSEF_ALIGN             = 0x1,
  13836.     DMUS_COMPOSEF_OVERLAP           = 0x2,
  13837.     DMUS_COMPOSEF_IMMEDIATE         = 0x4,
  13838.     DMUS_COMPOSEF_GRID              = 0x8,
  13839.     DMUS_COMPOSEF_BEAT              = 0x10,
  13840.     DMUS_COMPOSEF_MEASURE           = 0x20,
  13841.     DMUS_COMPOSEF_AFTERPREPARETIME  = 0x40,
  13842.     DMUS_COMPOSEF_MODULATE          = 0x1000,
  13843.     DMUS_COMPOSEF_LONG              = 0x2000
  13844.    DMUS_COMPOSEF_FLAGS;}
  13845.  
  13846. const
  13847. // DMUS_PMSGF_FLAGS fill the DMUS_PMSG's dwFlags member
  13848.   DMUS_PMSGF_REFTIME          = 1;      // if rtTime is valid
  13849.   DMUS_PMSGF_MUSICTIME        = 2;      // if mtTime is valid
  13850.   DMUS_PMSGF_TOOL_IMMEDIATE   = 4;      // if PMSG should be processed immediately
  13851.   DMUS_PMSGF_TOOL_QUEUE       = 8;      // if PMSG should be processed a little early, at Queue time
  13852.   DMUS_PMSGF_TOOL_ATTIME      = 16;     // if PMSG should be processed at the time stamp
  13853.   DMUS_PMSGF_TOOL_FLUSH       = 32;     // if PMSG is being flushed
  13854.   // The values of DMUS_TIME_RESOLVE_FLAGS may also be used inside the
  13855.   // DMUS_PMSG's dwFlags member.
  13856.  
  13857. type
  13858.   TDMUS_PMSGF_FLAGS    = Cardinal;
  13859.   DMUS_PMSGF_FLAGS     = TDMUS_PMSGF_FLAGS;
  13860. {typedef enum enumDMUS_PMSGF_FLAGS
  13861. {
  13862.     DMUS_PMSGF_REFTIME          = 1,      /* if rtTime is valid
  13863.     DMUS_PMSGF_MUSICTIME        = 2,      /* if mtTime is valid
  13864.     DMUS_PMSGF_TOOL_IMMEDIATE   = 4,      /* if PMSG should be processed immediately
  13865.     DMUS_PMSGF_TOOL_QUEUE       = 8,      /* if PMSG should be processed a little early, at Queue time
  13866.     DMUS_PMSGF_TOOL_ATTIME      = 16,     /* if PMSG should be processed at the time stamp
  13867.     DMUS_PMSGF_TOOL_FLUSH       = 32      /* if PMSG is being flushed
  13868.     /* The values of DMUS_TIME_RESOLVE_FLAGS may also be used inside the
  13869.     /* DMUS_PMSG's dwFlags member.
  13870.  DMUS_PMSGF_FLAGS;}
  13871.  
  13872. const
  13873. // DMUS_PMSGT_TYPES fill the DMUS_PMSG's dwType member
  13874.   DMUS_PMSGT_MIDI             = 0;      // MIDI short message
  13875.   DMUS_PMSGT_NOTE             = 1;      // Interactive Music Note
  13876.   DMUS_PMSGT_SYSEX            = 2;      // MIDI long message (system exclusive message)
  13877.   DMUS_PMSGT_NOTIFICATION     = 3;      // Notification message
  13878.   DMUS_PMSGT_TEMPO            = 4;      // Tempo message
  13879.   DMUS_PMSGT_CURVE            = 5;      // Control change / pitch bend, etc. curve
  13880.   DMUS_PMSGT_TIMESIG          = 6;      // Time signature
  13881.   DMUS_PMSGT_PATCH            = 7;      // Patch changes
  13882.   DMUS_PMSGT_TRANSPOSE        = 8;      // Transposition messages
  13883.   DMUS_PMSGT_CHANNEL_PRIORITY = 9;      // Channel priority
  13884.   DMUS_PMSGT_STOP             = 10;     // Stop message
  13885.   DMUS_PMSGT_DIRTY            = 11;     // Tells Tools that cache GetParam() info to refresh
  13886.   DMUS_PMSGT_USER             = 255;    // User message
  13887.  
  13888. type
  13889.   TDMUS_PMSGT_TYPES = Cardinal;
  13890.   DMUS_PMSGT_TYPES  = TDMUS_PMSGT_TYPES;
  13891.  
  13892. {typedef enum enumDMUS_PMSGT_TYPES
  13893. {
  13894.     DMUS_PMSGT_MIDI             = 0,      /* MIDI short message
  13895.     DMUS_PMSGT_NOTE             = 1,      /* Interactive Music Note
  13896.     DMUS_PMSGT_SYSEX            = 2,      /* MIDI long message (system exclusive message)
  13897.     DMUS_PMSGT_NOTIFICATION     = 3,      /* Notification message
  13898.     DMUS_PMSGT_TEMPO            = 4,      /* Tempo message
  13899.     DMUS_PMSGT_CURVE            = 5,      /* Control change / pitch bend, etc. curve
  13900.     DMUS_PMSGT_TIMESIG          = 6,      /* Time signature
  13901.     DMUS_PMSGT_PATCH            = 7,      /* Patch changes
  13902.     DMUS_PMSGT_TRANSPOSE        = 8,      /* Transposition messages
  13903.     DMUS_PMSGT_CHANNEL_PRIORITY = 9,      /* Channel priority
  13904.     DMUS_PMSGT_STOP             = 10,     /* Stop message
  13905.     DMUS_PMSGT_DIRTY            = 11,     /* Tells Tools that cache GetParam() info to refresh
  13906.     DMUS_PMSGT_USER             = 255     /* User message
  13907.  DMUS_PMSGT_TYPES;}
  13908.  
  13909. const
  13910. // DMUS_SEGF_FLAGS correspond to IDirectMusicPerformance::PlaySegment, and other API
  13911.   DMUS_SEGF_REFTIME           = 64;        // time parameter is in reference time  
  13912.   DMUS_SEGF_SECONDARY         = 128;       // secondary segment
  13913.   DMUS_SEGF_QUEUE             = 256;       // queue at the end of the primary segment queue (primary only)
  13914.   DMUS_SEGF_CONTROL           = 512;       // play as a control track (secondary segments only)
  13915.   DMUS_SEGF_AFTERPREPARETIME  = 1 shl 10;  // play after the prepare time (See IDirectMusicPerformance::GetPrepareTime)
  13916.   DMUS_SEGF_GRID              = 1 shl 11;  // play on grid boundary
  13917.   DMUS_SEGF_BEAT              = 1 shl 12;  // play on beat boundary
  13918.   DMUS_SEGF_MEASURE           = 1 shl 13;  // play on measure boundary
  13919.   DMUS_SEGF_DEFAULT           = 1 shl 14;  // use segment's default boundary
  13920.   DMUS_SEGF_NOINVALIDATE      = 1 shl 15;  // play without invalidating the currently playing segment(s)
  13921.  
  13922. type
  13923.   TDMUS_SEGF_FLAGS = Cardinal;
  13924.   DMUS_SEGF_FLAGS  = TDMUS_SEGF_FLAGS;
  13925.  
  13926. {typedef enum enumDMUS_SEGF_FLAGS
  13927. {
  13928.     DMUS_SEGF_REFTIME           = 64,     /* time parameter is in reference time  
  13929.     DMUS_SEGF_SECONDARY         = 128,    /* secondary segment
  13930.     DMUS_SEGF_QUEUE             = 256,    /* queue at the end of the primary segment queue (primary only)
  13931.     DMUS_SEGF_CONTROL           = 512,    /* play as a control track (secondary segments only)
  13932.     DMUS_SEGF_AFTERPREPARETIME  = 1<<10,  /* play after the prepare time (See IDirectMusicPerformance::GetPrepareTime)
  13933.     DMUS_SEGF_GRID              = 1<<11,  /* play on grid boundary
  13934.     DMUS_SEGF_BEAT              = 1<<12,  /* play on beat boundary
  13935.     DMUS_SEGF_MEASURE           = 1<<13,  /* play on measure boundary
  13936.     DMUS_SEGF_DEFAULT           = 1<<14,  /* use segment's default boundary
  13937.     DMUS_SEGF_NOINVALIDATE      = 1<<15   /* play without invalidating the currently playing segment(s)
  13938.  DMUS_SEGF_FLAGS;}
  13939.  
  13940. const
  13941. // DMUS_TIME_RESOLVE_FLAGS correspond to IDirectMusicPerformance::GetResolvedTime, and can
  13942. // also be used interchangeably with the corresponding DMUS_SEGF_FLAGS, since their values
  13943. // are intentionally the same
  13944.   DMUS_TIME_RESOLVE_AFTERPREPARETIME  = 1 shl 10;  // resolve to a time after the prepare time
  13945.   DMUS_TIME_RESOLVE_GRID              = 1 shl 11;  // resolve to a time on a grid boundary
  13946.   DMUS_TIME_RESOLVE_BEAT              = 1 shl 12;  // resolve to a time on a beat boundary
  13947.   DMUS_TIME_RESOLVE_MEASURE           = 1 shl 13;  // resolve to a time on a measure boundary
  13948.  
  13949. type
  13950.   TDMUS_TIME_RESOLVE_FLAGS = Cardinal;
  13951.   DMUS_TIME_RESOLVE_FLAGS  = TDMUS_TIME_RESOLVE_FLAGS;
  13952.  
  13953. {typedef enum enumDMUS_TIME_RESOLVE_FLAGS
  13954. {
  13955.     DMUS_TIME_RESOLVE_AFTERPREPARETIME  = 1<<10,  /* resolve to a time after the prepare time
  13956.     DMUS_TIME_RESOLVE_GRID              = 1<<11,  /* resolve to a time on a grid boundary
  13957.     DMUS_TIME_RESOLVE_BEAT              = 1<<12,  /* resolve to a time on a beat boundary
  13958.     DMUS_TIME_RESOLVE_MEASURE           = 1<<13   /* resolve to a time on a measure boundary
  13959.  DMUS_TIME_RESOLVE_FLAGS;}
  13960.  
  13961. const
  13962. // The following flags are sent in the IDirectMusicTrack::Play() method
  13963. // inside the dwFlags parameter
  13964.   DMUS_TRACKF_SEEK            = 1;      // set on a seek
  13965.   DMUS_TRACKF_LOOP            = 2;      // set on a loop (repeat)
  13966.   DMUS_TRACKF_START           = 4;      // set on first call to Play
  13967.   DMUS_TRACKF_FLUSH           = 8;      // set when this call is in response to a flush on the perfomance
  13968.   DMUS_TRACKF_DIRTY           = 16;     // set when the track should consider any cached values from a previous call to GetParam to be invalidated
  13969.  
  13970. type
  13971.   TDMUS_TRACKF_FLAGS = Cardinal;
  13972.   DMUS_TRACKF_FLAGS  = TDMUS_TRACKF_FLAGS;
  13973.  
  13974. {typedef enum enumDMUS_TRACKF_FLAGS
  13975. {
  13976.     DMUS_TRACKF_SEEK            = 1,      /* set on a seek
  13977.     DMUS_TRACKF_LOOP            = 2,      /* set on a loop (repeat)
  13978.     DMUS_TRACKF_START           = 4,      /* set on first call to Play
  13979.     DMUS_TRACKF_FLUSH           = 8,      /* set when this call is in response to a flush on the perfomance
  13980.     DMUS_TRACKF_DIRTY           = 16,     /* set when the track should consider any cached values from a previous call to GetParam to be invalidated
  13981.  DMUS_TRACKF_FLAGS;}
  13982.  
  13983. const
  13984.   DMUS_MAXSUBCHORD = 8;
  13985.  
  13986. type
  13987.   TDMUS_SUBCHORD = record
  13988.     dwChordPattern    : DWORD;     // Notes in the subchord
  13989.     dwScalePattern    : DWORD;     // Notes in the scale
  13990.     dwInversionPoints : DWORD;     // Where inversions can occur
  13991.     dwLevels          : DWORD;     // Which levels are supported by this subchord
  13992.     bChordRoot        : Byte;      // Root of the subchord
  13993.     bScaleRoot        : Byte;      // Root of the scale
  13994.   end;
  13995.   DMUS_SUBCHORD = TDMUS_SUBCHORD;
  13996.  
  13997.   TDMUS_CHORD_KEY = record
  13998.     wszName        : array[0..15] of WideChar;                        // Name of the chord
  13999.     wMeasure       : Word;                                            // Measure this falls on
  14000.     bBeat          : Byte;                                            // Beat this falls on
  14001.     bSubChordCount : Byte;                                            // Number of chords in the list of subchords
  14002.     SubChordList   : array[0..DMUS_MAXSUBCHORD - 1] of TDMUS_SUBCHORD;// List of sub chords
  14003.     dwScale        : DWORD;                                           // Scale underlying the entire chord
  14004.     bKey           : Byte;                                            // Key underlying the entire chord
  14005.   end;
  14006.   DMUS_CHORD_KEY = TDMUS_CHORD_KEY;
  14007.  
  14008. const
  14009. //typedef enum enumDMUS_NOTEF_FLAGS
  14010.   DMUS_NOTEF_NOTEON = 1;     // Set if this is a MIDI Note On. Otherwise, it is MIDI Note Off
  14011.  
  14012. type
  14013.   TDMUS_NOTEF_FLAGS = Cardinal;
  14014.   DMUS_NOTEF_FLAGS  = TDMUS_NOTEF_FLAGS;
  14015.  
  14016. // The DMUS_PLAYMODE_FLAGS are used to determine how to convert wMusicValue
  14017. //  into the appropriate bMidiValue.
  14018. ///
  14019. const
  14020. //typedef enum enumDMUS_PLAYMODE_FLAGS
  14021.   DMUS_PLAYMODE_KEY_ROOT          = 1;  // Transpose on top of the key root.
  14022.   DMUS_PLAYMODE_CHORD_ROOT        = 2;  // Transpose on top of the chord root.
  14023.   DMUS_PLAYMODE_SCALE_INTERVALS   = 4;  // Use scale intervals from scale pattern.
  14024.   DMUS_PLAYMODE_CHORD_INTERVALS   = 8;  // Use chord intervals from chord pattern.
  14025.   DMUS_PLAYMODE_NONE              = 16; // No mode. Indicates the parent part's mode should be used.
  14026.  
  14027. type
  14028.   TDMUS_PLAYMODE_FLAGS = Cardinal;
  14029.   DMUS_PLAYMODE_FLAGS  = TDMUS_PLAYMODE_FLAGS;
  14030.  
  14031. // The following are playback modes that can be created by combining the DMUS_PLAYMODE_FLAGS
  14032. //   in various ways:
  14033. ///
  14034.  
  14035. // Fixed. wMusicValue holds final MIDI note value. This is used for drums, sound effects, and sequenced
  14036. //   notes that should not be transposed by the chord or scale.
  14037. ///
  14038. const
  14039.   DMUS_PLAYMODE_FIXED            = 0;
  14040. // In fixed to key, the musicvalue is again a fixed MIDI value, but it
  14041. //   is transposed on top of the key root.
  14042. ///
  14043.   DMUS_PLAYMODE_FIXEDTOKEY       = DMUS_PLAYMODE_KEY_ROOT;
  14044. // In fixed to chord, the musicvalue is also a fixed MIDI value, but it
  14045. //   is transposed on top of the chord root.
  14046. ///
  14047.   DMUS_PLAYMODE_FIXEDTOCHORD     = DMUS_PLAYMODE_CHORD_ROOT;
  14048. // In Pedalpoint, the key root is used and the notes only track the intervals in
  14049. //   the scale. The chord root and intervals are completely ignored. This is useful
  14050. //   for melodic lines that play relative to the key root.
  14051. ///
  14052.   DMUS_PLAYMODE_PEDALPOINT       = (DMUS_PLAYMODE_KEY_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS);
  14053. // In the Melodic mode, the chord root is used but the notes only track the intervals in
  14054. //   the scale. The key root and chord intervals are completely ignored. This is useful
  14055. //   for melodic lines that play relative to the chord root.
  14056. ///
  14057.   DMUS_PLAYMODE_MELODIC          = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS);
  14058. // Normal chord mode is the prevalent playback mode.
  14059. //   The notes track the intervals in the chord, which is based on the chord root.
  14060. //   If there is a scale component to the MusicValue, the additional intervals
  14061. //   are pulled from the scale and added.
  14062. //   If the chord does not have an interval to match the chord component of
  14063. //   the MusicValue, the note is silent.
  14064. ///
  14065.   DMUS_PLAYMODE_NORMALCHORD      = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_CHORD_INTERVALS);
  14066. // If it is desirable to play a note that is above the top of the chord, the
  14067. //   always play mode (known as "purpleized" in a former life) finds a position
  14068. //   for the note by using intervals from the scale. Essentially, this mode is
  14069. //   a combination of the Normal and Melodic playback modes, where a failure
  14070. //   in Normal causes a second try in Melodic mode.
  14071. ///
  14072.   DMUS_PLAYMODE_ALWAYSPLAY       = (DMUS_PLAYMODE_MELODIC or DMUS_PLAYMODE_NORMALCHORD);
  14073.  
  14074. //  Legacy names for modes...
  14075.   DMUS_PLAYMODE_PURPLEIZED       = DMUS_PLAYMODE_ALWAYSPLAY;
  14076.   DMUS_PLAYMODE_SCALE_ROOT       = DMUS_PLAYMODE_KEY_ROOT;
  14077.   DMUS_PLAYMODE_FIXEDTOSCALE     = DMUS_PLAYMODE_FIXEDTOKEY;
  14078.  
  14079. const
  14080.   DMUS_TEMPO_MAX         = 350;
  14081.   DMUS_TEMPO_MIN         = 10;
  14082.  
  14083.   DMUS_MASTERTEMPO_MAX   = 2.0;
  14084.   DMUS_MASTERTEMPO_MIN   = 0.25;
  14085.  
  14086. const
  14087.   DMUS_CURVE_RESET = 1;           // Set if the curve needs to be reset.
  14088.  
  14089. type
  14090.   TDMUS_CURVE_FLAGS = Cardinal;
  14091.   DMUS_CURVE_FLAGS  = TDMUS_CURVE_FLAGS;
  14092. {
  14093.     DMUS_CURVE_RESET = 1,           /* Set if the curve needs to be reset.
  14094.  DMUS_CURVE_FLAGS; }
  14095.  
  14096.  
  14097. const
  14098.   //DMUS_CURVE_RESET   = 1;
  14099.  
  14100. // Curve shapes
  14101.   DMUS_CURVES_LINEAR  = 0;
  14102.   DMUS_CURVES_INSTANT = 1;
  14103.   DMUS_CURVES_EXP     = 2;
  14104.   DMUS_CURVES_LOG     = 3;
  14105.   DMUS_CURVES_SINE    = 4;
  14106.  
  14107. // curve types
  14108.   DMUS_CURVET_PBCURVE     = $03;
  14109.   DMUS_CURVET_CCCURVE     = $04;
  14110.   DMUS_CURVET_MATCURVE    = $05;
  14111.   DMUS_CURVET_PATCURVE    = $06;
  14112.  
  14113. // notification type values
  14114. // The following correspond to GUID_NOTIFICATION_SEGMENT
  14115. const
  14116.   DMUS_NOTIFICATION_SEGSTART     = 0;
  14117.   DMUS_NOTIFICATION_SEGEND       = 1;
  14118.   DMUS_NOTIFICATION_SEGALMOSTEND = 2;
  14119.   DMUS_NOTIFICATION_SEGLOOP      = 3;
  14120.   DMUS_NOTIFICATION_SEGABORT     = 4;
  14121. // The following correspond to GUID_NOTIFICATION_PERFORMANCE
  14122.   DMUS_NOTIFICATION_MUSICSTARTED = 0;
  14123.   DMUS_NOTIFICATION_MUSICSTOPPED = 1;
  14124. // The following corresponds to GUID_NOTIFICATION_MEASUREANDBEAT
  14125.   DMUS_NOTIFICATION_MEASUREBEAT  = 0;
  14126. // The following corresponds to GUID_NOTIFICATION_CHORD
  14127.   DMUS_NOTIFICATION_CHORD        = 0;
  14128. // The following correspond to GUID_NOTIFICATION_COMMAND
  14129.   DMUS_NOTIFICATION_GROOVE       = 0;
  14130.   DMUS_NOTIFICATION_EMBELLISHMENT= 1;
  14131.  
  14132. type
  14133. // Time Signature structure, used by IDirectMusicStyle
  14134. // Also used as a parameter for GetParam() and SetParam
  14135.   TDMUS_TIMESIGNATURE = record
  14136.     mtTime           : MUSIC_TIME;
  14137.     bBeatsPerMeasure : Byte;        // beats per measure (top of time sig)
  14138.     bBeat            : Byte;        // what note receives the beat (bottom of time sig.)
  14139.                                     // we can assume that 0 means 256th note
  14140.     wGridsPerBeat    : Word;        // grids per beat
  14141.   end;
  14142.   DMUS_TIMESIGNATURE = TDMUS_TIMESIGNATURE;
  14143.  
  14144. //      Flags for dwValidData. When set, a flag indicates that the
  14145. //      corresponding field in DMUSOBJECTDESC holds valid data.
  14146. const
  14147.   DMUS_OBJ_OBJECT         = 1 shl 0;     // Object GUID is valid.
  14148.   DMUS_OBJ_CLASS          = 1 shl 1;     // Class GUID is valid.
  14149.   DMUS_OBJ_NAME           = 1 shl 2;     // Name is valid.
  14150.   DMUS_OBJ_CATEGORY       = 1 shl 3;     // Category is valid.
  14151.   DMUS_OBJ_FILENAME       = 1 shl 4;     // File path is valid.
  14152.   DMUS_OBJ_FULLPATH       = 1 shl 5;     // Path is full path.
  14153.   DMUS_OBJ_URL            = 1 shl 6;     // Path is URL.
  14154.   DMUS_OBJ_VERSION        = 1 shl 7;     // Version is valid.
  14155.   DMUS_OBJ_DATE           = 1 shl 8;     // Date is valid.
  14156.   DMUS_OBJ_LOADED         = 1 shl 9;     // Object is currently loaded in memory.
  14157.   DMUS_OBJ_MEMORY         = 1 shl 10;    // Object is pointed to by pbMemData.
  14158.  
  14159. const
  14160.   DMUSB_LOADED    = 1 shl 0;        // Set when band has been loaded
  14161.   DMUSB_DEFAULT   = 1 shl 1;        // Set when band is default band for a style
  14162.  
  14163. type
  14164.   IDirectMusicTrack = interface;
  14165.   IDirectMusicPerformance = interface;
  14166.   IDirectMusicTool = interface;
  14167.   IDirectMusicSegment = interface;
  14168.   IDirectMusicSegmentState = interface;
  14169.   IDirectMusicGraph = interface;
  14170.   //IDirectMusicPort = interface;
  14171.   //IDirectMusicBuffer = interface;
  14172.   //IDirectMusicInstrument = interface;
  14173.   //IDirectMusicDownloadedInstrument = interface;
  14174.   IDirectMusicBand = interface;
  14175.   IDirectMusicChordMap = interface;
  14176.   IDirectMusicLoader = interface;
  14177.   IDirectMusicObject = interface;
  14178. {#ifndef __cplusplus
  14179. typedef interface IDirectMusic IDirectMusic;
  14180. typedef interface IDirectMusicTrack IDirectMusicTrack;
  14181. typedef interface IDirectMusicPerformance IDirectMusicPerformance;
  14182. typedef interface IDirectMusicTool IDirectMusicTool;
  14183. typedef interface IDirectMusicSegment IDirectMusicSegment;
  14184. typedef interface IDirectMusicSegmentState IDirectMusicSegmentState;
  14185. typedef interface IDirectMusicGraph IDirectMusicGraph;
  14186. typedef interface IDirectMusicPort IDirectMusicPort;
  14187. typedef interface IDirectMusicBuffer IDirectMusicBuffer;
  14188. typedef interface IDirectMusicInstrument IDirectMusicInstrument;
  14189. typedef interface IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument;
  14190. typedef interface IDirectMusicBand IDirectMusicBand;
  14191. typedef interface IDirectMusicChordMap IDirectMusicChordMap;
  14192. typedef interface IDirectMusicObject IDirectMusicObject;
  14193. typedef interface IDirectMusicLoader IDirectMusicLoader;
  14194. #endif}
  14195.  
  14196.   LPDMUS_OBJECT = IDirectMusicObject;
  14197.   LPDMUS_LOADER = IDirectMusicLoader;
  14198.   LPDMUS_BAND   = IDirectMusicBand;
  14199.  
  14200.   TDMUS_PMSG_PART = record
  14201.     dwSize           : DWORD;
  14202.     rtTime           : REFERENCE_TIME;      // real time (in 100 nanosecond increments)           \
  14203.     mtTime           : MUSIC_TIME;          // music time                                         \
  14204.     dwFlags          : DWORD;               // various bits (see DMUS_PMSG_FLAGS enumeration)     \
  14205.     dwPChannel       : DWORD;               // Performance Channel. The Performance can           \
  14206.                                             // use this to determine the port/channel.            \
  14207.     dwVirtualTrackID : DWORD;               // virtual track ID                                   \
  14208.     pTool            : IDirectMusicTool;    // tool interface pointer                             \
  14209.     pGraph           : IDirectMusicGraph;   // tool graph interface pointer                       \
  14210.     dwType           : DWORD;               // PMSG type (see DMUS_PMSGT_TYPES defines)               \
  14211.     dwVoiceID        : DWORD;               // unique voice id which allows synthesizers to       \
  14212.                                             // identify a specific event. For DirectX 6.0,        \
  14213.                                             // this field should always be 0.                     \
  14214.     dwGroupID        : DWORD;               // Track group id                                  \
  14215.     punkUser         : IUnknown;            // user com pointer, auto released upon PMSG free
  14216.   end;
  14217. // every DMUS_PMSG is based off of this structure. The Performance needs
  14218. // to access these members consistently in every PMSG that goes through it.
  14219. {typedef struct _DMUS_PMSG
  14220. {
  14221.     /* begin DMUS_PMSG_PART
  14222.     DMUS_PMSG_PART
  14223.     /* end DMUS_PMSG_PART
  14224.  
  14225.  DMUS_PMSG;}
  14226.   TDMUS_PMSG = TDMUS_PMSG_PART;
  14227.   DMUS_PMSG  = TDMUS_PMSG;
  14228.  
  14229.   // DMUS_NOTE_PMSG
  14230.   TDMUS_NOTE_PMSG = record
  14231.     // begin DMUS_PMSG_PART
  14232.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14233.     // end DMUS_PMSG_PART
  14234.  
  14235.     mtDuration     : MUSIC_TIME;     // duration
  14236.     wMusicValue    : Word;           // Description of note in chord and key.
  14237.     wMeasure       : Word;           // Measure in which this note occurs
  14238.     nOffset        : Smallint;       // Offset from grid at which this note occurs
  14239.     bBeat          : Byte;           // Beat (in measure) at which this note occurs
  14240.     bGrid          : Byte;           // Grid offset from beat at which this note occurs
  14241.     bVelocity      : Byte;           // Note velocity
  14242.     bFlags         : Byte;           // see DMUS_NOTE_FLAGS
  14243.     bTimeRange     : Byte;           // Range to randomize time.
  14244.     bDurRange      : Byte;           // Range to randomize duration.
  14245.     bVelRange      : Byte;           // Range to randomize velocity.
  14246.     bPlayModeFlags : Byte;           // Play mode
  14247.     bSubChordLevel : Byte;           // Which subchord level this note uses.  
  14248.     bMidiValue     : Byte;           // The MIDI note value, converted from wMusicValue
  14249.     cTranspose     : Shortint;       // Transposition to add to midi note value after converted from wMusicValue.
  14250.   end;
  14251.   DMUS_NOTE_PMSG = TDMUS_NOTE_PMSG;
  14252.  
  14253.   // DMUS_MIDI_PMSG
  14254.   TDMUS_MIDI_PMSG = record
  14255.     // begin DMUS_PMSG_PART
  14256.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14257.     // end DMUS_PMSG_PART
  14258.  
  14259.     bStatus : Byte;
  14260.     bByte1  : Byte;
  14261.     bByte2  : Byte;
  14262.     bPad    : array[0..0] of Byte;
  14263.   end;
  14264.   DMUS_MIDI_PMSG = TDMUS_MIDI_PMSG;
  14265.  
  14266.   // DMUS_PATCH_PMSG
  14267.   TDMUS_PATCH_PMSG = record
  14268.     // begin DMUS_PMSG_PART
  14269.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14270.     // end DMUS_PMSG_PART
  14271.  
  14272.     byInstrument : Byte;
  14273.     byMSB        : Byte;
  14274.     byLSB        : Byte;
  14275.     byPad        : array[0..0] of Byte;
  14276.   end;
  14277.   DMUS_PATCH_PMSG = TDMUS_PATCH_PMSG;
  14278.  
  14279.   // DMUS_TRANSPOSE_PMSG
  14280.   TDMUS_TRANSPOSE_PMSG = record
  14281.     // begin DMUS_PMSG_PART
  14282.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14283.     // end DMUS_PMSG_PART
  14284.  
  14285.     nTranspose : Smallint;
  14286.   end;
  14287.   DMUS_TRANSPOSE_PMSG = TDMUS_TRANSPOSE_PMSG;
  14288.  
  14289.   // DMUS_CHANNEL_PRIORITY_PMSG
  14290.   TDMUS_CHANNEL_PRIORITY_PMSG = record
  14291.     // begin DMUS_PMSG_PART
  14292.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14293.     // end DMUS_PMSG_PART
  14294.  
  14295.     dwChannelPriority : DWORD;
  14296.   end;
  14297.   DMUS_CHANNEL_PRIORITY_PMSG = TDMUS_CHANNEL_PRIORITY_PMSG;
  14298.  
  14299.   // DMUS_TEMPO_PMSG
  14300.   TDMUS_TEMPO_PMSG = record
  14301.     // begin DMUS_PMSG_PART
  14302.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14303.     // end DMUS_PMSG_PART
  14304.  
  14305.     dblTempo : Double;                       // the tempo
  14306.   end;
  14307.   DMUS_TEMPO_PMSG = TDMUS_TEMPO_PMSG;
  14308.  
  14309.   // DMUS_SYSEX_PMSG
  14310.   TDMUS_SYSEX_PMSG = record
  14311.     // begin DMUS_PMSG_PART
  14312.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14313.     // end DMUS_PMSG_PART
  14314.  
  14315.     dwLen  : DWORD;                    // length of the data
  14316.     abData : array[0..0] of Byte;      // array of data, length equal to dwLen
  14317.   end;
  14318.   DMUS_SYSEX_PMSG = TDMUS_SYSEX_PMSG;
  14319.  
  14320.   // DMUS_CURVE_PMSG
  14321.   TDMUS_CURVE_PMSG = record
  14322.     // begin DMUS_PMSG_PART
  14323.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14324.     // end DMUS_PMSG_PART
  14325.  
  14326.     mtDuration      : MUSIC_TIME;   // how long this curve lasts
  14327.     mtOriginalStart : MUSIC_TIME;   // must be set to either zero when this PMSG is created or to the original mtTime of the curve
  14328.     mtResetDuration : MUSIC_TIME;   // how long after the curve is finished to reset to the
  14329.                                     //  reset value, nResetValue
  14330.     nStartValue     : Smallint;     // curve's start value
  14331.     nEndValue       : Smallint;     // curve's end value
  14332.     nResetValue     : Smallint;     // curve's reset value, sent after mtResetDuration or
  14333.                                     //  upon a flush or invalidation
  14334.     wMeasure        : Word;         // Measure in which this curve occurs
  14335.     nOffset         : Smallint;     // Offset from grid at which this curve occurs
  14336.     bBeat           : Byte;         // Beat (in measure) at which this curve occurs
  14337.     bGrid           : Byte;         // Grid offset from beat at which this curve occurs
  14338.     bType           : Byte;         // type of curve
  14339.     bCurveShape     : Byte;         // shape of curve
  14340.     bCCData         : Byte;         // CC# if this is a control change type
  14341.     bFlags          : Byte;         // set to 1 if the nResetValue must be sent when the
  14342.                                     //  time is reached or an invalidate occurs because
  14343.                                     //  of a transition. If 0, the curve stays
  14344.                                     //  permanently stuck at the new value. All bits besides
  14345.                                     //  1 are reserved.
  14346.  
  14347.   end;
  14348.   DMUS_CURVE_PMSG = TDMUS_CURVE_PMSG;
  14349.  
  14350.   // DMUS_TIMESIG_PMSG
  14351.   TDMUS_TIMESIG_PMSG = record
  14352.     // begin DMUS_PMSG_PART
  14353.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14354.     // end DMUS_PMSG_PART
  14355.  
  14356.     // Time signatures define how many beats per measure, which note receives
  14357.     // the beat, and the grid resolution.
  14358.     bBeatsPerMeasure : Byte;       // beats per measure (top of time sig)
  14359.     bBeat            : Byte;       // what note receives the beat (bottom of time sig.)
  14360.                                    // we can assume that 0 means 256th note
  14361.     wGridsPerBeat    : Word;       // grids per beat
  14362.   end;
  14363.   DMUS_TIMESIG_PMSG = TDMUS_TIMESIG_PMSG;
  14364.  
  14365.   // DMUS_NOTIFICATION_PMSG
  14366.   PDMUS_NOTIFICATION_PMSG = ^TDMUS_NOTIFICATION_PMSG;
  14367.   TDMUS_NOTIFICATION_PMSG = record
  14368.     // begin DMUS_PMSG_PART
  14369.     DMUS_PMSG_PART : TDMUS_PMSG_PART;
  14370.     // end DMUS_PMSG_PART
  14371.  
  14372.     guidNotificationType : TGUID;
  14373.     dwNotificationOption : DWORD;
  14374.     dwField1             : DWORD;
  14375.     dwField2             : DWORD;
  14376.   end;
  14377.   DMUS_NOTIFICATION_PMSG = TDMUS_NOTIFICATION_PMSG;
  14378.  
  14379.   TDMUS_VERSION = record
  14380.     dwVersionMS : DWORD;
  14381.     dwVersionLS : DWORD;
  14382.   end;
  14383.   DMUS_VERSION = TDMUS_VERSION;
  14384.   LPDMUS_VERSION = ^TDMUS_VERSION;
  14385.  
  14386. //      The DMUSOBJECTDESC structure is used to communicate everything you could
  14387. //      possibly use to describe a DirectMusic object.
  14388.  
  14389.   TDMUS_OBJECTDESC = record
  14390.     dwSize      : DWORD;                                       // Size of this structure.
  14391.     dwValidData : DWORD;                                       // Flags indicating which fields below are valid.
  14392.     guidObject  : TGUID;                                       // Unique ID for this object.
  14393.     guidClass   : TGUID;                                       // GUID for the class of object.
  14394.     ftDate      : TFILETIME;                                   // Last edited date of object.
  14395.     vVersion    : TDMUS_VERSION;                               // Version.
  14396.     wszName     : array[0..DMUS_MAX_NAME - 1] of WCHAR;        // Name of object.
  14397.     wszCategory : array[0..DMUS_MAX_CATEGORY - 1] of WCHAR;    // Category for object (optional).
  14398.     wszFileName : array[0..DMUS_MAX_FILENAME - 1] of WCHAR;    // File path.
  14399.     llMemLength : LONGLONG;                                       // Size of Memory data.
  14400.     pbMemData   : Pointer;                                       // Memory pointer for data.
  14401.   end;
  14402.   DMUS_OBJECTDESC   = TDMUS_OBJECTDESC;
  14403.   LPDMUS_OBJECTDESC = ^TDMUS_OBJECTDESC;
  14404.  
  14405.   IDirectMusicBand = interface(IUnknown)
  14406.   ['{D2AC28C0-B39B-11D1-8704-00600893B1BD}']
  14407.     // IDirectMusicBand
  14408.     function CreateSegment(out ppSegment: IDirectMusicSegment) : HResult; stdcall;
  14409.     function Download(pPerformance: IDirectMusicPerformance) : HResult; stdcall;
  14410.     function Unload(pPerformance: IDirectMusicPerformance) : HResult; stdcall;
  14411.   end;
  14412.  
  14413.   IDirectMusicObject = interface(IUnknown)
  14414.   ['{D2AC28B5-B39B-11D1-8704-00600893B1BD}']
  14415.     // IDirectMusicObject
  14416.     function GetDescriptor(var pDesc: TDMUS_OBJECTDESC) : HResult; stdcall;
  14417.     function SetDescriptor(const pDesc: TDMUS_OBJECTDESC) : HResult; stdcall;
  14418.     function ParseDescriptor(pStream: IStream;
  14419.                              var pDesc: TDMUS_OBJECTDESC) : HResult; stdcall;
  14420.   end;
  14421.  
  14422.   IDirectMusicLoader = interface(IUnknown)
  14423.   ['{2FFAACA2-5DCA-11D2-AFA6-00AA0024D8B6}']
  14424.     // IDirectMusicLoader
  14425.     function GetObject(const pDesc: TDMUS_OBJECTDESC;
  14426.                        const riid: TGUID;
  14427.                        out ppv) : HResult; stdcall;
  14428.     function SetObject(const pDesc: TDMUS_OBJECTDESC) : HResult; stdcall;
  14429.     function SetSearchDirectory(const rguidClass: TGUID;
  14430.                                 pwzPath: PWCHAR;
  14431.                                 fClear: BOOL) : HResult; stdcall;
  14432.     function ScanDirectory(const rguidClass: TGUID;
  14433.                            pwzFileExtension: PWCHAR;
  14434.                            var pwzScanFileName: PWCHAR) : HResult; stdcall;
  14435.     function CacheObject(pObject: IDirectMusicObject) : HResult; stdcall;
  14436.     function ReleaseObject(pObject: IDirectMusicObject) : HResult; stdcall;
  14437.     function ClearCache(const rguidClass: TGUID) : HResult; stdcall;
  14438.     function EnableCache(const rguidClass: TGUID;
  14439.                          fEnable: BOOL) : HResult; stdcall;
  14440.     function EnumObject(const rguidClass: TGUID;
  14441.                         dwIndex: DWORD;
  14442.                         var pDesc: TDMUS_OBJECTDESC) : HResult; stdcall;
  14443.   end;
  14444.  
  14445. //  Stream object supports IDirectMusicGetLoader interface to access loader while file parsing.
  14446.   IDirectMusicGetLoader = interface(IUnknown)
  14447.   ['{68A04844-D13D-11D1-AFA6-00AA0024D8B6}']
  14448.     // IDirectMusicGetLoader
  14449.     function GetLoader(out ppLoader: IDirectMusicLoader) : HResult; stdcall;
  14450.   end;
  14451.  
  14452. { IDirectMusicSegment }
  14453.  
  14454.   IDirectMusicSegment = interface(IUnknown)
  14455.   ['{F96029A2-4282-11D2-8717-00600893B1BD}']
  14456.     //  IDirectMusicSegment
  14457.     function GetLength(var pmtLength: MUSIC_TIME) : HResult; stdcall;
  14458.     function SetLength(mtLength: MUSIC_TIME) : HResult; stdcall;
  14459.     function GetRepeats(var pdwRepeats: DWORD) : HResult; stdcall;
  14460.     function SetRepeats(dwRepeats: DWORD) : HResult; stdcall;
  14461.     function GetDefaultResolution(var pdwResolution: DWORD) : HResult; stdcall;
  14462.     function SetDefaultResolution(dwResolution: DWORD) : HResult; stdcall;
  14463.     function GetTrack(const rguidType: TGUID;
  14464.                       dwGroupBits: DWORD;
  14465.                       dwIndex: DWORD;
  14466.                       out ppTrack: IDirectMusicTrack) : HResult; stdcall;
  14467.     function GetTrackGroup(pTrack: IDirectMusicTrack;
  14468.                            var pdwGroupBits: DWORD) : HResult; stdcall;
  14469.     function InsertTrack(pTrack: IDirectMusicTrack;
  14470.                          dwGroupBits: DWORD) : HResult; stdcall;
  14471.     function RemoveTrack(pTrack: IDirectMusicTrack) : HResult; stdcall;
  14472.     function InitPlay(out ppSegState: IDirectMusicSegmentState;
  14473.                       pPerformance: IDirectMusicPerformance;
  14474.                       dwFlags: DWORD) : HResult; stdcall;
  14475.     function GetGraph(out ppGraph: IDirectMusicGraph) : HResult; stdcall;
  14476.     function SetGraph(pGraph: IDirectMusicGraph) : HResult; stdcall;
  14477.     function AddNotificationType(const rguidNotificationType: TGUID) : HResult; stdcall;
  14478.     function RemoveNotificationType(const rguidNotificationType: TGUID) : HResult; stdcall;
  14479.     function GetParam(const rguidType: TGUID;
  14480.                       dwGroupBits: DWORD;
  14481.                       dwIndex: DWORD;
  14482.                       mtTime: MUSIC_TIME;
  14483.                       var pmtNext: MUSIC_TIME;
  14484.                       pParam: Pointer) : HResult; stdcall;
  14485.     function SetParam(const rguidType: TGUID;
  14486.                       dwGroupBits: DWORD;
  14487.                       dwIndex: DWORD;
  14488.                       mtTime: MUSIC_TIME;
  14489.                       pParam: Pointer) : HResult; stdcall;
  14490.     function Clone(mtStart: MUSIC_TIME;
  14491.                    mtEnd: MUSIC_TIME;
  14492.                    out ppSegment: IDirectMusicSegment) : HResult; stdcall;
  14493.     function SetStartPoint(mtStart: MUSIC_TIME) : HResult; stdcall;
  14494.     function GetStartPoint(var pmtStart: MUSIC_TIME) : HResult; stdcall;
  14495.     function SetLoopPoints(mtStart: MUSIC_TIME;
  14496.                            mtEnd: MUSIC_TIME) : HResult; stdcall;
  14497.     function GetLoopPoints(var pmtStart: MUSIC_TIME;
  14498.                            var pmtEnd: MUSIC_TIME) : HResult; stdcall;
  14499.     function SetPChannelsUsed(dwNumPChannels: DWORD;
  14500.                               const paPChannels) : HResult; stdcall;
  14501.   end;
  14502.  
  14503. { IDirectMusicSegmentState }
  14504.  
  14505.   IDirectMusicSegmentState = interface(IUnknown)
  14506.   ['{A3AFDCC7-D3EE-11D1-BC8D-00A0C922E6EB}']
  14507.     //  IDirectMusicSegmentState
  14508.     function GetRepeats(var pdwRepeats: DWORD) : HResult; stdcall;
  14509.     function GetSegment(out ppSegment: IDirectMusicSegment) : HResult; stdcall;
  14510.     function GetStartTime(var pmtStart: MUSIC_TIME) : HResult; stdcall;
  14511.     function GetSeek(var pmtSeek: MUSIC_TIME) : HResult; stdcall;
  14512.     function GetStartPoint(var pmtStart: MUSIC_TIME) : HResult; stdcall;
  14513.   end;
  14514.  
  14515. { IDirectMusicTrack }
  14516.  
  14517.   IDirectMusicTrack = interface(IUnknown)
  14518.   ['{F96029A1-4282-11D2-8717-00600893B1BD}']
  14519.     //  IDirectMusicTrack
  14520.     function Init(pSegment: IDirectMusicSegment) : HResult; stdcall;
  14521.     function InitPlay(pSegmentState: IDirectMusicSegmentState;
  14522.                       pPerformance: IDirectMusicPerformance;
  14523.                       var ppStateData: Pointer;
  14524.                       dwVirtualTrackID: DWORD;
  14525.                       dwFlags: DWORD) : HResult; stdcall;
  14526.     function EndPlay(const pStateData) : HResult; stdcall;
  14527.     function Play(const pStateData;
  14528.                   mtStart: MUSIC_TIME;
  14529.                   mtEnd: MUSIC_TIME;
  14530.                   mtOffset: MUSIC_TIME;
  14531.                   dwFlags: DWORD;
  14532.                   pPerf: IDirectMusicPerformance;
  14533.                   pSegSt: IDirectMusicSegmentState;
  14534.                   dwVirtualID: DWORD) : HResult; stdcall;
  14535.     function GetParam(const rguidType: TGUID;
  14536.                       mtTime: MUSIC_TIME;
  14537.                       var pmtNext: MUSIC_TIME;
  14538.                       var pParam) : HResult; stdcall;
  14539.     function SetParam(const rguidType: TGUID;
  14540.                       mtTime: MUSIC_TIME;
  14541.                       const pParam) : HResult; stdcall;
  14542.     function IsParamSupported(const rguidType: TGUID) : HResult; stdcall;
  14543.     function AddNotificationType(const rguidNotificationType: TGUID) : HResult; stdcall;
  14544.     function RemoveNotificationType(const rguidNotificationType: TGUID) : HResult; stdcall;
  14545.     function Clone(mtStart: MUSIC_TIME;
  14546.                    mtEnd: MUSIC_TIME;
  14547.                    out ppTrack: IDirectMusicTrack) : HResult; stdcall;
  14548.   end;
  14549.  
  14550. { IDirectMusicPerformance }
  14551.  
  14552.   IDirectMusicPerformance = interface(IUnknown)
  14553.   ['{07D43D03-6523-11D2-871D-00600893B1BD}']
  14554.     //  IDirectMusicPerformance
  14555.     function Init(out ppDirectMusic: IDirectMusic;
  14556.                   pDirectSound: IDirectSound;
  14557.                   hWnd: HWND) : HResult; stdcall;
  14558.     function PlaySegment(pSegment: IDirectMusicSegment;
  14559.                          dwFlags: DWORD;
  14560.                          i64StartTime: LONGLONG;
  14561.                          out ppSegmentState: IDirectMusicSegmentState) : HResult; stdcall;
  14562.     function Stop(pSegment: IDirectMusicSegment;
  14563.                   pSegmentState: IDirectMusicSegmentState;
  14564.                   mtTime: MUSIC_TIME;
  14565.                   dwFlags: DWORD) : HResult; stdcall;
  14566.     function GetSegmentState(out ppSegmentState: IDirectMusicSegmentState;
  14567.                              mtTime: MUSIC_TIME) : HResult; stdcall;
  14568.     function SetPrepareTime(dwMilliSeconds: DWORD) : HResult; stdcall;
  14569.     function GetPrepareTime(var pdwMilliSeconds: DWORD) : HResult; stdcall;
  14570.     function SetBumperLength(dwMilliSeconds: DWORD) : HResult; stdcall;
  14571.     function GetBumperLength(var pdwMilliSeconds: DWORD) : HResult; stdcall;
  14572.     function SendPMsg(const pPMSG: TDMUS_PMSG) : HResult; stdcall;
  14573.     function MusicToReferenceTime(mtTime: MUSIC_TIME;
  14574.                                   var prtTime: TREFERENCE_TIME) : HResult; stdcall;
  14575.     function ReferenceToMusicTime(rtTime: TREFERENCE_TIME;
  14576.                                   var pmtTime: MUSIC_TIME) : HResult; stdcall;
  14577.     function IsPlaying(pSegment: IDirectMusicSegment;
  14578.                        pSegState: IDirectMusicSegmentState) : HResult; stdcall;
  14579.     function GetTime(var prtNow: TREFERENCE_TIME;
  14580.                      var pmtNow: MUSIC_TIME) : HResult; stdcall;
  14581.     function AllocPMsg(cb: Cardinal;
  14582.                        var ppPMSG: TDMUS_PMSG) : HResult; stdcall;
  14583.     function FreePMsg(const pPMSG: TDMUS_PMSG) : HResult; stdcall;
  14584.     function GetGraph(out ppGraph: IDirectMusicGraph) : HResult; stdcall;
  14585.     function SetGraph(pGraph: IDirectMusicGraph) : HResult; stdcall;
  14586.     function SetNotificationHandle(hNotification: THandle;
  14587.                                    rtMinimum: TREFERENCE_TIME) : HResult; stdcall;
  14588.     function GetNotificationPMsg(var ppNotificationPMsg: PDMUS_NOTIFICATION_PMSG) : HResult; stdcall;
  14589.     function AddNotificationType(const rguidNotificationType: TGUID) : HResult; stdcall;
  14590.     function RemoveNotificationType(const rguidNotificationType: TGUID) : HResult; stdcall;
  14591.     function AddPort(pPort: IDirectMusicPort) : HResult; stdcall;
  14592.     function RemovePort(pPort: IDirectMusicPort) : HResult; stdcall;
  14593.     function AssignPChannelBlock(dwBlockNum: DWORD;
  14594.                                  pPort: IDirectMusicPort;
  14595.                                  dwGroup: DWORD) : HResult; stdcall;
  14596.     function AssignPChannel(dwPChannel: DWORD;
  14597.                             pPort: IDirectMusicPort;
  14598.                             dwGroup: DWORD;
  14599.                             dwMChannel: DWORD) : HResult; stdcall;
  14600.     function PChannelInfo(dwPChannel: DWORD;
  14601.                           out ppPort: IDirectMusicPort;
  14602.                           var pdwGroup: DWORD;
  14603.                           var pdwMChannel: DWORD) : HResult; stdcall;
  14604.     function DownloadInstrument(pInst: IDirectMusicInstrument;
  14605.                                 dwPChannel: DWORD;
  14606.                                 out ppDownInst: IDirectMusicDownloadedInstrument;
  14607.                                 const pNoteRanges;
  14608.                                 dwNumNoteRanges: DWORD;
  14609.                                 out ppPort: IDirectMusicPort;
  14610.                                 var pdwGroup: DWORD;
  14611.                                 var pdwMChannel: DWORD) : HResult; stdcall;
  14612.     function Invalidate(mtTime: MUSIC_TIME;
  14613.                         dwFlags: DWORD) : HResult; stdcall;
  14614.     function GetParam(const rguidType: TGUID;
  14615.                       dwGroupBits: DWORD;
  14616.                       dwIndex: DWORD;
  14617.                       mtTime: MUSIC_TIME;
  14618.                       var pmtNext: MUSIC_TIME;
  14619.                       var pParam) : HResult; stdcall;
  14620.     function SetParam(const rguidType: TGUID;
  14621.                       dwGroupBits: DWORD;
  14622.                       dwIndex: DWORD;
  14623.                       mtTime: MUSIC_TIME;
  14624.                       pParam: Pointer) : HResult; stdcall;
  14625.     function GetGlobalParam(const rguidType: TGUID;
  14626.                             var pParam;
  14627.                             dwSize: DWORD) : HResult; stdcall;
  14628.     function SetGlobalParam(const rguidType: TGUID;
  14629.                             const pParam;
  14630.                             dwSize: DWORD) : HResult; stdcall;
  14631.     function GetLatencyTime(var prtTime: TREFERENCE_TIME) : HResult; stdcall;
  14632.     function GetQueueTime(var prtTime: TREFERENCE_TIME) : HResult; stdcall;
  14633.     function AdjustTime(rtAmount: TREFERENCE_TIME) : HResult; stdcall;
  14634.     function CloseDown : HResult; stdcall;
  14635.     function GetResolvedTime(rtTime: TREFERENCE_TIME;
  14636.                              var prtResolved: TREFERENCE_TIME;
  14637.                              dwTimeResolveFlags: DWORD) : HResult; stdcall;
  14638.     function MIDIToMusic(bMIDIValue: Byte;
  14639.                          const pChord: TDMUS_CHORD_KEY;
  14640.                          bPlayMode: Byte;
  14641.                          bChordLevel: Byte;
  14642.                          var pwMusicValue: Word) : HResult; stdcall;
  14643.     function MusicToMIDI(wMusicValue: Word;
  14644.                          const pChord: TDMUS_CHORD_KEY;
  14645.                          bPlayMode: Byte;
  14646.                          bChordLevel: Byte;
  14647.                          var pbMIDIValue: Byte) : HResult; stdcall;
  14648.     function TimeToRhythm(mtTime: MUSIC_TIME;
  14649.                           const pTimeSig: TDMUS_TIMESIGNATURE;
  14650.                           var pwMeasure: Word;
  14651.                           var pbBeat: Byte;
  14652.                           var pbGrid: Byte;
  14653.                           var pnOffset: Smallint) : HResult; stdcall;
  14654.     function RhythmToTime(wMeasure: Word;
  14655.                           bBeat: Byte;
  14656.                           bGrid: Byte;
  14657.                           nOffset: Smallint;
  14658.                           const pTimeSig: TDMUS_TIMESIGNATURE;
  14659.                           var pmtTime: MUSIC_TIME) : HResult; stdcall;
  14660.   end;
  14661.  
  14662. { IDirectMusicTool }
  14663.  
  14664.   IDirectMusicTool = interface(IUnknown)
  14665.   ['{D2AC28BA-B39B-11D1-8704-00600893B1BD}']
  14666.     //  IDirectMusicTool
  14667.     function Init(pGraph: IDirectMusicGraph) : HResult; stdcall;
  14668.     function GetMsgDeliveryType(var pdwDeliveryType: DWORD) : HResult; stdcall;
  14669.     function GetMediaTypeArraySize(var pdwNumElements: DWORD) : HResult; stdcall;
  14670.     function GetMediaTypes(var padwMediaTypes;
  14671.                            dwNumElements: DWORD) : HResult; stdcall;
  14672.     function ProcessPMsg(pPerf: IDirectMusicPerformance;
  14673.                          const pPMSG: TDMUS_PMSG) : HResult; stdcall;
  14674.     function Flush(pPerf: IDirectMusicPerformance;
  14675.                    const pPMSG: TDMUS_PMSG;
  14676.                    rtTime: TREFERENCE_TIME) : HResult; stdcall;
  14677.   end;
  14678.  
  14679. { IDirectMusicGraph }
  14680.  
  14681.   IDirectMusicGraph = interface(IUnknown)
  14682.   ['{2BEFC277-5497-11D2-BCCB-00A0C922E6EB}']
  14683.     //  IDirectMusicGraph
  14684.     function StampPMsg(const pPMSG: TDMUS_PMSG) : HResult; stdcall;
  14685.     function InsertTool(pTool: IDirectMusicTool;
  14686.                         const pdwPChannels;
  14687.                         cPChannels: DWORD;
  14688.                         lIndex: Longint) : HResult; stdcall;
  14689.     function GetTool(dwIndex: DWORD;
  14690.                      out ppTool: IDirectMusicTool) : HResult; stdcall;
  14691.     function RemoveTool(pTool: IDirectMusicTool) : HResult; stdcall;
  14692.   end;
  14693.  
  14694. { IDirectMusicStyle }
  14695.  
  14696.   IDirectMusicStyle = interface(IUnknown)
  14697.   ['{D2AC28BD-B39B-11D1-8704-00600893B1BD}']
  14698.     //  IDirectMusicStyle
  14699.     function GetBand(pwszName: PWCHAR;
  14700.                      out ppBand: IDirectMusicBand) : HResult; stdcall;
  14701.     function EnumBand(dwIndex: DWORD;
  14702.                       pwszName: PWCHAR) : HResult; stdcall;
  14703.     function GetDefaultBand(out ppBand: IDirectMusicBand) : HResult; stdcall;
  14704.     function EnumMotif(dwIndex: DWORD;
  14705.                        pwszName: PWCHAR) : HResult; stdcall;
  14706.     function GetMotif(pwszName: PWCHAR;
  14707.                       out ppSegment: IDirectMusicSegment) : HResult; stdcall;
  14708.     function GetDefaultChordMap(out ppChordMap: IDirectMusicChordMap) : HResult; stdcall;
  14709.     function EnumChordMap(dwIndex: DWORD;
  14710.                           pwszName: PWCHAR) : HResult; stdcall;
  14711.     function GetChordMap(pwszName: PWCHAR;
  14712.                          out ppChordMap: IDirectMusicChordMap) : HResult; stdcall;
  14713.     function GetTimeSignature(var pTimeSig: TDMUS_TIMESIGNATURE) : HResult; stdcall;
  14714.     function GetEmbellishmentLength(dwType: DWORD;
  14715.                                     dwLevel: DWORD;
  14716.                                     var pdwMin: DWORD;
  14717.                                     var pdwMax: DWORD) : HResult; stdcall;
  14718.     function GetTempo(var pTempo: Double) : HResult; stdcall;
  14719.   end;
  14720.  
  14721. { IDirectMusicChordMap }
  14722.  
  14723.   IDirectMusicChordMap = interface(IUnknown)
  14724.   ['{D2AC28BE-B39B-11D1-8704-00600893B1BD}']
  14725.     //  IDirectMusicChordMap
  14726.     function GetScale(var pdwScale: DWORD) : HResult; stdcall;
  14727.   end;
  14728.  
  14729. { IDirectMusicComposer }
  14730.  
  14731.   IDirectMusicComposer = interface(IUnknown)
  14732.   ['{D2AC28BF-B39B-11D1-8704-00600893B1BD}']
  14733.     //  IDirectMusicComposer
  14734.     function ComposeSegmentFromTemplate(pStyle: IDirectMusicStyle;
  14735.                                         pTempSeg: IDirectMusicSegment;
  14736.                                         wActivity: Word;
  14737.                                         pChordMap: IDirectMusicChordMap;
  14738.                                         out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
  14739.     function ComposeSegmentFromShape(pStyle: IDirectMusicStyle;
  14740.                                      wNumMeasures: Word;
  14741.                                      wShape: Word;
  14742.                                      wActivity: Word;
  14743.                                      fIntro: BOOL;
  14744.                                      fEnd: BOOL;
  14745.                                      pChordMap: IDirectMusicChordMap;
  14746.                                      out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
  14747.     function ComposeTransition(pFromSeg: IDirectMusicSegment;
  14748.                                pToSeg: IDirectMusicSegment;
  14749.                                mtTime: MUSIC_TIME;
  14750.                                wCommand: Word;
  14751.                                dwFlags: DWORD;
  14752.                                pChordMap: IDirectMusicChordMap;
  14753.                                out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
  14754.     function AutoTransition(pPerformance: IDirectMusicPerformance;
  14755.                             pToSeg: IDirectMusicSegment;
  14756.                             wCommand: Word;
  14757.                             dwFlags: DWORD;
  14758.                             pChordMap: IDirectMusicChordMap;
  14759.                             out ppTransSeg: IDirectMusicSegment;
  14760.                             out ppToSegState: IDirectMusicSegmentState;
  14761.                             out ppTransSegState: IDirectMusicSegmentState) : HResult; stdcall;
  14762.     function ComposeTemplateFromShape(wNumMeasures: Word;
  14763.                                       wShape: Word;
  14764.                                       fIntro: BOOL;
  14765.                                       fEnd: BOOL;
  14766.                                       wEndLength: Word;
  14767.                                       out ppTempSeg: IDirectMusicSegment) : HResult; stdcall;
  14768.     function ChangeChordMap(pSectionSeg: IDirectMusicSegment;
  14769.                             fTrackScale: BOOL;
  14770.                             pChordMap: IDirectMusicChordMap) : HResult; stdcall;
  14771.   end;
  14772.  
  14773. const
  14774.   // CLSID's
  14775.   CLSID_DirectMusicPerformance  : TGUID = '{D2AC2881-B39B-11D1-8704-00600893B1BD}';
  14776.   CLSID_DirectMusicSegment      : TGUID = '{D2AC2882-B39B-11D1-8704-00600893B1BD}';
  14777.   CLSID_DirectMusicSegmentState : TGUID = '{D2AC2883-B39B-11D1-8704-00600893B1BD}';
  14778.   CLSID_DirectMusicGraph        : TGUID = '{D2AC2884-B39B-11D1-8704-00600893B1BD}';
  14779.   CLSID_DirectMusicTempoTrack   : TGUID = '{D2AC2885-B39B-11D1-8704-00600893B1BD}';
  14780.   CLSID_DirectMusicSeqTrack     : TGUID = '{D2AC2886-B39B-11D1-8704-00600893B1BD}';
  14781.   CLSID_DirectMusicSysExTrack   : TGUID = '{D2AC2887-B39B-11D1-8704-00600893B1BD}';
  14782.   CLSID_DirectMusicTimeSigTrack : TGUID = '{D2AC2888-B39B-11D1-8704-00600893B1BD}';
  14783.   CLSID_DirectMusicStyle        : TGUID = '{D2AC288A-B39B-11D1-8704-00600893B1BD}';
  14784.   CLSID_DirectMusicChordTrack   : TGUID = '{D2AC288B-B39B-11D1-8704-00600893B1BD}';
  14785.   CLSID_DirectMusicCommandTrack : TGUID = '{D2AC288C-B39B-11D1-8704-00600893B1BD}';
  14786.   CLSID_DirectMusicStyleTrack   : TGUID = '{D2AC288D-B39B-11D1-8704-00600893B1BD}';
  14787.   CLSID_DirectMusicMotifTrack   : TGUID = '{D2AC288E-B39B-11D1-8704-00600893B1BD}';
  14788.   CLSID_DirectMusicChordMap     : TGUID = '{D2AC288F-B39B-11D1-8704-00600893B1BD}';
  14789.   CLSID_DirectMusicComposer     : TGUID = '{D2AC2890-B39B-11D1-8704-00600893B1BD}';
  14790.   CLSID_DirectMusicSignPostTrack: TGUID = '{F17E8672-C3B4-11D1-870B-00600893B1BD}';
  14791.   CLSID_DirectMusicLoader       : TGUID = '{D2AC2892-B39B-11D1-8704-00600893B1BD}';
  14792.   CLSID_DirectMusicBandTrack    : TGUID = '{D2AC2894-B39B-11D1-8704-00600893B1BD}';
  14793.   CLSID_DirectMusicBand         : TGUID = '{79BA9E00-B6EE-11D1-86BE-00C04FBF8FEF}';
  14794.   CLSID_DirectMusicChordMapTrack: TGUID = '{D2AC2896-B39B-11D1-8704-00600893B1BD}';
  14795.   CLSID_DirectMusicMuteTrack    : TGUID = '{D2AC2898-B39B-11D1-8704-00600893B1BD}';
  14796.  
  14797. // Special GUID for all object types. This is used by the loader.
  14798.   GUID_DirectMusicAllTypes      : TGUID = '{D2AC2893-B39B-11D1-8704-00600893B1BD}';
  14799.  
  14800. // Notification guids
  14801.   GUID_NOTIFICATION_SEGMENT       : TGUID = '{D2AC2899-B39B-11D1-8704-00600893B1BD}';
  14802.   GUID_NOTIFICATION_PERFORMANCE   : TGUID = '{81F75BC5-4E5D-11D2-BCC7-00A0C922E6EB}';
  14803.   GUID_NOTIFICATION_MEASUREANDBEAT: TGUID = '{D2AC289A-B39B-11D1-8704-00600893B1BD}';
  14804.   GUID_NOTIFICATION_CHORD         : TGUID = '{D2AC289B-B39B-11D1-8704-00600893B1BD}';
  14805.   GUID_NOTIFICATION_COMMAND       : TGUID = '{D2AC289C-B39B-11D1-8704-00600893B1BD}';
  14806.  
  14807. // Track param type guids
  14808. // Use to get/set a DMUS_COMMAND_PARAM param in the Command track
  14809.   GUID_CommandParam               : TGUID = '{D2AC289D-B39B-11D1-8704-00600893B1BD}';
  14810.  
  14811. // Use to get/set a DMUS_CHORD_PARAM param in the Chord track
  14812.   GUID_ChordParam                 : TGUID = '{D2AC289E-B39B-11D1-8704-00600893B1BD}';
  14813.  
  14814. // Use to get a DMUS_RHYTHM_PARAM param in the Chord track
  14815.   GUID_RhythmParam                : TGUID = '{D2AC289F-B39B-11D1-8704-00600893B1BD}';
  14816.  
  14817. // Use to get/set an IDirectMusicStyle param in the Style track
  14818.   GUID_IDirectMusicStyle          : TGUID = '{D2AC28A1-B39B-11D1-8704-00600893B1BD}';
  14819.  
  14820. // Use to get a DMUS_TIMESIGNATURE param in the Style and TimeSig tracks
  14821.   GUID_TimeSignature              : TGUID = '{D2AC28A4-B39B-11D1-8704-00600893B1BD}';
  14822.  
  14823. // Use to get/set a DMUS_TEMPO_PARAM param in the Tempo track
  14824.   GUID_TempoParam                 : TGUID = '{D2AC28A5-B39B-11D1-8704-00600893B1BD}';
  14825.  
  14826. // Use to set an IDirectMusicBand param in the Band track
  14827.   GUID_IDirectMusicBand           : TGUID = '{D2AC28AC-B39B-11D1-8704-00600893B1BD}';
  14828.  
  14829. // Use to get/set an IDirectMusicChordMap param in the ChordMap track
  14830.   GUID_IDirectMusicChordMap       : TGUID = '{D2AC28AD-B39B-11D1-8704-00600893B1BD}';
  14831.  
  14832. // Use to get/set a DMUS_MUTE_PARAM param in the Mute track
  14833.   GUID_MuteParam                  : TGUID = '{D2AC28AF-B39B-11D1-8704-00600893B1BD}';
  14834.  
  14835. // These guids are used in IDirectMusicSegment::SetParam to tell the band track to perform various actions.
  14836. ///
  14837. /// Download bands for the IDirectMusicSegment
  14838.   GUID_Download                   : TGUID = '{D2AC28A7-B39B-11D1-8704-00600893B1BD}';
  14839.  
  14840. // Unload bands for the IDirectMusicSegment
  14841.   GUID_Unload                     : TGUID = '{D2AC28A8-B39B-11D1-8704-00600893B1BD}';
  14842.  
  14843. // Connect segment's bands to an IDirectMusicCollection
  14844.   GUID_ConnectToDLSCollection     : TGUID = '{1DB1AE6B-E92E-11D1-A8C5-00C04FA3726E}';
  14845.  
  14846. // Enable/disable autodownloading of bands
  14847.   GUID_Enable_Auto_Download       : TGUID = '{D2AC28A9-B39B-11D1-8704-00600893B1BD}';
  14848.   GUID_Disable_Auto_Download      : TGUID = '{D2AC28AA-B39B-11D1-8704-00600893B1BD}';
  14849.  
  14850. // Clear all bands
  14851.   GUID_Clear_All_Bands            : TGUID = '{D2AC28AB-B39B-11D1-8704-00600893B1BD}';
  14852.  
  14853. // Set segment to manage all program changes, bank selects, etc. for simple playback of a standard MIDI file
  14854.   GUID_StandardMIDIFile           : TGUID = '{06621075-E92E-11D1-A8C5-00C04FA3726E}';
  14855. // For compatibility with beta releases...
  14856.   GUID_IgnoreBankSelectForGM      : TGUID = '{06621075-E92E-11D1-A8C5-00C04FA3726E}'; //same as GUID_StandardMIDIFile;
  14857.  
  14858. // Disable/enable param guids. Use these in SetParam calls to disable or enable sending
  14859. // specific PMsg types.
  14860. ///
  14861.   GUID_DisableTimeSig             : TGUID = '{45FC707B-1DB4-11D2-BCAC-00A0C922E6EB}';
  14862.   GUID_EnableTimeSig              : TGUID = '{45FC707C-1DB4-11D2-BCAC-00A0C922E6EB}';
  14863.   GUID_DisableTempo               : TGUID = '{45FC707D-1DB4-11D2-BCAC-00A0C922E6EB}';
  14864.   GUID_EnableTempo                : TGUID = '{45FC707E-1DB4-11D2-BCAC-00A0C922E6EB}';
  14865.  
  14866. // Global data guids
  14867.   GUID_PerfMasterTempo            : TGUID = '{D2AC28B0-B39B-11D1-8704-00600893B1BD}';
  14868.   GUID_PerfMasterVolume           : TGUID = '{D2AC28B1-B39B-11D1-8704-00600893B1BD}';
  14869.   GUID_PerfMasterGrooveLevel      : TGUID = '{D2AC28B2-B39B-11D1-8704-00600893B1BD}';
  14870.   GUID_PerfAutoDownload           : TGUID = '{FB09565B-3631-11D2-BCB8-00A0C922E6EB}';
  14871.  
  14872. // GUID for default GM/GS dls collection.
  14873.   GUID_DefaultGMCollection        : TGUID = '{F17E8673-C3B4-11D1-870B-00600893B1BD}';
  14874.  
  14875. // IID's
  14876.   IID_IDirectMusicLoader          : TGUID = '{2FFAACA2-5DCA-11D2-AFA6-00AA0024D8B6}';
  14877.   IID_IDirectMusicGetLoader       : TGUID = '{68A04844-D13D-11D1-AFA6-00AA0024D8B6}';
  14878.   IID_IDirectMusicObject          : TGUID = '{D2AC28B5-B39B-11D1-8704-00600893B1BD}';
  14879.   IID_IDirectMusicSegment         : TGUID = '{F96029A2-4282-11D2-8717-00600893B1BD}';
  14880.   IID_IDirectMusicSegmentState    : TGUID = '{A3AFDCC7-D3EE-11D1-BC8D-00A0C922E6EB}';
  14881.   IID_IDirectMusicTrack           : TGUID = '{F96029A1-4282-11D2-8717-00600893B1BD}';
  14882.   IID_IDirectMusicPerformance     : TGUID = '{07D43D03-6523-11D2-871D-00600893B1BD}';
  14883.   IID_IDirectMusicTool            : TGUID = '{D2AC28BA-B39B-11D1-8704-00600893B1BD}';
  14884.   IID_IDirectMusicGraph           : TGUID = '{2BEFC277-5497-11D2-BCCB-00A0C922E6EB}';
  14885.   IID_IDirectMusicStyle           : TGUID = '{D2AC28BD-B39B-11D1-8704-00600893B1BD}';
  14886.   IID_IDirectMusicChordMap        : TGUID = '{D2AC28BE-B39B-11D1-8704-00600893B1BD}';
  14887.   IID_IDirectMusicComposer        : TGUID = '{D2AC28BF-B39B-11D1-8704-00600893B1BD}';
  14888.   IID_IDirectMusicBand            : TGUID = '{D2AC28C0-B39B-11D1-8704-00600893B1BD}';
  14889.  
  14890. // Alternate interface IDs, available in DX7 release and after.
  14891.   IID_IDirectMusicPerformance2    : TGUID = '{6FC2CAE0-BC78-11D2-AFA6-00AA0024D8B6}';
  14892.   IID_IDirectMusicSegment2        : TGUID = '{D38894D1-C052-11D2-872F-00600893B1BD}';
  14893.  
  14894.  
  14895. //***********************************************************************
  14896. //                                                                      *
  14897. //   dmusicf.h -- This module defines the DirectMusic file formats      *
  14898. //                                                                      *
  14899. //   Copyright (c) 1998, Microsoft Corp. All rights reserved.           *
  14900. //                                                                      *
  14901. //**********************************************************************
  14902. // Common chunks
  14903. const
  14904.   DMUS_FOURCC_GUID_CHUNK     = Ord('g') + Ord('u') shl 8 + Ord('i') shl 16 + Ord('d') shl 24;
  14905.   DMUS_FOURCC_INFO_LIST      = Ord('I') + Ord('N') shl 8 + Ord('F') shl 16 + Ord('O') shl 24;
  14906.   DMUS_FOURCC_UNFO_LIST      = Ord('U') + Ord('N') shl 8 + Ord('F') shl 16 + Ord('O') shl 24;
  14907.   DMUS_FOURCC_UNAM_CHUNK     = Ord('U') + Ord('N') shl 8 + Ord('A') shl 16 + Ord('M') shl 24;
  14908.   DMUS_FOURCC_UART_CHUNK     = Ord('U') + Ord('A') shl 8 + Ord('R') shl 16 + Ord('T') shl 24;
  14909.   DMUS_FOURCC_UCOP_CHUNK     = Ord('U') + Ord('C') shl 8 + Ord('O') shl 16 + Ord('P') shl 24;
  14910.   DMUS_FOURCC_USBJ_CHUNK     = Ord('U') + Ord('S') shl 8 + Ord('B') shl 16 + Ord('J') shl 24;
  14911.   DMUS_FOURCC_UCMT_CHUNK     = Ord('U') + Ord('C') shl 8 + Ord('M') shl 16 + Ord('T') shl 24;
  14912.   DMUS_FOURCC_CATEGORY_CHUNK = Ord('c') + Ord('a') shl 8 + Ord('t') shl 16 + Ord('g') shl 24;
  14913.   DMUS_FOURCC_VERSION_CHUNK  = Ord('v') + Ord('e') shl 8 + Ord('r') shl 16 + Ord('s') shl 24;
  14914.  
  14915. // The following structures are used by the Tracks, and are the packed structures
  14916. // that are passed to the Tracks inside the IStream.
  14917.  
  14918. type
  14919.   TDMUS_IO_SEQ_ITEM = record
  14920.     mtTime     : MUSIC_TIME;
  14921.     mtDuration : MUSIC_TIME;
  14922.     dwPChannel : DWORD;
  14923.     nOffset    : Smallint;
  14924.     bStatus    : Byte;
  14925.     bByte1     : Byte;
  14926.     bByte2     : Byte;
  14927.   end;
  14928.   DMUS_IO_SEQ_ITEM = TDMUS_IO_SEQ_ITEM;
  14929.  
  14930.  
  14931.   TDMUS_IO_CURVE_ITEM = record
  14932.     mtStart         : MUSIC_TIME;
  14933.     mtDuration      : MUSIC_TIME;
  14934.     mtResetDuration : MUSIC_TIME;
  14935.     dwPChannel      : DWORD;
  14936.     nOffset         : Smallint;
  14937.     nStartValue     : Smallint;
  14938.     nEndValue       : Smallint;
  14939.     nResetValue     : Smallint;
  14940.     bType           : Byte;
  14941.     bCurveShape     : Byte;
  14942.     bCCData         : Byte;
  14943.     bFlags          : Byte;
  14944.   end;
  14945.   DMUS_IO_CURVE_ITEM = TDMUS_IO_CURVE_ITEM;
  14946.  
  14947.  
  14948.   TDMUS_IO_TEMPO_ITEM = record
  14949.     lTime    : MUSIC_TIME;
  14950.     dblTempo : Double;
  14951.   end;
  14952.   DMUS_IO_TEMPO_ITEM = TDMUS_IO_TEMPO_ITEM;
  14953.  
  14954.  
  14955.   TDMUS_IO_SYSEX_ITEM = record
  14956.     mtTime        : MUSIC_TIME;
  14957.     dwPChannel    : DWORD;
  14958.     dwSysExLength : DWORD;
  14959.   end;
  14960.   DMUS_IO_SYSEX_ITEM = TDMUS_IO_SYSEX_ITEM;
  14961.  
  14962.  
  14963.   TDMUS_IO_TIMESIGNATURE_ITEM = record
  14964.     lTime            : MUSIC_TIME;
  14965.     bBeatsPerMeasure : Byte;          // beats per measure (top of time sig)
  14966.     bBeat            : Byte;          // what note receives the beat (bottom of time sig.)
  14967.                                       // we can assume that 0 means 256th note
  14968.     wGridsPerBeat    : Word;          // grids per beat
  14969.   end;
  14970.   DMUS_IO_TIMESIGNATURE_ITEM = TDMUS_IO_TIMESIGNATURE_ITEM;
  14971.  
  14972. // PARAM structures, used by GetParam() and SetParam()
  14973.   TDMUS_COMMAND_PARAM = record
  14974.     bCommand     : Byte;
  14975.     bGrooveLevel : Byte;
  14976.     bGrooveRange : Byte;
  14977.   end;
  14978.   DMUS_COMMAND_PARAM = TDMUS_COMMAND_PARAM;
  14979.  
  14980.   //DMUS_CHORD_KEY = DMUS_CHORD_PARAM; // DMUS_CHORD_KEY defined in dmusici.h
  14981.  
  14982.   TDMUS_RHYTHM_PARAM = record
  14983.     TimeSig         : TDMUS_TIMESIGNATURE;
  14984.     dwRhythmPattern : DWORD;
  14985.   end;
  14986.   DMUS_RHYTHM_PARAM = TDMUS_RHYTHM_PARAM;
  14987.  
  14988.   TDMUS_TEMPO_PARAM = record
  14989.     mtTime   : MUSIC_TIME;
  14990.     dblTempo : Double;
  14991.   end;
  14992.   DMUS_TEMPO_PARAM = TDMUS_TEMPO_PARAM;
  14993.  
  14994.  
  14995.   TDMUS_MUTE_PARAM = record
  14996.     dwPChannel    : DWORD;
  14997.     dwPChannelMap : DWORD;
  14998.     fMute         : BOOL;
  14999.   end;
  15000.   DMUS_MUTE_PARAM = TDMUS_MUTE_PARAM;
  15001.  
  15002. const
  15003. // Style chunks
  15004.  
  15005.   DMUS_FOURCC_STYLE_FORM           = Ord('D') + Ord('M') shl 8 + Ord('S') shl 16 + Ord('T') shl 24;
  15006.   DMUS_FOURCC_STYLE_CHUNK          = Ord('s') + Ord('t') shl 8 + Ord('y') shl 16 + Ord('h') shl 24;
  15007.   DMUS_FOURCC_PART_LIST            = Ord('p') + Ord('a') shl 8 + Ord('r') shl 16 + Ord('t') shl 24;
  15008.   DMUS_FOURCC_PART_CHUNK           = Ord('p') + Ord('r') shl 8 + Ord('t') shl 16 + Ord('h') shl 24;
  15009.   DMUS_FOURCC_NOTE_CHUNK           = Ord('n') + Ord('o') shl 8 + Ord('t') shl 16 + Ord('e') shl 24;
  15010.   DMUS_FOURCC_CURVE_CHUNK          = Ord('c') + Ord('r') shl 8 + Ord('v') shl 16 + Ord('e') shl 24;
  15011.   DMUS_FOURCC_PATTERN_LIST         = Ord('p') + Ord('t') shl 8 + Ord('t') shl 16 + Ord('n') shl 24;
  15012.   DMUS_FOURCC_PATTERN_CHUNK        = Ord('p') + Ord('t') shl 8 + Ord('n') shl 16 + Ord('h') shl 24;
  15013.   DMUS_FOURCC_RHYTHM_CHUNK         = Ord('r') + Ord('h') shl 8 + Ord('t') shl 16 + Ord('m') shl 24;
  15014.   DMUS_FOURCC_PARTREF_LIST         = Ord('p') + Ord('r') shl 8 + Ord('e') shl 16 + Ord('f') shl 24;
  15015.   DMUS_FOURCC_PARTREF_CHUNK        = Ord('p') + Ord('r') shl 8 + Ord('f') shl 16 + Ord('c') shl 24;
  15016.   DMUS_FOURCC_STYLE_PERS_REF_LIST  = Ord('p') + Ord('r') shl 8 + Ord('r') shl 16 + Ord('f') shl 24;
  15017.   DMUS_FOURCC_MOTIFSETTINGS_CHUNK  = Ord('m') + Ord('t') shl 8 + Ord('f') shl 16 + Ord('s') shl 24;
  15018.  
  15019. // Flags used by variations: these make up the DWORDs in dwVariationChoices.              
  15020.  
  15021. // These flags determine the types of chords supported by a given variation in DirectMusic
  15022. // mode.  The first seven flags (bits 1-7) are set if the variation supports major chords  
  15023. // rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation        
  15024. // supports major chords rooted in the tonic, second, and fourth scale positions.  The
  15025. // next seven flags serve the same purpose, but for minor chords, and the following seven
  15026. // flags serve the same purpose for chords that are not major or minor (e.g., SUS 4        
  15027. // chords).  Bits 22, 23, and 24 are set if the variation supports chords rooted in the    
  15028. // scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones,      
  15029. // respectively.  For example, to support a C# minor chord in the scale of C Major,        
  15030. // bits 8 (for tonic minor) and 24 (for sharp) need to be set.  Bits 25, 26, an 27 handle  
  15031. // chords that are triads, 6th or 7th chords, and chords with extensions, respectively.
  15032. // bits 28 and 29 handle chords that are followed by tonic and dominant chords,            
  15033. // respectively.                                                                          
  15034.   DMUS_VARIATIONF_MAJOR       = $0000007F; // Seven positions in the scale - major chords.
  15035.   DMUS_VARIATIONF_MINOR       = $00003F80; // Seven positions in the scale - minor chords.
  15036.   DMUS_VARIATIONF_OTHER       = $001FC000; // Seven positions in the scale - other chords.
  15037.   DMUS_VARIATIONF_ROOT_SCALE  = $00200000; // Handles chord roots in the scale.
  15038.   DMUS_VARIATIONF_ROOT_FLAT   = $00400000; // Handles flat chord roots (based on scale notes).
  15039.   DMUS_VARIATIONF_ROOT_SHARP  = $00800000; // Handles sharp chord roots (based on scale notes).
  15040.   DMUS_VARIATIONF_TYPE_TRIAD  = $01000000; // Handles simple chords - triads.
  15041.   DMUS_VARIATIONF_TYPE_6AND7  = $02000000; // Handles simple chords - 6 and 7.
  15042.   DMUS_VARIATIONF_TYPE_COMPLEX= $04000000; // Handles complex chords.
  15043.   DMUS_VARIATIONF_DEST_TO1    = $08000000; // Handles transitions to 1 chord.
  15044.   DMUS_VARIATIONF_DEST_TO5    = $10000000; // Handles transitions to 5 chord.
  15045.  
  15046. // The top three bits of the variation flags are the Mode bits.  If all are 0, it's IMA.
  15047. // If the smallest is 1, it's Direct Music.
  15048.   DMUS_VARIATIONF_MODES       = $E0000000;
  15049.   DMUS_VARIATIONF_IMA25_MODE  = $00000000;
  15050.   DMUS_VARIATIONF_DMUS_MODE   = $20000000;
  15051.  
  15052. type
  15053.   TDMUS_IO_TIMESIG = record
  15054.     // Time signatures define how many beats per measure, which note receives
  15055.     // the beat, and the grid resolution.
  15056.     bBeatsPerMeasure : Byte;    // beats per measure (top of time sig)
  15057.     bBeat            : Byte;    // what note receives the beat (bottom of time sig.)
  15058.                                 // we can assume that 0 means 256th note
  15059.     wGridsPerBeat    : Word;    // grids per beat
  15060.   end;
  15061.   DMUS_IO_TIMESIG = TDMUS_IO_TIMESIG;
  15062.  
  15063.   TDMUS_IO_STYLE = record
  15064.     timeSig : TDMUS_IO_TIMESIG;        // Styles have a default Time Signature
  15065.     dblTempo: Double;
  15066.   end;
  15067.   DMUS_IO_STYLE = TDMUS_IO_STYLE;
  15068.  
  15069.   TDMUS_IO_VERSION = record
  15070.     dwVersionMS : DWORD;        // Version # high-order 32 bits
  15071.     dwVersionLS : DWORD;        // Version # low-order 32 bits  
  15072.   end;
  15073.   DMUS_IO_VERSION = TDMUS_IO_VERSION;
  15074.  
  15075.   TDMUS_IO_PATTERN = record
  15076.     timeSig        : TDMUS_IO_TIMESIG;        // Patterns can override the Style's Time sig.
  15077.     bGrooveBottom  : Byte;                    // bottom of groove range
  15078.     bGrooveTop     : Byte;                    // top of groove range
  15079.     wEmbellishment : Word;                    // Fill, Break, Intro, End, Normal, Motif
  15080.     wNbrMeasures   : Word;                    // length in measures
  15081.   end;
  15082.   DMUS_IO_PATTERN = TDMUS_IO_PATTERN;
  15083.  
  15084.   TDMUS_IO_STYLEPART = record
  15085.     timeSig            : TDMUS_IO_TIMESIG;        // can override pattern's
  15086.     dwVariationChoices : array[0..31] of DWORD;   // MOAW choice bitfield
  15087.     guidPartID         : TGUID;                   // identifies the part
  15088.     wNbrMeasures       : Word;                    // length of the Part
  15089.     bPlayModeFlags     : Byte;                    // see PLAYMODE flags
  15090.     bInvertUpper       : Byte;                    // inversion upper limit
  15091.     bInvertLower       : Byte;                    // inversion lower limit
  15092.   end;
  15093.   DMUS_IO_STYLEPART = TDMUS_IO_STYLEPART;
  15094.  
  15095.   TDMUS_IO_PARTREF = record
  15096.     guidPartID       : TGUID;   // unique ID for matching up with parts
  15097.     wLogicalPartID   : Word;    // corresponds to port/device/midi channel
  15098.     bVariationLockID : Byte;    // parts with the same ID lock variations.
  15099.                                 // high bit is used to identify master Part
  15100.     bSubChordLevel   : Byte;    // tells which sub chord level this part wants
  15101.     bPriority        : Byte;    // 256 priority levels. Parts with lower priority
  15102.                                 // aren't played first when a device runs out of
  15103.                                 // notes
  15104.     bRandomVariation : Byte;    // when set, matching variations play in random order
  15105.                                 // when clear, matching variations play sequentially
  15106.   end;
  15107.   DMUS_IO_PARTREF = TDMUS_IO_PARTREF;
  15108.  
  15109.   TDMUS_IO_STYLENOTE = record
  15110.     mtGridStart : MUSIC_TIME;    // when this note occurs
  15111.     dwVariation : DWORD;         // variation bits
  15112.     mtDuration : MUSIC_TIME;     // how long this note lasts
  15113.     nTimeOffset : Smallint;      // offset from mtGridStart
  15114.     wMusicValue : Word;          // Position in scale.
  15115.     bVelocity : Byte;            // Note velocity.
  15116.     bTimeRange : Byte;           // Range to randomize start time.
  15117.     bDurRange : Byte;            // Range to randomize duration.
  15118.     bVelRange : Byte;            // Range to randomize velocity.
  15119.     bInversionID : Byte;         // Identifies inversion group to which this note belongs
  15120.     bPlayModeFlags : Byte;       // Can override part
  15121.   end;
  15122.   DMUS_IO_STYLENOTE = TDMUS_IO_STYLENOTE;
  15123.  
  15124.   TDMUS_IO_STYLECURVE = record
  15125.     mtGridStart     : MUSIC_TIME;// when this curve occurs
  15126.     dwVariation     : DWORD;     // variation bits
  15127.     mtDuration      : MUSIC_TIME;// how long this curve lasts
  15128.     mtResetDuration : MUSIC_TIME;// how long after the end of the curve to reset the curve
  15129.     nTimeOffset     : Smallint;  // offset from mtGridStart
  15130.     nStartValue     : Smallint;  // curve's start value
  15131.     nEndValue       : Smallint;  // curve's end value
  15132.     nResetValue     : Smallint;  // the value to which to reset the curve
  15133.     bEventType      : Byte;      // type of curve
  15134.     bCurveShape     : Byte;      // shape of curve
  15135.     bCCData         : Byte;      // CC#
  15136.     bFlags          : Byte;      // Bit 1=TRUE means to send nResetValue. Otherwise, don't.
  15137.                                  //  Other bits are reserved.
  15138.   end;
  15139.   DMUS_IO_STYLECURVE = TDMUS_IO_STYLECURVE;
  15140.  
  15141.   TDMUS_IO_MOTIFSETTINGS = record
  15142.     dwRepeats    : DWORD;         // Number of repeats. By default, 0.
  15143.     mtPlayStart  : MUSIC_TIME;    // Start of playback. By default, 0.
  15144.     mtLoopStart  : MUSIC_TIME;    // Start of looping portion. By default, 0.
  15145.     mtLoopEnd    : MUSIC_TIME;    // End of loop. Must be greater than mtLoopStart. By default equal to length of motif.
  15146.     dwResolution : DWORD;         // Default resolution.
  15147.   end;
  15148.   DMUS_IO_MOTIFSETTINGS = TDMUS_IO_MOTIFSETTINGS;
  15149.  
  15150.  
  15151. const
  15152. // Chord and command file formats
  15153.  
  15154.   DMUS_FOURCC_CHORDTRACK_LIST        = Ord('c') + Ord('o') shl 8 + Ord('r') shl 16 + Ord('d') shl 24;
  15155.   DMUS_FOURCC_CHORDTRACKHEADER_CHUNK = Ord('c') + Ord('r') shl 8 + Ord('d') shl 16 + Ord('h') shl 24;
  15156.   DMUS_FOURCC_CHORDTRACKBODY_CHUNK   = Ord('c') + Ord('r') shl 8 + Ord('d') shl 16 + Ord('b') shl 24;
  15157.  
  15158.   DMUS_FOURCC_COMMANDTRACK_CHUNK     = Ord('c') + Ord('m') shl 8 + Ord('n') shl 16 + Ord('d') shl 24;
  15159.  
  15160. type
  15161.   TDMUS_IO_CHORD = record
  15162.     wszName : array[0..15] of WCHAR;    // Name of the chord
  15163.     mtTime : MUSIC_TIME;                // Time of this chord
  15164.     wMeasure : Word;                    // Measure this falls on
  15165.     bBeat : Byte;                       // Beat this falls on
  15166.   end;
  15167.   DMUS_IO_CHORD = TDMUS_IO_CHORD;
  15168.  
  15169.   TDMUS_IO_SUBCHORD = record
  15170.     dwChordPattern    : DWORD;     // Notes in the subchord
  15171.     dwScalePattern    : DWORD;     // Notes in the scale
  15172.     dwInversionPoints : DWORD;     // Where inversions can occur
  15173.     dwLevels          : DWORD;     // Which levels are supported by this subchord
  15174.     bChordRoot        : Byte;      // Root of the subchord
  15175.     bScaleRoot        : Byte;      // Root of the scale
  15176.   end;
  15177.   DMUS_IO_SUBCHORD = TDMUS_IO_SUBCHORD;
  15178.  
  15179.   TDMUS_IO_COMMAND = record
  15180.     mtTime       : MUSIC_TIME;     // Time of this command
  15181.     wMeasure     : Word;           // Measure this falls on
  15182.     bBeat        : Byte;           // Beat this falls on
  15183.     bCommand     : Byte;           // Command type (see #defines below)
  15184.     bGrooveLevel : Byte;           // Groove level (0 if command is not a groove)
  15185.     bGrooveRange : Byte;           // Groove range  
  15186.   end;
  15187.   DMUS_IO_COMMAND = TDMUS_IO_COMMAND;
  15188.  
  15189.  
  15190. //  File io for DirectMusic Tool and ToolGraph objects
  15191. ///
  15192.  
  15193. const
  15194. // RIFF ids:
  15195.  
  15196.   DMUS_FOURCC_TOOLGRAPH_FORM = Ord('D') + Ord('M') shl 8 + Ord('T') shl 16 + Ord('G') shl 24;
  15197.   DMUS_FOURCC_TOOL_LIST      = Ord('t') + Ord('o') shl 8 + Ord('l') shl 16 + Ord('l') shl 24;
  15198.   DMUS_FOURCC_TOOL_FORM      = Ord('D') + Ord('M') shl 8 + Ord('T') shl 16 + Ord('L') shl 24;
  15199.   DMUS_FOURCC_TOOL_CHUNK     = Ord('t') + Ord('o') shl 8 + Ord('l') shl 16 + Ord('h') shl 24;
  15200.  
  15201. type
  15202. // io structures:
  15203.  
  15204.   TDMUS_IO_TOOL_HEADER = record
  15205.     guidClassID : TGUID;                // Class id of tool.
  15206.     lIndex      : Longint;              // Position in graph.
  15207.     cPChannels  : DWORD;                // Number of items in channels array.
  15208.     ckid        : FOURCC;               // chunk ID of tool's data chunk if 0 fccType valid.
  15209.     fccType     : FOURCC;               // list type if NULL ckid valid.
  15210.     dwPChannels : array[0..0] of DWORD; // Array of PChannels, size determined by cPChannels.
  15211.   end;
  15212.   DMUS_IO_TOOL_HEADER = TDMUS_IO_TOOL_HEADER;
  15213.  
  15214.  
  15215. //  File io for DirectMusic Band Track object
  15216.  
  15217. const
  15218. // RIFF ids:
  15219.   DMUS_FOURCC_BANDTRACK_FORM  = Ord('D') + Ord('M') shl 8 + Ord('B') shl 16 + Ord('T') shl 24;
  15220.   DMUS_FOURCC_BANDTRACK_CHUNK = Ord('b') + Ord('d') shl 8 + Ord('t') shl 16 + Ord('h') shl 24;
  15221.   DMUS_FOURCC_BANDS_LIST      = Ord('l') + Ord('b') shl 8 + Ord('d') shl 16 + Ord('l') shl 24;
  15222.   DMUS_FOURCC_BAND_LIST       = Ord('l') + Ord('b') shl 8 + Ord('n') shl 16 + Ord('d') shl 24;
  15223.   DMUS_FOURCC_BANDITEM_CHUNK  = Ord('b') + Ord('d') shl 8 + Ord('i') shl 16 + Ord('h') shl 24;
  15224.  
  15225. type
  15226. //  io structures
  15227.   TDMUS_IO_BAND_TRACK_HEADER = record
  15228.     bAutoDownload : BOOL;     // Determines if Auto-Download is enabled.
  15229.   end;
  15230.   DMUS_IO_BAND_TRACK_HEADER = TDMUS_IO_BAND_TRACK_HEADER;
  15231.  
  15232.   TDMUS_IO_BAND_ITEM_HEADER = record
  15233.     lBandTime : MUSIC_TIME;   // Position in track list.
  15234.   end;
  15235.   DMUS_IO_BAND_ITEM_HEADER = TDMUS_IO_BAND_ITEM_HEADER;
  15236.  
  15237.  
  15238. //  File io for DirectMusic Band object
  15239. ///
  15240.  
  15241. const
  15242. // RIFF ids:
  15243.  
  15244.   DMUS_FOURCC_BAND_FORM          = Ord('D') + Ord('M') shl 8 + Ord('B') shl 16 + Ord('D') shl 24;
  15245.   DMUS_FOURCC_INSTRUMENTS_LIST   = Ord('l') + Ord('b') shl 8 + Ord('i') shl 16 + Ord('l') shl 24;
  15246.   DMUS_FOURCC_INSTRUMENT_LIST    = Ord('l') + Ord('b') shl 8 + Ord('i') shl 16 + Ord('n') shl 24;
  15247.   DMUS_FOURCC_INSTRUMENT_CHUNK   = Ord('b') + Ord('i') shl 8 + Ord('n') shl 16 + Ord('s') shl 24;
  15248.  
  15249. // Flags for DMUS_IO_INSTRUMENT
  15250. ///
  15251.   DMUS_IO_INST_PATCH              = (1 shl 0);      // dwPatch is valid.
  15252.   DMUS_IO_INST_BANKSELECT         = (1 shl 1);      // dwPatch contains a valid Bank Select MSB and LSB part
  15253.   DMUS_IO_INST_ASSIGN_PATCH       = (1 shl 3);      // dwAssignPatch is valid
  15254.   DMUS_IO_INST_NOTERANGES         = (1 shl 4);      // dwNoteRanges is valid
  15255.   DMUS_IO_INST_PAN                = (1 shl 5);      // bPan is valid
  15256.   DMUS_IO_INST_VOLUME             = (1 shl 6);      // bVolume is valid
  15257.   DMUS_IO_INST_TRANSPOSE          = (1 shl 7);      // nTranspose is valid
  15258.   DMUS_IO_INST_GM                 = (1 shl 8);      // Instrument is from GM collection
  15259.   DMUS_IO_INST_GS                 = (1 shl 9);      // Instrument is from GS collection
  15260.   DMUS_IO_INST_XG                 = (1 shl 10);     // Instrument is from XG collection
  15261.   DMUS_IO_INST_CHANNEL_PRIORITY   = (1 shl 11);     // dwChannelPriority is valid
  15262.   DMUS_IO_INST_USE_DEFAULT_GM_SET = (1 shl 12);     // Always use the default GM set for this patch,  
  15263.                                                     // don't rely on the synth caps stating GM or GS in hardware.
  15264.  
  15265. type
  15266. //  io structures
  15267.   TDMUS_IO_INSTRUMENT = record
  15268.     dwPatch           : DWORD;                   // MSB, LSB and Program change to define instrument
  15269.     dwAssignPatch     : DWORD;                   // MSB, LSB and Program change to assign to instrument when downloading
  15270.     dwNoteRanges      : array[0..3] of DWORD;    // 128 bits; one for each MIDI note instrument needs to able to play
  15271.     dwPChannel        : DWORD;                   // PChannel instrument plays on
  15272.     dwFlags           : DWORD;                   // DMUS_IO_INST_ flags
  15273.     bPan              : Byte;                    // Pan for instrument
  15274.     bVolume           : Byte;                    // Volume for instrument
  15275.     nTranspose        : Smallint;                // Number of semitones to transpose notes
  15276.     dwChannelPriority : DWORD;                   // Channel priority
  15277.   end;
  15278.   DMUS_IO_INSTRUMENT = TDMUS_IO_INSTRUMENT;
  15279.  
  15280.  
  15281. //  File io for DirectMusic Segment object
  15282.  
  15283. const
  15284. // RIFF ids:
  15285.  
  15286.   DMUS_FOURCC_SEGMENT_FORM   = Ord('D') + Ord('M') shl 8 + Ord('S') shl 16 + Ord('G') shl 24;
  15287.   DMUS_FOURCC_SEGMENT_CHUNK  = Ord('s') + Ord('e') shl 8 + Ord('g') shl 16 + Ord('h') shl 24;
  15288.   DMUS_FOURCC_TRACK_LIST     = Ord('t') + Ord('r') shl 8 + Ord('k') shl 16 + Ord('l') shl 24;
  15289.   DMUS_FOURCC_TRACK_FORM     = Ord('D') + Ord('M') shl 8 + Ord('T') shl 16 + Ord('K') shl 24;
  15290.   DMUS_FOURCC_TRACK_CHUNK    = Ord('t') + Ord('r') shl 8 + Ord('k') shl 16 + Ord('h') shl 24;
  15291.  
  15292. type
  15293. //  io structures:
  15294.  
  15295.   TDMUS_IO_SEGMENT_HEADER = record
  15296.     dwRepeats    : DWORD;         // Number of repeats. By default, 0.
  15297.     mtLength     : MUSIC_TIME;    // Length, in music time.
  15298.     mtPlayStart  : MUSIC_TIME;    // Start of playback. By default, 0.
  15299.     mtLoopStart  : MUSIC_TIME;    // Start of looping portion. By default, 0.
  15300.     mtLoopEnd    : MUSIC_TIME;    // End of loop. Must be greater than dwPlayStart. By default equal to length.
  15301.     dwResolution : DWORD;         // Default resolution.
  15302.   end;
  15303.   DMUS_IO_SEGMENT_HEADER = TDMUS_IO_SEGMENT_HEADER;
  15304.  
  15305.   TDMUS_IO_TRACK_HEADER = record
  15306.     guidClassID : TGUID;         // Class id of track.
  15307.     dwPosition  : DWORD;         // Position in track list.
  15308.     dwGroup     : DWORD;         // Group bits for track.
  15309.     ckid        : FOURCC;        // chunk ID of track's data chunk if 0 fccType valid.
  15310.     fccType     : FOURCC;        // list type if NULL ckid valid
  15311.   end;
  15312.   DMUS_IO_TRACK_HEADER = TDMUS_IO_TRACK_HEADER;
  15313.  
  15314. //  File io for DirectMusic reference chunk.
  15315. //  This is used to embed a reference to an object.
  15316.  
  15317. const
  15318. //  RIFF ids:
  15319.  
  15320.   DMUS_FOURCC_REF_LIST       = Ord('D') + Ord('M') shl 8 + Ord('R') shl 16 + Ord('F') shl 24;
  15321.   DMUS_FOURCC_REF_CHUNK      = Ord('r') + Ord('e') shl 8 + Ord('f') shl 16 + Ord('h') shl 24;
  15322.   DMUS_FOURCC_DATE_CHUNK     = Ord('d') + Ord('a') shl 8 + Ord('t') shl 16 + Ord('e') shl 24;
  15323.   DMUS_FOURCC_NAME_CHUNK     = Ord('n') + Ord('a') shl 8 + Ord('m') shl 16 + Ord('e') shl 24;
  15324.   DMUS_FOURCC_FILE_CHUNK     = Ord('f') + Ord('i') shl 8 + Ord('l') shl 16 + Ord('e') shl 24;
  15325.  
  15326. type
  15327.   TDMUS_IO_REFERENCE = record
  15328.     guidClassID : TGUID;    // Class id is always required.
  15329.     dwValidData : DWORD;    // Flags.
  15330.   end;
  15331.   DMUS_IO_REFERENCE = TDMUS_IO_REFERENCE;
  15332.  
  15333.  
  15334. // Chord Maps
  15335.  
  15336. const
  15337. // runtime chunks
  15338.   DMUS_FOURCC_CHORDMAP_FORM      = Ord('D') + Ord('M') shl 8 + Ord('P') shl 16 + Ord('R') shl 24;
  15339.   DMUS_FOURCC_IOCHORDMAP_CHUNK   = Ord('p') + Ord('e') shl 8 + Ord('r') shl 16 + Ord('h') shl 24;
  15340.   DMUS_FOURCC_SUBCHORD_CHUNK     = Ord('c') + Ord('h') shl 8 + Ord('d') shl 16 + Ord('t') shl 24;
  15341.   DMUS_FOURCC_CHORDENTRY_CHUNK   = Ord('c') + Ord('h') shl 8 + Ord('e') shl 16 + Ord('h') shl 24;
  15342.   DMUS_FOURCC_SUBCHORDID_CHUNK   = Ord('s') + Ord('b') shl 8 + Ord('c') shl 16 + Ord('n') shl 24;
  15343.   DMUS_FOURCC_IONEXTCHORD_CHUNK  = Ord('n') + Ord('c') shl 8 + Ord('r') shl 16 + Ord('d') shl 24;
  15344.   DMUS_FOURCC_NEXTCHORDSEQ_CHUNK = Ord('n') + Ord('c') shl 8 + Ord('s') shl 16 + Ord('q') shl 24;
  15345.   DMUS_FOURCC_IOSIGNPOST_CHUNK   = Ord('s') + Ord('p') shl 8 + Ord('s') shl 16 + Ord('h') shl 24;
  15346.   DMUS_FOURCC_CHORDNAME_CHUNK    = Ord('I') + Ord('N') shl 8 + Ord('A') shl 16 + Ord('M') shl 24;
  15347.  
  15348. // runtime list chunks
  15349.   DMUS_FOURCC_CHORDENTRY_LIST    = Ord('c') + Ord('h') shl 8 + Ord('o') shl 16 + Ord('e') shl 24;
  15350.   DMUS_FOURCC_CHORDMAP_LIST      = Ord('c') + Ord('m') shl 8 + Ord('a') shl 16 + Ord('p') shl 24;
  15351.   DMUS_FOURCC_CHORD_LIST         = Ord('c') + Ord('h') shl 8 + Ord('r') shl 16 + Ord('d') shl 24;
  15352.   DMUS_FOURCC_CHORDPALETTE_LIST  = Ord('c') + Ord('h') shl 8 + Ord('p') shl 16 + Ord('l') shl 24;
  15353.   DMUS_FOURCC_CADENCE_LIST       = Ord('c') + Ord('a') shl 8 + Ord('d') shl 16 + Ord('e') shl 24;
  15354.   DMUS_FOURCC_SIGNPOSTITEM_LIST  = Ord('s') + Ord('p') shl 8 + Ord('s') shl 16 + Ord('t') shl 24;
  15355.  
  15356.   DMUS_FOURCC_SIGNPOST_LIST      = Ord('s') + Ord('p') shl 8 + Ord('s') shl 16 + Ord('q') shl 24;
  15357.  
  15358. // values for dwChord field of DMUS_IO_PERS_SIGNPOST
  15359. // DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST)
  15360.   DMUS_SIGNPOSTF_A       = 1;
  15361.   DMUS_SIGNPOSTF_B       = 2;
  15362.   DMUS_SIGNPOSTF_C       = 4;
  15363.   DMUS_SIGNPOSTF_D       = 8;
  15364.   DMUS_SIGNPOSTF_E       = $10;
  15365.   DMUS_SIGNPOSTF_F       = $20;
  15366.   DMUS_SIGNPOSTF_LETTER  = (DMUS_SIGNPOSTF_A or DMUS_SIGNPOSTF_B or DMUS_SIGNPOSTF_C or DMUS_SIGNPOSTF_D or DMUS_SIGNPOSTF_E or DMUS_SIGNPOSTF_F);
  15367.   DMUS_SIGNPOSTF_1       = $100;
  15368.   DMUS_SIGNPOSTF_2       = $200;
  15369.   DMUS_SIGNPOSTF_3       = $400;
  15370.   DMUS_SIGNPOSTF_4       = $800;
  15371.   DMUS_SIGNPOSTF_5       = $1000;
  15372.   DMUS_SIGNPOSTF_6       = $2000;
  15373.   DMUS_SIGNPOSTF_7       = $4000;
  15374.   DMUS_SIGNPOSTF_ROOT    = (DMUS_SIGNPOSTF_1 or DMUS_SIGNPOSTF_2 or DMUS_SIGNPOSTF_3 or DMUS_SIGNPOSTF_4 or DMUS_SIGNPOSTF_5 or DMUS_SIGNPOSTF_6 or DMUS_SIGNPOSTF_7);
  15375.   DMUS_SIGNPOSTF_CADENCE = $8000;
  15376.  
  15377. // values for dwChord field of DMUS_IO_PERS_SIGNPOST
  15378.   DMUS_SPOSTCADENCEF_1 = 2;   // Use the first cadence chord.
  15379.   DMUS_SPOSTCADENCEF_2 = 4;   // Use the second cadence chord.
  15380.  
  15381. type
  15382. // run time data structs
  15383.   TDMUS_IO_CHORDMAP = record
  15384.     wszLoadName    : array[0..19] of WCHAR;
  15385.     dwScalePattern : DWORD;
  15386.     dwFlags        : DWORD;
  15387.   end;
  15388.   DMUS_IO_CHORDMAP = TDMUS_IO_CHORDMAP;
  15389.  
  15390.   TDMUS_IO_CHORDMAP_SUBCHORD = record
  15391.     dwChordPattern : DWORD;
  15392.     dwScalePattern : DWORD;
  15393.     dwInvertPattern: DWORD;
  15394.     bChordRoot     : Byte;
  15395.     bScaleRoot     : Byte;
  15396.     wCFlags        : Word;
  15397.     dwLevels       : DWORD;   // parts or which subchord levels this chord supports
  15398.   end;
  15399.   DMUS_IO_CHORDMAP_SUBCHORD = TDMUS_IO_CHORDMAP_SUBCHORD;
  15400.  
  15401. // Legacy name...
  15402.   DMUS_IO_PERS_SUBCHORD = TDMUS_IO_CHORDMAP_SUBCHORD;
  15403.  
  15404.   TDMUS_IO_CHORDENTRY = record
  15405.     dwFlags       : DWORD;
  15406.     wConnectionID : Word;  // replaces runtime "pointer to this"
  15407.   end;
  15408.   DMUS_IO_CHORDENTRY = TDMUS_IO_CHORDENTRY;
  15409.  
  15410.   TDMUS_IO_NEXTCHORD = record
  15411.     dwFlags       : DWORD;
  15412.     nWeight       : Word;
  15413.     wMinBeats     : Word;
  15414.     wMaxBeats     : Word;
  15415.     wConnectionID : Word;  // points to an ioChordEntry
  15416.   end;
  15417.   DMUS_IO_NEXTCHORD = TDMUS_IO_NEXTCHORD;
  15418.  
  15419.   TDMUS_IO_CHORDMAP_SIGNPOST = record
  15420.     dwChords : DWORD;   // 1bit per group
  15421.     dwFlags  : DWORD;
  15422.   end;
  15423.   DMUS_IO_CHORDMAP_SIGNPOST = TDMUS_IO_CHORDMAP_SIGNPOST;
  15424.  
  15425. // Legacy name...
  15426.   DMUS_IO_PERS_SIGNPOST = TDMUS_IO_CHORDMAP_SIGNPOST;
  15427.  
  15428. const
  15429. // Signpost tracks
  15430.   DMUS_FOURCC_SIGNPOST_TRACK_CHUNK = Ord('s') + Ord('g') shl 8 + Ord('n') shl 16 + Ord('p') shl 24;
  15431.  
  15432. type
  15433.   TDMUS_IO_SIGNPOST = record
  15434.     mtTime   : MUSIC_TIME;
  15435.     dwChords : DWORD;
  15436.     wMeasure : Word;
  15437.   end;
  15438.   DMUS_IO_SIGNPOST = TDMUS_IO_SIGNPOST;
  15439.  
  15440. const
  15441.   DMUS_FOURCC_MUTE_CHUNK = Ord('m') + Ord('u') shl 8 + Ord('t') shl 16 + Ord('e') shl 24;
  15442.  
  15443. type
  15444.   TDMUS_IO_MUTE = record
  15445.     mtTime        : MUSIC_TIME;
  15446.     dwPChannel    : DWORD;
  15447.     dwPChannelMap : DWORD;
  15448.   end;
  15449.   DMUS_IO_MUTE = TDMUS_IO_MUTE;
  15450.  
  15451. // Used for both style and chord map tracks
  15452. const
  15453.   DMUS_FOURCC_TIME_STAMP_CHUNK = Ord('s') + Ord('t') shl 8 + Ord('m') shl 16 + Ord('p') shl 24;
  15454.  
  15455. // Style tracks
  15456.   DMUS_FOURCC_STYLE_TRACK_LIST = Ord('s') + Ord('t') shl 8 + Ord('t') shl 16 + Ord('r') shl 24;
  15457.   DMUS_FOURCC_STYLE_REF_LIST   = Ord('s') + Ord('t') shl 8 + Ord('r') shl 16 + Ord('f') shl 24;
  15458.  
  15459. // Chord map tracks
  15460.   DMUS_FOURCC_PERS_TRACK_LIST = Ord('p') + Ord('f') shl 8 + Ord('t') shl 16 + Ord('r') shl 24;
  15461.   DMUS_FOURCC_PERS_REF_LIST   = Ord('p') + Ord('f') shl 8 + Ord('r') shl 16 + Ord('f') shl 24;
  15462.   DMUS_FOURCC_TEMPO_TRACK     = Ord('t') + Ord('e') shl 8 + Ord('t') shl 16 + Ord('r') shl 24;
  15463.   DMUS_FOURCC_SEQ_TRACK       = Ord('s') + Ord('e') shl 8 + Ord('q') shl 16 + Ord('t') shl 24;
  15464.   DMUS_FOURCC_SEQ_LIST        = Ord('e') + Ord('v') shl 8 + Ord('t') shl 16 + Ord('l') shl 24;
  15465.   DMUS_FOURCC_CURVE_LIST      = Ord('c') + Ord('u') shl 8 + Ord('r') shl 16 + Ord('l') shl 24;
  15466.   DMUS_FOURCC_SYSEX_TRACK     = Ord('s') + Ord('y') shl 8 + Ord('e') shl 16 + Ord('x') shl 24;
  15467.   DMUS_FOURCC_TIMESIGNATURE_TRACK = Ord('t') + Ord('i') shl 8 + Ord('m') shl 16 + Ord('s') shl 24;
  15468.  
  15469. implementation
  15470.  
  15471. const
  15472.   DDrawLib = 'DDraw.dll';
  15473.   D3DRMLib = 'D3DRM.dll';
  15474.   D3DXofLib = 'd3dxof.dll';
  15475.   DInputLib = 'DInput.dll';
  15476.   DPlayXLib = 'DPlayX.dll';
  15477.   DSetupLib = 'DSetup.dll';
  15478.   DSoundLib = 'DSound.dll';
  15479.  
  15480.  
  15481. { DirectDraw }
  15482.  
  15483. function GET_WHQL_YEAR(dwWHQLLevel: DWORD): DWORD;
  15484. begin
  15485.   Result := dwWHQLLevel div $10000;
  15486. end;
  15487.  
  15488. function GET_WHQL_MONTH(dwWHQLLevel: DWORD): DWORD;
  15489. begin
  15490.   Result := (dwWHQLLevel div $100) and $FF;
  15491. end;
  15492.  
  15493. function GET_WHQL_DAY(dwWHQLLevel: DWORD): DWORD;
  15494. begin
  15495.   Result := dwWHQLLevel and $FF;
  15496. end;
  15497.  
  15498. function DirectDrawEnumerateA; external DDrawLib;
  15499. function DirectDrawEnumerateW; external DDrawLib;
  15500. function DirectDrawEnumerate; external DDrawLib name 'DirectDrawEnumerateA';
  15501.  
  15502. function DirectDrawEnumerateExA; external DDrawLib;
  15503. function DirectDrawEnumerateExW; external DDrawLib;
  15504. function DirectDrawEnumerateEx; external DDrawLib name 'DirectDrawEnumerateExA';
  15505.  
  15506. function DirectDrawCreate; external DDrawLib;
  15507. function DirectDrawCreateEx; external DDrawLib;
  15508. function DirectDrawCreateClipper; external DDrawLib;
  15509.  
  15510. { Direct3D }
  15511.  
  15512. function D3DVALP(val: TD3DValue; prec: Integer): TD3DValue;
  15513. begin
  15514.   Result := val;
  15515. end;
  15516.  
  15517. function D3DVAL(val: TD3DValue): TD3DValue;
  15518. begin
  15519.   Result := val;
  15520. end;
  15521.  
  15522. function D3DDivide(a, b: TD3DValue): TD3DValue;
  15523. begin
  15524.   Result := a / b;
  15525. end;
  15526.  
  15527. function D3DMultiply(a, b: TD3DValue): TD3DValue;
  15528. begin
  15529.   Result := a * b;
  15530. end;
  15531.  
  15532. function CI_GETALPHA(ci: Integer): Byte;
  15533. begin
  15534.   Result := ci shr 24;
  15535. end;
  15536.  
  15537. function CI_GETINDEX(ci: Integer): Word;
  15538. begin
  15539.   Result := ci shr 8;
  15540. end;
  15541.  
  15542. function CI_GETFRACTION(ci: Integer): Byte;
  15543. begin
  15544.   Result := ci;
  15545. end;
  15546.  
  15547. function CI_ROUNDINDEX(ci: Integer): Integer;
  15548. begin
  15549.   Result := CI_GETINDEX(ci)+$80;
  15550. end;
  15551.  
  15552. function CI_MASKALPHA(ci: Integer): Integer;
  15553. begin
  15554.   Result := ci and $FFFFFF;
  15555. end;
  15556.  
  15557. function CI_MAKE(a: Byte; i: Word; f: Byte): Integer;
  15558. begin
  15559.   Result := (a shl 24) or (i shl 8) or f;
  15560. end;
  15561.  
  15562. function RGBA_GETALPHA(rgb: TD3DColor): Byte;
  15563. begin
  15564.   Result := rgb shr 24;
  15565. end;
  15566.  
  15567. function RGBA_GETRED(rgb: TD3DColor): Byte;
  15568. begin
  15569.   Result := rgb shr 16;
  15570. end;
  15571.  
  15572. function RGBA_GETGREEN(rgb: TD3DColor): Byte;
  15573. begin
  15574.   Result := rgb shr 8;
  15575. end;
  15576.  
  15577. function RGBA_GETBLUE(rgb: TD3DColor): Byte;
  15578. begin
  15579.   Result := rgb;
  15580. end;
  15581.  
  15582. function RGBA_MAKE(r, g, b, a: Byte): TD3DColor;
  15583. begin
  15584.   Result := (a shl 24) or (r shl 16) or (g shl 8) or b;
  15585. end;
  15586.  
  15587. function D3DRGB(r, g, b: TD3DValue): TD3DColor;
  15588. begin
  15589.   Result := $FF000000 or (Trunc(r*255) shl 16) or (Trunc(g*255) shl 8) or
  15590.        (Trunc(b*255));
  15591. end;
  15592.  
  15593. function D3DRGBA(r, g, b, a: TD3DValue): TD3DColor;
  15594. begin
  15595.   Result := (Trunc(a*255) shl 24) or (Trunc(r*255) shl 16) or (Trunc(g*255) shl 8) or
  15596.     (Trunc(b*255));
  15597. end;
  15598.  
  15599. function RGB_GETRED(rgb: TD3DColor): Byte;
  15600. begin
  15601.   Result := rgb shr 16;
  15602. end;
  15603.  
  15604. function RGB_GETGREEN(rgb: TD3DColor): Byte;
  15605. begin
  15606.   Result := rgb shr 8;
  15607. end;
  15608.  
  15609. function RGB_GETBLUE(rgb: TD3DColor): Byte;
  15610. begin
  15611.   Result := rgb;
  15612. end;
  15613.  
  15614. function RGBA_SETALPHA(rgba: TD3DColor; x: Byte): TD3DColor;
  15615. begin
  15616.   Result := (x shl 24) or (rgba and $00FFFFFF);
  15617. end;
  15618.  
  15619. function RGB_MAKE(r, g, b: Byte): TD3DColor;
  15620. begin
  15621.   Result := (r shl 16) or (g shl 8) or b;
  15622. end;
  15623.  
  15624. function RGBA_TORGB(rgba: TD3DColor): TD3DColor;
  15625. begin
  15626.   Result := rgba and $00FFFFFF;
  15627. end;
  15628.  
  15629. function RGB_TORGBA(rgb: TD3DColor): TD3DColor;
  15630. begin
  15631.   Result := rgb or $FF000000;
  15632. end;
  15633.  
  15634. function VectorAdd(v1, v2: TD3DVector) : TD3DVector;
  15635. begin
  15636.   result.x := v1.x+v2.x;
  15637.   result.y := v1.y+v2.y;
  15638.   result.z := v1.z+v2.z;
  15639. end;
  15640.  
  15641. function VectorSub(v1, v2: TD3DVector) : TD3DVector;
  15642. begin
  15643.   result.x := v1.x-v2.x;
  15644.   result.y := v1.y-v2.y;
  15645.   result.z := v1.z-v2.z;
  15646. end;
  15647.  
  15648. function VectorMulS(v: TD3DVector; s: TD3DValue) : TD3DVector;
  15649. begin
  15650.   result.x := v.x*s;
  15651.   result.y := v.y*s;
  15652.   result.z := v.z*s;
  15653. end;
  15654.  
  15655. function VectorDivS(v: TD3DVector; s: TD3DValue) : TD3DVector;
  15656. begin
  15657.   result.x := v.x/s;
  15658.   result.y := v.y/s;
  15659.   result.z := v.z/s;
  15660. end;
  15661.  
  15662. function VectorMul(v1, v2: TD3DVector) : TD3DVector;
  15663. begin
  15664.   result.x := v1.x*v2.x;
  15665.   result.y := v1.y*v2.y;
  15666.   result.z := v1.z*v2.z;
  15667. end;
  15668.  
  15669. function VectorDiv(v1, v2: TD3DVector) : TD3DVector;
  15670. begin
  15671.   result.x := v1.x/v2.x;
  15672.   result.y := v1.y/v2.y;
  15673.   result.z := v1.z/v2.z;
  15674. end;
  15675.  
  15676. function VectorSmaller(v1, v2: TD3DVector) : boolean;
  15677. begin
  15678.   result := (v1.x < v2.x) and (v1.y < v2.y) and (v1.z < v2.z);
  15679. end;
  15680.  
  15681. function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
  15682. begin
  15683.   result := (v1.x <= v2.x) and (v1.y <= v2.y) and (v1.z <= v2.z);
  15684. end;
  15685.  
  15686. function VectorEquel(v1, v2: TD3DVector) : boolean;
  15687. begin
  15688.   result := (v1.x = v2.x) and (v1.y = v2.y) and (v1.z = v2.z);
  15689. end;
  15690.  
  15691. function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
  15692. begin
  15693.   result := (v.x*v.x) + (v.y*v.y) + (v.z*v.z);
  15694. end;
  15695.  
  15696. function VectorMagnitude(v: TD3DVector) : TD3DValue;
  15697. begin
  15698.   result := sqrt( (v.x*v.x) + (v.y*v.y) + (v.z*v.z) );
  15699. end;
  15700.  
  15701. function VectorNormalize(v: TD3DVector) : TD3DVector;
  15702. begin
  15703.   result := VectorDivS(v,VectorMagnitude(v));
  15704. end;
  15705.  
  15706. function VectorMin(v: TD3DVector) : TD3DValue;
  15707. var
  15708.   ret : TD3DValue;
  15709. begin
  15710.   ret := v.x;
  15711.   if (v.y < ret) then ret := v.y;
  15712.   if (v.z < ret) then ret := v.z;
  15713.   result := ret;
  15714. end;
  15715.  
  15716. function VectorMax(v: TD3DVector) : TD3DValue;
  15717. var
  15718.   ret : TD3DValue;
  15719. begin
  15720.   ret := v.x;
  15721.   if (ret < v.y) then ret := v.y;
  15722.   if (ret < v.z) then ret := v.z;
  15723.   result := ret;
  15724. end;
  15725.  
  15726. function VectorMinimize(v1, v2: TD3DVector) : TD3DVector;
  15727. begin
  15728.   if v1.x < v2.x then result.x := v1.x else result.x := v2.x;
  15729.   if v1.y < v2.y then result.y := v1.y else result.y := v2.y;
  15730.   if v1.z < v2.z then result.z := v1.z else result.z := v2.z;
  15731. end;
  15732.  
  15733. function VectorMaximize(v1, v2: TD3DVector) : TD3DVector;
  15734. begin
  15735.   if v1.x > v2.x then result.x := v1.x else result.x := v2.x;
  15736.   if v1.y > v2.y then result.y := v1.y else result.y := v2.y;
  15737.   if v1.z > v2.z then result.z := v1.z else result.z := v2.z;
  15738. end;
  15739.  
  15740. function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
  15741. begin
  15742.   result := (v1.x*v2.x) + (v1.y * v2.y) + (v1.z*v2.z);
  15743. end;
  15744.  
  15745. function VectorCrossProduct(v1, v2: TD3DVector) : TD3DVector;
  15746. begin
  15747.   result.x := (v1.y*v2.z) - (v1.z*v2.y);
  15748.   result.y := (v1.z*v2.x) - (v1.x*v2.z);
  15749.   result.z := (v1.x*v2.y) - (v1.y*v2.x);
  15750. end;
  15751.  
  15752. function D3DSTATE_OVERRIDE(typ: DWORD): DWORD;
  15753. begin
  15754.   Result := typ + D3DSTATE_OVERRIDE_BIAS;
  15755. end;
  15756.  
  15757. function D3DRENDERSTATE_STIPPLEPATTERN(y: DWORD): TD3DRenderStateType;
  15758. begin
  15759.   Result := TD3DRenderStateType(Ord(D3DRENDERSTATE_STIPPLEPATTERN00)+y);
  15760. end;
  15761.  
  15762. function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
  15763. begin
  15764.   if not (len in [1..29]) then len := 0;
  15765.   result := len;
  15766. end;
  15767.  
  15768. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD): DWORD;
  15769. begin
  15770.   Result := D3DFVF_TEXTUREFORMAT3 shl (CoordIndex*2 + 16);
  15771. end;
  15772.  
  15773. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD): DWORD;
  15774. begin
  15775.   Result := D3DFVF_TEXTUREFORMAT2;
  15776. end;
  15777.  
  15778. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD): DWORD;
  15779. begin
  15780.   Result := D3DFVF_TEXTUREFORMAT4 shl (CoordIndex*2 + 16);
  15781. end;
  15782.  
  15783. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD): DWORD;
  15784. begin
  15785.   Result := D3DFVF_TEXTUREFORMAT1 shl (CoordIndex*2 + 16);
  15786. end;
  15787.  
  15788. { Direct3DRM }
  15789.  
  15790. procedure D3DRMAnimationGetRotateKey(const rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  15791. begin
  15792.   rmQuat.s := rmKey.dvK[0];
  15793.   rmQuat.v.x := rmKey.dvK[1];
  15794.   rmQuat.v.y := rmKey.dvK[2];
  15795.   rmQuat.v.z := rmKey.dvK[3];
  15796. end;
  15797.  
  15798. procedure D3DRMAnimationGetScaleKey(const rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  15799. begin
  15800.   dvVec.x := rmKey.dvK[0];
  15801.   dvVec.y := rmKey.dvK[1];
  15802.   dvVec.z := rmKey.dvK[2];
  15803. end;
  15804.  
  15805. procedure D3DRMAnimationGetPositionKey(const rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  15806. begin
  15807.   dvVec.x := rmKey.dvK[0];
  15808.   dvVec.y := rmKey.dvK[1];
  15809.   dvVec.z := rmKey.dvK[2];
  15810. end;
  15811.  
  15812. procedure D3DRMAnimationSetRotateKey(var rmKey: TD3DRMAnimationKey; const rmQuat: TD3DRMQuaternion);
  15813. begin
  15814.   rmKey.dvK[0] := rmQuat.s;
  15815.   rmKey.dvK[1] := rmQuat.v.x;
  15816.   rmKey.dvK[2] := rmQuat.v.y;
  15817.   rmKey.dvK[3] := rmQuat.v.z;
  15818. end;
  15819.  
  15820. procedure D3DRMAnimationSetScaleKey(var rmKey: TD3DRMAnimationKey; const dvVec: TD3DVector);
  15821. begin
  15822.   rmKey.dvK[0] := dvVec.x;
  15823.   rmKey.dvK[1] := dvVec.y;
  15824.   rmKey.dvK[2] := dvVec.z;
  15825. end;
  15826.  
  15827. procedure D3DRMAnimationSetPositionKey(var rmKey: TD3DRMAnimationKey; const dvVec: TD3DVector);
  15828. begin
  15829.   rmKey.dvK[0] := dvVec.x;
  15830.   rmKey.dvK[1] := dvVec.y;
  15831.   rmKey.dvK[2] := dvVec.z;
  15832. end;
  15833.  
  15834. function Direct3DRMCreate; external D3DRMLib;
  15835.  
  15836. function D3DRMCreateColorRGB; external D3DRMLib;
  15837. function D3DRMCreateColorRGBA; external D3DRMLib;
  15838. function D3DRMColorGetRed; external D3DRMLib;
  15839. function D3DRMColorGetGreen; external D3DRMLib;
  15840. function D3DRMColorGetBlue; external D3DRMLib;
  15841. function D3DRMColorGetAlpha; external D3DRMLib;
  15842. function D3DRMVectorAdd; external D3DRMLib;
  15843. function D3DRMVectorSubtract; external D3DRMLib;
  15844. function D3DRMVectorReflect; external D3DRMLib;
  15845. function D3DRMVectorCrossProduct; external D3DRMLib;
  15846. function D3DRMVectorDotProduct; external D3DRMLib;
  15847. function D3DRMVectorNormalize; external D3DRMLib;
  15848. function D3DRMVectorModulus; external D3DRMLib;
  15849. function D3DRMVectorRotate; external D3DRMLib;
  15850. function D3DRMVectorScale; external D3DRMLib;
  15851. function D3DRMVectorRandom; external D3DRMLib;
  15852. function D3DRMQuaternionFromRotation; external D3DRMLib;
  15853. function D3DRMQuaternionMultiply; external D3DRMLib;
  15854. function D3DRMQuaternionSlerp; external D3DRMLib;
  15855. procedure D3DRMMatrixFromQuaternion; external D3DRMLib;
  15856. function D3DRMQuaternionFromMatrix; external D3DRMLib;
  15857.  
  15858. function DirectXFileCreate; external D3DXofLib;
  15859.  
  15860. { DirectInput }
  15861.  
  15862. function GET_DIDEVICE_TYPE(dwDevType: DWORD): DWORD;
  15863. begin
  15864.   Result := LOBYTE(dwDevType);
  15865. end;
  15866.  
  15867. function GET_DIDEVICE_SUBTYPE(dwDevType: DWORD): DWORD;
  15868. begin
  15869.   Result := HIBYTE(dwDevType);
  15870. end;
  15871.  
  15872. function DIEFT_GETTYPE(n: DWORD): DWORD;
  15873. begin
  15874.   Result := LOBYTE(n);
  15875. end;
  15876.  
  15877. function DIDFT_MAKEINSTANCE(n: WORD): DWORD;
  15878. begin
  15879.   Result := n shl 8;
  15880. end;
  15881.  
  15882. function DIDFT_GETTYPE(n: DWORD): DWORD;
  15883. begin
  15884.   Result := LOBYTE(n);
  15885. end;
  15886.  
  15887. function DIDFT_GETINSTANCE(n: DWORD): WORD;
  15888. begin
  15889.   Result := n shr 8;
  15890. end;
  15891.  
  15892. function DIDFT_ENUMCOLLECTION(n: WORD): DWORD;
  15893. begin
  15894.   Result := n shl 8;
  15895. end;
  15896.  
  15897. function DIMAKEUSAGEDWORD(UsagePage, Usage: Word): DWORD;
  15898. begin
  15899.   Result := MAKELONG(Usage, UsagePage);
  15900. end;
  15901.  
  15902. function DirectInputCreate; external DInputLib name 'DirectInputCreateA';
  15903. function DirectInputCreateEx; external DInputLib name 'DirectInputCreateEx';
  15904.  
  15905. { DirectPlay }
  15906.  
  15907. function DirectPlayEnumerateA; external DPlayXLib;
  15908. function DirectPlayEnumerateW; external DPlayXLib;
  15909. function DirectPlayEnumerate; external DPlayXLib name 'DirectPlayEnumerateA';
  15910.  
  15911. function DirectPlayCreate; external DPlayXLib;
  15912.  
  15913. function DirectPlayLobbyCreateW; external DPlayXLib;
  15914. function DirectPlayLobbyCreateA; external DPlayXLib;
  15915. function DirectPlayLobbyCreate; external DPlayXLib name 'DirectPlayLobbyCreateA';
  15916.  
  15917. { DirectSetup }
  15918.  
  15919. function DirectXSetupA; external DSetupLib;
  15920. function DirectXSetupW; external DSetupLib;
  15921. function DirectXSetup; external DSetupLib name 'DirectXSetupA';
  15922.  
  15923. function DirectXDeviceDriverSetupA; external DSetupLib;
  15924. function DirectXDeviceDriverSetupW; external DSetupLib;
  15925. function DirectXDeviceDriverSetup; external DSetupLib name 'DirectXDeviceDriverSetupA';
  15926.  
  15927. function DirectXRegisterApplicationA; external DSetupLib;
  15928. function DirectXRegisterApplicationW; external DSetupLib;
  15929. function DirectXRegisterApplication; external DSetupLib name 'DirectXRegisterApplicationA';
  15930.  
  15931. function DirectXUnRegisterApplication; external DSetupLib;
  15932.  
  15933. function DirectXSetupSetCallback; external DSetupLib;
  15934.  
  15935. function DirectXSetupGetVersion; external DSetupLib;
  15936.  
  15937. { DirectSound }
  15938.  
  15939. function DSSPEAKER_COMBINED(c, g: Byte): DWORD;
  15940. begin
  15941.   Result := c or (g shl 16);
  15942. end;
  15943.  
  15944. function DSSPEAKER_CONFIG(a: DWORD): Byte;
  15945. begin
  15946.   Result := a;
  15947. end;
  15948.  
  15949. function DSSPEAKER_GEOMETRY(a: DWORD): Byte;
  15950. begin
  15951.   Result := a shr 16;
  15952. end;
  15953.  
  15954. function DirectSoundCreate; external DSoundLib;
  15955. function DirectSoundEnumerateA; external DSoundLib;
  15956. function DirectSoundEnumerateW; external DSoundLib;
  15957. function DirectSoundEnumerate; external DSoundLib name 'DirectSoundEnumerateA';
  15958.  
  15959. function DirectSoundCaptureCreate; external DSoundLib;
  15960. function DirectSoundCaptureEnumerateA; external DSoundLib;
  15961. function DirectSoundCaptureEnumerateW; external DSoundLib;
  15962. function DirectSoundCaptureEnumerate; external DSoundLib name 'DirectSoundCaptureEnumerateA';
  15963.  
  15964. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
  15965. begin
  15966.   Result := Ord(ch0) + (Ord(ch1) shl 8) + (Ord(ch2) shl 16) + (Ord(ch3) shl 24);
  15967. end;
  15968.  
  15969. function MAKE_DMHRESULTSUCCESS(code: Cardinal) : HResult;
  15970. begin
  15971.   Result := MakeResult(0, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code)));
  15972. end;
  15973.  
  15974. function MAKE_DMHRESULTERROR(code: Cardinal) : HResult;
  15975. begin
  15976.   Result := MakeResult(1, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code)));
  15977. end;
  15978.  
  15979. // The number of bytes to allocate for an event with 'cb' data bytes.
  15980. //
  15981. function QWORD_ALIGN(x: LONGLONG): LONGLONG;
  15982. begin
  15983.   Result := x + 7;
  15984.   PDWORD(@Result)^ := PDWORD(@Result)^ and (not 7);
  15985. end;
  15986.  
  15987. function DMUS_EVENT_SIZE(cb: LONGLONG): LONGLONG;
  15988. begin
  15989.   Result := QWORD_ALIGN(SizeOf(DMUS_EVENTHEADER) + cb);
  15990. end;
  15991.  
  15992. end.
  15993.  
  15994.