Subversion Repositories spacemission

Rev

Rev 16 | 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. (c)2004 Jaro Benes Recompilation with Erik Unger's headers
  30.  
  31. Join in order:
  32.   1) DirectDraw
  33.   2) Direct3D
  34.   3) Direct3DRM
  35.   4) DirectInput
  36.   5) DirectPlay
  37.   6) DirectSetup
  38.   7) DirectSound
  39.   8) DirectMusic
  40. }
  41. Unit DirectX;
  42.  
  43. Interface
  44.  
  45. {Delphi version marks}
  46.  
  47. {$I DelphiXcfg.inc}
  48.  
  49. {$MINENUMSIZE 4}
  50. {$ALIGN ON}
  51.  
  52. uses
  53.   Windows, MMSystem;
  54.  
  55. type
  56. {$IFDEF UNICODE}
  57.   PCharAW = PWideChar;
  58. {$ELSE}
  59.   PCharAW = PAnsiChar;
  60. {$ENDIF}
  61.  
  62. //DirectDraw file
  63. (*==========================================================================;
  64.  *
  65.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  66.  *
  67.  *  Files:      ddraw.h dvp.h
  68.  *  Content:    DirectDraw and DirectDrawVideoPort include files
  69.  *
  70.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  71.  *
  72.  *  Modified: 10-Sep-2000
  73.  *
  74.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  75.  *  E-Mail: DelphiDirectX@next-reality.com
  76.  *
  77.  *
  78.  ***************************************************************************)
  79.  
  80. var
  81.   DDrawDLL : HMODULE = 0;
  82.  
  83. function DDErrorString(Value: HResult) : string;
  84.  
  85. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
  86.  
  87. (*
  88.  * FOURCC codes for DX compressed-texture pixel formats
  89.  *)
  90. const
  91.   FOURCC_DXT1 = 'DXT1';
  92.   FOURCC_DXT2 = 'DXT2';
  93.   FOURCC_DXT3 = 'DXT3';
  94.   FOURCC_DXT4 = 'DXT4';
  95.   FOURCC_DXT5 = 'DXT5';
  96.  
  97. (*
  98.  * GUIDS used by DirectDraw objects
  99.  *)
  100. const
  101.   CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
  102.   CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';
  103.   CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';
  104.  
  105. const
  106.   DD_ROP_SPACE = (256 div 32);       // space required to store ROP array
  107.  
  108.   MAX_DDDEVICEID_STRING = 512;
  109.  
  110. (*
  111.  * Flags for the IDirectDraw4::GetDeviceIdentifier method
  112.  *)
  113.  
  114. (*
  115.  * This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped
  116.  * with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the
  117.  * host adapter, but is typically physcially located on a separate card. The stacked secondary's information is
  118.  * returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities
  119.  * of the DirectDraw object involved.
  120.  *)
  121.   DDGDI_GETHOSTIDENTIFIER         = $00000001;
  122.  
  123. (*============================================================================
  124.  *
  125.  * DirectDraw Structures
  126.  *
  127.  * Various structures used to invoke DirectDraw.
  128.  *
  129.  *==========================================================================*)
  130.  
  131. var
  132.   NilGUID : TGUID{$IfNDef VER6UP} absolute 0{$EndIf};
  133.  
  134. type
  135.   TRefGUID = packed record
  136.     case integer of
  137.     1: (guid : PGUID);
  138.     2: (dwFlags : DWORD);
  139.   end;
  140.  
  141.   IDirectDraw = interface;
  142.   IDirectDraw2 = interface;
  143.   IDirectDraw4 = interface;
  144.   IDirectDraw7 = interface;
  145.   IDirectDrawSurface = interface;
  146.   IDirectDrawSurface2 = interface;
  147.   IDirectDrawSurface3 = interface;
  148.   IDirectDrawSurface4 = interface;
  149.   IDirectDrawSurface7 = interface;
  150.  
  151.   IDirectDrawPalette = interface;
  152.   IDirectDrawClipper = interface;
  153.   IDirectDrawColorControl = interface;
  154.   IDirectDrawGammaControl = interface;
  155.  
  156. (*
  157.  * Generic pixel format with 8-bit RGB and alpha components
  158.  *)
  159.   PDDARGB = ^TDDARGB;
  160.   TDDARGB = packed record
  161.     blue:     BYTE;
  162.     green:    BYTE;
  163.     red:      BYTE;
  164.     alpha:    BYTE;
  165.   end;
  166.  
  167. (*
  168.  * This version of the structure remains for backwards source compatibility.
  169.  * The DDARGB structure is the one that should be used for all DirectDraw APIs.
  170.  *)
  171.   PDDRGBA = ^TDDRGBA;
  172.   TDDRGBA = packed record
  173.     red   : BYTE;
  174.     green : BYTE;
  175.     blue  : BYTE;
  176.     alpha : BYTE;
  177.   end;
  178.  
  179. (*
  180.  * TDDColorKey
  181.  *)
  182.   PDDColorKey = ^TDDColorKey;
  183.   TDDColorKey = packed 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. // Delphi 5 can't handle interface in variant records
  191. // so we have to use pointers instead (which can be type-casted into interfaces):
  192.  
  193. {$IFDEF VER5UP}
  194.   PDirectDrawSurface = Pointer;              
  195. {$ELSE}
  196.   PDirectDrawSurface = IDirectDrawSurface;
  197. {$ENDIF}
  198.  
  199. (*
  200.  * TDDBltFX
  201.  * Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
  202.  *)
  203.   PDDBltFX = ^TDDBltFX;
  204.   TDDBltFX = packed record
  205.     dwSize                        : DWORD;     // size of structure
  206.     dwDDFX                        : DWORD;     // FX operations
  207.     dwROP                         : DWORD;     // Win32 raster operations
  208.     dwDDROP                       : DWORD;     // Raster operations new for DirectDraw
  209.     dwRotationAngle               : DWORD;     // Rotation angle for blt
  210.     dwZBufferOpCode               : DWORD;     // ZBuffer compares
  211.     dwZBufferLow                  : DWORD;     // Low limit of Z buffer
  212.     dwZBufferHigh                 : DWORD;     // High limit of Z buffer
  213.     dwZBufferBaseDest             : DWORD;     // Destination base value
  214.     dwZDestConstBitDepth          : DWORD;     // Bit depth used to specify Z constant for destination
  215.     case integer of
  216.     0: (
  217.       dwZDestConst                : DWORD      // Constant to use as Z buffer for dest
  218.      );
  219.     1: (
  220.       lpDDSZBufferDest            : PDirectDrawSurface; // Surface to use as Z buffer for dest
  221.       dwZSrcConstBitDepth         : DWORD;     // Bit depth used to specify Z constant for source
  222.       case integer of
  223.       0: (
  224.         dwZSrcConst               : DWORD;     // Constant to use as Z buffer for src
  225.        );
  226.       1: (
  227.         lpDDSZBufferSrc           : PDirectDrawSurface; // Surface to use as Z buffer for src
  228.         dwAlphaEdgeBlendBitDepth  : DWORD;     // Bit depth used to specify constant for alpha edge blend
  229.         dwAlphaEdgeBlend          : DWORD;     // Alpha for edge blending
  230.         dwReserved                : DWORD;
  231.         dwAlphaDestConstBitDepth  : DWORD;     // Bit depth used to specify alpha constant for destination
  232.         case integer of
  233.         0: (
  234.           dwAlphaDestConst        : DWORD;     // Constant to use as Alpha Channel
  235.          );
  236.         1: (
  237.           lpDDSAlphaDest          : PDirectDrawSurface; // Surface to use as Alpha Channel
  238.           dwAlphaSrcConstBitDepth : DWORD;     // Bit depth used to specify alpha constant for source
  239.           case integer of
  240.           0: (
  241.             dwAlphaSrcConst       : DWORD;     // Constant to use as Alpha Channel
  242.           );
  243.           1: (
  244.             lpDDSAlphaSrc         : PDirectDrawSurface; // Surface to use as Alpha Channel
  245.             case integer of
  246.             0: (
  247.               dwFillColor         : DWORD;     // color in RGB or Palettized
  248.             );
  249.             1: (
  250.               dwFillDepth         : DWORD;     // depth value for z-buffer
  251.             );
  252.             2: (
  253.               dwFillPixel         : DWORD;     // pixel value
  254.             );
  255.             3: (
  256.               lpDDSPattern        : PDirectDrawSurface; // Surface to use as pattern
  257.               ddckDestColorkey    : TDDColorKey; // DestColorkey override
  258.               ddckSrcColorkey     : TDDColorKey; // SrcColorkey override
  259.             )
  260.         )
  261.       )
  262.     )
  263.   )
  264.   end;
  265.  
  266. (*
  267.  * TDDSCaps
  268.  *)
  269.   PDDSCaps = ^TDDSCaps;
  270.   TDDSCaps = packed record
  271.     dwCaps: DWORD;         // capabilities of surface wanted
  272.   end;
  273.  
  274. (*
  275.  * TDDOSCaps
  276.  *)
  277.   PDDOSCaps = ^TDDOSCaps;
  278.   TDDOSCaps = packed record
  279.     dwCaps: DWORD;         // capabilities of surface wanted
  280.   end;
  281.  
  282. (*
  283.  * This structure is used internally by DirectDraw.
  284.  *)
  285.   PDDSCapsEx = ^TDDSCapsEx;
  286.   TDDSCapsEx = packed record
  287.     dwCaps2 : DWORD;
  288.     dwCaps3 : DWORD;
  289.     dwCaps4 : DWORD;
  290.   end;
  291.  
  292. (*
  293.  * TDDSCaps2
  294.  *)
  295.   PDDSCaps2 = ^TDDSCaps2;
  296.   TDDSCaps2 = packed record
  297.     dwCaps: DWORD;         // capabilities of surface wanted
  298.     dwCaps2 : DWORD;
  299.     dwCaps3 : DWORD;
  300.     dwCaps4 : DWORD;
  301.   end;
  302.  
  303. (*
  304.  * TDDCaps
  305.  *)
  306. (*
  307.  * This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X.
  308.  * It is present for back compatability.
  309.  *)
  310.   PDDCaps_DX3 = ^TDDCaps_DX3;
  311.   TDDCaps_DX3 = packed record
  312.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  313.     dwCaps: DWORD;                 // driver specific capabilities
  314.     dwCaps2: DWORD;                // more driver specific capabilites
  315.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  316.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  317.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  318.     dwPalCaps: DWORD;              // palette capabilities
  319.     dwSVCaps: DWORD;               // stereo vision capabilities
  320.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  321.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  322.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  323.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  324.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  325.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  326.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  327.     dwVidMemTotal: DWORD;          // total amount of video memory
  328.     dwVidMemFree: DWORD;           // amount of free video memory
  329.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  330.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  331.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  332.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  333.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  334.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  335.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  336.     dwAlignStrideAlign: DWORD;     // stride alignment
  337.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  338.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  339.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  340.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  341.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  342.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  343.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  344.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  345.     dwReserved1: DWORD;            // reserved
  346.     dwReserved2: DWORD;            // reserved
  347.     dwReserved3: DWORD;            // reserved
  348.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  349.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  350.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  351.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  352.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  353.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  354.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  355.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  356.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  357.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  358.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  359.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  360.     dwReserved4 : DWORD;
  361.     dwReserved5 : DWORD;
  362.     dwReserved6 : DWORD;
  363.   end;
  364.  
  365. (*
  366.  * This structure is the TDDCaps structure as it was in version 5 of Direct X.
  367.  * It is present for back compatability.
  368.  *)
  369.   PDDCaps_DX5 = ^TDDCaps_DX5;
  370.   TDDCaps_DX5 = packed record
  371.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  372.     dwCaps: DWORD;                 // driver specific capabilities
  373.     dwCaps2: DWORD;                // more driver specific capabilites
  374.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  375.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  376.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  377.     dwPalCaps: DWORD;              // palette capabilities
  378.     dwSVCaps: DWORD;               // stereo vision capabilities
  379.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  380.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  381.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  382.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  383.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  384.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  385.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  386.     dwVidMemTotal: DWORD;          // total amount of video memory
  387.     dwVidMemFree: DWORD;           // amount of free video memory
  388.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  389.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  390.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  391.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  392.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  393.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  394.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  395.     dwAlignStrideAlign: DWORD;     // stride alignment
  396.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  397.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  398.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  399.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  400.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  401.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  402.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  403.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  404.     dwReserved1: DWORD;            // reserved
  405.     dwReserved2: DWORD;            // reserved
  406.     dwReserved3: DWORD;            // reserved
  407.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  408.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  409.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  410.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  411.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  412.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  413.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  414.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  415.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  416.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  417.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  418.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  419.     // Members added for DX5:
  420.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  421.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  422.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  423.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  424.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  425.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  426.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  427.     dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  428.   end;
  429.  
  430.   PDDCaps_DX6 = ^TDDCaps_DX6;
  431.   TDDCaps_DX6 = packed record
  432.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  433.     dwCaps: DWORD;                 // driver specific capabilities
  434.     dwCaps2: DWORD;                // more driver specific capabilites
  435.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  436.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  437.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  438.     dwPalCaps: DWORD;              // palette capabilities
  439.     dwSVCaps: DWORD;               // stereo vision capabilities
  440.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  441.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  442.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  443.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  444.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  445.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  446.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  447.     dwVidMemTotal: DWORD;          // total amount of video memory
  448.     dwVidMemFree: DWORD;           // amount of free video memory
  449.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  450.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  451.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  452.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  453.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  454.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  455.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  456.     dwAlignStrideAlign: DWORD;     // stride alignment
  457.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  458.     ddsOldCaps: TDDSCaps;          // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6
  459.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  460.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  461.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  462.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  463.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  464.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  465.     dwReserved1: DWORD;            // reserved
  466.     dwReserved2: DWORD;            // reserved
  467.     dwReserved3: DWORD;            // reserved
  468.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  469.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  470.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  471.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  472.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  473.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  474.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  475.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  476.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  477.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  478.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  479.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  480.     // Members added for DX5:
  481.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  482.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  483.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  484.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  485.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  486.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  487.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  488.     dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  489.     // Members added for DX6 release
  490.     ddsCaps : TDDSCaps2 ;          // Surface Caps
  491.   end;
  492.  
  493.   TDDCaps_DX7 = TDDCaps_DX6;
  494.  
  495.   PDDCaps = ^TDDCaps;
  496.  
  497. {$IFDEF DIRECTX3}
  498.   TDDCaps = TDDCaps_DX3;
  499. {$ELSE}
  500.   {$IFDEF DIRECTX5}
  501.     TDDCaps = TDDCaps_DX5;
  502.   {$ELSE}
  503.     {$IFDEF DIRECTX6}
  504.       TDDCaps = TDDCaps_DX6;
  505.     {$ELSE}
  506.       TDDCaps = TDDCaps_DX7;
  507.     {$ENDIF}
  508.   {$ENDIF}
  509. {$ENDIF}
  510.  
  511.  
  512.  
  513.  
  514. (*
  515.  * TDDPixelFormat
  516.  *)
  517.   PDDPixelFormat_DX5 = ^TDDPixelFormat_DX5;
  518.   TDDPixelFormat_DX5 = packed record
  519.     dwSize: DWORD;                 // size of structure
  520.     dwFlags: DWORD;                // pixel format flags
  521.     dwFourCC: DWORD;               // (FOURCC code)
  522.     case Integer of
  523.     0: (
  524.       dwZBufferBitDepth: DWORD;      // how many bits for z buffers
  525.      );
  526.     1: (
  527.       dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
  528.      );
  529.     2: (
  530.       dwRGBBitCount: DWORD;          // how many bits per pixel
  531.       dwRBitMask: DWORD;             // mask for red bit
  532.       dwGBitMask: DWORD;             // mask for green bits
  533.       dwBBitMask: DWORD;             // mask for blue bits
  534.       dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
  535.      );
  536.     3: (
  537.       dwYUVBitCount: DWORD;          // how many bits per pixel
  538.       dwYBitMask: DWORD;             // mask for Y bits
  539.       dwUBitMask: DWORD;             // mask for U bits
  540.       dwVBitMask: DWORD;             // mask for V bits
  541.       case Integer of
  542.       0: (
  543.         dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
  544.        );
  545.       1: (
  546.         dwRGBZBitMask: DWORD;
  547.        );
  548.       2: (
  549.         dwYUVZBitMask: DWORD;
  550.        );
  551.      );
  552.   end;
  553.  
  554.   PDDPixelFormat_DX6 = ^TDDPixelFormat_DX6;
  555.   TDDPixelFormat_DX6 = packed record
  556.     dwSize: DWORD;                 // size of structure
  557.     dwFlags: DWORD;                // pixel format flags
  558.     dwFourCC: DWORD;               // (FOURCC code)
  559.     case Integer of
  560.       1: (
  561.           dwRGBBitCount : DWORD;  // how many bits per pixel
  562.           dwRBitMask : DWORD;  // mask for red bit
  563.           dwGBitMask : DWORD;  // mask for green bits
  564.           dwBBitMask : DWORD;  // mask for blue bits
  565.           dwRGBAlphaBitMask : DWORD; // mask for alpha channel
  566.           );
  567.       2: (
  568.           dwYUVBitCount : DWORD;  // how many bits per pixel
  569.           dwYBitMask : DWORD;  // mask for Y bits
  570.           dwUBitMask : DWORD;  // mask for U bits
  571.           dwVBitMask : DWORD;  // mask for V bits
  572.           dwYUVAlphaBitMask : DWORD; // mask for alpha channel
  573.           );
  574.       3: (
  575.           dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits)
  576.           dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
  577.           dwZBitMask : DWORD;  // mask for Z bits
  578.           dwStencilBitMask : DWORD; // mask for stencil bits
  579.           dwLuminanceAlphaBitMask : DWORD;// mask for alpha channel
  580.           );
  581.       4: (
  582.           dwAlphaBitDepth : DWORD; // how many bits for alpha channels
  583.           dwLuminanceBitMask : DWORD; // mask for luminance bits
  584.           dwBumpDvBitMask : DWORD;        // mask for bump map V delta bits
  585.           dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map
  586.           dwRGBZBitMask : DWORD;  // mask for Z channel
  587.           );
  588.       5: (
  589.            dwLuminanceBitCount : DWORD; // how many bits per pixel
  590.            dwBumpDuBitMask : DWORD;       // mask for bump map U delta bits
  591.            Fill1, Fill2    : DWORD;
  592.            dwYUVZBitMask   : DWORD;  // mask for Z channel
  593.          );
  594.       6: ( dwBumpBitCount  : DWORD;         // how many bits per "buxel", total
  595.          );
  596.   end;
  597.  
  598.   TDDPixelFormat_DX3 = TDDPixelFormat_DX5;
  599.   TDDPixelFormat_DX7 = TDDPixelFormat_DX6;
  600.  
  601.   PDDPixelFormat = ^TDDPixelFormat;
  602. {$IFDEF DIRECTX3}
  603.   TDDPixelFormat = TDDPixelFormat_DX3;
  604. {$ELSE}
  605.   {$IFDEF DIRECTX5}
  606.     TDDPixelFormat = TDDPixelFormat_DX5;
  607.   {$ELSE}
  608.     {$IFDEF DIRECTX6}
  609.       TDDPixelFormat = TDDPixelFormat_DX6;
  610.     {$ELSE}
  611.       TDDPixelFormat = TDDPixelFormat_DX7;
  612.     {$ENDIF}
  613.   {$ENDIF}
  614. {$ENDIF}
  615.  
  616. (*
  617.  * TDDOverlayFX
  618.  *)
  619.   PDDOverlayFX = ^TDDOverlayFX;
  620.   TDDOverlayFX = packed record
  621.     dwSize: DWORD;                         // size of structure
  622.     dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  623.     dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
  624.     dwReserved: DWORD;
  625.     dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  626.     case Integer of
  627.     0: (
  628.       dwAlphaDestConst: DWORD;               // Constant to use as alpha channel for dest
  629.       dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
  630.       dwAlphaSrcConst: DWORD;                // Constant to use as alpha channel for src
  631.       dckDestColorkey: TDDColorKey;                // DestColorkey override
  632.       dckSrcColorkey: TDDColorKey;                 // DestColorkey override
  633.       dwDDFX: DWORD;                         // Overlay FX
  634.       dwFlags: DWORD;                        // flags
  635.      );
  636.     1: (
  637.       lpDDSAlphaDest: PDirectDrawSurface;     // Surface to use as alpha channel for dest
  638.       filler: DWORD;
  639.       lpDDSAlphaSrc: PDirectDrawSurface;      // Surface to use as alpha channel for src
  640.      );
  641.   end;
  642.  
  643. (*
  644.  * TDDBltBatch: BltBatch entry structure
  645.  *)
  646.   PDDBltBatch = ^TDDBltBatch;
  647.   TDDBltBatch = packed record
  648.     lprDest: PRect;
  649.     lpDDSSrc: IDirectDrawSurface;
  650.     lprSrc: PRect;
  651.     dwFlags: DWORD;
  652.     lpDDBltFx: TDDBltFX;
  653.   end;
  654.  
  655. (*
  656.  * TDDGammaRamp
  657.  *)
  658.   PDDGammaRamp = ^TDDGammaRamp;
  659.   TDDGammaRamp = packed record
  660.     red   : array[0..255] of WORD;
  661.     green : array[0..255] of WORD;
  662.     blue  : array[0..255] of WORD;
  663.   end;
  664.  
  665. (*
  666.  *  This is the structure within which DirectDraw returns data about the current graphics driver and chipset
  667.  *)
  668.  
  669.   PDDDeviceIdentifier = ^TDDDeviceIdentifier;
  670.   TDDDeviceIdentifier = packed record
  671.     //
  672.     // These elements are for presentation to the user only. They should not be used to identify particular
  673.     // drivers, since this is unreliable and many different strings may be associated with the same
  674.     // device, and the same driver from different vendors.
  675.     //
  676.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  677.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  678.  
  679.     //
  680.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  681.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  682.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  683.     //
  684.     // This version has the form:
  685.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  686.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  687.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  688.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  689.     //
  690.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  691.  
  692.     //
  693.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  694.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  695.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  696.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  697.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  698.     //
  699.     dwVendorId: DWORD;
  700.     dwDeviceId: DWORD;
  701.     dwSubSysId: DWORD;
  702.     dwRevision: DWORD;
  703.  
  704.     //
  705.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  706.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  707.     // reprofile the graphics subsystem.
  708.     // This element can also be used to identify particular problematic drivers.
  709.     //
  710.     guidDeviceIdentifier: TGUID;
  711.   end;
  712.  
  713.   PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;
  714.   TDDDeviceIdentifier2 = packed record
  715.     //
  716.     // These elements are for presentation to the user only. They should not be used to identify particular
  717.     // drivers, since this is unreliable and many different strings may be associated with the same
  718.     // device, and the same driver from different vendors.
  719.     //
  720.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  721.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  722.  
  723.     //
  724.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  725.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  726.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  727.     //
  728.     // This version has the form:
  729.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  730.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  731.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  732.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  733.     //
  734.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  735.  
  736.     //
  737.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  738.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  739.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  740.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  741.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  742.     //
  743.     dwVendorId: DWORD;
  744.     dwDeviceId: DWORD;
  745.     dwSubSysId: DWORD;
  746.     dwRevision: DWORD;
  747.  
  748.     //
  749.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  750.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  751.     // reprofile the graphics subsystem.
  752.     // This element can also be used to identify particular problematic drivers.
  753.     //
  754.     guidDeviceIdentifier: TGUID;
  755.  
  756.     (*
  757.      * This element is used to determine the Windows Hardware Quality Lab (WHQL)
  758.      * certification level for this driver/device pair.
  759.      *)
  760.     dwWHQLLevel: DWORD;
  761.   end;
  762.  
  763. (*
  764.  * callbacks
  765.  *)
  766.   TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;
  767.       Code: DWORD; lpContext: Pointer): HResult; stdcall;
  768.   TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
  769.  
  770. (*
  771.  * TDDSurfaceDesc
  772.  *)
  773.   PDDSurfaceDesc_DX5 = ^TDDSurfaceDesc_DX5;
  774.   TDDSurfaceDesc_DX5 = packed record
  775.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  776.     dwFlags: DWORD;                // determines what fields are valid
  777.     dwHeight: DWORD;               // height of surface to be created
  778.     dwWidth: DWORD;                // width of input surface
  779.     case Integer of
  780.     0: (
  781.       dwLinearSize : DWORD;       // unused at the moment
  782.      );
  783.     1: (
  784.       lPitch: LongInt;                 // distance to start of next line (return value only)
  785.       dwBackBufferCount: DWORD;      // number of back buffers requested
  786.       case Integer of
  787.       0: (
  788.         dwMipMapCount: DWORD;          // number of mip-map levels requested
  789.         dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  790.         dwReserved: DWORD;             // reserved
  791.         lpSurface: Pointer;              // pointer to the associated surface memory
  792.         ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
  793.         ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
  794.         ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
  795.         ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
  796.         ddpfPixelFormat: TDDPixelFormat_DX5; // pixel format description of the surface
  797.         ddsCaps: TDDSCaps;                // direct draw surface capabilities
  798.        );
  799.       1: (
  800.         dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  801.        );
  802.       2: (
  803.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  804.        );
  805.      );
  806.   end;
  807.  
  808.   PDDSurfaceDesc_DX6 = ^TDDSurfaceDesc_DX6;
  809.   TDDSurfaceDesc_DX6 = packed record
  810.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  811.     dwFlags: DWORD;                // determines what fields are valid
  812.     dwHeight: DWORD;               // height of surface to be created
  813.     dwWidth: DWORD;                // width of input surface
  814.     case Integer of
  815.     0: (
  816.       dwLinearSize : DWORD;       // unused at the moment
  817.      );
  818.     1: (
  819.       lPitch: LongInt;                 // distance to start of next line (return value only)
  820.       dwBackBufferCount: DWORD;      // number of back buffers requested
  821.       case Integer of
  822.       0: (
  823.         dwMipMapCount: DWORD;          // number of mip-map levels requested
  824.         dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  825.         dwReserved: DWORD;             // reserved
  826.         lpSurface: Pointer;              // pointer to the associated surface memory
  827.         ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
  828.         ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
  829.         ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
  830.         ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
  831.         ddpfPixelFormat: TDDPixelFormat_DX6; // pixel format description of the surface
  832.         ddsCaps: TDDSCaps;                // direct draw surface capabilities
  833.        );
  834.       1: (
  835.         dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  836.        );
  837.       2: (
  838.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  839.        );
  840.      );
  841.   end;
  842.  
  843.   PDDSurfaceDesc = ^TDDSurfaceDesc;
  844. {$IFDEF DIRECTX5}
  845.   TDDSurfaceDesc = TDDSurfaceDesc_DX5;
  846. {$ELSE}
  847.   TDDSurfaceDesc = TDDSurfaceDesc_DX6;
  848. {$ENDIF}
  849.  
  850.  
  851. (*
  852.  * TDDSurfaceDesc2
  853.  *)
  854.   PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
  855.   TDDSurfaceDesc2 = packed record
  856.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  857.     dwFlags: DWORD;                // determines what fields are valid
  858.     dwHeight: DWORD;               // height of surface to be created
  859.     dwWidth: DWORD;                // width of input surface
  860.     case Integer of
  861.     0: (
  862.       lPitch : LongInt;                  // distance to start of next line (return value only)
  863.      );
  864.     1: (
  865.       dwLinearSize : DWORD;              // Formless late-allocated optimized surface size
  866.       dwBackBufferCount: DWORD;          // number of back buffers requested
  867.       case Integer of
  868.       0: (
  869.         dwMipMapCount: DWORD;            // number of mip-map levels requested
  870.         dwAlphaBitDepth: DWORD;          // depth of alpha buffer requested
  871.         dwReserved: DWORD;               // reserved
  872.         lpSurface: Pointer;              // pointer to the associated surface memory
  873.         ddckCKDestOverlay: TDDColorKey;  // color key for destination overlay use
  874.         ddckCKDestBlt: TDDColorKey;      // color key for destination blt use
  875.         ddckCKSrcOverlay: TDDColorKey;   // color key for source overlay use
  876.         ddckCKSrcBlt: TDDColorKey;       // color key for source blt use
  877.         ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface
  878.         ddsCaps: TDDSCaps2;              // direct draw surface capabilities
  879.         dwTextureStage: DWORD;           // stage in multitexture cascade
  880.        );
  881.       1: (
  882.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  883.        );
  884.      );
  885.   end;
  886.  
  887. (*
  888.  * TDDOptSurfaceDesc
  889.  *)
  890.  
  891.   PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
  892.   TDDOptSurfaceDesc = packed record
  893.     dwSize : DWORD;             // size of the DDOPTSURFACEDESC structure
  894.     dwFlags : DWORD;            // determines what fields are valid
  895.     ddSCaps : TDDSCaps2;        // Common caps like: Memory type
  896.     ddOSCaps : TDDOSCaps;       // Common caps like: Memory type
  897.     guid : TGUID;               // Compression technique GUID
  898.     dwCompressionRatio : DWORD; // Compression ratio
  899.   end;
  900.  
  901. (*
  902.  * DDCOLORCONTROL
  903.  *)
  904.   PDDColorControl = ^TDDColorControl;
  905.   TDDColorControl = packed record
  906.     dwSize: DWORD;
  907.     dwFlags: DWORD;
  908.     lBrightness: LongInt;
  909.     lContrast: LongInt;
  910.     lHue: LongInt;
  911.     lSaturation: LongInt;
  912.     lSharpness: LongInt;
  913.     lGamma: LongInt;
  914.     lColorEnable: LongInt;
  915.     dwReserved1: DWORD;
  916.   end;
  917.  
  918. (*
  919.  * callbacks
  920.  *)
  921.  
  922. {$IFNDEF WINNT}
  923.   TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc;
  924.       lpContext: Pointer) : HResult; stdcall;
  925.   TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  926.       lpContext: Pointer) : HResult; stdcall;
  927.   TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface;
  928.       const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer) : HResult; stdcall;
  929.   TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4;
  930.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
  931.   TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7;
  932.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
  933. {$ENDIF}
  934.  
  935. (*
  936.  * INTERACES FOLLOW:
  937.  *      IDirectDraw
  938.  *      IDirectDrawClipper
  939.  *      IDirectDrawPalette
  940.  *      IDirectDrawSurface
  941.  *)
  942.  
  943. (*
  944.  * IDirectDraw
  945.  *)
  946.  
  947.   IDirectDraw = interface (IUnknown)
  948.     ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
  949.     (*** IDirectDraw methods ***)
  950.     function Compact: HResult; stdcall;
  951.     function CreateClipper (dwFlags: DWORD;
  952.         out lplpDDClipper: IDirectDrawClipper;
  953.         pUnkOuter: IUnknown) : HResult; stdcall;
  954.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  955.         out lplpDDPalette: IDirectDrawPalette;
  956.         pUnkOuter: IUnknown) : HResult; stdcall;
  957.     function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
  958.         out lplpDDSurface: IDirectDrawSurface;
  959.         pUnkOuter: IUnknown) : HResult; stdcall;
  960.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
  961.         out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
  962.     function EnumDisplayModes (dwFlags: DWORD;
  963.         lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
  964.         lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
  965.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
  966.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
  967.         HResult; stdcall;
  968.     function FlipToGDISurface: HResult; stdcall;
  969.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  970.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  971.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  972.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) :
  973.         HResult; stdcall;
  974.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  975.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  976.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  977.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  978.     function RestoreDisplayMode: HResult; stdcall;
  979.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  980.     (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  981.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD;
  982.         dwBpp: DWORD) : HResult; stdcall;
  983.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  984.         HResult; stdcall;
  985.   end;
  986.  
  987.   IDirectDraw2 = interface (IUnknown)
  988.     ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
  989.     (*** IDirectDraw methods ***)
  990.     function Compact: HResult; stdcall;
  991.     function CreateClipper (dwFlags: DWORD;
  992.         out lplpDDClipper: IDirectDrawClipper;
  993.         pUnkOuter: IUnknown) : HResult; stdcall;
  994.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  995.         out lplpDDPalette: IDirectDrawPalette;
  996.         pUnkOuter: IUnknown) : HResult; stdcall;
  997.     function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
  998.         out lplpDDSurface: IDirectDrawSurface;
  999.         pUnkOuter: IUnknown) : HResult; stdcall;
  1000.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
  1001.         out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
  1002.     function EnumDisplayModes (dwFlags: DWORD;
  1003.         lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
  1004.         lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
  1005.     function EnumSurfaces (dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc;
  1006.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
  1007.         HResult; stdcall;
  1008.     function FlipToGDISurface: HResult; stdcall;
  1009.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1010.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1011.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1012.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) : HResult; stdcall;
  1013.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1014.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1015.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1016.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1017.     function RestoreDisplayMode: HResult; stdcall;
  1018.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1019. (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  1020.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1021.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1022.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1023.         HResult; stdcall;
  1024.     (*** Added in the v2 interface ***)
  1025.     function GetAvailableVidMem (var lpDDSCaps: TDDSCaps;
  1026.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1027.   end;
  1028.  
  1029.   IDirectDraw4 = interface (IUnknown)
  1030.     ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}']
  1031.     (*** IDirectDraw methods ***)
  1032.     function Compact: HResult; stdcall;
  1033.     function CreateClipper (dwFlags: DWORD;
  1034.         out lplpDDClipper: IDirectDrawClipper;
  1035.         pUnkOuter: IUnknown) : HResult; stdcall;
  1036.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  1037.         out lplpDDPalette: IDirectDrawPalette;
  1038.         pUnkOuter: IUnknown) : HResult; stdcall;
  1039.     function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1040.         out lplpDDSurface: IDirectDrawSurface4;
  1041.         pUnkOuter: IUnknown) : HResult; stdcall;
  1042.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface4;
  1043.         out lplpDupDDSurface: IDirectDrawSurface4) : HResult; stdcall;
  1044.     function EnumDisplayModes (dwFlags: DWORD;
  1045.         lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
  1046.         lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
  1047.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1048.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2) :
  1049.         HResult; stdcall;
  1050.     function FlipToGDISurface: HResult; stdcall;
  1051.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1052.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1053.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1054.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface4) :
  1055.         HResult; stdcall;
  1056.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1057.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1058.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1059.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1060.     function RestoreDisplayMode: HResult; stdcall;
  1061.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1062. (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  1063.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1064.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1065.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1066.         HResult; stdcall;
  1067.     (*** Added in the v2 interface ***)
  1068.     function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
  1069.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1070.     (*** Added in the V4 Interface ***)
  1071.     function GetSurfaceFromDC (hdc : Windows.HDC;
  1072.         out lpDDS4: IDirectDrawSurface4) : HResult; stdcall;
  1073.     function RestoreAllSurfaces : HResult; stdcall;
  1074.     function TestCooperativeLevel : HResult; stdcall;
  1075.     function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier;
  1076.         dwFlags: DWORD) : HResult; stdcall;
  1077.   end;
  1078.  
  1079.   IDirectDraw7 = interface (IUnknown)
  1080.     ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}']
  1081.     (*** IDirectDraw methods ***)
  1082.     function Compact: HResult; stdcall;
  1083.     function CreateClipper (dwFlags: DWORD;
  1084.         out lplpDDClipper: IDirectDrawClipper;
  1085.         pUnkOuter: IUnknown) : HResult; stdcall;
  1086.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  1087.         out lplpDDPalette: IDirectDrawPalette;
  1088.         pUnkOuter: IUnknown) : HResult; stdcall;
  1089.     function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1090.         out lplpDDSurface: IDirectDrawSurface7;
  1091.         pUnkOuter: IUnknown) : HResult; stdcall;
  1092.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface7;
  1093.         out lplpDupDDSurface: IDirectDrawSurface7) : HResult; stdcall;
  1094.     function EnumDisplayModes (dwFlags: DWORD;
  1095.         lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
  1096.         lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
  1097.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1098.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) :
  1099.         HResult; stdcall;
  1100.     function FlipToGDISurface: HResult; stdcall;
  1101.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1102.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1103.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1104.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface7) :
  1105.         HResult; stdcall;
  1106.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1107.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1108.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1109.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1110.     function RestoreDisplayMode: HResult; stdcall;
  1111.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1112.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1113.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1114.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1115.         HResult; stdcall;
  1116.     (*** Added in the v2 interface ***)
  1117.     function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
  1118.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1119.     (*** Added in the V4 Interface ***)
  1120.     function GetSurfaceFromDC (hdc : Windows.HDC;
  1121.         out lpDDS: IDirectDrawSurface7) : HResult; stdcall;
  1122.     function RestoreAllSurfaces : HResult; stdcall;
  1123.     function TestCooperativeLevel : HResult; stdcall;
  1124.     function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier2;
  1125.         dwFlags: DWORD) : HResult; stdcall;
  1126.     function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD) : HResult; stdcall;
  1127.     function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD) : HResult; stdcall;
  1128.   end;
  1129.  
  1130.  
  1131.  
  1132. (*
  1133.  * IDirectDrawPalette
  1134.  *)
  1135.  
  1136.   IDirectDrawPalette = interface (IUnknown)
  1137.     ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
  1138.     (*** IDirectDrawPalette methods ***)
  1139.     function GetCaps (out lpdwCaps: DWORD) : HResult; stdcall;
  1140.     function GetEntries (dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;
  1141.         lpEntries: pointer) : HResult; stdcall;
  1142.     function Initialize (lpDD: IDirectDraw; dwFlags: DWORD;
  1143.         lpDDColorTable: pointer) : HResult; stdcall;
  1144.     function SetEntries (dwFlags: DWORD; dwStartingEntry: DWORD;
  1145.         dwCount: DWORD; lpEntries: pointer) : HResult; stdcall;
  1146.   end;
  1147.  
  1148. (*
  1149.  * IDirectDrawClipper
  1150.  *)
  1151.  
  1152.   IDirectDrawClipper = interface (IUnknown)
  1153.     ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
  1154.     (*** IDirectDrawClipper methods ***)
  1155.     function GetClipList (lpRect: PRect; lpClipList: PRgnData;
  1156.         var lpdwSize: DWORD) : HResult; stdcall;
  1157.     function GetHWnd (out lphWnd: HWND) : HResult; stdcall;
  1158.     function Initialize (lpDD: IDirectDraw; dwFlags: DWORD) : HResult; stdcall;
  1159.     function IsClipListChanged (out lpbChanged: BOOL) : HResult; stdcall;
  1160.     function SetClipList (lpClipList: PRgnData; dwFlags: DWORD) : HResult; stdcall;
  1161.     function SetHWnd (dwFlags: DWORD; hWnd: HWND) : HResult; stdcall;
  1162.   end;
  1163.  
  1164. (*
  1165.  * IDirectDrawSurface and related interfaces
  1166.  *)
  1167.  
  1168.   IDirectDrawSurface = interface (IUnknown)
  1169.     ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
  1170.     (*** IDirectDrawSurface methods ***)
  1171.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface) :
  1172.         HResult; stdcall;
  1173.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1174.     function Blt (lpDestRect: PRect;
  1175.         lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
  1176.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1177.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1178.         dwFlags: DWORD) : HResult; stdcall;
  1179.     function BltFast (dwX: DWORD; dwY: DWORD;
  1180.         lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
  1181.         dwTrans: DWORD) : HResult; stdcall;
  1182.     function DeleteAttachedSurface (dwFlags: DWORD;
  1183.         lpDDSAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
  1184.     function EnumAttachedSurfaces (lpContext: Pointer;
  1185.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1186.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1187.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1188.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface;
  1189.         dwFlags: DWORD) : HResult; stdcall;
  1190.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1191.         (*out*)var lplpDDAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
  1192.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1193.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1194.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1195.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1196.         HResult; stdcall;
  1197.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1198.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1199.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1200.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1201.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1202.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1203.     function Initialize (lpDD: IDirectDraw;
  1204.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1205.     function IsLost: HResult; stdcall;
  1206.     function Lock (lpDestRect: PRect; out lpDDSurfaceDesc:
  1207.         TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle) : HResult; stdcall;
  1208.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1209.     function _Restore: HResult; stdcall;
  1210.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1211.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1212.         HResult; stdcall;
  1213.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1214.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1215.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1216.     function UpdateOverlay (lpSrcRect: PRect;
  1217.         lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect;
  1218.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1219.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1220.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1221.         lpDDSReference: IDirectDrawSurface) : HResult; stdcall;
  1222.   end;
  1223.  
  1224. (*
  1225.  * IDirectDrawSurface2 and related interfaces
  1226.  *)
  1227.  
  1228.   IDirectDrawSurface2 = interface (IUnknown)
  1229.     ['{57805885-6eec-11cf-9441-a82303c10e27}']
  1230.     (*** IDirectDrawSurface methods ***)
  1231.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface2) :
  1232.         HResult; stdcall;
  1233.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1234.     function Blt (lpDestRect: PRect;
  1235.         lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
  1236.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1237.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1238.         dwFlags: DWORD) : HResult; stdcall;
  1239.     function BltFast (dwX: DWORD; dwY: DWORD;
  1240.         lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
  1241.         dwTrans: DWORD) : HResult; stdcall;
  1242.     function DeleteAttachedSurface (dwFlags: DWORD;
  1243.         lpDDSAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
  1244.     function EnumAttachedSurfaces (lpContext: Pointer;
  1245.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1246.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1247.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1248.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface2;
  1249.         dwFlags: DWORD) : HResult; stdcall;
  1250.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1251.         out lplpDDAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
  1252.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1253.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1254.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1255.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1256.         HResult; stdcall;
  1257.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1258.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1259.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1260.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1261.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1262.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1263.     function Initialize (lpDD: IDirectDraw;
  1264.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1265.     function IsLost: HResult; stdcall;
  1266.     function Lock (lpDestRect: PRect;
  1267.         out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
  1268.         hEvent: THandle) : HResult; stdcall;
  1269.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1270.     function _Restore: HResult; stdcall;
  1271.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1272.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1273.         HResult; stdcall;
  1274.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1275.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1276.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1277.     function UpdateOverlay (lpSrcRect: PRect;
  1278.         lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect;
  1279.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1280.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1281.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1282.         lpDDSReference: IDirectDrawSurface2) : HResult; stdcall;
  1283.     (*** Added in the v2 interface ***)
  1284.     function GetDDInterface (var lplpDD: IDirectDraw) : HResult; stdcall;
  1285.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1286.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1287.   end;
  1288.  
  1289.   IDirectDrawSurface3 = interface (IUnknown)
  1290.     ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']
  1291.     (*** IDirectDrawSurface methods ***)
  1292.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface3) :
  1293.         HResult; stdcall;
  1294.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1295.     function Blt (lpDestRect: PRect;
  1296.         lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
  1297.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1298.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1299.         dwFlags: DWORD) : HResult; stdcall;
  1300.     function BltFast (dwX: DWORD; dwY: DWORD;
  1301.         lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
  1302.         dwTrans: DWORD) : HResult; stdcall;
  1303.     function DeleteAttachedSurface (dwFlags: DWORD;
  1304.         lpDDSAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
  1305.     function EnumAttachedSurfaces (lpContext: Pointer;
  1306.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1307.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1308.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1309.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface3;
  1310.         dwFlags: DWORD) : HResult; stdcall;
  1311.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1312.         out lplpDDAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
  1313.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1314.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1315.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1316.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1317.         HResult; stdcall;
  1318.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1319.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1320.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1321.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1322.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1323.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1324.     function Initialize (lpDD: IDirectDraw;
  1325.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1326.     function IsLost: HResult; stdcall;
  1327.     function Lock (lpDestRect: PRect;
  1328.         out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
  1329.         hEvent: THandle) : HResult; stdcall;
  1330.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1331.     function _Restore: HResult; stdcall;
  1332.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1333.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1334.         HResult; stdcall;
  1335.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1336.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1337.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1338.     function UpdateOverlay (lpSrcRect: PRect;
  1339.         lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect;
  1340.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1341.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1342.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1343.         lpDDSReference: IDirectDrawSurface3) : HResult; stdcall;
  1344.     (*** Added in the v2 interface ***)
  1345.     function GetDDInterface (out lplpDD: IDirectDraw) : HResult; stdcall;
  1346.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1347.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1348.     (*** Added in the V3 interface ***)
  1349.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD) : HResult; stdcall;
  1350.   end;
  1351.  
  1352. (*
  1353.  * IDirectDrawSurface4 and related interfaces
  1354.  *)
  1355.   IDirectDrawSurface4 = interface (IUnknown)
  1356.     ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']
  1357.     (*** IDirectDrawSurface methods ***)
  1358.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface4) :
  1359.         HResult; stdcall;
  1360.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1361.     function Blt (lpDestRect: PRect;
  1362.         lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
  1363.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1364.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1365.         dwFlags: DWORD) : HResult; stdcall;
  1366.     function BltFast (dwX: DWORD; dwY: DWORD;
  1367.         lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
  1368.         dwTrans: DWORD) : HResult; stdcall;
  1369.     function DeleteAttachedSurface (dwFlags: DWORD;
  1370.         lpDDSAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
  1371.     function EnumAttachedSurfaces (lpContext: Pointer;
  1372.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
  1373.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1374.         lpfnCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
  1375.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface4;
  1376.         dwFlags: DWORD) : HResult; stdcall;
  1377.     function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
  1378.         out lplpDDAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
  1379.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1380.     function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
  1381.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1382.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1383.         HResult; stdcall;
  1384.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1385.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1386.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1387.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1388.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1389.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1390.     function Initialize (lpDD: IDirectDraw;
  1391.         out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1392.     function IsLost: HResult; stdcall;
  1393.     function Lock (lpDestRect: PRect;
  1394.         out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
  1395.         hEvent: THandle) : HResult; stdcall;
  1396.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1397.     function _Restore: HResult; stdcall;
  1398.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1399.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1400.         HResult; stdcall;
  1401.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1402.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1403.     function Unlock (lpRect: PRect) : HResult; stdcall;
  1404.     function UpdateOverlay (lpSrcRect: PRect;
  1405.         lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect;
  1406.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1407.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1408.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1409.         lpDDSReference: IDirectDrawSurface4) : HResult; stdcall;
  1410.     (*** Added in the v2 interface ***)
  1411.     function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
  1412.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1413.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1414.     (*** Added in the V3 interface ***)
  1415.     function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
  1416.     (*** Added in the v4 interface ***)
  1417.     function SetPrivateData(const guidTag: TGUID; lpData: pointer;
  1418.         cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1419.     function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
  1420.         var lpcbBufferSize: DWORD) : HResult; stdcall;
  1421.     function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
  1422.     function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
  1423.     function ChangeUniquenessValue : HResult; stdcall;
  1424.   end;
  1425.  
  1426.   IDirectDrawSurface7 = interface (IUnknown)
  1427.     ['{06675a80-3b9b-11d2-b92f-00609797ea5b}']
  1428.     (*** IDirectDrawSurface methods ***)
  1429.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface7) :
  1430.         HResult; stdcall;
  1431.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1432.     function Blt (lpDestRect: PRect;
  1433.         lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
  1434.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1435.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1436.         dwFlags: DWORD) : HResult; stdcall;
  1437.     function BltFast (dwX: DWORD; dwY: DWORD;
  1438.         lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
  1439.         dwTrans: DWORD) : HResult; stdcall;
  1440.     function DeleteAttachedSurface (dwFlags: DWORD;
  1441.         lpDDSAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
  1442.     function EnumAttachedSurfaces (lpContext: Pointer;
  1443.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
  1444.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1445.         lpfnCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
  1446.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface7;
  1447.         dwFlags: DWORD) : HResult; stdcall;
  1448.     function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
  1449.         out lplpDDAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
  1450.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1451.     function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
  1452.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1453.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1454.         HResult; stdcall;
  1455.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1456.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1457.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1458.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1459.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1460.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1461.     function Initialize (lpDD: IDirectDraw;
  1462.         out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1463.     function IsLost: HResult; stdcall;
  1464.     function Lock (lpDestRect: PRect;
  1465.         out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
  1466.         hEvent: THandle) : HResult; stdcall;
  1467.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1468.     function _Restore: HResult; stdcall;
  1469.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1470.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1471.         HResult; stdcall;
  1472.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1473.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1474.     function Unlock (lpRect: PRect) : HResult; stdcall;
  1475.     function UpdateOverlay (lpSrcRect: PRect;
  1476.         lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect;
  1477.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1478.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1479.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1480.         lpDDSReference: IDirectDrawSurface7) : HResult; stdcall;
  1481.     (*** Added in the v2 interface ***)
  1482.     function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
  1483.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1484.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1485.     (*** Added in the V3 interface ***)
  1486.     function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
  1487.     (*** Added in the v4 interface ***)
  1488.     function SetPrivateData(const guidTag: TGUID; lpData: pointer;
  1489.         cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1490.     function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
  1491.         var lpcbBufferSize: DWORD) : HResult; stdcall;
  1492.     function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
  1493.     function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
  1494.     function ChangeUniquenessValue : HResult; stdcall;
  1495.     (*** Moved Texture7 methods here ***)
  1496.     function SetPriority(dwPriority: DWORD) : HResult; stdcall;
  1497.     function GetPriority(out lpdwPriority: DWORD) : HResult; stdcall;
  1498.     function SetLOD(dwMaxLOD: DWORD) : HResult; stdcall;
  1499.     function GetLOD(out lpdwMaxLOD: DWORD) : HResult; stdcall;
  1500.   end;
  1501.  
  1502.   IDirectDrawColorControl = interface (IUnknown)
  1503.     ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
  1504.     function GetColorControls(out lpColorControl: TDDColorControl) : HResult; stdcall;
  1505.     function SetColorControls(const lpColorControl: TDDColorControl) : HResult; stdcall;
  1506.   end;
  1507.  
  1508. (*
  1509.  * IDirectDrawGammaControl
  1510.  *)
  1511.   IDirectDrawGammaControl = interface (IUnknown)
  1512.     ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
  1513.     function GetGammaRamp (dwFlags: DWORD; out lpRampData: TDDGammaRamp)
  1514.         : HResult; stdcall;
  1515.     function SetGammaRamp (dwFlags: DWORD; const lpRampData: TDDGammaRamp)
  1516.         : HResult; stdcall;
  1517.   end;
  1518.  
  1519. type
  1520.   IID_IDirectDraw = IDirectDraw;
  1521.   IID_IDirectDraw2 = IDirectDraw2;
  1522.   IID_IDirectDraw4 = IDirectDraw4;
  1523.   IID_IDirectDraw7 = IDirectDraw7;
  1524.   IID_IDirectDrawSurface = IDirectDrawSurface;
  1525.   IID_IDirectDrawSurface2 = IDirectDrawSurface2;
  1526.   IID_IDirectDrawSurface3 = IDirectDrawSurface3;
  1527.   IID_IDirectDrawSurface4 = IDirectDrawSurface4;
  1528.   IID_IDirectDrawSurface7 = IDirectDrawSurface7;
  1529.  
  1530.   IID_IDirectDrawPalette = IDirectDrawPalette;
  1531.   IID_IDirectDrawClipper = IDirectDrawClipper;
  1532.   IID_IDirectDrawColorControl = IDirectDrawColorControl;
  1533.   IID_IDirectDrawGammaControl = IDirectDrawGammaControl;
  1534.  
  1535. const  
  1536. (*
  1537.  * ddsCaps field is valid.
  1538.  *)
  1539.   DDSD_CAPS               = $00000001;     // default
  1540.  
  1541. (*
  1542.  * dwHeight field is valid.
  1543.  *)
  1544.   DDSD_HEIGHT             = $00000002;
  1545.  
  1546. (*
  1547.  * dwWidth field is valid.
  1548.  *)
  1549.   DDSD_WIDTH              = $00000004;
  1550.  
  1551. (*
  1552.  * lPitch is valid.
  1553.  *)
  1554.   DDSD_PITCH              = $00000008;
  1555.  
  1556. (*
  1557.  * dwBackBufferCount is valid.
  1558.  *)
  1559.   DDSD_BACKBUFFERCOUNT    = $00000020;
  1560.  
  1561. (*
  1562.  * dwZBufferBitDepth is valid.  (shouldnt be used in DDSURFACEDESC2)
  1563.  *)
  1564.   DDSD_ZBUFFERBITDEPTH    = $00000040;
  1565.  
  1566. (*
  1567.  * dwAlphaBitDepth is valid.
  1568.  *)
  1569.    DDSD_ALPHABITDEPTH      = $00000080;
  1570.  
  1571. (*
  1572.  * lpSurface is valid.
  1573.  *)
  1574.   DDSD_LPSURFACE           = $00000800;
  1575.  
  1576. (*
  1577.  * ddpfPixelFormat is valid.
  1578.  *)
  1579.   DDSD_PIXELFORMAT        = $00001000;
  1580.  
  1581. (*
  1582.  * ddckCKDestOverlay is valid.
  1583.  *)
  1584.   DDSD_CKDESTOVERLAY      = $00002000;
  1585.  
  1586. (*
  1587.  * ddckCKDestBlt is valid.
  1588.  *)
  1589.   DDSD_CKDESTBLT          = $00004000;
  1590.  
  1591. (*
  1592.  * ddckCKSrcOverlay is valid.
  1593.  *)
  1594.   DDSD_CKSRCOVERLAY       = $00008000;
  1595.  
  1596. (*
  1597.  * ddckCKSrcBlt is valid.
  1598.  *)
  1599.   DDSD_CKSRCBLT           = $00010000;
  1600.  
  1601. (*
  1602.  * dwMipMapCount is valid.
  1603.  *)
  1604.   DDSD_MIPMAPCOUNT        = $00020000;
  1605.  
  1606.  (*
  1607.   * dwRefreshRate is valid
  1608.   *)
  1609.   DDSD_REFRESHRATE        = $00040000;
  1610.  
  1611. (*
  1612.  * dwLinearSize is valid
  1613.  *)
  1614.   DDSD_LINEARSIZE         = $00080000;
  1615.  
  1616. (*
  1617.  * dwTextureStage is valid
  1618.  *)
  1619.   DDSD_TEXTURESTAGE       = $00100000;
  1620.  
  1621. (*
  1622.  * All input fields are valid.
  1623.  *)
  1624.   DDSD_ALL                = $001ff9ee;
  1625.  
  1626.  
  1627. (*
  1628.  * guid field is valid.
  1629.  *)
  1630.   DDOSD_GUID                  = $00000001;
  1631.  
  1632. (*
  1633.  * dwCompressionRatio field is valid.
  1634.  *)
  1635.   DDOSD_COMPRESSION_RATIO     = $00000002;
  1636.  
  1637. (*
  1638.  * ddSCaps field is valid.
  1639.  *)
  1640.   DDOSD_SCAPS                 = $00000004;
  1641.  
  1642. (*
  1643.  * ddOSCaps field is valid.
  1644.  *)
  1645.   DDOSD_OSCAPS                = $00000008;
  1646.  
  1647. (*
  1648.  * All input fields are valid.
  1649.  *)
  1650.   DDOSD_ALL                   = $0000000f;
  1651.  
  1652. (*
  1653.  * The surface's optimized pixelformat is compressed
  1654.  *)
  1655.   DDOSDCAPS_OPTCOMPRESSED                       = $00000001;
  1656.  
  1657. (*
  1658.  * The surface's optimized pixelformat is reordered
  1659.  *)
  1660.   DDOSDCAPS_OPTREORDERED                        = $00000002;
  1661.  
  1662. (*
  1663.  * The opt surface is a monolithic mipmap
  1664.  *)
  1665.   DDOSDCAPS_MONOLITHICMIPMAP            = $00000004;
  1666.  
  1667. (*
  1668.  * The valid Surf caps:
  1669.  *   DDSCAPS_SYSTEMMEMORY       = $00000800;
  1670.  *   DDSCAPS_VIDEOMEMORY        = $00004000;
  1671.  *   DDSCAPS_LOCALVIDMEM        = $10000000;
  1672.  *   DDSCAPS_NONLOCALVIDMEM     = $20000000;
  1673.  *)
  1674.   DDOSDCAPS_VALIDSCAPS          = $30004800;
  1675.  
  1676. (*
  1677.  * The valid OptSurf caps
  1678.  *)
  1679.   DDOSDCAPS_VALIDOSCAPS                 = $00000007;
  1680.  
  1681.  
  1682. (*
  1683.  * DDCOLORCONTROL
  1684.  *)
  1685.  
  1686. (*
  1687.  * lBrightness field is valid.
  1688.  *)
  1689.   DDCOLOR_BRIGHTNESS            = $00000001;
  1690.  
  1691. (*
  1692.  * lContrast field is valid.
  1693.  *)
  1694.   DDCOLOR_CONTRAST              = $00000002;
  1695.  
  1696. (*
  1697.  * lHue field is valid.
  1698.  *)
  1699.   DDCOLOR_HUE                   = $00000004;
  1700.  
  1701. (*
  1702.  * lSaturation field is valid.
  1703.  *)
  1704.   DDCOLOR_SATURATION            = $00000008;
  1705.  
  1706. (*
  1707.  * lSharpness field is valid.
  1708.  *)
  1709.   DDCOLOR_SHARPNESS             = $00000010;
  1710.  
  1711. (*
  1712.  * lGamma field is valid.
  1713.  *)
  1714.   DDCOLOR_GAMMA                 = $00000020;
  1715.  
  1716. (*
  1717.  * lColorEnable field is valid.
  1718.  *)
  1719.   DDCOLOR_COLORENABLE           = $00000040;
  1720.  
  1721.  
  1722.  
  1723. (*============================================================================
  1724.  *
  1725.  * Direct Draw Capability Flags
  1726.  *
  1727.  * These flags are used to describe the capabilities of a given Surface.
  1728.  * All flags are bit flags.
  1729.  *
  1730.  *==========================================================================*)
  1731.  
  1732. (****************************************************************************
  1733.  *
  1734.  * DIRECTDRAWSURFACE CAPABILITY FLAGS
  1735.  *
  1736.  ****************************************************************************)
  1737. (*
  1738.  * This bit currently has no meaning.
  1739.  *)
  1740.   DDSCAPS_RESERVED1                       = $00000001;
  1741.  
  1742. (*
  1743.  * Indicates that this surface contains alpha-only information.
  1744.  * (To determine if a surface is RGBA/YUVA, the pixel format must be
  1745.  * interrogated.)
  1746.  *)
  1747.   DDSCAPS_ALPHA                           = $00000002;
  1748.  
  1749. (*
  1750.  * Indicates that this surface is a backbuffer.  It is generally
  1751.  * set by CreateSurface when the DDSCAPS_FLIP capability bit is set.
  1752.  * It indicates that this surface is THE back buffer of a surface
  1753.  * flipping structure.  DirectDraw supports N surfaces in a
  1754.  * surface flipping structure.  Only the surface that immediately
  1755.  * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set.
  1756.  * The other surfaces are identified as back buffers by the presence
  1757.  * of the DDSCAPS_FLIP capability, their attachment order, and the
  1758.  * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER
  1759.  * capabilities.  The bit is sent to CreateSurface when a standalone
  1760.  * back buffer is being created.  This surface could be attached to
  1761.  * a front buffer and/or back buffers to form a flipping surface
  1762.  * structure after the CreateSurface call.  See AddAttachments for
  1763.  * a detailed description of the behaviors in this case.
  1764.  *)
  1765.   DDSCAPS_BACKBUFFER                      = $00000004;
  1766.  
  1767. (*
  1768.  * Indicates a complex surface structure is being described.  A
  1769.  * complex surface structure results in the creation of more than
  1770.  * one surface.  The additional surfaces are attached to the root
  1771.  * surface.  The complex structure can only be destroyed by
  1772.  * destroying the root.
  1773.  *)
  1774.   DDSCAPS_COMPLEX                         = $00000008;
  1775.  
  1776. (*
  1777.  * Indicates that this surface is a part of a surface flipping structure.
  1778.  * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and
  1779.  * DDSCAP_BACKBUFFER bits are not set.  They are set by CreateSurface
  1780.  * on the resulting creations.  The dwBackBufferCount field in the
  1781.  * TDDSurfaceDesc structure must be set to at least 1 in order for
  1782.  * the CreateSurface call to succeed.  The DDSCAPS_COMPLEX capability
  1783.  * must always be set with creating multiple surfaces through CreateSurface.
  1784.  *)
  1785.   DDSCAPS_FLIP                            = $00000010;
  1786.  
  1787. (*
  1788.  * Indicates that this surface is THE front buffer of a surface flipping
  1789.  * structure.  It is generally set by CreateSurface when the DDSCAPS_FLIP
  1790.  * capability bit is set.
  1791.  * If this capability is sent to CreateSurface then a standalonw front buffer
  1792.  * is created.  This surface will not have the DDSCAPS_FLIP capability.
  1793.  * It can be attached to other back buffers to form a flipping structure.
  1794.  * See AddAttachments for a detailed description of the behaviors in this
  1795.  * case.
  1796.  *)
  1797.   DDSCAPS_FRONTBUFFER                     = $00000020;
  1798.  
  1799. (*
  1800.  * Indicates that this surface is any offscreen surface that is not an overlay,
  1801.  * texture, zbuffer, front buffer, back buffer, or alpha surface.  It is used
  1802.  * to identify plain vanilla surfaces.
  1803.  *)
  1804.   DDSCAPS_OFFSCREENPLAIN                  = $00000040;
  1805.  
  1806. (*
  1807.  * Indicates that this surface is an overlay.  It may or may not be directly visible
  1808.  * depending on whether or not it is currently being overlayed onto the primary
  1809.  * surface.  DDSCAPS_VISIBLE can be used to determine whether or not it is being
  1810.  * overlayed at the moment.
  1811.  *)
  1812.   DDSCAPS_OVERLAY                         = $00000080;
  1813.  
  1814. (*
  1815.  * Indicates that unique DirectDrawPalette objects can be created and
  1816.  * attached to this surface.
  1817.  *)
  1818.   DDSCAPS_PALETTE                         = $00000100;
  1819.  
  1820. (*
  1821.  * Indicates that this surface is the primary surface.  The primary
  1822.  * surface represents what the user is seeing at the moment.
  1823.  *)
  1824.   DDSCAPS_PRIMARYSURFACE                  = $00000200;
  1825.  
  1826. (*
  1827.  * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now
  1828.  * obsolete.
  1829.  *)
  1830.   DDSCAPS_RESERVED3              = $00000400;
  1831. (*
  1832.  * Indicates that this surface is the primary surface for the left eye.
  1833.  * The primary surface for the left eye represents what the user is seeing
  1834.  * at the moment with the users left eye.  When this surface is created the
  1835.  * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users
  1836.  * right eye.
  1837.  *)
  1838.   DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3;
  1839.  
  1840. (*
  1841.  * Indicates that this surface memory was allocated in system memory
  1842.  *)
  1843.   DDSCAPS_SYSTEMMEMORY                    = $00000800;
  1844.  
  1845. (*
  1846.  * Indicates that this surface can be used as a 3D texture.  It does not
  1847.  * indicate whether or not the surface is being used for that purpose.
  1848.  *)
  1849.   DDSCAPS_TEXTURE                         = $00001000;
  1850.  
  1851. (*
  1852.  * Indicates that a surface may be a destination for 3D rendering.  This
  1853.  * bit must be set in order to query for a Direct3D Device Interface
  1854.  * from this surface.
  1855.  *)
  1856.   DDSCAPS_3DDEVICE                        = $00002000;
  1857.  
  1858. (*
  1859.  * Indicates that this surface exists in video memory.
  1860.  *)
  1861.   DDSCAPS_VIDEOMEMORY                     = $00004000;
  1862.  
  1863. (*
  1864.  * Indicates that changes made to this surface are immediately visible.
  1865.  * It is always set for the primary surface and is set for overlays while
  1866.  * they are being overlayed and texture maps while they are being textured.
  1867.  *)
  1868.   DDSCAPS_VISIBLE                         = $00008000;
  1869.  
  1870. (*
  1871.  * Indicates that only writes are permitted to the surface.  Read accesses
  1872.  * from the surface may or may not generate a protection fault, but the
  1873.  * results of a read from this surface will not be meaningful.  READ ONLY.
  1874.  *)
  1875.   DDSCAPS_WRITEONLY                       = $00010000;
  1876.  
  1877. (*
  1878.  * Indicates that this surface is a z buffer. A z buffer does not contain
  1879.  * displayable information.  Instead it contains bit depth information that is
  1880.  * used to determine which pixels are visible and which are obscured.
  1881.  *)
  1882.   DDSCAPS_ZBUFFER                         = $00020000;
  1883.  
  1884. (*
  1885.  * Indicates surface will have a DC associated long term
  1886.  *)
  1887.   DDSCAPS_OWNDC                           = $00040000;
  1888.  
  1889. (*
  1890.  * Indicates surface should be able to receive live video
  1891.  *)
  1892.   DDSCAPS_LIVEVIDEO                       = $00080000;
  1893.  
  1894. (*
  1895.  * Indicates surface should be able to have a stream decompressed
  1896.  * to it by the hardware.
  1897.  *)
  1898.   DDSCAPS_HWCODEC                         = $00100000;
  1899.  
  1900. (*
  1901.  * Surface is a ModeX surface.
  1902.  *
  1903.  *)
  1904.   DDSCAPS_MODEX                           = $00200000;
  1905.  
  1906. (*
  1907.  * Indicates surface is one level of a mip-map. This surface will
  1908.  * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map.
  1909.  * This can be done explicitly, by creating a number of surfaces and
  1910.  * attaching them with AddAttachedSurface or by implicitly by CreateSurface.
  1911.  * If this bit is set then DDSCAPS_TEXTURE must also be set.
  1912.  *)
  1913.   DDSCAPS_MIPMAP                          = $00400000;
  1914.  
  1915. (*
  1916.  * This bit is reserved. It should not be specified.
  1917.  *)
  1918.   DDSCAPS_RESERVED2                       = $00800000;
  1919.  
  1920. (*
  1921.  * Indicates that memory for the surface is not allocated until the surface
  1922.  * is loaded (via the Direct3D texture Load() function).
  1923.  *)
  1924.   DDSCAPS_ALLOCONLOAD                     = $04000000;
  1925.  
  1926. (*
  1927.  * Indicates that the surface will recieve data from a video port.
  1928.  *)
  1929.   DDSCAPS_VIDEOPORT                       = $08000000;
  1930.  
  1931. (*
  1932.  * Indicates that a video memory surface is resident in true, local video
  1933.  * memory rather than non-local video memory. If this flag is specified then
  1934.  * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
  1935.  * DDSCAPS_NONLOCALVIDMEM.
  1936.  *)
  1937.   DDSCAPS_LOCALVIDMEM                     = $10000000;
  1938.  
  1939. (*
  1940.  * Indicates that a video memory surface is resident in non-local video
  1941.  * memory rather than true, local video memory. If this flag is specified
  1942.  * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
  1943.  * DDSCAPS_LOCALVIDMEM.
  1944.  *)
  1945.   DDSCAPS_NONLOCALVIDMEM                  = $20000000;
  1946.  
  1947. (*
  1948.  * Indicates that this surface is a standard VGA mode surface, and not a
  1949.  * ModeX surface. (This flag will never be set in combination with the
  1950.  * DDSCAPS_MODEX flag).
  1951.  *)
  1952.   DDSCAPS_STANDARDVGAMODE                 = $40000000;
  1953.  
  1954. (*
  1955.  * Indicates that this surface will be an optimized surface. This flag is
  1956.  * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface
  1957.  * will be created without any underlying video memory until loaded.
  1958.  *)
  1959.   DDSCAPS_OPTIMIZED                       = $80000000;
  1960.  
  1961.  
  1962.  
  1963. (*
  1964.  * Indicates that this surface will receive data from a video port using
  1965.  * the de-interlacing hardware.  This allows the driver to allocate memory
  1966.  * for any extra buffers that may be required.  The DDSCAPS_VIDEOPORT and
  1967.  * DDSCAPS_OVERLAY flags must also be set.
  1968.  *)
  1969.   DDSCAPS2_HARDWAREDEINTERLACE            = $00000002;
  1970.  
  1971. (*
  1972.  * Indicates to the driver that this surface will be locked very frequently
  1973.  * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap
  1974.  * set must also have DDSCAPS_TEXTURE. This cap cannot be used with
  1975.  * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE.
  1976.  *)
  1977.   DDSCAPS2_HINTDYNAMIC                  = $00000004;
  1978.  
  1979. (*
  1980.  * Indicates to the driver that this surface can be re-ordered/retiled on
  1981.  * load. This operation will not change the size of the texture. It is
  1982.  * relatively fast and symmetrical, since the application may lock these
  1983.  * bits (although it will take a performance hit when doing so). Surfaces
  1984.  * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be
  1985.  * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE.
  1986.  *)
  1987.   DDSCAPS2_HINTSTATIC                   = $00000008;
  1988.  
  1989. (*
  1990.  * Indicates that the client would like this texture surface to be managed by the
  1991.  * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have
  1992.  * DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY.
  1993.  *)
  1994.   DDSCAPS2_TEXTUREMANAGE                  = $00000010;
  1995.  
  1996. (*
  1997.  * These bits are reserved for internal use *)
  1998.   DDSCAPS2_RESERVED1                      = $00000020;
  1999.   DDSCAPS2_RESERVED2                      = $00000040;
  2000.  
  2001. (*
  2002.  * Indicates to the driver that this surface will never be locked again.
  2003.  * The driver is free to optimize this surface via retiling and actual compression.
  2004.  * All calls to Lock() or Blts from this surface will fail. Surfaces with this
  2005.  * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with
  2006.  * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC.
  2007.  *)
  2008.   DDSCAPS2_OPAQUE                         = $00000080;
  2009.  
  2010. (*
  2011.  * Applications should set this bit at CreateSurface time to indicate that they
  2012.  * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set.
  2013.  *)
  2014.   DDSCAPS2_HINTANTIALIASING               = $00000100;
  2015.  
  2016. (*
  2017.  * This flag is used at CreateSurface time to indicate that this set of
  2018.  * surfaces is a cubic environment map
  2019.  *)
  2020.   DDSCAPS2_CUBEMAP                        = $00000200;
  2021.  
  2022. (*
  2023.  * These flags preform two functions:
  2024.  * - At CreateSurface time, they define which of the six cube faces are
  2025.  *   required by the application.
  2026.  * - After creation, each face in the cubemap will have exactly one of these
  2027.  *   bits set.
  2028.  *)
  2029.   DDSCAPS2_CUBEMAP_POSITIVEX              = $00000400;
  2030.   DDSCAPS2_CUBEMAP_NEGATIVEX              = $00000800;
  2031.   DDSCAPS2_CUBEMAP_POSITIVEY              = $00001000;
  2032.   DDSCAPS2_CUBEMAP_NEGATIVEY              = $00002000;
  2033.   DDSCAPS2_CUBEMAP_POSITIVEZ              = $00004000;
  2034.   DDSCAPS2_CUBEMAP_NEGATIVEZ              = $00008000;
  2035.  
  2036. (*
  2037.  * This macro may be used to specify all faces of a cube map at CreateSurface time
  2038.  *)
  2039.   DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or
  2040.                                 DDSCAPS2_CUBEMAP_NEGATIVEX or
  2041.                                 DDSCAPS2_CUBEMAP_POSITIVEY or
  2042.                                 DDSCAPS2_CUBEMAP_NEGATIVEY or
  2043.                                 DDSCAPS2_CUBEMAP_POSITIVEZ or
  2044.                                 DDSCAPS2_CUBEMAP_NEGATIVEZ );
  2045.  
  2046.  
  2047. (*
  2048.  * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards
  2049.  * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface
  2050.  * constructs such as Cube Maps, wherein there are more than one mipmap surface attached
  2051.  * to the root surface.
  2052.  * This caps bit is ignored by CreateSurface
  2053.  *)
  2054.   DDSCAPS2_MIPMAPSUBLEVEL                 = $00010000;
  2055.  
  2056. (* This flag indicates that the texture should be managed by D3D only *)
  2057.   DDSCAPS2_D3DTEXTUREMANAGE               = $00020000;
  2058.  
  2059. (* This flag indicates that the managed surface can be safely lost *)
  2060.   DDSCAPS2_DONOTPERSIST                   = $00040000;
  2061.  
  2062. (* indicates that this surface is part of a stereo flipping chain *)
  2063.   DDSCAPS2_STEREOSURFACELEFT              = $00080000;
  2064.  
  2065.  
  2066.  
  2067.  (****************************************************************************
  2068.  *
  2069.  * DIRECTDRAW DRIVER CAPABILITY FLAGS
  2070.  *
  2071.  ****************************************************************************)
  2072.  
  2073. (*
  2074.  * Display hardware has 3D acceleration.
  2075.  *)
  2076.   DDCAPS_3D                       = $00000001;
  2077.  
  2078. (*
  2079.  * Indicates that DirectDraw will support only dest rectangles that are aligned
  2080.  * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively.
  2081.  * READ ONLY.
  2082.  *)
  2083.   DDCAPS_ALIGNBOUNDARYDEST        = $00000002;
  2084.  
  2085. (*
  2086.  * Indicates that DirectDraw will support only source rectangles  whose sizes in
  2087.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively.  READ ONLY.
  2088.  *)
  2089.   DDCAPS_ALIGNSIZEDEST            = $00000004;
  2090. (*
  2091.  * Indicates that DirectDraw will support only source rectangles that are aligned
  2092.  * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively.
  2093.  * READ ONLY.
  2094.  *)
  2095.   DDCAPS_ALIGNBOUNDARYSRC         = $00000008;
  2096.  
  2097. (*
  2098.  * Indicates that DirectDraw will support only source rectangles  whose sizes in
  2099.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively.  READ ONLY.
  2100.  *)
  2101.   DDCAPS_ALIGNSIZESRC             = $00000010;
  2102.  
  2103. (*
  2104.  * Indicates that DirectDraw will create video memory surfaces that have a stride
  2105.  * alignment equal to DIRECTDRAWCAPS.dwAlignStride.  READ ONLY.
  2106.  *)
  2107.   DDCAPS_ALIGNSTRIDE              = $00000020;
  2108.  
  2109. (*
  2110.  * Display hardware is capable of blt operations.
  2111.  *)
  2112.   DDCAPS_BLT                      = $00000040;
  2113.  
  2114. (*
  2115.  * Display hardware is capable of asynchronous blt operations.
  2116.  *)
  2117.   DDCAPS_BLTQUEUE                 = $00000080;
  2118.  
  2119. (*
  2120.  * Display hardware is capable of color space conversions during the blt operation.
  2121.  *)
  2122.   DDCAPS_BLTFOURCC                = $00000100;
  2123.  
  2124. (*
  2125.  * Display hardware is capable of stretching during blt operations.
  2126.  *)
  2127.   DDCAPS_BLTSTRETCH               = $00000200;
  2128.  
  2129. (*
  2130.  * Display hardware is shared with GDI.
  2131.  *)
  2132.   DDCAPS_GDI                      = $00000400;
  2133.  
  2134. (*
  2135.  * Display hardware can overlay.
  2136.  *)
  2137.   DDCAPS_OVERLAY                  = $00000800;
  2138.  
  2139. (*
  2140.  * Set if display hardware supports overlays but can not clip them.
  2141.  *)
  2142.   DDCAPS_OVERLAYCANTCLIP          = $00001000;
  2143.  
  2144. (*
  2145.  * Indicates that overlay hardware is capable of color space conversions during
  2146.  * the overlay operation.
  2147.  *)
  2148.   DDCAPS_OVERLAYFOURCC            = $00002000;
  2149.  
  2150. (*
  2151.  * Indicates that stretching can be done by the overlay hardware.
  2152.  *)
  2153.   DDCAPS_OVERLAYSTRETCH           = $00004000;
  2154.  
  2155. (*
  2156.  * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces
  2157.  * other than the primary surface.
  2158.  *)
  2159.   DDCAPS_PALETTE                  = $00008000;
  2160.  
  2161. (*
  2162.  * Indicates that palette changes can be syncd with the veritcal refresh.
  2163.  *)
  2164.   DDCAPS_PALETTEVSYNC             = $00010000;
  2165.  
  2166. (*
  2167.  * Display hardware can return the current scan line.
  2168.  *)
  2169.   DDCAPS_READSCANLINE             = $00020000;
  2170.  
  2171. (*
  2172.  * Display hardware has stereo vision capabilities.  DDSCAPS_PRIMARYSURFACELEFT
  2173.  * can be created.
  2174.  *)
  2175.   DDCAPS_STEREOVIEW               = $00040000;
  2176.  
  2177. (*
  2178.  * Display hardware is capable of generating a vertical blank interrupt.
  2179.  *)
  2180.   DDCAPS_VBI                      = $00080000;
  2181.  
  2182. (*
  2183.  * Supports the use of z buffers with blt operations.
  2184.  *)
  2185.   DDCAPS_ZBLTS                    = $00100000;
  2186.  
  2187. (*
  2188.  * Supports Z Ordering of overlays.
  2189.  *)
  2190.   DDCAPS_ZOVERLAYS                = $00200000;
  2191.  
  2192. (*
  2193.  * Supports color key
  2194.  *)
  2195.   DDCAPS_COLORKEY                 = $00400000;
  2196.  
  2197. (*
  2198.  * Supports alpha surfaces
  2199.  *)
  2200.   DDCAPS_ALPHA                    = $00800000;
  2201.  
  2202. (*
  2203.  * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set)
  2204.  *)
  2205.   DDCAPS_COLORKEYHWASSIST         = $01000000;
  2206.  
  2207. (*
  2208.  * no hardware support at all
  2209.  *)
  2210.   DDCAPS_NOHARDWARE               = $02000000;
  2211.  
  2212. (*
  2213.  * Display hardware is capable of color fill with bltter
  2214.  *)
  2215.   DDCAPS_BLTCOLORFILL             = $04000000;
  2216.  
  2217. (*
  2218.  * Display hardware is bank switched, and potentially very slow at
  2219.  * random access to VRAM.
  2220.  *)
  2221.   DDCAPS_BANKSWITCHED             = $08000000;
  2222.  
  2223. (*
  2224.  * Display hardware is capable of depth filling Z-buffers with bltter
  2225.  *)
  2226.   DDCAPS_BLTDEPTHFILL             = $10000000;
  2227.  
  2228. (*
  2229.  * Display hardware is capable of clipping while bltting.
  2230.  *)
  2231.   DDCAPS_CANCLIP                  = $20000000;
  2232.  
  2233. (*
  2234.  * Display hardware is capable of clipping while stretch bltting.
  2235.  *)
  2236.   DDCAPS_CANCLIPSTRETCHED         = $40000000;
  2237.  
  2238. (*
  2239.  * Display hardware is capable of bltting to or from system memory
  2240.  *)
  2241.   DDCAPS_CANBLTSYSMEM             = $80000000;
  2242.  
  2243.  
  2244.  (****************************************************************************
  2245.  *
  2246.  * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2)
  2247.  *
  2248.  ****************************************************************************)
  2249.  
  2250. (*
  2251.  * Display hardware is certified
  2252.  *)
  2253.   DDCAPS2_CERTIFIED               = $00000001;
  2254.  
  2255. (*
  2256.  * Driver cannot interleave 2D operations (lock and blt) to surfaces with
  2257.  * Direct3D rendering operations between calls to BeginScene() and EndScene()
  2258.  *)
  2259.   DDCAPS2_NO2DDURING3DSCENE       = $00000002;
  2260.  
  2261. (*
  2262.  * Display hardware contains a video port
  2263.  *)
  2264.   DDCAPS2_VIDEOPORT               = $00000004;
  2265.  
  2266. (*
  2267.  * The overlay can be automatically flipped according to the video port
  2268.  * VSYNCs, providing automatic doubled buffered display of video port
  2269.  * data using an overlay
  2270.  *)
  2271.   DDCAPS2_AUTOFLIPOVERLAY         = $00000008;
  2272.  
  2273. (*
  2274.  * Overlay can display each field of interlaced data individually while
  2275.  * it is interleaved in memory without causing jittery artifacts.
  2276.  *)
  2277.   DDCAPS2_CANBOBINTERLEAVED     = $00000010;
  2278.  
  2279. (*
  2280.  * Overlay can display each field of interlaced data individually while
  2281.  * it is not interleaved in memory without causing jittery artifacts.
  2282.  *)
  2283.   DDCAPS2_CANBOBNONINTERLEAVED  = $00000020;
  2284.  
  2285. (*
  2286.  * The overlay surface contains color controls (brightness, sharpness, etc.)
  2287.  *)
  2288.   DDCAPS2_COLORCONTROLOVERLAY   = $00000040;
  2289.  
  2290. (*
  2291.  * The primary surface contains color controls (gamma, etc.)
  2292.  *)
  2293.   DDCAPS2_COLORCONTROLPRIMARY   = $00000080;
  2294.  
  2295. (*
  2296.  * RGBZ -> RGB supported for 16:16 RGB:Z
  2297.  *)
  2298.   DDCAPS2_CANDROPZ16BIT         = $00000100;
  2299.  
  2300. (*
  2301.  * Driver supports non-local video memory.
  2302.  *)
  2303.   DDCAPS2_NONLOCALVIDMEM          = $00000200;
  2304.  
  2305. (*
  2306.  * Dirver supports non-local video memory but has different capabilities for
  2307.  * non-local video memory surfaces. If this bit is set then so must
  2308.  * DDCAPS2_NONLOCALVIDMEM.
  2309.  *)
  2310.   DDCAPS2_NONLOCALVIDMEMCAPS      = $00000400;
  2311.  
  2312. (*
  2313.  * Driver neither requires nor prefers surfaces to be pagelocked when performing
  2314.  * blts involving system memory surfaces
  2315.  *)
  2316.   DDCAPS2_NOPAGELOCKREQUIRED      = $00000800;
  2317.  
  2318. (*
  2319.  * Driver can create surfaces which are wider than the primary surface
  2320.  *)
  2321.   DDCAPS2_WIDESURFACES            = $00001000;
  2322.  
  2323. (*
  2324.  * Driver supports bob without using a video port by handling the
  2325.  * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip.
  2326.  *)
  2327.   DDCAPS2_CANFLIPODDEVEN          = $00002000;
  2328.  
  2329. (*
  2330.  * Driver supports bob using hardware
  2331.  *)
  2332.   DDCAPS2_CANBOBHARDWARE          = $00004000;
  2333.  
  2334. (*
  2335.  * Driver supports bltting any FOURCC surface to another surface of the same FOURCC
  2336.  *)
  2337.   DDCAPS2_COPYFOURCC              = $00008000;
  2338.  
  2339.  
  2340. (*
  2341.  * Driver supports loadable gamma ramps for the primary surface
  2342.  *)
  2343.   DDCAPS2_PRIMARYGAMMA            = $00020000;
  2344.  
  2345. (*
  2346.  * Driver can render in windowed mode.
  2347.  *)
  2348.   DDCAPS2_CANRENDERWINDOWED       = $00080000;
  2349.  
  2350. (*
  2351.  * A calibrator is available to adjust the gamma ramp according to the
  2352.  * physical display properties so that the result will be identical on
  2353.  * all calibrated systems.
  2354.  *)
  2355.   DDCAPS2_CANCALIBRATEGAMMA       = $00100000;
  2356.  
  2357. (*
  2358.  * Indicates that the driver will respond to DDFLIP_INTERVALn flags
  2359.  *)
  2360.   DDCAPS2_FLIPINTERVAL            = $00200000;
  2361.  
  2362. (*
  2363.  * Indicates that the driver will respond to DDFLIP_NOVSYNC
  2364.  *)
  2365.    DDCAPS2_FLIPNOVSYNC             = $00400000;
  2366.  
  2367. (*
  2368.  * Driver supports management of video memory, if this flag is ON,
  2369.  * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on
  2370.  * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on
  2371.  *)
  2372.   DDCAPS2_CANMANAGETEXTURE        = $00800000;
  2373.  
  2374. (*
  2375.  * The Direct3D texture manager uses this cap to decide whether to put managed
  2376.  * surfaces in non-local video memory. If the cap is set, the texture manager will
  2377.  * put managed surfaces in non-local vidmem. Drivers that cannot texture from
  2378.  * local vidmem SHOULD NOT set this cap.
  2379.  *)
  2380.   DDCAPS2_TEXMANINNONLOCALVIDMEM  = $01000000;
  2381.  
  2382. (*
  2383.  * Indicates that the driver supports DX7 type of stereo in at least one mode (which may
  2384.  * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher)
  2385.  * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of
  2386.  * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application
  2387.  * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode.
  2388.  *)
  2389.   DDCAPS2_STEREO                  = $02000000;
  2390.  
  2391. (*
  2392.  * This caps bit is intended for internal DirectDraw use.
  2393.  * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set.
  2394.  * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and
  2395.  *  all the assoicated system memory blt caps must be correct).
  2396.  * -It implies that the system->video blt caps in DDCAPS also apply to system to
  2397.  *  nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops
  2398.  *  members of DDCAPS (DDCORECAPS) are filled in correctly.
  2399.  * -Any blt from system to nonlocal memory that matches these caps bits will
  2400.  *  be passed to the driver.
  2401.  *
  2402.  * NOTE: This is intended to enable the driver itself to do efficient reordering
  2403.  * of textures. This is NOT meant to imply that hardware can write into AGP memory.
  2404.  * This operation is not currently supported.
  2405.  *)
  2406.   DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL   = $04000000;
  2407.  
  2408. (****************************************************************************
  2409.  *
  2410.  * DIRECTDRAW FX ALPHA CAPABILITY FLAGS
  2411.  *
  2412.  ****************************************************************************)
  2413.  
  2414. (*
  2415.  * Supports alpha blending around the edge of a source color keyed surface.
  2416.  * For Blt.
  2417.  *)
  2418.   DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
  2419.  
  2420. (*
  2421.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2422.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  2423.  * more opaque as the alpha value increases.  (0 is transparent.)
  2424.  * For Blt.
  2425.  *)
  2426.   DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
  2427.  
  2428. (*
  2429.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2430.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  2431.  * becomes more transparent as the alpha value increases.  (0 is opaque.)
  2432.  * This flag can only be set if DDCAPS_ALPHA is set.
  2433.  * For Blt.
  2434.  *)
  2435.   DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
  2436.  
  2437. (*
  2438.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  2439.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  2440.  * (0 is transparent.)
  2441.  * For Blt.
  2442.  *)
  2443.   DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
  2444.  
  2445. (*
  2446.  * The depth of the alpha channel data can range can be 1,2,4, or 8.
  2447.  * The NEG suffix indicates that this alpha channel becomes more transparent
  2448.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  2449.  * DDCAPS_ALPHA is set.
  2450.  * For Blt.
  2451.  *)
  2452.   DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
  2453.  
  2454. (*
  2455.  * Supports alpha blending around the edge of a source color keyed surface.
  2456.  * For Overlays.
  2457.  *)
  2458.   DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
  2459.  
  2460. (*
  2461.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2462.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  2463.  * more opaque as the alpha value increases.  (0 is transparent.)
  2464.  * For Overlays.
  2465.  *)
  2466.   DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
  2467.  
  2468. (*
  2469.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2470.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  2471.  * becomes more transparent as the alpha value increases.  (0 is opaque.)
  2472.  * This flag can only be set if DDCAPS_ALPHA is set.
  2473.  * For Overlays.
  2474.  *)
  2475.   DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
  2476.  
  2477. (*
  2478.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  2479.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  2480.  * (0 is transparent.)
  2481.  * For Overlays.
  2482.  *)
  2483.   DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
  2484.  
  2485. (*
  2486.  * The depth of the alpha channel data can range can be 1,2,4, or 8.  
  2487.  * The NEG suffix indicates that this alpha channel becomes more transparent
  2488.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  2489.  * DDCAPS_ALPHA is set.
  2490.  * For Overlays.
  2491.  *)
  2492.   DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
  2493.  
  2494. (****************************************************************************
  2495.  *
  2496.  * DIRECTDRAW FX CAPABILITY FLAGS
  2497.  *
  2498.  ****************************************************************************)
  2499.  
  2500. (*
  2501.  * Uses arithmetic operations to stretch and shrink surfaces during blt
  2502.  * rather than pixel doubling techniques.  Along the Y axis.
  2503.  *)
  2504.   DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
  2505.  
  2506. (*
  2507.  * Uses arithmetic operations to stretch during blt
  2508.  * rather than pixel doubling techniques.  Along the Y axis. Only
  2509.  * works for x1, x2, etc.
  2510.  *)
  2511.   DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
  2512.  
  2513. (*
  2514.  * Supports mirroring left to right in blt.
  2515.  *)
  2516.   DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
  2517.  
  2518. (*
  2519.  * Supports mirroring top to bottom in blt.
  2520.  *)
  2521.   DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
  2522.  
  2523. (*
  2524.  * Supports arbitrary rotation for blts.
  2525.  *)
  2526.   DDFXCAPS_BLTROTATION            = $00000100;
  2527.  
  2528. (*
  2529.  * Supports 90 degree rotations for blts.
  2530.  *)
  2531.    DDFXCAPS_BLTROTATION90          = $00000200;
  2532.  
  2533. (*
  2534.  * DirectDraw supports arbitrary shrinking of a surface along the
  2535.  * x axis (horizontal direction) for blts.
  2536.  *)
  2537.   DDFXCAPS_BLTSHRINKX             = $00000400;
  2538.  
  2539. (*
  2540.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2541.  * along the x axis (horizontal direction) for blts.
  2542.  *)
  2543.   DDFXCAPS_BLTSHRINKXN            = $00000800;
  2544.  
  2545. (*
  2546.  * DirectDraw supports arbitrary shrinking of a surface along the
  2547.  * y axis (horizontal direction) for blts.  
  2548.  *)
  2549.   DDFXCAPS_BLTSHRINKY             = $00001000;
  2550.  
  2551. (*
  2552.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2553.  * along the y axis (vertical direction) for blts.
  2554.  *)
  2555.   DDFXCAPS_BLTSHRINKYN            = $00002000;
  2556.  
  2557. (*
  2558.  * DirectDraw supports arbitrary stretching of a surface along the
  2559.  * x axis (horizontal direction) for blts.
  2560.  *)
  2561.   DDFXCAPS_BLTSTRETCHX            = $00004000;
  2562.  
  2563. (*
  2564.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2565.  * along the x axis (horizontal direction) for blts.
  2566.  *)
  2567.   DDFXCAPS_BLTSTRETCHXN           = $00008000;
  2568.  
  2569. (*
  2570.  * DirectDraw supports arbitrary stretching of a surface along the
  2571.  * y axis (horizontal direction) for blts.  
  2572.  *)
  2573.   DDFXCAPS_BLTSTRETCHY            = $00010000;
  2574.  
  2575. (*
  2576.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2577.  * along the y axis (vertical direction) for blts.  
  2578.  *)
  2579.   DDFXCAPS_BLTSTRETCHYN           = $00020000;
  2580.  
  2581. (*
  2582.  * Uses arithmetic operations to stretch and shrink surfaces during
  2583.  * overlay rather than pixel doubling techniques.  Along the Y axis
  2584.  * for overlays.
  2585.  *)
  2586.   DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
  2587.  
  2588. (*
  2589.  * Uses arithmetic operations to stretch surfaces during
  2590.  * overlay rather than pixel doubling techniques.  Along the Y axis
  2591.  * for overlays. Only works for x1, x2, etc.
  2592.  *)
  2593.   DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
  2594.  
  2595. (*
  2596.  * DirectDraw supports arbitrary shrinking of a surface along the
  2597.  * x axis (horizontal direction) for overlays.
  2598.  *)
  2599.   DDFXCAPS_OVERLAYSHRINKX         = $00080000;
  2600.  
  2601. (*
  2602.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2603.  * along the x axis (horizontal direction) for overlays.
  2604.  *)
  2605.   DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
  2606.  
  2607. (*
  2608.  * DirectDraw supports arbitrary shrinking of a surface along the
  2609.  * y axis (horizontal direction) for overlays.
  2610.  *)
  2611.   DDFXCAPS_OVERLAYSHRINKY         = $00200000;
  2612.  
  2613. (*
  2614.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2615.  * along the y axis (vertical direction) for overlays.  
  2616.  *)
  2617.   DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
  2618.  
  2619. (*
  2620.  * DirectDraw supports arbitrary stretching of a surface along the
  2621.  * x axis (horizontal direction) for overlays.
  2622.  *)
  2623.   DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
  2624.  
  2625. (*
  2626.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2627.  * along the x axis (horizontal direction) for overlays.
  2628.  *)
  2629.   DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
  2630.  
  2631. (*
  2632.  * DirectDraw supports arbitrary stretching of a surface along the
  2633.  * y axis (horizontal direction) for overlays.  
  2634.  *)
  2635.   DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
  2636.  
  2637. (*
  2638.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2639.  * along the y axis (vertical direction) for overlays.  
  2640.  *)
  2641.   DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
  2642.  
  2643. (*
  2644.  * DirectDraw supports mirroring of overlays across the vertical axis
  2645.  *)
  2646.   DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
  2647.  
  2648. (*
  2649.  * DirectDraw supports mirroring of overlays across the horizontal axis
  2650.  *)
  2651.   DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
  2652.  
  2653. (*
  2654.  * Driver can do alpha blending for blits.
  2655.  *)
  2656.   DDFXCAPS_BLTALPHA             = $00000001;
  2657.  
  2658. (*
  2659.  * Driver can do geometric transformations (or warps) for blits.
  2660.  *)
  2661.   DDFXCAPS_BLTTRANSFORM         = $00000002;
  2662.  
  2663. (*
  2664.  * Driver can do surface-reconstruction filtering for warped blits.
  2665.  *)
  2666.   DDFXCAPS_BLTFILTER           = DDFXCAPS_BLTARITHSTRETCHY;
  2667.  
  2668. (*
  2669.  * Driver can do alpha blending for overlays.
  2670.  *)
  2671.   DDFXCAPS_OVERLAYALPHA                 = $00000004;
  2672.  
  2673. (*
  2674.  * Driver can do geometric transformations (or warps) for overlays.
  2675.  *)
  2676.   DDFXCAPS_OVERLAYTRANSFORM     = $20000000;
  2677.  
  2678. (*
  2679.  * Driver can do surface-reconstruction filtering for warped overlays.
  2680.  *)
  2681.   DDFXCAPS_OVERLAYFILTER              = DDFXCAPS_OVERLAYARITHSTRETCHY;
  2682.  
  2683. (****************************************************************************
  2684.  *
  2685.  * DIRECTDRAW STEREO VIEW CAPABILITIES
  2686.  *
  2687.  ****************************************************************************)
  2688.  
  2689. (*
  2690.  * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete
  2691.  * The stereo view is accomplished via enigma encoding.
  2692.  *)
  2693.   DDSVCAPS_RESERVED1                 = $00000001;
  2694.   DDSVCAPS_ENIGMA                 = DDSVCAPS_RESERVED1;
  2695.  
  2696. (*
  2697.  * This flag used to be DDSVCAPS_FLICKER, which is now obsolete
  2698.  * The stereo view is accomplished via high frequency flickering.
  2699.  *)
  2700.   DDSVCAPS_RESERVED2                = $00000002;
  2701.   DDSVCAPS_FLICKER                = DDSVCAPS_RESERVED2;
  2702.  
  2703. (*
  2704.  * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete
  2705.  * The stereo view is accomplished via red and blue filters applied
  2706.  * to the left and right eyes.  All images must adapt their colorspaces
  2707.  * for this process.
  2708.  *)
  2709.   DDSVCAPS_RESERVED3                = $00000004;
  2710.   DDSVCAPS_REDBLUE                = DDSVCAPS_RESERVED3;
  2711.  
  2712. (*
  2713.  * This flag used to be DDSVCAPS_SPLIT, which is now obsolete
  2714.  * The stereo view is accomplished with split screen technology.
  2715.  *)
  2716.   DDSVCAPS_RESERVED4                  = $00000008;
  2717.   DDSVCAPS_SPLIT                  = DDSVCAPS_RESERVED4;
  2718.  
  2719. (*
  2720.  * The stereo view is accomplished with switching technology
  2721.  *)
  2722.   DDSVCAPS_STEREOSEQUENTIAL       = $00000010;
  2723.  
  2724. (****************************************************************************
  2725.  *
  2726.  * DIRECTDRAWPALETTE CAPABILITIES
  2727.  *
  2728.  ****************************************************************************)
  2729.  
  2730. (*
  2731.  * Index is 4 bits.  There are sixteen color entries in the palette table.
  2732.  *)
  2733.   DDPCAPS_4BIT                    = $00000001;
  2734.  
  2735. (*
  2736.  * Index is onto a 8 bit color index.  This field is only valid with the
  2737.  * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target
  2738.  * surface is in 8bpp. Each color entry is one byte long and is an index
  2739.  * into destination surface's 8bpp palette.
  2740.  *)
  2741.   DDPCAPS_8BITENTRIES             = $00000002;
  2742.  
  2743. (*
  2744.  * Index is 8 bits.  There are 256 color entries in the palette table.
  2745.  *)
  2746.   DDPCAPS_8BIT                    = $00000004;
  2747.  
  2748. (*
  2749.  * Indicates that this DIRECTDRAWPALETTE should use the palette color array
  2750.  * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE
  2751.  * object.
  2752.  * This flag is obsolete. DirectDraw always initializes the color array from
  2753.  * the lpDDColorArray parameter. The definition remains for source-level
  2754.  * compatibility.
  2755.  *)
  2756.   DDPCAPS_INITIALIZE              = $00000008;
  2757.  
  2758. (*
  2759.  * This palette is the one attached to the primary surface.  Changing this
  2760.  * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified
  2761.  * and supported.
  2762.  *)
  2763.   DDPCAPS_PRIMARYSURFACE          = $00000010;
  2764.  
  2765. (*
  2766.  * This palette is the one attached to the primary surface left.  Changing
  2767.  * this table has immediate effect on the display for the left eye unless
  2768.  * DDPSETPAL_VSYNC is specified and supported.
  2769.  *)
  2770.   DDPCAPS_PRIMARYSURFACELEFT      = $00000020;
  2771.  
  2772. (*
  2773.  * This palette can have all 256 entries defined
  2774.  *)
  2775.   DDPCAPS_ALLOW256                = $00000040;
  2776.  
  2777. (*
  2778.  * This palette can have modifications to it synced with the monitors
  2779.  * refresh rate.
  2780.  *)
  2781.   DDPCAPS_VSYNC                   = $00000080;
  2782.  
  2783. (*
  2784.  * Index is 1 bit.  There are two color entries in the palette table.
  2785.  *)
  2786.   DDPCAPS_1BIT                    = $00000100;
  2787.  
  2788. (*
  2789.  * Index is 2 bit.  There are four color entries in the palette table.
  2790.  *)
  2791.   DDPCAPS_2BIT                    = $00000200;
  2792.  
  2793. (*
  2794.  * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value
  2795.  *)
  2796.   DDPCAPS_ALPHA                 = $00000400;
  2797.  
  2798. (****************************************************************************
  2799.  *
  2800.  * DIRECTDRAWPALETTE SETENTRY CONSTANTS
  2801.  *
  2802.  ****************************************************************************)
  2803.  
  2804.  
  2805. (****************************************************************************
  2806.  *
  2807.  * DIRECTDRAWPALETTE GETENTRY CONSTANTS
  2808.  *
  2809.  ****************************************************************************)
  2810.  
  2811. (* 0 is the only legal value *)
  2812.  
  2813. (****************************************************************************
  2814.  *
  2815.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  2816.  *
  2817.  ****************************************************************************)
  2818.  
  2819. (*
  2820.  * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData
  2821.  * must be set to sizeof(IUnknown^). DirectDraw will call AddRef through this
  2822.  * pointer and Release when the private data is destroyed. This includes when
  2823.  * the surface or palette is destroyed before such priovate data is destroyed.
  2824.  *)
  2825.   DDSPD_IUNKNOWNPOINTER           = $00000001;
  2826.  
  2827. (*
  2828.  * Private data is only valid for the current state of the object,
  2829.  * as determined by the uniqueness value.
  2830.  *)
  2831.   DDSPD_VOLATILE                  = $00000002;
  2832.  
  2833. (****************************************************************************
  2834.  *
  2835.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  2836.  *
  2837.  ****************************************************************************)
  2838.  
  2839.  
  2840. (****************************************************************************
  2841.  *
  2842.  * DIRECTDRAW BITDEPTH CONSTANTS
  2843.  *
  2844.  * NOTE:  These are only used to indicate supported bit depths.   These
  2845.  * are flags only, they are not to be used as an actual bit depth.   The
  2846.  * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual
  2847.  * bit depths in a surface or for changing the display mode.
  2848.  *
  2849.  ****************************************************************************)
  2850.  
  2851. (*
  2852.  * 1 bit per pixel.
  2853.  *)
  2854.   DDBD_1                  = $00004000;
  2855.  
  2856. (*
  2857.  * 2 bits per pixel.
  2858.  *)
  2859.   DDBD_2                  = $00002000;
  2860.  
  2861. (*
  2862.  * 4 bits per pixel.
  2863.  *)
  2864.   DDBD_4                  = $00001000;
  2865.  
  2866. (*
  2867.  * 8 bits per pixel.
  2868.  *)
  2869.   DDBD_8                  = $00000800;
  2870.  
  2871. (*
  2872.  * 16 bits per pixel.
  2873.  *)
  2874.   DDBD_16                 = $00000400;
  2875.  
  2876. (*
  2877.  * 24 bits per pixel.
  2878.  *)
  2879.   DDBD_24                 = $00000200;
  2880.  
  2881. (*
  2882.  * 32 bits per pixel.
  2883.  *)
  2884.   DDBD_32                 = $00000100;
  2885.  
  2886. (****************************************************************************
  2887.  *
  2888.  * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS
  2889.  *
  2890.  ****************************************************************************)
  2891.  
  2892. (*
  2893.  * Set if the structure contains a color space.  Not set if the structure
  2894.  * contains a single color key.
  2895.  *)
  2896.   DDCKEY_COLORSPACE       = $00000001;
  2897.  
  2898. (*
  2899.  * Set if the structure specifies a color key or color space which is to be
  2900.  * used as a destination color key for blt operations.
  2901.  *)
  2902.   DDCKEY_DESTBLT          = $00000002;
  2903.  
  2904. (*
  2905.  * Set if the structure specifies a color key or color space which is to be
  2906.  * used as a destination color key for overlay operations.
  2907.  *)
  2908.   DDCKEY_DESTOVERLAY      = $00000004;
  2909.  
  2910. (*
  2911.  * Set if the structure specifies a color key or color space which is to be
  2912.  * used as a source color key for blt operations.
  2913.  *)
  2914.   DDCKEY_SRCBLT           = $00000008;
  2915.  
  2916. (*
  2917.  * Set if the structure specifies a color key or color space which is to be
  2918.  * used as a source color key for overlay operations.
  2919.  *)
  2920.   DDCKEY_SRCOVERLAY       = $00000010;
  2921.  
  2922.  
  2923. (****************************************************************************
  2924.  *
  2925.  * DIRECTDRAW COLOR KEY CAPABILITY FLAGS
  2926.  *
  2927.  ****************************************************************************)
  2928.  
  2929. (*
  2930.  * Supports transparent blting using a color key to identify the replaceable
  2931.  * bits of the destination surface for RGB colors.
  2932.  *)
  2933.   DDCKEYCAPS_DESTBLT                      = $00000001;
  2934.  
  2935. (*
  2936.  * Supports transparent blting using a color space to identify the replaceable
  2937.  * bits of the destination surface for RGB colors.
  2938.  *)
  2939.   DDCKEYCAPS_DESTBLTCLRSPACE              = $00000002;
  2940.  
  2941. (*
  2942.  * Supports transparent blting using a color space to identify the replaceable
  2943.  * bits of the destination surface for YUV colors.
  2944.  *)
  2945.   DDCKEYCAPS_DESTBLTCLRSPACEYUV           = $00000004;
  2946.  
  2947. (*
  2948.  * Supports transparent blting using a color key to identify the replaceable
  2949.  * bits of the destination surface for YUV colors.
  2950.  *)
  2951.   DDCKEYCAPS_DESTBLTYUV                   = $00000008;
  2952.  
  2953. (*
  2954.  * Supports overlaying using colorkeying of the replaceable bits of the surface
  2955.  * being overlayed for RGB colors.
  2956.  *)
  2957.   DDCKEYCAPS_DESTOVERLAY                  = $00000010;
  2958.  
  2959. (*
  2960.  * Supports a color space as the color key for the destination for RGB colors.
  2961.  *)
  2962.   DDCKEYCAPS_DESTOVERLAYCLRSPACE          = $00000020;
  2963.  
  2964. (*
  2965.  * Supports a color space as the color key for the destination for YUV colors.
  2966.  *)
  2967.   DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV       = $00000040;
  2968.  
  2969. (*
  2970.  * Supports only one active destination color key value for visible overlay
  2971.  * surfaces.
  2972.  *)
  2973.   DDCKEYCAPS_DESTOVERLAYONEACTIVE         = $00000080;
  2974.  
  2975. (*
  2976.  * Supports overlaying using colorkeying of the replaceable bits of the
  2977.  * surface being overlayed for YUV colors.
  2978.  *)
  2979.   DDCKEYCAPS_DESTOVERLAYYUV               = $00000100;
  2980.  
  2981. (*
  2982.  * Supports transparent blting using the color key for the source with
  2983.  * this surface for RGB colors.
  2984.  *)
  2985.   DDCKEYCAPS_SRCBLT                       = $00000200;
  2986.  
  2987. (*
  2988.  * Supports transparent blting using a color space for the source with
  2989.  * this surface for RGB colors.
  2990.  *)
  2991.   DDCKEYCAPS_SRCBLTCLRSPACE               = $00000400;
  2992.  
  2993. (*
  2994.  * Supports transparent blting using a color space for the source with
  2995.  * this surface for YUV colors.
  2996.  *)
  2997.   DDCKEYCAPS_SRCBLTCLRSPACEYUV            = $00000800;
  2998.  
  2999. (*
  3000.  * Supports transparent blting using the color key for the source with
  3001.  * this surface for YUV colors.
  3002.  *)
  3003.   DDCKEYCAPS_SRCBLTYUV                    = $00001000;
  3004.  
  3005. (*
  3006.  * Supports overlays using the color key for the source with this
  3007.  * overlay surface for RGB colors.
  3008.  *)
  3009.   DDCKEYCAPS_SRCOVERLAY                   = $00002000;
  3010.  
  3011. (*
  3012.  * Supports overlays using a color space as the source color key for
  3013.  * the overlay surface for RGB colors.
  3014.  *)
  3015.   DDCKEYCAPS_SRCOVERLAYCLRSPACE           = $00004000;
  3016.  
  3017. (*
  3018.  * Supports overlays using a color space as the source color key for
  3019.  * the overlay surface for YUV colors.
  3020.  *)
  3021.   DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV        = $00008000;
  3022.  
  3023. (*
  3024.  * Supports only one active source color key value for visible
  3025.  * overlay surfaces.
  3026.  *)
  3027.   DDCKEYCAPS_SRCOVERLAYONEACTIVE          = $00010000;
  3028.  
  3029. (*
  3030.  * Supports overlays using the color key for the source with this
  3031.  * overlay surface for YUV colors.
  3032.  *)
  3033.   DDCKEYCAPS_SRCOVERLAYYUV                = $00020000;
  3034.  
  3035. (*
  3036.  * there are no bandwidth trade-offs for using colorkey with an overlay
  3037.  *)
  3038.   DDCKEYCAPS_NOCOSTOVERLAY                = $00040000;
  3039.  
  3040.  
  3041. (****************************************************************************
  3042.  *
  3043.  * DIRECTDRAW PIXELFORMAT FLAGS
  3044.  *
  3045.  ****************************************************************************)
  3046.  
  3047. (*
  3048.  * The surface has alpha channel information in the pixel format.
  3049.  *)
  3050.   DDPF_ALPHAPIXELS                        = $00000001;
  3051.  
  3052. (*
  3053.  * The pixel format contains alpha only information
  3054.  *)
  3055.   DDPF_ALPHA                              = $00000002;
  3056.  
  3057. (*
  3058.  * The FourCC code is valid.
  3059.  *)
  3060.   DDPF_FOURCC                             = $00000004;
  3061.  
  3062. (*
  3063.  * The surface is 4-bit color indexed.
  3064.  *)
  3065.   DDPF_PALETTEINDEXED4                    = $00000008;
  3066.  
  3067. (*
  3068.  * The surface is indexed into a palette which stores indices
  3069.  * into the destination surface's 8-bit palette.
  3070.  *)
  3071.   DDPF_PALETTEINDEXEDTO8                  = $00000010;
  3072.  
  3073. (*
  3074.  * The surface is 8-bit color indexed.
  3075.  *)
  3076.   DDPF_PALETTEINDEXED8                    = $00000020;
  3077.  
  3078. (*
  3079.  * The RGB data in the pixel format structure is valid.
  3080.  *)
  3081.   DDPF_RGB                                = $00000040;
  3082.  
  3083. (*
  3084.  * The surface will accept pixel data in the format specified
  3085.  * and compress it during the write.
  3086.  *)
  3087.   DDPF_COMPRESSED                         = $00000080;
  3088.  
  3089. (*
  3090.  * The surface will accept RGB data and translate it during
  3091.  * the write to YUV data.  The format of the data to be written
  3092.  * will be contained in the pixel format structure.  The DDPF_RGB
  3093.  * flag will be set.
  3094.  *)
  3095.   DDPF_RGBTOYUV                           = $00000100;
  3096.  
  3097. (*
  3098.  * pixel format is YUV - YUV data in pixel format struct is valid
  3099.  *)
  3100.   DDPF_YUV                                = $00000200;
  3101.  
  3102. (*
  3103.  * pixel format is a z buffer only surface
  3104.  *)
  3105.   DDPF_ZBUFFER                            = $00000400;
  3106.  
  3107. (*
  3108.  * The surface is 1-bit color indexed.
  3109.  *)
  3110.   DDPF_PALETTEINDEXED1                    = $00000800;
  3111.  
  3112. (*
  3113.  * The surface is 2-bit color indexed.
  3114.  *)
  3115.   DDPF_PALETTEINDEXED2                    = $00001000;
  3116.  
  3117. (*
  3118.  * The surface contains Z information in the pixels
  3119.  *)
  3120.   DDPF_ZPIXELS                          = $00002000;
  3121.  
  3122. (*
  3123.  * The surface contains stencil information along with Z
  3124.  *)
  3125.   DDPF_STENCILBUFFER                    = $00004000;
  3126.  
  3127. (*
  3128.  * Premultiplied alpha format -- the color components have been
  3129.  * premultiplied by the alpha component.
  3130.  *)
  3131.   DDPF_ALPHAPREMULT                     = $00008000;
  3132.  
  3133.  
  3134. (*
  3135.  * Luminance data in the pixel format is valid.
  3136.  * Use this flag for luminance-only or luminance+alpha surfaces,
  3137.  * the bit depth is then ddpf.dwLuminanceBitCount.
  3138.  *)
  3139.   DDPF_LUMINANCE                          = $00020000;
  3140.  
  3141. (*
  3142.  * Luminance data in the pixel format is valid.
  3143.  * Use this flag when hanging luminance off bumpmap surfaces,
  3144.  * the bit mask for the luminance portion of the pixel is then
  3145.  * ddpf.dwBumpLuminanceBitMask
  3146.  *)
  3147.   DDPF_BUMPLUMINANCE                      = $00040000;
  3148.  
  3149. (*
  3150.  * Bump map dUdV data in the pixel format is valid.
  3151.  *)
  3152.   DDPF_BUMPDUDV                           = $00080000;
  3153.  
  3154. (*===========================================================================
  3155.  *
  3156.  *
  3157.  * DIRECTDRAW CALLBACK FLAGS
  3158.  *
  3159.  *
  3160.  *==========================================================================*)
  3161.  
  3162. (****************************************************************************
  3163.  *
  3164.  * DIRECTDRAW ENUMSURFACES FLAGS
  3165.  *
  3166.  ****************************************************************************)
  3167.  
  3168. (*
  3169.  * Enumerate all of the surfaces that meet the search criterion.
  3170.  *)
  3171.   DDENUMSURFACES_ALL                      = $00000001;
  3172.  
  3173. (*
  3174.  * A search hit is a surface that matches the surface description.
  3175.  *)
  3176.   DDENUMSURFACES_MATCH                    = $00000002;
  3177.  
  3178. (*
  3179.  * A search hit is a surface that does not match the surface description.
  3180.  *)
  3181.   DDENUMSURFACES_NOMATCH                  = $00000004;
  3182.  
  3183. (*
  3184.  * Enumerate the first surface that can be created which meets the search criterion.
  3185.  *)
  3186.   DDENUMSURFACES_CANBECREATED             = $00000008;
  3187.  
  3188. (*
  3189.  * Enumerate the surfaces that already exist that meet the search criterion.
  3190.  *)
  3191.   DDENUMSURFACES_DOESEXIST                = $00000010;
  3192.  
  3193. (****************************************************************************
  3194.  *
  3195.  * DIRECTDRAW SETDISPLAYMODE FLAGS
  3196.  *
  3197.  ****************************************************************************)
  3198.  
  3199. (*
  3200.  * The desired mode is a standard VGA mode
  3201.  *)
  3202.   DDSDM_STANDARDVGAMODE                   = $00000001;
  3203.  
  3204. (****************************************************************************
  3205.  *
  3206.  * DIRECTDRAW ENUMDISPLAYMODES FLAGS
  3207.  *
  3208.  ****************************************************************************)
  3209.  
  3210. (*
  3211.  * Enumerate Modes with different refresh rates.  EnumDisplayModes guarantees
  3212.  * that a particular mode will be enumerated only once.  This flag specifies whether
  3213.  * the refresh rate is taken into account when determining if a mode is unique.
  3214.  *)
  3215.   DDEDM_REFRESHRATES                      = $00000001;
  3216.  
  3217. (*
  3218.  * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA
  3219.  * modes such as mode 0x13 in addition to the usual ModeX modes (which are always
  3220.  * enumerated if the application has previously called SetCooperativeLevel with the
  3221.  * DDSCL_ALLOWMODEX flag set).
  3222.  *)
  3223.   DDEDM_STANDARDVGAMODES                  = $00000002;
  3224.  
  3225.  
  3226. (****************************************************************************
  3227.  *
  3228.  * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS
  3229.  *
  3230.  ****************************************************************************)
  3231.  
  3232. (*
  3233.  * Exclusive mode owner will be responsible for the entire primary surface.
  3234.  * GDI can be ignored. used with DD
  3235.  *)
  3236.   DDSCL_FULLSCREEN                        = $00000001;
  3237.  
  3238. (*
  3239.  * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode
  3240.  *)
  3241.   DDSCL_ALLOWREBOOT                       = $00000002;
  3242.  
  3243. (*
  3244.  * prevents DDRAW from modifying the application window.
  3245.  * prevents DDRAW from minimize/restore the application window on activation.
  3246.  *)
  3247.   DDSCL_NOWINDOWCHANGES                   = $00000004;
  3248.  
  3249. (*
  3250.  * app wants to work as a regular Windows application
  3251.  *)
  3252.   DDSCL_NORMAL                            = $00000008;
  3253.  
  3254. (*
  3255.  * app wants exclusive access
  3256.  *)
  3257.   DDSCL_EXCLUSIVE                         = $00000010;
  3258.  
  3259.  
  3260. (*
  3261.  * app can deal with non-windows display modes
  3262.  *)
  3263.   DDSCL_ALLOWMODEX                        = $00000040;
  3264.  
  3265. (*
  3266.  * this window will receive the focus messages
  3267.  *)
  3268.   DDSCL_SETFOCUSWINDOW                    = $00000080;
  3269.  
  3270. (*
  3271.  * this window is associated with the DDRAW object and will
  3272.  * cover the screen in fullscreen mode
  3273.  *)
  3274.   DDSCL_SETDEVICEWINDOW                   = $00000100;
  3275.  
  3276. (*
  3277.  * app wants DDRAW to create a window to be associated with the
  3278.  * DDRAW object
  3279.  *)
  3280.   DDSCL_CREATEDEVICEWINDOW                = $00000200;
  3281.  
  3282. (*
  3283.  * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D
  3284.  * take the global crtisec more frequently.
  3285.  *)
  3286.   DDSCL_MULTITHREADED                     = $00000400;
  3287.  
  3288. (*
  3289.  * App hints that it would like to keep the FPU set up for optimal Direct3D
  3290.  * performance (single precision and exceptions disabled) so Direct3D
  3291.  * does not need to explicitly set the FPU each time
  3292.  *)
  3293.   DDSCL_FPUSETUP                          = $00000800;
  3294.  
  3295. (*
  3296.  * App specifies that it needs either double precision FPU or FPU exceptions
  3297.  * enabled. This makes Direct3D explicitly set the FPU state eah time it is
  3298.  * called. Setting the flag will reduce Direct3D performance. The flag is
  3299.  * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP
  3300.  *)
  3301.   DDSCL_FPUPRESERVE                          = $00001000;
  3302.  
  3303. (****************************************************************************
  3304.  *
  3305.  * DIRECTDRAW BLT FLAGS
  3306.  *
  3307.  ****************************************************************************)
  3308.  
  3309. (*
  3310.  * Use the alpha information in the pixel format or the alpha channel surface
  3311.  * attached to the destination surface as the alpha channel for this blt.
  3312.  *)
  3313.   DDBLT_ALPHADEST                         = $00000001;
  3314.  
  3315. (*
  3316.  * Use the dwConstAlphaDest field in the TDDBltFX structure as the alpha channel
  3317.  * for the destination surface for this blt.
  3318.  *)
  3319.   DDBLT_ALPHADESTCONSTOVERRIDE            = $00000002;
  3320.  
  3321. (*
  3322.  * The NEG suffix indicates that the destination surface becomes more
  3323.  * transparent as the alpha value increases. (0 is opaque)
  3324.  *)
  3325.   DDBLT_ALPHADESTNEG                      = $00000004;
  3326.  
  3327. (*
  3328.  * Use the lpDDSAlphaDest field in the TDDBltFX structure as the alpha
  3329.  * channel for the destination for this blt.
  3330.  *)
  3331.   DDBLT_ALPHADESTSURFACEOVERRIDE          = $00000008;
  3332.  
  3333. (*
  3334.  * Use the dwAlphaEdgeBlend field in the TDDBltFX structure as the alpha channel
  3335.  * for the edges of the image that border the color key colors.
  3336.  *)
  3337.   DDBLT_ALPHAEDGEBLEND                    = $00000010;
  3338.  
  3339. (*
  3340.  * Use the alpha information in the pixel format or the alpha channel surface
  3341.  * attached to the source surface as the alpha channel for this blt.
  3342.  *)
  3343.   DDBLT_ALPHASRC                          = $00000020;
  3344.  
  3345. (*
  3346.  * Use the dwConstAlphaSrc field in the TDDBltFX structure as the alpha channel
  3347.  * for the source for this blt.
  3348.  *)
  3349.   DDBLT_ALPHASRCCONSTOVERRIDE             = $00000040;
  3350.  
  3351. (*
  3352.  * The NEG suffix indicates that the source surface becomes more transparent
  3353.  * as the alpha value increases. (0 is opaque)
  3354.  *)
  3355.   DDBLT_ALPHASRCNEG                       = $00000080;
  3356.  
  3357. (*
  3358.  * Use the lpDDSAlphaSrc field in the TDDBltFX structure as the alpha channel
  3359.  * for the source for this blt.
  3360.  *)
  3361.   DDBLT_ALPHASRCSURFACEOVERRIDE           = $00000100;
  3362.  
  3363. (*
  3364.  * Do this blt asynchronously through the FIFO in the order received.  If
  3365.  * there is no room in the hardware FIFO fail the call.
  3366.  *)
  3367.   DDBLT_ASYNC                             = $00000200;
  3368.  
  3369. (*
  3370.  * Uses the dwFillColor field in the TDDBltFX structure as the RGB color
  3371.  * to fill the destination rectangle on the destination surface with.
  3372.  *)
  3373.   DDBLT_COLORFILL                         = $00000400;
  3374.  
  3375. (*
  3376.  * Uses the dwDDFX field in the TDDBltFX structure to specify the effects
  3377.  * to use for the blt.
  3378.  *)
  3379.   DDBLT_DDFX                              = $00000800;
  3380.  
  3381. (*
  3382.  * Uses the dwDDROPS field in the TDDBltFX structure to specify the ROPS
  3383.  * that are not part of the Win32 API.
  3384.  *)
  3385.   DDBLT_DDROPS                            = $00001000;
  3386.  
  3387. (*
  3388.  * Use the color key associated with the destination surface.
  3389.  *)
  3390.   DDBLT_KEYDEST                           = $00002000;
  3391.  
  3392. (*
  3393.  * Use the dckDestColorkey field in the TDDBltFX structure as the color key
  3394.  * for the destination surface.
  3395.  *)
  3396.   DDBLT_KEYDESTOVERRIDE                   = $00004000;
  3397.  
  3398. (*
  3399.  * Use the color key associated with the source surface.
  3400.  *)
  3401.   DDBLT_KEYSRC                            = $00008000;
  3402.  
  3403. (*
  3404.  * Use the dckSrcColorkey field in the TDDBltFX structure as the color key
  3405.  * for the source surface.
  3406.  *)
  3407.   DDBLT_KEYSRCOVERRIDE                    = $00010000;
  3408.  
  3409. (*
  3410.  * Use the dwROP field in the TDDBltFX structure for the raster operation
  3411.  * for this blt.  These ROPs are the same as the ones defined in the Win32 API.
  3412.  *)
  3413.   DDBLT_ROP                               = $00020000;
  3414.  
  3415. (*
  3416.  * Use the dwRotationAngle field in the TDDBltFX structure as the angle
  3417.  * (specified in 1/100th of a degree) to rotate the surface.
  3418.  *)
  3419.   DDBLT_ROTATIONANGLE                     = $00040000;
  3420.  
  3421. (*
  3422.  * Z-buffered blt using the z-buffers attached to the source and destination
  3423.  * surfaces and the dwZBufferOpCode field in the TDDBltFX structure as the
  3424.  * z-buffer opcode.
  3425.  *)
  3426.   DDBLT_ZBUFFER                           = $00080000;
  3427.  
  3428. (*
  3429.  * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field
  3430.  * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
  3431.  * for the destination.
  3432.  *)
  3433.   DDBLT_ZBUFFERDESTCONSTOVERRIDE          = $00100000;
  3434.  
  3435. (*
  3436.  * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode
  3437.  * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
  3438.  * respectively for the destination.
  3439.  *)
  3440.   DDBLT_ZBUFFERDESTOVERRIDE               = $00200000;
  3441.  
  3442. (*
  3443.  * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field
  3444.  * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
  3445.  * for the source.
  3446.  *)
  3447.   DDBLT_ZBUFFERSRCCONSTOVERRIDE           = $00400000;
  3448.  
  3449. (*
  3450.  * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode
  3451.  * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
  3452.  * respectively for the source.
  3453.  *)
  3454.    DDBLT_ZBUFFERSRCOVERRIDE                = $00800000;
  3455.  
  3456. (*
  3457.  * wait until the device is ready to handle the blt
  3458.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  3459.  *)
  3460.   DDBLT_WAIT                              = $01000000;
  3461.  
  3462. (*
  3463.  * Uses the dwFillDepth field in the TDDBltFX structure as the depth value
  3464.  * to fill the destination rectangle on the destination Z-buffer surface
  3465.  * with.
  3466.  *)
  3467.   DDBLT_DEPTHFILL                         = $02000000;
  3468.  
  3469. (*
  3470.  * wait until the device is ready to handle the blt
  3471.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  3472.  *)
  3473.   DDBLT_DONOTWAIT                         = $08000000;
  3474.  
  3475. (****************************************************************************
  3476.  *
  3477.  * BLTFAST FLAGS
  3478.  *
  3479.  ****************************************************************************)
  3480.  
  3481.   DDBLTFAST_NOCOLORKEY                    = $00000000;
  3482.   DDBLTFAST_SRCCOLORKEY                   = $00000001;
  3483.   DDBLTFAST_DESTCOLORKEY                  = $00000002;
  3484.   DDBLTFAST_WAIT                          = $00000010;
  3485.   DDBLTFAST_DONOTWAIT                     = $00000020;
  3486.  
  3487. (****************************************************************************
  3488.  *
  3489.  * FLIP FLAGS
  3490.  *
  3491.  ****************************************************************************)
  3492.  
  3493.  
  3494.   DDFLIP_WAIT                          = $00000001;
  3495.  
  3496. (*
  3497.  * Indicates that the target surface contains the even field of video data.
  3498.  * This flag is only valid with an overlay surface.
  3499.  *)
  3500.   DDFLIP_EVEN                          = $00000002;
  3501.  
  3502. (*
  3503.  * Indicates that the target surface contains the odd field of video data.
  3504.  * This flag is only valid with an overlay surface.
  3505.  *)
  3506.   DDFLIP_ODD                           = $00000004;
  3507.  
  3508. (*
  3509.  * Causes DirectDraw to perform the physical flip immediately and return
  3510.  * to the application. Typically, what was the front buffer but is now the back
  3511.  * buffer will still be visible (depending on timing) until the next vertical
  3512.  * retrace. Subsequent operations involving the two flipped surfaces will
  3513.  * not check to see if the physical flip has finished (i.e. will not return
  3514.  * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)).
  3515.  * This allows an application to perform Flips at a higher frequency than the
  3516.  * monitor refresh rate, but may introduce visible artifacts.
  3517.  * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set,
  3518.  * DDFLIP_NOVSYNC has no effect.
  3519.  *)
  3520.   DDFLIP_NOVSYNC                       = $00000008;
  3521.  
  3522.  
  3523. (*
  3524.  * Flip Interval Flags. These flags indicate how many vertical retraces to wait between
  3525.  * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each
  3526.  * surface involved in the flip until the specified number of vertical retraces has
  3527.  * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set,
  3528.  * DDFLIP_INTERVALn has no effect.
  3529.  *)
  3530.  
  3531. (*
  3532.  * DirectDraw will flip on every other vertical sync
  3533.  *)
  3534.   DDFLIP_INTERVAL2                     = $02000000;
  3535.  
  3536.  
  3537. (*
  3538.  * DirectDraw will flip on every third vertical sync
  3539.  *)
  3540.   DDFLIP_INTERVAL3                     = $03000000;
  3541.  
  3542.  
  3543. (*
  3544.  * DirectDraw will flip on every fourth vertical sync
  3545.  *)
  3546.   DDFLIP_INTERVAL4                     = $04000000;
  3547.  
  3548. (*
  3549.  * DirectDraw will flip and display a main stereo surface
  3550.  *)
  3551.   DDFLIP_STEREO                        = $00000010;
  3552.  
  3553. (*
  3554.  * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish
  3555.  * to override the default and use time when the accelerator is busy (as denoted by
  3556.  * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT.
  3557.  *)
  3558.   DDFLIP_DONOTWAIT                     = $00000020;
  3559.  
  3560. (****************************************************************************
  3561.  *
  3562.  * DIRECTDRAW SURFACE OVERLAY FLAGS
  3563.  *
  3564.  ****************************************************************************)
  3565.  
  3566. (*
  3567.  * Use the alpha information in the pixel format or the alpha channel surface
  3568.  * attached to the destination surface as the alpha channel for the
  3569.  * destination overlay.
  3570.  *)
  3571.   DDOVER_ALPHADEST                        = $00000001;
  3572.  
  3573. (*
  3574.  * Use the dwConstAlphaDest field in the TDDOverlayFX structure as the
  3575.  * destination alpha channel for this overlay.
  3576.  *)
  3577.   DDOVER_ALPHADESTCONSTOVERRIDE           = $00000002;
  3578.  
  3579. (*
  3580.  * The NEG suffix indicates that the destination surface becomes more
  3581.  * transparent as the alpha value increases.
  3582.  *)
  3583.   DDOVER_ALPHADESTNEG                     = $00000004;
  3584.  
  3585. (*
  3586.  * Use the lpDDSAlphaDest field in the TDDOverlayFX structure as the alpha
  3587.  * channel destination for this overlay.
  3588.  *)
  3589.   DDOVER_ALPHADESTSURFACEOVERRIDE         = $00000008;
  3590.  
  3591. (*
  3592.  * Use the dwAlphaEdgeBlend field in the TDDOverlayFX structure as the alpha
  3593.  * channel for the edges of the image that border the color key colors.
  3594.  *)
  3595.   DDOVER_ALPHAEDGEBLEND                   = $00000010;
  3596.  
  3597. (*
  3598.  * Use the alpha information in the pixel format or the alpha channel surface
  3599.  * attached to the source surface as the source alpha channel for this overlay.
  3600.  *)
  3601.   DDOVER_ALPHASRC                         = $00000020;
  3602.  
  3603. (*
  3604.  * Use the dwConstAlphaSrc field in the TDDOverlayFX structure as the source
  3605.  * alpha channel for this overlay.
  3606.  *)
  3607.   DDOVER_ALPHASRCCONSTOVERRIDE            = $00000040;
  3608.  
  3609. (*
  3610.  * The NEG suffix indicates that the source surface becomes more transparent
  3611.  * as the alpha value increases.
  3612.  *)
  3613.   DDOVER_ALPHASRCNEG                      = $00000080;
  3614.  
  3615. (*
  3616.  * Use the lpDDSAlphaSrc field in the TDDOverlayFX structure as the alpha channel
  3617.  * source for this overlay.
  3618.  *)
  3619.   DDOVER_ALPHASRCSURFACEOVERRIDE          = $00000100;
  3620.  
  3621. (*
  3622.  * Turn this overlay off.
  3623.  *)
  3624.   DDOVER_HIDE                             = $00000200;
  3625.  
  3626. (*
  3627.  * Use the color key associated with the destination surface.
  3628.  *)
  3629.   DDOVER_KEYDEST                          = $00000400;
  3630.  
  3631. (*
  3632.  * Use the dckDestColorkey field in the TDDOverlayFX structure as the color key
  3633.  * for the destination surface
  3634.  *)
  3635.   DDOVER_KEYDESTOVERRIDE                  = $00000800;
  3636.  
  3637. (*
  3638.  * Use the color key associated with the source surface.
  3639.  *)
  3640.   DDOVER_KEYSRC                           = $00001000;
  3641.  
  3642. (*
  3643.  * Use the dckSrcColorkey field in the TDDOverlayFX structure as the color key
  3644.  * for the source surface.
  3645.  *)
  3646.   DDOVER_KEYSRCOVERRIDE                   = $00002000;
  3647.  
  3648. (*
  3649.  * Turn this overlay on.
  3650.  *)
  3651.   DDOVER_SHOW                             = $00004000;
  3652.  
  3653. (*
  3654.  * Add a dirty rect to an emulated overlayed surface.
  3655.  *)
  3656.   DDOVER_ADDDIRTYRECT                     = $00008000;
  3657.  
  3658. (*
  3659.  * Redraw all dirty rects on an emulated overlayed surface.
  3660.  *)
  3661.   DDOVER_REFRESHDIRTYRECTS                = $00010000;
  3662.  
  3663. (*
  3664.  * Redraw the entire surface on an emulated overlayed surface.
  3665.  *)
  3666.   DDOVER_REFRESHALL                      = $00020000;
  3667.  
  3668. (*
  3669.  * Use the overlay FX flags to define special overlay FX
  3670.  *)
  3671.   DDOVER_DDFX                             = $00080000;
  3672.  
  3673. (*
  3674.  * Autoflip the overlay when ever the video port autoflips
  3675.  *)
  3676.   DDOVER_AUTOFLIP                         = $00100000;
  3677.  
  3678. (*
  3679.  * Display each field of video port data individually without
  3680.  * causing any jittery artifacts
  3681.  *)
  3682.   DDOVER_BOB                              = $00200000;
  3683.  
  3684. (*
  3685.  * Indicates that bob/weave decisions should not be overridden by other
  3686.  * interfaces.
  3687.  *)
  3688.   DDOVER_OVERRIDEBOBWEAVE                 = $00400000;
  3689.  
  3690. (*
  3691.  * Indicates that the surface memory is composed of interleaved fields.
  3692.  *)
  3693.   DDOVER_INTERLEAVED                      = $00800000;
  3694.  
  3695. (*
  3696.  * Indicates that bob will be performed using hardware rather than
  3697.  * software or emulated.
  3698.  *)
  3699.   DDOVER_BOBHARDWARE                    = $01000000;
  3700.  
  3701. (*
  3702.  * Indicates that overlay FX structure contains valid ARGB scaling factors.
  3703.  *)
  3704.   DDOVER_ARGBSCALEFACTORS                 = $02000000;
  3705.  
  3706. (*
  3707.  * Indicates that ARGB scaling factors can be degraded to fit driver capabilities.
  3708.  *)
  3709.   DDOVER_DEGRADEARGBSCALING               = $04000000;
  3710.  
  3711. (****************************************************************************
  3712.  *
  3713.  * DIRECTDRAWSURFACE LOCK FLAGS
  3714.  *
  3715.  ****************************************************************************)
  3716.  
  3717. (*
  3718.  * The default.  Set to indicate that Lock should return a valid memory pointer
  3719.  * to the top of the specified rectangle.  If no rectangle is specified then a
  3720.  * pointer to the top of the surface is returned.
  3721.  *)
  3722.   DDLOCK_SURFACEMEMORYPTR                 = $00000000;    // = default
  3723.  
  3724. (*
  3725.  * Set to indicate that Lock should wait until it can obtain a valid memory
  3726.  * pointer before returning.  If this bit is set, Lock will never return
  3727.  * DDERR_WASSTILLDRAWING.
  3728.  *)
  3729.   DDLOCK_WAIT                             = $00000001;
  3730.  
  3731. (*
  3732.  * Set if an event handle is being passed to Lock.  Lock will trigger the event
  3733.  * when it can return the surface memory pointer requested.
  3734.  *)
  3735.   DDLOCK_EVENT                            = $00000002;
  3736.  
  3737. (*
  3738.  * Indicates that the surface being locked will only be read from.
  3739.  *)
  3740.   DDLOCK_READONLY                         = $00000010;
  3741.  
  3742. (*
  3743.  * Indicates that the surface being locked will only be written to
  3744.  *)
  3745.   DDLOCK_WRITEONLY                        = $00000020;
  3746.  
  3747. (*
  3748.  * Indicates that a system wide lock should not be taken when this surface
  3749.  * is locked. This has several advantages (cursor responsiveness, ability
  3750.  * to call more Windows functions, easier debugging) when locking video
  3751.  * memory surfaces. However, an application specifying this flag must
  3752.  * comply with a number of conditions documented in the help file.
  3753.  * Furthermore, this flag cannot be specified when locking the primary.
  3754.  *)
  3755.   DDLOCK_NOSYSLOCK                        = $00000800;
  3756.  
  3757. (*
  3758.  * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices
  3759.  * that were referred to in Draw*PrimtiveVB calls since the start of the
  3760.  * frame (or the last lock without this flag) will be modified during the
  3761.  * lock. This can be useful when one is only appending data to the vertex
  3762.  * buffer
  3763.  *)
  3764.   DDLOCK_NOOVERWRITE                      = $00001000;
  3765.  
  3766. (*
  3767.  * Indicates that no assumptions will be made about the contents of the
  3768.  * surface or vertex buffer during this lock.
  3769.  * This enables two things:
  3770.  * -    Direct3D or the driver may provide an alternative memory
  3771.  *      area as the vertex buffer. This is useful when one plans to clear the
  3772.  *      contents of the vertex buffer and fill in new data.
  3773.  * -    Drivers sometimes store surface data in a re-ordered format.
  3774.  *      When the application locks the surface, the driver is forced to un-re-order
  3775.  *      the surface data before allowing the application to see the surface contents.
  3776.  *      This flag is a hint to the driver that it can skip the un-re-ordering process
  3777.  *      since the application plans to overwrite every single pixel in the surface
  3778.  *      or locked rectangle (and so erase any un-re-ordered pixels anyway).
  3779.  *      Applications should always set this flag when they intend to overwrite the entire
  3780.  *      surface or locked rectangle.
  3781.  *)
  3782.   DDLOCK_DISCARDCONTENTS                  = $00002000;
  3783.  (*
  3784.   * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS
  3785.   *)
  3786.   DDLOCK_OKTOSWAP                         = $00002000;
  3787.  
  3788. (*
  3789.  * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish
  3790.  * to override the default and use time when the accelerator is busy (as denoted by
  3791.  * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT.
  3792.  *)
  3793.   DDLOCK_DONOTWAIT                        = $00004000;
  3794.  
  3795.  
  3796. (****************************************************************************
  3797.  *
  3798.  * DIRECTDRAWSURFACE PAGELOCK FLAGS
  3799.  *
  3800.  ****************************************************************************)
  3801.  
  3802. (*
  3803.  * No flags defined at present
  3804.  *)
  3805.  
  3806.  
  3807. (****************************************************************************
  3808.  *
  3809.  * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS
  3810.  *
  3811.  ****************************************************************************)
  3812.  
  3813. (*
  3814.  * No flags defined at present
  3815.  *)
  3816.  
  3817.  
  3818. (****************************************************************************
  3819.  *
  3820.  * DIRECTDRAWSURFACE BLT FX FLAGS
  3821.  *
  3822.  ****************************************************************************)
  3823.  
  3824. (*
  3825.  * If stretching, use arithmetic stretching along the Y axis for this blt.
  3826.  *)
  3827.   DDBLTFX_ARITHSTRETCHY                   = $00000001;
  3828.  
  3829. (*
  3830.  * Do this blt mirroring the surface left to right.  Spin the
  3831.  * surface around its y-axis.
  3832.  *)
  3833.   DDBLTFX_MIRRORLEFTRIGHT                 = $00000002;
  3834.  
  3835. (*
  3836.  * Do this blt mirroring the surface up and down.  Spin the surface
  3837.  * around its x-axis.
  3838.  *)
  3839.   DDBLTFX_MIRRORUPDOWN                    = $00000004;
  3840.  
  3841. (*
  3842.  * Schedule this blt to avoid tearing.
  3843.  *)
  3844.   DDBLTFX_NOTEARING                       = $00000008;
  3845.  
  3846. (*
  3847.  * Do this blt rotating the surface one hundred and eighty degrees.
  3848.  *)
  3849.   DDBLTFX_ROTATE180                       = $00000010;
  3850.  
  3851. (*
  3852.  * Do this blt rotating the surface two hundred and seventy degrees.
  3853.  *)
  3854.   DDBLTFX_ROTATE270                       = $00000020;
  3855.  
  3856. (*
  3857.  * Do this blt rotating the surface ninety degrees.
  3858.  *)
  3859.   DDBLTFX_ROTATE90                        = $00000040;
  3860.  
  3861. (*
  3862.  * Do this z blt using dwZBufferLow and dwZBufferHigh as  range values
  3863.  * specified to limit the bits copied from the source surface.
  3864.  *)
  3865.   DDBLTFX_ZBUFFERRANGE                    = $00000080;
  3866.  
  3867. (*
  3868.  * Do this z blt adding the dwZBufferBaseDest to each of the sources z values
  3869.  * before comparing it with the desting z values.
  3870.  *)
  3871.   DDBLTFX_ZBUFFERBASEDEST                 = $00000100;
  3872.  
  3873. (****************************************************************************
  3874.  *
  3875.  * DIRECTDRAWSURFACE OVERLAY FX FLAGS
  3876.  *
  3877.  ****************************************************************************)
  3878.  
  3879. (*
  3880.  * If stretching, use arithmetic stretching along the Y axis for this overlay.
  3881.  *)
  3882.   DDOVERFX_ARITHSTRETCHY                  = $00000001;
  3883.  
  3884. (*
  3885.  * Mirror the overlay across the vertical axis
  3886.  *)
  3887.   DDOVERFX_MIRRORLEFTRIGHT                = $00000002;
  3888.  
  3889. (*
  3890.  * Mirror the overlay across the horizontal axis
  3891.  *)
  3892.   DDOVERFX_MIRRORUPDOWN                   = $00000004;
  3893.  
  3894. (****************************************************************************
  3895.  *
  3896.  * Flags for dwDDFX member of DDSPRITEFX structure
  3897.  *
  3898.  ****************************************************************************)
  3899. (*
  3900.  * Use affine transformation matrix in fTransform member.
  3901.  *)
  3902.   DDSPRITEFX_AFFINETRANSFORM            = $00000001;
  3903.  
  3904. (*
  3905.  * Use RGBA scaling factors in ddrgbaScaleFactors member.
  3906.  *)
  3907.   DDSPRITEFX_RGBASCALING                        = $00000002;
  3908.  
  3909. (*
  3910.  * Degrade RGBA scaling factors to accommodate driver's capabilities.
  3911.  *)
  3912.   DDSPRITEFX_DEGRADERGBASCALING         = $00000004;
  3913.  
  3914. (*
  3915.  * Do bilinear filtering of stretched or warped sprite.
  3916.  *)
  3917.   DDSPRITEFX_BILINEARFILTER                     = $00000008;
  3918.  
  3919. (*
  3920.  * Do "blur" filtering of stretched or warped sprite.
  3921.  *)
  3922.   DDSPRITEFX_BLURFILTER                         = $00000010;
  3923.  
  3924. (*
  3925.  * Do "flat" filtering of stretched or warped sprite.
  3926.  *)
  3927.   DDSPRITEFX_FLATFILTER                         = $00000020;
  3928.  
  3929. (*
  3930.  * Degrade filtering operation to accommodate driver's capabilities.
  3931.  *)
  3932.   DDSPRITEFX_DEGRADEFILTER              = $00000040;
  3933.  
  3934. (****************************************************************************
  3935.  *
  3936.  * DIRECTDRAW WAITFORVERTICALBLANK FLAGS
  3937.  *
  3938.  ****************************************************************************)
  3939.  
  3940. (*
  3941.  * return when the vertical blank interval begins
  3942.  *)
  3943.   DDWAITVB_BLOCKBEGIN                     = $00000001;
  3944.  
  3945. (*
  3946.  * set up an event to trigger when the vertical blank begins
  3947.  *)
  3948.   DDWAITVB_BLOCKBEGINEVENT                = $00000002;
  3949.  
  3950. (*
  3951.  * return when the vertical blank interval ends and display begins
  3952.  *)
  3953.   DDWAITVB_BLOCKEND                       = $00000004;
  3954.  
  3955. (****************************************************************************
  3956.  *
  3957.  * DIRECTDRAW GETFLIPSTATUS FLAGS
  3958.  *
  3959.  ****************************************************************************)
  3960.  
  3961. (*
  3962.  * is it OK to flip now?
  3963.  *)
  3964.   DDGFS_CANFLIP                   = $00000001;
  3965.  
  3966. (*
  3967.  * is the last flip finished?
  3968.  *)
  3969.   DDGFS_ISFLIPDONE                = $00000002;
  3970.  
  3971. (****************************************************************************
  3972.  *
  3973.  * DIRECTDRAW GETBLTSTATUS FLAGS
  3974.  *
  3975.  ****************************************************************************)
  3976.  
  3977. (*
  3978.  * is it OK to blt now?
  3979.  *)
  3980.   DDGBS_CANBLT                    = $00000001;
  3981.  
  3982. (*
  3983.  * is the blt to the surface finished?
  3984.  *)
  3985.   DDGBS_ISBLTDONE                 = $00000002;
  3986.  
  3987.  
  3988. (****************************************************************************
  3989.  *
  3990.  * DIRECTDRAW ENUMOVERLAYZORDER FLAGS
  3991.  *
  3992.  ****************************************************************************)
  3993.  
  3994. (*
  3995.  * Enumerate overlays back to front.
  3996.  *)
  3997.   DDENUMOVERLAYZ_BACKTOFRONT      = $00000000;
  3998.  
  3999. (*
  4000.  * Enumerate overlays front to back
  4001.  *)
  4002.   DDENUMOVERLAYZ_FRONTTOBACK      = $00000001;
  4003.  
  4004. (****************************************************************************
  4005.  *
  4006.  * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS
  4007.  *
  4008.  ****************************************************************************)
  4009.  
  4010. (*
  4011.  * Send overlay to front
  4012.  *)
  4013.   DDOVERZ_SENDTOFRONT             = $00000000;
  4014.  
  4015. (*
  4016.  * Send overlay to back
  4017.  *)
  4018.   DDOVERZ_SENDTOBACK              = $00000001;
  4019.  
  4020. (*
  4021.  * Move Overlay forward
  4022.  *)
  4023.   DDOVERZ_MOVEFORWARD             = $00000002;
  4024.  
  4025. (*
  4026.  * Move Overlay backward
  4027.  *)
  4028.   DDOVERZ_MOVEBACKWARD            = $00000003;
  4029.  
  4030. (*
  4031.  * Move Overlay in front of relative surface
  4032.  *)
  4033.   DDOVERZ_INSERTINFRONTOF         = $00000004;
  4034.  
  4035. (*
  4036.  * Move Overlay in back of relative surface
  4037.  *)
  4038.   DDOVERZ_INSERTINBACKOF          = $00000005;
  4039.  
  4040. (****************************************************************************
  4041.  *
  4042.  * DIRECTDRAW SETGAMMARAMP FLAGS
  4043.  *
  4044.  ****************************************************************************)
  4045.  
  4046. (*
  4047.  * Request calibrator to adjust the gamma ramp according to the physical
  4048.  * properties of the display so that the result should appear identical
  4049.  * on all systems.
  4050.  *)
  4051.   DDSGR_CALIBRATE                        = $00000001;
  4052.  
  4053. (****************************************************************************
  4054.  *
  4055.  * DIRECTDRAW STARTMODETEST FLAGS
  4056.  *
  4057.  ****************************************************************************)
  4058.  
  4059. (*
  4060.  * Indicates that the mode being tested has passed
  4061.  *)
  4062.  DDSMT_ISTESTREQUIRED                   = $00000001;
  4063.  
  4064.  
  4065. (****************************************************************************
  4066.  *
  4067.  * DIRECTDRAW EVALUATEMODE FLAGS
  4068.  *
  4069.  ****************************************************************************)
  4070.  
  4071. (*
  4072.  * Indicates that the mode being tested has passed
  4073.  *)
  4074.  DDEM_MODEPASSED                        = $00000001;
  4075.  
  4076. (*
  4077.  * Indicates that the mode being tested has failed
  4078.  *)
  4079.  DDEM_MODEFAILED                        = $00000002;
  4080.  
  4081. (*===========================================================================
  4082.  *
  4083.  *
  4084.  * DIRECTDRAW RETURN CODES
  4085.  *
  4086.  * The return values from DirectDraw Commands and Surface that return an HResult
  4087.  * are codes from DirectDraw concerning the results of the action
  4088.  * requested by DirectDraw.
  4089.  *
  4090.  *==========================================================================*)
  4091.  
  4092. (*
  4093.  * Status is OK
  4094.  *
  4095.  * Issued by: DirectDraw Commands and all callbacks
  4096.  *)
  4097.   DD_OK                                   = 0;
  4098.   DD_FALSE                                = S_FALSE;
  4099.  
  4100. (****************************************************************************
  4101.  *
  4102.  * DIRECTDRAW ENUMCALLBACK RETURN VALUES
  4103.  *
  4104.  * EnumCallback returns are used to control the flow of the DIRECTDRAW and
  4105.  * DIRECTDRAWSURFACE object enumerations.   They can only be returned by
  4106.  * enumeration callback routines.
  4107.  *
  4108.  ****************************************************************************)
  4109.  
  4110. (*
  4111.  * stop the enumeration
  4112.  *)
  4113.   DDENUMRET_CANCEL                        = 0;
  4114.  
  4115. (*
  4116.  * continue the enumeration
  4117.  *)
  4118.   DDENUMRET_OK                            = 1;
  4119.  
  4120. (****************************************************************************
  4121.  *
  4122.  * DIRECTDRAW ERRORS
  4123.  *
  4124.  * Errors are represented by negative values and cannot be combined.
  4125.  *
  4126.  ****************************************************************************)
  4127.  
  4128.   _FACDD = $876;
  4129.   MAKE_DDHRESULT = HResult(1 shl 31) or HResult(_FACDD shl 16);
  4130.  
  4131.  
  4132. (*
  4133.  * This object is already initialized
  4134.  *)
  4135.   DDERR_ALREADYINITIALIZED                = MAKE_DDHRESULT + 5;
  4136.  
  4137. (*
  4138.  * This surface can not be attached to the requested surface.
  4139.  *)
  4140.   DDERR_CANNOTATTACHSURFACE               = MAKE_DDHRESULT + 10;
  4141.  
  4142. (*
  4143.  * This surface can not be detached from the requested surface.
  4144.  *)
  4145.   DDERR_CANNOTDETACHSURFACE               = MAKE_DDHRESULT + 20;
  4146.  
  4147. (*
  4148.  * Support is currently not available.
  4149.  *)
  4150.   DDERR_CURRENTLYNOTAVAIL                 = MAKE_DDHRESULT + 40;
  4151.  
  4152. (*
  4153.  * An exception was encountered while performing the requested operation
  4154.  *)
  4155.   DDERR_EXCEPTION                         = MAKE_DDHRESULT + 55;
  4156.  
  4157. (*
  4158.  * Generic failure.
  4159.  *)
  4160.   DDERR_GENERIC                           = E_FAIL;
  4161.  
  4162. (*
  4163.  * Height of rectangle provided is not a multiple of reqd alignment
  4164.  *)
  4165.   DDERR_HEIGHTALIGN                       = MAKE_DDHRESULT + 90;
  4166.  
  4167. (*
  4168.  * Unable to match primary surface creation request with existing
  4169.  * primary surface.
  4170.  *)
  4171.   DDERR_INCOMPATIBLEPRIMARY               = MAKE_DDHRESULT + 95;
  4172.  
  4173. (*
  4174.  * One or more of the caps bits passed to the callback are incorrect.
  4175.  *)
  4176.   DDERR_INVALIDCAPS                       = MAKE_DDHRESULT + 100;
  4177.  
  4178. (*
  4179.  * DirectDraw does not support provided Cliplist.
  4180.  *)
  4181.   DDERR_INVALIDCLIPLIST                   = MAKE_DDHRESULT + 110;
  4182.  
  4183. (*
  4184.  * DirectDraw does not support the requested mode
  4185.  *)
  4186.   DDERR_INVALIDMODE                       = MAKE_DDHRESULT + 120;
  4187.  
  4188. (*
  4189.  * DirectDraw received a pointer that was an invalid DIRECTDRAW object.
  4190.  *)
  4191.   DDERR_INVALIDOBJECT                     = MAKE_DDHRESULT + 130;
  4192.  
  4193. (*
  4194.  * One or more of the parameters passed to the callback function are
  4195.  * incorrect.
  4196.  *)
  4197.   DDERR_INVALIDPARAMS                     = E_INVALIDARG;
  4198.  
  4199. (*
  4200.  * pixel format was invalid as specified
  4201.  *)
  4202.   DDERR_INVALIDPIXELFORMAT                = MAKE_DDHRESULT + 145;
  4203.  
  4204. (*
  4205.  * Rectangle provided was invalid.
  4206.  *)
  4207.   DDERR_INVALIDRECT                       = MAKE_DDHRESULT + 150;
  4208.  
  4209. (*
  4210.  * Operation could not be carried out because one or more surfaces are locked
  4211.  *)
  4212.   DDERR_LOCKEDSURFACES                    = MAKE_DDHRESULT + 160;
  4213.  
  4214. (*
  4215.  * There is no 3D present.
  4216.  *)
  4217.   DDERR_NO3D                              = MAKE_DDHRESULT + 170;
  4218.  
  4219. (*
  4220.  * Operation could not be carried out because there is no alpha accleration
  4221.  * hardware present or available.
  4222.  *)
  4223.   DDERR_NOALPHAHW                         = MAKE_DDHRESULT + 180;
  4224.  
  4225. (*
  4226.  * Operation could not be carried out because there is no stereo
  4227.  * hardware present or available.
  4228.  *)
  4229.   DDERR_NOSTEREOHARDWARE          = MAKE_DDHRESULT + 181;
  4230.  
  4231. (*
  4232.  * Operation could not be carried out because there is no hardware
  4233.  * present which supports stereo surfaces
  4234.  *)
  4235.   DDERR_NOSURFACELEFT             = MAKE_DDHRESULT + 182;
  4236.  
  4237. (*
  4238.  * no clip list available
  4239.  *)
  4240.   DDERR_NOCLIPLIST                        = MAKE_DDHRESULT + 205;
  4241.  
  4242. (*
  4243.  * Operation could not be carried out because there is no color conversion
  4244.  * hardware present or available.
  4245.  *)
  4246.   DDERR_NOCOLORCONVHW                     = MAKE_DDHRESULT + 210;
  4247.  
  4248. (*
  4249.  * Create function called without DirectDraw object method SetCooperativeLevel
  4250.  * being called.
  4251.  *)
  4252.   DDERR_NOCOOPERATIVELEVELSET             = MAKE_DDHRESULT + 212;
  4253.  
  4254. (*
  4255.  * Surface doesn't currently have a color key
  4256.  *)
  4257.   DDERR_NOCOLORKEY                        = MAKE_DDHRESULT + 215;
  4258.  
  4259. (*
  4260.  * Operation could not be carried out because there is no hardware support
  4261.  * of the dest color key.
  4262.  *)
  4263.   DDERR_NOCOLORKEYHW                      = MAKE_DDHRESULT + 220;
  4264.  
  4265. (*
  4266.  * No DirectDraw support possible with current display driver
  4267.  *)
  4268.   DDERR_NODIRECTDRAWSUPPORT               = MAKE_DDHRESULT + 222;
  4269.  
  4270. (*
  4271.  * Operation requires the application to have exclusive mode but the
  4272.  * application does not have exclusive mode.
  4273.  *)
  4274.   DDERR_NOEXCLUSIVEMODE                   = MAKE_DDHRESULT + 225;
  4275.  
  4276. (*
  4277.  * Flipping visible surfaces is not supported.
  4278.  *)
  4279.   DDERR_NOFLIPHW                          = MAKE_DDHRESULT + 230;
  4280.  
  4281. (*
  4282.  * There is no GDI present.
  4283.  *)
  4284.   DDERR_NOGDI                             = MAKE_DDHRESULT + 240;
  4285.  
  4286. (*
  4287.  * Operation could not be carried out because there is no hardware present
  4288.  * or available.
  4289.  *)
  4290.   DDERR_NOMIRRORHW                        = MAKE_DDHRESULT + 250;
  4291.  
  4292. (*
  4293.  * Requested item was not found
  4294.  *)
  4295.   DDERR_NOTFOUND                          = MAKE_DDHRESULT + 255;
  4296.  
  4297. (*
  4298.  * Operation could not be carried out because there is no overlay hardware
  4299.  * present or available.
  4300.  *)
  4301.   DDERR_NOOVERLAYHW                       = MAKE_DDHRESULT + 260;
  4302.  
  4303. (*
  4304.  * Operation could not be carried out because the source and destination
  4305.  * rectangles are on the same surface and overlap each other.
  4306.  *)
  4307.   DDERR_OVERLAPPINGRECTS                = MAKE_DDHRESULT + 270;
  4308.  
  4309. (*
  4310.  * Operation could not be carried out because there is no appropriate raster
  4311.  * op hardware present or available.
  4312.  *)
  4313.   DDERR_NORASTEROPHW                      = MAKE_DDHRESULT + 280;
  4314.  
  4315. (*
  4316.  * Operation could not be carried out because there is no rotation hardware
  4317.  * present or available.
  4318.  *)
  4319.   DDERR_NOROTATIONHW                      = MAKE_DDHRESULT + 290;
  4320.  
  4321. (*
  4322.  * Operation could not be carried out because there is no hardware support
  4323.  * for stretching
  4324.  *)
  4325.   DDERR_NOSTRETCHHW                       = MAKE_DDHRESULT + 310;
  4326.  
  4327. (*
  4328.  * DirectDrawSurface is not in 4 bit color palette and the requested operation
  4329.  * requires 4 bit color palette.
  4330.  *)
  4331.   DDERR_NOT4BITCOLOR                      = MAKE_DDHRESULT + 316;
  4332.  
  4333. (*
  4334.  * DirectDrawSurface is not in 4 bit color index palette and the requested
  4335.  * operation requires 4 bit color index palette.
  4336.  *)
  4337.   DDERR_NOT4BITCOLORINDEX                 = MAKE_DDHRESULT + 317;
  4338.  
  4339. (*
  4340.  * DirectDraw Surface is not in 8 bit color mode and the requested operation
  4341.  * requires 8 bit color.
  4342.  *)
  4343.   DDERR_NOT8BITCOLOR                      = MAKE_DDHRESULT + 320;
  4344.  
  4345. (*
  4346.  * Operation could not be carried out because there is no texture mapping
  4347.  * hardware present or available.
  4348.  *)
  4349.   DDERR_NOTEXTUREHW                       = MAKE_DDHRESULT + 330;
  4350.  
  4351. (*
  4352.  * Operation could not be carried out because there is no hardware support
  4353.  * for vertical blank synchronized operations.
  4354.  *)
  4355.   DDERR_NOVSYNCHW                         = MAKE_DDHRESULT + 335;
  4356.  
  4357. (*
  4358.  * Operation could not be carried out because there is no hardware support
  4359.  * for zbuffer blting.
  4360.  *)
  4361.   DDERR_NOZBUFFERHW                       = MAKE_DDHRESULT + 340;
  4362.  
  4363. (*
  4364.  * Overlay surfaces could not be z layered based on their BltOrder because
  4365.  * the hardware does not support z layering of overlays.
  4366.  *)
  4367.   DDERR_NOZOVERLAYHW                      = MAKE_DDHRESULT + 350;
  4368.  
  4369. (*
  4370.  * The hardware needed for the requested operation has already been
  4371.  * allocated.
  4372.  *)
  4373.   DDERR_OUTOFCAPS                         = MAKE_DDHRESULT + 360;
  4374.  
  4375. (*
  4376.  * DirectDraw does not have enough memory to perform the operation.
  4377.  *)
  4378.   DDERR_OUTOFMEMORY                       = E_OUTOFMEMORY;
  4379.  
  4380. (*
  4381.  * DirectDraw does not have enough memory to perform the operation.
  4382.  *)
  4383.   DDERR_OUTOFVIDEOMEMORY                  = MAKE_DDHRESULT + 380;
  4384.  
  4385. (*
  4386.  * hardware does not support clipped overlays
  4387.  *)
  4388.   DDERR_OVERLAYCANTCLIP                   = MAKE_DDHRESULT + 382;
  4389.  
  4390. (*
  4391.  * Can only have ony color key active at one time for overlays
  4392.  *)
  4393.   DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = MAKE_DDHRESULT + 384;
  4394.  
  4395. (*
  4396.  * Access to this palette is being refused because the palette is already
  4397.  * locked by another thread.
  4398.  *)
  4399.   DDERR_PALETTEBUSY                       = MAKE_DDHRESULT + 387;
  4400.  
  4401. (*
  4402.  * No src color key specified for this operation.
  4403.  *)
  4404.   DDERR_COLORKEYNOTSET                    = MAKE_DDHRESULT + 400;
  4405.  
  4406. (*
  4407.  * This surface is already attached to the surface it is being attached to.
  4408.  *)
  4409.   DDERR_SURFACEALREADYATTACHED            = MAKE_DDHRESULT + 410;
  4410.  
  4411. (*
  4412.  * This surface is already a dependency of the surface it is being made a
  4413.  * dependency of.
  4414.  *)
  4415.   DDERR_SURFACEALREADYDEPENDENT           = MAKE_DDHRESULT + 420;
  4416.  
  4417. (*
  4418.  * Access to this surface is being refused because the surface is already
  4419.  * locked by another thread.
  4420.  *)
  4421.   DDERR_SURFACEBUSY                       = MAKE_DDHRESULT + 430;
  4422.  
  4423. (*
  4424.  * Access to this surface is being refused because no driver exists
  4425.  * which can supply a pointer to the surface.
  4426.  * This is most likely to happen when attempting to lock the primary
  4427.  * surface when no DCI provider is present.
  4428.  * Will also happen on attempts to lock an optimized surface.
  4429.  *)
  4430.   DDERR_CANTLOCKSURFACE                   = MAKE_DDHRESULT + 435;
  4431.  
  4432. (*
  4433.  * Access to Surface refused because Surface is obscured.
  4434.  *)
  4435.   DDERR_SURFACEISOBSCURED                 = MAKE_DDHRESULT + 440;
  4436.  
  4437. (*
  4438.  * Access to this surface is being refused because the surface is gone.
  4439.  * The DIRECTDRAWSURFACE object representing this surface should
  4440.  * have Restore called on it.
  4441.  *)
  4442.   DDERR_SURFACELOST                       = MAKE_DDHRESULT + 450;
  4443.  
  4444. (*
  4445.  * The requested surface is not attached.
  4446.  *)
  4447.   DDERR_SURFACENOTATTACHED                = MAKE_DDHRESULT + 460;
  4448.  
  4449. (*
  4450.  * Height requested by DirectDraw is too large.
  4451.  *)
  4452.   DDERR_TOOBIGHEIGHT                      = MAKE_DDHRESULT + 470;
  4453.  
  4454. (*
  4455.  * Size requested by DirectDraw is too large --  The individual height and
  4456.  * width are OK.
  4457.  *)
  4458.   DDERR_TOOBIGSIZE                        = MAKE_DDHRESULT + 480;
  4459.  
  4460. (*
  4461.  * Width requested by DirectDraw is too large.
  4462.  *)
  4463.   DDERR_TOOBIGWIDTH                       = MAKE_DDHRESULT + 490;
  4464.  
  4465. (*
  4466.  * Action not supported.
  4467.  *)
  4468.   DDERR_UNSUPPORTED                       = E_NOTIMPL;
  4469.  
  4470. (*
  4471.  * FOURCC format requested is unsupported by DirectDraw
  4472.  *)
  4473.   DDERR_UNSUPPORTEDFORMAT                 = MAKE_DDHRESULT + 510;
  4474.  
  4475. (*
  4476.  * Bitmask in the pixel format requested is unsupported by DirectDraw
  4477.  *)
  4478.   DDERR_UNSUPPORTEDMASK                   = MAKE_DDHRESULT + 520;
  4479.  
  4480. (*
  4481.  * The specified stream contains invalid data
  4482.  *)
  4483.   DDERR_INVALIDSTREAM                     = MAKE_DDHRESULT + 521;
  4484.  
  4485. (*
  4486.  * vertical blank is in progress
  4487.  *)
  4488.   DDERR_VERTICALBLANKINPROGRESS           = MAKE_DDHRESULT + 537;
  4489.  
  4490. (*
  4491.  * Informs DirectDraw that the previous Blt which is transfering information
  4492.  * to or from this Surface is incomplete.
  4493.  *)
  4494.   DDERR_WASSTILLDRAWING                   = MAKE_DDHRESULT + 540;
  4495.  
  4496. (*
  4497.  * The specified surface type requires specification of the COMPLEX flag
  4498.  *)
  4499.   DDERR_DDSCAPSCOMPLEXREQUIRED            = MAKE_DDHRESULT + 542;
  4500.  
  4501. (*
  4502.  * Rectangle provided was not horizontally aligned on reqd. boundary
  4503.  *)
  4504.   DDERR_XALIGN                            = MAKE_DDHRESULT + 560;
  4505.  
  4506. (*
  4507.  * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver
  4508.  * identifier.
  4509.  *)
  4510.   DDERR_INVALIDDIRECTDRAWGUID             = MAKE_DDHRESULT + 561;
  4511.  
  4512. (*
  4513.  * A DirectDraw object representing this driver has already been created
  4514.  * for this process.
  4515.  *)
  4516.   DDERR_DIRECTDRAWALREADYCREATED          = MAKE_DDHRESULT + 562;
  4517.  
  4518. (*
  4519.  * A hardware only DirectDraw object creation was attempted but the driver
  4520.  * did not support any hardware.
  4521.  *)
  4522.   DDERR_NODIRECTDRAWHW                    = MAKE_DDHRESULT + 563;
  4523.  
  4524. (*
  4525.  * this process already has created a primary surface
  4526.  *)
  4527.   DDERR_PRIMARYSURFACEALREADYEXISTS       = MAKE_DDHRESULT + 564;
  4528.  
  4529. (*
  4530.  * software emulation not available.
  4531.  *)
  4532.   DDERR_NOEMULATION                       = MAKE_DDHRESULT + 565;
  4533.  
  4534. (*
  4535.  * region passed to Clipper::GetClipList is too small.
  4536.  *)
  4537.   DDERR_REGIONTOOSMALL                    = MAKE_DDHRESULT + 566;
  4538.  
  4539. (*
  4540.  * an attempt was made to set a clip list for a clipper objec that
  4541.  * is already monitoring an hwnd.
  4542.  *)
  4543.   DDERR_CLIPPERISUSINGHWND                = MAKE_DDHRESULT + 567;
  4544.  
  4545. (*
  4546.  * No clipper object attached to surface object
  4547.  *)
  4548.   DDERR_NOCLIPPERATTACHED                 = MAKE_DDHRESULT + 568;
  4549.  
  4550. (*
  4551.  * Clipper notification requires an HWND or
  4552.  * no HWND has previously been set as the CooperativeLevel HWND.
  4553.  *)
  4554.   DDERR_NOHWND                            = MAKE_DDHRESULT + 569;
  4555.  
  4556. (*
  4557.  * HWND used by DirectDraw CooperativeLevel has been subclassed,
  4558.  * this prevents DirectDraw from restoring state.
  4559.  *)
  4560.   DDERR_HWNDSUBCLASSED                    = MAKE_DDHRESULT + 570;
  4561.  
  4562. (*
  4563.  * The CooperativeLevel HWND has already been set.
  4564.  * It can not be reset while the process has surfaces or palettes created.
  4565.  *)
  4566.   DDERR_HWNDALREADYSET                    = MAKE_DDHRESULT + 571;
  4567.  
  4568. (*
  4569.  * No palette object attached to this surface.
  4570.  *)
  4571.   DDERR_NOPALETTEATTACHED                 = MAKE_DDHRESULT + 572;
  4572.  
  4573. (*
  4574.  * No hardware support for 16 or 256 color palettes.
  4575.  *)
  4576.   DDERR_NOPALETTEHW                       = MAKE_DDHRESULT + 573;
  4577.  
  4578. (*
  4579.  * If a clipper object is attached to the source surface passed into a
  4580.  * BltFast call.
  4581.  *)
  4582.   DDERR_BLTFASTCANTCLIP                   = MAKE_DDHRESULT + 574;
  4583.  
  4584. (*
  4585.  * No blter.
  4586.  *)
  4587.   DDERR_NOBLTHW                           = MAKE_DDHRESULT + 575;
  4588.  
  4589. (*
  4590.  * No DirectDraw ROP hardware.
  4591.  *)
  4592.   DDERR_NODDROPSHW                        = MAKE_DDHRESULT + 576;
  4593.  
  4594. (*
  4595.  * returned when GetOverlayPosition is called on a hidden overlay
  4596.  *)
  4597.   DDERR_OVERLAYNOTVISIBLE                 = MAKE_DDHRESULT + 577;
  4598.  
  4599. (*
  4600.  * returned when GetOverlayPosition is called on a overlay that UpdateOverlay
  4601.  * has never been called on to establish a destionation.
  4602.  *)
  4603.   DDERR_NOOVERLAYDEST                     = MAKE_DDHRESULT + 578;
  4604.  
  4605. (*
  4606.  * returned when the position of the overlay on the destionation is no longer
  4607.  * legal for that destionation.
  4608.  *)
  4609.   DDERR_INVALIDPOSITION                   = MAKE_DDHRESULT + 579;
  4610.  
  4611. (*
  4612.  * returned when an overlay member is called for a non-overlay surface
  4613.  *)
  4614.   DDERR_NOTAOVERLAYSURFACE                = MAKE_DDHRESULT + 580;
  4615.  
  4616. (*
  4617.  * An attempt was made to set the cooperative level when it was already
  4618.  * set to exclusive.
  4619.  *)
  4620.   DDERR_EXCLUSIVEMODEALREADYSET           = MAKE_DDHRESULT + 581;
  4621.  
  4622. (*
  4623.  * An attempt has been made to flip a surface that is not flippable.
  4624.  *)
  4625.   DDERR_NOTFLIPPABLE                      = MAKE_DDHRESULT + 582;
  4626.  
  4627. (*
  4628.  * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly
  4629.  * created.
  4630.  *)
  4631.   DDERR_CANTDUPLICATE                     = MAKE_DDHRESULT + 583;
  4632.  
  4633. (*
  4634.  * Surface was not locked.  An attempt to unlock a surface that was not
  4635.  * locked at all, or by this process, has been attempted.
  4636.  *)
  4637.   DDERR_NOTLOCKED                         = MAKE_DDHRESULT + 584;
  4638.  
  4639. (*
  4640.  * Windows can not create any more DCs, or a DC was requested for a paltte-indexed
  4641.  * surface when the surface had no palette AND the display mode was not palette-indexed
  4642.  * (in this case DirectDraw cannot select a proper palette into the DC)
  4643.  *)
  4644.   DDERR_CANTCREATEDC                      = MAKE_DDHRESULT + 585;
  4645.  
  4646. (*
  4647.  * No DC was ever created for this surface.
  4648.  *)
  4649.   DDERR_NODC                              = MAKE_DDHRESULT + 586;
  4650.  
  4651. (*
  4652.  * This surface can not be restored because it was created in a different
  4653.  * mode.
  4654.  *)
  4655.   DDERR_WRONGMODE                         = MAKE_DDHRESULT + 587;
  4656.  
  4657. (*
  4658.  * This surface can not be restored because it is an implicitly created
  4659.  * surface.
  4660.  *)
  4661.   DDERR_IMPLICITLYCREATED                 = MAKE_DDHRESULT + 588;
  4662.  
  4663. (*
  4664.  * The surface being used is not a palette-based surface
  4665.  *)
  4666.   DDERR_NOTPALETTIZED                     = MAKE_DDHRESULT + 589;
  4667.  
  4668. (*
  4669.  * The display is currently in an unsupported mode
  4670.  *)
  4671.   DDERR_UNSUPPORTEDMODE                   = MAKE_DDHRESULT + 590;
  4672.  
  4673. (*
  4674.  * Operation could not be carried out because there is no mip-map
  4675.  * texture mapping hardware present or available.
  4676.  *)
  4677.   DDERR_NOMIPMAPHW                        = MAKE_DDHRESULT + 591;
  4678.  
  4679. (*
  4680.  * The requested action could not be performed because the surface was of
  4681.  * the wrong type.
  4682.  *)
  4683.   DDERR_INVALIDSURFACETYPE                = MAKE_DDHRESULT + 592;
  4684.  
  4685. (*
  4686.  * Device does not support optimized surfaces, therefore no video memory optimized surfaces
  4687.  *)
  4688.   DDERR_NOOPTIMIZEHW                      = MAKE_DDHRESULT + 600;
  4689.  
  4690. (*
  4691.  * Surface is an optimized surface, but has not yet been allocated any memory
  4692.  *)
  4693.   DDERR_NOTLOADED                         = MAKE_DDHRESULT + 601;
  4694.  
  4695. (*
  4696.  * Attempt was made to create or set a device window without first setting
  4697.  * the focus window
  4698.  *)
  4699.   DDERR_NOFOCUSWINDOW                     = MAKE_DDHRESULT + 602;
  4700.  
  4701. (*
  4702.  * Attempt was made to set a palette on a mipmap sublevel
  4703.  *)
  4704.   DDERR_NOTONMIPMAPSUBLEVEL               = MAKE_DDHRESULT + 603;
  4705.  
  4706. (*
  4707.  * A DC has already been returned for this surface. Only one DC can be
  4708.  * retrieved per surface.
  4709.  *)
  4710.   DDERR_DCALREADYCREATED                  = MAKE_DDHRESULT + 620;
  4711.  
  4712. (*
  4713.  * An attempt was made to allocate non-local video memory from a device
  4714.  * that does not support non-local video memory.
  4715.  *)
  4716.   DDERR_NONONLOCALVIDMEM                  = MAKE_DDHRESULT + 630;
  4717.  
  4718. (*
  4719.  * The attempt to page lock a surface failed.
  4720.  *)
  4721.   DDERR_CANTPAGELOCK                      = MAKE_DDHRESULT + 640;
  4722.  
  4723. (*
  4724.  * The attempt to page unlock a surface failed.
  4725.  *)
  4726.   DDERR_CANTPAGEUNLOCK                    = MAKE_DDHRESULT + 660;
  4727.  
  4728. (*
  4729.  * An attempt was made to page unlock a surface with no outstanding page locks.
  4730.  *)
  4731.   DDERR_NOTPAGELOCKED                     = MAKE_DDHRESULT + 680;
  4732.  
  4733. (*
  4734.  * There is more data available than the specified buffer size could hold
  4735.  *)
  4736.   DDERR_MOREDATA                                = MAKE_DDHRESULT + 690;
  4737.  
  4738. (*
  4739.  * The data has expired and is therefore no longer valid.
  4740.  *)
  4741.   DDERR_EXPIRED                           = MAKE_DDHRESULT + 691;
  4742.  
  4743. (*
  4744.  * The mode test has finished executing.
  4745.  *)
  4746.  DDERR_TESTFINISHED                      = MAKE_DDHRESULT + 692;
  4747.  
  4748. (*
  4749.  * The mode test has switched to a new mode.
  4750.  *)
  4751.  DDERR_NEWMODE                           = MAKE_DDHRESULT + 693;
  4752.  
  4753. (*
  4754.  * D3D has not yet been initialized.
  4755.  *)
  4756.  DDERR_D3DNOTINITIALIZED                 = MAKE_DDHRESULT + 694;
  4757.  
  4758. (*
  4759.  * The video port is not active
  4760.  *)
  4761.   DDERR_VIDEONOTACTIVE                          = MAKE_DDHRESULT + 695;
  4762.  
  4763. (*
  4764.  * The monitor does not have EDID data.
  4765.  *)
  4766.  DDERR_NOMONITORINFORMATION             = MAKE_DDHRESULT + 696;
  4767.  
  4768. (*
  4769.  * The driver does not enumerate display mode refresh rates.
  4770.  *)
  4771.  DDERR_NODRIVERSUPPORT                  = MAKE_DDHRESULT + 697;
  4772.  
  4773. (*
  4774.  * Surfaces created by one direct draw device cannot be used directly by
  4775.  * another direct draw device.
  4776.  *)
  4777.   DDERR_DEVICEDOESNTOWNSURFACE                  = MAKE_DDHRESULT + 699;
  4778.  
  4779. (*
  4780.  * An attempt was made to invoke an interface member of a DirectDraw object
  4781.  * created by CoCreateInstance() before it was initialized.
  4782.  *)
  4783.   DDERR_NOTINITIALIZED                    = CO_E_NOTINITIALIZED;
  4784.  
  4785. (* Alpha bit depth constants *)
  4786.  
  4787. (*
  4788.  * API's
  4789.  *)
  4790.  
  4791. type
  4792.   HMonitor = THandle;
  4793.  
  4794.   TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
  4795.       lpDriverName: PAnsiChar; lpContext: Pointer) : BOOL; stdcall;
  4796.   TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
  4797.       lpDriverName: PWideChar; lpContext: Pointer) : BOOL; stdcall;
  4798. {$IFDEF UNICODE}
  4799.   TDDEnumCallback = TDDEnumCallbackW;
  4800. {$ELSE}
  4801.   TDDEnumCallback = TDDEnumCallbackA;
  4802. {$ENDIF}
  4803.  
  4804.   TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
  4805.       lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
  4806.       stdcall;
  4807.   TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
  4808.       lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
  4809.       stdcall;
  4810.      
  4811. {$IFDEF UNICODE}
  4812.   TDDEnumCallbackEx = TDDEnumCallbackExW;
  4813. {$ELSE}
  4814.   TDDEnumCallbackEx = TDDEnumCallbackExA;
  4815. {$ENDIF}
  4816.  
  4817. var
  4818.   DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA;
  4819.        lpContext: Pointer) : HResult; stdcall;
  4820.   DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW;
  4821.        lpContext: Pointer) : HResult; stdcall;
  4822.   DirectDrawEnumerate : function (lpCallback: TDDEnumCallback;
  4823.        lpContext: Pointer) : HResult; stdcall;
  4824.  
  4825.   DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA;
  4826.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4827.   DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW;
  4828.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4829.   DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx;
  4830.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4831.  
  4832.   DirectDrawCreate : function (lpGUID: PGUID;
  4833.        out lplpDD: IDirectDraw;
  4834.        pUnkOuter: IUnknown) : HResult; stdcall;
  4835.   DirectDrawCreateEx : function  (lpGUID: PGUID;
  4836.        out lplpDD: IDirectDraw7; const iid: TGUID;
  4837.        pUnkOuter: IUnknown) : HResult; stdcall;
  4838.   DirectDrawCreateClipper : function (dwFlags: DWORD;
  4839.        out lplpDDClipper: IDirectDrawClipper;
  4840.        pUnkOuter: IUnknown) : HResult; stdcall;
  4841.  
  4842. const
  4843. (*
  4844.  * Flags for DirectDrawEnumerateEx
  4845.  * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to
  4846.  * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx.
  4847.  * By default, only the primary display device is enumerated.
  4848.  * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES)
  4849.  *)
  4850.  
  4851. (*
  4852.  * This flag causes enumeration of any GDI display devices which are part of
  4853.  * the Windows Desktop
  4854.  *)
  4855.   DDENUM_ATTACHEDSECONDARYDEVICES     = $00000001;
  4856.  
  4857. (*
  4858.  * This flag causes enumeration of any GDI display devices which are not
  4859.  * part of the Windows Desktop
  4860.  *)
  4861.   DDENUM_DETACHEDSECONDARYDEVICES     = $00000002;
  4862.  
  4863. (*
  4864.  * This flag causes enumeration of non-display devices
  4865.  *)
  4866.   DDENUM_NONDISPLAYDEVICES            = $00000004;
  4867.  
  4868.   REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
  4869.   REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
  4870.   REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
  4871.  
  4872.   DDCREATE_HARDWAREONLY       = $00000001;
  4873.   DDCREATE_EMULATIONONLY      = $00000002;
  4874.  
  4875. (*
  4876.  * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel
  4877.  *)
  4878. function GET_WHQL_YEAR(dwWHQLLevel: DWORD) : DWORD;
  4879. function GET_WHQL_MONTH(dwWHQLLevel: DWORD) : DWORD;
  4880. function GET_WHQL_DAY(dwWHQLLevel: DWORD) : DWORD;
  4881.  
  4882.  
  4883. (*==========================================================================;
  4884.  *
  4885.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  4886.  *
  4887.  *  File:       dvp.h
  4888.  *  Content:    DirectDrawVideoPort include file
  4889.  *
  4890.  ***************************************************************************)
  4891.  
  4892. const
  4893. (*
  4894.  * GUIDS used by DirectDrawVideoPort objects
  4895.  *)
  4896.   DDVPTYPE_E_HREFH_VREFH: TGUID =
  4897.       (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4898.   DDVPTYPE_E_HREFH_VREFL: TGUID =
  4899.       (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4900.   DDVPTYPE_E_HREFL_VREFH: TGUID =
  4901.       (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4902.   DDVPTYPE_E_HREFL_VREFL: TGUID =
  4903.       (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4904.   DDVPTYPE_CCIR656: TGUID =
  4905.       (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4906.   DDVPTYPE_BROOKTREE: TGUID =
  4907.       (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4908.   DDVPTYPE_PHILIPS: TGUID =
  4909.       (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4910.  
  4911. (*
  4912.  * GUIDS used to describe connections
  4913.  *)
  4914.  
  4915. (*============================================================================
  4916.  *
  4917.  * DirectDraw Structures
  4918.  *
  4919.  * Various structures used to invoke DirectDraw.
  4920.  *
  4921.  *==========================================================================*)
  4922.  
  4923. type
  4924.  
  4925. (*
  4926.  * TDDVideoPortConnect
  4927.  *)
  4928.   PDDVideoPortConnect = ^TDDVideoPortConnect;
  4929.   TDDVideoPortConnect = packed record
  4930.     dwSize: DWORD;        // size of the TDDVideoPortConnect structure
  4931.     dwPortWidth: DWORD;   // Width of the video port
  4932.     guidTypeID: TGUID;    // Description of video port connection
  4933.     dwFlags: DWORD;       // Connection flags
  4934.     dwReserved1: DWORD;   // Reserved, set to zero.
  4935.   end;
  4936.  
  4937. (*
  4938.  * TDDVideoPortCaps
  4939.  *)
  4940.   PDDVideoPortCaps = ^TDDVideoPortCaps;
  4941.   TDDVideoPortCaps = packed record
  4942.     dwSize: DWORD;                          // size of the TDDVideoPortCaps structure
  4943.     dwFlags: DWORD;                         // indicates which fields contain data
  4944.     dwMaxWidth: DWORD;                      // max width of the video port field
  4945.     dwMaxVBIWidth: DWORD;                   // max width of the VBI data
  4946.     dwMaxHeight: DWORD;                     // max height of the video port field
  4947.     dwVideoPortID: DWORD;                   // Video port ID (0 - (dwMaxVideoPorts -1))
  4948.     dwCaps: DWORD;                          // Video port capabilities
  4949.     dwFX: DWORD;                            // More video port capabilities
  4950.     dwNumAutoFlipSurfaces: DWORD;           // Number of autoflippable surfaces
  4951.     dwAlignVideoPortBoundary: DWORD;        // Byte restriction of placement within the surface
  4952.     dwAlignVideoPortPrescaleWidth: DWORD;   // Byte restriction of width after prescaling
  4953.     dwAlignVideoPortCropBoundary: DWORD;    // Byte restriction of left cropping
  4954.     dwAlignVideoPortCropWidth: DWORD;       // Byte restriction of cropping width
  4955.     dwPreshrinkXStep: DWORD;                // Width can be shrunk in steps of 1/x
  4956.     dwPreshrinkYStep: DWORD;                // Height can be shrunk in steps of 1/x
  4957.     dwNumVBIAutoFlipSurfaces: DWORD;        // Number of VBI autoflippable surfaces
  4958.     dwNumPreferredAutoflip: DWORD;      // Optimal number of autoflippable surfaces for hardware
  4959.     wNumFilterTapsX: WORD;              // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.)
  4960.     wNumFilterTapsY: WORD;              // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.)
  4961.   end;
  4962.  
  4963. const
  4964. (*
  4965.  * The dwMaxWidth and dwMaxVBIWidth members are valid
  4966.  *)
  4967.   DDVPD_WIDTH = $00000001;
  4968.  
  4969. (*
  4970.  * The dwMaxHeight member is valid
  4971.  *)
  4972.   DDVPD_HEIGHT = $00000002;
  4973.  
  4974. (*
  4975.  * The dwVideoPortID member is valid
  4976.  *)
  4977.   DDVPD_ID = $00000004;
  4978.  
  4979. (*
  4980.  * The dwCaps member is valid
  4981.  *)
  4982.   DDVPD_CAPS = $00000008;
  4983.  
  4984. (*
  4985.  * The dwFX member is valid
  4986.  *)
  4987.   DDVPD_FX = $00000010;
  4988.  
  4989. (*
  4990.  * The dwNumAutoFlipSurfaces member is valid
  4991.  *)
  4992.   DDVPD_AUTOFLIP = $00000020;
  4993.  
  4994. (*
  4995.  * All of the alignment members are valid
  4996.  *)
  4997.   DDVPD_ALIGN = $00000040;
  4998.  
  4999. (*
  5000.  * The dwNumPreferredAutoflip member is valid
  5001.  *)
  5002.   DDVPD_PREFERREDAUTOFLIP = $00000080;
  5003.  
  5004. (*
  5005.  * The wNumFilterTapsX and wNumFilterTapsY fields are valid
  5006.  *)
  5007.   DDVPD_FILTERQUALITY     = $00000100;
  5008.  
  5009. type
  5010. (*
  5011.  * TDDVideoPortDesc
  5012.  *)
  5013.   PDDVideoPortDesc = ^TDDVideoPortDesc;
  5014.   TDDVideoPortDesc = packed record
  5015.     dwSize: DWORD;                       // size of the TDDVideoPortDesc structure
  5016.     dwFieldWidth: DWORD;                 // width of the video port field
  5017.     dwVBIWidth: DWORD;                   // width of the VBI data
  5018.     dwFieldHeight: DWORD;                // height of the video port field
  5019.     dwMicrosecondsPerField: DWORD;       // Microseconds per video field
  5020.     dwMaxPixelsPerSecond: DWORD;         // Maximum pixel rate per second
  5021.     dwVideoPortID: DWORD;                // Video port ID (0 - (dwMaxVideoPorts -1))
  5022.     dwReserved1: DWORD;                  // Reserved for future use - set to zero
  5023.     VideoPortType: TDDVideoPortConnect;  // Description of video port connection
  5024.     dwReserved2: DWORD;                  // Reserved for future use - set to zero
  5025.     dwReserved3: DWORD;                  // Reserved for future use - set to zero
  5026.   end;
  5027.  
  5028. (*
  5029.  * TDDVideoPortInfo
  5030.  *)
  5031.   PDDVideoPortInfo = ^TDDVideoPortInfo;
  5032.   TDDVideoPortInfo = packed record
  5033.     dwSize: DWORD;                            // Size of the structure
  5034.     dwOriginX: DWORD;                         // Placement of the video data within the surface.
  5035.     dwOriginY: DWORD;                         // Placement of the video data within the surface.
  5036.     dwVPFlags: DWORD;                         // Video port options
  5037.     rCrop: TRect;                             // Cropping rectangle (optional).
  5038.     dwPrescaleWidth: DWORD;                   // Determines pre-scaling/zooming in the X direction (optional).
  5039.     dwPrescaleHeight: DWORD;                  // Determines pre-scaling/zooming in the Y direction (optional).
  5040.     lpddpfInputFormat: PDDPixelFormat;       // Video format written to the video port
  5041.     lpddpfVBIInputFormat: PDDPixelFormat;    // Input format of the VBI data
  5042.     lpddpfVBIOutputFormat: PDDPixelFormat;   // Output format of the data
  5043.     dwVBIHeight: DWORD;                       // Specifies the number of lines of data within the vertical blanking interval.
  5044.     dwReserved1: DWORD;                       // Reserved for future use - set to zero
  5045.     dwReserved2: DWORD;                       // Reserved for future use - set to zero
  5046.   end;
  5047.  
  5048. (*
  5049.  * TDDVideoPortBandWidth
  5050.  *)
  5051.   PDDVideoPortBandWidth = ^TDDVideoPortBandWidth;
  5052.   TDDVideoPortBandWidth = packed record
  5053.     dwSize: DWORD;                 // Size of the structure
  5054.     dwCaps: DWORD;
  5055.     dwOverlay: DWORD;              // Zoom factor at which overlay is supported
  5056.     dwColorkey: DWORD;             // Zoom factor at which overlay w/ colorkey is supported
  5057.     dwYInterpolate: DWORD;         // Zoom factor at which overlay w/ Y interpolation is supported
  5058.     dwYInterpAndColorkey: DWORD;   // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
  5059.     dwReserved1: DWORD;            // Reserved for future use - set to zero
  5060.     dwReserved2: DWORD;            // Reserved for future use - set to zero
  5061.   end;
  5062.  
  5063. (*
  5064.  * TDDVideoPortStatus
  5065.  *)
  5066.   PDDVideoPortStatus = ^TDDVideoPortStatus;
  5067.   TDDVideoPortStatus = record
  5068.     dwSize: DWORD;                       // Size of the structure
  5069.     bInUse: BOOL;                        // TRUE if video port is currently being used
  5070.     dwFlags: DWORD;                      // Currently not used
  5071.     dwReserved1: DWORD;                  // Reserved for future use
  5072.     VideoPortType: TDDVideoPortConnect;  // Information about the connection
  5073.     dwReserved2: DWORD;                  // Reserved for future use
  5074.     dwReserved3: DWORD;                  // Reserved for future use
  5075.   end;
  5076.  
  5077. const
  5078. (*============================================================================
  5079.  *
  5080.  * Video Port Flags
  5081.  *
  5082.  * All flags are bit flags.
  5083.  *
  5084.  *==========================================================================*)
  5085.  
  5086. (****************************************************************************
  5087.  *
  5088.  * VIDEOPORT TDDVideoPortConnect FLAGS
  5089.  *
  5090.  ****************************************************************************)
  5091.  
  5092. (*
  5093.  * When this is set by the driver and passed to the client, this
  5094.  * indicates that the video port is capable of double clocking the data.
  5095.  * When this is set by the client, this indicates that the video port
  5096.  * should enable double clocking.  This flag is only valid with external
  5097.  * syncs.
  5098.  *)
  5099.   DDVPCONNECT_DOUBLECLOCK = $00000001;
  5100.  
  5101. (*
  5102.  * When this is set by the driver and passed to the client, this
  5103.  * indicates that the video port is capable of using an external VACT
  5104.  * signal. When this is set by the client, this indicates that the
  5105.  * video port should use the external VACT signal.
  5106.  *)
  5107.   DDVPCONNECT_VACT = $00000002;
  5108.  
  5109. (*
  5110.  * When this is set by the driver and passed to the client, this
  5111.  * indicates that the video port is capable of treating even fields
  5112.  * like odd fields and visa versa.  When this is set by the client,
  5113.  * this indicates that the video port should treat even fields like odd
  5114.  * fields.
  5115.  *)
  5116.   DDVPCONNECT_INVERTPOLARITY = $00000004;
  5117.  
  5118. (*
  5119.  * Indicates that any data written to the video port during the VREF
  5120.  * period will not be written into the frame buffer. This flag is read only.
  5121.  *)
  5122.   DDVPCONNECT_DISCARDSVREFDATA = $00000008;
  5123.  
  5124. (*
  5125.  * When this is set be the driver and passed to the client, this
  5126.  * indicates that the device will write half lines into the frame buffer
  5127.  * if half lines are provided by the decoder.  If this is set by the client,
  5128.  * this indicates that the decoder will be supplying half lines.
  5129.  *)
  5130.   DDVPCONNECT_HALFLINE = $00000010;
  5131.  
  5132. (*
  5133.  * Indicates that the signal is interlaced. This flag is only
  5134.  * set by the client.
  5135.  *)
  5136.   DDVPCONNECT_INTERLACED = $00000020;
  5137.  
  5138. (*
  5139.  * Indicates that video port is shareable and that this video port
  5140.  * will use the even fields.  This flag is only set by the client.
  5141.  *)
  5142.   DDVPCONNECT_SHAREEVEN = $00000040;
  5143.  
  5144. (*
  5145.  * Indicates that video port is shareable and that this video port
  5146.  * will use the odd fields.  This flag is only set by the client.
  5147.  *)
  5148.   DDVPCONNECT_SHAREODD = $00000080;
  5149.  
  5150. (****************************************************************************
  5151.  *
  5152.  * VIDEOPORT TDDVideoPortDesc CAPS
  5153.  *
  5154.  ****************************************************************************)
  5155.  
  5156. (*
  5157.  * Flip can be performed automatically to avoid tearing.
  5158.  *)
  5159.   DDVPCAPS_AUTOFLIP = $00000001;
  5160.  
  5161. (*
  5162.  * Supports interlaced video
  5163.  *)
  5164.   DDVPCAPS_INTERLACED = $00000002;
  5165.  
  5166. (*
  5167.  * Supports non-interlaced video
  5168.  *)
  5169.   DDVPCAPS_NONINTERLACED = $00000004;
  5170.  
  5171. (*
  5172.  * Indicates that the device can return whether the current field
  5173.  * of an interlaced signal is even or odd.
  5174.  *)
  5175.   DDVPCAPS_READBACKFIELD = $00000008;
  5176.  
  5177. (*
  5178.  * Indicates that the device can return the current line of video
  5179.  * being written into the frame buffer.
  5180.  *)
  5181.   DDVPCAPS_READBACKLINE = $00000010;
  5182.  
  5183. (*
  5184.  * Allows two gen-locked video streams to share a single video port,
  5185.  * where one stream uses the even fields and the other uses the odd
  5186.  * fields. Separate parameters (including address, scaling,
  5187.  * cropping, etc.) are maintained for both fields.)
  5188.  *)
  5189.   DDVPCAPS_SHAREABLE = $00000020;
  5190.  
  5191. (*
  5192.  * Even fields of video can be automatically discarded.
  5193.  *)
  5194.   DDVPCAPS_SKIPEVENFIELDS = $00000040;
  5195.  
  5196. (*
  5197.  * Odd fields of video can be automatically discarded.
  5198.  *)
  5199.   DDVPCAPS_SKIPODDFIELDS = $00000080;
  5200.  
  5201. (*
  5202.  * Indicates that the device is capable of driving the graphics
  5203.  * VSYNC with the video port VSYNC.
  5204.  *)
  5205.   DDVPCAPS_SYNCMASTER = $00000100;
  5206.  
  5207. (*
  5208.  * Indicates that data within the vertical blanking interval can
  5209.  * be written to a different surface.
  5210.  *)
  5211.   DDVPCAPS_VBISURFACE = $00000200;
  5212.  
  5213. (*
  5214.  * Indicates that the video port can perform color operations
  5215.  * on the incoming data before it is written to the frame buffer.
  5216.  *)
  5217.   DDVPCAPS_COLORCONTROL = $00000400;
  5218.  
  5219. (*
  5220.  * Indicates that the video port can accept VBI data in a different
  5221.  * width or format than the regular video data.
  5222.  *)
  5223.   DDVPCAPS_OVERSAMPLEDVBI = $00000800;
  5224.  
  5225. (*
  5226.  * Indicates that the video port can write data directly to system memory
  5227.  *)
  5228.   DDVPCAPS_SYSTEMMEMORY = $00001000;
  5229.  
  5230. (*
  5231.  * Indicates that the VBI and video portions of the video stream can
  5232.  * be controlled by an independent processes.
  5233.  *)
  5234.   DDVPCAPS_VBIANDVIDEOINDEPENDENT       = $00002000;
  5235.  
  5236. (*
  5237.  * Indicates that the video port contains high quality hardware
  5238.  * de-interlacing hardware that should be used instead of the
  5239.  * bob/weave algorithms.
  5240.  *)
  5241.   DDVPCAPS_HARDWAREDEINTERLACE          = $00004000;
  5242.  
  5243. (****************************************************************************
  5244.  *
  5245.  * VIDEOPORT TDDVideoPortDesc FX
  5246.  *
  5247.  ****************************************************************************)
  5248.  
  5249. (*
  5250.  * Limited cropping is available to crop out the vertical interval data.
  5251.  *)
  5252.   DDVPFX_CROPTOPDATA = $00000001;
  5253.  
  5254. (*
  5255.  * Incoming data can be cropped in the X direction before it is written
  5256.  * to the surface.
  5257.  *)
  5258.   DDVPFX_CROPX = $00000002;
  5259.  
  5260. (*
  5261.  * Incoming data can be cropped in the Y direction before it is written
  5262.  * to the surface.
  5263.  *)
  5264.   DDVPFX_CROPY = $00000004;
  5265.  
  5266. (*
  5267.  * Supports interleaving interlaced fields in memory.
  5268.  *)
  5269.   DDVPFX_INTERLEAVE = $00000008;
  5270.  
  5271. (*
  5272.  * Supports mirroring left to right as the video data is written
  5273.  * into the frame buffer.
  5274.  *)
  5275.   DDVPFX_MIRRORLEFTRIGHT = $00000010;
  5276.  
  5277. (*
  5278.  * Supports mirroring top to bottom as the video data is written
  5279.  * into the frame buffer.
  5280.  *)
  5281.   DDVPFX_MIRRORUPDOWN = $00000020;
  5282.  
  5283. (*
  5284.  * Data can be arbitrarily shrunk in the X direction before it
  5285.  * is written to the surface.
  5286.  *)
  5287.   DDVPFX_PRESHRINKX = $00000040;
  5288.  
  5289. (*
  5290.  * Data can be arbitrarily shrunk in the Y direction before it
  5291.  * is written to the surface.
  5292.  *)
  5293.   DDVPFX_PRESHRINKY = $00000080;
  5294.  
  5295. (*
  5296.  * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X
  5297.  * direction before it is written to the surface.
  5298.  *)
  5299.   DDVPFX_PRESHRINKXB = $00000100;
  5300.  
  5301. (*
  5302.  * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y
  5303.  * direction before it is written to the surface.
  5304.  *)
  5305.   DDVPFX_PRESHRINKYB = $00000200;
  5306.  
  5307. (*
  5308.  * Data can be shrunk in increments of 1/x in the X direction
  5309.  * (where X is specified in the TDDVideoPortCaps.dwPreshrinkXStep)
  5310.  * before it is written to the surface.
  5311.  *)
  5312.   DDVPFX_PRESHRINKXS = $00000400;
  5313.  
  5314. (*
  5315.  * Data can be shrunk in increments of 1/x in the Y direction
  5316.  * (where X is specified in the TDDVideoPortCaps.dwPreshrinkYStep)
  5317.  * before it is written to the surface.
  5318.  *)
  5319.   DDVPFX_PRESHRINKYS = $00000800;
  5320.  
  5321. (*
  5322.  * Data can be arbitrarily stretched in the X direction before
  5323.  * it is written to the surface.
  5324.  *)
  5325.   DDVPFX_PRESTRETCHX = $00001000;
  5326.  
  5327. (*
  5328.  * Data can be arbitrarily stretched in the Y direction before
  5329.  * it is written to the surface.
  5330.  *)
  5331.   DDVPFX_PRESTRETCHY = $00002000;
  5332.  
  5333. (*
  5334.  * Data can be integer stretched in the X direction before it is
  5335.  * written to the surface.
  5336.  *)
  5337.   DDVPFX_PRESTRETCHXN = $00004000;
  5338.  
  5339. (*
  5340.  * Data can be integer stretched in the Y direction before it is
  5341.  * written to the surface.
  5342.  *)
  5343.   DDVPFX_PRESTRETCHYN = $00008000;
  5344.  
  5345. (*
  5346.  * Indicates that data within the vertical blanking interval can
  5347.  * be converted independently of the remaining video data.
  5348.  *)
  5349.   DDVPFX_VBICONVERT = $00010000;
  5350.  
  5351. (*
  5352.  * Indicates that scaling can be disabled for data within the
  5353.  * vertical blanking interval.
  5354.  *)
  5355.   DDVPFX_VBINOSCALE = $00020000;
  5356.  
  5357. (*
  5358.  * Indicates that the video data can ignore the left and right
  5359.  * cropping coordinates when cropping oversampled VBI data.
  5360.  *)
  5361.   DDVPFX_IGNOREVBIXCROP = $00040000;
  5362.  
  5363. (*
  5364.  * Indicates that interleaving can be disabled for data within the
  5365.  * vertical blanking interval.
  5366.  *)
  5367.   DDVPFX_VBINOINTERLEAVE     = $00080000;
  5368.  
  5369. (****************************************************************************
  5370.  *
  5371.  * VIDEOPORT TDDVideoPortInfo FLAGS
  5372.  *
  5373.  ****************************************************************************)
  5374.  
  5375. (*
  5376.  * Perform automatic flipping.   Auto-flipping is performed between
  5377.  * the overlay surface that was attached to the video port using
  5378.  * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that
  5379.  * are attached to the surface via the IDirectDrawSurface::AttachSurface
  5380.  * method.  The flip order is the order in which the overlay surfaces
  5381.  * were. attached.
  5382.  *)
  5383.   DDVP_AUTOFLIP = $00000001;
  5384.  
  5385. (*
  5386.  * Perform conversion using the ddpfOutputFormat information.
  5387.  *)
  5388.   DDVP_CONVERT = $00000002;
  5389.  
  5390. (*
  5391.  * Perform cropping using the specified rectangle.
  5392.  *)
  5393.   DDVP_CROP = $00000004;
  5394.  
  5395. (*
  5396.  * Indicates that interlaced fields should be interleaved in memory.
  5397.  *)
  5398.   DDVP_INTERLEAVE = $00000008;
  5399.  
  5400. (*
  5401.  * Indicates that the data should be mirrored left to right as it's
  5402.  * written into the frame buffer.
  5403.  *)
  5404.   DDVP_MIRRORLEFTRIGHT = $00000010;
  5405.  
  5406. (*
  5407.  * Indicates that the data should be mirrored top to bottom as it's
  5408.  * written into the frame buffer.
  5409.  *)
  5410.   DDVP_MIRRORUPDOWN = $00000020;
  5411.  
  5412. (*
  5413.  * Perform pre-scaling/zooming based on the pre-scale parameters.
  5414.  *)
  5415.   DDVP_PRESCALE = $00000040;
  5416.  
  5417. (*
  5418.  * Ignore input of even fields.
  5419.  *)
  5420.   DDVP_SKIPEVENFIELDS = $00000080;
  5421.  
  5422. (*
  5423.  * Ignore input of odd fields.
  5424.  *)
  5425.   DDVP_SKIPODDFIELDS = $00000100;
  5426.  
  5427. (*
  5428.  * Drive the graphics VSYNCs using the video port VYSNCs.
  5429.  *)
  5430.   DDVP_SYNCMASTER = $00000200;
  5431.  
  5432. (*
  5433.  * The ddpfVBIOutputFormatFormat member contains data that should be used
  5434.  * to convert the data within the vertical blanking interval.
  5435.  *)
  5436.   DDVP_VBICONVERT = $00000400;
  5437.  
  5438. (*
  5439.  * Indicates that data within the vertical blanking interval
  5440.  * should not be scaled.
  5441.  *)
  5442.   DDVP_VBINOSCALE = $00000800;
  5443.  
  5444. (*
  5445.  * Indicates that these bob/weave decisions should not be
  5446.  * overriden by other interfaces.
  5447.  *)
  5448.   DDVP_OVERRIDEBOBWEAVE = $00001000;
  5449.  
  5450. (*
  5451.  * Indicates that the video data should ignore the left and right
  5452.  * cropping coordinates when cropping the VBI data.
  5453.  *)
  5454.   DDVP_IGNOREVBIXCROP = $00002000;
  5455.  
  5456. (*
  5457.  * Indicates that interleaving can be disabled for data within the
  5458.  * vertical blanking interval.
  5459.  *)
  5460.   DDVP_VBINOINTERLEAVE                  = $00004000;
  5461.  
  5462. (*
  5463.  * Indicates that the video port should use the hardware
  5464.  * de-interlacing hardware.
  5465.  *)
  5466.   DDVP_HARDWAREDEINTERLACE              = $00008000;
  5467.  
  5468. (****************************************************************************
  5469.  *
  5470.  * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS
  5471.  *
  5472.  ****************************************************************************)
  5473.  
  5474. (*
  5475.  * Return formats for the video data
  5476.  *)
  5477.   DDVPFORMAT_VIDEO = $00000001;
  5478.  
  5479. (*
  5480.  * Return formats for the VBI data
  5481.  *)
  5482.   DDVPFORMAT_VBI = $00000002;
  5483.  
  5484. (****************************************************************************
  5485.  *
  5486.  * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS
  5487.  *
  5488.  ****************************************************************************)
  5489.  
  5490. (*
  5491.  * Surface should receive video data (and VBI data if a surface
  5492.  * is not explicitly attached for that purpose)
  5493.  *)
  5494.   DDVPTARGET_VIDEO = $00000001;
  5495.  
  5496. (*
  5497.  * Surface should receive VBI data
  5498.  *)
  5499.   DDVPTARGET_VBI = $00000002;
  5500.  
  5501. (****************************************************************************
  5502.  *
  5503.  * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS
  5504.  *
  5505.  ****************************************************************************)
  5506.  
  5507. (*
  5508.  * Waits until the beginning of the next VSYNC
  5509.  *)
  5510.   DDVPWAIT_BEGIN = $00000001;
  5511.  
  5512. (*
  5513.  * Waits until the end of the next/current VSYNC
  5514.  *)
  5515.   DDVPWAIT_END = $00000002;
  5516.  
  5517. (*
  5518.  * Waits until the beginning of the specified line
  5519.  *)
  5520.   DDVPWAIT_LINE = $00000003;
  5521.  
  5522. (****************************************************************************
  5523.  *
  5524.  * DIRECTDRAWVIDEOPORT FLIP FLAGS
  5525.  *
  5526.  ****************************************************************************)
  5527.  
  5528. (*
  5529.  * Flips the normal video surface
  5530.  *)
  5531.   DDVPFLIP_VIDEO = $00000001;
  5532.  
  5533. (*
  5534.  * Flips the VBI surface
  5535.  *)
  5536.   DDVPFLIP_VBI = $00000002;
  5537.  
  5538. (****************************************************************************
  5539.  *
  5540.  * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES
  5541.  *
  5542.  ****************************************************************************)
  5543.  
  5544. (*
  5545.  * No video signal is present at the video port
  5546.  *)
  5547.   DDVPSQ_NOSIGNAL = $00000001;
  5548.  
  5549. (*
  5550.  * A valid video signal is present at the video port
  5551.  *)
  5552.   DDVPSQ_SIGNALOK = $00000002;
  5553.  
  5554. (****************************************************************************
  5555.  *
  5556.  * VIDEOPORTBANDWIDTH Flags
  5557.  *
  5558.  ****************************************************************************)
  5559.  
  5560. (*
  5561.  * The specified height/width refer to the size of the video port data
  5562.  * written into memory, after prescaling has occured.
  5563.  *)
  5564.   DDVPB_VIDEOPORT = $00000001;
  5565.  
  5566. (*
  5567.  * The specified height/width refer to the source size of the overlay.
  5568.  *)
  5569.   DDVPB_OVERLAY = $00000002;
  5570.  
  5571. (*
  5572.  * This is a query for the device to return which caps this device requires.
  5573.  *)
  5574.   DDVPB_TYPE = $00000004;
  5575.  
  5576. (****************************************************************************
  5577.  *
  5578.  * VIDEOPORTBANDWIDTH Caps
  5579.  *
  5580.  ****************************************************************************)
  5581.  
  5582. (*
  5583.  * The bandwidth for this device is dependant on the overlay source size.
  5584.  *)
  5585.   DDVPBCAPS_SOURCE = $00000001;
  5586.  
  5587. (*
  5588.  * The bandwidth for this device is dependant on the overlay destination
  5589.  * size.
  5590.  *)
  5591.   DDVPBCAPS_DESTINATION = $00000002;
  5592.  
  5593. (****************************************************************************
  5594.  *
  5595.  * DDVIDEOPORTCONTAINER CreateVideoPort flags
  5596.  *
  5597.  ****************************************************************************)
  5598.  
  5599. (*
  5600.  * The process only wants to control the VBI portion of the video stream.
  5601.  *)
  5602.   DDVPCREATE_VBIONLY                    = $00000001;
  5603.  
  5604. (*
  5605.  * The process only wants to control the non-VBI (video) portion of
  5606.  * the video stream.
  5607.  *)
  5608.   DDVPCREATE_VIDEOONLY                  = $00000002;
  5609.  
  5610. (****************************************************************************
  5611.  *
  5612.  * DDVIDEOPORTSTATUS flags
  5613.  *
  5614.  ****************************************************************************)
  5615.  
  5616. (*
  5617.  * The video port interface is only controlling the VBI portion of the
  5618.  * video stream
  5619.  *)
  5620.   DDVPSTATUS_VBIONLY                    = $00000001;
  5621.  
  5622. (*
  5623.  * The video port interface is only controlling the video portion of the
  5624.  * video stream
  5625.  *)
  5626.   DDVPSTATUS_VIDEOONLY                  = $00000002;
  5627.  
  5628.  
  5629. type
  5630. (*
  5631.  * API's
  5632.  *)
  5633.  
  5634.   TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps;
  5635.       lpContext: Pointer) : HResult; stdcall;
  5636.  
  5637. (*
  5638.  * INTERACES FOLLOW:
  5639.  *      IDirectDrawVideoPort
  5640.  *      IVideoPort
  5641.  *)
  5642.  
  5643.  
  5644. (*
  5645.  * IDirectDrawVideoPort
  5646.  *)
  5647.   IDirectDrawVideoPort = interface (IUnknown)
  5648.     ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}']
  5649.     (*** IDirectDrawVideoPort methods ***)
  5650.     function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) : HResult; stdcall;
  5651.     function GetBandwidthInfo(var lpddpfFormat: TDDPixelFormat;
  5652.         dwWidth: DWORD; dwHeight: DWORD; dwFlags: DWORD;
  5653.         var lpBandwidth: TDDVideoPortBandWidth) : HResult; stdcall;
  5654.     function GetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
  5655.     function GetInputFormats(var lpNumFormats: DWORD; var lpFormats:
  5656.         TDDPixelFormat; dwFlags: DWORD) : HResult; stdcall;
  5657.     function GetOutputFormats(var lpInputFormat: TDDPixelFormat;
  5658.         var lpNumFormats: DWORD; lpFormats: PDDPixelFormat; dwFlags: DWORD)
  5659.         : HResult; stdcall;
  5660.     function GetFieldPolarity(var lpbVideoField: BOOL) : HResult; stdcall;
  5661.     function GetVideoLine(var lpdwLine: DWORD) : HResult; stdcall;
  5662.     function GetVideoSignalStatus(varlpdwStatus: DWORD) : HResult; stdcall;
  5663.     function SetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
  5664.     function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) :
  5665.         HResult; stdcall;
  5666.     function StartVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
  5667.     function StopVideo: HResult; stdcall;
  5668.     function UpdateVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
  5669.     function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD) :
  5670.         HResult; stdcall;
  5671.   end;
  5672.  
  5673. (*
  5674.  * IDirectDrawVideoPortContainer
  5675.  *)
  5676.   IDDVideoPortContainer = interface (IUnknown)
  5677.     ['{6C142760-A733-11CE-A521-0020AF0BE560}']
  5678.     (*** IDDVideoPortContainer methods ***)
  5679.     function CreateVideoPort(dwFlags: DWORD; var lpTDDVideoPortDesc:
  5680.         TDDVideoPortDesc; var lplpDDVideoPort: IDirectDrawVideoPort;
  5681.         pUnkOuter: IUnknown) : HResult; stdcall;
  5682.     function EnumVideoPorts(dwFlags: DWORD;
  5683.         lpTDDVideoPortCaps: PDDVideoPortCaps; lpContext: Pointer;
  5684.         lpEnumVideoCallback: TDDEnumVideoCallback) : HResult; stdcall;
  5685.     function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD;
  5686.         lpConnectInfo: PDDVideoPortConnect) : HResult; stdcall;
  5687.     function QueryVideoPortStatus(dwPortId: DWORD;
  5688.         var lpVPStatus: TDDVideoPortStatus) : HResult; stdcall;
  5689.   end;
  5690.  
  5691.   IID_IDDVideoPortContainer = IDDVideoPortContainer;
  5692.   IID_IDirectDrawVideoPort = IDirectDrawVideoPort;
  5693.  
  5694.  
  5695. //Direct3D file
  5696. (*==========================================================================;
  5697.  *
  5698.  *  Copyright (C) 1995-1998 Microsoft Corporation.  All Rights Reserved.
  5699.  *
  5700.  *  Files:   d3dtypes.h d3dcaps.h d3d.h
  5701.  *
  5702.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  5703.  *
  5704.  *  Modyfied: 26-Jun-2000
  5705.  *
  5706.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  5707.  *  E-Mail: DelphiDirectX@next-reality.com
  5708.  *
  5709.  ***************************************************************************)
  5710.  
  5711. (* TD3DValue is the fundamental Direct3D fractional data type *)
  5712.  
  5713. type
  5714.   TRefClsID = TGUID;
  5715.  
  5716. type
  5717.   TD3DValue = Single;
  5718.   TD3DFixed = LongInt;
  5719.   float = TD3DValue;
  5720.   PD3DColor = ^TD3DColor;
  5721.   TD3DColor = DWORD;
  5722.  
  5723. function D3DVal(val: variant) : float;
  5724. function D3DDivide(a,b: double) : float;
  5725. function D3DMultiply(a,b: double) : float;
  5726.  
  5727. (*
  5728.  * Format of CI colors is
  5729.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5730.  *  |    alpha      |         color index           |   fraction    |
  5731.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5732.  *)
  5733.  
  5734. // #define CI_GETALPHA(ci)    ((ci) >> 24)
  5735. function CI_GETALPHA(ci: DWORD) : DWORD;
  5736.  
  5737. // #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
  5738. function CI_GETINDEX(ci: DWORD) : DWORD;
  5739.  
  5740. // #define CI_GETFRACTION(ci) ((ci) & 0xff)
  5741. function CI_GETFRACTION(ci: DWORD) : DWORD;
  5742.  
  5743. // #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
  5744. function CI_ROUNDINDEX(ci: DWORD) : DWORD;
  5745.  
  5746. // #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
  5747. function CI_MASKALPHA(ci: DWORD) : DWORD;
  5748.  
  5749. // #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
  5750. function CI_MAKE(a,i,f: DWORD) : DWORD;
  5751.  
  5752. (*
  5753.  * Format of RGBA colors is
  5754.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5755.  *  |    alpha      |      red      |     green     |     blue      |
  5756.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5757.  *)
  5758.  
  5759. // #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
  5760. function RGBA_GETALPHA(rgb: TD3DColor) : DWORD;
  5761.  
  5762. // #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
  5763. function RGBA_GETRED(rgb: TD3DColor) : DWORD;
  5764.  
  5765. // #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
  5766. function RGBA_GETGREEN(rgb: TD3DColor) : DWORD;
  5767.  
  5768. // #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
  5769. function RGBA_GETBLUE(rgb: TD3DColor) : DWORD;
  5770.  
  5771. // #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  5772. function RGBA_MAKE(r, g, b, a: DWORD) : TD3DColor;
  5773.  
  5774. (* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
  5775.  * The float values must be in the range 0..1
  5776.  *)
  5777.  
  5778. // #define D3DRGB(r, g, b) \
  5779. //     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  5780. function D3DRGB(r, g, b: float) : TD3DColor;
  5781.  
  5782. // #define D3DRGBA(r, g, b, a) \
  5783. //     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
  5784. //     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
  5785. //    )
  5786. function D3DRGBA(r, g, b, a: float) : TD3DColor;
  5787.  
  5788. (*
  5789.  * Format of RGB colors is
  5790.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5791.  *  |    ignored    |      red      |     green     |     blue      |
  5792.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5793.  *)
  5794.  
  5795. // #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
  5796. function RGB_GETRED(rgb: TD3DColor) : DWORD;
  5797.  
  5798. // #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
  5799. function RGB_GETGREEN(rgb: TD3DColor) : DWORD;
  5800.  
  5801. // #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
  5802. function RGB_GETBLUE(rgb: TD3DColor) : DWORD;
  5803.  
  5804. // #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
  5805. function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD) : TD3DColor;
  5806.  
  5807. // #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
  5808. function RGB_MAKE(r, g, b: DWORD) : TD3DColor;
  5809.  
  5810. // #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
  5811. function RGBA_TORGB(rgba: TD3DColor) : TD3DColor;
  5812.  
  5813. // #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
  5814. function RGB_TORGBA(rgb: TD3DColor) : TD3DColor;
  5815.  
  5816. (*
  5817.  * Flags for Enumerate functions
  5818.  *)
  5819. const
  5820.  
  5821. (*
  5822.  * Stop the enumeration
  5823.  *)
  5824.  
  5825.   D3DENUMRET_CANCEL                        = DDENUMRET_CANCEL;
  5826.  
  5827. (*
  5828.  * Continue the enumeration
  5829.  *)
  5830.  
  5831.   D3DENUMRET_OK                            = DDENUMRET_OK;
  5832.  
  5833. type
  5834.   TD3DValidateCallback = function (lpUserArg: Pointer;
  5835.       dwOffset: DWORD): HResult; stdcall;
  5836.   TD3DEnumTextureFormatsCallback = function (var lpDdsd: TDDSurfaceDesc;
  5837.       lpContext: Pointer): HResult; stdcall;
  5838.   TD3DEnumPixelFormatsCallback = function (var lpDDPixFmt: TDDPixelFormat;
  5839.       lpContext: Pointer): HResult; stdcall;
  5840.  
  5841.  
  5842.   PD3DMaterialHandle = ^TD3DMaterialHandle;
  5843.   TD3DMaterialHandle = DWORD;
  5844.  
  5845.   PD3DTextureHandle = ^TD3DTextureHandle;
  5846.   TD3DTextureHandle = DWORD;
  5847.  
  5848.   PD3DMatrixHandle = ^TD3DMatrixHandle;
  5849.   TD3DMatrixHandle = DWORD;
  5850.  
  5851.   PD3DColorValue = ^TD3DColorValue;
  5852.   TD3DColorValue = packed record
  5853.     case Integer of
  5854.     0: (
  5855.       r: TD3DValue;
  5856.       g: TD3DValue;
  5857.       b: TD3DValue;
  5858.       a: TD3DValue;
  5859.      );
  5860.     1: (
  5861.       dvR: TD3DValue;
  5862.       dvG: TD3DValue;
  5863.       dvB: TD3DValue;
  5864.       dvA: TD3DValue;
  5865.      );
  5866.   end;
  5867.  
  5868.   PD3DRect = ^TD3DRect;
  5869.   TD3DRect = packed record
  5870.     case Integer of
  5871.     0: (
  5872.       x1: LongInt;
  5873.       y1: LongInt;
  5874.       x2: LongInt;
  5875.       y2: LongInt;
  5876.      );
  5877.     1: (
  5878.       lX1: LongInt;
  5879.       lY1: LongInt;
  5880.       lX2: LongInt;
  5881.       lY2: LongInt;
  5882.      );
  5883.      2: (
  5884.        a: array[0..3] of LongInt;
  5885.      );
  5886.   end;
  5887.  
  5888.   PD3DVector = ^TD3DVector;
  5889.   TD3DVector = packed record
  5890.     case Integer of
  5891.     0: (
  5892.       x: TD3DValue;
  5893.       y: TD3DValue;
  5894.       z: TD3DValue;
  5895.      );
  5896.     1: (
  5897.       dvX: TD3DValue;
  5898.       dvY: TD3DValue;
  5899.       dvZ: TD3DValue;
  5900.      );
  5901.   end;
  5902.  
  5903. (******************************************************************
  5904.  *                                                                *
  5905.  *   D3DVec.inl                                                   *
  5906.  *                                                                *
  5907.  *   Float-valued 3D vector class for Direct3D.                   *
  5908.  *                                                                *
  5909.  *   Copyright (c) 1996-1998 Microsoft Corp. All rights reserved. *
  5910.  *                                                                *
  5911.  ******************************************************************)
  5912.  
  5913.     // Addition and subtraction
  5914.   function VectorAdd(const v1, v2: TD3DVector) : TD3DVector;
  5915.   function VectorSub(const v1, v2: TD3DVector) : TD3DVector;
  5916.     // Scalar multiplication and division
  5917.   function VectorMulS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  5918.   function VectorDivS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  5919.     // Memberwise multiplication and division
  5920.   function VectorMul(const v1, v2: TD3DVector) : TD3DVector;
  5921.   function VectorDiv(const v1, v2: TD3DVector) : TD3DVector;
  5922.     // Vector dominance
  5923.   function VectorSmaller(v1, v2: TD3DVector) : boolean;
  5924.   function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
  5925.     // Bitwise equality
  5926.   function VectorEquel(v1, v2: TD3DVector) : boolean;
  5927.     // Length-related functions
  5928.   function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
  5929.   function VectorMagnitude(v: TD3DVector) : TD3DValue;
  5930.     // Returns vector with same direction and unit length
  5931.   function VectorNormalize(const v: TD3DVector) : TD3DVector;
  5932.     // Return min/max component of the input vector
  5933.   function VectorMin(v: TD3DVector) : TD3DValue;
  5934.   function VectorMax(v: TD3DVector) : TD3DValue;
  5935.     // Return memberwise min/max of input vectors
  5936.   function VectorMinimize(const v1, v2: TD3DVector) : TD3DVector;
  5937.   function VectorMaximize(const v1, v2: TD3DVector) : TD3DVector;
  5938.     // Dot and cross product
  5939.   function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
  5940.   function VectorCrossProduct(const v1, v2: TD3DVector) : TD3DVector;
  5941.  
  5942. type
  5943. (*
  5944.  * Vertex data types supported in an ExecuteBuffer.
  5945.  *)
  5946.  
  5947. (*
  5948.  * Homogeneous vertices
  5949.  *)
  5950.  
  5951.   PD3DHVertex = ^TD3DHVertex;
  5952.   TD3DHVertex = packed record
  5953.     dwFlags: DWORD;        (* Homogeneous clipping flags *)
  5954.     case Integer of
  5955.     0: (
  5956.       hx: TD3DValue;
  5957.       hy: TD3DValue;
  5958.       hz: TD3DValue;
  5959.      );
  5960.     1: (
  5961.       dvHX: TD3DValue;
  5962.       dvHY: TD3DValue;
  5963.       dvHZ: TD3DValue;
  5964.      );
  5965.   end;
  5966.  
  5967. (*
  5968.  * Transformed/lit vertices
  5969.  *)
  5970.  
  5971.   PD3DTLVertex = ^TD3DTLVertex;
  5972.   TD3DTLVertex = packed record
  5973.     case Integer of
  5974.     0: (
  5975.       sx: TD3DValue;             (* Screen coordinates *)
  5976.       sy: TD3DValue;
  5977.       sz: TD3DValue;
  5978.       rhw: TD3DValue;            (* Reciprocal of homogeneous w *)
  5979.       color: TD3DColor;          (* Vertex color *)
  5980.       specular: TD3DColor;       (* Specular component of vertex *)
  5981.       tu: TD3DValue;             (* Texture coordinates *)
  5982.       tv: TD3DValue;
  5983.      );
  5984.     1: (
  5985.       dvSX: TD3DValue;
  5986.       dvSY: TD3DValue;
  5987.       dvSZ: TD3DValue;
  5988.       dvRHW: TD3DValue;
  5989.       dcColor: TD3DColor;
  5990.       dcSpecular: TD3DColor;
  5991.       dvTU: TD3DValue;
  5992.       dvTV: TD3DValue;
  5993.      );
  5994.   end;
  5995.  
  5996. (*
  5997.  * Untransformed/lit vertices
  5998.  *)
  5999.  
  6000.   PD3DLVertex = ^TD3DLVertex;
  6001.   TD3DLVertex = packed record
  6002.     case Integer of
  6003.     0: (
  6004.       x: TD3DValue;             (* Homogeneous coordinates *)
  6005.       y: TD3DValue;
  6006.       z: TD3DValue;
  6007.       dwReserved: DWORD;
  6008.       color: TD3DColor;         (* Vertex color *)
  6009.       specular: TD3DColor;      (* Specular component of vertex *)
  6010.       tu: TD3DValue;            (* Texture coordinates *)
  6011.       tv: TD3DValue;
  6012.      );
  6013.     1: (
  6014.       dvX: TD3DValue;
  6015.       dvY: TD3DValue;
  6016.       dvZ: TD3DValue;
  6017.       UNIONFILLER1d: DWORD;
  6018.       dcColor: TD3DColor;
  6019.       dcSpecular: TD3DColor;
  6020.       dvTU: TD3DValue;
  6021.       dvTV: TD3DValue;
  6022.      );
  6023.   end;
  6024.  
  6025. (*
  6026.  * Untransformed/unlit vertices
  6027.  *)
  6028.  
  6029.   PD3DVertex = ^TD3DVertex;
  6030.   TD3DVertex = packed record
  6031.     case Integer of
  6032.     0: (
  6033.       x: TD3DValue;             (* Homogeneous coordinates *)
  6034.       y: TD3DValue;
  6035.       z: TD3DValue;
  6036.       nx: TD3DValue;            (* Normal *)
  6037.       ny: TD3DValue;
  6038.       nz: TD3DValue;
  6039.       tu: TD3DValue;            (* Texture coordinates *)
  6040.       tv: TD3DValue;
  6041.      );
  6042.     1: (
  6043.       dvX: TD3DValue;
  6044.       dvY: TD3DValue;
  6045.       dvZ: TD3DValue;
  6046.       dvNX: TD3DValue;
  6047.       dvNY: TD3DValue;
  6048.       dvNZ: TD3DValue;
  6049.       dvTU: TD3DValue;
  6050.       dvTV: TD3DValue;
  6051.      );
  6052.   end;
  6053.  
  6054. (*
  6055.  * Matrix, viewport, and tranformation structures and definitions.
  6056.  *)
  6057.  
  6058.   PD3DMatrix = ^TD3DMatrix;
  6059.   TD3DMatrix = packed record
  6060.     case integer of
  6061.       0 : (_11, _12, _13, _14: TD3DValue;
  6062.            _21, _22, _23, _24: TD3DValue;
  6063.            _31, _32, _33, _34: TD3DValue;
  6064.            _41, _42, _43, _44: TD3DValue);
  6065.       1 : (m : array [0..3, 0..3] of TD3DValue);
  6066.   end;
  6067.  
  6068.   PD3DViewport = ^TD3DViewport;
  6069.   TD3DViewport = packed record
  6070.     dwSize: DWORD;
  6071.     dwX: DWORD;
  6072.     dwY: DWORD;                (* Top left *)
  6073.     dwWidth: DWORD;
  6074.     dwHeight: DWORD;           (* Dimensions *)
  6075.     dvScaleX: TD3DValue;       (* Scale homogeneous to screen *)
  6076.     dvScaleY: TD3DValue;       (* Scale homogeneous to screen *)
  6077.     dvMaxX: TD3DValue;         (* Min/max homogeneous x coord *)
  6078.     dvMaxY: TD3DValue;         (* Min/max homogeneous y coord *)
  6079.     dvMinZ: TD3DValue;
  6080.     dvMaxZ: TD3DValue;         (* Min/max homogeneous z coord *)
  6081.   end;
  6082.  
  6083.   PD3DViewport2 = ^TD3DViewport2;
  6084.   TD3DViewport2 = packed record
  6085.     dwSize: DWORD;
  6086.     dwX: DWORD;
  6087.     dwY: DWORD;                (* Viewport Top left *)
  6088.     dwWidth: DWORD;
  6089.     dwHeight: DWORD;           (* Viewport Dimensions *)
  6090.     dvClipX: TD3DValue;        (* Top left of clip volume *)
  6091.     dvClipY: TD3DValue;
  6092.     dvClipWidth: TD3DValue;    (* Clip Volume Dimensions *)
  6093.     dvClipHeight: TD3DValue;
  6094.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  6095.     dvMaxZ: TD3DValue;
  6096.   end;
  6097.  
  6098.   PD3DViewport7 = ^TD3DViewport7;
  6099.   TD3DViewport7 = packed record
  6100.     dwX: DWORD;
  6101.     dwY: DWORD;                (* Viewport Top left *)
  6102.     dwWidth: DWORD;
  6103.     dwHeight: DWORD;           (* Viewport Dimensions *)
  6104.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  6105.     dvMaxZ: TD3DValue;
  6106.   end;
  6107.  
  6108. (*
  6109.  * Values for clip fields.
  6110.  *)
  6111.  
  6112. const
  6113. // Max number of user clipping planes, supported in D3D.
  6114.   D3DMAXUSERCLIPPLANES  = 32;
  6115.  
  6116. // These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
  6117. //
  6118.   D3DCLIPPLANE0 = (1 shl 0);
  6119.   D3DCLIPPLANE1 = (1 shl 1);
  6120.   D3DCLIPPLANE2 = (1 shl 2);
  6121.   D3DCLIPPLANE3 = (1 shl 3);
  6122.   D3DCLIPPLANE4 = (1 shl 4);
  6123.   D3DCLIPPLANE5 = (1 shl 5);
  6124.  
  6125. const
  6126.   D3DCLIP_LEFT                            = $00000001;
  6127.   D3DCLIP_RIGHT                           = $00000002;
  6128.   D3DCLIP_TOP                             = $00000004;
  6129.   D3DCLIP_BOTTOM                          = $00000008;
  6130.   D3DCLIP_FRONT                           = $00000010;
  6131.   D3DCLIP_BACK                            = $00000020;
  6132.   D3DCLIP_GEN0                            = $00000040;
  6133.   D3DCLIP_GEN1                            = $00000080;
  6134.   D3DCLIP_GEN2                            = $00000100;
  6135.   D3DCLIP_GEN3                            = $00000200;
  6136.   D3DCLIP_GEN4                            = $00000400;
  6137.   D3DCLIP_GEN5                            = $00000800;
  6138.  
  6139. (*
  6140.  * Values for d3d status.
  6141.  *)
  6142.  
  6143.   D3DSTATUS_CLIPUNIONLEFT                 = D3DCLIP_LEFT;
  6144.   D3DSTATUS_CLIPUNIONRIGHT                = D3DCLIP_RIGHT;
  6145.   D3DSTATUS_CLIPUNIONTOP                  = D3DCLIP_TOP;
  6146.   D3DSTATUS_CLIPUNIONBOTTOM               = D3DCLIP_BOTTOM;
  6147.   D3DSTATUS_CLIPUNIONFRONT                = D3DCLIP_FRONT;
  6148.   D3DSTATUS_CLIPUNIONBACK                 = D3DCLIP_BACK;
  6149.   D3DSTATUS_CLIPUNIONGEN0                 = D3DCLIP_GEN0;
  6150.   D3DSTATUS_CLIPUNIONGEN1                 = D3DCLIP_GEN1;
  6151.   D3DSTATUS_CLIPUNIONGEN2                 = D3DCLIP_GEN2;
  6152.   D3DSTATUS_CLIPUNIONGEN3                 = D3DCLIP_GEN3;
  6153.   D3DSTATUS_CLIPUNIONGEN4                 = D3DCLIP_GEN4;
  6154.   D3DSTATUS_CLIPUNIONGEN5                 = D3DCLIP_GEN5;
  6155.  
  6156.   D3DSTATUS_CLIPINTERSECTIONLEFT          = $00001000;
  6157.   D3DSTATUS_CLIPINTERSECTIONRIGHT         = $00002000;
  6158.   D3DSTATUS_CLIPINTERSECTIONTOP           = $00004000;
  6159.   D3DSTATUS_CLIPINTERSECTIONBOTTOM        = $00008000;
  6160.   D3DSTATUS_CLIPINTERSECTIONFRONT         = $00010000;
  6161.   D3DSTATUS_CLIPINTERSECTIONBACK          = $00020000;
  6162.   D3DSTATUS_CLIPINTERSECTIONGEN0          = $00040000;
  6163.   D3DSTATUS_CLIPINTERSECTIONGEN1          = $00080000;
  6164.   D3DSTATUS_CLIPINTERSECTIONGEN2          = $00100000;
  6165.   D3DSTATUS_CLIPINTERSECTIONGEN3          = $00200000;
  6166.   D3DSTATUS_CLIPINTERSECTIONGEN4          = $00400000;
  6167.   D3DSTATUS_CLIPINTERSECTIONGEN5          = $00800000;
  6168.   D3DSTATUS_ZNOTVISIBLE                   = $01000000;
  6169. (* Do not use 0x80000000 for any status flags in future as it is reserved *)
  6170.  
  6171.   D3DSTATUS_CLIPUNIONALL = (
  6172.             D3DSTATUS_CLIPUNIONLEFT or
  6173.             D3DSTATUS_CLIPUNIONRIGHT or
  6174.             D3DSTATUS_CLIPUNIONTOP or
  6175.             D3DSTATUS_CLIPUNIONBOTTOM or
  6176.             D3DSTATUS_CLIPUNIONFRONT or
  6177.             D3DSTATUS_CLIPUNIONBACK or
  6178.             D3DSTATUS_CLIPUNIONGEN0 or
  6179.             D3DSTATUS_CLIPUNIONGEN1 or
  6180.             D3DSTATUS_CLIPUNIONGEN2 or
  6181.             D3DSTATUS_CLIPUNIONGEN3 or
  6182.             D3DSTATUS_CLIPUNIONGEN4 or
  6183.             D3DSTATUS_CLIPUNIONGEN5);
  6184.  
  6185.   D3DSTATUS_CLIPINTERSECTIONALL = (
  6186.             D3DSTATUS_CLIPINTERSECTIONLEFT or
  6187.             D3DSTATUS_CLIPINTERSECTIONRIGHT or
  6188.             D3DSTATUS_CLIPINTERSECTIONTOP or
  6189.             D3DSTATUS_CLIPINTERSECTIONBOTTOM or
  6190.             D3DSTATUS_CLIPINTERSECTIONFRONT or
  6191.             D3DSTATUS_CLIPINTERSECTIONBACK or
  6192.             D3DSTATUS_CLIPINTERSECTIONGEN0 or
  6193.             D3DSTATUS_CLIPINTERSECTIONGEN1 or
  6194.             D3DSTATUS_CLIPINTERSECTIONGEN2 or
  6195.             D3DSTATUS_CLIPINTERSECTIONGEN3 or
  6196.             D3DSTATUS_CLIPINTERSECTIONGEN4 or
  6197.             D3DSTATUS_CLIPINTERSECTIONGEN5);
  6198.  
  6199.   D3DSTATUS_DEFAULT = (
  6200.             D3DSTATUS_CLIPINTERSECTIONALL or
  6201.             D3DSTATUS_ZNOTVISIBLE);
  6202.  
  6203. (*
  6204.  * Options for direct transform calls
  6205.  *)
  6206.  
  6207.   D3DTRANSFORM_CLIPPED       = $00000001;
  6208.   D3DTRANSFORM_UNCLIPPED     = $00000002;
  6209.  
  6210. type
  6211.   PD3DTransformData = ^TD3DTransformData;
  6212.   TD3DTransformData = packed record
  6213.     dwSize: DWORD;
  6214.     lpIn: Pointer;             (* Input vertices *)
  6215.     dwInSize: DWORD;           (* Stride of input vertices *)
  6216.     lpOut: Pointer;            (* Output vertices *)
  6217.     dwOutSize: DWORD;          (* Stride of output vertices *)
  6218.     lpHOut: ^TD3DHVertex;       (* Output homogeneous vertices *)
  6219.     dwClip: DWORD;             (* Clipping hint *)
  6220.     dwClipIntersection: DWORD;
  6221.     dwClipUnion: DWORD;        (* Union of all clip flags *)
  6222.     drExtent: TD3DRect;         (* Extent of transformed vertices *)
  6223.   end;
  6224.  
  6225. (*
  6226.  * Structure defining position and direction properties for lighting.
  6227.  *)
  6228.  
  6229.   PD3DLightingElement = ^TD3DLightingElement;
  6230.   TD3DLightingElement = packed record
  6231.     dvPosition: TD3DVector;           (* Lightable point in model space *)
  6232.     dvNormal: TD3DVector;             (* Normalised unit vector *)
  6233.   end;
  6234.  
  6235. (*
  6236.  * Structure defining material properties for lighting.
  6237.  *)
  6238.  
  6239.   PD3DMaterial = ^TD3DMaterial;
  6240.   TD3DMaterial = packed record
  6241.     dwSize: DWORD;
  6242.     case Integer of
  6243.     0: (
  6244.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  6245.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  6246.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  6247.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  6248.       power: TD3DValue;               (* Sharpness if specular highlight *)
  6249.       hTexture: TD3DTextureHandle;    (* Handle to texture map *)
  6250.       dwRampSize: DWORD;
  6251.      );
  6252.     1: (
  6253.       dcvDiffuse: TD3DColorValue;
  6254.       dcvAmbient: TD3DColorValue;
  6255.       dcvSpecular: TD3DColorValue;
  6256.       dcvEmissive: TD3DColorValue;
  6257.       dvPower: TD3DValue;
  6258.      );
  6259.   end;
  6260.  
  6261.   PD3DMaterial7 = ^TD3DMaterial7;
  6262.   TD3DMaterial7 = packed record
  6263.     case Integer of
  6264.     0: (
  6265.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  6266.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  6267.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  6268.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  6269.       power: TD3DValue;               (* Sharpness if specular highlight *)
  6270.      );
  6271.     1: (
  6272.       dcvDiffuse: TD3DColorValue;
  6273.       dcvAmbient: TD3DColorValue;
  6274.       dcvSpecular: TD3DColorValue;
  6275.       dcvEmissive: TD3DColorValue;
  6276.       dvPower: TD3DValue;
  6277.      );
  6278.   end;
  6279.  
  6280.   PD3DLightType = ^TD3DLightType;
  6281.   TD3DLightType = (
  6282.     D3DLIGHT_INVALID_0,
  6283.     D3DLIGHT_POINT,
  6284.     D3DLIGHT_SPOT,
  6285.     D3DLIGHT_DIRECTIONAL,
  6286. // Note: The following light type (D3DLIGHT_PARALLELPOINT)
  6287. // is no longer supported from D3D for DX7 onwards.
  6288.     D3DLIGHT_PARALLELPOINT,
  6289.     D3DLIGHT_GLSPOT);
  6290.  
  6291. (*
  6292.  * Structure defining a light source and its properties.
  6293.  *)
  6294.  
  6295.   PD3DLight = ^TD3DLight;
  6296.   TD3DLight = packed record
  6297.     dwSize: DWORD;
  6298.     dltType: TD3DLightType;     (* Type of light source *)
  6299.     dcvColor: TD3DColorValue;   (* Color of light *)
  6300.     dvPosition: TD3DVector;     (* Position in world space *)
  6301.     dvDirection: TD3DVector;    (* Direction in world space *)
  6302.     dvRange: TD3DValue;         (* Cutoff range *)
  6303.     dvFalloff: TD3DValue;       (* Falloff *)
  6304.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6305.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6306.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6307.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6308.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6309.   end;
  6310.  
  6311.   PD3DLight7 = ^TD3DLight7;
  6312.   TD3DLight7 = packed record
  6313.     dltType: TD3DLightType;     (* Type of light source *)
  6314.     dcvDiffuse: TD3DColorValue; (* Diffuse color of light *)
  6315.     dcvSpecular: TD3DColorValue;(* Specular color of light *)
  6316.     dcvAmbient: TD3DColorValue; (* Ambient color of light *)
  6317.     dvPosition: TD3DVector;     (* Position in world space *)
  6318.     dvDirection: TD3DVector;    (* Direction in world space *)
  6319.     dvRange: TD3DValue;         (* Cutoff range *)
  6320.     dvFalloff: TD3DValue;       (* Falloff *)
  6321.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6322.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6323.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6324.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6325.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6326.   end;
  6327.  
  6328. (*
  6329.  * Structure defining a light source and its properties.
  6330.  *)
  6331.  
  6332. (* flags bits *)
  6333. const
  6334.   D3DLIGHT_ACTIVE                       = $00000001;
  6335.   D3DLIGHT_NO_SPECULAR  = $00000002;
  6336.   D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE;
  6337.  
  6338. (* maximum valid light range *)
  6339.   D3DLIGHT_RANGE_MAX            = 1.8439088915e+18; //sqrt(FLT_MAX);
  6340.  
  6341. type
  6342.   PD3DLight2 = ^TD3DLight2;
  6343.   TD3DLight2 = packed record
  6344.     dwSize: DWORD;
  6345.     dltType: TD3DLightType;     (* Type of light source *)
  6346.     dcvColor: TD3DColorValue;   (* Color of light *)
  6347.     dvPosition: TD3DVector;     (* Position in world space *)
  6348.     dvDirection: TD3DVector;    (* Direction in world space *)
  6349.     dvRange: TD3DValue;         (* Cutoff range *)
  6350.     dvFalloff: TD3DValue;       (* Falloff *)
  6351.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6352.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6353.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6354.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6355.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6356.     dwFlags: DWORD;
  6357.   end;
  6358.  
  6359.   PD3DLightData = ^TD3DLightData;
  6360.   TD3DLightData = packed record
  6361.     dwSize: DWORD;
  6362.     lpIn: ^TD3DLightingElement;   (* Input positions and normals *)
  6363.     dwInSize: DWORD;             (* Stride of input elements *)
  6364.     lpOut: ^TD3DTLVertex;         (* Output colors *)
  6365.     dwOutSize: DWORD;            (* Stride of output colors *)
  6366.   end;
  6367.  
  6368. (*
  6369.  * Before DX5, these values were in an enum called
  6370.  * TD3DColorModel. This was not correct, since they are
  6371.  * bit flags. A driver can surface either or both flags
  6372.  * in the dcmColorModel member of D3DDEVICEDESC.
  6373.  *)
  6374.  
  6375. type
  6376.   TD3DColorModel = DWORD;
  6377.  
  6378. const
  6379.   D3DCOLOR_MONO = 1;
  6380.   D3DCOLOR_RGB  = 2;
  6381.  
  6382. (*
  6383.  * Options for clearing
  6384.  *)
  6385.  
  6386. const
  6387.   D3DCLEAR_TARGET            = $00000001; (* Clear target surface *)
  6388.   D3DCLEAR_ZBUFFER           = $00000002; (* Clear target z buffer *)
  6389.   D3DCLEAR_STENCIL           = $00000004; (* Clear stencil planes *)
  6390.  
  6391. (*
  6392.  * Execute buffers are allocated via Direct3D.  These buffers may then
  6393.  * be filled by the application with instructions to execute along with
  6394.  * vertex data.
  6395.  *)
  6396.  
  6397. (*
  6398.  * Supported op codes for execute instructions.
  6399.  *)
  6400.  
  6401. type
  6402.   PD3DOpcode = ^TD3DOpcode;
  6403.   TD3DOpcode = (
  6404.     D3DOP_INVALID_0,
  6405.     D3DOP_POINT,
  6406.     D3DOP_LINE,
  6407.     D3DOP_TRIANGLE,
  6408.     D3DOP_MATRIXLOAD,
  6409.     D3DOP_MATRIXMULTIPLY,
  6410.     D3DOP_STATETRANSFORM,
  6411.     D3DOP_STATELIGHT,
  6412.     D3DOP_STATERENDER,
  6413.     D3DOP_PROCESSVERTICES,
  6414.     D3DOP_TEXTURELOAD,
  6415.     D3DOP_EXIT,
  6416.     D3DOP_BRANCHFORWARD,
  6417.     D3DOP_SPAN,
  6418.     D3DOP_SETSTATUS);
  6419.  
  6420.   PD3DInstruction = ^TD3DInstruction;
  6421.   TD3DInstruction = packed record
  6422.     bOpcode: BYTE;   (* Instruction opcode *)
  6423.     bSize: BYTE;     (* Size of each instruction data unit *)
  6424.     wCount: WORD;    (* Count of instruction data units to follow *)
  6425.   end;
  6426.  
  6427. (*
  6428.  * Structure for texture loads
  6429.  *)
  6430.  
  6431.   PD3DTextureLoad = ^TD3DTextureLoad;
  6432.   TD3DTextureLoad = packed record
  6433.     hDestTexture: TD3DTextureHandle;
  6434.     hSrcTexture: TD3DTextureHandle;
  6435.   end;
  6436.  
  6437. (*
  6438.  * Structure for picking
  6439.  *)
  6440.  
  6441.   PD3DPickRecord = ^TD3DPickRecord;
  6442.   TD3DPickRecord = packed record
  6443.     bOpcode: BYTE;
  6444.     bPad: BYTE;
  6445.     dwOffset: DWORD;
  6446.     dvZ: TD3DValue;
  6447.   end;
  6448.  
  6449. (*
  6450.  * The following defines the rendering states which can be set in the
  6451.  * execute buffer.
  6452.  *)
  6453.  
  6454.   PD3DShadeMode = ^TD3DShadeMode;
  6455.   TD3DShadeMode = (
  6456.     D3DSHADE_INVALID_0,
  6457.     D3DSHADE_FLAT,
  6458.     D3DSHADE_GOURAUD,
  6459.     D3DSHADE_PHONG);
  6460.  
  6461.   PD3DFillMode = ^TD3DFillMode;
  6462.   TD3DFillMode = (
  6463.     D3DFILL_INVALID_0,
  6464.     D3DFILL_POINT,
  6465.     D3DFILL_WIREFRAME,
  6466.     D3DFILL_SOLID);
  6467.  
  6468.   PD3DLinePattern = ^TD3DLinePattern;
  6469.   TD3DLinePattern = packed record
  6470.     wRepeatFactor: WORD;
  6471.     wLinePattern: WORD;
  6472.   end;
  6473.  
  6474.   PD3DTextureFilter = ^TD3DTextureFilter;
  6475.   TD3DTextureFilter = (
  6476.     D3DFILTER_INVALID_0,
  6477.     D3DFILTER_NEAREST,
  6478.     D3DFILTER_LINEAR,
  6479.     D3DFILTER_MIPNEAREST,
  6480.     D3DFILTER_MIPLINEAR,
  6481.     D3DFILTER_LINEARMIPNEAREST,
  6482.     D3DFILTER_LINEARMIPLINEAR);
  6483.  
  6484.   PD3DBlend = ^TD3DBlend;
  6485.   TD3DBlend = (
  6486.     D3DBLEND_INVALID_0,
  6487.     D3DBLEND_ZERO,
  6488.     D3DBLEND_ONE,
  6489.     D3DBLEND_SRCCOLOR,
  6490.     D3DBLEND_INVSRCCOLOR,
  6491.     D3DBLEND_SRCALPHA,
  6492.     D3DBLEND_INVSRCALPHA,
  6493.     D3DBLEND_DESTALPHA,
  6494.     D3DBLEND_INVDESTALPHA,
  6495.     D3DBLEND_DESTCOLOR,
  6496.     D3DBLEND_INVDESTCOLOR,
  6497.     D3DBLEND_SRCALPHASAT,
  6498.     D3DBLEND_BOTHSRCALPHA,
  6499.     D3DBLEND_BOTHINVSRCALPHA);
  6500.  
  6501.   PD3DTextureBlend = ^TD3DTextureBlend;
  6502.   TD3DTextureBlend = (
  6503.     D3DTBLEND_INVALID_0,
  6504.     D3DTBLEND_DECAL,
  6505.     D3DTBLEND_MODULATE,
  6506.     D3DTBLEND_DECALALPHA,
  6507.     D3DTBLEND_MODULATEALPHA,
  6508.     D3DTBLEND_DECALMASK,
  6509.     D3DTBLEND_MODULATEMASK,
  6510.     D3DTBLEND_COPY,
  6511.     D3DTBLEND_ADD);
  6512.  
  6513.   PD3DTextureAddress = ^TD3DTextureAddress;
  6514.   TD3DTextureAddress = (
  6515.     D3DTADDRESS_INVALID_0,
  6516.     D3DTADDRESS_WRAP,
  6517.     D3DTADDRESS_MIRROR,
  6518.     D3DTADDRESS_CLAMP,
  6519.     D3DTADDRESS_BORDER);
  6520.  
  6521.   PD3DCull = ^TD3DCull;
  6522.   TD3DCull = (
  6523.     D3DCULL_INVALID_0,
  6524.     D3DCULL_NONE,
  6525.     D3DCULL_CW,
  6526.     D3DCULL_CCW);
  6527.  
  6528.   PD3DCmpFunc = ^TD3DCmpFunc;
  6529.   TD3DCmpFunc = (
  6530.     D3DCMP_INVALID_0,
  6531.     D3DCMP_NEVER,
  6532.     D3DCMP_LESS,
  6533.     D3DCMP_EQUAL,
  6534.     D3DCMP_LESSEQUAL,
  6535.     D3DCMP_GREATER,
  6536.     D3DCMP_NOTEQUAL,
  6537.     D3DCMP_GREATEREQUAL,
  6538.     D3DCMP_ALWAYS);
  6539.  
  6540.   PD3DStencilOp = ^TD3DStencilOp;
  6541.   TD3DStencilOp = (
  6542.     D3DSTENCILOP_INVALID_0,
  6543.     D3DSTENCILOP_KEEP,
  6544.     D3DSTENCILOP_ZERO,
  6545.     D3DSTENCILOP_REPLACE,
  6546.     D3DSTENCILOP_INCRSAT,
  6547.     D3DSTENCILOP_DECRSAT,
  6548.     D3DSTENCILOP_INVERT,
  6549.     D3DSTENCILOP_INCR,
  6550.     D3DSTENCILOP_DECR);
  6551.    
  6552.   PD3DFogMode = ^TD3DFogMode;
  6553.   TD3DFogMode = (
  6554.     D3DFOG_NONE,
  6555.     D3DFOG_EXP,
  6556.     D3DFOG_EXP2,
  6557.     D3DFOG_LINEAR);
  6558.  
  6559.   PD3DZBufferType = ^TD3DZBufferType;
  6560.   TD3DZBufferType = (
  6561.     D3DZB_FALSE,
  6562.     D3DZB_TRUE,   // Z buffering
  6563.     D3DZB_USEW);  // W buffering
  6564.  
  6565.   PD3DAntialiasMode = ^TD3DAntialiasMode;
  6566.   TD3DAntialiasMode = (
  6567.     D3DANTIALIAS_NONE,
  6568.     D3DANTIALIAS_SORTDEPENDENT,
  6569.     D3DANTIALIAS_SORTINDEPENDENT);
  6570.  
  6571. // Vertex types supported by Direct3D
  6572.   PD3DVertexType = ^TD3DVertexType;
  6573.   TD3DVertexType = (
  6574.     D3DVT_INVALID_0,
  6575.     D3DVT_VERTEX,
  6576.     D3DVT_LVERTEX,
  6577.     D3DVT_TLVERTEX);
  6578.  
  6579. // Primitives supported by draw-primitive API
  6580.   PD3DPrimitiveType = ^TD3DPrimitiveType;
  6581.   TD3DPrimitiveType = (
  6582.     D3DPT_INVALID_0,
  6583.     D3DPT_POINTLIST,
  6584.     D3DPT_LINELIST,
  6585.     D3DPT_LINESTRIP,
  6586.     D3DPT_TRIANGLELIST,
  6587.     D3DPT_TRIANGLESTRIP,
  6588.     D3DPT_TRIANGLEFAN);
  6589.  
  6590. (*
  6591.  * Amount to add to a state to generate the override for that state.
  6592.  *)
  6593.  
  6594. const
  6595.   D3DSTATE_OVERRIDE_BIAS          = 256;
  6596.  
  6597. (*
  6598.  * A state which sets the override flag for the specified state type.
  6599.  *)
  6600.  
  6601. function D3DSTATE_OVERRIDE(StateType: DWORD) : DWORD;
  6602.  
  6603. type
  6604.   PD3DTransformStateType = ^TD3DTransformStateType;
  6605.   TD3DTransformStateType = DWORD;
  6606. const
  6607.   D3DTRANSFORMSTATE_WORLD         = 1;
  6608.   D3DTRANSFORMSTATE_VIEW          = 2;
  6609.   D3DTRANSFORMSTATE_PROJECTION    = 3;
  6610.   D3DTRANSFORMSTATE_WORLD1        = 4;  // 2nd matrix to blend
  6611.   D3DTRANSFORMSTATE_WORLD2        = 5;  // 3rd matrix to blend
  6612.   D3DTRANSFORMSTATE_WORLD3        = 6;  // 4th matrix to blend
  6613.   D3DTRANSFORMSTATE_TEXTURE0      = 16;
  6614.   D3DTRANSFORMSTATE_TEXTURE1      = 17;
  6615.   D3DTRANSFORMSTATE_TEXTURE2      = 18;
  6616.   D3DTRANSFORMSTATE_TEXTURE3      = 19;
  6617.   D3DTRANSFORMSTATE_TEXTURE4      = 20;
  6618.   D3DTRANSFORMSTATE_TEXTURE5      = 21;
  6619.   D3DTRANSFORMSTATE_TEXTURE6      = 22;
  6620.   D3DTRANSFORMSTATE_TEXTURE7      = 23;
  6621.  
  6622. type
  6623.   PD3DLightStateType = ^TD3DLightStateType;
  6624.   TD3DLightStateType = (
  6625.     D3DLIGHTSTATE_INVALID_0,
  6626.     D3DLIGHTSTATE_MATERIAL,
  6627.     D3DLIGHTSTATE_AMBIENT,
  6628.     D3DLIGHTSTATE_COLORMODEL,
  6629.     D3DLIGHTSTATE_FOGMODE,
  6630.     D3DLIGHTSTATE_FOGSTART,
  6631.     D3DLIGHTSTATE_FOGEND,
  6632.     D3DLIGHTSTATE_FOGDENSITY,
  6633.     D3DLIGHTSTATE_COLORVERTEX);
  6634.  
  6635.   PD3DRenderStateType = ^TD3DRenderStateType;
  6636.   TD3DRenderStateType = DWORD;
  6637. const
  6638.     D3DRENDERSTATE_ANTIALIAS          = 2;    (* D3DANTIALIASMODE *)
  6639.     D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4;    (* TRUE for perspective correction *)
  6640.     D3DRENDERSTATE_ZENABLE            = 7;    (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *)
  6641.     D3DRENDERSTATE_FILLMODE           = 8;    (* D3DFILL_MODE        *)
  6642.     D3DRENDERSTATE_SHADEMODE          = 9;    (* D3DSHADEMODE *)
  6643.     D3DRENDERSTATE_LINEPATTERN        = 10;   (* D3DLINEPATTERN *)
  6644.     D3DRENDERSTATE_ZWRITEENABLE       = 14;   (* TRUE to enable z writes *)
  6645.     D3DRENDERSTATE_ALPHATESTENABLE    = 15;   (* TRUE to enable alpha tests *)
  6646.     D3DRENDERSTATE_LASTPIXEL          = 16;   (* TRUE for last-pixel on lines *)
  6647.     D3DRENDERSTATE_SRCBLEND           = 19;   (* D3DBLEND *)
  6648.     D3DRENDERSTATE_DESTBLEND          = 20;   (* D3DBLEND *)
  6649.     D3DRENDERSTATE_CULLMODE           = 22;   (* D3DCULL *)
  6650.     D3DRENDERSTATE_ZFUNC              = 23;   (* D3DCMPFUNC *)
  6651.     D3DRENDERSTATE_ALPHAREF           = 24;   (* D3DFIXED *)
  6652.     D3DRENDERSTATE_ALPHAFUNC          = 25;   (* D3DCMPFUNC *)
  6653.     D3DRENDERSTATE_DITHERENABLE       = 26;   (* TRUE to enable dithering *)
  6654.     D3DRENDERSTATE_ALPHABLENDENABLE   = 27;   (* TRUE to enable alpha blending *)
  6655.     D3DRENDERSTATE_FOGENABLE          = 28;   (* TRUE to enable fog blending *)
  6656.     D3DRENDERSTATE_SPECULARENABLE     = 29;   (* TRUE to enable specular *)
  6657.     D3DRENDERSTATE_ZVISIBLE           = 30;   (* TRUE to enable z checking *)
  6658.     D3DRENDERSTATE_STIPPLEDALPHA      = 33;   (* TRUE to enable stippled alpha (RGB device only) *)
  6659.     D3DRENDERSTATE_FOGCOLOR           = 34;   (* D3DCOLOR *)
  6660.     D3DRENDERSTATE_FOGTABLEMODE       = 35;   (* D3DFOGMODE *)
  6661.     D3DRENDERSTATE_FOGSTART           = 36;   (* Fog start (for both vertex and pixel fog) *)
  6662.     D3DRENDERSTATE_FOGEND             = 37;   (* Fog end      *)
  6663.     D3DRENDERSTATE_FOGDENSITY         = 38;   (* Fog density  *)
  6664.     D3DRENDERSTATE_EDGEANTIALIAS      = 40;   (* TRUE to enable edge antialiasing *)
  6665.     D3DRENDERSTATE_COLORKEYENABLE     = 41;   (* TRUE to enable source colorkeyed textures *)
  6666.     D3DRENDERSTATE_ZBIAS              = 47;   (* LONG Z bias *)
  6667.     D3DRENDERSTATE_RANGEFOGENABLE     = 48;   (* Enables range-based fog *)
  6668.  
  6669.     D3DRENDERSTATE_STENCILENABLE      = 52;   (* BOOL enable/disable stenciling *)
  6670.     D3DRENDERSTATE_STENCILFAIL        = 53;   (* D3DSTENCILOP to do if stencil test fails *)
  6671.     D3DRENDERSTATE_STENCILZFAIL       = 54;   (* D3DSTENCILOP to do if stencil test passes and Z test fails *)
  6672.     D3DRENDERSTATE_STENCILPASS        = 55;   (* D3DSTENCILOP to do if both stencil and Z tests pass *)
  6673.     D3DRENDERSTATE_STENCILFUNC        = 56;   (* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *)
  6674.     D3DRENDERSTATE_STENCILREF         = 57;   (* Reference value used in stencil test *)
  6675.     D3DRENDERSTATE_STENCILMASK        = 58;   (* Mask value used in stencil test *)
  6676.     D3DRENDERSTATE_STENCILWRITEMASK   = 59;   (* Write mask applied to values written to stencil buffer *)
  6677.     D3DRENDERSTATE_TEXTUREFACTOR      = 60;   (* D3DCOLOR used for multi-texture blend *)
  6678.  
  6679.     (*
  6680.      * 128 values [128; 255] are reserved for texture coordinate wrap flags.
  6681.      * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
  6682.      * a flags word preserves forward compatibility with texture coordinates
  6683.      * that are >2D.
  6684.      *)
  6685.     D3DRENDERSTATE_WRAP0              = 128;  (* wrap for 1st texture coord. set *)
  6686.     D3DRENDERSTATE_WRAP1              = 129;  (* wrap for 2nd texture coord. set *)
  6687.     D3DRENDERSTATE_WRAP2              = 130;  (* wrap for 3rd texture coord. set *)
  6688.     D3DRENDERSTATE_WRAP3              = 131;  (* wrap for 4th texture coord. set *)
  6689.     D3DRENDERSTATE_WRAP4              = 132;  (* wrap for 5th texture coord. set *)
  6690.     D3DRENDERSTATE_WRAP5              = 133;  (* wrap for 6th texture coord. set *)
  6691.     D3DRENDERSTATE_WRAP6              = 134;  (* wrap for 7th texture coord. set *)
  6692.     D3DRENDERSTATE_WRAP7              = 135;  (* wrap for 8th texture coord. set *)
  6693.     D3DRENDERSTATE_CLIPPING            = 136;
  6694.     D3DRENDERSTATE_LIGHTING            = 137;
  6695.     D3DRENDERSTATE_EXTENTS             = 138;
  6696.     D3DRENDERSTATE_AMBIENT             = 139;
  6697.     D3DRENDERSTATE_FOGVERTEXMODE       = 140;
  6698.     D3DRENDERSTATE_COLORVERTEX         = 141;
  6699.     D3DRENDERSTATE_LOCALVIEWER         = 142;
  6700.     D3DRENDERSTATE_NORMALIZENORMALS    = 143;
  6701.     D3DRENDERSTATE_COLORKEYBLENDENABLE = 144;
  6702.     D3DRENDERSTATE_DIFFUSEMATERIALSOURCE    = 145;
  6703.     D3DRENDERSTATE_SPECULARMATERIALSOURCE   = 146;
  6704.     D3DRENDERSTATE_AMBIENTMATERIALSOURCE    = 147;
  6705.     D3DRENDERSTATE_EMISSIVEMATERIALSOURCE   = 148;
  6706.     D3DRENDERSTATE_VERTEXBLEND              = 151;
  6707.     D3DRENDERSTATE_CLIPPLANEENABLE          = 152;
  6708.  
  6709. //
  6710. // retired renderstates - not supported for DX7 interfaces
  6711. //
  6712.     D3DRENDERSTATE_TEXTUREHANDLE      = 1;    (* Texture handle for legacy interfaces (Texture;Texture2) *)
  6713.     D3DRENDERSTATE_TEXTUREADDRESS     = 3;    (* D3DTEXTUREADDRESS  *)
  6714.     D3DRENDERSTATE_WRAPU              = 5;    (* TRUE for wrapping in u *)
  6715.     D3DRENDERSTATE_WRAPV              = 6;    (* TRUE for wrapping in v *)
  6716.     D3DRENDERSTATE_MONOENABLE         = 11;   (* TRUE to enable mono rasterization *)
  6717.     D3DRENDERSTATE_ROP2               = 12;   (* ROP2 *)
  6718.     D3DRENDERSTATE_PLANEMASK          = 13;   (* DWORD physical plane mask *)
  6719.     D3DRENDERSTATE_TEXTUREMAG         = 17;   (* D3DTEXTUREFILTER *)
  6720.     D3DRENDERSTATE_TEXTUREMIN         = 18;   (* D3DTEXTUREFILTER *)
  6721.     D3DRENDERSTATE_TEXTUREMAPBLEND    = 21;   (* D3DTEXTUREBLEND *)
  6722.     D3DRENDERSTATE_SUBPIXEL           = 31;   (* TRUE to enable subpixel correction *)
  6723.     D3DRENDERSTATE_SUBPIXELX          = 32;   (* TRUE to enable correction in X only *)
  6724.     D3DRENDERSTATE_STIPPLEENABLE      = 39;   (* TRUE to enable stippling *)
  6725.     D3DRENDERSTATE_BORDERCOLOR        = 43;   (* Border color for texturing w/border *)
  6726.     D3DRENDERSTATE_TEXTUREADDRESSU    = 44;   (* Texture addressing mode for U coordinate *)
  6727.     D3DRENDERSTATE_TEXTUREADDRESSV    = 45;   (* Texture addressing mode for V coordinate *)
  6728.     D3DRENDERSTATE_MIPMAPLODBIAS      = 46;   (* D3DVALUE Mipmap LOD bias *)
  6729.     D3DRENDERSTATE_ANISOTROPY         = 49;   (* Max. anisotropy. 1 = no anisotropy *)
  6730.     D3DRENDERSTATE_FLUSHBATCH         = 50;   (* Explicit flush for DP batching (DX5 Only) *)
  6731.     D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51; (* BOOL enable sort-independent transparency *)
  6732.     D3DRENDERSTATE_STIPPLEPATTERN00   = 64;   (* Stipple pattern 01...  *)
  6733.     D3DRENDERSTATE_STIPPLEPATTERN01   = 65;
  6734.     D3DRENDERSTATE_STIPPLEPATTERN02   = 66;
  6735.     D3DRENDERSTATE_STIPPLEPATTERN03   = 67;
  6736.     D3DRENDERSTATE_STIPPLEPATTERN04   = 68;
  6737.     D3DRENDERSTATE_STIPPLEPATTERN05   = 69;
  6738.     D3DRENDERSTATE_STIPPLEPATTERN06   = 70;
  6739.     D3DRENDERSTATE_STIPPLEPATTERN07   = 71;
  6740.     D3DRENDERSTATE_STIPPLEPATTERN08   = 72;
  6741.     D3DRENDERSTATE_STIPPLEPATTERN09   = 73;
  6742.     D3DRENDERSTATE_STIPPLEPATTERN10   = 74;
  6743.     D3DRENDERSTATE_STIPPLEPATTERN11   = 75;
  6744.     D3DRENDERSTATE_STIPPLEPATTERN12   = 76;
  6745.     D3DRENDERSTATE_STIPPLEPATTERN13   = 77;
  6746.     D3DRENDERSTATE_STIPPLEPATTERN14   = 78;
  6747.     D3DRENDERSTATE_STIPPLEPATTERN15   = 79;
  6748.     D3DRENDERSTATE_STIPPLEPATTERN16   = 80;
  6749.     D3DRENDERSTATE_STIPPLEPATTERN17   = 81;
  6750.     D3DRENDERSTATE_STIPPLEPATTERN18   = 82;
  6751.     D3DRENDERSTATE_STIPPLEPATTERN19   = 83;
  6752.     D3DRENDERSTATE_STIPPLEPATTERN20   = 84;
  6753.     D3DRENDERSTATE_STIPPLEPATTERN21   = 85;
  6754.     D3DRENDERSTATE_STIPPLEPATTERN22   = 86;
  6755.     D3DRENDERSTATE_STIPPLEPATTERN23   = 87;
  6756.     D3DRENDERSTATE_STIPPLEPATTERN24   = 88;
  6757.     D3DRENDERSTATE_STIPPLEPATTERN25   = 89;
  6758.     D3DRENDERSTATE_STIPPLEPATTERN26   = 90;
  6759.     D3DRENDERSTATE_STIPPLEPATTERN27   = 91;
  6760.     D3DRENDERSTATE_STIPPLEPATTERN28   = 92;
  6761.     D3DRENDERSTATE_STIPPLEPATTERN29   = 93;
  6762.     D3DRENDERSTATE_STIPPLEPATTERN30   = 94;
  6763.     D3DRENDERSTATE_STIPPLEPATTERN31   = 95;
  6764.  
  6765. //
  6766. // retired renderstate names - the values are still used under new naming conventions
  6767. //
  6768.     D3DRENDERSTATE_FOGTABLESTART      = 36;   (* Fog table start    *)
  6769.     D3DRENDERSTATE_FOGTABLEEND        = 37;   (* Fog table end      *)
  6770.     D3DRENDERSTATE_FOGTABLEDENSITY    = 38;   (* Fog table density  *)
  6771.  
  6772. type
  6773. // Values for material source
  6774.   PD3DMateralColorSource = ^TD3DMateralColorSource;
  6775.   TD3DMateralColorSource = (
  6776.     D3DMCS_MATERIAL,              // Color from material is used
  6777.     D3DMCS_COLOR1,                // Diffuse vertex color is used
  6778.     D3DMCS_COLOR2                 // Specular vertex color is used
  6779.   );
  6780.  
  6781. const
  6782.   // For back-compatibility with legacy compilations
  6783.   D3DRENDERSTATE_BLENDENABLE = D3DRENDERSTATE_ALPHABLENDENABLE;
  6784.  
  6785.  
  6786. // Bias to apply to the texture coordinate set to apply a wrap to.
  6787.    D3DRENDERSTATE_WRAPBIAS                = 128;
  6788.  
  6789. (* Flags to construct the WRAP render states *)
  6790.   D3DWRAP_U   = $00000001;
  6791.   D3DWRAP_V   = $00000002;
  6792.  
  6793. (* Flags to construct the WRAP render states for 1D thru 4D texture coordinates *)
  6794.   D3DWRAPCOORD_0   = $00000001;    // same as D3DWRAP_U
  6795.   D3DWRAPCOORD_1   = $00000002;    // same as D3DWRAP_V
  6796.   D3DWRAPCOORD_2   = $00000004;
  6797.   D3DWRAPCOORD_3   = $00000008;
  6798.  
  6799. function D3DRENDERSTATE_STIPPLEPATTERN(y: integer) : TD3DRenderStateType;
  6800.  
  6801. type
  6802.   PD3DState = ^TD3DState;
  6803.   TD3DState = packed record
  6804.     case Integer of
  6805.     0: (
  6806.       dtstTransformStateType: TD3DTransformStateType;
  6807.       dwArg: Array [ 0..0 ] of DWORD;
  6808.      );
  6809.     1: (
  6810.       dlstLightStateType: TD3DLightStateType;
  6811.       dvArg: Array [ 0..0 ] of TD3DValue;
  6812.      );
  6813.     2: (
  6814.       drstRenderStateType: TD3DRenderStateType;
  6815.      );
  6816.   end;
  6817.  
  6818. (*
  6819.  * Operation used to load matrices
  6820.  * hDstMat = hSrcMat
  6821.  *)
  6822.   PD3DMatrixLoad = ^TD3DMatrixLoad;
  6823.   TD3DMatrixLoad = packed record
  6824.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  6825.     hSrcMatrix: TD3DMatrixHandle;    (* Source matrix *)
  6826.   end;
  6827.  
  6828. (*
  6829.  * Operation used to multiply matrices
  6830.  * hDstMat = hSrcMat1 * hSrcMat2
  6831.  *)
  6832.   PD3DMatrixMultiply = ^TD3DMatrixMultiply;
  6833.   TD3DMatrixMultiply = packed record
  6834.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  6835.     hSrcMatrix1: TD3DMatrixHandle;   (* First source matrix *)
  6836.     hSrcMatrix2: TD3DMatrixHandle;   (* Second source matrix *)
  6837.   end;
  6838.  
  6839. (*
  6840.  * Operation used to transform and light vertices.
  6841.  *)
  6842.   PD3DProcessVertices = ^TD3DProcessVertices;
  6843.   TD3DProcessVertices = packed record
  6844.     dwFlags: DWORD;           (* Do we transform or light or just copy? *)
  6845.     wStart: WORD;             (* Index to first vertex in source *)
  6846.     wDest: WORD;              (* Index to first vertex in local buffer *)
  6847.     dwCount: DWORD;           (* Number of vertices to be processed *)
  6848.     dwReserved: DWORD;        (* Must be zero *)
  6849.   end;
  6850.  
  6851. const
  6852.   D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
  6853.   D3DPROCESSVERTICES_TRANSFORM            = $00000001;
  6854.   D3DPROCESSVERTICES_COPY                 = $00000002;
  6855.   D3DPROCESSVERTICES_OPMASK               = $00000007;
  6856.  
  6857.   D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
  6858.   D3DPROCESSVERTICES_NOCOLOR              = $00000010;
  6859.  
  6860.  
  6861. (*
  6862.  * State enumerants for per-stage texture processing.
  6863.  *)
  6864. type
  6865.   PD3DTextureStageStateType = ^TD3DTextureStageStateType;
  6866.   TD3DTextureStageStateType = DWORD;
  6867. const
  6868.   D3DTSS_COLOROP        =  1; (* D3DTEXTUREOP - per-stage blending controls for color channels *)
  6869.   D3DTSS_COLORARG1      =  2; (* D3DTA_* (texture arg) *)
  6870.   D3DTSS_COLORARG2      =  3; (* D3DTA_* (texture arg) *)
  6871.   D3DTSS_ALPHAOP        =  4; (* D3DTEXTUREOP - per-stage blending controls for alpha channel *)
  6872.   D3DTSS_ALPHAARG1      =  5; (* D3DTA_* (texture arg) *)
  6873.   D3DTSS_ALPHAARG2      =  6; (* D3DTA_* (texture arg) *)
  6874.   D3DTSS_BUMPENVMAT00   =  7; (* D3DVALUE (bump mapping matrix) *)
  6875.   D3DTSS_BUMPENVMAT01   =  8; (* D3DVALUE (bump mapping matrix) *)
  6876.   D3DTSS_BUMPENVMAT10   =  9; (* D3DVALUE (bump mapping matrix) *)
  6877.   D3DTSS_BUMPENVMAT11   = 10; (* D3DVALUE (bump mapping matrix) *)
  6878.   D3DTSS_TEXCOORDINDEX  = 11; (* identifies which set of texture coordinates index this texture *)
  6879.   D3DTSS_ADDRESS        = 12; (* D3DTEXTUREADDRESS for both coordinates *)
  6880.   D3DTSS_ADDRESSU       = 13; (* D3DTEXTUREADDRESS for U coordinate *)
  6881.   D3DTSS_ADDRESSV       = 14; (* D3DTEXTUREADDRESS for V coordinate *)
  6882.   D3DTSS_BORDERCOLOR    = 15; (* D3DCOLOR *)
  6883.   D3DTSS_MAGFILTER      = 16; (* D3DTEXTUREMAGFILTER filter to use for magnification *)
  6884.   D3DTSS_MINFILTER      = 17; (* D3DTEXTUREMINFILTER filter to use for minification *)
  6885.   D3DTSS_MIPFILTER      = 18; (* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification *)
  6886.   D3DTSS_MIPMAPLODBIAS  = 19; (* D3DVALUE Mipmap LOD bias *)
  6887.   D3DTSS_MAXMIPLEVEL    = 20; (* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) *)
  6888.   D3DTSS_MAXANISOTROPY  = 21; (* DWORD maximum anisotropy *)
  6889.   D3DTSS_BUMPENVLSCALE  = 22; (* D3DVALUE scale for bump map luminance *)
  6890.   D3DTSS_BUMPENVLOFFSET = 23; (* D3DVALUE offset for bump map luminance *)
  6891.   D3DTSS_TEXTURETRANSFORMFLAGS = 24; (* D3DTEXTURETRANSFORMFLAGS controls texture transform *)
  6892.  
  6893. // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
  6894. // and normal in the camera space) should be taken as texture coordinates
  6895. // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
  6896. //
  6897.   D3DTSS_TCI_PASSTHRU                             = $00000000;
  6898.   D3DTSS_TCI_CAMERASPACENORMAL                    = $00010000;
  6899.   D3DTSS_TCI_CAMERASPACEPOSITION                  = $00020000;
  6900.   D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR          = $00030000;
  6901.  
  6902. type
  6903. (*
  6904.  * Enumerations for COLOROP and ALPHAOP texture blending operations set in
  6905.  * texture processing stage controls in D3DRENDERSTATE.
  6906.  *)
  6907.   PD3DTextureOp = ^TD3DTextureOp;
  6908.   TD3DTextureOp = (
  6909.     D3DTOP_INVALID_0,
  6910. // Control
  6911.     D3DTOP_DISABLE   ,      // disables stage
  6912.     D3DTOP_SELECTARG1,      // the default
  6913.     D3DTOP_SELECTARG2,
  6914.  
  6915. // Modulate
  6916.     D3DTOP_MODULATE  ,      // multiply args together
  6917.     D3DTOP_MODULATE2X,      // multiply and  1 bit
  6918.     D3DTOP_MODULATE4X,      // multiply and  2 bits
  6919.  
  6920. // Add
  6921.     D3DTOP_ADD        ,   // add arguments together
  6922.     D3DTOP_ADDSIGNED  ,   // add with -0.5 bias
  6923.     D3DTOP_ADDSIGNED2X,   // as above but left  1 bit
  6924.     D3DTOP_SUBTRACT   ,   // Arg1 - Arg2, with no saturation
  6925.     D3DTOP_ADDSMOOTH  ,   // add 2 args, subtract product
  6926.                           // Arg1 + Arg2 - Arg1*Arg2
  6927.                           // = Arg1 + (1-Arg1)*Arg2
  6928.  
  6929. // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
  6930.     D3DTOP_BLENDDIFFUSEALPHA  , // iterated alpha
  6931.     D3DTOP_BLENDTEXTUREALPHA  , // texture alpha
  6932.     D3DTOP_BLENDFACTORALPHA   , // alpha from D3DRENDERSTATE_TEXTUREFACTOR
  6933.     // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
  6934.     D3DTOP_BLENDTEXTUREALPHAPM, // texture alpha
  6935.     D3DTOP_BLENDCURRENTALPHA  , // by alpha of current color
  6936.  
  6937. // Specular mapping
  6938.     D3DTOP_PREMODULATE           ,     // modulate with next texture before use
  6939.     D3DTOP_MODULATEALPHA_ADDCOLOR,     // Arg1.RGB + Arg1.A*Arg2.RGB
  6940.                                        // COLOROP only
  6941.     D3DTOP_MODULATECOLOR_ADDALPHA,     // Arg1.RGB*Arg2.RGB + Arg1.A
  6942.                                             // COLOROP only
  6943.     D3DTOP_MODULATEINVALPHA_ADDCOLOR,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
  6944.                                        // COLOROP only
  6945.     D3DTOP_MODULATEINVCOLOR_ADDALPHA,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
  6946.                                             // COLOROP only
  6947.  
  6948. // Bump mapping
  6949.     D3DTOP_BUMPENVMAP         , // per pixel env map perturbation
  6950.     D3DTOP_BUMPENVMAPLUMINANCE, // with luminance channel
  6951.     // This can do either diffuse or specular bump mapping with correct input.
  6952.     // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
  6953.     // where each component has been scaled and offset to make it signed.
  6954.     // The result is replicated into all four (including alpha) channels.
  6955.     // This is a valid COLOROP only.
  6956.     D3DTOP_DOTPRODUCT3
  6957.   );
  6958.  
  6959. (*
  6960.  * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
  6961.  * set in texture processing stage controls in D3DRENDERSTATE.
  6962.  *)
  6963. const
  6964.   D3DTA_SELECTMASK        = $0000000f;  // mask for arg selector
  6965.   D3DTA_DIFFUSE           = $00000000;  // select diffuse color
  6966.   D3DTA_CURRENT           = $00000001;  // select result of previous stage
  6967.   D3DTA_TEXTURE           = $00000002;  // select texture color
  6968.   D3DTA_TFACTOR           = $00000003;  // select RENDERSTATE_TEXTUREFACTOR
  6969.   D3DTA_SPECULAR          = $00000004;  // select specular color
  6970.   D3DTA_COMPLEMENT        = $00000010;  // take 1.0 - x
  6971.   D3DTA_ALPHAREPLICATE    = $00000020;  // replicate alpha to color components
  6972.  
  6973. (*
  6974.  *  IDirect3DTexture2 State Filter Types
  6975.  *)
  6976. type
  6977.   PD3DTextureMagFilter = ^TD3DTextureMagFilter;
  6978.   TD3DTextureMagFilter = (
  6979.     D3DTFG_INVALID_0,
  6980.     D3DTFG_POINT        ,    // nearest
  6981.     D3DTFG_LINEAR       ,    // linear interpolation
  6982.     D3DTFG_FLATCUBIC    ,    // cubic
  6983.     D3DTFG_GAUSSIANCUBIC,    // different cubic kernel
  6984.     D3DTFG_ANISOTROPIC
  6985.   );
  6986.  
  6987.   PD3DTextureMinFilter = ^TD3DTextureMinFilter;
  6988.   TD3DTextureMinFilter = (
  6989.     D3DTFN_INVALID_0,
  6990.     D3DTFN_POINT      ,    // nearest
  6991.     D3DTFN_LINEAR     ,    // linear interpolation
  6992.     D3DTFN_ANISOTROPIC
  6993.   );
  6994.  
  6995.   PD3DTextureMipFilter = ^TD3DTextureMipFilter;
  6996.   TD3DTextureMipFilter = (
  6997.     D3DTFP_INVALID_0,
  6998.     D3DTFP_NONE   ,    // mipmapping disabled (use MAG filter)
  6999.     D3DTFP_POINT  ,    // nearest
  7000.     D3DTFP_LINEAR      // linear interpolation
  7001.   );
  7002.  
  7003.  
  7004. (*
  7005.  * Triangle flags
  7006.  *)
  7007.  
  7008. (*
  7009.  * Tri strip and fan flags.
  7010.  * START loads all three vertices
  7011.  * EVEN and ODD load just v3 with even or odd culling
  7012.  * START_FLAT contains a count from 0 to 29 that allows the
  7013.  * whole strip or fan to be culled in one hit.
  7014.  * e.g. for a quad len = 1
  7015.  *)
  7016. const
  7017.   D3DTRIFLAG_START                        = $00000000;
  7018. // #define D3DTRIFLAG_STARTFLAT(len) (len)         (* 0 < len < 30 *)
  7019. function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
  7020.  
  7021. const
  7022.   D3DTRIFLAG_ODD                          = $0000001e;
  7023.   D3DTRIFLAG_EVEN                         = $0000001f;
  7024.  
  7025. (*
  7026.  * Triangle edge flags
  7027.  * enable edges for wireframe or antialiasing
  7028.  *)
  7029.   D3DTRIFLAG_EDGEENABLE1                  = $00000100; (* v0-v1 edge *)
  7030.   D3DTRIFLAG_EDGEENABLE2                  = $00000200; (* v1-v2 edge *)
  7031.   D3DTRIFLAG_EDGEENABLE3                  = $00000400; (* v2-v0 edge *)
  7032.   D3DTRIFLAG_EDGEENABLETRIANGLE = (
  7033.       D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3);
  7034.  
  7035. (*
  7036.  * Primitive structures and related defines.  Vertex offsets are to types
  7037.  * TD3DVertex, TD3DLVertex, or TD3DTLVertex.
  7038.  *)
  7039.  
  7040. (*
  7041.  * Triangle list primitive structure
  7042.  *)
  7043. type
  7044.   PD3DTriangle = ^TD3DTriangle;
  7045.   TD3DTriangle = packed record
  7046.     case Integer of
  7047.     0: (
  7048.       v1: WORD;            (* Vertex indices *)
  7049.       v2: WORD;
  7050.       v3: WORD;
  7051.       wFlags: WORD;        (* Edge (and other) flags *)
  7052.      );
  7053.     1: (
  7054.       wV1: WORD;
  7055.       wV2: WORD;
  7056.       wV3: WORD;
  7057.      );
  7058.   end;
  7059.  
  7060. (*
  7061.  * Line strip structure.
  7062.  * The instruction count - 1 defines the number of line segments.
  7063.  *)
  7064.   PD3DLine = ^TD3DLine;
  7065.   TD3DLine = packed record
  7066.     case Integer of
  7067.     0: (
  7068.       v1: WORD;            (* Vertex indices *)
  7069.       v2: WORD;
  7070.      );
  7071.     1: (
  7072.       wV1: WORD;
  7073.       wV2: WORD;
  7074.      );
  7075.   end;
  7076.  
  7077. (*
  7078.  * Span structure
  7079.  * Spans join a list of points with the same y value.
  7080.  * If the y value changes, a new span is started.
  7081.  *)
  7082.   PD3DSpan = ^TD3DSpan;
  7083.   TD3DSpan = packed record
  7084.     wCount: WORD;        (* Number of spans *)
  7085.     wFirst: WORD;        (* Index to first vertex *)
  7086.   end;
  7087.  
  7088. (*
  7089.  * Point structure
  7090.  *)
  7091.   PD3DPoint = ^TD3DPoint;
  7092.   TD3DPoint = packed record
  7093.     wCount: WORD;        (* number of points         *)
  7094.     wFirst: WORD;        (* index to first vertex    *)
  7095.   end;
  7096.  
  7097. (*
  7098.  * Forward branch structure.
  7099.  * Mask is logically anded with the driver status mask
  7100.  * if the result equals 'value', the branch is taken.
  7101.  *)
  7102.   PD3DBranch = ^TD3DBranch;
  7103.   TD3DBranch = packed record
  7104.     dwMask: DWORD;         (* Bitmask against D3D status *)
  7105.     dwValue: DWORD;
  7106.     bNegate: BOOL;         (* TRUE to negate comparison *)
  7107.     dwOffset: DWORD;       (* How far to branch forward (0 for exit)*)
  7108.   end;
  7109.  
  7110. (*
  7111.  * Status used for set status instruction.
  7112.  * The D3D status is initialised on device creation
  7113.  * and is modified by all execute calls.
  7114.  *)
  7115.   PD3DStatus = ^TD3DStatus;
  7116.   TD3DStatus = packed record
  7117.     dwFlags: DWORD;        (* Do we set extents or status *)
  7118.     dwStatus: DWORD;       (* D3D status *)
  7119.     drExtent: TD3DRect;
  7120.   end;
  7121.  
  7122. const
  7123.   D3DSETSTATUS_STATUS    = $00000001;
  7124.   D3DSETSTATUS_EXTENTS   = $00000002;
  7125.   D3DSETSTATUS_ALL      = (D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS);
  7126.  
  7127. type
  7128.   PD3DClipStatus = ^TD3DClipStatus;
  7129.   TD3DClipStatus = packed record
  7130.     dwFlags : DWORD; (* Do we set 2d extents, 3D extents or status *)
  7131.     dwStatus : DWORD; (* Clip status *)
  7132.     minx, maxx : float; (* X extents *)
  7133.     miny, maxy : float; (* Y extents *)
  7134.     minz, maxz : float; (* Z extents *)
  7135.   end;
  7136.  
  7137. const
  7138.   D3DCLIPSTATUS_STATUS        = $00000001;
  7139.   D3DCLIPSTATUS_EXTENTS2      = $00000002;
  7140.   D3DCLIPSTATUS_EXTENTS3      = $00000004;
  7141.  
  7142. (*
  7143.  * Statistics structure
  7144.  *)
  7145. type
  7146.   PD3DStats = ^TD3DStats;
  7147.   TD3DStats = packed record
  7148.     dwSize: DWORD;
  7149.     dwTrianglesDrawn: DWORD;
  7150.     dwLinesDrawn: DWORD;
  7151.     dwPointsDrawn: DWORD;
  7152.     dwSpansDrawn: DWORD;
  7153.     dwVerticesProcessed: DWORD;
  7154.   end;
  7155.  
  7156. (*
  7157.  * Execute options.
  7158.  * When calling using D3DEXECUTE_UNCLIPPED all the primitives
  7159.  * inside the buffer must be contained within the viewport.
  7160.  *)
  7161. const
  7162.   D3DEXECUTE_CLIPPED       = $00000001;
  7163.   D3DEXECUTE_UNCLIPPED     = $00000002;
  7164.  
  7165. type
  7166.   PD3DExecuteData = ^TD3DExecuteData;
  7167.   TD3DExecuteData = packed record
  7168.     dwSize: DWORD;
  7169.     dwVertexOffset: DWORD;
  7170.     dwVertexCount: DWORD;
  7171.     dwInstructionOffset: DWORD;
  7172.     dwInstructionLength: DWORD;
  7173.     dwHVertexOffset: DWORD;
  7174.     dsStatus: TD3DStatus;       (* Status after execute *)
  7175.   end;
  7176.  
  7177. (*
  7178.  * Palette flags.
  7179.  * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
  7180.  *)
  7181.  
  7182. const
  7183.   D3DPAL_FREE     = $00;    (* Renderer may use this entry freely *)
  7184.   D3DPAL_READONLY = $40;    (* Renderer may not set this entry *)
  7185.   D3DPAL_RESERVED = $80;    (* Renderer may not use this entry *)
  7186.  
  7187.  
  7188. type
  7189.   PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
  7190.   TD3DVertexBufferDesc = packed record
  7191.     dwSize : DWORD;
  7192.     dwCaps : DWORD;
  7193.     dwFVF : DWORD;
  7194.     dwNumVertices : DWORD;
  7195.   end;
  7196.  
  7197. const
  7198. (* These correspond to DDSCAPS_* flags *)
  7199.   D3DVBCAPS_SYSTEMMEMORY      = $00000800;
  7200.   D3DVBCAPS_WRITEONLY         = $00010000;
  7201.   D3DVBCAPS_OPTIMIZED         = $80000000;
  7202.   D3DVBCAPS_DONOTCLIP         = $00000001;
  7203.  
  7204. (* Vertex Operations for ProcessVertices *)
  7205.   D3DVOP_LIGHT      = (1 shl 10);
  7206.   D3DVOP_TRANSFORM  = (1 shl 0);
  7207.   D3DVOP_CLIP       = (1 shl 2);
  7208.   D3DVOP_EXTENTS    = (1 shl 3);
  7209.  
  7210. (* The maximum number of vertices user can pass to any d3d
  7211.    drawing function or to create vertex buffer with
  7212. *)
  7213.   D3DMAXNUMVERTICES  =  ((1 shl 16) - 1);
  7214. (* The maximum number of primitives user can pass to any d3d
  7215.    drawing function.
  7216. *)
  7217.   D3DMAXNUMPRIMITIVES = ((1 shl 16) - 1);
  7218.  
  7219. (* Bits for dwFlags in ProcessVertices call *)
  7220.   D3DPV_DONOTCOPYDATA = (1 shl 0);
  7221.  
  7222. //-------------------------------------------------------------------
  7223.  
  7224. // Flexible vertex format bits
  7225. //
  7226.   D3DFVF_RESERVED0        = $001;
  7227.   D3DFVF_POSITION_MASK    = $00E;
  7228.   D3DFVF_XYZ              = $002;
  7229.   D3DFVF_XYZRHW           = $004;
  7230.   D3DFVF_XYZB1            = $006;
  7231.   D3DFVF_XYZB2            = $008;
  7232.   D3DFVF_XYZB3            = $00a;
  7233.   D3DFVF_XYZB4            = $00c;
  7234.   D3DFVF_XYZB5            = $00e;
  7235.  
  7236.   D3DFVF_NORMAL           = $010;
  7237.   D3DFVF_RESERVED1        = $020;
  7238.   D3DFVF_DIFFUSE          = $040;
  7239.   D3DFVF_SPECULAR         = $080;
  7240.  
  7241.   D3DFVF_TEXCOUNT_MASK    = $f00;
  7242.   D3DFVF_TEXCOUNT_SHIFT   = 8;
  7243.   D3DFVF_TEX0             = $000;
  7244.   D3DFVF_TEX1             = $100;
  7245.   D3DFVF_TEX2             = $200;
  7246.   D3DFVF_TEX3             = $300;
  7247.   D3DFVF_TEX4             = $400;
  7248.   D3DFVF_TEX5             = $500;
  7249.   D3DFVF_TEX6             = $600;
  7250.   D3DFVF_TEX7             = $700;
  7251.   D3DFVF_TEX8             = $800;
  7252.  
  7253.   D3DFVF_RESERVED2        = $f000;  // 4 reserved bits
  7254.  
  7255.   D3DFVF_VERTEX = ( D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1 );
  7256.   D3DFVF_LVERTEX = ( D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or
  7257.                          D3DFVF_SPECULAR or D3DFVF_TEX1 );
  7258.   D3DFVF_TLVERTEX = ( D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or
  7259.                           D3DFVF_TEX1 );
  7260.  
  7261. type
  7262.   PD3DDP_PtrStride = ^TD3DDP_PtrStride;
  7263.   TD3DDP_PtrStride = packed record
  7264.     lpvData : pointer;
  7265.     dwStride : DWORD;
  7266.   end;
  7267.  
  7268. const
  7269.   D3DDP_MAXTEXCOORD = 8;
  7270.  
  7271. type
  7272.   PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData;
  7273.   TD3DDrawPrimitiveStridedData = packed record
  7274.     position : TD3DDP_PtrStride;
  7275.     normal : TD3DDP_PtrStride;
  7276.     diffuse : TD3DDP_PtrStride;
  7277.     specular : TD3DDP_PtrStride;
  7278.     textureCoords : array [0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride;
  7279.   end;
  7280.  
  7281. //---------------------------------------------------------------------
  7282. // ComputeSphereVisibility return values
  7283. //
  7284. const
  7285.   D3DVIS_INSIDE_FRUSTUM      = 0;
  7286.   D3DVIS_INTERSECT_FRUSTUM   = 1;
  7287.   D3DVIS_OUTSIDE_FRUSTUM     = 2;
  7288.   D3DVIS_INSIDE_LEFT         = 0;
  7289.   D3DVIS_INTERSECT_LEFT      = (1 shl 2);
  7290.   D3DVIS_OUTSIDE_LEFT        = (2 shl 2);
  7291.   D3DVIS_INSIDE_RIGHT        = 0;
  7292.   D3DVIS_INTERSECT_RIGHT     = (1 shl 4);
  7293.   D3DVIS_OUTSIDE_RIGHT       = (2 shl 4);
  7294.   D3DVIS_INSIDE_TOP          = 0;
  7295.   D3DVIS_INTERSECT_TOP       = (1 shl 6);
  7296.   D3DVIS_OUTSIDE_TOP         = (2 shl 6);
  7297.   D3DVIS_INSIDE_BOTTOM       = 0;
  7298.   D3DVIS_INTERSECT_BOTTOM    = (1 shl 8);
  7299.   D3DVIS_OUTSIDE_BOTTOM      = (2 shl 8);
  7300.   D3DVIS_INSIDE_NEAR         = 0;
  7301.   D3DVIS_INTERSECT_NEAR      = (1 shl 10);
  7302.   D3DVIS_OUTSIDE_NEAR        = (2 shl 10);
  7303.   D3DVIS_INSIDE_FAR          = 0;
  7304.   D3DVIS_INTERSECT_FAR       = (1 shl 12);
  7305.   D3DVIS_OUTSIDE_FAR         = (2 shl 12);
  7306.  
  7307.   D3DVIS_MASK_FRUSTUM        = (3 shl 0);
  7308.   D3DVIS_MASK_LEFT           = (3 shl 2);
  7309.   D3DVIS_MASK_RIGHT          = (3 shl 4);
  7310.   D3DVIS_MASK_TOP            = (3 shl 6);
  7311.   D3DVIS_MASK_BOTTOM         = (3 shl 8);
  7312.   D3DVIS_MASK_NEAR           = (3 shl 10);
  7313.   D3DVIS_MASK_FAR            = (3 shl 12);
  7314.  
  7315. // To be used with GetInfo()
  7316.   D3DDEVINFOID_TEXTUREMANAGER    = 1;
  7317.   D3DDEVINFOID_D3DTEXTUREMANAGER = 2;
  7318.   D3DDEVINFOID_TEXTURING         = 3;
  7319.  
  7320. type
  7321.   PD3DStateBlockType = ^TD3DStateBlockType;
  7322.   TD3DStateBlockType = (
  7323.     D3DSBT_INVALID_0   ,
  7324.     D3DSBT_ALL         , // capture all state
  7325.     D3DSBT_PIXELSTATE  , // capture pixel state
  7326.     D3DSBT_VERTEXSTATE   // capture vertex state
  7327.   );
  7328.  
  7329. // The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
  7330. //
  7331.   PD3DVertexBlendFlags = ^TD3DVertexBlendFlags;
  7332.   TD3DVertexBlendFlags = (
  7333.     D3DVBLEND_DISABLE , // Disable vertex blending
  7334.     D3DVBLEND_1WEIGHT , // blend between 2 matrices
  7335.     D3DVBLEND_2WEIGHTS, // blend between 3 matrices
  7336.     D3DVBLEND_3WEIGHTS  // blend between 4 matrices
  7337.   );
  7338.  
  7339.   PD3DTextureTransformFlags = ^TD3DTextureTransformFlags;
  7340.   TD3DTextureTransformFlags = (
  7341.     D3DTTFF_DISABLE ,    // texture coordinates are passed directly
  7342.     D3DTTFF_COUNT1  ,    // rasterizer should expect 1-D texture coords
  7343.     D3DTTFF_COUNT2  ,    // rasterizer should expect 2-D texture coords
  7344.     D3DTTFF_COUNT3  ,    // rasterizer should expect 3-D texture coords
  7345.     D3DTTFF_COUNT4       // rasterizer should expect 4-D texture coords
  7346.   );
  7347.  
  7348. const
  7349.   D3DTTFF_PROJECTED       = TD3DTextureTransformFlags(256); // texcoords to be divided by COUNTth element
  7350.  
  7351. // Macros to set texture coordinate format bits in the FVF id
  7352.  
  7353. D3DFVF_TEXTUREFORMAT2 = 0;         // Two floating point values
  7354. D3DFVF_TEXTUREFORMAT1 = 3;         // One floating point value
  7355. D3DFVF_TEXTUREFORMAT3 = 1;         // Three floating point values
  7356. D3DFVF_TEXTUREFORMAT4 = 2;         // Four floating point values
  7357.  
  7358. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD) : DWORD;
  7359. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD) : DWORD;
  7360. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD) : DWORD;
  7361. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD) : DWORD;
  7362.  
  7363. (*==========================================================================;
  7364.  *
  7365.  *
  7366.  *  File:       d3dcaps.h
  7367.  *  Content:    Direct3D capabilities include file
  7368.  *
  7369.  ***************************************************************************)
  7370.  
  7371. (* Description of capabilities of transform *)
  7372.  
  7373. type
  7374.   PD3DTransformCaps = ^TD3DTransformCaps;
  7375.   TD3DTransformCaps = packed record
  7376.     dwSize: DWORD;
  7377.     dwCaps: DWORD;
  7378.   end;
  7379.  
  7380. const
  7381.   D3DTRANSFORMCAPS_CLIP         = $00000001; (* Will clip whilst transforming *)
  7382.  
  7383. (* Description of capabilities of lighting *)
  7384.  
  7385. type
  7386.   PD3DLightingCaps = ^TD3DLightingCaps;
  7387.   TD3DLightingCaps = packed record
  7388.     dwSize: DWORD;
  7389.     dwCaps: DWORD;                   (* Lighting caps *)
  7390.     dwLightingModel: DWORD;          (* Lighting model - RGB or mono *)
  7391.     dwNumLights: DWORD;              (* Number of lights that can be handled *)
  7392.   end;
  7393.  
  7394. const
  7395.   D3DLIGHTINGMODEL_RGB            = $00000001;
  7396.   D3DLIGHTINGMODEL_MONO           = $00000002;
  7397.  
  7398.   D3DLIGHTCAPS_POINT              = $00000001; (* Point lights supported *)
  7399.   D3DLIGHTCAPS_SPOT               = $00000002; (* Spot lights supported *)
  7400.   D3DLIGHTCAPS_DIRECTIONAL        = $00000004; (* Directional lights supported *)
  7401.   D3DLIGHTCAPS_PARALLELPOINT      = $00000008; (* Parallel point lights supported *)
  7402.   D3DLIGHTCAPS_GLSPOT             = $00000010; (* GL syle spot lights supported *)
  7403.  
  7404. (* Description of capabilities for each primitive type *)
  7405.  
  7406. type
  7407.   PD3DPrimCaps = ^TD3DPrimCaps;
  7408.   TD3DPrimCaps = packed record
  7409.     dwSize: DWORD;
  7410.     dwMiscCaps: DWORD;                 (* Capability flags *)
  7411.     dwRasterCaps: DWORD;
  7412.     dwZCmpCaps: DWORD;
  7413.     dwSrcBlendCaps: DWORD;
  7414.     dwDestBlendCaps: DWORD;
  7415.     dwAlphaCmpCaps: DWORD;
  7416.     dwShadeCaps: DWORD;
  7417.     dwTextureCaps: DWORD;
  7418.     dwTextureFilterCaps: DWORD;
  7419.     dwTextureBlendCaps: DWORD;
  7420.     dwTextureAddressCaps: DWORD;
  7421.     dwStippleWidth: DWORD;             (* maximum width and height of *)
  7422.     dwStippleHeight: DWORD;            (* of supported stipple (up to 32x32) *)
  7423.   end;
  7424.  
  7425. const
  7426. (* TD3DPrimCaps dwMiscCaps *)
  7427.  
  7428.   D3DPMISCCAPS_MASKPLANES         = $00000001;
  7429.   D3DPMISCCAPS_MASKZ              = $00000002;
  7430.   D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
  7431.   D3DPMISCCAPS_CONFORMANT         = $00000008;
  7432.   D3DPMISCCAPS_CULLNONE           = $00000010;
  7433.   D3DPMISCCAPS_CULLCW             = $00000020;
  7434.   D3DPMISCCAPS_CULLCCW            = $00000040;
  7435.  
  7436. (* TD3DPrimCaps dwRasterCaps *)
  7437.  
  7438.   D3DPRASTERCAPS_DITHER           = $00000001;
  7439.   D3DPRASTERCAPS_ROP2             = $00000002;
  7440.   D3DPRASTERCAPS_XOR              = $00000004;
  7441.   D3DPRASTERCAPS_PAT              = $00000008;
  7442.   D3DPRASTERCAPS_ZTEST            = $00000010;
  7443.   D3DPRASTERCAPS_SUBPIXEL         = $00000020;
  7444.   D3DPRASTERCAPS_SUBPIXELX        = $00000040;
  7445.   D3DPRASTERCAPS_FOGVERTEX        = $00000080;
  7446.   D3DPRASTERCAPS_FOGTABLE         = $00000100;
  7447.   D3DPRASTERCAPS_STIPPLE          = $00000200;
  7448.   D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT   = $00000400;
  7449.   D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = $00000800;
  7450.   D3DPRASTERCAPS_ANTIALIASEDGES           = $00001000;
  7451.   D3DPRASTERCAPS_MIPMAPLODBIAS            = $00002000;
  7452.   D3DPRASTERCAPS_ZBIAS                    = $00004000;
  7453.   D3DPRASTERCAPS_ZBUFFERLESSHSR           = $00008000;
  7454.   D3DPRASTERCAPS_FOGRANGE                 = $00010000;
  7455.   D3DPRASTERCAPS_ANISOTROPY               = $00020000;
  7456.   D3DPRASTERCAPS_WBUFFER                      = $00040000;
  7457.   D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT   = $00080000;
  7458.   D3DPRASTERCAPS_WFOG                         = $00100000;
  7459.   D3DPRASTERCAPS_ZFOG                         = $00200000;
  7460.  
  7461. (* TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps *)
  7462.  
  7463. const
  7464.   D3DPCMPCAPS_NEVER               = $00000001;
  7465.   D3DPCMPCAPS_LESS                = $00000002;
  7466.   D3DPCMPCAPS_EQUAL               = $00000004;
  7467.   D3DPCMPCAPS_LESSEQUAL           = $00000008;
  7468.   D3DPCMPCAPS_GREATER             = $00000010;
  7469.   D3DPCMPCAPS_NOTEQUAL            = $00000020;
  7470.   D3DPCMPCAPS_GREATEREQUAL        = $00000040;
  7471.   D3DPCMPCAPS_ALWAYS              = $00000080;
  7472.  
  7473. (* TD3DPrimCaps dwSourceBlendCaps, dwDestBlendCaps *)
  7474.  
  7475.   D3DPBLENDCAPS_ZERO              = $00000001;
  7476.   D3DPBLENDCAPS_ONE               = $00000002;
  7477.   D3DPBLENDCAPS_SRCCOLOR          = $00000004;
  7478.   D3DPBLENDCAPS_INVSRCCOLOR       = $00000008;
  7479.   D3DPBLENDCAPS_SRCALPHA          = $00000010;
  7480.   D3DPBLENDCAPS_INVSRCALPHA       = $00000020;
  7481.   D3DPBLENDCAPS_DESTALPHA         = $00000040;
  7482.   D3DPBLENDCAPS_INVDESTALPHA      = $00000080;
  7483.   D3DPBLENDCAPS_DESTCOLOR         = $00000100;
  7484.   D3DPBLENDCAPS_INVDESTCOLOR      = $00000200;
  7485.   D3DPBLENDCAPS_SRCALPHASAT       = $00000400;
  7486.   D3DPBLENDCAPS_BOTHSRCALPHA      = $00000800;
  7487.   D3DPBLENDCAPS_BOTHINVSRCALPHA   = $00001000;
  7488.  
  7489. (* TD3DPrimCaps dwShadeCaps *)
  7490.  
  7491.   D3DPSHADECAPS_COLORFLATMONO             = $00000001;
  7492.   D3DPSHADECAPS_COLORFLATRGB              = $00000002;
  7493.   D3DPSHADECAPS_COLORGOURAUDMONO          = $00000004;
  7494.   D3DPSHADECAPS_COLORGOURAUDRGB           = $00000008;
  7495.   D3DPSHADECAPS_COLORPHONGMONO            = $00000010;
  7496.   D3DPSHADECAPS_COLORPHONGRGB             = $00000020;
  7497.  
  7498.   D3DPSHADECAPS_SPECULARFLATMONO          = $00000040;
  7499.   D3DPSHADECAPS_SPECULARFLATRGB           = $00000080;
  7500.   D3DPSHADECAPS_SPECULARGOURAUDMONO       = $00000100;
  7501.   D3DPSHADECAPS_SPECULARGOURAUDRGB        = $00000200;
  7502.   D3DPSHADECAPS_SPECULARPHONGMONO         = $00000400;
  7503.   D3DPSHADECAPS_SPECULARPHONGRGB          = $00000800;
  7504.  
  7505.   D3DPSHADECAPS_ALPHAFLATBLEND            = $00001000;
  7506.   D3DPSHADECAPS_ALPHAFLATSTIPPLED         = $00002000;
  7507.   D3DPSHADECAPS_ALPHAGOURAUDBLEND         = $00004000;
  7508.   D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED      = $00008000;
  7509.   D3DPSHADECAPS_ALPHAPHONGBLEND           = $00010000;
  7510.   D3DPSHADECAPS_ALPHAPHONGSTIPPLED        = $00020000;
  7511.  
  7512.   D3DPSHADECAPS_FOGFLAT                   = $00040000;
  7513.   D3DPSHADECAPS_FOGGOURAUD                = $00080000;
  7514.   D3DPSHADECAPS_FOGPHONG                  = $00100000;
  7515.  
  7516. (* TD3DPrimCaps dwTextureCaps *)
  7517.  
  7518. (*
  7519.  * Perspective-correct texturing is supported
  7520.  *)
  7521.   D3DPTEXTURECAPS_PERSPECTIVE     = $00000001;
  7522.  
  7523. (*
  7524.  * Power-of-2 texture dimensions are required
  7525.  *)
  7526.   D3DPTEXTURECAPS_POW2            = $00000002;
  7527.  
  7528. (*
  7529.  * Alpha in texture pixels is supported
  7530.  *)
  7531.   D3DPTEXTURECAPS_ALPHA           = $00000004;
  7532.  
  7533. (*
  7534.  * Color-keyed textures are supported
  7535.  *)
  7536.   D3DPTEXTURECAPS_TRANSPARENCY    = $00000008;
  7537.  
  7538. (*
  7539.  * obsolete, see D3DPTADDRESSCAPS_BORDER
  7540.  *)
  7541.   D3DPTEXTURECAPS_BORDER          = $00000010;
  7542.  
  7543. (*
  7544.  * Only square textures are supported
  7545.  *)
  7546.   D3DPTEXTURECAPS_SQUAREONLY      = $00000020;
  7547.  
  7548. (*
  7549.  * Texture indices are not scaled by the texture size prior
  7550.  * to interpolation.
  7551.  *)
  7552.   D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040;
  7553.  
  7554. (*
  7555.  * Device can draw alpha from texture palettes
  7556.  *)
  7557.   D3DPTEXTURECAPS_ALPHAPALETTE    = $00000080;
  7558.  
  7559. (*
  7560.  * Device can use non-POW2 textures if:
  7561.  *  1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
  7562.  *  2) D3DRS_WRAP(N) is zero for this texture's coordinates
  7563.  *  3) mip mapping is not enabled (use magnification filter only)
  7564.  *)
  7565.   D3DPTEXTURECAPS_NONPOW2CONDITIONAL  = $00000100;
  7566.  
  7567. // 0x00000200L unused
  7568.  
  7569. (*
  7570.  * Device can divide transformed texture coordinates by the
  7571.  * COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
  7572.  *)
  7573.   D3DPTEXTURECAPS_PROJECTED  = $00000400;
  7574.  
  7575. (*
  7576.  * Device can do cubemap textures
  7577.  *)
  7578.   D3DPTEXTURECAPS_CUBEMAP           = $00000800;
  7579.  
  7580.   D3DPTEXTURECAPS_COLORKEYBLEND     = $00001000;
  7581.  
  7582.  
  7583. (* TD3DPrimCaps dwTextureFilterCaps *)
  7584.  
  7585.   D3DPTFILTERCAPS_NEAREST         = $00000001;
  7586.   D3DPTFILTERCAPS_LINEAR          = $00000002;
  7587.   D3DPTFILTERCAPS_MIPNEAREST      = $00000004;
  7588.   D3DPTFILTERCAPS_MIPLINEAR       = $00000008;
  7589.   D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010;
  7590.   D3DPTFILTERCAPS_LINEARMIPLINEAR = $00000020;
  7591.  
  7592. (* Device3 Min Filter *)
  7593.   D3DPTFILTERCAPS_MINFPOINT       = $00000100;
  7594.   D3DPTFILTERCAPS_MINFLINEAR      = $00000200;
  7595.   D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400;
  7596.  
  7597. (* Device3 Mip Filter *)
  7598.   D3DPTFILTERCAPS_MIPFPOINT       = $00010000;
  7599.   D3DPTFILTERCAPS_MIPFLINEAR      = $00020000;
  7600.  
  7601. (* Device3 Mag Filter *)
  7602.   D3DPTFILTERCAPS_MAGFPOINT         = $01000000;
  7603.   D3DPTFILTERCAPS_MAGFLINEAR        = $02000000;
  7604.   D3DPTFILTERCAPS_MAGFANISOTROPIC   = $04000000;
  7605.   D3DPTFILTERCAPS_MAGFAFLATCUBIC    = $08000000;
  7606.   D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000;
  7607.  
  7608. (* TD3DPrimCaps dwTextureBlendCaps *)
  7609.  
  7610.   D3DPTBLENDCAPS_DECAL            = $00000001;
  7611.   D3DPTBLENDCAPS_MODULATE         = $00000002;
  7612.   D3DPTBLENDCAPS_DECALALPHA       = $00000004;
  7613.   D3DPTBLENDCAPS_MODULATEALPHA    = $00000008;
  7614.   D3DPTBLENDCAPS_DECALMASK        = $00000010;
  7615.   D3DPTBLENDCAPS_MODULATEMASK     = $00000020;
  7616.   D3DPTBLENDCAPS_COPY             = $00000040;
  7617.   D3DPTBLENDCAPS_ADD                      = $00000080;
  7618.  
  7619. (* TD3DPrimCaps dwTextureAddressCaps *)
  7620.   D3DPTADDRESSCAPS_WRAP           = $00000001;
  7621.   D3DPTADDRESSCAPS_MIRROR         = $00000002;
  7622.   D3DPTADDRESSCAPS_CLAMP          = $00000004;
  7623.   D3DPTADDRESSCAPS_BORDER         = $00000008;
  7624.   D3DPTADDRESSCAPS_INDEPENDENTUV  = $00000010;
  7625.  
  7626. (* D3DDEVICEDESC dwStencilCaps *)
  7627.  
  7628.   D3DSTENCILCAPS_KEEP     = $00000001;
  7629.   D3DSTENCILCAPS_ZERO     = $00000002;
  7630.   D3DSTENCILCAPS_REPLACE  = $00000004;
  7631.   D3DSTENCILCAPS_INCRSAT  = $00000008;
  7632.   D3DSTENCILCAPS_DECRSAT  = $00000010;
  7633.   D3DSTENCILCAPS_INVERT   = $00000020;
  7634.   D3DSTENCILCAPS_INCR     = $00000040;
  7635.   D3DSTENCILCAPS_DECR     = $00000080;
  7636.  
  7637. (* D3DDEVICEDESC dwTextureOpCaps *)
  7638.  
  7639.   D3DTEXOPCAPS_DISABLE                    = $00000001;
  7640.   D3DTEXOPCAPS_SELECTARG1                 = $00000002;
  7641.   D3DTEXOPCAPS_SELECTARG2                 = $00000004;
  7642.   D3DTEXOPCAPS_MODULATE                   = $00000008;
  7643.   D3DTEXOPCAPS_MODULATE2X                 = $00000010;
  7644.   D3DTEXOPCAPS_MODULATE4X                 = $00000020;
  7645.   D3DTEXOPCAPS_ADD                        = $00000040;
  7646.   D3DTEXOPCAPS_ADDSIGNED                  = $00000080;
  7647.   D3DTEXOPCAPS_ADDSIGNED2X                = $00000100;
  7648.   D3DTEXOPCAPS_SUBTRACT                   = $00000200;
  7649.   D3DTEXOPCAPS_ADDSMOOTH                  = $00000400;
  7650.   D3DTEXOPCAPS_BLENDDIFFUSEALPHA          = $00000800;
  7651.   D3DTEXOPCAPS_BLENDTEXTUREALPHA          = $00001000;
  7652.   D3DTEXOPCAPS_BLENDFACTORALPHA           = $00002000;
  7653.   D3DTEXOPCAPS_BLENDTEXTUREALPHAPM        = $00004000;
  7654.   D3DTEXOPCAPS_BLENDCURRENTALPHA          = $00008000;
  7655.   D3DTEXOPCAPS_PREMODULATE                = $00010000;
  7656.   D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR     = $00020000;
  7657.   D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA     = $00040000;
  7658.   D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR  = $00080000;
  7659.   D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA  = $00100000;
  7660.   D3DTEXOPCAPS_BUMPENVMAP                 = $00200000;
  7661.   D3DTEXOPCAPS_BUMPENVMAPLUMINANCE        = $00400000;
  7662.   D3DTEXOPCAPS_DOTPRODUCT3                = $00800000;
  7663.  
  7664. (* D3DDEVICEDESC dwFVFCaps flags *)
  7665.  
  7666.   D3DFVFCAPS_TEXCOORDCOUNTMASK    = $0000ffff; (* mask for texture coordinate count field *)
  7667.   D3DFVFCAPS_DONOTSTRIPELEMENTS   = $00080000; (* Device prefers that vertex elements not be stripped *)
  7668.  
  7669. (*
  7670.  * Description for a device.
  7671.  * This is used to describe a device that is to be created or to query
  7672.  * the current device.
  7673.  *)
  7674.  
  7675. type
  7676.   PD3DDeviceDesc = ^TD3DDeviceDesc;
  7677.   TD3DDeviceDesc = packed record
  7678.     dwSize: DWORD;                       (* Size of TD3DDeviceDesc structure *)
  7679.     dwFlags: DWORD;                      (* Indicates which fields have valid data *)
  7680.     dcmColorModel: TD3DColorModel;        (* Color model of device *)
  7681.     dwDevCaps: DWORD;                    (* Capabilities of device *)
  7682.     dtcTransformCaps: TD3DTransformCaps;  (* Capabilities of transform *)
  7683.     bClipping: BOOL;                     (* Device can do 3D clipping *)
  7684.     dlcLightingCaps: TD3DLightingCaps;    (* Capabilities of lighting *)
  7685.     dpcLineCaps: TD3DPrimCaps;
  7686.     dpcTriCaps: TD3DPrimCaps;
  7687.     dwDeviceRenderBitDepth: DWORD;       (* One of DDBB_8, 16, etc.. *)
  7688.     dwDeviceZBufferBitDepth: DWORD;      (* One of DDBD_16, 32, etc.. *)
  7689.     dwMaxBufferSize: DWORD;              (* Maximum execute buffer size *)
  7690.     dwMaxVertexCount: DWORD;             (* Maximum vertex count *)
  7691.     // *** New fields for DX5 *** //
  7692.  
  7693.     // Width and height caps are 0 for legacy HALs.
  7694.     dwMinTextureWidth, dwMinTextureHeight  : DWORD;
  7695.     dwMaxTextureWidth, dwMaxTextureHeight  : DWORD;
  7696.     dwMinStippleWidth, dwMaxStippleWidth   : DWORD;
  7697.     dwMinStippleHeight, dwMaxStippleHeight : DWORD;
  7698.  
  7699.     // New fields for DX6
  7700.     dwMaxTextureRepeat : DWORD;
  7701.     dwMaxTextureAspectRatio : DWORD;
  7702.     dwMaxAnisotropy : DWORD;
  7703.  
  7704.     // Guard band that the rasterizer can accommodate
  7705.     // Screen-space vertices inside this space but outside the viewport
  7706.     // will get clipped properly.
  7707.     dvGuardBandLeft : TD3DValue;
  7708.     dvGuardBandTop : TD3DValue;
  7709.     dvGuardBandRight : TD3DValue;
  7710.     dvGuardBandBottom : TD3DValue;
  7711.  
  7712.     dvExtentsAdjust : TD3DValue;
  7713.     dwStencilCaps : DWORD;
  7714.  
  7715.     dwFVFCaps : DWORD;  (* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware *)
  7716.     dwTextureOpCaps : DWORD;
  7717.     wMaxTextureBlendStages : WORD;
  7718.     wMaxSimultaneousTextures : WORD;
  7719.   end;
  7720.  
  7721.   PD3DDeviceDesc7 = ^TD3DDeviceDesc7;
  7722.   TD3DDeviceDesc7 = packed record
  7723.     dwDevCaps:               DWORD;             (* Capabilities of device *)
  7724.     dpcLineCaps:             TD3DPrimCaps;
  7725.     dpcTriCaps:              TD3DPrimCaps;
  7726.     dwDeviceRenderBitDepth:  DWORD;             (* One of DDBB_8, 16, etc.. *)
  7727.     dwDeviceZBufferBitDepth: DWORD;             (* One of DDBD_16, 32, etc.. *)
  7728.  
  7729.     dwMinTextureWidth, dwMinTextureHeight: DWORD;
  7730.     dwMaxTextureWidth, dwMaxTextureHeight: DWORD;
  7731.  
  7732.     dwMaxTextureRepeat:                    DWORD;
  7733.     dwMaxTextureAspectRatio:               DWORD;
  7734.     dwMaxAnisotropy:                       DWORD;
  7735.  
  7736.     dvGuardBandLeft:                       TD3DValue;
  7737.     dvGuardBandTop:                        TD3DValue;
  7738.     dvGuardBandRight:                      TD3DValue;
  7739.     dvGuardBandBottom:                     TD3DValue;
  7740.  
  7741.     dvExtentsAdjust:                       TD3DValue;
  7742.     dwStencilCaps:                         DWORD;
  7743.  
  7744.     dwFVFCaps:                             DWORD;
  7745.     dwTextureOpCaps:                       DWORD;
  7746.     wMaxTextureBlendStages:                WORD;
  7747.     wMaxSimultaneousTextures:              WORD;
  7748.  
  7749.     dwMaxActiveLights:                     DWORD;
  7750.     dvMaxVertexW:                          TD3DValue;
  7751.     deviceGUID:                            TGUID;
  7752.  
  7753.     wMaxUserClipPlanes:                    WORD;
  7754.     wMaxVertexBlendMatrices:               WORD;
  7755.  
  7756.     dwVertexProcessingCaps:                DWORD;
  7757.  
  7758.     dwReserved1:                           DWORD;
  7759.     dwReserved2:                           DWORD;
  7760.     dwReserved3:                           DWORD;
  7761.     dwReserved4:                           DWORD;
  7762.   end;
  7763.  
  7764. const
  7765.   D3DDEVICEDESCSIZE = sizeof(TD3DDeviceDesc);
  7766.   D3DDEVICEDESC7SIZE = sizeof(TD3DDeviceDesc7);
  7767.  
  7768. type
  7769.   TD3DEnumDevicesCallbackA = function (lpGuid: PGUID; // nil for the default device
  7770.       lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
  7771.       var lpD3DHWDeviceDesc: TD3DDeviceDesc;
  7772.       var lpD3DHELDeviceDesc: TD3DDeviceDesc;
  7773.       lpContext : pointer) : HResult; stdcall;
  7774.   TD3DEnumDevicesCallback = TD3DEnumDevicesCallbackA;
  7775.  
  7776.   TD3DEnumDevicesCallback7A = function (
  7777.       lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
  7778.       const lpD3DDeviceDesc: TD3DDeviceDesc7; lpContext: Pointer) : HResult; stdcall;
  7779.   TD3DEnumDevicesCallback7 = TD3DEnumDevicesCallback7A;
  7780.  
  7781. (* TD3DDeviceDesc dwFlags indicating valid fields *)
  7782.  
  7783. const
  7784.   D3DDD_COLORMODEL            = $00000001; (* dcmColorModel is valid *)
  7785.   D3DDD_DEVCAPS               = $00000002; (* dwDevCaps is valid *)
  7786.   D3DDD_TRANSFORMCAPS         = $00000004; (* dtcTransformCaps is valid *)
  7787.   D3DDD_LIGHTINGCAPS          = $00000008; (* dlcLightingCaps is valid *)
  7788.   D3DDD_BCLIPPING             = $00000010; (* bClipping is valid *)
  7789.   D3DDD_LINECAPS              = $00000020; (* dpcLineCaps is valid *)
  7790.   D3DDD_TRICAPS               = $00000040; (* dpcTriCaps is valid *)
  7791.   D3DDD_DEVICERENDERBITDEPTH  = $00000080; (* dwDeviceRenderBitDepth is valid *)
  7792.   D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; (* dwDeviceZBufferBitDepth is valid *)
  7793.   D3DDD_MAXBUFFERSIZE         = $00000200; (* dwMaxBufferSize is valid *)
  7794.   D3DDD_MAXVERTEXCOUNT        = $00000400; (* dwMaxVertexCount is valid *)
  7795.  
  7796. (* TD3DDeviceDesc dwDevCaps flags *)
  7797.  
  7798.   D3DDEVCAPS_FLOATTLVERTEX        = $00000001; (* Device accepts floating point *)
  7799.                                                     (* for post-transform vertex data *)
  7800.   D3DDEVCAPS_SORTINCREASINGZ      = $00000002; (* Device needs data sorted for increasing Z*)
  7801.   D3DDEVCAPS_SORTDECREASINGZ      = $00000004; (* Device needs data sorted for decreasing Z*)
  7802.   D3DDEVCAPS_SORTEXACT            = $00000008; (* Device needs data sorted exactly *)
  7803.  
  7804.   D3DDEVCAPS_EXECUTESYSTEMMEMORY  = $00000010; (* Device can use execute buffers from system memory *)
  7805.   D3DDEVCAPS_EXECUTEVIDEOMEMORY   = $00000020; (* Device can use execute buffers from video memory *)
  7806.   D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; (* Device can use TL buffers from system memory *)
  7807.   D3DDEVCAPS_TLVERTEXVIDEOMEMORY  = $00000080; (* Device can use TL buffers from video memory *)
  7808.   D3DDEVCAPS_TEXTURESYSTEMMEMORY  = $00000100; (* Device can texture from system memory *)
  7809.   D3DDEVCAPS_TEXTUREVIDEOMEMORY   = $00000200; (* Device can texture from device memory *)
  7810.   D3DDEVCAPS_DRAWPRIMTLVERTEX     = $00000400; (* Device can draw TLVERTEX primitives *)
  7811.   D3DDEVCAPS_CANRENDERAFTERFLIP   = $00000800; (* Device can render without waiting for flip to complete *)
  7812.   D3DDEVCAPS_TEXTURENONLOCALVIDMEM   = $00001000; (* Device can texture from nonlocal video memory *)
  7813.   D3DDEVCAPS_DRAWPRIMITIVES2         = $00002000; (* Device can support DrawPrimitives2 *)
  7814.   D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; (* Device is texturing from separate memory pools *)
  7815.   D3DDEVCAPS_DRAWPRIMITIVES2EX       = $00008000; (* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*)
  7816.   D3DDEVCAPS_HWTRANSFORMANDLIGHT     = $00010000; (* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also *)
  7817.   D3DDEVCAPS_CANBLTSYSTONONLOCAL     = $00020000; (* Device supports a Tex Blt from system memory to non-local vidmem *)
  7818.   D3DDEVCAPS_HWRASTERIZATION         = $00080000; (* Device has HW acceleration for rasterization *)
  7819.  
  7820. (*
  7821.  * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
  7822.  *)
  7823.  
  7824. (* device can do texgen *)
  7825.   D3DVTXPCAPS_TEXGEN              = $00000001;
  7826. (* device can do IDirect3DDevice7 colormaterialsource ops *)
  7827.   D3DVTXPCAPS_MATERIALSOURCE7     = $00000002;
  7828. (* device can do vertex fog *)
  7829.   D3DVTXPCAPS_VERTEXFOG           = $00000004;
  7830. (* device can do directional lights *)
  7831.   D3DVTXPCAPS_DIRECTIONALLIGHTS   = $00000008;
  7832. (* device can do positional lights (includes point and spot) *)
  7833.   D3DVTXPCAPS_POSITIONALLIGHTS    = $00000010;
  7834. (* device can do local viewer *)
  7835.   D3DVTXPCAPS_LOCALVIEWER         = $00000020;
  7836.  
  7837.   D3DFDS_COLORMODEL        = $00000001; (* Match color model *)
  7838.   D3DFDS_GUID              = $00000002; (* Match guid *)
  7839.   D3DFDS_HARDWARE          = $00000004; (* Match hardware/software *)
  7840.   D3DFDS_TRIANGLES         = $00000008; (* Match in triCaps *)
  7841.   D3DFDS_LINES             = $00000010; (* Match in lineCaps  *)
  7842.   D3DFDS_MISCCAPS          = $00000020; (* Match primCaps.dwMiscCaps *)
  7843.   D3DFDS_RASTERCAPS        = $00000040; (* Match primCaps.dwRasterCaps *)
  7844.   D3DFDS_ZCMPCAPS          = $00000080; (* Match primCaps.dwZCmpCaps *)
  7845.   D3DFDS_ALPHACMPCAPS      = $00000100; (* Match primCaps.dwAlphaCmpCaps *)
  7846.   D3DFDS_SRCBLENDCAPS      = $00000200; (* Match primCaps.dwSourceBlendCaps *)
  7847.   D3DFDS_DSTBLENDCAPS      = $00000400; (* Match primCaps.dwDestBlendCaps *)
  7848.   D3DFDS_SHADECAPS         = $00000800; (* Match primCaps.dwShadeCaps *)
  7849.   D3DFDS_TEXTURECAPS       = $00001000; (* Match primCaps.dwTextureCaps *)
  7850.   D3DFDS_TEXTUREFILTERCAPS = $00002000; (* Match primCaps.dwTextureFilterCaps *)
  7851.   D3DFDS_TEXTUREBLENDCAPS  = $00004000; (* Match primCaps.dwTextureBlendCaps *)
  7852.   D3DFDS_TEXTUREADDRESSCAPS  = $00008000; (* Match primCaps.dwTextureBlendCaps *)
  7853.  
  7854. (*
  7855.  * FindDevice arguments
  7856.  *)
  7857. type
  7858.   PD3DFindDeviceSearch = ^TD3DFindDeviceSearch;
  7859.   TD3DFindDeviceSearch = packed record
  7860.     dwSize: DWORD;
  7861.     dwFlags: DWORD;
  7862.     bHardware: BOOL;
  7863.     dcmColorModel: TD3DColorModel;
  7864.     guid: TGUID;
  7865.     dwCaps: DWORD;
  7866.     dpcPrimCaps: TD3DPrimCaps;
  7867.   end;
  7868.  
  7869.   PD3DFindDeviceResult = ^TD3DFindDeviceResult;
  7870.   TD3DFindDeviceResult = packed record
  7871.     dwSize: DWORD;
  7872.     guid: TGUID;               (* guid which matched *)
  7873.     ddHwDesc: TD3DDeviceDesc;   (* hardware TD3DDeviceDesc *)
  7874.     ddSwDesc: TD3DDeviceDesc;   (* software TD3DDeviceDesc *)
  7875.   end;
  7876.  
  7877. (*
  7878.  * Description of execute buffer.
  7879.  *)
  7880.   PD3DExecuteBufferDesc = ^TD3DExecuteBufferDesc;
  7881.   TD3DExecuteBufferDesc = packed record
  7882.     dwSize: DWORD;         (* size of this structure *)
  7883.     dwFlags: DWORD;        (* flags indicating which fields are valid *)
  7884.     dwCaps: DWORD;         (* capabilities of execute buffer *)
  7885.     dwBufferSize: DWORD;   (* size of execute buffer data *)
  7886.     lpData: Pointer;       (* pointer to actual data *)
  7887.   end;
  7888.  
  7889. (* D3DEXECUTEBUFFER dwFlags indicating valid fields *)
  7890.  
  7891. const
  7892.   D3DDEB_BUFSIZE          = $00000001;     (* buffer size valid *)
  7893.   D3DDEB_CAPS             = $00000002;     (* caps valid *)
  7894.   D3DDEB_LPDATA           = $00000004;     (* lpData valid *)
  7895.  
  7896. (* D3DEXECUTEBUFFER dwCaps *)
  7897.  
  7898.   D3DDEBCAPS_SYSTEMMEMORY = $00000001;     (* buffer in system memory *)
  7899.   D3DDEBCAPS_VIDEOMEMORY  = $00000002;     (* buffer in device memory *)
  7900.   D3DDEBCAPS_MEM          = (D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY);
  7901.  
  7902. type
  7903.   PD3DDevInfo_TextureManager = ^TD3DDevInfo_TextureManager;
  7904.   TD3DDevInfo_TextureManager = packed record
  7905.     bThrashing:              BOOL;       (* indicates if thrashing *)
  7906.     dwApproxBytesDownloaded: DWORD;      (* Approximate number of bytes downloaded by texture manager *)
  7907.     dwNumEvicts:             DWORD;      (* number of textures evicted *)
  7908.     dwNumVidCreates:         DWORD;      (* number of textures created in video memory *)
  7909.     dwNumTexturesUsed:       DWORD;      (* number of textures used *)
  7910.     dwNumUsedTexInVid:       DWORD;      (* number of used textures present in video memory *)
  7911.     dwWorkingSet:            DWORD;      (* number of textures in video memory *)
  7912.     dwWorkingSetBytes:       DWORD;      (* number of bytes in video memory *)
  7913.     dwTotalManaged:          DWORD;      (* total number of managed textures *)
  7914.     dwTotalBytes:            DWORD;      (* total number of bytes of managed textures *)
  7915.     dwLastPri:               DWORD;      (* priority of last texture evicted *)
  7916.   end;
  7917.  
  7918.   PD3DDevInfo_Texturing = ^TD3DDevInfo_Texturing;
  7919.   TD3DDevInfo_Texturing = packed record
  7920.     dwNumLoads:          DWORD;          (* counts Load() API calls *)
  7921.     dwApproxBytesLoaded: DWORD;          (* Approximate number bytes loaded via Load() *)
  7922.     dwNumPreLoads:       DWORD;          (* counts PreLoad() API calls *)
  7923.     dwNumSet:            DWORD;          (* counts SetTexture() API calls *)
  7924.     dwNumCreates:        DWORD;          (* counts texture creates *)
  7925.     dwNumDestroys:       DWORD;          (* counts texture destroys *)
  7926.     dwNumSetPriorities:  DWORD;          (* counts SetPriority() API calls *)
  7927.     dwNumSetLODs:        DWORD;          (* counts SetLOD() API calls *)
  7928.     dwNumLocks:          DWORD;          (* counts number of texture locks *)
  7929.     dwNumGetDCs:         DWORD;          (* counts number of GetDCs to textures *)
  7930.   end;
  7931.  
  7932. (*==========================================================================;
  7933.  *
  7934.  *
  7935.  *  File:   d3d.h
  7936.  *  Content:    Direct3D include file
  7937.  *
  7938.  ****************************************************************************)
  7939.  
  7940. function D3DErrorString(Value: HResult) : string;
  7941.  
  7942. (*
  7943.  * Interface IID's
  7944.  *)
  7945.  
  7946. const
  7947. (*
  7948.  * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer
  7949.  *)
  7950.   IID_IDirect3DRampDevice: TGUID =
  7951.       (D1:$F2086B20;D2:$259F;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
  7952.   IID_IDirect3DRGBDevice: TGUID =
  7953.       (D1:$A4665C60;D2:$2673;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
  7954.   IID_IDirect3DHALDevice: TGUID =
  7955.       (D1:$84E63dE0;D2:$46AA;D3:$11CF;D4:($81,$6F,$00,$00,$C0,$20,$15,$6E));
  7956.   IID_IDirect3DMMXDevice: TGUID =
  7957.       (D1:$881949a1;D2:$d6f3;D3:$11d0;D4:($89,$ab,$00,$a0,$c9,$05,$41,$29));
  7958.  
  7959.   IID_IDirect3DRefDevice: TGUID =
  7960.       (D1:$50936643;D2:$13e9;D3:$11d1;D4:($89,$aa,$00,$a0,$c9,$05,$41,$29));
  7961.   IID_IDirect3DNullDevice: TGUID =
  7962.       (D1:$8767df22;D2:$bacc;D3:$11d1;D4:($89,$69,$00,$a0,$c9,$06,$29,$a8));
  7963.  
  7964.   IID_IDirect3DTnLHalDevice: TGUID = '{f5049e78-4861-11d2-a407-00a0c90629a8}';
  7965.  
  7966. type
  7967.   IDirect3D = interface;
  7968.   IDirect3D2 = interface;
  7969.   IDirect3D3 = interface;
  7970.   IDirect3D7 = interface;
  7971.   IDirect3DDevice = interface;
  7972.   IDirect3DDevice2 = interface;
  7973.   IDirect3DDevice3 = interface;
  7974.   IDirect3DDevice7 = interface;
  7975.   IDirect3DExecuteBuffer = interface;
  7976.   IDirect3DLight = interface;
  7977.   IDirect3DMaterial = interface;
  7978.   IDirect3DMaterial2 = interface;
  7979.   IDirect3DMaterial3 = interface;
  7980.   IDirect3DTexture = interface;
  7981.   IDirect3DTexture2 = interface;
  7982.   IDirect3DViewport = interface;
  7983.   IDirect3DViewport2 = interface;
  7984.   IDirect3DViewport3 = interface;
  7985.   IDirect3DVertexBuffer = interface;
  7986.   IDirect3DVertexBuffer7 = interface;
  7987.  
  7988. (*
  7989.  * Direct3D interfaces
  7990.  *)
  7991.  
  7992.   IDirect3D = interface (IUnknown)
  7993.     ['{3BBA0080-2421-11CF-A31A-00AA00B93356}']
  7994.     (*** IDirect3D methods ***)
  7995.     function Initialize (lpREFIID: {REFIID} PGUID) : HResult; stdcall;
  7996.     function EnumDevices (lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  7997.         lpUserArg: Pointer) : HResult; stdcall;
  7998.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  7999.         pUnkOuter: IUnknown) : HResult; stdcall;
  8000.     function CreateMaterial (var lplpDirect3DMaterial: IDirect3DMaterial;
  8001.         pUnkOuter: IUnknown) : HResult; stdcall;
  8002.     function CreateViewport (var lplpD3DViewport: IDirect3DViewport;
  8003.         pUnkOuter: IUnknown) : HResult; stdcall;
  8004.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8005.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8006.   end;
  8007.  
  8008.   IDirect3D2 = interface (IUnknown)
  8009.     ['{6aae1ec1-662a-11d0-889d-00aa00bbb76a}']
  8010.     (*** IDirect3D2 methods ***)
  8011.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  8012.         lpUserArg: pointer) : HResult; stdcall;
  8013.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  8014.         pUnkOuter: IUnknown) : HResult; stdcall;
  8015.     function CreateMaterial (var lplpDirect3DMaterial2: IDirect3DMaterial2;
  8016.         pUnkOuter: IUnknown) : HResult; stdcall;
  8017.     function CreateViewport (var lplpD3DViewport2: IDirect3DViewport2;
  8018.         pUnkOuter: IUnknown) : HResult; stdcall;
  8019.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8020.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8021.     function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface;
  8022.         out lplpD3DDevice2: IDirect3DDevice2) : HResult; stdcall;
  8023.   end;
  8024.  
  8025.   IDirect3D3 = interface (IUnknown)
  8026.     ['{bb223240-e72b-11d0-a9b4-00aa00c0993e}']
  8027.     (*** IDirect3D3 methods ***)
  8028.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  8029.         lpUserArg: pointer) : HResult; stdcall;
  8030.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  8031.         pUnkOuter: IUnknown) : HResult; stdcall;
  8032.     function CreateMaterial (var lplpDirect3DMaterial3: IDirect3DMaterial3;
  8033.         pUnkOuter: IUnknown) : HResult; stdcall;
  8034.     function CreateViewport (var lplpD3DViewport3: IDirect3DViewport3;
  8035.         pUnkOuter: IUnknown) : HResult; stdcall;
  8036.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8037.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8038.     function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface4;
  8039.         out lplpD3DDevice: IDirect3DDevice3; pUnkOuter: IUnknown) : HResult; stdcall;
  8040.     function CreateVertexBuffer (var lpVBDesc: TD3DVertexBufferDesc;
  8041.         var lpD3DVertexBuffer: IDirect3DVertexBuffer;
  8042.         dwFlags: DWORD; pUnkOuter: IUnknown) : HResult; stdcall;
  8043.     function EnumZBufferFormats (const riidDevice: TRefClsID; lpEnumCallback:
  8044.         TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
  8045.     function EvictManagedTextures : HResult; stdcall;
  8046.   end;
  8047.  
  8048.   IDirect3D7 = interface (IUnknown)
  8049.     ['{f5049e77-4861-11d2-a407-00a0c90629a8}']
  8050.     (*** IDirect3D7 methods ***)
  8051.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback7;
  8052.         lpUserArg: pointer) : HResult; stdcall;
  8053.     function CreateDevice (const rclsid: TGUID; lpDDS: IDirectDrawSurface7;
  8054.         out lplpD3DDevice: IDirect3DDevice7) : HResult; stdcall;
  8055.     function CreateVertexBuffer (const lpVBDesc: TD3DVertexBufferDesc;
  8056.         out lplpD3DVertexBuffer: IDirect3DVertexBuffer7;
  8057.         dwFlags: DWORD) : HResult; stdcall;
  8058.     function EnumZBufferFormats (const riidDevice: TGUID; lpEnumCallback:
  8059.         TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
  8060.     function EvictManagedTextures : HResult; stdcall;
  8061.   end;
  8062.  
  8063. (*
  8064.  * Direct3D Device interfaces
  8065.  *)
  8066.  
  8067.   IDirect3DDevice = interface (IUnknown)
  8068.     ['{64108800-957d-11d0-89ab-00a0c9054129}']
  8069.     (*** IDirect3DDevice methods ***)
  8070.     function Initialize (lpd3d: IDirect3D; lpGUID: PGUID;
  8071.         var lpd3ddvdesc: TD3DDeviceDesc) : HResult; stdcall;
  8072.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8073.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8074.     function SwapTextureHandles (lpD3DTex1: IDirect3DTexture;
  8075.         lpD3DTex2: IDirect3DTexture) : HResult; stdcall;
  8076.     function CreateExecuteBuffer (var lpDesc: TD3DExecuteBufferDesc ;
  8077.         var lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8078.         pUnkOuter: IUnknown) : HResult; stdcall;
  8079.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8080.     function Execute (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8081.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
  8082.     function AddViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
  8083.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
  8084.     function NextViewport (lpDirect3DViewport: IDirect3DViewport;
  8085.         var lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
  8086.     function Pick (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8087.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD;
  8088.         var lpRect: TD3DRect) : HResult; stdcall;
  8089.     function GetPickRecords (var lpCount: DWORD;
  8090.         var lpD3DPickRec: TD3DPickRecord) : HResult; stdcall;
  8091.     function EnumTextureFormats (lpd3dEnumTextureProc:
  8092.         TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
  8093.         HResult; stdcall;
  8094.     function CreateMatrix (var lpD3DMatHandle: TD3DMatrixHandle) : HResult; stdcall;
  8095.     function SetMatrix (d3dMatHandle: TD3DMatrixHandle;
  8096.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8097.     function GetMatrix (var lpD3DMatHandle: TD3DMatrixHandle;
  8098.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8099.     function DeleteMatrix (d3dMatHandle: TD3DMatrixHandle) : HResult; stdcall;
  8100.     function BeginScene: HResult; stdcall;
  8101.     function EndScene: HResult; stdcall;
  8102.     function GetDirect3D (var lpD3D: IDirect3D) : HResult; stdcall;
  8103.   end;
  8104.  
  8105.   IDirect3DDevice2 = interface (IUnknown)
  8106.     ['{93281501-8cf8-11d0-89ab-00a0c9054129}']
  8107.     (*** IDirect3DDevice2 methods ***)
  8108.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8109.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8110.     function SwapTextureHandles (lpD3DTex1: IDirect3DTexture2;
  8111.         lpD3DTex2: IDirect3DTexture2) : HResult; stdcall;
  8112.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8113.     function AddViewport (lpDirect3DViewport2: IDirect3DViewport2) : HResult; stdcall;
  8114.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport2) : HResult; stdcall;
  8115.     function NextViewport (lpDirect3DViewport: IDirect3DViewport2;
  8116.         var lplpDirect3DViewport: IDirect3DViewport2; dwFlags: DWORD) :
  8117.         HResult; stdcall;
  8118.     function EnumTextureFormats (
  8119.         lpd3dEnumTextureProc: TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
  8120.         HResult; stdcall;
  8121.     function BeginScene: HResult; stdcall;
  8122.     function EndScene: HResult; stdcall;
  8123.     function GetDirect3D (var lpD3D: IDirect3D2) : HResult; stdcall;
  8124.  
  8125.     (*** DrawPrimitive API ***)
  8126.     function SetCurrentViewport (lpd3dViewport2: IDirect3DViewport2)
  8127.         : HResult; stdcall;
  8128.     function GetCurrentViewport (var lplpd3dViewport2: IDirect3DViewport2)
  8129.         : HResult; stdcall;
  8130.  
  8131.     function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface)
  8132.         : HResult; stdcall;
  8133.     function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface)
  8134.         : HResult; stdcall;
  8135.  
  8136.     function Begin_ (d3dpt: TD3DPrimitiveType; d3dvt: TD3DVertexType;
  8137.         dwFlags: DWORD) : HResult; stdcall;
  8138.     function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType; dvtVertexType:
  8139.         TD3DVertexType; lpvVertices: pointer; dwNumVertices: DWORD;
  8140.         dwFlags: DWORD) : HResult; stdcall;
  8141.     function Vertex (lpVertexType: pointer) : HResult;  stdcall;
  8142.     function Index (wVertexIndex: WORD) : HResult;  stdcall;
  8143.     function End_ (dwFlags: DWORD) : HResult; stdcall;
  8144.  
  8145.     function GetRenderState (dwRenderStateType: TD3DRenderStateType;
  8146.         var lpdwRenderState) : HResult; stdcall;
  8147.     function SetRenderState (dwRenderStateType: TD3DRenderStateType;
  8148.         dwRenderState: DWORD) : HResult; stdcall;
  8149.     function GetLightState (dwLightStateType: TD3DLightStateType;
  8150.         var lpdwLightState) : HResult; stdcall;
  8151.     function SetLightState (dwLightStateType: TD3DLightStateType;
  8152.         dwLightState: DWORD) : HResult; stdcall;
  8153.     function SetTransform (dtstTransformStateType: TD3DTransformStateType;
  8154.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8155.     function GetTransform (dtstTransformStateType: TD3DTransformStateType;
  8156.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8157.     function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
  8158.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8159.  
  8160.     function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8161.         dvtVertexType: TD3DVertexType; var lpvVertices; dwVertexCount,
  8162.         dwFlags: DWORD) : HResult; stdcall;
  8163.     function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8164.         dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwVertexCount: DWORD;
  8165.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8166.     function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8167.     function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8168.   end;
  8169.  
  8170.   IDirect3DDevice3 = interface (IUnknown)
  8171.     ['{b0ab3b60-33d7-11d1-a981-00c04fd7b174}']
  8172.     (*** IDirect3DDevice2 methods ***)
  8173.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8174.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8175.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8176.     function AddViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
  8177.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
  8178.     function NextViewport (lpDirect3DViewport: IDirect3DViewport3;
  8179.         var lplpAnotherViewport: IDirect3DViewport3; dwFlags: DWORD) : HResult; stdcall;
  8180.     function EnumTextureFormats (
  8181.         lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) :
  8182.         HResult; stdcall;
  8183.     function BeginScene: HResult; stdcall;
  8184.     function EndScene: HResult; stdcall;
  8185.     function GetDirect3D (var lpD3D: IDirect3D3) : HResult; stdcall;
  8186.     function SetCurrentViewport (lpd3dViewport: IDirect3DViewport3)
  8187.         : HResult; stdcall;
  8188.     function GetCurrentViewport (var lplpd3dViewport: IDirect3DViewport3)
  8189.         : HResult; stdcall;
  8190.     function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface4)
  8191.         : HResult; stdcall;
  8192.     function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface4)
  8193.         : HResult; stdcall;
  8194.     function Begin_ (d3dpt: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  8195.         dwFlags: DWORD) : HResult; stdcall;
  8196.     function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType;
  8197.         dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwNumVertices: DWORD;
  8198.         dwFlags: DWORD) : HResult; stdcall;
  8199.     function Vertex (lpVertex: pointer) : HResult;  stdcall;
  8200.     function Index (wVertexIndex: WORD) : HResult;  stdcall;
  8201.     function End_ (dwFlags: DWORD) : HResult; stdcall;
  8202.     function GetRenderState (dwRenderStateType: TD3DRenderStateType;
  8203.         var lpdwRenderState) : HResult; stdcall;
  8204.     function SetRenderState (dwRenderStateType: TD3DRenderStateType;
  8205.         dwRenderState: DWORD) : HResult; stdcall;
  8206.     function GetLightState (dwLightStateType: TD3DLightStateType;
  8207.         var lpdwLightState) : HResult; stdcall;
  8208.     function SetLightState (dwLightStateType: TD3DLightStateType;
  8209.         dwLightState: DWORD) : HResult; stdcall;
  8210.     function SetTransform (dtstTransformStateType: TD3DTransformStateType;
  8211.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8212.     function GetTransform (dtstTransformStateType: TD3DTransformStateType;
  8213.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8214.     function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
  8215.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8216.     function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8217.         dwVertexTypeDesc: DWORD; const lpvVertices;
  8218.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8219.     function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8220.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
  8221.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8222.     function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8223.     function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8224.     function DrawPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
  8225.         dwVertexTypeDesc : DWORD;
  8226.         var lpVertexArray: TD3DDrawPrimitiveStridedData;
  8227.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8228.     function DrawIndexedPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
  8229.         dwVertexTypeDesc : DWORD;
  8230.         var lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
  8231.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8232.     function DrawPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
  8233.         lpd3dVertexBuffer: IDirect3DVertexBuffer;
  8234.         dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
  8235.     function DrawIndexedPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
  8236.         lpd3dVertexBuffer: IDirect3DVertexBuffer; var lpwIndices: WORD;
  8237.         dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8238.     function ComputeSphereVisibility (var lpCenters: TD3DVector;
  8239.         var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
  8240.         var lpdwReturnValues: DWORD) : HResult; stdcall;
  8241.     function GetTexture (dwStage: DWORD; var lplpTexture: IDirect3DTexture2)
  8242.         : HResult; stdcall;
  8243.     function SetTexture (dwStage: DWORD; lplpTexture: IDirect3DTexture2)
  8244.         : HResult; stdcall;
  8245.     function GetTextureStageState (dwStage: DWORD;
  8246.         dwState: TD3DTextureStageStateType; var lpdwValue: DWORD) : HResult; stdcall;
  8247.     function SetTextureStageState (dwStage: DWORD;
  8248.         dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
  8249.     function ValidateDevice (var lpdwExtraPasses: DWORD) : HResult; stdcall;
  8250.   end;
  8251.  
  8252.   IDirect3DDevice7 = interface (IUnknown)
  8253.     ['{f5049e79-4861-11d2-a407-00a0c90629a8}']
  8254.     (*** IDirect3DDevice7 methods ***)
  8255.     function GetCaps(out lpD3DDevDesc: TD3DDeviceDesc7) : HResult; stdcall;
  8256.     function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) : HResult; stdcall;
  8257.     function BeginScene: HResult; stdcall;
  8258.     function EndScene: HResult; stdcall;
  8259.     function GetDirect3D(out lpD3D: IDirect3D7) : HResult; stdcall;
  8260.     function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface7; dwFlags: DWORD) : HResult; stdcall;
  8261.     function GetRenderTarget(out lplpRenderTarget: IDirectDrawSurface7) : HResult; stdcall;
  8262.     function Clear(dwCount: DWORD; lpRects: PD3DRect; dwFlags, dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
  8263.     function SetTransform(dtstTransformStateType: TD3DTransformStateType;
  8264.         const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8265.     function GetTransform(dtstTransformStateType: TD3DTransformStateType;
  8266.         out lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8267.     function SetViewport(const lpViewport: TD3DViewport7) : HResult; stdcall;
  8268.     function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType;
  8269.         const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8270.     function GetViewport(out lpViewport: TD3DViewport7) : HResult; stdcall;
  8271.     function SetMaterial(const lpMaterial: TD3DMaterial7) : HResult; stdcall;
  8272.     function GetMaterial(out lpMaterial: TD3DMaterial7) : HResult; stdcall;
  8273.     function SetLight(dwLightIndex: DWORD; const lpLight: TD3DLight7) : HResult; stdcall;
  8274.     function GetLight(dwLightIndex: DWORD; out lpLight: TD3DLight7) : HResult; stdcall;
  8275.     function SetRenderState(dwRenderStateType: TD3DRenderStateType; dwRenderState: DWORD) : HResult; stdcall;
  8276.     function GetRenderState(dwRenderStateType: TD3DRenderStateType; out dwRenderState: DWORD) : HResult; stdcall;
  8277.     function BeginStateBlock : HResult; stdcall;
  8278.     function EndStateBlock(out lpdwBlockHandle: DWORD) : HResult; stdcall;
  8279.     function PreLoad(lpddsTexture: IDirectDrawSurface7) : HResult; stdcall;
  8280.     function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  8281.         dwVertexTypeDesc: DWORD; const lpvVertices;
  8282.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8283.     function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  8284.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
  8285.         const lpwIndices; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8286.     function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8287.     function GetClipStatus(out lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8288.     function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  8289.         dwVertexTypeDesc : DWORD;
  8290.         const lpVertexArray: TD3DDrawPrimitiveStridedData;
  8291.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8292.     function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  8293.         dwVertexTypeDesc : DWORD;
  8294.         const lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
  8295.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8296.     function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  8297.         lpd3dVertexBuffer: IDirect3DVertexBuffer7;
  8298.         dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
  8299.     function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  8300.         lpd3dVertexBuffer: IDirect3DVertexBuffer7; dwStartVertex, dwNumVertices: DWORD;
  8301.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8302.     function ComputeSphereVisibility(const lpCenters: TD3DVector;
  8303.         var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
  8304.         var lpdwReturnValues: DWORD) : HResult; stdcall;
  8305.     function GetTexture(dwStage: DWORD; out lplpTexture: IDirectDrawSurface7) : HResult; stdcall;
  8306.     function SetTexture(dwStage: DWORD; lpTexture: IDirectDrawSurface7) : HResult; stdcall;
  8307.     function GetTextureStageState(dwStage: DWORD;
  8308.         dwState: TD3DTextureStageStateType; out lpdwValue: DWORD) : HResult; stdcall;
  8309.     function SetTextureStageState(dwStage: DWORD;
  8310.         dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
  8311.     function ValidateDevice(out lpdwExtraPasses: DWORD) : HResult; stdcall;
  8312.     function ApplyStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8313.     function CaptureStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8314.     function DeleteStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8315.     function CreateStateBlock(d3dsbType: TD3DStateBlockType; out lpdwBlockHandle: DWORD) : HResult; stdcall;
  8316.     function Load(lpDestTex: IDirectDrawSurface7; lpDestPoint: PPoint;
  8317.         lpSrcTex: IDirectDrawSurface7; lprcSrcRect: PRect; dwFlags: DWORD) : HResult; stdcall;
  8318.     function LightEnable(dwLightIndex: DWORD; bEnable: BOOL) : HResult; stdcall;
  8319.     function GetLightEnable(dwLightIndex: DWORD; out bEnable: BOOL) : HResult; stdcall;
  8320.     function SetClipPlane(dwIndex: DWORD; var pPlaneEquation: TD3DValue) : HResult; stdcall;
  8321.     function GetClipPlane(dwIndex: DWORD; out pPlaneEquation: TD3DValue) : HResult; stdcall;
  8322.     function GetInfo(dwDevInfoID: DWORD; pDevInfoStruct: Pointer; dwSize: DWORD) : HResult; stdcall;
  8323.   end;
  8324.  
  8325. (*
  8326.  * Execute Buffer interface
  8327.  *)
  8328.  
  8329.   IDirect3DExecuteBuffer = interface (IUnknown)
  8330.     ['{4417C145-33AD-11CF-816F-0000C020156E}']
  8331.     (*** IDirect3DExecuteBuffer methods ***)
  8332.     function Initialize (lpDirect3DDevice: IDirect3DDevice;
  8333.         var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
  8334.     function Lock (var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
  8335.     function Unlock: HResult; stdcall;
  8336.     function SetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
  8337.     function GetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
  8338.     function Validate (var lpdwOffset: DWORD; lpFunc: TD3DValidateCallback;
  8339.         lpUserArg: Pointer; dwReserved: DWORD) : HResult; stdcall;
  8340.     (*** Warning!  Optimize is defined differently in the header files
  8341.          and the online documentation ***)
  8342.     function Optimize (dwFlags: DWORD) : HResult; stdcall;
  8343.   end;
  8344.  
  8345. (*
  8346.  * Light interfaces
  8347.  *)
  8348.  
  8349.   IDirect3DLight = interface (IUnknown)
  8350.     ['{4417C142-33AD-11CF-816F-0000C020156E}']
  8351.     (*** IDirect3DLight methods ***)
  8352.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8353.     function SetLight (var lpLight: TD3DLight2) : HResult; stdcall;
  8354.     function GetLight (var lpLight: TD3DLight2) : HResult; stdcall;
  8355.   end;
  8356.  
  8357. (*
  8358.  * Material interfaces
  8359.  *)
  8360.  
  8361.   IDirect3DMaterial = interface (IUnknown)
  8362.     ['{4417C144-33AD-11CF-816F-0000C020156E}']
  8363.     (*** IDirect3DMaterial methods ***)
  8364.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8365.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8366.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8367.     function GetHandle (lpDirect3DDevice: IDirect3DDevice;
  8368.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8369.     function Reserve: HResult; stdcall;
  8370.     function Unreserve: HResult; stdcall;
  8371.   end;
  8372.  
  8373.   IDirect3DMaterial2 = interface (IUnknown)
  8374.     ['{93281503-8cf8-11d0-89ab-00a0c9054129}']
  8375.     (*** IDirect3DMaterial2 methods ***)
  8376.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8377.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8378.     function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
  8379.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8380.   end;
  8381.  
  8382.   IDirect3DMaterial3 = interface (IUnknown)
  8383.     ['{ca9c46f4-d3c5-11d1-b75a-00600852b312}']
  8384.     (*** IDirect3DMaterial2 methods ***)
  8385.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8386.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8387.     function GetHandle (lpDirect3DDevice: IDirect3DDevice3;
  8388.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8389.   end;
  8390.  
  8391. (*
  8392.  * Texture interfaces
  8393.  *)
  8394.  
  8395.   IDirect3DTexture = interface (IUnknown)
  8396.     ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}']
  8397.     (*** IDirect3DTexture methods ***)
  8398.     function Initialize (lpD3DDevice: IDirect3DDevice;
  8399.         lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  8400.     function GetHandle (lpDirect3DDevice: IDirect3DDevice;
  8401.         var lpHandle: TD3DTextureHandle) : HResult; stdcall;
  8402.     function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
  8403.     function Load (lpD3DTexture: IDirect3DTexture) : HResult; stdcall;
  8404.     function Unload: HResult; stdcall;
  8405.   end;
  8406.  
  8407.   IDirect3DTexture2 = interface (IUnknown)
  8408.     ['{93281502-8cf8-11d0-89ab-00a0c9054129}']
  8409.     (*** IDirect3DTexture2 methods ***)
  8410.     function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
  8411.         var lpHandle: TD3DTextureHandle) : HResult; stdcall;
  8412.     function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
  8413.     function Load (lpD3DTexture: IDirect3DTexture2) : HResult; stdcall;
  8414.   end;
  8415.  
  8416. (*
  8417.  * Viewport interfaces
  8418.  *)
  8419.  
  8420.   IDirect3DViewport = interface (IUnknown)
  8421.     ['{4417C146-33AD-11CF-816F-0000C020156E}']
  8422.     (*** IDirect3DViewport methods ***)
  8423.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8424.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8425.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8426.     function TransformVertices (dwVertexCount: DWORD;
  8427.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8428.         out lpOffscreen: DWORD) : HResult; stdcall;
  8429.     function LightElements (dwElementCount: DWORD;
  8430.         var lpData: TD3DLightData) : HResult; stdcall;
  8431.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8432.     function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
  8433.     function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
  8434.         HResult; stdcall;
  8435.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8436.         out lpValid: BOOL) : HResult; stdcall;
  8437.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8438.         HResult; stdcall;
  8439.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8440.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8441.      function NextLight (lpDirect3DLight: IDirect3DLight;
  8442.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8443.   end;
  8444.  
  8445.   IDirect3DViewport2 = interface (IUnknown)
  8446.     ['{93281500-8cf8-11d0-89ab-00a0c9054129}']
  8447.     (*** IDirect3DViewport2 methods ***)
  8448.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8449.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8450.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8451.     function TransformVertices (dwVertexCount: DWORD;
  8452.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8453.         out lpOffscreen: DWORD) : HResult; stdcall;
  8454.     function LightElements (dwElementCount: DWORD;
  8455.         var lpData: TD3DLightData) : HResult; stdcall;
  8456.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8457.     function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
  8458.     function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
  8459.         HResult; stdcall;
  8460.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8461.         out lpValid: BOOL) : HResult; stdcall;
  8462.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8463.         HResult; stdcall;
  8464.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8465.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8466.     function NextLight (lpDirect3DLight: IDirect3DLight;
  8467.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8468.     (*** IDirect3DViewport2 methods ***)
  8469.     function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
  8470.     function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
  8471.   end;
  8472.  
  8473.   IDirect3DViewport3 = interface (IUnknown)
  8474.     ['{b0ab3b61-33d7-11d1-a981-00c04fd7b174}']
  8475.     (*** IDirect3DViewport3 methods ***)
  8476.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8477.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8478.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8479.     function TransformVertices (dwVertexCount: DWORD;
  8480.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8481.         out lpOffscreen: DWORD) : HResult; stdcall;
  8482.     function LightElements (dwElementCount: DWORD;
  8483.         var lpData: TD3DLightData) : HResult; stdcall;
  8484.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8485.     function GetBackground (var hMat: TD3DMaterialHandle) : HResult; stdcall;
  8486.     function SetBackgroundDepth (
  8487.         lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  8488.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8489.         out lpValid: BOOL) : HResult; stdcall;
  8490.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8491.         HResult; stdcall;
  8492.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8493.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8494.     function NextLight (lpDirect3DLight: IDirect3DLight;
  8495.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8496.     function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
  8497.     function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
  8498.     function SetBackgroundDepth2 (
  8499.         lpDDSurface: IDirectDrawSurface4) : HResult; stdcall;
  8500.     function GetBackgroundDepth2 (out lplpDDSurface: IDirectDrawSurface4;
  8501.         out lpValid: BOOL) : HResult; stdcall;
  8502.     function Clear2 (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD;
  8503.         dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
  8504.   end;
  8505.  
  8506.   IDirect3DVertexBuffer = interface (IUnknown)
  8507.     ['{7a503555-4a83-11d1-a5db-00a0c90367f8}']
  8508.     (*** IDirect3DVertexBuffer methods ***)
  8509.     function Lock (dwFlags: DWORD; var lplpData: pointer; var lpdwSize: DWORD)
  8510.         : HResult; stdcall;
  8511.     function Unlock : HResult; stdcall;
  8512.     function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
  8513.         lpSrcBuffer: IDirect3DVertexBuffer; dwSrcIndex: DWORD;
  8514.         lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
  8515.     function GetVertexBufferDesc (var lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
  8516.     function Optimize(lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
  8517.   end;
  8518.  
  8519.   IDirect3DVertexBuffer7 = interface (IUnknown)
  8520.     ['{f5049e7d-4861-11d2-a407-00a0c90629a8}']
  8521.     (*** IDirect3DVertexBuffer methods ***)
  8522.     function Lock (dwFlags: DWORD; out lplpData: Pointer; out lpdwSize: DWORD) : HResult; stdcall;
  8523.     function Unlock : HResult; stdcall;
  8524.     function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
  8525.         lpSrcBuffer: IDirect3DVertexBuffer7; dwSrcIndex: DWORD;
  8526.         lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8527.     function GetVertexBufferDesc (out lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
  8528.     function Optimize(lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8529.     function ProcessVerticesStrided(dwVertexOp, dwDestIndex, dwCount: DWORD;
  8530.       lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexTypeDesc: DWORD;
  8531.       lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8532.   end;
  8533.  
  8534. type
  8535.   IID_IDirect3D = IDirect3D;
  8536.   IID_IDirect3D2 = IDirect3D2;
  8537.   IID_IDirect3D3 = IDirect3D3;
  8538.   IID_IDirect3D7 = IDirect3D7;
  8539.  
  8540.   IID_IDirect3DDevice = IDirect3DDevice;
  8541.   IID_IDirect3DDevice2 = IDirect3DDevice2;
  8542.   IID_IDirect3DDevice3 = IDirect3DDevice3;
  8543.   IID_IDirect3DDevice7 = IDirect3DDevice7;
  8544.  
  8545.   IID_IDirect3DTexture = IDirect3DTexture;
  8546.   IID_IDirect3DTexture2 = IDirect3DTexture2;
  8547.   IID_IDirect3DLight = IDirect3DLight;
  8548.   IID_IDirect3DMaterial = IDirect3DMaterial;
  8549.   IID_IDirect3DMaterial2 = IDirect3DMaterial2;
  8550.   IID_IDirect3DMaterial3 = IDirect3DMaterial3;
  8551.   IID_IDirect3DExecuteBuffer = IDirect3DExecuteBuffer;
  8552.   IID_IDirect3DViewport = IDirect3DViewport;
  8553.   IID_IDirect3DViewport2 = IDirect3DViewport2;
  8554.   IID_IDirect3DViewport3 = IDirect3DViewport3;
  8555.   IID_IDirect3DVertexBuffer = IDirect3DVertexBuffer;
  8556.   IID_IDirect3DVertexBuffer7 = IDirect3DVertexBuffer7;
  8557.  
  8558.  
  8559. const
  8560. (****************************************************************************
  8561.  *
  8562.  * Flags for IDirect3DDevice::NextViewport
  8563.  *
  8564.  ****************************************************************************)
  8565.  
  8566. (*
  8567.  * Return the next viewport
  8568.  *)
  8569.   D3DNEXT_NEXT =        $00000001;
  8570.  
  8571. (*
  8572.  * Return the first viewport
  8573.  *)
  8574.   D3DNEXT_HEAD =        $00000002;
  8575.  
  8576. (*
  8577.  * Return the last viewport
  8578.  *)
  8579.   D3DNEXT_TAIL =        $00000004;
  8580.  
  8581.  
  8582. (****************************************************************************
  8583.  *
  8584.  * Flags for DrawPrimitive/DrawIndexedPrimitive
  8585.  *   Also valid for Begin/BeginIndexed
  8586.  *   Also valid for VertexBuffer::CreateVertexBuffer
  8587.  ****************************************************************************)
  8588.  
  8589. (*
  8590.  * Wait until the device is ready to draw the primitive
  8591.  * This will cause DP to not return DDERR_WASSTILLDRAWING
  8592.  *)
  8593.   D3DDP_WAIT =                                  $00000001;
  8594.  
  8595. (*
  8596.  * Hint that it is acceptable to render the primitive out of order.
  8597.  *)
  8598.   D3DDP_OUTOFORDER            = $00000002;
  8599.  
  8600. (*
  8601.  * Hint that the primitives have been clipped by the application.
  8602.  *)
  8603.   D3DDP_DONOTCLIP =                             $00000004;
  8604.  
  8605. (*
  8606.  * Hint that the extents need not be updated.
  8607.  *)
  8608.   D3DDP_DONOTUPDATEEXTENTS =    $00000008;
  8609.  
  8610. (*
  8611.  * Hint that the lighting should not be applied on vertices.
  8612.  *)
  8613.  
  8614.   D3DDP_DONOTLIGHT            = $00000010;
  8615.  
  8616.  
  8617. (*
  8618.  * Direct3D Errors
  8619.  * DirectDraw error codes are used when errors not specified here.
  8620.  *)
  8621.  
  8622. const
  8623.   MAKE_D3DHRESULT = HResult($88760000);
  8624.  
  8625.   D3D_OK                          = DD_OK;
  8626.   D3DERR_BADMAJORVERSION          = MAKE_D3DHRESULT + 700;
  8627.   D3DERR_BADMINORVERSION          = MAKE_D3DHRESULT + 701;
  8628.  
  8629. (*
  8630.  * An invalid device was requested by the application.
  8631.  *)
  8632.   D3DERR_INVALID_DEVICE   = MAKE_D3DHRESULT + 705;
  8633.   D3DERR_INITFAILED       = MAKE_D3DHRESULT + 706;
  8634.  
  8635. (*
  8636.  * SetRenderTarget attempted on a device that was
  8637.  * QI'd off the render target.
  8638.  *)
  8639.   D3DERR_DEVICEAGGREGATED = MAKE_D3DHRESULT + 707;
  8640.  
  8641.   D3DERR_EXECUTE_CREATE_FAILED    = MAKE_D3DHRESULT + 710;
  8642.   D3DERR_EXECUTE_DESTROY_FAILED   = MAKE_D3DHRESULT + 711;
  8643.   D3DERR_EXECUTE_LOCK_FAILED      = MAKE_D3DHRESULT + 712;
  8644.   D3DERR_EXECUTE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 713;
  8645.   D3DERR_EXECUTE_LOCKED           = MAKE_D3DHRESULT + 714;
  8646.   D3DERR_EXECUTE_NOT_LOCKED       = MAKE_D3DHRESULT + 715;
  8647.  
  8648.   D3DERR_EXECUTE_FAILED           = MAKE_D3DHRESULT + 716;
  8649.   D3DERR_EXECUTE_CLIPPED_FAILED   = MAKE_D3DHRESULT + 717;
  8650.  
  8651.   D3DERR_TEXTURE_NO_SUPPORT       = MAKE_D3DHRESULT + 720;
  8652.   D3DERR_TEXTURE_CREATE_FAILED    = MAKE_D3DHRESULT + 721;
  8653.   D3DERR_TEXTURE_DESTROY_FAILED   = MAKE_D3DHRESULT + 722;
  8654.   D3DERR_TEXTURE_LOCK_FAILED      = MAKE_D3DHRESULT + 723;
  8655.   D3DERR_TEXTURE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 724;
  8656.   D3DERR_TEXTURE_LOAD_FAILED      = MAKE_D3DHRESULT + 725;
  8657.   D3DERR_TEXTURE_SWAP_FAILED      = MAKE_D3DHRESULT + 726;
  8658.   D3DERR_TEXTURE_LOCKED           = MAKE_D3DHRESULT + 727;
  8659.   D3DERR_TEXTURE_NOT_LOCKED       = MAKE_D3DHRESULT + 728;
  8660.   D3DERR_TEXTURE_GETSURF_FAILED   = MAKE_D3DHRESULT + 729;
  8661.  
  8662.   D3DERR_MATRIX_CREATE_FAILED     = MAKE_D3DHRESULT + 730;
  8663.   D3DERR_MATRIX_DESTROY_FAILED    = MAKE_D3DHRESULT + 731;
  8664.   D3DERR_MATRIX_SETDATA_FAILED    = MAKE_D3DHRESULT + 732;
  8665.   D3DERR_MATRIX_GETDATA_FAILED    = MAKE_D3DHRESULT + 733;
  8666.   D3DERR_SETVIEWPORTDATA_FAILED   = MAKE_D3DHRESULT + 734;
  8667.  
  8668.   D3DERR_INVALIDCURRENTVIEWPORT   = MAKE_D3DHRESULT + 735;
  8669.   D3DERR_INVALIDPRIMITIVETYPE     = MAKE_D3DHRESULT + 736;
  8670.   D3DERR_INVALIDVERTEXTYPE        = MAKE_D3DHRESULT + 737;
  8671.   D3DERR_TEXTURE_BADSIZE          = MAKE_D3DHRESULT + 738;
  8672.   D3DERR_INVALIDRAMPTEXTURE       = MAKE_D3DHRESULT + 739;
  8673.  
  8674.   D3DERR_MATERIAL_CREATE_FAILED   = MAKE_D3DHRESULT + 740;
  8675.   D3DERR_MATERIAL_DESTROY_FAILED  = MAKE_D3DHRESULT + 741;
  8676.   D3DERR_MATERIAL_SETDATA_FAILED  = MAKE_D3DHRESULT + 742;
  8677.   D3DERR_MATERIAL_GETDATA_FAILED  = MAKE_D3DHRESULT + 743;
  8678.  
  8679.   D3DERR_INVALIDPALETTE           = MAKE_D3DHRESULT + 744;
  8680.  
  8681.   D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY = MAKE_D3DHRESULT + 745;
  8682.   D3DERR_ZBUFF_NEEDS_VIDEOMEMORY  = MAKE_D3DHRESULT + 746;
  8683.   D3DERR_SURFACENOTINVIDMEM       = MAKE_D3DHRESULT + 747;
  8684.  
  8685.   D3DERR_LIGHT_SET_FAILED         = MAKE_D3DHRESULT + 750;
  8686.   D3DERR_LIGHTHASVIEWPORT         = MAKE_D3DHRESULT + 751;
  8687.   D3DERR_LIGHTNOTINTHISVIEWPORT   = MAKE_D3DHRESULT + 752;
  8688.  
  8689.   D3DERR_SCENE_IN_SCENE           = MAKE_D3DHRESULT + 760;
  8690.   D3DERR_SCENE_NOT_IN_SCENE       = MAKE_D3DHRESULT + 761;
  8691.   D3DERR_SCENE_BEGIN_FAILED       = MAKE_D3DHRESULT + 762;
  8692.   D3DERR_SCENE_END_FAILED         = MAKE_D3DHRESULT + 763;
  8693.  
  8694.   D3DERR_INBEGIN                  = MAKE_D3DHRESULT + 770;
  8695.   D3DERR_NOTINBEGIN               = MAKE_D3DHRESULT + 771;
  8696.   D3DERR_NOVIEWPORTS              = MAKE_D3DHRESULT + 772;
  8697.   D3DERR_VIEWPORTDATANOTSET       = MAKE_D3DHRESULT + 773;
  8698.   D3DERR_VIEWPORTHASNODEVICE      = MAKE_D3DHRESULT + 774;
  8699.   D3DERR_NOCURRENTVIEWPORT        = MAKE_D3DHRESULT + 775;
  8700.  
  8701.   D3DERR_INVALIDVERTEXFORMAT      = MAKE_D3DHRESULT + 2048;
  8702.  
  8703. (*
  8704.  * Attempted to CreateTexture on a surface that had a color key
  8705.  *)
  8706.   D3DERR_COLORKEYATTACHED                 = MAKE_D3DHRESULT + 2050;
  8707.  
  8708.   D3DERR_VERTEXBUFFEROPTIMIZED            = MAKE_D3DHRESULT + 2060;
  8709.   D3DERR_VBUF_CREATE_FAILED               = MAKE_D3DHRESULT + 2061;
  8710.   D3DERR_VERTEXBUFFERLOCKED               = MAKE_D3DHRESULT + 2062;
  8711.  
  8712.   D3DERR_ZBUFFER_NOTPRESENT               = MAKE_D3DHRESULT + 2070;
  8713.   D3DERR_STENCILBUFFER_NOTPRESENT         = MAKE_D3DHRESULT + 2071;
  8714.  
  8715.   D3DERR_WRONGTEXTUREFORMAT               = MAKE_D3DHRESULT + 2072;
  8716.   D3DERR_UNSUPPORTEDCOLOROPERATION        = MAKE_D3DHRESULT + 2073;
  8717.   D3DERR_UNSUPPORTEDCOLORARG              = MAKE_D3DHRESULT + 2074;
  8718.   D3DERR_UNSUPPORTEDALPHAOPERATION        = MAKE_D3DHRESULT + 2075;
  8719.   D3DERR_UNSUPPORTEDALPHAARG              = MAKE_D3DHRESULT + 2076;
  8720.   D3DERR_TOOMANYOPERATIONS                = MAKE_D3DHRESULT + 2077;
  8721.   D3DERR_CONFLICTINGTEXTUREFILTER         = MAKE_D3DHRESULT + 2078;
  8722.   D3DERR_UNSUPPORTEDFACTORVALUE           = MAKE_D3DHRESULT + 2079;
  8723.   D3DERR_CONFLICTINGRENDERSTATE           = MAKE_D3DHRESULT + 2081;
  8724.   D3DERR_UNSUPPORTEDTEXTUREFILTER         = MAKE_D3DHRESULT + 2082;
  8725.   D3DERR_TOOMANYPRIMITIVES                = MAKE_D3DHRESULT + 2083;
  8726.   D3DERR_INVALIDMATRIX                    = MAKE_D3DHRESULT + 2084;
  8727.   D3DERR_TOOMANYVERTICES                  = MAKE_D3DHRESULT + 2085;
  8728.   D3DERR_CONFLICTINGTEXTUREPALETTE        = MAKE_D3DHRESULT + 2086;
  8729.  
  8730.   D3DERR_INVALIDSTATEBLOCK        = MAKE_D3DHRESULT + 2100;
  8731.   D3DERR_INBEGINSTATEBLOCK        = MAKE_D3DHRESULT + 2101;
  8732.   D3DERR_NOTINBEGINSTATEBLOCK     = MAKE_D3DHRESULT + 2102;
  8733.  
  8734. procedure DisableFPUExceptions;
  8735. procedure EnableFPUExceptions;
  8736.  
  8737. (***************************************************************************
  8738.  *
  8739.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  8740.  *
  8741.  *  File:       dxfile.h
  8742.  *
  8743.  *  Content:    DirectX File public header file
  8744.  *
  8745.  ***************************************************************************)
  8746.  
  8747. var
  8748.   DXFileDLL : HMODULE;
  8749.  
  8750. function DXFileErrorString(Value: HResult) : string;
  8751.  
  8752. type
  8753.   TDXFileFormat = (
  8754.     DXFILEFORMAT_BINARY,
  8755.     DXFILEFORMAT_TEXT,
  8756.     DXFILEFORMAT_COMPRESSED
  8757.   );
  8758.  
  8759.   TDXFileLoadOptions = (
  8760.     DXFILELOAD_FROMFILE,
  8761.     DXFILELOAD_FROMRESOURCE,
  8762.     DXFILELOAD_FROMMEMORY,
  8763.     DXFILELOAD_INVALID_3,
  8764.     DXFILELOAD_FROMSTREAM,
  8765.     DXFILELOAD_INVALID_5,
  8766.     DXFILELOAD_INVALID_6,
  8767.     DXFILELOAD_INVALID_7,
  8768.     DXFILELOAD_FROMURL
  8769.   );
  8770.  
  8771.   PDXFileLoadResource = ^TDXFileLoadResource;
  8772.   TDXFileLoadResource = packed record
  8773.     hModule: HModule;
  8774.     lpName: PAnsiChar;
  8775.     lpType: PAnsiChar;
  8776.   end;
  8777.  
  8778.   PDXFileLoadMemory = ^TDXFileLoadMemory;
  8779.   TDXFileLoadMemory = packed record
  8780.     lpMemory: Pointer;
  8781.     dSize: DWORD;
  8782.   end;
  8783.  
  8784. (*
  8785.  * DirectX File object types.
  8786.  *)
  8787.  
  8788.   IDirectXFile = interface;
  8789.   IDirectXFileEnumObject = interface;
  8790.   IDirectXFileSaveObject = interface;
  8791.   IDirectXFileObject = interface;
  8792.   IDirectXFileData = interface;
  8793.   IDirectXFileDataReference = interface;
  8794.   IDirectXFileBinary = interface;
  8795.  
  8796. (*
  8797.  * DirectX File interfaces.
  8798.  *)
  8799.  
  8800.   IDirectXFile = interface (IUnknown)
  8801.     ['{3d82ab40-62da-11cf-ab39-0020af71e433}']
  8802.     function CreateEnumObject (pvSource: Pointer;
  8803.         dwLoadOptions: TDXFileLoadOptions;
  8804.         var ppEnumObj: IDirectXFileEnumObject) : HResult; stdcall;
  8805.     function CreateSaveObject (szFileName: PChar; dwFileFormat: TDXFileFormat;
  8806.         var ppSaveObj: IDirectXFileSaveObject) : HResult; stdcall;
  8807.     function RegisterTemplates (pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  8808.   end;
  8809.  
  8810.   IDirectXFileEnumObject = interface (IUnknown)
  8811.     ['{3d82ab41-62da-11cf-ab39-0020af71e433}']
  8812.     function GetNextDataObject (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8813.     function GetDataObjectById
  8814.         (const rguid: TGUID; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8815.     function GetDataObjectByName
  8816.         (szName: PChar; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8817.   end;
  8818.  
  8819.   IDirectXFileSaveObject = interface (IUnknown)
  8820.     ['{3d82ab42-62da-11cf-ab39-0020af71e433}']
  8821.     function SaveTemplates
  8822.         (cTemplates: DWORD; var ppguidTemplates: PGUID) : HResult; stdcall;
  8823.     function CreateDataObject (const rguidTemplate: TGUID; szName: PChar;
  8824.         pguid: PGUID; cbSize: DWORD; pvData: Pointer;
  8825.         var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8826.     function SaveData (pDataObj: IDirectXFileData) : HResult; stdcall;
  8827.   end;
  8828.  
  8829.   IDirectXFileObject = interface (IUnknown)
  8830.     ['{3d82ab43-62da-11cf-ab39-0020af71e433}']
  8831.     function GetName (pstrNameBuf: PChar; var dwBufLen: DWORD) : HResult; stdcall;
  8832.     function GetId (var pGuidBuf: TGUID) : HResult; stdcall;
  8833.   end;
  8834.  
  8835.   IDirectXFileData = interface (IDirectXFileObject)
  8836.     ['{3d82ab44-62da-11cf-ab39-0020af71e433}']
  8837.     function GetData
  8838.         (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer) : HResult; stdcall;
  8839.     function GetType (var ppguid: PGUID) : HResult; stdcall;
  8840.     function GetNextObject (var ppChildObj: IDirectXFileObject) : HResult; stdcall;
  8841.     function AddDataObject (pDataObj: IDirectXFileData) : HResult; stdcall;
  8842.     function AddDataReference (szRef: PChar; pguidRef: PGUID) : HResult; stdcall;
  8843.     function AddBinaryObject (szName: PChar; pguid: PGUID; szMimeType: PChar;
  8844.         pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  8845.   end;
  8846.  
  8847.   IDirectXFileDataReference = interface (IDirectXFileObject)
  8848.     ['{3d82ab45-62da-11cf-ab39-0020af71e433}']
  8849.     function Resolve (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8850.   end;
  8851.  
  8852.   IDirectXFileBinary = interface (IDirectXFileObject)
  8853.     ['{3d82ab46-62da-11cf-ab39-0020af71e433}']
  8854.     function GetSize (var pcbSize: DWORD) : HResult; stdcall;
  8855.     function GetMimeType (var pszMimeType: PChar) : HResult; stdcall;
  8856.     function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}) : HResult; stdcall;
  8857.   end;
  8858.  
  8859. const
  8860.  
  8861. (*
  8862.  * DirectXFile Object Class Id (for CoCreateInstance())
  8863.  *)
  8864.  
  8865.    CLSID_CDirectXFile: TGUID =
  8866.        (D1:$4516ec43;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  8867.  
  8868. (*
  8869.  * DirectX File Interface GUIDs.
  8870.  *)
  8871.  
  8872. type
  8873.   IID_IDirectXFile = IDirectXFile;
  8874.   IID_IDirectXFileEnumObject = IDirectXFileEnumObject;
  8875.   IID_IDirectXFileSaveObject = IDirectXFileSaveObject;
  8876.   IID_IDirectXFileObject = IDirectXFileObject;
  8877.   IID_IDirectXFileData = IDirectXFileData;
  8878.   IID_IDirectXFileDataReference = IDirectXFileDataReference;
  8879.   IID_IDirectXFileBinary = IDirectXFileBinary;
  8880.  
  8881. (*
  8882.  * DirectX File Header template's GUID.
  8883.  *)
  8884. const
  8885.   TID_DXFILEHeader: TGUID =
  8886.       (D1:$3d82ab43;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  8887.  
  8888. (*
  8889.  * DirectX File errors.
  8890.  *)
  8891.  
  8892. const
  8893.   DXFILE_OK = 0;
  8894.  
  8895.   DXFILEERR_BADOBJECT                 = MAKE_D3DHRESULT or 850;
  8896.   DXFILEERR_BADVALUE                  = MAKE_D3DHRESULT or 851;
  8897.   DXFILEERR_BADTYPE                   = MAKE_D3DHRESULT or 852;
  8898.   DXFILEERR_BADSTREAMHANDLE           = MAKE_D3DHRESULT or 853;
  8899.   DXFILEERR_BADALLOC                  = MAKE_D3DHRESULT or 854;
  8900.   DXFILEERR_NOTFOUND                  = MAKE_D3DHRESULT or 855;
  8901.   DXFILEERR_NOTDONEYET                = MAKE_D3DHRESULT or 856;
  8902.   DXFILEERR_FILENOTFOUND              = MAKE_D3DHRESULT or 857;
  8903.   DXFILEERR_RESOURCENOTFOUND          = MAKE_D3DHRESULT or 858;
  8904.   DXFILEERR_URLNOTFOUND               = MAKE_D3DHRESULT or 859;
  8905.   DXFILEERR_BADRESOURCE               = MAKE_D3DHRESULT or 860;
  8906.   DXFILEERR_BADFILETYPE               = MAKE_D3DHRESULT or 861;
  8907.   DXFILEERR_BADFILEVERSION            = MAKE_D3DHRESULT or 862;
  8908.   DXFILEERR_BADFILEFLOATSIZE          = MAKE_D3DHRESULT or 863;
  8909.   DXFILEERR_BADFILECOMPRESSIONTYPE    = MAKE_D3DHRESULT or 864;
  8910.   DXFILEERR_BADFILE                   = MAKE_D3DHRESULT or 865;
  8911.   DXFILEERR_PARSEERROR                = MAKE_D3DHRESULT or 866;
  8912.   DXFILEERR_NOTEMPLATE                = MAKE_D3DHRESULT or 867;
  8913.   DXFILEERR_BADARRAYSIZE              = MAKE_D3DHRESULT or 868;
  8914.   DXFILEERR_BADDATAREFERENCE          = MAKE_D3DHRESULT or 869;
  8915.   DXFILEERR_INTERNALERROR             = MAKE_D3DHRESULT or 870;
  8916.   DXFILEERR_NOMOREOBJECTS             = MAKE_D3DHRESULT or 871;
  8917.   DXFILEERR_BADINTRINSICS             = MAKE_D3DHRESULT or 872;
  8918.   DXFILEERR_NOMORESTREAMHANDLES       = MAKE_D3DHRESULT or 873;
  8919.   DXFILEERR_NOMOREDATA                = MAKE_D3DHRESULT or 874;
  8920.   DXFILEERR_BADCACHEFILE              = MAKE_D3DHRESULT or 875;
  8921.   DXFILEERR_NOINTERNET                = MAKE_D3DHRESULT or 876;
  8922.  
  8923. {$IFDEF D3DRM}
  8924. (*
  8925.  * API for creating IDirectXFile interface.
  8926.  *)
  8927.  
  8928. var
  8929.   DirectXFileCreate : function
  8930.     (out lplpDirectXFile: IDirectXFile) : HResult; stdcall;
  8931.  
  8932. (* D3DRM XFile templates in binary form *)
  8933. const
  8934.   D3DRM_XTEMPLATE_BYTES = 3215;
  8935.   D3DRM_XTEMPLATES: array [0..D3DRM_XTEMPLATE_BYTES-1] of byte = (
  8936.         $78, $6f, $66, $20, $30, $33, $30, $32, $62,
  8937.         $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  8938.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65,
  8939.         $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  8940.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  8941.         $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  8942.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0,
  8943.         $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  8944.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66,
  8945.         $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  8946.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  8947.         $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  8948.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71,
  8949.         $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  8950.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0,
  8951.         0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  8952.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1,
  8953.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  8954.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2,
  8955.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  8956.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0,
  8957.         0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  8958.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1,
  8959.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  8960.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f,
  8961.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  8962.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0,
  8963.         $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  8964.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0,
  8965.         $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  8966.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  8967.         $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  8968.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94,
  8969.         $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  8970.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0,
  8971.         0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  8972.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75,
  8973.         $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  8974.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0,
  8975.         $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  8976.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0,
  8977.         $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  8978.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0,
  8979.         $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  8980.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65,
  8981.         $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  8982.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0,
  8983.         $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  8984.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72,
  8985.         $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  8986.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  8987.         $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  8988.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0,
  8989.         0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  8990.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65,
  8991.         $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  8992.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f,
  8993.         $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  8994.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0,
  8995.         $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  8996.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c,
  8997.         $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  8998.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61,
  8999.         $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  9000.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33,
  9001.         $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  9002.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0,
  9003.         0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  9004.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0,
  9005.         $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  9006.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74,
  9007.         $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  9008.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf,
  9009.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  9010.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65,
  9011.         $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  9012.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f,
  9013.         $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  9014.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f,
  9015.         0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  9016.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0,
  9017.         $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  9018.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0,
  9019.         $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  9020.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0,
  9021.         $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  9022.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab,
  9023.         $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  9024.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0,
  9025.         $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  9026.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43,
  9027.         $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  9028.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14,
  9029.         0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  9030.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0,
  9031.         0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  9032.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0,
  9033.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  9034.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73,
  9035.         $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  9036.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f,
  9037.         0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  9038.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a,
  9039.         0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  9040.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  9041.         0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  9042.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e,
  9043.         $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  9044.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63,
  9045.         $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  9046.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0,
  9047.         0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  9048.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73,
  9049.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  9050.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61,
  9051.         $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  9052.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94,
  9053.         $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  9054.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65,
  9055.         $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  9056.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0,
  9057.         $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  9058.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57,
  9059.         $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  9060.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61,
  9061.         $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  9062.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  9063.         $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  9064.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f,
  9065.         $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  9066.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  9067.         $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  9068.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43,
  9069.         $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  9070.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  9071.         $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  9072.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72,
  9073.         $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  9074.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f,
  9075.         $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  9076.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65,
  9077.         $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  9078.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f,
  9079.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  9080.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0,
  9081.         0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  9082.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0,
  9083.         0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  9084.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0,
  9085.         $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  9086.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1,
  9087.         0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  9088.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14,
  9089.         0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  9090.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b,
  9091.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  9092.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73,
  9093.         $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  9094.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  9095.         $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  9096.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0,
  9097.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  9098.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f,
  9099.         $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  9100.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c,
  9101.         $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  9102.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f,
  9103.         $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  9104.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46,
  9105.         $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  9106.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  9107.         $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  9108.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  9109.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  9110.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65,
  9111.         $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  9112.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78,
  9113.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  9114.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56,
  9115.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  9116.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0,
  9117.         0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  9118.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76,
  9119.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  9120.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e,
  9121.         $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  9122.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  9123.         $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  9124.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62,
  9125.         $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  9126.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56,
  9127.         $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  9128.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63,
  9129.         $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  9130.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1,
  9131.         0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  9132.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0,
  9133.         $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  9134.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0,
  9135.         0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  9136.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65,
  9137.         $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  9138.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e,
  9139.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  9140.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46,
  9141.         $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  9142.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a,
  9143.         0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  9144.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  9145.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  9146.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0,
  9147.         $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  9148.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5,
  9149.         0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  9150.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11,
  9151.         $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  9152.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0,
  9153.         $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  9154.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5,
  9155.         0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  9156.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1,
  9157.         0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  9158.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0,
  9159.         $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  9160.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56,
  9161.         $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  9162.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54,
  9163.         $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  9164.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6,
  9165.         $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  9166.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0,
  9167.         0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  9168.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65,
  9169.         $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  9170.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0,
  9171.         $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  9172.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0,
  9173.         $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  9174.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0,
  9175.         $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  9176.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5,
  9177.         0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  9178.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69,
  9179.         $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  9180.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65,
  9181.         $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  9182.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b,
  9183.         0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  9184.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70,
  9185.         $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  9186.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0,
  9187.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  9188.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f,
  9189.         $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  9190.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f,
  9191.         $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  9192.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0,
  9193.         $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  9194.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf,
  9195.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  9196.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  9197.         0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  9198.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65,
  9199.         $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  9200.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  9201.         $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  9202.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0,
  9203.         $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  9204.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61,
  9205.         $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  9206.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  9207.         $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  9208.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0,
  9209.         $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  9210.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0,
  9211.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  9212.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72,
  9213.         $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  9214.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0,
  9215.         $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  9216.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1,
  9217.         0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  9218.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68,
  9219.         $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  9220.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b,
  9221.         $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  9222.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49,
  9223.         $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  9224.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0,
  9225.         0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  9226.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0,
  9227.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  9228.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0,
  9229.         $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  9230.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5,
  9231.         0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  9232.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0,
  9233.         $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  9234.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f,
  9235.         0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  9236.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74,
  9237.         $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  9238.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72,
  9239.         $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  9240.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0,
  9241.         0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  9242.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50,
  9243.         $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  9244.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf,
  9245.         $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  9246.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74,
  9247.         $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  9248.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0,
  9249.         $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  9250.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0,
  9251.         $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  9252.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0,
  9253.         $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  9254.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78,
  9255.         $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  9256.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0,
  9257.         $12, 0, $f, 0, $b, 0);
  9258.  
  9259. //---------------
  9260.  
  9261. //Direct3DRM file
  9262. (*==========================================================================;
  9263.  *
  9264.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  9265.  *
  9266.  *  Files:      D3DRMDef.h D3DRMObj.h D3DRM.h D3DRMWin.h RMXFGUID.h RMXFTmpl.h
  9267.  *  Content:    Direct3D Retained Mode include files
  9268.  *
  9269.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  9270.  *
  9271.  *  Modified: 10-Sep-2000
  9272.  *
  9273.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  9274.  *  E-Mail: DelphiDirectX@next-reality.com
  9275.  *
  9276.  *
  9277.  ***************************************************************************)
  9278.  
  9279. var
  9280.   D3DRMDLL : HMODULE = 0;
  9281.  
  9282. (*==========================================================================;
  9283.  *
  9284.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  9285.  *
  9286.  *  File:       d3drmdef.h
  9287.  *  Content:    Direct3DRM include file
  9288.  *
  9289.  ***************************************************************************)
  9290.  
  9291. type
  9292.   PD3DRMVector4D = ^TD3DRMVector4D;
  9293.   TD3DRMVector4D = packed record
  9294.     x, y, z, w: TD3DValue;
  9295.   end;
  9296.  
  9297.   PD3DRMMatrix4D = ^TD3DRMMatrix4D;
  9298.   TD3DRMMatrix4D = array [0..3, 0..3] of TD3DValue;
  9299.  
  9300.   PD3DRMQuaternion = ^TD3DRMQuaternion;
  9301.   TD3DRMQuaternion = packed record
  9302.     s: TD3DValue;
  9303.     v: TD3DVector;
  9304.   end;
  9305.  
  9306.   PD3DRMRay = ^TD3DRMRay;
  9307.   TD3DRMRay = packed record
  9308.     dvDir: TD3DVector;
  9309.     dvPos: TD3DVector;
  9310.   end;
  9311.  
  9312.   PD3DRMBox = ^TD3DRMBox;
  9313.   TD3DRMBox = packed record
  9314.     min, max: TD3DVector;
  9315.   end;
  9316.  
  9317.   TD3DRMWrapCallback = procedure (var lpD3DVector: TD3DVector;
  9318.       var lpU, lpV: Integer; var lpD3DRMVA, lpD3DRMVB: TD3DVector; lpArg:
  9319.       Pointer); stdcall; // unused ?
  9320.  
  9321.   PD3DRMLightType = ^TD3DRMLightType; // is it 16 or 32 bit ?
  9322.   TD3DRMLightType = (
  9323.     D3DRMLIGHT_AMBIENT,
  9324.     D3DRMLIGHT_POINT,
  9325.     D3DRMLIGHT_SPOT,
  9326.     D3DRMLIGHT_DIRECTIONAL,
  9327.     D3DRMLIGHT_PARALLELPOINT
  9328.   );
  9329.  
  9330.   PD3DRMShadeMode = ^TD3DRMShadeMode;
  9331.   TD3DRMShadeMode = WORD;
  9332.  
  9333. const
  9334.   D3DRMSHADE_FLAT = 0;
  9335.   D3DRMSHADE_GOURAUD = 1;
  9336.   D3DRMSHADE_PHONG = 2;
  9337.   D3DRMSHADE_MASK = 7;
  9338.   D3DRMSHADE_MAX = 8;
  9339.  
  9340. type
  9341.   PD3DRMLightMode = ^TD3DRMLightMode;
  9342.   TD3DRMLightMode = WORD;
  9343.  
  9344. const
  9345.   D3DRMLIGHT_OFF  = 0 * D3DRMSHADE_MAX;
  9346.   D3DRMLIGHT_ON   = 1 * D3DRMSHADE_MAX;
  9347.   D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX;
  9348.   D3DRMLIGHT_MAX  = 8 * D3DRMSHADE_MAX;
  9349.  
  9350. type
  9351.   PD3DRMFillMode = ^TD3DRMFillMode;
  9352.   TD3DRMFillMode = WORD;
  9353.  
  9354. const
  9355.   D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX;
  9356.   D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX;
  9357.   D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX;
  9358.   D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX;
  9359.   D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX;
  9360.  
  9361. type
  9362.   PD3DRMRenderQuality = ^TD3DRMRenderQuality;
  9363.   TD3DRMRenderQuality = DWORD;
  9364.  
  9365. const
  9366.   D3DRMRENDER_WIREFRAME   =
  9367.       (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_WIREFRAME);
  9368.   D3DRMRENDER_UNLITFLAT   =
  9369.       (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_SOLID);
  9370.   D3DRMRENDER_FLAT        =
  9371.       (D3DRMSHADE_FLAT + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9372.   D3DRMRENDER_GOURAUD     =
  9373.       (D3DRMSHADE_GOURAUD + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9374.   D3DRMRENDER_PHONG       =
  9375.       (D3DRMSHADE_PHONG + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9376.  
  9377.   D3DRMRENDERMODE_BLENDEDTRANSPARENCY   =  1;
  9378.   D3DRMRENDERMODE_SORTEDTRANSPARENCY    =  2;
  9379.   D3DRMRENDERMODE_LIGHTINMODELSPACE     =  8;
  9380.   D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR = 16;
  9381.  
  9382. type
  9383.   PD3DRMTextureQuality = ^TD3DRMTextureQuality;
  9384.   TD3DRMTextureQuality = (
  9385.     D3DRMTEXTURE_NEAREST,               (* choose nearest texel *)
  9386.     D3DRMTEXTURE_LINEAR,                (* interpolate 4 texels *)
  9387.     D3DRMTEXTURE_MIPNEAREST,            (* nearest texel in nearest mipmap  *)
  9388.     D3DRMTEXTURE_MIPLINEAR,             (* interpolate 2 texels from 2 mipmaps *)
  9389.     D3DRMTEXTURE_LINEARMIPNEAREST,      (* interpolate 4 texels in nearest mipmap *)
  9390.     D3DRMTEXTURE_LINEARMIPLINEAR        (* interpolate 8 texels from 2 mipmaps *)
  9391.   );
  9392.  
  9393. const
  9394. (*
  9395.  * Texture flags
  9396.  *)
  9397.   D3DRMTEXTURE_FORCERESIDENT          = $00000001; (* texture should be kept in video memory *)
  9398.   D3DRMTEXTURE_STATIC                 = $00000002; (* texture will not change *)
  9399.   D3DRMTEXTURE_DOWNSAMPLEPOINT        = $00000004; (* point filtering should be used when downsampling *)
  9400.   D3DRMTEXTURE_DOWNSAMPLEBILINEAR     = $00000008; (* bilinear filtering should be used when downsampling *)
  9401.   D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH  = $00000010; (* reduce bit depth when downsampling *)
  9402.   D3DRMTEXTURE_DOWNSAMPLENONE         = $00000020; (* texture should never be downsampled *)
  9403.   D3DRMTEXTURE_CHANGEDPIXELS          = $00000040; (* pixels have changed *)
  9404.   D3DRMTEXTURE_CHANGEDPALETTE         = $00000080; (* palette has changed *)
  9405.   D3DRMTEXTURE_INVALIDATEONLY         = $00000100; (* dirty regions are invalid *)
  9406.  
  9407. (*
  9408.  * Shadow flags
  9409.  *)
  9410.    D3DRMSHADOW_TRUEALPHA               = $00000001; (* shadow should render without artifacts when true alpha is on *)
  9411.  
  9412. type
  9413.   PD3DRMCombineType = ^TD3DRMCombineType;
  9414.   TD3DRMCombineType = (
  9415.     D3DRMCOMBINE_REPLACE,
  9416.     D3DRMCOMBINE_BEFORE,
  9417.     D3DRMCOMBINE_AFTER
  9418.   );
  9419.  
  9420.   PD3DRMColorModel = ^TD3DRMColorModel;
  9421.   TD3DRMColorModel = TD3DColorModel;
  9422.  
  9423.   PD3DRMPaletteFlags = ^TD3DRMPaletteFlags;
  9424.   TD3DRMPaletteFlags = (
  9425.     D3DRMPALETTE_FREE,                  (* renderer may use this entry freely *)
  9426.     D3DRMPALETTE_READONLY,              (* fixed but may be used by renderer *)
  9427.     D3DRMPALETTE_RESERVED               (* may not be used by renderer *)
  9428.   );
  9429.  
  9430.   PD3DRMPaletteEntry = ^TD3DRMPaletteEntry;
  9431.   TD3DRMPaletteEntry = packed record
  9432.     red: Byte;          (* 0 .. 255 *)
  9433.     green: Byte;        (* 0 .. 255 *)
  9434.     blue: Byte;         (* 0 .. 255 *)
  9435.     flags: Byte;        (* one of D3DRMPALETTEFLAGS *)
  9436.   end;
  9437.  
  9438.   PD3DRMImage = ^TD3DRMImage;
  9439.   TD3DRMImage = packed record
  9440.     width, height: Integer;    (* width and height in pixels *)
  9441.     aspectx, aspecty: Integer; (* aspect ratio for non-square pixels *)
  9442.     depth: Integer;            (* bits per pixel *)
  9443.     rgb: Integer;              (* if false, pixels are indices into a
  9444.                                    palette otherwise, pixels encode
  9445.                                    RGB values. *)
  9446.     bytes_per_line: Integer;   (* number of bytes of memory for a
  9447.                                    scanline. This must be a multiple
  9448.                                    of 4. *)
  9449.     buffer1: Pointer;          (* memory to render into (first buffer). *)
  9450.     buffer2: Pointer;          (* second rendering buffer for double
  9451.                                    buffering, set to NULL for single
  9452.                                    buffering. *)
  9453.     red_mask: DWORD;
  9454.     green_mask: DWORD;
  9455.     blue_mask: DWORD;
  9456.     alpha_mask: DWORD;        (* if rgb is true, these are masks for
  9457.                                    the red, green and blue parts of a
  9458.                                    pixel.  Otherwise, these are masks
  9459.                                    for the significant bits of the
  9460.                                    red, green and blue elements in the
  9461.                                    palette.  For instance, most SVGA
  9462.                                    displays use 64 intensities of red,
  9463.                                    green and blue, so the masks should
  9464.                                    all be set to = $fc. *)
  9465.     palette_size: Integer;     (* number of entries in palette *)
  9466.     palette: PD3DRMPaletteEntry; (* description of the palette (only if
  9467.                                    rgb is false).  Must be (1<<depth)
  9468.                                    elements. *)
  9469.   end;
  9470.  
  9471.   PD3DRMWrapType = ^TD3DRMWrapType;
  9472.   TD3DRMWrapType = (
  9473.     D3DRMWRAP_FLAT,
  9474.     D3DRMWRAP_CYLINDER,
  9475.     D3DRMWRAP_SPHERE,
  9476.     D3DRMWRAP_CHROME,
  9477.     D3DRMWRAP_SHEET,
  9478.     D3DRMWRAP_BOX
  9479.   );
  9480.  
  9481. const
  9482.   D3DRMWIREFRAME_CULL             = 1; (* cull backfaces *)
  9483.   D3DRMWIREFRAME_HIDDENLINE       = 2; (* lines are obscured by closer objects *)
  9484.  
  9485. type
  9486. (*
  9487.  * Do not use righthanded perspective in Viewport2::SetProjection().
  9488.  * Set up righthanded mode by using IDirect3DRM3::SetOptions().
  9489.  *)
  9490.   PD3DRMProjectionType = ^TD3DRMProjectionType;
  9491.   TD3DRMProjectionType = (
  9492.     D3DRMPROJECT_PERSPECTIVE,
  9493.     D3DRMPROJECT_ORTHOGRAPHIC,
  9494.     D3DRMPROJECT_RIGHTHANDPERSPECTIVE, (* Only valid pre-DX6 *)
  9495.     D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC (* Only valid pre-DX6 *)
  9496.   );
  9497.  
  9498. const
  9499.   D3DRMOPTIONS_LEFTHANDED  = 00000001; (* Default *)
  9500.   D3DRMOPTIONS_RIGHTHANDED = 00000002;
  9501.  
  9502. type
  9503.   PD3DRMXOFFormat = ^TD3DRMXOFFormat;
  9504.   TD3DRMXOFFormat = (
  9505.     D3DRMXOF_BINARY,
  9506.     D3DRMXOF_COMPRESSED,
  9507.     D3DRMXOF_TEXT
  9508.   );
  9509.  
  9510.   TD3DRMSaveOptions = DWORD;
  9511. const
  9512.   D3DRMXOFSAVE_NORMALS = 1;
  9513.   D3DRMXOFSAVE_TEXTURECOORDINATES = 2;
  9514.   D3DRMXOFSAVE_MATERIALS = 4;
  9515.   D3DRMXOFSAVE_TEXTURENAMES = 8;
  9516.   D3DRMXOFSAVE_ALL = 15;
  9517.   D3DRMXOFSAVE_TEMPLATES = 16;
  9518.   D3DRMXOFSAVE_TEXTURETOPOLOGY = 32;
  9519.  
  9520. type
  9521.   PD3DRMColorSource = ^TD3DRMColorSource;
  9522.   TD3DRMColorSource = (
  9523.     D3DRMCOLOR_FROMFACE,
  9524.     D3DRMCOLOR_FROMVERTEX
  9525.   );
  9526.  
  9527.   PD3DRMFrameConstraint = ^TD3DRMFrameConstraint;
  9528.   TD3DRMFrameConstraint = (
  9529.     D3DRMCONSTRAIN_Z,           (* use only X and Y rotations *)
  9530.     D3DRMCONSTRAIN_Y,           (* use only X and Z rotations *)
  9531.     D3DRMCONSTRAIN_X            (* use only Y and Z rotations *)
  9532.   );
  9533.  
  9534.   PD3DRMMaterialMode = ^TD3DRMMaterialMode;
  9535.   TD3DRMMaterialMode = (
  9536.     D3DRMMATERIAL_FROMMESH,
  9537.     D3DRMMATERIAL_FROMPARENT,
  9538.     D3DRMMATERIAL_FROMFRAME
  9539.   );
  9540.  
  9541.   PD3DRMFogMode = ^TD3DRMFogMode;
  9542.   TD3DRMFogMode = (
  9543.     D3DRMFOG_LINEAR,            (* linear between start and end *)
  9544.     D3DRMFOG_EXPONENTIAL,       (* density * exp(-distance) *)
  9545.     D3DRMFOG_EXPONENTIALSQUARED (* density * exp(-distance*distance) *)
  9546.   );
  9547.  
  9548.   PD3DRMZBufferMode = ^TD3DRMZBufferMode;
  9549.   TD3DRMZBufferMode = (
  9550.     D3DRMZBUFFER_FROMPARENT,    (* default *)
  9551.     D3DRMZBUFFER_ENABLE,        (* enable zbuffering *)
  9552.     D3DRMZBUFFER_DISABLE        (* disable zbuffering *)
  9553.   );
  9554.  
  9555.   PD3DRMSortMode = ^TD3DRMSortMode;
  9556.   TD3DRMSortMode = (
  9557.     D3DRMSORT_FROMPARENT,       (* default *)
  9558.     D3DRMSORT_NONE,             (* don't sort child frames *)
  9559.     D3DRMSORT_FRONTTOBACK,      (* sort child frames front-to-back *)
  9560.     D3DRMSORT_BACKTOFRONT       (* sort child frames back-to-front *)
  9561.   );
  9562.  
  9563.   TD3DRMMaterialOverride = packed record
  9564.     dwSize : DWORD;       (* Size of this structure *)
  9565.     dwFlags : DWORD;      (* Indicate which fields are valid *)
  9566.     dcDiffuse : TD3DColorValue;    (* RGBA *)
  9567.     dcAmbient : TD3DColorValue;    (* RGB *)
  9568.     dcEmissive : TD3DColorValue;   (* RGB *)
  9569.     dcSpecular : TD3DColorValue;   (* RGB *)
  9570.     dvPower : TD3DValue;
  9571.     lpD3DRMTex : IUnknown;
  9572.   end;
  9573.  
  9574. const
  9575.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY     = $00000001;
  9576.   D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY       = $00000002;
  9577.   D3DRMMATERIALOVERRIDE_DIFFUSE               = $00000003;
  9578.   D3DRMMATERIALOVERRIDE_AMBIENT               = $00000004;
  9579.   D3DRMMATERIALOVERRIDE_EMISSIVE              = $00000008;
  9580.   D3DRMMATERIALOVERRIDE_SPECULAR              = $00000010;
  9581.   D3DRMMATERIALOVERRIDE_POWER                 = $00000020;
  9582.   D3DRMMATERIALOVERRIDE_TEXTURE               = $00000040;
  9583.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY = $00000080;
  9584.   D3DRMMATERIALOVERRIDE_ALL                   = $000000FF;
  9585.  
  9586.   D3DRMFPTF_ALPHA                           = $00000001;
  9587.   D3DRMFPTF_NOALPHA                         = $00000002;
  9588.   D3DRMFPTF_PALETTIZED                      = $00000004;
  9589.   D3DRMFPTF_NOTPALETTIZED                   = $00000008;
  9590.  
  9591.   D3DRMSTATECHANGE_UPDATEONLY               = $000000001;
  9592.   D3DRMSTATECHANGE_VOLATILE                 = $000000002;
  9593.   D3DRMSTATECHANGE_NONVOLATILE              = $000000004;
  9594.   D3DRMSTATECHANGE_RENDER                   = $000000020;
  9595.   D3DRMSTATECHANGE_LIGHT                    = $000000040;
  9596.  
  9597. (*
  9598.  * Values for flags in RM3::CreateDeviceFromSurface
  9599.  *)
  9600.   D3DRMDEVICE_NOZBUFFER           = $00000001;
  9601.  
  9602. (*
  9603.  * Values for flags in Object2::SetClientData
  9604.  *)
  9605.   D3DRMCLIENTDATA_NONE            = $00000001;
  9606.   D3DRMCLIENTDATA_LOCALFREE       = $00000002;
  9607.   D3DRMCLIENTDATA_IUNKNOWN        = $00000004;
  9608.  
  9609. (*
  9610.  * Values for flags in Frame2::AddMoveCallback.
  9611.  *)
  9612.   D3DRMCALLBACK_PREORDER                = 0;
  9613.   D3DRMCALLBACK_POSTORDER               = 1;
  9614.  
  9615. (*
  9616.  * Values for flags in MeshBuilder2::RayPick.
  9617.  *)
  9618.   D3DRMRAYPICK_ONLYBOUNDINGBOXES        = 1;
  9619.   D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES  = 2;
  9620.   D3DRMRAYPICK_INTERPOLATEUV            = 4;
  9621.   D3DRMRAYPICK_INTERPOLATECOLOR         = 8;
  9622.   D3DRMRAYPICK_INTERPOLATENORMAL        = $10;
  9623.  
  9624. (*
  9625.  * Values for flags in MeshBuilder3::AddFacesIndexed.
  9626.  *)
  9627.   D3DRMADDFACES_VERTICESONLY             = 1;
  9628.  
  9629. (*
  9630.  * Values for flags in MeshBuilder2::GenerateNormals.
  9631.  *)
  9632.   D3DRMGENERATENORMALS_PRECOMPACT       = 1;
  9633.   D3DRMGENERATENORMALS_USECREASEANGLE   = 2;
  9634.  
  9635. (*
  9636.  * Values for MeshBuilder3::GetParentMesh
  9637.  *)
  9638.   D3DRMMESHBUILDER_DIRECTPARENT          = 1;
  9639.   D3DRMMESHBUILDER_ROOTMESH              = 2;
  9640.  
  9641. (*
  9642.  * Flags for MeshBuilder3::Enable
  9643.  *)
  9644.   D3DRMMESHBUILDER_RENDERENABLE   = $00000001;
  9645.   D3DRMMESHBUILDER_PICKENABLE     = $00000002;
  9646.  
  9647. (*
  9648.  * Flags for Object2::GetAge when used with MeshBuilders
  9649.  *)
  9650.   D3DRMMESHBUILDERAGE_GEOMETRY    = $00000001;
  9651.   D3DRMMESHBUILDERAGE_MATERIALS   = $00000002;
  9652.   D3DRMMESHBUILDERAGE_TEXTURES    = $00000004;
  9653.  
  9654. (*
  9655.  * Format flags for MeshBuilder3::AddTriangles.
  9656.  *)
  9657.   D3DRMFVF_TYPE                   = $00000001;
  9658.   D3DRMFVF_NORMAL                 = $00000002;
  9659.   D3DRMFVF_COLOR                  = $00000004;
  9660.   D3DRMFVF_TEXTURECOORDS          = $00000008;
  9661.  
  9662.   D3DRMVERTEX_STRIP               = $00000001;
  9663.   D3DRMVERTEX_FAN                 = $00000002;
  9664.   D3DRMVERTEX_LIST                = $00000004;
  9665.  
  9666. (*
  9667.  * Values for flags in Viewport2::Clear2
  9668.  *)
  9669.   D3DRMCLEAR_TARGET               = $00000001;
  9670.   D3DRMCLEAR_ZBUFFER              = $00000002;
  9671.   D3DRMCLEAR_DIRTYRECTS           = $00000004;
  9672.   D3DRMCLEAR_ALL                  = (D3DRMCLEAR_TARGET or
  9673.                                          D3DRMCLEAR_ZBUFFER or
  9674.                                          D3DRMCLEAR_DIRTYRECTS);
  9675.  
  9676. (*
  9677.  * Values for flags in Frame3::SetSceneFogMethod
  9678.  *)
  9679.   D3DRMFOGMETHOD_VERTEX          = $00000001;
  9680.   D3DRMFOGMETHOD_TABLE           = $00000002;
  9681.   D3DRMFOGMETHOD_ANY             = $00000004;
  9682.  
  9683. (*
  9684.  * Values for flags in Frame3::SetTraversalOptions
  9685.  *)
  9686.   D3DRMFRAME_RENDERENABLE        = $00000001;
  9687.   D3DRMFRAME_PICKENABLE          = $00000002;
  9688.  
  9689. type
  9690.   TD3DRMAnimationOptions = DWORD;
  9691.  
  9692. const
  9693.   D3DRMANIMATION_OPEN = $01;
  9694.   D3DRMANIMATION_CLOSED = $02;
  9695.   D3DRMANIMATION_LINEARPOSITION = $04;
  9696.   D3DRMANIMATION_SPLINEPOSITION = $08;
  9697.   D3DRMANIMATION_SCALEANDROTATION = $00000010;
  9698.   D3DRMANIMATION_POSITION = $00000020;
  9699.  
  9700. type
  9701.   TD3DRMInterpolationOptions = DWORD;
  9702. const
  9703.   D3DRMINTERPOLATION_OPEN = $01;
  9704.   D3DRMINTERPOLATION_CLOSED = $02;
  9705.   D3DRMINTERPOLATION_NEAREST = $0100;
  9706.   D3DRMINTERPOLATION_LINEAR = $04;
  9707.   D3DRMINTERPOLATION_SPLINE = $08;
  9708.   D3DRMINTERPOLATION_VERTEXCOLOR = $40;
  9709.   D3DRMINTERPOLATION_SLERPNORMALS = $80;
  9710.  
  9711. type
  9712.   TD3DRMLoadOptions = DWORD;
  9713.  
  9714. const
  9715.   D3DRMLOAD_FROMFILE  = $00;
  9716.   D3DRMLOAD_FROMRESOURCE = $01;
  9717.   D3DRMLOAD_FROMMEMORY = $02;
  9718.   D3DRMLOAD_FROMSTREAM = $04;
  9719.   D3DRMLOAD_FROMURL = $08;
  9720.  
  9721.   D3DRMLOAD_BYNAME = $10;
  9722.   D3DRMLOAD_BYPOSITION = $20;
  9723.   D3DRMLOAD_BYGUID = $40;
  9724.   D3DRMLOAD_FIRST = $80;
  9725.  
  9726.   D3DRMLOAD_INSTANCEBYREFERENCE = $100;
  9727.   D3DRMLOAD_INSTANCEBYCOPYING = $200;
  9728.  
  9729.   D3DRMLOAD_ASYNCHRONOUS = $400;
  9730.  
  9731. type
  9732.   PD3DRMLoadResource = ^TD3DRMLoadResource;
  9733.   TD3DRMLoadResource = packed record
  9734.     hModule: HMODULE;
  9735.     lpName: PAnsiChar;
  9736.     lpType: PAnsiChar;
  9737.   end;
  9738.  
  9739.   PD3DRMLoadMemory = ^TD3DRMLoadMemory;
  9740.   TD3DRMLoadMemory = packed record
  9741.     lpMemory: Pointer;
  9742.     dwSize: DWORD;
  9743.   end;
  9744.  
  9745. const
  9746.   D3DRMPMESHSTATUS_VALID = $01;
  9747.   D3DRMPMESHSTATUS_INTERRUPTED = $02;
  9748.   D3DRMPMESHSTATUS_BASEMESHCOMPLETE = $04;
  9749.   D3DRMPMESHSTATUS_COMPLETE = $08;
  9750.   D3DRMPMESHSTATUS_RENDERABLE = $10;
  9751.  
  9752.   D3DRMPMESHEVENT_BASEMESH = $01;
  9753.   D3DRMPMESHEVENT_COMPLETE = $02;
  9754.  
  9755. type
  9756.   PD3DRMPMeshLoadStatus = ^TD3DRMPMeshLoadStatus;
  9757.   TD3DRMPMeshLoadStatus = packed record
  9758.     dwSize,            // Size of this structure
  9759.     dwPMeshSize,       // Total Size (bytes)
  9760.     dwBaseMeshSize,    // Total Size of the Base Mesh
  9761.     dwBytesLoaded,     // Total bytes loaded
  9762.     dwVerticesLoaded,  // Number of vertices loaded
  9763.     dwFacesLoaded : DWORD;     // Number of faces loaded
  9764.     dwLoadResult : HResult;    // Result of the load operation
  9765.     dwFlags : DWORD;
  9766.   end;
  9767.  
  9768.   PD3DRMUserVisualReason = ^TD3DRMUserVisualReason;
  9769.   TD3DRMUserVisualReason = (
  9770.     D3DRMUSERVISUAL_CANSEE,
  9771.     D3DRMUSERVISUAL_RENDER
  9772.   );
  9773.  
  9774.   PD3DRMAnimationKey = ^TD3DRMAnimationKey;
  9775.   TD3DRMAnimationKey = packed record
  9776.     dwSize : DWORD;
  9777.     dwKeyType : DWORD;
  9778.     dvTime : TD3DValue;
  9779.     dwID : DWORD;
  9780.     case integer of
  9781.       0 : (dqRotateKey : TD3DRMQuaternion);
  9782.       1 : (dvScaleKey : TD3DVector);
  9783.       2 : (dvPositionKey : TD3DVector);
  9784.       3 : (dvK : array [0..3] of TD3DValue);
  9785.     end;
  9786.  
  9787. procedure D3DRMAnimationGetRotateKey
  9788.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  9789.  
  9790. procedure D3DRMAnimationGetScaleKey
  9791.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9792.  
  9793. procedure D3DRMAnimationGetPositionKey
  9794.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9795.  
  9796. procedure D3DRMAnimatioSetRotateKey
  9797.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  9798.  
  9799. procedure D3DRMAnimationSetScaleKey
  9800.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9801.  
  9802. procedure D3DRMAnimationSetPositionKey
  9803.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9804.  
  9805. const
  9806.   D3DRMANIMATION_ROTATEKEY = 01;
  9807.   D3DRMANIMATION_SCALEKEY = 02;
  9808.   D3DRMANIMATION_POSITIONKEY = 03;
  9809.  
  9810. type
  9811.   TD3DRMMapping = DWORD;
  9812.   PD3DRMMappingFlag = ^TD3DRMMappingFlag;
  9813.   TD3DRMMappingFlag = DWORD;
  9814.  
  9815. const
  9816.   D3DRMMAP_WRAPU = 1;
  9817.   D3DRMMAP_WRAPV = 2;
  9818.   D3DRMMAP_PERSPCORRECT = 4;
  9819.  
  9820. type
  9821.   PD3DRMVertex = ^TD3DRMVertex;
  9822.   TD3DRMVertex = packed record
  9823.     position: TD3DVector;
  9824.     normal: TD3DVector;
  9825.     tu, tv: TD3DValue;
  9826.     color: TD3DColor;
  9827.   end;
  9828.  
  9829.   TD3DRMGroupIndex = LongInt; (* group indexes begin a 0 *)
  9830.  
  9831. const
  9832.   D3DRMGROUP_ALLGROUPS = -1;
  9833.  
  9834. var
  9835. (*
  9836.  * Create a color from three components in the range 0-1 inclusive.
  9837.  *)
  9838.   D3DRMCreateColorRGB : function (red, green, blue: TD3DValue) : TD3DColor;
  9839.       stdcall;
  9840.  
  9841. (*
  9842.  * Create a color from four components in the range 0-1 inclusive.
  9843.  *)
  9844.   D3DRMCreateColorRGBA : function (red, green, blue, alpha: TD3DValue)
  9845.       : TD3DColor; stdcall;
  9846.  
  9847. (*
  9848.  * Get the red component of a color.
  9849.  *)
  9850.   D3DRMColorGetRed : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9851.  
  9852. (*
  9853.  * Get the green component of a color.
  9854.  *)
  9855.   D3DRMColorGetGreen : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9856.  
  9857. (*
  9858.  * Get the blue component of a color.
  9859.  *)
  9860.   D3DRMColorGetBlue : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9861.  
  9862. (*
  9863.  * Get the alpha component of a color.
  9864.  *)
  9865.   D3DRMColorGetAlpha : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9866.  
  9867. (*
  9868.  * Add two vectors.  Returns its first argument.
  9869.  *)
  9870.   D3DRMVectorAdd : function (var d, s1, s2: TD3DVector) : PD3DVector; stdcall;
  9871.  
  9872. (*
  9873.  * Subtract two vectors.  Returns its first argument.
  9874.  *)
  9875.   D3DRMVectorSubtract : function (var d, s1, s2: TD3DVector) : PD3DVector;
  9876.       stdcall;
  9877.  
  9878. (*
  9879.  * Reflect a ray about a given normal.  Returns its first argument.
  9880.  *)
  9881.   D3DRMVectorReflect : function (var d, ray, norm: TD3DVector) : PD3DVector;
  9882.       stdcall;
  9883.  
  9884. (*
  9885.  * Calculate the vector cross product.  Returns its first argument.
  9886.  *)
  9887.   D3DRMVectorCrossProduct : function (var d, s1, s2: TD3DVector) : PD3DVector;
  9888.       stdcall;
  9889.  
  9890. (*
  9891.  * Return the vector dot product.
  9892.  *)
  9893.   D3DRMVectorDotProduct : function (var s1, s2: TD3DVector) : TD3DValue;
  9894.       stdcall;
  9895.  
  9896. (*
  9897.  * Scale a vector so that its modulus is 1.  Returns its argument or
  9898.  * NULL if there was an error (e.g. a zero vector was passed).
  9899.  *)
  9900.   D3DRMVectorNormalize : function (var lpv: TD3DVector) : PD3DVector; stdcall;
  9901.  
  9902. (*
  9903.  * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  9904.  *)
  9905.   D3DRMVectorModulus : function (var v: TD3DVector) : TD3DValue; stdcall;
  9906.  
  9907. (*
  9908.  * Set the rotation part of a matrix to be a rotation of theta radians
  9909.  * around the given axis.
  9910.  *)
  9911.   D3DRMVectorRotate : function (var r, v, axis: TD3DVector; theta: TD3DValue) :
  9912.       PD3DVector; stdcall;
  9913.  
  9914. (*
  9915.  * Scale a vector uniformly in all three axes
  9916.  *)
  9917.   D3DRMVectorScale : function (var d, s: TD3DVector; factor: TD3DValue) :
  9918.       PD3DVector; stdcall;
  9919.  
  9920. (*
  9921.  * Return a random unit vector
  9922.  *)
  9923.   D3DRMVectorRandom : function (var d: TD3DVector) : PD3DVector; stdcall;
  9924.  
  9925. (*
  9926.  * Returns a unit quaternion that represents a rotation of theta radians
  9927.  * around the given axis.
  9928.  *)
  9929.  
  9930.   D3DRMQuaternionFromRotation : function (var quat: TD3DRMQuaternion;
  9931.       var v: TD3DVector; theta: TD3DValue) : PD3DRMQuaternion; stdcall;
  9932.  
  9933. (*
  9934.  * Calculate the product of two quaternions
  9935.  *)
  9936.   D3DRMQuaternionMultiply : function (var q, a, b: TD3DRMQuaternion) :
  9937.       PD3DRMQuaternion; stdcall;
  9938.  
  9939. (*
  9940.  * Interpolate between two quaternions
  9941.  *)
  9942.   D3DRMQuaternionSlerp : function (var q, a, b: TD3DRMQuaternion;
  9943.       alpha: TD3DValue) : PD3DRMQuaternion; stdcall;
  9944.  
  9945. (*
  9946.  * Calculate the matrix for the rotation that a unit quaternion represents
  9947.  *)
  9948.   D3DRMMatrixFromQuaternion : procedure (dmMat: TD3DRMMatrix4D; var lpDqQuat:
  9949.       TD3DRMQuaternion); stdcall;
  9950.  
  9951. (*
  9952.  * Calculate the quaternion that corresponds to a rotation matrix
  9953.  *)
  9954.   D3DRMQuaternionFromMatrix : function (var lpQuat: TD3DRMQuaternion;
  9955.       Mat: TD3DRMMatrix4D) : PD3DRMQuaternion; stdcall;
  9956.  
  9957. (*==========================================================================;
  9958.  *
  9959.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  9960.  *
  9961.  *  File:       d3drmobj.h
  9962.  *  Content:    Direct3DRM include file
  9963.  *
  9964.  ***************************************************************************)
  9965.  
  9966. (*
  9967.  * Direct3DRM Object classes
  9968.  *)
  9969.  
  9970. const
  9971.   CLSID_CDirect3DRMDevice: TGUID =
  9972.       (D1:$4fa3568e;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9973.   CLSID_CDirect3DRMViewport: TGUID =
  9974.       (D1:$4fa3568f;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9975.   CLSID_CDirect3DRMFrame: TGUID =
  9976.       (D1:$4fa35690;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9977.   CLSID_CDirect3DRMMesh: TGUID =
  9978.       (D1:$4fa35691;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9979.   CLSID_CDirect3DRMMeshBuilder: TGUID =
  9980.       (D1:$4fa35692;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9981.   CLSID_CDirect3DRMFace: TGUID =
  9982.       (D1:$4fa35693;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9983.   CLSID_CDirect3DRMLight: TGUID =
  9984.       (D1:$4fa35694;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9985.   CLSID_CDirect3DRMTexture: TGUID =
  9986.       (D1:$4fa35695;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9987.   CLSID_CDirect3DRMWrap: TGUID =
  9988.       (D1:$4fa35696;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9989.   CLSID_CDirect3DRMMaterial: TGUID =
  9990.       (D1:$4fa35697;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9991.   CLSID_CDirect3DRMAnimation: TGUID =
  9992.       (D1:$4fa35698;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9993.   CLSID_CDirect3DRMAnimationSet: TGUID =
  9994.       (D1:$4fa35699;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9995.   CLSID_CDirect3DRMUserVisual: TGUID =
  9996.       (D1:$4fa3569a;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9997.   CLSID_CDirect3DRMShadow: TGUID =
  9998.       (D1:$4fa3569b;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9999.   CLSID_CDirect3DRMViewportInterpolator: TGUID =
  10000.       (D1:$0de9eaa1;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10001.   CLSID_CDirect3DRMFrameInterpolator: TGUID =
  10002.       (D1:$0de9eaa2;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10003.   CLSID_CDirect3DRMMeshInterpolator: TGUID =
  10004.       (D1:$0de9eaa3;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10005.   CLSID_CDirect3DRMLightInterpolator: TGUID =
  10006.       (D1:$0de9eaa6;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10007.   CLSID_CDirect3DRMMaterialInterpolator: TGUID =
  10008.       (D1:$0de9eaa7;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10009.   CLSID_CDirect3DRMTextureInterpolator: TGUID =
  10010.       (D1:$0de9eaa8;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10011.   CLSID_CDirect3DRMProgressiveMesh: TGUID =
  10012.       (D1:$4516ec40;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10013.   CLSID_CDirect3DRMClippedVisual: TGUID =
  10014.       (D1:$5434e72d;D2:$6d66;D3:$11d1;D4:($bb,$0b,$00,$00,$f8,$75,$86,$5a));
  10015.  
  10016.  
  10017.  
  10018. type
  10019.   IDirect3DRMObject = interface;
  10020.   IDirect3DRMDevice = interface;
  10021.   IDirect3DRMDevice2 = interface;
  10022.   IDirect3DRMDevice3 = interface;
  10023.   IDirect3DRMViewport = interface;
  10024.   IDirect3DRMViewport2 = interface;
  10025.   IDirect3DRMFrame = interface;
  10026.   IDirect3DRMFrame2 = interface;
  10027.   IDirect3DRMFrame3 = interface;
  10028.   IDirect3DRMVisual = interface;
  10029.   IDirect3DRMMesh = interface;
  10030.   IDirect3DRMMeshBuilder = interface;
  10031.   IDirect3DRMMeshBuilder2 = interface;
  10032.   IDirect3DRMMeshBuilder3 = interface;
  10033.   IDirect3DRMFace = interface;
  10034.   IDirect3DRMFace2 = interface;
  10035.   IDirect3DRMLight = interface;
  10036.   IDirect3DRMTexture = interface;
  10037.   IDirect3DRMTexture2 = interface;
  10038.   IDirect3DRMTexture3 = interface;
  10039.   IDirect3DRMWrap = interface;
  10040.   IDirect3DRMMaterial = interface;
  10041.   IDirect3DRMMaterial2 = interface;
  10042.   IDirect3DRMAnimation = interface;
  10043.   IDirect3DRMAnimation2 = interface;
  10044.   IDirect3DRMAnimationSet = interface;
  10045.   IDirect3DRMAnimationSet2 = interface;
  10046.   IDirect3DRMArray = interface;
  10047.   IDirect3DRMObjectArray = interface;
  10048.   IDirect3DRMDeviceArray = interface;
  10049.   IDirect3DRMViewportArray = interface;
  10050.   IDirect3DRMFrameArray = interface;
  10051.   IDirect3DRMVisualArray = interface;
  10052.   IDirect3DRMLightArray = interface;
  10053.   IDirect3DRMPickedArray = interface;
  10054.   IDirect3DRMFaceArray = interface;
  10055.   IDirect3DRMAnimationArray = interface;
  10056.   IDirect3DRMUserVisual = interface;
  10057.   IDirect3DRMShadow = interface;
  10058.   IDirect3DRMShadow2 = interface;
  10059.   IDirect3DRMInterpolator = interface;
  10060.   IDirect3DRMProgressiveMesh = interface;
  10061.   IDirect3DRMPicked2Array = interface;
  10062.   IDirect3DRMClippedVisual = interface;
  10063.  
  10064. (*
  10065.  * Direct3DRM Object interfaces
  10066.  *)
  10067.   IID_IDirect3DRMObject =          IDirect3DRMObject;
  10068.   IID_IDirect3DRMDevice =          IDirect3DRMDevice;
  10069.   IID_IDirect3DRMDevice2 =         IDirect3DRMDevice2;
  10070.   IID_IDirect3DRMDevice3 =         IDirect3DRMDevice3;
  10071.   IID_IDirect3DRMViewport =        IDirect3DRMViewport;
  10072.   IID_IDirect3DRMViewport2 =       IDirect3DRMViewport2;
  10073.   IID_IDirect3DRMFrame =           IDirect3DRMFrame;
  10074.   IID_IDirect3DRMFrame2 =          IDirect3DRMFrame2;
  10075.   IID_IDirect3DRMFrame3 =          IDirect3DRMFrame3;
  10076.   IID_IDirect3DRMVisual =          IDirect3DRMVisual;
  10077.   IID_IDirect3DRMMesh =            IDirect3DRMMesh;
  10078.   IID_IDirect3DRMMeshBuilder =     IDirect3DRMMeshBuilder;
  10079.   IID_IDirect3DRMMeshBuilder2 =    IDirect3DRMMeshBuilder2;
  10080.   IID_IDirect3DRMMeshBuilder3 =    IDirect3DRMMeshBuilder3;
  10081.   IID_IDirect3DRMFace =            IDirect3DRMFace;
  10082.   IID_IDirect3DRMFace2 =           IDirect3DRMFace2;
  10083.   IID_IDirect3DRMLight =           IDirect3DRMLight;
  10084.   IID_IDirect3DRMTexture =         IDirect3DRMTexture;
  10085.   IID_IDirect3DRMTexture2 =        IDirect3DRMTexture2;
  10086.   IID_IDirect3DRMTexture3 =        IDirect3DRMTexture3;
  10087.   IID_IDirect3DRMWrap =            IDirect3DRMWrap;
  10088.   IID_IDirect3DRMMaterial =        IDirect3DRMMaterial;
  10089.   IID_IDirect3DRMMaterial2 =       IDirect3DRMMaterial2;
  10090.   IID_IDirect3DRMAnimation =       IDirect3DRMAnimation;
  10091.   IID_IDirect3DRMAnimation2 =      IDirect3DRMAnimation2;
  10092.   IID_IDirect3DRMAnimationSet =    IDirect3DRMAnimationSet;
  10093.   IID_IDirect3DRMAnimationSet2 =   IDirect3DRMAnimationSet2;
  10094.   IID_IDirect3DRMObjectArray =     IDirect3DRMObjectArray;
  10095.   IID_IDirect3DRMDeviceArray =     IDirect3DRMDeviceArray;
  10096.   IID_IDirect3DRMViewportArray =   IDirect3DRMViewportArray;
  10097.   IID_IDirect3DRMFrameArray =      IDirect3DRMFrameArray;
  10098.   IID_IDirect3DRMVisualArray =     IDirect3DRMVisualArray;
  10099.   IID_IDirect3DRMLightArray =      IDirect3DRMLightArray;
  10100.   IID_IDirect3DRMPickedArray =     IDirect3DRMPickedArray;
  10101.   IID_IDirect3DRMFaceArray =       IDirect3DRMFaceArray;
  10102.   IID_IDirect3DRMAnimationArray =  IDirect3DRMAnimationArray;
  10103.   IID_IDirect3DRMUserVisual =      IDirect3DRMUserVisual;
  10104.   IID_IDirect3DRMShadow =          IDirect3DRMShadow;
  10105.   IID_IDirect3DRMShadow2 =         IDirect3DRMShadow2;
  10106.   IID_IDirect3DRMInterpolator =    IDirect3DRMInterpolator;
  10107.   IID_IDirect3DRMProgressiveMesh = IDirect3DRMProgressiveMesh;
  10108.   IID_IDirect3DRMPicked2Array =    IDirect3DRMPicked2Array;
  10109.   IID_IDirect3DRMClippedVisual =   IDirect3DRMClippedVisual;
  10110.  
  10111.  
  10112.  
  10113.  
  10114.  
  10115.   PIDirect3DRMFaceArray = ^IDirect3DRMFaceArray;
  10116.  
  10117.   TD3DRMObjectCallback = procedure (lpD3DRMobj: IDirect3DRMObject;
  10118.       lpArg: Pointer); cdecl;
  10119.   TD3DRMFrameMoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame;
  10120.       lpArg: Pointer; delta: TD3DValue); cdecl;
  10121.   TD3DRMFrame3MoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame3;
  10122.       lpArg: Pointer; delta: TD3DValue); cdecl;
  10123.   TD3DRMUpdateCallback = procedure (lpobj: IDirect3DRMDevice; lpArg: Pointer;
  10124.       iRectCount: Integer; const d3dRectUpdate: TD3DRect); cdecl;
  10125.   TD3DRMDevice3UpdateCallback = procedure (lpobj: IDirect3DRMDevice3;
  10126.       lpArg: Pointer; iRectCount: Integer; const d3dRectUpdate: TD3DRect);cdecl;
  10127.   TD3DRMUserVisualCallback = function (lpD3DRMUV: IDirect3DRMUserVisual;
  10128.       lpArg: Pointer; lpD3DRMUVreason: TD3DRMUserVisualReason;
  10129.       lpD3DRMDev: IDirect3DRMDevice;
  10130.       lpD3DRMview: IDirect3DRMViewport) : Integer; cdecl;
  10131.   TD3DRMLoadTextureCallback = function (tex_name: PAnsiChar; lpArg: Pointer;
  10132.       out lpD3DRMTex: IDirect3DRMTexture) : HResult; cdecl;
  10133.   TD3DRMLoadTexture3Callback = function (tex_name: PAnsiChar; lpArg: Pointer;
  10134.       out lpD3DRMTex: IDirect3DRMTexture3) : HResult; cdecl;
  10135.   TD3DRMLoadCallback = procedure (lpObject: IDirect3DRMObject;
  10136.       const ObjectGuid: TGUID; lpArg: Pointer); cdecl;
  10137.   TD3DRMDownSampleCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
  10138.       pArg: pointer; pDDSSrc, pDDSDst: IDirectDrawSurface) : HResult; cdecl;
  10139.   TD3DRMValidationCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
  10140.       pArg: pointer; dwFlags, DWcRects: DWORD; const pRects: TRect) : HResult; cdecl;
  10141.  
  10142.   PD3DRMPickDesc = ^TD3DRMPickDesc;
  10143.   TD3DRMPickDesc = packed record
  10144.     ulFaceIdx: DWORD;
  10145.     lGroupIdx: LongInt;
  10146.     vPosition: TD3DVector;
  10147.   end;
  10148.  
  10149.   PD3DRMPickDesc2 = ^TD3DRMPickDesc2;
  10150.   TD3DRMPickDesc2 = packed record
  10151.     ulFaceIdx: DWORD;
  10152.     lGroupIdx: LongInt;
  10153.     dvPosition: TD3DVector;
  10154.     tu, tv: TD3DValue;
  10155.     dvNormal: TD3DVector;
  10156.     dcColor: TD3DColor;
  10157.   end;
  10158.  
  10159. (*
  10160.  * Base class
  10161.  *)
  10162. {$IFDEF D2COM}
  10163.   IDirect3DRMObject = class (IUnknown)
  10164. {$ELSE}
  10165.   IDirect3DRMObject = interface (IUnknown)
  10166.     ['{eb16cb00-d271-11ce-ac48-0000c03825a1}']
  10167. {$ENDIF}
  10168.     (*
  10169.      * The methods for IDirect3DRMObject
  10170.      *)
  10171.     function Clone (pUnkOuter: IUnknown; riid: TGUID;
  10172.         var ppvObj: Pointer) : HResult; stdcall;
  10173.     function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
  10174.         lpArg: Pointer) : HResult; stdcall;
  10175.     function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
  10176.         lpArg: Pointer) : HResult; stdcall;
  10177.     function SetAppData (ulData: DWORD) : HResult; stdcall;
  10178.     function GetAppData: DWORD; stdcall;
  10179.     function SetName (lpName: PAnsiChar) : HResult; stdcall;
  10180.     function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  10181.     function GetClassName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  10182.   end;
  10183.  
  10184.   IDirect3DRMVisual = interface (IDirect3DRMObject)
  10185.   end;
  10186.  
  10187.   IDirect3DRMDevice = interface (IDirect3DRMObject)
  10188.     ['{e9e19280-6e05-11cf-ac4a-0000c03825a1}']
  10189.     (*
  10190.      * IDirect3DRMDevice methods
  10191.      *)
  10192.     function Init (width: LongInt; height: LongInt) : HResult; stdcall;
  10193.     function InitFromD3D (lpD3D: IDirect3D; lpD3DIMDev: IDirect3DDevice) : HResult; stdcall;
  10194.     function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
  10195.         width: Integer; height: Integer) : HResult; stdcall;
  10196.     function Update: HResult; stdcall;
  10197.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
  10198.         arg: Pointer) : HResult; stdcall;
  10199.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
  10200.         arg: Pointer) : HResult; stdcall;
  10201.     function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
  10202.     function GetBufferCount: DWORD; stdcall;
  10203.     function SetDither (bDither: BOOL) : HResult; stdcall;
  10204.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10205.     function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
  10206.     function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
  10207.     function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
  10208.     function GetDither: BOOL; stdcall;
  10209.     function GetShades: DWORD; stdcall;
  10210.     function GetHeight: DWORD; stdcall;
  10211.     function GetWidth: DWORD; stdcall;
  10212.     function GetTrianglesDrawn: DWORD; stdcall;
  10213.     function GetWireframeOptions: DWORD; stdcall;
  10214.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10215.     function GetColorModel: TD3DColorModel; stdcall;
  10216.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  10217.     function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
  10218.   end;
  10219.  
  10220.   IDirect3DRMDevice2 = interface (IDirect3DRMDevice)
  10221.     ['{4516ec78-8f20-11d0-9b6d-0000c0781bc3}']
  10222.     (*
  10223.      * IDirect3DRMDevice2 methods
  10224.      *)
  10225.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10226.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw; lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
  10227.     function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
  10228.     function GetRenderMode : DWORD; stdcall;
  10229.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
  10230.   end;
  10231.  
  10232.   IDirect3DRMDevice3 = interface (IDirect3DRMObject)
  10233.     ['{549f498b-bfeb-11d1-8ed8-00a0c967a482}']
  10234.     (*
  10235.      * IDirect3DRMDevice methods
  10236.      *)
  10237.     function Init (width: LongInt; height: LongInt) : HResult; stdcall;
  10238.     function InitFromD3D (lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10239.     function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
  10240.         width: Integer; height: Integer) : HResult; stdcall;
  10241.     function Update: HResult; stdcall;
  10242.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
  10243.         arg: Pointer) : HResult; stdcall;
  10244.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
  10245.         arg: Pointer) : HResult; stdcall;
  10246.     function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
  10247.     function GetBufferCount: DWORD; stdcall;
  10248.     function SetDither (bDither: BOOL) : HResult; stdcall;
  10249.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10250.     function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
  10251.     function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
  10252.     function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
  10253.     function GetDither: BOOL; stdcall;
  10254.     function GetShades: DWORD; stdcall;
  10255.     function GetHeight: DWORD; stdcall;
  10256.     function GetWidth: DWORD; stdcall;
  10257.     function GetTrianglesDrawn: DWORD; stdcall;
  10258.     function GetWireframeOptions: DWORD; stdcall;
  10259.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10260.     function GetColorModel: TD3DColorModel; stdcall;
  10261.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  10262.     function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
  10263.     (*
  10264.      * IDirect3DRMDevice2 methods
  10265.      *)
  10266.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10267.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
  10268.             lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
  10269.     function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
  10270.     function GetRenderMode : DWORD; stdcall;
  10271.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
  10272.     (*
  10273.      * IDirect3DRMDevice3 methods
  10274.      *)
  10275.     function FindPreferredTextureFormat (dwBitDepths, dwFlags: DWORD;
  10276.         out lpDDPF: TDDPixelFormat) : HResult; stdcall;
  10277.     function RenderStateChange (dwStateNum, dwVal, dwFlags: DWORD) : HResult; stdcall;
  10278.  
  10279.     function LightStateChange (drsType: TD3DLightStateType; // defined different in header and help
  10280.         dwVal, dwFlags: DWORD) : HResult; stdcall;
  10281.     function GetStateChangeOptions (dwStateClass, dwStateNum: DWORD;
  10282.         var pdwFlags: DWORD) : HResult; stdcall;
  10283.     function SetStateChangeOptions ( dwStateClass, dwStateNum, dwFlags: DWORD) : HResult; stdcall;
  10284.   end;
  10285.  
  10286.   IDirect3DRMViewport = interface (IDirect3DRMObject)
  10287.     ['{eb16cb02-d271-11ce-ac48-0000c03825a1}']
  10288.     (*
  10289.      * IDirect3DRMViewport methods
  10290.      *)
  10291.     function Init (lpD3DRMDevice: IDirect3DRMDevice;
  10292.         lpD3DRMFrameCamera: IDirect3DRMFrame; xpos, ypos,
  10293.         width, height: DWORD) : HResult; stdcall;
  10294.     function Clear: HResult; stdcall;
  10295.     function Render (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10296.     function SetFront (rvFront: TD3DValue) : HResult; stdcall;
  10297.     function SetBack (rvBack: TD3DValue) : HResult; stdcall;
  10298.     function SetField (rvField: TD3DValue) : HResult; stdcall;
  10299.     function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
  10300.     function SetCamera (lpCamera: IDirect3DRMFrame) : HResult; stdcall;
  10301.     function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
  10302.     function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
  10303.     function InverseTransform (out lprvDst: TD3DVector;
  10304.         const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
  10305.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
  10306.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
  10307.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
  10308.     function GetCamera (out lpCamera: IDirect3DRMFrame) : HResult; stdcall;
  10309.     function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
  10310.     function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
  10311.         TD3DValue) : HResult; stdcall;
  10312.     function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
  10313.     function GetUniformScaling: BOOL;  stdcall;
  10314.     function GetX: LongInt; stdcall;
  10315.     function GetY: LongInt; stdcall;
  10316.     function GetWidth: DWORD; stdcall;
  10317.     function GetHeight: DWORD; stdcall;
  10318.     function GetField: TD3DValue; stdcall;
  10319.     function GetBack: TD3DValue; stdcall;
  10320.     function GetFront: TD3DValue; stdcall;
  10321.     function GetProjection: TD3DRMProjectionType; stdcall;
  10322.     function GetDirect3DViewport (out lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
  10323.   end;
  10324.  
  10325.   IDirect3DRMViewport2 = interface (IDirect3DRMObject)
  10326.     ['{4a1b1be6-bfed-11d1-8ed8-00a0c967a482}']
  10327.     (*
  10328.      * IDirect3DRMViewport2 methods
  10329.      *)
  10330.     function Init (lpD3DRMDevice: IDirect3DRMDevice3;
  10331.         lpD3DRMFrameCamera: IDirect3DRMFrame3; xpos, ypos,
  10332.         width, height: DWORD) : HResult; stdcall;
  10333.     function Clear (dwFlags: DWORD): HResult; stdcall;
  10334.     function Render (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  10335.     function SetFront (rvFront: TD3DValue) : HResult; stdcall;
  10336.     function SetBack (rvBack: TD3DValue) : HResult; stdcall;
  10337.     function SetField (rvField: TD3DValue) : HResult; stdcall;
  10338.     function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
  10339.     function SetCamera (lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
  10340.     function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
  10341.     function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
  10342.     function InverseTransform (out lprvDst: TD3DVector;
  10343.         const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
  10344.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
  10345.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
  10346.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
  10347.     function GetCamera (out lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
  10348.     function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  10349.     function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
  10350.         TD3DValue) : HResult; stdcall;
  10351.     function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
  10352.     function GetUniformScaling: BOOL; stdcall;
  10353.     function GetX: LongInt; stdcall;
  10354.     function GetY: LongInt; stdcall;
  10355.     function GetWidth: DWORD; stdcall;
  10356.     function GetHeight: DWORD; stdcall;
  10357.     function GetField: TD3DValue; stdcall;
  10358.     function GetBack: TD3DValue; stdcall;
  10359.     function GetFront: TD3DValue; stdcall;
  10360.     function GetProjection: TD3DRMProjectionType; stdcall;
  10361.     function GetDirect3DViewport (var lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
  10362.     function TransformVectors (dwNumVectors: DWORD; out lpDstVectors:
  10363.         TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10364.     function InverseTransformVectors (dwNumVectors: DWORD; out lpDstVectors:
  10365.         TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10366.   end;
  10367.  
  10368.   IDirect3DRMFrame = interface (IDirect3DRMVisual)
  10369.     ['{eb16cb03-d271-11ce-ac48-0000c03825a1}']
  10370.     (*
  10371.      * IDirect3DRMFrame methods
  10372.      *)
  10373.     function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame) : HResult; stdcall;
  10374.     function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10375.     function AddMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
  10376.         lpArg: Pointer) : HResult; stdcall;
  10377.     function AddTransform (rctCombine: TD3DRMCombineType;
  10378.         rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10379.     function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
  10380.         TD3DValue) : HResult; stdcall;
  10381.     function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10382.     function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  10383.         rvTheta: TD3DValue) : HResult; stdcall;
  10384.     function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10385.     function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
  10386.     function GetColor: TD3DColor; stdcall;
  10387.     function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
  10388.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  10389.     function GetParent (out lplpParent: IDirect3DRMFrame) : HResult; stdcall;
  10390.     function GetPosition (lpRef: IDirect3DRMFrame; out lprvPos: TD3DVector) : HResult; stdcall;
  10391.     function GetRotation (lpRef: IDirect3DRMFrame; out lprvAxis: TD3DVector;
  10392.         out lprvTheta: TD3DValue) : HResult; stdcall;
  10393.     function GetScene (out lplpRoot: IDirect3DRMFrame) : HResult; stdcall;
  10394.     function GetSortMode: TD3DRMSortMode; stdcall;
  10395.     function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10396.     function GetTransform (out rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10397.     function GetVelocity (lpRef: IDirect3DRMFrame; var lprvVel: TD3DVector;
  10398.         fRotVel: BOOL) : HResult; stdcall;
  10399.     function GetOrientation (lpRef: IDirect3DRMFrame; var lprvDir: TD3DVector;
  10400.         var lprvUp: TD3DVector) : HResult; stdcall;
  10401.     function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
  10402.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10403.     function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
  10404.     function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
  10405.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  10406.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer) : HResult; stdcall;
  10407.     function LookAt (lpTarget, lpRef: IDirect3DRMFrame;
  10408.         rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
  10409.     function Move (delta: TD3DValue) : HResult; stdcall;
  10410.     function DeleteChild (lpChild: IDirect3DRMFrame) : HResult; stdcall;
  10411.     function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10412.     function DeleteMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
  10413.         lpArg: Pointer) : HResult; stdcall;
  10414.     function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10415.     function GetSceneBackground: TD3DColor; stdcall;
  10416.     function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  10417.     function GetSceneFogColor: TD3DColor; stdcall;
  10418.     function GetSceneFogEnable: BOOL; stdcall;
  10419.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  10420.     function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
  10421.     function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
  10422.     function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10423.     function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
  10424.     function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10425.     function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
  10426.     function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
  10427.     function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
  10428.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
  10429.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10430.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10431.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  10432.     function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
  10433.     function SetOrientation (lpRef: IDirect3DRMFrame; rvDx, rvDy, rvDz, rvUx,
  10434.         rvUy, rvUz: TD3DValue) : HResult; stdcall;
  10435.     function SetPosition (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10436.     function SetRotation (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ,
  10437.         rvTheta: TD3DValue) : HResult; stdcall;
  10438.     function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
  10439.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10440.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10441.     function SetVelocity (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue;
  10442.         fRotVel: BOOL) : HResult; stdcall;
  10443.     function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
  10444.     function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
  10445.   end;
  10446.  
  10447.   IDirect3DRMFrame2 = interface (IDirect3DRMFrame)
  10448.     ['{c3dfbd60-3988-11d0-9ec2-0000c0291ac3}']
  10449.     (*
  10450.      * IDirect3DRMFrame2 methods
  10451.      *)
  10452.     function AddMoveCallback2 (d3drmFMC: TD3DRMFrameMoveCallback; lpArg:
  10453.         Pointer; dwFlags: DWORD) : HResult; stdcall;
  10454.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10455.     function GetBoxEnable : boolean; stdcall;
  10456.     function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
  10457.     function GetMaterial (out lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10458.     function GetInheritAxes : boolean; stdcall;
  10459.     function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10460.     function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10461.     function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
  10462.     function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
  10463.     function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
  10464.     function SetMaterial (var lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10465.     function SetQuaternion (lpRef: IDirect3DRMFrame;
  10466.         const quat: TD3DRMQuaternion) : HResult; stdcall;
  10467.     function RayPick (lpRefFrame: IDirect3DRMFrame; var ray: TD3DRMRay;
  10468.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) :
  10469.         HResult; stdcall;
  10470.     function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
  10471.         d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
  10472.   end;
  10473.  
  10474.   IDirect3DRMFrame3 = interface (IDirect3DRMVisual)
  10475.     ['{ff6b7f70-a40e-11d1-91f9-0000f8758e66}']
  10476.     (*
  10477.      * IDirect3DRMFrame3 methods
  10478.      *)
  10479.     function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame3) : HResult; stdcall;
  10480.     function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10481.     function AddMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback;
  10482.         lpArg: Pointer; dwFlags: DWORD) : HResult; stdcall;
  10483.     function AddTransform (rctCombine: TD3DRMCombineType;
  10484.         rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10485.     function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
  10486.         TD3DValue) : HResult; stdcall;
  10487.     function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10488.     function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  10489.         rvTheta: TD3DValue) : HResult; stdcall;
  10490.     function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10491.     function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
  10492.     function GetColor: TD3DColor; stdcall;
  10493.     function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
  10494.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  10495.     function GetParent (out lplpParent: IDirect3DRMFrame3) : HResult; stdcall;
  10496.     function GetPosition (lpRef: IDirect3DRMFrame3; out lprvPos: TD3DVector) : HResult; stdcall;
  10497.     function GetRotation (lpRef: IDirect3DRMFrame3; out lprvAxis: TD3DVector;
  10498.         out lprvTheta: TD3DValue) : HResult; stdcall;
  10499.     function GetScene (out lplpRoot: IDirect3DRMFrame3) : HResult; stdcall;
  10500.     function GetSortMode: TD3DRMSortMode; stdcall;
  10501.     function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10502.     function GetTransform (lpRefFrame: IDirect3DRMFrame3;
  10503.         var rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10504.     function GetVelocity (lpRef: IDirect3DRMFrame3; out lprvVel: TD3DVector;
  10505.         fRotVel: BOOL) : HResult; stdcall;
  10506.     function GetOrientation (lpRef: IDirect3DRMFrame3; out lprvDir: TD3DVector;
  10507.         out lprvUp: TD3DVector) : HResult; stdcall;
  10508.     function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
  10509.     function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
  10510.     function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
  10511.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  10512.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer) : HResult; stdcall;
  10513.     function LookAt (lpTarget, lpRef: IDirect3DRMFrame3;
  10514.         rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
  10515.     function Move (delta: TD3DValue) : HResult; stdcall;
  10516.     function DeleteChild (lpChild: IDirect3DRMFrame3) : HResult; stdcall;
  10517.     function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10518.     function DeleteMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback; lpArg: Pointer) : HResult; stdcall;
  10519.     function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10520.     function GetSceneBackground: TD3DColor; stdcall;
  10521.     function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  10522.     function GetSceneFogColor: TD3DColor; stdcall;
  10523.     function GetSceneFogEnable: BOOL; stdcall;
  10524.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  10525.     function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
  10526.     function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
  10527.     function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10528.     function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
  10529.     function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10530.     function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
  10531.     function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
  10532.     function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
  10533.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
  10534.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10535.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10536.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  10537.     function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
  10538.     function SetOrientation (lpRef: IDirect3DRMFrame3; rvDx, rvDy, rvDz, rvUx,
  10539.         rvUy, rvUz: TD3DValue) : HResult; stdcall;
  10540.     function SetPosition (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue) :
  10541.         HResult; stdcall;
  10542.     function SetRotation (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ,
  10543.         rvTheta: TD3DValue) : HResult; stdcall;
  10544.     function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
  10545.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10546.     function SetVelocity (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue;
  10547.         fRotVel: BOOL) : HResult; stdcall;
  10548.     function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
  10549.     function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
  10550.  
  10551.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10552.     function GetBoxEnable : boolean; stdcall;
  10553.     function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
  10554.     function GetMaterial (out lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10555.     function GetInheritAxes : boolean; stdcall;
  10556.     function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10557.     function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10558.     function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
  10559.     function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
  10560.     function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
  10561.     function SetMaterial (var lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10562.     function SetQuaternion (lpRef: IDirect3DRMFrame3;
  10563.         const quat: TD3DRMQuaternion) : HResult; stdcall;
  10564.     function RayPick (lpRefFrame: IDirect3DRMFrame3; var ray: TD3DRMRay;
  10565.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) : HResult; stdcall;
  10566.     function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
  10567.         d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
  10568.     function TransformVectors (lpRefFrame: IDirect3DRMFrame3;
  10569.         dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
  10570.         const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10571.     function InverseTransformVectors (lpRefFrame: IDirect3DRMFrame3;
  10572.         dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
  10573.         const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10574.     function SetTraversalOptions (dwFlags: DWORD) : HResult; stdcall;
  10575.     function GetTraversalOptions (out lpdwFlags: DWORD) : HResult; stdcall;
  10576.     function SetSceneFogMethod (dwFlags: DWORD) : HResult; stdcall;
  10577.     function GetSceneFogMethod (out lpdwFlags: DWORD) : HResult; stdcall;
  10578.     function SetMaterialOverride (
  10579.         const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
  10580.     function GetMaterialOverride (
  10581.         const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
  10582.   end;
  10583.  
  10584.  
  10585.   IDirect3DRMMesh = interface (IDirect3DRMVisual)
  10586.     ['{a3a80d01-6e12-11cf-ac4a-0000c03825a1}']
  10587.     (*
  10588.      * IDirect3DRMMesh methods
  10589.      *)
  10590.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10591.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10592.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10593.     function AddGroup (vCount, fCount, vPerFace: DWORD; var fData: DWORD;
  10594.         var returnId: TD3DRMGroupIndex) : HResult; stdcall;
  10595.     function SetVertices (id: TD3DRMGroupIndex; index, count: DWORD;
  10596.         var values: TD3DRMVertex) : HResult; stdcall;
  10597.     function SetGroupColor (id: TD3DRMGroupIndex; value: TD3DColor) : HResult; stdcall;
  10598.     function SetGroupColorRGB (id: TD3DRMGroupIndex; red, green,
  10599.         blue: TD3DValue) : HResult; stdcall;
  10600.     function SetGroupMapping (id: TD3DRMGroupIndex;
  10601.         value: TD3DRMMapping) : HResult; stdcall;
  10602.     function SetGroupQuality (id: TD3DRMGroupIndex;
  10603.         value: TD3DRMRenderQuality) : HResult; stdcall;
  10604.     function SetGroupMaterial (id: TD3DRMGroupIndex; value:
  10605.         IDirect3DRMMaterial) : HResult; stdcall;
  10606.     function SetGroupTexture (id: TD3DRMGroupIndex; value: IDirect3DRMTexture) : HResult; stdcall;
  10607.     function GetGroupCount: DWORD; stdcall;
  10608.     function GetGroup (id: TD3DRMGroupIndex; vCount, fCount, vPerFace : PDWORD;
  10609.         var fDataSize: DWORD; fData: PDWORD) : HResult; stdcall;
  10610.     function GetVertices (id: TD3DRMGroupIndex; index, count : DWORD;
  10611.         out returnPtr : TD3DRMVertex) : HResult; stdcall;
  10612.     function GetGroupColor (id: TD3DRMGroupIndex) : TD3DColor; stdcall;
  10613.     function GetGroupMapping (id: TD3DRMGroupIndex) : TD3DRMMapping; stdcall;
  10614.     function GetGroupQuality (id: TD3DRMGroupIndex) : TD3DRMRenderQuality; stdcall;
  10615.     function GetGroupMaterial (id: TD3DRMGroupIndex;
  10616.         out returnPtr: IDirect3DRMMaterial) : HResult; stdcall;
  10617.     function GetGroupTexture (id: TD3DRMGroupIndex;
  10618.         out returnPtr: IDirect3DRMTexture) : HResult; stdcall;
  10619.   end;
  10620.  
  10621.   IDirect3DRMProgressiveMesh = interface (IDirect3DRMVisual)
  10622.     ['{4516ec79-8f20-11d0-9b6d-0000c0781bc3}']
  10623.     (*
  10624.      * IDirect3DRMProgressiveMesh methods
  10625.      *)
  10626.     function Load (lpSource, lpObjID: pointer; dloLoadflags : TD3DRMLoadOptions;
  10627.         lpCallback: TD3DRMLoadTextureCallback; lpArg: pointer) : HResult; stdcall;
  10628.     function GetLoadStatus (out lpStatus: TD3DRMPMeshLoadStatus) : HResult; stdcall;
  10629.     function SetMinRenderDetail (d3dVal: TD3DValue) : HResult; stdcall;
  10630.     function Abort (dwFlags: DWORD) : HResult; stdcall;
  10631.     function GetFaceDetail (out lpdwCount: DWORD) : HResult; stdcall;
  10632.     function GetVertexDetail (out lpdwCount: DWORD) : HResult; stdcall;
  10633.     function SetFaceDetail (dwCount: DWORD) : HResult; stdcall;
  10634.     function SetVertexDetail (dwCount: DWORD) : HResult; stdcall;
  10635.     function GetFaceDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
  10636.     function GetVertexDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
  10637.     function GetDetail (out lpdvVal: TD3DValue) : HResult; stdcall;
  10638.     function SetDetail (lpdvVal: TD3DValue) : HResult; stdcall;
  10639.     function RegisterEvents (hEvent: THANDLE; dwFlags, dwReserved: DWORD) : HResult; stdcall;
  10640.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10641.     function Duplicate (out lplpD3DRMPMesh: IDirect3DRMProgressiveMesh) : HResult; stdcall;
  10642.     function GetBox (out lpBBox: TD3DRMBox) : HResult; stdcall;
  10643.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10644.     function GetQuality (out lpdwquality: TD3DRMRenderQuality) : HResult; stdcall;
  10645.   end;
  10646.  
  10647.   IDirect3DRMShadow = interface (IDirect3DRMVisual)
  10648.     ['{af359780-6ba3-11cf-ac4a-0000c03825a1}']
  10649.     (*
  10650.      * IDirect3DRMShadow methods
  10651.      *)
  10652.     function Init (lpD3DRMVisual: IDirect3DRMVisual;
  10653.         lpD3DRMLight: IDirect3DRMLight;
  10654.         px, py, pz, nx, ny, nz: TD3DValue) : HResult; stdcall;
  10655.   end;
  10656.  
  10657.   IDirect3DRMShadow2 = interface (IDirect3DRMShadow)
  10658.     ['{86b44e25-9c82-11d1-bb0b-00a0c981a0a6}']
  10659.     (*
  10660.      * IDirect3DRMShadow2 methods
  10661.      *)
  10662.     function GetVisual (out lplpDirect3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10663.     function SetVisual (lpDirect3DRMVisual: IDirect3DRMVisual;
  10664.         dwFlags: DWORD) : HResult; stdcall;
  10665.     function GetLight (out lplpDirect3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10666.     function SetLight (lplpDirect3DRMLight: IDirect3DRMLight;
  10667.         dwFlags: DWORD) : HResult; stdcall;
  10668.     function GetPlane (
  10669.         var pdvPX, pdvPY, pdvPZ, pdvNX, pdvNY, pdvNZ: TD3DValue) : HResult; stdcall;
  10670.     function SetPlane (px, py, pz, nx, ny, nz: TD3DValue;
  10671.         dwFlags: DWORD) : HResult; stdcall;
  10672.     function GetOptions (out pdwOptions: DWORD) : HResult; stdcall;
  10673.     function SetOptions (dwOptions: DWORD) : HResult; stdcall;
  10674.  
  10675.   end;
  10676.  
  10677.   IDirect3DRMFace = interface (IDirect3DRMObject)
  10678.     ['{eb16cb07-d271-11ce-ac48-0000c03825a1}']
  10679.     (*
  10680.      * IDirect3DRMFace methods
  10681.      *)
  10682.     function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
  10683.     function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
  10684.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10685.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10686.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10687.     function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10688.     function SetMaterial (lpMat: IDirect3DRMMaterial) : HResult; stdcall;
  10689.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10690.     function GetVertex (index: DWORD; out lpPosition: TD3DVector;
  10691.         out lpNormal: TD3DVector) : HResult; stdcall;
  10692.     function GetVertices (var lpdwVertexCount: DWORD;
  10693.         out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
  10694.     function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
  10695.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10696.     function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
  10697.     function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10698.     function GetMaterial (out lpMat: IDirect3DRMMaterial) : HResult; stdcall;
  10699.     function GetVertexCount: Integer; stdcall;
  10700.     function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
  10701.     function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
  10702.     function GetColor: TD3DColor; stdcall;
  10703.   end;
  10704.  
  10705.   IDirect3DRMFace2 = interface (IDirect3DRMObject)
  10706.     ['{4516ec81-8f20-11d0-9b6d-0000c0781bc3}']
  10707.     (*
  10708.      * IDirect3DRMFace2 methods
  10709.      *)
  10710.     function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
  10711.     function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
  10712.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10713.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10714.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10715.     function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10716.     function SetMaterial (lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
  10717.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10718.     function GetVertex (index: DWORD; out lpPosition: TD3DVector;
  10719.         out lpNormal: TD3DVector) : HResult; stdcall;
  10720.     function GetVertices (var lpdwVertexCount: DWORD;
  10721.         out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
  10722.     function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
  10723.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10724.     function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
  10725.     function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10726.     function GetMaterial (out lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
  10727.     function GetVertexCount: Integer; stdcall;
  10728.     function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
  10729.     function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
  10730.     function GetColor: TD3DColor; stdcall;
  10731.   end;
  10732.  
  10733.   IDirect3DRMMeshBuilder = interface (IDirect3DRMVisual)
  10734.     ['{a3a80d02-6e12-11cf-ac4a-0000c03825a1}']
  10735.     (*
  10736.      * IDirect3DRMMeshBuilder methods
  10737.      *)
  10738.     function Load (lpvObjSource, lpvObjID: Pointer; d3drmLOFlags:
  10739.         TD3DRMLoadOptions; d3drmLoadTextureProc: TD3DRMLoadTextureCallback;
  10740.         lpvArg: Pointer) : HResult; stdcall;
  10741.     function Save (lpFilename: PChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  10742.         d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
  10743.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10744.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10745.     function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
  10746.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10747.     function GenerateNormals : HResult; stdcall;
  10748.     function GetColorSource: TD3DRMColorSource; stdcall;
  10749.     function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10750.     function AddMeshBuilder (lpD3DRMMeshBuild: IDirect3DRMMeshBuilder) : HResult; stdcall;
  10751.     function AddFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10752.     function AddFace (lpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10753.     function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
  10754.         normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
  10755.         lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
  10756.     function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
  10757.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10758.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10759.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10760.     function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10761.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10762.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10763.     function SetPerspective (perspective: BOOL) : HResult; stdcall;
  10764.     function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10765.     function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10766.     function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10767.     function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
  10768.     function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
  10769.     function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
  10770.     function GetVertices (var vcount: DWORD; var vertices : TD3DVector;
  10771.         var ncount : DWORD;
  10772.         var normals : TD3DVector;
  10773.         var face_data_size, face_data : DWORD) : HResult; stdcall;
  10774.     function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
  10775.     function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
  10776.     function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
  10777.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  10778.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10779.     function GetPerspective: BOOL; stdcall;
  10780.     function GetFaceCount: Integer; stdcall;
  10781.     function GetVertexCount: Integer; stdcall;
  10782.     function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
  10783.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10784.   end;
  10785.  
  10786.   IDirect3DRMMeshBuilder2 = interface (IDirect3DRMMeshBuilder)
  10787.     ['{4516ec77-8f20-11d0-9b6d-0000c0781bc3}']
  10788.     (*
  10789.      * IDirect3DRMMeshBuilder2 methods
  10790.      *)
  10791.     function GenerateNormals2 (
  10792.         dvCreaseAngle: TD3DValue; dwFlags: DWORD) : HResult; stdcall;
  10793.     function GetFace (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10794.   end;
  10795.  
  10796.   IDirect3DRMMeshBuilder3 = interface (IDirect3DRMVisual)
  10797.     ['{ff6b7f71-a40e-11d1-91f9-0000f8758e66}']
  10798.     (*
  10799.      * IDirect3DRMMeshBuilder3 methods
  10800.      *)
  10801.     function Load (lpvObjSource, lpvObjID: Pointer;
  10802.         d3drmLOFlags: TD3DRMLoadOptions;
  10803.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback;
  10804.         lpvArg: Pointer) : HResult; stdcall;
  10805.     function Save (lpFilename: PAnsiChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  10806.         d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
  10807.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10808.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10809.     function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
  10810.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10811.     function GenerateNormals (
  10812.         dvCreaseAngle: TD3DValue; dwFlags: DWORD): HResult; stdcall;
  10813.     function GetColorSource: TD3DRMColorSource; stdcall;
  10814.     function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10815.     function AddMeshBuilder (
  10816.         lpD3DRMMeshBuild: IDirect3DRMMeshBuilder3) : HResult; stdcall;
  10817.     function AddFrame (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  10818.     function AddFace (lpD3DRMFace: IDirect3DRMFace2) : HResult; stdcall;
  10819.     function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
  10820.         normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
  10821.         lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
  10822.     function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
  10823.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10824.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10825.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10826.     function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10827.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10828.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10829.     function SetPerspective (perspective: BOOL) : HResult; stdcall;
  10830.     function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10831.     function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10832.     function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10833.     function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
  10834.     function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
  10835.     function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
  10836.     function GetGeometry (var vcount: DWORD; var vertices : TD3DVector;
  10837.         var ncount : DWORD; var normals : TD3DVector;
  10838.         var face_data_size, face_data : DWORD) : HResult; stdcall;
  10839.     function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
  10840.     function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
  10841.     function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
  10842.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
  10843.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10844.     function GetPerspective: BOOL; stdcall;
  10845.     function GetFaceCount: Integer; stdcall;
  10846.     function GetVertexCount: Integer; stdcall;
  10847.     function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
  10848.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10849.     function GetFace
  10850.         (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10851.     function GetVertex (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
  10852.     function GetNormal (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
  10853.     function DeleteVertices (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
  10854.     function DeleteNormals (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
  10855.     function DeleteFace (lpFace: IDirect3DRMFace2) : HResult; stdcall;
  10856.     function Empty (dwFlags: DWORD) : HResult; stdcall;
  10857.     function Optimize (dwFlags: DWORD) : HResult; stdcall;
  10858.     function AddFacesIndexed (dwFlags: DWORD; var lpdwvIndices: DWORD;
  10859.         lpdwIndexFirst, lpdwCount: PDWORD) : HResult; stdcall;
  10860.     function CreateSubMesh (out lplpUnk: IUnknown) : HResult; stdcall;
  10861.     function GetParentMesh (dwFlags: DWORD; out lplpUnk: IUnknown) : HResult; stdcall;
  10862.     function GetSubMeshes (lpdwCount: PDWORD; lpUnk: IUnknown) : HResult; stdcall;
  10863.     function DeleteSubMesh (lplpUnk: IUnknown) : HResult; stdcall;
  10864.     function Enable (dwFlags: DWORD) : HResult; stdcall;
  10865.     function GetEnable (out lpdwFlags: DWORD) : HResult; stdcall;
  10866.     function AddTriangles (dwFlags, dwFormat, dwVertexCount:  DWORD;
  10867.         lpData: pointer) : HResult; stdcall;
  10868.     function SetVertices
  10869.         (dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
  10870.     function GetVertices(dwFirst: DWORD; var lpdwCount: DWORD;
  10871.         lpdvVector: PD3DVector) : HResult; stdcall;
  10872.     function SetNormals(dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
  10873.     function GetNormals (dwFirst: DWORD; lpdwCount: PDWORD;
  10874.         var lpdvVector: TD3DVector) : HResult; stdcall;
  10875.     function GetNormalCount : integer; stdcall;
  10876.   end;
  10877.  
  10878.   IDirect3DRMLight = interface (IDirect3DRMObject)
  10879.     ['{eb16cb08-d271-11ce-ac48-0000c03825a1}']
  10880.     (*
  10881.      * IDirect3DRMLight methods
  10882.      *)
  10883.     function SetType (d3drmtType: TD3DRMLightType) : HResult; stdcall;
  10884.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10885.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10886.     function SetRange (rvRange: TD3DValue) : HResult; stdcall;
  10887.     function SetUmbra (rvAngle: TD3DValue) : HResult; stdcall;
  10888.     function SetPenumbra (rvAngle: TD3DValue) : HResult; stdcall;
  10889.     function SetConstantAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10890.     function SetLinearAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10891.     function SetQuadraticAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10892.     function GetRange: TD3DValue; stdcall;
  10893.     function GetUmbra: TD3DValue; stdcall;
  10894.     function GetPenumbra: TD3DValue; stdcall;
  10895.     function GetConstantAttenuation: TD3DValue; stdcall;
  10896.     function GetLinearAttenuation: TD3DValue; stdcall;
  10897.     function GetQuadraticAttenuation: TD3DValue; stdcall;
  10898.     function GetColor: TD3DColor; stdcall;
  10899.     function GetType: TD3DRMLightType; stdcall;
  10900.     function SetEnableFrame (lpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
  10901.     function GetEnableFrame (out lplpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
  10902.   end;
  10903.  
  10904.   IDirect3DRMTexture = interface (IDirect3DRMVisual)
  10905.     ['{eb16cb09-d271-11ce-ac48-0000c03825a1}']
  10906.     (*
  10907.      * IDirect3DRMTexture methods
  10908.      *)
  10909.     function InitFromFile (filename: PAnsiChar) : HResult; stdcall;
  10910.     function InitFromSurface (lpDDS: IDirectDrawSurface) : HResult; stdcall;
  10911.     function InitFromResource (rs: HRSRC) : HResult; stdcall;
  10912.     function Changed (bPixels, bPalette: BOOL) : HResult; stdcall;
  10913.     function SetColors (ulColors: DWORD) : HResult; stdcall;
  10914.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10915.     function SetDecalSize (rvWidth, rvHeight: TD3DValue) : HResult; stdcall;
  10916.     function SetDecalOrigin (lX, lY: LongInt) : HResult; stdcall;
  10917.     function SetDecalScale (dwScale: DWORD) : HResult; stdcall;
  10918.     function SetDecalTransparency (bTransp: BOOL) : HResult; stdcall;
  10919.     function SetDecalTransparentColor (rcTransp: TD3DColor) : HResult; stdcall;
  10920.     function GetDecalSize (out lprvWidth, lprvHeight: TD3DValue) : HResult; stdcall;
  10921.     function GetDecalOrigin (out lplX, lplY: LongInt) : HResult; stdcall;
  10922.     function GetImage: PD3DRMImage; stdcall;
  10923.     function GetShades: DWORD; stdcall;
  10924.     function GetColors: DWORD; stdcall;
  10925.     function GetDecalScale: DWORD; stdcall;
  10926.     function GetDecalTransparency: BOOL; stdcall;
  10927.     function GetDecalTransparentColor: TD3DColor; stdcall;
  10928.   end;
  10929.  
  10930.   IDirect3DRMTexture2 = interface (IDirect3DRMTexture)
  10931.     ['{120f30c0-1629-11d0-941c-0080c80cfa7b}']
  10932.     (*
  10933.      * IDirect3DRMTexture2 methods
  10934.      *)
  10935.     function InitFromImage (const lpImage: TD3DRMImage) : HResult; stdcall;
  10936.     function InitFromResource2 (hModule: HModule;
  10937.         strName, strType: PAnsiChar) : HResult; stdcall;
  10938.     function GenerateMIPMap (dwFlags: DWORD) : HResult; stdcall;
  10939.   end;
  10940.  
  10941.   IDirect3DRMTexture3 = interface (IDirect3DRMTexture2)
  10942.     ['{ff6b7f73-a40e-11d1-91f9-0000f8758e66}']
  10943.     (*
  10944.      * IDirect3DRMTexture3 methods
  10945.      *)
  10946.     function GetSurface
  10947.         (dwFlags: DWORD; out lplpDDS: IDirectDrawSurface) : HResult; stdcall;
  10948.     function SetCacheOptions (lImportance: integer; dwFlags: DWORD) : HResult; stdcall;
  10949.     function GetCacheOptions (var lplImportance: integer; var lpdwFlags: DWORD) : HResult; stdcall;
  10950.     function SetDownsampleCallback (
  10951.         pCallback: TD3DRMDownSampleCallback; pArg: pointer) : HResult; stdcall;
  10952.     function SetValidationCallback (
  10953.         pCallback: TD3DRMValidationCallback; pArg: pointer) : HResult; stdcall;
  10954.   end;
  10955.  
  10956.   IDirect3DRMWrap = interface (IDirect3DRMObject)
  10957.     ['{eb16cb0a-d271-11ce-ac48-0000c03825a1}']
  10958.     (*
  10959.      * IDirect3DRMWrap methods
  10960.      *)
  10961.     function Init (d3drmwt: TD3DRMWrapType; lpd3drmfRef: IDirect3DRMFrame;
  10962.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue)
  10963.         : HResult; stdcall;
  10964.     function Apply (lpObject: IDirect3DRMObject) : HResult; stdcall;
  10965.     function ApplyRelative(frame: IDirect3DRMFrame; mesh: IDirect3DRMObject) : HResult; stdcall;
  10966.   end;
  10967.  
  10968.   IDirect3DRMMaterial = interface (IDirect3DRMObject)
  10969.     ['{eb16cb0b-d271-11ce-ac48-0000c03825a1}']
  10970.     (*
  10971.      * IDirect3DRMMaterial methods
  10972.      *)
  10973.     function SetPower (rvPower: TD3DValue) : HResult; stdcall;
  10974.     function SetSpecular (r, g, b: TD3DValue) : HResult; stdcall;
  10975.     function SetEmissive (r, g, b: TD3DValue) : HResult; stdcall;
  10976.     function GetPower: TD3DValue; stdcall;
  10977.     function GetSpecular (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
  10978.     function GetEmissive (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
  10979.   end;
  10980.  
  10981.   IDirect3DRMMaterial2 = interface (IDirect3DRMMaterial)
  10982.     ['{ff6b7f75-a40e-11d1-91f9-0000f8758e66}']
  10983.     (*
  10984.      * IDirect3DRMMaterial2 methods
  10985.      *)
  10986.     function GetAmbient(out r,g,b: TD3DValue) : HResult; stdcall;
  10987.     function SetAmbient(r,g,b: TD3DValue) : HResult; stdcall;
  10988.   end;
  10989.  
  10990.   IDirect3DRMAnimation = interface (IDirect3DRMObject)
  10991.     ['{eb16cb0d-d271-11ce-ac48-0000c03825a1}']
  10992.     (*
  10993.      * IDirect3DRMAnimation methods
  10994.      *)
  10995.     function SetOptions (d3drmanimFlags: TD3DRMAnimationOptions) : HResult; stdcall;
  10996.     function AddRotateKey (rvTime: TD3DValue; const rqQuat: TD3DRMQuaternion) : HResult; stdcall;
  10997.     function AddPositionKey (rvTime, rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10998.     function AddScaleKey (time, x, y, z: TD3DValue) : HResult; stdcall;
  10999.     function DeleteKey (time: TD3DValue) : HResult; stdcall;
  11000.     function SetFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11001.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11002.     function GetOptions: TD3DRMAnimationOptions; stdcall;
  11003.   end;
  11004.  
  11005.   IDirect3DRMAnimation2 = interface (IDirect3DRMAnimation)
  11006.     ['{ff6b7f77-a40e-11d1-91f9-0000f8758e66}']
  11007.     (*
  11008.      * IDirect3DRMAnimation methods
  11009.      *)
  11010.     function GetFrame (out lpD3DFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11011.     function DeleteKeyByID (dwID: DWORD) : HResult; stdcall;
  11012.     function AddKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
  11013.     function ModifyKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
  11014.     function GetKeys (dvTimeMin, dvTimeMax: TD3DValue; var lpdwNumKeys: DWORD;
  11015.         lpKey: PD3DRMAnimationKey) : HResult; stdcall;
  11016.   end;
  11017.  
  11018.   IDirect3DRMAnimationSet = interface (IDirect3DRMObject)
  11019.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  11020.     (*
  11021.      * IDirect3DRMAnimationSet methods
  11022.      *)
  11023.     function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11024.     function Load (lpvObjSource, lpvObjID: Pointer;
  11025.         d3drmLOFlags: TD3DRMLoadOptions;
  11026.         d3drmLoadTextureProc: TD3DRMLoadTextureCallback; lpArgLTP: Pointer;
  11027.         lpParentFrame: IDirect3DRMFrame) : HResult; stdcall;
  11028.     function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11029.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11030.   end;
  11031.  
  11032.   IDirect3DRMAnimationSet2 = interface (IDirect3DRMObject)
  11033.     ['{ff6b7f79-a40e-11d1-91f9-0000f8758e66}']
  11034.     (*
  11035.      * IDirect3DRMAnimationSet methods
  11036.      *)
  11037.     function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11038.     function Load (lpvObjSource, lpvObjID: Pointer;
  11039.         d3drmLOFlags: TD3DRMLoadOptions;
  11040.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback; lpArgLTP: Pointer;
  11041.         lpParentFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11042.     function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11043.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11044.     function GetAnimations(out lplpArray: IDirect3DRMAnimationArray) : HResult; stdcall;
  11045.   end;
  11046.  
  11047.   IDirect3DRMUserVisual = interface (IDirect3DRMVisual)
  11048.     ['{59163de0-6d43-11cf-ac4a-0000c03825a1}']
  11049.     (*
  11050.      * IDirect3DRMUserVisual methods
  11051.      *)
  11052.     function Init (d3drmUVProc: TD3DRMUserVisualCallback;
  11053.         lpArg: Pointer) : HResult; stdcall;
  11054.   end;
  11055.  
  11056.   IDirect3DRMArray = interface (IUnknown)
  11057.     function GetSize: DWORD; stdcall;
  11058.     (* No GetElement method as it would get overloaded
  11059.      * in derived classes, and overloading is
  11060.      * a no-no in COM
  11061.      *)
  11062.   end;
  11063.  
  11064.   IDirect3DRMObjectArray = interface (IDirect3DRMArray)
  11065.         ['{242f6bc2-3849-11d0-9b6d-0000c0781bc3}']
  11066.     function GetElement (index: DWORD; out lplpD3DRMObject:
  11067.         IDirect3DRMObject) : HResult; stdcall;
  11068.   end;
  11069.  
  11070.   IDirect3DRMDeviceArray = interface (IDirect3DRMArray)
  11071.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  11072.     function GetElement (index: DWORD; out lplpD3DRMDevice:
  11073.         IDirect3DRMDevice) : HResult; stdcall;
  11074.   end;
  11075.  
  11076.   IDirect3DRMFrameArray = interface (IDirect3DRMArray)
  11077.     ['{eb16cb12-d271-11ce-ac48-0000c03825a1}']
  11078.     function GetElement (index: DWORD; out lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11079.   end;
  11080.  
  11081.   IDirect3DRMViewportArray = interface (IDirect3DRMArray)
  11082.     ['{eb16cb11-d271-11ce-ac48-0000c03825a1}']
  11083.     function GetElement (index: DWORD; out lplpD3DRMViewport:
  11084.         IDirect3DRMViewport) : HResult; stdcall;
  11085.   end;
  11086.  
  11087.   IDirect3DRMVisualArray = interface (IDirect3DRMArray)
  11088.     ['{eb16cb13-d271-11ce-ac48-0000c03825a1}']
  11089.     function GetElement (index: DWORD; out lplpD3DRMVisual:
  11090.         IDirect3DRMVisual) : HResult; stdcall;
  11091.   end;
  11092.  
  11093.   IDirect3DRMAnimationArray = interface (IDirect3DRMArray)
  11094.     ['{d5f1cae0-4bd7-11d1-b974-0060083e45f3}']
  11095.     function GetElement (index: DWORD; out lplpD3DRMAnimation2:
  11096.         IDirect3DRMAnimation2) : HResult; stdcall;
  11097.   end;
  11098.  
  11099.   IDirect3DRMPickedArray = interface (IDirect3DRMArray)
  11100.     ['{eb16cb16-d271-11ce-ac48-0000c03825a1}']
  11101.     function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
  11102.         out lplpFrameArray: IDirect3DRMFrameArray;
  11103.         const lpD3DRMPickDesc: TD3DRMPickDesc) : HResult; stdcall;
  11104.  
  11105.   end;
  11106.  
  11107.   IDirect3DRMLightArray = interface (IDirect3DRMArray)
  11108.     ['{eb16cb14-d271-11ce-ac48-0000c03825a1}']
  11109.     function GetElement (index: DWORD; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11110.   end;
  11111.  
  11112.  
  11113.   IDirect3DRMFaceArray = interface (IDirect3DRMArray)
  11114.     ['{eb16cb17-d271-11ce-ac48-0000c03825a1}']
  11115.     function GetElement (index: DWORD; out lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  11116.   end;
  11117.  
  11118.   IDirect3DRMPicked2Array = interface (IDirect3DRMArray)
  11119.     ['{4516ec7b-8f20-11d0-9b6d-0000c0781bc3}']
  11120.     function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
  11121.         out lplpFrameArray: IDirect3DRMFrameArray; const lpD3DRMPickDesc2:
  11122.         TD3DRMPickDesc2) : HResult; stdcall;
  11123.   end;
  11124.  
  11125.   IDirect3DRMInterpolator = interface (IDirect3DRMObject)
  11126.     ['{242f6bc1-3849-11d0-9b6d-0000c0781bc3}']
  11127.     (*
  11128.      * IDirect3DRMInterpolator methods
  11129.      *)
  11130.     function AttachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11131.     function GetAttachedObjects
  11132.         (lpD3DRMObjectArray: IDirect3DRMObjectArray) : HResult; stdcall;
  11133.     function DetachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11134.     function SetIndex (d3dVal: TD3DValue) : HResult; stdcall;
  11135.     function GetIndex : TD3DValue; stdcall;
  11136.     function Interpolate (d3dVal: TD3DValue; lpD3DRMObject: IDirect3DRMObject;
  11137.         d3drmInterpFlags: TD3DRMInterpolationOptions) : HResult; stdcall;
  11138.   end;
  11139.  
  11140.   IDirect3DRMClippedVisual = interface (IDirect3DRMObject)
  11141.     ['{5434e733-6d66-11d1-bb0b-0000f875865a}']
  11142.     (*
  11143.      * IDirect3DRMClippedVisual methods
  11144.      *)
  11145.     function Init (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  11146.     function AddPlane (lpRef: IDirect3DRMFrame3;
  11147.         const lpdvPoint, lpdvNormal: TD3DVector;
  11148.         dwFlags: DWORD; out lpdwReturnID: DWORD) : HResult; stdcall;
  11149.     function DeletePlane (dwID, dwFlags: DWORD) : HResult; stdcall;
  11150.     function GetPlaneIDs (var lpdwCount: DWORD; out lpdwID: DWORD; dwFlags: DWORD) : HResult; stdcall;
  11151.     function GetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  11152.         out lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
  11153.     function SetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  11154.         const lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
  11155.   end;
  11156.  
  11157. (*==========================================================================;
  11158.  *
  11159.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11160.  *
  11161.  *  File:       d3drm.h
  11162.  *  Content:    Direct3DRM include file
  11163.  *
  11164.  ***************************************************************************)
  11165.  
  11166. function D3DRMErrorString(Value: HResult) : string;
  11167.  
  11168. //type
  11169.   //TRefClsID = TGUID;
  11170.  
  11171. type
  11172.   TD3DRMDevicePaletteCallback = procedure (lpDirect3DRMDev: IDirect3DRMDevice;
  11173.       lpArg: Pointer; dwIndex: DWORD; red, green, blue: LongInt); cdecl;
  11174.  
  11175. (*
  11176.  * Direct3DRM Object Class (for CoCreateInstance())
  11177.  *)
  11178. const
  11179.   CLSID_CDirect3DRM: TGUID =
  11180.       (D1:$4516ec41;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  11181.  
  11182. type
  11183.   IDirect3DRM = interface (IUnknown)
  11184.     ['{2bc49361-8327-11cf-ac4a-0000c03825a1}']
  11185.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11186.         const riid: TGUID; out ppv) : HResult; stdcall;
  11187.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame;
  11188.         var lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11189.     function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11190.     function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
  11191.         IDirect3DRMMeshBuilder) : HResult; stdcall;
  11192.     function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  11193.     function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11194.     function CreateAnimationSet (var lplpD3DRMAnimationSet:
  11195.         IDirect3DRMAnimationSet) : HResult; stdcall;
  11196.     function CreateTexture (var lpImage: TD3DRMImage;
  11197.         var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  11198.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11199.         cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11200.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11201.         vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11202.     function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
  11203.         IDirect3DRMMaterial) : HResult; stdcall;
  11204.     function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
  11205.         IDirect3DRMDevice) : HResult; stdcall;
  11206.  
  11207.     (* Create a Windows Device using DirectDraw surfaces *)
  11208.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11209.         lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice) :
  11210.         HResult; stdcall;
  11211.  
  11212.       (* Create a Windows Device using D3D objects *)
  11213.     function CreateDeviceFromD3D (lpD3D: IDirect3D; lpD3DDev: IDirect3DDevice;
  11214.         var lplpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
  11215.  
  11216.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11217.         lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
  11218.         IDirect3DRMDevice) : HResult; stdcall;
  11219.  
  11220.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11221.         var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  11222.  
  11223.     function CreateShadow (lpVisual: IDirect3DRMVisual;
  11224.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  11225.         var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
  11226.     function CreateViewport (lpDev: IDirect3DRMDevice;
  11227.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11228.         var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
  11229.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  11230.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11231.         var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11232.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11233.         var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11234.     function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
  11235.         IDirect3DRMTexture) : HResult; stdcall;
  11236.     function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
  11237.         IDirect3DRMTexture) : HResult; stdcall;
  11238.  
  11239.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11240.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11241.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11242.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11243.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11244.  
  11245.     function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11246.     function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11247.  
  11248.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11249.  
  11250.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11251.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11252.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11253.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  11254.         IDirect3DRMFrame) : HResult; stdcall;
  11255.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11256.   end;
  11257.  
  11258. // Moved from D3DRMObj, to avoid circular unit reference:
  11259.  
  11260.   IDirect3DRMObject2 = interface (IUnknown)
  11261.     ['{4516ec7c-8f20-11d0-9b6d-0000c0781bc3}']
  11262.     (*
  11263.      * IDirect3DRMObject2 methods
  11264.      *)
  11265.     function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
  11266.         lpArg: Pointer) : HResult; stdcall;
  11267.     function Clone (pUnkOuter: IUnknown; const riid: TGUID;
  11268.         out ppvObj) : HResult; stdcall;
  11269.     function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
  11270.         lpArg: Pointer) : HResult; stdcall;
  11271.     function GetClientData (dwID: DWORD; out lplpvData: Pointer) : HResult; stdcall;
  11272.     function GetDirect3DRM (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
  11273.     function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  11274.     function SetClientData (dwID: DWORD; lpvData: pointer; dwFlags: DWORD) : HResult; stdcall;
  11275.     function SetName (lpName: PAnsiChar) : HResult; stdcall;
  11276.     function GetAge (dwFlags: DWORD; out pdwAge: DWORD) : HResult; stdcall;
  11277.   end;
  11278.  
  11279.   IID_IDirect3DRMObject2 = IDirect3DRMObject2;
  11280.  
  11281.   IDirect3DRM2 = interface (IUnknown)
  11282.     ['{4516ecc8-8f20-11d0-9b6d-0000c0781bc3}']
  11283.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11284.         const riid: TGUID; out ppv) : HResult; stdcall;
  11285.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame2;
  11286.         var lplpD3DRMFrame: IDirect3DRMFrame2) : HResult; stdcall;
  11287.     function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11288.     function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
  11289.         IDirect3DRMMeshBuilder2) : HResult; stdcall;
  11290.     function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  11291.     function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11292.     function CreateAnimationSet (var lplpD3DRMAnimationSet:
  11293.         IDirect3DRMAnimationSet) : HResult; stdcall;
  11294.     function CreateTexture (var lpImage: TD3DRMImage;
  11295.         var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
  11296.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11297.         cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11298.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11299.         vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11300.     function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
  11301.         IDirect3DRMMaterial) : HResult; stdcall;
  11302.     function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
  11303.         IDirect3DRMDevice2) : HResult; stdcall;
  11304.  
  11305.     (* Create a Windows Device using DirectDraw surfaces *)
  11306.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11307.         lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice2) :
  11308.         HResult; stdcall;
  11309.  
  11310.       (* Create a Windows Device using D3D objects *)
  11311.     function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  11312.         var lplpD3DRMDevice: IDirect3DRMDevice2) : HResult; stdcall;
  11313.  
  11314.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11315.         lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
  11316.         IDirect3DRMDevice2) : HResult; stdcall;
  11317.  
  11318.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11319.         var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
  11320.  
  11321.     function CreateShadow (lpVisual: IDirect3DRMVisual;
  11322.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  11323.         var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
  11324.     function CreateViewport (lpDev: IDirect3DRMDevice;
  11325.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11326.         var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
  11327.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  11328.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11329.         var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11330.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11331.         var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11332.     function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
  11333.         IDirect3DRMTexture2) : HResult; stdcall;
  11334.     function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
  11335.         IDirect3DRMTexture2) : HResult; stdcall;
  11336.  
  11337.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11338.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11339.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11340.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11341.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11342.  
  11343.     function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11344.     function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject:
  11345.         IDirect3DRMObject) : HResult; stdcall;
  11346.  
  11347.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11348.  
  11349.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11350.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11351.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11352.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  11353.         IDirect3DRMFrame) : HResult; stdcall;
  11354.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11355.     function CreateProgressiveMesh (var lplpD3DRMProgressiveMesh:
  11356.         IDirect3DRMProgressiveMesh) : HResult; stdcall;
  11357.   end;
  11358.  
  11359.   IDirect3DRM3 = interface (IUnknown)
  11360.     ['{4516ec83-8f20-11d0-9b6d-0000c0781bc3}']
  11361.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11362.         const riid: TGUID; out ppv) : HResult; stdcall;
  11363.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame3;
  11364.         out lplpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11365.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11366.     function CreateMeshBuilder (out lplpD3DRMMeshBuilder:
  11367.         IDirect3DRMMeshBuilder3) : HResult; stdcall;
  11368.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
  11369.     function CreateAnimation (out lplpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11370.     function CreateAnimationSet (out lplpD3DRMAnimationSet:
  11371.         IDirect3DRMAnimationSet2) : HResult; stdcall;
  11372.     function CreateTexture (const lpImage: TD3DRMImage;
  11373.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11374.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11375.         cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11376.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11377.         vGreen, vBlue: TD3DValue; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11378.     function CreateMaterial (vPower: TD3DValue; out lplpD3DRMMaterial:
  11379.         IDirect3DRMMaterial2) : HResult; stdcall;
  11380.     function CreateDevice (dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
  11381.         IDirect3DRMDevice3) : HResult; stdcall;
  11382.  
  11383.     (* Create a Windows Device using DirectDraw surfaces *)
  11384.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11385.         lpDDSBack: IDirectDrawSurface; dwFlags: DWORD;
  11386.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11387.  
  11388.       (* Create a Windows Device using D3D objects *)
  11389.     function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  11390.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11391.  
  11392.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11393.         lpGUID: PGUID; width, height: Integer;
  11394.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11395.  
  11396.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11397.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11398.  
  11399.     function CreateShadow (pUnk: IUnknown; lpLight: IDirect3DRMLight;
  11400.         px, py, pz, nx, ny, nz: TD3DValue;
  11401.         out lplpShadow: IDirect3DRMShadow2) : HResult; stdcall;
  11402.     function CreateViewport (lpDev: IDirect3DRMDevice3;
  11403.         lpCamera: IDirect3DRMFrame3; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11404.         out lplpD3DRMViewport: IDirect3DRMViewport2) : HResult; stdcall;
  11405.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame3;
  11406.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11407.         out lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11408.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11409.         out lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11410.     function LoadTexture (lpFileName: PAnsiChar; out lplpD3DRMTexture:
  11411.         IDirect3DRMTexture3) : HResult; stdcall;
  11412.     function LoadTextureFromResource (hModule: HMODULE;
  11413.         strName, strType: PAnsiChar;
  11414.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11415.  
  11416.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11417.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11418.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11419.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11420.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11421.  
  11422.     function GetDevices (out lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11423.     function GetNamedObject (lpName: PAnsiChar; out lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11424.  
  11425.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11426.  
  11427.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11428.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11429.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11430.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer; lpParentFrame:
  11431.         IDirect3DRMFrame3) : HResult; stdcall;
  11432.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11433.     function CreateProgressiveMesh (out lplpD3DRMProgressiveMesh:
  11434.         IDirect3DRMProgressiveMesh) : HResult; stdcall;
  11435.  
  11436.     (* Used with IDirect3DRMObject2 *)
  11437.     function RegisterClient (const rguid: TGUID; out lpdwID: DWORD) : HResult; stdcall;
  11438.     function UnregisterClient (const rguid: TGUID) : HResult; stdcall;
  11439.  
  11440.     function CreateClippedVisual (lpVisual: IDirect3DRMVisual;
  11441.         lpClippedVisual: IDirect3DRMClippedVisual) : HResult; stdcall;
  11442.     function SetOptions (dwOptions: DWORD) : HResult; stdcall;
  11443.     function GetOptions (out lpdwOptions: DWORD) : HResult; stdcall;
  11444.   end;
  11445.  
  11446.   IID_IDirect3DRM =  IDirect3DRM;
  11447.   IID_IDirect3DRM2 = IDirect3DRM2;
  11448.   IID_IDirect3DRM3 = IDirect3DRM3;
  11449.  
  11450. const
  11451.   MAKE_D3RMDHRESULT = HResult($88760000);
  11452.  
  11453.   D3DRM_OK                        = DD_OK;
  11454.   D3DRMERR_BADOBJECT              = MAKE_D3RMDHRESULT + 781;
  11455.   D3DRMERR_BADTYPE                = MAKE_D3RMDHRESULT + 782;
  11456.   D3DRMERR_BADALLOC               = MAKE_D3RMDHRESULT + 783;
  11457.   D3DRMERR_FACEUSED               = MAKE_D3RMDHRESULT + 784;
  11458.   D3DRMERR_NOTFOUND               = MAKE_D3RMDHRESULT + 785;
  11459.   D3DRMERR_NOTDONEYET             = MAKE_D3RMDHRESULT + 786;
  11460.   D3DRMERR_FILENOTFOUND           = MAKE_D3RMDHRESULT + 787;
  11461.   D3DRMERR_BADFILE                = MAKE_D3RMDHRESULT + 788;
  11462.   D3DRMERR_BADDEVICE              = MAKE_D3RMDHRESULT + 789;
  11463.   D3DRMERR_BADVALUE               = MAKE_D3RMDHRESULT + 790;
  11464.   D3DRMERR_BADMAJORVERSION        = MAKE_D3RMDHRESULT + 791;
  11465.   D3DRMERR_BADMINORVERSION        = MAKE_D3RMDHRESULT + 792;
  11466.   D3DRMERR_UNABLETOEXECUTE        = MAKE_D3RMDHRESULT + 793;
  11467.   D3DRMERR_LIBRARYNOTFOUND        = MAKE_D3RMDHRESULT + 794;
  11468.   D3DRMERR_INVALIDLIBRARY         = MAKE_D3RMDHRESULT + 795;
  11469.   D3DRMERR_PENDING                = MAKE_D3RMDHRESULT + 796;
  11470.   D3DRMERR_NOTENOUGHDATA          = MAKE_D3RMDHRESULT + 797;
  11471.   D3DRMERR_REQUESTTOOLARGE        = MAKE_D3RMDHRESULT + 798;
  11472.   D3DRMERR_REQUESTTOOSMALL        = MAKE_D3RMDHRESULT + 799;
  11473.   D3DRMERR_CONNECTIONLOST         = MAKE_D3RMDHRESULT + 800;
  11474.   D3DRMERR_LOADABORTED            = MAKE_D3RMDHRESULT + 801;
  11475.   D3DRMERR_NOINTERNET             = MAKE_D3RMDHRESULT + 802;
  11476.   D3DRMERR_BADCACHEFILE           = MAKE_D3RMDHRESULT + 803;
  11477.   D3DRMERR_BOXNOTSET              = MAKE_D3RMDHRESULT + 804;
  11478.   D3DRMERR_BADPMDATA              = MAKE_D3RMDHRESULT + 805;
  11479.   D3DRMERR_CLIENTNOTREGISTERED    = MAKE_D3RMDHRESULT + 806;
  11480.   D3DRMERR_NOTCREATEDFROMDDS      = MAKE_D3RMDHRESULT + 807;
  11481.   D3DRMERR_NOSUCHKEY              = MAKE_D3RMDHRESULT + 808;
  11482.   D3DRMERR_INCOMPATABLEKEY        = MAKE_D3RMDHRESULT + 809;
  11483.   D3DRMERR_ELEMENTINUSE           = MAKE_D3RMDHRESULT + 810;
  11484.   D3DRMERR_TEXTUREFORMATNOTFOUND  = MAKE_D3RMDHRESULT + 811;
  11485.  
  11486. (* Create a Direct3DRM API *)
  11487. var
  11488.   Direct3DRMCreate : function (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
  11489.  
  11490. (*==========================================================================;
  11491.  *
  11492.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11493.  *
  11494.  *  File:       d3drmwin.h
  11495.  *  Content:    Direct3DRM include file
  11496.  *
  11497.  ***************************************************************************)
  11498.  
  11499. type
  11500.   IDirect3DRMWinDevice = interface (IDirect3DRMObject)
  11501.     ['{c5016cc0-d273-11ce-ac48-0000c03825a1}']
  11502.     (*
  11503.      * IDirect3DRMWinDevice methods
  11504.      *)
  11505.  
  11506.     (* Repaint the window with the last frame which was rendered. *)
  11507.     function HandlePaint (hDC: HDC) : HResult; stdcall;
  11508.  
  11509.     (* Respond to a WM_ACTIVATE message. *)
  11510.     function HandleActivate (wparam: WORD) : HResult; stdcall;
  11511.   end;
  11512.  
  11513. (*
  11514.  * GUIDS used by Direct3DRM Windows interface
  11515.  *)
  11516.   IID_IDirect3DRMWinDevice = IDirect3DRMWinDevice;
  11517.  
  11518. (***************************************************************************
  11519.  *
  11520.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  11521.  *
  11522.  *  File:       rmxfguid.h
  11523.  *
  11524.  *  Content:    Defines GUIDs of D3DRM's templates.
  11525.  *
  11526.  ***************************************************************************)
  11527.  
  11528. const
  11529. (* {2B957100-9E9A-11cf-AB39-0020AF71E433} *)
  11530.   TID_D3DRMInfo: TGUID =
  11531.       (D1:$2b957100;D2:$9e9a;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11532.  
  11533. (* {3D82AB44-62DA-11cf-AB39-0020AF71E433} *)
  11534.   TID_D3DRMMesh: TGUID =
  11535.       (D1:$3d82ab44;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11536.  
  11537. (* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} *)
  11538.   TID_D3DRMVector: TGUID =
  11539.       (D1:$3d82ab5e;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11540.  
  11541. (* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} *)
  11542.   TID_D3DRMMeshFace: TGUID =
  11543.       (D1:$3d82ab5f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11544.  
  11545. (* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} *)
  11546.   TID_D3DRMMaterial: TGUID =
  11547.       (D1:$3d82ab4d;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11548.  
  11549. (* {35FF44E1-6C7C-11cf-8F52-0040333594A3} *)
  11550.   TID_D3DRMMaterialArray: TGUID =
  11551.       (D1:$35ff44e1;D2:$6c7c;D3:$11cf;D4:($8F,$52,$00,$40,$33,$35,$94,$a3));
  11552.  
  11553. (* {3D82AB46-62DA-11cf-AB39-0020AF71E433} *)
  11554.   TID_D3DRMFrame: TGUID =
  11555.       (D1:$3d82ab46;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11556.  
  11557. (* {F6F23F41-7686-11cf-8F52-0040333594A3} *)
  11558.   TID_D3DRMFrameTransformMatrix: TGUID =
  11559.       (D1:$f6f23f41;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11560.  
  11561. (* {F6F23F42-7686-11cf-8F52-0040333594A3} *)
  11562.   TID_D3DRMMeshMaterialList: TGUID =
  11563.       (D1:$f6f23f42;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11564.  
  11565. (* {F6F23F40-7686-11cf-8F52-0040333594A3} *)
  11566.   TID_D3DRMMeshTextureCoords: TGUID =
  11567.       (D1:$f6f23f40;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11568.  
  11569. (* {F6F23F43-7686-11cf-8F52-0040333594A3} *)
  11570.   TID_D3DRMMeshNormals: TGUID =
  11571.       (D1:$f6f23f43;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11572.  
  11573. (* {F6F23F44-7686-11cf-8F52-0040333594A3} *)
  11574.   TID_D3DRMCoords2d: TGUID =
  11575.       (D1:$f6f23f44;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11576.  
  11577. (* {F6F23F45-7686-11cf-8F52-0040333594A3} *)
  11578.   TID_D3DRMMatrix4x4: TGUID =
  11579.       (D1:$f6f23f45;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11580.  
  11581. (* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} *)
  11582.   TID_D3DRMAnimation: TGUID =
  11583.       (D1:$3d82ab4f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11584.  
  11585. (* {3D82AB50-62DA-11cf-AB39-0020AF71E433} *)
  11586.   TID_D3DRMAnimationSet: TGUID =
  11587.       (D1:$3d82ab50;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11588.  
  11589. (* {10DD46A8-775B-11cf-8F52-0040333594A3} *)
  11590.   TID_D3DRMAnimationKey: TGUID =
  11591.       (D1:$10dd46a8;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11592.  
  11593. (* {10DD46A9-775B-11cf-8F52-0040333594A3} *)
  11594.   TID_D3DRMFloatKeys: TGUID =
  11595.       (D1:$10dd46a9;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11596.  
  11597. (* {01411840-7786-11cf-8F52-0040333594A3} *)
  11598.   TID_D3DRMMaterialAmbientColor: TGUID =
  11599.       (D1:$01411840;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11600.  
  11601. (* {01411841-7786-11cf-8F52-0040333594A3} *)
  11602.   TID_D3DRMMaterialDiffuseColor: TGUID =
  11603.       (D1:$01411841;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11604.  
  11605. (* {01411842-7786-11cf-8F52-0040333594A3} *)
  11606.   TID_D3DRMMaterialSpecularColor: TGUID =
  11607.       (D1:$01411842;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11608.  
  11609. (* {D3E16E80-7835-11cf-8F52-0040333594A3} *)
  11610.   TID_D3DRMMaterialEmissiveColor: TGUID =
  11611.       (D1:$d3e16e80;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11612.  
  11613. (* {01411843-7786-11cf-8F52-0040333594A3} *)
  11614.   TID_D3DRMMaterialPower: TGUID =
  11615.       (D1:$01411843;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11616.  
  11617. (* {35FF44E0-6C7C-11cf-8F52-0040333594A3} *)
  11618.   TID_D3DRMColorRGBA: TGUID =
  11619.       (D1:$35ff44e0;D2:$6c7c;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11620.  
  11621. (* {D3E16E81-7835-11cf-8F52-0040333594A3} *)
  11622.   TID_D3DRMColorRGB: TGUID =
  11623.       (D1:$d3e16e81;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11624.  
  11625. (* {A42790E0-7810-11cf-8F52-0040333594A3} *)
  11626.   TID_D3DRMGuid: TGUID =
  11627.       (D1:$a42790e0;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11628.  
  11629. (* {A42790E1-7810-11cf-8F52-0040333594A3} *)
  11630.   TID_D3DRMTextureFilename: TGUID =
  11631.       (D1:$a42790e1;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11632.  
  11633. (* {A42790E2-7810-11cf-8F52-0040333594A3} *)
  11634.   TID_D3DRMTextureReference: TGUID =
  11635.       (D1:$a42790e2;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11636.  
  11637. (* {1630B820-7842-11cf-8F52-0040333594A3} *)
  11638.   TID_D3DRMIndexedColor: TGUID =
  11639.       (D1:$1630b820;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11640.  
  11641. (* {1630B821-7842-11cf-8F52-0040333594A3} *)
  11642.   TID_D3DRMMeshVertexColors: TGUID =
  11643.       (D1:$1630b821;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11644.  
  11645. (* {4885AE60-78E8-11cf-8F52-0040333594A3} *)
  11646.   TID_D3DRMMaterialWrap: TGUID =
  11647.       (D1:$4885ae60;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11648.  
  11649. (* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} *)
  11650.   TID_D3DRMBoolean: TGUID =
  11651.       (D1:$537da6a0;D2:$ca37;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
  11652.  
  11653. (* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} *)
  11654.   TID_D3DRMMeshFaceWraps: TGUID =
  11655.       (D1:$ed1ec5c0;D2:$c0a8;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
  11656.  
  11657. (* {4885AE63-78E8-11cf-8F52-0040333594A3} *)
  11658.   TID_D3DRMBoolean2d: TGUID =
  11659.       (D1:$4885ae63;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11660.  
  11661. (* {F406B180-7B3B-11cf-8F52-0040333594A3} *)
  11662.   TID_D3DRMTimedFloatKeys: TGUID =
  11663.       (D1:$f406b180;D2:$7b3b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11664.  
  11665. (* {E2BF56C0-840F-11cf-8F52-0040333594A3} *)
  11666.   TID_D3DRMAnimationOptions: TGUID =
  11667.       (D1:$e2bf56c0;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11668.  
  11669. (* {E2BF56C1-840F-11cf-8F52-0040333594A3} *)
  11670.   TID_D3DRMFramePosition: TGUID =
  11671.       (D1:$e2bf56c1;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11672.  
  11673. (* {E2BF56C2-840F-11cf-8F52-0040333594A3} *)
  11674.   TID_D3DRMFrameVelocity: TGUID =
  11675.       (D1:$e2bf56c2;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11676.  
  11677. (* {E2BF56C3-840F-11cf-8F52-0040333594A3} *)
  11678.   TID_D3DRMFrameRotation: TGUID =
  11679.       (D1:$e2bf56c3;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11680.  
  11681. (* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} *)
  11682.   TID_D3DRMLight: TGUID =
  11683.       (D1:$3d82ab4a;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11684.  
  11685. (* {3D82AB51-62DA-11cf-AB39-0020AF71E433} *)
  11686.   TID_D3DRMCamera: TGUID =
  11687.       (D1:$3d82ab51;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11688.  
  11689. (* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} *)
  11690.   TID_D3DRMAppData: TGUID =
  11691.       (D1:$e5745280;D2:$b24f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11692.  
  11693. (* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} *)
  11694.   TID_D3DRMLightUmbra: TGUID =
  11695.       (D1:$aed22740;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11696.  
  11697. (* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} *)
  11698.   TID_D3DRMLightRange: TGUID =
  11699.       (D1:$aed22742;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11700.  
  11701. (* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} *)
  11702.   TID_D3DRMLightPenumbra: TGUID =
  11703.       (D1:$aed22741;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11704.  
  11705. (* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} *)
  11706.   TID_D3DRMLightAttenuation: TGUID =
  11707.       (D1:$a8a98ba0;D2:$c5e5;D3:$11cf;D4:($b9,$41,$00,$80,$c8,$0c,$fa,$7b));
  11708.  
  11709. (* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} *)
  11710.   TID_D3DRMInlineData: TGUID =
  11711.       (D1:$3a23eea0;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11712.  
  11713. (* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} *)
  11714.   TID_D3DRMUrl: TGUID =
  11715.       (D1:$3a23eea1;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11716.  
  11717. (* {8A63C360-997D-11d0-941C-0080C80CFA7B} *)
  11718.   TID_D3DRMProgressiveMesh: TGUID =
  11719.       (D1:$8A63C360;D2:$997D;D3:$11d0;D4:($94,$1C,$00,$80,$C8,$0C,$FA,$7B));
  11720.  
  11721. (* {98116AA0-BDBA-11d1-82C0-00A0C9697271} *)
  11722.   TID_D3DRMExternalVisual: TGUID =
  11723.       (D1:$98116AA0;D2:$BDBA;D3:$11d1;D4:($82,$C0,$00,$A0,$C9,$69,$72,$71));
  11724.  
  11725. (* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} *)
  11726.   TID_D3DRMStringProperty: TGUID =
  11727.       (D1:$7f0f21e0;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11728.  
  11729. (* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} *)
  11730.   TID_D3DRMPropertyBag: TGUID =
  11731.       (D1:$7f0f21e1;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11732.  
  11733. // {7F5D5EA0-D53A-11d1-82C0-00A0C9697271}
  11734.   TID_D3DRMRightHanded: TGUID =
  11735.       (D1:$7f5d5ea0;D2:$d53a;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11736.  
  11737. (*==========================================================================;
  11738.  *
  11739.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11740.  *
  11741.  *  File:       rmxftmpl.h
  11742.  *  Content:    D3DRM XFile templates in binary form
  11743.  *
  11744.  ***************************************************************************)
  11745.  
  11746. const
  11747.   D3DRM_XTEMPLATE_BYTES_2  = 3278;
  11748.  
  11749.   D3DRM_XTEMPLATES_2: array [0..D3DRM_XTEMPLATE_BYTES_2-1] of byte = (
  11750.         $78, $6f, $66, $20, $30, $33, $30, $32, $62, $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  11751.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65, $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  11752.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  11753.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  11754.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66, $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  11755.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  11756.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  11757.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0, 0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  11758.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  11759.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  11760.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0, 0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  11761.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  11762.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  11763.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  11764.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  11765.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  11766.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  11767.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  11768.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75, $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  11769.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  11770.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0, $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  11771.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  11772.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  11773.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  11774.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72, $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  11775.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  11776.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  11777.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65, $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  11778.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  11779.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  11780.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c, $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  11781.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  11782.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  11783.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  11784.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  11785.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74, $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  11786.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  11787.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  11788.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  11789.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  11790.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0, $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  11791.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0, $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  11792.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  11793.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  11794.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  11795.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43, $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  11796.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  11797.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0, 0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  11798.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  11799.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73, $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  11800.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  11801.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a, 0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  11802.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  11803.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  11804.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  11805.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  11806.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  11807.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  11808.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  11809.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  11810.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  11811.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  11812.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  11813.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  11814.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  11815.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  11816.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  11817.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  11818.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  11819.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  11820.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65, $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  11821.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  11822.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0, 0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  11823.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  11824.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0, $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  11825.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  11826.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14, 0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  11827.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b, 0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  11828.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73, $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  11829.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  11830.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  11831.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  11832.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  11833.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  11834.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  11835.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  11836.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  11837.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  11838.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  11839.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  11840.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0, 0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  11841.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  11842.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  11843.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  11844.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  11845.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  11846.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  11847.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  11848.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0, $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  11849.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  11850.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65, $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  11851.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  11852.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46, $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  11853.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a, 0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  11854.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  11855.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0, $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  11856.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5, 0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  11857.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  11858.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  11859.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5, 0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  11860.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  11861.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  11862.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  11863.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  11864.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6, $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  11865.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0, 0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  11866.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65, $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  11867.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  11868.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0, $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  11869.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  11870.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5, 0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  11871.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  11872.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65, $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  11873.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  11874.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70, $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  11875.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  11876.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f, $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  11877.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f, $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  11878.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  11879.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  11880.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  11881.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65, $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  11882.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  11883.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0, $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  11884.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  11885.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  11886.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0, $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  11887.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  11888.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  11889.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  11890.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  11891.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68, $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  11892.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  11893.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  11894.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  11895.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  11896.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  11897.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  11898.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  11899.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  11900.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74, $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  11901.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  11902.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0, 0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  11903.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50, $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  11904.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  11905.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  11906.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  11907.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0, $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  11908.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  11909.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78, $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  11910.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0,
  11911.         $b, 0, 0, 0, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $a, 0, $5, 0, $a0,
  11912.         $5e, $5d, $7f, $3a, $d5, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $29, 0, $1, 0, $c,
  11913.         0, 0, 0, $62, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $14, 0, $b, 0);
  11914.  
  11915. //---------------
  11916. {$ENDIF}
  11917. //DirectInput file
  11918. (*==========================================================================;
  11919.  *
  11920.  *  Copyright (C) 1996-1999 Microsoft Corporation.  All Rights Reserved.
  11921.  *
  11922.  *  File:       dinput.h
  11923.  *  Content:    DirectInput include file
  11924.  *
  11925.  *  DirectX 7.0 Delphi adaptation by Erik Unger, input format
  11926.  *  variable structure & other fixups by Arne Schäpers (as)
  11927.  *
  11928.  *  Modified: 10-Sep-2000
  11929.  *
  11930.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  11931.  *  E-Mail: DelphiDirectX@next-reality.com
  11932.  *          a.schaepers@digitalpublishing.de            
  11933.  *
  11934.  ***************************************************************************)
  11935.  
  11936. { Some notes from as:
  11937.   1. DirectInput Enum callback functions which are documented with result
  11938.   type BOOL in the SDK had to be changed to result type integer because the debug
  11939.   version of DINPUT.DLL (which is the same for SDK versions 5.0, 5.2, 6.0, and 6.1)
  11940.   explicitely checks for two possible return values:
  11941.  
  11942.   0 - FALSE in C and in Delphi
  11943.   1 - TRUE in C, defined as DIENUM_CONTINUE
  11944.  
  11945.   In Delphi, TRUE means $FFFFFFFF (= -1) for the LongBool (= BOOL) data
  11946.   type, and AL = 1 (upper three bytes undefined) for the Boolean data type.
  11947.   The debug version of DINPUT.DLL will throw an external exception
  11948.   ("invalid return value for callback") when fed with either value.
  11949.  
  11950.   This change affects the following methods:
  11951.   EnumDevices, EnumObjects, EnumEffects, EnumCreatedEffectObjects
  11952.  
  11953.   2. Windows 98 and DX6 debug versions DInput and DSound
  11954.  
  11955.   Under Windows 98, the "debug" setup of the DirectX SDK 6.x skips DInput.DLL
  11956.   and DSound.DLL, i.e. makes you end up with the retail version of these two
  11957.   files without any notice.
  11958.   The debug versions of DInput.DLL and DSound.DLL can be found in the
  11959.   \extras\Win98\Win98Dbg folder of the SDK CD; they need to be installed
  11960.   "manually".
  11961.  
  11962.   This problem has been fixed with DX7 where the SDK installs the debug versions
  11963.   of DInput and DSound without any "manual" help.
  11964.  
  11965. }
  11966.  
  11967.  
  11968. var
  11969.   DInputDLL : HMODULE;
  11970.  
  11971. {$IFDEF DIRECTX3}
  11972. const DIRECTINPUT_VERSION = $0300;
  11973. {$ELSE}
  11974. const DIRECTINPUT_VERSION = $0700;
  11975. {$ENDIF}
  11976.  
  11977. function DIErrorString(Value: HResult) : string;
  11978.  
  11979. //type
  11980. //  TRefGUID = packed record
  11981. //    case integer of
  11982. //    1: (guid : PGUID);
  11983. //    2: (dwFlags : DWORD);
  11984. //  end;
  11985.  
  11986. (****************************************************************************
  11987.  *
  11988.  *      Class IDs
  11989.  *
  11990.  ****************************************************************************)
  11991. const
  11992.   CLSID_DirectInput: TGUID =
  11993.       (D1:$25E609E0;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11994.   CLSID_DirectInputDevice: TGUID =
  11995.       (D1:$25E609E1;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11996.  
  11997. (****************************************************************************
  11998.  *
  11999.  *      Predefined object types
  12000.  *
  12001.  ****************************************************************************)
  12002.  
  12003.   GUID_XAxis: TGUID =
  12004.       (D1:$A36D02E0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12005.   GUID_YAxis: TGUID =
  12006.       (D1:$A36D02E1;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12007.   GUID_ZAxis: TGUID =
  12008.       (D1:$A36D02E2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12009.   GUID_RxAxis: TGUID =
  12010.       (D1:$A36D02F4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12011.   GUID_RyAxis: TGUID =
  12012.       (D1:$A36D02F5;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12013.   GUID_RzAxis: TGUID =
  12014.       (D1:$A36D02E3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12015.   GUID_Slider: TGUID =
  12016.       (D1:$A36D02E4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12017.  
  12018.   GUID_Button: TGUID =
  12019.       (D1:$A36D02F0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12020.   GUID_Key: TGUID =
  12021.       (D1:$55728220;D2:$D33C;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12022.  
  12023.   GUID_POV: TGUID =
  12024.       (D1:$A36D02F2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12025.  
  12026.   GUID_Unknown: TGUID =
  12027.       (D1:$A36D02F3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12028.  
  12029. (****************************************************************************
  12030.  *
  12031.  *      Predefined product GUIDs
  12032.  *
  12033.  ****************************************************************************)
  12034.  
  12035.   GUID_SysMouse: TGUID =
  12036.       (D1:$6F1D2B60;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12037.   GUID_SysKeyboard: TGUID =
  12038.       (D1:$6F1D2B61;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12039.   GUID_Joystick: TGUID =
  12040.       (D1:$6F1D2B70;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12041.   GUID_SysMouseEm: TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}';
  12042.   GUID_SysMouseEm2: TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}';
  12043.   GUID_SysKeyboardEm: TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}';
  12044.   GUID_SysKeyboardEm2: TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}';
  12045.  
  12046. (****************************************************************************
  12047.  *
  12048.  *      Predefined force feedback effects
  12049.  *
  12050.  ****************************************************************************)
  12051.  
  12052.   GUID_ConstantForce: TGUID =
  12053.       (D1:$13541C20;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12054.   GUID_RampForce: TGUID =
  12055.       (D1:$13541C21;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12056.   GUID_Square: TGUID =
  12057.       (D1:$13541C22;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12058.   GUID_Sine: TGUID =
  12059.       (D1:$13541C23;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12060.   GUID_Triangle: TGUID =
  12061.       (D1:$13541C24;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12062.   GUID_SawtoothUp: TGUID =
  12063.       (D1:$13541C25;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12064.   GUID_SawtoothDown: TGUID =
  12065.       (D1:$13541C26;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12066.   GUID_Spring: TGUID =
  12067.       (D1:$13541C27;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12068.   GUID_Damper: TGUID =
  12069.       (D1:$13541C28;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12070.   GUID_Inertia: TGUID =
  12071.       (D1:$13541C29;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12072.   GUID_Friction: TGUID =
  12073.       (D1:$13541C2A;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12074.   GUID_CustomForce: TGUID =
  12075.       (D1:$13541C2B;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12076.  
  12077.  
  12078.  
  12079. (****************************************************************************
  12080.  *
  12081.  *      Interfaces and Structures...
  12082.  *
  12083.  ****************************************************************************)
  12084.  
  12085. (****************************************************************************
  12086.  *
  12087.  *      IDirectInputEffect
  12088.  *
  12089.  ****************************************************************************)
  12090.  
  12091. const
  12092.   DIEFT_ALL                   = $00000000;
  12093.  
  12094.   DIEFT_CONSTANTFORCE         = $00000001;
  12095.   DIEFT_RAMPFORCE             = $00000002;
  12096.   DIEFT_PERIODIC              = $00000003;
  12097.   DIEFT_CONDITION             = $00000004;
  12098.   DIEFT_CUSTOMFORCE           = $00000005;
  12099.   DIEFT_HARDWARE              = $000000FF;
  12100.  
  12101.   DIEFT_FFATTACK              = $00000200;
  12102.   DIEFT_FFFADE                = $00000400;
  12103.   DIEFT_SATURATION            = $00000800;
  12104.   DIEFT_POSNEGCOEFFICIENTS    = $00001000;
  12105.   DIEFT_POSNEGSATURATION      = $00002000;
  12106.   DIEFT_DEADBAND              = $00004000;
  12107.   DIEFT_STARTDELAY            = $00008000;
  12108.  
  12109. function DIEFT_GETTYPE(n: variant) : byte;
  12110.  
  12111. const
  12112.   DI_DEGREES                  =     100;
  12113.   DI_FFNOMINALMAX             =   10000;
  12114.   DI_SECONDS                  = 1000000;
  12115.  
  12116. type
  12117.   PDIConstantForce = ^TDIConstantForce;
  12118.   TDIConstantForce = packed record
  12119.     lMagnitude : LongInt;
  12120.   end;
  12121.  
  12122.   PDIRampForce = ^TDIRampForce;
  12123.   TDIRampForce = packed record
  12124.     lStart : LongInt;
  12125.     lEnd : LongInt;
  12126.   end;
  12127.  
  12128.   PDIPeriodic = ^TDIPeriodic;
  12129.   TDIPeriodic = packed record
  12130.     dwMagnitude : DWORD;
  12131.     lOffset : LongInt;
  12132.     dwPhase : DWORD;
  12133.     dwPeriod : DWORD;
  12134.   end;
  12135.  
  12136.   PDICondition = ^TDICondition;
  12137.   TDICondition = packed record
  12138.     lOffset : LongInt;
  12139.     lPositiveCoefficient : LongInt;
  12140.     lNegativeCoefficient : LongInt;
  12141.     dwPositiveSaturation : DWORD;
  12142.     dwNegativeSaturation : DWORD;
  12143.     lDeadBand : LongInt;
  12144.   end;
  12145.  
  12146.   PDICustomForce = ^TDICustomForce;
  12147.   TDICustomForce = packed record
  12148.     cChannels : DWORD;
  12149.     dwSamplePeriod : DWORD;
  12150.     cSamples : DWORD;
  12151.     rglForceData : PLongInt;
  12152.   end;
  12153.  
  12154.   PDIEnvelope = ^TDIEnvelope;
  12155.   TDIEnvelope = packed record
  12156.     dwSize : DWORD;                   (* sizeof(DIENVELOPE)   *)
  12157.     dwAttackLevel : DWORD;
  12158.     dwAttackTime : DWORD;             (* Microseconds         *)
  12159.     dwFadeLevel : DWORD;
  12160.     dwFadeTime : DWORD;               (* Microseconds         *)
  12161.   end;
  12162.  
  12163.   PDIEffect_DX5 = ^TDIEffect_DX5;
  12164.   TDIEffect_DX5 = packed record
  12165.     dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
  12166.     dwFlags : DWORD;                  (* DIEFF_*              *)
  12167.     dwDuration : DWORD;               (* Microseconds         *)
  12168.     dwSamplePeriod : DWORD;           (* Microseconds         *)
  12169.     dwGain : DWORD;
  12170.     dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
  12171.     dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
  12172.     cAxes : DWORD;                    (* Number of axes       *)
  12173.     rgdwAxes : PDWORD;                (* Array of axes        *)
  12174.     rglDirection : PLongInt;          (* Array of directions  *)
  12175.     lpEnvelope : PDIEnvelope;         (* Optional             *)
  12176.     cbTypeSpecificParams : DWORD;     (* Size of params       *)
  12177.     lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
  12178.   end;
  12179.  
  12180.   PDIEffect_DX6 = ^TDIEffect_DX6;
  12181.   TDIEffect_DX6 = packed record
  12182.     dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
  12183.     dwFlags : DWORD;                  (* DIEFF_*              *)
  12184.     dwDuration : DWORD;               (* Microseconds         *)
  12185.     dwSamplePeriod : DWORD;           (* Microseconds         *)
  12186.     dwGain : DWORD;
  12187.     dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
  12188.     dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
  12189.     cAxes : DWORD;                    (* Number of axes       *)
  12190.     rgdwAxes : PDWORD;                (* Array of axes        *)
  12191.     rglDirection : PLongInt;          (* Array of directions  *)
  12192.     lpEnvelope : PDIEnvelope;         (* Optional             *)
  12193.     cbTypeSpecificParams : DWORD;     (* Size of params       *)
  12194.     lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
  12195.     dwStartDelay: DWORD;              (* Microseconds         *)
  12196.   end;
  12197.  
  12198.   PDIEffect = ^TDIEffect;
  12199. {$IFDEF DIRECTX5}
  12200.   TDIEffect = TDIEffect_DX5;
  12201. {$ELSE}
  12202.   TDIEffect = TDIEffect_DX6;
  12203. {$ENDIF}
  12204.  
  12205.   PDIFileEffect = ^TDIFileEffect;
  12206.   TDIFileEffect = packed record
  12207.     dwSize : DWORD;
  12208.     GuidEffect: TGUID;
  12209.     lpDiEffect: PDIEffect;
  12210.     szFriendlyName : array [0..MAX_PATH-1] of AnsiChar;
  12211.   end;
  12212.  
  12213. const
  12214.   DIEFF_OBJECTIDS             = $00000001;
  12215.   DIEFF_OBJECTOFFSETS         = $00000002;
  12216.   DIEFF_CARTESIAN             = $00000010;
  12217.   DIEFF_POLAR                 = $00000020;
  12218.   DIEFF_SPHERICAL             = $00000040;
  12219.  
  12220.   DIEP_DURATION               = $00000001;
  12221.   DIEP_SAMPLEPERIOD           = $00000002;
  12222.   DIEP_GAIN                   = $00000004;
  12223.   DIEP_TRIGGERBUTTON          = $00000008;
  12224.   DIEP_TRIGGERREPEATINTERVAL  = $00000010;
  12225.   DIEP_AXES                   = $00000020;
  12226.   DIEP_DIRECTION              = $00000040;
  12227.   DIEP_ENVELOPE               = $00000080;
  12228.   DIEP_TYPESPECIFICPARAMS     = $00000100;
  12229. {$IFDEF DIRECTX5}
  12230.   DIEP_ALLPARAMS              = $000001FF;
  12231. {$ELSE}
  12232.   DIEP_STARTDELAY             = $00000200;
  12233.   DIEP_ALLPARAMS_DX5          = $000001FF;
  12234.   DIEP_ALLPARAMS              = $000003FF;
  12235. {$ENDIF}
  12236.   DIEP_START                  = $20000000;
  12237.   DIEP_NORESTART              = $40000000;
  12238.   DIEP_NODOWNLOAD             = $80000000;
  12239.   DIEB_NOTRIGGER              = $FFFFFFFF;
  12240.  
  12241.   DIES_SOLO                   = $00000001;
  12242.   DIES_NODOWNLOAD             = $80000000;
  12243.  
  12244.   DIEGES_PLAYING              = $00000001;
  12245.   DIEGES_EMULATED             = $00000002;
  12246.  
  12247.  
  12248. type
  12249.   PDIEffEscape = ^TDIEffEscape;
  12250.   TDIEffEscape = packed record
  12251.     dwSize : DWORD;
  12252.     dwCommand : DWORD;
  12253.     lpvInBuffer : pointer;
  12254.     cbInBuffer : DWORD;
  12255.     lpvOutBuffer : pointer;
  12256.     cbOutBuffer : DWORD;
  12257.   end;
  12258.  
  12259.  
  12260. //
  12261. // IDirectSoundCapture  // as: ???
  12262. //
  12263.   IDirectInputEffect = interface (IUnknown)
  12264.     ['{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}']
  12265.     (** IDirectInputEffect methods ***)
  12266.     function Initialize(hinst: THandle; dwVersion: DWORD;
  12267.         const rguid: TGUID) : HResult;  stdcall;
  12268.     function GetEffectGuid(var pguid: TGUID) : HResult;  stdcall;
  12269.     function GetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
  12270.     function SetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
  12271.     function Start(dwIterations: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12272.     function Stop : HResult;  stdcall;
  12273.     function GetEffectStatus(var pdwFlags : DWORD) : HResult;  stdcall;
  12274.     function Download : HResult;  stdcall;
  12275.     function Unload : HResult;  stdcall;
  12276.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12277.   end;
  12278.  
  12279. (****************************************************************************
  12280.  *
  12281.  *      IDirectInputDevice
  12282.  *
  12283.  ****************************************************************************)
  12284.  
  12285. const
  12286.   DIDEVTYPE_DEVICE = 1;
  12287.   DIDEVTYPE_MOUSE = 2;
  12288.   DIDEVTYPE_KEYBOARD = 3;
  12289.   DIDEVTYPE_JOYSTICK = 4;
  12290.   DIDEVTYPE_HID = $00010000;
  12291.  
  12292.   DIDEVTYPEMOUSE_UNKNOWN = 1;
  12293.   DIDEVTYPEMOUSE_TRADITIONAL = 2;
  12294.   DIDEVTYPEMOUSE_FINGERSTICK = 3;
  12295.   DIDEVTYPEMOUSE_TOUCHPAD = 4;
  12296.   DIDEVTYPEMOUSE_TRACKBALL = 5;
  12297.  
  12298.   DIDEVTYPEKEYBOARD_UNKNOWN = 0;
  12299.   DIDEVTYPEKEYBOARD_PCXT = 1;
  12300.   DIDEVTYPEKEYBOARD_OLIVETTI = 2;
  12301.   DIDEVTYPEKEYBOARD_PCAT = 3;
  12302.   DIDEVTYPEKEYBOARD_PCENH = 4;
  12303.   DIDEVTYPEKEYBOARD_NOKIA1050 = 5;
  12304.   DIDEVTYPEKEYBOARD_NOKIA9140 = 6;
  12305.   DIDEVTYPEKEYBOARD_NEC98 = 7;
  12306.   DIDEVTYPEKEYBOARD_NEC98LAPTOP = 8;
  12307.   DIDEVTYPEKEYBOARD_NEC98106 = 9;
  12308.   DIDEVTYPEKEYBOARD_JAPAN106 = 10;
  12309.   DIDEVTYPEKEYBOARD_JAPANAX = 11;
  12310.   DIDEVTYPEKEYBOARD_J3100 = 12;
  12311.  
  12312.   DIDEVTYPEJOYSTICK_UNKNOWN = 1;
  12313.   DIDEVTYPEJOYSTICK_TRADITIONAL = 2;
  12314.   DIDEVTYPEJOYSTICK_FLIGHTSTICK = 3;
  12315.   DIDEVTYPEJOYSTICK_GAMEPAD = 4;
  12316.   DIDEVTYPEJOYSTICK_RUDDER = 5;
  12317.   DIDEVTYPEJOYSTICK_WHEEL = 6;
  12318.   DIDEVTYPEJOYSTICK_HEADTRACKER = 7;
  12319.  
  12320. function GET_DIDEVICE_TYPE(dwDevType: variant) : byte;
  12321. function GET_DIDEVICE_SUBTYPE(dwDevType: variant) : byte;
  12322.  
  12323. type
  12324.   PDIDevCaps_DX3 = ^TDIDevCaps_DX3;
  12325.   TDIDevCaps_DX3 = packed record
  12326.     dwSize: DWORD;
  12327.     dwFlags: DWORD;
  12328.     dwDevType: DWORD;
  12329.     dwAxes: DWORD;
  12330.     dwButtons: DWORD;
  12331.     dwPOVs: DWORD;
  12332.   end;
  12333.  
  12334.   PDIDevCaps_DX5 = ^TDIDevCaps_DX5;
  12335.   TDIDevCaps_DX5 = packed record
  12336.     dwSize: DWORD;
  12337.     dwFlags: DWORD;
  12338.     dwDevType: DWORD;
  12339.     dwAxes: DWORD;
  12340.     dwButtons: DWORD;
  12341.     dwPOVs: DWORD;
  12342.     dwFFSamplePeriod: DWORD;
  12343.     dwFFMinTimeResolution: DWORD;
  12344.     dwFirmwareRevision: DWORD;
  12345.     dwHardwareRevision: DWORD;
  12346.     dwFFDriverVersion: DWORD;
  12347.   end;
  12348.  
  12349.   PDIDevCaps = ^TDIDevCaps;
  12350. {$IFDEF DIRECTX3}
  12351.   TDIDevCaps = TDIDevCaps_DX3;
  12352. {$ELSE}
  12353.   TDIDevCaps = TDIDevCaps_DX5;
  12354. {$ENDIF}
  12355.  
  12356. const
  12357.   DIDC_ATTACHED           = $00000001;
  12358.   DIDC_POLLEDDEVICE       = $00000002;
  12359.   DIDC_EMULATED           = $00000004;
  12360.   DIDC_POLLEDDATAFORMAT   = $00000008;
  12361.   DIDC_FORCEFEEDBACK      = $00000100;
  12362.   DIDC_FFATTACK           = $00000200;
  12363.   DIDC_FFFADE             = $00000400;
  12364.   DIDC_SATURATION         = $00000800;
  12365.   DIDC_POSNEGCOEFFICIENTS = $00001000;
  12366.   DIDC_POSNEGSATURATION   = $00002000;
  12367.   DIDC_DEADBAND           = $00004000;
  12368.   DIDC_STARTDELAY         = $00008000;
  12369.   DIDC_ALIAS              = $00010000;
  12370.   DIDC_PHANTOM            = $00020000;
  12371.  
  12372.   DIDFT_ALL = $00000000;
  12373.  
  12374.   DIDFT_RELAXIS = $00000001;
  12375.   DIDFT_ABSAXIS = $00000002;
  12376.   DIDFT_AXIS    = $00000003;
  12377.  
  12378.   DIDFT_PSHBUTTON = $00000004;
  12379.   DIDFT_TGLBUTTON = $00000008;
  12380.   DIDFT_BUTTON    = $0000000C;
  12381.  
  12382.   DIDFT_POV        = $00000010;
  12383.   DIDFT_COLLECTION = $00000040;
  12384.   DIDFT_NODATA     = $00000080;
  12385.  
  12386.   DIDFT_ANYINSTANCE = $00FFFF00;
  12387.   DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE;
  12388. function DIDFT_MAKEINSTANCE(n: variant) : DWORD;
  12389. function DIDFT_GETTYPE(n: variant) : byte;
  12390. function DIDFT_GETINSTANCE(n: variant) : DWORD;
  12391. const
  12392.   DIDFT_FFACTUATOR        = $01000000;
  12393.   DIDFT_FFEFFECTTRIGGER   = $02000000;
  12394.   DIDFT_OUTPUT            = $10000000;
  12395.   DIDFT_VENDORDEFINED     = $04000000;
  12396.   DIDFT_ALIAS             = $08000000;
  12397.  
  12398. function DIDFT_ENUMCOLLECTION(n: variant) : DWORD;
  12399. const
  12400.   DIDFT_NOCOLLECTION = $00FFFF00;
  12401.  
  12402.  
  12403.  
  12404. type
  12405.   PDIObjectDataFormat = ^TDIObjectDataFormat;
  12406.   TDIObjectDataFormat = packed record
  12407.     pguid: PGUID;
  12408.     dwOfs: DWORD;
  12409.     dwType: DWORD;
  12410.     dwFlags: DWORD;
  12411.   end;
  12412.  
  12413.   PDIDataFormat = ^TDIDataFormat;
  12414.   TDIDataFormat = packed record
  12415.     dwSize: DWORD;  
  12416.     dwObjSize: DWORD;
  12417.     dwFlags: DWORD;  
  12418.     dwDataSize: DWORD;  
  12419.     dwNumObjs: DWORD;  
  12420.     rgodf: PDIObjectDataFormat;
  12421.   end;
  12422.  
  12423. const
  12424.   DIDF_ABSAXIS = $00000001;
  12425.   DIDF_RELAXIS = $00000002;
  12426.  
  12427. type
  12428.   PDIDeviceObjectInstance_DX3A = ^TDIDeviceObjectInstance_DX3A;
  12429.   TDIDeviceObjectInstance_DX3A = packed record
  12430.     dwSize: DWORD;
  12431.     guidType: TGUID;
  12432.     dwOfs: DWORD;
  12433.     dwType: DWORD;
  12434.     dwFlags: DWORD;
  12435.     tszName: Array [0..MAX_PATH-1] of CHAR;
  12436.   end;
  12437.  
  12438.   PDIDeviceObjectInstance_DX3W = ^TDIDeviceObjectInstance_DX3W;
  12439.   TDIDeviceObjectInstance_DX3W = packed record
  12440.     dwSize: DWORD;
  12441.     guidType: TGUID;
  12442.     dwOfs: DWORD;
  12443.     dwType: DWORD;
  12444.     dwFlags: DWORD;
  12445.     tszName: Array [0..MAX_PATH-1] of WCHAR;
  12446.   end;
  12447.  
  12448.   PDIDeviceObjectInstance_DX3 = ^TDIDeviceObjectInstance_DX3;
  12449. {$IFDEF UNICODE}
  12450.   TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3W;
  12451. {$ELSE}
  12452.   TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3A;
  12453. {$ENDIF}
  12454.  
  12455.   PDIDeviceObjectInstance_DX5A = ^TDIDeviceObjectInstance_DX5A;
  12456.   TDIDeviceObjectInstance_DX5A = packed record
  12457.     dwSize: DWORD;
  12458.     guidType: TGUID;
  12459.     dwOfs: DWORD;
  12460.     dwType: DWORD;
  12461.     dwFlags: DWORD;
  12462.     tszName: Array [0..MAX_PATH-1] of CHAR;
  12463.     dwFFMaxForce: DWORD;
  12464.     dwFFForceResolution: DWORD;
  12465.     wCollectionNumber: WORD;
  12466.     wDesignatorIndex: WORD;
  12467.     wUsagePage: WORD;
  12468.     wUsage: WORD;
  12469.     dwDimension: DWORD;
  12470.     wExponent: WORD;
  12471.     wReserved: WORD;
  12472.   end;
  12473.  
  12474.   PDIDeviceObjectInstance_DX5W = ^TDIDeviceObjectInstance_DX5W;
  12475.   TDIDeviceObjectInstance_DX5W = packed record
  12476.     dwSize: DWORD;
  12477.     guidType: TGUID;
  12478.     dwOfs: DWORD;
  12479.     dwType: DWORD;
  12480.     dwFlags: DWORD;
  12481.     tszName: Array [0..MAX_PATH-1] of WCHAR;
  12482.     dwFFMaxForce: DWORD;
  12483.     dwFFForceResolution: DWORD;
  12484.     wCollectionNumber: WORD;
  12485.     wDesignatorIndex: WORD;
  12486.     wUsagePage: WORD;
  12487.     wUsage: WORD;
  12488.     dwDimension: DWORD;
  12489.     wExponent: WORD;
  12490.     wReserved: WORD;
  12491.   end;
  12492.  
  12493.   PDIDeviceObjectInstance_DX5 = ^TDIDeviceObjectInstance_DX5;
  12494. {$IFDEF UNICODE}
  12495.   TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5W;
  12496. {$ELSE}
  12497.   TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5A;
  12498. {$ENDIF}
  12499.  
  12500.   PDIDeviceObjectInstanceA = ^TDIDeviceObjectInstanceA;
  12501.   PDIDeviceObjectInstanceW = ^TDIDeviceObjectInstanceA;
  12502.   PDIDeviceObjectInstance = ^TDIDeviceObjectInstance;
  12503. {$IFDEF DIRECTX3}
  12504.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX3A;
  12505.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX3W;
  12506.   TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX3;
  12507. {$ELSE}
  12508.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX5A;
  12509.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX5W;
  12510.   TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX5;
  12511. {$ENDIF}
  12512.  
  12513.   // Bug fix (and deviation from the SDK). Callback *must* return
  12514.   // DIENUM_STOP (= 0) or DIENUM_CONTINUE (=1) in order to work
  12515.   // with the debug version of DINPUT.DLL
  12516.   TDIEnumDeviceObjectsCallbackA = function (
  12517.       var lpddoi: TDIDeviceObjectInstanceA; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12518.   TDIEnumDeviceObjectsCallbackW = function (
  12519.       var lpddoi: TDIDeviceObjectInstanceW; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12520.   TDIEnumDeviceObjectsCallback = function (
  12521.       var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12522.  
  12523.   TDIEnumDeviceObjectsProc = function (
  12524.       var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12525.  
  12526. const
  12527.   DIDOI_FFACTUATOR        = $00000001;
  12528.   DIDOI_FFEFFECTTRIGGER   = $00000002;
  12529.   DIDOI_POLLED            = $00008000;
  12530.   DIDOI_ASPECTPOSITION    = $00000100;
  12531.   DIDOI_ASPECTVELOCITY    = $00000200;
  12532.   DIDOI_ASPECTACCEL       = $00000300;
  12533.   DIDOI_ASPECTFORCE       = $00000400;
  12534.   DIDOI_ASPECTMASK        = $00000F00;
  12535.   DIDOI_GUIDISUSAGE       = $00010000;
  12536.  
  12537. type
  12538.   PDIPropHeader = ^TDIPropHeader;
  12539.   TDIPropHeader = packed record
  12540.     dwSize: DWORD;
  12541.     dwHeaderSize: DWORD;
  12542.     dwObj: DWORD;
  12543.     dwHow: DWORD;
  12544.   end;
  12545.  
  12546. const
  12547.   DIPH_DEVICE = 0;
  12548.   DIPH_BYOFFSET = 1;
  12549.   DIPH_BYID = 2;
  12550.   DIPH_BYUSAGE = 3;
  12551.  
  12552. function DIMAKEUSAGEDWORD(UsagePage, Usage: WORD) : DWORD;
  12553.  
  12554. type
  12555.   PDIPropDWord = ^TDIPropDWord;
  12556.   TDIPropDWord = packed record
  12557.     diph: TDIPropHeader;
  12558.     dwData: DWORD;
  12559.   end;
  12560.  
  12561.   PDIPropRange = ^TDIPropRange;
  12562.   TDIPropRange = packed record
  12563.     diph: TDIPropHeader;
  12564.     lMin: Longint;
  12565.     lMax: Longint;
  12566.   end;
  12567.  
  12568. const
  12569.   DIPROPRANGE_NOMIN = $80000000;
  12570.   DIPROPRANGE_NOMAX = $7FFFFFFF;
  12571.  
  12572. type
  12573.   PDIPropCal = ^TDIPropCal;
  12574.   TDIPropCal = packed record
  12575.     diph: TDIPropHeader;
  12576.     lMin:    LongInt;
  12577.     lCenter: LongInt;
  12578.     lMax:    LongInt;
  12579.   end;
  12580.  
  12581.   PDIPropGUIDAndPath = ^TDIPropGUIDAndPath;
  12582.   TDIPropGUIDAndPath = packed record
  12583.     diph: TDIPropHeader;
  12584.     guidClass: TGUID;
  12585.     wszPath: array [0..MAX_PATH-1] of WideChar;
  12586.   end;
  12587.  
  12588.   PDIPropString = ^TDIPropString;
  12589.   TDIPropString = packed record
  12590.     diph: TDIPropHeader;
  12591.     wsz: array [0..MAX_PATH-1] of WideChar;
  12592.   end;
  12593.  
  12594. type
  12595.   MAKEDIPROP = PGUID;
  12596.  
  12597. const
  12598.   DIPROP_BUFFERSIZE = MAKEDIPROP(1);
  12599.  
  12600.   DIPROP_AXISMODE = MAKEDIPROP(2);
  12601.  
  12602.   DIPROPAXISMODE_ABS = 0;
  12603.   DIPROPAXISMODE_REL = 1;
  12604.  
  12605.   DIPROP_GRANULARITY = MAKEDIPROP(3);
  12606.  
  12607.   DIPROP_RANGE = MAKEDIPROP(4);
  12608.  
  12609.   DIPROP_DEADZONE = MAKEDIPROP(5);
  12610.  
  12611.   DIPROP_SATURATION = MAKEDIPROP(6);
  12612.  
  12613.   DIPROP_FFGAIN = MAKEDIPROP(7);
  12614.  
  12615.   DIPROP_FFLOAD = MAKEDIPROP(8);
  12616.  
  12617.   DIPROP_AUTOCENTER = MAKEDIPROP(9);
  12618.  
  12619.   DIPROPAUTOCENTER_OFF = 0;
  12620.   DIPROPAUTOCENTER_ON = 1;
  12621.  
  12622.   DIPROP_CALIBRATIONMODE = MAKEDIPROP(10);
  12623.  
  12624.   DIPROPCALIBRATIONMODE_COOKED = 0;
  12625.   DIPROPCALIBRATIONMODE_RAW = 1;
  12626.  
  12627.   DIPROP_CALIBRATION      = MAKEDIPROP(11);
  12628.  
  12629.   DIPROP_GUIDANDPATH      = MAKEDIPROP(12);
  12630.  
  12631.   DIPROP_INSTANCENAME     = MAKEDIPROP(13);
  12632.  
  12633.   DIPROP_PRODUCTNAME      = MAKEDIPROP(14);
  12634.  
  12635.   DIPROP_JOYSTICKID       = MAKEDIPROP(15);
  12636.  
  12637.   DIPROP_GETPORTDISPLAYNAME       = MAKEDIPROP(16);
  12638.  
  12639.  
  12640.   DIPROP_ENABLEREPORTID       = MAKEDIPROP(17);
  12641.  
  12642.  
  12643.   DIPROP_GETPHYSICALRANGE            = MAKEDIPROP(18);
  12644.  
  12645.   DIPROP_GETLOGICALRANGE            = MAKEDIPROP(19);
  12646.  
  12647.  
  12648. type
  12649.   PDIDeviceObjectData = ^TDIDeviceObjectData;
  12650.   TDIDeviceObjectData = packed record
  12651.     dwOfs: DWORD;
  12652.     dwData: DWORD;
  12653.     dwTimeStamp: DWORD;
  12654.     dwSequence: DWORD;
  12655.   end;
  12656.  
  12657. const
  12658.   DIGDD_PEEK = $00000001;
  12659. {
  12660. #define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \
  12661.                          (int) ((dwSequence1) - (dwSequence2))  cmp 0
  12662. }
  12663.  
  12664.   DISCL_EXCLUSIVE  = $00000001;
  12665.   DISCL_NONEXCLUSIVE = $00000002;
  12666.   DISCL_FOREGROUND = $00000004;
  12667.   DISCL_BACKGROUND = $00000008;
  12668.   DISCL_NOWINKEY   = $00000010;
  12669.  
  12670.  
  12671. type
  12672.  
  12673.   PDIDeviceInstance_DX3A = ^TDIDeviceInstance_DX3A;
  12674.   TDIDeviceInstance_DX3A = packed record
  12675.     dwSize: DWORD;
  12676.     guidInstance: TGUID;
  12677.     guidProduct: TGUID;
  12678.     dwDevType: DWORD;
  12679.     tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
  12680.     tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
  12681.   end;
  12682.  
  12683.   PDIDeviceInstance_DX3W = ^TDIDeviceInstance_DX3W;
  12684.   TDIDeviceInstance_DX3W = packed record
  12685.     dwSize: DWORD;
  12686.     guidInstance: TGUID;
  12687.     guidProduct: TGUID;
  12688.     dwDevType: DWORD;
  12689.     tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
  12690.     tszProductName: Array [0..MAX_PATH-1] of WideChar;
  12691.   end;
  12692.  
  12693.   PDIDeviceInstance_DX3 = ^TDIDeviceInstance_DX3;
  12694. {$IFDEF UNICODE}
  12695.   TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3W;
  12696. {$ELSE}
  12697.   TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3A;
  12698. {$ENDIF}
  12699.  
  12700.   PDIDeviceInstance_DX5A = ^TDIDeviceInstance_DX5A;
  12701.   TDIDeviceInstance_DX5A = packed record
  12702.     dwSize: DWORD;
  12703.     guidInstance: TGUID;
  12704.     guidProduct: TGUID;
  12705.     dwDevType: DWORD;
  12706.     tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
  12707.     tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
  12708.     guidFFDriver: TGUID;
  12709.     wUsagePage: WORD;
  12710.     wUsage: WORD;
  12711.   end;
  12712.  
  12713.   PDIDeviceInstance_DX5W = ^TDIDeviceInstance_DX5W;
  12714.   TDIDeviceInstance_DX5W = packed record
  12715.     dwSize: DWORD;
  12716.     guidInstance: TGUID;
  12717.     guidProduct: TGUID;
  12718.     dwDevType: DWORD;
  12719.     tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
  12720.     tszProductName: Array [0..MAX_PATH-1] of WideChar;
  12721.     guidFFDriver: TGUID;
  12722.     wUsagePage: WORD;
  12723.     wUsage: WORD;
  12724.   end;
  12725.  
  12726.   PDIDeviceInstance_DX5 = ^TDIDeviceInstance_DX5;
  12727. {$IFDEF UNICODE}
  12728.   TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5W;
  12729. {$ELSE}
  12730.   TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5A;
  12731. {$ENDIF}
  12732.  
  12733.   PDIDeviceInstanceA = ^TDIDeviceInstanceA;
  12734.   PDIDeviceInstanceW = ^TDIDeviceInstanceW;
  12735.   PDIDeviceInstance = ^TDIDeviceInstance;
  12736. {$IFDEF DIRECTX3}
  12737.   TDIDeviceInstanceA = TDIDeviceInstance_DX3A;
  12738.   TDIDeviceInstanceW = TDIDeviceInstance_DX3W;
  12739.   TDIDeviceInstance = TDIDeviceInstance_DX3;
  12740. {$ELSE}
  12741.   TDIDeviceInstanceA = TDIDeviceInstance_DX5A;
  12742.   TDIDeviceInstanceW = TDIDeviceInstance_DX5W;
  12743.   TDIDeviceInstance = TDIDeviceInstance_DX5;
  12744. {$ENDIF}
  12745.  
  12746.   IDirectInputDeviceA = interface (IUnknown)
  12747.     ['{5944E680-C92E-11CF-BFC7-444553540000}']
  12748.     (*** IDirectInputDeviceA methods ***)
  12749.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
  12750.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA;
  12751.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  12752.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12753.         HResult;  stdcall;
  12754.     function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader) :
  12755.         HResult;  stdcall;
  12756.     function Acquire : HResult;  stdcall;
  12757.     function Unacquire : HResult;  stdcall;
  12758.     function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
  12759.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
  12760.         var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12761.     function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
  12762.     function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
  12763.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12764.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj: DWORD;
  12765.         dwHow: DWORD) : HResult;  stdcall;
  12766.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceA) : HResult;  stdcall;
  12767.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12768.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
  12769.   end;
  12770.  
  12771.   IDirectInputDeviceW = interface (IUnknown)
  12772.     ['{5944E681-C92E-11CF-BFC7-444553540000}']
  12773.     (*** IDirectInputDeviceW methods ***)
  12774.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
  12775.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW;
  12776.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  12777.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12778.         HResult;  stdcall;
  12779.     function SetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12780.         HResult;  stdcall;
  12781.     function Acquire : HResult;  stdcall;
  12782.     function Unacquire : HResult;  stdcall;
  12783.     function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
  12784.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
  12785.         var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12786.     function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
  12787.     function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
  12788.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12789.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj: DWORD;
  12790.         dwHow: DWORD) : HResult;  stdcall;
  12791.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceW) : HResult;  stdcall;
  12792.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12793.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
  12794.   end;
  12795.  
  12796. {$IFDEF UNICODE}
  12797.   IDirectInputDevice = IDirectInputDeviceW;
  12798. {$ELSE}
  12799.   IDirectInputDevice = IDirectInputDeviceA;
  12800. {$ENDIF}
  12801.  
  12802. const
  12803.   DISFFC_RESET            = $00000001;
  12804.   DISFFC_STOPALL          = $00000002;
  12805.   DISFFC_PAUSE            = $00000004;
  12806.   DISFFC_CONTINUE         = $00000008;
  12807.   DISFFC_SETACTUATORSON   = $00000010;
  12808.   DISFFC_SETACTUATORSOFF  = $00000020;
  12809.  
  12810.   DIGFFS_EMPTY            = $00000001;
  12811.   DIGFFS_STOPPED          = $00000002;
  12812.   DIGFFS_PAUSED           = $00000004;
  12813.   DIGFFS_ACTUATORSON      = $00000010;
  12814.   DIGFFS_ACTUATORSOFF     = $00000020;
  12815.   DIGFFS_POWERON          = $00000040;
  12816.   DIGFFS_POWEROFF         = $00000080;
  12817.   DIGFFS_SAFETYSWITCHON   = $00000100;
  12818.   DIGFFS_SAFETYSWITCHOFF  = $00000200;
  12819.   DIGFFS_USERFFSWITCHON   = $00000400;
  12820.   DIGFFS_USERFFSWITCHOFF  = $00000800;
  12821.   DIGFFS_DEVICELOST       = $80000000;
  12822.  
  12823. type
  12824.   PDIEffectInfoA = ^TDIEffectInfoA;
  12825.   TDIEffectInfoA = packed record
  12826.     dwSize : DWORD;
  12827.     guid : TGUID;
  12828.     dwEffType : DWORD;
  12829.     dwStaticParams : DWORD;
  12830.     dwDynamicParams : DWORD;
  12831.     tszName : array [0..MAX_PATH-1] of CHAR;
  12832.   end;
  12833.  
  12834.   PDIEffectInfoW = ^TDIEffectInfoW;
  12835.   TDIEffectInfoW = packed record
  12836.     dwSize : DWORD;
  12837.     guid : TGUID;
  12838.     dwEffType : DWORD;
  12839.     dwStaticParams : DWORD;
  12840.     dwDynamicParams : DWORD;
  12841.     tszName : array [0..MAX_PATH-1] of WCHAR;
  12842.   end;
  12843.  
  12844.   PDIEffectInfo = ^TDIEffectInfo;
  12845. {$IFDEF UNICODE}
  12846.   TDIEffectInfo = TDIEffectInfoW;
  12847. {$ELSE}
  12848.   TDIEffectInfo = TDIEffectInfoA;
  12849. {$ENDIF}
  12850.  
  12851. const
  12852.   DISDD_CONTINUE          = $00000001;
  12853.  
  12854.   // Bug fix & deviation from the SDK: Must return DIENUM_STOP or
  12855.   // DIENUM_CONTINUE (=1) in order to work with the debug version of DINPUT.DLL
  12856. type
  12857.   TDIEnumEffectsCallbackA =
  12858.       function(var pdei: TDIEffectInfoA; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
  12859.   TDIEnumEffectsCallbackW =
  12860.       function(var pdei: TDIEffectInfoW; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
  12861.   TDIEnumEffectsCallback =
  12862.       function(var pdei: TDIEffectInfo; pvRef: pointer) : Integer; stdcall; // BOOL; stdcall;
  12863.   TDIEnumEffectsProc = TDIEnumEffectsCallback;
  12864.  
  12865.   TDIEnumCreatedEffectObjectsCallback =
  12866.       function(peff: IDirectInputEffect; pvRev: pointer): Integer; stdcall; // BOOL; stdcall;
  12867.   TDIEnumCreatedEffectObjectsProc = TDIEnumCreatedEffectObjectsCallback;
  12868.  
  12869.   IDirectInputDevice2A = interface (IDirectInputDeviceA)
  12870.     ['{5944E682-C92E-11CF-BFC7-444553540000}']
  12871.     (*** IDirectInputDevice2A methods ***)
  12872.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
  12873.         var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
  12874.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackA;
  12875.         pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
  12876.     function GetEffectInfo(pdei: TDIEffectInfoA; const rguid: TGUID) : HResult;  stdcall;
  12877.     function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
  12878.     function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
  12879.     function EnumCreatedEffectObjects(lpCallback:
  12880.         TDIEnumCreatedEffectObjectsCallback;
  12881.         pvRef: pointer; fl: DWORD) : HResult;  stdcall;
  12882.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12883.     function Poll : HResult;  stdcall;
  12884.     function SendDeviceData
  12885.         (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  12886.         var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
  12887.   end;
  12888.  
  12889.   IDirectInputDevice2W = interface (IDirectInputDeviceW)
  12890.     ['{5944E683-C92E-11CF-BFC7-444553540000}']
  12891.     (*** IDirectInputDevice2W methods ***)
  12892.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
  12893.         var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
  12894.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackW;
  12895.         pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
  12896.     function GetEffectInfo(pdei: TDIEffectInfoW; const rguid: TGUID) : HResult;  stdcall;
  12897.     function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
  12898.     function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
  12899.     function EnumCreatedEffectObjects(lpCallback:
  12900.         TDIEnumCreatedEffectObjectsCallback;
  12901.         pvRef: pointer; fl: DWORD) : HResult;  stdcall;
  12902.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12903.     function Poll : HResult;  stdcall;
  12904.     function SendDeviceData
  12905.         (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  12906.         var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
  12907.   end;
  12908.  
  12909. {$IFDEF UNICODE}
  12910.   IDirectInputDevice2 = IDirectInputDevice2W;
  12911. {$ELSE}
  12912.   IDirectInputDevice2 = IDirectInputDevice2A;
  12913. {$ENDIF}
  12914.  
  12915. const
  12916.   DIFEF_DEFAULT               = $00000000;
  12917.   DIFEF_INCLUDENONSTANDARD    = $00000001;
  12918.   DIFEF_MODIFYIFNEEDED          = $00000010;
  12919.  
  12920. ///Weitermachen:  (as: nur die Deklarationen eingefüllt, die ich zum Testen gebraucht habe)
  12921.  
  12922. type
  12923.   TEnumEffectsInFileCallback = function(gaga, huhu: Integer): HResult;
  12924.  
  12925. type
  12926.   IDirectInputDevice7W = interface (IDirectInputDevice2W)
  12927.     ['{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}']
  12928.     (*** IDirectInputDevice7A methods ***)
  12929.     function EnumEffectsInFile(const lpszFileName: PChar;
  12930.       pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
  12931.     function WriteEffectToFile(const lpszFileName: PChar;
  12932.       dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
  12933.   end;
  12934.  
  12935.   IDirectInputDevice7A = interface (IDirectInputDevice2A)
  12936.     ['{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}']
  12937.     function EnumEffectsInFile(const lpszFileName: PChar;
  12938.       pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
  12939.     function WriteEffectToFile(const lpszFileName: PChar;
  12940.       dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
  12941.   end;
  12942.  
  12943. {$IFDEF UNICODE}
  12944.   IDirectInputDevice7 = IDirectInputDevice7W;
  12945. {$ELSE}
  12946.   IDirectInputDevice7 = IDirectInputDevice7A;
  12947. {$ENDIF}
  12948.  
  12949. (****************************************************************************
  12950.  *
  12951.  *      Mouse
  12952.  *
  12953.  ****************************************************************************)
  12954.  
  12955. type
  12956.   PDIMouseState = ^TDIMouseState;
  12957.   TDIMouseState = packed record
  12958.     lX: Longint;
  12959.     lY: Longint;
  12960.     lZ: Longint;
  12961.     rgbButtons: Array [0..3] of BYTE;  // up to 4 buttons
  12962.   end;
  12963.  
  12964.   PDIMouseState2 = ^TDIMouseState2;
  12965.   TDIMouseState2 = packed record
  12966.     lX: Longint;
  12967.     lY: Longint;
  12968.     lZ: Longint;
  12969.     rgbButtons: Array [0..7] of BYTE;  // up to 8 buttons
  12970.   end;
  12971.  
  12972. const
  12973.   DIMOFS_X       = 0;
  12974.   DIMOFS_Y       = 4;
  12975.   DIMOFS_Z       = 8;
  12976.   DIMOFS_BUTTON0 = 12;
  12977.   DIMOFS_BUTTON1 = 13;
  12978.   DIMOFS_BUTTON2 = 14;
  12979.   DIMOFS_BUTTON3 = 15;
  12980.   // DX7 supports up to 8 mouse buttons
  12981.   DIMOFS_BUTTON4 = DIMOFS_BUTTON0+4;
  12982.   DIMOFS_BUTTON5 = DIMOFS_BUTTON0+5;
  12983.   DIMOFS_BUTTON6 = DIMOFS_BUTTON0+6;
  12984.   DIMOFS_BUTTON7 = DIMOFS_BUTTON0+7;
  12985.  
  12986.  
  12987. const
  12988.   _c_dfDIMouse_Objects: array[0..6] of TDIObjectDataFormat = (
  12989.     (  pguid: @GUID_XAxis;
  12990.        dwOfs: DIMOFS_X;
  12991.        dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
  12992.        dwFlags: 0),
  12993.     (  pguid: @GUID_YAxis;
  12994.        dwOfs: DIMOFS_Y;
  12995.        dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
  12996.        dwFlags: 0),
  12997.     (  pguid: @GUID_ZAxis;
  12998.        dwOfs: DIMOFS_Z;
  12999.        dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION;
  13000.        dwFlags: 0),
  13001.     (  pguid: nil;
  13002.        dwOfs: DIMOFS_BUTTON0;
  13003.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13004.        dwFlags: 0),
  13005.     (  pguid: nil;
  13006.        dwOfs: DIMOFS_BUTTON1;
  13007.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13008.        dwFlags: 0),
  13009.     (  pguid: nil;
  13010.        dwOfs: DIMOFS_BUTTON2;
  13011.        dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13012.        dwFlags: 0),
  13013.     (  pguid: nil;
  13014.        dwOfs: DIMOFS_BUTTON3;
  13015.        dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13016.        dwFlags: 0)
  13017.     );
  13018.  
  13019.   c_dfDIMouse: TDIDataFormat = (
  13020.     dwSize: Sizeof(c_dfDIMouse);              // $18
  13021.     dwObjSize: Sizeof(TDIObjectDataFormat);   // $10
  13022.     dwFlags: DIDF_RELAXIS;                    //
  13023.     dwDataSize: Sizeof(TDIMouseState);        // $10
  13024.     dwNumObjs: High(_c_dfDIMouse_Objects)+1;  // 7
  13025.     rgodf: @_c_dfDIMouse_Objects[Low(_c_dfDIMouse_Objects)]
  13026.   );
  13027.  
  13028.  
  13029.   _c_dfDIMouse2_Objects: array[0..10] of TDIObjectDataFormat = (
  13030.     (  pguid: @GUID_XAxis;
  13031.        dwOfs: DIMOFS_X;
  13032.        dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
  13033.        dwFlags: 0),
  13034.     (  pguid: @GUID_YAxis;
  13035.        dwOfs: DIMOFS_Y;
  13036.        dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
  13037.        dwFlags: 0),
  13038.     (  pguid: @GUID_ZAxis;
  13039.        dwOfs: DIMOFS_Z;
  13040.        dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION;
  13041.        dwFlags: 0),
  13042.     (  pguid: nil;
  13043.        dwOfs: DIMOFS_BUTTON0;
  13044.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13045.        dwFlags: 0),
  13046.     (  pguid: nil;
  13047.        dwOfs: DIMOFS_BUTTON1;
  13048.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13049.        dwFlags: 0),
  13050.     (  pguid: nil;
  13051.        dwOfs: DIMOFS_BUTTON2;
  13052.        dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13053.        dwFlags: 0),
  13054.     (  pguid: nil;
  13055.        dwOfs: DIMOFS_BUTTON3;
  13056.        dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13057.        dwFlags: 0),
  13058.     // fields introduced with IDirectInputDevice7.GetDeviceState      
  13059.     (  pguid: nil;
  13060.        dwOfs: DIMOFS_BUTTON4;
  13061.        dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13062.        dwFlags: 0),
  13063.     (  pguid: nil;
  13064.        dwOfs: DIMOFS_BUTTON5;
  13065.        dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13066.        dwFlags: 0),
  13067.     (  pguid: nil;
  13068.        dwOfs: DIMOFS_BUTTON6;
  13069.        dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13070.        dwFlags: 0),
  13071.     (  pguid: nil;
  13072.        dwOfs: DIMOFS_BUTTON7;
  13073.        dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13074.        dwFlags: 0)
  13075.     );
  13076.  
  13077.   c_dfDIMouse2: TDIDataFormat = (
  13078.     dwSize: Sizeof(c_dfDIMouse);              // $18
  13079.     dwObjSize: Sizeof(TDIObjectDataFormat);   // $10
  13080.     dwFlags: DIDF_RELAXIS;                    //
  13081.     dwDataSize: Sizeof(TDIMouseState2);        // $14
  13082.     dwNumObjs: High(_c_dfDIMouse_Objects)+1;  // 11
  13083.     rgodf: @_c_dfDIMouse2_Objects[Low(_c_dfDIMouse2_Objects)]
  13084.   );
  13085.  
  13086.  
  13087. (****************************************************************************
  13088.  *
  13089.  *      DirectInput keyboard scan codes
  13090.  *
  13091.  ****************************************************************************)
  13092.  
  13093. const
  13094.   DIK_ESCAPE          = $01;
  13095.   DIK_1               = $02;
  13096.   DIK_2               = $03;
  13097.   DIK_3               = $04;
  13098.   DIK_4               = $05;
  13099.   DIK_5               = $06;
  13100.   DIK_6               = $07;
  13101.   DIK_7               = $08;
  13102.   DIK_8               = $09;
  13103.   DIK_9               = $0A;
  13104.   DIK_0               = $0B;
  13105.   DIK_MINUS           = $0C;    (* - on main keyboard *)
  13106.   DIK_EQUALS          = $0D;
  13107.   DIK_BACK            = $0E;    (* backspace *)
  13108.   DIK_TAB             = $0F;
  13109.   DIK_Q               = $10;
  13110.   DIK_W               = $11;
  13111.   DIK_E               = $12;
  13112.   DIK_R               = $13;
  13113.   DIK_T               = $14;
  13114.   DIK_Y               = $15;
  13115.   DIK_U               = $16;
  13116.   DIK_I               = $17;
  13117.   DIK_O               = $18;
  13118.   DIK_P               = $19;
  13119.   DIK_LBRACKET        = $1A;
  13120.   DIK_RBRACKET        = $1B;
  13121.   DIK_RETURN          = $1C;    (* Enter on main keyboard *)
  13122.   DIK_LCONTROL        = $1D;
  13123.   DIK_A               = $1E;
  13124.   DIK_S               = $1F;
  13125.   DIK_D               = $20;
  13126.   DIK_F               = $21;
  13127.   DIK_G               = $22;
  13128.   DIK_H               = $23;
  13129.   DIK_J               = $24;
  13130.   DIK_K               = $25;
  13131.   DIK_L               = $26;
  13132.   DIK_SEMICOLON       = $27;
  13133.   DIK_APOSTROPHE      = $28;
  13134.   DIK_GRAVE           = $29;    (* accent grave *)
  13135.   DIK_LSHIFT          = $2A;
  13136.   DIK_BACKSLASH       = $2B;
  13137.   DIK_Z               = $2C;
  13138.   DIK_X               = $2D;
  13139.   DIK_C               = $2E;
  13140.   DIK_V               = $2F;
  13141.   DIK_B               = $30;
  13142.   DIK_N               = $31;
  13143.   DIK_M               = $32;
  13144.   DIK_COMMA           = $33;
  13145.   DIK_PERIOD          = $34;    (* . on main keyboard *)
  13146.   DIK_SLASH           = $35;    (* / on main keyboard *)
  13147.   DIK_RSHIFT          = $36;
  13148.   DIK_MULTIPLY        = $37;    (* * on numeric keypad *)
  13149.   DIK_LMENU           = $38;    (* left Alt *)
  13150.   DIK_SPACE           = $39;
  13151.   DIK_CAPITAL         = $3A;
  13152.   DIK_F1              = $3B;
  13153.   DIK_F2              = $3C;
  13154.   DIK_F3              = $3D;
  13155.   DIK_F4              = $3E;
  13156.   DIK_F5              = $3F;
  13157.   DIK_F6              = $40;
  13158.   DIK_F7              = $41;
  13159.   DIK_F8              = $42;
  13160.   DIK_F9              = $43;
  13161.   DIK_F10             = $44;
  13162.   DIK_NUMLOCK         = $45;
  13163.   DIK_SCROLL          = $46;    (* Scroll Lock *)
  13164.   DIK_NUMPAD7         = $47;
  13165.   DIK_NUMPAD8         = $48;
  13166.   DIK_NUMPAD9         = $49;
  13167.   DIK_SUBTRACT        = $4A;    (* - on numeric keypad *)
  13168.   DIK_NUMPAD4         = $4B;
  13169.   DIK_NUMPAD5         = $4C;
  13170.   DIK_NUMPAD6         = $4D;
  13171.   DIK_ADD             = $4E;    (* + on numeric keypad *)
  13172.   DIK_NUMPAD1         = $4F;
  13173.   DIK_NUMPAD2         = $50;
  13174.   DIK_NUMPAD3         = $51;
  13175.   DIK_NUMPAD0         = $52;
  13176.   DIK_DECIMAL         = $53;    (* . on numeric keypad *)
  13177.   // $54 to $56 unassigned
  13178.   DIK_F11             = $57;
  13179.   DIK_F12             = $58;
  13180.   // $59 to $63 unassigned
  13181.   DIK_F13             = $64;    (*                     (NEC PC98) *)
  13182.   DIK_F14             = $65;    (*                     (NEC PC98) *)
  13183.   DIK_F15             = $66;    (*                     (NEC PC98) *)
  13184.   // $67 to $6F unassigned
  13185.   DIK_KANA            = $70;    (* (Japanese keyboard)            *)
  13186.   DIK_CONVERT         = $79;    (* (Japanese keyboard)            *)
  13187.   DIK_NOCONVERT       = $7B;    (* (Japanese keyboard)            *)
  13188.   DIK_YEN             = $7D;    (* (Japanese keyboard)            *)
  13189.   DIK_NUMPADEQUALS    = $8D;    (* = on numeric keypad (NEC PC98) *)
  13190.   // $8E to $8F unassigned
  13191.   DIK_CIRCUMFLEX      = $90;    (* (Japanese keyboard)            *)
  13192.   DIK_AT              = $91;    (*                     (NEC PC98) *)
  13193.   DIK_COLON           = $92;    (*                     (NEC PC98) *)
  13194.   DIK_UNDERLINE       = $93;    (*                     (NEC PC98) *)
  13195.   DIK_KANJI           = $94;    (* (Japanese keyboard)            *)
  13196.   DIK_STOP            = $95;    (*                     (NEC PC98) *)
  13197.   DIK_AX              = $96;    (*                     (Japan AX) *)
  13198.   DIK_UNLABELED       = $97;    (*                        (J3100) *)
  13199.   // $98 to $99 unassigned
  13200.   DIK_NUMPADENTER     = $9C;    (* Enter on numeric keypad *)
  13201.   DIK_RCONTROL        = $9D;
  13202.   // $9E to $B2 unassigned
  13203.   DIK_NUMPADCOMMA     = $B3;    (* , on numeric keypad (NEC PC98) *)
  13204.   // $B4 unassigned
  13205.   DIK_DIVIDE          = $B5;    (* / on numeric keypad *)
  13206.   // $B6 unassigned
  13207.   DIK_SYSRQ           = $B7;
  13208.   DIK_RMENU           = $B8;    (* right Alt *)
  13209.   // $B9 to $C4 unassigned
  13210.   DIK_PAUSE           = $C5;    (* Pause (watch out - not realiable on some kbds) *)
  13211.   // $C6 unassigned
  13212.   DIK_HOME            = $C7;    (* Home on arrow keypad *)
  13213.   DIK_UP              = $C8;    (* UpArrow on arrow keypad *)
  13214.   DIK_PRIOR           = $C9;    (* PgUp on arrow keypad *)
  13215.   // $CA unassigned
  13216.   DIK_LEFT            = $CB;    (* LeftArrow on arrow keypad *)
  13217.   DIK_RIGHT           = $CD;    (* RightArrow on arrow keypad *)
  13218.   // $CF unassigned
  13219.   DIK_END             = $CF;    (* End on arrow keypad *)
  13220.   DIK_DOWN            = $D0;    (* DownArrow on arrow keypad *)
  13221.   DIK_NEXT            = $D1;    (* PgDn on arrow keypad *)
  13222.   DIK_INSERT          = $D2;    (* Insert on arrow keypad *)
  13223.   DIK_DELETE          = $D3;    (* Delete on arrow keypad *)
  13224.   DIK_LWIN            = $DB;    (* Left Windows key *)
  13225.   DIK_RWIN            = $DC;    (* Right Windows key *)
  13226.   DIK_APPS            = $DD;    (* AppMenu key *)
  13227.   // New with DX 6.1 & Win98
  13228.   DIK_POWER           = $DE;
  13229.   DIK_SLEEP           = $DF;
  13230.   // $E0 to $E2 unassigned
  13231.   // $E3 = Wake up ("translated" in German DInput to "Kielwasser" (ship's wake) ;-)
  13232.  
  13233. (*
  13234.  *  Alternate names for keys, to facilitate transition from DOS.
  13235.  *)
  13236.   DIK_BACKSPACE      = DIK_BACK    ;        (* backspace *)
  13237.   DIK_NUMPADSTAR     = DIK_MULTIPLY;        (* * on numeric keypad *)
  13238.   DIK_LALT           = DIK_LMENU   ;        (* left Alt *)
  13239.   DIK_CAPSLOCK       = DIK_CAPITAL ;        (* CapsLock *)
  13240.   DIK_NUMPADMINUS    = DIK_SUBTRACT;        (* - on numeric keypad *)
  13241.   DIK_NUMPADPLUS     = DIK_ADD     ;        (* + on numeric keypad *)
  13242.   DIK_NUMPADPERIOD   = DIK_DECIMAL ;        (* . on numeric keypad *)
  13243.   DIK_NUMPADSLASH    = DIK_DIVIDE  ;        (* / on numeric keypad *)
  13244.   DIK_RALT           = DIK_RMENU   ;        (* right Alt *)
  13245.   DIK_UPARROW        = DIK_UP      ;        (* UpArrow on arrow keypad *)
  13246.   DIK_PGUP           = DIK_PRIOR   ;        (* PgUp on arrow keypad *)
  13247.   DIK_LEFTARROW      = DIK_LEFT    ;        (* LeftArrow on arrow keypad *)
  13248.   DIK_RIGHTARROW     = DIK_RIGHT   ;        (* RightArrow on arrow keypad *)
  13249.   DIK_DOWNARROW      = DIK_DOWN    ;        (* DownArrow on arrow keypad *)
  13250.   DIK_PGDN           = DIK_NEXT    ;        (* PgDn on arrow keypad *)
  13251.  
  13252. (****************************************************************************
  13253.  *
  13254.  *      Keyboard
  13255.  *
  13256.  ****************************************************************************)
  13257.  
  13258.  
  13259. type
  13260.   TDIKeyboardState = array[0..255] of Byte;
  13261. (*
  13262. const
  13263.   _c_dfDIKeyboard_Objects: array[0..255] of TDIObjectDataFormat = (
  13264.     (  pguid: @GUID_Key;
  13265.        dwOfs: DIK_ESCAPE;
  13266.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13267.        dwFlags: 0),
  13268.     // -------- top row (except function keys) on main kbd ------------
  13269.     (  pguid: @GUID_Key;
  13270.        dwOfs: DIK_1;  // "1" on main kbd, Offset 2
  13271.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13272.        dwFlags: 0),
  13273.     (  pguid: @GUID_Key;
  13274.        dwOfs: DIK_2;  // "2" on main kbd, Offset 3
  13275.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13276.        dwFlags: 0),
  13277.     (  pguid: @GUID_Key;
  13278.        dwOfs: DIK_3;  // "3" on main kbd, etc.
  13279.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13280.        dwFlags: 0),
  13281.     (  pguid: @GUID_Key;
  13282.        dwOfs: DIK_4;
  13283.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13284.        dwFlags: 0),
  13285.     (  pguid: @GUID_Key;
  13286.        dwOfs: DIK_5;
  13287.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13288.        dwFlags: 0),
  13289.     (  pguid: @GUID_Key;
  13290.        dwOfs: DIK_6;
  13291.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13292.        dwFlags: 0),
  13293.     (  pguid: @GUID_Key;
  13294.        dwOfs: DIK_7;
  13295.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13296.        dwFlags: 0),
  13297.     (  pguid: @GUID_Key;
  13298.        dwOfs: DIK_8;
  13299.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13300.        dwFlags: 0),
  13301.     (  pguid: @GUID_Key;
  13302.        dwOfs: DIK_9;
  13303.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13304.        dwFlags: 0),
  13305.     (  pguid: @GUID_Key;
  13306.        dwOfs: DIK_0;  // "0", main kbd
  13307.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13308.        dwFlags: 0),
  13309.     (  pguid: @GUID_Key;
  13310.        dwOfs: DIK_MINUS; // "-" on US kbds, "ß" on german kbds
  13311.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13312.        dwFlags: 0),
  13313.     (  pguid: @GUID_Key;
  13314.        dwOfs: DIK_EQUALS;  // "=" for US, "´" for german
  13315.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13316.        dwFlags: 0),
  13317.     (  pguid: @GUID_Key;
  13318.        dwOfs: DIK_BACK;  // backspace
  13319.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13320.        dwFlags: 0),
  13321.     // ----------- 2nd row -----------------------
  13322.     (  pguid: @GUID_Key;
  13323.        dwOfs: DIK_TAB;
  13324.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13325.        dwFlags: 0),
  13326.     (  pguid: @GUID_Key;
  13327.        dwOfs: DIK_Q;
  13328.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13329.        dwFlags: 0),
  13330.     (  pguid: @GUID_Key;
  13331.        dwOfs: DIK_W;
  13332.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13333.        dwFlags: 0),
  13334.     (  pguid: @GUID_Key;
  13335.        dwOfs: DIK_E;
  13336.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13337.        dwFlags: 0),
  13338.     (  pguid: @GUID_Key;
  13339.        dwOfs: DIK_R;
  13340.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13341.        dwFlags: 0),
  13342.     (  pguid: @GUID_Key;
  13343.        dwOfs: DIK_T;
  13344.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13345.        dwFlags: 0),
  13346.     (  pguid: @GUID_Key;
  13347.        dwOfs: DIK_Y;  // "Z" on german & french keyboards
  13348.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13349.        dwFlags: 0),
  13350.     (  pguid: @GUID_Key;
  13351.        dwOfs: DIK_U;
  13352.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13353.        dwFlags: 0),
  13354.     (  pguid: @GUID_Key;
  13355.        dwOfs: DIK_I;
  13356.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13357.        dwFlags: 0),
  13358.     (  pguid: @GUID_Key;
  13359.        dwOfs: DIK_O;
  13360.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13361.        dwFlags: 0),
  13362.     (  pguid: @GUID_Key;
  13363.        dwOfs: DIK_P;
  13364.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13365.        dwFlags: 0),
  13366.     (  pguid: @GUID_Key;
  13367.        dwOfs: DIK_LBRACKET;  // "Ãœ" on german keyboards
  13368.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13369.        dwFlags: 0),
  13370.     (  pguid: @GUID_Key;
  13371.        dwOfs: DIK_RBRACKET;  // "+" on german keyboards
  13372.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13373.        dwFlags: 0),
  13374.     (  pguid: @GUID_Key;
  13375.        dwOfs: DIK_RETURN;   // Enter on main kbd
  13376.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13377.        dwFlags: 0),
  13378.     // next row should really start with caps lock but doesn't ;-)
  13379.     // (DIK_CAPITAL is Offset $3A, i.e. after 4th row)
  13380.     (  pguid: @GUID_Key;
  13381.        dwOfs: DIK_LCONTROL;  // Left Ctrl (german kbds: "Strg")
  13382.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13383.        dwFlags: 0),
  13384.     // ----------- 3rd row ------------------------------
  13385.     (  pguid: @GUID_Key;
  13386.        dwOfs: DIK_A;
  13387.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13388.        dwFlags: 0),
  13389.     (  pguid: @GUID_Key;
  13390.        dwOfs: DIK_S;
  13391.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13392.        dwFlags: 0),
  13393.     (  pguid: @GUID_Key;
  13394.        dwOfs: DIK_D;
  13395.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13396.        dwFlags: 0),
  13397.     (  pguid: @GUID_Key;
  13398.        dwOfs: DIK_F;
  13399.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13400.        dwFlags: 0),
  13401.     (  pguid: @GUID_Key;
  13402.        dwOfs: DIK_G;
  13403.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13404.        dwFlags: 0),
  13405.     (  pguid: @GUID_Key;
  13406.        dwOfs: DIK_H;
  13407.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13408.        dwFlags: 0),
  13409.     (  pguid: @GUID_Key;
  13410.        dwOfs: DIK_J;
  13411.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13412.        dwFlags: 0),
  13413.     (  pguid: @GUID_Key;
  13414.        dwOfs: DIK_K;
  13415.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13416.        dwFlags: 0),
  13417.     (  pguid: @GUID_Key;
  13418.        dwOfs: DIK_L;
  13419.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13420.        dwFlags: 0),
  13421.     (  pguid: @GUID_Key;
  13422.        dwOfs: DIK_SEMICOLON;  // "Ö" on german kbds
  13423.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13424.        dwFlags: 0),
  13425.     (  pguid: @GUID_Key;
  13426.        dwOfs: DIK_APOSTROPHE;  // "Ä" on german kbds
  13427.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13428.        dwFlags: 0),
  13429.     (  pguid: @GUID_Key;
  13430.        dwOfs: DIK_GRAVE; // accent grave, "'" on german kbds
  13431.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13432.        dwFlags: 0),
  13433.     // ---------------- 4th row -----------------------
  13434.     (  pguid: @GUID_Key;
  13435.        dwOfs: DIK_LSHIFT;  // left shift
  13436.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13437.        dwFlags: 0),
  13438.     (  pguid: @GUID_Key;
  13439.        dwOfs: DIK_BACKSLASH;  // "<" on german kbds
  13440.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13441.        dwFlags: 0),
  13442.     (  pguid: @GUID_Key;
  13443.        dwOfs: DIK_Z;     // "Y" on german kbds
  13444.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13445.        dwFlags: 0),
  13446.     (  pguid: @GUID_Key;
  13447.        dwOfs: DIK_X;
  13448.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13449.        dwFlags: 0),
  13450.     (  pguid: @GUID_Key;
  13451.        dwOfs: DIK_C;
  13452.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13453.        dwFlags: 0),
  13454.     (  pguid: @GUID_Key;
  13455.        dwOfs: DIK_V;
  13456.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13457.        dwFlags: 0),
  13458.     (  pguid: @GUID_Key;
  13459.        dwOfs: DIK_B;
  13460.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13461.        dwFlags: 0),
  13462.     (  pguid: @GUID_Key;
  13463.        dwOfs: DIK_N;
  13464.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13465.        dwFlags: 0),
  13466.     (  pguid: @GUID_Key;
  13467.        dwOfs: DIK_M;
  13468.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13469.        dwFlags: 0),
  13470.     (  pguid: @GUID_Key;
  13471.        dwOfs: DIK_COMMA;
  13472.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13473.        dwFlags: 0),
  13474.     (  pguid: @GUID_Key;
  13475.        dwOfs: DIK_PERIOD;  // on main kbd
  13476.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13477.        dwFlags: 0),
  13478.     (  pguid: @GUID_Key;
  13479.        dwOfs: DIK_SLASH;  // "-" on german kbds
  13480.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13481.        dwFlags: 0),
  13482.     (  pguid: @GUID_Key;
  13483.        dwOfs: DIK_RSHIFT;
  13484.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13485.        dwFlags: 0),
  13486.     // --- misc keys (bye, bye, order) ----------------
  13487.     (  pguid: @GUID_Key;
  13488.        dwOfs: DIK_MULTIPLY;  // on numeric keypad
  13489.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13490.        dwFlags: 0),
  13491.     (  pguid: @GUID_Key;
  13492.        dwOfs: DIK_LMENU;  // left ALT
  13493.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13494.        dwFlags: 0),
  13495.     (  pguid: @GUID_Key;
  13496.        dwOfs: DIK_SPACE;  // space bar
  13497.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13498.        dwFlags: 0),
  13499.     (  pguid: @GUID_Key;
  13500.        dwOfs: DIK_CAPITAL;   // caps lock (on main kbd, above LSHIFT)
  13501.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13502.        dwFlags: 0),
  13503.     // ---------- function keys -----------
  13504.     (  pguid: @GUID_Key;
  13505.        dwOfs: DIK_F1;
  13506.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13507.        dwFlags: 0),
  13508.     (  pguid: @GUID_Key;
  13509.        dwOfs: DIK_F2;
  13510.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13511.        dwFlags: 0),
  13512.     (  pguid: @GUID_Key;
  13513.        dwOfs: DIK_F3;
  13514.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13515.        dwFlags: 0),
  13516.     (  pguid: @GUID_Key;
  13517.        dwOfs: DIK_F4;
  13518.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13519.        dwFlags: 0),
  13520.     (  pguid: @GUID_Key;
  13521.        dwOfs: DIK_F5;
  13522.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13523.        dwFlags: 0),
  13524.     (  pguid: @GUID_Key;
  13525.        dwOfs: DIK_F6;
  13526.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13527.        dwFlags: 0),
  13528.     (  pguid: @GUID_Key;
  13529.        dwOfs: DIK_F7;
  13530.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13531.        dwFlags: 0),
  13532.     (  pguid: @GUID_Key;
  13533.        dwOfs: DIK_F8;
  13534.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13535.        dwFlags: 0),
  13536.     (  pguid: @GUID_Key;
  13537.        dwOfs: DIK_F9;
  13538.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13539.        dwFlags: 0),
  13540.     (  pguid: @GUID_Key;
  13541.        dwOfs: DIK_F10;
  13542.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13543.        dwFlags: 0),
  13544.     // ------- F11, F12 after numeric keypad (for "historical reasons" -- XT kbd)
  13545.  
  13546.     // --------- numeric keypad (mostly, that is) -----------
  13547.     (  pguid: @GUID_Key;
  13548.        dwOfs: DIK_NUMLOCK;   // numeric keypad
  13549.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13550.        dwFlags: 0),
  13551.     (  pguid: @GUID_Key;
  13552.        dwOfs: DIK_SCROLL;  // scroll lock
  13553.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13554.        dwFlags: 0),
  13555.     (  pguid: @GUID_Key;
  13556.        dwOfs: DIK_NUMPAD7;
  13557.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13558.        dwFlags: 0),
  13559.     (  pguid: @GUID_Key;
  13560.        dwOfs: DIK_NUMPAD8;
  13561.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13562.        dwFlags: 0),
  13563.     (  pguid: @GUID_Key;
  13564.        dwOfs: DIK_NUMPAD9;
  13565.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13566.        dwFlags: 0),
  13567.     (  pguid: @GUID_Key;
  13568.        dwOfs: DIK_SUBTRACT;  // "-" on numeric keypad
  13569.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13570.        dwFlags: 0),
  13571.     (  pguid: @GUID_Key;
  13572.        dwOfs: DIK_NUMPAD4;
  13573.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13574.        dwFlags: 0),
  13575.     (  pguid: @GUID_Key;
  13576.        dwOfs: DIK_NUMPAD5;
  13577.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13578.        dwFlags: 0),
  13579.     (  pguid: @GUID_Key;
  13580.        dwOfs: DIK_NUMPAD6;
  13581.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13582.        dwFlags: 0),
  13583.     (  pguid: @GUID_Key;
  13584.        dwOfs: DIK_ADD;   // "+" on numeric keypad
  13585.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13586.        dwFlags: 0),
  13587.     (  pguid: @GUID_Key;
  13588.        dwOfs: DIK_NUMPAD1;
  13589.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13590.        dwFlags: 0),
  13591.     (  pguid: @GUID_Key;
  13592.        dwOfs: DIK_NUMPAD2;
  13593.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13594.        dwFlags: 0),
  13595.     (  pguid: @GUID_Key;
  13596.        dwOfs: DIK_NUMPAD3;
  13597.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13598.        dwFlags: 0),
  13599.     (  pguid: @GUID_Key;
  13600.        dwOfs: DIK_NUMPAD0;  // "0" or "Insert" on numeric keypad
  13601.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13602.        dwFlags: 0),
  13603.     (  pguid: @GUID_Key;
  13604.        dwOfs: DIK_DECIMAL;  // "." or "Del" on numeric keypad
  13605.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13606.        dwFlags: 0),
  13607.     (  pguid: @GUID_Key;
  13608.        dwOfs: $54;
  13609.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13610.        dwFlags: 0),
  13611.     // "extended" function keys; F13 to F15 only on NEC PC98
  13612.     (  pguid: @GUID_Key;
  13613.        dwOfs: DIK_F11;
  13614.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13615.        dwFlags: 0),
  13616.     (  pguid: @GUID_Key;
  13617.        dwOfs: DIK_F12;
  13618.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13619.        dwFlags: 0),
  13620.     // -------------------------------------------------
  13621.     // a whole lot of keys for asian kbds only
  13622.     // -------------------------------------------------
  13623.     (  pguid: @GUID_Key;
  13624.        dwOfs: DIK_NUMPADENTER;  // Enter on numeric keypad
  13625.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13626.        dwFlags: 0),
  13627.     (  pguid: @GUID_Key;
  13628.        dwOfs: DIK_RCONTROL;        // right Ctrl on main kbd
  13629.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13630.        dwFlags: 0),
  13631.     (  pguid: @GUID_Key;   // "," on numeric keypad (NEC PC98 only)
  13632.        dwOfs: DIK_NUMPADCOMMA;
  13633.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13634.        dwFlags: 0),
  13635.     (  pguid: @GUID_Key;
  13636.        dwOfs: DIK_DIVIDE;   // "/" on numeric keypad
  13637.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13638.        dwFlags: 0),
  13639.     (  pguid: @GUID_Key;
  13640.        dwOfs: DIK_SYSRQ;   // "System request", "Druck/S-Abf" on german kbds
  13641.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13642.        dwFlags: 0),
  13643.     (  pguid: @GUID_Key;
  13644.        dwOfs: DIK_RMENU;  // right ALT
  13645.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13646.        dwFlags: 0),
  13647.     (  pguid: @GUID_Key;
  13648.        dwOfs: DIK_PAUSE;  // "Pause" - not reliable on some kbds
  13649.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13650.        dwFlags: 0),
  13651.  
  13652.     // ----------- arrow keypad -----------------
  13653.     (  pguid: @GUID_Key;
  13654.        dwOfs:   DIK_HOME;    // Home on arrow keypad
  13655.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13656.        dwFlags: 0),
  13657.     (  pguid: @GUID_Key;
  13658.        dwOfs: DIK_UP;        // UpArrow on arrow keypad
  13659.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13660.        dwFlags: 0),
  13661.     (  pguid: @GUID_Key;
  13662.        dwOfs: DIK_PRIOR;    // PgUp on arrow keypad
  13663.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13664.        dwFlags: 0),
  13665.     (  pguid: @GUID_Key;
  13666.        dwOfs: DIK_LEFT;    // LeftArrow on arrow keypad
  13667.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13668.        dwFlags: 0),
  13669.     (  pguid: @GUID_Key;
  13670.        dwOfs: DIK_RIGHT;    // RightArrow on arrow keypad
  13671.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13672.        dwFlags: 0),
  13673.     (  pguid: @GUID_Key;
  13674.        dwOfs: DIK_END;    // End on arrow keypad
  13675.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13676.        dwFlags: 0),
  13677.     (  pguid: @GUID_Key;
  13678.        dwOfs: DIK_DOWN;    // DownArrow on arrow keypad
  13679.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13680.        dwFlags: 0),
  13681.     (  pguid: @GUID_Key;
  13682.        dwOfs: DIK_NEXT;    // PgDn on arrow keypad
  13683.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13684.        dwFlags: 0),
  13685.     (  pguid: @GUID_Key;
  13686.        dwOfs: DIK_INSERT;    // Insert on arrow keypad
  13687.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13688.        dwFlags: 0),
  13689.     (  pguid: @GUID_Key;
  13690.        dwOfs: DIK_DELETE;    // Delete on arrow keypad
  13691.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13692.        dwFlags: 0),
  13693.     (  pguid: @GUID_Key;
  13694.        dwOfs: DIK_LWIN;    // Left Windows key
  13695.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13696.        dwFlags: 0),
  13697.     (  pguid: @GUID_Key;
  13698.        dwOfs: DIK_RWIN;    // Right Windows key
  13699.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13700.        dwFlags: 0),
  13701.     (  pguid: @GUID_Key;
  13702.        dwOfs: DIK_APPS;    // AppMenu key
  13703.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13704.        dwFlags: 0),
  13705.     // -------- added with Win 98 / DirectX 6.1 ------------
  13706.     (  pguid: @GUID_Key;
  13707.        dwOfs: 222;    // Power on key
  13708.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13709.        dwFlags: 0),
  13710.     (  pguid: @GUID_Key;
  13711.        dwOfs: 223;    // Sleep key
  13712.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13713.        dwFlags: 0),
  13714.     (  pguid: @GUID_Key;
  13715.        dwOfs: 227;   // Wake (up) key. The german "translation"
  13716.                      // reads "Kielwasser" (ship's wake) ;-)
  13717.        dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
  13718.        dwFlags: 0)
  13719.   );
  13720. *)
  13721.  
  13722. var  // set by initialization - I was simply too lazy
  13723.   _c_dfDIKeyboard_Objects: array[0..255] of TDIObjectDataFormat;
  13724. const
  13725.   c_dfDIKeyboard: TDIDataFormat = (
  13726.     dwSize: Sizeof(c_dfDIKeyboard);
  13727.     dwObjSize: Sizeof(TDIObjectDataFormat);
  13728.     dwFlags: DIDF_RELAXIS;
  13729.     dwDataSize: Sizeof(TDIKeyboardState);
  13730.     dwNumObjs: High(_c_dfDIKeyboard_Objects)+1;
  13731.     rgodf: @_c_dfDIKeyboard_Objects[Low(_c_dfDIKeyboard_Objects)]
  13732.   );
  13733.  
  13734. (****************************************************************************
  13735.  *
  13736.  *      Joystick
  13737.  *
  13738.  ****************************************************************************)
  13739.  
  13740.  
  13741. type
  13742.   PDIJoyState = ^TDIJoyState;
  13743.   TDIJoyState = packed record
  13744.     lX: Longint;   (* x-axis position              *)
  13745.     lY: Longint;   (* y-axis position              *)
  13746.     lZ: Longint;   (* z-axis position              *)
  13747.     lRx: Longint;   (* x-axis rotation              *)
  13748.     lRy: Longint;   (* y-axis rotation              *)
  13749.     lRz: Longint;   (* z-axis rotation              *)
  13750.     rglSlider: Array [0..1] of Longint;   (* extra axes positions         *)
  13751.     rgdwPOV: Array [0..3] of DWORD;   (* POV directions               *)
  13752.     rgbButtons: Array [0..31] of BYTE;   (* 32 buttons                   *)
  13753.   end;
  13754.  
  13755.   PDIJoyState2 = ^TDIJoyState2;
  13756.   TDIJoyState2 = packed record
  13757.     lX: Longint;   (* x-axis position              *)
  13758.     lY: Longint;   (* y-axis position              *)
  13759.     lZ: Longint;   (* z-axis position              *)
  13760.     lRx: Longint;   (* x-axis rotation              *)
  13761.     lRy: Longint;   (* y-axis rotation              *)
  13762.     lRz: Longint;   (* z-axis rotation              *)
  13763.     rglSlider: Array [0..1] of Longint;   (* extra axes positions         *)
  13764.     rgdwPOV: Array [0..3] of DWORD;   (* POV directions               *)
  13765.     rgbButtons: Array [0..127] of BYTE;   (* 128 buttons                  *)
  13766.     lVX: Longint;   (* x-axis velocity              *)
  13767.     lVY: Longint;   (* y-axis velocity              *)
  13768.     lVZ: Longint;   (* z-axis velocity              *)
  13769.     lVRx: Longint;   (* x-axis angular velocity      *)
  13770.     lVRy: Longint;   (* y-axis angular velocity      *)
  13771.     lVRz: Longint;   (* z-axis angular velocity      *)
  13772.     rglVSlider: Array [0..1] of Longint;   (* extra axes velocities        *)
  13773.     lAX: Longint;   (* x-axis acceleration          *)
  13774.     lAY: Longint;   (* y-axis acceleration          *)
  13775.     lAZ: Longint;   (* z-axis acceleration          *)
  13776.     lARx: Longint;   (* x-axis angular acceleration  *)
  13777.     lARy: Longint;   (* y-axis angular acceleration  *)
  13778.     lARz: Longint;   (* z-axis angular acceleration  *)
  13779.     rglASlider: Array [0..1] of Longint;   (* extra axes accelerations     *)
  13780.     lFX: Longint;   (* x-axis force                 *)
  13781.     lFY: Longint;   (* y-axis force                 *)
  13782.     lFZ: Longint;   (* z-axis force                 *)
  13783.     lFRx: Longint;   (* x-axis torque                *)
  13784.     lFRy: Longint;   (* y-axis torque                *)
  13785.     lFRz: Longint;   (* z-axis torque                *)
  13786.     rglFSlider: Array [0..1] of Longint;   (* extra axes forces            *)
  13787.   end;
  13788.  
  13789.  
  13790. function DIJOFS_SLIDER(n: variant) : variant;
  13791.  
  13792. function DIJOFS_POV(n: variant) : variant;
  13793.  
  13794. function DIJOFS_BUTTON(n: variant) : variant;
  13795. const
  13796.   DIJOFS_BUTTON_ = 48;
  13797.  
  13798. const
  13799.   DIJOFS_BUTTON0 = DIJOFS_BUTTON_ + 0;
  13800.   DIJOFS_BUTTON1 = DIJOFS_BUTTON_ + 1;
  13801.   DIJOFS_BUTTON2 = DIJOFS_BUTTON_ + 2;
  13802.   DIJOFS_BUTTON3 = DIJOFS_BUTTON_ + 3;
  13803.   DIJOFS_BUTTON4 = DIJOFS_BUTTON_ + 4;
  13804.   DIJOFS_BUTTON5 = DIJOFS_BUTTON_ + 5;
  13805.   DIJOFS_BUTTON6 = DIJOFS_BUTTON_ + 6;
  13806.   DIJOFS_BUTTON7 = DIJOFS_BUTTON_ + 7;
  13807.   DIJOFS_BUTTON8 = DIJOFS_BUTTON_ + 8;
  13808.   DIJOFS_BUTTON9 = DIJOFS_BUTTON_ + 9;
  13809.   DIJOFS_BUTTON10 = DIJOFS_BUTTON_ + 10;
  13810.   DIJOFS_BUTTON11 = DIJOFS_BUTTON_ + 11;
  13811.   DIJOFS_BUTTON12 = DIJOFS_BUTTON_ + 12;
  13812.   DIJOFS_BUTTON13 = DIJOFS_BUTTON_ + 13;
  13813.   DIJOFS_BUTTON14 = DIJOFS_BUTTON_ + 14;
  13814.   DIJOFS_BUTTON15 = DIJOFS_BUTTON_ + 15;
  13815.   DIJOFS_BUTTON16 = DIJOFS_BUTTON_ + 16;
  13816.   DIJOFS_BUTTON17 = DIJOFS_BUTTON_ + 17;
  13817.   DIJOFS_BUTTON18 = DIJOFS_BUTTON_ + 18;
  13818.   DIJOFS_BUTTON19 = DIJOFS_BUTTON_ + 19;
  13819.   DIJOFS_BUTTON20 = DIJOFS_BUTTON_ + 20;
  13820.   DIJOFS_BUTTON21 = DIJOFS_BUTTON_ + 21;
  13821.   DIJOFS_BUTTON22 = DIJOFS_BUTTON_ + 22;
  13822.   DIJOFS_BUTTON23 = DIJOFS_BUTTON_ + 23;
  13823.   DIJOFS_BUTTON24 = DIJOFS_BUTTON_ + 24;
  13824.   DIJOFS_BUTTON25 = DIJOFS_BUTTON_ + 25;
  13825.   DIJOFS_BUTTON26 = DIJOFS_BUTTON_ + 26;
  13826.   DIJOFS_BUTTON27 = DIJOFS_BUTTON_ + 27;
  13827.   DIJOFS_BUTTON28 = DIJOFS_BUTTON_ + 28;
  13828.   DIJOFS_BUTTON29 = DIJOFS_BUTTON_ + 29;
  13829.   DIJOFS_BUTTON30 = DIJOFS_BUTTON_ + 30;
  13830.   DIJOFS_BUTTON31 = DIJOFS_BUTTON_ + 31;
  13831.  
  13832.  
  13833. const
  13834.   DIJOFS_X  =0;
  13835.   DIJOFS_Y  =4;
  13836.   DIJOFS_Z  =8;
  13837.   DIJOFS_RX =12;
  13838.   DIJOFS_RY =16;
  13839.   DIJOFS_RZ =20;
  13840.  
  13841.   _c_dfDIJoystick_Objects: array[0..43] of TDIObjectDataFormat = (
  13842.     (  pguid: @GUID_XAxis;
  13843.        dwOfs: DIJOFS_X; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
  13844.     (  pguid: @GUID_YAxis;
  13845.        dwOfs: DIJOFS_Y; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
  13846.     (  pguid: @GUID_ZAxis;
  13847.        dwOfs: DIJOFS_Z; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
  13848.     (  pguid: @GUID_RxAxis;
  13849.        dwOfs: DIJOFS_RX; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
  13850.     (  pguid: @GUID_RyAxis;
  13851.        dwOfs: DIJOFS_RY; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
  13852.     (  pguid: @GUID_RzAxis;
  13853.        dwOfs: DIJOFS_RZ; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
  13854.  
  13855.     (  pguid: @GUID_Slider;  // 2 Sliders
  13856.        dwOfs: 24; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
  13857.     (  pguid: @GUID_Slider;
  13858.        dwOfs: 28; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
  13859.  
  13860.     (  pguid: @GUID_POV;  // 4 POVs (yes, really)
  13861.        dwOfs: 32; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
  13862.     (  pguid: @GUID_POV;
  13863.        dwOfs: 36; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
  13864.     (  pguid: @GUID_POV;
  13865.        dwOfs: 40; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
  13866.     (  pguid: @GUID_POV;
  13867.        dwOfs: 44; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
  13868.  
  13869.     (  pguid: nil;   // Buttons
  13870.        dwOfs: DIJOFS_BUTTON0; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13871.     (  pguid: nil;
  13872.        dwOfs: DIJOFS_BUTTON1; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13873.     (  pguid: nil;
  13874.        dwOfs: DIJOFS_BUTTON2; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13875.     (  pguid: nil;
  13876.        dwOfs: DIJOFS_BUTTON3; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13877.     (  pguid: nil;
  13878.        dwOfs: DIJOFS_BUTTON4; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13879.     (  pguid: nil;
  13880.        dwOfs: DIJOFS_BUTTON5; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13881.     (  pguid: nil;
  13882.        dwOfs: DIJOFS_BUTTON6; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13883.     (  pguid: nil;
  13884.        dwOfs: DIJOFS_BUTTON7; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13885.     (  pguid: nil;
  13886.        dwOfs: DIJOFS_BUTTON8; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13887.     (  pguid: nil;
  13888.        dwOfs: DIJOFS_BUTTON9; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13889.     (  pguid: nil;
  13890.        dwOfs: DIJOFS_BUTTON10; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13891.     (  pguid: nil;
  13892.        dwOfs: DIJOFS_BUTTON11; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13893.     (  pguid: nil;
  13894.        dwOfs: DIJOFS_BUTTON12; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13895.     (  pguid: nil;
  13896.        dwOfs: DIJOFS_BUTTON13; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13897.     (  pguid: nil;
  13898.        dwOfs: DIJOFS_BUTTON14; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13899.     (  pguid: nil;
  13900.        dwOfs: DIJOFS_BUTTON15; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13901.     (  pguid: nil;
  13902.        dwOfs: DIJOFS_BUTTON16; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13903.     (  pguid: nil;
  13904.        dwOfs: DIJOFS_BUTTON17; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13905.     (  pguid: nil;
  13906.        dwOfs: DIJOFS_BUTTON18; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13907.     (  pguid: nil;
  13908.        dwOfs: DIJOFS_BUTTON19; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13909.     (  pguid: nil;
  13910.        dwOfs: DIJOFS_BUTTON20; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13911.     (  pguid: nil;
  13912.        dwOfs: DIJOFS_BUTTON21; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13913.     (  pguid: nil;
  13914.        dwOfs: DIJOFS_BUTTON22; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13915.     (  pguid: nil;
  13916.        dwOfs: DIJOFS_BUTTON23; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13917.     (  pguid: nil;
  13918.        dwOfs: DIJOFS_BUTTON24; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13919.     (  pguid: nil;
  13920.        dwOfs: DIJOFS_BUTTON25; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13921.     (  pguid: nil;
  13922.        dwOfs: DIJOFS_BUTTON26; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13923.     (  pguid: nil;
  13924.        dwOfs: DIJOFS_BUTTON27; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13925.     (  pguid: nil;
  13926.        dwOfs: DIJOFS_BUTTON28; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13927.     (  pguid: nil;
  13928.        dwOfs: DIJOFS_BUTTON29; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13929.     (  pguid: nil;
  13930.        dwOfs: DIJOFS_BUTTON30; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
  13931.     (  pguid: nil;
  13932.        dwOfs: DIJOFS_BUTTON31; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0)
  13933.   );
  13934.  
  13935.   c_dfDIJoystick: TDIDataFormat = (
  13936.     dwSize: Sizeof(c_dfDIJoystick);
  13937.     dwObjSize: Sizeof(TDIObjectDataFormat);  // $10
  13938.     dwFlags: DIDF_ABSAXIS;
  13939.     dwDataSize: SizeOf(TDIJoyState);         // $10
  13940.     dwNumObjs: High(_c_dfDIJoystick_Objects)+1;  // $2C
  13941.     rgodf: @_c_dfDIJoystick_Objects[Low(_c_dfDIJoystick_Objects)]
  13942.   );
  13943.  
  13944. var  // Set by initialization part -- didn't want to type in another 656 consts...
  13945.   _c_dfDIJoystick2_Objects: array[0..$A3] of TDIObjectDataFormat;
  13946.   { Elements $00..$2B: exact copy of _c_dfDIJoystick
  13947.     Elements $2C..$8B: more "buttons" with nil GUIDs
  13948.     remaining elements ($8B..$A2):
  13949.      $8C,$8D,$8E: X axis, Y axis, Z axis with dwFlags = $0200
  13950.      $8F,$90,$91: rX axis, rY axis, rZ axis with dwFlags = $0200
  13951.      $92, $93: Slider with dwFlags = $0200
  13952.      --------
  13953.      $94,$95,$96: X axis, Y axis, Z axis with dwFlags = $0300
  13954.      $97,$98,$99: rX axis, rY axis, rZ axis with dwFlags = $0300
  13955.      $9A,$9B: Slider with dwFlags = $0300
  13956.      --------
  13957.      $9C,$9D,$9E: X axis, Y axis, Z axis with dwFlags = $0400
  13958.      $9F, $A0, $A1: rX axis, rY axis, rZ axis with dwFlags = $0400
  13959.      $A2, $A3: Slider with dwFlags = $0400
  13960.   }
  13961. const
  13962.   c_dfDIJoystick2: TDIDataFormat = (
  13963.     dwSize: Sizeof(c_dfDIJoystick2);
  13964.     dwObjSize: Sizeof(TDIObjectDataFormat);
  13965.     dwFlags: DIDF_ABSAXIS;
  13966.     dwDataSize: SizeOf(TDIJoyState2);  // $110
  13967.     dwNumObjs: High(_c_dfDIJoystick2_Objects)+1;
  13968.     rgodf: @_c_dfDIJoystick2_Objects[Low(_c_dfDIJoystick2_Objects)]
  13969.   );
  13970.  
  13971. (****************************************************************************
  13972.  *
  13973.  *  IDirectInput
  13974.  *
  13975.  ****************************************************************************)
  13976.  
  13977.  
  13978.   DIENUM_STOP = 0;
  13979.   DIENUM_CONTINUE = 1;
  13980.  
  13981. type
  13982.   // as with the other enum functions: must rtn DIENUM_STOP or DIENUM_CONTINUE
  13983.   TDIEnumDevicesCallbackA = function (var lpddi: TDIDeviceInstanceA;
  13984.       pvRef: Pointer): Integer; stdcall;  // BOOL; stdcall;
  13985.   TDIEnumDevicesCallbackW = function (var lpddi: TDIDeviceInstanceW;
  13986.       pvRef: Pointer): Integer; stdcall;  // BOOL; stdcall;
  13987.   TDIEnumDevicesCallback = function (var lpddi: TDIDeviceInstance;
  13988.       pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  13989.   TDIEnumDevicesProc = TDIEnumDevicesCallback;
  13990.  
  13991. const
  13992.   DIEDFL_ALLDEVICES       = $00000000;
  13993.   DIEDFL_ATTACHEDONLY     = $00000001;
  13994.   DIEDFL_FORCEFEEDBACK    = $00000100;
  13995.  
  13996. type
  13997.  
  13998.   IDirectInputW = interface (IUnknown)
  13999.     ['{89521361-AA8A-11CF-BFC7-444553540000}']
  14000.     (*** IDirectInputW methods ***)
  14001.     function CreateDevice(const rguid: TGUID; var lplpDirectInputDevice:
  14002.         IDirectInputDeviceW; pUnkOuter: IUnknown) : HResult;  stdcall;
  14003.     function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackW;
  14004.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  14005.     function GetDeviceStatus(const rguidInstance: TGUID) : HResult;  stdcall;
  14006.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  14007.     function Initialize(hinst: THandle; dwVersion: DWORD) : HResult;  stdcall;
  14008.   end;
  14009.  
  14010.   IDirectInputA = interface (IUnknown)
  14011.     ['{89521360-AA8A-11CF-BFC7-444553540000}']
  14012.     (*** IDirectInputA methods ***)
  14013.     function CreateDevice(const rguid: TGUID; var lplpDirectInputDevice:
  14014.         IDirectInputDeviceA; pUnkOuter: IUnknown) : HResult;  stdcall;
  14015.     function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackA;
  14016.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  14017.     function GetDeviceStatus(const rguidInstance: TGUID) : HResult;  stdcall;
  14018.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  14019.     function Initialize(hinst: THandle; dwVersion: DWORD) : HResult;  stdcall;
  14020.   end;
  14021.  
  14022. {$IFDEF UNICODE}
  14023.   IDirectInput = IDirectInputW;
  14024. {$ELSE}
  14025.   IDirectInput = IDirectInputA;
  14026. {$ENDIF}
  14027.  
  14028.  
  14029.   IDirectInput2W = interface (IDirectInputW)
  14030.     ['{5944E663-AA8A-11CF-BFC7-444553540000}']
  14031.     (*** IDirectInput2W methods ***)
  14032.     function FindDevice(const rguidClass: TGUID; ptszName: PWideChar; out pguidInstance: TGUID): HResult;  stdcall;
  14033.   end;
  14034.  
  14035.   IDirectInput2A = interface (IDirectInputA)
  14036.     ['{5944E662-AA8A-11CF-BFC7-444553540000}']
  14037.     (*** IDirectInput2A methods ***)
  14038.     function FindDevice(const rguidClass: TGUID; ptszName: PAnsiChar; out pguidInstance: TGUID): HResult;  stdcall;
  14039.   end;
  14040.  
  14041. {$IFDEF UNICODE}
  14042.   IDirectInput2 = IDirectInput2W;
  14043. {$ELSE}
  14044.   IDirectInput2 = IDirectInput2A;
  14045. {$ENDIF}
  14046.  
  14047.  
  14048. type
  14049.   IDirectInput7W = interface (IDirectInput2W)
  14050.     ['{9A4CB685-236D-11D3-8E9D-00C04F6844AE}']
  14051.     {*** IDirectInput7W methods ***}
  14052.     function CreateDeviceEx(const rguid, riid: TGUID; out lplpDirectInputDevice;
  14053.         pUnkOuter: IUnknown) : HResult; stdcall;
  14054.   end;
  14055.  
  14056.   IDirectInput7A = interface (IDirectInput2A)
  14057.     ['{9A4CB684-236D-11D3-8E9D-00C04F6844AE}']
  14058.     {*** IDirectInput7A methods ***}
  14059.     function CreateDeviceEx(const rguid, riid: TGUID; out lplpDirectInputDevice;
  14060.         pUnkOuter: IUnknown) : HResult; stdcall;
  14061.   end;
  14062.  
  14063. {$IFDEF UNICODE}
  14064.   IDirectInput7 = IDirectInput7W;
  14065. {$ELSE}
  14066.   IDirectInput7 = IDirectInput7A;
  14067. {$ENDIF}
  14068.  
  14069.  
  14070. var
  14071.   DirectInputCreateA : function (hinst: THandle; dwVersion: DWORD;
  14072.       out ppDI: IDirectInputA;
  14073.       punkOuter: IUnknown) : HResult; stdcall;
  14074.   DirectInputCreateW : function (hinst: THandle; dwVersion: DWORD;
  14075.       out ppDI: IDirectInputW;
  14076.       punkOuter: IUnknown) : HResult; stdcall;
  14077.   DirectInputCreate : function (hinst: THandle; dwVersion: DWORD;
  14078.       out ppDI: IDirectInput;
  14079.       punkOuter: IUnknown) : HResult; stdcall;
  14080.  
  14081.   DirectInputCreateEx : function (
  14082.       hinst: THandle;
  14083.       dwVersion: DWORD;
  14084.       const riidltf: TGUID;
  14085.       out ppvOut;
  14086.       punkOuter: IUnknown) : HResult; stdcall;
  14087.  
  14088. (****************************************************************************
  14089.  *
  14090.  *      Interfaces
  14091.  *
  14092.  ****************************************************************************)
  14093. type
  14094.   IID_IDirectInputW = IDirectInputW;
  14095.   IID_IDirectInputA = IDirectInputA;
  14096.   IID_IDirectInput = IDirectInput;
  14097.  
  14098.   IID_IDirectInput2W = IDirectInput2W;
  14099.   IID_IDirectInput2A = IDirectInput2A;
  14100.   IID_IDirectInput2 = IDirectInput2;
  14101.  
  14102.   IID_IDirectInput7W = IDirectInput7W;
  14103.   IID_IDirectInput7A = IDirectInput7A;
  14104.   IID_IDirectInput7 = IDirectInput7;
  14105.  
  14106.   IID_IDirectInputDeviceW = IDirectInputDeviceW;
  14107.   IID_IDirectInputDeviceA = IDirectInputDeviceA;
  14108.   IID_IDirectInputDevice = IDirectInputDevice;
  14109.  
  14110.   IID_IDirectInputDevice2W = IDirectInputDevice2W;
  14111.   IID_IDirectInputDevice2A = IDirectInputDevice2A;
  14112.   IID_IDirectInputDevice2 = IDirectInputDevice2;
  14113.  
  14114.   IID_IDirectInputEffect = IDirectInputEffect;
  14115.  
  14116.   IID_IDirectInputDevice7W = IDirectInputDevice7W;
  14117.   IID_IDirectInputDevice7A = IDirectInputDevice7A;
  14118.   IID_IDirectInputDevice7 = IDirectInputDevice7;
  14119.  
  14120. (****************************************************************************
  14121.  *
  14122.  *  Return Codes
  14123.  *
  14124.  ****************************************************************************)
  14125.  
  14126. (*
  14127.  *  The operation completed successfully.
  14128.  *)
  14129. const
  14130.   DI_OK = S_OK;
  14131.  
  14132. (*
  14133.  *  The device exists but is not currently attached.
  14134.  *)
  14135.   DI_NOTATTACHED = S_FALSE;
  14136.  
  14137. (*
  14138.  *  The device buffer overflowed.  Some input was lost.
  14139.  *)
  14140.   DI_BUFFEROVERFLOW = S_FALSE;
  14141.  
  14142. (*
  14143.  *  The change in device properties had no effect.
  14144.  *)
  14145.   DI_PROPNOEFFECT = S_FALSE;
  14146.  
  14147. (*
  14148.  *  The operation had no effect.
  14149.  *)
  14150.   DI_NOEFFECT = S_FALSE;
  14151.  
  14152. (*
  14153.  *  The device is a polled device.  As a result, device buffering
  14154.  *  will not collect any data and event notifications will not be
  14155.  *  signalled until GetDeviceState is called.
  14156.  *)
  14157.   DI_POLLEDDEVICE = $00000002;
  14158.  
  14159. (*
  14160.  *  The parameters of the effect were successfully updated by
  14161.  *  IDirectInputEffect::SetParameters, but the effect was not
  14162.  *  downloaded because the device is not exclusively acquired
  14163.  *  or because the DIEP_NODOWNLOAD flag was passed.
  14164.  *)
  14165.   DI_DOWNLOADSKIPPED = $00000003;
  14166.  
  14167. (*
  14168.  *  The parameters of the effect were successfully updated by
  14169.  *  IDirectInputEffect::SetParameters, but in order to change
  14170.  *  the parameters, the effect needed to be restarted.
  14171.  *)
  14172.   DI_EFFECTRESTARTED = $00000004;
  14173.  
  14174. (*
  14175.  *  The parameters of the effect were successfully updated by
  14176.  *  IDirectInputEffect::SetParameters, but some of them were
  14177.  *  beyond the capabilities of the device and were truncated.
  14178.  *)
  14179.   DI_TRUNCATED = $00000008;
  14180.  
  14181. (*
  14182.  *  Equal to DI_EFFECTRESTARTED | DI_TRUNCATED.
  14183.  *)
  14184.   DI_TRUNCATEDANDRESTARTED = $0000000C;
  14185.  
  14186.   SEVERITY_ERROR_FACILITY_WIN32 =
  14187.       HResult(SEVERITY_ERROR shl 31) or HResult(FACILITY_WIN32 shl 16);
  14188.  
  14189. (*
  14190.  *  The application requires a newer version of DirectInput.
  14191.  *)
  14192.  
  14193.   DIERR_OLDDIRECTINPUTVERSION = SEVERITY_ERROR_FACILITY_WIN32
  14194.       or ERROR_OLD_WIN_VERSION;
  14195.  
  14196. (*
  14197.  *  The application was written for an unsupported prerelease version
  14198.  *  of DirectInput.
  14199.  *)
  14200.   DIERR_BETADIRECTINPUTVERSION = SEVERITY_ERROR_FACILITY_WIN32
  14201.       or ERROR_RMODE_APP;
  14202.  
  14203. (*
  14204.  *  The object could not be created due to an incompatible driver version
  14205.  *  or mismatched or incomplete driver components.
  14206.  *)
  14207.   DIERR_BADDRIVERVER = SEVERITY_ERROR_FACILITY_WIN32
  14208.       or ERROR_BAD_DRIVER_LEVEL;
  14209.  
  14210. (*
  14211.  * The device or device instance or effect is not registered with DirectInput.
  14212.  *)
  14213.   DIERR_DEVICENOTREG = REGDB_E_CLASSNOTREG;
  14214.  
  14215. (*
  14216.  * The requested object does not exist.
  14217.  *)
  14218.   DIERR_NOTFOUND = SEVERITY_ERROR_FACILITY_WIN32
  14219.       or ERROR_FILE_NOT_FOUND;
  14220.  
  14221. (*
  14222.  * The requested object does not exist.
  14223.  *)
  14224.   DIERR_OBJECTNOTFOUND = SEVERITY_ERROR_FACILITY_WIN32
  14225.       or ERROR_FILE_NOT_FOUND;
  14226.  
  14227. (*
  14228.  * An invalid parameter was passed to the returning function,
  14229.  * or the object was not in a state that admitted the function
  14230.  * to be called.
  14231.  *)
  14232.   DIERR_INVALIDPARAM = E_INVALIDARG;
  14233.  
  14234. (*
  14235.  * The specified interface is not supported by the object
  14236.  *)
  14237.   DIERR_NOINTERFACE = E_NOINTERFACE;
  14238.  
  14239. (*
  14240.  * An undetermined error occured inside the DInput subsystem
  14241.  *)
  14242.   DIERR_GENERIC = E_FAIL;
  14243.  
  14244. (*
  14245.  * The DInput subsystem couldn't allocate sufficient memory to complete the
  14246.  * caller's request.
  14247.  *)
  14248.   DIERR_OUTOFMEMORY = E_OUTOFMEMORY;
  14249.  
  14250. (*
  14251.  * The function called is not supported at this time
  14252.  *)
  14253.   DIERR_UNSUPPORTED = E_NOTIMPL;
  14254.  
  14255. (*
  14256.  * This object has not been initialized
  14257.  *)
  14258.   DIERR_NOTINITIALIZED = SEVERITY_ERROR_FACILITY_WIN32
  14259.       or ERROR_NOT_READY;
  14260.  
  14261. (*
  14262.  * This object is already initialized
  14263.  *)
  14264.   DIERR_ALREADYINITIALIZED = SEVERITY_ERROR_FACILITY_WIN32
  14265.       or ERROR_ALREADY_INITIALIZED;
  14266.  
  14267. (*
  14268.  * This object does not support aggregation
  14269.  *)
  14270.   DIERR_NOAGGREGATION = CLASS_E_NOAGGREGATION;
  14271.  
  14272. (*
  14273.  * Another app has a higher priority level, preventing this call from
  14274.  * succeeding.
  14275.  *)
  14276.   DIERR_OTHERAPPHASPRIO = E_ACCESSDENIED;
  14277.  
  14278. (*
  14279.  * Access to the device has been lost.  It must be re-acquired.
  14280.  *)
  14281.   DIERR_INPUTLOST = SEVERITY_ERROR_FACILITY_WIN32
  14282.       or ERROR_READ_FAULT;
  14283.  
  14284. (*
  14285.  * The operation cannot be performed while the device is acquired.
  14286.  *)
  14287.   DIERR_ACQUIRED = SEVERITY_ERROR_FACILITY_WIN32
  14288.       or ERROR_BUSY;
  14289.  
  14290. (*
  14291.  * The operation cannot be performed unless the device is acquired.
  14292.  *)
  14293.   DIERR_NOTACQUIRED = SEVERITY_ERROR_FACILITY_WIN32
  14294.       or ERROR_INVALID_ACCESS;
  14295.  
  14296. (*
  14297.  * The specified property cannot be changed.
  14298.  *)
  14299.   DIERR_READONLY = E_ACCESSDENIED;
  14300.  
  14301. (*
  14302.  * The device already has an event notification associated with it.
  14303.  *)
  14304.   DIERR_HANDLEEXISTS = E_ACCESSDENIED;
  14305.  
  14306. (*
  14307.  * Data is not yet available.
  14308.  *)
  14309.   E_PENDING = HResult($80070007);
  14310.  
  14311. (*
  14312.  * Unable to IDirectInputJoyConfig_Acquire because the user
  14313.  * does not have sufficient privileges to change the joystick
  14314.  * configuration.
  14315.  *)
  14316.   DIERR_INSUFFICIENTPRIVS = HResult($80040200);
  14317.  
  14318. (*
  14319.  * The device is full.
  14320.  *)
  14321.   DIERR_DEVICEFULL = DIERR_INSUFFICIENTPRIVS + 1;
  14322.  
  14323. (*
  14324.  * Not all the requested information fit into the buffer.
  14325.  *)
  14326.   DIERR_MOREDATA = DIERR_INSUFFICIENTPRIVS + 2;
  14327.  
  14328. (*
  14329.  * The effect is not downloaded.
  14330.  *)
  14331.   DIERR_NOTDOWNLOADED = DIERR_INSUFFICIENTPRIVS + 3;
  14332.  
  14333. (*
  14334.  *  The device cannot be reinitialized because there are still effects
  14335.  *  attached to it.
  14336.  *)
  14337.   DIERR_HASEFFECTS = DIERR_INSUFFICIENTPRIVS + 4;
  14338.  
  14339. (*
  14340.  *  The operation cannot be performed unless the device is acquired
  14341.  *  in DISCL_EXCLUSIVE mode.
  14342.  *)
  14343.   DIERR_NOTEXCLUSIVEACQUIRED = DIERR_INSUFFICIENTPRIVS + 5;
  14344.  
  14345. (*
  14346.  *  The effect could not be downloaded because essential information
  14347.  *  is missing.  For example, no axes have been associated with the
  14348.  *  effect, or no type-specific information has been created.
  14349.  *)
  14350.   DIERR_INCOMPLETEEFFECT = DIERR_INSUFFICIENTPRIVS + 6;
  14351.  
  14352. (*
  14353.  *  Attempted to read buffered device data from a device that is
  14354.  *  not buffered.
  14355.  *)
  14356.   DIERR_NOTBUFFERED = DIERR_INSUFFICIENTPRIVS + 7;
  14357.  
  14358. (*
  14359.  *  An attempt was made to modify parameters of an effect while it is
  14360.  *  playing.  Not all hardware devices support altering the parameters
  14361.  *  of an effect while it is playing.
  14362.  *)
  14363.   DIERR_EFFECTPLAYING = DIERR_INSUFFICIENTPRIVS + 8;
  14364.  
  14365. (*
  14366.  *  The operation could not be completed because the device is not
  14367.  *  plugged in.
  14368.  *)
  14369.   DIERR_UNPLUGGED                = $80040209;
  14370.  
  14371. (*
  14372.  *  SendDeviceData failed because more information was requested
  14373.  *  to be sent than can be sent to the device.  Some devices have
  14374.  *  restrictions on how much data can be sent to them.  (For example,
  14375.  *  there might be a limit on the number of buttons that can be
  14376.  *  pressed at once.)
  14377.  *)
  14378.  DIERR_REPORTFULL                = $8004020A;
  14379.  
  14380.  
  14381. (****************************************************************************
  14382.  *
  14383.  *  Definitions for non-IDirectInput (VJoyD) features defined more recently
  14384.  *  than the current sdk files
  14385.  *
  14386.  ****************************************************************************)
  14387.  
  14388. (*
  14389.  * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure
  14390.  * contains mini-driver specific data to be passed by VJoyD to the mini-
  14391.  * driver instead of doing a poll.
  14392.  *)
  14393.   JOY_PASSDRIVERDATA          = $10000000;
  14394.  
  14395. (*
  14396.  * Informs the joystick driver that the configuration has been changed
  14397.  * and should be reloaded from the registery.
  14398.  * dwFlags is reserved and should be set to zero
  14399.  *)
  14400.  
  14401. function joyConfigChanged(dwFlags: DWORD) : MMRESULT; stdcall;
  14402.  
  14403. const
  14404. (*
  14405.  * Hardware Setting indicating that the device is a headtracker
  14406.  *)
  14407.   JOY_HWS_ISHEADTRACKER       = $02000000;
  14408.  
  14409. (*
  14410.  * Hardware Setting indicating that the VxD is used to replace
  14411.  * the standard analog polling
  14412.  *)
  14413.   JOY_HWS_ISGAMEPORTDRIVER    = $04000000;
  14414.  
  14415. (*
  14416.  * Hardware Setting indicating that the driver needs a standard
  14417.  * gameport in order to communicate with the device.
  14418.  *)
  14419.   JOY_HWS_ISANALOGPORTDRIVER  = $08000000;
  14420.  
  14421. (*
  14422.  * Hardware Setting indicating that VJoyD should not load this
  14423.  * driver, it will be loaded externally and will register with
  14424.  * VJoyD of it's own accord.
  14425.  *)
  14426.   JOY_HWS_AUTOLOAD            = $10000000;
  14427.  
  14428. (*
  14429.  * Hardware Setting indicating that the driver acquires any
  14430.  * resources needed without needing a devnode through VJoyD.
  14431.  *)
  14432.   JOY_HWS_NODEVNODE           = $20000000;
  14433.  
  14434. (*
  14435.  * Hardware Setting indicating that the device is a gameport bus
  14436.  *)
  14437.   JOY_HWS_ISGAMEPORTBUS       = $80000000;
  14438.   JOY_HWS_GAMEPORTBUSBUSY     = $00000001;
  14439.  
  14440. //from older Verion:
  14441. (*
  14442.  * Hardware Setting indicating that the VxD can be used as
  14443.  * a port 201h emulator.
  14444.  *)
  14445.   JOY_HWS_ISGAMEPORTEMULATOR  = $40000000;
  14446.  
  14447.  
  14448. (*
  14449.  * Usage Setting indicating that the settings are volatile and
  14450.  * should be removed if still present on a reboot.
  14451.  *)
  14452.   JOY_US_VOLATILE             = $00000008;
  14453.  
  14454. (****************************************************************************
  14455.  *
  14456.  *  Definitions for non-IDirectInput (VJoyD) features defined more recently
  14457.  *  than the current ddk files
  14458.  *
  14459.  ****************************************************************************)
  14460.  
  14461. (*
  14462.  * Poll type in which the do_other field of the JOYOEMPOLLDATA
  14463.  * structure contains mini-driver specific data passed from an app.
  14464.  *)
  14465.   JOY_OEMPOLL_PASSDRIVERDATA  = 7;
  14466.  
  14467. {$IFDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
  14468. //DirectPlay file
  14469.  
  14470. (*==========================================================================;
  14471.  *
  14472.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  14473.  *
  14474.  *  File:       dplay.h dplobby.h
  14475.  *  Content:    DirectPlay include files
  14476.  *
  14477.  *  DirectX 7 Delphi adaptation by Erik Unger
  14478.  *
  14479.  *  Modified: 4-Jun-2000
  14480.  *
  14481.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  14482.  *  E-Mail: DelphiDirectX@next-reality.com
  14483.  *
  14484.  ***************************************************************************)
  14485.  
  14486. var
  14487.   DPlayDLL : HMODULE = 0;
  14488.  
  14489. (*==========================================================================;
  14490.  *
  14491.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  14492.  *
  14493.  *  File:       dplay.h
  14494.  *  Content:    DirectPlay include file
  14495.  *
  14496.  ***************************************************************************)
  14497.  
  14498. function DPErrorString(Value: HResult) : string;
  14499.  
  14500. const
  14501. // {D1EB6D20-8923-11d0-9D97-00A0C90A43CB}
  14502.   CLSID_DirectPlay: TGUID =
  14503.       (D1:$d1eb6d20;D2:$8923;D3:$11d0;D4:($9d,$97,$00,$a0,$c9,$a,$43,$cb));
  14504.  
  14505. (*
  14506.  * GUIDS used by Service Providers shipped with DirectPlay
  14507.  * Use these to identify Service Provider returned by EnumConnections
  14508.  *)
  14509.  
  14510. // GUID for IPX service provider
  14511. // {685BC400-9D2C-11cf-A9CD-00AA006886E3}
  14512.   DPSPGUID_IPX: TGUID =
  14513.       (D1:$685bc400;D2:$9d2c;D3:$11cf;D4:($a9,$cd,$00,$aa,$00,$68,$86,$e3));
  14514.  
  14515. // GUID for TCP/IP service provider
  14516. // 36E95EE0-8577-11cf-960C-0080C7534E82
  14517.   DPSPGUID_TCPIP: TGUID =
  14518.       (D1:$36E95EE0;D2:$8577;D3:$11cf;D4:($96,$0c,$00,$80,$c7,$53,$4e,$82));
  14519.  
  14520. // GUID for Serial service provider
  14521. // {0F1D6860-88D9-11cf-9C4E-00A0C905425E}
  14522.   DPSPGUID_SERIAL: TGUID =
  14523.       (D1:$f1d6860;D2:$88d9;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$05,$42,$5e));
  14524.  
  14525. // GUID for Modem service provider
  14526. // {44EAA760-CB68-11cf-9C4E-00A0C905425E}
  14527.   DPSPGUID_MODEM: TGUID =
  14528.       (D1:$44eaa760;D2:$cb68;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$05,$42,$5e));
  14529.  
  14530.  
  14531. (****************************************************************************
  14532.  *
  14533.  * DirectPlay Structures
  14534.  *
  14535.  * Various structures used to invoke DirectPlay.
  14536.  *
  14537.  ****************************************************************************)
  14538.  
  14539. type
  14540.  (*
  14541.  * TDPID
  14542.  * DirectPlay player and group ID
  14543.  *)
  14544.   TDPID = DWORD;
  14545.   PDPID = ^TDPID;
  14546.  
  14547.  
  14548. const
  14549. (*
  14550.  * DPID that system messages come from
  14551.  *)
  14552.   DPID_SYSMSG = 0;
  14553.  
  14554. (*
  14555.  * DPID representing all players in the session
  14556.  *)
  14557.   DPID_ALLPLAYERS = 0;
  14558.  
  14559. (*
  14560.  * DPID representing the server player
  14561.  *)
  14562.   DPID_SERVERPLAYER = 1;
  14563.  
  14564. (*
  14565.  * DPID representing the maximum ID in the range of DPID's reserved for
  14566.  * use by DirectPlay.
  14567.  *)
  14568.   DPID_RESERVEDRANGE = 100;
  14569.  
  14570. (*
  14571.  * The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID)
  14572.  *)
  14573.   DPID_UNKNOWN = $FFFFFFFF;
  14574.  
  14575. type
  14576. (*
  14577.  * DPCAPS
  14578.  * Used to obtain the capabilities of a DirectPlay object
  14579.  *)
  14580.   PDPCaps = ^TDPCaps;
  14581.   TDPCaps = packed record
  14582.     dwSize: DWORD;              // Size of structure, in bytes
  14583.     dwFlags: DWORD;             // DPCAPS_xxx flags
  14584.     dwMaxBufferSize: DWORD;     // Maximum message size, in bytes,  for this service provider
  14585.     dwMaxQueueSize: DWORD;      // Obsolete.
  14586.     dwMaxPlayers: DWORD;        // Maximum players/groups (local + remote)
  14587.     dwHundredBaud: DWORD;       // Bandwidth in 100 bits per second units;
  14588.                                 // i.e. 24 is 2400, 96 is 9600, etc.
  14589.     dwLatency: DWORD;           // Estimated latency; 0 = unknown
  14590.     dwMaxLocalPlayers: DWORD;   // Maximum # of locally created players allowed
  14591.     dwHeaderLength: DWORD;      // Maximum header length, in bytes, on messages
  14592.                                 // added by the service provider
  14593.     dwTimeout: DWORD;           // Service provider's suggested timeout value
  14594.                                 // This is how long DirectPlay will wait for
  14595.                                 // responses to system messages
  14596.   end;
  14597.  
  14598. const
  14599. (*
  14600.  * This DirectPlay object is the session host.  If the host exits the
  14601.  * session, another application will become the host and receive a
  14602.  * DPSYS_HOST system message.
  14603.  *)
  14604.   DPCAPS_ISHOST = $00000002;
  14605.  
  14606. (*
  14607.  * The service provider bound to this DirectPlay object can optimize
  14608.  * group messaging.
  14609.  *)
  14610.   DPCAPS_GROUPOPTIMIZED = $00000008;
  14611.  
  14612. (*
  14613.  * The service provider bound to this DirectPlay object can optimize
  14614.  * keep alives (see DPSESSION_KEEPALIVE)
  14615.  *)
  14616.   DPCAPS_KEEPALIVEOPTIMIZED = $00000010;
  14617.  
  14618. (*
  14619.  * The service provider bound to this DirectPlay object can optimize
  14620.  * guaranteed message delivery.
  14621.  *)
  14622.   DPCAPS_GUARANTEEDOPTIMIZED = $00000020;
  14623.  
  14624. (*
  14625.  * This DirectPlay object supports guaranteed message delivery.
  14626.  *)
  14627.   DPCAPS_GUARANTEEDSUPPORTED = $00000040;
  14628.  
  14629. (*
  14630.  * This DirectPlay object supports digital signing of messages.
  14631.  *)
  14632.   DPCAPS_SIGNINGSUPPORTED = $00000080;
  14633.  
  14634. (*
  14635.  * This DirectPlay object supports encryption of messages.
  14636.  *)
  14637.   DPCAPS_ENCRYPTIONSUPPORTED = $00000100;
  14638.  
  14639. (*
  14640.  * This DirectPlay player was created on this machine
  14641.  *)
  14642.   DPPLAYERCAPS_LOCAL = $00000800;
  14643.  
  14644. (*
  14645.  * Current Open settings supports all forms of Cancel
  14646.  *)
  14647.   DPCAPS_ASYNCCANCELSUPPORTED = $00001000;
  14648.  
  14649. (*
  14650.  * Current Open settings supports CancelAll, but not Cancel
  14651.  *)
  14652.   DPCAPS_ASYNCCANCELALLSUPPORTED = $00002000;
  14653.  
  14654. (*
  14655.  * Current Open settings supports Send Timeouts for sends
  14656.  *)
  14657.   DPCAPS_SENDTIMEOUTSUPPORTED = $00004000;
  14658.  
  14659. (*
  14660.  * Current Open settings supports send priority
  14661.  *)
  14662.   DPCAPS_SENDPRIORITYSUPPORTED = $00008000;
  14663.  
  14664. (*
  14665.  * Current Open settings supports DPSEND_ASYNC flag
  14666.  *)
  14667.   DPCAPS_ASYNCSUPPORTED = $00010000;
  14668.  
  14669. type
  14670. (*
  14671.  * TDPSessionDesc2
  14672.  * Used to describe the properties of a DirectPlay
  14673.  * session instance
  14674.  *)
  14675.   PDPSessionDesc2 = ^TDPSessionDesc2;
  14676.   TDPSessionDesc2 = packed record
  14677.     dwSize: DWORD;             // Size of structure
  14678.     dwFlags: DWORD;            // DPSESSION_xxx flags
  14679.     guidInstance: TGUID;       // ID for the session instance
  14680.     guidApplication: TGUID;    // GUID of the DirectPlay application.
  14681.                                // GUID_NULL for all applications.
  14682.     dwMaxPlayers: DWORD;       // Maximum # players allowed in session
  14683.     dwCurrentPlayers: DWORD;   // Current # players in session (read only)
  14684.     case integer of
  14685.       0 : (
  14686.     lpszSessionName: PCharAW;  // Name of the session
  14687.     lpszPassword: PCharAW;     // Password of the session (optional)
  14688.     dwReserved1: DWORD;        // Reserved for future MS use.
  14689.     dwReserved2: DWORD;
  14690.     dwUser1: DWORD;            // For use by the application
  14691.     dwUser2: DWORD;
  14692.     dwUser3: DWORD;
  14693.     dwUser4: DWORD;
  14694.       );
  14695.       1 : (
  14696.     lpszSessionNameA: PAnsiChar;   // Name of the session
  14697.     lpszPasswordA: PAnsiChar       // Password of the session (optional)
  14698.       );
  14699.       2 : (
  14700.     lpszSessionNameW: PWideChar;
  14701.     lpszPasswordW: PWideChar
  14702.       );
  14703.   end;
  14704.  
  14705. const
  14706. (*
  14707.  * Applications cannot create new players in this session.
  14708.  *)
  14709.   DPSESSION_NEWPLAYERSDISABLED = $00000001;
  14710.  
  14711. (*
  14712.  * If the DirectPlay object that created the session, the host,
  14713.  * quits, then the host will attempt to migrate to another
  14714.  * DirectPlay object so that new players can continue to be created
  14715.  * and new applications can join the session.
  14716.  *)
  14717.   DPSESSION_MIGRATEHOST = $00000004;
  14718.  
  14719. (*
  14720.  * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom
  14721.  * fields in player messages.  This cuts two DWORD's off the message
  14722.  * overhead.
  14723.  *)
  14724.   DPSESSION_NOMESSAGEID = $00000008;
  14725.  
  14726. (*
  14727.  * This flag tells DirectPlay to not allow any new applications to
  14728.  * join the session.  Applications already in the session can still
  14729.  * create new players.
  14730.  *)
  14731.   DPSESSION_JOINDISABLED = $00000020;
  14732.  
  14733. (*
  14734.  * This flag tells DirectPlay to detect when remote players
  14735.  * exit abnormally (e.g. their computer or modem gets unplugged)
  14736.  *)
  14737.   DPSESSION_KEEPALIVE = $00000040;
  14738.  
  14739. (*
  14740.  * This flag tells DirectPlay not to send a message to all players
  14741.  * when a players remote data changes
  14742.  *)
  14743.   DPSESSION_NODATAMESSAGES = $00000080;
  14744.  
  14745. (*
  14746.  * This flag indicates that the session belongs to a secure server
  14747.  * and needs user authentication
  14748.  *)
  14749.   DPSESSION_SECURESERVER = $00000100;
  14750.  
  14751. (*
  14752.  * This flag indicates that the session is private and requirs a password
  14753.  * for EnumSessions as well as Open.
  14754.  *)
  14755.   DPSESSION_PRIVATE = $00000200;
  14756.  
  14757. (*
  14758.  * This flag indicates that the session requires a password for joining.
  14759.  *)
  14760.   DPSESSION_PASSWORDREQUIRED = $00000400;
  14761.  
  14762. (*
  14763.  * This flag tells DirectPlay to route all messages through the server
  14764.  *)
  14765.   DPSESSION_MULTICASTSERVER = $00000800;
  14766.  
  14767. (*
  14768.  * This flag tells DirectPlay to only download information about the
  14769.  * DPPLAYER_SERVERPLAYER.
  14770.  *)
  14771.   DPSESSION_CLIENTSERVER = $00001000;
  14772.  
  14773. (*
  14774.  * This flag tells DirectPlay to use the protocol built into dplay
  14775.  * for reliability and statistics all the time.  When this bit is
  14776.  * set, only other sessions with this bit set can join or be joined.
  14777.  *)
  14778.   DPSESSION_DIRECTPLAYPROTOCOL = $00002000;
  14779.  
  14780. (*
  14781.  * This flag tells DirectPlay that preserving order of received
  14782.  * packets is not important, when using reliable delivery.  This
  14783.  * will allow messages to be indicated out of order if preceding
  14784.  * messages have not yet arrived.  Otherwise DPLAY will wait for
  14785.  * earlier messages before delivering later reliable messages.
  14786.  *)
  14787.   DPSESSION_NOPRESERVEORDER = $00004000;
  14788.  
  14789.  
  14790. (*
  14791.  * This flag tells DirectPlay to optimize communication for latency
  14792.  *)
  14793.   DPSESSION_OPTIMIZELATENCY = $00008000;
  14794.  
  14795. type
  14796. (*
  14797.  * TDPName
  14798.  * Used to hold the name of a DirectPlay entity
  14799.  * like a player or a group
  14800.  *)
  14801.   PDPName = ^TDPName;
  14802.   TDPName = packed record
  14803.     dwSize: DWORD;    // Size of structure
  14804.     dwFlags: DWORD;   // Not used. Must be zero.
  14805.     case Integer of
  14806.       0 : (
  14807.     lpszShortName : PCharAW; // The short or friendly name
  14808.     lpszLongName : PCharAW;  // The long or formal name
  14809.       );
  14810.       1 : (
  14811.     lpszShortNameA : PAnsiChar;
  14812.     lpszLongNameA : PAnsiChar;
  14813.       );
  14814.       2 : (
  14815.     lpszShortNameW : PWideChar;
  14816.     lpszLongNameW : PWideChar;
  14817.       );
  14818.   end;
  14819.  
  14820. (*
  14821.  * TDPCredentials
  14822.  * Used to hold the user name and password of a DirectPlay user
  14823.  *)
  14824.  
  14825.   PDPCredentials = ^TDPCredentials;
  14826.   TDPCredentials = packed record
  14827.     dwSize: DWORD;    // Size of structure
  14828.     dwFlags: DWORD;   // Not used. Must be zero.
  14829.     case Integer of
  14830.       0 : (
  14831.     lpszUsername: PCharAW;   // User name of the account
  14832.     lpszPassword: PCharAW;   // Password of the account
  14833.     lpszDomain:   PCharAW;   // Domain name of the account
  14834.       );
  14835.       1 : (
  14836.     lpszUsernameA: PAnsiChar;   // User name of the account
  14837.     lpszPasswordA: PAnsiChar;   // Password of the account
  14838.     lpszDomainA:   PAnsiChar;   // Domain name of the account
  14839.       );
  14840.       2 : (
  14841.     lpszUsernameW: PWideChar;   // User name of the account
  14842.     lpszPasswordW: PWideChar;   // Password of the account
  14843.     lpszDomainW:   PWideChar;   // Domain name of the account
  14844.       );
  14845.   end;
  14846.  
  14847. (*
  14848.  * TDPSecurityDesc
  14849.  * Used to describe the security properties of a DirectPlay
  14850.  * session instance
  14851.  *)
  14852.   PDPSecurityDesc = ^TDPSecurityDesc;
  14853.   TDPSecurityDesc = packed record
  14854.     dwSize: DWORD;                  // Size of structure
  14855.     dwFlags: DWORD;                 // Not used. Must be zero.
  14856.     case Integer of
  14857.       0 : (
  14858.     lpszSSPIProvider : PCharAW;  // SSPI provider name
  14859.     lpszCAPIProvider : PCharAW;  // CAPI provider name
  14860.     dwCAPIProviderType: DWORD;      // Crypto Service Provider type
  14861.     dwEncryptionAlgorithm: DWORD;   // Encryption Algorithm type
  14862.       );
  14863.       1 : (
  14864.     lpszSSPIProviderA : PAnsiChar;  // SSPI provider name
  14865.     lpszCAPIProviderA : PAnsiChar;  // CAPI provider name
  14866.       );
  14867.       2 : (
  14868.     lpszSSPIProviderW : PWideChar;  // SSPI provider name
  14869.     lpszCAPIProviderW : PWideChar;  // CAPI provider name
  14870.       );
  14871.   end;
  14872.  
  14873. (*
  14874.  * DPACCOUNTDESC
  14875.  * Used to describe a user membership account
  14876.  *)
  14877.  
  14878.   PDPAccountDesc = ^TDPAccountDesc;
  14879.   TDPAccountDesc = packed record
  14880.     dwSize: DWORD;    // Size of structure
  14881.     dwFlags: DWORD;   // Not used. Must be zero.
  14882.     case Integer of
  14883.       0 : (lpszAccountID : PCharAW);  // Account identifier
  14884.       1 : (lpszAccountIDA : PAnsiChar);
  14885.       2 : (lpszAccountIDW : PWideChar);
  14886.   end;
  14887.  
  14888. (*
  14889.  * TDPLConnection
  14890.  * Used to hold all in the informaion needed to connect
  14891.  * an application to a session or create a session
  14892.  *)
  14893.   PDPLConnection = ^TDPLConnection;
  14894.   TDPLConnection = packed record
  14895.     dwSize: DWORD;                     // Size of this structure
  14896.     dwFlags: DWORD;                    // Flags specific to this structure
  14897.     lpSessionDesc: PDPSessionDesc2;    // Pointer to session desc to use on connect
  14898.     lpPlayerName: PDPName;             // Pointer to Player name structure
  14899.     guidSP: TGUID;                     // GUID of the DPlay SP to use
  14900.     lpAddress: Pointer;                // Address for service provider
  14901.     dwAddressSize: DWORD;              // Size of address data
  14902.   end;
  14903.  
  14904. (*
  14905.  * TDPChat
  14906.  * Used to hold the a DirectPlay chat message
  14907.  *)
  14908.   PDPChat = ^TDPChat;
  14909.   TDPChat = packed record
  14910.     dwSize: DWORD;
  14911.     dwFlags: DWORD;
  14912.     case Integer of
  14913.       0 : (lpszMessage : PCharAW);  // Message string
  14914.       1 : (lpszMessageA : PAnsiChar);
  14915.       2 : (lpszMessageW : PWideChar);
  14916.   end;
  14917.  
  14918. (*
  14919.  * TSGBuffer
  14920.  * Scatter Gather Buffer used for SendEx
  14921.  *)
  14922.   PSGBuffer = ^TSGBuffer;
  14923.   TSGBuffer = packed record
  14924.     len: UINT;
  14925.     pData: PUCHAR;
  14926.   end;
  14927.  
  14928. (****************************************************************************
  14929.  *
  14930.  * Prototypes for DirectPlay callback functions
  14931.  *
  14932.  ****************************************************************************)
  14933.  
  14934. (*
  14935.  * Callback for IDirectPlay2::EnumSessions
  14936.  *)
  14937.   TDPEnumSessionsCallback2 = function(lpThisSD: PDPSessionDesc2;
  14938.       var lpdwTimeOut: DWORD; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
  14939.  
  14940. const
  14941. (*
  14942.  * This flag is set on the EnumSessions callback dwFlags parameter when
  14943.  * the time out has occurred. There will be no session data for this
  14944.  * callback. If *lpdwTimeOut is set to a non-zero value and the
  14945.  * EnumSessionsCallback function returns TRUE then EnumSessions will
  14946.  * continue waiting until the next timeout occurs. Timeouts are in
  14947.  * milliseconds.
  14948.  *)
  14949.   DPESC_TIMEDOUT = $00000001;
  14950.  
  14951. type
  14952. (*
  14953.  * Callback for IDirectPlay2.EnumPlayers
  14954.  *              IDirectPlay2.EnumGroups
  14955.  *              IDirectPlay2.EnumGroupPlayers
  14956.  *)
  14957.   TDPEnumPlayersCallback2 = function(DPID: TDPID; dwPlayerType: DWORD;
  14958.       const lpName: TDPName; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
  14959.  
  14960.  
  14961. (*
  14962.  * ANSI callback for DirectPlayEnumerate
  14963.  * This callback prototype will be used if compiling
  14964.  * for ANSI strings
  14965.  *)
  14966.   TDPEnumDPCallbackA = function(const lpguidSP: TGUID; lpSPName: PAnsiChar;
  14967.       dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer) : BOOL; stdcall;
  14968.  
  14969. (*
  14970.  * Unicode callback for DirectPlayEnumerate
  14971.  * This callback prototype will be used if compiling
  14972.  * for Unicode strings
  14973.  *)
  14974.   TDPEnumDPCallbackW = function(const lpguidSP: TGUID; lpSPName: PWideChar;
  14975.       dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer) : BOOL; stdcall;
  14976.  
  14977. (*
  14978.  * Callback for DirectPlayEnumerate
  14979.  *)
  14980. {$IFDEF UNICODE}
  14981.   TDPEnumDPCallback = TDPEnumDPCallbackW;
  14982. {$ELSE}
  14983.   TDPEnumDPCallback = TDPEnumDPCallbackA;
  14984. {$ENDIF}
  14985.  
  14986. (*
  14987.  * Callback for IDirectPlay3(A/W).EnumConnections
  14988.  *)
  14989.   TDPEnumConnectionsCallback = function(const lpguidSP: TGUID;
  14990.       lpConnection: Pointer; dwConnectionSize: DWORD; const lpName: TDPName;
  14991.       dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
  14992.  
  14993. (*
  14994.  * API's
  14995.  *)
  14996.  
  14997. var
  14998.   DirectPlayEnumerate : function (lpEnumDPCallback: TDPEnumDPCallback;
  14999.       lpContext: Pointer) : HResult; stdcall;
  15000.   DirectPlayEnumerateA : function (lpEnumDPCallback: TDPEnumDPCallbackA;
  15001.       lpContext: Pointer) : HResult; stdcall;
  15002.   DirectPlayEnumerateW : function (lpEnumDPCallback: TDPEnumDPCallbackW;
  15003.       lpContext: Pointer) : HResult; stdcall;
  15004.  
  15005.  
  15006. (****************************************************************************
  15007.  *
  15008.  * IDirectPlay2 (and IDirectPlay2A) Interface
  15009.  *
  15010.  ****************************************************************************)
  15011.  
  15012. type
  15013.   IDirectPlay2AW = interface (IUnknown)
  15014.     (*** IDirectPlay2 methods ***)
  15015.     function AddPlayerToGroup(idGroup: TDPID; idPlayer: TDPID) : HResult; stdcall;
  15016.     function Close: HResult; stdcall;
  15017.     function CreateGroup(out lpidGroup: TDPID; lpGroupName: PDPName;
  15018.         lpData: Pointer; dwDataSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  15019.     function CreatePlayer(out lpidPlayer: TDPID; pPlayerName: PDPName;
  15020.         hEvent: THandle; lpData: Pointer; dwDataSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  15021.     function DeletePlayerFromGroup(idGroup: TDPID; idPlayer: TDPID) : HResult; stdcall;
  15022.     function DestroyGroup(idGroup: TDPID) : HResult; stdcall;
  15023.     function DestroyPlayer(idPlayer: TDPID) : HResult; stdcall;
  15024.     function EnumGroupPlayers(idGroup: TDPID; lpguidInstance: PGUID;
  15025.         lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
  15026.         dwFlags: DWORD) : HResult; stdcall;
  15027.     function EnumGroups(lpguidInstance: PGUID; lpEnumPlayersCallback2:
  15028.         TDPEnumPlayersCallback2; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  15029.     function EnumPlayers(lpguidInstance: PGUID; lpEnumPlayersCallback2:
  15030.         TDPEnumPlayersCallback2; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  15031.     function EnumSessions(const lpsd: TDPSessionDesc2; dwTimeout: DWORD;
  15032.         lpEnumSessionsCallback2: TDPEnumSessionsCallback2; lpContext: Pointer;
  15033.         dwFlags: DWORD) : HResult; stdcall;
  15034.     function GetCaps(var lpDPCaps: TDPCaps; dwFlags: DWORD) : HResult; stdcall;
  15035.     function GetGroupData(idGroup: TDPID; lpData: Pointer; var lpdwDataSize: DWORD;
  15036.         dwFlags: DWORD) : HResult; stdcall;
  15037.     function GetGroupName(idGroup: TDPID; lpData: Pointer; var lpdwDataSize: DWORD) :
  15038.         HResult; stdcall;
  15039.     function GetMessageCount(idPlayer: TDPID; var lpdwCount: DWORD) : HResult; stdcall;
  15040.     function GetPlayerAddress(idPlayer: TDPID; lpAddress: Pointer;
  15041.         var lpdwAddressSize: DWORD) : HResult; stdcall;
  15042.     function GetPlayerCaps(idPlayer: TDPID; var lpPlayerCaps: TDPCaps;
  15043.         dwFlags: DWORD) : HResult; stdcall;
  15044.     function GetPlayerData(idPlayer: TDPID; lpData: Pointer; var lpdwDataSize: DWORD;
  15045.         dwFlags: DWORD) : HResult; stdcall;
  15046.     function GetPlayerName(idPlayer: TDPID; lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
  15047.     function GetSessionDesc(lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
  15048.     function Initialize(const lpGUID: TGUID) : HResult; stdcall;
  15049.     function Open(var lpsd: TDPSessionDesc2; dwFlags: DWORD) : HResult; stdcall;
  15050.     function Receive(var lpidFrom: TDPID; var lpidTo: TDPID; dwFlags: DWORD;
  15051.         lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
  15052.     function Send(idFrom: TDPID; lpidTo: TDPID; dwFlags: DWORD; var lpData;
  15053.         lpdwDataSize: DWORD) : HResult; stdcall;
  15054.     function SetGroupData(idGroup: TDPID; lpData: Pointer; dwDataSize: DWORD;
  15055.         dwFlags: DWORD) : HResult; stdcall;
  15056.     function SetGroupName(idGroup: TDPID; lpGroupName: PDPName;
  15057.         dwFlags: DWORD) : HResult; stdcall;
  15058.     function SetPlayerData(idPlayer: TDPID; lpData: Pointer; dwDataSize: DWORD;
  15059.         dwFlags: DWORD) : HResult; stdcall;
  15060.     function SetPlayerName(idPlayer: TDPID; lpPlayerName: PDPName;
  15061.         dwFlags: DWORD) : HResult; stdcall;
  15062.     function SetSessionDesc(var lpSessDesc: TDPSessionDesc2; dwFlags: DWORD) :
  15063.         HResult; stdcall;
  15064.   end;
  15065.  
  15066.   IDirectPlay2W = interface (IDirectPlay2AW)
  15067.     ['{2B74F7C0-9154-11CF-A9CD-00AA006886E3}']
  15068.   end;
  15069.   IDirectPlay2A = interface (IDirectPlay2AW)
  15070.     ['{9d460580-a822-11cf-960c-0080c7534e82}']
  15071.   end;
  15072.  
  15073. {$IFDEF UNICODE}
  15074.   IDirectPlay2 = IDirectPlay2W;
  15075. {$ELSE}
  15076.   IDirectPlay2 = IDirectPlay2A;
  15077. {$ENDIF}
  15078.  
  15079. (****************************************************************************
  15080.  *
  15081.  * IDirectPlay3 (and IDirectPlay3A) Interface
  15082.  *
  15083.  ****************************************************************************)
  15084.  
  15085.   IDirectPlay3AW = interface (IDirectPlay2AW)
  15086.     (*** IDirectPlay3 methods ***)
  15087.     function AddGroupToGroup(idParentGroup: TDPID; idGroup: TDPID) : HResult; stdcall;
  15088.     function CreateGroupInGroup(idParentGroup: TDPID; var lpidGroup: TDPID;
  15089.         lpGroupName: PDPName; lpData: Pointer; dwDataSize: DWORD;
  15090.         dwFlags: DWORD) : HResult; stdcall;
  15091.     function DeleteGroupFromGroup(idParentGroup: TDPID; idGroup: TDPID) : HResult; stdcall;
  15092.     function EnumConnections(lpguidApplication: PGUID;
  15093.         lpEnumCallback: TDPEnumConnectionsCallback; lpContext: Pointer;
  15094.         dwFlags: DWORD) : HResult; stdcall;
  15095.     function EnumGroupsInGroup(idGroup: TDPID; lpguidInstance: PGUID;
  15096.         lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
  15097.         dwFlags: DWORD) : HResult; stdcall;
  15098.     function GetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
  15099.         lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
  15100.     function InitializeConnection(lpConnection: Pointer; dwFlags: DWORD) : HResult; stdcall;
  15101.     function SecureOpen(var lpsd: TDPSessionDesc2; dwFlags: DWORD;
  15102.         var lpSecurity: TDPSecurityDesc; var lpCredentials: TDPCredentials) : HResult; stdcall;
  15103.     function SendChatMessage(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
  15104.         var lpChatMessage: TDPChat) : HResult; stdcall;
  15105.     function SetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
  15106.         var lpConnection: TDPLConnection) : HResult; stdcall;
  15107.     function StartSession(dwFlags: DWORD; idGroup: TDPID) : HResult; stdcall;
  15108.     function GetGroupFlags(idGroup: TDPID; out lpdwFlags: DWORD) : HResult; stdcall;
  15109.     function GetGroupParent(idGroup: TDPID; out lpidParent: TDPID) : HResult; stdcall;
  15110.     function GetPlayerAccount(idPlayer: TDPID; dwFlags: DWORD; var lpData;
  15111.         var lpdwDataSize: DWORD) : HResult; stdcall;
  15112.     function GetPlayerFlags(idPlayer: TDPID; out lpdwFlags: DWORD) : HResult; stdcall;
  15113.   end;
  15114.  
  15115.  
  15116.   IDirectPlay3W = interface (IDirectPlay3AW)
  15117.     ['{133EFE40-32DC-11D0-9CFB-00A0C90A43CB}']
  15118.   end;
  15119.   IDirectPlay3A = interface (IDirectPlay3AW)
  15120.     ['{133efe41-32dc-11d0-9cfb-00a0c90a43cb}']
  15121.   end;
  15122.  
  15123. {$IFDEF UNICODE}
  15124.   IDirectPlay3 = IDirectPlay3W;
  15125. {$ELSE}
  15126.   IDirectPlay3 = IDirectPlay3A;
  15127. {$ENDIF}
  15128.  
  15129.  
  15130. (****************************************************************************
  15131.  *
  15132.  * IDirectPlay4 (and IDirectPlay4A) Interface
  15133.  *
  15134.  ****************************************************************************)
  15135.  
  15136.   IDirectPlay4AW = interface (IDirectPlay3AW)
  15137.     (*** IDirectPlay4 methods ***)
  15138.     function GetGroupOwner(idGroup: TDPID; out idOwner: TDPID) : HResult; stdcall;
  15139.     function SetGroupOwner(idGroup: TDPID; idOwner: TDPID) : HResult; stdcall;
  15140.     function SendEx(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD; lpData: Pointer;
  15141.         dwDataSize: DWORD; dwPriority: DWORD; dwTimeout: DWORD;
  15142.         lpContext: Pointer; lpdwMsgId: PDWORD) : HResult; stdcall;
  15143.     function GetMessageQueue(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
  15144.         lpdwNumMsgs: PDWORD; lpdwNumBytes: PDWORD) : HResult; stdcall;
  15145.     function CancelMessage(dwMessageID: DWORD; dwFlags: DWORD) : HResult; stdcall;
  15146.     function CancelPriority(dwMinPriority: DWORD; dwMaxPriority: DWORD; dwFlags: DWORD) : HResult; stdcall;
  15147.   end;
  15148.  
  15149.  
  15150.   IDirectPlay4W = interface (IDirectPlay4AW)
  15151.     ['{0ab1c530-4745-11D1-a7a1-0000f803abfc}']
  15152.   end;
  15153.   IDirectPlay4A = interface (IDirectPlay4AW)
  15154.     ['{0ab1c531-4745-11D1-a7a1-0000f803abfc}']
  15155.   end;
  15156.  
  15157. {$IFDEF UNICODE}
  15158.   IDirectPlay4 = IDirectPlay4W;
  15159. {$ELSE}
  15160.   IDirectPlay4 = IDirectPlay4A;
  15161. {$ENDIF}
  15162.  
  15163.  
  15164. const
  15165. (****************************************************************************
  15166.  *
  15167.  * EnumConnections API flags
  15168.  *
  15169.  ****************************************************************************)
  15170.  
  15171. (*
  15172.  * Enumerate Service Providers
  15173.  *)
  15174.   DPCONNECTION_DIRECTPLAY = $00000001;
  15175.  
  15176. (*
  15177.  * Enumerate Lobby Providers
  15178.  *)
  15179.   DPCONNECTION_DIRECTPLAYLOBBY = $00000002;
  15180.  
  15181. (****************************************************************************
  15182.  *
  15183.  * EnumPlayers API flags
  15184.  *
  15185.  ****************************************************************************)
  15186.  
  15187. (*
  15188.  * Enumerate all players in the current session
  15189.  *)
  15190.   DPENUMPLAYERS_ALL = $00000000;
  15191.   DPENUMGROUPS_ALL = DPENUMPLAYERS_ALL;
  15192.  
  15193. (*
  15194.  * Enumerate only local (created by this application) players
  15195.  * or groups
  15196.  *)
  15197.   DPENUMPLAYERS_LOCAL = $00000008;
  15198.   DPENUMGROUPS_LOCAL = DPENUMPLAYERS_LOCAL;
  15199.  
  15200. (*
  15201.  * Enumerate only remote (non-local) players
  15202.  * or groups
  15203.  *)
  15204.   DPENUMPLAYERS_REMOTE = $00000010;
  15205.   DPENUMGROUPS_REMOTE = DPENUMPLAYERS_REMOTE;
  15206.  
  15207. (*
  15208.  * Enumerate groups along with the players
  15209.  *)
  15210.   DPENUMPLAYERS_GROUP = $00000020;
  15211.  
  15212. (*
  15213.  * Enumerate players or groups in another session
  15214.  * (must supply lpguidInstance)
  15215.  *)
  15216.   DPENUMPLAYERS_SESSION = $00000080;
  15217.   DPENUMGROUPS_SESSION = DPENUMPLAYERS_SESSION;
  15218.  
  15219. (*
  15220.  * Enumerate server players
  15221.  *)
  15222.   DPENUMPLAYERS_SERVERPLAYER = $00000100;
  15223.  
  15224. (*
  15225.  * Enumerate spectator players
  15226.  *)
  15227.   DPENUMPLAYERS_SPECTATOR = $00000200;
  15228.  
  15229. (*
  15230.  * Enumerate shortcut groups
  15231.  *)
  15232.   DPENUMGROUPS_SHORTCUT = $00000400;
  15233.  
  15234. (*
  15235.  * Enumerate staging area groups
  15236.  *)
  15237.   DPENUMGROUPS_STAGINGAREA = $00000800;
  15238.  
  15239. (*
  15240.  * Enumerate hidden groups
  15241.  *)
  15242.   DPENUMGROUPS_HIDDEN = $00001000;
  15243.  
  15244. (*
  15245.  * Enumerate the group's owner
  15246.  *)
  15247.   DPENUMPLAYERS_OWNER = $00002000;
  15248.  
  15249. (****************************************************************************
  15250.  *
  15251.  * CreatePlayer API flags
  15252.  *
  15253.  ****************************************************************************)
  15254.  
  15255. (*
  15256.  * This flag indicates that this player should be designated
  15257.  * the server player. The app should specify this at CreatePlayer.
  15258.  *)
  15259.   DPPLAYER_SERVERPLAYER = DPENUMPLAYERS_SERVERPLAYER;
  15260.  
  15261. (*
  15262.  * This flag indicates that this player should be designated
  15263.  * a spectator. The app should specify this at CreatePlayer.
  15264.  *)
  15265.   DPPLAYER_SPECTATOR = DPENUMPLAYERS_SPECTATOR;
  15266.  
  15267. (*
  15268.  * This flag indicates that this player was created locally.
  15269.  * (returned from GetPlayerFlags)
  15270.  *)
  15271.   DPPLAYER_LOCAL = DPENUMPLAYERS_LOCAL;
  15272.  
  15273. (*
  15274.  * This flag indicates that this player is the group's owner
  15275.  * (Only returned in EnumGroupPlayers)
  15276.  *)
  15277.   DPPLAYER_OWNER = DPENUMPLAYERS_OWNER;
  15278.  
  15279. (****************************************************************************
  15280.  *
  15281.  * CreateGroup API flags
  15282.  *
  15283.  ****************************************************************************)
  15284.  
  15285. (*
  15286.  * This flag indicates that the StartSession can be called on the group.
  15287.  * The app should specify this at CreateGroup, or CreateGroupInGroup.
  15288.  *)
  15289.   DPGROUP_STAGINGAREA = DPENUMGROUPS_STAGINGAREA;
  15290.  
  15291. (*
  15292.  * This flag indicates that this group was created locally.
  15293.  * (returned from GetGroupFlags)
  15294.  *)
  15295.   DPGROUP_LOCAL = DPENUMGROUPS_LOCAL;
  15296.  
  15297. (*
  15298.  * This flag indicates that this group was created hidden.
  15299.  *)
  15300.   DPGROUP_HIDDEN = DPENUMGROUPS_HIDDEN;
  15301.  
  15302. (****************************************************************************
  15303.  *
  15304.  * EnumSessions API flags
  15305.  *
  15306.  ****************************************************************************)
  15307.  
  15308. (*
  15309.  * Enumerate sessions which can be joined
  15310.  *)
  15311.   DPENUMSESSIONS_AVAILABLE = $00000001;
  15312.  
  15313. (*
  15314.  * Enumerate all sessions even if they can't be joined.
  15315.  *)
  15316.   DPENUMSESSIONS_ALL = $00000002;
  15317.  
  15318. (*
  15319.  * Start an asynchronous enum sessions
  15320.  *)
  15321.   DPENUMSESSIONS_ASYNC = $00000010;
  15322.  
  15323. (*
  15324.  * Stop an asynchronous enum sessions
  15325.  *)
  15326.   DPENUMSESSIONS_STOPASYNC = $00000020;
  15327.  
  15328. (*
  15329.  * Enumerate sessions even if they require a password
  15330.  *)
  15331.   DPENUMSESSIONS_PASSWORDREQUIRED = $00000040;
  15332.  
  15333. (*
  15334.  * Return status about progress of enumeration instead of
  15335.  * showing any status dialogs.
  15336.  *)
  15337.   DPENUMSESSIONS_RETURNSTATUS = $00000080;
  15338.  
  15339. (****************************************************************************
  15340.  *
  15341.  * GetCaps and GetPlayerCaps API flags
  15342.  *
  15343.  ****************************************************************************)
  15344.  
  15345. (*
  15346.  * The latency returned should be for guaranteed message sending.
  15347.  * Default is non-guaranteed messaging.
  15348.  *)
  15349.   DPGETCAPS_GUARANTEED = $00000001;
  15350.  
  15351. (****************************************************************************
  15352.  *
  15353.  * GetGroupData, GetPlayerData API flags
  15354.  * Remote and local Group/Player data is maintained separately.
  15355.  * Default is DPGET_REMOTE.
  15356.  *
  15357.  ****************************************************************************)
  15358.  
  15359. (*
  15360.  * Get the remote data (set by any DirectPlay object in
  15361.  * the session using DPSET_REMOTE)
  15362.  *)
  15363.   DPGET_REMOTE = $00000000;
  15364.  
  15365. (*
  15366.  * Get the local data (set by this DirectPlay object
  15367.  * using DPSET_LOCAL)
  15368.  *)
  15369.   DPGET_LOCAL = $00000001;
  15370.  
  15371. (****************************************************************************
  15372.  *
  15373.  * Open API flags
  15374.  *
  15375.  ****************************************************************************)
  15376.  
  15377. (*
  15378.  * Join the session that is described by the DPSESSIONDESC2 structure
  15379.  *)
  15380.   DPOPEN_JOIN = $00000001;
  15381.  
  15382. (*
  15383.  * Create a new session as described by the DPSESSIONDESC2 structure
  15384.  *)
  15385.   DPOPEN_CREATE = $00000002;
  15386.  
  15387. (*
  15388.  * Return status about progress of open instead of showing
  15389.  * any status dialogs.
  15390.  *)
  15391.   DPOPEN_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
  15392.  
  15393. (****************************************************************************
  15394.  *
  15395.  * DPLCONNECTION flags
  15396.  *
  15397.  ****************************************************************************)
  15398.  
  15399. (*
  15400.  * This application should create a new session as
  15401.  * described by the DPSESIONDESC structure
  15402.  *)
  15403.   DPLCONNECTION_CREATESESSION = DPOPEN_CREATE;
  15404.  
  15405. (*
  15406.  * This application should join the session described by
  15407.  * the DPSESIONDESC structure with the lpAddress data
  15408.  *)
  15409.   DPLCONNECTION_JOINSESSION = DPOPEN_JOIN;
  15410.  
  15411. (****************************************************************************
  15412.  *
  15413.  * Receive API flags
  15414.  * Default is DPRECEIVE_ALL
  15415.  *
  15416.  ****************************************************************************)
  15417.  
  15418. (*
  15419.  * Get the first message in the queue
  15420.  *)
  15421.   DPRECEIVE_ALL = $00000001;
  15422.  
  15423. (*
  15424.  * Get the first message in the queue directed to a specific player
  15425.  *)
  15426.   DPRECEIVE_TOPLAYER = $00000002;
  15427.  
  15428. (*
  15429.  * Get the first message in the queue from a specific player
  15430.  *)
  15431.   DPRECEIVE_FROMPLAYER = $00000004;
  15432.  
  15433. (*
  15434.  * Get the message but don't remove it from the queue
  15435.  *)
  15436.   DPRECEIVE_PEEK = $00000008;
  15437.  
  15438. (****************************************************************************
  15439.  *
  15440.  * Send API flags
  15441.  *
  15442.  ****************************************************************************)
  15443.  
  15444. (*
  15445.  * Send the message using a guaranteed send method.
  15446.  * Default is non-guaranteed.
  15447.  *)
  15448.   DPSEND_GUARANTEED = $00000001;
  15449.  
  15450. (*
  15451.  * This flag is obsolete. It is ignored by DirectPlay
  15452.  *)
  15453.   DPSEND_HIGHPRIORITY = $00000002;
  15454.  
  15455. (*
  15456.  * This flag is obsolete. It is ignored by DirectPlay
  15457.  *)
  15458.   DPSEND_OPENSTREAM = $00000008;
  15459.  
  15460. (*
  15461.  * This flag is obsolete. It is ignored by DirectPlay
  15462.  *)
  15463.   DPSEND_CLOSESTREAM = $00000010;
  15464.  
  15465. (*
  15466.  * Send the message digitally signed to ensure authenticity.
  15467.  *)
  15468.   DPSEND_SIGNED = $00000020;
  15469.  
  15470. (*
  15471.  * Send the message with encryption to ensure privacy.
  15472.  *)
  15473.   DPSEND_ENCRYPTED = $00000040;
  15474.  
  15475. (*
  15476.  * The message is a lobby system message
  15477.  *)
  15478.   DPSEND_LOBBYSYSTEMMESSAGE = $00000080;
  15479.  
  15480. (*
  15481.  * andyco - added this so we can make addforward async.
  15482.  * needs to be sanitized when we add / expose full async
  15483.  * support.  8/3/97.
  15484.  *)
  15485.   DPSEND_ASYNC = $00000200;
  15486.  
  15487. (*
  15488.  * When a message is completed, don't tell me.
  15489.  * by default the application is notified with a system message.
  15490.  *)
  15491.   DPSEND_NOSENDCOMPLETEMSG = $00000400;
  15492.  
  15493.  
  15494. (*
  15495.  * Maximum priority for sends available to applications
  15496.  *)
  15497.   DPSEND_MAX_PRI = $0000FFFF;
  15498.   DPSEND_MAX_PRIORITY = DPSEND_MAX_PRI;
  15499.  
  15500. (****************************************************************************
  15501.  *
  15502.  * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName,
  15503.  * SetSessionDesc API flags.
  15504.  * Default is DPSET_REMOTE.
  15505.  *
  15506.  ****************************************************************************)
  15507.  
  15508. (*
  15509.  * Propagate the data to all players in the session
  15510.  *)
  15511.   DPSET_REMOTE = $00000000;
  15512.  
  15513. (*
  15514.  * Do not propagate the data to other players
  15515.  *)
  15516.   DPSET_LOCAL = $00000001;
  15517.  
  15518. (*
  15519.  * Used with DPSET_REMOTE, use guaranteed message send to
  15520.  * propagate the data
  15521.  *)
  15522.   DPSET_GUARANTEED = $00000002;
  15523.  
  15524. (****************************************************************************
  15525.  *
  15526.  * GetMessageQueue API flags.
  15527.  * Default is DPMESSAGEQUEUE_SEND
  15528.  *
  15529.  ****************************************************************************)
  15530.  
  15531. (*
  15532.  * Get Send Queue - requires Service Provider Support
  15533.  *)
  15534.   DPMESSAGEQUEUE_SEND = $00000001;
  15535.  
  15536. (*
  15537.  * Get Receive Queue
  15538.  *)
  15539.   DPMESSAGEQUEUE_RECEIVE = $00000002;
  15540.  
  15541. (****************************************************************************
  15542.  *
  15543.  * Connect API flags
  15544.  *
  15545.  ****************************************************************************)
  15546.  
  15547. (*
  15548.  * Start an asynchronous connect which returns status codes
  15549.  *)
  15550.   DPCONNECT_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
  15551.  
  15552. (****************************************************************************
  15553.  *
  15554.  * DirectPlay system messages and message data structures
  15555.  *
  15556.  * All system message come 'From' player DPID_SYSMSG.  To determine what type
  15557.  * of message it is, cast the lpData from Receive to TDPMsg_Generic and check
  15558.  * the dwType member against one of the following DPSYS_xxx constants. Once
  15559.  * a match is found, cast the lpData to the corresponding of the DPMSG_xxx
  15560.  * structures to access the data of the message.
  15561.  *
  15562.  ****************************************************************************)
  15563.  
  15564. (*
  15565.  * A new player or group has been created in the session
  15566.  * Use TDPMsg_CreatePlayerOrGroup.  Check dwPlayerType to see if it
  15567.  * is a player or a group.
  15568.  *)
  15569.   DPSYS_CREATEPLAYERORGROUP = $0003;
  15570.  
  15571. (*
  15572.  * A player has been deleted from the session
  15573.  * Use TDPMsg_DestroyPlayerOrGroup
  15574.  *)
  15575.   DPSYS_DESTROYPLAYERORGROUP = $0005;
  15576.  
  15577. (*
  15578.  * A player has been added to a group
  15579.  * Use DPMSG_ADDPLAYERTOGROUP
  15580.  *)
  15581.   DPSYS_ADDPLAYERTOGROUP = $0007;
  15582.  
  15583. (*
  15584.  * A player has been removed from a group
  15585.  * Use DPMSG_DELETEPLAYERFROMGROUP
  15586.  *)
  15587.   DPSYS_DELETEPLAYERFROMGROUP = $0021;
  15588.  
  15589. (*
  15590.  * This DirectPlay object lost its connection with all the
  15591.  * other players in the session.
  15592.  * Use DPMSG_SESSIONLOST.
  15593.  *)
  15594.   DPSYS_SESSIONLOST = $0031;
  15595.  
  15596. (*
  15597.  * The current host has left the session.
  15598.  * This DirectPlay object is now the host.
  15599.  * Use DPMSG_HOST.
  15600.  *)
  15601.   DPSYS_HOST = $0101;
  15602.  
  15603. (*
  15604.  * The remote data associated with a player or
  15605.  * group has changed. Check dwPlayerType to see
  15606.  * if it is a player or a group
  15607.  * Use DPMSG_SETPLAYERORGROUPDATA
  15608.  *)
  15609.   DPSYS_SETPLAYERORGROUPDATA = $0102;
  15610.  
  15611. (*
  15612.  * The name of a player or group has changed.
  15613.  * Check dwPlayerType to see if it is a player
  15614.  * or a group.
  15615.  * Use TDPMsg_SetPlayerOrGroupName
  15616.  *)
  15617.   DPSYS_SETPLAYERORGROUPNAME = $0103;
  15618.  
  15619. (*
  15620.  * The session description has changed.
  15621.  * Use DPMSG_SETSESSIONDESC
  15622.  *)
  15623.   DPSYS_SETSESSIONDESC = $0104;
  15624.  
  15625. (*
  15626.  * A group has been added to a group
  15627.  * Use TDPMsg_AddGroupToGroup
  15628.  *)
  15629.   DPSYS_ADDGROUPTOGROUP = $0105;
  15630.  
  15631. (*
  15632.  * A group has been removed from a group
  15633.  * Use DPMsg_DeleteGroupFromGroup
  15634.  *)
  15635.   DPSYS_DELETEGROUPFROMGROUP = $0106;
  15636.  
  15637. (*
  15638.  * A secure player-player message has arrived.
  15639.  * Use DPMSG_SECUREMESSAGE
  15640.  *)
  15641.   DPSYS_SECUREMESSAGE = $0107;
  15642.  
  15643. (*
  15644.  * Start a new session.
  15645.  * Use DPMSG_STARTSESSION
  15646.  *)
  15647.   DPSYS_STARTSESSION = $0108;
  15648.  
  15649. (*
  15650.  * A chat message has arrived
  15651.  * Use DPMSG_CHAT
  15652.  *)
  15653.   DPSYS_CHAT = $0109;
  15654.  
  15655. (*
  15656.  * The owner of a group has changed
  15657.  * Use DPMSG_SETGROUPOWNER
  15658.  *)
  15659.   DPSYS_SETGROUPOWNER = $010A;
  15660.  
  15661. (*
  15662.  * An async send has finished, failed or been cancelled
  15663.  * Use DPMSG_SENDCOMPLETE
  15664.  *)
  15665.   DPSYS_SENDCOMPLETE = $010D;
  15666.  
  15667. (*
  15668.  * Used in the dwPlayerType field to indicate if it applies to a group
  15669.  * or a player
  15670.  *)
  15671.   DPPLAYERTYPE_GROUP = $00000000;
  15672.   DPPLAYERTYPE_PLAYER = $00000001;
  15673.  
  15674. type
  15675. (*
  15676.  * TDPMsg_Generic
  15677.  * Generic message structure used to identify the message type.
  15678.  *)
  15679.   PDPMsg_Generic = ^TDPMsg_Generic;
  15680.   TDPMsg_Generic = packed record
  15681.     dwType: DWORD;   // Message type
  15682.   end;
  15683.  
  15684. (*
  15685.  * TDPMsg_CreatePlayerOrGroup
  15686.  * System message generated when a new player or group
  15687.  * created in the session with information about it.
  15688.  *)
  15689.   PDPMsg_CreatePlayerOrGroup = ^TDPMsg_CreatePlayerOrGroup;
  15690.   TDPMsg_CreatePlayerOrGroup = packed record
  15691.     dwType: DWORD;             // Message type
  15692.     dwPlayerType: DWORD;       // Is it a player or group
  15693.     DPID: TDPID;               // ID of the player or group
  15694.     dwCurrentPlayers: DWORD;   // current # players & groups in session
  15695.     lpData: Pointer;           // pointer to remote data
  15696.     dwDataSize: DWORD;         // size of remote data
  15697.     dpnName: TDPName;           // structure with name info
  15698.                                // the following fields are only available when using
  15699.                                // the IDirectPlay3 interface or greater
  15700.     dpIdParent: TDPID;         // id of parent group
  15701.     dwFlags: DWORD;            // player or group flags
  15702.   end;
  15703.  
  15704. (*
  15705.  * TDPMsg_DestroyPlayerOrGroup
  15706.  * System message generated when a player or group is being
  15707.  * destroyed in the session with information about it.
  15708.  *)
  15709.   PDPMsg_DestroyPlayerOrGroup= ^TDPMsg_DestroyPlayerOrGroup;
  15710.   TDPMsg_DestroyPlayerOrGroup = packed record
  15711.     dwType: DWORD;             // Message type
  15712.     dwPlayerType: DWORD;       // Is it a player or group
  15713.     DPID: TDPID;                // player ID being deleted
  15714.     lpLocalData: Pointer;      // copy of players local data
  15715.     dwLocalDataSize: DWORD;    // sizeof local data
  15716.     lpRemoteData: Pointer;     // copy of players remote data
  15717.     dwRemoteDataSize: DWORD;   // sizeof remote data
  15718.                                // the following fields are only available when using
  15719.                                // the IDirectPlay3 interface or greater
  15720.     dpnName: TDPName;           // structure with name info
  15721.     dpIdParent: TDPID;          // id of parent group
  15722.     dwFlags: DWORD;            // player or group flags
  15723.   end;
  15724.  
  15725. (*
  15726.  * DPMSG_ADDPLAYERTOGROUP
  15727.  * System message generated when a player is being added
  15728.  * to a group.
  15729.  *)
  15730.   PDPMsg_AddPlayerToGroup = ^TDPMsg_AddPlayerToGroup;
  15731.   TDPMsg_AddPlayerToGroup = packed record
  15732.     dwType: DWORD;      // Message type
  15733.     dpIdGroup: TDPID;    // group ID being added to
  15734.     dpIdPlayer: TDPID;   // player ID being added
  15735.   end;
  15736.  
  15737. (*
  15738.  * DPMSG_DELETEPLAYERFROMGROUP
  15739.  * System message generated when a player is being
  15740.  * removed from a group
  15741.  *)
  15742.   PDPMsg_DeletePlayerFromGroup = ^TDPMsg_DeletePlayerFromGroup;
  15743.   TDPMsg_DeletePlayerFromGroup = TDPMsg_AddPlayerToGroup;
  15744.  
  15745. (*
  15746.  * TDPMsg_AddGroupToGroup
  15747.  * System message generated when a group is being added
  15748.  * to a group.
  15749.  *)
  15750.   PDPMsg_AddGroupToGroup = ^TDPMsg_AddGroupToGroup;
  15751.   TDPMsg_AddGroupToGroup = packed record
  15752.     dwType: DWORD;           // Message type
  15753.     dpIdParentGroup: TDPID;   // group ID being added to
  15754.     dpIdGroup: TDPID;         // group ID being added
  15755.   end;
  15756.  
  15757. (*
  15758.  * DPMsg_DeleteGroupFromGroup
  15759.  * System message generated when a GROUP is being
  15760.  * removed from a group
  15761.  *)
  15762.   PDPMsg_DeleteGroupFromGroup = ^TDPMsg_DeleteGroupFromGroup;
  15763.   TDPMsg_DeleteGroupFromGroup = TDPMsg_AddGroupToGroup;
  15764.  
  15765. (*
  15766.  * DPMSG_SETPLAYERORGROUPDATA
  15767.  * System message generated when remote data for a player or
  15768.  * group has changed.
  15769.  *)
  15770.   PDPMsg_SetPlayerOrGroupData = ^TDPMsg_SetPlayerOrGroupData;
  15771.   TDPMsg_SetPlayerOrGroupData = packed record
  15772.     dwType: DWORD;         // Message type
  15773.     dwPlayerType: DWORD;   // Is it a player or group
  15774.     DPID: TDPID;           // ID of player or group
  15775.     lpData: Pointer;       // pointer to remote data
  15776.     dwDataSize: DWORD;     // size of remote data
  15777.   end;
  15778.  
  15779. (*
  15780.  * DPMSG_SETPLAYERORGROUPNAME
  15781.  * System message generated when the name of a player or
  15782.  * group has changed.
  15783.  *)
  15784.   PDPMsg_SetPlayerOrGroupName = ^TDPMsg_SetPlayerOrGroupName;
  15785.   TDPMsg_SetPlayerOrGroupName = packed record
  15786.     dwType: DWORD;         // Message type
  15787.     dwPlayerType: DWORD;   // Is it a player or group
  15788.     DPID: TDPID;           // ID of player or group
  15789.     dpnName: TDPName;      // structure with new name info
  15790.   end;
  15791.  
  15792. (*
  15793.  * DPMSG_SETSESSIONDESC
  15794.  * System message generated when session desc has changed
  15795.  *)
  15796.   PDPMsg_SetSessionDesc = ^TDPMsg_SetSessionDesc;
  15797.   TDPMsg_SetSessionDesc = packed record
  15798.     dwType: DWORD;            // Message type
  15799.     dpDesc: TDPSessionDesc2;   // Session desc
  15800.   end;
  15801.  
  15802. (*
  15803.  * DPMSG_HOST
  15804.  * System message generated when the host has migrated to this
  15805.  * DirectPlay object.
  15806.  *
  15807.  *)
  15808.   PDPMsg_Host = ^TDPMsg_Host;
  15809.   TDPMsg_Host = TDPMsg_Generic;
  15810.  
  15811. (*
  15812.  * DPMSG_SESSIONLOST
  15813.  * System message generated when the connection to the session is lost.
  15814.  *
  15815.  *)
  15816.   PDPMsg_SessionLost = ^TDPMsg_SessionLost;
  15817.   TDPMsg_SessionLost = TDPMsg_Generic;
  15818.  
  15819. (*
  15820.  * DPMSG_SECUREMESSAGE
  15821.  * System message generated when a player requests a secure send
  15822.  *)
  15823.   PDPMsg_SecureMessage = ^TDPMsg_SecureMessage;
  15824.   TDPMsg_SecureMessage = packed record
  15825.     dwType: DWORD;       // Message Type
  15826.     dwFlags: DWORD;      // Signed/Encrypted
  15827.     dpIdFrom: TDPID;      // ID of Sending Player
  15828.     lpData: Pointer;     // Player message
  15829.     dwDataSize: DWORD;   // Size of player message
  15830.   end;
  15831.  
  15832. (*
  15833.  * DPMSG_STARTSESSION
  15834.  * System message containing all information required to
  15835.  * start a new session
  15836.  *)
  15837.   PDPMsg_StartSession = ^TDPMsg_StartSession;
  15838.   TDPMsg_StartSession = packed record
  15839.     dwType: DWORD;             // Message type
  15840.     lpConn: PDPLConnection;   // TDPLConnection structure
  15841.   end;
  15842.  
  15843. (*
  15844.  * DPMSG_CHAT
  15845.  * System message containing a chat message
  15846.  *)
  15847.   PDPMsg_Chat = ^TDPMsg_Chat;
  15848.   TDPMsg_Chat = packed record
  15849.     dwType: DWORD;        // Message type
  15850.     dwFlags: DWORD;       // Message flags
  15851.     idFromPlayer: TDPID;  // ID of the Sending Player
  15852.     idToPlayer: TDPID;    // ID of the To Player
  15853.     idToGroup: TDPID;     // ID of the To Group
  15854.     lpChat: PDPChat;      // Pointer to a structure containing the chat message
  15855.   end;
  15856.  
  15857. (*
  15858.  * DPMSG_SETGROUPOWNER
  15859.  * System message generated when the owner of a group has changed
  15860.  *)
  15861.   PDPMsg_SetGroupOwner = ^TDPMsg_SetGroupOwner;
  15862.   TDPMsg_SetGroupOwner = packed record
  15863.     dwType: DWORD;        // Message type
  15864.     idGroup: TDPID;       // ID of the group
  15865.     idNewOwner: TDPID;    // ID of the player that is the new owner
  15866.     idOldOwner: TDPID;    // ID of the player that used to be the owner
  15867.   end;
  15868.  
  15869. (*
  15870.  * DPMSG_SENDCOMPLETE
  15871.  * System message generated when finished with an Async Send message
  15872.  *
  15873.  * NOTE SENDPARMS has an overlay for DPMSG_SENDCOMPLETE, don't
  15874.  *                change this message w/o changing SENDPARMS.
  15875.  *)
  15876.   PDPMsg_SendComplete = ^TDPMsg_SendComplete;
  15877.   TDPMsg_SendComplete = packed record
  15878.     dwType: DWORD;        // Message type
  15879.     idFrom: TDPID;
  15880.     idTo: TDPID;
  15881.     dwFlags: DWORD;
  15882.     dwPriority: DWORD;
  15883.     dwTimeout: DWORD;
  15884.     lpvContext: Pointer;
  15885.     dwMsgID: DWORD;
  15886.     hr: HRESULT;
  15887.     dwSendTime: DWORD;
  15888.   end;
  15889.  
  15890. (****************************************************************************
  15891.  *
  15892.  * DIRECTPLAY ERRORS
  15893.  *
  15894.  * Errors are represented by negative values and cannot be combined.
  15895.  *
  15896.  ****************************************************************************)
  15897. const
  15898.   MAKE_DPHRESULT = HResult($88770000);
  15899.  
  15900.   DP_OK = S_OK;
  15901.   DPERR_ALREADYINITIALIZED = MAKE_DPHRESULT + 5;
  15902.   DPERR_ACCESSDENIED = MAKE_DPHRESULT + 10;
  15903.   DPERR_ACTIVEPLAYERS = MAKE_DPHRESULT + 20;
  15904.   DPERR_BUFFERTOOSMALL = MAKE_DPHRESULT + 30;
  15905.   DPERR_CANTADDPLAYER = MAKE_DPHRESULT + 40;
  15906.   DPERR_CANTCREATEGROUP = MAKE_DPHRESULT + 50;
  15907.   DPERR_CANTCREATEPLAYER = MAKE_DPHRESULT + 60;
  15908.   DPERR_CANTCREATESESSION = MAKE_DPHRESULT + 70;
  15909.   DPERR_CAPSNOTAVAILABLEYET = MAKE_DPHRESULT + 80;
  15910.   DPERR_EXCEPTION = MAKE_DPHRESULT + 90;
  15911.   DPERR_GENERIC = E_FAIL;
  15912.   DPERR_INVALIDFLAGS = MAKE_DPHRESULT + 120;
  15913.   DPERR_INVALIDOBJECT = MAKE_DPHRESULT + 130;
  15914.   DPERR_INVALIDPARAM = E_INVALIDARG;
  15915.   DPERR_INVALIDPARAMS = DPERR_INVALIDPARAM;
  15916.   DPERR_INVALIDPLAYER = MAKE_DPHRESULT + 150;
  15917.   DPERR_INVALIDGROUP = MAKE_DPHRESULT + 155;
  15918.   DPERR_NOCAPS = MAKE_DPHRESULT + 160;
  15919.   DPERR_NOCONNECTION = MAKE_DPHRESULT + 170;
  15920.   DPERR_NOMEMORY = E_OUTOFMEMORY;
  15921.   DPERR_OUTOFMEMORY = DPERR_NOMEMORY;
  15922.   DPERR_NOMESSAGES = MAKE_DPHRESULT + 190;
  15923.   DPERR_NONAMESERVERFOUND = MAKE_DPHRESULT + 200;
  15924.   DPERR_NOPLAYERS = MAKE_DPHRESULT + 210;
  15925.   DPERR_NOSESSIONS = MAKE_DPHRESULT + 220;
  15926.   DPERR_PENDING = E_PENDING;
  15927.   DPERR_SENDTOOBIG = MAKE_DPHRESULT + 230;
  15928.   DPERR_TIMEOUT = MAKE_DPHRESULT + 240;
  15929.   DPERR_UNAVAILABLE = MAKE_DPHRESULT + 250;
  15930.   DPERR_UNSUPPORTED = E_NOTIMPL;
  15931.   DPERR_BUSY = MAKE_DPHRESULT + 270;
  15932.   DPERR_USERCANCEL = MAKE_DPHRESULT + 280;
  15933.   DPERR_NOINTERFACE = E_NOINTERFACE;
  15934.   DPERR_CANNOTCREATESERVER = MAKE_DPHRESULT + 290;
  15935.   DPERR_PLAYERLOST = MAKE_DPHRESULT + 300;
  15936.   DPERR_SESSIONLOST = MAKE_DPHRESULT + 310;
  15937.   DPERR_UNINITIALIZED = MAKE_DPHRESULT + 320;
  15938.   DPERR_NONEWPLAYERS = MAKE_DPHRESULT + 330;
  15939.   DPERR_INVALIDPASSWORD = MAKE_DPHRESULT + 340;
  15940.   DPERR_CONNECTING = MAKE_DPHRESULT + 350;
  15941.   DPERR_CONNECTIONLOST = MAKE_DPHRESULT + 360;
  15942.   DPERR_UNKNOWNMESSAGE = MAKE_DPHRESULT + 370;
  15943.   DPERR_CANCELFAILED = MAKE_DPHRESULT + 380;
  15944.   DPERR_INVALIDPRIORITY = MAKE_DPHRESULT + 390;
  15945.   DPERR_NOTHANDLED = MAKE_DPHRESULT + 400;
  15946.   DPERR_CANCELLED = MAKE_DPHRESULT + 410;
  15947.   DPERR_ABORTED = MAKE_DPHRESULT + 420;
  15948.  
  15949.  
  15950.   DPERR_BUFFERTOOLARGE = MAKE_DPHRESULT + 1000;
  15951.   DPERR_CANTCREATEPROCESS = MAKE_DPHRESULT + 1010;
  15952.   DPERR_APPNOTSTARTED = MAKE_DPHRESULT + 1020;
  15953.   DPERR_INVALIDINTERFACE = MAKE_DPHRESULT + 1030;
  15954.   DPERR_NOSERVICEPROVIDER = MAKE_DPHRESULT + 1040;
  15955.   DPERR_UNKNOWNAPPLICATION = MAKE_DPHRESULT + 1050;
  15956.   DPERR_NOTLOBBIED = MAKE_DPHRESULT + 1070;
  15957.   DPERR_SERVICEPROVIDERLOADED = MAKE_DPHRESULT + 1080;
  15958.   DPERR_ALREADYREGISTERED = MAKE_DPHRESULT + 1090;
  15959.   DPERR_NOTREGISTERED = MAKE_DPHRESULT + 1100;
  15960.  
  15961. //
  15962. // Security related errors
  15963. //
  15964.   DPERR_AUTHENTICATIONFAILED = MAKE_DPHRESULT + 2000;
  15965.   DPERR_CANTLOADSSPI = MAKE_DPHRESULT + 2010;
  15966.   DPERR_ENCRYPTIONFAILED = MAKE_DPHRESULT + 2020;
  15967.   DPERR_SIGNFAILED = MAKE_DPHRESULT + 2030;
  15968.   DPERR_CANTLOADSECURITYPACKAGE = MAKE_DPHRESULT + 2040;
  15969.   DPERR_ENCRYPTIONNOTSUPPORTED = MAKE_DPHRESULT + 2050;
  15970.   DPERR_CANTLOADCAPI = MAKE_DPHRESULT + 2060;
  15971.   DPERR_NOTLOGGEDIN = MAKE_DPHRESULT + 2070;
  15972.   DPERR_LOGONDENIED = MAKE_DPHRESULT + 2080;
  15973.  
  15974. (****************************************************************************
  15975.  *
  15976.  *      dplay 1.0 obsolete structures + interfaces
  15977.  *      Included for compatibility only. New apps should
  15978.  *      use IDirectPlay2
  15979.  *
  15980.  ****************************************************************************)
  15981.  
  15982.   DPOPEN_OPENSESSION = DPOPEN_JOIN;
  15983.   DPOPEN_CREATESESSION = DPOPEN_CREATE;
  15984.  
  15985.   DPENUMSESSIONS_PREVIOUS = $00000004;
  15986.  
  15987.   DPENUMPLAYERS_PREVIOUS = $00000004;
  15988.  
  15989.   DPSEND_GUARANTEE = DPSEND_GUARANTEED;
  15990.   DPSEND_TRYONCE = $00000004;
  15991.  
  15992.   DPCAPS_NAMESERVICE = $00000001;
  15993.   DPCAPS_NAMESERVER = DPCAPS_ISHOST;
  15994.   DPCAPS_GUARANTEED = $00000004;
  15995.  
  15996.   DPLONGNAMELEN = 52;
  15997.   DPSHORTNAMELEN = 20;
  15998.   DPSESSIONNAMELEN = 32;
  15999.   DPPASSWORDLEN = 16;
  16000.   DPUSERRESERVED = 16;
  16001.  
  16002.   DPSYS_ADDPLAYER = $0003;
  16003.   DPSYS_DELETEPLAYER = $0005;
  16004.  
  16005.   DPSYS_DELETEGROUP = $0020;
  16006.   DPSYS_DELETEPLAYERFROMGRP = $0021;
  16007.   DPSYS_CONNECT = $484b;
  16008.  
  16009. type
  16010.   PDPMsg_AddPlayer = ^TDPMsg_AddPlayer;
  16011.   TDPMsg_AddPlayer = packed record
  16012.     dwType: DWORD;
  16013.     dwPlayerType: DWORD;
  16014.     DPID: TDPID;
  16015.     szLongName: array[0..DPLONGNAMELEN-1] of Char;
  16016.     szShortName: array[0..DPSHORTNAMELEN-1] of Char;
  16017.     dwCurrentPlayers: DWORD;
  16018.   end;
  16019.  
  16020.   PDPMsg_AddGroup = ^TDPMsg_AddGroup;
  16021.   TDPMsg_AddGroup = TDPMsg_AddPlayer;
  16022.  
  16023.   PDPMsg_GroupAdd = ^TDPMsg_GroupAdd;
  16024.   TDPMsg_GroupAdd = packed record
  16025.     dwType: DWORD;
  16026.     dpIdGroup: TDPID;
  16027.     dpIdPlayer: TDPID;
  16028.   end;
  16029.  
  16030.   PDPMsg_GroupDelete = ^TDPMsg_GroupDelete;
  16031.   TDPMsg_GroupDelete = TDPMsg_GroupAdd;
  16032.  
  16033.   PDPMsg_DeletePlayer = ^TDPMsg_DeletePlayer;
  16034.   TDPMsg_DeletePlayer = packed record
  16035.     dwType: DWORD;
  16036.     DPID: TDPID;
  16037.   end;
  16038.  
  16039.   TDPEnumPlayersCallback = function(dpId: TDPID; lpFriendlyName: PChar;
  16040.       lpFormalName: PChar; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
  16041.  
  16042.   PDPSessionDesc = ^TDPSessionDesc;
  16043.   TDPSessionDesc = packed record
  16044.     dwSize: DWORD;
  16045.     guidSession: TGUID;
  16046.     dwSession: DWORD;
  16047.     dwMaxPlayers: DWORD;
  16048.     dwCurrentPlayers: DWORD;
  16049.     dwFlags: DWORD;
  16050.     szSessionName: Array [0..DPSESSIONNAMELEN-1] of char;
  16051.     szUserField: Array [0..DPUSERRESERVED-1] of char;
  16052.     dwReserved1: DWORD;
  16053.     szPassword: Array [0..DPPASSWORDLEN-1] of char;
  16054.     dwReserved2: DWORD;
  16055.     dwUser1: DWORD;
  16056.     dwUser2: DWORD;
  16057.     dwUser3: DWORD;
  16058.     dwUser4: DWORD;
  16059.   end;
  16060.  
  16061.   TDPEnumSessionsCallback = function(const lpDPSessionDesc: TDPSessionDesc;
  16062.       lpContext: Pointer; var lpdwTimeOut: DWORD; dwFlags: DWORD) : BOOL; stdcall;
  16063.  
  16064. type
  16065.   IDirectPlay = interface (IUnknown)
  16066.     ['{5454e9a0-db65-11ce-921c-00aa006c4972}']
  16067.     (*** IDirectPlay methods ***)
  16068.     function AddPlayerToGroup(pidGroup: TDPID; pidPlayer: TDPID) : HResult; stdcall;
  16069.     function Close: HResult; stdcall;
  16070.     function CreatePlayer(out lppidID: TDPID; lpPlayerFriendlyName: PChar;
  16071.         lpPlayerFormalName: PChar; lpEvent: PHandle) : HResult; stdcall;
  16072.     function CreateGroup(out lppidID: TDPID; lpGroupFriendlyName: PChar;
  16073.         lpGroupFormalName: PChar) : HResult; stdcall;
  16074.     function DeletePlayerFromGroup(pidGroup: TDPID; pidPlayer: TDPID) : HResult; stdcall;
  16075.     function DestroyPlayer(pidID: TDPID) : HResult; stdcall;
  16076.     function DestroyGroup(pidID: TDPID) : HResult; stdcall;
  16077.     function EnableNewPlayers(bEnable: BOOL) : HResult; stdcall;
  16078.     function EnumGroupPlayers(pidGroupPID: TDPID; lpEnumPlayersCallback:
  16079.         TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  16080.     function EnumGroups(dwSessionID: DWORD; lpEnumPlayersCallback:
  16081.         TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  16082.     function EnumPlayers(dwSessionId: DWORD; lpEnumPlayersCallback:
  16083.         TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  16084.     function EnumSessions(var lpSDesc: TDPSessionDesc; dwTimeout: DWORD;
  16085.         lpEnumSessionsCallback: TDPEnumSessionsCallback; lpContext: Pointer;
  16086.         dwFlags: DWORD) : HResult; stdcall;
  16087.     function GetCaps(var lpDPCaps: TDPCaps) : HResult; stdcall;
  16088.     function GetMessageCount(pidID: TDPID; var lpdwCount: DWORD) : HResult; stdcall;
  16089.     function GetPlayerCaps(pidID: TDPID; var lpDPPlayerCaps: TDPCaps) : HResult; stdcall;
  16090.     function GetPlayerName(pidID: TDPID; lpPlayerFriendlyName: PChar;
  16091.         var lpdwFriendlyNameLength: DWORD; lpPlayerFormalName: PChar;
  16092.         var lpdwFormalNameLength: DWORD) : HResult; stdcall;
  16093.     function Initialize(const lpGUID: TGUID) : HResult; stdcall;
  16094.     function Open(var lpSDesc: TDPSessionDesc) : HResult; stdcall;
  16095.     function Receive(var lppidFrom, lppidTo: TDPID; dwFlags: DWORD;
  16096.         var lpvBuffer; var lpdwSize: DWORD) : HResult; stdcall;
  16097.     function SaveSession(lpSessionName: PChar) : HResult; stdcall;
  16098.     function Send(pidFrom: TDPID; pidTo: TDPID; dwFlags: DWORD;
  16099.         var lpvBuffer; dwBuffSize: DWORD) : HResult; stdcall;
  16100.     function SetPlayerName(pidID: TDPID; lpPlayerFriendlyName: PChar;
  16101.         lpPlayerFormalName: PChar) : HResult; stdcall;
  16102.   end;
  16103.  
  16104. (*
  16105.  * GUIDS used by DirectPlay objects
  16106.  *)
  16107.   IID_IDirectPlay2W = IDirectPlay2W;
  16108.   IID_IDirectPlay2A = IDirectPlay2A;
  16109.   IID_IDirectPlay2 =  IDirectPlay2;
  16110.  
  16111.   IID_IDirectPlay3W = IDirectPlay3W;
  16112.   IID_IDirectPlay3A = IDirectPlay3A;
  16113.   IID_IDirectPlay3 =  IDirectPlay3;
  16114.  
  16115.   IID_IDirectPlay4W = IDirectPlay4W;
  16116.   IID_IDirectPlay4A = IDirectPlay4A;
  16117.   IID_IDirectPlay4 =  IDirectPlay4;
  16118.  
  16119.   IID_IDirectPlay = IDirectPlay;
  16120.  
  16121. var
  16122.   DirectPlayCreate : function (lpGUID: PGUID; out lplpDP: IDirectPlay;
  16123.       pUnk: IUnknown) : HResult; stdcall;
  16124.  
  16125. (*==========================================================================;
  16126.  *
  16127.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  16128.  *
  16129.  *  File:       dplobby.h
  16130.  *  Content:    DirectPlayLobby include file
  16131.  ***************************************************************************)
  16132.  
  16133. (*
  16134.  * GUIDS used by DirectPlay objects
  16135.  *)
  16136.  
  16137. const
  16138. (* {2FE8F810-B2A5-11d0-A787-0000F803ABFC} *)
  16139.   CLSID_DirectPlayLobby: TGUID =
  16140.       (D1:$2fe8f810;D2:$b2a5;D3:$11d0;D4:($a7,$87,$00,$00,$f8,$3,$ab,$fc));
  16141.  
  16142. (****************************************************************************
  16143.  *
  16144.  * IDirectPlayLobby Structures
  16145.  *
  16146.  * Various structures used to invoke DirectPlayLobby.
  16147.  *
  16148.  ****************************************************************************)
  16149.  
  16150. type
  16151. (*
  16152.  * TDPLAppInfo
  16153.  * Used to hold information about a registered DirectPlay
  16154.  * application
  16155.  *)
  16156.   PDPLAppInfo = ^TDPLAppInfo;
  16157.   TDPLAppInfo = packed record
  16158.     dwSize: DWORD;            // Size of this structure
  16159.     guidApplication: TGUID;   // GUID of the Application
  16160.     case Integer of           // Pointer to the Application Name
  16161.       0: (lpszAppName: PCharAW);
  16162.       1: (lpszAppNameW: PWideChar);
  16163.       3: (lpszAppNameA: PChar);
  16164.   end;
  16165.  
  16166. (*
  16167.  * TDPCompoundAddressElement
  16168.  *
  16169.  * An array of these is passed to CreateCompoundAddresses()
  16170.  *)
  16171.   PDPCompoundAddressElement = ^TDPCompoundAddressElement;
  16172.   TDPCompoundAddressElement = packed record
  16173.     guidDataType: TGUID;
  16174.     dwDataSize: DWORD;
  16175.     lpData: Pointer;
  16176.   end;                                
  16177.  
  16178. (*
  16179.  * TDPApplicationDesc
  16180.  * Used to register a DirectPlay application
  16181.  *)
  16182.   PDPApplicationDesc = ^TDPApplicationDesc;
  16183.   TDPApplicationDesc = packed record
  16184.     dwSize: DWORD;
  16185.     dwFlags: DWORD;
  16186.     case integer of
  16187.       0 : (lpszApplicationName: PCharAW;
  16188.            guidApplication: TGUID;
  16189.            lpszFilename: PCharAW;
  16190.            lpszCommandLine: PCharAW;
  16191.            lpszPath: PCharAW;
  16192.            lpszCurrentDirectory: PCharAW;
  16193.            lpszDescriptionA: PAnsiChar;
  16194.            lpszDescriptionW: PWideChar);
  16195.       1 : (lpszApplicationNameA: PAnsiChar;
  16196.            filler1: TGUID;
  16197.            lpszFilenameA: PAnsiChar;
  16198.            lpszCommandLineA: PAnsiChar;
  16199.            lpszPathA: PAnsiChar;
  16200.            lpszCurrentDirectoryA: PAnsiChar);
  16201.       2 : (lpszApplicationNameW: PWideChar;
  16202.            filler2: TGUID;
  16203.            lpszFilenameW: PWideChar;
  16204.            lpszCommandLineW: PWideChar;
  16205.            lpszPathW: PWideChar;
  16206.            lpszCurrentDirectoryW: PWideChar);
  16207.   end;
  16208.  
  16209. (*
  16210.  * TDPApplicationDesc2
  16211.  * Used to register a DirectPlay application
  16212.  *)
  16213.   PDPApplicationDesc2 = ^TDPApplicationDesc2;
  16214.   TDPApplicationDesc2 = packed record
  16215.     dwSize: DWORD;
  16216.     dwFlags: DWORD;
  16217.     case integer of
  16218.       0 : (lpszApplicationName: PCharAW;
  16219.            guidApplication: TGUID;
  16220.            lpszFilename: PCharAW;
  16221.            lpszCommandLine: PCharAW;
  16222.            lpszPath: PCharAW;
  16223.            lpszCurrentDirectory: PCharAW;
  16224.            lpszDescriptionA: PAnsiChar;
  16225.            lpszDescriptionW: PWideChar;
  16226.            lpszAppLauncherName: PCharAW);
  16227.       1 : (lpszApplicationNameA: PAnsiChar;
  16228.            filler1: TGUID;
  16229.            lpszFilenameA: PAnsiChar;
  16230.            lpszCommandLineA: PAnsiChar;
  16231.            lpszPathA: PAnsiChar;
  16232.            lpszCurrentDirectoryA: PAnsiChar;
  16233.            filler3: PChar;
  16234.            filler4: PChar;
  16235.            lpszAppLauncherNameA: PAnsiChar);
  16236.       2 : (lpszApplicationNameW: PWideChar;
  16237.            filler2: TGUID;
  16238.            lpszFilenameW: PWideChar;
  16239.            lpszCommandLineW: PWideChar;
  16240.            lpszPathW: PWideChar;
  16241.            lpszCurrentDirectoryW: PWideChar;
  16242.            filler5: PChar;
  16243.            filler6: PChar;
  16244.            lpszAppLauncherNameW: PWideChar);
  16245.   end;
  16246.  
  16247.  
  16248. (****************************************************************************
  16249.  *
  16250.  * Enumeration Method Callback Prototypes
  16251.  *
  16252.  ****************************************************************************)
  16253.  
  16254. (*
  16255.  * Callback for EnumAddress()
  16256.  *)
  16257.   TDPEnumAdressCallback = function(const guidDataType: TGUID;
  16258.       dwDataSize: DWORD; lpData: Pointer; lpContext: Pointer) : BOOL; stdcall;
  16259.  
  16260. (*
  16261.  * Callback for EnumAddressTypes()
  16262.  *)
  16263.   TDPLEnumAddressTypesCallback = function(const guidDataType: TGUID;
  16264.       lpContext: Pointer; dwFlags: DWORD) : BOOL; stdcall;
  16265.  
  16266. (*
  16267.  * Callback for EnumLocalApplications()
  16268.  *)
  16269.   TDPLEnumLocalApplicationsCallback = function(const lpAppInfo: TDPLAppInfo;
  16270.       lpContext: Pointer; dwFlags: DWORD) : BOOL; stdcall;
  16271.  
  16272. (****************************************************************************
  16273.  *
  16274.  * IDirectPlayLobby (and IDirectPlayLobbyA) Interface
  16275.  *
  16276.  ****************************************************************************)
  16277.  
  16278. type
  16279.   IDirectPlayLobbyAW = interface (IUnknown)
  16280.     (*** IDirectPlayLobby methods ***)
  16281.     function Connect(dwFlags: DWORD; out lplpDP: IDirectPlay2;
  16282.         pUnk: IUnknown) : HResult; stdcall;
  16283.     function CreateAddress(const guidSP, guidDataType: TGUID; var lpData;
  16284.         dwDataSize: DWORD; var lpAddress; var lpdwAddressSize: DWORD) : HResult; stdcall;
  16285.     function EnumAddress(lpEnumAddressCallback: TDPEnumAdressCallback;
  16286.         var lpAddress; dwAddressSize: DWORD; lpContext : Pointer) : HResult; stdcall;
  16287.     function EnumAddressTypes(lpEnumAddressTypeCallback:
  16288.         TDPLEnumAddressTypesCallback; const guidSP: TGUID; lpContext: Pointer;
  16289.         dwFlags: DWORD) : HResult; stdcall;
  16290.     function EnumLocalApplications(lpEnumLocalAppCallback: TDPLEnumLocalApplicationsCallback;
  16291.         lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  16292.     function GetConnectionSettings(dwAppID: DWORD; lpData: PDPLConnection;
  16293.         var lpdwDataSize: DWORD) : HResult; stdcall;
  16294.     function ReceiveLobbyMessage(dwFlags: DWORD; dwAppID: DWORD;
  16295.         var lpdwMessageFlags: DWORD; lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
  16296.     function RunApplication(dwFlags: DWORD; var lpdwAppId: DWORD;
  16297.         const lpConn: TDPLConnection; hReceiveEvent: THandle) : HResult; stdcall;
  16298.     function SendLobbyMessage(dwFlags: DWORD; dwAppID: DWORD; const lpData;
  16299.         dwDataSize: DWORD) : HResult; stdcall;
  16300.     function SetConnectionSettings(dwFlags: DWORD; dwAppID: DWORD;
  16301.         var lpConn: TDPLConnection) : HResult; stdcall;
  16302.     function SetLobbyMessageEvent(dwFlags: DWORD; dwAppID: DWORD;
  16303.         hReceiveEvent: THandle) : HResult; stdcall;
  16304.   end;
  16305.  
  16306.   IDirectPlayLobbyW = interface (IDirectPlayLobbyAW)
  16307.     ['{AF465C71-9588-11CF-A020-00AA006157AC}']
  16308.   end;
  16309.   IDirectPlayLobbyA = interface (IDirectPlayLobbyAW)
  16310.     ['{26C66A70-B367-11cf-A024-00AA006157AC}']
  16311.   end;
  16312.  
  16313. {$IFDEF UNICODE}
  16314.   IDirectPlayLobby = IDirectPlayLobbyW;
  16315. {$ELSE}
  16316.   IDirectPlayLobby = IDirectPlayLobbyA;
  16317. {$ENDIF}
  16318.  
  16319.  
  16320. (****************************************************************************
  16321.  *
  16322.  * IDirectPlayLobby2 (and IDirectPlayLobby2A) Interface
  16323.  *
  16324.  ****************************************************************************)
  16325.  
  16326.   IDirectPlayLobby2AW = interface(IDirectPlayLobbyAW)
  16327.     (*** IDirectPlayLobby2 methods ***)
  16328.     function CreateCompoundAddress(const lpElements: TDPCompoundAddressElement;
  16329.         dwElementCount: DWORD; lpAddress: Pointer; var lpdwAddressSize: DWORD) : HResult; stdcall;
  16330.   end;
  16331.  
  16332.   IDirectPlayLobby2W = interface (IDirectPlayLobby2AW)
  16333.     ['{0194C220-A303-11D0-9C4F-00A0C905425E}']
  16334.   end;
  16335.   IDirectPlayLobby2A = interface (IDirectPlayLobby2AW)
  16336.     ['{1BB4AF80-A303-11d0-9C4F-00A0C905425E}']
  16337.   end;
  16338.  
  16339. {$IFDEF UNICODE}
  16340.   IDirectPlayLobby2 = IDirectPlayLobby2W;
  16341. {$ELSE}
  16342.   IDirectPlayLobby2 = IDirectPlayLobby2A;
  16343. {$ENDIF}
  16344.  
  16345. (****************************************************************************
  16346.  *
  16347.  * IDirectPlayLobby3 (and IDirectPlayLobby3A) Interface
  16348.  *
  16349.  ****************************************************************************)
  16350.  
  16351.   IDirectPlayLobby3AW = interface(IDirectPlayLobby2AW)
  16352.     (*** IDirectPlayLobby3 methods ***)
  16353.     function ConnectEx(dwFlags: DWORD; const riid: TGUID;
  16354.         out lplpDP; pUnk: IUnknown) : HResult; stdcall;
  16355.     function RegisterApplication(dwFlags: DWORD;
  16356.         var lpAppDesc: TDPApplicationDesc) : HResult; stdcall;
  16357.     function UnregisterApplication(dwFlags: DWORD;
  16358.          const guidApplication: TGUID) : HResult; stdcall;
  16359.     function WaitForConnectionSettings(dwFlags: DWORD) : HResult; stdcall;
  16360.         end;
  16361.  
  16362.   IDirectPlayLobby3W = interface (IDirectPlayLobby3AW)
  16363.     ['{2DB72490-652C-11d1-A7A8-0000F803ABFC}']
  16364.   end;
  16365.   IDirectPlayLobby3A = interface (IDirectPlayLobby3AW)
  16366.     ['{2DB72491-652C-11d1-A7A8-0000F803ABFC}']
  16367.   end;
  16368.  
  16369. {$IFDEF UNICODE}
  16370.   IDirectPlayLobby3 = IDirectPlayLobby3W;
  16371. {$ELSE}
  16372.   IDirectPlayLobby3 = IDirectPlayLobby3A;
  16373. {$ENDIF}
  16374.  
  16375.   IID_IDirectPlayLobbyW =  IDirectPlayLobbyW;
  16376.   IID_IDirectPlayLobbyA =  IDirectPlayLobbyA;
  16377.   IID_IDirectPlayLobby =   IDirectPlayLobby;
  16378.  
  16379.   IID_IDirectPlayLobby2W = IDirectPlayLobby2W;
  16380.   IID_IDirectPlayLobby2A = IDirectPlayLobby2A;
  16381.   IID_IDirectPlayLobby2 =  IDirectPlayLobby2;
  16382.  
  16383.   IID_IDirectPlayLobby3W = IDirectPlayLobby3W;
  16384.   IID_IDirectPlayLobby3A = IDirectPlayLobby3A;
  16385.   IID_IDirectPlayLobby3 =  IDirectPlayLobby3;
  16386.  
  16387. (****************************************************************************
  16388.  *
  16389.  * DirectPlayLobby API Prototypes
  16390.  *
  16391.  ****************************************************************************)
  16392.  
  16393. var
  16394.   DirectPlayLobbyCreateW : function (lpguidSP: PGUID; out lplpDPL:
  16395.       IDirectPlayLobbyW; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
  16396.   DirectPlayLobbyCreateA : function (lpguidSP: PGUID; out lplpDPL:
  16397.       IDirectPlayLobbyA; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
  16398.   DirectPlayLobbyCreate : function (lpguidSP: PGUID; out lplpDPL:
  16399.       IDirectPlayLobby; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
  16400.  
  16401. const
  16402. (****************************************************************************
  16403.  *
  16404.  * DirectPlayLobby Flags
  16405.  *
  16406.  ****************************************************************************)
  16407.  
  16408. (*
  16409.  *  This flag is used by IDirectPlayLobby.WaitForConnectionSettings to
  16410.  *  cancel a current wait that is in progress.
  16411.  *)
  16412.  DPLWAIT_CANCEL = $00000001;
  16413.  
  16414. (*
  16415.  *      This is a message flag used by ReceiveLobbyMessage.  It can be
  16416.  *      returned in the dwMessageFlags parameter to indicate a message from
  16417.  *      the system.
  16418.  *)
  16419.   DPLMSG_SYSTEM = $00000001;
  16420.  
  16421. (*
  16422.  *      This is a message flag used by ReceiveLobbyMessage and SendLobbyMessage.
  16423.  *  It is used to indicate that the message is a standard lobby message.
  16424.  *  TDPLMsg_SetProperty, TDPLMsg_SetPropertyResponse, TDPLMsg_GetProperty,
  16425.  *      TDPLMsg_GetPropertyResponse
  16426.  *)
  16427.   DPLMSG_STANDARD = $00000002;
  16428.  
  16429. type
  16430. (****************************************************************************
  16431.  *
  16432.  * DirectPlayLobby messages and message data structures
  16433.  *
  16434.  * All system messages have a dwMessageFlags value of DPLMSG_SYSTEM returned
  16435.  * from a call to ReceiveLobbyMessage.
  16436.  *
  16437.  * All standard messages have a dwMessageFlags value of DPLMSG_STANDARD returned
  16438.  * from a call to ReceiveLobbyMessage.
  16439.  *
  16440.  ****************************************************************************)
  16441.  
  16442. (*
  16443.  * TDPLMsg_Generic
  16444.  * Generic message structure used to identify the message type.
  16445.  *)
  16446.   PDPLMsg_Generic = ^TDPLMsg_Generic;
  16447.   TDPLMsg_Generic = packed record
  16448.     dwType: DWORD;   // Message type
  16449.   end;
  16450.  
  16451. (*
  16452.  * TDPLMsg_SystemMessage
  16453.  * Generic message format for all system messages --
  16454.  * DPLSYS_CONNECTIONSETTINGSREAD, DPLSYS_DPLYCONNECTSUCCEEDED,
  16455.  * DPLSYS_DPLAYCONNECTFAILED, DPLSYS_APPTERMINATED, DPLSYS_NEWCONNECTIONSETTINGS
  16456.  *)
  16457.   PDPLMsg_SystemMessage = ^TDPLMsg_SystemMessage;
  16458.   TDPLMsg_SystemMessage = packed record
  16459.     dwType: DWORD;         // Message type
  16460.     guidInstance: TGUID;    // Instance GUID of the dplay session the message corresponds to
  16461.   end;
  16462.  
  16463. (*
  16464.  *  TDPLMsg_SetProperty
  16465.  *  Standard message sent by an application to a lobby to set a
  16466.  *  property
  16467.  *)
  16468.   PDPLMsg_SetProperty = ^TDPLMsg_SetProperty;
  16469.   TDPLMsg_SetProperty = packed record
  16470.     dwType: DWORD;                           // Message type
  16471.     dwRequestID: DWORD;                      // Request ID (DPL_NOCONFIRMATION if no confirmation desired)
  16472.     guidPlayer: TGUID;                       // Player GUID
  16473.     guidPropertyTag: TGUID;                  // Property GUID
  16474.     dwDataSize: DWORD;                       // Size of data
  16475.     dwPropertyData: array[0..0] of DWORD;    // Buffer containing data
  16476.   end;
  16477.  
  16478. const
  16479.   DPL_NOCONFIRMATION = 0;
  16480.  
  16481. type
  16482. (*
  16483.  *  TDPLMsg_SetPropertyResponse
  16484.  *  Standard message returned by a lobby to confirm a
  16485.  *  TDPLMsg_SetProperty message.
  16486.  *)
  16487.   PDPLMsg_SetPropertyResponse = ^TDPLMsg_SetPropertyResponse;
  16488.   TDPLMsg_SetPropertyResponse = packed record
  16489.     dwType: DWORD;            // Message type
  16490.     dwRequestID: DWORD;       // Request ID
  16491.     guidPlayer: TGUID;        // Player GUID
  16492.     guidPropertyTag: TGUID;   // Property GUID
  16493.     hr: HResult;              // Return Code
  16494.   end;
  16495.  
  16496. (*
  16497.  *  TDPLMsg_GetProperty
  16498.  *  Standard message sent by an application to a lobby to request
  16499.  *      the current value of a property
  16500.  *)
  16501.   PDPLMsg_GetProperty = ^TDPLMsg_GetProperty;
  16502.   TDPLMsg_GetProperty = packed record
  16503.     dwType: DWORD;            // Message type
  16504.     dwRequestID: DWORD;       // Request ID
  16505.     guidPlayer: TGUID;        // Player GUID
  16506.     guidPropertyTag: TGUID;   // Property GUID
  16507.   end;
  16508.   LPDPLMSG_GETPROPERTY = ^TDPLMsg_GetProperty;
  16509.  
  16510. (*
  16511.  *  TDPLMsg_GetPropertyResponse
  16512.  *  Standard message returned by a lobby in response to a
  16513.  *      TDPLMsg_GetProperty message.
  16514.  *)
  16515.   PDPLMsg_GetPropertyResponse = ^TDPLMsg_GetPropertyResponse;
  16516.   TDPLMsg_GetPropertyResponse = packed record
  16517.     dwType: DWORD;                           // Message type
  16518.     dwRequestID: DWORD;                      // Request ID
  16519.     guidPlayer: TGUID;                       // Player GUID
  16520.     guidPropertyTag: TGUID;                  // Property GUID
  16521.     hr: HResult;                             // Return Code
  16522.     dwDataSize: DWORD;                       // Size of data
  16523.     dwPropertyData: array[0..0] of DWORD;    // Buffer containing data
  16524.   end;
  16525.  
  16526. (*
  16527.  *  TDPLMsg_NewSessionHost
  16528.  *  Standard message returned by a lobby in response to a
  16529.  *  the session host migrating to a new client
  16530.  *)
  16531.   PDPLMsg_NewSessionHost = ^TDPLMsg_NewSessionHost;
  16532.   TDPLMsg_NewSessionHost = packed record
  16533.     dwType: DWORD;            // Message type
  16534.     guidInstance: TGUID;      // Property GUID
  16535.   end;
  16536.  
  16537. const
  16538. (******************************************
  16539.  *
  16540.  *      DirectPlay Lobby message dwType values
  16541.  *
  16542.  *****************************************)
  16543.  
  16544. (*
  16545.  *  The application has read the connection settings.
  16546.  *  It is now O.K. for the lobby client to release
  16547.  *  its IDirectPlayLobby interface.
  16548.  *)
  16549.   DPLSYS_CONNECTIONSETTINGSREAD = $00000001;
  16550.  
  16551. (*
  16552.  *  The application's call to DirectPlayConnect failed
  16553.  *)
  16554.   DPLSYS_DPLAYCONNECTFAILED = $00000002;
  16555.  
  16556. (*
  16557.  *  The application has created a DirectPlay session.
  16558.  *)
  16559.   DPLSYS_DPLAYCONNECTSUCCEEDED = $00000003;
  16560.  
  16561. (*
  16562.  *  The application has terminated.
  16563.  *)
  16564.   DPLSYS_APPTERMINATED = $00000004;
  16565.  
  16566. (*
  16567.  *  The message is a TDPLMsg_SetProperty message.
  16568.  *)
  16569.   DPLSYS_SETPROPERTY = $00000005;
  16570.  
  16571. (*
  16572.  *  The message is a TDPLMsg_SetPropertyResponse message.
  16573.  *)
  16574.   DPLSYS_SETPROPERTYRESPONSE = $00000006;
  16575.  
  16576. (*
  16577.  *  The message is a TDPLMsg_GetProperty message.
  16578.  *)
  16579.   DPLSYS_GETPROPERTY = $00000007;
  16580.  
  16581. (*
  16582.  *  The message is a TDPLMsg_GetPropertyResponse message.
  16583.  *)
  16584.   DPLSYS_GETPROPERTYRESPONSE = $00000008;
  16585.  
  16586. (*
  16587.  *  The message is a TDPLMsg_NewSessionHost message.
  16588.  *)
  16589.   DPLSYS_NEWSESSIONHOST = $00000009;
  16590.  
  16591. (*
  16592.  *  New connection settings are available.
  16593.  *)
  16594.   DPLSYS_NEWCONNECTIONSETTINGS = $0000000A;
  16595.  
  16596. (****************************************************************************
  16597.  *
  16598.  * DirectPlay defined property GUIDs and associated data structures
  16599.  *
  16600.  ****************************************************************************)
  16601.  
  16602. (*
  16603.  * DPLPROPERTY_MessagesSupported
  16604.  *
  16605.  * Request whether the lobby supports standard.  Lobby with respond with either
  16606.  * TRUE or FALSE or may not respond at all.
  16607.  *
  16608.  * Property data is a single BOOL with TRUE or FALSE
  16609.  *)
  16610. // {762CCDA1-D916-11d0-BA39-00C04FD7ED67}
  16611.   DPLPROPERTY_MessagesSupported: TGUID =
  16612.       (D1:$762ccda1;D2:$d916;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
  16613.  
  16614. (*
  16615.  * DPLPROPERTY_LobbyGuid
  16616.  *
  16617.  * Request the GUID that identifies the lobby software that the application
  16618.  * is communicating with.
  16619.  *
  16620.  * Property data is a single GUID.
  16621.  *)
  16622. // {F56920A0-D218-11d0-BA39-00C04FD7ED67}
  16623.   DPLPROPERTY_LobbyGuid: TGUID =
  16624.       (D1:$F56920A0;D2:$D218;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
  16625.  
  16626. (*
  16627.  * DPLPROPERTY_PlayerGuid
  16628.  *
  16629.  * Request the GUID that identifies the player on this machine for sending
  16630.  * property data back to the lobby.
  16631.  *
  16632.  * Property data is the DPLDATA_PLAYERDATA structure
  16633.  *)
  16634. // {B4319322-D20D-11d0-BA39-00C04FD7ED67}
  16635.   DPLPROPERTY_PlayerGuid: TGUID =
  16636.       (D1:$b4319322;D2:$d20d;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
  16637.  
  16638. type
  16639. (*
  16640.  * TDPLData_PlayerGUID
  16641.  *
  16642.  * Data structure to hold the GUID of the player and player creation flags
  16643.  * from the lobby.
  16644.  *)
  16645.   PDPLData_PlayerGUID = ^TDPLData_PlayerGUID;
  16646.   TDPLData_PlayerGUID = packed record
  16647.     guidPlayer: TGUID;
  16648.     dwPlayerFlags: DWORD;
  16649.   end;
  16650.  
  16651. const
  16652. (*
  16653.  * DPLPROPERTY_PlayerScore
  16654.  *
  16655.  * Used to send an array of long integers to the lobby indicating the
  16656.  * score of a player.
  16657.  *
  16658.  * Property data is the TDPLData_PlayerScore structure.
  16659.  *)
  16660. // {48784000-D219-11d0-BA39-00C04FD7ED67}
  16661.   DPLPROPERTY_PlayerScore: TGUID =
  16662.       (D1:$48784000;D2:$d219;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
  16663.  
  16664. type
  16665. (*
  16666.  * TDPLData_PlayerScore
  16667.  *
  16668.  * Data structure to hold an array of long integers representing a player score.
  16669.  * Application must allocate enough memory to hold all the scores.
  16670.  *)
  16671.   PDPLData_PlayerScore = ^TDPLData_PlayerScore;
  16672.   TDPLData_PlayerScore = packed record
  16673.     dwScoreCount: DWORD;
  16674.     Score: array[0..0] of LongInt;
  16675.   end;
  16676.  
  16677. (****************************************************************************
  16678.  *
  16679.  * DirectPlay Address ID's
  16680.  *
  16681.  ****************************************************************************)
  16682.  
  16683. (* DirectPlay Address
  16684.  *
  16685.  * A DirectPlay address consists of multiple chunks of data, each tagged
  16686.  * with a GUID signifying the type of data in the chunk. The chunk also
  16687.  * has a length so that unknown chunk types can be skipped.
  16688.  *
  16689.  * The EnumAddress() function is used to parse these address data chunks.
  16690.  *)
  16691.  
  16692. (*
  16693.  * TDPAddress
  16694.  *
  16695.  * Header for block of address data elements
  16696.  *)
  16697.   PDPAddress = ^TDPAddress;
  16698.   TDPAddress = packed record
  16699.     guidDataType: TGUID;
  16700.     dwDataSize: DWORD;
  16701.   end;
  16702.  
  16703. const
  16704. (*
  16705.  * DPAID_TotalSize
  16706.  *
  16707.  * Chunk is a DWORD containing size of entire TDPAddress structure
  16708.  *)
  16709.  
  16710. // {1318F560-912C-11d0-9DAA-00A0C90A43CB}
  16711.   DPAID_TotalSize: TGUID =
  16712.       (D1:$1318f560;D2:$912c;D3:$11d0;D4:($9d,$aa,$00,$a0,$c9,$a,$43,$cb));
  16713.  
  16714. (*
  16715.  * DPAID_ServiceProvider
  16716.  *
  16717.  * Chunk is a GUID describing the service provider that created the chunk.
  16718.  * All addresses must contain this chunk.
  16719.  *)
  16720.  
  16721. // {07D916C0-E0AF-11cf-9C4E-00A0C905425E}
  16722.   DPAID_ServiceProvider: TGUID =
  16723.       (D1:$7d916c0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
  16724.  
  16725. (*
  16726.  * DPAID_LobbyProvider
  16727.  *
  16728.  * Chunk is a GUID describing the lobby provider that created the chunk.
  16729.  * All addresses must contain this chunk.
  16730.  *)
  16731.  
  16732. // {59B95640-9667-11d0-A77D-0000F803ABFC}
  16733.   DPAID_LobbyProvider: TGUID =
  16734.       (D1:$59b95640;D2:$9667;D3:$11d0;D4:($a7,$7d,$00,$00,$f8,$3,$ab,$fc));
  16735.  
  16736. (*
  16737.  * DPAID_Phone and DPAID_PhoneW
  16738.  *
  16739.  * Chunk is a string containing a phone number (i.e. "1-800-555-1212")
  16740.  * in ANSI or UNICODE format
  16741.  *)
  16742.  
  16743. // {78EC89A0-E0AF-11cf-9C4E-00A0C905425E}
  16744.   DPAID_Phone: TGUID =
  16745.       (D1:$78ec89a0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
  16746.  
  16747. // {BA5A7A70-9DBF-11d0-9CC1-00A0C905425E}
  16748.   DPAID_PhoneW: TGUID =
  16749.       (D1:$ba5a7a70;D2:$9dbf;D3:$11d0;D4:($9c,$c1,$00,$a0,$c9,$5,$42,$5e));
  16750.  
  16751. (*
  16752.  * DPAID_Modem and DPAID_ModemW
  16753.  *
  16754.  * Chunk is a string containing a modem name registered with TAPI
  16755.  * in ANSI or UNICODE format
  16756.  *)
  16757.  
  16758. // {F6DCC200-A2FE-11d0-9C4F-00A0C905425E}
  16759.   DPAID_Modem: TGUID =
  16760.       (D1:$f6dcc200;D2:$a2fe;D3:$11d0;D4:($9c,$4f,$00,$a0,$c9,$5,$42,$5e));
  16761.  
  16762. // {01FD92E0-A2FF-11d0-9C4F-00A0C905425E}
  16763.   DPAID_ModemW: TGUID =
  16764.       (D1:$1fd92e0;D2:$a2ff;D3:$11d0;D4:($9c,$4f,$00,$a0,$c9,$5,$42,$5e));
  16765.  
  16766. (*
  16767.  * DPAID_Inet and DPAID_InetW
  16768.  *
  16769.  * Chunk is a string containing a TCP/IP host name or an IP address
  16770.  * (i.e. "dplay.microsoft.com" or "137.55.100.173") in ANSI or UNICODE format
  16771.  *)
  16772.  
  16773. // {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E}
  16774.   DPAID_INet: TGUID =
  16775.       (D1:$c4a54da0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
  16776.  
  16777. // {E63232A0-9DBF-11d0-9CC1-00A0C905425E}
  16778.   DPAID_INetW: TGUID =
  16779.       (D1:$e63232a0;D2:$9dbf;D3:$11d0;D4:($9c,$c1,$00,$a0,$c9,$5,$42,$5e));
  16780.  
  16781. (*
  16782.  * DPAID_InetPort
  16783.  *
  16784.  * Chunk is the port number used for creating the apps TCP and UDP sockets.
  16785.  * WORD value (i.e. 47624)
  16786.  *)
  16787.  
  16788. // {E4524541-8EA5-11d1-8A96-006097B01411}
  16789.   DPAID_INetPort: TGUID =
  16790.       (D1:$e4524541;D2:$8ea5;D3:$11d1;D4:($8a,$96,$00,$60,$97,$b0,$14,$11));
  16791.  
  16792. //@@BEGIN_MSINTERNAL
  16793. (*
  16794.  * DPAID_MaxMessageSize
  16795.  *
  16796.  * Tells DPLAY what the maximum allowed message size is.  Enables SPs to
  16797.  *      combat Denial of Service attacks
  16798.  *)
  16799.  
  16800.  // this terrible hack is needed so the SP can work with the Elmer build.
  16801.  // it can be removed when the MSINTERNAL stuff is removed
  16802. {$DEFINE MAXMSGSIZEGUIDDEFINED}
  16803.  
  16804. // {F5D09980-F0C4-11d1-8326-006097B01411}
  16805.   DPAID_MaxMessageSize: TGUID =
  16806.       (D1:$f5d09980;D2:$f0c4;D3:$11d1;D4:($83,$26,$00,$60,$97,$b0,$14,$11));
  16807. //@@END_MSINTERNAL
  16808.  
  16809. (*
  16810.  * TDPComPortAddress
  16811.  *
  16812.  * Used to specify com port settings. The constants that define baud rate,
  16813.  * stop bits and parity are defined in WINBASE.H. The constants for flow
  16814.  * control are given below.
  16815.  *)
  16816.  
  16817.   DPCPA_NOFLOW       = 0;           // no flow control
  16818.   DPCPA_XONXOFFFLOW  = 1;           // software flow control
  16819.   DPCPA_RTSFLOW      = 2;           // hardware flow control with RTS
  16820.   DPCPA_DTRFLOW      = 3;           // hardware flow control with DTR
  16821.   DPCPA_RTSDTRFLOW   = 4;           // hardware flow control with RTS and DTR
  16822.  
  16823. type
  16824.   PDPComPortAddress = ^TDPComPortAddress;
  16825.   TDPComPortAddress = packed record
  16826.     dwComPort: DWORD;       // COM port to use (1-4)
  16827.     dwBaudRate: DWORD;      // baud rate (100-256k)
  16828.     dwStopBits: DWORD;      // no. stop bits (1-2)
  16829.     dwParity: DWORD;        // parity (none, odd, even, mark)
  16830.     dwFlowControl: DWORD;   // flow control (none, xon/xoff, rts, dtr)
  16831.   end;
  16832.  
  16833. const
  16834. (*
  16835.  * DPAID_ComPort
  16836.  *
  16837.  * Chunk contains a TDPComPortAddress structure defining the serial port.
  16838.  *)
  16839.  
  16840. // {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E}
  16841.   DPAID_ComPort: TGUID =
  16842.       (D1:$f2f0ce00;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
  16843.  
  16844. (****************************************************************************
  16845.  *
  16846.  *      dplobby 1.0 obsolete definitions
  16847.  *      Included for compatibility only.
  16848.  *
  16849.  ****************************************************************************)
  16850.  
  16851.   DPLAD_SYSTEM = DPLMSG_SYSTEM;
  16852. {$ENDIF} // UseDirectPlay
  16853.  
  16854. //DirectSetup file
  16855. (*==========================================================================
  16856.  *
  16857.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  16858.  *
  16859.  *  File:       dsetup.h
  16860.  *  Content:    DirectXSetup, error codes and flags
  16861.  *
  16862.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  16863.  *
  16864.  *  Modyfied: 05-Oct-99
  16865.  *
  16866.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  16867.  *  E-Mail: DelphiDirectX@next-reality.com
  16868.  *
  16869.  ***************************************************************************)
  16870.  
  16871. var
  16872.   DSetupDLL : HModule;
  16873.  
  16874. type
  16875.   PDLSVersion = ^TDLSVersion;
  16876.   TDLSVersion = packed record
  16877.     dwVersionMS: DWORD;
  16878.     dwVersionLS: DWORD;
  16879.   end;
  16880.  
  16881.  
  16882. const
  16883.   FOURCC_VERS : array[0..3] of Char = ('v','e','r','s');
  16884.  
  16885. // DSETUP Error Codes, must remain compatible with previous setup.
  16886.   DSETUPERR_SUCCESS_RESTART     = HResult(1);
  16887.   DSETUPERR_SUCCESS             = HResult(0);
  16888.   DSETUPERR_BADWINDOWSVERSION   = HResult(-1);
  16889.   DSETUPERR_SOURCEFILENOTFOUND  = HResult(-2);
  16890.   DSETUPERR_BADSOURCESIZE       = HResult(-3);
  16891.   DSETUPERR_BADSOURCETIME       = HResult(-4);
  16892.   DSETUPERR_NOCOPY              = HResult(-5);
  16893.   DSETUPERR_OUTOFDISKSPACE      = HResult(-6);
  16894.   DSETUPERR_CANTFINDINF         = HResult(-7);
  16895.   DSETUPERR_CANTFINDDIR         = HResult(-8);
  16896.   DSETUPERR_INTERNAL            = HResult(-9);
  16897.   DSETUPERR_NTWITHNO3D          = HResult(-10);  // REM: obsolete, you'll never see this
  16898.   DSETUPERR_UNKNOWNOS           = HResult(-11);
  16899.   DSETUPERR_USERHITCANCEL       = HResult(-12);
  16900.   DSETUPERR_NOTPREINSTALLEDONNT = HResult(-13);
  16901.   DSETUPERR_NEWERVERSION        = HResult(-14);  
  16902.  
  16903. // DSETUP flags. DirectX 5.0 apps should use these flags only.
  16904.   DSETUP_DDRAWDRV     = $00000008;   (* install DirectDraw Drivers           *)
  16905.   DSETUP_DSOUNDDRV    = $00000010;   (* install DirectSound Drivers          *)
  16906.   DSETUP_DXCORE       = $00010000;   (* install DirectX runtime              *)
  16907.   DSETUP_DIRECTX = DSETUP_DXCORE or DSETUP_DDRAWDRV or DSETUP_DSOUNDDRV;
  16908.   DSETUP_TESTINSTALL  = $00020000;   (* just test install, don't do anything *)
  16909.   DSETUP_USEROLDERFLAG= $02000000;   (* enable return DSETUPERR_NEWERVERSION *)
  16910. // Bug #22730
  16911.   DSETUP_NTINSTALL              = $00080000;   (* install on Win2K platform *)
  16912.  
  16913. // These OBSOLETE flags are here for compatibility with pre-DX5 apps only.
  16914. // They are present to allow DX3 apps to be recompiled with DX5 and still work.
  16915. // DO NOT USE THEM for DX5. They will go away in future DX releases.
  16916.   DSETUP_DDRAW         = $00000001; (* OBSOLETE. install DirectDraw           *)
  16917.   DSETUP_DSOUND        = $00000002; (* OBSOLETE. install DirectSound          *)
  16918.   DSETUP_DPLAY         = $00000004; (* OBSOLETE. install DirectPlay           *)
  16919.   DSETUP_DPLAYSP       = $00000020; (* OBSOLETE. install DirectPlay Providers *)
  16920.   DSETUP_DVIDEO        = $00000040; (* OBSOLETE. install DirectVideo          *)
  16921.   DSETUP_D3D           = $00000200; (* OBSOLETE. install Direct3D             *)
  16922.   DSETUP_DINPUT        = $00000800; (* OBSOLETE. install DirectInput          *)
  16923.   DSETUP_DIRECTXSETUP  = $00001000; (* OBSOLETE. install DirectXSetup DLL's   *)
  16924.   DSETUP_NOUI          = $00002000; (* OBSOLETE. install DirectX with NO UI   *)
  16925.   DSETUP_PROMPTFORDRIVERS = $10000000; (* OBSOLETE. prompt when replacing display/audio drivers *)
  16926.   DSETUP_RESTOREDRIVERS = $20000000;(* OBSOLETE. restore display/audio drivers *)
  16927.  
  16928. //******************************************************************
  16929. // DirectX Setup Callback mechanism
  16930. //******************************************************************
  16931.  
  16932. // DSETUP Message Info Codes, passed to callback as Reason parameter.
  16933.   DSETUP_CB_MSG_NOMESSAGE                 = 0;
  16934.   DSETUP_CB_MSG_CANTINSTALL_UNKNOWNOS     = 1;
  16935.   DSETUP_CB_MSG_CANTINSTALL_NT            = 2;
  16936.   DSETUP_CB_MSG_CANTINSTALL_BETA          = 3;
  16937.   DSETUP_CB_MSG_CANTINSTALL_NOTWIN32      = 4;
  16938.   DSETUP_CB_MSG_CANTINSTALL_WRONGLANGUAGE = 5;
  16939.   DSETUP_CB_MSG_CANTINSTALL_WRONGPLATFORM = 6;
  16940.   DSETUP_CB_MSG_PREINSTALL_NT             = 7;
  16941.   DSETUP_CB_MSG_NOTPREINSTALLEDONNT       = 8;
  16942.   DSETUP_CB_MSG_SETUP_INIT_FAILED         = 9;
  16943.   DSETUP_CB_MSG_INTERNAL_ERROR            = 10;
  16944.   DSETUP_CB_MSG_CHECK_DRIVER_UPGRADE      = 11;
  16945.   DSETUP_CB_MSG_OUTOFDISKSPACE            = 12;
  16946.   DSETUP_CB_MSG_BEGIN_INSTALL             = 13;
  16947.   DSETUP_CB_MSG_BEGIN_INSTALL_RUNTIME     = 14;
  16948.   DSETUP_CB_MSG_BEGIN_INSTALL_DRIVERS     = 15;
  16949.   DSETUP_CB_MSG_BEGIN_RESTORE_DRIVERS     = 16;
  16950.   DSETUP_CB_MSG_FILECOPYERROR             = 17;
  16951.  
  16952.  
  16953.   DSETUP_CB_UPGRADE_TYPE_MASK      = $000F;
  16954.   DSETUP_CB_UPGRADE_KEEP           = $0001;
  16955.   DSETUP_CB_UPGRADE_SAFE           = $0002;
  16956.   DSETUP_CB_UPGRADE_FORCE          = $0004;
  16957.   DSETUP_CB_UPGRADE_UNKNOWN        = $0008;
  16958.  
  16959.   DSETUP_CB_UPGRADE_HASWARNINGS    = $0100;
  16960.   DSETUP_CB_UPGRADE_CANTBACKUP     = $0200;
  16961.  
  16962.   DSETUP_CB_UPGRADE_DEVICE_ACTIVE  = $0800;
  16963.  
  16964.   DSETUP_CB_UPGRADE_DEVICE_DISPLAY = $1000;
  16965.   DSETUP_CB_UPGRADE_DEVICE_MEDIA   = $2000;
  16966.  
  16967.  
  16968. type
  16969.   PDSetup_CB_UpgradeInfo = ^TDSetup_CB_UpgradeInfo;
  16970.   TDSetup_CB_UpgradeInfo = record
  16971.     UpgradeFlags: DWORD;
  16972.   end;
  16973.  
  16974.   PDSetup_CB_FileCopyError = ^TDSetup_CB_FileCopyError;
  16975.   TDSetup_CB_FileCopyError = record
  16976.     dwError: DWORD;
  16977.   end;
  16978.  
  16979. //
  16980. // Data Structures
  16981. //
  16982.   PDirectXRegisterAppA = ^TDirectXRegisterAppA;
  16983.   TDirectXRegisterAppA = record
  16984.     dwSize: DWORD;
  16985.     dwFlags: DWORD;
  16986.     lpszApplicationName: PAnsiChar;
  16987.     lpGUID: PGUID;
  16988.     lpszFilename: PAnsiChar;
  16989.     lpszCommandLine: PAnsiChar;
  16990.     lpszPath: PAnsiChar;
  16991.     lpszCurrentDirectory: PAnsiChar;
  16992.   end;
  16993.  
  16994.   PDirectXRegisterApp2A = ^TDirectXRegisterApp2A;
  16995.   TDirectXRegisterApp2A = record
  16996.     dwSize: DWORD;
  16997.     dwFlags: DWORD;
  16998.     lpszApplicationName: PAnsiChar;
  16999.     lpGUID: PGUID;
  17000.     lpszFilename: PAnsiChar;
  17001.     lpszCommandLine: PAnsiChar;
  17002.     lpszPath: PAnsiChar;
  17003.     lpszCurrentDirectory: PAnsiChar;
  17004.     lpszLauncherName: PAnsiChar;
  17005.   end;
  17006.  
  17007.   PDirectXRegisterAppW = ^TDirectXRegisterAppW;
  17008.   TDirectXRegisterAppW = record
  17009.     dwSize: DWORD;
  17010.     dwFlags: DWORD;
  17011.     lpszApplicationName: PWideChar;
  17012.     lpGUID: PGUID;
  17013.     lpszFilename: PWideChar;
  17014.     lpszCommandLine: PWideChar;
  17015.     lpszPath: PWideChar;
  17016.     lpszCurrentDirectory: PWideChar;
  17017.   end;
  17018.  
  17019.   PDirectXRegisterApp2W = ^TDirectXRegisterApp2W;
  17020.   TDirectXRegisterApp2W = record
  17021.     dwSize: DWORD;
  17022.     dwFlags: DWORD;
  17023.     lpszApplicationName: PWideChar;
  17024.     lpGUID: PGUID;
  17025.     lpszFilename: PWideChar;
  17026.     lpszCommandLine: PWideChar;
  17027.     lpszPath: PWideChar;
  17028.     lpszCurrentDirectory: PWideChar;
  17029.     lpszLauncherName: PWideChar;
  17030.   end;
  17031.  
  17032.   PDirectXRegisterApp = ^TDirectXRegisterApp;
  17033.   PDirectXRegisterApp2 = ^TDirectXRegisterApp2;
  17034. {$IFDEF UNICODE}
  17035.   TDirectXRegisterApp = TDirectXRegisterAppW;
  17036.   TDirectXRegisterApp2 = TDirectXRegisterApp2W;
  17037. {$ELSE}
  17038.   TDirectXRegisterApp = TDirectXRegisterAppA;
  17039.   TDirectXRegisterApp2 = TDirectXRegisterApp2A;
  17040. {$ENDIF}
  17041.  
  17042. //
  17043. // API
  17044. //
  17045. var
  17046.   DirectXSetupW : function (hWnd: HWND; lpszRootPath: PWideChar; dwFlags: DWORD) : Integer; stdcall;
  17047.   DirectXSetupA : function (hWnd: HWND; lpszRootPath: PAnsiChar; dwFlags: DWORD) : Integer; stdcall;
  17048.   DirectXSetup : function (hWnd: HWND; lpszRootPath: PCharAW; dwFlags: DWORD) : Integer; stdcall;
  17049.  
  17050.   DirectXDeviceDriverSetupW : function (hWnd: HWND; lpszDriverClass: PWideChar;
  17051.      lpszDriverPath: PWideChar; dwFlags: DWORD) : Integer; stdcall;
  17052.   DirectXDeviceDriverSetupA : function (hWnd: HWND; lpszDriverClass: PAnsiChar;
  17053.      lpszDriverPath: PAnsiChar; dwFlags: DWORD) : Integer; stdcall;
  17054.   DirectXDeviceDriverSetup : function (hWnd: HWND; lpszDriverClass: PCharAW;
  17055.      lpszDriverPath: PCharAW; dwFlags: DWORD) : Integer; stdcall;
  17056.  
  17057.   DirectXRegisterApplicationW : function
  17058.      (hWnd: HWND; const lpDXRegApp: TDirectXRegisterAppW) : Integer; stdcall;
  17059.   DirectXRegisterApplicationA : function
  17060.      (hWnd: HWND; const lpDXRegApp: TDirectXRegisterAppA) : Integer; stdcall;
  17061.   DirectXRegisterApplication : function
  17062.      (hWnd: HWND; const lpDXRegApp: TDirectXRegisterApp) : Integer; stdcall;
  17063.  
  17064.   DirectXUnRegisterApplication : function
  17065.      (hWnd: HWND; const lpGUID: TGUID) : Integer; stdcall;
  17066.  
  17067. type
  17068.   TDSetup_Callback = function (Reason: DWORD; MsgType: DWORD; // Same as flags to MessageBox
  17069.       szMessage: PChar; szName: PChar; pInfo: Pointer) : DWORD; stdcall;
  17070.  
  17071. var
  17072.   DirectXSetupSetCallback : function (Callback: TDSetup_Callback) : Integer; stdcall;
  17073.  
  17074.   DirectXSetupGetVersion : function (out lpdwVersion, lpdwMinorVersion: DWORD) : Integer; stdcall;
  17075.  
  17076. //DirectSound file
  17077. (*==========================================================================;
  17078.  *
  17079.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  17080.  *
  17081.  *  File:       dsound.h
  17082.  *  Content:    DirectSound include file
  17083.  *
  17084.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  17085.  *
  17086.  *  Modified: 10-Sep-2000
  17087.  *
  17088.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  17089.  *  E-Mail: DelphiDirectX@next-reality.com
  17090.  *
  17091.  ***************************************************************************)
  17092.  
  17093. {
  17094.   Windows 98 and debug versions DInput and DSound
  17095.  
  17096.   Under Windows 98, the "debug" setup of the DirectX SDK 6.x skips DInput.DLL
  17097.   and DSound.DLL, i.e. makes you end up with the retail version of these two
  17098.   files without any notice.
  17099.   The debug versions of DInput.DLL and DSound.DLL can be found in the
  17100.   \extras\Win98\Win98Dbg folder of the SDK CD; they need to be installed
  17101.   "manually".
  17102. }
  17103.  
  17104.  
  17105. var
  17106.   DSoundDLL : HMODULE;
  17107.  
  17108. function DSErrorString(Value: HResult) : string;
  17109.  
  17110. const
  17111.   _FACDS = $878;
  17112. function MAKE_DSHResult(code: DWORD) : HResult;
  17113.  
  17114. const
  17115.   FLT_MIN = 1.175494351E-38;
  17116.   FLT_MAX = 3.402823466E+38;
  17117.  
  17118. const
  17119. // Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000}
  17120.   CLSID_DirectSound: TGUID = '{47D4D946-62E8-11cf-93BC-444553540000}';
  17121.  
  17122. // DirectSound Capture Component GUID {B0210780-89CD-11d0-AF08-00A0C925CD16}
  17123.   CLSID_DirectSoundCapture: TGUID = '{47D4D946-62E8-11cf-93BC-444553540000}';
  17124.  
  17125. //
  17126. // Structures
  17127. //
  17128. type
  17129.   IDirectSound = interface;
  17130.   IDirectSoundBuffer = interface;
  17131.   IDirectSound3DListener = interface;
  17132.   IDirectSound3DBuffer = interface;
  17133.   IDirectSoundCapture = interface;
  17134.   IDirectSoundCaptureBuffer = interface;
  17135.   IDirectSoundNotify = interface;
  17136.   IKsPropertySet = interface;
  17137.  
  17138.   PDSCaps = ^TDSCaps;
  17139.   TDSCaps = packed record
  17140.     dwSize: DWORD;
  17141.     dwFlags: DWORD;
  17142.     dwMinSecondarySampleRate: DWORD;
  17143.     dwMaxSecondarySampleRate: DWORD;
  17144.     dwPrimaryBuffers: DWORD;
  17145.     dwMaxHwMixingAllBuffers: DWORD;
  17146.     dwMaxHwMixingStaticBuffers: DWORD;
  17147.     dwMaxHwMixingStreamingBuffers: DWORD;
  17148.     dwFreeHwMixingAllBuffers: DWORD;
  17149.     dwFreeHwMixingStaticBuffers: DWORD;
  17150.     dwFreeHwMixingStreamingBuffers: DWORD;
  17151.     dwMaxHw3DAllBuffers: DWORD;
  17152.     dwMaxHw3DStaticBuffers: DWORD;
  17153.     dwMaxHw3DStreamingBuffers: DWORD;
  17154.     dwFreeHw3DAllBuffers: DWORD;
  17155.     dwFreeHw3DStaticBuffers: DWORD;
  17156.     dwFreeHw3DStreamingBuffers: DWORD;
  17157.     dwTotalHwMemBytes: DWORD;
  17158.     dwFreeHwMemBytes: DWORD;
  17159.     dwMaxContigFreeHwMemBytes: DWORD;
  17160.     dwUnlockTransferRateHwBuffers: DWORD;
  17161.     dwPlayCpuOverheadSwBuffers: DWORD;
  17162.     dwReserved1: DWORD;
  17163.     dwReserved2: DWORD;
  17164.   end;
  17165.   PCDSCaps = ^TDSCaps;
  17166.  
  17167.   PDSBCaps = ^TDSBCaps;
  17168.   TDSBCaps = packed record
  17169.     dwSize: DWORD;
  17170.     dwFlags: DWORD;
  17171.     dwBufferBytes: DWORD;
  17172.     dwUnlockTransferRate: DWORD;
  17173.     dwPlayCpuOverhead: DWORD;
  17174.   end;
  17175.   PCDSBCaps = ^TDSBCaps;
  17176.  
  17177.   TDSBufferDesc_DX6 = packed record
  17178.     dwSize: DWORD;
  17179.     dwFlags: DWORD;
  17180.     dwBufferBytes: DWORD;
  17181.     dwReserved: DWORD;
  17182.     lpwfxFormat: PWaveFormatEx;
  17183.   end;
  17184.  
  17185.   TDSBufferDesc1 = TDSBufferDesc_DX6;
  17186.   PDSBufferDesc1 = ^TDSBufferDesc1;
  17187.   PCDSBufferDesc1 = PDSBufferDesc1;
  17188.  
  17189.   TDSBufferDesc_DX7 = packed record
  17190.     dwSize: DWORD;
  17191.     dwFlags: DWORD;
  17192.     dwBufferBytes: DWORD;
  17193.     dwReserved: DWORD;
  17194.     lpwfxFormat: PWaveFormatEx;
  17195.     guid3DAlgorithm: TGUID;
  17196.   end;
  17197.  
  17198. {$IFDEF DIRECTX6}
  17199.   TDSBufferDesc = TDSBufferDesc_DX6;
  17200. {$ELSE}
  17201.   TDSBufferDesc = TDSBufferDesc_DX7;
  17202. {$ENDIF}
  17203.  
  17204.   PDSBufferDesc = ^TDSBufferDesc;
  17205.   PCDSBufferDesc = PDSBufferDesc;
  17206.  
  17207. (***
  17208. // Snipped from D3DTypes.pas:
  17209.  
  17210.   TD3DValue = Single;
  17211.  
  17212.   PD3DVector = ^TD3DVector;
  17213.   TD3DVector = packed record
  17214.     case Integer of
  17215.     0: (
  17216.       x: TD3DValue;
  17217.       y: TD3DValue;
  17218.       z: TD3DValue;
  17219.      );
  17220.     1: (
  17221.       dvX: TD3DValue;
  17222.       dvY: TD3DValue;
  17223.       dvZ: TD3DValue;
  17224.      );
  17225.   end;
  17226. *)
  17227.  
  17228.   PDS3DBuffer = ^TDS3DBuffer;
  17229.   TDS3DBuffer = packed record
  17230.     dwSize: DWORD;
  17231.     vPosition: TD3DVector;
  17232.     vVelocity: TD3DVector;
  17233.     dwInsideConeAngle: DWORD;
  17234.     dwOutsideConeAngle: DWORD;
  17235.     vConeOrientation: TD3DVector;
  17236.     lConeOutsideVolume: LongInt;
  17237.     flMinDistance: TD3DValue;
  17238.     flMaxDistance: TD3DValue;
  17239.     dwMode: DWORD;
  17240.   end;
  17241.   TCDS3DBuffer = ^TDS3DBuffer;
  17242.  
  17243.   PDS3DListener = ^TDS3DListener;
  17244.   TDS3DListener = packed record
  17245.     dwSize: DWORD;
  17246.     vPosition: TD3DVector;
  17247.     vVelocity: TD3DVector;
  17248.     vOrientFront: TD3DVector;
  17249.     vOrientTop: TD3DVector;
  17250.     flDistanceFactor: TD3DValue;
  17251.     flRolloffFactor: TD3DValue;
  17252.     flDopplerFactor: TD3DValue;
  17253.   end;
  17254.   PCDS3DListener = ^TDS3DListener;
  17255.  
  17256.   PDSCCaps = ^TDSCCaps;
  17257.   TDSCCaps = packed record
  17258.     dwSize: DWORD;
  17259.     dwFlags: DWORD;
  17260.     dwFormats: DWORD;
  17261.     dwChannels: DWORD;
  17262.   end;
  17263.   PCDSCCaps = ^TDSCCaps;
  17264.  
  17265.   PDSCBufferDesc = ^TDSCBufferDesc;
  17266.   TDSCBufferDesc = packed record
  17267.     dwSize: DWORD;
  17268.     dwFlags: DWORD;
  17269.     dwBufferBytes: DWORD;
  17270.     dwReserved: DWORD;
  17271.     lpwfxFormat: PWaveFormatEx;
  17272.   end;
  17273.   PCDSCBufferDesc = ^TDSCBufferDesc;
  17274.  
  17275.   PDSCBCaps = ^TDSCBCaps;
  17276.   TDSCBCaps = packed record
  17277.     dwSize: DWORD;
  17278.     dwFlags: DWORD;
  17279.     dwBufferBytes: DWORD;
  17280.     dwReserved: DWORD;
  17281.   end;
  17282.   PCDSCBCaps = ^TDSCBCaps;
  17283.  
  17284.   PDSBPositionNotify = ^TDSBPositionNotify;
  17285.   TDSBPositionNotify = packed record
  17286.     dwOffset: DWORD;
  17287.     hEventNotify: THandle;
  17288.   end;
  17289.   PCDSBPositionNotify = ^TDSBPositionNotify;
  17290.  
  17291. //
  17292. // DirectSound API
  17293. //
  17294.   TDSEnumCallbackW = function (lpGuid: PGUID; lpstrDescription: PWideChar;
  17295.       lpstrModule: PWideChar; lpContext: Pointer) : BOOL; stdcall;
  17296.   TDSEnumCallbackA = function (lpGuid: PGUID; lpstrDescription: PAnsiChar;
  17297.       lpstrModule: PAnsiChar; lpContext: Pointer) : BOOL; stdcall;
  17298. {$IFDEF UNICODE}
  17299.   TDSEnumCallback = TDSEnumCallbackW;
  17300. {$ELSE}
  17301.   TDSEnumCallback = TDSEnumCallbackA;
  17302. {$ENDIF}
  17303.  
  17304. //
  17305. // IDirectSound
  17306. //
  17307.   IDirectSound = interface (IUnknown)
  17308.     ['{279AFA83-4981-11CE-A521-0020AF0BE560}']
  17309.     // IDirectSound methods
  17310.     function CreateSoundBuffer(const lpDSBufferDesc: TDSBufferDesc;
  17311.         out lpIDirectSoundBuffer: IDirectSoundBuffer;
  17312.         pUnkOuter: IUnknown) : HResult; stdcall;
  17313.     function GetCaps(var lpDSCaps: TDSCaps) : HResult; stdcall;
  17314.     function DuplicateSoundBuffer(lpDsbOriginal: IDirectSoundBuffer;
  17315.         out lpDsbDuplicate: IDirectSoundBuffer) : HResult; stdcall;
  17316.     function SetCooperativeLevel(hwnd: HWND; dwLevel: DWORD) : HResult; stdcall;
  17317.     function Compact: HResult; stdcall;
  17318.     function GetSpeakerConfig(var lpdwSpeakerConfig: DWORD) : HResult; stdcall;
  17319.     function SetSpeakerConfig(dwSpeakerConfig: DWORD) : HResult; stdcall;
  17320.     function Initialize(lpGuid: PGUID) : HResult; stdcall;
  17321.   end;
  17322.  
  17323. //
  17324. // IDirectSoundBuffer
  17325. //
  17326.   IDirectSoundBuffer = interface (IUnknown)
  17327.     ['{279AFA85-4981-11CE-A521-0020AF0BE560}']
  17328.     // IDirectSoundBuffer methods
  17329.     function GetCaps(var lpDSCaps: TDSBCaps) : HResult; stdcall;
  17330.     function GetCurrentPosition
  17331.         (lpdwCapturePosition, lpdwReadPosition : PDWORD) : HResult; stdcall;
  17332.     function GetFormat(lpwfxFormat: PWaveFormatEx; dwSizeAllocated: DWORD;
  17333.         lpdwSizeWritten: PWORD) : HResult; stdcall;
  17334.     function GetVolume(var lplVolume: integer) : HResult; stdcall;
  17335.     function GetPan(var lplPan: integer) : HResult; stdcall;
  17336.     function GetFrequency(var lpdwFrequency: DWORD) : HResult; stdcall;
  17337.     function GetStatus(var lpdwStatus: DWORD) : HResult; stdcall;
  17338.     function Initialize(lpDirectSound: IDirectSound;
  17339.         const lpcDSBufferDesc: TDSBufferDesc) : HResult; stdcall;
  17340.     function Lock(dwWriteCursor, dwWriteBytes: DWORD;
  17341.         var lplpvAudioPtr1: Pointer; var lpdwAudioBytes1: DWORD;
  17342.         var lplpvAudioPtr2: Pointer; var lpdwAudioBytes2: DWORD;
  17343.         dwFlags: DWORD) : HResult; stdcall;
  17344.     function Play(dwReserved1,dwReserved2,dwFlags: DWORD) : HResult; stdcall;
  17345.     function SetCurrentPosition(dwPosition: DWORD) : HResult; stdcall;
  17346.     function SetFormat(const lpcfxFormat: TWaveFormatEx) : HResult; stdcall;
  17347.     function SetVolume(lVolume: integer) : HResult; stdcall;
  17348.     function SetPan(lPan: integer) : HResult; stdcall;
  17349.     function SetFrequency(dwFrequency: DWORD) : HResult; stdcall;
  17350.     function Stop: HResult; stdcall;
  17351.     function Unlock(lpvAudioPtr1: Pointer; dwAudioBytes1: DWORD;
  17352.         lpvAudioPtr2: Pointer; dwAudioBytes2: DWORD) : HResult; stdcall;
  17353.     function Restore: HResult; stdcall;
  17354.   end;
  17355.  
  17356. //
  17357. // IDirectSound3DListener
  17358. //
  17359.   IDirectSound3DListener = interface (IUnknown)
  17360.     ['{279AFA84-4981-11CE-A521-0020AF0BE560}']
  17361.     // IDirectSound3D methods
  17362.     function GetAllParameters(var lpListener: TDS3DListener) : HResult; stdcall;
  17363.     function GetDistanceFactor(var lpflDistanceFactor: TD3DValue) : HResult; stdcall;
  17364.     function GetDopplerFactor(var lpflDopplerFactor: TD3DValue) : HResult; stdcall;
  17365.     function GetOrientation
  17366.         (var lpvOrientFront, lpvOrientTop: TD3DVector) : HResult; stdcall;
  17367.     function GetPosition(var lpvPosition: TD3DVector) : HResult; stdcall;
  17368.     function GetRolloffFactor(var lpflRolloffFactor: TD3DValue) : HResult; stdcall;
  17369.     function GetVelocity(var lpvVelocity: TD3DVector) : HResult; stdcall;
  17370.     function SetAllParameters
  17371.         (const lpcListener: TDS3DListener; dwApply: DWORD) : HResult; stdcall;
  17372.     function SetDistanceFactor
  17373.         (flDistanceFactor: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17374.     function SetDopplerFactor
  17375.         (flDopplerFactor: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17376.     function SetOrientation(xFront, yFront, zFront, xTop, yTop, zTop: TD3DValue;
  17377.         dwApply: DWORD) : HResult; stdcall;
  17378.     function SetPosition(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17379.     function SetRolloffFactor
  17380.         (flRolloffFactor: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17381.     function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17382.     function CommitDeferredSettings: HResult; stdcall;
  17383.   end;
  17384.  
  17385.  
  17386. //
  17387. // IDirectSound3DBuffer
  17388. //
  17389.   IDirectSound3DBuffer = interface (IUnknown)
  17390.     ['{279AFA86-4981-11CE-A521-0020AF0BE560}']
  17391.     // IDirectSoundBuffer3D methods
  17392.     function GetAllParameters(var lpDs3dBuffer: TDS3DBuffer) : HResult; stdcall;
  17393.     function GetConeAngles
  17394.         (var lpdwInsideConeAngle, lpdwOutsideConeAngle: DWORD) : HResult; stdcall;
  17395.     function GetConeOrientation(var lpvOrientation: TD3DVector) : HResult; stdcall;
  17396.     function GetConeOutsideVolume(var lplConeOutsideVolume: integer) : HResult; stdcall;
  17397.     function GetMaxDistance(var lpflMaxDistance: TD3DValue) : HResult; stdcall;
  17398.     function GetMinDistance(var lpflMinDistance: TD3DValue) : HResult; stdcall;
  17399.     function GetMode(var lpdwMode: DWORD) : HResult; stdcall;
  17400.     function GetPosition(var lpvPosition: TD3DVector) : HResult; stdcall;
  17401.     function GetVelocity(var lpvVelocity: TD3DVector) : HResult; stdcall;
  17402.     function SetAllParameters
  17403.         (const lpcDs3dBuffer: TDS3DBuffer; dwApply: DWORD) : HResult; stdcall;
  17404.     function SetConeAngles
  17405.         (dwInsideConeAngle, dwOutsideConeAngle, dwApply: DWORD) : HResult; stdcall;
  17406.     function SetConeOrientation(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17407.     function SetConeOutsideVolume
  17408.         (lConeOutsideVolume: LongInt; dwApply: DWORD) : HResult; stdcall;
  17409.     function SetMaxDistance(flMaxDistance: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17410.     function SetMinDistance(flMinDistance: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17411.     function SetMode(dwMode: DWORD; dwApply: DWORD) : HResult; stdcall;
  17412.     function SetPosition(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17413.     function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
  17414.   end;
  17415.  
  17416.  
  17417. //
  17418. // IDirectSoundCapture
  17419. //
  17420.   IDirectSoundCapture = interface (IUnknown)
  17421.     ['{b0210781-89cd-11d0-af08-00a0c925cd16}']
  17422.     // IDirectSoundCapture methods
  17423.     function CreateCaptureBuffer(const lpDSCBufferDesc: TDSCBufferDesc;
  17424.         var lplpDirectSoundCaptureBuffer: IDirectSoundCaptureBuffer;
  17425.         pUnkOuter: IUnknown) : HResult; stdcall;
  17426.     function GetCaps(var lpdwCaps: TDSCCaps) : HResult; stdcall;
  17427.     function Initialize(lpGuid: PGUID) : HResult; stdcall;
  17428.   end;
  17429.  
  17430.  
  17431. //
  17432. // IDirectSoundCaptureBuffer
  17433. //
  17434.   IDirectSoundCaptureBuffer = interface (IUnknown)
  17435.     ['{b0210782-89cd-11d0-af08-00a0c925cd16}']
  17436.     // IDirectSoundCaptureBuffer methods
  17437.     function GetCaps(var lpdwCaps: TDSCBCaps) : HResult; stdcall;
  17438.     function GetCurrentPosition
  17439.         (lpdwCapturePosition, lpdwReadPosition: PDWORD) : HResult; stdcall;
  17440.     function GetFormat(lpwfxFormat: PWaveFormatEx; dwSizeAllocated: DWORD;
  17441.         lpdwSizeWritten : PDWORD) : HResult; stdcall;
  17442.     function GetStatus(var lpdwStatus: DWORD) : HResult; stdcall;
  17443.     function Initialize(lpDirectSoundCapture: IDirectSoundCapture;
  17444.         const lpcDSBufferDesc: TDSCBufferDesc) : HResult; stdcall;
  17445.     function Lock(dwReadCursor, dwReadBytes: DWORD;
  17446.         var lplpvAudioPtr1: Pointer; var lpdwAudioBytes1: DWORD;
  17447.         var lplpvAudioPtr2: Pointer; var lpdwAudioBytes2: DWORD;
  17448.         dwFlags: DWORD) : HResult; stdcall;
  17449.     function Start(dwFlags: DWORD) : HResult; stdcall;
  17450.     function Stop: HResult; stdcall;
  17451.     function Unlock(lpvAudioPtr1: Pointer; dwAudioBytes1: DWORD;
  17452.         lpvAudioPtr2: Pointer; dwAudioBytes2: DWORD) : HResult; stdcall;
  17453.   end;
  17454.  
  17455. //
  17456. // IDirectSoundNotify
  17457. //
  17458.   IDirectSoundNotify = interface (IUnknown)
  17459.     ['{b0210783-89cd-11d0-af08-00a0c925cd16}']
  17460.     // IDirectSoundNotify methods
  17461.     function SetNotificationPositions(cPositionNotifies: DWORD;
  17462.         const lpcPositionNotifies: TDSBPositionNotify) : HResult; stdcall;
  17463.   end;
  17464.  
  17465. //
  17466. // IKsPropertySet
  17467. //
  17468.   IKsPropertySet = interface (IUnknown)
  17469.     ['{31efac30-515c-11d0-a9aa-00aa0061be93}']
  17470.     // IKsPropertySet methods
  17471.     function Get(const rguidPropSet: TGUID; ulId: DWORD; var pInstanceData;
  17472.         ulInstanceLength: DWORD; var pPropertyData; ulDataLength: DWORD;
  17473.         var pulBytesReturned: DWORD) : HResult; stdcall;
  17474.     // Warning: The following method is defined as Set() in DirectX
  17475.     //          which is a reserved word in Delphi!
  17476.     function SetProperty(const rguidPropSet: TGUID; ulId: DWORD;
  17477.         var pInstanceData; ulInstanceLength: DWORD;
  17478.         var pPropertyData; pulDataLength: DWORD) : HResult; stdcall;
  17479.     function QuerySupport(const rguidPropSet: TGUID; ulId: DWORD;
  17480.         var pulTypeSupport: DWORD) : HResult; stdcall;
  17481.   end;
  17482.  
  17483.  
  17484. const
  17485.   KSPROPERTY_SUPPORT_GET = $00000001;
  17486.   KSPROPERTY_SUPPORT_SET = $00000002;
  17487.  
  17488. //
  17489. // GUID's for all the objects
  17490. //
  17491. type
  17492.   IID_IDirectSound = IDirectSound;
  17493.   IID_IDirectSoundBuffer = IDirectSoundBuffer;
  17494.   IID_IDirectSound3DListener = IDirectSound3DListener;
  17495.   IID_IDirectSound3DBuffer = IDirectSound3DBuffer;
  17496.   IID_IDirectSoundCapture = IDirectSoundCapture;
  17497.   IID_IDirectSoundCaptureBuffer = IDirectSoundCaptureBuffer;
  17498.   IID_IDirectSoundNotify = IDirectSoundNotify;
  17499.   IID_IKsPropertySet = IKsPropertySet;
  17500.  
  17501. //
  17502. // Creation Routines
  17503. //
  17504. var
  17505.     DirectSoundCreate : function ( lpGuid: PGUID; out ppDS: IDirectSound;
  17506.         pUnkOuter: IUnknown) : HResult; stdcall;
  17507.  
  17508.     DirectSoundEnumerateW : function (lpDSEnumCallback: TDSEnumCallbackW;
  17509.         lpContext: Pointer) : HResult; stdcall;
  17510.     DirectSoundEnumerateA : function (lpDSEnumCallback: TDSEnumCallbackA;
  17511.         lpContext: Pointer) : HResult; stdcall;
  17512.     DirectSoundEnumerate : function (lpDSEnumCallback: TDSEnumCallback;
  17513.         lpContext: Pointer) : HResult; stdcall;
  17514.  
  17515.     DirectSoundCaptureCreate : function (lpGUID: PGUID;
  17516.         out lplpDSC: IDirectSoundCapture;
  17517.         pUnkOuter: IUnknown) : HResult; stdcall;
  17518.  
  17519.     DirectSoundCaptureEnumerateW : function (lpDSEnumCallback: TDSEnumCallbackW;
  17520.         lpContext: Pointer) : HResult; stdcall;
  17521.     DirectSoundCaptureEnumerateA : function (lpDSEnumCallback: TDSEnumCallbackA;
  17522.         lpContext: Pointer) : HResult; stdcall;
  17523.     DirectSoundCaptureEnumerate : function(lpDSEnumCallback: TDSEnumCallback;
  17524.         lpContext: Pointer) : HResult; stdcall;
  17525.  
  17526.  
  17527. //
  17528. // Return Codes
  17529. //
  17530.  
  17531. const
  17532.   MAKE_DSHRESULT_ = HResult($88780000);
  17533.  
  17534.   DS_OK = 0;
  17535.  
  17536. // The function completed successfully, but we had to substitute the 3D algorithm
  17537.   DS_NO_VIRTUALIZATION = MAKE_DSHRESULT_ + 10;
  17538.  
  17539. // The call failed because resources (such as a priority level)
  17540. // were already being used by another caller.
  17541.   DSERR_ALLOCATED = MAKE_DSHRESULT_ + 10;
  17542.  
  17543. // The control (vol,pan,etc.) requested by the caller is not available.
  17544.   DSERR_CONTROLUNAVAIL = MAKE_DSHRESULT_ + 30;
  17545.  
  17546. // An invalid parameter was passed to the returning function
  17547.   DSERR_INVALIDPARAM = E_INVALIDARG;
  17548.  
  17549. // This call is not valid for the current state of this object
  17550.   DSERR_INVALIDCALL = MAKE_DSHRESULT_ + 50;
  17551.  
  17552. // An undetermined error occured inside the DirectSound subsystem
  17553.   DSERR_GENERIC = E_FAIL;
  17554.  
  17555. // The caller does not have the priority level required for the function to
  17556. // succeed.
  17557.   DSERR_PRIOLEVELNEEDED = MAKE_DSHRESULT_ + 70;
  17558.  
  17559. // Not enough free memory is available to complete the operation
  17560.   DSERR_OUTOFMEMORY = E_OUTOFMEMORY;
  17561.  
  17562. // The specified WAVE format is not supported
  17563.   DSERR_BADFORMAT = MAKE_DSHRESULT_ + 100;
  17564.  
  17565. // The function called is not supported at this time
  17566.   DSERR_UNSUPPORTED = E_NOTIMPL;
  17567.  
  17568. // No sound driver is available for use
  17569.   DSERR_NODRIVER = MAKE_DSHRESULT_ + 120;
  17570.  
  17571. // This object is already initialized
  17572.   DSERR_ALREADYINITIALIZED = MAKE_DSHRESULT_ + 130;
  17573.  
  17574. // This object does not support aggregation
  17575.   DSERR_NOAGGREGATION = CLASS_E_NOAGGREGATION;
  17576.  
  17577. // The buffer memory has been lost, and must be restored.
  17578.   DSERR_BUFFERLOST = MAKE_DSHRESULT_ + 150;
  17579.  
  17580. // Another app has a higher priority level, preventing this call from
  17581. // succeeding.
  17582.   DSERR_OTHERAPPHASPRIO = MAKE_DSHRESULT_ + 160;
  17583.  
  17584. // This object has not been initialized
  17585.   DSERR_UNINITIALIZED = MAKE_DSHRESULT_ + 170;
  17586.  
  17587. // The requested COM interface is not available
  17588.   DSERR_NOINTERFACE = E_NOINTERFACE;
  17589.  
  17590. // Access is denied
  17591.   DSERR_ACCESSDENIED = E_ACCESSDENIED;
  17592.  
  17593. //
  17594. // Flags
  17595. //
  17596.  
  17597.   DSCAPS_PRIMARYMONO = $00000001;
  17598.   DSCAPS_PRIMARYSTEREO = $00000002;
  17599.   DSCAPS_PRIMARY8BIT = $00000004;
  17600.   DSCAPS_PRIMARY16BIT = $00000008;
  17601.   DSCAPS_CONTINUOUSRATE = $00000010;
  17602.   DSCAPS_EMULDRIVER = $00000020;
  17603.   DSCAPS_CERTIFIED = $00000040;
  17604.   DSCAPS_SECONDARYMONO = $00000100;
  17605.   DSCAPS_SECONDARYSTEREO = $00000200;
  17606.   DSCAPS_SECONDARY8BIT = $00000400;
  17607.   DSCAPS_SECONDARY16BIT = $00000800;
  17608.  
  17609.   DSSCL_NORMAL = $00000001;
  17610.   DSSCL_PRIORITY = $00000002;
  17611.   DSSCL_EXCLUSIVE = $00000003;
  17612.   DSSCL_WRITEPRIMARY = $00000004;
  17613.  
  17614.   DSSPEAKER_HEADPHONE = $00000001;
  17615.   DSSPEAKER_MONO = $00000002;
  17616.   DSSPEAKER_QUAD = $00000003;
  17617.   DSSPEAKER_STEREO = $00000004;
  17618.   DSSPEAKER_SURROUND = $00000005;
  17619.   DSSPEAKER_5POINT1 = $00000006;
  17620.  
  17621.   DSSPEAKER_GEOMETRY_MIN     = $00000005;  //   5 degrees
  17622.   DSSPEAKER_GEOMETRY_NARROW  = $0000000A;  //  10 degrees
  17623.   DSSPEAKER_GEOMETRY_WIDE    = $00000014;  //  20 degrees
  17624.   DSSPEAKER_GEOMETRY_MAX     = $000000B4;  // 180 degrees
  17625.  
  17626. function DSSPEAKER_COMBINED(c, g: variant) : DWORD;
  17627. function DSSPEAKER_CONFIG(a: variant) : byte;
  17628. function DSSPEAKER_GEOMETRY(a: variant) : byte;
  17629.  
  17630. const
  17631.   DSBCAPS_PRIMARYBUFFER = $00000001;
  17632.   DSBCAPS_STATIC = $00000002;
  17633.   DSBCAPS_LOCHARDWARE = $00000004;
  17634.   DSBCAPS_LOCSOFTWARE = $00000008;
  17635.   DSBCAPS_CTRL3D = $00000010;
  17636.   DSBCAPS_CTRLFREQUENCY = $00000020;
  17637.   DSBCAPS_CTRLPAN = $00000040;
  17638.   DSBCAPS_CTRLVOLUME = $00000080;
  17639.   DSBCAPS_CTRLPOSITIONNOTIFY = $00000100;
  17640.   DSBCAPS_STICKYFOCUS = $00004000;
  17641.   DSBCAPS_GLOBALFOCUS = $00008000;
  17642.   DSBCAPS_GETCURRENTPOSITION2 = $00010000;
  17643.   DSBCAPS_MUTE3DATMAXDISTANCE = $00020000;
  17644.   DSBCAPS_LOCDEFER            = $00040000;
  17645.  
  17646.   DSBPLAY_LOOPING = $00000001;
  17647.   DSBPLAY_LOCHARDWARE = $00000002;
  17648.   DSBPLAY_LOCSOFTWARE = $00000004;
  17649.   DSBPLAY_TERMINATEBY_TIME = $00000008;
  17650.   DSBPLAY_TERMINATEBY_DISTANCE = $000000010;
  17651.   DSBPLAY_TERMINATEBY_PRIORITY = $000000020;
  17652.  
  17653.   DSBSTATUS_PLAYING = $00000001;
  17654.   DSBSTATUS_BUFFERLOST = $00000002;
  17655.   DSBSTATUS_LOOPING = $00000004;
  17656.   DSBSTATUS_LOCHARDWARE = $00000008;
  17657.   DSBSTATUS_LOCSOFTWARE = $00000010;
  17658.   DSBSTATUS_TERMINATED = $00000020;
  17659.  
  17660.   DSBLOCK_FROMWRITECURSOR = $00000001;
  17661.   DSBLOCK_ENTIREBUFFER = $00000002;
  17662.  
  17663.   DSBFREQUENCY_MIN = 100;
  17664.   DSBFREQUENCY_MAX = 100000;
  17665.   DSBFREQUENCY_ORIGINAL = 0;
  17666.  
  17667.   DSBPAN_LEFT = -10000;
  17668.   DSBPAN_CENTER = 0;
  17669.   DSBPAN_RIGHT = 10000;
  17670.  
  17671.   DSBVOLUME_MIN = -10000;
  17672.   DSBVOLUME_MAX = 0;
  17673.  
  17674.   DSBSIZE_MIN = 4;
  17675.   DSBSIZE_MAX = $0FFFFFFF;
  17676.  
  17677.   DS3DMODE_NORMAL = $00000000;
  17678.   DS3DMODE_HEADRELATIVE = $00000001;
  17679.   DS3DMODE_DISABLE = $00000002;
  17680.  
  17681.   DS3D_IMMEDIATE = $00000000;
  17682.   DS3D_DEFERRED = $00000001;
  17683.  
  17684.   DS3D_MINDISTANCEFACTOR = FLT_MIN;
  17685.   DS3D_MAXDISTANCEFACTOR = FLT_MAX;
  17686.   DS3D_DEFAULTDISTANCEFACTOR = 1.0;
  17687.  
  17688.   DS3D_MINROLLOFFFACTOR = 0.0;
  17689.   DS3D_MAXROLLOFFFACTOR = 10.0;
  17690.   DS3D_DEFAULTROLLOFFFACTOR = 1.0;
  17691.  
  17692.   DS3D_MINDOPPLERFACTOR = 0.0;
  17693.   DS3D_MAXDOPPLERFACTOR = 10.0;
  17694.   DS3D_DEFAULTDOPPLERFACTOR = 1.0;
  17695.  
  17696.   DS3D_DEFAULTMINDISTANCE = 1.0;
  17697.   DS3D_DEFAULTMAXDISTANCE = 1000000000.0;
  17698.  
  17699.   DS3D_MINCONEANGLE = 0;
  17700.   DS3D_MAXCONEANGLE = 360;
  17701.   DS3D_DEFAULTCONEANGLE = 360;
  17702.  
  17703.   DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX;
  17704.  
  17705.   DSCCAPS_EMULDRIVER = $00000020;
  17706.   DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED;
  17707.  
  17708.   DSCBCAPS_WAVEMAPPED = $80000000;
  17709.  
  17710.  
  17711.  
  17712.   DSBCAPS_CTRLDEFAULT = $000000E0;
  17713.   DSBCAPS_CTRLALL = $000001F0;
  17714.  
  17715.   DSCBLOCK_ENTIREBUFFER = $00000001;
  17716.  
  17717.   DSCBSTATUS_CAPTURING = $00000001;
  17718.   DSCBSTATUS_LOOPING = $00000002;
  17719.  
  17720.   DSCBSTART_LOOPING = $00000001;
  17721.  
  17722.   DSBPN_OFFSETSTOP = DWORD(-1);
  17723.  
  17724. //
  17725. // DirectSound3D Algorithms
  17726. //
  17727.  
  17728. // Default DirectSound3D algorithm {00000000-0000-0000-0000-000000000000}
  17729.   DS3DALG_DEFAULT: TGUID = '{00000000-0000-0000-0000-000000000000}';
  17730.  
  17731. // No virtualization {C241333F-1C1B-11d2-94F5-00C04FC28ACA}
  17732.   DS3DALG_NO_VIRTUALIZATION: TGUID = '';
  17733.  
  17734. // High-quality HRTF algorithm {C2413340-1C1B-11d2-94F5-00C04FC28ACA}
  17735.   DS3DALG_HRTF_FULL: TGUID = '{C2413340-1C1B-11d2-94F5-00C04FC28ACA}';
  17736.  
  17737. // Lower-quality HRTF algorithm {C2413342-1C1B-11d2-94F5-00C04FC28ACA}
  17738.   DS3DALG_HRTF_LIGHT: TGUID = '{C2413342-1C1B-11d2-94F5-00C04FC28ACA}';
  17739.  
  17740. //DirectMusic file
  17741. (*==========================================================================;
  17742.  *
  17743.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  17744.  *
  17745.  *  Files:      dls1.h dls2.h dmdls.h dmerror.h dmksctrl.h
  17746.                 dmusicc.h dmusici.h dmusicf.h dmusbuff.h
  17747.  *  Content:    DirectMusic, DirectSetup
  17748.  *
  17749.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  17750.  *
  17751.  *  Modyfied: 10-Sep-2000
  17752.  *
  17753.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  17754.  *  E-Mail: DelphiDirectX@next-reality.com
  17755.  *
  17756.  ***************************************************************************)
  17757.  
  17758.  
  17759. function MAKE_HRESULT(sev,fac,code: DWORD) : HResult;
  17760.  
  17761. type
  17762.   mmioFOURCC = array [0..3] of Char;
  17763.  
  17764.  
  17765. (*==========================================================================;
  17766. //
  17767. //  dls1.h
  17768. //
  17769. //
  17770. //  Description:
  17771. //
  17772. //  Interface defines and structures for the Instrument Collection Form
  17773. //  RIFF DLS.
  17774. //
  17775. //
  17776. //  Written by Sonic Foundry 1996.  Released for public use.
  17777. //
  17778. //=========================================================================*)
  17779.  
  17780. (*//////////////////////////////////////////////////////////////////////////
  17781. //
  17782. //
  17783. // Layout of an instrument collection:
  17784. //
  17785. //
  17786. // RIFF [] 'DLS ' [dlid,colh,INSTLIST,WAVEPOOL,INFOLIST]
  17787. //
  17788. // INSTLIST
  17789. // LIST [] 'lins'
  17790. //               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  17791. //               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  17792. //               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  17793. //
  17794. // RGNLIST
  17795. // LIST [] 'lrgn'
  17796. //               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  17797. //               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  17798. //               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  17799. //
  17800. // ARTLIST
  17801. // LIST [] 'lart'
  17802. //         'art1' level 1 Articulation connection graph
  17803. //         'art2' level 2 Articulation connection graph
  17804. //         '3rd1' Possible 3rd party articulation structure 1
  17805. //         '3rd2' Possible 3rd party articulation structure 2 .... and so on
  17806. //
  17807. // WAVEPOOL
  17808. // ptbl [] [pool table]
  17809. // LIST [] 'wvpl'
  17810. //               [path],
  17811. //               [path],
  17812. //               LIST [] 'wave' [dlid,RIFFWAVE]
  17813. //               LIST [] 'wave' [dlid,RIFFWAVE]
  17814. //               LIST [] 'wave' [dlid,RIFFWAVE]
  17815. //               LIST [] 'wave' [dlid,RIFFWAVE]
  17816. //               LIST [] 'wave' [dlid,RIFFWAVE]
  17817. //
  17818. // INFOLIST
  17819. // LIST [] 'INFO'
  17820. //               'icmt' 'One of those crazy comments.'
  17821. //               'icop' 'Copyright (C) 1996 Sonic Foundry'
  17822. //
  17823. ////////////////////////////////////////////////////////////////////////(*)
  17824.  
  17825. (*/////////////////////////////////////////////////////////////////////////
  17826. // FOURCC's used in the DLS file
  17827. ////////////////////////////////////////////////////////////////////////(*)
  17828.  
  17829. const
  17830.   FOURCC_DLS   : mmioFOURCC = ('D','L','S',' ');
  17831.   FOURCC_DLID  : mmioFOURCC = ('d','l','i','d');
  17832.   FOURCC_COLH  : mmioFOURCC = ('c','o','l','h');
  17833.   FOURCC_WVPL  : mmioFOURCC = ('w','v','p','l');
  17834.   FOURCC_PTBL  : mmioFOURCC = ('p','t','b','l');
  17835.   FOURCC_PATH  : mmioFOURCC = ('p','a','t','h');
  17836.   FOURCC_wave  : mmioFOURCC = ('w','a','v','e');
  17837.   FOURCC_LINS  : mmioFOURCC = ('l','i','n','s');
  17838.   FOURCC_INS   : mmioFOURCC = ('i','n','s',' ');
  17839.   FOURCC_INSH  : mmioFOURCC = ('i','n','s','h');
  17840.   FOURCC_LRGN  : mmioFOURCC = ('l','r','g','n');
  17841.   FOURCC_RGN   : mmioFOURCC = ('r','g','n',' ');
  17842.   FOURCC_RGNH  : mmioFOURCC = ('r','g','n','h');
  17843.   FOURCC_LART  : mmioFOURCC = ('l','a','r','t');
  17844.   FOURCC_ART1  : mmioFOURCC = ('a','r','t','1');
  17845.   FOURCC_WLNK  : mmioFOURCC = ('w','l','n','k');
  17846.   FOURCC_WSMP  : mmioFOURCC = ('w','s','m','p');
  17847.   //FOURCC_VERS  : mmioFOURCC = ('v','e','r','s');
  17848.  
  17849. (*/////////////////////////////////////////////////////////////////////////
  17850. // Articulation connection graph definitions
  17851. ////////////////////////////////////////////////////////////////////////(*)
  17852.  
  17853. (* Generic Sources *)
  17854.   CONN_SRC_NONE              = $0000;
  17855.   CONN_SRC_LFO               = $0001;
  17856.   CONN_SRC_KEYONVELOCITY     = $0002;
  17857.   CONN_SRC_KEYNUMBER         = $0003;
  17858.   CONN_SRC_EG1               = $0004;
  17859.   CONN_SRC_EG2               = $0005;
  17860.   CONN_SRC_PITCHWHEEL        = $0006;
  17861.  
  17862. (* Midi Controllers 0-127 *)
  17863.   CONN_SRC_CC1               = $0081;
  17864.   CONN_SRC_CC7               = $0087;
  17865.   CONN_SRC_CC10              = $008a;
  17866.   CONN_SRC_CC11              = $008b;
  17867.  
  17868. (* Generic Destinations *)
  17869.   CONN_DST_NONE              = $0000;
  17870.   CONN_DST_ATTENUATION       = $0001;
  17871.   CONN_DST_PITCH             = $0003;
  17872.   CONN_DST_PAN               = $0004;
  17873.  
  17874. (* LFO Destinations *)
  17875.   CONN_DST_LFO_FREQUENCY     = $0104;
  17876.   CONN_DST_LFO_STARTDELAY    = $0105;
  17877.  
  17878. (* EG1 Destinations *)
  17879.   CONN_DST_EG1_ATTACKTIME    = $0206;
  17880.   CONN_DST_EG1_DECAYTIME     = $0207;
  17881.   CONN_DST_EG1_RELEASETIME   = $0209;
  17882.   CONN_DST_EG1_SUSTAINLEVEL  = $020a;
  17883.  
  17884. (* EG2 Destinations *)
  17885.   CONN_DST_EG2_ATTACKTIME    = $030a;
  17886.   CONN_DST_EG2_DECAYTIME     = $030b;
  17887.   CONN_DST_EG2_RELEASETIME   = $030d;
  17888.   CONN_DST_EG2_SUSTAINLEVEL  = $030e;
  17889.  
  17890.   CONN_TRN_NONE              = $0000;
  17891.   CONN_TRN_CONCAVE           = $0001;
  17892.  
  17893. type
  17894.   PDLSId = ^TDLSId;
  17895.   TDLSId = packed record
  17896.     ulData1 : ULONG;
  17897.     usData2 : Word;
  17898.     usData3 : Word;
  17899.     abData4 : array [0..7] of BYTE;
  17900.   end;
  17901.  
  17902. //  PDLSVersion = ^TDLSVersion;
  17903. //  TDLSVersion = packed record
  17904. //    dwVersionMS,
  17905. //    dwVersionLS : DWORD;
  17906. //  end;
  17907.  
  17908.   PConnection = ^TConnection;
  17909.   TConnection = packed record
  17910.     usSource : Word;
  17911.     usControl : Word;
  17912.     SuDestination : Word;
  17913.     usTransform :  Word;
  17914.     lScale : LongInt;
  17915.   end;
  17916.  
  17917. (* Level 1 Articulation Data *)
  17918.  
  17919.   PConnectionList = ^TConnectionList;
  17920.   TConnectionList = packed record
  17921.     cbSize : ULONG;            (* size of the connection list structure *)
  17922.     cConnections : ULONG;      (* count of connections in the list *)
  17923.   end;
  17924.  
  17925. (*/////////////////////////////////////////////////////////////////////////
  17926. // Generic type defines for regions and instruments
  17927. ////////////////////////////////////////////////////////////////////////(*)
  17928.  
  17929.   PRGNRange = ^TRGNRange;
  17930.   TRGNRange = packed record
  17931.     usLow : Word;
  17932.     usHigh : Word;
  17933.   end;
  17934.  
  17935. const
  17936.   F_INSTRUMENT_DRUMS      = $80000000;
  17937.  
  17938. type
  17939.   PMIDILocale = ^TMIDILocale;
  17940.   TMIDILocale = packed record
  17941.     ulBank : ULONG;
  17942.     ulInstrument : ULONG;
  17943.   end;
  17944.  
  17945. (*/////////////////////////////////////////////////////////////////////////
  17946. // Header structures found in an DLS file for collection, instruments, and
  17947. // regions.
  17948. ////////////////////////////////////////////////////////////////////////(*)
  17949.  
  17950. const
  17951.   F_RGN_OPTION_SELFNONEXCLUSIVE  = $0001;
  17952.  
  17953. type
  17954.   PRGNHeader = ^TRGNHeader;
  17955.   TRGNHeader = packed record
  17956.     RangeKey : TRGNRange;          (* Key range  *)
  17957.     RangeVelocity : TRGNRange;     (* Velocity Range  *)
  17958.     fusOptions : Word   ;          (* Synthesis options for this range *)
  17959.     usKeyGroup : Word   ;          (* Key grouping for non simultaneous play *)
  17960.                                    (* 0 = no group, 1 up is group *)
  17961.                                    (* for Level 1 only groups 1-15 are allowed *)
  17962.   end;
  17963.  
  17964.   PInstHeader = ^TInstHeader;
  17965.   TInstHeader = packed record
  17966.     cRegions : ULONG;                (* Count of regions in this instrument *)
  17967.     Locale : TMIDILocale;            (* Intended MIDI locale of this instrument *)
  17968.   end;
  17969.  
  17970.   PDLSHeader = ^TDLSHeader;
  17971.   TDLSHeader = packed record
  17972.     cInstruments : ULONG;
  17973.   end;
  17974.  
  17975. (*////////////////////////////////////////////////////////////////////////////
  17976. // definitions for the Wave link structure
  17977. ///////////////////////////////////////////////////////////////////////////(*)
  17978.  
  17979. (* ****  For level 1 only WAVELINK_CHANNEL_MONO is valid  **** *)
  17980. (* ulChannel allows for up to 32 channels of audio with each bit position *)
  17981. (* specifiying a channel of playback *)
  17982.  
  17983. const
  17984.   WAVELINK_CHANNEL_LEFT    = $0001;
  17985.   WAVELINK_CHANNEL_RIGHT   = $0002;
  17986.  
  17987.   F_WAVELINK_PHASE_MASTER  = $0001;
  17988.  
  17989. type
  17990.   PWaveLink = ^TWaveLink;
  17991.   TWaveLink = packed record  (* any paths or links are stored right after struct *)
  17992.     fusOptions :   Word;     (* options flags for this wave *)
  17993.     usPhaseGroup : Word;     (* Phase grouping for locking channels *)
  17994.     ulChannel :    ULONG;    (* channel placement *)
  17995.     ulTableIndex : ULONG;    (* index into the wave pool table, 0 based *)
  17996.   end;
  17997.  
  17998. const
  17999.   POOL_CUE_NULL  = $ffffffff;
  18000.  
  18001. type
  18002.   PPoolCUE = ^TPoolCUE;
  18003.   TPoolCUE = packed record
  18004.     ulOffset : ULONG;
  18005.   end;
  18006.  
  18007.   PPoolTable = ^TPoolTable;
  18008.   TPoolTable = packed record
  18009.     cbSize : ULONG;             (* size of the pool table structure *)
  18010.     cCues :  ULONG;             (* count of cues in the list *)
  18011.   end;
  18012.  
  18013. (*////////////////////////////////////////////////////////////////////////////
  18014. // Structures for the "wsmp" chunk
  18015. ///////////////////////////////////////////////////////////////////////////(*)
  18016.  
  18017. const
  18018.   F_WSMP_NO_TRUNCATION     = $0001;
  18019.   F_WSMP_NO_COMPRESSION    = $0002;
  18020.  
  18021. type
  18022.   PWSMPL = ^TWSMPL;
  18023.   TWSMPL = packed record
  18024.     cbSize :        ULONG;
  18025.     usUnityNote :   Word;       (* MIDI Unity Playback Note *)
  18026.     sFineTune :     SmallInt;   (* Fine Tune in log tuning *)
  18027.     lAttenuation :  Integer;    (* Overall Attenuation to be applied to data *)
  18028.     fulOptions :    ULONG;      (* Flag options  *)
  18029.     cSampleLoops :  ULONG;      (* Count of Sample loops, 0 loops is one shot *)
  18030.   end;
  18031.  
  18032.  
  18033. (* This loop type is a normal forward playing loop which is continually *)
  18034. (* played until the envelope reaches an off threshold in the release *)
  18035. (* portion of the volume envelope *)
  18036.  
  18037. const
  18038.   WLOOP_TYPE_FORWARD  = 0;
  18039.  
  18040. type
  18041.   TWLoop = packed record
  18042.     cbSize :   ULONG;
  18043.     ulType :   ULONG;           (* Loop Type *)
  18044.     ulStart :  ULONG;           (* Start of loop in samples *)
  18045.     ulLength : ULONG;           (* Length of loop in samples *)
  18046.   end;
  18047.  
  18048. (*******************************************************************************
  18049.  
  18050. dls2.h
  18051.  
  18052. Description:
  18053.  
  18054. Interface defines and structures for the DLS2 extensions of DLS.
  18055.  
  18056.  
  18057.   Written by Microsoft 1998.  Released for public use.
  18058.  
  18059. *******************************************************************************)
  18060.  
  18061. (*
  18062.   FOURCC's used in the DLS2 file, in addition to DLS1 chunks
  18063. *)
  18064. const
  18065.   FOURCC_RGN2  : mmioFOURCC = ('r','g','n','2');
  18066.   FOURCC_LAR2  : mmioFOURCC = ('l','a','r','2');
  18067.   FOURCC_ART2  : mmioFOURCC = ('a','r','t','2');
  18068.   FOURCC_CDL   : mmioFOURCC = ('c','d','l',' ');
  18069. //  FOURCC_DLID  : mmioFOURCC = ('d','l','i','d');
  18070.  
  18071. (*
  18072.   Articulation connection graph definitions. These are in addition to
  18073.   the definitions in the DLS1 header.
  18074. *)
  18075.  
  18076. const
  18077. (* Generic Sources (in addition to DLS1 sources. *)
  18078.   CONN_SRC_POLYPRESSURE           = $0007;      (* Polyphonic Pressure *)
  18079.   CONN_SRC_CHANNELPRESSURE      = $0008;        (* Channel Pressure *)
  18080.   CONN_SRC_VIBRATO                    = $0009;  (* Vibrato LFO *)
  18081.   CONN_SRC_MONOPRESSURE     = $000a; (* MIDI Mono pressure *)
  18082.  
  18083.  
  18084. (* Midi Controllers *)
  18085.   CONN_SRC_CC91                     = $00db;    (* Reverb Send *)
  18086.   CONN_SRC_CC93                     = $00dd;    (* Chorus Send *)
  18087.  
  18088.  
  18089. (* Generic Destinations *)
  18090.   CONN_DST_GAIN                 = $0001;        (* Same as CONN_DST_ ATTENUATION *)
  18091.   CONN_DST_KEYNUMBER            = $0005;        (* Key Number Generator *)
  18092.  
  18093. (* Audio Channel Output Destinations *)
  18094.   CONN_DST_LEFT                     = $0010;    (* Left Channel Send *)
  18095.   CONN_DST_RIGHT                        = $0011;        (* Right Channel Send *)
  18096.   CONN_DST_CENTER                         = $0012;      (* Center Channel Send *)
  18097.   CONN_DST_LEFTREAR                     = $0013;        (* Left Rear Channel Send *)
  18098.   CONN_DST_RIGHTREAR            = $0014;        (* Right Rear Channel Send *)
  18099.   CONN_DST_LFE_CHANNEL  = $0015;        (* LFE Channel Send *)
  18100.   CONN_DST_CHORUS                         = $0080;      (* Chorus Send *)
  18101.   CONN_DST_REVERB                         = $0081;      (* Reverb Send *)
  18102.  
  18103. (* Vibrato LFO Destinations *)
  18104.   CONN_DST_VIB_FREQUENCY                = $0114;        (* Vibrato Frequency *)
  18105.   CONN_DST_VIB_STARTDELAY         = $0115;      (* Vibrato Start Delay *)
  18106.  
  18107. (* EG1 Destinations *)
  18108.   CONN_DST_EG1_DELAYTIME                = $020B;        (* EG1 Delay Time *)
  18109.   CONN_DST_EG1_HOLDTIME         = $020C;        (* EG1 Hold Time *)
  18110.  
  18111.  
  18112. (*      EG2 Destinations *)
  18113.   CONN_DST_EG2_DELAYTIME                = $030F;        (* EG2 Delay Time *)
  18114.   CONN_DST_EG2_HOLDTIME         = $0310;        (* EG2 Hold Time *)
  18115.  
  18116.  
  18117. (* Filter Destinations *)
  18118.   CONN_DST_FILTER_CUTOFF                = $0500;        (* Filter Cutoff Frequency *)
  18119.   CONN_DST_FILTER_Q                     = $0501;        (* Filter Resonance *)
  18120.  
  18121.  
  18122. (* Transforms *)
  18123.   CONN_TRN_CONVEX                       = $0002;        (* Convex Transform *)
  18124.   CONN_TRN_SWITCH                       = $0003;        (* Switch Transform *)
  18125.  
  18126.  
  18127. (*      Conditional chunk operators *)
  18128.   DLS_CDL_AND                          = $0001; (* X = X & Y *)
  18129.   DLS_CDL_OR                           = $0002; (* X = X | Y *)
  18130.   DLS_CDL_XOR                          = $0003; (* X = X ^ Y *)
  18131.   DLS_CDL_ADD                        = $0004;   (* X = X + Y *)
  18132.   DLS_CDL_SUBTRACT         = $0005;     (* X = X - Y *)
  18133.   DLS_CDL_MULTIPLY           = $0006;   (* X = X * Y *)
  18134.   DLS_CDL_DIVIDE                     = $0007;   (* X = X / Y *)
  18135.   DLS_CDL_LOGICAL_AND      = $0008;     (* X = X && Y *)
  18136.   DLS_CDL_LOGICAL_OR       = $0009;     (* X = X || Y *)
  18137.   DLS_CDL_LT                           = $000A; (* X = (X < Y) *)
  18138.   DLS_CDL_LE                           = $000B; (* X = (X <= Y) *)
  18139.   DLS_CDL_GT                       = $000C;     (* X = (X > Y) *)
  18140.   DLS_CDL_GE                       = $000D;     (* X = (X >= Y) *)
  18141.   DLS_CDL_EQ                       = $000E;     (* X = (X == Y) *)
  18142.   DLS_CDL_NOT                        = $000F;   (* X = !X *)
  18143.   DLS_CDL_CONST            = $0010;     (* 32-bit constant *)
  18144.   DLS_CDL_QUERY            = $0011;     (* 32-bit value returned from query *)
  18145.   DLS_CDL_QUERYSUPPORTED = $0012;       (* Test to see if DLSID Query is supported *)
  18146.  
  18147. (*
  18148. Loop and release
  18149. *)
  18150.  
  18151.   WLOOP_TYPE_RELEASE  = 2;
  18152.  
  18153. (*
  18154. DLSID queries for <cdl-ck>
  18155. *)
  18156.  
  18157.   DLSID_GMInHardware : TGUID =        '{178f2f24-c364-11d1-a760-0000f875ac12}';
  18158.   DLSID_GSInHardware : TGUID =        '{178f2f25-c364-11d1-a760-0000f875ac12}';
  18159.   DLSID_XGInHardware : TGUID =        '{178f2f26-c364-11d1-a760-0000f875ac12}';
  18160.   DLSID_SupportsDLS1 : TGUID =        '{178f2f27-c364-11d1-a760-0000f875ac12}';
  18161.   DLSID_SupportsDLS2 : TGUID =        '{f14599e5-4689-11d2-afa6-00aa0024d8b6}';
  18162.   DLSID_SampleMemorySize : TGUID =    '{178f2f28-c364-11d1-a760-0000f875ac12}';
  18163.   DLSID_ManufacturersID : TGUID =     '{b03e1181-8095-11d2-a1ef-00600833dbd8}';
  18164.   DLSID_ProductID : TGUID =           '{b03e1182-8095-11d2-a1ef-00600833dbd8}';
  18165.   DLSID_SamplePlaybackRate : TGUID =  '{2a91f713-a4bf-11d2-bbdf-00600833dbd8}';
  18166.  
  18167. (************************************************************************
  18168. *                                                                       *
  18169. *   dmdls.h -- DLS download definitions for DirectMusic API's           *
  18170. *                                                                       *
  18171. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  18172. *                                                                       *
  18173. ************************************************************************)
  18174.  
  18175. type
  18176.   TPCent =   LongInt;  (* Pitch cents *)
  18177.   TGCent =   LongInt;  (* Gain cents *)
  18178.   TTCent =   LongInt;  (* Time cents *)
  18179.   TPercent = LongInt;  (* Per.. cent! *)
  18180.  
  18181.   PReference_Time = ^TReference_Time;
  18182.   TReference_Time = LongLong;
  18183.  
  18184.   TFourCC = DWORD;   (* a four character code *)
  18185.  
  18186. //function MAKEFOURCC (ch0, ch1, ch2, ch3: Char) : TFourCC;
  18187.  
  18188. type
  18189.   TDMus_DownloadInfor = packed record
  18190.     dwDLType:                DWORD;      (* Instrument or Wave *)
  18191.     dwDLId:                  DWORD;      (* Unique identifier to tag this download. *)
  18192.     dwNumOffsetTableEntries: DWORD;      (* Number of index in the offset address table. *)
  18193.     cbSize:                  DWORD;      (* Total size of this memory chunk. *)
  18194.   end;
  18195.  
  18196. const
  18197.   DMUS_DOWNLOADINFO_INSTRUMENT   = 1;
  18198.   DMUS_DOWNLOADINFO_WAVE         = 2;
  18199.   DMUS_DOWNLOADINFO_INSTRUMENT2  = 3;   (* New version for better DLS2 support. *)
  18200.  
  18201.   DMUS_DEFAULT_SIZE_OFFSETTABLE  = 1;
  18202.  
  18203. (* Flags for DMUS_INSTRUMENT's ulFlags member *)
  18204.  
  18205.   DMUS_INSTRUMENT_GM_INSTRUMENT  = 1 shl 0;
  18206.  
  18207. type
  18208.   TDMus_OffsetTable = packed record
  18209.     ulOffsetTable : array [0..DMUS_DEFAULT_SIZE_OFFSETTABLE-1] of ULONG;
  18210.   end;
  18211.  
  18212.   TDMus_Instrument = packed record
  18213.     ulPatch:          ULONG;
  18214.     ulFirstRegionIdx: ULONG;
  18215.     ulGlobalArtIdx:   ULONG;                 (* If zero the instrument does not have an articulation *)
  18216.     ulFirstExtCkIdx:  ULONG;                 (* If zero no 3rd party entenstion chunks associated with the instrument *)
  18217.     ulCopyrightIdx:   ULONG;                 (* If zero no Copyright information associated with the instrument *)
  18218.     ulFlags:          ULONG;
  18219.   end;
  18220.  
  18221.   TDMus_Region = packed record
  18222.     RangeKey:         TRGNRange;
  18223.     RangeVelocity:    TRGNRange;
  18224.     fusOptions:       Word;
  18225.     usKeyGroup:       Word;
  18226.     ulRegionArtIdx:   ULONG;                 (* If zero the region does not have an articulation *)
  18227.     ulNextRegionIdx:  ULONG;                 (* If zero no more regions *)
  18228.     ulFirstExtCkIdx:  ULONG;                 (* If zero no 3rd party entenstion chunks associated with the region *)
  18229.     WaveLink:         TWaveLink;
  18230.     WSMP:             TWSMPL;                (*  If WSMP.cSampleLoops > 1 then a WLOOP is included *)
  18231.     WLOOP:            array [0..0] of TWLoop;
  18232.   end;
  18233.  
  18234.   TDMus_LFOParams = packed record
  18235.     pcFrequency:   TPCent;
  18236.     tcDelay:       TTCent;
  18237.     gcVolumeScale: TGCent;
  18238.     pcPitchScale:  TPCent;
  18239.     gcMWToVolume:  TGCent;
  18240.     pcMWToPitch:   TPCent;
  18241.   end;
  18242.  
  18243.   TDMus_VEGParams = packed record
  18244.     tcAttack:      TTCent;
  18245.     tcDecay:       TTCent;
  18246.     ptSustain:     TPercent;
  18247.     tcRelease:     TTCent;
  18248.     tcVel2Attack:  TTCent;
  18249.     tcKey2Decay:   TTCent;
  18250.   end;
  18251.  
  18252.   TDMus_PEGParams = packed record
  18253.     tcAttack:      TTCent;
  18254.     tcDecay:       TTCent;
  18255.     ptSustain:     TPercent;
  18256.     tcRelease:     TTCent;
  18257.     tcVel2Attack:  TTCent;
  18258.     tcKey2Decay:   TTCent;
  18259.     pcRange:       TPCent;
  18260.   end;
  18261.  
  18262.   TDMus_MSCParams = packed record
  18263.     ptDefaultPan: TPercent;
  18264.   end;
  18265.  
  18266.   TDMus_ArticParams = packed record
  18267.     LFO:      TDMus_LFOParams;
  18268.     VolEG:    TDMus_VEGParams;
  18269.     PitchEG:  TDMus_PEGParams;
  18270.     Misc:     TDMus_MSCParams;
  18271.   end;
  18272.  
  18273.   TDMus_Articulation = packed record
  18274.     ulArt1Idx:       ULONG;                  (* If zero no DLS Level 1 articulation chunk *)
  18275.     ulFirstExtCkIdx: ULONG;                  (* If zero no 3rd party entenstion chunks associated with the articulation *)
  18276.   end;
  18277.  
  18278. const
  18279.   DMUS_MIN_DATA_SIZE = 4;
  18280.  
  18281. (*  The actual number is determined by cbSize of struct _DMUS_EXTENSIONCHUNK *)
  18282.  
  18283. type
  18284.   DMus_ExtensionChunk = packed record
  18285.     cbSize:                      ULONG;           (*  Size of extension chunk  *)
  18286.     ulNextExtCkIdx:              ULONG;           (*  If zero no more 3rd party entenstion chunks *)
  18287.     ExtCkID:                     TFourCC;
  18288.     byExtCk: array [0..DMUS_MIN_DATA_SIZE-1] of BYTE;  (*  The actual number that follows is determined by cbSize *)
  18289.   end;
  18290.  
  18291. (*  The actual number is determined by cbSize of struct _DMUS_COPYRIGHT *)
  18292.  
  18293.   TDmus_Copyright = packed record
  18294.     cbSize:                          ULONG;              (*  Size of copyright information *)
  18295.     byCopyright: array [0..DMUS_MIN_DATA_SIZE-1] of BYTE;               (*  The actual number that follows is determined by cbSize *)
  18296.   end;
  18297.  
  18298.   TDMus_WaveData = packed record
  18299.     cbSize:                     ULONG;          
  18300.     byData: array [0..DMUS_MIN_DATA_SIZE-1] of BYTE;
  18301.   end;
  18302.  
  18303.   TDMus_Wave = packed record
  18304.     ulFirstExtCkIdx: ULONG;              (* If zero no 3rd party entenstion chunks associated with the wave *)
  18305.     ulCopyrightIdx:  ULONG;              (* If zero no Copyright information associated with the wave *)
  18306.     ulWaveDataIdx:   ULONG;              (* Location of actual wave data. *)
  18307. ///    WaveformatEx:    TWaveFormatEx;
  18308.   end;
  18309.  
  18310.   PDMus_NoteRange = ^TDMus_NoteRange;
  18311.   TDMus_NoteRange = packed record
  18312.     dwLowNote:  DWORD;           (* Sets the low note for the range of MIDI note events to which the instrument responds.*)
  18313.     dwHighNote: DWORD;           (* Sets the high note for the range of MIDI note events to which the instrument responds.*)
  18314.   end;
  18315.  
  18316. (************************************************************************
  18317. *                                                                       *
  18318. *   dmerror.h -- Error code returned by DirectMusic API's               *
  18319. *                                                                       *
  18320. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  18321. *                                                                       *
  18322. ************************************************************************)
  18323.  
  18324. const
  18325.   FACILITY_DIRECTMUSIC      = $878;       (* Shared with DirectSound *)
  18326.   DMUS_ERRBASE              = $1000;      (* Make error codes human readable in hex *)
  18327.  
  18328.   MAKE_DMHRESULTSUCCESS = (0 shl 31) or (FACILITY_DIRECTMUSIC shl 16) or DMUS_ERRBASE;
  18329.   MAKE_DMHRESULTERROR =   (1 shl 31) or (FACILITY_DIRECTMUSIC shl 16) or DMUS_ERRBASE;
  18330.  
  18331.  
  18332. (* DMUS_S_PARTIALLOAD
  18333.  *
  18334.  * The object could only load partially. This can happen if some components are
  18335.  * not registered properly, such as embedded tracks and tools.
  18336.  *)
  18337.   DMUS_S_PARTIALLOAD               = MAKE_DMHRESULTSUCCESS + $091;
  18338.  
  18339. (* DMUS_S_PARTIALDOWNLOAD
  18340.  *
  18341.  * This code indicates that a band download was only successful in reaching
  18342.  * some, but not all, of the referenced ports. Some samples may not play
  18343.  * correctly.
  18344.  *)
  18345.   DMUS_S_PARTIALDOWNLOAD          = MAKE_DMHRESULTSUCCESS + $092;
  18346.  
  18347. (* DMUS_S_REQUEUE
  18348.  *
  18349.  * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the
  18350.  * performance that it should cue the PMsg again automatically.
  18351.  *)
  18352.   DMUS_S_REQUEUE                   = MAKE_DMHRESULTSUCCESS + $200;
  18353.  
  18354. (* DMUS_S_FREE
  18355.  *
  18356.  * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the
  18357.  * performance that it should free the PMsg automatically.
  18358.  *)
  18359.   DMUS_S_FREE                      = MAKE_DMHRESULTSUCCESS + $201;
  18360.  
  18361. (* DMUS_S_END
  18362.  *
  18363.  * Return value from IDirectMusicTrack::Play() which indicates to the
  18364.  * segment that the track has no more data after mtEnd.
  18365.  *)
  18366.   DMUS_S_END                       = MAKE_DMHRESULTSUCCESS + $202;
  18367.  
  18368. (* DMUS_S_STRING_TRUNCATED
  18369.  *
  18370.  * Returned string has been truncated to fit the buffer size.
  18371.  *)
  18372.   DMUS_S_STRING_TRUNCATED          = MAKE_DMHRESULTSUCCESS + $210;
  18373.  
  18374. (* DMUS_S_LAST_TOOL
  18375.  *
  18376.  * Returned from IDirectMusicGraph::StampPMsg(), this indicates that the PMsg
  18377.  * is already stamped with the last tool in the graph. The returned PMsg's
  18378.  * tool pointer is now NULL.
  18379.  *)
  18380.   DMUS_S_LAST_TOOL                 = MAKE_DMHRESULTSUCCESS + $211;
  18381.  
  18382. (* DMUS_S_OVER_CHORD
  18383.  *
  18384.  * Returned from IDirectMusicPerformance::MusicToMIDI(), this indicates
  18385.  * that no note has been calculated because the music value has the note
  18386.  * at a position higher than the top note of the chord. This applies only
  18387.  * to DMUS_PLAYMODE_NORMALCHORD play mode. This success code indicates
  18388.  * that the caller should not do anything with the note. It is not meant
  18389.  * to be played against this chord.
  18390.  *)
  18391.   DMUS_S_OVER_CHORD                = MAKE_DMHRESULTSUCCESS + $212;
  18392.  
  18393. (* DMUS_S_UP_OCTAVE
  18394.  *
  18395.  * Returned from IDirectMusicPerformance::MIDIToMusic(),  and
  18396.  * IDirectMusicPerformance::MusicToMIDI(), this indicates
  18397.  * that the note conversion generated a note value that is below 0,
  18398.  * so it has been bumped up one or more octaves to be in the proper
  18399.  * MIDI range of 0 through 127.
  18400.  * Note that this is valid for MIDIToMusic() when using play modes
  18401.  * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of
  18402.  * which store MIDI values in wMusicValue. With MusicToMIDI(), it is
  18403.  * valid for all play modes.
  18404.  * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code.
  18405.  *)
  18406.   DMUS_S_UP_OCTAVE                 = MAKE_DMHRESULTSUCCESS + $213;
  18407.  
  18408. (* DMUS_S_DOWN_OCTAVE
  18409.  *
  18410.  * Returned from IDirectMusicPerformance::MIDIToMusic(),  and
  18411.  * IDirectMusicPerformance::MusicToMIDI(), this indicates
  18412.  * that the note conversion generated a note value that is above 127,
  18413.  * so it has been bumped down one or more octaves to be in the proper
  18414.  * MIDI range of 0 through 127.
  18415.  * Note that this is valid for MIDIToMusic() when using play modes
  18416.  * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of
  18417.  * which store MIDI values in wMusicValue. With MusicToMIDI(), it is
  18418.  * valid for all play modes.
  18419.  * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code.
  18420.  *)
  18421.   DMUS_S_DOWN_OCTAVE               = MAKE_DMHRESULTSUCCESS + $214;
  18422.  
  18423. (* DMUS_S_NOBUFFERCONTROL
  18424.  *
  18425.  * Although the audio output from the port will be routed to the
  18426.  * same device as the given DirectSound buffer, buffer controls
  18427.  * such as pan and volume will not affect the output.
  18428.  *
  18429.  *)
  18430.   DMUS_S_NOBUFFERCONTROL          = MAKE_DMHRESULTSUCCESS + $215;
  18431.  
  18432. (* DMUS_E_DRIVER_FAILED
  18433.  *
  18434.  * An unexpected error was returned from a device driver, indicating
  18435.  * possible failure of the driver or hardware.
  18436.  *)
  18437.   DMUS_E_DRIVER_FAILED            = MAKE_DMHRESULTERROR + $0101;
  18438.  
  18439. (* DMUS_E_PORTS_OPEN
  18440.  *
  18441.  * The requested operation cannot be performed while there are
  18442.  * instantiated ports in any process in the system.
  18443.  *)
  18444.   DMUS_E_PORTS_OPEN               = MAKE_DMHRESULTERROR + $0102;
  18445.  
  18446. (* DMUS_E_DEVICE_IN_USE
  18447.  *
  18448.  * The requested device is already in use (possibly by a non-DirectMusic
  18449.  * client) and cannot be opened again.
  18450.  *)
  18451.   DMUS_E_DEVICE_IN_USE            = MAKE_DMHRESULTERROR + $0103;
  18452.  
  18453. (* DMUS_E_INSUFFICIENTBUFFER
  18454.  *
  18455.  * Buffer is not large enough for requested operation.
  18456.  *)
  18457.   DMUS_E_INSUFFICIENTBUFFER       = MAKE_DMHRESULTERROR + $0104;
  18458.  
  18459. (* DMUS_E_BUFFERNOTSET
  18460.  *
  18461.  * No buffer was prepared for the download data.
  18462.  *)
  18463.   DMUS_E_BUFFERNOTSET             = MAKE_DMHRESULTERROR + $0105;
  18464.  
  18465. (* DMUS_E_BUFFERNOTAVAILABLE
  18466.  *
  18467.  * Download failed due to inability to access or create download buffer.
  18468.  *)
  18469.   DMUS_E_BUFFERNOTAVAILABLE       = MAKE_DMHRESULTERROR + $0106;
  18470.  
  18471. (* DMUS_E_NOTADLSCOL
  18472.  *
  18473.  * Error parsing DLS collection. File is corrupt.
  18474.  *)
  18475.   DMUS_E_NOTADLSCOL               = MAKE_DMHRESULTERROR + $0108;
  18476.  
  18477. (* DMUS_E_INVALIDOFFSET
  18478.  *
  18479.  * Wave chunks in DLS collection file are at incorrect offsets.
  18480.  *)
  18481.   DMUS_E_INVALIDOFFSET            = MAKE_DMHRESULTERROR + $0109;
  18482.  
  18483. (* DMUS_E_ALREADY_LOADED
  18484.  *
  18485.  * Second attempt to load a DLS collection that is currently open.
  18486.  *)
  18487.   DMUS_E_ALREADY_LOADED           = MAKE_DMHRESULTERROR + $0111;
  18488.  
  18489. (* DMUS_E_INVALIDPOS
  18490.  *
  18491.  * Error reading wave data from DLS collection. Indicates bad file.
  18492.  *)
  18493.   DMUS_E_INVALIDPOS               = MAKE_DMHRESULTERROR + $0113;
  18494.  
  18495. (* DMUS_E_INVALIDPATCH
  18496.  *
  18497.  * There is no instrument in the collection that matches patch number.
  18498.  *)
  18499.   DMUS_E_INVALIDPATCH             = MAKE_DMHRESULTERROR + $0114;
  18500.  
  18501. (* DMUS_E_CANNOTSEEK
  18502.  *
  18503.  * The IStream* doesn't support Seek().
  18504.  *)
  18505.   DMUS_E_CANNOTSEEK               = MAKE_DMHRESULTERROR + $0115;
  18506.  
  18507. (* DMUS_E_CANNOTWRITE
  18508.  *
  18509.  * The IStream* doesn't support Write().
  18510.  *)
  18511.   DMUS_E_CANNOTWRITE              = MAKE_DMHRESULTERROR + $0116;
  18512.  
  18513. (* DMUS_E_CHUNKNOTFOUND
  18514.  *
  18515.  * The RIFF parser doesn't contain a required chunk while parsing file.
  18516.  *)
  18517.   DMUS_E_CHUNKNOTFOUND            = MAKE_DMHRESULTERROR + $0117;
  18518.  
  18519. (* DMUS_E_INVALID_DOWNLOADID
  18520.  *
  18521.  * Invalid download id was used in the process of creating a download buffer.
  18522.  *)
  18523.   DMUS_E_INVALID_DOWNLOADID       = MAKE_DMHRESULTERROR + $0119;
  18524.  
  18525. (* DMUS_E_NOT_DOWNLOADED_TO_PORT
  18526.  *
  18527.  * Tried to unload an object that was not downloaded or previously unloaded.
  18528.  *)
  18529.   DMUS_E_NOT_DOWNLOADED_TO_PORT   = MAKE_DMHRESULTERROR + $0120;
  18530.  
  18531. (* DMUS_E_ALREADY_DOWNLOADED
  18532.  *
  18533.  * Buffer was already downloaded to synth.
  18534.  *)
  18535.   DMUS_E_ALREADY_DOWNLOADED       = MAKE_DMHRESULTERROR + $0121;
  18536.  
  18537. (* DMUS_E_UNKNOWN_PROPERTY
  18538.  *
  18539.  * The specified property item was not recognized by the target object.
  18540.  *)
  18541.   DMUS_E_UNKNOWN_PROPERTY         = MAKE_DMHRESULTERROR + $0122;
  18542.  
  18543. (* DMUS_E_SET_UNSUPPORTED
  18544.  *
  18545.  * The specified property item may not be set on the target object.
  18546.  *)
  18547.   DMUS_E_SET_UNSUPPORTED          = MAKE_DMHRESULTERROR + $0123;
  18548.  
  18549. (* DMUS_E_GET_UNSUPPORTED
  18550.  *
  18551.  * The specified property item may not be retrieved from the target object.
  18552.  *)
  18553.   DMUS_E_GET_UNSUPPORTED          = MAKE_DMHRESULTERROR + $0124;
  18554.  
  18555. (* DMUS_E_NOTMONO
  18556.  *
  18557.  * Wave chunk has more than one interleaved channel. DLS format requires MONO.
  18558.  *)
  18559.   DMUS_E_NOTMONO                  = MAKE_DMHRESULTERROR + $0125;
  18560.  
  18561. (* DMUS_E_BADARTICULATION
  18562.  *
  18563.  * Invalid articulation chunk in DLS collection.
  18564.  *)
  18565.   DMUS_E_BADARTICULATION          = MAKE_DMHRESULTERROR + $0126;
  18566.  
  18567. (* DMUS_E_BADINSTRUMENT
  18568.  *
  18569.  * Invalid instrument chunk in DLS collection.
  18570.  *)
  18571.   DMUS_E_BADINSTRUMENT            = MAKE_DMHRESULTERROR + $0127;
  18572.  
  18573. (* DMUS_E_BADWAVELINK
  18574.  *
  18575.  * Wavelink chunk in DLS collection points to invalid wave.
  18576.  *)
  18577.   DMUS_E_BADWAVELINK              = MAKE_DMHRESULTERROR + $0128;
  18578.  
  18579. (* DMUS_E_NOARTICULATION
  18580.  *
  18581.  * Articulation missing from instrument in DLS collection.
  18582.  *)
  18583.   DMUS_E_NOARTICULATION           = MAKE_DMHRESULTERROR + $0129;
  18584.  
  18585. (* DMUS_E_NOTPCM
  18586.  *
  18587.  * Downoaded DLS wave is not in PCM format.
  18588. *)
  18589.   DMUS_E_NOTPCM                   = MAKE_DMHRESULTERROR + $012A;
  18590.  
  18591. (* DMUS_E_BADWAVE
  18592.  *
  18593.  * Bad wave chunk in DLS collection
  18594.  *)
  18595.   DMUS_E_BADWAVE                  = MAKE_DMHRESULTERROR + $012B;
  18596.  
  18597. (* DMUS_E_BADOFFSETTABLE
  18598.  *
  18599.  * Offset Table for download buffer has errors.
  18600.  *)
  18601.   DMUS_E_BADOFFSETTABLE           = MAKE_DMHRESULTERROR + $012C;
  18602.  
  18603. (* DMUS_E_UNKNOWNDOWNLOAD
  18604.  *
  18605.  * Attempted to download unknown data type.
  18606.  *)
  18607.   DMUS_E_UNKNOWNDOWNLOAD          = MAKE_DMHRESULTERROR + $012D;
  18608.  
  18609. (* DMUS_E_NOSYNTHSINK
  18610.  *
  18611.  * The operation could not be completed because no sink was connected to
  18612.  * the synthesizer.
  18613.  *)
  18614.   DMUS_E_NOSYNTHSINK              = MAKE_DMHRESULTERROR + $012E;
  18615.  
  18616. (* DMUS_E_ALREADYOPEN
  18617.  *
  18618.  * An attempt was made to open the software synthesizer while it was already
  18619.  * open.
  18620.  * ASSERT?
  18621.  *)
  18622.   DMUS_E_ALREADYOPEN              = MAKE_DMHRESULTERROR + $012F;
  18623.  
  18624. (* DMUS_E_ALREADYCLOSE
  18625.  *
  18626.  * An attempt was made to close the software synthesizer while it was already
  18627.  * open.
  18628.  * ASSERT?
  18629.  *)
  18630.   DMUS_E_ALREADYCLOSED            = MAKE_DMHRESULTERROR + $0130;
  18631.  
  18632. (* DMUS_E_SYNTHNOTCONFIGURED
  18633.  *
  18634.  * The operation could not be completed because the software synth has not
  18635.  * yet been fully configured.
  18636.  * ASSERT?
  18637.  *)
  18638.   DMUS_E_SYNTHNOTCONFIGURED       = MAKE_DMHRESULTERROR + $0131;
  18639.  
  18640. (* DMUS_E_SYNTHACTIVE
  18641.  *
  18642.  * The operation cannot be carried out while the synthesizer is active.
  18643.  *)
  18644.   DMUS_E_SYNTHACTIVE              = MAKE_DMHRESULTERROR + $0132;
  18645.  
  18646. (* DMUS_E_CANNOTREAD
  18647.  *
  18648.  * An error occurred while attempting to read from the IStream* object.
  18649.  *)
  18650.   DMUS_E_CANNOTREAD               = MAKE_DMHRESULTERROR + $0133;
  18651.  
  18652. (* DMUS_E_DMUSIC_RELEASED
  18653.  *
  18654.  * The operation cannot be performed because the final instance of the
  18655.  * DirectMusic object was released. Ports cannot be used after final
  18656.  * release of the DirectMusic object.
  18657.  *)
  18658.   DMUS_E_DMUSIC_RELEASED          = MAKE_DMHRESULTERROR + $0134;
  18659.  
  18660. (* DMUS_E_BUFFER_EMPTY
  18661.  *
  18662.  * There was no data in the referenced buffer.
  18663.  *)
  18664.   DMUS_E_BUFFER_EMPTY             = MAKE_DMHRESULTERROR + $0135;
  18665.  
  18666. (* DMUS_E_BUFFER_FULL
  18667.  *
  18668.  * There is insufficient space to insert the given event into the buffer.
  18669.  *)
  18670.   DMUS_E_BUFFER_FULL              = MAKE_DMHRESULTERROR + $0136;
  18671.  
  18672. (* DMUS_E_PORT_NOT_CAPTURE
  18673.  *
  18674.  * The given operation could not be carried out because the port is a
  18675.  * capture port.
  18676.  *)
  18677.   DMUS_E_PORT_NOT_CAPTURE         = MAKE_DMHRESULTERROR + $0137;
  18678.  
  18679. (* DMUS_E_PORT_NOT_RENDER
  18680.  *
  18681.  * The given operation could not be carried out because the port is a
  18682.  * render port.
  18683.  *)
  18684.   DMUS_E_PORT_NOT_RENDER          = MAKE_DMHRESULTERROR + $0138;
  18685.  
  18686. (* DMUS_E_DSOUND_NOT_SET
  18687.  *
  18688.  * The port could not be created because no DirectSound has been specified.
  18689.  * Specify a DirectSound interface via the IDirectMusic::SetDirectSound
  18690.  * method; pass NULL to have DirectMusic manage usage of DirectSound.
  18691.  *)
  18692.   DMUS_E_DSOUND_NOT_SET           = MAKE_DMHRESULTERROR + $0139;
  18693.  
  18694. (* DMUS_E_ALREADY_ACTIVATED
  18695.  *
  18696.  * The operation cannot be carried out while the port is active.
  18697.  *)
  18698.   DMUS_E_ALREADY_ACTIVATED        = MAKE_DMHRESULTERROR + $013A;
  18699.  
  18700. (* DMUS_E_INVALIDBUFFER
  18701.  *
  18702.  * Invalid DirectSound buffer was handed to port.
  18703.  *)
  18704.   DMUS_E_INVALIDBUFFER            = MAKE_DMHRESULTERROR + $013B;
  18705.  
  18706. (* DMUS_E_WAVEFORMATNOTSUPPORTED
  18707.  *
  18708.  * Invalid buffer format was handed to the synth sink.
  18709.  *)
  18710.   DMUS_E_WAVEFORMATNOTSUPPORTED   = MAKE_DMHRESULTERROR + $013C;
  18711.  
  18712. (* DMUS_E_SYNTHINACTIVE
  18713.  *
  18714.  * The operation cannot be carried out while the synthesizer is inactive.
  18715.  *)
  18716.   DMUS_E_SYNTHINACTIVE            = MAKE_DMHRESULTERROR + $013D;
  18717.  
  18718. (* DMUS_E_DSOUND_ALREADY_SET
  18719.  *
  18720.  * IDirectMusic::SetDirectSound has already been called. It may not be
  18721.  * changed while in use.
  18722.  *)
  18723.   DMUS_E_DSOUND_ALREADY_SET       = MAKE_DMHRESULTERROR + $013E;
  18724.  
  18725. (* DMUS_E_INVALID_EVENT
  18726.  *
  18727.  * The given event is invalid (either it is not a valid MIDI message
  18728.  * or it makes use of running status). The event cannot be packed
  18729.  * into the buffer.
  18730.  *)
  18731.   DMUS_E_INVALID_EVENT            = MAKE_DMHRESULTERROR + $013F;
  18732.  
  18733. (* DMUS_E_UNSUPPORTED_STREAM
  18734.  *
  18735.  * The IStream* object does not contain data supported by the loading object.
  18736.  *)
  18737.   DMUS_E_UNSUPPORTED_STREAM       = MAKE_DMHRESULTERROR + $0150;
  18738.  
  18739. (* DMUS_E_ALREADY_INITED
  18740.  *
  18741.  * The object has already been initialized.
  18742.  *)
  18743.   DMUS_E_ALREADY_INITED           = MAKE_DMHRESULTERROR + $0151;
  18744.  
  18745. (* DMUS_E_INVALID_BAND
  18746.  *
  18747.  * The file does not contain a valid band.
  18748.  *)
  18749.   DMUS_E_INVALID_BAND             = MAKE_DMHRESULTERROR + $0152;
  18750.  
  18751. (* DMUS_E_TRACK_HDR_NOT_FIRST_CK
  18752.  *
  18753.  * The IStream* object's data does not have a track header as the first chunk,
  18754.  * and therefore can not be read by the segment object.
  18755.  *)
  18756.   DMUS_E_TRACK_HDR_NOT_FIRST_CK   = MAKE_DMHRESULTERROR + $0155;
  18757.  
  18758. (* DMUS_E_TOOL_HDR_NOT_FIRST_CK
  18759.  *
  18760.  * The IStream* object's data does not have a tool header as the first chunk,
  18761.  * and therefore can not be read by the graph object.
  18762.  *)
  18763.   DMUS_E_TOOL_HDR_NOT_FIRST_CK    = MAKE_DMHRESULTERROR + $0156;
  18764.  
  18765. (* DMUS_E_INVALID_TRACK_HDR
  18766.  *
  18767.  * The IStream* object's data contains an invalid track header (ckid is 0 and
  18768.  * fccType is NULL,) and therefore can not be read by the segment object.
  18769.  *)
  18770.   DMUS_E_INVALID_TRACK_HDR        = MAKE_DMHRESULTERROR + $0157;
  18771.  
  18772. (* DMUS_E_INVALID_TOOL_HDR
  18773.  *
  18774.  * The IStream* object's data contains an invalid tool header (ckid is 0 and
  18775.  * fccType is NULL,) and therefore can not be read by the graph object.
  18776.  *)
  18777.   DMUS_E_INVALID_TOOL_HDR         = MAKE_DMHRESULTERROR + $0158;
  18778.  
  18779. (* DMUS_E_ALL_TOOLS_FAILED
  18780.  *
  18781.  * The graph object was unable to load all tools from the IStream* object data.
  18782.  * This may be due to errors in the stream, or the tools being incorrectly
  18783.  * registered on the client.
  18784.  *)
  18785.   DMUS_E_ALL_TOOLS_FAILED         = MAKE_DMHRESULTERROR + $0159;
  18786.  
  18787. (* DMUS_E_ALL_TRACKS_FAILED
  18788.  *
  18789.  * The segment object was unable to load all tracks from the IStream* object data.
  18790.  * This may be due to errors in the stream, or the tracks being incorrectly
  18791.  * registered on the client.
  18792.  *)
  18793.   DMUS_E_ALL_TRACKS_FAILED        = MAKE_DMHRESULTERROR + $0160;
  18794.  
  18795. (* DMUS_E_NOT_FOUND
  18796.  *
  18797.  * The requested item was not contained by the object.
  18798.  *)
  18799.   DMUS_E_NOT_FOUND                = MAKE_DMHRESULTERROR + $0161;
  18800.  
  18801. (* DMUS_E_NOT_INIT
  18802.  *
  18803.  * A required object is not initialized or failed to initialize.
  18804.  *)
  18805.   DMUS_E_NOT_INIT                 = MAKE_DMHRESULTERROR + $0162;
  18806.  
  18807. (* DMUS_E_TYPE_DISABLED
  18808.  *
  18809.  * The requested parameter type is currently disabled. Parameter types may
  18810.  * be enabled and disabled by certain calls to SetParam().
  18811.  *)
  18812.   DMUS_E_TYPE_DISABLED            = MAKE_DMHRESULTERROR + $0163;
  18813.  
  18814. (* DMUS_E_TYPE_UNSUPPORTED
  18815.  *
  18816.  * The requested parameter type is not supported on the object.
  18817.  *)
  18818.   DMUS_E_TYPE_UNSUPPORTED         = MAKE_DMHRESULTERROR + $0164;
  18819.  
  18820. (* DMUS_E_TIME_PAST
  18821.  *
  18822.  * The time is in the past, and the operation can not succeed.
  18823.  *)
  18824.   DMUS_E_TIME_PAST                = MAKE_DMHRESULTERROR + $0165;
  18825.  
  18826. (* DMUS_E_TRACK_NOT_FOUND
  18827.  *
  18828.  * The requested track is not contained by the segment.
  18829.  *)
  18830.   DMUS_E_TRACK_NOT_FOUND        = MAKE_DMHRESULTERROR + $0166;
  18831.  
  18832. (* DMUS_E_NO_MASTER_CLOCK
  18833.  *
  18834.  * There is no master clock in the performance. Be sure to call
  18835.  * IDirectMusicPerformance::Init().
  18836.  *)
  18837.   DMUS_E_NO_MASTER_CLOCK          = MAKE_DMHRESULTERROR + $0170;
  18838.  
  18839. (* DMUS_E_LOADER_NOCLASSID
  18840.  *
  18841.  * The class id field is required and missing in the DMUS_OBJECTDESC.
  18842.  *)
  18843.   DMUS_E_LOADER_NOCLASSID         = MAKE_DMHRESULTERROR + $0180;
  18844.  
  18845. (* DMUS_E_LOADER_BADPATH
  18846.  *
  18847.  * The requested file path is invalid.
  18848.  *)
  18849.   DMUS_E_LOADER_BADPATH           = MAKE_DMHRESULTERROR + $0181;
  18850.  
  18851. (* DMUS_E_LOADER_FAILEDOPEN
  18852.  *
  18853.  * File open failed - either file doesn't exist or is locked.
  18854.  *)
  18855.   DMUS_E_LOADER_FAILEDOPEN        = MAKE_DMHRESULTERROR + $0182;
  18856.  
  18857. (* DMUS_E_LOADER_FORMATNOTSUPPORTED
  18858.  *
  18859.  * Search data type is not supported.
  18860.  *)
  18861.   DMUS_E_LOADER_FORMATNOTSUPPORTED    = MAKE_DMHRESULTERROR + $0183;
  18862.  
  18863. (* DMUS_E_LOADER_FAILEDCREATE
  18864.  *
  18865.  * Unable to find or create object.
  18866.  *)
  18867.   DMUS_E_LOADER_FAILEDCREATE      = MAKE_DMHRESULTERROR + $0184;
  18868.  
  18869. (* DMUS_E_LOADER_OBJECTNOTFOUND
  18870.  *
  18871.  * Object was not found.
  18872.  *)
  18873.   DMUS_E_LOADER_OBJECTNOTFOUND    = MAKE_DMHRESULTERROR + $0185;
  18874.  
  18875. (* DMUS_E_LOADER_NOFILENAME
  18876.  *
  18877.  * The file name is missing from the DMUS_OBJECTDESC.
  18878.  *)
  18879.   DMUS_E_LOADER_NOFILENAME          = MAKE_DMHRESULTERROR + $0186;
  18880.  
  18881. (* DMUS_E_INVALIDFILE
  18882.  *
  18883.  * The file requested is not a valid file.
  18884.  *)
  18885.   DMUS_E_INVALIDFILE              = MAKE_DMHRESULTERROR + $0200;
  18886.  
  18887. (* DMUS_E_ALREADY_EXISTS
  18888.  *
  18889.  * The tool is already contained in the graph. Create a new instance.
  18890.  *)
  18891.   DMUS_E_ALREADY_EXISTS           = MAKE_DMHRESULTERROR + $0201;
  18892.  
  18893. (* DMUS_E_OUT_OF_RANGE
  18894.  *
  18895.  * Value is out of range, for instance the requested length is longer than
  18896.  * the segment.
  18897.  *)
  18898.   DMUS_E_OUT_OF_RANGE             = MAKE_DMHRESULTERROR + $0202;
  18899.  
  18900. (* DMUS_E_SEGMENT_INIT_FAILED
  18901.  *
  18902.  * Segment initialization failed, most likely due to a critical memory situation.
  18903.  *)
  18904.   DMUS_E_SEGMENT_INIT_FAILED      = MAKE_DMHRESULTERROR + $0203;
  18905.  
  18906. (* DMUS_E_ALREADY_SENT
  18907.  *
  18908.  * The DMUS_PMSG has already been sent to the performance object via
  18909.  * IDirectMusicPerformance::SendPMsg().
  18910.  *)
  18911.   DMUS_E_ALREADY_SENT             = MAKE_DMHRESULTERROR + $0204;
  18912.  
  18913. (* DMUS_E_CANNOT_FREE
  18914.  *
  18915.  * The DMUS_PMSG was either not allocated by the performance via
  18916.  * IDirectMusicPerformance::AllocPMsg(), or it was already freed via
  18917.  * IDirectMusicPerformance::FreePMsg().
  18918.  *)
  18919.   DMUS_E_CANNOT_FREE              = MAKE_DMHRESULTERROR + $0205;
  18920.  
  18921. (* DMUS_E_CANNOT_OPEN_PORT
  18922.  *
  18923.  * The default system port could not be opened.
  18924.  *)
  18925.   DMUS_E_CANNOT_OPEN_PORT         = MAKE_DMHRESULTERROR + $0206;
  18926.  
  18927. (* DMUS_E_CONNOT_CONVERT
  18928.  *
  18929.  * A call to MIDIToMusic() or MusicToMIDI() resulted in an error because
  18930.  * the requested conversion could not happen. This usually occurs when the
  18931.  * provided DMUS_CHORD_KEY structure has an invalid chord or scale pattern.
  18932.  *)
  18933.   DMUS_E_CONNOT_CONVERT           = MAKE_DMHRESULTERROR + $0207;
  18934.  
  18935. (* DMUS_E_DESCEND_CHUNK_FAIL
  18936.  *
  18937.  * DMUS_E_DESCEND_CHUNK_FAIL is returned when the end of the file
  18938.  * was reached before the desired chunk was found.
  18939.  *)
  18940.   DMUS_E_DESCEND_CHUNK_FAIL       = MAKE_DMHRESULTERROR + $0210;
  18941.  
  18942.  
  18943. (************************************************************************
  18944. *                                                                       *
  18945. *   dmksctrl.h -- Definition of IKsControl                              *
  18946. *                                                                       *
  18947. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  18948. *                                                                       *
  18949. *                                                                       *
  18950. *   This header file contains the definition of IKsControl, which       *
  18951. *   duplicates definitions from ks.h and ksproxy.h. Your code should    *
  18952. *   include ks.h and ksproxy.h directly if you have them (they are      *
  18953. *   provided in the Windows 98 DDK and will be in the Windows NT 5      *
  18954. *   SDK).                                                               *
  18955. *                                                                       *
  18956. ************************************************************************)
  18957.  
  18958. (*
  18959.  * Warning: This will prevent the rest of ks.h from being pulled in if ks.h is
  18960.  * included after dmksctrl.h. Make sure you do not include both headers in
  18961.  * the same source file.
  18962.  *)
  18963.  
  18964. type
  18965.   PKsIdentifier = ^TKsIdentifier;
  18966.   TKsIdentifier = packed record
  18967.     case integer of
  18968.       1 : (
  18969.              Set_: TGUID;
  18970.              Id : ULONG;
  18971.              Flags: ULONG
  18972.           );
  18973.       2 : (Alignment: LONGLONG);
  18974.   end;
  18975.  
  18976.   PKsProperty = ^TKsProperty;
  18977.   TKsProperty = TKsIdentifier;
  18978.  
  18979.   PKsMethod = ^TKsMethod;
  18980.   TKsMethod = TKsIdentifier;
  18981.  
  18982.   PKsEvent = ^TKsEvent;
  18983.   TKsEvent = TKsIdentifier;
  18984.  
  18985. const
  18986.   KSMETHOD_TYPE_NONE                  = $00000000;
  18987.   KSMETHOD_TYPE_READ                  = $00000001;
  18988.   KSMETHOD_TYPE_WRITE                 = $00000002;
  18989.   KSMETHOD_TYPE_MODIFY                = $00000003;
  18990.   KSMETHOD_TYPE_SOURCE                = $00000004;
  18991.  
  18992.   KSMETHOD_TYPE_SEND                  = $00000001;
  18993.   KSMETHOD_TYPE_SETSUPPORT            = $00000100;
  18994.   KSMETHOD_TYPE_BASICSUPPORT          = $00000200;
  18995.  
  18996.   KSPROPERTY_TYPE_GET                 = $00000001;
  18997.   KSPROPERTY_TYPE_SET                 = $00000002;
  18998.   KSPROPERTY_TYPE_SETSUPPORT          = $00000100;
  18999.   KSPROPERTY_TYPE_BASICSUPPORT        = $00000200;
  19000.   KSPROPERTY_TYPE_RELATIONS           = $00000400;
  19001.   KSPROPERTY_TYPE_SERIALIZESET        = $00000800;
  19002.   KSPROPERTY_TYPE_UNSERIALIZESET      = $00001000;
  19003.   KSPROPERTY_TYPE_SERIALIZERAW        = $00002000;
  19004.   KSPROPERTY_TYPE_UNSERIALIZERAW      = $00004000;
  19005.   KSPROPERTY_TYPE_SERIALIZESIZE       = $00008000;
  19006.   KSPROPERTY_TYPE_DEFAULTVALUES       = $00010000;
  19007.  
  19008.   KSPROPERTY_TYPE_TOPOLOGY            = $10000000;
  19009.  
  19010. type
  19011.   IKsControl = interface (IUnknown)
  19012.     ['{28F54685-06FD-11D2-B27A-00A0C9223196}']
  19013.     function KsProperty (const pProperty: TKsProperty; PropertyLength: ULONG;
  19014.         var PropertyData; DataLength: ULONG; out BytesReturned: ULONG) : HResult; stdcall;
  19015.     function KsMethod(const Method: TKsMethod; MethodLength: ULONG;
  19016.         var MethodData; DataLength: ULONG; out BytesReturned: ULONG) : HResult; stdcall;
  19017.     function KsEvent (const Event: TKsEvent; EventLength: ULONG;
  19018.         var EventData; DataLength: ULONG; out BytesReturned: ULONG) : HResult; stdcall;
  19019.   end;
  19020.  
  19021. type
  19022.   IID_IKsControl = IKsControl;
  19023.   STATIC_IID_IKsControl = IID_IKsControl;
  19024.  
  19025.  
  19026. const
  19027. (* These formats are in ksmedia.h
  19028.  *)
  19029.   KSDATAFORMAT_SUBTYPE_MIDI : TGUID = '{1D262760-E957-11CF-A5D6-28DB04C10000}';
  19030.  
  19031.   KSDATAFORMAT_SUBTYPE_DIRECTMUSIC : TGUID = '{1a82f8bc-3f8b-11d2-b774-0060083316c1}';
  19032.  
  19033. (************************************************************************
  19034. *                                                                       *
  19035. *   dmusicc.h -- This module defines the DirectMusic core API's         *
  19036. *                                                                       *
  19037. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  19038. *                                                                       *
  19039. ************************************************************************)
  19040.  
  19041. const
  19042.   DMUS_MAX_DESCRIPTION = 128;
  19043.   DMUS_MAX_DRIVER = 128;
  19044.  
  19045. type
  19046.   PDMus_BufferDesc = ^TDMus_BufferDesc;
  19047.   TDMus_BufferDesc = packed record
  19048.     dwSize,
  19049.     dwFlags : DWORD;
  19050.     guidBufferFormat : TGUID;
  19051.     cbBuffer : DWORD;
  19052.   end;
  19053.  
  19054. const
  19055. (* DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS
  19056.  * and DMUS_PORTPARAMS.
  19057.  *)
  19058.   DMUS_EFFECT_NONE             = $00000000;
  19059.   DMUS_EFFECT_REVERB           = $00000001;
  19060.   DMUS_EFFECT_CHORUS           = $00000002;
  19061.  
  19062. (* For DMUS_PORTCAPS dwClass
  19063.  *)
  19064.   DMUS_PC_INPUTCLASS        = 0;
  19065.   DMUS_PC_OUTPUTCLASS       = 1;
  19066.  
  19067. (* For DMUS_PORTCAPS dwFlags
  19068.  *)
  19069.   DMUS_PC_DLS              = $00000001;
  19070.   DMUS_PC_EXTERNAL         = $00000002;
  19071.   DMUS_PC_SOFTWARESYNTH    = $00000004;
  19072.   DMUS_PC_MEMORYSIZEFIXED  = $00000008;
  19073.   DMUS_PC_GMINHARDWARE     = $00000010;
  19074.   DMUS_PC_GSINHARDWARE     = $00000020;
  19075.   DMUS_PC_XGINHARDWARE     = $00000040;
  19076.   DMUS_PC_DIRECTSOUND      = $00000080;
  19077.   DMUS_PC_SHAREABLE        = $00000100;
  19078.   DMUS_PC_DLS2             = $00000200;
  19079.   DMUS_PC_SYSTEMMEMORY     = $7FFFFFFF;
  19080.  
  19081. type
  19082.   PDMus_PortCaps = ^TDMus_PortCaps;
  19083.   TDMus_PortCaps = packed record
  19084.     dwSize:              DWORD;
  19085.     dwFlags:             DWORD;
  19086.     guidPort:            TGUID;
  19087.     dwClass:             DWORD;
  19088.     dwType:              DWORD;
  19089.     dwMemorySize:        DWORD;
  19090.     dwMaxChannelGroups:  DWORD;
  19091.     dwMaxVoices:         DWORD;
  19092.     dwMaxAudioChannels:  DWORD;
  19093.     dwEffectFlags:       DWORD;
  19094.     wszDescription:      array [0..DMUS_MAX_DESCRIPTION-1] of WideChar;
  19095.   end;
  19096.  
  19097. const
  19098. (* Values for DMUS_PORTCAPS dwType. This field indicates the underlying
  19099.  * driver type of the port.
  19100.  *)
  19101.   DMUS_PORT_WINMM_DRIVER      = 0;
  19102.   DMUS_PORT_USER_MODE_SYNTH   = 1;
  19103.   DMUS_PORT_KERNEL_MODE       = 2;
  19104.  
  19105. (* These flags (set in dwValidParams) indicate which other members of the *)
  19106. (* DMUS_PORTPARAMS are valid. *)
  19107. (* *)
  19108.   DMUS_PORTPARAMS_VOICES           = $00000001;
  19109.   DMUS_PORTPARAMS_CHANNELGROUPS    = $00000002;
  19110.   DMUS_PORTPARAMS_AUDIOCHANNELS    = $00000004;
  19111.   DMUS_PORTPARAMS_SAMPLERATE       = $00000008;
  19112.   DMUS_PORTPARAMS_EFFECTS          = $00000020;
  19113.   DMUS_PORTPARAMS_SHARE            = $00000040;
  19114.  
  19115. type
  19116.   PDMus_PortParams = ^TDMus_PortParams;
  19117.   TDMus_PortParams = packed record
  19118.     dwSize:          DWORD;
  19119.     dwValidParams:   DWORD;
  19120.     dwVoices:        DWORD;
  19121.     dwChannelGroups: DWORD;
  19122.     dwAudioChannels: DWORD;
  19123.     dwSampleRate:    DWORD;
  19124.     dwEffectFlags:   DWORD;
  19125.     fShare:          BOOL;
  19126.   end;
  19127.  
  19128.   PDMus_SynthStats = ^TDMus_SynthStats;
  19129.   TDMus_SynthStats = packed record
  19130.     dwSize:        DWORD;        (* Size in bytes of the structure *)
  19131.     dwValidStats:  DWORD;        (* Flags indicating which fields below are valid. *)
  19132.     dwVoices:      DWORD;        (* Average number of voices playing. *)
  19133.     dwTotalCPU:    DWORD;        (* Total CPU usage as percent * 100. *)
  19134.     dwCPUPerVoice: DWORD;        (* CPU per voice as percent * 100. *)
  19135.     dwLostNotes:   DWORD;        (* Number of notes lost in 1 second. *)
  19136.     dwFreeMemory:  DWORD;        (* Free memory in bytes *)
  19137.     lPeakVolume:   LongInt;      (* Decibel level * 100. *)
  19138.   end;
  19139.  
  19140. const
  19141.   DMUS_SYNTHSTATS_VOICES          = 1 shl 0;
  19142.   DMUS_SYNTHSTATS_TOTAL_CPU       = 1 shl 1;
  19143.   DMUS_SYNTHSTATS_CPU_PER_VOICE   = 1 shl 2;
  19144.   DMUS_SYNTHSTATS_LOST_NOTES      = 1 shl 3;
  19145.   DMUS_SYNTHSTATS_PEAK_VOLUME     = 1 shl 4;
  19146.   DMUS_SYNTHSTATS_FREE_MEMORY     = 1 shl 5;
  19147.  
  19148.   DMUS_SYNTHSTATS_SYSTEMMEMORY   = DMUS_PC_SYSTEMMEMORY;
  19149.  
  19150. type
  19151.   TDMus_Waves_Reverb_Params = packed record
  19152.     fInGain,        (* Input gain in dB (to avoid output overflows) *)
  19153.     fReverbMix,     (* Reverb mix in dB. 0dB means 100% wet reverb (no direct signal)
  19154.                     Negative values gives less wet signal.
  19155.                     The coeficients are calculated so that the overall output level stays
  19156.                     (approximately) constant regardless of the ammount of reverb mix. *)
  19157.     fReverbTime,    (* The reverb decay time, in milliseconds. *)
  19158.     fHighFreqRTRatio : Single; (* The ratio of the high frequencies to the global reverb time.
  19159.                     Unless very 'splashy-bright' reverbs are wanted, this should be set to
  19160.                     a value < 1.0.
  19161.                     For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the
  19162.                     decay time for high frequencies will be 100ms.*)
  19163.  
  19164.   end;
  19165.  
  19166.  
  19167. (*  Note: Default values for Reverb are:
  19168.     fInGain             = 0.0dB   (no change in level)
  19169.     fReverbMix          = -10.0dB   (a reasonable reverb mix)
  19170.     fReverbTime         = 1000.0ms (one second global reverb time)
  19171.     fHighFreqRTRatio    = 0.001    (the ratio of the high frequencies to the global reverb time)
  19172. *)
  19173.  
  19174.   TDMus_ClockType = (
  19175.     DMUS_CLOCK_SYSTEM,
  19176.     DMUS_CLOCK_WAVE
  19177.   );
  19178.  
  19179.   PDMus_ClockInfo = ^TDMus_ClockInfo;
  19180.   TDMus_ClockInfo = packed record
  19181.     dwSize : WORD;
  19182.     ctType : TDMus_ClockType;
  19183.     guidClock : TGUID;          (* Identifies this time source *)
  19184.     wszDescription : array [0..DMUS_MAX_DESCRIPTION-1] of WideChar;
  19185.   end;
  19186.  
  19187. const
  19188.   DMUS_EVENT_STRUCTURED   = $00000001;  (* Unstructured data (SysEx, etc.) *)
  19189.  
  19190. (* Standard values for voice priorities. Numerically higher priorities are higher in priority.
  19191.  * These priorities are used to set the voice priority for all voices on a channel. They are
  19192.  * used in the dwPriority parameter of IDirectMusicPort::GetPriority and returned in the
  19193.  * lpwPriority parameter of pdwPriority.
  19194.  *
  19195.  * These priorities are shared with DirectSound.
  19196.  *)
  19197.  
  19198. const
  19199.   DAUD_CRITICAL_VOICE_PRIORITY    = $F0000000;
  19200.   DAUD_HIGH_VOICE_PRIORITY        = $C0000000;
  19201.   DAUD_STANDARD_VOICE_PRIORITY    = $80000000;
  19202.   DAUD_LOW_VOICE_PRIORITY         = $40000000;
  19203.   DAUD_PERSIST_VOICE_PRIORITY     = $10000000;
  19204.  
  19205. (* These are the default priorities assigned if not overridden. By default priorities are
  19206.  * equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as
  19207.  * channel 5 on channel group 2;.
  19208.  *
  19209.  * In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16
  19210.  * except for 10.
  19211.  *)
  19212.   DAUD_CHAN1_VOICE_PRIORITY_OFFSET    = $0000000E;
  19213.   DAUD_CHAN2_VOICE_PRIORITY_OFFSET    = $0000000D;
  19214.   DAUD_CHAN3_VOICE_PRIORITY_OFFSET    = $0000000C;
  19215.   DAUD_CHAN4_VOICE_PRIORITY_OFFSET    = $0000000B;
  19216.   DAUD_CHAN5_VOICE_PRIORITY_OFFSET    = $0000000A;
  19217.   DAUD_CHAN6_VOICE_PRIORITY_OFFSET    = $00000009;
  19218.   DAUD_CHAN7_VOICE_PRIORITY_OFFSET    = $00000008;
  19219.   DAUD_CHAN8_VOICE_PRIORITY_OFFSET    = $00000007;
  19220.   DAUD_CHAN9_VOICE_PRIORITY_OFFSET    = $00000006;
  19221.   DAUD_CHAN10_VOICE_PRIORITY_OFFSET   = $0000000F;
  19222.   DAUD_CHAN11_VOICE_PRIORITY_OFFSET   = $00000005;
  19223.   DAUD_CHAN12_VOICE_PRIORITY_OFFSET   = $00000004;
  19224.   DAUD_CHAN13_VOICE_PRIORITY_OFFSET   = $00000003;
  19225.   DAUD_CHAN14_VOICE_PRIORITY_OFFSET   = $00000002;
  19226.   DAUD_CHAN15_VOICE_PRIORITY_OFFSET   = $00000001;
  19227.   DAUD_CHAN16_VOICE_PRIORITY_OFFSET   = $00000000;
  19228.  
  19229.  
  19230.   DAUD_CHAN1_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN1_VOICE_PRIORITY_OFFSET);
  19231.   DAUD_CHAN2_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN2_VOICE_PRIORITY_OFFSET);
  19232.   DAUD_CHAN3_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN3_VOICE_PRIORITY_OFFSET);
  19233.   DAUD_CHAN4_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN4_VOICE_PRIORITY_OFFSET);
  19234.   DAUD_CHAN5_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN5_VOICE_PRIORITY_OFFSET);
  19235.   DAUD_CHAN6_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN6_VOICE_PRIORITY_OFFSET);
  19236.   DAUD_CHAN7_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN7_VOICE_PRIORITY_OFFSET);
  19237.   DAUD_CHAN8_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN8_VOICE_PRIORITY_OFFSET);
  19238.   DAUD_CHAN9_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN9_VOICE_PRIORITY_OFFSET);
  19239.   DAUD_CHAN10_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN10_VOICE_PRIORITY_OFFSET);
  19240.   DAUD_CHAN11_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN11_VOICE_PRIORITY_OFFSET);
  19241.   DAUD_CHAN12_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN12_VOICE_PRIORITY_OFFSET);
  19242.   DAUD_CHAN13_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN13_VOICE_PRIORITY_OFFSET);
  19243.   DAUD_CHAN14_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN14_VOICE_PRIORITY_OFFSET);
  19244.   DAUD_CHAN15_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN15_VOICE_PRIORITY_OFFSET);
  19245.   DAUD_CHAN16_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN16_VOICE_PRIORITY_OFFSET);
  19246.  
  19247. type
  19248.   IDirectMusicBuffer = interface;
  19249.   IDirectMusicPort = interface;
  19250.   IDirectMusicThru = interface;
  19251.   IReferenceClock = interface;
  19252.   PIReferenceClock = IReferenceClock;
  19253.  
  19254.   IDirectMusic = interface (IUnknown)
  19255.     ['{6536115a-7b2d-11d2-ba18-0000f875ac12}']
  19256.     function EnumPort (dwIndex: DWORD;
  19257.                        var pPortCaps: TDMus_PortCaps) : HResult; stdcall;
  19258.     function CreateMusicBuffer (var pBufferDesc: TDMus_BufferDesc;
  19259.                                 out ppBuffer: IDirectMusicBuffer;
  19260.                                 pUnkOuter: IUnknown) : HResult; stdcall;
  19261.     function CreatePort (const rclsidPort: TGUID;
  19262.                          const pPortParams: TDMus_PortParams;
  19263.                          out ppPort: IDirectMusicPort;
  19264.                          pUnkOuter: IUnknown) : HResult; stdcall;
  19265.     function EnumMasterClock (dwIndex: DWORD;
  19266.                               var lpClockInfo: TDMus_ClockInfo) : HResult; stdcall;
  19267.     function GetMasterClock (pguidClock: PGUID;
  19268.                              ppReferenceClock : PIReferenceClock) : HResult; stdcall;
  19269.     function SetMasterClock (const rguidClock: TGUID) : HResult; stdcall;
  19270.     function Activate (fEnable: BOOL) : HResult; stdcall;
  19271.     function GetDefaultPort (out pguidPort: TGUID) : HResult; stdcall;
  19272.     function SetDirectSound (pDirectSound: IDirectSound;
  19273.                              hWnd: HWND) : HResult; stdcall;
  19274.  
  19275.   end;
  19276.  
  19277.   IDirectMusicBuffer = interface (IUnknown)
  19278.     ['{d2ac2878-b39b-11d1-8704-00600893b1bd}']
  19279.     function Flush : HResult; stdcall;
  19280.     function TotalTime (out prtTime: TReference_Time) : HResult; stdcall;
  19281.     function PackStructured (const rt: TReference_Time;
  19282.                              dwChannelGroup: DWORD;
  19283.                              dwChannelMessage: DWORD ) : HResult; stdcall;
  19284.     function PackUnstructured (const rt: TReference_Time;
  19285.                                dwChannelGroup: DWORD;
  19286.                                cb: DWORD;
  19287.                                const lpb) : HResult; stdcall;
  19288.     function ResetReadPtr : HResult; stdcall;
  19289.     function GetNextEvent (out prt: TReference_Time;
  19290.                            out pdwChannelGroup: DWORD;
  19291.                            out pdwLength: DWORD;
  19292.                            out ppData: Pointer) : HResult; stdcall;
  19293.  
  19294.     function GetRawBufferPtr (out ppData: Pointer) : HResult; stdcall;
  19295.     function GetStartTime (out prt: TReference_Time) : HResult; stdcall;
  19296.     function GetUsedBytes (out pcb: DWORD) : HResult; stdcall;
  19297.     function GetMaxBytes (out pcb: DWORD) : HResult; stdcall;
  19298.     function GetBufferFormat (out pGuidFormat: TGUID) : HResult; stdcall;
  19299.     function SetStartTime (const rt: TReference_Time) : HResult; stdcall;
  19300.     function SetUsedBytes (cb: DWORD) : HResult; stdcall;
  19301.   end;
  19302.  
  19303.  
  19304. (* Format of DirectMusic events in a buffer
  19305.  *
  19306.  * A buffer contains 1 or more events, each with the following header.
  19307.  * Immediately following the header is the event data. The header+data
  19308.  * size is rounded to the nearest quadword (8 bytes).
  19309.  *)
  19310.  
  19311.   TDMus_EventHeader = packed record
  19312.     cbEvent:        DWORD;                   (* Unrounded bytes in event *)
  19313.     dwChannelGroup: DWORD;                   (* Channel group of event *)
  19314.     rtDelta:        TReference_Time;         (* Delta from start time of entire buffer *)
  19315.     dwFlags:        DWORD;                   (* Flags DMUS_EVENT_xxx *)
  19316.   end;
  19317.  
  19318.   IDirectMusicInstrument = interface (IUnknown)
  19319.     ['{d2ac287d-b39b-11d1-8704-00600893b1bd}']
  19320.     function GetPatch (out pdwPatch: DWORD ) : HResult; stdcall;
  19321.     function SetPatch (dwPatch: DWORD) : HResult; stdcall;
  19322.   end;
  19323.  
  19324.   IDirectMusicDownloadedInstrument = interface (IUnknown)
  19325.     ['{d2ac287e-b39b-11d1-8704-00600893b1bd}']
  19326.     (* None at this time *)
  19327.   end;
  19328.  
  19329.   IDirectMusicCollection = interface (IUnknown)
  19330.     ['{d2ac287c-b39b-11d1-8704-00600893b1bd}']
  19331.     function GetInstrument (dwPatch: DWORD;
  19332.                             out ppInstrument: IDirectMusicInstrument) : HResult; stdcall;
  19333.     function EnumInstrument (dwIndex: DWORD;
  19334.                              out pdwPatch: DWORD;
  19335.                              pwszName: LPWSTR;
  19336.                              dwNameLen: DWORD) : HResult; stdcall;
  19337.   end;
  19338.  
  19339.  
  19340.   IDirectMusicDownload = interface (IUnknown)
  19341.     ['{d2ac287b-b39b-11d1-8704-00600893b1bd}']
  19342.     function GetBuffer (out ppvBuffer: Pointer;
  19343.                         out pdwSize: DWORD) : HResult; stdcall;
  19344.   end;
  19345.  
  19346.   IDirectMusicPortDownload = interface (IUnknown)
  19347.     ['{d2ac287a-b39b-11d1-8704-00600893b1bd}']
  19348.     function GetBuffer (dwDLId: DWORD;
  19349.                         out ppIDMDownload: IDirectMusicDownload) : HResult; stdcall;
  19350.     function AllocateBuffer (dwSize: DWORD;
  19351.                              out ppIDMDownload: IDirectMusicDownload) : HResult; stdcall;
  19352.     function GetDLId (out pdwStartDLId: DWORD;
  19353.                       dwCount: DWORD) : HResult; stdcall;
  19354.     function GetAppend (out pdwAppend: DWORD) : HResult; stdcall;
  19355.     function Download (pIDMDownload: IDirectMusicDownload) : HResult; stdcall;
  19356.     function Unload(pIDMDownload: IDirectMusicDownload) : HResult; stdcall;
  19357.   end;
  19358.  
  19359.   IDirectMusicPort = interface (IUnknown)
  19360.     ['{08f2d8c9-37c2-11d2-b9f9-0000f875ac12}']
  19361.     function PlayBuffer (pBuffer: IDirectMusicBuffer) : HResult; stdcall;
  19362.     function SetReadNotificationHandle (hEvent: THANDLE) : HResult; stdcall;
  19363.     function Read (pBuffer: IDirectMusicBuffer) : HResult; stdcall;
  19364.     function DownloadInstrument (pInstrument: IDirectMusicInstrument;
  19365.                                  out ppDownloadedInstrument: IDirectMusicDownloadedInstrument;
  19366.                                  pNoteRanges: PDMus_NoteRange;
  19367.                                  dwNumNoteRanges: DWORD) : HResult; stdcall;
  19368.     function UnloadInstrument (pDownloadedInstrument: IDirectMusicDownloadedInstrument) : HResult; stdcall;
  19369.     function GetLatencyClock (out ppClock: IReferenceClock) : HResult; stdcall;
  19370.     function GetRunningStats (var pStats: TDMus_SynthStats) : HResult; stdcall;
  19371.     function Compact : HResult; stdcall;
  19372.     function GetCaps (var pPortCaps: TDMus_PortCaps) : HResult; stdcall;
  19373.     function DeviceIoControl (dwIoControlCode: DWORD;
  19374.                               const lpInBuffer;
  19375.                               nInBufferSize: DWORD;
  19376.                               out lpOutBuffer;
  19377.                               nOutBufferSize: DWORD;
  19378.                               out lpBytesReturned: DWORD;
  19379.                               var lpOverlapped: TOVERLAPPED) : HResult; stdcall;
  19380.     function SetNumChannelGroups (dwChannelGroups: DWORD) : HResult; stdcall;
  19381.     function GetNumChannelGroups (out pdwChannelGroups: DWORD) : HResult; stdcall;
  19382.     function Activate (fActive: BOOL) : HResult; stdcall;
  19383.     function SetChannelPriority (dwChannelGroup, dwChannel,
  19384.                                  dwPriority: DWORD) : HResult; stdcall;
  19385.     function GetChannelPriority (dwChannelGroup, dwChannel: DWORD;
  19386.                                  out pdwPriority: DWORD) : HResult; stdcall;
  19387.     function SetDirectSound (pDirectSound: IDirectSound;
  19388.                              pDirectSoundBuffer: IDirectSoundBuffer) : HResult; stdcall;
  19389.     function GetFormat (pWaveFormatEx: PWaveFormatEx;
  19390.                         var pdwWaveFormatExSize: DWORD;
  19391.                         out pdwBufferSize: DWORD) : HResult; stdcall;
  19392. end;
  19393.  
  19394.   IDirectMusicThru = interface (IUnknown)
  19395.     ['{ced153e7-3606-11d2-b9f9-0000f875ac12}']
  19396.     function ThruChannel (dwSourceChannelGroup,
  19397.                           dwSourceChannel,
  19398.                           dwDestinationChannelGroup,
  19399.                           dwDestinationChannel: DWORD;
  19400.                           pDestinationPort: IDirectMusicPort) : HResult; stdcall;
  19401.   end;
  19402.  
  19403.  
  19404.   IReferenceClock = interface (IUnknown)
  19405.     ['{56a86897-0ad4-11ce-b03a-0020af0ba770}']
  19406.     (*  get the time now *)
  19407.     function GetTime (out pTime: TReference_Time) : HResult; stdcall;
  19408.  
  19409.     (*  ask for an async notification that a time has elapsed *)
  19410.     function AdviseTime (const baseTime,                  (*  base time *)
  19411.                          streamTime: TReference_Time;     (*  stream offset time *)
  19412.                          hEvent: THANDLE;                 (*  advise via this event *)
  19413.                          var pdwAdviseCookie: DWORD) : HResult; stdcall;   (*  where your cookie goes *)
  19414.  
  19415.     (*  ask for an async periodic notification that a time has elapsed *)
  19416.     function AdvisePeriodic (const startTime,                  (*  starting at this time *)
  19417.                              periodTime: TReference_Time;      (*  time between notifications *)
  19418.                              hSemaphore: THANDLE;              (*  advise via a semaphore *)
  19419.                              var pdwAdviseCookie: DWORD) : HResult; stdcall;   (*  where your cookie goes *)
  19420.  
  19421.     (*  cancel a request for notification *)
  19422.     function Unadvise (dwAdviseCookie: DWORD) : HResult; stdcall;
  19423.   end;
  19424.  
  19425. type
  19426.   IID_IDirectMusic = IDirectMusic;
  19427.   IID_IDirectMusicBuffer = IDirectMusicBuffer;
  19428.   IID_IDirectMusicPort = IDirectMusicPort;
  19429.   IID_IDirectMusicThru = IDirectMusicThru;
  19430.   IID_IDirectMusicPortDownload = IDirectMusicPortDownload;
  19431.   IID_IDirectMusicDownload = IDirectMusicDownload;
  19432.   IID_IDirectMusicCollection = IDirectMusicCollection;
  19433.   IID_IDirectMusicInstrument = IDirectMusicInstrument;
  19434.   IID_IDirectMusicDownloadedInstrument = IDirectMusicDownloadedInstrument;
  19435.   IID_IReferenceClock = IReferenceClock;
  19436.  
  19437. const
  19438.   CLSID_DirectMusic: TGUID = '{636b9f10-0c7d-11d1-95b2-0020afdc7421}';
  19439.  
  19440.   CLSID_DirectMusicCollection: TGUID = '{480ff4b0-28b2-11d1-bef7-00c04fbf8fef}';
  19441.   CLSID_DirectMusicSynth: TGUID = '{58C2B4D0-46E7-11D1-89AC-00A0C9054129}';
  19442.  
  19443. (* Property Query GUID_DMUS_PROP_GM_Hardware - Local GM set, no need to download
  19444.  * Property Query GUID_DMUS_PROP_GS_Hardware - Local GS set, no need to download
  19445.  * Property Query GUID_DMUS_PROP_XG_Hardware - Local XG set, no need to download
  19446.  * Property Query GUID_DMUS_PROP_DLS1        - Support DLS level 1
  19447.  * Property Query GUID_DMUS_PROP_XG_Capable  - Support minimum requirements of XG
  19448.  * Property Query GUID_DMUS_PROP_GS_Capable  - Support minimum requirements of GS
  19449.  * Property Query GUID_DMUS_PROP_SynthSink_DSOUND - Synthsink talks to DSound
  19450.  * Property Query GUID_DMUS_PROP_SynthSink_WAVE - Synthsink talks to Wave device
  19451.  *
  19452.  * Item 0: Supported
  19453.  * Returns a DWORD which is non-zero if the feature is supported
  19454.  *)
  19455.   GUID_DMUS_PROP_GM_Hardware: TGUID = '{178f2f24-c364-11d1-a760-0000f875ac12}';
  19456.   GUID_DMUS_PROP_GS_Hardware: TGUID = '{178f2f25-c364-11d1-a760-0000f875ac12}';
  19457.   GUID_DMUS_PROP_XG_Hardware: TGUID = '{178f2f26-c364-11d1-a760-0000f875ac12}';
  19458.   GUID_DMUS_PROP_XG_Capable: TGUID = '{6496aba1-61b0-11d2-afa6-00aa0024d8b6}';
  19459.   GUID_DMUS_PROP_GS_Capable: TGUID = '{6496aba2-61b0-11d2-afa6-00aa0024d8b6}';
  19460.   GUID_DMUS_PROP_DLS1: TGUID = '{178f2f27-c364-11d1-a760-0000f875ac12}';
  19461.   GUID_DMUS_PROP_DLS2: TGUID = '{f14599e5-4689-11d2-afa6-00aa0024d8b6}';
  19462.   GUID_DMUS_PROP_INSTRUMENT2: TGUID = '{865fd372-9f67-11d2-872a-00600893b1bd}';
  19463.   GUID_DMUS_PROP_SynthSink_DSOUND: TGUID = '{0aa97844-c877-11d1-870c-00600893b1bd}';
  19464.   GUID_DMUS_PROP_SynthSink_WAVE: TGUID = '{0aa97845-c877-11d1-870c-00600893b1bd}';
  19465.   GUID_DMUS_PROP_SampleMemorySize: TGUID = '{178f2f28-c364-11d1-a760-0000f875ac12}';
  19466.   GUID_DMUS_PROP_SamplePlaybackRate: TGUID = '{2a91f713-a4bf-11d2-bbdf-00600833dbd8}';
  19467.  
  19468. (* Property Get/Set GUID_DMUS_PROP_WriteLatency
  19469.  *
  19470.  * Item 0: Synth buffer write latency, in milliseconds
  19471.  * Get/Set SynthSink latency, the average time after the play head that the next buffer gets written.
  19472.  *)
  19473.   GUID_DMUS_PROP_WriteLatency: TGUID = '{268a0fa0-60f2-11d2-afa6-00aa0024d8b6}';
  19474.  
  19475. (* Property Get/Set GUID_DMUS_PROP_WritePeriod
  19476.  *
  19477.  * Item 0: Synth buffer write period, in milliseconds
  19478.  * Get/Set SynthSink buffer write period, time span between successive writes.
  19479.  *)
  19480.   GUID_DMUS_PROP_WritePeriod: TGUID = '{268a0fa1-60f2-11d2-afa6-00aa0024d8b6}';
  19481.  
  19482. (* Property Get GUID_DMUS_PROP_MemorySize
  19483.  *
  19484.  * Item 0: Memory size
  19485.  * Returns a DWORD containing the total number of bytes of sample RAM
  19486.  *)
  19487.   GUID_DMUS_PROP_MemorySize: TGUID = '{178f2f28-c364-11d1-a760-0000f875ac12}';
  19488.  
  19489. (* Property Set GUID_DMUS_PROP_WavesReverb
  19490.  *
  19491.  * Item 0: DMUS_WAVES_REVERB structure
  19492.  * Sets reverb parameters
  19493.  *)
  19494.   GUID_DMUS_PROP_WavesReverb: TGUID = '{04cb5622-32e5-11d2-afa6-00aa0024d8b6}';
  19495.  
  19496. (* Property Set GUID_DMUS_PROP_Effects
  19497.  *
  19498.  * Item 0: DWORD with effects flags.
  19499.  * Get/Set effects bits, same as dwEffectFlags in DMUS_PORTPARAMS and DMUS_PORTCAPS:
  19500.  * DMUS_EFFECT_NONE
  19501.  * DMUS_EFFECT_REVERB
  19502.  * DMUS_EFFECT_CHORUS
  19503.  *)
  19504.   GUID_DMUS_PROP_Effects: TGUID = '{cda8d611-684a-11d2-871e-00600893b1bd}';
  19505.  
  19506. (* Property Set GUID_DMUS_PROP_LegacyCaps
  19507.  *
  19508.  * Item 0: The MIDINCAPS or MIDIOUTCAPS which describes the port's underlying WinMM device. This property is only supported
  19509.  * by ports which wrap WinMM devices.
  19510.  *)
  19511.  
  19512.   GUID_DMUS_PROP_LegacyCaps: TGUID = '{cfa7cdc2-00a1-11d2-aad5-0000f875ac12}';
  19513.  
  19514. (* Property Set GUID_DMUS_Volume
  19515.  *
  19516.  * Item 0: A long which contains an offset, in 1/100 dB, to be added to the final volume
  19517.  *
  19518.  *)
  19519.   GUID_DMUS_PROP_Volume: TGUID = '{fedfae25-e46e-11d1-aace-0000f875ac12}';
  19520.  
  19521. (* Min and Max values for setting volume with GUID_DMUS_PROP_Volume *)
  19522.  
  19523.   DMUS_VOLUME_MAX =    2000;        (* +20 dB *)
  19524.   DMUS_VOLUME_MIN =  -20000;        (* -200 dB *)
  19525.  
  19526. (************************************************************************
  19527. *                                                                       *
  19528. *   dmusici.h -- This module contains the API for the                   *
  19529. *                DirectMusic performance layer                          *
  19530. *                                                                       *
  19531. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  19532. *                                                                       *
  19533. ************************************************************************)
  19534.  
  19535. type
  19536.   TTransition_Type = WORD;
  19537.   PMusic_Time = ^TMusic_Time;
  19538.   TMusic_Time = LongInt;
  19539.  
  19540. const
  19541.   DMUS_PPQ       = 768;     (* parts per quarter note *)
  19542.  
  19543. type
  19544.   TDMus_CommandT_Types = (
  19545.     DMUS_COMMANDT_GROOVE,
  19546.     DMUS_COMMANDT_FILL  ,
  19547.     DMUS_COMMANDT_INTRO ,
  19548.     DMUS_COMMANDT_BREAK ,
  19549.     DMUS_COMMANDT_END   ,
  19550.     DMUS_COMMANDT_ENDANDINTRO
  19551.   );
  19552.  
  19553.   TDMus_ShapeT_Types = (
  19554.     DMUS_SHAPET_FALLING ,
  19555.     DMUS_SHAPET_LEVEL   ,
  19556.     DMUS_SHAPET_LOOPABLE,
  19557.     DMUS_SHAPET_LOUD    ,
  19558.     DMUS_SHAPET_QUIET   ,
  19559.     DMUS_SHAPET_PEAKING ,
  19560.     DMUS_SHAPET_RANDOM  ,
  19561.     DMUS_SHAPET_RISING  ,
  19562.     DMUS_SHAPET_SONG
  19563.   );
  19564.  
  19565. type
  19566.   TDMus_ComposeF_Flags = DWORD;
  19567. const
  19568.   DMUS_COMPOSEF_NONE              = 0;
  19569.   DMUS_COMPOSEF_ALIGN             = $1;
  19570.   DMUS_COMPOSEF_OVERLAP           = $2;
  19571.   DMUS_COMPOSEF_IMMEDIATE         = $4;
  19572.   DMUS_COMPOSEF_GRID              = $8;
  19573.   DMUS_COMPOSEF_BEAT              = $10;
  19574.   DMUS_COMPOSEF_MEASURE           = $20;
  19575.   DMUS_COMPOSEF_AFTERPREPARETIME  = $40;
  19576.   DMUS_COMPOSEF_MODULATE          = $1000;
  19577.   DMUS_COMPOSEF_LONG              = $2000;
  19578.  
  19579.  
  19580. type
  19581. (* DMUS_PMsgF_FLAGS fill the TDMus_PMsg's dwFlags member *)
  19582.   TDMus_PMsgF_Flags = DWORD;
  19583. const
  19584.   DMUS_PMsgF_REFTIME          = 1;      (* if rtTime is valid *)
  19585.   DMUS_PMsgF_MUSICTIME        = 2;      (* if mtTime is valid *)
  19586.   DMUS_PMsgF_TOOL_IMMEDIATE   = 4;      (* if PMSG should be processed immediately *)
  19587.   DMUS_PMsgF_TOOL_QUEUE       = 8;      (* if PMSG should be processed a little early, at Queue time *)
  19588.   DMUS_PMsgF_TOOL_ATTIME      = 16;     (* if PMSG should be processed at the time stamp *)
  19589.   DMUS_PMsgF_TOOL_FLUSH       = 32;     (* if PMSG is being flushed *)
  19590.   (* The values of DMUS_TIME_RESOLVE_FLAGS may also be used inside the *)
  19591.   (* TDMus_PMsg's dwFlags member. *)
  19592.  
  19593. type
  19594. (* DMUS_PMsgT_TYPES fill the TDMus_PMsg's dwType member *)
  19595.   TDMus_PMsgT_Types = (
  19596.     DMUS_PMsgT_MIDI            ,      (* MIDI short message *)
  19597.     DMUS_PMsgT_NOTE            ,      (* Interactive Music Note *)
  19598.     DMUS_PMsgT_SYSEX           ,      (* MIDI long message (system exclusive message) *)
  19599.     DMUS_PMsgT_NOTIFICATION    ,      (* Notification message *)
  19600.     DMUS_PMsgT_TEMPO           ,      (* Tempo message *)
  19601.     DMUS_PMsgT_CURVE           ,      (* Control change / pitch bend, etc. curve *)
  19602.     DMUS_PMsgT_TIMESIG         ,      (* Time signature *)
  19603.     DMUS_PMsgT_PATCH           ,      (* Patch changes *)
  19604.     DMUS_PMsgT_TRANSPOSE       ,      (* Transposition messages *)
  19605.     DMUS_PMsgT_CHANNEL_PRIORITY,      (* Channel priority *)
  19606.     DMUS_PMsgT_STOP            ,      (* Stop message *)
  19607.     DMUS_PMsgT_DIRTY                  (* Tells Tools that cache GetParam() info to refresh *)
  19608.   );
  19609. const
  19610.   DMUS_PMsgT_USER             = TDMus_PMsgT_Types(255); (* User message *)
  19611.  
  19612. type
  19613. (* DMUS_SEGF_FLAGS correspond to IDirectMusicPerformance::PlaySegment, and other API *)
  19614.   TDMus_SegF_Flags = DWORD;
  19615. const
  19616.   DMUS_SEGF_REFTIME           = 64;     (* time parameter is in reference time  *)
  19617.   DMUS_SEGF_SECONDARY         = 128;    (* secondary segment *)
  19618.   DMUS_SEGF_QUEUE             = 256;    (* queue at the end of the primary segment queue (primary only) *)
  19619.   DMUS_SEGF_CONTROL           = 512;    (* play as a control track (secondary segments only) *)
  19620.   DMUS_SEGF_AFTERPREPARETIME  = 1 shl 10;  (* play after the prepare time (See IDirectMusicPerformance::GetPrepareTime) *)
  19621.   DMUS_SEGF_GRID              = 1 shl 11;  (* play on grid boundary *)
  19622.   DMUS_SEGF_BEAT              = 1 shl 12;  (* play on beat boundary *)
  19623.   DMUS_SEGF_MEASURE           = 1 shl 13;  (* play on measure boundary *)
  19624.   DMUS_SEGF_DEFAULT           = 1 shl 14;  (* use segment's default boundary *)
  19625.   DMUS_SEGF_NOINVALIDATE      = 1 shl 15;  (* play without invalidating the currently playing segment(s) *)
  19626.  
  19627. (* DMUS_TIME_RESOLVE_FLAGS correspond to IDirectMusicPerformance::GetResolvedTime, and can *)
  19628. (* also be used interchangeably with the corresponding DMUS_SEGF_FLAGS, since their values *)
  19629. (* are intentionally the same *)
  19630. type
  19631.   TDMus_Time_Resolve_Flags = DWORD;
  19632. const
  19633.   DMUS_TIME_RESOLVE_AFTERPREPARETIME  = 1 shl 10;  (* resolve to a time after the prepare time *)
  19634.   DMUS_TIME_RESOLVE_GRID              = 1 shl 11;  (* resolve to a time on a grid boundary *)
  19635.   DMUS_TIME_RESOLVE_BEAT              = 1 shl 12;  (* resolve to a time on a beat boundary *)
  19636.   DMUS_TIME_RESOLVE_MEASURE           = 1 shl 13;  (* resolve to a time on a measure boundary *)
  19637.  
  19638. (* The following flags are sent in the IDirectMusicTrack::Play() method *)
  19639. (* inside the dwFlags parameter *)
  19640. type
  19641.   TDMus_TrackF_Flags = DWORD;
  19642. const
  19643.   DMUS_TRACKF_SEEK   = 1;      (* set on a seek *)
  19644.   DMUS_TRACKF_LOOP   = 2;      (* set on a loop (repeat) *)
  19645.   DMUS_TRACKF_START  = 4;      (* set on first call to Play *)
  19646.   DMUS_TRACKF_FLUSH  = 8;      (* set when this call is in response to a flush on the perfomance *)
  19647.   DMUS_TRACKF_DIRTY  = 16;     (* set when the track should consider any cached values from a previous call to GetParam to be invalidated *)
  19648.  
  19649.   DMUS_MAXSUBCHORD = 8;
  19650.  
  19651. type
  19652.   IDirectMusicTrack =                interface;
  19653.   IDirectMusicPerformance =          interface;
  19654.   IDirectMusicSegment =              interface;
  19655.   IDirectMusicSegmentState =         interface;
  19656.   IDirectMusicTool =                 interface;
  19657.   IDirectMusicGraph =                interface;
  19658.  
  19659.  
  19660.   PIDirectMusicSegmentState = ^IDirectMusicSegmentState;
  19661.  
  19662.   TDMus_PMsg_Part = record
  19663.     dwSize:          DWORD;
  19664.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  19665.     mtTime:          TMusic_Time;          (* music time *)
  19666.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  19667.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  19668.                                            (* use this to determine the port/channel. *)
  19669.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  19670.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  19671.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  19672.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  19673.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  19674.                                            (* identify a specific event. For DirectX 6.0, *)
  19675.                                            (* this field should always be 0. *)
  19676.     dwGroupID:       DWORD;                (* Track group id *)
  19677.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  19678.   end;
  19679.  
  19680. (* every TDMus_PMsg is based off of this structure. The Performance needs
  19681.    to access these members consistently in every PMSG that goes through it. *)
  19682.  
  19683.     (* begin DMUS_PMsg_PART *)
  19684.   PDMus_PMsg = ^TDMus_PMsg;  
  19685.   TDMus_PMsg = TDMus_PMsg_Part;
  19686.     (* end DMUS_PMsg_PART *)
  19687.  
  19688. (* DMUS_NOTIFICATION_PMsg *)
  19689.   PDMus_Notification_PMsg = ^TDMus_Notification_PMsg;
  19690.   TDMus_Notification_PMsg = record
  19691.     (* begin DMUS_PMsg_PART *)
  19692.     dwSize:          DWORD;
  19693.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  19694.     mtTime:          TMusic_Time;          (* music time *)
  19695.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  19696.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  19697.                                            (* use this to determine the port/channel. *)
  19698.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  19699.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  19700.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  19701.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  19702.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  19703.                                            (* identify a specific event. For DirectX 6.0, *)
  19704.                                            (* this field should always be 0. *)
  19705.     dwGroupID:       DWORD;                (* Track group id *)
  19706.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  19707.     (* end DMUS_PMsg_PART *)
  19708.  
  19709.     guidNotificationType: TGUID;
  19710.     dwNotificationOption: DWORD;
  19711.     dwField1:             DWORD;
  19712.     dwField2:             DWORD;
  19713.   end;
  19714.  
  19715.   TDMus_SubChord = packed record
  19716.     dwChordPattern:    DWORD;    (* Notes in the subchord *)
  19717.     dwScalePattern:    DWORD;    (* Notes in the scale *)
  19718.     dwInversionPoints: DWORD;    (* Where inversions can occur *)
  19719.     dwLevels:          DWORD;    (* Which levels are supported by this subchord *)
  19720.     bChordRoot:        BYTE;     (* Root of the subchord *)
  19721.     bScaleRoot:        BYTE;     (* Root of the scale *)
  19722.   end;
  19723.  
  19724.   TDMus_Chord_Key = packed record
  19725.     wszName: array [0..15] of WideChar;  (* Name of the chord *)
  19726.     wMeasure:       WORD;                (* Measure this falls on *)
  19727.     bBeat:          BYTE;                (* Beat this falls on *)
  19728.     bSubChordCount: BYTE;                (* Number of chords in the list of subchords *)
  19729.     SubChordList: array [0..DMUS_MAXSUBCHORD-1] of TDMus_SubChord; (* List of sub chords *)
  19730.     dwScale:        DWORD;               (* Scale underlying the entire chord *)
  19731.     bKey:           BYTE;                (* Key underlying the entire chord *)
  19732.   end;
  19733.  
  19734. (* Time Signature structure, used by IDirectMusicStyle *)
  19735. (* Also used as a parameter for GetParam() and SetParam *)
  19736.   TDMus_TimeSignature = packed record
  19737.     mtTime:           TMusic_Time;
  19738.     bBeatsPerMeasure: BYTE;          (* beats per measure (top of time sig) *)
  19739.     bBeat:            BYTE;          (* what note receives the beat (bottom of time sig.) *)
  19740.                                      (* we can assume that 0 means 256th note *)
  19741.     wGridsPerBeat:    WORD;          (* grids per beat *)
  19742.   end;
  19743.  
  19744. (*/////////////////////////////////////////////////////////////////////
  19745. // IDirectMusicSegmentState *)
  19746.   IDirectMusicSegmentState = interface (IUnknown)
  19747.     ['{a3afdcc7-d3ee-11d1-bc8d-00a0c922e6eb}']
  19748.     function GetRepeats (out pdwRepeats: DWORD) : HResult; stdcall;
  19749.     function GetSegment (out ppSegment: IDirectMusicSegment) : HResult; stdcall;
  19750.     function GetStartTime (out pmtStart: TMusic_Time) : HResult; stdcall;
  19751.     function GetSeek (out pmtSeek: TMusic_Time) : HResult; stdcall;
  19752.     function GetStartPoint (out pmtStart: TMusic_Time) : HResult; stdcall;
  19753.   end;
  19754.  
  19755. (*////////////////////////////////////////////////////////////////////
  19756. // IDirectMusicSegment *)
  19757.   IDirectMusicSegment = interface (IUnknown)
  19758.     ['{f96029a2-4282-11d2-8717-00600893b1bd}']
  19759.     function GetLength (out pmtLength: TMusic_Time) : HResult; stdcall;
  19760.     function SetLength (mtLength: TMusic_Time) : HResult; stdcall;
  19761.     function GetRepeats (out pdwRepeats: DWORD) : HResult; stdcall;
  19762.     function SetRepeats (dwRepeats: DWORD) : HResult; stdcall;
  19763.     function GetDefaultResolution (out pdwResolution: DWORD) : HResult; stdcall;
  19764.     function SetDefaultResolution (dwResolution: DWORD) : HResult; stdcall;
  19765.     function GetTrack (const rguidType: TGUID;
  19766.                        dwGroupBits, dwIndex: DWORD;
  19767.                        out ppTrack: IDirectMusicTrack) : HResult; stdcall;
  19768.     function GetTrackGroup (pTrack: IDirectMusicTrack;
  19769.                             out pdwGroupBits: DWORD) : HResult; stdcall;
  19770.     function InsertTrack (pTrack: IDirectMusicTrack;
  19771.                           dwGroupBits: DWORD) : HResult; stdcall;
  19772.     function RemoveTrack (pTrack: IDirectMusicTrack) : HResult; stdcall;
  19773.     function InitPlay (out ppSegState: IDirectMusicSegmentState;
  19774.                        pPerformance: IDirectMusicPerformance;
  19775.                        dwFlags: DWORD) : HResult; stdcall;
  19776.     function GetGraph (out ppGraph: IDirectMusicGraph) : HResult; stdcall;
  19777.     function SetGraph (pGraph: IDirectMusicGraph) : HResult; stdcall;
  19778.     function AddNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
  19779.     function RemoveNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
  19780.     function GetParam (const rguidType: TGUID;
  19781.                        dwGroupBits, dwIndex: DWORD;
  19782.                        mtTime:       TMusic_Time;
  19783.                        out pmtNext:  TMusic_Time;
  19784.                        pParam: Pointer) : HResult; stdcall;
  19785.     function SetParam (const rguidType: TGUID;
  19786.                        dwGroupBits, dwIndex: DWORD;
  19787.                        mtTime: TMusic_Time;
  19788.                        pParam: Pointer) : HResult; stdcall;
  19789.     function Clone (mtStart: TMusic_Time;
  19790.                     mtEnd:   TMusic_Time;
  19791.                     out ppSegment: IDirectMusicSegment) : HResult; stdcall;
  19792.     function SetStartPoint (mtStart: TMusic_Time) : HResult; stdcall;
  19793.     function GetStartPoint (out pmtStart: TMusic_Time) : HResult; stdcall;
  19794.     function SetLoopPoints (mtStart: TMusic_Time;
  19795.                             mtEnd:   TMusic_Time) : HResult; stdcall;
  19796.     function GetLoopPoints (out pmtStart, pmtEnd: TMusic_Time) : HResult; stdcall;
  19797.     function SetPChannelsUsed (dwNumPChannels: DWORD;
  19798.                                var paPChannels: DWORD) : HResult; stdcall;
  19799.   end;
  19800.  
  19801.  
  19802. (*////////////////////////////////////////////////////////////////////
  19803. // IDirectMusicTrack *)
  19804.   IDirectMusicTrack = interface (IUnknown)
  19805.     ['{f96029a1-4282-11d2-8717-00600893b1bd}']
  19806.     function Init (pSegment: IDirectMusicSegment) : HResult; stdcall;
  19807.     function InitPlay (pSegmentState: IDirectMusicSegmentState;
  19808.                        pPerformance:  IDirectMusicPerformance;
  19809.                        out ppStateData: Pointer;
  19810.                        dwVirtualTrackID, dwFlags: DWORD) : HResult; stdcall;
  19811.     function EndPlay (pStateData: Pointer) : HResult; stdcall;
  19812.     function Play    (pStateData: Pointer;
  19813.                       mtStart:    TMusic_Time;
  19814.                       mtEnd:      TMusic_Time;
  19815.                       mtOffset:   TMusic_Time;
  19816.                       dwFlags:    DWORD;
  19817.                       pPerf:      IDirectMusicPerformance;
  19818.                       pSegSt:     IDirectMusicSegmentState;
  19819.                       dwVirtualID:DWORD) : HResult; stdcall;
  19820.     function GetParam (const rguidType: TGUID;
  19821.                        mtTime:      TMusic_Time;
  19822.                        out pmtNext: TMusic_Time;
  19823.                        pParam: Pointer) : HResult; stdcall;
  19824.     function SetParam (const rguidType: TGUID;
  19825.                        mtTime: TMusic_Time;
  19826.                        pParam: Pointer) : HResult; stdcall;
  19827.     function IsParamSupported  (const rguidType: TGUID) : HResult; stdcall;
  19828.     function AddNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
  19829.     function RemoveNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
  19830.     function Clone (mtStart: TMusic_Time;
  19831.                     mtEnd:   TMusic_Time;
  19832.                     out ppTrack: IDirectMusicTrack) : HResult; stdcall;
  19833.   end;
  19834.  
  19835. PIDirectMusic = ^IDirectMusic;
  19836.  
  19837. (*////////////////////////////////////////////////////////////////////
  19838. // IDirectMusicPerformance *)
  19839.   IDirectMusicPerformance = interface (IUnknown)
  19840.     ['{07d43d03-6523-11d2-871d-00600893b1bd}']
  19841.     function Init (ppDirectMusic: PIDirectMusic;
  19842.                    pDirectSound: IDirectSound;
  19843.                    hWnd: HWND ) : HResult; stdcall;
  19844.     function PlaySegment (pSegment: IDirectMusicSegment;
  19845.                           dwFlags: DWORD;
  19846.                           i64StartTime: LongLong;
  19847.                           ppSegmentState: PIDirectMusicSegmentState) : HResult; stdcall;
  19848.     function Stop (pSegment: IDirectMusicSegment;
  19849.                    pSegmentState: IDirectMusicSegmentState;
  19850.                    mtTime: TMusic_Time;
  19851.                    dwFlags: DWORD) : HResult; stdcall;
  19852.     function GetSegmentState (out ppSegmentState: IDirectMusicSegmentState;
  19853.                               mtTime: TMusic_Time) : HResult; stdcall;
  19854.     function SetPrepareTime (dwMilliSeconds: DWORD) : HResult; stdcall;
  19855.     function GetPrepareTime (out pdwMilliSeconds: DWORD) : HResult; stdcall;
  19856.     function SetBumperLength (dwMilliSeconds: DWORD) : HResult; stdcall;
  19857.     function GetBumperLength (out pdwMilliSeconds: DWORD) : HResult; stdcall;
  19858.     function SendPMsg (out pPMSG: TDMus_PMsg) : HResult; stdcall;
  19859.     function MusicToReferenceTime (mtTime: TMusic_Time;
  19860.                                    out prtTime: TReference_Time) : HResult; stdcall;
  19861.     function ReferenceToMusicTime (rtTime: TReference_Time;
  19862.                                    out pmtTime: TMusic_Time) : HResult; stdcall;
  19863.     function IsPlaying (pSegment: IDirectMusicSegment;
  19864.                         pSegState: IDirectMusicSegmentState) : HResult; stdcall;
  19865.     function GetTime (prtNow: PReference_Time;
  19866.                       pmtNow: PMusic_Time) : HResult; stdcall;
  19867.     function AllocPMsg (cb: ULONG;
  19868.                         out ppPMSG: PDMus_PMsg) : HResult; stdcall;
  19869.     function FreePMsg (pPMSG: PDMus_PMsg) : HResult; stdcall;
  19870.     function GetGraph (out ppGraph: IDirectMusicGraph) : HResult; stdcall;
  19871.     function SetGraph (pGraph: IDirectMusicGraph) : HResult; stdcall;
  19872.     function SetNotificationHandle (hNotification: THANDLE;
  19873.                                     rtMinimum: TReference_Time) : HResult; stdcall;
  19874.     function GetNotificationPMsg (out ppNotificationPMsg: PDMus_Notification_PMsg) : HResult; stdcall;
  19875.     function AddNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
  19876.     function RemoveNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
  19877.     function AddPort (pPort: IDirectMusicPort) : HResult; stdcall;
  19878.     function RemovePort (pPort: IDirectMusicPort) : HResult; stdcall;
  19879.     function AssignPChannelBlock (dwBlockNum: DWORD;
  19880.                                   pPort: IDirectMusicPort;
  19881.                                   dwGroup: DWORD) : HResult; stdcall;
  19882.     function AssignPChannel (dwPChannel: DWORD;
  19883.                              pPort: IDirectMusicPort;
  19884.                              dwGroup, dwMChannel: DWORD) : HResult; stdcall;
  19885.     function PChannelInfo (dwPChannel: DWORD;
  19886.                            out ppPort: IDirectMusicPort;
  19887.                            out pdwGroup, pdwMChannel: DWORD ) : HResult; stdcall;
  19888.     function DownloadInstrument (pInst: IDirectMusicInstrument;
  19889.                                  dwPChannel: DWORD;
  19890.                                  out ppDownInst: IDirectMusicDownloadedInstrument;
  19891.                                  var pNoteRanges: TDMus_NoteRange;
  19892.                                  dwNumNoteRanges: DWORD;
  19893.                                  out ppPort: IDirectMusicPort;
  19894.                                  out pdwGroup, pdwMChannel: DWORD) : HResult; stdcall;
  19895.     function Invalidate (mtTime: TMusic_Time;
  19896.                          dwFlags: DWORD) : HResult; stdcall;
  19897.     function GetParam (const rguidType: TGUID;
  19898.                        dwGroupBits, dwIndex: DWORD;
  19899.                        mtTime:      TMusic_Time;
  19900.                        out pmtNext: TMusic_Time;
  19901.                        pParam: Pointer) : HResult; stdcall;
  19902.     function SetParam (const rguidType: TGUID;
  19903.                        dwGroupBits, dwIndex: DWORD;
  19904.                        mtTime: TMusic_Time;
  19905.                        pParam: Pointer) : HResult; stdcall;
  19906.     function GetGlobalParam (const rguidType: TGUID;
  19907.                              pParam: Pointer;
  19908.                              dwSize: DWORD) : HResult; stdcall;
  19909.     function SetGlobalParam (const rguidType: TGUID;
  19910.                              pParam: Pointer;
  19911.                              dwSize: DWORD) : HResult; stdcall;
  19912.     function GetLatencyTime (out prtTime: TReference_Time) : HResult; stdcall;
  19913.     function GetQueueTime (out prtTime: TReference_Time) : HResult; stdcall;
  19914.     function AdjustTime (rtAmount: TReference_Time) : HResult; stdcall;
  19915.     function CloseDown : HResult; stdcall;
  19916.     function GetResolvedTime (rtTime: TReference_Time;
  19917.                               out prtResolved: TReference_Time;
  19918.                               dwTimeResolveFlags: DWORD) : HResult; stdcall;
  19919.     function MIDIToMusic (bMIDIValue: BYTE;
  19920.                           const pChord: TDMus_Chord_Key;
  19921.                           bPlayMode, bChordLevel: Byte;
  19922.                           out pwMusicValue: WORD) : HResult; stdcall;
  19923.     function MusicToMIDI (wMusicValue: WORD;
  19924.                           const pChord: TDMus_Chord_Key;
  19925.                           bPlayMode, bChordLevel: BYTE;
  19926.                           out pbMIDIValue: BYTE) : HResult; stdcall;
  19927.     function TimeToRhythm (mtTime: TMusic_Time;
  19928.                            const pTimeSig: TDMus_TimeSignature;
  19929.                            out pwMeasure: WORD;
  19930.                            out pbBeat, pbGrid: BYTE;
  19931.                            out pnOffset: SmallInt) : HResult; stdcall;
  19932.     function RhythmToTime (wMeasure: WORD;
  19933.                            bBeat, bGrid: BYTE;
  19934.                            nOffset: SmallInt;
  19935.                            const pTimeSig: TDMus_TimeSignature;
  19936.                            out pmtTime: TMusic_Time) : HResult; stdcall;
  19937. end;
  19938.  
  19939. (*////////////////////////////////////////////////////////////////////
  19940. // IDirectMusicTool *)
  19941.   IDirectMusicTool = interface (IUnknown)
  19942.     ['{d2ac28ba-b39b-11d1-8704-00600893b1bd}']
  19943.     function Init (pGraph: IDirectMusicGraph) : HResult; stdcall;
  19944.     function GetMsgDeliveryType (out pdwDeliveryType: DWORD) : HResult; stdcall;
  19945.     function GetMediaTypeArraySize (out pdwNumElements: DWORD) : HResult; stdcall;
  19946.     function GetMediaTypes (out padwMediaTypes: PDWORD;
  19947.                             dwNumElements: DWORD) : HResult; stdcall;
  19948.     function ProcessPMsg (pPerf: IDirectMusicPerformance;
  19949.                           var pPMSG: TDMus_PMsg) : HResult; stdcall;
  19950.     function Flush (pPerf: IDirectMusicPerformance;
  19951.                     const pPMSG: TDMus_PMsg;
  19952.                     rtTime: TReference_Time) : HResult; stdcall;
  19953. end;
  19954.  
  19955. (*////////////////////////////////////////////////////////////////////
  19956. // IDirectMusicGraph *)
  19957.   IDirectMusicGraph = interface (IUnknown)
  19958.     ['{2befc277-5497-11d2-bccb-00a0c922e6eb}']
  19959.     function StampPMsg (var pPMSG: TDMus_PMsg ) : HResult; stdcall;
  19960.     function InsertTool (pTool: IDirectMusicTool;
  19961.                          var pdwPChannels: DWORD;
  19962.                          cPChannels: DWORD;
  19963.                          lIndex: LongInt) : HResult; stdcall;
  19964.     function GetTool (dwIndex: DWORD;
  19965.                       out ppTool: IDirectMusicTool) : HResult; stdcall;
  19966.     function RemoveTool (pTool: IDirectMusicTool) : HResult; stdcall;
  19967.   end;
  19968.  
  19969.  
  19970. (* DMUS_NOTE_PMsg *)
  19971.   TDMus_Note_PMsg = packed record
  19972.     (* begin DMUS_PMsg_PART *)
  19973.     dwSize:          DWORD;
  19974.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  19975.     mtTime:          TMusic_Time;          (* music time *)
  19976.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  19977.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  19978.                                            (* use this to determine the port/channel. *)
  19979.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  19980.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  19981.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  19982.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  19983.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  19984.                                            (* identify a specific event. For DirectX 6.0, *)
  19985.                                            (* this field should always be 0. *)
  19986.     dwGroupID:       DWORD;                (* Track group id *)
  19987.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  19988.     (* end DMUS_PMsg_PART *)
  19989.  
  19990.     mtDuration: TMusic_Time;    (* duration *)
  19991.     wMusicValue:    WORD;       (* Description of note in chord and key. *)
  19992.     wMeasure:       WORD;       (* Measure in which this note occurs *)
  19993.     nOffset:        SmallInt;   (* Offset from grid at which this note occurs *)
  19994.     bBeat:          BYTE;       (* Beat (in measure) at which this note occurs *)
  19995.     bGrid:          BYTE;       (* Grid offset from beat at which this note occurs *)
  19996.     bVelocity:      BYTE;       (* Note velocity *)
  19997.     bFlags:         BYTE;       (* see DMUS_NOTE_FLAGS *)
  19998.     bTimeRange:     BYTE;       (* Range to randomize time. *)
  19999.     bDurRange:      BYTE;       (* Range to randomize duration. *)
  20000.     bVelRange:      BYTE;       (* Range to randomize velocity. *)
  20001.     bPlayModeFlags: BYTE;       (* Play mode *)
  20002.     bSubChordLevel: BYTE;       (* Which subchord level this note uses.  *)
  20003.     bMidiValue:     BYTE;       (* The MIDI note value, converted from wMusicValue *)
  20004.     cTranspose:     char;       (* Transposition to add to midi note value after converted from wMusicValue. *)
  20005.   end;
  20006.  
  20007.   TDMus_NoteF_Flags = DWORD;
  20008. const
  20009.   DMUS_NOTEF_NOTEON = 1;     (* Set if this is a MIDI Note On. Otherwise, it is MIDI Note Off *)
  20010.  
  20011. (* The DMUS_PLAYMODE_FLAGS are used to determine how to convert wMusicValue
  20012.    into the appropriate bMidiValue.
  20013. *)
  20014. type
  20015.   TDMus_PlayMode_Flags = DWORD;
  20016. const
  20017.    DMUS_PLAYMODE_KEY_ROOT          = 1;  (* Transpose on top of the key root. *)
  20018.    DMUS_PLAYMODE_CHORD_ROOT        = 2;  (* Transpose on top of the chord root. *)
  20019.    DMUS_PLAYMODE_SCALE_INTERVALS   = 4;  (* Use scale intervals from scale pattern. *)
  20020.    DMUS_PLAYMODE_CHORD_INTERVALS   = 8;  (* Use chord intervals from chord pattern. *)
  20021.    DMUS_PLAYMODE_NONE              = 16; (* No mode. Indicates the parent part's mode should be used. *)
  20022.  
  20023. (* The following are playback modes that can be created by combining the DMUS_PLAYMODE_FLAGS
  20024.    in various ways:
  20025. *)
  20026.  
  20027. (* Fixed. wMusicValue holds final MIDI note value. This is used for drums, sound effects, and sequenced
  20028.    notes that should not be transposed by the chord or scale.
  20029. *)
  20030.   DMUS_PLAYMODE_FIXED            = 0;
  20031. (* In fixed to key, the musicvalue is again a fixed MIDI value, but it
  20032.    is transposed on top of the key root.
  20033. *)
  20034.   DMUS_PLAYMODE_FIXEDTOKEY       = DMUS_PLAYMODE_KEY_ROOT;
  20035. (* In fixed to chord, the musicvalue is also a fixed MIDI value, but it
  20036.    is transposed on top of the chord root.
  20037. *)
  20038.   DMUS_PLAYMODE_FIXEDTOCHORD     = DMUS_PLAYMODE_CHORD_ROOT;
  20039. (* In Pedalpoint, the key root is used and the notes only track the intervals in
  20040.    the scale. The chord root and intervals are completely ignored. This is useful
  20041.    for melodic lines that play relative to the key root.
  20042. *)
  20043.   DMUS_PLAYMODE_PEDALPOINT       = (DMUS_PLAYMODE_KEY_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS);
  20044. (* In the Melodic mode, the chord root is used but the notes only track the intervals in
  20045.    the scale. The key root and chord intervals are completely ignored. This is useful
  20046.    for melodic lines that play relative to the chord root.
  20047. *)
  20048.   DMUS_PLAYMODE_MELODIC          = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS);
  20049. (* Normal chord mode is the prevalent playback mode.
  20050.    The notes track the intervals in the chord, which is based on the chord root.
  20051.    If there is a scale component to the MusicValue, the additional intervals
  20052.    are pulled from the scale and added.
  20053.    If the chord does not have an interval to match the chord component of
  20054.    the MusicValue, the note is silent.
  20055. *)
  20056.   DMUS_PLAYMODE_NORMALCHORD      = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_CHORD_INTERVALS);
  20057. (* If it is desirable to play a note that is above the top of the chord, the
  20058.    always play mode (known as "purpleized" in a former life) finds a position
  20059.    for the note by using intervals from the scale. Essentially, this mode is
  20060.    a combination of the Normal and Melodic playback modes, where a failure
  20061.    in Normal causes a second try in Melodic mode.
  20062. *)
  20063.   DMUS_PLAYMODE_ALWAYSPLAY       = (DMUS_PLAYMODE_MELODIC or DMUS_PLAYMODE_NORMALCHORD);
  20064.  
  20065. (*  Legacy names for modes... *)
  20066.   DMUS_PLAYMODE_PURPLEIZED       = DMUS_PLAYMODE_ALWAYSPLAY;
  20067.   DMUS_PLAYMODE_SCALE_ROOT       = DMUS_PLAYMODE_KEY_ROOT;
  20068.   DMUS_PLAYMODE_FIXEDTOSCALE     = DMUS_PLAYMODE_FIXEDTOKEY;
  20069.  
  20070. type
  20071. (* DMUS_MIDI_PMsg *)
  20072.   TDMus_Midi_PMsg = record
  20073.     (* begin DMUS_PMsg_PART *)
  20074.     dwSize:          DWORD;
  20075.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  20076.     mtTime:          TMusic_Time;          (* music time *)
  20077.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  20078.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  20079.                                            (* use this to determine the port/channel. *)
  20080.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  20081.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  20082.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  20083.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  20084.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  20085.                                            (* identify a specific event. For DirectX 6.0, *)
  20086.                                            (* this field should always be 0. *)
  20087.     dwGroupID:       DWORD;                (* Track group id *)
  20088.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  20089.     (* end DMUS_PMsg_PART *)
  20090.  
  20091.     bStatus: BYTE;
  20092.     bByte1:  BYTE;
  20093.     bByte2:  BYTE;
  20094.     bPad: array [0..0] of BYTE;
  20095.   end;
  20096.  
  20097. (* DMUS_PATCH_PMsg *)
  20098.   TDMus_Patch_PMsg = packed record
  20099.     (* begin DMUS_PMsg_PART *)
  20100.     dwSize:          DWORD;
  20101.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  20102.     mtTime:          TMusic_Time;          (* music time *)
  20103.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  20104.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  20105.                                            (* use this to determine the port/channel. *)
  20106.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  20107.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  20108.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  20109.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  20110.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  20111.                                            (* identify a specific event. For DirectX 6.0, *)
  20112.                                            (* this field should always be 0. *)
  20113.     dwGroupID:       DWORD;                (* Track group id *)
  20114.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  20115.     (* end DMUS_PMsg_PART *)
  20116.  
  20117.     byInstrument: BYTE;
  20118.     byMSB:        BYTE;
  20119.     byLSB:        BYTE;
  20120.     byPad: array [0..0] of BYTE;
  20121.   end;
  20122.  
  20123. (* DMUS_TRANSPOSE_PMsg *)
  20124.   TDMus_Transpose_PMsg = packed record
  20125.     (* begin DMUS_PMsg_PART *)
  20126.     dwSize:          DWORD;
  20127.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  20128.     mtTime:          TMusic_Time;          (* music time *)
  20129.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  20130.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  20131.                                            (* use this to determine the port/channel. *)
  20132.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  20133.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  20134.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  20135.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  20136.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  20137.                                            (* identify a specific event. For DirectX 6.0, *)
  20138.                                            (* this field should always be 0. *)
  20139.     dwGroupID:       DWORD;                (* Track group id *)
  20140.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  20141.     (* end DMUS_PMsg_PART *)
  20142.  
  20143.     nTranspose: SmallInt;
  20144.   end;
  20145.  
  20146. (* DMUS_CHANNEL_PRIORITY_PMsg *)
  20147.   TDMus_Channel_Priority_PMsg = packed record
  20148.     (* begin DMUS_PMsg_PART *)
  20149.     dwSize:          DWORD;
  20150.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  20151.     mtTime:          TMusic_Time;          (* music time *)
  20152.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  20153.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  20154.                                            (* use this to determine the port/channel. *)
  20155.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  20156.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  20157.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  20158.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  20159.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  20160.                                            (* identify a specific event. For DirectX 6.0, *)
  20161.                                            (* this field should always be 0. *)
  20162.     dwGroupID:       DWORD;                (* Track group id *)
  20163.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  20164.     (* end DMUS_PMsg_PART *)
  20165.  
  20166.     dwChannelPriority: DWORD;
  20167.   end;
  20168.  
  20169. (* DMUS_TEMPO_PMsg *)
  20170.   TDMus_Tempo_PMsg = packed record
  20171.     (* begin DMUS_PMsg_PART *)
  20172.     dwSize:          DWORD;
  20173.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  20174.     mtTime:          TMusic_Time;          (* music time *)
  20175.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  20176.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  20177.                                            (* use this to determine the port/channel. *)
  20178.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  20179.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  20180.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  20181.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  20182.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  20183.                                            (* identify a specific event. For DirectX 6.0, *)
  20184.                                            (* this field should always be 0. *)
  20185.     dwGroupID:       DWORD;                (* Track group id *)
  20186.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  20187.     (* end DMUS_PMsg_PART *)
  20188.  
  20189.     dblTempo: double;                      (* the tempo *)
  20190.   end;
  20191.  
  20192. const
  20193.   DMUS_TEMPO_MAX         = 1000;
  20194.   DMUS_TEMPO_MIN         = 1;
  20195.  
  20196.   DMUS_MASTERTEMPO_MAX   = 100.0;
  20197.   DMUS_MASTERTEMPO_MIN   = 0.01;
  20198.  
  20199. type
  20200. (* DMUS_SYSEX_PMsg *)
  20201.   TDMus_SysEx_PMsg = packed record
  20202.     (* begin DMUS_PMsg_PART *)
  20203.     dwSize:          DWORD;
  20204.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  20205.     mtTime:          TMusic_Time;          (* music time *)
  20206.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  20207.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  20208.                                            (* use this to determine the port/channel. *)
  20209.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  20210.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  20211.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  20212.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  20213.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  20214.                                            (* identify a specific event. For DirectX 6.0, *)
  20215.                                            (* this field should always be 0. *)
  20216.     dwGroupID:       DWORD;                (* Track group id *)
  20217.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  20218.     (* end DMUS_PMsg_PART *)
  20219.  
  20220.     dwLen:     DWORD;                      (* length of the data *)
  20221.     abData: array [0..0] of BYTE;          (* array of data, length equal to dwLen *)
  20222.   end;
  20223.  
  20224. (* DMUS_CURVE_PMsg *)
  20225.   TDMus_Curve_PMsg = packed record
  20226.     (* begin DMUS_PMsg_PART *)
  20227.     dwSize:          DWORD;
  20228.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  20229.     mtTime:          TMusic_Time;          (* music time *)
  20230.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  20231.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  20232.                                            (* use this to determine the port/channel. *)
  20233.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  20234.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  20235.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  20236.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  20237.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  20238.                                            (* identify a specific event. For DirectX 6.0, *)
  20239.                                            (* this field should always be 0. *)
  20240.     dwGroupID:       DWORD;                (* Track group id *)
  20241.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  20242.     (* end DMUS_PMsg_PART *)
  20243.  
  20244.     mtDuration:      TMusic_Time;     (* how long this curve lasts *)
  20245.     mtOriginalStart: TMusic_Time;     (* must be set to either zero when this PMSG is created or to the original mtTime of the curve *)
  20246.     mtResetDuration: TMusic_Time;     (* how long after the curve is finished to reset to the
  20247.                                         reset value, nResetValue *)
  20248.     nStartValue:     SmallInt;        (* curve's start value *)
  20249.     nEndValue:       SmallInt;        (* curve's end value *)
  20250.     nResetValue:     SmallInt;        (* curve's reset value, sent after mtResetDuration or
  20251.                                         upon a flush or invalidation *)
  20252.     wMeasure:        WORD;            (* Measure in which this curve occurs *)
  20253.     nOffset:         SmallInt;        (* Offset from grid at which this curve occurs *)
  20254.     bBeat:           BYTE;            (* Beat (in measure) at which this curve occurs *)
  20255.     bGrid:           BYTE;            (* Grid offset from beat at which this curve occurs *)
  20256.     bType:           BYTE;            (* type of curve *)
  20257.     bCurveShape:     BYTE;            (* shape of curve *)
  20258.     bCCData:         BYTE;            (* CC# if this is a control change type *)
  20259.     bFlags:          BYTE;            (* set to 1 if the nResetValue must be sent when the
  20260.                                         time is reached or an invalidate occurs because
  20261.                                         of a transition. If 0, the curve stays
  20262.                                         permanently stuck at the new value. All bits besides
  20263.                                         1 are reserved. *)
  20264.   end;
  20265.  
  20266.   TDMus_Curve_Flags = DWORD;
  20267. const
  20268.   DMUS_CURVE_RESET = 1;           (* Set if the curve needs to be reset. *)
  20269.  
  20270. (* Curve shapes *)
  20271. type
  20272.   TDMus_Curve_Shapes = (
  20273.     DMUS_CURVES_LINEAR ,
  20274.     DMUS_CURVES_INSTANT,
  20275.     DMUS_CURVES_EXP    ,
  20276.     DMUS_CURVES_LOG    ,
  20277.     DMUS_CURVES_SINE  
  20278.   );
  20279.  
  20280. const
  20281. (* curve types *)
  20282.   DMUS_CURVET_PBCURVE      = $03;
  20283.   DMUS_CURVET_CCCURVE      = $04;
  20284.   DMUS_CURVET_MATCURVE     = $05;
  20285.   DMUS_CURVET_PATCURVE     = $06;
  20286.  
  20287. type
  20288. (* DMUS_TIMESIG_PMsg *)
  20289.   TDMus_TimeSig_PMsg = packed record
  20290.     (* begin DMUS_PMsg_PART *)
  20291.     dwSize:          DWORD;
  20292.     rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
  20293.     mtTime:          TMusic_Time;          (* music time *)
  20294.     dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
  20295.     dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
  20296.                                            (* use this to determine the port/channel. *)
  20297.     dwVirtualTrackID:DWORD;                (* virtual track ID *)
  20298.     pTool:           IDirectMusicTool;     (* tool interface pointer *)
  20299.     pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
  20300.     dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
  20301.     dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
  20302.                                            (* identify a specific event. For DirectX 6.0, *)
  20303.                                            (* this field should always be 0. *)
  20304.     dwGroupID:       DWORD;                (* Track group id *)
  20305.     punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
  20306.     (* end DMUS_PMsg_PART *)
  20307.  
  20308.     (* Time signatures define how many beats per measure, which note receives *)
  20309.     (* the beat, and the grid resolution. *)
  20310.     bBeatsPerMeasure: BYTE;          (* beats per measure (top of time sig) *)
  20311.     bBeat:            BYTE;          (* what note receives the beat (bottom of time sig.) *)
  20312.                                      (* we can assume that 0 means 256th note *)
  20313.     wGridsPerBeat:    WORD;          (* grids per beat *)
  20314.   end;
  20315.  
  20316. const
  20317. (* notification type values *)
  20318. (* The following correspond to GUID_NOTIFICATION_SEGMENT *)
  20319.   DMUS_NOTIFICATION_SEGSTART     = 0;
  20320.   DMUS_NOTIFICATION_SEGEND       = 1;
  20321.   DMUS_NOTIFICATION_SEGALMOSTEND = 2;
  20322.   DMUS_NOTIFICATION_SEGLOOP      = 3;
  20323.   DMUS_NOTIFICATION_SEGABORT     = 4;
  20324. (* The following correspond to GUID_NOTIFICATION_PERFORMANCE *)
  20325.   DMUS_NOTIFICATION_MUSICSTARTED = 0;
  20326.   DMUS_NOTIFICATION_MUSICSTOPPED = 1;
  20327. (* The following corresponds to GUID_NOTIFICATION_MEASUREANDBEAT *)
  20328.   DMUS_NOTIFICATION_MEASUREBEAT  = 0;
  20329. (* The following corresponds to GUID_NOTIFICATION_CHORD *)
  20330.   DMUS_NOTIFICATION_CHORD        = 0;
  20331. (* The following correspond to GUID_NOTIFICATION_COMMAND *)
  20332.   DMUS_NOTIFICATION_GROOVE        = 0;
  20333.   DMUS_NOTIFICATION_EMBELLISHMENT = 1;
  20334.  
  20335. const
  20336.   DMUS_MAX_NAME          = 64;         (* Maximum object name length. *)
  20337.   DMUS_MAX_CATEGORY      = 64;         (* Maximum object category name length. *)
  20338.   DMUS_MAX_FILENAME      = MAX_PATH;
  20339.  
  20340. type
  20341.   PDMus_Version = ^TDMus_Version;
  20342.   TDMus_Version = packed record
  20343.     dwVersionMS: DWORD;
  20344.     dwVersionLS: DWORD;
  20345.   end;
  20346.  
  20347. (*      The DMUSOBJECTDESC structure is used to communicate everything you could *)
  20348. (*      possibly use to describe a DirectMusic object.  *)
  20349.   PDMus_ObjectDesc = ^TDMus_ObjectDesc;
  20350.   TDMus_ObjectDesc = packed record
  20351.     dwSize:      DWORD;                     (* Size of this structure. *)
  20352.     dwValidData: DWORD;                     (* Flags indicating which fields below are valid. *)
  20353.     guidObject:  TGUID;                     (* Unique ID for this object. *)
  20354.     guidClass:   TGUID;                     (* GUID for the class of object. *)
  20355.     ftDate:      TFileTime;                 (* Last edited date of object. *)
  20356.     vVersion:    TDMus_Version;              (* Version. *)
  20357.     wszName:     array [0..DMUS_MAX_NAME-1] of WCHAR; (* Name of object. *)
  20358.     wszCategory: array [0..DMUS_MAX_CATEGORY-1] of WCHAR; (* Category for object (optional). *)
  20359.     wszFileName: array [0..DMUS_MAX_FILENAME-1] of WCHAR; (* File path. *)
  20360.     llMemLength: LongLong;                     (* Size of Memory data. *)
  20361.     pbMemData:   Pointer;                   (* Memory pointer for data. *)
  20362.     dwDummy:     DWORD; ///?
  20363.   end;
  20364.  
  20365. (*      Flags for dwValidData. When set, a flag indicates that the  *)
  20366. (*      corresponding field in DMUSOBJECTDESC holds valid data. *)
  20367. const
  20368.   DMUS_OBJ_OBJECT         = (1 shl 0);     (* Object GUID is valid. *)
  20369.   DMUS_OBJ_CLASS          = (1 shl 1);     (* Class GUID is valid. *)
  20370.   DMUS_OBJ_NAME           = (1 shl 2);     (* Name is valid. *)
  20371.   DMUS_OBJ_CATEGORY       = (1 shl 3);     (* Category is valid. *)
  20372.   DMUS_OBJ_FILENAME       = (1 shl 4);     (* File path is valid. *)
  20373.   DMUS_OBJ_FULLPATH       = (1 shl 5);     (* Path is full path. *)
  20374.   DMUS_OBJ_URL            = (1 shl 6);     (* Path is URL. *)
  20375.   DMUS_OBJ_VERSION        = (1 shl 7);     (* Version is valid. *)
  20376.   DMUS_OBJ_DATE           = (1 shl 8);     (* Date is valid. *)
  20377.   DMUS_OBJ_LOADED         = (1 shl 9);     (* Object is currently loaded in memory. *)
  20378.   DMUS_OBJ_MEMORY         = (1 shl 10);    (* Object is pointed to by pbMemData. *)
  20379.  
  20380.   DMUSB_LOADED    = (1 shl 0);        (* Set when band has been loaded *)
  20381.   DMUSB_DEFAULT   = (1 shl 1);        (* Set when band is default band for a style *)
  20382.  
  20383. type
  20384.   IDirectMusicBand =                 interface;
  20385.   IDirectMusicChordMap =             interface;
  20386.   IDirectMusicLoader =               interface;
  20387.   IDirectMusicObject =               interface;
  20388.  
  20389.  
  20390.   IDirectMusicBand = interface (IUnknown)
  20391.     ['{d2ac28c0-b39b-11d1-8704-00600893b1bd}']
  20392.     function CreateSegment (out ppSegment: IDirectMusicSegment) : HResult; stdcall;
  20393.     function Download      (pPerformance: IDirectMusicPerformance) : HResult; stdcall;
  20394.     function Unload        (pPerformance: IDirectMusicPerformance) : HResult; stdcall;
  20395.   end;
  20396.  
  20397.   IDirectMusicObject = interface (IUnknown)
  20398.     ['{d2ac28b5-b39b-11d1-8704-00600893b1bd}']
  20399.     function GetDescriptor (out pDesc: TDMus_ObjectDesc) : HResult; stdcall;
  20400.     function SetDescriptor (const pDesc: TDMus_ObjectDesc) : HResult; stdcall;
  20401.     function ParseDescriptor (var pStream;
  20402.                               out pDesc: TDMus_ObjectDesc) : HResult; stdcall;
  20403.   end;
  20404.  
  20405.   IDirectMusicLoader = interface (IUnknown)
  20406.     ['{2ffaaca2-5dca-11d2-afa6-00aa0024d8b6}']
  20407.     function GetObject (const pDesc: TDMus_ObjectDesc;
  20408.                         const riid : TGUID;
  20409.                         out ppv) : HResult; stdcall;
  20410.     function SetObject (const pDesc: TDMus_ObjectDesc) : HResult; stdcall;
  20411.     function SetSearchDirectory (const rguidClass: TGUID;
  20412.                                  pwzPath: PWideChar;
  20413.                                  fClear:  BOOL) : HResult; stdcall;
  20414.     function ScanDirectory (const rguidClass: TGUID;
  20415.                             pwzFileExtension,
  20416.                             pwzScanFileName: PWideChar) : HResult; stdcall;
  20417.     function CacheObject (pObject: IDirectMusicObject) : HResult; stdcall;
  20418.     function ReleaseObject (pObject: IDirectMusicObject) : HResult; stdcall;
  20419.     function ClearCache (const rguidClass: TGUID) : HResult; stdcall;
  20420.     function EnableCache (const rguidClass: TGUID;
  20421.                           fEnable: BOOL) : HResult; stdcall;
  20422.     function EnumObject (const rguidClass: TGUID;
  20423.                          dwIndex: DWORD;
  20424.                          const pDesc: TDMus_ObjectDesc) : HResult; stdcall;
  20425.   end;
  20426.  
  20427. (*  Stream object supports IDirectMusicGetLoader interface to access loader while file parsing. *)
  20428.  
  20429.   IDirectMusicGetLoader = interface (IUnknown)
  20430.     ['{68a04844-d13d-11d1-afa6-00aa0024d8b6}']
  20431.     function GetLoader (out ppLoader: IDirectMusicLoader) : HResult; stdcall;
  20432.   end;
  20433.  
  20434. (*/////////////////////////////////////////////////////////////////////
  20435. // IDirectMusicStyle *)
  20436.   IDirectMusicStyle = interface (IUnknown)
  20437.     ['{d2ac28bd-b39b-11d1-8704-00600893b1bd}']
  20438.     function GetBand (pwszName: PWideChar;
  20439.                       out ppBand: IDirectMusicBand) : HResult; stdcall;
  20440.     function EnumBand (dwIndex: DWORD;
  20441.                        pwszName: PWideChar) : HResult; stdcall;
  20442.     function GetDefaultBand (out ppBand: IDirectMusicBand) : HResult; stdcall;
  20443.     function EnumMotif (dwIndex: DWORD;
  20444.                         pwszName: PWideChar) : HResult; stdcall;
  20445.     function GetMotif (pwszName: PWideChar;
  20446.                        out ppSegment: IDirectMusicSegment) : HResult; stdcall;
  20447.     function GetDefaultChordMap (out ppChordMap: IDirectMusicChordMap) : HResult; stdcall;
  20448.     function EnumChordMap (dwIndex: DWORD;
  20449.                            pwszName: PWideChar) : HResult; stdcall;
  20450.     function GetChordMap (pwszName: PWideChar;
  20451.                           out ppChordMap: IDirectMusicChordMap) : HResult; stdcall;
  20452.     function GetTimeSignature (out pTimeSig: TDMus_TimeSignature) : HResult; stdcall;
  20453.     function GetEmbellishmentLength (dwType, dwLevel: DWORD;
  20454.                                      out pdwMin, pdwMax: DWORD) : HResult; stdcall;
  20455.     function GetTempo (out pTempo: double) : HResult; stdcall;
  20456.   end;
  20457.  
  20458. (*/////////////////////////////////////////////////////////////////////
  20459. // IDirectMusicChordMap *)
  20460.   IDirectMusicChordMap = interface (IUnknown)
  20461.     ['{d2ac28be-b39b-11d1-8704-00600893b1bd}']
  20462.     function GetScale (out pdwScale: DWORD) : HResult; stdcall;
  20463.   end;
  20464.  
  20465. (*/////////////////////////////////////////////////////////////////////
  20466. // IDirectMusicComposer *)
  20467.   IDirectMusicComposer = interface (IUnknown)
  20468.     ['{d2ac28bf-b39b-11d1-8704-00600893b1bd}']
  20469.     function ComposeSegmentFromTemplate (pStyle: IDirectMusicStyle;
  20470.                                          pTempSeg: IDirectMusicSegment;
  20471.                                          wActivity: WORD;
  20472.                                          pChordMap: IDirectMusicChordMap;
  20473.                                          out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
  20474.     function ComposeSegmentFromShape (pStyle: IDirectMusicStyle;
  20475.                                       wNumMeasures,
  20476.                                       wShape,
  20477.                                       wActivity: WORD;
  20478.                                       fIntro:    BOOL;
  20479.                                       fEnd:      BOOL;
  20480.                                       pChordMap: IDirectMusicChordMap;
  20481.                                       out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
  20482.     function ComposeTransition (pFromSeg: IDirectMusicSegment;
  20483.                                 pToSeg:   IDirectMusicSegment;
  20484.                                 mtTime:   TMusic_Time;
  20485.                                 wCommand: WORD;
  20486.                                 dwFlags:  DWORD;
  20487.                                 pChordMap:IDirectMusicChordMap;
  20488.                                 out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
  20489.     function AutoTransition (pPerformance: IDirectMusicPerformance;
  20490.                              pToSeg:       IDirectMusicSegment;
  20491.                              wCommand:     WORD;
  20492.                              dwFlags:      DWORD;
  20493.                              pChordMap:    IDirectMusicChordMap;
  20494.                              out ppTransSeg:      IDirectMusicSegment;
  20495.                              out ppToSegState:    IDirectMusicSegmentState;
  20496.                              out ppTransSegState: IDirectMusicSegmentState) : HResult; stdcall;
  20497.     function ComposeTemplateFromShape (wNumMeasures: WORD;
  20498.                                        wShape:       WORD;
  20499.                                        fIntro:       BOOL;
  20500.                                        fEnd:         BOOL;
  20501.                                        wEndLength:   WORD;
  20502.                                        out ppTempSeg:IDirectMusicSegment) : HResult; stdcall;
  20503.     function ChangeChordMap (pSectionSeg: IDirectMusicSegment;
  20504.                              fTrackScale: BOOL;
  20505.                              pChordMap:   IDirectMusicChordMap) : HResult; stdcall;
  20506.   end;
  20507.  
  20508. const  
  20509. (* CLSID's *)
  20510.   CLSID_DirectMusicPerformance : TGUID = '{d2ac2881-b39b-11d1-8704-00600893b1bd}';
  20511.   CLSID_DirectMusicSegment : TGUID = '{d2ac2882-b39b-11d1-8704-00600893b1bd}';
  20512.   CLSID_DirectMusicSegmentState : TGUID = '{d2ac2883-b39b-11d1-8704-00600893b1bd}';
  20513.   CLSID_DirectMusicGraph : TGUID = '{d2ac2884-b39b-11d1-8704-00600893b1bd}';
  20514.   CLSID_DirectMusicTempoTrack : TGUID = '{d2ac2885-b39b-11d1-8704-00600893b1bd}';
  20515.   CLSID_DirectMusicSeqTrack : TGUID = '{d2ac2886-b39b-11d1-8704-00600893b1bd}';
  20516.   CLSID_DirectMusicSysExTrack : TGUID = '{d2ac2887-b39b-11d1-8704-00600893b1bd}';
  20517.   CLSID_DirectMusicTimeSigTrack : TGUID = '{d2ac2888-b39b-11d1-8704-00600893b1bd}';
  20518.   CLSID_DirectMusicStyle : TGUID = '{d2ac288a-b39b-11d1-8704-00600893b1bd}';
  20519.   CLSID_DirectMusicChordTrack : TGUID = '{d2ac288b-b39b-11d1-8704-00600893b1bd}';
  20520.   CLSID_DirectMusicCommandTrack : TGUID = '{d2ac288c-b39b-11d1-8704-00600893b1bd}';
  20521.   CLSID_DirectMusicStyleTrack : TGUID = '{d2ac288d-b39b-11d1-8704-00600893b1bd}';
  20522.   CLSID_DirectMusicMotifTrack : TGUID = '{d2ac288e-b39b-11d1-8704-00600893b1bd}';
  20523.   CLSID_DirectMusicChordMap : TGUID = '{d2ac288f-b39b-11d1-8704-00600893b1bd}';
  20524.   CLSID_DirectMusicComposer : TGUID = '{d2ac2890-b39b-11d1-8704-00600893b1bd}';
  20525.   CLSID_DirectMusicSignPostTrack : TGUID = '{f17e8672-c3b4-11d1-870b-00600893b1bd}';
  20526.   CLSID_DirectMusicLoader : TGUID = '{d2ac2892-b39b-11d1-8704-00600893b1bd}';
  20527.   CLSID_DirectMusicBandTrack : TGUID = '{d2ac2894-b39b-11d1-8704-00600893b1bd}';
  20528.   CLSID_DirectMusicBand : TGUID = '{79ba9e00-b6ee-11d1-86be-00c04fbf8fef}';
  20529.   CLSID_DirectMusicChordMapTrack : TGUID = '{d2ac2896-b39b-11d1-8704-00600893b1bd}';
  20530.   CLSID_DirectMusicMuteTrack : TGUID = '{d2ac2898-b39b-11d1-8704-00600893b1bd}';
  20531.  
  20532. (* Special GUID for all object types. This is used by the loader. *)
  20533.   GUID_DirectMusicAllTypes : TGUID = '{d2ac2893-b39b-11d1-8704-00600893b1bd}';
  20534.  
  20535. (* Notification guids *)
  20536.   GUID_NOTIFICATION_SEGMENT : TGUID = '{d2ac2899-b39b-11d1-8704-00600893b1bd}';
  20537.   GUID_NOTIFICATION_PERFORMANCE : TGUID = '{81f75bc5-4e5d-11d2-bcc7-00a0c922e6eb}';
  20538.   GUID_NOTIFICATION_MEASUREANDBEAT : TGUID = '{d2ac289a-b39b-11d1-8704-00600893b1bd}';
  20539.   GUID_NOTIFICATION_CHORD : TGUID = '{d2ac289b-b39b-11d1-8704-00600893b1bd}';
  20540.   GUID_NOTIFICATION_COMMAND : TGUID = '{d2ac289c-b39b-11d1-8704-00600893b1bd}';
  20541.  
  20542. (* Track param type guids *)
  20543. (* Use to get/set a DMUS_COMMAND_PARAM param in the Command track *)
  20544.   GUID_CommandParam : TGUID = '{d2ac289d-b39b-11d1-8704-00600893b1bd}';
  20545.  
  20546. (* Use to get a DMUS_COMMAND_PARAM_2 param in the Command track *)
  20547.   GUID_CommandParam2 : TGUID = '{28f97ef7-9538-11d2-97a9-00c04fa36e58}';
  20548.  
  20549. (* Use to get/set a DMUS_CHORD_PARAM param in the Chord track *)
  20550.   GUID_ChordParam : TGUID = '{d2ac289e-b39b-11d1-8704-00600893b1bd}';
  20551.  
  20552. (* Use to get a DMUS_RHYTHM_PARAM param in the Chord track *)
  20553.   GUID_RhythmParam : TGUID = '{d2ac289f-b39b-11d1-8704-00600893b1bd}';
  20554.  
  20555. (* Use to get/set an IDirectMusicStyle param in the Style track *)
  20556.   GUID_IDirectMusicStyle : TGUID = '{d2ac28a1-b39b-11d1-8704-00600893b1bd}';
  20557.  
  20558. (* Use to get a DMUS_TIMESIGNATURE param in the Style and TimeSig tracks *)
  20559.   GUID_TimeSignature : TGUID = '{d2ac28a4-b39b-11d1-8704-00600893b1bd}';
  20560.  
  20561. (* Use to get/set a DMUS_TEMPO_PARAM param in the Tempo track *)
  20562.   GUID_TempoParam : TGUID = '{d2ac28a5-b39b-11d1-8704-00600893b1bd}';
  20563.  
  20564. (* Use to set an IDirectMusicBand param in the Band track *)
  20565.   GUID_IDirectMusicBand : TGUID = '{d2ac28ac-b39b-11d1-8704-00600893b1bd}';
  20566.  
  20567. (* Use to get/set an IDirectMusicChordMap param in the ChordMap track *)
  20568.   GUID_IDirectMusicChordMap : TGUID = '{d2ac28ad-b39b-11d1-8704-00600893b1bd}';
  20569.  
  20570. (* Use to get/set a DMUS_MUTE_PARAM param in the Mute track *)
  20571.   GUID_MuteParam : TGUID = '{d2ac28af-b39b-11d1-8704-00600893b1bd}';
  20572.  
  20573. (* These guids are used in IDirectMusicSegment::SetParam to tell the band track to perform various actions.
  20574.  *)
  20575. (* Download bands for the IDirectMusicSegment *)
  20576.   GUID_Download : TGUID = '{d2ac28a7-b39b-11d1-8704-00600893b1bd}';
  20577.  
  20578. (* Unload bands for the IDirectMusicSegment *)
  20579.   GUID_Unload : TGUID = '{d2ac28a8-b39b-11d1-8704-00600893b1bd}';
  20580.  
  20581. (* Connect segment's bands to an IDirectMusicCollection *)
  20582.   GUID_ConnectToDLSCollection : TGUID = '{1db1ae6b-e92e-11d1-a8c5-00c04fa3726e}';
  20583.  
  20584. (* Enable/disable autodownloading of bands *)
  20585.   GUID_Enable_Auto_Download : TGUID = '{d2ac28a9-b39b-11d1-8704-00600893b1bd}';
  20586.   GUID_Disable_Auto_Download : TGUID = '{d2ac28aa-b39b-11d1-8704-00600893b1bd}';
  20587.  
  20588. (* Clear all bands *)
  20589.   GUID_Clear_All_Bands : TGUID = '{d2ac28ab-b39b-11d1-8704-00600893b1bd}';
  20590.  
  20591. (* Set segment to manage all program changes, bank selects, etc. for simple playback of a standard MIDI file *)
  20592.   _GUID_StandardMIDIFile = '{06621075-e92e-11d1-a8c5-00c04fa3726e}';
  20593.   GUID_StandardMIDIFile : TGUID = _GUID_StandardMIDIFile;
  20594. (* For compatibility with beta releases... *)
  20595.   GUID_IgnoreBankSelectForGM : TGUID = _GUID_StandardMIDIFile;
  20596.  
  20597. (* Disable/enable param guids. Use these in SetParam calls to disable or enable sending
  20598.  * specific PMsg types.
  20599.  *)
  20600.   GUID_DisableTimeSig : TGUID = '{45fc707b-1db4-11d2-bcac-00a0c922e6eb}';
  20601.   GUID_EnableTimeSig : TGUID = '{45fc707c-1db4-11d2-bcac-00a0c922e6eb}';
  20602.   GUID_DisableTempo : TGUID = '{45fc707d-1db4-11d2-bcac-00a0c922e6eb}';
  20603.   GUID_EnableTempo : TGUID = '{45fc707e-1db4-11d2-bcac-00a0c922e6eb}';
  20604.  
  20605. (* Used in SetParam calls for pattern-based tracks.  A nonzero value seeds the random number
  20606. generator for variation selection; a value of zero reverts to the default behavior of
  20607. getting the seed from the system clock.
  20608. *)
  20609.   GUID_SeedVariations : TGUID = '{65b76fa5-ff37-11d2-814e-00c04fa36e58}';
  20610.  
  20611. (* Global data guids *)
  20612.   GUID_PerfMasterTempo : TGUID = '{d2ac28b0-b39b-11d1-8704-00600893b1bd}';
  20613.   GUID_PerfMasterVolume : TGUID = '{d2ac28b1-b39b-11d1-8704-00600893b1bd}';
  20614.   GUID_PerfMasterGrooveLevel : TGUID = '{d2ac28b2-b39b-11d1-8704-00600893b1bd}';
  20615.   GUID_PerfAutoDownload : TGUID = '{fb09565b-3631-11d2-bcb8-00a0c922e6eb}';
  20616.  
  20617. (* GUID for default GM/GS dls collection. *)
  20618.   GUID_DefaultGMCollection : TGUID = '{f17e8673-c3b4-11d1-870b-00600893b1bd}';
  20619.  
  20620. type
  20621. (* IID's *)
  20622.   IID_IDirectMusicLoader = IDirectMusicLoader;
  20623.   IID_IDirectMusicGetLoader = IDirectMusicGetLoader;
  20624.   IID_IDirectMusicObject = IDirectMusicObject;
  20625.   IID_IDirectMusicSegment = IDirectMusicSegment;
  20626.   IID_IDirectMusicSegmentState = IDirectMusicSegmentState;
  20627.   IID_IDirectMusicTrack = IDirectMusicTrack;
  20628.   IID_IDirectMusicPerformance = IDirectMusicPerformance;
  20629.   IID_IDirectMusicTool = IDirectMusicTool;
  20630.   IID_IDirectMusicGraph = IDirectMusicGraph;
  20631.   IID_IDirectMusicStyle = IDirectMusicStyle;
  20632.   IID_IDirectMusicChordMap = IDirectMusicChordMap;
  20633.   IID_IDirectMusicComposer = IDirectMusicComposer;
  20634.   IID_IDirectMusicBand = IDirectMusicBand;
  20635.  
  20636. const  
  20637. (* Alternate interface IDs, available in DX7 release and after. *)
  20638.   IID_IDirectMusicPerformance2 : TGUID = '{6fc2cae0-bc78-11d2-afa6-00aa0024d8b6}';
  20639.   IID_IDirectMusicSegment2 : TGUID = '{d38894d1-c052-11d2-872f-00600893b1bd}';
  20640.  
  20641. (************************************************************************
  20642. *                                                                       *
  20643. *   dmusicf.h -- This module defines the DirectMusic file formats       *
  20644. *                                                                       *
  20645. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  20646. *                                                                       *
  20647. ************************************************************************)
  20648.  
  20649. //type IDirectMusicCollection = interface;
  20650.  
  20651. const
  20652. (* Common chunks *)
  20653.  
  20654.   DMUS_FOURCC_GUID_CHUNK        : mmioFOURCC = ('g','u','i','d');
  20655.   DMUS_FOURCC_INFO_LIST         : mmioFOURCC = ('I','N','F','O');
  20656.   DMUS_FOURCC_UNFO_LIST         : mmioFOURCC = ('U','N','F','O');
  20657.   DMUS_FOURCC_UNAM_CHUNK        : mmioFOURCC = ('U','N','A','M');
  20658.   DMUS_FOURCC_UART_CHUNK        : mmioFOURCC = ('U','A','R','T');
  20659.   DMUS_FOURCC_UCOP_CHUNK        : mmioFOURCC = ('U','C','O','P');
  20660.   DMUS_FOURCC_USBJ_CHUNK        : mmioFOURCC = ('U','S','B','J');
  20661.   DMUS_FOURCC_UCMT_CHUNK        : mmioFOURCC = ('U','C','M','T');
  20662.   DMUS_FOURCC_CATEGORY_CHUNK    : mmioFOURCC = ('c','a','t','g');
  20663.   DMUS_FOURCC_VERSION_CHUNK     : mmioFOURCC = ('v','e','r','s');
  20664.  
  20665. (* The following structures are used by the Tracks, and are the packed structures *)
  20666. (* that are passed to the Tracks inside the IStream. *)
  20667.  
  20668. type
  20669.   TDMus_IO_Seq_Item = packed record
  20670.     mtTime:     TMusic_Time;
  20671.     mtDuration: TMusic_Time;
  20672.     dwPChannel: DWORD;
  20673.     nOffset:    SmallInt;
  20674.     bStatus:    BYTE;
  20675.     bByte1:     BYTE;
  20676.     bByte2:     BYTE;
  20677.   end;
  20678.  
  20679.   TDMus_IO_Curve_Item = packed record
  20680.     mtStart:          TMusic_Time;
  20681.     mtDuration:       TMusic_Time;
  20682.     mtResetDuration:  TMusic_Time;
  20683.     dwPChannel:       DWORD;
  20684.        nOffset:       SmallInt;
  20685.        nStartValue:   SmallInt;
  20686.        nEndValue:     SmallInt;
  20687.        nResetValue:   SmallInt;
  20688.     bType:            BYTE;
  20689.     bCurveShape:      BYTE;
  20690.     bCCData:          BYTE;
  20691.     bFlags:           BYTE;
  20692.   end;
  20693.  
  20694.   TDMus_IO_Tempo_Item = packed record
  20695.     lTime:    TMusic_Time;
  20696.     dblTempo: double;
  20697.   end;
  20698.  
  20699.   TDMus_IO_SysEx_Item = packed record
  20700.     mtTime:        TMusic_Time;
  20701.     dwPChannel:    DWORD;
  20702.     dwSysExLength: DWORD;
  20703.   end;
  20704.  
  20705.   TDMus_IO_TimeSignature_Item = packed record
  20706.     lTime:            TMusic_Time;
  20707.     bBeatsPerMeasure: BYTE;            (* beats per measure (top of time sig) *)
  20708.     bBeat:            BYTE;            (* what note receives the beat (bottom of time sig.) *)
  20709.                                        (* we can assume that 0 means 256th note *)
  20710.     wGridsPerBeat:    WORD;            (* grids per beat *)
  20711.   end;
  20712.  
  20713. (* PARAM structures, used by GetParam() and SetParam() *)
  20714.   TDMus_Command_Param = packed record
  20715.     bCommand:     BYTE;
  20716.     bGrooveLevel: BYTE;
  20717.     bGrooveRange: BYTE;
  20718.   end;
  20719.  
  20720.   TDMus_Command_Param_2 = packed record
  20721.     mtTime : TMusic_Time;
  20722.     bCommand:     BYTE;
  20723.     bGrooveLevel: BYTE;
  20724.     bGrooveRange: BYTE;
  20725.   end;
  20726.  
  20727.   TDMus_Chord_Param = TDMus_Chord_Key; (* DMUS_CHORD_KEY defined in dmusici.h *)
  20728.  
  20729.   TDMus_Rhythm_Param = packed record
  20730.     TimeSig:         TDMus_TimeSignature;
  20731.     dwRhythmPattern: DWORD;
  20732.   end;
  20733.  
  20734.   TDMus_Tempo_Param = packed record
  20735.     mtTime:   TMusic_Time;
  20736.     dblTempo: double;
  20737.   end;
  20738.  
  20739.   TDMus_Mute_Param = packed record
  20740.     dwPChannel:    DWORD;
  20741.     dwPChannelMap: DWORD;
  20742.     fMute:         BOOL;
  20743.   end;
  20744.  
  20745. const
  20746. (* Style chunks *)
  20747.  
  20748.   DMUS_FOURCC_STYLE_FORM        : mmioFOURCC = ('D','M','S','T');
  20749.   DMUS_FOURCC_STYLE_CHUNK       : mmioFOURCC = ('s','t','y','h');
  20750.   DMUS_FOURCC_PART_LIST         : mmioFOURCC = ('p','a','r','t');
  20751.   DMUS_FOURCC_PART_CHUNK        : mmioFOURCC = ('p','r','t','h');
  20752.   DMUS_FOURCC_NOTE_CHUNK        : mmioFOURCC = ('n','o','t','e');
  20753.   DMUS_FOURCC_CURVE_CHUNK       : mmioFOURCC = ('c','r','v','e');
  20754.   DMUS_FOURCC_PATTERN_LIST      : mmioFOURCC = ('p','t','t','n');
  20755.   DMUS_FOURCC_PATTERN_CHUNK     : mmioFOURCC = ('p','t','n','h');
  20756.   DMUS_FOURCC_RHYTHM_CHUNK      : mmioFOURCC = ('r','h','t','m');
  20757.   DMUS_FOURCC_PARTREF_LIST      : mmioFOURCC = ('p','r','e','f');
  20758.   DMUS_FOURCC_PARTREF_CHUNK     : mmioFOURCC = ('p','r','f','c');
  20759.   DMUS_FOURCC_STYLE_PERS_REF_LIST   : mmioFOURCC = ('p', 'r', 'r', 'f');
  20760.   DMUS_FOURCC_MOTIFSETTINGS_CHUNK   : mmioFOURCC = ('m', 't', 'f', 's');
  20761.  
  20762. (* Flags used by variations: these make up the DWORDs in dwVariationChoices.               *)
  20763.  
  20764. (* These flags determine the types of chords supported by a given variation in DirectMusic *)
  20765. (* mode.  The first seven flags (bits 1-7) are set if the variation supports major chords  *)
  20766. (* rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation         *)
  20767. (* supports major chords rooted in the tonic, second, and fourth scale positions.  The     *)
  20768. (* next seven flags serve the same purpose, but for minor chords, and the following seven  *)
  20769. (* flags serve the same purpose for chords that are not major or minor (e.g., SUS 4        *)
  20770. (* chords).  Bits 22, 23, and 24 are set if the variation supports chords rooted in the    *)
  20771. (* scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones,       *)
  20772. (* respectively.  For example, to support a C# minor chord in the scale of C Major,        *)
  20773. (* bits 8 (for tonic minor) and 24 (for sharp) need to be set.  Bits 25, 26, an 27 handle  *)
  20774. (* chords that are triads, 6th or 7th chords, and chords with extensions, respectively.    *)
  20775. (* bits 28 and 29 handle chords that are followed by tonic and dominant chords,            *)
  20776. (* respectively.                                                                           *)
  20777.   DMUS_VARIATIONF_MAJOR        = $0000007F; (* Seven positions in the scale - major chords. *)
  20778.   DMUS_VARIATIONF_MINOR        = $00003F80; (* Seven positions in the scale - minor chords. *)
  20779.   DMUS_VARIATIONF_OTHER        = $001FC000; (* Seven positions in the scale - other chords. *)
  20780.   DMUS_VARIATIONF_ROOT_SCALE   = $00200000; (* Handles chord roots in the scale. *)
  20781.   DMUS_VARIATIONF_ROOT_FLAT    = $00400000; (* Handles flat chord roots (based on scale notes). *)
  20782.   DMUS_VARIATIONF_ROOT_SHARP   = $00800000; (* Handles sharp chord roots (based on scale notes). *)
  20783.   DMUS_VARIATIONF_TYPE_TRIAD   = $01000000; (* Handles simple chords - triads. *)
  20784.   DMUS_VARIATIONF_TYPE_6AND7   = $02000000; (* Handles simple chords - 6 and 7. *)
  20785.   DMUS_VARIATIONF_TYPE_COMPLEX = $04000000; (* Handles complex chords. *)
  20786.   DMUS_VARIATIONF_DEST_TO1     = $08000000; (* Handles transitions to 1 chord. *)
  20787.   DMUS_VARIATIONF_DEST_TO5     = $10000000; (* Handles transitions to 5 chord. *)
  20788.  
  20789. (* The top three bits of the variation flags are the Mode bits.  If all are 0, it's IMA. *)
  20790. (* If the smallest is 1, it's Direct Music. *)
  20791.   DMUS_VARIATIONF_MODES        = $E0000000;
  20792.   DMUS_VARIATIONF_IMA25_MODE   = $00000000;
  20793.   DMUS_VARIATIONF_DMUS_MODE    = $20000000;
  20794.  
  20795. //#pragma pack(2)
  20796.  
  20797. type BYTE2 = Word;
  20798.  
  20799. type
  20800.   TDMus_IO_TimeSig = packed record
  20801.     (* Time signatures define how many beats per measure, which note receives *)
  20802.     (* the beat, and the grid resolution. *)
  20803.     bBeatsPerMeasure: BYTE2;      (* beats per measure (top of time sig) *)
  20804.     bBeat:            BYTE2;      (* what note receives the beat (bottom of time sig.) *)
  20805.                                  (* we can assume that 0 means 256th note *)
  20806.     wGridsPerBeat:    WORD;      (* grids per beat *)
  20807.   end;
  20808.  
  20809.   TDMus_IO_Style = packed record
  20810.     timeSig:  TDMus_IO_TimeSig;           (* Styles have a default Time Signature *)
  20811.     dblTempo: double;
  20812.   end;
  20813.  
  20814.   TDMus_IO_Version = packed record
  20815.     dwVersionMS: DWORD;                      (* Version # high-order 32 bits *)
  20816.     dwVersionLS: DWORD;                      (* Version # low-order 32 bits  *)
  20817.   end;
  20818.  
  20819.   TDMus_IO_Pattern = packed record
  20820.     timeSig:        TDMus_IO_TimeSig;    (* Patterns can override the Style's Time sig. *)
  20821.     bGrooveBottom:  BYTE2;                (* bottom of groove range *)
  20822.     bGrooveTop:     BYTE2;                (* top of groove range *)
  20823.     wEmbellishment: WORD;                (* Fill, Break, Intro, End, Normal, Motif *)
  20824.     wNbrMeasures:   WORD;                (* length in measures *)
  20825.   end;
  20826.  
  20827.   TDMus_IO_StylePart = packed record
  20828.     timeSig:        TDMus_IO_TimeSig;   (* can override pattern's *)
  20829.     dwVariationChoices: array [0..31] of DWORD; (* MOAW choice bitfield *)
  20830.     guidPartID:     TGUID;              (* identifies the part *)
  20831.     wNbrMeasures:   WORD;               (* length of the Part *)
  20832.     bPlayModeFlags: BYTE2;               (* see PLAYMODE flags *)
  20833.     bInvertUpper:   BYTE2;               (* inversion upper limit *)
  20834.     bInvertLower:   BYTE2;               (* inversion lower limit *)
  20835.   end;
  20836.  
  20837.   TDMus_IO_PartRef = packed record
  20838.     guidPartID:       TGUID;     (* unique ID for matching up with parts *)
  20839.     wLogicalPartID:   WORD;      (* corresponds to port/device/midi channel *)
  20840.     bVariationLockID: BYTE2;      (* parts with the same ID lock variations. *)
  20841.                                  (* high bit is used to identify master Part *)
  20842.     bSubChordLevel:   BYTE2;      (* tells which sub chord level this part wants *)
  20843.     bPriority:        BYTE2;      (* 256 priority levels. Parts with lower priority *)
  20844.                                  (* aren't played first when a device runs out of *)
  20845.                                  (* notes *)
  20846.     bRandomVariation: BYTE2;      (* when set, matching variations play in random order *)
  20847.                                  (* when clear, matching variations play sequentially *)
  20848.   end;
  20849.  
  20850.   TDMus_IO_StyleNote = packed record
  20851.     mtGridStart:    TMusic_Time ;(* when this note occurs *)
  20852.     dwVariation:    DWORD;       (* variation bits *)
  20853.     mtDuration:     TMusic_Time; (* how long this note lasts *)
  20854.     nTimeOffset:    SmallInt;    (* offset from mtGridStart *)
  20855.     wMusicValue:    WORD;        (* Position in scale. *)
  20856.     bVelocity:      BYTE2;        (* Note velocity. *)
  20857.     bTimeRange:     BYTE2;        (* Range to randomize start time. *)
  20858.     bDurRange:      BYTE2;        (* Range to randomize duration. *)
  20859.     bVelRange:      BYTE2;        (* Range to randomize velocity. *)
  20860.     bInversionID:   BYTE2;        (* Identifies inversion group to which this note belongs *)
  20861.     bPlayModeFlags: BYTE2;        (* Can override part *)
  20862.   end;
  20863.  
  20864.   TDMus_IO_StyleCurve = packed record
  20865.     mtGridStart:     TMusic_Time; (* when this curve occurs *)
  20866.     dwVariation:     DWORD;       (* variation bits *)
  20867.     mtDuration:      TMusic_Time; (* how long this curve lasts *)
  20868.     mtResetDuration: TMusic_Time; (* how long after the end of the curve to reset the curve *)
  20869.     nTimeOffset:     SmallInt;    (* offset from mtGridStart *)
  20870.     nStartValue:     SmallInt;    (* curve's start value *)
  20871.     nEndValue:       SmallInt;    (* curve's end value *)
  20872.     nResetValue:     SmallInt;    (* the value to which to reset the curve *)
  20873.     bEventType:      BYTE2;        (* type of curve *)
  20874.     bCurveShape:     BYTE2;        (* shape of curve *)
  20875.     bCCData:         BYTE2;        (* CC# *)
  20876.     bFlags:          BYTE2;        (* Bit 1=TRUE means to send nResetValue. Otherwise, don't.
  20877.                                     Other bits are reserved. *)
  20878.   end;
  20879.  
  20880.   TDMus_IO_MotifSettings = packed record
  20881.     dwRepeats:    DWORD;          (* Number of repeats. By default, 0. *)
  20882.     mtPlayStart:  TMusic_Time;    (* Start of playback. By default, 0. *)
  20883.     mtLoopStart:  TMusic_Time;    (* Start of looping portion. By default, 0. *)
  20884.     mtLoopEnd:    TMusic_Time;    (* End of loop. Must be greater than mtLoopStart. By default equal to length of motif. *)
  20885.     dwResolution: DWORD;          (* Default resolution. *)
  20886.   end;
  20887.  
  20888. //#pragma pack()
  20889.  
  20890. (*
  20891. RIFF
  20892. (
  20893.     'DMST'          // Style
  20894.     <styh-ck>       // Style header chunk
  20895.     <guid-ck>       // Every Style has a GUID
  20896.     [<UNFO-list>]   // Name, author, copyright info., comments
  20897.     [<vers-ck>]     // version chunk
  20898.     <part-list>...  // List of parts in the Style, used by patterns
  20899.     <pttn-list>...  // List of patterns in the Style
  20900.     <DMBD-form>...  // List of bands in the Style
  20901.     [<motf-list>]   // List of motifs in the Style
  20902.     [<prrf-list>]   // List of chord map references in the Style
  20903. )
  20904.  
  20905.     // <styh-ck>
  20906.     styh
  20907.     (
  20908.         <DMUS_IO_STYLE>
  20909.     )
  20910.  
  20911.     // <guid-ck>
  20912.     guid
  20913.     (
  20914.         <GUID>
  20915.     )
  20916.  
  20917.     // <vers-ck>
  20918.     vers
  20919.     (
  20920.         <DMUS_IO_VERSION>
  20921.     )
  20922.  
  20923.     // <part-list>
  20924.     LIST
  20925.     (
  20926.         'part'
  20927.         <prth-ck>       // Part header chunk
  20928.         [<UNFO-list>]
  20929.         [<note-ck>]     // List of notes in Part
  20930.         [<crve-ck>]     // List of curves in Part
  20931.     )
  20932.  
  20933.         // <orth-ck>
  20934.         prth
  20935.         (
  20936.             <DMUS_IO_STYLEPART>
  20937.         )
  20938.  
  20939.         // <note-ck>
  20940.         'note'
  20941.         (
  20942.             // sizeof DMUS_IO_STYLENOTE:DWORD
  20943.             <DMUS_IO_STYLENOTE>...
  20944.         )
  20945.  
  20946.         // <crve-ck>
  20947.         'crve'
  20948.         (
  20949.             // sizeof DMUS_IO_STYLECURVE:DWORD
  20950.             <DMUS_IO_STYLECURVE>...
  20951.         )
  20952.  
  20953.     // <pttn-list>
  20954.     LIST
  20955.     (
  20956.         'pttn'
  20957.         <ptnh-ck>       // Pattern header chunk
  20958.         <rhtm-ck>       // List of rhythms for chord matching
  20959.         [<UNFO-list>]
  20960.         [<mtfs-ck>]     // Motif settings chunk
  20961.         <pref-list>...  // List of part reference id's
  20962.     )
  20963.  
  20964.         // <ptnh-ck>
  20965.         ptnh
  20966.         (
  20967.             <DMUS_IO_PATTERN>
  20968.         )
  20969.  
  20970.         // <rhtm-ck>
  20971.         'rhtm'
  20972.         (
  20973.             // DWORD's representing rhythms for chord matching based on number
  20974.             // of measures in the pattern
  20975.         )
  20976.  
  20977.         // pref-list
  20978.         LIST
  20979.         (
  20980.             'pref'
  20981.             <prfc-ck>   // part ref chunk
  20982.         )
  20983.  
  20984.         // <prfc-ck>
  20985.         prfc
  20986.         (
  20987.             <DMUS_IO_PARTREF>
  20988.         )
  20989.  
  20990.         // <mtfs-ck>
  20991.         mtfs
  20992.         (
  20993.             <DMUS_IO_MOTIFSETTINGS>
  20994.         )
  20995.  
  20996.     // <prrf-list>
  20997.     LIST
  20998.     (
  20999.         'prrf'
  21000.         // some number of <DMRF>
  21001.     )
  21002. *)
  21003.  
  21004. (* Chord and command file formats *)
  21005. const
  21006.   DMUS_FOURCC_CHORDTRACK_LIST         : mmioFOURCC = ('c','o','r','d');
  21007.   DMUS_FOURCC_CHORDTRACKHEADER_CHUNK  : mmioFOURCC = ('c','r','d','h');
  21008.   DMUS_FOURCC_CHORDTRACKBODY_CHUNK    : mmioFOURCC = ('c','r','d','b');
  21009.  
  21010.   DMUS_FOURCC_COMMANDTRACK_CHUNK      : mmioFOURCC = ('c','m','n','d');
  21011.  
  21012. type
  21013.   TDMus_IO_Chord = packed record
  21014.     wszName: array [0..15] of WCHAR; (* Name of the chord *)
  21015.     mtTime:      TMusic_Time;    (* Time of this chord *)
  21016.     wMeasure:    WORD;           (* Measure this falls on *)
  21017.     bBeat:       BYTE;           (* Beat this falls on *)
  21018.   end;
  21019.  
  21020.   TDMus_IO_SubChord = packed record
  21021.     dwChordPattern:    DWORD;    (* Notes in the subchord *)
  21022.     dwScalePattern:    DWORD;    (* Notes in the scale *)
  21023.     dwInversionPoints: DWORD;    (* Where inversions can occur *)
  21024.     dwLevels:          DWORD;    (* Which levels are supported by this subchord *)
  21025.     bChordRoot:        BYTE;     (* Root of the subchord *)
  21026.     bScaleRoot:        BYTE;     (* Root of the scale *)
  21027.   end;
  21028.  
  21029.   TDMus_IO_Command = packed record
  21030.     mtTime:       TMusic_Time;   (* Time of this command *)
  21031.     wMeasure:     WORD;          (* Measure this falls on *)
  21032.     bBeat:        BYTE;          (* Beat this falls on *)
  21033.     bCommand:     BYTE;          (* Command type (see #defines below) *)
  21034.     bGrooveLevel: BYTE;          (* Groove level (0 if command is not a groove) *)
  21035.     bGrooveRange: BYTE;          (* Groove range  *)
  21036.   end;
  21037.  
  21038. (*
  21039.  
  21040.     // <cord-list>
  21041.     LIST
  21042.     (
  21043.         'cord'
  21044.         <crdh-ck>
  21045.         <crdb-ck>       // Chord body chunk
  21046.     )
  21047.  
  21048.         // <crdh-ck>
  21049.         crdh
  21050.         (
  21051.             // Scale: dword (upper 8 bits for root, lower 24 for scale)
  21052.         )
  21053.  
  21054.         // <crdb-ck>
  21055.         crdb
  21056.         (
  21057.             // sizeof DMUS_IO_CHORD:dword
  21058.             <DMUS_IO_CHORD>
  21059.             // # of DMUS_IO_SUBCHORDS:dword
  21060.             // sizeof DMUS_IO_SUBCHORDS:dword
  21061.             // a number of <DMUS_IO_SUBCHORD>
  21062.         )
  21063.  
  21064.  
  21065.     // <cmnd-list>
  21066.     'cmnd'
  21067.     (
  21068.         //sizeof DMUS_IO_COMMAND: DWORD
  21069.         <DMUS_IO_COMMAND>...
  21070.     )
  21071.  
  21072. *)
  21073.  
  21074. (*  File io for DirectMusic Tool and ToolGraph objects
  21075. *)
  21076.  
  21077. (* RIFF ids: *)
  21078. const
  21079.   DMUS_FOURCC_TOOLGRAPH_FORM  : mmioFOURCC = ('D','M','T','G');
  21080.   DMUS_FOURCC_TOOL_LIST       : mmioFOURCC = ('t','o','l','l');
  21081.   DMUS_FOURCC_TOOL_FORM       : mmioFOURCC = ('D','M','T','L');
  21082.   DMUS_FOURCC_TOOL_CHUNK      : mmioFOURCC = ('t','o','l','h');
  21083.  
  21084. (* io structures: *)
  21085. type
  21086.   TDMus_IO_Tool_Header = packed record
  21087.     guidClassID:    TGUID;       (* Class id of tool. *)
  21088.     lIndex:         LongInt;     (* Position in graph. *)
  21089.     cPChannels:     DWORD;       (* Number of items in channels array. *)
  21090.     ckid:           TFourCC;     (* chunk ID of tool's data chunk if 0 fccType valid. *)
  21091.     fccType:        TFourCC;     (* list type if NULL ckid valid. *)
  21092.     dwPChannels: array [0..0] of DWORD; (* Array of PChannels, size determined by cPChannels. *)
  21093.   end;
  21094.  
  21095. (*
  21096. RIFF
  21097. (
  21098.     'DMTG'          // DirectMusic ToolGraph chunk
  21099.     [<guid-ck>]     // GUID for ToolGraph
  21100.     [<vers-ck>]     // Optional version info
  21101.     [<UNFO-list>]   // Name, author, copyright info., comments
  21102.     <toll-list>     // List of Tools
  21103. )
  21104.  
  21105.     // <guid-ck>
  21106.     'guid'
  21107.     (
  21108.         <GUID>
  21109.     )
  21110.  
  21111.     // <vers-ck>
  21112.     vers
  21113.     (
  21114.         <DMUS_IO_VERSION>
  21115.     )
  21116.  
  21117.     // <toll-list>
  21118.     LIST
  21119.     (
  21120.         'toll'          // List of tools
  21121.         <DMTL-form>...  // Each tool is encapsulated in a RIFF chunk
  21122.     )
  21123.  
  21124. // <DMTL-form>      // Tools can be embedded in a graph or stored as separate files.
  21125. RIFF
  21126. (
  21127.     'DMTL'
  21128.     <tolh-ck>
  21129.     [<guid-ck>]     // Optional GUID for tool object instance (not to be confused with Class id in track header)
  21130.     [<vers-ck>]     // Optional version info
  21131.     [<UNFO-list>]   // Optional name, author, copyright info., comments
  21132.     [<data>]        // Tool data. Must be a RIFF readable chunk.
  21133. )
  21134.  
  21135.     // <tolh-ck>            // Tool header chunk
  21136.     (
  21137.         'tolh'
  21138.         <DMUS_IO_TOOL_HEADER>   // Tool header
  21139.     )
  21140. *)
  21141.  
  21142. (*  File io for DirectMusic Band Track object *)
  21143.  
  21144.  
  21145. (* RIFF ids: *)
  21146. const
  21147.   DMUS_FOURCC_BANDTRACK_FORM  : mmioFOURCC = ('D','M','B','T');
  21148.   DMUS_FOURCC_BANDTRACK_CHUNK : mmioFOURCC = ('b','d','t','h');
  21149.   DMUS_FOURCC_BANDS_LIST      : mmioFOURCC = ('l','b','d','l');
  21150.   DMUS_FOURCC_BAND_LIST       : mmioFOURCC = ('l','b','n','d');
  21151.   DMUS_FOURCC_BANDITEM_CHUNK  : mmioFOURCC = ('b','d','i','h');
  21152.  
  21153. type
  21154. (*  io structures *)
  21155.   TDMus_IO_Band_Track_Header = packed record
  21156.     bAutoDownload: BOOL;    (* Determines if Auto-Download is enabled. *)
  21157.   end;
  21158.  
  21159.   TDMus_IO_Band_Item_Header = packed record
  21160.     lBandTime: TMusic_Time;   (* Position in track list. *)
  21161.   end;
  21162.  
  21163. (*
  21164. RIFF
  21165. (
  21166.     'DMBT'          // DirectMusic Band Track form-type
  21167.     [<bdth-ck>]     // Band track header
  21168.     [<guid-ck>]     // GUID for band track
  21169.     [<vers-ck>]     // Optional version info
  21170.     [<UNFO-list>]   // Name, author, copyright info., comments
  21171.     <lbdl-list>     // List of Band Lists
  21172. )
  21173.  
  21174.     // <bnth-ck>
  21175.     'bdth'
  21176.     (
  21177.         <DMUS_IO_BAND_TRACK_HEADER>
  21178.     )
  21179.  
  21180.     // <guid-ck>
  21181.     'guid'
  21182.     (
  21183.         <GUID>
  21184.     )
  21185.  
  21186.     // <vers-ck>
  21187.     vers
  21188.     (
  21189.         <DMUS_IO_VERSION>
  21190.     )
  21191.  
  21192.     // <lbdl-list>
  21193.     LIST
  21194.     (
  21195.         'lbdl'          // List of bands
  21196.         <lbnd-list>     // Each band is encapsulated in a list
  21197.     )
  21198.  
  21199.         // <lbnd-list>
  21200.         LIST
  21201.         (
  21202.             'lbnd'
  21203.             <bdih-ck>
  21204.             <DMBD-form> // Band
  21205.         )
  21206.  
  21207.             // <bdih-ck>            // band item header
  21208.             (
  21209.                 <DMUS_IO_BAND_ITEM_HEADER>  // Band item header
  21210.             )
  21211. *)      
  21212.  
  21213.  
  21214. (*  File io for DirectMusic Band object
  21215. *)
  21216.  
  21217. (* RIFF ids: *)
  21218. const
  21219.   DMUS_FOURCC_BAND_FORM           : mmioFOURCC = ('D','M','B','D');
  21220.   DMUS_FOURCC_INSTRUMENTS_LIST    : mmioFOURCC = ('l','b','i','l');
  21221.   DMUS_FOURCC_INSTRUMENT_LIST     : mmioFOURCC = ('l','b','i','n');
  21222.   DMUS_FOURCC_INSTRUMENT_CHUNK    : mmioFOURCC = ('b','i','n','s');
  21223.  
  21224. (* Flags for DMUS_IO_INSTRUMENT
  21225.  *)
  21226.   DMUS_IO_INST_PATCH          = (1 shl 0);        (* dwPatch is valid. *)
  21227.   DMUS_IO_INST_BANKSELECT     = (1 shl 1);        (* dwPatch contains a valid Bank Select MSB and LSB part *)
  21228.   DMUS_IO_INST_ASSIGN_PATCH   = (1 shl 3);        (* dwAssignPatch is valid *)
  21229.   DMUS_IO_INST_NOTERANGES     = (1 shl 4);        (* dwNoteRanges is valid *)
  21230.   DMUS_IO_INST_PAN            = (1 shl 5);        (* bPan is valid *)
  21231.   DMUS_IO_INST_VOLUME         = (1 shl 6);        (* bVolume is valid *)
  21232.   DMUS_IO_INST_TRANSPOSE      = (1 shl 7);        (* nTranspose is valid *)
  21233.   DMUS_IO_INST_GM             = (1 shl 8);        (* Instrument is from GM collection *)
  21234.   DMUS_IO_INST_GS             = (1 shl 9);        (* Instrument is from GS collection *)
  21235.   DMUS_IO_INST_XG             = (1 shl 10);       (* Instrument is from XG collection *)
  21236.   DMUS_IO_INST_CHANNEL_PRIORITY = (1 shl 11);     (* dwChannelPriority is valid *)
  21237.   DMUS_IO_INST_USE_DEFAULT_GM_SET = (1 shl 12);   (* Always use the default GM set for this patch,  *)
  21238.                                                   (* don't rely on the synth caps stating GM or GS in hardware. *)
  21239. type
  21240. (*  io structures *)
  21241.   TDMus_IO_Instruments = packed record
  21242.     dwPatch:           DWORD;    (* MSB, LSB and Program change to define instrument *)
  21243.     dwAssignPatch:     DWORD;    (* MSB, LSB and Program change to assign to instrument when downloading *)
  21244.     dwNoteRanges: array [0..3] of DWORD;(* 128 bits: one for each MIDI note instrument needs to able to play *)
  21245.     dwPChannel:        DWORD;    (* PChannel instrument plays on *)
  21246.     dwFlags:           DWORD;    (* DMUS_IO_INST_ flags *)
  21247.     bPan:              BYTE;     (* Pan for instrument *)
  21248.     bVolume:           BYTE;     (* Volume for instrument *)
  21249.     nTranspose:        SmallInt; (* Number of semitones to transpose notes *)
  21250.     dwChannelPriority: DWORD;    (* Channel priority *)
  21251.   end;
  21252.  
  21253. (*
  21254. // <DMBD-form> bands can be embedded in other forms
  21255. RIFF
  21256. (
  21257.     'DMBD'          // DirectMusic Band chunk
  21258.     [<guid-ck>]     // GUID for band
  21259.     [<vers-ck>]     // Optional version info
  21260.     [<UNFO-list>]   // Name, author, copyright info., comments
  21261.     <lbil-list>     // List of Instruments
  21262. )
  21263.  
  21264.     // <guid-ck>
  21265.     'guid'
  21266.     (
  21267.         <GUID>
  21268.     )
  21269.  
  21270.     // <vers-ck>
  21271.     vers
  21272.     (
  21273.         <DMUS_IO_VERSION>
  21274.     )
  21275.  
  21276.     // <lbil-list>
  21277.     LIST
  21278.     (
  21279.         'lbil'          // List of instruments
  21280.         <lbin-list>     // Each instrument is encapsulated in a list
  21281.     )
  21282.  
  21283.         // <lbin-list>
  21284.         LIST
  21285.         (
  21286.             'lbin'
  21287.             <bins-ck>
  21288.             [<DMRF-list>]       // Optional reference to DLS Collection file.
  21289.         )
  21290.  
  21291.             // <bins-ck>            // Instrument chunk
  21292.             (
  21293.                 'bins'
  21294.                 <DMUS_IO_INSTRUMENT>    // Instrument header
  21295.             )
  21296. *)
  21297.  
  21298. (*  File io for DirectMusic Segment object *)
  21299.  
  21300. (* RIFF ids: *)
  21301. const
  21302.   DMUS_FOURCC_SEGMENT_FORM    : mmioFOURCC = ('D','M','S','G');
  21303.   DMUS_FOURCC_SEGMENT_CHUNK   : mmioFOURCC = ('s','e','g','h');
  21304.   DMUS_FOURCC_TRACK_LIST      : mmioFOURCC = ('t','r','k','l');
  21305.   DMUS_FOURCC_TRACK_FORM      : mmioFOURCC = ('D','M','T','K');
  21306.   DMUS_FOURCC_TRACK_CHUNK     : mmioFOURCC = ('t','r','k','h');
  21307.  
  21308. (*  io structures:*)
  21309. type
  21310.   TDMus_IO_Segment_Header = packed record
  21311.     dwRepeats:    DWORD;         (* Number of repeats. By default, 0. *)
  21312.     mtLength:     TMusic_Time;   (* Length, in music time. *)
  21313.     mtPlayStart:  TMusic_Time;   (* Start of playback. By default, 0. *)
  21314.     mtLoopStart:  TMusic_Time;   (* Start of looping portion. By default, 0. *)
  21315.     mtLoopEnd:    TMusic_Time;   (* End of loop. Must be greater than dwPlayStart. By default equal to length. *)
  21316.     dwResolution: DWORD;         (* Default resolution. *)
  21317.   end;
  21318.  
  21319.   TDMus_IO_Track_Header = packed record
  21320.     guidClassID: TGUID;          (* Class id of track. *)
  21321.     dwPosition:  DWORD;          (* Position in track list. *)
  21322.     dwGroup:     DWORD;          (* Group bits for track. *)
  21323.     ckid:        TFourCC;        (* chunk ID of track's data chunk if 0 fccType valid. *)
  21324.     fccType:     TFourCC;        (* list type if NULL ckid valid *)
  21325.   end;
  21326.  
  21327. (*
  21328. RIFF
  21329. (
  21330.     'DMSG'          // DirectMusic Segment chunk
  21331.     <segh-ck>       // Segment header chunk
  21332.     [<guid-ck>]     // GUID for segment
  21333.     [<vers-ck>]     // Optional version info
  21334.     [<UNFO-list>]   // Name, author, copyright info., comments
  21335.     <trkl-list>     // List of Tracks
  21336.     [<DMTG-form>]   // Optional ToolGraph
  21337. )
  21338.  
  21339.     // <segh-ck>        
  21340.     'segh'
  21341.     (
  21342.         <DMUS_IO_SEGMENT_HEADER>
  21343.     )
  21344.    
  21345.     // <guid-ck>
  21346.     'guid'
  21347.     (
  21348.         <GUID>
  21349.     )
  21350.  
  21351.     // <vers-ck>
  21352.     vers
  21353.     (
  21354.         <DMUS_IO_VERSION>
  21355.     )
  21356.  
  21357.     // <trkl-list>
  21358.     LIST
  21359.     (
  21360.         'trkl'          // List of tracks
  21361.         <DMTK-form>...  // Each track is encapsulated in a RIFF chunk
  21362.     )
  21363.  
  21364. // <DMTK-form>      // Tracks can be embedded in a segment or stored as separate files.
  21365. RIFF
  21366. (
  21367.     'DMTK'
  21368.     <trkh-ck>
  21369.     [<guid-ck>]     // Optional GUID for track object instance (not to be confused with Class id in track header)
  21370.     [<vers-ck>]     // Optional version info
  21371.     [<UNFO-list>]   // Optional name, author, copyright info., comments
  21372.     [<data>]        // Track data. Must be a RIFF readable chunk.
  21373. )
  21374.  
  21375.     // <trkh-ck>            // Track header chunk
  21376.     (
  21377.         'trkh'
  21378.         <DMUS_IO_TRACK_HEADER>  // Track header
  21379.     )
  21380. *)
  21381.  
  21382. (*  File io for DirectMusic reference chunk.
  21383.     This is used to embed a reference to an object.
  21384. *)
  21385.  
  21386. (*  RIFF ids: *)
  21387. const
  21388.   DMUS_FOURCC_REF_LIST        : mmioFOURCC = ('D','M','R','F');
  21389.   DMUS_FOURCC_REF_CHUNK       : mmioFOURCC = ('r','e','f','h');
  21390.   DMUS_FOURCC_DATE_CHUNK      : mmioFOURCC = ('d','a','t','e');
  21391.   DMUS_FOURCC_NAME_CHUNK      : mmioFOURCC = ('n','a','m','e');
  21392.   DMUS_FOURCC_FILE_CHUNK      : mmioFOURCC = ('f','i','l','e');
  21393.  
  21394. type
  21395.   TDMus_IO_Reference = packed record
  21396.     guidClassID: TGUID;      (* Class id is always required. *)
  21397.     dwValidData: DWORD;      (* Flags. *)
  21398.   end;
  21399.  
  21400. (*
  21401. LIST
  21402. (
  21403.     'DMRF'          // DirectMusic Reference chunk
  21404.     <refh-ck>       // Reference header chunk
  21405.     [<guid-ck>]     // Optional object GUID.
  21406.     [<date-ck>]     // Optional file date.
  21407.     [<name-ck>]     // Optional name.
  21408.     [<file-ck>]     // Optional file name.
  21409.     [<catg-ck>]     // Optional category name.
  21410.     [<vers-ck>]     // Optional version info.
  21411. )
  21412.  
  21413.     // <refh-ck>
  21414.     'refh'
  21415.     (
  21416.         <DMUS_IO_REFERENCE>
  21417.     )
  21418.  
  21419.     // <guid-ck>
  21420.     'guid'
  21421.     (
  21422.         <GUID>
  21423.     )
  21424.  
  21425.     // <date-ck>
  21426.     date
  21427.     (
  21428.         <FILETIME>
  21429.     )
  21430.  
  21431.     // <name-ck>
  21432.     name
  21433.     (
  21434.         // Name, stored as NULL terminated string of WCHARs
  21435.     )
  21436.  
  21437.     // <file-ck>
  21438.     file
  21439.     (
  21440.         // File name, stored as NULL terminated string of WCHARs
  21441.     )
  21442.  
  21443.     // <catg-ck>
  21444.     catg
  21445.     (
  21446.         // Category name, stored as NULL terminated string of WCHARs
  21447.     )
  21448.  
  21449.     // <vers-ck>
  21450.     vers
  21451.     (
  21452.         <DMUS_IO_VERSION>
  21453.     )
  21454. *)
  21455.  
  21456. (* Chord Maps *)
  21457. const
  21458. (* runtime chunks *)
  21459.   DMUS_FOURCC_CHORDMAP_FORM       : mmioFOURCC = ('D','M','P','R');
  21460.   DMUS_FOURCC_IOCHORDMAP_CHUNK    : mmioFOURCC = ('p','e','r','h');
  21461.   DMUS_FOURCC_SUBCHORD_CHUNK      : mmioFOURCC = ('c','h','d','t');
  21462.   DMUS_FOURCC_CHORDENTRY_CHUNK    : mmioFOURCC = ('c','h','e','h');
  21463.   DMUS_FOURCC_SUBCHORDID_CHUNK    : mmioFOURCC = ('s','b','c','n');
  21464.   DMUS_FOURCC_IONEXTCHORD_CHUNK   : mmioFOURCC = ('n','c','r','d');
  21465.   DMUS_FOURCC_NEXTCHORDSEQ_CHUNK  : mmioFOURCC = ('n','c','s','q');
  21466.   DMUS_FOURCC_IOSIGNPOST_CHUNK    : mmioFOURCC = ('s','p','s','h');
  21467.   DMUS_FOURCC_CHORDNAME_CHUNK     : mmioFOURCC = ('I','N','A','M');
  21468.  
  21469. (* runtime list chunks *)
  21470.   DMUS_FOURCC_CHORDENTRY_LIST     : mmioFOURCC = ('c','h','o','e');
  21471.   DMUS_FOURCC_CHORDMAP_LIST       : mmioFOURCC = ('c','m','a','p');
  21472.   DMUS_FOURCC_CHORD_LIST          : mmioFOURCC = ('c','h','r','d');
  21473.   DMUS_FOURCC_CHORDPALETTE_LIST   : mmioFOURCC = ('c','h','p','l');
  21474.   DMUS_FOURCC_CADENCE_LIST        : mmioFOURCC = ('c','a','d','e');
  21475.   DMUS_FOURCC_SIGNPOSTITEM_LIST   : mmioFOURCC = ('s','p','s','t');
  21476.  
  21477.   DMUS_FOURCC_SIGNPOST_LIST       : mmioFOURCC = ('s','p','s','q');
  21478.  
  21479. (* values for dwChord field of DMUS_IO_PERS_SIGNPOST *)
  21480. (* DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST) *)
  21481.   DMUS_SIGNPOSTF_A       = 1;
  21482.   DMUS_SIGNPOSTF_B       = 2;
  21483.   DMUS_SIGNPOSTF_C       = 4;
  21484.   DMUS_SIGNPOSTF_D       = 8;
  21485.   DMUS_SIGNPOSTF_E       = $10;
  21486.   DMUS_SIGNPOSTF_F       = $20;
  21487.   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);
  21488.   DMUS_SIGNPOSTF_1       = $100;
  21489.   DMUS_SIGNPOSTF_2       = $200;
  21490.   DMUS_SIGNPOSTF_3       = $400;
  21491.   DMUS_SIGNPOSTF_4       = $800;
  21492.   DMUS_SIGNPOSTF_5       = $1000;
  21493.   DMUS_SIGNPOSTF_6       = $2000;
  21494.   DMUS_SIGNPOSTF_7       = $4000;
  21495.   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);
  21496.   DMUS_SIGNPOSTF_CADENCE = $8000;
  21497.  
  21498. (* values for dwChord field of DMUS_IO_PERS_SIGNPOST *)
  21499.   DMUS_SPOSTCADENCEF_1 = 2;   (* Use the first cadence chord. *)
  21500.   DMUS_SPOSTCADENCEF_2 = 4;   (* Use the second cadence chord. *)
  21501.  
  21502. type
  21503. (* run time data structs *)
  21504.   TDMus_IO_ChordMap = packed record
  21505.     wszLoadName: array [0..19] of WCHAR;
  21506.     dwScalePattern: DWORD;
  21507.     dwFlags:        DWORD;
  21508.   end;
  21509.  
  21510.   TDMus_IO_ChordMap_SubChord = packed record
  21511.     dwChordPattern:  DWORD;
  21512.     dwScalePattern:  DWORD;
  21513.     dwInvertPattern: DWORD;
  21514.     bChordRoot:      BYTE;
  21515.     bScaleRoot:      BYTE;
  21516.     wCFlags:         WORD;
  21517.     dwLevels:        DWORD;    (* parts or which subchord levels this chord supports *)
  21518.   end;
  21519.  
  21520. (* Legacy name... *)
  21521.   TDMus_IO_Pers_SubChord = TDMus_IO_ChordMap_SubChord;
  21522.  
  21523.   TDMus_IO_ChordEntry = packed record
  21524.     dwFlags:       DWORD;
  21525.     wConnectionID: WORD;     (* replaces runtime "pointer to this" *)
  21526.   end;
  21527.  
  21528.   TDMus_IO_NextChord = packed record
  21529.     dwFlags:       DWORD;
  21530.     nWeight:       WORD;
  21531.     wMinBeats:     WORD;
  21532.     wMaxBeats:     WORD;
  21533.     wConnectionID: WORD;     (* points to an ioChordEntry *)
  21534.   end;
  21535.  
  21536.   TDMus_IO_ChordMap_SignPost = packed record
  21537.     dwChords: DWORD;     (* 1bit per group *)
  21538.     dwFlags:  DWORD;
  21539.   end;
  21540.  
  21541. (* Legacy name... *)
  21542.   TDMus_IO_Pers_SignPost = TDMus_IO_ChordMap_SignPost;
  21543.  
  21544. (*
  21545. RIFF
  21546. (
  21547.     'DMPR'
  21548.     <perh-ck>           // Chord map header chunk
  21549.     [<guid-ck>]         // guid chunk
  21550.     [<vers-ck>]         // version chunk (two DWORDS)
  21551.     [<UNFO-list>]       // Unfo chunk
  21552.     <chdt-ck>           // subchord database
  21553.     <chpl-list>         // chord palette
  21554.     <cmap-list>         // chord map
  21555.     <spsq-list>         // signpost list
  21556.  )
  21557.  
  21558. <cmap-list> ::= LIST('cmap' <choe-list> )
  21559.  
  21560. <choe-list> ::= LIST('choe'
  21561.                                 <cheh-ck>   // chord entry data
  21562.                                 <chrd-list> // chord definition
  21563.                                 <ncsq-ck>   // connecting(next) chords
  21564.                      )
  21565.  
  21566. <chrd-list> ::= LIST('chrd'
  21567.                                 <INAM-ck>   // name of chord in wide char format
  21568.                                 <sbcn-ck>   // list of subchords composing chord
  21569.                     )
  21570.  
  21571. <chpl-list> ::= LIST('chpl'
  21572.                                 <chrd-list> ... // chord definition
  21573.                     )
  21574.  
  21575. <spsq-list> ::== LIST('spsq' <spst-list> ... )
  21576.  
  21577. <spst-list> ::= LIST('spst'
  21578.                              <spsh-ck>
  21579.                              <chrd-list>
  21580.                              [<cade-list>]
  21581.                     )
  21582.  
  21583. <cade-list> ::= LIST('cade' <chrd-list> ...)
  21584.  
  21585. <perh-ck> ::= perh(<DMUS_IO_CHORDMAP>)
  21586.  
  21587. <chdt-ck> ::= chdt(<cbChordSize::WORD>
  21588.                    <DMUS_IO_PERS_SUBCHORD> ... )
  21589.  
  21590. <cheh-ck> ::= cheh(<DMUS_IO_CHORDENTRY>)
  21591.  
  21592. <sbcn-ck> ::= sbcn(<cSubChordID:WORD> ...)
  21593.  
  21594. <ncsq-ck> ::= ncsq(<wNextChordSize:WORD>
  21595.                    <DMUS_IO_NEXTCHORD>...)
  21596.  
  21597. <spsh-ck> ::= spsh(<DMUS_IO_PERS_SIGNPOST>)
  21598.  
  21599. *)
  21600.  
  21601. (* Signpost tracks *)
  21602. const
  21603.   DMUS_FOURCC_SIGNPOST_TRACK_CHUNK    : mmioFOURCC = ( 's', 'g', 'n', 'p' );
  21604.  
  21605. type
  21606.   TDMus_IO_SignPost = packed record
  21607.     mtTime:   TMusic_Time;
  21608.     dwChords: DWORD;
  21609.     wMeasure: WORD;
  21610.   end;
  21611.  
  21612. (*
  21613.  
  21614.     // <sgnp-list>
  21615.     'sgnp'
  21616.     (
  21617.         //sizeof DMUS_IO_SIGNPOST: DWORD
  21618.         <DMUS_IO_SIGNPOST>...
  21619.     )
  21620.  
  21621. *)
  21622.  
  21623. const
  21624.   DMUS_FOURCC_MUTE_CHUNK  : mmioFOURCC = ('m','u','t','e');
  21625.  
  21626. type
  21627.   TDMus_IO_Mute = packed record
  21628.     mtTime: TMusic_Time;
  21629.     dwPChannel:    DWORD;
  21630.     dwPChannelMap: DWORD;
  21631.   end;
  21632.  
  21633. (*
  21634.  
  21635.     // <mute-list>
  21636.     'mute'
  21637.     (
  21638.         //sizeof DMUS_IO_MUTE:DWORD
  21639.         <DMUS_IO_MUTE>...
  21640.     )
  21641.  
  21642.  
  21643. *)
  21644.  
  21645. const
  21646. (* Used for both style and chord map tracks *)
  21647.  
  21648.   DMUS_FOURCC_TIME_STAMP_CHUNK   : mmioFOURCC = ('s', 't', 'm', 'p');
  21649.  
  21650. (* Style tracks *)
  21651.  
  21652.   DMUS_FOURCC_STYLE_TRACK_LIST   : mmioFOURCC = ('s', 't', 't', 'r');
  21653.   DMUS_FOURCC_STYLE_REF_LIST     : mmioFOURCC = ('s', 't', 'r', 'f');
  21654.  
  21655. (*
  21656.  
  21657.     // <sttr-list>
  21658.     LIST('sttr'
  21659.     (
  21660.         // some number of <strf-list>
  21661.     )
  21662.  
  21663.     // <strf-list>
  21664.     LIST('strf'
  21665.     (
  21666.         <stmp-ck>
  21667.         <DMRF>
  21668.     )
  21669.  
  21670.     // <stmp-ck> defined in ..\dmcompos\dmcompp.h
  21671.  
  21672. *)
  21673.  
  21674. (* Chord map tracks *)
  21675.  
  21676.   DMUS_FOURCC_PERS_TRACK_LIST : mmioFOURCC = ('p', 'f', 't', 'r');
  21677.   DMUS_FOURCC_PERS_REF_LIST   : mmioFOURCC = ('p', 'f', 'r', 'f');
  21678.  
  21679. (*
  21680.  
  21681.     // <pftr-list>
  21682.     LIST('pftr'
  21683.     (
  21684.         // some number of <pfrf-list>
  21685.     )
  21686.  
  21687.     // <pfrf-list>
  21688.     LIST('pfrf'
  21689.     (
  21690.         <stmp-ck>
  21691.         <DMRF>
  21692.     )
  21693.  
  21694.   // <stmp-ck>
  21695.   'stmp'
  21696.   (
  21697.     // time:DWORD
  21698.   )
  21699.  
  21700.  
  21701.  
  21702. *)
  21703.  
  21704.   DMUS_FOURCC_TEMPO_TRACK    : mmioFOURCC = ('t','e','t','r');
  21705.  
  21706. (*
  21707.     // tempo list
  21708.     'tetr'
  21709.     (
  21710.         // sizeof DMUS_IO_TEMPO_ITEM: DWORD
  21711.         <DMUS_IO_TEMPO_ITEM>...
  21712.     )
  21713.   *)
  21714.  
  21715.   DMUS_FOURCC_SEQ_TRACK      : mmioFOURCC = ('s','e','q','t');
  21716.   DMUS_FOURCC_SEQ_LIST       : mmioFOURCC = ('e','v','t','l');
  21717.   DMUS_FOURCC_CURVE_LIST     : mmioFOURCC = ('c','u','r','l');
  21718.  
  21719. (*
  21720.     // sequence track
  21721.     'seqt'
  21722.     (
  21723.         // sequence list
  21724.         'evtl'
  21725.         (
  21726.             // sizeof DMUS_IO_SEQ_ITEM: DWORD
  21727.             <DMUS_IO_SEQ_ITEM>...
  21728.         )
  21729.         // curve list
  21730.         'curl'
  21731.         (
  21732.             // sizeof DMUS_IO_CURVE_ITEM: DWORD
  21733.             <DMUS_IO_CURVE_ITEM>...
  21734.         )
  21735.     )
  21736. *)
  21737.  
  21738.   DMUS_FOURCC_SYSEX_TRACK    : mmioFOURCC = ('s','y','e','x');
  21739.  
  21740. (*
  21741.     // sysex track
  21742.     'syex'
  21743.     (
  21744.         // list of:
  21745.         // {
  21746.         //      <DMUS_IO_SYSEX_ITEM>
  21747.         //      sys-ex: data
  21748.         // }...
  21749.     )
  21750. *)
  21751.  
  21752.   DMUS_FOURCC_TIMESIGNATURE_TRACK : mmioFOURCC = ('t','i','m','s');
  21753.  
  21754. (*
  21755.     // time signature track
  21756.     'tims'
  21757.     (
  21758.         // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD
  21759.         <DMUS_IO_TIMESIGNATURE_ITEM>...
  21760.     )
  21761. *)
  21762.  
  21763. (***************************************************************************
  21764. *                                                                          *
  21765. *   DMusBuff.h -- This module defines the buffer format for DirectMusic    *
  21766. *                 Shared file between user mode and kernel mode components *
  21767. *                                                                          *
  21768. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.               *
  21769. *                                                                          *
  21770. ***************************************************************************)
  21771.  
  21772. (* The number of bytes to allocate for an event with 'cb' data bytes.
  21773.  *)
  21774. function QWORD_ALIGN(x: DWORD) : DWORD;
  21775.  
  21776. function DMUS_EVENT_SIZE(cb: DWORD) : DWORD;
  21777.  
  21778.  
  21779.  
  21780. Implementation
  21781.  
  21782. //DirectDraw file
  21783.  
  21784.  
  21785. {
  21786. #define GET_WHQL_YEAR( dwWHQLLevel ) \
  21787.     ( (dwWHQLLevel) / 0x10000 )
  21788. #define GET_WHQL_MONTH( dwWHQLLevel ) \
  21789.     ( ( (dwWHQLLevel) / 0x100 ) & 0x00ff )
  21790. #define GET_WHQL_DAY( dwWHQLLevel ) \
  21791.     ( (dwWHQLLevel) & 0xff )
  21792. }
  21793. function GET_WHQL_YEAR(dwWHQLLevel: DWORD) : DWORD;
  21794. begin
  21795.   Result := (dwWHQLLevel) div $10000;
  21796. end;
  21797.  
  21798. function GET_WHQL_MONTH(dwWHQLLevel: DWORD) : DWORD;
  21799. begin
  21800.   Result := ( (dwWHQLLevel) div $100 ) and $00ff;
  21801. end;
  21802.  
  21803. function GET_WHQL_DAY(dwWHQLLevel: DWORD) : DWORD;
  21804. begin
  21805.   Result := (dwWHQLLevel) and $ff;
  21806. end;
  21807.  
  21808.  
  21809. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
  21810. begin
  21811.   Result := DWORD(byte(ch0) shl 0) or
  21812.             DWORD(byte(ch1) shl 8) or
  21813.             DWORD(byte(ch2) shl 16) or
  21814.             DWORD(byte(ch3) shl 24);
  21815. end;
  21816.  
  21817. function DDErrorString(Value: HResult) : string;
  21818. begin
  21819.   case Value of
  21820.     DD_OK: Result := 'The request completed successfully.';
  21821.     DDERR_ALREADYINITIALIZED: Result := 'This object is already initialized.';
  21822.     DDERR_BLTFASTCANTCLIP: Result := ' if a clipper object is attached to the source surface passed into a BltFast call.';
  21823.     DDERR_CANNOTATTACHSURFACE: Result := 'This surface can not be attached to the requested surface.';
  21824.     DDERR_CANNOTDETACHSURFACE: Result := 'This surface can not be detached from the requested surface.';
  21825.     DDERR_CANTCREATEDC: Result := 'Windows can not create any more DCs.';
  21826.     DDERR_CANTDUPLICATE: Result := 'Cannot duplicate primary & 3D surfaces, or surfaces that are implicitly created.';
  21827.     DDERR_CLIPPERISUSINGHWND: Result := 'An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.';
  21828.     DDERR_COLORKEYNOTSET: Result := 'No src color key specified for this operation.';
  21829.     DDERR_CURRENTLYNOTAVAIL: Result := 'Support is currently not available.';
  21830.     DDERR_DIRECTDRAWALREADYCREATED: Result := 'A DirectDraw object representing this driver has already been created for this process.';
  21831.     DDERR_EXCEPTION: Result := 'An exception was encountered while performing the requested operation.';
  21832.     DDERR_EXCLUSIVEMODEALREADYSET: Result := 'An attempt was made to set the cooperative level when it was already set to exclusive.';
  21833.     DDERR_GENERIC: Result := 'Generic failure.';
  21834.     DDERR_HEIGHTALIGN: Result := 'Height of rectangle provided is not a multiple of reqd alignment.';
  21835.     DDERR_HWNDALREADYSET: Result := 'The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.';
  21836.     DDERR_HWNDSUBCLASSED: Result := 'HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.';
  21837.     DDERR_IMPLICITLYCREATED: Result := 'This surface can not be restored because it is an implicitly created surface.';
  21838.     DDERR_INCOMPATIBLEPRIMARY: Result := 'Unable to match primary surface creation request with existing primary surface.';
  21839.     DDERR_INVALIDCAPS: Result := 'One or more of the caps bits passed to the callback are incorrect.';
  21840.     DDERR_INVALIDCLIPLIST: Result := 'DirectDraw does not support the provided cliplist.';
  21841.     DDERR_INVALIDDIRECTDRAWGUID: Result := 'The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.';
  21842.     DDERR_INVALIDMODE: Result := 'DirectDraw does not support the requested mode.';
  21843.     DDERR_INVALIDOBJECT: Result := 'DirectDraw received a pointer that was an invalid DIRECTDRAW object.';
  21844.     DDERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the function are incorrect.';
  21845.     DDERR_INVALIDPIXELFORMAT: Result := 'The pixel format was invalid as specified.';
  21846.     DDERR_INVALIDPOSITION: Result := 'Returned when the position of the overlay on the destination is no longer legal for that destination.';
  21847.     DDERR_INVALIDRECT: Result := 'Rectangle provided was invalid.';
  21848.     DDERR_LOCKEDSURFACES: Result := 'Operation could not be carried out because one or more surfaces are locked.';
  21849.     DDERR_NO3D: Result := 'There is no 3D present.';
  21850.     DDERR_NOALPHAHW: Result := 'Operation could not be carried out because there is no alpha accleration hardware present or available.';
  21851.     DDERR_NOBLTHW: Result := 'No blitter hardware present.';
  21852.     DDERR_NOCLIPLIST: Result := 'No cliplist available.';
  21853.     DDERR_NOCLIPPERATTACHED: Result := 'No clipper object attached to surface object.';
  21854.     DDERR_NOCOLORCONVHW: Result := 'Operation could not be carried out because there is no color conversion hardware present or available.';
  21855.     DDERR_NOCOLORKEY: Result := 'Surface does not currently have a color key';
  21856.     DDERR_NOCOLORKEYHW: Result := 'Operation could not be carried out because there is no hardware support of the destination color key.';
  21857.     DDERR_NOCOOPERATIVELEVELSET: Result := 'Create function called without DirectDraw object method SetCooperativeLevel being called.';
  21858.     DDERR_NODC: Result := 'No DC was ever created for this surface.';
  21859.     DDERR_NODDROPSHW: Result := 'No DirectDraw ROP hardware.';
  21860.     DDERR_NODIRECTDRAWHW: Result := 'A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.';
  21861.     DDERR_NOEMULATION: Result := 'Software emulation not available.';
  21862.     DDERR_NOEXCLUSIVEMODE: Result := 'Operation requires the application to have exclusive mode but the application does not have exclusive mode.';
  21863.     DDERR_NOFLIPHW: Result := 'Flipping visible surfaces is not supported.';
  21864.     DDERR_NOGDI: Result := 'There is no GDI present.';
  21865.     DDERR_NOHWND: Result := 'Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.';
  21866.     DDERR_NOMIRRORHW: Result := 'Operation could not be carried out because there is no hardware present or available.';
  21867.     DDERR_NOOVERLAYDEST: Result := 'Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.';
  21868.     DDERR_NOOVERLAYHW: Result := 'Operation could not be carried out because there is no overlay hardware present or available.';
  21869.     DDERR_NOPALETTEATTACHED: Result := 'No palette object attached to this surface.';
  21870.     DDERR_NOPALETTEHW: Result := 'No hardware support for 16 or 256 color palettes.';
  21871.     DDERR_NORASTEROPHW: Result := 'Operation could not be carried out because there is no appropriate raster op hardware present or available.';
  21872.     DDERR_NOROTATIONHW: Result := 'Operation could not be carried out because there is no rotation hardware present or available.';
  21873.     DDERR_NOSTRETCHHW: Result := 'Operation could not be carried out because there is no hardware support for stretching.';
  21874.     DDERR_NOT4BITCOLOR: Result := 'DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.';
  21875.     DDERR_NOT4BITCOLORINDEX: Result := 'DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.';
  21876.     DDERR_NOT8BITCOLOR: Result := 'DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.';
  21877.     DDERR_NOTAOVERLAYSURFACE: Result := 'Returned when an overlay member is called for a non-overlay surface.';
  21878.     DDERR_NOTEXTUREHW: Result := 'Operation could not be carried out because there is no texture mapping hardware present or available.';
  21879.     DDERR_NOTFLIPPABLE: Result := 'An attempt has been made to flip a surface that is not flippable.';
  21880.     DDERR_NOTFOUND: Result := 'Requested item was not found.';
  21881.     DDERR_NOTLOCKED: Result := 'Surface was not locked.  An attempt to unlock a surface that was not locked at all, or by this process, has been attempted.';
  21882.     DDERR_NOTPALETTIZED: Result := 'The surface being used is not a palette-based surface.';
  21883.     DDERR_NOVSYNCHW: Result := 'Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.';
  21884.     DDERR_NOZBUFFERHW: Result := 'Operation could not be carried out because there is no hardware support for zbuffer blitting.';
  21885.     DDERR_NOZOVERLAYHW: Result := 'Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.';
  21886.     DDERR_OUTOFCAPS: Result := 'The hardware needed for the requested operation has already been allocated.';
  21887.     DDERR_OUTOFMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.';
  21888.     DDERR_OUTOFVIDEOMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.';
  21889.     DDERR_OVERLAYCANTCLIP: Result := 'The hardware does not support clipped overlays.';
  21890.     DDERR_OVERLAYCOLORKEYONLYONEACTIVE: Result := 'Can only have ony color key active at one time for overlays.';
  21891.     DDERR_OVERLAYNOTVISIBLE: Result := 'Returned when GetOverlayPosition is called on a hidden overlay.';
  21892.     DDERR_PALETTEBUSY: Result := 'Access to this palette is being refused because the palette is already locked by another thread.';
  21893.     DDERR_PRIMARYSURFACEALREADYEXISTS: Result := 'This process already has created a primary surface.';
  21894.     DDERR_REGIONTOOSMALL: Result := 'Region passed to Clipper::GetClipList is too small.';
  21895.     DDERR_SURFACEALREADYATTACHED: Result := 'This surface is already attached to the surface it is being attached to.';
  21896.     DDERR_SURFACEALREADYDEPENDENT: Result := 'This surface is already a dependency of the surface it is being made a dependency of.';
  21897.     DDERR_SURFACEBUSY: Result := 'Access to this surface is being refused because the surface is already locked by another thread.';
  21898.     DDERR_SURFACEISOBSCURED: Result := 'Access to surface refused because the surface is obscured.';
  21899.     DDERR_SURFACELOST: Result := 'Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.';
  21900.     DDERR_SURFACENOTATTACHED: Result := 'The requested surface is not attached.';
  21901.     DDERR_TOOBIGHEIGHT: Result := 'Height requested by DirectDraw is too large.';
  21902.     DDERR_TOOBIGSIZE: Result := 'Size requested by DirectDraw is too large, but the individual height and width are OK.';
  21903.     DDERR_TOOBIGWIDTH: Result := 'Width requested by DirectDraw is too large.';
  21904.     DDERR_UNSUPPORTED: Result := 'Action not supported.';
  21905.     DDERR_UNSUPPORTEDFORMAT: Result := 'FOURCC format requested is unsupported by DirectDraw.';
  21906.     DDERR_UNSUPPORTEDMASK: Result := 'Bitmask in the pixel format requested is unsupported by DirectDraw.';
  21907.     DDERR_VERTICALBLANKINPROGRESS: Result := 'Vertical blank is in progress.';
  21908.     DDERR_WASSTILLDRAWING: Result := 'Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.';
  21909.     DDERR_WRONGMODE: Result := 'This surface can not be restored because it was created in a different mode.';
  21910.     DDERR_XALIGN: Result := 'Rectangle provided was not horizontally aligned on required boundary.';
  21911.     // new:
  21912.     DDERR_OVERLAPPINGRECTS: Result := 'Operation could not be carried out because the source and destination rectangles are on the same surface and overlap each other.';
  21913.     DDERR_INVALIDSTREAM: Result := 'The specified stream contains invalid data';
  21914.     DDERR_UNSUPPORTEDMODE: Result := 'The display is currently in an unsupported mode';
  21915.     DDERR_NOMIPMAPHW: Result := 'Operation could not be carried out because there is no mip-map texture mapping hardware present or available.';
  21916.     DDERR_INVALIDSURFACETYPE: Result := 'The requested action could not be performed because the surface was of the wrong type.';
  21917.     DDERR_NOOPTIMIZEHW: Result := 'Device does not support optimized surfaces, therefore no video memory optimized surfaces';
  21918.     DDERR_NOTLOADED: Result := 'Surface is an optimized surface, but has not yet been allocated any memory';
  21919.     DDERR_NOFOCUSWINDOW: Result := 'Attempt was made to create or set a device window without first setting the focus window';
  21920.     DDERR_DCALREADYCREATED: Result := 'A DC has already been returned for this surface. Only one DC can be retrieved per surface.';
  21921.     DDERR_NONONLOCALVIDMEM: Result := 'An attempt was made to allocate non-local video memory from a device that does not support non-local video memory.';
  21922.     DDERR_CANTPAGELOCK: Result := 'The attempt to page lock a surface failed.';
  21923.     DDERR_CANTPAGEUNLOCK: Result := 'The attempt to page unlock a surface failed.';
  21924.     DDERR_NOTPAGELOCKED: Result := 'An attempt was made to page unlock a surface with no outstanding page locks.';
  21925.     DDERR_MOREDATA: Result := 'There is more data available than the specified buffer size could hold';
  21926.     DDERR_EXPIRED: Result := 'The data has expired and is therefore no longer valid.';
  21927.     DDERR_VIDEONOTACTIVE: Result := 'The video port is not active';
  21928.     DDERR_DEVICEDOESNTOWNSURFACE: Result := 'Surfaces created by one direct draw device cannot be used directly by another direct draw device.';
  21929.     DDERR_NOTINITIALIZED: Result := 'An attempt was made to invoke an interface member of a DirectDraw object created by CoCreateInstance() before it was initialized.';
  21930.     else Result := 'Unrecognized Error';
  21931.   end;
  21932. end;
  21933.  
  21934. //Direct3D file
  21935.  
  21936. function DXFileErrorString(Value: HResult) : string;
  21937. begin
  21938.   case Value of
  21939.     DXFILE_OK: Result := 'Command completed successfully. Equivalent to DD_OK.';
  21940.     DXFILEERR_BADVALUE: Result := 'Parameter is invalid.';
  21941.     DXFILEERR_BADTYPE: Result := 'Object type is invalid.';
  21942.     DXFILEERR_BADALLOC: Result := 'Memory allocation failed.';
  21943.     DXFILEERR_NOTFOUND: Result := 'Object could not be found.';
  21944.     DXFILEERR_FILENOTFOUND: Result := 'File could not be found.';
  21945.     DXFILEERR_RESOURCENOTFOUND: Result := 'Resource could not be found.';
  21946.     DXFILEERR_URLNOTFOUND: Result := 'URL could not be found.';
  21947.     DXFILEERR_BADRESOURCE: Result := 'Resource is invalid.';
  21948.     DXFILEERR_BADFILETYPE: Result := 'File is not a DirectX file.';
  21949.     DXFILEERR_BADFILEVERSION: Result := 'File version is not valid.';
  21950.     DXFILEERR_BADFILEFLOATSIZE: Result := 'Floating-point size is invalid.';
  21951.     DXFILEERR_BADFILE: Result := 'File is invalid.';
  21952.     DXFILEERR_PARSEERROR: Result := 'File could not be parsed.';
  21953.     DXFILEERR_BADARRAYSIZE: Result := 'Array size is invalid.';
  21954.     DXFILEERR_BADDATAREFERENCE: Result := 'Data reference is invalid.';
  21955.     DXFILEERR_NOMOREOBJECTS: Result := 'All objects have been enumerated.';
  21956.     DXFILEERR_NOMOREDATA: Result := 'No further data is available.';
  21957.     else Result := 'Unrecognized Error';
  21958.   end;
  21959. end;
  21960.  
  21961. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD) : DWORD;
  21962. begin
  21963.   Result := (D3DFVF_TEXTUREFORMAT3 shl (CoordIndex*2 + 16));
  21964. end;
  21965.  
  21966. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD) : DWORD;
  21967. begin
  21968.   Result := (D3DFVF_TEXTUREFORMAT2);
  21969. end;
  21970.  
  21971. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD) : DWORD;
  21972. begin
  21973.   Result := (D3DFVF_TEXTUREFORMAT4 shl (CoordIndex*2 + 16));
  21974. end;
  21975.  
  21976. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD) : DWORD;
  21977. begin
  21978.   Result := (D3DFVF_TEXTUREFORMAT1 shl (CoordIndex*2 + 16));
  21979. end;
  21980.  
  21981.  
  21982. function D3DVal(val: variant) : float;
  21983. begin
  21984.   Result := val;
  21985. end;
  21986.  
  21987. function D3DDivide(a,b: double) : float;
  21988. begin
  21989.   Result := a / b;
  21990. end;
  21991.  
  21992. function D3DMultiply(a,b: double) : float;
  21993. begin
  21994.   Result := a * b;
  21995. end;
  21996.  
  21997. // #define CI_GETALPHA(ci)    ((ci) >> 24)
  21998. function CI_GETALPHA(ci: DWORD) : DWORD;
  21999. begin
  22000.   Result := ci shr 24;
  22001. end;
  22002.  
  22003. // #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
  22004. function CI_GETINDEX(ci: DWORD) : DWORD;
  22005. begin
  22006.   Result := (ci shr 8) and $ffff;
  22007. end;
  22008.  
  22009. // #define CI_GETFRACTION(ci) ((ci) & 0xff)
  22010. function CI_GETFRACTION(ci: DWORD) : DWORD;
  22011. begin
  22012.   Result := ci and $ff;
  22013. end;
  22014.  
  22015. // #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
  22016. function CI_ROUNDINDEX(ci: DWORD) : DWORD;
  22017. begin
  22018.   Result := CI_GETINDEX(ci + $80);
  22019. end;
  22020.  
  22021. // #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
  22022. function CI_MASKALPHA(ci: DWORD) : DWORD;
  22023. begin
  22024.   Result := ci and $ffffff;
  22025. end;
  22026.  
  22027. // #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
  22028. function CI_MAKE(a,i,f: DWORD) : DWORD;
  22029. begin
  22030.   Result := (a shl 24) or (i shl 8) or f;
  22031. end;
  22032.  
  22033. // #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
  22034. function RGBA_GETALPHA(rgb: TD3DColor) : DWORD;
  22035. begin
  22036.   Result := rgb shr 24;
  22037. end;
  22038.  
  22039. // #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
  22040. function RGBA_GETRED(rgb: TD3DColor) : DWORD;
  22041. begin
  22042.   Result := (rgb shr 16) and $ff;
  22043. end;
  22044.  
  22045. // #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
  22046. function RGBA_GETGREEN(rgb: TD3DColor) : DWORD;
  22047. begin
  22048.   Result := (rgb shr 8) and $ff;
  22049. end;
  22050.  
  22051. // #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
  22052. function RGBA_GETBLUE(rgb: TD3DColor) : DWORD;
  22053. begin
  22054.   Result := rgb and $ff;
  22055. end;
  22056.  
  22057. // #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  22058. function RGBA_MAKE(r, g, b, a: DWORD) : TD3DColor;
  22059. begin
  22060.   Result := (a shl 24) or (r shl 16) or (g shl 8) or b;
  22061. end;
  22062.  
  22063. // #define D3DRGB(r, g, b) \
  22064. //     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  22065. function D3DRGB(r, g, b: float) : TD3DColor;
  22066. begin
  22067.   Result := $ff000000 or (round(r * 255) shl 16)
  22068.                       or (round(g * 255) shl 8)
  22069.                       or round(b * 255);
  22070. end;
  22071.  
  22072. // #define D3DRGBA(r, g, b, a) \
  22073. //     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
  22074. //     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
  22075. //    )
  22076. function D3DRGBA(r, g, b, a: float) : TD3DColor;
  22077. begin
  22078.   Result := (round(a * 255) shl 24) or (round(r * 255) shl 16)
  22079.                                     or (round(g * 255) shl 8)
  22080.                                     or round(b * 255);
  22081. end;
  22082.  
  22083. // #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
  22084. function RGB_GETRED(rgb: TD3DColor) : DWORD;
  22085. begin
  22086.   Result := (rgb shr 16) and $ff;
  22087. end;
  22088.  
  22089. // #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
  22090. function RGB_GETGREEN(rgb: TD3DColor) : DWORD;
  22091. begin
  22092.   Result := (rgb shr 8) and $ff;
  22093. end;
  22094.  
  22095. // #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
  22096. function RGB_GETBLUE(rgb: TD3DColor) : DWORD;
  22097. begin
  22098.   Result := rgb and $ff;
  22099. end;
  22100.  
  22101. // #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
  22102. function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD) : TD3DColor;
  22103. begin
  22104.   Result := (x shl 24) or (rgba and $00ffffff);
  22105. end;
  22106.  
  22107. // #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
  22108. function RGB_MAKE(r, g, b: DWORD) : TD3DColor;
  22109. begin
  22110.   Result := (r shl 16) or (g shl 8) or b;
  22111. end;
  22112.  
  22113. // #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
  22114. function RGBA_TORGB(rgba: TD3DColor) : TD3DColor;
  22115. begin
  22116.   Result := rgba and $00ffffff;
  22117. end;
  22118.  
  22119. // #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
  22120. function RGB_TORGBA(rgb: TD3DColor) : TD3DColor;
  22121. begin
  22122.   Result := rgb or $ff000000;
  22123. end;
  22124.  
  22125.  
  22126. function D3DSTATE_OVERRIDE(StateType: DWORD) : DWORD;
  22127. begin
  22128.   Result := StateType + D3DSTATE_OVERRIDE_BIAS;
  22129. end;
  22130.  
  22131. function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
  22132. begin
  22133.   if not (len in [1..29]) then len := 0;
  22134.   result := len;
  22135. end;
  22136.  
  22137. // #define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y))
  22138. function D3DRENDERSTATE_STIPPLEPATTERN(y: integer) : TD3DRenderStateType;
  22139. begin
  22140.   Result := TD3DRenderStateType(Ord(D3DRENDERSTATE_STIPPLEPATTERN00) + y);
  22141. end;
  22142.  
  22143.  
  22144.  
  22145.  
  22146.     // Addition and subtraction
  22147. function VectorAdd(const v1, v2: TD3DVector) : TD3DVector;
  22148. begin
  22149.   result.x := v1.x+v2.x;
  22150.   result.y := v1.y+v2.y;
  22151.   result.z := v1.z+v2.z;
  22152. end;
  22153.  
  22154. function VectorSub(const v1, v2: TD3DVector) : TD3DVector;
  22155. begin
  22156.   result.x := v1.x-v2.x;
  22157.   result.y := v1.y-v2.y;
  22158.   result.z := v1.z-v2.z;
  22159. end;
  22160.  
  22161.     // Scalar multiplication and division
  22162. function VectorMulS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  22163. begin
  22164.   result.x := v.x*s;
  22165.   result.y := v.y*s;
  22166.   result.z := v.z*s;
  22167. end;
  22168.  
  22169. function VectorDivS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  22170. begin
  22171.   result.x := v.x/s;
  22172.   result.y := v.y/s;
  22173.   result.z := v.z/s;
  22174. end;
  22175.  
  22176.     // Memberwise multiplication and division
  22177. function VectorMul(const v1, v2: TD3DVector) : TD3DVector;
  22178. begin
  22179.   result.x := v1.x*v2.x;
  22180.   result.y := v1.y*v2.y;
  22181.   result.z := v1.z*v2.z;
  22182. end;
  22183.  
  22184. function VectorDiv(const v1, v2: TD3DVector) : TD3DVector;
  22185. begin
  22186.   result.x := v1.x/v2.x;
  22187.   result.y := v1.y/v2.y;
  22188.   result.z := v1.z/v2.z;
  22189. end;
  22190.  
  22191.     // Vector dominance
  22192. function VectorSmaller(v1, v2: TD3DVector) : boolean;
  22193. begin
  22194.   result := (v1.x < v2.x) and (v1.y < v2.y) and (v1.z < v2.z);
  22195. end;
  22196.  
  22197. function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
  22198. begin
  22199.   result := (v1.x <= v2.x) and (v1.y <= v2.y) and (v1.z <= v2.z);
  22200. end;
  22201.  
  22202.     // Bitwise equality
  22203. function VectorEquel(v1, v2: TD3DVector) : boolean;
  22204. begin
  22205.   result := (v1.x = v2.x) and (v1.y = v2.y) and (v1.z = v2.z);
  22206. end;
  22207.  
  22208.     // Length-related functions
  22209. function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
  22210. begin
  22211.   result := (v.x*v.x) + (v.y*v.y) + (v.z*v.z);
  22212. end;
  22213.  
  22214. function VectorMagnitude(v: TD3DVector) : TD3DValue;
  22215. begin
  22216.   result := sqrt((v.x*v.x) + (v.y*v.y) + (v.z*v.z));
  22217. end;
  22218.  
  22219.     // Returns vector with same direction and unit length
  22220. function VectorNormalize(const v: TD3DVector) : TD3DVector;
  22221. begin
  22222.   result := VectorDivS(v,VectorMagnitude(v));
  22223. end;
  22224.  
  22225.     // Return min/max component of the input vector
  22226. function VectorMin(v: TD3DVector) : TD3DValue;
  22227. var
  22228.   ret : TD3DValue;
  22229. begin
  22230.   ret := v.x;
  22231.   if (v.y < ret) then ret := v.y;
  22232.   if (v.z < ret) then ret := v.z;
  22233.   result := ret;
  22234. end;
  22235.  
  22236. function VectorMax(v: TD3DVector) : TD3DValue;
  22237. var
  22238.   ret : TD3DValue;
  22239. begin
  22240.   ret := v.x;
  22241.   if (ret < v.y) then ret := v.y;
  22242.   if (ret < v.z) then ret := v.z;
  22243.   result := ret;
  22244. end;
  22245.  
  22246.     // Return memberwise min/max of input vectors
  22247. function VectorMinimize(const v1, v2: TD3DVector) : TD3DVector;
  22248. begin
  22249.   if v1.x < v2.x then result.x := v1.x else result.x := v2.x;
  22250.   if v1.y < v2.y then result.y := v1.y else result.y := v2.y;
  22251.   if v1.z < v2.z then result.z := v1.z else result.z := v2.z;
  22252. end;
  22253.  
  22254. function VectorMaximize(const v1, v2: TD3DVector) : TD3DVector;
  22255. begin
  22256.   if v1.x > v2.x then result.x := v1.x else result.x := v2.x;
  22257.   if v1.y > v2.y then result.y := v1.y else result.y := v2.y;
  22258.   if v1.z > v2.z then result.z := v1.z else result.z := v2.z;
  22259. end;
  22260.  
  22261.     // Dot and cross product
  22262. function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
  22263. begin
  22264.   result := (v1.x*v2.x) + (v1.y * v2.y) + (v1.z*v2.z);
  22265. end;
  22266.  
  22267. function VectorCrossProduct(const v1, v2: TD3DVector) : TD3DVector;
  22268. begin
  22269.   result.x := (v1.y*v2.z) - (v1.z*v2.y);
  22270.   result.y := (v1.z*v2.x) - (v1.x*v2.z);
  22271.   result.z := (v1.x*v2.y) - (v1.y*v2.x);
  22272. end;
  22273.  
  22274. procedure DisableFPUExceptions;
  22275. var
  22276.   FPUControlWord: WORD;
  22277. asm
  22278.   FSTCW   FPUControlWord;
  22279.   OR      FPUControlWord, $4 + $1; { Divide by zero + invalid operation }
  22280.   FLDCW   FPUControlWord;
  22281. end;
  22282.  
  22283. procedure EnableFPUExceptions;
  22284. var
  22285.   FPUControlWord: WORD;
  22286. asm
  22287.   FSTCW   FPUControlWord;
  22288.   AND     FPUControlWord, $FFFF - $4 - $1; { Divide by zero + invalid operation }
  22289.   FLDCW   FPUControlWord;
  22290. end;
  22291.  
  22292. function D3DErrorString(Value: HResult) : string; //Full description not available yet
  22293. begin
  22294.   case Value of
  22295.     D3D_OK: Result := 'No error';
  22296.  
  22297.     D3DERR_BADMAJORVERSION: Result := 'D3DERR_BADMAJORVERSION';
  22298.     D3DERR_BADMINORVERSION: Result := 'D3DERR_BADMINORVERSION';
  22299.  
  22300.     D3DERR_INVALID_DEVICE: Result := 'D3DERR_INITFAILED';
  22301.     D3DERR_INITFAILED: Result := 'D3DERR_INITFAILED';
  22302.  
  22303.     D3DERR_DEVICEAGGREGATED: Result := 'D3DERR_DEVICEAGGREGATED';
  22304.  
  22305.     D3DERR_EXECUTE_CREATE_FAILED: Result := 'D3DERR_EXECUTE_CREATE_FAILED';
  22306.     D3DERR_EXECUTE_DESTROY_FAILED: Result := 'D3DERR_EXECUTE_DESTROY_FAILED';
  22307.     D3DERR_EXECUTE_LOCK_FAILED: Result := 'D3DERR_EXECUTE_LOCK_FAILED';
  22308.     D3DERR_EXECUTE_UNLOCK_FAILED: Result := 'D3DERR_EXECUTE_UNLOCK_FAILED';
  22309.     D3DERR_EXECUTE_LOCKED: Result := 'D3DERR_EXECUTE_LOCKED';
  22310.     D3DERR_EXECUTE_NOT_LOCKED: Result := 'D3DERR_EXECUTE_NOT_LOCKED';
  22311.  
  22312.     D3DERR_EXECUTE_FAILED: Result := 'D3DERR_EXECUTE_FAILED';
  22313.     D3DERR_EXECUTE_CLIPPED_FAILED: Result := 'D3DERR_EXECUTE_CLIPPED_FAILED';
  22314.  
  22315.     D3DERR_TEXTURE_NO_SUPPORT: Result := 'D3DERR_TEXTURE_NO_SUPPORT';
  22316.     D3DERR_TEXTURE_CREATE_FAILED: Result := 'D3DERR_TEXTURE_CREATE_FAILED';
  22317.     D3DERR_TEXTURE_DESTROY_FAILED: Result := 'D3DERR_TEXTURE_DESTROY_FAILED';
  22318.     D3DERR_TEXTURE_LOCK_FAILED: Result := 'D3DERR_TEXTURE_LOCK_FAILED';
  22319.     D3DERR_TEXTURE_UNLOCK_FAILED: Result := 'D3DERR_TEXTURE_UNLOCK_FAILED';
  22320.     D3DERR_TEXTURE_LOAD_FAILED: Result := 'D3DERR_TEXTURE_LOAD_FAILED';
  22321.     D3DERR_TEXTURE_SWAP_FAILED: Result := 'D3DERR_TEXTURE_SWAP_FAILED';
  22322.     D3DERR_TEXTURE_LOCKED: Result := 'D3DERR_TEXTURELOCKED';
  22323.     D3DERR_TEXTURE_NOT_LOCKED: Result := 'D3DERR_TEXTURE_NOT_LOCKED';
  22324.     D3DERR_TEXTURE_GETSURF_FAILED: Result := 'D3DERR_TEXTURE_GETSURF_FAILED';
  22325.  
  22326.     D3DERR_MATRIX_CREATE_FAILED: Result := 'D3DERR_MATRIX_CREATE_FAILED';
  22327.     D3DERR_MATRIX_DESTROY_FAILED: Result := 'D3DERR_MATRIX_DESTROY_FAILED';
  22328.     D3DERR_MATRIX_SETDATA_FAILED: Result := 'D3DERR_MATRIX_SETDATA_FAILED';
  22329.     D3DERR_MATRIX_GETDATA_FAILED: Result := 'D3DERR_MATRIX_GETDATA_FAILED';
  22330.     D3DERR_SETVIEWPORTDATA_FAILED: Result := 'D3DERR_SETVIEWPORTDATA_FAILED';
  22331.  
  22332.     D3DERR_INVALIDCURRENTVIEWPORT: Result := 'D3DERR_INVALIDCURRENTVIEWPORT';
  22333.     D3DERR_INVALIDPRIMITIVETYPE: Result := 'D3DERR_INVALIDPRIMITIVETYPE';
  22334.     D3DERR_INVALIDVERTEXTYPE: Result := 'D3DERR_INVALIDVERTEXTYPE';
  22335.     D3DERR_TEXTURE_BADSIZE: Result := 'D3DERR_TEXTURE_BADSIZE';
  22336.     D3DERR_INVALIDRAMPTEXTURE: Result := 'D3DERR_INVALIDRAMPTEXTURE';
  22337.  
  22338.     D3DERR_MATERIAL_CREATE_FAILED: Result := 'D3DERR_MATERIAL_CREATE_FAILED';
  22339.     D3DERR_MATERIAL_DESTROY_FAILED: Result := 'D3DERR_MATERIAL_DESTROY_FAILED';
  22340.     D3DERR_MATERIAL_SETDATA_FAILED: Result := 'D3DERR_MATERIAL_SETDATA_FAILED';
  22341.     D3DERR_MATERIAL_GETDATA_FAILED: Result := 'D3DERR_MATERIAL_GETDATA_FAILED';
  22342.  
  22343.     D3DERR_INVALIDPALETTE: Result := 'D3DERR_INVALIDPALETTE';
  22344.  
  22345.     D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY: Result := 'D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY';
  22346.     D3DERR_ZBUFF_NEEDS_VIDEOMEMORY: Result := 'D3DERR_ZBUFF_NEEDS_VIDEOMEMORY';
  22347.     D3DERR_SURFACENOTINVIDMEM: Result := 'D3DERR_SURFACENOTINVIDMEM';
  22348.  
  22349.     D3DERR_LIGHT_SET_FAILED: Result := 'D3DERR_LIGHT_SET_FAILED';
  22350.     D3DERR_LIGHTHASVIEWPORT: Result := 'D3DERR_LIGHTHASVIEWPORT';
  22351.     D3DERR_LIGHTNOTINTHISVIEWPORT: Result := 'D3DERR_LIGHTNOTINTHISVIEWPORT';
  22352.  
  22353.     D3DERR_SCENE_IN_SCENE: Result := 'D3DERR_SCENE_IN_SCENE';
  22354.     D3DERR_SCENE_NOT_IN_SCENE: Result := 'D3DERR_SCENE_NOT_IN_SCENE';
  22355.     D3DERR_SCENE_BEGIN_FAILED: Result := 'D3DERR_SCENE_BEGIN_FAILED';
  22356.     D3DERR_SCENE_END_FAILED: Result := 'D3DERR_SCENE_END_FAILED';
  22357.  
  22358.     D3DERR_INBEGIN: Result := 'D3DERR_INBEGIN';
  22359.     D3DERR_NOTINBEGIN: Result := 'D3DERR_NOTINBEGIN';
  22360.     D3DERR_NOVIEWPORTS: Result := 'D3DERR_NOVIEWPORTS';
  22361.     D3DERR_VIEWPORTDATANOTSET: Result := 'D3DERR_VIEWPORTDATANOTSET';
  22362.     D3DERR_VIEWPORTHASNODEVICE: Result := 'D3DERR_VIEWPORTHASNODEVICE';
  22363.     D3DERR_NOCURRENTVIEWPORT: Result := 'D3DERR_NOCURRENTVIEWPORT';
  22364.  
  22365.     D3DERR_INVALIDVERTEXFORMAT: Result := 'D3DERR_INVALIDVERTEXFORMAT';
  22366.  
  22367.     D3DERR_COLORKEYATTACHED: Result := 'D3DERR_COLORKEYATTACHED';
  22368.  
  22369.     D3DERR_VERTEXBUFFEROPTIMIZED: Result := 'D3DERR_VERTEXBUFFEROPTIMIZED';
  22370.     D3DERR_VBUF_CREATE_FAILED: Result := 'D3DERR_VBUF_CREATE_FAILED';
  22371.     D3DERR_VERTEXBUFFERLOCKED: Result := 'D3DERR_VERTEXBUFFERLOCKED';
  22372.  
  22373.     D3DERR_ZBUFFER_NOTPRESENT: Result := 'D3DERR_ZBUFFER_NOTPRESENT';
  22374.     D3DERR_STENCILBUFFER_NOTPRESENT: Result := 'D3DERR_STENCILBUFFER_NOTPRESENT';
  22375.  
  22376.     D3DERR_WRONGTEXTUREFORMAT: Result := 'D3DERR_WRONGTEXTUREFORMAT';
  22377.     D3DERR_UNSUPPORTEDCOLOROPERATION: Result := 'D3DERR_UNSUPPORTEDCOLOROPERATION';
  22378.     D3DERR_UNSUPPORTEDCOLORARG: Result := 'D3DERR_UNSUPPORTEDCOLORARG';
  22379.     D3DERR_UNSUPPORTEDALPHAOPERATION: Result := 'D3DERR_UNSUPPORTEDALPHAOPERATION';
  22380.     D3DERR_UNSUPPORTEDALPHAARG: Result := 'D3DERR_UNSUPPORTEDALPHAARG';
  22381.     D3DERR_TOOMANYOPERATIONS: Result := 'D3DERR_TOOMANYOPERATIONS';
  22382.     D3DERR_CONFLICTINGTEXTUREFILTER: Result := 'D3DERR_CONFLICTINGTEXTUREFILTER';
  22383.     D3DERR_UNSUPPORTEDFACTORVALUE: Result := 'D3DERR_UNSUPPORTEDFACTORVALUE';
  22384.  
  22385.     D3DERR_CONFLICTINGRENDERSTATE: Result := 'D3DERR_CONFLICTINGRENDERSTATE';
  22386.     D3DERR_UNSUPPORTEDTEXTUREFILTER: Result := 'D3DERR_UNSUPPORTEDTEXTUREFILTER';
  22387.     D3DERR_TOOMANYPRIMITIVES: Result := 'D3DERR_TOOMANYPRIMITIVES';
  22388.     D3DERR_INVALIDMATRIX: Result := 'D3DERR_INVALIDMATRIX';
  22389.     D3DERR_TOOMANYVERTICES: Result := 'D3DERR_TOOMANYVERTICES';
  22390.     D3DERR_CONFLICTINGTEXTUREPALETTE: Result := 'D3DERR_CONFLICTINGTEXTUREPALETTE';
  22391.  
  22392.     else Result := 'Unrecognized Error';
  22393.   end;
  22394. end;
  22395. {$IFDEF D3DRM}
  22396. //Direct3DRM file
  22397.  
  22398. (*==========================================================================;
  22399.  *
  22400.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  22401.  *
  22402.  *  File:       d3drmdef.h
  22403.  *  Content:    Direct3DRM include file
  22404.  *
  22405.  ***************************************************************************)
  22406.  
  22407. procedure D3DRMAnimationGetRotateKey
  22408.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  22409. begin
  22410.   rmQuat := rmKey.dqRotateKey;
  22411. end;
  22412.  
  22413. procedure D3DRMAnimationGetScaleKey
  22414.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  22415. begin
  22416.   dvVec := rmKey.dvScaleKey;
  22417. end;
  22418.  
  22419. procedure D3DRMAnimationGetPositionKey
  22420.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  22421. begin
  22422.   dvVec := rmKey.dvPositionKey;
  22423. end;
  22424.  
  22425. procedure D3DRMAnimatioSetRotateKey
  22426.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  22427. begin
  22428.   rmKey.dqRotateKey := rmQuat;
  22429. end;
  22430.  
  22431. procedure D3DRMAnimationSetScaleKey
  22432.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  22433. begin
  22434.   rmKey.dvScaleKey := dvVec;
  22435. end;
  22436.  
  22437. procedure D3DRMAnimationSetPositionKey
  22438.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  22439. begin
  22440.   rmKey.dvPositionKey := dvVec;
  22441. end;
  22442.  
  22443. (*==========================================================================;
  22444.  *
  22445.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  22446.  *
  22447.  *  File:       d3drm.h
  22448.  *  Content:    Direct3DRM include file
  22449.  *
  22450.  ***************************************************************************)
  22451.  
  22452. function D3DRMErrorString(Value: HResult) : string;
  22453. begin
  22454.   case Value of
  22455.     D3DRM_OK: Result := 'No error. Equivalent to DD_OK.';
  22456.     D3DRMERR_BADALLOC: Result := 'Out of memory.';
  22457.     D3DRMERR_BADDEVICE: Result := 'Device is not compatible with renderer.';
  22458.     D3DRMERR_BADFILE: Result := 'Data file is corrupt.';
  22459.     D3DRMERR_BADMAJORVERSION: Result := 'Bad DLL major version.';
  22460.     D3DRMERR_BADMINORVERSION: Result := 'Bad DLL minor version.';
  22461.     D3DRMERR_BADOBJECT: Result := 'Object expected in argument.';
  22462.     D3DRMERR_BADPMDATA: Result := 'The data in the .x file is corrupted. The conversion to a progressive mesh succeeded but produced an invalid progressive mesh in the .x file.';
  22463.     D3DRMERR_BADTYPE: Result := 'Bad argument type passed.';
  22464.     D3DRMERR_BADVALUE: Result := 'Bad argument value passed.';
  22465.     D3DRMERR_BOXNOTSET: Result := 'An attempt was made to access a bounding box (for example, with IDirect3DRMFrame3::GetBox) when no bounding box was set on the frame.';
  22466.     D3DRMERR_CLIENTNOTREGISTERED: Result := 'Client has not been registered. Call IDirect3DRM3::RegisterClient.';
  22467.     D3DRMERR_CONNECTIONLOST: Result := 'Data connection was lost during a load, clone, or duplicate.';
  22468.     D3DRMERR_ELEMENTINUSE: Result := 'Element can´t be modified or deleted while in use. To empty a submesh, call Empty() against its parent.';
  22469. //    D3DRMERR_ENTRYINUSE: Result := 'Vertex or normal entries are currently in use by a face and cannot be deleted.';
  22470.     D3DRMERR_FACEUSED: Result := 'Face already used in a mesh.';
  22471.     D3DRMERR_FILENOTFOUND: Result := 'File cannot be opened.';
  22472. //    D3DRMERR_INCOMPATIBLEKEY: Result := 'Specified animation key is incompatible. The key cannot be modified.';
  22473.     D3DRMERR_INVALIDLIBRARY: Result := 'Specified libary is invalid.';
  22474. //    D3DRMERR_INVALIDOBJECT: Result := 'Method received a pointer to an object that is invalid.';
  22475. //    D3DRMERR_INVALIDPARAMS: Result := 'One of the parameters passed to the method is invalid.';
  22476.     D3DRMERR_LIBRARYNOTFOUND: Result := 'Specified libary not found.';
  22477.     D3DRMERR_LOADABORTED: Result := 'Load aborted by user.';
  22478.     D3DRMERR_NOSUCHKEY: Result := 'Specified animation key does not exist.';
  22479.     D3DRMERR_NOTCREATEDFROMDDS: Result := 'Specified texture was not created from a DirectDraw Surface.';
  22480.     D3DRMERR_NOTDONEYET: Result := 'Unimplemented.';
  22481.     D3DRMERR_NOTENOUGHDATA: Result := 'Not enough data has been loaded to perform the requested operation.';
  22482.     D3DRMERR_NOTFOUND: Result := 'Object not found in specified place.';
  22483. //    D3DRMERR_OUTOFRANGE: Result := 'Specified value is out of range.';
  22484.     D3DRMERR_PENDING: Result := 'Data required to supply the requested information has not finished loading.';
  22485.     D3DRMERR_REQUESTTOOLARGE: Result := 'Attempt was made to set a level of detail in a progressive mesh greater than the maximum available.';
  22486.     D3DRMERR_REQUESTTOOSMALL: Result := 'Attempt was made to set the minimum rendering detail of a progressive mesh smaller than the detail in the base mesh (the minimum for rendering).';
  22487.     D3DRMERR_TEXTUREFORMATNOTFOUND: Result := 'Texture format could not be found that meets the specified criteria and that the underlying Immediate Mode device supports.';
  22488.     D3DRMERR_UNABLETOEXECUTE: Result := 'Unable to carry out procedure.';
  22489.     DDERR_INVALIDOBJECT: Result := 'Received pointer that was an invalid object.';
  22490.     DDERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the method are incorrect.';
  22491.     DDERR_NOTFOUND: Result := 'The requested item was not found.';
  22492.     DDERR_NOTINITIALIZED: Result := 'An attempt was made to call an interface method of an object created by CoCreateInstance before the object was initialized.';
  22493.     DDERR_OUTOFMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.';
  22494.     else Result := 'Unrecognized Error';
  22495.   end;
  22496. end;
  22497. {$ENDIF}
  22498. //DirectInput file
  22499.  
  22500.  
  22501. function DIMAKEUSAGEDWORD(UsagePage, Usage: WORD) : DWORD;
  22502. begin
  22503.   Result := Usage or (UsagePage shl 16);
  22504. end;
  22505.  
  22506.  
  22507. function DIEFT_GETTYPE(n: variant) : byte;
  22508. begin
  22509.   Result := byte(n);
  22510. end;
  22511.  
  22512. function GET_DIDEVICE_TYPE(dwDevType: variant) : byte;
  22513. begin
  22514.   Result := byte(dwDevType);
  22515. end;
  22516.  
  22517. function GET_DIDEVICE_SUBTYPE(dwDevType: variant) : byte;
  22518. begin
  22519.   Result := hi(word(dwDevType));
  22520. end;
  22521.  
  22522. function DIDFT_MAKEINSTANCE(n: variant) : DWORD;
  22523. begin
  22524.   Result := word(n) shl 8;
  22525. end;
  22526.  
  22527. function DIDFT_GETTYPE(n: variant) : byte;
  22528. begin
  22529.   Result := byte(n);
  22530. end;
  22531.  
  22532. function DIDFT_GETINSTANCE(n: variant) : DWORD;
  22533. begin
  22534.   Result := word(n) shr 8;
  22535. end;
  22536.  
  22537. function DIDFT_ENUMCOLLECTION(n: variant) : DWORD;
  22538. begin
  22539.   Result := word(n) shl 8;
  22540. end;
  22541.  
  22542. function DIJOFS_SLIDER(n: variant) : variant;
  22543. begin
  22544.   Result := n * 4 + 24;
  22545. end;
  22546.  
  22547. function DIJOFS_POV(n: variant) : variant;
  22548. begin
  22549.   Result := n * 4 + 32;
  22550. end;
  22551.  
  22552. function DIJOFS_BUTTON(n: variant) : variant;
  22553. begin
  22554.   Result := 48 + n;
  22555. end;
  22556.  
  22557. function DIErrorString(Value: HResult) : string;
  22558. var
  22559.   sValue: array[0..255] of char;
  22560. begin
  22561.   case Value of
  22562.     DI_OK: Result := 'The operation completed successfully.';
  22563.     S_FALSE: Result := '"The operation had no effect." or "The device buffer overflowed and some input was lost." or "The device exists but is not currently attached." or "The change in device properties had no effect."';
  22564. //    DI_BUFFEROVERFLOW: Result := 'The device buffer overflowed and some input was lost. This value is equal to the S_FALSE standard COM return value.';
  22565.     DI_DOWNLOADSKIPPED: Result := 'The parameters of the effect were successfully updated, but the effect could not be downloaded because the associated device was not acquired in exclusive mode.';
  22566.     DI_EFFECTRESTARTED: Result := 'The effect was stopped, the parameters were updated, and the effect was restarted.';
  22567. //    DI_NOEFFECT: Result := 'The operation had no effect. This value is equal to the S_FALSE standard COM return value.';
  22568. //    DI_NOTATTACHED: Result := 'The device exists but is not currently attached. This value is equal to the S_FALSE standard COM return value.';
  22569.     DI_POLLEDDEVICE: Result := 'The device is a polled device. As a result, device buffering will not collect any data and event notifications will not be signaled until the IDirectInputDevice2::Poll method is called.';
  22570. //    DI_PROPNOEFFECT: Result := 'The change in device properties had no effect. This value is equal to the S_FALSE standard COM return value.';
  22571.     DI_TRUNCATED: Result := 'The parameters of the effect were successfully updated, but some of them were beyond the capabilities of the device and were truncated to the nearest supported value.';
  22572.     DI_TRUNCATEDANDRESTARTED: Result := 'Equal to DI_EFFECTRESTARTED | DI_TRUNCATED.';
  22573.     DIERR_ACQUIRED: Result := 'The operation cannot be performed while the device is acquired.';
  22574.     DIERR_ALREADYINITIALIZED: Result := 'This object is already initialized';
  22575.     DIERR_BADDRIVERVER: Result := 'The object could not be created due to an incompatible driver version or mismatched or incomplete driver components.';
  22576.     DIERR_BETADIRECTINPUTVERSION: Result := 'The application was written for an unsupported prerelease version of DirectInput.';
  22577.     DIERR_DEVICEFULL: Result := 'The device is full.';
  22578.     DIERR_DEVICENOTREG: Result := 'The device or device instance is not registered with DirectInput. This value is equal to the REGDB_E_CLASSNOTREG standard COM return value.';
  22579.     DIERR_EFFECTPLAYING: Result := 'The parameters were updated in memory but were not downloaded to the device because the device does not support updating an effect while it is still playing.';
  22580.     DIERR_HASEFFECTS: Result := 'The device cannot be reinitialized because there are still effects attached to it.';
  22581.     DIERR_GENERIC: Result := 'An undetermined error occurred inside the DirectInput subsystem. This value is equal to the E_FAIL standard COM return value.';
  22582. //    DIERR_HANDLEEXISTS: Result := 'The device already has an event notification associated with it. This value is equal to the E_ACCESSDENIED standard COM return value.';
  22583.     DIERR_INCOMPLETEEFFECT: Result := 'The effect could not be downloaded because essential information is missing. For example, no axes have been associated with the effect, or no type-specific information has been supplied.';
  22584.     DIERR_INPUTLOST: Result := 'Access to the input device has been lost. It must be reacquired.';
  22585.     DIERR_INVALIDPARAM: Result := 'An invalid parameter was passed to the returning function, or the object was not in a state that permitted the function to be called. This value is equal to the E_INVALIDARG standard COM return value.';
  22586.     DIERR_MOREDATA: Result := 'Not all the requested information fitted into the buffer.';
  22587.     DIERR_NOAGGREGATION: Result := 'This object does not support aggregation.';
  22588.     DIERR_NOINTERFACE: Result := 'The specified interface is not supported by the object. This value is equal to the E_NOINTERFACE standard COM return value.';
  22589.     DIERR_NOTACQUIRED: Result := 'The operation cannot be performed unless the device is acquired.';
  22590.     DIERR_NOTBUFFERED: Result := 'The device is not buffered. Set the DIPROP_BUFFERSIZE property to enable buffering.';
  22591.     DIERR_NOTDOWNLOADED: Result := 'The effect is not downloaded.';
  22592.     DIERR_NOTEXCLUSIVEACQUIRED: Result := 'The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode.';
  22593.     DIERR_NOTFOUND: Result := 'The requested object does not exist.';
  22594.     DIERR_NOTINITIALIZED: Result := 'This object has not been initialized.';
  22595. //    DIERR_OBJECTNOTFOUND: Result := 'The requested object does not exist.';
  22596.     DIERR_OLDDIRECTINPUTVERSION: Result := 'The application requires a newer version of DirectInput.';
  22597.     DIERR_OTHERAPPHASPRIO: Result := '"The device already has an event notification associated with it." or "The specified property cannot be changed." or "Another application has a higher priority level, preventing this call from succeeding. "';
  22598.     DIERR_OUTOFMEMORY: Result := 'The DirectInput subsystem could not allocate sufficient memory to complete the call. This value is equal to the E_OUTOFMEMORY standard COM return value.';
  22599. //    DIERR_READONLY: Result := 'The specified property cannot be changed. This value is equal to the E_ACCESSDENIED standard COM return value.';
  22600.     DIERR_UNSUPPORTED: Result := 'The function called is not supported at this time. This value is equal to the E_NOTIMPL standard COM return value.';
  22601.     E_PENDING: Result := 'Data is not yet available.';
  22602.     HResult($800405CC): Result := 'No more memory for effects of this kind (not documented)';
  22603.       else Result := 'Unrecognized Error: $' + sValue;
  22604.   end;
  22605. end;
  22606.  
  22607. function joyConfigChanged(dwFlags: DWORD) : MMRESULT; external 'WinMM.dll';
  22608.  
  22609. procedure Init_c_dfDIKeyboard_Objects;  // XRef: Initialization
  22610. var x: Cardinal;
  22611. begin
  22612.   for x := 0 to 255 do
  22613.   with _c_dfDIKeyboard_Objects[x] do
  22614.   begin
  22615.     pGuid := @GUID_Key; dwOfs := x; dwFlags := 0;
  22616.     dwType := $80000000 or DIDFT_BUTTON or x shl 8;
  22617.   end;
  22618. end;
  22619.  
  22620. procedure Init_c_dfDIJoystick2_Objects;  // XRef: Initialization
  22621. var x,y, OfVal: Cardinal;
  22622. begin
  22623.   Move(_c_dfDIJoystick_Objects,_c_dfDIJoystick2_Objects,SizeOf(_c_dfDIJoystick_Objects));
  22624.   // all those empty "buttons"
  22625.   for x := $2C to $8B do
  22626.     Move(_c_dfDIJoystick_Objects[$2B],_c_dfDIJoystick2_Objects[x],SizeOf(TDIObjectDataFormat));
  22627.   for x := 0 to 2 do
  22628.   begin  // 3 more blocks of X axis..Sliders
  22629.     Move(_c_dfDIJoystick_Objects,_c_dfDIJoystick2_Objects[$8C+8*x],8*SizeOf(TDIObjectDataFormat));
  22630.     for y := 0 to 7 do _c_dfDIJoystick2_Objects[$8C+8*x+y].dwFlags := (x+1) shl 8;
  22631.   end;
  22632.   OfVal := _c_dfDIJoystick2_Objects[$2B].dwOfs+1;
  22633.   for x := $2C to $A3 do
  22634.   begin
  22635.     _c_dfDIJoystick2_Objects[x].dwOfs := OfVal;
  22636.     if x < $8C then Inc(OfVal) else Inc(OfVal,4);
  22637.   end;
  22638. end;
  22639.  
  22640. //DirectPlay file
  22641. {$IFDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
  22642.  
  22643. (*==========================================================================;
  22644.  *
  22645.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  22646.  *
  22647.  *  File:       dplay.h
  22648.  *  Content:    DirectPlay include file
  22649.  *
  22650.  ***************************************************************************)
  22651.  
  22652. function DPErrorString(Value: HResult) : string;
  22653. begin
  22654.   case Value of
  22655.     CLASS_E_NOAGGREGATION: Result := 'A non-NULL value was passed for the pUnkOuter parameter in DirectPlayCreate, DirectPlayLobbyCreate, or IDirectPlayLobby2::Connect.';
  22656.     DPERR_ACCESSDENIED: Result := 'The session is full or an incorrect password was supplied.';
  22657.     DPERR_ACTIVEPLAYERS: Result := 'The requested operation cannot be performed because there are existing active players.';
  22658.     DPERR_ALREADYINITIALIZED: Result := 'This object is already initialized.';
  22659.     DPERR_APPNOTSTARTED: Result := 'The application has not been started yet.';
  22660.     DPERR_AUTHENTICATIONFAILED: Result := 'The password or credentials supplied could not be authenticated.';
  22661.     DPERR_BUFFERTOOLARGE: Result := 'The data buffer is too large to store.';
  22662.     DPERR_BUSY: Result := 'A message cannot be sent because the transmission medium is busy.';
  22663.     DPERR_BUFFERTOOSMALL: Result := 'The supplied buffer is not large enough to contain the requested data.';
  22664.     DPERR_CANTADDPLAYER: Result := 'The player cannot be added to the session.';
  22665.     DPERR_CANTCREATEGROUP: Result := 'A new group cannot be created.';
  22666.     DPERR_CANTCREATEPLAYER: Result := 'A new player cannot be created.';
  22667.     DPERR_CANTCREATEPROCESS: Result := 'Cannot start the application.';
  22668.     DPERR_CANTCREATESESSION: Result := 'A new session cannot be created.';
  22669.     DPERR_CANTLOADCAPI: Result := 'No credentials were supplied and the CryptoAPI package (CAPI) to use for cryptography services cannot be loaded.';
  22670.     DPERR_CANTLOADSECURITYPACKAGE: Result := 'The software security package cannot be loaded.';
  22671.     DPERR_CANTLOADSSPI: Result := 'No credentials were supplied and the software security package (SSPI) that will prompt for credentials cannot be loaded.';
  22672.     DPERR_CAPSNOTAVAILABLEYET: Result := 'The capabilities of the DirectPlay object have not been determined yet. This error will occur if the DirectPlay object is implemented on a connectivity solution that requires polling to determine available bandwidth and latency.';
  22673.     DPERR_CONNECTING: Result := 'The method is in the process of connecting to the network. The application should keep calling the method until it returns DP_OK, indicating successful completion, or it returns a different error.';
  22674.     DPERR_ENCRYPTIONFAILED: Result := 'The requested information could not be digitally encrypted. Encryption is used for message privacy. This error is only relevant in a secure session.';
  22675.     DPERR_EXCEPTION: Result := 'An exception occurred when processing the request.';
  22676.     DPERR_GENERIC: Result := 'An undefined error condition occurred.';
  22677. //    DPERR_INVALIDCREDENTIALS: Result := 'The credentials supplied (as to IDirectPlay3::SecureOpen) were not valid.';
  22678.     DPERR_INVALIDFLAGS: Result := 'The flags passed to this method are invalid.';
  22679.     DPERR_INVALIDGROUP: Result := 'The group ID is not recognized as a valid group ID for this game session.';
  22680.     DPERR_INVALIDINTERFACE: Result := 'The interface parameter is invalid.';
  22681.     DPERR_INVALIDOBJECT: Result := 'The DirectPlay object pointer is invalid.';
  22682.     DPERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the method are invalid.';
  22683.     DPERR_INVALIDPASSWORD: Result := 'An invalid password was supplied when attempting to join a session that requires a password.';
  22684.     DPERR_INVALIDPLAYER: Result := 'The player ID is not recognized as a valid player ID for this game session.';
  22685.     DPERR_LOGONDENIED: Result := 'The session could not be opened because credentials are required and either no credentials were supplied or the credentials were invalid.';
  22686.     DPERR_NOCAPS: Result := 'The communication link that DirectPlay is attempting to use is not capable of this function.';
  22687.     DPERR_NOCONNECTION: Result := 'No communication link was established.';
  22688.     DPERR_NOINTERFACE: Result := 'The interface is not supported.';
  22689.     DPERR_NOMESSAGES: Result := 'There are no messages in the receive queue.';
  22690.     DPERR_NONAMESERVERFOUND: Result := 'No name server (host) could be found or created. A host must exist to create a player.';
  22691.     DPERR_NONEWPLAYERS: Result := 'The session is not accepting any new players.';
  22692.     DPERR_NOPLAYERS: Result := 'There are no active players in the session.';
  22693.     DPERR_NOSESSIONS: Result := 'There are no existing sessions for this game.';
  22694.     DPERR_NOTLOBBIED: Result := 'Returned by the IDirectPlayLobby2::Connect method if the application was not started by using the IDirectPlayLobby2::RunApplication method or if there is no DPLCONNECTION structure currently initialized for this DirectPlayLobby object.';
  22695.     DPERR_NOTLOGGEDIN: Result := 'An action cannot be performed because a player or client application is not logged in. Returned by the IDirectPlay3::Send method when the client application tries to send a secure message without being logged in.';
  22696.     DPERR_OUTOFMEMORY: Result := 'There is insufficient memory to perform the requested operation.';
  22697.     DPERR_PLAYERLOST: Result := 'A player has lost the connection to the session.';
  22698.     DPERR_SENDTOOBIG: Result := 'The message being sent by the IDirectPlay3::Send method is too large.';
  22699.     DPERR_SESSIONLOST: Result := 'The connection to the session has been lost.';
  22700.     DPERR_SIGNFAILED: Result := 'The requested information could not be digitally signed. Digital signatures are used to establish the authenticity of messages.';
  22701.     DPERR_TIMEOUT: Result := 'The operation could not be completed in the specified time.';
  22702.     DPERR_UNAVAILABLE: Result := 'The requested function is not available at this time.';
  22703.     DPERR_UNINITIALIZED: Result := 'The requested object has not been initialized.';
  22704.     DPERR_UNKNOWNAPPLICATION: Result := 'An unknown application was specified.';
  22705.     DPERR_UNSUPPORTED: Result := 'The function is not available in this implementation. Returned from IDirectPlay3::GetGroupConnectionSettings and IDirectPlay3::SetGroupConnectionSettings if they are called from a session that is not a lobby session.';
  22706.     DPERR_USERCANCEL: Result := 'Can be returned in two ways. 1) The user canceled the connection process during a call to the IDirectPlay3::Open method. 2) The user clicked Cancel in one of the DirectPlay service provider dialog boxes during a call to IDirectPlay3::EnumSessions.';
  22707.     else Result := 'Unrecognized Error';
  22708.   end;
  22709. end;
  22710. {$ENDIF} // UseDirectPlay
  22711.  
  22712. //DirectSetup file
  22713.  
  22714. (*==========================================================================
  22715.  *
  22716.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  22717.  *
  22718.  *  File:       dsetup.h
  22719.  *  Content:    DirectXSetup, error codes and flags
  22720.  ***************************************************************************)
  22721.  
  22722. procedure LoadDSetup;
  22723.  
  22724.   function RegGetStringValue(Hive: HKEY; const KeyName, ValueName: string): string;
  22725.   var EnvKey  : HKEY;
  22726.       Buf     : array[0..255] of char;
  22727.       BufSize : DWord;
  22728.       RegType : DWord;
  22729.       rc      : DWord;
  22730.   begin
  22731.     Result := '';
  22732.     BufSize := Sizeof(Buf);
  22733.     ZeroMemory(@Buf, BufSize);
  22734.     RegType := REG_SZ;
  22735.     try
  22736.       if (RegOpenKeyEx(Hive, PChar(KeyName), 0, KEY_READ, EnvKey) = ERROR_SUCCESS) then
  22737.       begin
  22738.         try
  22739.           if (ValueName = '') then rc := RegQueryValueEx(EnvKey, nil, nil, @RegType, @Buf, @BufSize)
  22740.             else rc := RegQueryValueEx(EnvKey, PChar(ValueName), nil, @RegType, @Buf, @BufSize);
  22741.           if rc = ERROR_SUCCESS then Result := string(Buf);
  22742.         finally
  22743.           RegCloseKey(EnvKey);
  22744.         end;
  22745.       end;
  22746.     finally
  22747.       RegCloseKey(Hive);
  22748.     end;
  22749.   end;
  22750.  
  22751.  
  22752.   function ExistFile(const FileName: string): Boolean;
  22753.   var hFile: THandle;
  22754.   begin
  22755.     hFile := CreateFile(PChar(FileName), 0, 0, nil, OPEN_EXISTING, 0, 0);
  22756.     Result := hFile <> INVALID_HANDLE_VALUE;
  22757.     if hFile = INVALID_HANDLE_VALUE then CloseHandle(hFile);
  22758.   end;
  22759.  
  22760.   function GetDSetupDLLPath : string;
  22761.   begin
  22762.      Result := RegGetStringValue(HKEY_LOCAL_MACHINE,
  22763.                                  'Software\Microsoft\Windows\CurrentVersion\Uninstall\DirectXDrivers',
  22764.                                  'UninstallString');
  22765.      if Result <> '' then
  22766.        Result := Copy(Result,1,Length(Result)-Length('dxsetup.exe')) + 'DSetup.dll';
  22767.   end;
  22768.  
  22769. begin
  22770.   DSetupDLL := LoadLibrary(PChar(GetDSetupDLLPath));
  22771.  
  22772.   DirectXSetupA := GetProcAddress(DSetupDLL,'DirectXSetupA');
  22773.   DirectXSetupW := GetProcAddress(DSetupDLL,'DirectXSetupW');
  22774. {$IFDEF UNICODE}
  22775.   DirectXSetup := DirectXSetupW;
  22776. {$ELSE}
  22777.   DirectXSetup := DirectXSetupA;
  22778. {$ENDIF}
  22779.  
  22780.   DirectXDeviceDriverSetupA :=
  22781.       GetProcAddress(DSetupDLL,'DirectXDeviceDriverSetupA');
  22782.   DirectXDeviceDriverSetupW :=
  22783.       GetProcAddress(DSetupDLL,'DirectXDeviceDriverSetupW');
  22784. {$IFDEF UNICODE}
  22785.   DirectXDeviceDriverSetup := DirectXDeviceDriverSetupW;
  22786. {$ELSE}
  22787.   DirectXDeviceDriverSetup := DirectXDeviceDriverSetupA;
  22788. {$ENDIF}
  22789.  
  22790.   DirectXRegisterApplicationA :=
  22791.        GetProcAddress(DSetupDLL,'DirectXRegisterApplicationA');
  22792.   DirectXRegisterApplicationW :=
  22793.        GetProcAddress(DSetupDLL,'DirectXRegisterApplicationW');
  22794. {$IFDEF UNICODE}
  22795.   DirectXRegisterApplication := DirectXRegisterApplicationW;
  22796. {$ELSE}
  22797.   DirectXRegisterApplication := DirectXRegisterApplicationA;
  22798. {$ENDIF}
  22799.  
  22800.   DirectXUnRegisterApplication :=
  22801.       GetProcAddress(DSetupDLL,'DirectXUnRegisterApplication');
  22802.  
  22803.   DirectXSetupSetCallback :=
  22804.       GetProcAddress(DSetupDLL,'DirectXSetupSetCallback');
  22805.  
  22806.   DirectXSetupGetVersion := GetProcAddress(DSetupDLL,'DirectXSetupGetVersion');
  22807.  
  22808. end;
  22809.  
  22810. //DirectSound file
  22811.  
  22812. function MAKE_DSHRESULT(code: DWORD) : HResult;
  22813. begin
  22814.   Result := HResult(1 shl 31) or HResult(_FACDS shl 16)
  22815.       or HResult(code);
  22816. end;
  22817.  
  22818. function DSSPEAKER_COMBINED(c, g: variant) : DWORD;
  22819. begin
  22820.   Result := byte(c) or (byte(g) shl 16)
  22821. end;
  22822.  
  22823. function DSSPEAKER_CONFIG(a: variant) : byte;
  22824. begin
  22825.   Result := byte(a);
  22826. end;
  22827.  
  22828. function DSSPEAKER_GEOMETRY(a: variant) : byte;
  22829. begin
  22830.   Result := byte(a shr 16 and $FF);
  22831. end;
  22832.  
  22833.  
  22834. function DSErrorString(Value: HResult) : string;
  22835. begin
  22836.   case Value of
  22837.     DS_OK: Result := 'The request completed successfully.';
  22838.     DSERR_ALLOCATED: Result := 'The request failed because resources, such as a priority level, were already in use by another caller.';
  22839.     DSERR_ALREADYINITIALIZED: Result := 'The object is already initialized.';
  22840.     DSERR_BADFORMAT: Result := 'The specified wave format is not supported.';
  22841.     DSERR_BUFFERLOST: Result := 'The buffer memory has been lost and must be restored.';
  22842.     DSERR_CONTROLUNAVAIL: Result := 'The control (volume, pan, and so forth) requested by the caller is not available.';
  22843.     DSERR_GENERIC: Result := 'An undetermined error occurred inside the DirectSound subsystem.';
  22844.     DSERR_INVALIDCALL: Result := 'This function is not valid for the current state of this object.';
  22845.     DSERR_INVALIDPARAM: Result := 'An invalid parameter was passed to the returning function.';
  22846.     DSERR_NOAGGREGATION: Result := 'The object does not support aggregation.';
  22847.     DSERR_NODRIVER: Result := 'No sound driver is available for use.';
  22848.     DSERR_NOINTERFACE: Result := 'The requested COM interface is not available.';
  22849.     DSERR_OTHERAPPHASPRIO: Result := 'Another application has a higher priority level, preventing this call from succeeding.';
  22850.     DSERR_OUTOFMEMORY: Result := 'The DirectSound subsystem could not allocate sufficient memory to complete the caller´s request.';
  22851.     DSERR_PRIOLEVELNEEDED: Result := 'The caller does not have the priority level required for the function to succeed.';
  22852.     DSERR_UNINITIALIZED: Result := 'The IDirectSound::Initialize method has not been called or has not been called successfully before other methods were called.';
  22853.     DSERR_UNSUPPORTED: Result := 'The function called is not supported at this time.';
  22854.     else Result := 'Unrecognized Error';
  22855.   end;
  22856. end;
  22857.  
  22858. //DirectMusic file
  22859.  
  22860. function MAKE_HRESULT(sev,fac,code: DWORD) : HResult;
  22861. begin
  22862.   Result := (sev shl 31) or (fac shl 16) or code;
  22863. end;
  22864.  
  22865. //function MAKEFOURCC (ch0, ch1, ch2, ch3: Char) : TFourCC;
  22866. //type
  22867. //  tfcc = array [0..3] of Char;
  22868. //begin
  22869. //  tfcc(Result)[0] := ch0;
  22870. //  tfcc(Result)[1] := ch1;
  22871. //  tfcc(Result)[2] := ch2;
  22872. //  tfcc(Result)[3] := ch3;
  22873. //end;
  22874.  
  22875. function QWORD_ALIGN(x: DWORD) : DWORD;
  22876. begin
  22877.   Result := (x + 7) and (not 7); //  (((x) + 7) & ~7)
  22878. end;
  22879.  
  22880. function DMUS_EVENT_SIZE(cb: DWORD) : DWORD;
  22881. begin
  22882.   Result := QWORD_ALIGN(SizeOf(TDMus_EventHeader) + cb); // QWORD_ALIGN(sizeof(DMUS_EVENTHEADER) + cb)
  22883. end;
  22884.  
  22885. function IsNTandDelphiRunning : boolean;
  22886. var
  22887.   OSVersion  : TOSVersionInfo;
  22888.   AppName    : array[0..255] of char;
  22889. begin
  22890.   OSVersion.dwOsVersionInfoSize := sizeof(OSVersion);
  22891.   GetVersionEx(OSVersion);
  22892.   // Not running in NT or program is not Delphi itself ?
  22893.   AppName[0] := #0;
  22894.   lstrcat(AppName, PChar(ParamStr(0)));  // ParamStr(0) = Application.ExeName
  22895.   {$IFDEF VER12UP}
  22896.   CharUpperBuff(AppName, High(AppName) + 1);
  22897.   {$ELSE}
  22898.   CharUpperBuff(AppName, SizeOf(AppName));
  22899.   {$ENDIF}
  22900.   result := ( (OSVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) and
  22901.               (Pos('DELPHI32.EXE', AppName) = Length(AppName) - Length('DELPHI32.EXE') + 1) );
  22902. end;
  22903.  
  22904. initialization
  22905. begin
  22906.   {DirectDraw}
  22907.  
  22908.   if not IsNTandDelphiRunning then
  22909.   begin
  22910.     DDrawDLL := LoadLibrary('DDraw.dll');
  22911.     DirectDrawEnumerateA := GetProcAddress(DDrawDLL,'DirectDrawEnumerateA');
  22912.     DirectDrawEnumerateW := GetProcAddress(DDrawDLL,'DirectDrawEnumerateW');
  22913. {$IFDEF UNICODE}
  22914.     DirectDrawEnumerate := DirectDrawEnumerateW;
  22915. {$ELSE}
  22916.     DirectDrawEnumerate := DirectDrawEnumerateA;
  22917. {$ENDIF}
  22918.  
  22919.     DirectDrawEnumerateExA := GetProcAddress(DDrawDLL,'DirectDrawEnumerateExA');
  22920.     DirectDrawEnumerateExW := GetProcAddress(DDrawDLL,'DirectDrawEnumerateExW');
  22921. {$IFDEF UNICODE}
  22922.     DirectDrawEnumerateEx := DirectDrawEnumerateExW;
  22923. {$ELSE}
  22924.     DirectDrawEnumerateEx := DirectDrawEnumerateExA;
  22925. {$ENDIF}
  22926.  
  22927.     DirectDrawCreate := GetProcAddress(DDrawDLL,'DirectDrawCreate');
  22928.     DirectDrawCreateEx := GetProcAddress(DDrawDLL,'DirectDrawCreateEx');
  22929.     DirectDrawCreateClipper := GetProcAddress(DDrawDLL,'DirectDrawCreateClipper');
  22930. {$IFDEF WINNT}
  22931.     NtDirectDrawCreate := GetProcAddress(DDrawDLL,'NtDirectDrawCreate');
  22932. {$ENDIF}
  22933.   end;
  22934.   {DirectDraw}
  22935.   {Direct3D}
  22936.   DisableFPUExceptions;
  22937.   {$IFDEF D3DRM}
  22938.   if not IsNTandDelphiRunning then
  22939.   begin
  22940.     DXFileDLL := LoadLibrary('D3DXOF.DLL');
  22941.     DirectXFileCreate := GetProcAddress(DXFileDLL,'DirectXFileCreate');
  22942.   end;
  22943.   {Direct3D}
  22944.   {Direct3DRM}
  22945.   if not IsNTandDelphiRunning then
  22946.   begin
  22947.     D3DRMDLL := LoadLibrary('D3DRM.dll');
  22948.     //d3drmdef:
  22949.     D3DRMCreateColorRGB := GetProcAddress(D3DRMDLL,'D3DRMCreateColorRGB');
  22950.     D3DRMCreateColorRGBA := GetProcAddress(D3DRMDLL,'D3DRMCreateColorRGBA');
  22951.     D3DRMColorGetRed := GetProcAddress(D3DRMDLL,'D3DRMColorGetRed');
  22952.     D3DRMColorGetGreen := GetProcAddress(D3DRMDLL,'D3DRMColorGetGreen');
  22953.     D3DRMColorGetBlue := GetProcAddress(D3DRMDLL,'D3DRMColorGetBlue');
  22954.     D3DRMColorGetAlpha := GetProcAddress(D3DRMDLL,'D3DRMColorGetAlpha');
  22955.     D3DRMVectorAdd := GetProcAddress(D3DRMDLL,'D3DRMVectorAdd');
  22956.     D3DRMVectorSubtract := GetProcAddress(D3DRMDLL,'D3DRMVectorSubtract');
  22957.     D3DRMVectorReflect := GetProcAddress(D3DRMDLL,'D3DRMVectorReflect');
  22958.     D3DRMVectorCrossProduct := GetProcAddress(D3DRMDLL,'D3DRMVectorCrossProduct');
  22959.     D3DRMVectorDotProduct := GetProcAddress(D3DRMDLL,'D3DRMVectorDotProduct');
  22960.     D3DRMVectorNormalize := GetProcAddress(D3DRMDLL,'D3DRMVectorNormalize');
  22961.     D3DRMVectorModulus := GetProcAddress(D3DRMDLL,'D3DRMVectorModulus');
  22962.     D3DRMVectorRotate := GetProcAddress(D3DRMDLL,'D3DRMVectorRotate');
  22963.     D3DRMVectorScale := GetProcAddress(D3DRMDLL,'D3DRMVectorScale');
  22964.     D3DRMVectorRandom := GetProcAddress(D3DRMDLL,'D3DRMVectorRandom');
  22965.     D3DRMQuaternionFromRotation := GetProcAddress(D3DRMDLL,'D3DRMQuaternionFromRotation');
  22966.     D3DRMQuaternionMultiply := GetProcAddress(D3DRMDLL,'D3DRMQuaternionMultiply');
  22967.     D3DRMQuaternionSlerp := GetProcAddress(D3DRMDLL,'D3DRMQuaternionSlerp');
  22968.     D3DRMMatrixFromQuaternion := GetProcAddress(D3DRMDLL,'D3DRMMatrixFromQuaternion');
  22969.     D3DRMQuaternionFromMatrix := GetProcAddress(D3DRMDLL,'D3DRMQuaternionFromMatrix');
  22970.     //d3drm:
  22971.     Direct3DRMCreate := GetProcAddress(D3DRMDLL,'Direct3DRMCreate');
  22972.   end;
  22973.   {$ENDIF}
  22974.   {Direct3DRM}
  22975.   {DirectInput}
  22976.   Init_c_dfDIKeyboard_Objects;  // set kbd GUIDs & flags
  22977.   Init_c_dfDIJoystick2_Objects;  // construct Joystick2 from Joystick fmt
  22978.  
  22979.   if not IsNTandDelphiRunning then
  22980.   begin
  22981.     DInputDLL := LoadLibrary('DInput.dll');
  22982.  
  22983.     DirectInputCreateA := GetProcAddress(DInputDLL,'DirectInputCreateA');
  22984.     DirectInputCreateW := GetProcAddress(DInputDLL,'DirectInputCreateW');
  22985.     // no A/W version
  22986.     DirectInputCreateEx := GetProcAddress(DInputDLL,'DirectInputCreateEx');
  22987. {$IFDEF UNICODE}
  22988.     DirectInputCreate := DirectInputCreateW;
  22989. {$ELSE}
  22990.     DirectInputCreate := DirectInputCreateA;
  22991. {$ENDIF}
  22992.   end;
  22993.   {DirectInput}
  22994.   {DirectPlay}
  22995.   {$IFDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
  22996.   if not IsNTandDelphiRunning then
  22997.   begin
  22998.     DPlayDLL := LoadLibrary('DPlayX.dll');
  22999.  
  23000.     DirectPlayEnumerateA := GetProcAddress(DPlayDLL,'DirectPlayEnumerateA');
  23001.     DirectPlayEnumerateW := GetProcAddress(DPlayDLL,'DirectPlayEnumerateW');
  23002.   {$IFDEF UNICODE}
  23003.     DirectPlayEnumerate := DirectPlayEnumerateW;
  23004.   {$ELSE}
  23005.     DirectPlayEnumerate := DirectPlayEnumerateA;
  23006.   {$ENDIF}
  23007.  
  23008.     DirectPlayCreate := GetProcAddress(DPlayDLL,'DirectPlayCreate');
  23009.  
  23010. //  File:       dplay.h
  23011.  
  23012.     DirectPlayLobbyCreateW := GetProcAddress(DPlayDLL,'DirectPlayLobbyCreateW');
  23013.     DirectPlayLobbyCreateA := GetProcAddress(DPlayDLL,'DirectPlayLobbyCreateA');
  23014.   {$IFDEF UNICODE}
  23015.     DirectPlayLobbyCreate := DirectPlayLobbyCreateW;
  23016.   {$ELSE}
  23017.     DirectPlayLobbyCreate := DirectPlayLobbyCreateA;
  23018.   {$ENDIF}
  23019.  
  23020.   end;
  23021.   {$ENDIF} // UseDirectPlay
  23022.   {DirectPlay}
  23023.   {DirectSetup}
  23024.   if not IsNTandDelphiRunning then
  23025.   begin
  23026.     LoadDSetup;
  23027.   end;
  23028.   {DirectSetup}
  23029.   {DirectSound}
  23030.   if not IsNTandDelphiRunning then
  23031.   begin
  23032.     DSoundDLL := LoadLibrary('DSound.dll');
  23033.     DirectSoundCreate := GetProcAddress(DSoundDLL,'DirectSoundCreate');
  23034.  
  23035.     DirectSoundEnumerateW := GetProcAddress(DSoundDLL,'DirectSoundEnumerateW');
  23036.     DirectSoundEnumerateA := GetProcAddress(DSoundDLL,'DirectSoundEnumerateA');
  23037.   {$IFDEF UNICODE}
  23038.     DirectSoundEnumerate := DirectSoundEnumerateW;
  23039.   {$ELSE}
  23040.     DirectSoundEnumerate := DirectSoundEnumerateA;
  23041.   {$ENDIF}
  23042.  
  23043.     DirectSoundCaptureCreate :=
  23044.         GetProcAddress(DSoundDLL,'DirectSoundCaptureCreate');
  23045.  
  23046.     DirectSoundCaptureEnumerateW :=
  23047.         GetProcAddress(DSoundDLL,'DirectSoundCaptureEnumerateW');
  23048.     DirectSoundCaptureEnumerateA :=
  23049.         GetProcAddress(DSoundDLL,'DirectSoundCaptureEnumerateA');
  23050.   {$IFDEF UNICODE}
  23051.     DirectSoundCaptureEnumerate := DirectSoundCaptureEnumerateW;
  23052.   {$ELSE}
  23053.     DirectSoundCaptureEnumerate := DirectSoundCaptureEnumerateA;
  23054.   {$ENDIF}
  23055.   end;
  23056.   {DirectSound}
  23057. end;
  23058.  
  23059. finalization
  23060. begin
  23061.   {DirectDraw}
  23062.   if DDrawDLL <> 0 then FreeLibrary(DDrawDLL);
  23063.   {DirectDraw}
  23064.   {Direct3D}
  23065.   FreeLibrary(DXFileDLL);
  23066.   {Direct3D}
  23067.   {Direct3DRM}
  23068.   {$IFDEF D3DRM}
  23069.   if D3DRMDLL <> 0 then FreeLibrary(D3DRMDLL);
  23070.   {$ENDIF}
  23071.   {Direct3DRM}
  23072.   {DirectInput}
  23073.   FreeLibrary(DInputDLL);
  23074.   {DirectInput}
  23075.   {DirectPlay}
  23076.   {$IFDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
  23077.   if DPlayDLL <> 0 then FreeLibrary(DPlayDLL);
  23078.   {$ENDIF} // UseDirectPlay
  23079.   {DirectPlay}
  23080.   {DirectSetup}
  23081.   FreeLibrary(DSetupDLL);
  23082.   {DirectSetup}
  23083.   {DirectSound}
  23084.   FreeLibrary(DSoundDLL);
  23085.   {DirectSound}
  23086. end;
  23087.  
  23088.  
  23089. End.