Subversion Repositories spacemission

Rev

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

Rev Author Line No. Line
1 daniel-mar 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
 ***************************************************************************)
4 daniel-mar 28
{
29
(c)2004 Jaro Benes Recompilation with Erik Unger's headers
10 daniel-mar 30
(c)2024 Daniel Marschall, small fixes
1 daniel-mar 31
 
4 daniel-mar 32
Join in order:
33
  1) DirectDraw
34
  2) Direct3D
35
  3) Direct3DRM
36
  4) DirectInput
37
  5) DirectPlay
38
  6) DirectSetup
39
  7) DirectSound
40
  8) DirectMusic
41
}
42
Unit DirectX;
1 daniel-mar 43
 
4 daniel-mar 44
Interface
1 daniel-mar 45
 
4 daniel-mar 46
{Delphi version marks}
1 daniel-mar 47
 
4 daniel-mar 48
{$I DelphiXcfg.inc}
1 daniel-mar 49
 
4 daniel-mar 50
{$MINENUMSIZE 4}
51
{$ALIGN ON}
1 daniel-mar 52
 
4 daniel-mar 53
uses
54
  Windows, MMSystem;
55
//DirectDraw file
1 daniel-mar 56
(*==========================================================================;
57
 *
4 daniel-mar 58
 *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 59
 *
4 daniel-mar 60
 *  Files:      ddraw.h dvp.h
61
 *  Content:    DirectDraw and DirectDrawVideoPort include files
1 daniel-mar 62
 *
4 daniel-mar 63
 *  DirectX 7.0 Delphi adaptation by Erik Unger
64
 *
65
 *  Modified: 10-Sep-2000
66
 *
67
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
68
 *  E-Mail: DelphiDirectX@next-reality.com
69
 *
70
 *
1 daniel-mar 71
 ***************************************************************************)
72
 
4 daniel-mar 73
var
74
  DDrawDLL : HMODULE = 0;
1 daniel-mar 75
 
4 daniel-mar 76
function DDErrorString(Value: HResult) : string;
1 daniel-mar 77
 
4 daniel-mar 78
function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
1 daniel-mar 79
 
4 daniel-mar 80
(*
81
 * FOURCC codes for DX compressed-texture pixel formats
82
 *)
1 daniel-mar 83
const
4 daniel-mar 84
  FOURCC_DXT1 = 'DXT1';
85
  FOURCC_DXT2 = 'DXT2';
86
  FOURCC_DXT3 = 'DXT3';
87
  FOURCC_DXT4 = 'DXT4';
88
  FOURCC_DXT5 = 'DXT5';
89
 
90
(*
91
 * GUIDS used by DirectDraw objects
92
 *)
93
const
1 daniel-mar 94
  CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
4 daniel-mar 95
  CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';
96
  CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';
1 daniel-mar 97
 
98
const
4 daniel-mar 99
  DD_ROP_SPACE = (256 div 32);       // space required to store ROP array
1 daniel-mar 100
 
4 daniel-mar 101
  MAX_DDDEVICEID_STRING = 512;
1 daniel-mar 102
 
4 daniel-mar 103
(*
104
 * Flags for the IDirectDraw4::GetDeviceIdentifier method
105
 *)
1 daniel-mar 106
 
4 daniel-mar 107
(*
108
 * This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped
109
 * with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the
110
 * host adapter, but is typically physcially located on a separate card. The stacked secondary's information is
111
 * returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities
112
 * of the DirectDraw object involved.
113
 *)
114
  DDGDI_GETHOSTIDENTIFIER         = $00000001;
115
 
116
(*============================================================================
117
 *
118
 * DirectDraw Structures
119
 *
120
 * Various structures used to invoke DirectDraw.
121
 *
122
 *==========================================================================*)
123
 
124
var
125
  NilGUID : TGUID{$IfNDef VER6UP} absolute 0{$EndIf};
126
 
1 daniel-mar 127
type
4 daniel-mar 128
  TRefGUID = packed record
129
    case integer of
130
    1: (guid : PGUID);
131
    2: (dwFlags : DWORD);
132
  end;
133
 
1 daniel-mar 134
  IDirectDraw = interface;
135
  IDirectDraw2 = interface;
136
  IDirectDraw4 = interface;
137
  IDirectDraw7 = interface;
138
  IDirectDrawSurface = interface;
139
  IDirectDrawSurface2 = interface;
140
  IDirectDrawSurface3 = interface;
141
  IDirectDrawSurface4 = interface;
142
  IDirectDrawSurface7 = interface;
4 daniel-mar 143
 
1 daniel-mar 144
  IDirectDrawPalette = interface;
145
  IDirectDrawClipper = interface;
146
  IDirectDrawColorControl = interface;
147
  IDirectDrawGammaControl = interface;
148
 
4 daniel-mar 149
(*
150
 * Generic pixel format with 8-bit RGB and alpha components
151
 *)
1 daniel-mar 152
  PDDARGB = ^TDDARGB;
4 daniel-mar 153
  TDDARGB = packed record
154
    blue:     BYTE;
155
    green:    BYTE;
156
    red:      BYTE;
157
    alpha:    BYTE;
1 daniel-mar 158
  end;
159
 
4 daniel-mar 160
(*
161
 * This version of the structure remains for backwards source compatibility.
162
 * The DDARGB structure is the one that should be used for all DirectDraw APIs.
163
 *)
1 daniel-mar 164
  PDDRGBA = ^TDDRGBA;
4 daniel-mar 165
  TDDRGBA = packed record
166
    red   : BYTE;
167
    green : BYTE;
168
    blue  : BYTE;
169
    alpha : BYTE;
1 daniel-mar 170
  end;
171
 
4 daniel-mar 172
(*
173
 * TDDColorKey
174
 *)
1 daniel-mar 175
  PDDColorKey = ^TDDColorKey;
4 daniel-mar 176
  TDDColorKey = packed record
1 daniel-mar 177
    dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to
4 daniel-mar 178
                                   // be treated as Color Key, inclusive
1 daniel-mar 179
    dwColorSpaceHighValue: DWORD;  // high boundary of color space that is
4 daniel-mar 180
                                   // to be treated as Color Key, inclusive
1 daniel-mar 181
  end;
182
 
4 daniel-mar 183
// Delphi 5 can't handle interface in variant records
184
// so we have to use pointers instead (which can be type-casted into interfaces):
1 daniel-mar 185
 
4 daniel-mar 186
{$IFDEF VER5UP}
187
  PDirectDrawSurface = Pointer;              
188
{$ELSE}
189
  PDirectDrawSurface = IDirectDrawSurface;
190
{$ENDIF}
1 daniel-mar 191
 
4 daniel-mar 192
(*
193
 * TDDBltFX
194
 * Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
195
 *)
1 daniel-mar 196
  PDDBltFX = ^TDDBltFX;
4 daniel-mar 197
  TDDBltFX = packed record
198
    dwSize                        : DWORD;     // size of structure
199
    dwDDFX                        : DWORD;     // FX operations
200
    dwROP                         : DWORD;     // Win32 raster operations
201
    dwDDROP                       : DWORD;     // Raster operations new for DirectDraw
202
    dwRotationAngle               : DWORD;     // Rotation angle for blt
203
    dwZBufferOpCode               : DWORD;     // ZBuffer compares
204
    dwZBufferLow                  : DWORD;     // Low limit of Z buffer
205
    dwZBufferHigh                 : DWORD;     // High limit of Z buffer
206
    dwZBufferBaseDest             : DWORD;     // Destination base value
207
    dwZDestConstBitDepth          : DWORD;     // Bit depth used to specify Z constant for destination
208
    case integer of
1 daniel-mar 209
    0: (
4 daniel-mar 210
      dwZDestConst                : DWORD      // Constant to use as Z buffer for dest
211
     );
1 daniel-mar 212
    1: (
4 daniel-mar 213
      lpDDSZBufferDest            : PDirectDrawSurface; // Surface to use as Z buffer for dest
214
      dwZSrcConstBitDepth         : DWORD;     // Bit depth used to specify Z constant for source
215
      case integer of
216
      0: (
217
        dwZSrcConst               : DWORD;     // Constant to use as Z buffer for src
218
       );
219
      1: (
220
        lpDDSZBufferSrc           : PDirectDrawSurface; // Surface to use as Z buffer for src
221
        dwAlphaEdgeBlendBitDepth  : DWORD;     // Bit depth used to specify constant for alpha edge blend
222
        dwAlphaEdgeBlend          : DWORD;     // Alpha for edge blending
223
        dwReserved                : DWORD;
224
        dwAlphaDestConstBitDepth  : DWORD;     // Bit depth used to specify alpha constant for destination
225
        case integer of
226
        0: (
227
          dwAlphaDestConst        : DWORD;     // Constant to use as Alpha Channel
228
         );
229
        1: (
230
          lpDDSAlphaDest          : PDirectDrawSurface; // Surface to use as Alpha Channel
231
          dwAlphaSrcConstBitDepth : DWORD;     // Bit depth used to specify alpha constant for source
232
          case integer of
233
          0: (
234
            dwAlphaSrcConst       : DWORD;     // Constant to use as Alpha Channel
235
          );
236
          1: (
237
            lpDDSAlphaSrc         : PDirectDrawSurface; // Surface to use as Alpha Channel
238
            case integer of
239
            0: (
240
              dwFillColor         : DWORD;     // color in RGB or Palettized
241
            );
242
            1: (
243
              dwFillDepth         : DWORD;     // depth value for z-buffer
244
            );
245
            2: (
246
              dwFillPixel         : DWORD;     // pixel value
247
            );
248
            3: (
249
              lpDDSPattern        : PDirectDrawSurface; // Surface to use as pattern
250
              ddckDestColorkey    : TDDColorKey; // DestColorkey override
251
              ddckSrcColorkey     : TDDColorKey; // SrcColorkey override
252
            )
253
        )
254
      )
255
    )
256
  )
1 daniel-mar 257
  end;
258
 
4 daniel-mar 259
(*
260
 * TDDSCaps
261
 *)
1 daniel-mar 262
  PDDSCaps = ^TDDSCaps;
4 daniel-mar 263
  TDDSCaps = packed record
1 daniel-mar 264
    dwCaps: DWORD;         // capabilities of surface wanted
265
  end;
266
 
4 daniel-mar 267
(*
268
 * TDDOSCaps
269
 *)
1 daniel-mar 270
  PDDOSCaps = ^TDDOSCaps;
4 daniel-mar 271
  TDDOSCaps = packed record
1 daniel-mar 272
    dwCaps: DWORD;         // capabilities of surface wanted
273
  end;
274
 
4 daniel-mar 275
(*
276
 * This structure is used internally by DirectDraw.
277
 *)
1 daniel-mar 278
  PDDSCapsEx = ^TDDSCapsEx;
4 daniel-mar 279
  TDDSCapsEx = packed record
280
    dwCaps2 : DWORD;
281
    dwCaps3 : DWORD;
282
    dwCaps4 : DWORD;
1 daniel-mar 283
  end;
284
 
4 daniel-mar 285
(*
286
 * TDDSCaps2
287
 *)
1 daniel-mar 288
  PDDSCaps2 = ^TDDSCaps2;
4 daniel-mar 289
  TDDSCaps2 = packed record
1 daniel-mar 290
    dwCaps: DWORD;         // capabilities of surface wanted
4 daniel-mar 291
    dwCaps2 : DWORD;
292
    dwCaps3 : DWORD;
293
    dwCaps4 : DWORD;
1 daniel-mar 294
  end;
295
 
4 daniel-mar 296
(*
297
 * TDDCaps
298
 *)
299
(*
300
 * This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X.
301
 * It is present for back compatability.
302
 *)
1 daniel-mar 303
  PDDCaps_DX3 = ^TDDCaps_DX3;
4 daniel-mar 304
  TDDCaps_DX3 = packed record
1 daniel-mar 305
    dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
306
    dwCaps: DWORD;                 // driver specific capabilities
307
    dwCaps2: DWORD;                // more driver specific capabilites
308
    dwCKeyCaps: DWORD;             // color key capabilities of the surface
309
    dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
310
    dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
311
    dwPalCaps: DWORD;              // palette capabilities
312
    dwSVCaps: DWORD;               // stereo vision capabilities
313
    dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
314
    dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
315
    dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
316
    dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
317
    dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
318
    dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
319
    dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
320
    dwVidMemTotal: DWORD;          // total amount of video memory
321
    dwVidMemFree: DWORD;           // amount of free video memory
322
    dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
323
    dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
324
    dwNumFourCCCodes: DWORD;       // number of four cc codes
325
    dwAlignBoundarySrc: DWORD;     // source rectangle alignment
326
    dwAlignSizeSrc: DWORD;         // source rectangle byte size
327
    dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
328
    dwAlignSizeDest: DWORD;        // dest rectangle byte size
329
    dwAlignStrideAlign: DWORD;     // stride alignment
4 daniel-mar 330
    dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
1 daniel-mar 331
    ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
332
    dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
333
    dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
334
    dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
335
    dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
336
    dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
337
    dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
338
    dwReserved1: DWORD;            // reserved
339
    dwReserved2: DWORD;            // reserved
340
    dwReserved3: DWORD;            // reserved
341
    dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
342
    dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
343
    dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
4 daniel-mar 344
    dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
1 daniel-mar 345
    dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
346
    dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
347
    dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
4 daniel-mar 348
    dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
1 daniel-mar 349
    dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
350
    dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
351
    dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
4 daniel-mar 352
    dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
353
    dwReserved4 : DWORD;
354
    dwReserved5 : DWORD;
355
    dwReserved6 : DWORD;
1 daniel-mar 356
  end;
357
 
4 daniel-mar 358
(*
359
 * This structure is the TDDCaps structure as it was in version 5 of Direct X.
360
 * It is present for back compatability.
361
 *)
1 daniel-mar 362
  PDDCaps_DX5 = ^TDDCaps_DX5;
4 daniel-mar 363
  TDDCaps_DX5 = packed record
1 daniel-mar 364
    dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
365
    dwCaps: DWORD;                 // driver specific capabilities
366
    dwCaps2: DWORD;                // more driver specific capabilites
367
    dwCKeyCaps: DWORD;             // color key capabilities of the surface
368
    dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
369
    dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
370
    dwPalCaps: DWORD;              // palette capabilities
371
    dwSVCaps: DWORD;               // stereo vision capabilities
372
    dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
373
    dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
374
    dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
375
    dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
376
    dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
377
    dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
378
    dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
379
    dwVidMemTotal: DWORD;          // total amount of video memory
380
    dwVidMemFree: DWORD;           // amount of free video memory
381
    dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
382
    dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
383
    dwNumFourCCCodes: DWORD;       // number of four cc codes
384
    dwAlignBoundarySrc: DWORD;     // source rectangle alignment
385
    dwAlignSizeSrc: DWORD;         // source rectangle byte size
386
    dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
387
    dwAlignSizeDest: DWORD;        // dest rectangle byte size
388
    dwAlignStrideAlign: DWORD;     // stride alignment
4 daniel-mar 389
    dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
1 daniel-mar 390
    ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
391
    dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
392
    dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
393
    dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
394
    dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
395
    dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
396
    dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
397
    dwReserved1: DWORD;            // reserved
398
    dwReserved2: DWORD;            // reserved
399
    dwReserved3: DWORD;            // reserved
400
    dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
401
    dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
402
    dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
4 daniel-mar 403
    dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
1 daniel-mar 404
    dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
405
    dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
406
    dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
4 daniel-mar 407
    dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
1 daniel-mar 408
    dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
409
    dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
410
    dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
4 daniel-mar 411
    dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
412
    // Members added for DX5:
413
    dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
414
    dwCurrVideoPorts: DWORD;       // current number of video ports used
415
    dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
416
    dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
417
    dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
418
    dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
419
    dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
420
    dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
1 daniel-mar 421
  end;
422
 
423
  PDDCaps_DX6 = ^TDDCaps_DX6;
4 daniel-mar 424
  TDDCaps_DX6 = packed record
1 daniel-mar 425
    dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
426
    dwCaps: DWORD;                 // driver specific capabilities
427
    dwCaps2: DWORD;                // more driver specific capabilites
428
    dwCKeyCaps: DWORD;             // color key capabilities of the surface
429
    dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
430
    dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
431
    dwPalCaps: DWORD;              // palette capabilities
432
    dwSVCaps: DWORD;               // stereo vision capabilities
433
    dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
434
    dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
435
    dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
436
    dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
437
    dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
438
    dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
439
    dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
440
    dwVidMemTotal: DWORD;          // total amount of video memory
441
    dwVidMemFree: DWORD;           // amount of free video memory
442
    dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
443
    dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
444
    dwNumFourCCCodes: DWORD;       // number of four cc codes
445
    dwAlignBoundarySrc: DWORD;     // source rectangle alignment
446
    dwAlignSizeSrc: DWORD;         // source rectangle byte size
447
    dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
448
    dwAlignSizeDest: DWORD;        // dest rectangle byte size
449
    dwAlignStrideAlign: DWORD;     // stride alignment
4 daniel-mar 450
    dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
451
    ddsOldCaps: TDDSCaps;          // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6
1 daniel-mar 452
    dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
453
    dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
454
    dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
455
    dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
456
    dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
457
    dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
458
    dwReserved1: DWORD;            // reserved
459
    dwReserved2: DWORD;            // reserved
460
    dwReserved3: DWORD;            // reserved
461
    dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
462
    dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
463
    dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
4 daniel-mar 464
    dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
1 daniel-mar 465
    dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
466
    dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
467
    dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
4 daniel-mar 468
    dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
1 daniel-mar 469
    dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
470
    dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
471
    dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
4 daniel-mar 472
    dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
473
    // Members added for DX5:
474
    dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
475
    dwCurrVideoPorts: DWORD;       // current number of video ports used
476
    dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
477
    dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
478
    dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
479
    dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
480
    dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
481
    dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
482
    // Members added for DX6 release
483
    ddsCaps : TDDSCaps2 ;          // Surface Caps
1 daniel-mar 484
  end;
485
 
4 daniel-mar 486
  TDDCaps_DX7 = TDDCaps_DX6;
487
 
488
  PDDCaps = ^TDDCaps;
489
 
490
{$IFDEF DIRECTX3}
1 daniel-mar 491
  TDDCaps = TDDCaps_DX3;
4 daniel-mar 492
{$ELSE}
493
  {$IFDEF DIRECTX5}
494
    TDDCaps = TDDCaps_DX5;
495
  {$ELSE}
496
    {$IFDEF DIRECTX6}
497
      TDDCaps = TDDCaps_DX6;
498
    {$ELSE}
499
      TDDCaps = TDDCaps_DX7;
500
    {$ENDIF}
501
  {$ENDIF}
1 daniel-mar 502
{$ENDIF}
503
 
504
 
505
 
4 daniel-mar 506
 
507
(*
508
 * TDDPixelFormat
509
 *)
510
  PDDPixelFormat_DX5 = ^TDDPixelFormat_DX5;
511
  TDDPixelFormat_DX5 = packed record
512
    dwSize: DWORD;                 // size of structure
513
    dwFlags: DWORD;                // pixel format flags
514
    dwFourCC: DWORD;               // (FOURCC code)
1 daniel-mar 515
    case Integer of
4 daniel-mar 516
    0: (
517
      dwZBufferBitDepth: DWORD;      // how many bits for z buffers
518
     );
519
    1: (
520
      dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
521
     );
522
    2: (
523
      dwRGBBitCount: DWORD;          // how many bits per pixel
524
      dwRBitMask: DWORD;             // mask for red bit
525
      dwGBitMask: DWORD;             // mask for green bits
526
      dwBBitMask: DWORD;             // mask for blue bits
527
      dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
528
     );
529
    3: (
530
      dwYUVBitCount: DWORD;          // how many bits per pixel
531
      dwYBitMask: DWORD;             // mask for Y bits
532
      dwUBitMask: DWORD;             // mask for U bits
533
      dwVBitMask: DWORD;             // mask for V bits
534
      case Integer of
1 daniel-mar 535
      0: (
4 daniel-mar 536
        dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
537
       );
1 daniel-mar 538
      1: (
4 daniel-mar 539
        dwRGBZBitMask: DWORD;
540
       );
1 daniel-mar 541
      2: (
4 daniel-mar 542
        dwYUVZBitMask: DWORD;
543
       );
544
     );
545
  end;
546
 
547
  PDDPixelFormat_DX6 = ^TDDPixelFormat_DX6;
548
  TDDPixelFormat_DX6 = packed record
549
    dwSize: DWORD;                 // size of structure
550
    dwFlags: DWORD;                // pixel format flags
551
    dwFourCC: DWORD;               // (FOURCC code)
552
    case Integer of
553
      1: (
554
          dwRGBBitCount : DWORD;  // how many bits per pixel
555
          dwRBitMask : DWORD;  // mask for red bit
556
          dwGBitMask : DWORD;  // mask for green bits
557
          dwBBitMask : DWORD;  // mask for blue bits
558
          dwRGBAlphaBitMask : DWORD; // mask for alpha channel
559
          );
560
      2: (
561
          dwYUVBitCount : DWORD;  // how many bits per pixel
562
          dwYBitMask : DWORD;  // mask for Y bits
563
          dwUBitMask : DWORD;  // mask for U bits
564
          dwVBitMask : DWORD;  // mask for V bits
565
          dwYUVAlphaBitMask : DWORD; // mask for alpha channel
566
          );
1 daniel-mar 567
      3: (
4 daniel-mar 568
          dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits)
569
          dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
570
          dwZBitMask : DWORD;  // mask for Z bits
571
          dwStencilBitMask : DWORD; // mask for stencil bits
572
          dwLuminanceAlphaBitMask : DWORD;// mask for alpha channel
573
          );
1 daniel-mar 574
      4: (
4 daniel-mar 575
          dwAlphaBitDepth : DWORD; // how many bits for alpha channels
576
          dwLuminanceBitMask : DWORD; // mask for luminance bits
577
          dwBumpDvBitMask : DWORD;        // mask for bump map V delta bits
578
          dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map
579
          dwRGBZBitMask : DWORD;  // mask for Z channel
580
          );
1 daniel-mar 581
      5: (
4 daniel-mar 582
           dwLuminanceBitCount : DWORD; // how many bits per pixel
583
           dwBumpDuBitMask : DWORD;       // mask for bump map U delta bits
584
           Fill1, Fill2    : DWORD;
585
           dwYUVZBitMask   : DWORD;  // mask for Z channel
586
         );
587
      6: ( dwBumpBitCount  : DWORD;         // how many bits per "buxel", total
588
         );
1 daniel-mar 589
  end;
590
 
4 daniel-mar 591
  TDDPixelFormat_DX3 = TDDPixelFormat_DX5;
592
  TDDPixelFormat_DX7 = TDDPixelFormat_DX6;
1 daniel-mar 593
 
4 daniel-mar 594
  PDDPixelFormat = ^TDDPixelFormat;
595
{$IFDEF DIRECTX3}
596
  TDDPixelFormat = TDDPixelFormat_DX3;
597
{$ELSE}
598
  {$IFDEF DIRECTX5}
599
    TDDPixelFormat = TDDPixelFormat_DX5;
600
  {$ELSE}
601
    {$IFDEF DIRECTX6}
602
      TDDPixelFormat = TDDPixelFormat_DX6;
603
    {$ELSE}
604
      TDDPixelFormat = TDDPixelFormat_DX7;
605
    {$ENDIF}
606
  {$ENDIF}
607
{$ENDIF}
1 daniel-mar 608
 
4 daniel-mar 609
(*
610
 * TDDOverlayFX
611
 *)
612
  PDDOverlayFX = ^TDDOverlayFX;
613
  TDDOverlayFX = packed record
1 daniel-mar 614
    dwSize: DWORD;                         // size of structure
615
    dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
616
    dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
617
    dwReserved: DWORD;
618
    dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
619
    case Integer of
620
    0: (
4 daniel-mar 621
      dwAlphaDestConst: DWORD;               // Constant to use as alpha channel for dest
622
      dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
623
      dwAlphaSrcConst: DWORD;                // Constant to use as alpha channel for src
624
      dckDestColorkey: TDDColorKey;                // DestColorkey override
625
      dckSrcColorkey: TDDColorKey;                 // DestColorkey override
626
      dwDDFX: DWORD;                         // Overlay FX
627
      dwFlags: DWORD;                        // flags
628
     );
1 daniel-mar 629
    1: (
4 daniel-mar 630
      lpDDSAlphaDest: PDirectDrawSurface;     // Surface to use as alpha channel for dest
631
      filler: DWORD;
632
      lpDDSAlphaSrc: PDirectDrawSurface;      // Surface to use as alpha channel for src
633
     );
1 daniel-mar 634
  end;
635
 
4 daniel-mar 636
(*
637
 * TDDBltBatch: BltBatch entry structure
638
 *)
1 daniel-mar 639
  PDDBltBatch = ^TDDBltBatch;
4 daniel-mar 640
  TDDBltBatch = packed record
1 daniel-mar 641
    lprDest: PRect;
642
    lpDDSSrc: IDirectDrawSurface;
643
    lprSrc: PRect;
644
    dwFlags: DWORD;
4 daniel-mar 645
    lpDDBltFx: TDDBltFX;
1 daniel-mar 646
  end;
647
 
4 daniel-mar 648
(*
649
 * TDDGammaRamp
650
 *)
1 daniel-mar 651
  PDDGammaRamp = ^TDDGammaRamp;
4 daniel-mar 652
  TDDGammaRamp = packed record
653
    red   : array[0..255] of WORD;
654
    green : array[0..255] of WORD;
655
    blue  : array[0..255] of WORD;
1 daniel-mar 656
  end;
657
 
4 daniel-mar 658
(*
659
 *  This is the structure within which DirectDraw returns data about the current graphics driver and chipset
660
 *)
1 daniel-mar 661
 
662
  PDDDeviceIdentifier = ^TDDDeviceIdentifier;
4 daniel-mar 663
  TDDDeviceIdentifier = packed record
1 daniel-mar 664
    //
665
    // These elements are for presentation to the user only. They should not be used to identify particular
666
    // drivers, since this is unreliable and many different strings may be associated with the same
667
    // device, and the same driver from different vendors.
668
    //
669
    szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
670
    szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
671
 
672
    //
673
    // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
674
    // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
675
    // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
676
    //
677
    // This version has the form:
678
    //  wProduct = HIWORD(liDriverVersion.HighPart)
679
    //  wVersion = LOWORD(liDriverVersion.HighPart)
680
    //  wSubVersion = HIWORD(liDriverVersion.LowPart)
681
    //  wBuild = LOWORD(liDriverVersion.LowPart)
682
    //
683
    liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
684
 
685
    //
686
    // These elements can be used to identify particular chipsets. Use with extreme caution.
687
    //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
688
    //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
689
    //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
690
    //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
691
    //
692
    dwVendorId: DWORD;
693
    dwDeviceId: DWORD;
694
    dwSubSysId: DWORD;
695
    dwRevision: DWORD;
696
 
697
    //
698
    // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
699
    // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
700
    // reprofile the graphics subsystem.
701
    // This element can also be used to identify particular problematic drivers.
702
    //
703
    guidDeviceIdentifier: TGUID;
704
  end;
705
 
706
  PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;
4 daniel-mar 707
  TDDDeviceIdentifier2 = packed record
1 daniel-mar 708
    //
709
    // These elements are for presentation to the user only. They should not be used to identify particular
710
    // drivers, since this is unreliable and many different strings may be associated with the same
711
    // device, and the same driver from different vendors.
712
    //
713
    szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
714
    szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
715
 
716
    //
717
    // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
718
    // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
719
    // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
720
    //
721
    // This version has the form:
722
    //  wProduct = HIWORD(liDriverVersion.HighPart)
723
    //  wVersion = LOWORD(liDriverVersion.HighPart)
724
    //  wSubVersion = HIWORD(liDriverVersion.LowPart)
725
    //  wBuild = LOWORD(liDriverVersion.LowPart)
726
    //
727
    liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
728
 
729
    //
730
    // These elements can be used to identify particular chipsets. Use with extreme caution.
731
    //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
732
    //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
733
    //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
734
    //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
735
    //
736
    dwVendorId: DWORD;
737
    dwDeviceId: DWORD;
738
    dwSubSysId: DWORD;
739
    dwRevision: DWORD;
740
 
741
    //
742
    // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
743
    // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
744
    // reprofile the graphics subsystem.
745
    // This element can also be used to identify particular problematic drivers.
746
    //
747
    guidDeviceIdentifier: TGUID;
748
 
4 daniel-mar 749
    (*
750
     * This element is used to determine the Windows Hardware Quality Lab (WHQL)
751
     * certification level for this driver/device pair.
752
     *)
1 daniel-mar 753
    dwWHQLLevel: DWORD;
754
  end;
755
 
4 daniel-mar 756
(*
757
 * callbacks
758
 *)
1 daniel-mar 759
  TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;
760
      Code: DWORD; lpContext: Pointer): HResult; stdcall;
761
  TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
762
 
4 daniel-mar 763
(*
764
 * TDDSurfaceDesc
765
 *)
766
  PDDSurfaceDesc_DX5 = ^TDDSurfaceDesc_DX5;
767
  TDDSurfaceDesc_DX5 = packed record
768
    dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
769
    dwFlags: DWORD;                // determines what fields are valid
770
    dwHeight: DWORD;               // height of surface to be created
771
    dwWidth: DWORD;                // width of input surface
772
    case Integer of
773
    0: (
774
      dwLinearSize : DWORD;       // unused at the moment
775
     );
776
    1: (
777
      lPitch: LongInt;                 // distance to start of next line (return value only)
778
      dwBackBufferCount: DWORD;      // number of back buffers requested
779
      case Integer of
780
      0: (
781
        dwMipMapCount: DWORD;          // number of mip-map levels requested
782
        dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
783
        dwReserved: DWORD;             // reserved
784
        lpSurface: Pointer;              // pointer to the associated surface memory
785
        ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
786
        ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
787
        ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
788
        ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
789
        ddpfPixelFormat: TDDPixelFormat_DX5; // pixel format description of the surface
790
        ddsCaps: TDDSCaps;                // direct draw surface capabilities
791
       );
792
      1: (
793
        dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
794
       );
795
      2: (
796
        dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
797
       );
798
     );
799
  end;
1 daniel-mar 800
 
4 daniel-mar 801
  PDDSurfaceDesc_DX6 = ^TDDSurfaceDesc_DX6;
802
  TDDSurfaceDesc_DX6 = packed record
803
    dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
804
    dwFlags: DWORD;                // determines what fields are valid
805
    dwHeight: DWORD;               // height of surface to be created
806
    dwWidth: DWORD;                // width of input surface
807
    case Integer of
808
    0: (
809
      dwLinearSize : DWORD;       // unused at the moment
810
     );
811
    1: (
812
      lPitch: LongInt;                 // distance to start of next line (return value only)
813
      dwBackBufferCount: DWORD;      // number of back buffers requested
814
      case Integer of
815
      0: (
816
        dwMipMapCount: DWORD;          // number of mip-map levels requested
817
        dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
818
        dwReserved: DWORD;             // reserved
819
        lpSurface: Pointer;              // pointer to the associated surface memory
820
        ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
821
        ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
822
        ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
823
        ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
824
        ddpfPixelFormat: TDDPixelFormat_DX6; // pixel format description of the surface
825
        ddsCaps: TDDSCaps;                // direct draw surface capabilities
826
       );
827
      1: (
828
        dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
829
       );
830
      2: (
831
        dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
832
       );
833
     );
834
  end;
1 daniel-mar 835
 
4 daniel-mar 836
  PDDSurfaceDesc = ^TDDSurfaceDesc;
837
{$IFDEF DIRECTX5}
838
  TDDSurfaceDesc = TDDSurfaceDesc_DX5;
839
{$ELSE}
840
  TDDSurfaceDesc = TDDSurfaceDesc_DX6;
841
{$ENDIF}
1 daniel-mar 842
 
843
 
4 daniel-mar 844
(*
845
 * TDDSurfaceDesc2
846
 *)
847
  PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
848
  TDDSurfaceDesc2 = packed record
849
    dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
850
    dwFlags: DWORD;                // determines what fields are valid
851
    dwHeight: DWORD;               // height of surface to be created
852
    dwWidth: DWORD;                // width of input surface
853
    case Integer of
854
    0: (
855
      lPitch : LongInt;                  // distance to start of next line (return value only)
856
     );
857
    1: (
858
      dwLinearSize : DWORD;              // Formless late-allocated optimized surface size
859
      dwBackBufferCount: DWORD;          // number of back buffers requested
860
      case Integer of
861
      0: (
862
        dwMipMapCount: DWORD;            // number of mip-map levels requested
863
        dwAlphaBitDepth: DWORD;          // depth of alpha buffer requested
864
        dwReserved: DWORD;               // reserved
865
        lpSurface: Pointer;              // pointer to the associated surface memory
866
        ddckCKDestOverlay: TDDColorKey;  // color key for destination overlay use
867
        ddckCKDestBlt: TDDColorKey;      // color key for destination blt use
868
        ddckCKSrcOverlay: TDDColorKey;   // color key for source overlay use
869
        ddckCKSrcBlt: TDDColorKey;       // color key for source blt use
870
        ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface
871
        ddsCaps: TDDSCaps2;              // direct draw surface capabilities
872
        dwTextureStage: DWORD;           // stage in multitexture cascade
873
       );
874
      1: (
875
        dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
876
       );
877
     );
878
  end;
1 daniel-mar 879
 
4 daniel-mar 880
(*
881
 * TDDOptSurfaceDesc
882
 *)
1 daniel-mar 883
 
4 daniel-mar 884
  PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
885
  TDDOptSurfaceDesc = packed record
886
    dwSize : DWORD;             // size of the DDOPTSURFACEDESC structure
887
    dwFlags : DWORD;            // determines what fields are valid
888
    ddSCaps : TDDSCaps2;        // Common caps like: Memory type
889
    ddOSCaps : TDDOSCaps;       // Common caps like: Memory type
890
    guid : TGUID;               // Compression technique GUID
891
    dwCompressionRatio : DWORD; // Compression ratio
892
  end;
893
 
894
(*
895
 * DDCOLORCONTROL
896
 *)
897
  PDDColorControl = ^TDDColorControl;
898
  TDDColorControl = packed record
899
    dwSize: DWORD;
900
    dwFlags: DWORD;
901
    lBrightness: LongInt;
902
    lContrast: LongInt;
903
    lHue: LongInt;
904
    lSaturation: LongInt;
905
    lSharpness: LongInt;
906
    lGamma: LongInt;
907
    lColorEnable: LongInt;
908
    dwReserved1: DWORD;
909
  end;
910
 
911
(*
912
 * callbacks
913
 *)
914
 
915
{$IFNDEF WINNT}
916
  TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc;
917
      lpContext: Pointer) : HResult; stdcall;
918
  TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2;
919
      lpContext: Pointer) : HResult; stdcall;
920
  TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface;
921
      const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer) : HResult; stdcall;
922
  TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4;
923
      const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
924
  TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7;
925
      const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
926
{$ENDIF}
927
 
928
(*
929
 * INTERACES FOLLOW:
930
 *      IDirectDraw
931
 *      IDirectDrawClipper
932
 *      IDirectDrawPalette
933
 *      IDirectDrawSurface
934
 *)
935
 
936
(*
937
 * IDirectDraw
938
 *)
939
 
940
  IDirectDraw = interface (IUnknown)
1 daniel-mar 941
    ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
4 daniel-mar 942
    (*** IDirectDraw methods ***)
1 daniel-mar 943
    function Compact: HResult; stdcall;
4 daniel-mar 944
    function CreateClipper (dwFlags: DWORD;
945
        out lplpDDClipper: IDirectDrawClipper;
946
        pUnkOuter: IUnknown) : HResult; stdcall;
947
    function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
948
        out lplpDDPalette: IDirectDrawPalette;
949
        pUnkOuter: IUnknown) : HResult; stdcall;
950
    function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
951
        out lplpDDSurface: IDirectDrawSurface;
952
        pUnkOuter: IUnknown) : HResult; stdcall;
953
    function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
954
        out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
955
    function EnumDisplayModes (dwFlags: DWORD;
956
        lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
957
        lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
958
    function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
959
        lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
960
        HResult; stdcall;
1 daniel-mar 961
    function FlipToGDISurface: HResult; stdcall;
4 daniel-mar 962
    function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
963
    function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
964
    function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
965
    function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) :
966
        HResult; stdcall;
967
    function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
968
    function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
969
    function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
970
    function Initialize (lpGUID: PGUID) : HResult; stdcall;
1 daniel-mar 971
    function RestoreDisplayMode: HResult; stdcall;
4 daniel-mar 972
    function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
973
    (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
974
    function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD;
975
        dwBpp: DWORD) : HResult; stdcall;
976
    function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
977
        HResult; stdcall;
1 daniel-mar 978
  end;
979
 
4 daniel-mar 980
  IDirectDraw2 = interface (IUnknown)
1 daniel-mar 981
    ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
4 daniel-mar 982
    (*** IDirectDraw methods ***)
1 daniel-mar 983
    function Compact: HResult; stdcall;
4 daniel-mar 984
    function CreateClipper (dwFlags: DWORD;
985
        out lplpDDClipper: IDirectDrawClipper;
986
        pUnkOuter: IUnknown) : HResult; stdcall;
987
    function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
988
        out lplpDDPalette: IDirectDrawPalette;
989
        pUnkOuter: IUnknown) : HResult; stdcall;
990
    function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
991
        out lplpDDSurface: IDirectDrawSurface;
992
        pUnkOuter: IUnknown) : HResult; stdcall;
993
    function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
994
        out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
995
    function EnumDisplayModes (dwFlags: DWORD;
996
        lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
997
        lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
998
    function EnumSurfaces (dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc;
999
        lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
1000
        HResult; stdcall;
1 daniel-mar 1001
    function FlipToGDISurface: HResult; stdcall;
4 daniel-mar 1002
    function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
1003
    function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1004
    function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
1005
    function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) : HResult; stdcall;
1006
    function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
1007
    function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
1008
    function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
1009
    function Initialize (lpGUID: PGUID) : HResult; stdcall;
1 daniel-mar 1010
    function RestoreDisplayMode: HResult; stdcall;
4 daniel-mar 1011
    function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
1012
(*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
1013
    function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
1014
        dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
1015
    function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
1016
        HResult; stdcall;
1017
    (*** Added in the v2 interface ***)
1018
    function GetAvailableVidMem (var lpDDSCaps: TDDSCaps;
1019
        out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
1 daniel-mar 1020
  end;
1021
 
4 daniel-mar 1022
  IDirectDraw4 = interface (IUnknown)
1023
    ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}']
1024
    (*** IDirectDraw methods ***)
1 daniel-mar 1025
    function Compact: HResult; stdcall;
4 daniel-mar 1026
    function CreateClipper (dwFlags: DWORD;
1027
        out lplpDDClipper: IDirectDrawClipper;
1028
        pUnkOuter: IUnknown) : HResult; stdcall;
1029
    function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
1030
        out lplpDDPalette: IDirectDrawPalette;
1031
        pUnkOuter: IUnknown) : HResult; stdcall;
1032
    function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
1033
        out lplpDDSurface: IDirectDrawSurface4;
1034
        pUnkOuter: IUnknown) : HResult; stdcall;
1035
    function DuplicateSurface (lpDDSurface: IDirectDrawSurface4;
1036
        out lplpDupDDSurface: IDirectDrawSurface4) : HResult; stdcall;
1037
    function EnumDisplayModes (dwFlags: DWORD;
1038
        lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
1039
        lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
1040
    function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
1041
        lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2) :
1042
        HResult; stdcall;
1 daniel-mar 1043
    function FlipToGDISurface: HResult; stdcall;
4 daniel-mar 1044
    function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
1045
    function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1046
    function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
1047
    function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface4) :
1048
        HResult; stdcall;
1049
    function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
1050
    function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
1051
    function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
1052
    function Initialize (lpGUID: PGUID) : HResult; stdcall;
1 daniel-mar 1053
    function RestoreDisplayMode: HResult; stdcall;
4 daniel-mar 1054
    function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
1055
(*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
1056
    function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
1057
        dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
1058
    function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
1059
        HResult; stdcall;
1060
    (*** Added in the v2 interface ***)
1061
    function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
1062
        out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
1063
    (*** Added in the V4 Interface ***)
1064
    function GetSurfaceFromDC (hdc : Windows.HDC;
1065
        out lpDDS4: IDirectDrawSurface4) : HResult; stdcall;
1066
    function RestoreAllSurfaces : HResult; stdcall;
1067
    function TestCooperativeLevel : HResult; stdcall;
1068
    function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier;
1069
        dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 1070
  end;
1071
 
4 daniel-mar 1072
  IDirectDraw7 = interface (IUnknown)
1073
    ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}']
1074
    (*** IDirectDraw methods ***)
1 daniel-mar 1075
    function Compact: HResult; stdcall;
4 daniel-mar 1076
    function CreateClipper (dwFlags: DWORD;
1077
        out lplpDDClipper: IDirectDrawClipper;
1078
        pUnkOuter: IUnknown) : HResult; stdcall;
1079
    function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
1080
        out lplpDDPalette: IDirectDrawPalette;
1081
        pUnkOuter: IUnknown) : HResult; stdcall;
1082
    function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
1083
        out lplpDDSurface: IDirectDrawSurface7;
1084
        pUnkOuter: IUnknown) : HResult; stdcall;
1085
    function DuplicateSurface (lpDDSurface: IDirectDrawSurface7;
1086
        out lplpDupDDSurface: IDirectDrawSurface7) : HResult; stdcall;
1087
    function EnumDisplayModes (dwFlags: DWORD;
1088
        lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
1089
        lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
1090
    function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
1091
        lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) :
1092
        HResult; stdcall;
1 daniel-mar 1093
    function FlipToGDISurface: HResult; stdcall;
4 daniel-mar 1094
    function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
1095
    function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1096
    function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
1097
    function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface7) :
1098
        HResult; stdcall;
1099
    function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
1100
    function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
1101
    function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
1102
    function Initialize (lpGUID: PGUID) : HResult; stdcall;
1 daniel-mar 1103
    function RestoreDisplayMode: HResult; stdcall;
4 daniel-mar 1104
    function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
1105
    function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
1106
        dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
1107
    function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
1108
        HResult; stdcall;
1109
    (*** Added in the v2 interface ***)
1110
    function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
1111
        out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
1112
    (*** Added in the V4 Interface ***)
1113
    function GetSurfaceFromDC (hdc : Windows.HDC;
1114
        out lpDDS: IDirectDrawSurface7) : HResult; stdcall;
1115
    function RestoreAllSurfaces : HResult; stdcall;
1116
    function TestCooperativeLevel : HResult; stdcall;
1117
    function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier2;
1118
        dwFlags: DWORD) : HResult; stdcall;
1119
    function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD) : HResult; stdcall;
1120
    function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD) : HResult; stdcall;
1 daniel-mar 1121
  end;
1122
 
1123
 
4 daniel-mar 1124
 
1125
(*
1126
 * IDirectDrawPalette
1127
 *)
1128
 
1129
  IDirectDrawPalette = interface (IUnknown)
1 daniel-mar 1130
    ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
4 daniel-mar 1131
    (*** IDirectDrawPalette methods ***)
1132
    function GetCaps (out lpdwCaps: DWORD) : HResult; stdcall;
1133
    function GetEntries (dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;
1134
        lpEntries: pointer) : HResult; stdcall;
1135
    function Initialize (lpDD: IDirectDraw; dwFlags: DWORD;
1136
        lpDDColorTable: pointer) : HResult; stdcall;
1137
    function SetEntries (dwFlags: DWORD; dwStartingEntry: DWORD;
1138
        dwCount: DWORD; lpEntries: pointer) : HResult; stdcall;
1 daniel-mar 1139
  end;
1140
 
4 daniel-mar 1141
(*
1142
 * IDirectDrawClipper
1143
 *)
1 daniel-mar 1144
 
4 daniel-mar 1145
  IDirectDrawClipper = interface (IUnknown)
1 daniel-mar 1146
    ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
4 daniel-mar 1147
    (*** IDirectDrawClipper methods ***)
1148
    function GetClipList (lpRect: PRect; lpClipList: PRgnData;
1149
        var lpdwSize: DWORD) : HResult; stdcall;
1150
    function GetHWnd (out lphWnd: HWND) : HResult; stdcall;
1151
    function Initialize (lpDD: IDirectDraw; dwFlags: DWORD) : HResult; stdcall;
1152
    function IsClipListChanged (out lpbChanged: BOOL) : HResult; stdcall;
1153
    function SetClipList (lpClipList: PRgnData; dwFlags: DWORD) : HResult; stdcall;
1154
    function SetHWnd (dwFlags: DWORD; hWnd: HWND) : HResult; stdcall;
1 daniel-mar 1155
  end;
1156
 
4 daniel-mar 1157
(*
1158
 * IDirectDrawSurface and related interfaces
1159
 *)
1 daniel-mar 1160
 
4 daniel-mar 1161
  IDirectDrawSurface = interface (IUnknown)
1 daniel-mar 1162
    ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
4 daniel-mar 1163
    (*** IDirectDrawSurface methods ***)
1164
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface) :
1165
        HResult; stdcall;
1166
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1167
    function Blt (lpDestRect: PRect;
1168
        lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
1169
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1170
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1171
        dwFlags: DWORD) : HResult; stdcall;
1172
    function BltFast (dwX: DWORD; dwY: DWORD;
1173
        lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
1174
        dwTrans: DWORD) : HResult; stdcall;
1175
    function DeleteAttachedSurface (dwFlags: DWORD;
1176
        lpDDSAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
1177
    function EnumAttachedSurfaces (lpContext: Pointer;
1178
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1179
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1180
        lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1181
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface;
1182
        dwFlags: DWORD) : HResult; stdcall;
1183
    function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
1184
        (*out*)var lplpDDAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
1185
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1186
    function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
1187
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1188
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1189
        HResult; stdcall;
1190
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1191
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1192
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1193
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1194
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1195
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1196
    function Initialize (lpDD: IDirectDraw;
1197
        out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1 daniel-mar 1198
    function IsLost: HResult; stdcall;
4 daniel-mar 1199
    function Lock (lpDestRect: PRect; out lpDDSurfaceDesc:
1200
        TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle) : HResult; stdcall;
1201
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1202
    function _Restore: HResult; stdcall;
1203
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1204
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1205
        HResult; stdcall;
1206
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1207
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1208
    function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
1209
    function UpdateOverlay (lpSrcRect: PRect;
1210
        lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect;
1211
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1212
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1213
    function UpdateOverlayZOrder (dwFlags: DWORD;
1214
        lpDDSReference: IDirectDrawSurface) : HResult; stdcall;
1 daniel-mar 1215
  end;
1216
 
4 daniel-mar 1217
(*
1218
 * IDirectDrawSurface2 and related interfaces
1219
 *)
1 daniel-mar 1220
 
4 daniel-mar 1221
  IDirectDrawSurface2 = interface (IUnknown)
1222
    ['{57805885-6eec-11cf-9441-a82303c10e27}']
1223
    (*** IDirectDrawSurface methods ***)
1224
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface2) :
1225
        HResult; stdcall;
1226
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1227
    function Blt (lpDestRect: PRect;
1228
        lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
1229
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1230
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1231
        dwFlags: DWORD) : HResult; stdcall;
1232
    function BltFast (dwX: DWORD; dwY: DWORD;
1233
        lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
1234
        dwTrans: DWORD) : HResult; stdcall;
1235
    function DeleteAttachedSurface (dwFlags: DWORD;
1236
        lpDDSAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
1237
    function EnumAttachedSurfaces (lpContext: Pointer;
1238
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1239
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1240
        lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1241
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface2;
1242
        dwFlags: DWORD) : HResult; stdcall;
1243
    function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
1244
        out lplpDDAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
1245
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1246
    function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
1247
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1248
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1249
        HResult; stdcall;
1250
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1251
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1252
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1253
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1254
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1255
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1256
    function Initialize (lpDD: IDirectDraw;
1257
        out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1 daniel-mar 1258
    function IsLost: HResult; stdcall;
4 daniel-mar 1259
    function Lock (lpDestRect: PRect;
1260
        out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
1261
        hEvent: THandle) : HResult; stdcall;
1262
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1263
    function _Restore: HResult; stdcall;
1264
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1265
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1266
        HResult; stdcall;
1267
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1268
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1269
    function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
1270
    function UpdateOverlay (lpSrcRect: PRect;
1271
        lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect;
1272
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1273
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1274
    function UpdateOverlayZOrder (dwFlags: DWORD;
1275
        lpDDSReference: IDirectDrawSurface2) : HResult; stdcall;
1276
    (*** Added in the v2 interface ***)
1277
    function GetDDInterface (var lplpDD: IDirectDraw) : HResult; stdcall;
1278
    function PageLock (dwFlags: DWORD) : HResult; stdcall;
1279
    function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 1280
  end;
1281
 
4 daniel-mar 1282
  IDirectDrawSurface3 = interface (IUnknown)
1 daniel-mar 1283
    ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']
4 daniel-mar 1284
    (*** IDirectDrawSurface methods ***)
1285
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface3) :
1286
        HResult; stdcall;
1287
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1288
    function Blt (lpDestRect: PRect;
1289
        lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
1290
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1291
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1292
        dwFlags: DWORD) : HResult; stdcall;
1293
    function BltFast (dwX: DWORD; dwY: DWORD;
1294
        lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
1295
        dwTrans: DWORD) : HResult; stdcall;
1296
    function DeleteAttachedSurface (dwFlags: DWORD;
1297
        lpDDSAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
1298
    function EnumAttachedSurfaces (lpContext: Pointer;
1299
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1300
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1301
        lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1302
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface3;
1303
        dwFlags: DWORD) : HResult; stdcall;
1304
    function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
1305
        out lplpDDAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
1306
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1307
    function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
1308
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1309
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1310
        HResult; stdcall;
1311
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1312
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1313
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1314
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1315
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1316
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1317
    function Initialize (lpDD: IDirectDraw;
1318
        out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1 daniel-mar 1319
    function IsLost: HResult; stdcall;
4 daniel-mar 1320
    function Lock (lpDestRect: PRect;
1321
        out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
1322
        hEvent: THandle) : HResult; stdcall;
1323
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1324
    function _Restore: HResult; stdcall;
1325
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1326
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1327
        HResult; stdcall;
1328
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1329
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1330
    function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
1331
    function UpdateOverlay (lpSrcRect: PRect;
1332
        lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect;
1333
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1334
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1335
    function UpdateOverlayZOrder (dwFlags: DWORD;
1336
        lpDDSReference: IDirectDrawSurface3) : HResult; stdcall;
1337
    (*** Added in the v2 interface ***)
1338
    function GetDDInterface (out lplpDD: IDirectDraw) : HResult; stdcall;
1339
    function PageLock (dwFlags: DWORD) : HResult; stdcall;
1340
    function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
1341
    (*** Added in the V3 interface ***)
1342
    function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 1343
  end;
1344
 
4 daniel-mar 1345
(*
1346
 * IDirectDrawSurface4 and related interfaces
1347
 *)
1348
  IDirectDrawSurface4 = interface (IUnknown)
1 daniel-mar 1349
    ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']
4 daniel-mar 1350
    (*** IDirectDrawSurface methods ***)
1351
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface4) :
1352
        HResult; stdcall;
1353
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1354
    function Blt (lpDestRect: PRect;
1355
        lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
1356
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1357
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1358
        dwFlags: DWORD) : HResult; stdcall;
1359
    function BltFast (dwX: DWORD; dwY: DWORD;
1360
        lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
1361
        dwTrans: DWORD) : HResult; stdcall;
1362
    function DeleteAttachedSurface (dwFlags: DWORD;
1363
        lpDDSAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
1364
    function EnumAttachedSurfaces (lpContext: Pointer;
1365
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
1366
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1367
        lpfnCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
1368
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface4;
1369
        dwFlags: DWORD) : HResult; stdcall;
1370
    function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
1371
        out lplpDDAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
1372
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1373
    function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
1374
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1375
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1376
        HResult; stdcall;
1377
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1378
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1379
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1380
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1381
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1382
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1383
    function Initialize (lpDD: IDirectDraw;
1384
        out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1 daniel-mar 1385
    function IsLost: HResult; stdcall;
4 daniel-mar 1386
    function Lock (lpDestRect: PRect;
1387
        out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
1388
        hEvent: THandle) : HResult; stdcall;
1389
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1390
    function _Restore: HResult; stdcall;
1391
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1392
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1393
        HResult; stdcall;
1394
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1395
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1396
    function Unlock (lpRect: PRect) : HResult; stdcall;
1397
    function UpdateOverlay (lpSrcRect: PRect;
1398
        lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect;
1399
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1400
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1401
    function UpdateOverlayZOrder (dwFlags: DWORD;
1402
        lpDDSReference: IDirectDrawSurface4) : HResult; stdcall;
1403
    (*** Added in the v2 interface ***)
1404
    function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
1405
    function PageLock (dwFlags: DWORD) : HResult; stdcall;
1406
    function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
1407
    (*** Added in the V3 interface ***)
1408
    function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
1409
    (*** Added in the v4 interface ***)
1410
    function SetPrivateData(const guidTag: TGUID; lpData: pointer;
1411
        cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
1412
    function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
1413
        var lpcbBufferSize: DWORD) : HResult; stdcall;
1414
    function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
1415
    function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
1416
    function ChangeUniquenessValue : HResult; stdcall;
1 daniel-mar 1417
  end;
1418
 
4 daniel-mar 1419
  IDirectDrawSurface7 = interface (IUnknown)
1420
    ['{06675a80-3b9b-11d2-b92f-00609797ea5b}']
1421
    (*** IDirectDrawSurface methods ***)
1422
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface7) :
1423
        HResult; stdcall;
1424
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1425
    function Blt (lpDestRect: PRect;
1426
        lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
1427
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1428
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1429
        dwFlags: DWORD) : HResult; stdcall;
1430
    function BltFast (dwX: DWORD; dwY: DWORD;
1431
        lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
1432
        dwTrans: DWORD) : HResult; stdcall;
1433
    function DeleteAttachedSurface (dwFlags: DWORD;
1434
        lpDDSAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
1435
    function EnumAttachedSurfaces (lpContext: Pointer;
1436
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
1437
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1438
        lpfnCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
1439
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface7;
1440
        dwFlags: DWORD) : HResult; stdcall;
1441
    function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
1442
        out lplpDDAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
1443
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1444
    function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
1445
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1446
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1447
        HResult; stdcall;
1448
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1449
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1450
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1451
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1452
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1453
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1454
    function Initialize (lpDD: IDirectDraw;
1455
        out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1 daniel-mar 1456
    function IsLost: HResult; stdcall;
4 daniel-mar 1457
    function Lock (lpDestRect: PRect;
1458
        out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
1459
        hEvent: THandle) : HResult; stdcall;
1460
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1461
    function _Restore: HResult; stdcall;
1462
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1463
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1464
        HResult; stdcall;
1465
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1466
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1467
    function Unlock (lpRect: PRect) : HResult; stdcall;
1468
    function UpdateOverlay (lpSrcRect: PRect;
1469
        lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect;
1470
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1471
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1472
    function UpdateOverlayZOrder (dwFlags: DWORD;
1473
        lpDDSReference: IDirectDrawSurface7) : HResult; stdcall;
1474
    (*** Added in the v2 interface ***)
1475
    function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
1476
    function PageLock (dwFlags: DWORD) : HResult; stdcall;
1477
    function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
1478
    (*** Added in the V3 interface ***)
1479
    function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
1480
    (*** Added in the v4 interface ***)
1481
    function SetPrivateData(const guidTag: TGUID; lpData: pointer;
1482
        cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
1483
    function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
1484
        var lpcbBufferSize: DWORD) : HResult; stdcall;
1485
    function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
1486
    function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
1487
    function ChangeUniquenessValue : HResult; stdcall;
1488
    (*** Moved Texture7 methods here ***)
1489
    function SetPriority(dwPriority: DWORD) : HResult; stdcall;
1490
    function GetPriority(out lpdwPriority: DWORD) : HResult; stdcall;
1491
    function SetLOD(dwMaxLOD: DWORD) : HResult; stdcall;
1492
    function GetLOD(out lpdwMaxLOD: DWORD) : HResult; stdcall;
1 daniel-mar 1493
  end;
1494
 
4 daniel-mar 1495
  IDirectDrawColorControl = interface (IUnknown)
1 daniel-mar 1496
    ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
4 daniel-mar 1497
    function GetColorControls(out lpColorControl: TDDColorControl) : HResult; stdcall;
1498
    function SetColorControls(const lpColorControl: TDDColorControl) : HResult; stdcall;
1 daniel-mar 1499
  end;
1500
 
4 daniel-mar 1501
(*
1502
 * IDirectDrawGammaControl
1503
 *)
1504
  IDirectDrawGammaControl = interface (IUnknown)
1 daniel-mar 1505
    ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
4 daniel-mar 1506
    function GetGammaRamp (dwFlags: DWORD; out lpRampData: TDDGammaRamp)
1507
        : HResult; stdcall;
1508
    function SetGammaRamp (dwFlags: DWORD; const lpRampData: TDDGammaRamp)
1509
        : HResult; stdcall;
1 daniel-mar 1510
  end;
1511
 
4 daniel-mar 1512
type
1513
  IID_IDirectDraw = IDirectDraw;
1514
  IID_IDirectDraw2 = IDirectDraw2;
1515
  IID_IDirectDraw4 = IDirectDraw4;
1516
  IID_IDirectDraw7 = IDirectDraw7;
1517
  IID_IDirectDrawSurface = IDirectDrawSurface;
1518
  IID_IDirectDrawSurface2 = IDirectDrawSurface2;
1519
  IID_IDirectDrawSurface3 = IDirectDrawSurface3;
1520
  IID_IDirectDrawSurface4 = IDirectDrawSurface4;
1521
  IID_IDirectDrawSurface7 = IDirectDrawSurface7;
1 daniel-mar 1522
 
4 daniel-mar 1523
  IID_IDirectDrawPalette = IDirectDrawPalette;
1524
  IID_IDirectDrawClipper = IDirectDrawClipper;
1525
  IID_IDirectDrawColorControl = IDirectDrawColorControl;
1526
  IID_IDirectDrawGammaControl = IDirectDrawGammaControl;
1 daniel-mar 1527
 
4 daniel-mar 1528
const  
1529
(*
1530
 * ddsCaps field is valid.
1531
 *)
1 daniel-mar 1532
  DDSD_CAPS               = $00000001;     // default
4 daniel-mar 1533
 
1534
(*
1535
 * dwHeight field is valid.
1536
 *)
1 daniel-mar 1537
  DDSD_HEIGHT             = $00000002;
4 daniel-mar 1538
 
1539
(*
1540
 * dwWidth field is valid.
1541
 *)
1 daniel-mar 1542
  DDSD_WIDTH              = $00000004;
4 daniel-mar 1543
 
1544
(*
1545
 * lPitch is valid.
1546
 *)
1 daniel-mar 1547
  DDSD_PITCH              = $00000008;
4 daniel-mar 1548
 
1549
(*
1550
 * dwBackBufferCount is valid.
1551
 *)
1 daniel-mar 1552
  DDSD_BACKBUFFERCOUNT    = $00000020;
4 daniel-mar 1553
 
1554
(*
1555
 * dwZBufferBitDepth is valid.  (shouldnt be used in DDSURFACEDESC2)
1556
 *)
1 daniel-mar 1557
  DDSD_ZBUFFERBITDEPTH    = $00000040;
4 daniel-mar 1558
 
1559
(*
1560
 * dwAlphaBitDepth is valid.
1561
 *)
1562
   DDSD_ALPHABITDEPTH      = $00000080;
1563
 
1564
(*
1565
 * lpSurface is valid.
1566
 *)
1567
  DDSD_LPSURFACE           = $00000800;
1568
 
1569
(*
1570
 * ddpfPixelFormat is valid.
1571
 *)
1 daniel-mar 1572
  DDSD_PIXELFORMAT        = $00001000;
4 daniel-mar 1573
 
1574
(*
1575
 * ddckCKDestOverlay is valid.
1576
 *)
1 daniel-mar 1577
  DDSD_CKDESTOVERLAY      = $00002000;
4 daniel-mar 1578
 
1579
(*
1580
 * ddckCKDestBlt is valid.
1581
 *)
1 daniel-mar 1582
  DDSD_CKDESTBLT          = $00004000;
4 daniel-mar 1583
 
1584
(*
1585
 * ddckCKSrcOverlay is valid.
1586
 *)
1 daniel-mar 1587
  DDSD_CKSRCOVERLAY       = $00008000;
4 daniel-mar 1588
 
1589
(*
1590
 * ddckCKSrcBlt is valid.
1591
 *)
1 daniel-mar 1592
  DDSD_CKSRCBLT           = $00010000;
4 daniel-mar 1593
 
1594
(*
1595
 * dwMipMapCount is valid.
1596
 *)
1 daniel-mar 1597
  DDSD_MIPMAPCOUNT        = $00020000;
4 daniel-mar 1598
 
1599
 (*
1600
  * dwRefreshRate is valid
1601
  *)
1 daniel-mar 1602
  DDSD_REFRESHRATE        = $00040000;
4 daniel-mar 1603
 
1604
(*
1605
 * dwLinearSize is valid
1606
 *)
1607
  DDSD_LINEARSIZE         = $00080000;
1608
 
1609
(*
1610
 * dwTextureStage is valid
1611
 *)
1 daniel-mar 1612
  DDSD_TEXTURESTAGE       = $00100000;
1613
 
4 daniel-mar 1614
(*
1615
 * All input fields are valid.
1616
 *)
1617
  DDSD_ALL                = $001ff9ee;
1 daniel-mar 1618
 
1619
 
4 daniel-mar 1620
(*
1621
 * guid field is valid.
1622
 *)
1623
  DDOSD_GUID                  = $00000001;
1 daniel-mar 1624
 
4 daniel-mar 1625
(*
1626
 * dwCompressionRatio field is valid.
1627
 *)
1628
  DDOSD_COMPRESSION_RATIO     = $00000002;
1 daniel-mar 1629
 
4 daniel-mar 1630
(*
1631
 * ddSCaps field is valid.
1632
 *)
1633
  DDOSD_SCAPS                 = $00000004;
1 daniel-mar 1634
 
4 daniel-mar 1635
(*
1636
 * ddOSCaps field is valid.
1637
 *)
1638
  DDOSD_OSCAPS                = $00000008;
1 daniel-mar 1639
 
4 daniel-mar 1640
(*
1641
 * All input fields are valid.
1642
 *)
1643
  DDOSD_ALL                   = $0000000f;
1 daniel-mar 1644
 
4 daniel-mar 1645
(*
1646
 * The surface's optimized pixelformat is compressed
1647
 *)
1648
  DDOSDCAPS_OPTCOMPRESSED                       = $00000001;
1 daniel-mar 1649
 
4 daniel-mar 1650
(*
1651
 * The surface's optimized pixelformat is reordered
1652
 *)
1653
  DDOSDCAPS_OPTREORDERED                        = $00000002;
1 daniel-mar 1654
 
4 daniel-mar 1655
(*
1656
 * The opt surface is a monolithic mipmap
1657
 *)
1658
  DDOSDCAPS_MONOLITHICMIPMAP            = $00000004;
1 daniel-mar 1659
 
4 daniel-mar 1660
(*
1661
 * The valid Surf caps:
1662
 *   DDSCAPS_SYSTEMMEMORY       = $00000800;
1663
 *   DDSCAPS_VIDEOMEMORY        = $00004000;
1664
 *   DDSCAPS_LOCALVIDMEM        = $10000000;
1665
 *   DDSCAPS_NONLOCALVIDMEM     = $20000000;
1666
 *)
1667
  DDOSDCAPS_VALIDSCAPS          = $30004800;
1 daniel-mar 1668
 
4 daniel-mar 1669
(*
1670
 * The valid OptSurf caps
1671
 *)
1672
  DDOSDCAPS_VALIDOSCAPS                 = $00000007;
1 daniel-mar 1673
 
1674
 
4 daniel-mar 1675
(*
1676
 * DDCOLORCONTROL
1677
 *)
1 daniel-mar 1678
 
4 daniel-mar 1679
(*
1680
 * lBrightness field is valid.
1681
 *)
1682
  DDCOLOR_BRIGHTNESS            = $00000001;
1 daniel-mar 1683
 
4 daniel-mar 1684
(*
1685
 * lContrast field is valid.
1686
 *)
1687
  DDCOLOR_CONTRAST              = $00000002;
1688
 
1689
(*
1690
 * lHue field is valid.
1691
 *)
1692
  DDCOLOR_HUE                   = $00000004;
1693
 
1694
(*
1695
 * lSaturation field is valid.
1696
 *)
1697
  DDCOLOR_SATURATION            = $00000008;
1698
 
1699
(*
1700
 * lSharpness field is valid.
1701
 *)
1702
  DDCOLOR_SHARPNESS             = $00000010;
1703
 
1704
(*
1705
 * lGamma field is valid.
1706
 *)
1707
  DDCOLOR_GAMMA                 = $00000020;
1708
 
1709
(*
1710
 * lColorEnable field is valid.
1711
 *)
1712
  DDCOLOR_COLORENABLE           = $00000040;
1713
 
1714
 
1715
 
1716
(*============================================================================
1717
 *
1718
 * Direct Draw Capability Flags
1719
 *
1720
 * These flags are used to describe the capabilities of a given Surface.
1721
 * All flags are bit flags.
1722
 *
1723
 *==========================================================================*)
1724
 
1725
(****************************************************************************
1726
 *
1727
 * DIRECTDRAWSURFACE CAPABILITY FLAGS
1728
 *
1729
 ****************************************************************************)
1730
(*
1731
 * This bit currently has no meaning.
1732
 *)
1733
  DDSCAPS_RESERVED1                       = $00000001;
1734
 
1735
(*
1736
 * Indicates that this surface contains alpha-only information.
1737
 * (To determine if a surface is RGBA/YUVA, the pixel format must be
1738
 * interrogated.)
1739
 *)
1740
  DDSCAPS_ALPHA                           = $00000002;
1741
 
1742
(*
1743
 * Indicates that this surface is a backbuffer.  It is generally
1744
 * set by CreateSurface when the DDSCAPS_FLIP capability bit is set.
1745
 * It indicates that this surface is THE back buffer of a surface
1746
 * flipping structure.  DirectDraw supports N surfaces in a
1747
 * surface flipping structure.  Only the surface that immediately
1748
 * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set.
1749
 * The other surfaces are identified as back buffers by the presence
1750
 * of the DDSCAPS_FLIP capability, their attachment order, and the
1751
 * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER
1752
 * capabilities.  The bit is sent to CreateSurface when a standalone
1753
 * back buffer is being created.  This surface could be attached to
1754
 * a front buffer and/or back buffers to form a flipping surface
1755
 * structure after the CreateSurface call.  See AddAttachments for
1756
 * a detailed description of the behaviors in this case.
1757
 *)
1758
  DDSCAPS_BACKBUFFER                      = $00000004;
1759
 
1760
(*
1761
 * Indicates a complex surface structure is being described.  A
1762
 * complex surface structure results in the creation of more than
1763
 * one surface.  The additional surfaces are attached to the root
1764
 * surface.  The complex structure can only be destroyed by
1765
 * destroying the root.
1766
 *)
1767
  DDSCAPS_COMPLEX                         = $00000008;
1768
 
1769
(*
1770
 * Indicates that this surface is a part of a surface flipping structure.
1771
 * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and
1772
 * DDSCAP_BACKBUFFER bits are not set.  They are set by CreateSurface
1773
 * on the resulting creations.  The dwBackBufferCount field in the
1774
 * TDDSurfaceDesc structure must be set to at least 1 in order for
1775
 * the CreateSurface call to succeed.  The DDSCAPS_COMPLEX capability
1776
 * must always be set with creating multiple surfaces through CreateSurface.
1777
 *)
1778
  DDSCAPS_FLIP                            = $00000010;
1779
 
1780
(*
1781
 * Indicates that this surface is THE front buffer of a surface flipping
1782
 * structure.  It is generally set by CreateSurface when the DDSCAPS_FLIP
1783
 * capability bit is set.
1784
 * If this capability is sent to CreateSurface then a standalonw front buffer
1785
 * is created.  This surface will not have the DDSCAPS_FLIP capability.
1786
 * It can be attached to other back buffers to form a flipping structure.
1787
 * See AddAttachments for a detailed description of the behaviors in this
1788
 * case.
1789
 *)
1790
  DDSCAPS_FRONTBUFFER                     = $00000020;
1791
 
1792
(*
1793
 * Indicates that this surface is any offscreen surface that is not an overlay,
1794
 * texture, zbuffer, front buffer, back buffer, or alpha surface.  It is used
1795
 * to identify plain vanilla surfaces.
1796
 *)
1797
  DDSCAPS_OFFSCREENPLAIN                  = $00000040;
1798
 
1799
(*
1800
 * Indicates that this surface is an overlay.  It may or may not be directly visible
1801
 * depending on whether or not it is currently being overlayed onto the primary
1802
 * surface.  DDSCAPS_VISIBLE can be used to determine whether or not it is being
1803
 * overlayed at the moment.
1804
 *)
1805
  DDSCAPS_OVERLAY                         = $00000080;
1806
 
1807
(*
1808
 * Indicates that unique DirectDrawPalette objects can be created and
1809
 * attached to this surface.
1810
 *)
1811
  DDSCAPS_PALETTE                         = $00000100;
1812
 
1813
(*
1814
 * Indicates that this surface is the primary surface.  The primary
1815
 * surface represents what the user is seeing at the moment.
1816
 *)
1817
  DDSCAPS_PRIMARYSURFACE                  = $00000200;
1818
 
1819
(*
1820
 * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now
1821
 * obsolete.
1822
 *)
1823
  DDSCAPS_RESERVED3              = $00000400;
1824
(*
1825
 * Indicates that this surface is the primary surface for the left eye.
1826
 * The primary surface for the left eye represents what the user is seeing
1827
 * at the moment with the users left eye.  When this surface is created the
1828
 * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users
1829
 * right eye.
1830
 *)
1831
  DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3;
1832
 
1833
(*
1834
 * Indicates that this surface memory was allocated in system memory
1835
 *)
1836
  DDSCAPS_SYSTEMMEMORY                    = $00000800;
1837
 
1838
(*
1839
 * Indicates that this surface can be used as a 3D texture.  It does not
1840
 * indicate whether or not the surface is being used for that purpose.
1841
 *)
1842
  DDSCAPS_TEXTURE                         = $00001000;
1843
 
1844
(*
1845
 * Indicates that a surface may be a destination for 3D rendering.  This
1846
 * bit must be set in order to query for a Direct3D Device Interface
1847
 * from this surface.
1848
 *)
1849
  DDSCAPS_3DDEVICE                        = $00002000;
1850
 
1851
(*
1852
 * Indicates that this surface exists in video memory.
1853
 *)
1854
  DDSCAPS_VIDEOMEMORY                     = $00004000;
1855
 
1856
(*
1857
 * Indicates that changes made to this surface are immediately visible.
1858
 * It is always set for the primary surface and is set for overlays while
1859
 * they are being overlayed and texture maps while they are being textured.
1860
 *)
1861
  DDSCAPS_VISIBLE                         = $00008000;
1862
 
1863
(*
1864
 * Indicates that only writes are permitted to the surface.  Read accesses
1865
 * from the surface may or may not generate a protection fault, but the
1866
 * results of a read from this surface will not be meaningful.  READ ONLY.
1867
 *)
1868
  DDSCAPS_WRITEONLY                       = $00010000;
1869
 
1870
(*
1871
 * Indicates that this surface is a z buffer. A z buffer does not contain
1872
 * displayable information.  Instead it contains bit depth information that is
1873
 * used to determine which pixels are visible and which are obscured.
1874
 *)
1875
  DDSCAPS_ZBUFFER                         = $00020000;
1876
 
1877
(*
1878
 * Indicates surface will have a DC associated long term
1879
 *)
1880
  DDSCAPS_OWNDC                           = $00040000;
1881
 
1882
(*
1883
 * Indicates surface should be able to receive live video
1884
 *)
1885
  DDSCAPS_LIVEVIDEO                       = $00080000;
1886
 
1887
(*
1888
 * Indicates surface should be able to have a stream decompressed
1889
 * to it by the hardware.
1890
 *)
1891
  DDSCAPS_HWCODEC                         = $00100000;
1892
 
1893
(*
1894
 * Surface is a ModeX surface.
1895
 *
1896
 *)
1897
  DDSCAPS_MODEX                           = $00200000;
1898
 
1899
(*
1900
 * Indicates surface is one level of a mip-map. This surface will
1901
 * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map.
1902
 * This can be done explicitly, by creating a number of surfaces and
1903
 * attaching them with AddAttachedSurface or by implicitly by CreateSurface.
1904
 * If this bit is set then DDSCAPS_TEXTURE must also be set.
1905
 *)
1906
  DDSCAPS_MIPMAP                          = $00400000;
1907
 
1908
(*
1909
 * This bit is reserved. It should not be specified.
1910
 *)
1911
  DDSCAPS_RESERVED2                       = $00800000;
1912
 
1913
(*
1914
 * Indicates that memory for the surface is not allocated until the surface
1915
 * is loaded (via the Direct3D texture Load() function).
1916
 *)
1917
  DDSCAPS_ALLOCONLOAD                     = $04000000;
1918
 
1919
(*
1920
 * Indicates that the surface will recieve data from a video port.
1921
 *)
1922
  DDSCAPS_VIDEOPORT                       = $08000000;
1923
 
1924
(*
1925
 * Indicates that a video memory surface is resident in true, local video
1926
 * memory rather than non-local video memory. If this flag is specified then
1927
 * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
1928
 * DDSCAPS_NONLOCALVIDMEM.
1929
 *)
1930
  DDSCAPS_LOCALVIDMEM                     = $10000000;
1931
 
1932
(*
1933
 * Indicates that a video memory surface is resident in non-local video
1934
 * memory rather than true, local video memory. If this flag is specified
1935
 * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
1936
 * DDSCAPS_LOCALVIDMEM.
1937
 *)
1938
  DDSCAPS_NONLOCALVIDMEM                  = $20000000;
1939
 
1940
(*
1941
 * Indicates that this surface is a standard VGA mode surface, and not a
1942
 * ModeX surface. (This flag will never be set in combination with the
1943
 * DDSCAPS_MODEX flag).
1944
 *)
1945
  DDSCAPS_STANDARDVGAMODE                 = $40000000;
1946
 
1947
(*
1948
 * Indicates that this surface will be an optimized surface. This flag is
1949
 * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface
1950
 * will be created without any underlying video memory until loaded.
1951
 *)
1952
  DDSCAPS_OPTIMIZED                       = $80000000;
1953
 
1954
 
1955
 
1956
(*
1957
 * Indicates that this surface will receive data from a video port using
1958
 * the de-interlacing hardware.  This allows the driver to allocate memory
1959
 * for any extra buffers that may be required.  The DDSCAPS_VIDEOPORT and
1960
 * DDSCAPS_OVERLAY flags must also be set.
1961
 *)
1962
  DDSCAPS2_HARDWAREDEINTERLACE            = $00000002;
1963
 
1964
(*
1965
 * Indicates to the driver that this surface will be locked very frequently
1966
 * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap
1967
 * set must also have DDSCAPS_TEXTURE. This cap cannot be used with
1968
 * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE.
1969
 *)
1970
  DDSCAPS2_HINTDYNAMIC                  = $00000004;
1971
 
1972
(*
1973
 * Indicates to the driver that this surface can be re-ordered/retiled on
1974
 * load. This operation will not change the size of the texture. It is
1975
 * relatively fast and symmetrical, since the application may lock these
1976
 * bits (although it will take a performance hit when doing so). Surfaces
1977
 * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be
1978
 * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE.
1979
 *)
1980
  DDSCAPS2_HINTSTATIC                   = $00000008;
1981
 
1982
(*
1983
 * Indicates that the client would like this texture surface to be managed by the
1984
 * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have
1985
 * DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY.
1986
 *)
1987
  DDSCAPS2_TEXTUREMANAGE                  = $00000010;
1988
 
1989
(*
1990
 * These bits are reserved for internal use *)
1991
  DDSCAPS2_RESERVED1                      = $00000020;
1992
  DDSCAPS2_RESERVED2                      = $00000040;
1993
 
1994
(*
1995
 * Indicates to the driver that this surface will never be locked again.
1996
 * The driver is free to optimize this surface via retiling and actual compression.
1997
 * All calls to Lock() or Blts from this surface will fail. Surfaces with this
1998
 * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with
1999
 * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC.
2000
 *)
2001
  DDSCAPS2_OPAQUE                         = $00000080;
2002
 
2003
(*
2004
 * Applications should set this bit at CreateSurface time to indicate that they
2005
 * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set.
2006
 *)
2007
  DDSCAPS2_HINTANTIALIASING               = $00000100;
2008
 
2009
(*
2010
 * This flag is used at CreateSurface time to indicate that this set of
2011
 * surfaces is a cubic environment map
2012
 *)
2013
  DDSCAPS2_CUBEMAP                        = $00000200;
2014
 
2015
(*
2016
 * These flags preform two functions:
2017
 * - At CreateSurface time, they define which of the six cube faces are
2018
 *   required by the application.
2019
 * - After creation, each face in the cubemap will have exactly one of these
2020
 *   bits set.
2021
 *)
2022
  DDSCAPS2_CUBEMAP_POSITIVEX              = $00000400;
2023
  DDSCAPS2_CUBEMAP_NEGATIVEX              = $00000800;
2024
  DDSCAPS2_CUBEMAP_POSITIVEY              = $00001000;
2025
  DDSCAPS2_CUBEMAP_NEGATIVEY              = $00002000;
2026
  DDSCAPS2_CUBEMAP_POSITIVEZ              = $00004000;
2027
  DDSCAPS2_CUBEMAP_NEGATIVEZ              = $00008000;
2028
 
2029
(*
2030
 * This macro may be used to specify all faces of a cube map at CreateSurface time
2031
 *)
2032
  DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or
2033
                                DDSCAPS2_CUBEMAP_NEGATIVEX or
2034
                                DDSCAPS2_CUBEMAP_POSITIVEY or
2035
                                DDSCAPS2_CUBEMAP_NEGATIVEY or
2036
                                DDSCAPS2_CUBEMAP_POSITIVEZ or
2037
                                DDSCAPS2_CUBEMAP_NEGATIVEZ );
2038
 
2039
 
2040
(*
2041
 * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards
2042
 * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface
2043
 * constructs such as Cube Maps, wherein there are more than one mipmap surface attached
2044
 * to the root surface.
2045
 * This caps bit is ignored by CreateSurface
2046
 *)
2047
  DDSCAPS2_MIPMAPSUBLEVEL                 = $00010000;
2048
 
2049
(* This flag indicates that the texture should be managed by D3D only *)
2050
  DDSCAPS2_D3DTEXTUREMANAGE               = $00020000;
2051
 
2052
(* This flag indicates that the managed surface can be safely lost *)
2053
  DDSCAPS2_DONOTPERSIST                   = $00040000;
2054
 
2055
(* indicates that this surface is part of a stereo flipping chain *)
2056
  DDSCAPS2_STEREOSURFACELEFT              = $00080000;
2057
 
2058
 
2059
 
2060
 (****************************************************************************
2061
 *
2062
 * DIRECTDRAW DRIVER CAPABILITY FLAGS
2063
 *
2064
 ****************************************************************************)
2065
 
2066
(*
2067
 * Display hardware has 3D acceleration.
2068
 *)
2069
  DDCAPS_3D                       = $00000001;
2070
 
2071
(*
2072
 * Indicates that DirectDraw will support only dest rectangles that are aligned
2073
 * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively.
2074
 * READ ONLY.
2075
 *)
2076
  DDCAPS_ALIGNBOUNDARYDEST        = $00000002;
2077
 
2078
(*
2079
 * Indicates that DirectDraw will support only source rectangles  whose sizes in
2080
 * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively.  READ ONLY.
2081
 *)
2082
  DDCAPS_ALIGNSIZEDEST            = $00000004;
2083
(*
2084
 * Indicates that DirectDraw will support only source rectangles that are aligned
2085
 * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively.
2086
 * READ ONLY.
2087
 *)
2088
  DDCAPS_ALIGNBOUNDARYSRC         = $00000008;
2089
 
2090
(*
2091
 * Indicates that DirectDraw will support only source rectangles  whose sizes in
2092
 * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively.  READ ONLY.
2093
 *)
2094
  DDCAPS_ALIGNSIZESRC             = $00000010;
2095
 
2096
(*
2097
 * Indicates that DirectDraw will create video memory surfaces that have a stride
2098
 * alignment equal to DIRECTDRAWCAPS.dwAlignStride.  READ ONLY.
2099
 *)
2100
  DDCAPS_ALIGNSTRIDE              = $00000020;
2101
 
2102
(*
2103
 * Display hardware is capable of blt operations.
2104
 *)
2105
  DDCAPS_BLT                      = $00000040;
2106
 
2107
(*
2108
 * Display hardware is capable of asynchronous blt operations.
2109
 *)
2110
  DDCAPS_BLTQUEUE                 = $00000080;
2111
 
2112
(*
2113
 * Display hardware is capable of color space conversions during the blt operation.
2114
 *)
2115
  DDCAPS_BLTFOURCC                = $00000100;
2116
 
2117
(*
2118
 * Display hardware is capable of stretching during blt operations.
2119
 *)
2120
  DDCAPS_BLTSTRETCH               = $00000200;
2121
 
2122
(*
2123
 * Display hardware is shared with GDI.
2124
 *)
2125
  DDCAPS_GDI                      = $00000400;
2126
 
2127
(*
2128
 * Display hardware can overlay.
2129
 *)
2130
  DDCAPS_OVERLAY                  = $00000800;
2131
 
2132
(*
2133
 * Set if display hardware supports overlays but can not clip them.
2134
 *)
2135
  DDCAPS_OVERLAYCANTCLIP          = $00001000;
2136
 
2137
(*
2138
 * Indicates that overlay hardware is capable of color space conversions during
2139
 * the overlay operation.
2140
 *)
2141
  DDCAPS_OVERLAYFOURCC            = $00002000;
2142
 
2143
(*
2144
 * Indicates that stretching can be done by the overlay hardware.
2145
 *)
2146
  DDCAPS_OVERLAYSTRETCH           = $00004000;
2147
 
2148
(*
2149
 * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces
2150
 * other than the primary surface.
2151
 *)
2152
  DDCAPS_PALETTE                  = $00008000;
2153
 
2154
(*
2155
 * Indicates that palette changes can be syncd with the veritcal refresh.
2156
 *)
2157
  DDCAPS_PALETTEVSYNC             = $00010000;
2158
 
2159
(*
2160
 * Display hardware can return the current scan line.
2161
 *)
2162
  DDCAPS_READSCANLINE             = $00020000;
2163
 
2164
(*
2165
 * Display hardware has stereo vision capabilities.  DDSCAPS_PRIMARYSURFACELEFT
2166
 * can be created.
2167
 *)
2168
  DDCAPS_STEREOVIEW               = $00040000;
2169
 
2170
(*
2171
 * Display hardware is capable of generating a vertical blank interrupt.
2172
 *)
2173
  DDCAPS_VBI                      = $00080000;
2174
 
2175
(*
2176
 * Supports the use of z buffers with blt operations.
2177
 *)
2178
  DDCAPS_ZBLTS                    = $00100000;
2179
 
2180
(*
2181
 * Supports Z Ordering of overlays.
2182
 *)
2183
  DDCAPS_ZOVERLAYS                = $00200000;
2184
 
2185
(*
2186
 * Supports color key
2187
 *)
2188
  DDCAPS_COLORKEY                 = $00400000;
2189
 
2190
(*
2191
 * Supports alpha surfaces
2192
 *)
2193
  DDCAPS_ALPHA                    = $00800000;
2194
 
2195
(*
2196
 * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set)
2197
 *)
2198
  DDCAPS_COLORKEYHWASSIST         = $01000000;
2199
 
2200
(*
2201
 * no hardware support at all
2202
 *)
2203
  DDCAPS_NOHARDWARE               = $02000000;
2204
 
2205
(*
2206
 * Display hardware is capable of color fill with bltter
2207
 *)
2208
  DDCAPS_BLTCOLORFILL             = $04000000;
2209
 
2210
(*
2211
 * Display hardware is bank switched, and potentially very slow at
2212
 * random access to VRAM.
2213
 *)
2214
  DDCAPS_BANKSWITCHED             = $08000000;
2215
 
2216
(*
2217
 * Display hardware is capable of depth filling Z-buffers with bltter
2218
 *)
2219
  DDCAPS_BLTDEPTHFILL             = $10000000;
2220
 
2221
(*
2222
 * Display hardware is capable of clipping while bltting.
2223
 *)
2224
  DDCAPS_CANCLIP                  = $20000000;
2225
 
2226
(*
2227
 * Display hardware is capable of clipping while stretch bltting.
2228
 *)
2229
  DDCAPS_CANCLIPSTRETCHED         = $40000000;
2230
 
2231
(*
2232
 * Display hardware is capable of bltting to or from system memory
2233
 *)
2234
  DDCAPS_CANBLTSYSMEM             = $80000000;
2235
 
2236
 
2237
 (****************************************************************************
2238
 *
2239
 * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2)
2240
 *
2241
 ****************************************************************************)
2242
 
2243
(*
2244
 * Display hardware is certified
2245
 *)
2246
  DDCAPS2_CERTIFIED               = $00000001;
2247
 
2248
(*
2249
 * Driver cannot interleave 2D operations (lock and blt) to surfaces with
2250
 * Direct3D rendering operations between calls to BeginScene() and EndScene()
2251
 *)
2252
  DDCAPS2_NO2DDURING3DSCENE       = $00000002;
2253
 
2254
(*
2255
 * Display hardware contains a video port
2256
 *)
2257
  DDCAPS2_VIDEOPORT               = $00000004;
2258
 
2259
(*
2260
 * The overlay can be automatically flipped according to the video port
2261
 * VSYNCs, providing automatic doubled buffered display of video port
2262
 * data using an overlay
2263
 *)
2264
  DDCAPS2_AUTOFLIPOVERLAY         = $00000008;
2265
 
2266
(*
2267
 * Overlay can display each field of interlaced data individually while
2268
 * it is interleaved in memory without causing jittery artifacts.
2269
 *)
2270
  DDCAPS2_CANBOBINTERLEAVED     = $00000010;
2271
 
2272
(*
2273
 * Overlay can display each field of interlaced data individually while
2274
 * it is not interleaved in memory without causing jittery artifacts.
2275
 *)
2276
  DDCAPS2_CANBOBNONINTERLEAVED  = $00000020;
2277
 
2278
(*
2279
 * The overlay surface contains color controls (brightness, sharpness, etc.)
2280
 *)
2281
  DDCAPS2_COLORCONTROLOVERLAY   = $00000040;
2282
 
2283
(*
2284
 * The primary surface contains color controls (gamma, etc.)
2285
 *)
2286
  DDCAPS2_COLORCONTROLPRIMARY   = $00000080;
2287
 
2288
(*
2289
 * RGBZ -> RGB supported for 16:16 RGB:Z
2290
 *)
2291
  DDCAPS2_CANDROPZ16BIT         = $00000100;
2292
 
2293
(*
2294
 * Driver supports non-local video memory.
2295
 *)
2296
  DDCAPS2_NONLOCALVIDMEM          = $00000200;
2297
 
2298
(*
2299
 * Dirver supports non-local video memory but has different capabilities for
2300
 * non-local video memory surfaces. If this bit is set then so must
2301
 * DDCAPS2_NONLOCALVIDMEM.
2302
 *)
2303
  DDCAPS2_NONLOCALVIDMEMCAPS      = $00000400;
2304
 
2305
(*
2306
 * Driver neither requires nor prefers surfaces to be pagelocked when performing
2307
 * blts involving system memory surfaces
2308
 *)
2309
  DDCAPS2_NOPAGELOCKREQUIRED      = $00000800;
2310
 
2311
(*
2312
 * Driver can create surfaces which are wider than the primary surface
2313
 *)
2314
  DDCAPS2_WIDESURFACES            = $00001000;
2315
 
2316
(*
2317
 * Driver supports bob without using a video port by handling the
2318
 * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip.
2319
 *)
2320
  DDCAPS2_CANFLIPODDEVEN          = $00002000;
2321
 
2322
(*
2323
 * Driver supports bob using hardware
2324
 *)
2325
  DDCAPS2_CANBOBHARDWARE          = $00004000;
2326
 
2327
(*
2328
 * Driver supports bltting any FOURCC surface to another surface of the same FOURCC
2329
 *)
2330
  DDCAPS2_COPYFOURCC              = $00008000;
2331
 
2332
 
2333
(*
2334
 * Driver supports loadable gamma ramps for the primary surface
2335
 *)
2336
  DDCAPS2_PRIMARYGAMMA            = $00020000;
2337
 
2338
(*
2339
 * Driver can render in windowed mode.
2340
 *)
2341
  DDCAPS2_CANRENDERWINDOWED       = $00080000;
2342
 
2343
(*
2344
 * A calibrator is available to adjust the gamma ramp according to the
2345
 * physical display properties so that the result will be identical on
2346
 * all calibrated systems.
2347
 *)
2348
  DDCAPS2_CANCALIBRATEGAMMA       = $00100000;
2349
 
2350
(*
2351
 * Indicates that the driver will respond to DDFLIP_INTERVALn flags
2352
 *)
2353
  DDCAPS2_FLIPINTERVAL            = $00200000;
2354
 
2355
(*
2356
 * Indicates that the driver will respond to DDFLIP_NOVSYNC
2357
 *)
2358
   DDCAPS2_FLIPNOVSYNC             = $00400000;
2359
 
2360
(*
2361
 * Driver supports management of video memory, if this flag is ON,
2362
 * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on
2363
 * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on
2364
 *)
2365
  DDCAPS2_CANMANAGETEXTURE        = $00800000;
2366
 
2367
(*
2368
 * The Direct3D texture manager uses this cap to decide whether to put managed
2369
 * surfaces in non-local video memory. If the cap is set, the texture manager will
2370
 * put managed surfaces in non-local vidmem. Drivers that cannot texture from
2371
 * local vidmem SHOULD NOT set this cap.
2372
 *)
2373
  DDCAPS2_TEXMANINNONLOCALVIDMEM  = $01000000;
2374
 
2375
(*
2376
 * Indicates that the driver supports DX7 type of stereo in at least one mode (which may
2377
 * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher)
2378
 * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of
2379
 * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application
2380
 * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode.
2381
 *)
2382
  DDCAPS2_STEREO                  = $02000000;
2383
 
2384
(*
2385
 * This caps bit is intended for internal DirectDraw use.
2386
 * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set.
2387
 * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and
2388
 *  all the assoicated system memory blt caps must be correct).
2389
 * -It implies that the system->video blt caps in DDCAPS also apply to system to
2390
 *  nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops
2391
 *  members of DDCAPS (DDCORECAPS) are filled in correctly.
2392
 * -Any blt from system to nonlocal memory that matches these caps bits will
2393
 *  be passed to the driver.
2394
 *
2395
 * NOTE: This is intended to enable the driver itself to do efficient reordering
2396
 * of textures. This is NOT meant to imply that hardware can write into AGP memory.
2397
 * This operation is not currently supported.
2398
 *)
2399
  DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL   = $04000000;
2400
 
2401
(****************************************************************************
2402
 *
2403
 * DIRECTDRAW FX ALPHA CAPABILITY FLAGS
2404
 *
2405
 ****************************************************************************)
2406
 
2407
(*
2408
 * Supports alpha blending around the edge of a source color keyed surface.
2409
 * For Blt.
2410
 *)
1 daniel-mar 2411
  DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
4 daniel-mar 2412
 
2413
(*
2414
 * Supports alpha information in the pixel format.  The bit depth of alpha
2415
 * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
2416
 * more opaque as the alpha value increases.  (0 is transparent.)
2417
 * For Blt.
2418
 *)
1 daniel-mar 2419
  DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
4 daniel-mar 2420
 
2421
(*
2422
 * Supports alpha information in the pixel format.  The bit depth of alpha
2423
 * information in the pixel format can be 1,2,4, or 8.  The alpha value
2424
 * becomes more transparent as the alpha value increases.  (0 is opaque.)
2425
 * This flag can only be set if DDCAPS_ALPHA is set.
2426
 * For Blt.
2427
 *)
1 daniel-mar 2428
  DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
4 daniel-mar 2429
 
2430
(*
2431
 * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
2432
 * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
2433
 * (0 is transparent.)
2434
 * For Blt.
2435
 *)
1 daniel-mar 2436
  DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
4 daniel-mar 2437
 
2438
(*
2439
 * The depth of the alpha channel data can range can be 1,2,4, or 8.
2440
 * The NEG suffix indicates that this alpha channel becomes more transparent
2441
 * as the alpha value increases. (0 is opaque.)  This flag can only be set if
2442
 * DDCAPS_ALPHA is set.
2443
 * For Blt.
2444
 *)
1 daniel-mar 2445
  DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
4 daniel-mar 2446
 
2447
(*
2448
 * Supports alpha blending around the edge of a source color keyed surface.
2449
 * For Overlays.
2450
 *)
1 daniel-mar 2451
  DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
4 daniel-mar 2452
 
2453
(*
2454
 * Supports alpha information in the pixel format.  The bit depth of alpha
2455
 * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
2456
 * more opaque as the alpha value increases.  (0 is transparent.)
2457
 * For Overlays.
2458
 *)
1 daniel-mar 2459
  DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
4 daniel-mar 2460
 
2461
(*
2462
 * Supports alpha information in the pixel format.  The bit depth of alpha
2463
 * information in the pixel format can be 1,2,4, or 8.  The alpha value
2464
 * becomes more transparent as the alpha value increases.  (0 is opaque.)
2465
 * This flag can only be set if DDCAPS_ALPHA is set.
2466
 * For Overlays.
2467
 *)
1 daniel-mar 2468
  DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
4 daniel-mar 2469
 
2470
(*
2471
 * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
2472
 * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
2473
 * (0 is transparent.)
2474
 * For Overlays.
2475
 *)
1 daniel-mar 2476
  DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
4 daniel-mar 2477
 
2478
(*
2479
 * The depth of the alpha channel data can range can be 1,2,4, or 8.  
2480
 * The NEG suffix indicates that this alpha channel becomes more transparent
2481
 * as the alpha value increases. (0 is opaque.)  This flag can only be set if
2482
 * DDCAPS_ALPHA is set.
2483
 * For Overlays.
2484
 *)
1 daniel-mar 2485
  DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
2486
 
4 daniel-mar 2487
(****************************************************************************
2488
 *
2489
 * DIRECTDRAW FX CAPABILITY FLAGS
2490
 *
2491
 ****************************************************************************)
1 daniel-mar 2492
 
4 daniel-mar 2493
(*
2494
 * Uses arithmetic operations to stretch and shrink surfaces during blt
2495
 * rather than pixel doubling techniques.  Along the Y axis.
2496
 *)
1 daniel-mar 2497
  DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
4 daniel-mar 2498
 
2499
(*
2500
 * Uses arithmetic operations to stretch during blt
2501
 * rather than pixel doubling techniques.  Along the Y axis. Only
2502
 * works for x1, x2, etc.
2503
 *)
1 daniel-mar 2504
  DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
4 daniel-mar 2505
 
2506
(*
2507
 * Supports mirroring left to right in blt.
2508
 *)
1 daniel-mar 2509
  DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
4 daniel-mar 2510
 
2511
(*
2512
 * Supports mirroring top to bottom in blt.
2513
 *)
1 daniel-mar 2514
  DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
4 daniel-mar 2515
 
2516
(*
2517
 * Supports arbitrary rotation for blts.
2518
 *)
1 daniel-mar 2519
  DDFXCAPS_BLTROTATION            = $00000100;
4 daniel-mar 2520
 
2521
(*
2522
 * Supports 90 degree rotations for blts.
2523
 *)
2524
   DDFXCAPS_BLTROTATION90          = $00000200;
2525
 
2526
(*
2527
 * DirectDraw supports arbitrary shrinking of a surface along the
2528
 * x axis (horizontal direction) for blts.
2529
 *)
1 daniel-mar 2530
  DDFXCAPS_BLTSHRINKX             = $00000400;
4 daniel-mar 2531
 
2532
(*
2533
 * DirectDraw supports integer shrinking (1x,2x,) of a surface
2534
 * along the x axis (horizontal direction) for blts.
2535
 *)
1 daniel-mar 2536
  DDFXCAPS_BLTSHRINKXN            = $00000800;
4 daniel-mar 2537
 
2538
(*
2539
 * DirectDraw supports arbitrary shrinking of a surface along the
2540
 * y axis (horizontal direction) for blts.  
2541
 *)
1 daniel-mar 2542
  DDFXCAPS_BLTSHRINKY             = $00001000;
4 daniel-mar 2543
 
2544
(*
2545
 * DirectDraw supports integer shrinking (1x,2x,) of a surface
2546
 * along the y axis (vertical direction) for blts.
2547
 *)
1 daniel-mar 2548
  DDFXCAPS_BLTSHRINKYN            = $00002000;
4 daniel-mar 2549
 
2550
(*
2551
 * DirectDraw supports arbitrary stretching of a surface along the
2552
 * x axis (horizontal direction) for blts.
2553
 *)
1 daniel-mar 2554
  DDFXCAPS_BLTSTRETCHX            = $00004000;
4 daniel-mar 2555
 
2556
(*
2557
 * DirectDraw supports integer stretching (1x,2x,) of a surface
2558
 * along the x axis (horizontal direction) for blts.
2559
 *)
1 daniel-mar 2560
  DDFXCAPS_BLTSTRETCHXN           = $00008000;
4 daniel-mar 2561
 
2562
(*
2563
 * DirectDraw supports arbitrary stretching of a surface along the
2564
 * y axis (horizontal direction) for blts.  
2565
 *)
1 daniel-mar 2566
  DDFXCAPS_BLTSTRETCHY            = $00010000;
4 daniel-mar 2567
 
2568
(*
2569
 * DirectDraw supports integer stretching (1x,2x,) of a surface
2570
 * along the y axis (vertical direction) for blts.  
2571
 *)
1 daniel-mar 2572
  DDFXCAPS_BLTSTRETCHYN           = $00020000;
4 daniel-mar 2573
 
2574
(*
2575
 * Uses arithmetic operations to stretch and shrink surfaces during
2576
 * overlay rather than pixel doubling techniques.  Along the Y axis
2577
 * for overlays.
2578
 *)
1 daniel-mar 2579
  DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
4 daniel-mar 2580
 
2581
(*
2582
 * Uses arithmetic operations to stretch surfaces during
2583
 * overlay rather than pixel doubling techniques.  Along the Y axis
2584
 * for overlays. Only works for x1, x2, etc.
2585
 *)
1 daniel-mar 2586
  DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
4 daniel-mar 2587
 
2588
(*
2589
 * DirectDraw supports arbitrary shrinking of a surface along the
2590
 * x axis (horizontal direction) for overlays.
2591
 *)
1 daniel-mar 2592
  DDFXCAPS_OVERLAYSHRINKX         = $00080000;
4 daniel-mar 2593
 
2594
(*
2595
 * DirectDraw supports integer shrinking (1x,2x,) of a surface
2596
 * along the x axis (horizontal direction) for overlays.
2597
 *)
1 daniel-mar 2598
  DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
4 daniel-mar 2599
 
2600
(*
2601
 * DirectDraw supports arbitrary shrinking of a surface along the
2602
 * y axis (horizontal direction) for overlays.
2603
 *)
1 daniel-mar 2604
  DDFXCAPS_OVERLAYSHRINKY         = $00200000;
4 daniel-mar 2605
 
2606
(*
2607
 * DirectDraw supports integer shrinking (1x,2x,) of a surface
2608
 * along the y axis (vertical direction) for overlays.  
2609
 *)
1 daniel-mar 2610
  DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
4 daniel-mar 2611
 
2612
(*
2613
 * DirectDraw supports arbitrary stretching of a surface along the
2614
 * x axis (horizontal direction) for overlays.
2615
 *)
1 daniel-mar 2616
  DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
4 daniel-mar 2617
 
2618
(*
2619
 * DirectDraw supports integer stretching (1x,2x,) of a surface
2620
 * along the x axis (horizontal direction) for overlays.
2621
 *)
1 daniel-mar 2622
  DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
4 daniel-mar 2623
 
2624
(*
2625
 * DirectDraw supports arbitrary stretching of a surface along the
2626
 * y axis (horizontal direction) for overlays.  
2627
 *)
1 daniel-mar 2628
  DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
4 daniel-mar 2629
 
2630
(*
2631
 * DirectDraw supports integer stretching (1x,2x,) of a surface
2632
 * along the y axis (vertical direction) for overlays.  
2633
 *)
1 daniel-mar 2634
  DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
4 daniel-mar 2635
 
2636
(*
2637
 * DirectDraw supports mirroring of overlays across the vertical axis
2638
 *)
1 daniel-mar 2639
  DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
4 daniel-mar 2640
 
2641
(*
2642
 * DirectDraw supports mirroring of overlays across the horizontal axis
2643
 *)
1 daniel-mar 2644
  DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
2645
 
4 daniel-mar 2646
(*
2647
 * Driver can do alpha blending for blits.
2648
 *)
2649
  DDFXCAPS_BLTALPHA             = $00000001;
1 daniel-mar 2650
 
4 daniel-mar 2651
(*
2652
 * Driver can do geometric transformations (or warps) for blits.
2653
 *)
2654
  DDFXCAPS_BLTTRANSFORM         = $00000002;
2655
 
2656
(*
2657
 * Driver can do surface-reconstruction filtering for warped blits.
2658
 *)
2659
  DDFXCAPS_BLTFILTER           = DDFXCAPS_BLTARITHSTRETCHY;
2660
 
2661
(*
2662
 * Driver can do alpha blending for overlays.
2663
 *)
2664
  DDFXCAPS_OVERLAYALPHA                 = $00000004;
2665
 
2666
(*
2667
 * Driver can do geometric transformations (or warps) for overlays.
2668
 *)
2669
  DDFXCAPS_OVERLAYTRANSFORM     = $20000000;
2670
 
2671
(*
2672
 * Driver can do surface-reconstruction filtering for warped overlays.
2673
 *)
2674
  DDFXCAPS_OVERLAYFILTER              = DDFXCAPS_OVERLAYARITHSTRETCHY;
2675
 
2676
(****************************************************************************
2677
 *
2678
 * DIRECTDRAW STEREO VIEW CAPABILITIES
2679
 *
2680
 ****************************************************************************)
2681
 
2682
(*
2683
 * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete
2684
 * The stereo view is accomplished via enigma encoding.
2685
 *)
2686
  DDSVCAPS_RESERVED1                 = $00000001;
2687
  DDSVCAPS_ENIGMA                 = DDSVCAPS_RESERVED1;
2688
 
2689
(*
2690
 * This flag used to be DDSVCAPS_FLICKER, which is now obsolete
2691
 * The stereo view is accomplished via high frequency flickering.
2692
 *)
2693
  DDSVCAPS_RESERVED2                = $00000002;
2694
  DDSVCAPS_FLICKER                = DDSVCAPS_RESERVED2;
2695
 
2696
(*
2697
 * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete
2698
 * The stereo view is accomplished via red and blue filters applied
2699
 * to the left and right eyes.  All images must adapt their colorspaces
2700
 * for this process.
2701
 *)
2702
  DDSVCAPS_RESERVED3                = $00000004;
2703
  DDSVCAPS_REDBLUE                = DDSVCAPS_RESERVED3;
2704
 
2705
(*
2706
 * This flag used to be DDSVCAPS_SPLIT, which is now obsolete
2707
 * The stereo view is accomplished with split screen technology.
2708
 *)
2709
  DDSVCAPS_RESERVED4                  = $00000008;
2710
  DDSVCAPS_SPLIT                  = DDSVCAPS_RESERVED4;
2711
 
2712
(*
2713
 * The stereo view is accomplished with switching technology
2714
 *)
1 daniel-mar 2715
  DDSVCAPS_STEREOSEQUENTIAL       = $00000010;
2716
 
4 daniel-mar 2717
(****************************************************************************
2718
 *
2719
 * DIRECTDRAWPALETTE CAPABILITIES
2720
 *
2721
 ****************************************************************************)
1 daniel-mar 2722
 
4 daniel-mar 2723
(*
2724
 * Index is 4 bits.  There are sixteen color entries in the palette table.
2725
 *)
2726
  DDPCAPS_4BIT                    = $00000001;
1 daniel-mar 2727
 
4 daniel-mar 2728
(*
2729
 * Index is onto a 8 bit color index.  This field is only valid with the
2730
 * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target
2731
 * surface is in 8bpp. Each color entry is one byte long and is an index
2732
 * into destination surface's 8bpp palette.
2733
 *)
2734
  DDPCAPS_8BITENTRIES             = $00000002;
1 daniel-mar 2735
 
4 daniel-mar 2736
(*
2737
 * Index is 8 bits.  There are 256 color entries in the palette table.
2738
 *)
2739
  DDPCAPS_8BIT                    = $00000004;
1 daniel-mar 2740
 
4 daniel-mar 2741
(*
2742
 * Indicates that this DIRECTDRAWPALETTE should use the palette color array
2743
 * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE
2744
 * object.
2745
 * This flag is obsolete. DirectDraw always initializes the color array from
2746
 * the lpDDColorArray parameter. The definition remains for source-level
2747
 * compatibility.
2748
 *)
2749
  DDPCAPS_INITIALIZE              = $00000008;
1 daniel-mar 2750
 
4 daniel-mar 2751
(*
2752
 * This palette is the one attached to the primary surface.  Changing this
2753
 * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified
2754
 * and supported.
2755
 *)
2756
  DDPCAPS_PRIMARYSURFACE          = $00000010;
1 daniel-mar 2757
 
4 daniel-mar 2758
(*
2759
 * This palette is the one attached to the primary surface left.  Changing
2760
 * this table has immediate effect on the display for the left eye unless
2761
 * DDPSETPAL_VSYNC is specified and supported.
2762
 *)
2763
  DDPCAPS_PRIMARYSURFACELEFT      = $00000020;
1 daniel-mar 2764
 
4 daniel-mar 2765
(*
2766
 * This palette can have all 256 entries defined
2767
 *)
2768
  DDPCAPS_ALLOW256                = $00000040;
1 daniel-mar 2769
 
4 daniel-mar 2770
(*
2771
 * This palette can have modifications to it synced with the monitors
2772
 * refresh rate.
2773
 *)
2774
  DDPCAPS_VSYNC                   = $00000080;
1 daniel-mar 2775
 
4 daniel-mar 2776
(*
2777
 * Index is 1 bit.  There are two color entries in the palette table.
2778
 *)
2779
  DDPCAPS_1BIT                    = $00000100;
1 daniel-mar 2780
 
4 daniel-mar 2781
(*
2782
 * Index is 2 bit.  There are four color entries in the palette table.
2783
 *)
2784
  DDPCAPS_2BIT                    = $00000200;
1 daniel-mar 2785
 
4 daniel-mar 2786
(*
2787
 * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value
2788
 *)
2789
  DDPCAPS_ALPHA                 = $00000400;
1 daniel-mar 2790
 
4 daniel-mar 2791
(****************************************************************************
2792
 *
2793
 * DIRECTDRAWPALETTE SETENTRY CONSTANTS
2794
 *
2795
 ****************************************************************************)
1 daniel-mar 2796
 
2797
 
4 daniel-mar 2798
(****************************************************************************
2799
 *
2800
 * DIRECTDRAWPALETTE GETENTRY CONSTANTS
2801
 *
2802
 ****************************************************************************)
1 daniel-mar 2803
 
4 daniel-mar 2804
(* 0 is the only legal value *)
1 daniel-mar 2805
 
4 daniel-mar 2806
(****************************************************************************
2807
 *
2808
 * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
2809
 *
2810
 ****************************************************************************)
1 daniel-mar 2811
 
4 daniel-mar 2812
(*
2813
 * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData
2814
 * must be set to sizeof(IUnknown^). DirectDraw will call AddRef through this
2815
 * pointer and Release when the private data is destroyed. This includes when
2816
 * the surface or palette is destroyed before such priovate data is destroyed.
2817
 *)
2818
  DDSPD_IUNKNOWNPOINTER           = $00000001;
1 daniel-mar 2819
 
4 daniel-mar 2820
(*
2821
 * Private data is only valid for the current state of the object,
2822
 * as determined by the uniqueness value.
2823
 *)
2824
  DDSPD_VOLATILE                  = $00000002;
1 daniel-mar 2825
 
4 daniel-mar 2826
(****************************************************************************
2827
 *
2828
 * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
2829
 *
2830
 ****************************************************************************)
1 daniel-mar 2831
 
2832
 
4 daniel-mar 2833
(****************************************************************************
2834
 *
2835
 * DIRECTDRAW BITDEPTH CONSTANTS
2836
 *
2837
 * NOTE:  These are only used to indicate supported bit depths.   These
2838
 * are flags only, they are not to be used as an actual bit depth.   The
2839
 * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual
2840
 * bit depths in a surface or for changing the display mode.
2841
 *
2842
 ****************************************************************************)
1 daniel-mar 2843
 
4 daniel-mar 2844
(*
2845
 * 1 bit per pixel.
2846
 *)
2847
  DDBD_1                  = $00004000;
1 daniel-mar 2848
 
4 daniel-mar 2849
(*
2850
 * 2 bits per pixel.
2851
 *)
2852
  DDBD_2                  = $00002000;
1 daniel-mar 2853
 
4 daniel-mar 2854
(*
2855
 * 4 bits per pixel.
2856
 *)
2857
  DDBD_4                  = $00001000;
1 daniel-mar 2858
 
4 daniel-mar 2859
(*
2860
 * 8 bits per pixel.
2861
 *)
2862
  DDBD_8                  = $00000800;
1 daniel-mar 2863
 
4 daniel-mar 2864
(*
2865
 * 16 bits per pixel.
2866
 *)
2867
  DDBD_16                 = $00000400;
1 daniel-mar 2868
 
4 daniel-mar 2869
(*
2870
 * 24 bits per pixel.
2871
 *)
2872
  DDBD_24                 = $00000200;
1 daniel-mar 2873
 
4 daniel-mar 2874
(*
2875
 * 32 bits per pixel.
2876
 *)
2877
  DDBD_32                 = $00000100;
1 daniel-mar 2878
 
4 daniel-mar 2879
(****************************************************************************
2880
 *
2881
 * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS
2882
 *
2883
 ****************************************************************************)
1 daniel-mar 2884
 
4 daniel-mar 2885
(*
2886
 * Set if the structure contains a color space.  Not set if the structure
2887
 * contains a single color key.
2888
 *)
2889
  DDCKEY_COLORSPACE       = $00000001;
1 daniel-mar 2890
 
4 daniel-mar 2891
(*
2892
 * Set if the structure specifies a color key or color space which is to be
2893
 * used as a destination color key for blt operations.
2894
 *)
2895
  DDCKEY_DESTBLT          = $00000002;
1 daniel-mar 2896
 
4 daniel-mar 2897
(*
2898
 * Set if the structure specifies a color key or color space which is to be
2899
 * used as a destination color key for overlay operations.
2900
 *)
2901
  DDCKEY_DESTOVERLAY      = $00000004;
1 daniel-mar 2902
 
4 daniel-mar 2903
(*
2904
 * Set if the structure specifies a color key or color space which is to be
2905
 * used as a source color key for blt operations.
2906
 *)
2907
  DDCKEY_SRCBLT           = $00000008;
1 daniel-mar 2908
 
4 daniel-mar 2909
(*
2910
 * Set if the structure specifies a color key or color space which is to be
2911
 * used as a source color key for overlay operations.
2912
 *)
2913
  DDCKEY_SRCOVERLAY       = $00000010;
1 daniel-mar 2914
 
2915
 
4 daniel-mar 2916
(****************************************************************************
2917
 *
2918
 * DIRECTDRAW COLOR KEY CAPABILITY FLAGS
2919
 *
2920
 ****************************************************************************)
1 daniel-mar 2921
 
4 daniel-mar 2922
(*
2923
 * Supports transparent blting using a color key to identify the replaceable
2924
 * bits of the destination surface for RGB colors.
2925
 *)
2926
  DDCKEYCAPS_DESTBLT                      = $00000001;
1 daniel-mar 2927
 
4 daniel-mar 2928
(*
2929
 * Supports transparent blting using a color space to identify the replaceable
2930
 * bits of the destination surface for RGB colors.
2931
 *)
2932
  DDCKEYCAPS_DESTBLTCLRSPACE              = $00000002;
1 daniel-mar 2933
 
4 daniel-mar 2934
(*
2935
 * Supports transparent blting using a color space to identify the replaceable
2936
 * bits of the destination surface for YUV colors.
2937
 *)
2938
  DDCKEYCAPS_DESTBLTCLRSPACEYUV           = $00000004;
1 daniel-mar 2939
 
4 daniel-mar 2940
(*
2941
 * Supports transparent blting using a color key to identify the replaceable
2942
 * bits of the destination surface for YUV colors.
2943
 *)
2944
  DDCKEYCAPS_DESTBLTYUV                   = $00000008;
1 daniel-mar 2945
 
4 daniel-mar 2946
(*
2947
 * Supports overlaying using colorkeying of the replaceable bits of the surface
2948
 * being overlayed for RGB colors.
2949
 *)
2950
  DDCKEYCAPS_DESTOVERLAY                  = $00000010;
1 daniel-mar 2951
 
4 daniel-mar 2952
(*
2953
 * Supports a color space as the color key for the destination for RGB colors.
2954
 *)
2955
  DDCKEYCAPS_DESTOVERLAYCLRSPACE          = $00000020;
1 daniel-mar 2956
 
4 daniel-mar 2957
(*
2958
 * Supports a color space as the color key for the destination for YUV colors.
2959
 *)
2960
  DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV       = $00000040;
1 daniel-mar 2961
 
4 daniel-mar 2962
(*
2963
 * Supports only one active destination color key value for visible overlay
2964
 * surfaces.
2965
 *)
2966
  DDCKEYCAPS_DESTOVERLAYONEACTIVE         = $00000080;
1 daniel-mar 2967
 
4 daniel-mar 2968
(*
2969
 * Supports overlaying using colorkeying of the replaceable bits of the
2970
 * surface being overlayed for YUV colors.
2971
 *)
2972
  DDCKEYCAPS_DESTOVERLAYYUV               = $00000100;
1 daniel-mar 2973
 
4 daniel-mar 2974
(*
2975
 * Supports transparent blting using the color key for the source with
2976
 * this surface for RGB colors.
2977
 *)
2978
  DDCKEYCAPS_SRCBLT                       = $00000200;
1 daniel-mar 2979
 
4 daniel-mar 2980
(*
2981
 * Supports transparent blting using a color space for the source with
2982
 * this surface for RGB colors.
2983
 *)
2984
  DDCKEYCAPS_SRCBLTCLRSPACE               = $00000400;
1 daniel-mar 2985
 
4 daniel-mar 2986
(*
2987
 * Supports transparent blting using a color space for the source with
2988
 * this surface for YUV colors.
2989
 *)
2990
  DDCKEYCAPS_SRCBLTCLRSPACEYUV            = $00000800;
1 daniel-mar 2991
 
4 daniel-mar 2992
(*
2993
 * Supports transparent blting using the color key for the source with
2994
 * this surface for YUV colors.
2995
 *)
2996
  DDCKEYCAPS_SRCBLTYUV                    = $00001000;
1 daniel-mar 2997
 
4 daniel-mar 2998
(*
2999
 * Supports overlays using the color key for the source with this
3000
 * overlay surface for RGB colors.
3001
 *)
3002
  DDCKEYCAPS_SRCOVERLAY                   = $00002000;
1 daniel-mar 3003
 
4 daniel-mar 3004
(*
3005
 * Supports overlays using a color space as the source color key for
3006
 * the overlay surface for RGB colors.
3007
 *)
3008
  DDCKEYCAPS_SRCOVERLAYCLRSPACE           = $00004000;
1 daniel-mar 3009
 
4 daniel-mar 3010
(*
3011
 * Supports overlays using a color space as the source color key for
3012
 * the overlay surface for YUV colors.
3013
 *)
3014
  DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV        = $00008000;
1 daniel-mar 3015
 
4 daniel-mar 3016
(*
3017
 * Supports only one active source color key value for visible
3018
 * overlay surfaces.
3019
 *)
3020
  DDCKEYCAPS_SRCOVERLAYONEACTIVE          = $00010000;
1 daniel-mar 3021
 
4 daniel-mar 3022
(*
3023
 * Supports overlays using the color key for the source with this
3024
 * overlay surface for YUV colors.
3025
 *)
3026
  DDCKEYCAPS_SRCOVERLAYYUV                = $00020000;
1 daniel-mar 3027
 
4 daniel-mar 3028
(*
3029
 * there are no bandwidth trade-offs for using colorkey with an overlay
3030
 *)
3031
  DDCKEYCAPS_NOCOSTOVERLAY                = $00040000;
1 daniel-mar 3032
 
3033
 
4 daniel-mar 3034
(****************************************************************************
3035
 *
3036
 * DIRECTDRAW PIXELFORMAT FLAGS
3037
 *
3038
 ****************************************************************************)
1 daniel-mar 3039
 
4 daniel-mar 3040
(*
3041
 * The surface has alpha channel information in the pixel format.
3042
 *)
3043
  DDPF_ALPHAPIXELS                        = $00000001;
1 daniel-mar 3044
 
4 daniel-mar 3045
(*
3046
 * The pixel format contains alpha only information
3047
 *)
3048
  DDPF_ALPHA                              = $00000002;
1 daniel-mar 3049
 
4 daniel-mar 3050
(*
3051
 * The FourCC code is valid.
3052
 *)
3053
  DDPF_FOURCC                             = $00000004;
1 daniel-mar 3054
 
4 daniel-mar 3055
(*
3056
 * The surface is 4-bit color indexed.
3057
 *)
3058
  DDPF_PALETTEINDEXED4                    = $00000008;
1 daniel-mar 3059
 
4 daniel-mar 3060
(*
3061
 * The surface is indexed into a palette which stores indices
3062
 * into the destination surface's 8-bit palette.
3063
 *)
3064
  DDPF_PALETTEINDEXEDTO8                  = $00000010;
3065
 
3066
(*
3067
 * The surface is 8-bit color indexed.
3068
 *)
3069
  DDPF_PALETTEINDEXED8                    = $00000020;
3070
 
3071
(*
3072
 * The RGB data in the pixel format structure is valid.
3073
 *)
3074
  DDPF_RGB                                = $00000040;
3075
 
3076
(*
3077
 * The surface will accept pixel data in the format specified
3078
 * and compress it during the write.
3079
 *)
3080
  DDPF_COMPRESSED                         = $00000080;
3081
 
3082
(*
3083
 * The surface will accept RGB data and translate it during
3084
 * the write to YUV data.  The format of the data to be written
3085
 * will be contained in the pixel format structure.  The DDPF_RGB
3086
 * flag will be set.
3087
 *)
3088
  DDPF_RGBTOYUV                           = $00000100;
3089
 
3090
(*
3091
 * pixel format is YUV - YUV data in pixel format struct is valid
3092
 *)
3093
  DDPF_YUV                                = $00000200;
3094
 
3095
(*
3096
 * pixel format is a z buffer only surface
3097
 *)
3098
  DDPF_ZBUFFER                            = $00000400;
3099
 
3100
(*
3101
 * The surface is 1-bit color indexed.
3102
 *)
3103
  DDPF_PALETTEINDEXED1                    = $00000800;
3104
 
3105
(*
3106
 * The surface is 2-bit color indexed.
3107
 *)
3108
  DDPF_PALETTEINDEXED2                    = $00001000;
3109
 
3110
(*
3111
 * The surface contains Z information in the pixels
3112
 *)
3113
  DDPF_ZPIXELS                          = $00002000;
3114
 
3115
(*
3116
 * The surface contains stencil information along with Z
3117
 *)
3118
  DDPF_STENCILBUFFER                    = $00004000;
3119
 
3120
(*
3121
 * Premultiplied alpha format -- the color components have been
3122
 * premultiplied by the alpha component.
3123
 *)
3124
  DDPF_ALPHAPREMULT                     = $00008000;
3125
 
3126
 
3127
(*
3128
 * Luminance data in the pixel format is valid.
3129
 * Use this flag for luminance-only or luminance+alpha surfaces,
3130
 * the bit depth is then ddpf.dwLuminanceBitCount.
3131
 *)
3132
  DDPF_LUMINANCE                          = $00020000;
3133
 
3134
(*
3135
 * Luminance data in the pixel format is valid.
3136
 * Use this flag when hanging luminance off bumpmap surfaces,
3137
 * the bit mask for the luminance portion of the pixel is then
3138
 * ddpf.dwBumpLuminanceBitMask
3139
 *)
3140
  DDPF_BUMPLUMINANCE                      = $00040000;
3141
 
3142
(*
3143
 * Bump map dUdV data in the pixel format is valid.
3144
 *)
3145
  DDPF_BUMPDUDV                           = $00080000;
3146
 
3147
(*===========================================================================
3148
 *
3149
 *
3150
 * DIRECTDRAW CALLBACK FLAGS
3151
 *
3152
 *
3153
 *==========================================================================*)
3154
 
3155
(****************************************************************************
3156
 *
3157
 * DIRECTDRAW ENUMSURFACES FLAGS
3158
 *
3159
 ****************************************************************************)
3160
 
3161
(*
3162
 * Enumerate all of the surfaces that meet the search criterion.
3163
 *)
3164
  DDENUMSURFACES_ALL                      = $00000001;
3165
 
3166
(*
3167
 * A search hit is a surface that matches the surface description.
3168
 *)
3169
  DDENUMSURFACES_MATCH                    = $00000002;
3170
 
3171
(*
3172
 * A search hit is a surface that does not match the surface description.
3173
 *)
3174
  DDENUMSURFACES_NOMATCH                  = $00000004;
3175
 
3176
(*
3177
 * Enumerate the first surface that can be created which meets the search criterion.
3178
 *)
3179
  DDENUMSURFACES_CANBECREATED             = $00000008;
3180
 
3181
(*
3182
 * Enumerate the surfaces that already exist that meet the search criterion.
3183
 *)
3184
  DDENUMSURFACES_DOESEXIST                = $00000010;
3185
 
3186
(****************************************************************************
3187
 *
3188
 * DIRECTDRAW SETDISPLAYMODE FLAGS
3189
 *
3190
 ****************************************************************************)
3191
 
3192
(*
3193
 * The desired mode is a standard VGA mode
3194
 *)
3195
  DDSDM_STANDARDVGAMODE                   = $00000001;
3196
 
3197
(****************************************************************************
3198
 *
3199
 * DIRECTDRAW ENUMDISPLAYMODES FLAGS
3200
 *
3201
 ****************************************************************************)
3202
 
3203
(*
3204
 * Enumerate Modes with different refresh rates.  EnumDisplayModes guarantees
3205
 * that a particular mode will be enumerated only once.  This flag specifies whether
3206
 * the refresh rate is taken into account when determining if a mode is unique.
3207
 *)
3208
  DDEDM_REFRESHRATES                      = $00000001;
3209
 
3210
(*
3211
 * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA
3212
 * modes such as mode 0x13 in addition to the usual ModeX modes (which are always
3213
 * enumerated if the application has previously called SetCooperativeLevel with the
3214
 * DDSCL_ALLOWMODEX flag set).
3215
 *)
3216
  DDEDM_STANDARDVGAMODES                  = $00000002;
3217
 
3218
 
3219
(****************************************************************************
3220
 *
3221
 * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS
3222
 *
3223
 ****************************************************************************)
3224
 
3225
(*
3226
 * Exclusive mode owner will be responsible for the entire primary surface.
3227
 * GDI can be ignored. used with DD
3228
 *)
3229
  DDSCL_FULLSCREEN                        = $00000001;
3230
 
3231
(*
3232
 * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode
3233
 *)
3234
  DDSCL_ALLOWREBOOT                       = $00000002;
3235
 
3236
(*
3237
 * prevents DDRAW from modifying the application window.
3238
 * prevents DDRAW from minimize/restore the application window on activation.
3239
 *)
3240
  DDSCL_NOWINDOWCHANGES                   = $00000004;
3241
 
3242
(*
3243
 * app wants to work as a regular Windows application
3244
 *)
3245
  DDSCL_NORMAL                            = $00000008;
3246
 
3247
(*
3248
 * app wants exclusive access
3249
 *)
3250
  DDSCL_EXCLUSIVE                         = $00000010;
3251
 
3252
 
3253
(*
3254
 * app can deal with non-windows display modes
3255
 *)
3256
  DDSCL_ALLOWMODEX                        = $00000040;
3257
 
3258
(*
3259
 * this window will receive the focus messages
3260
 *)
3261
  DDSCL_SETFOCUSWINDOW                    = $00000080;
3262
 
3263
(*
3264
 * this window is associated with the DDRAW object and will
3265
 * cover the screen in fullscreen mode
3266
 *)
3267
  DDSCL_SETDEVICEWINDOW                   = $00000100;
3268
 
3269
(*
3270
 * app wants DDRAW to create a window to be associated with the
3271
 * DDRAW object
3272
 *)
3273
  DDSCL_CREATEDEVICEWINDOW                = $00000200;
3274
 
3275
(*
3276
 * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D
3277
 * take the global crtisec more frequently.
3278
 *)
3279
  DDSCL_MULTITHREADED                     = $00000400;
3280
 
3281
(*
3282
 * App hints that it would like to keep the FPU set up for optimal Direct3D
3283
 * performance (single precision and exceptions disabled) so Direct3D
3284
 * does not need to explicitly set the FPU each time
3285
 *)
3286
  DDSCL_FPUSETUP                          = $00000800;
3287
 
3288
(*
3289
 * App specifies that it needs either double precision FPU or FPU exceptions
3290
 * enabled. This makes Direct3D explicitly set the FPU state eah time it is
3291
 * called. Setting the flag will reduce Direct3D performance. The flag is
3292
 * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP
3293
 *)
3294
  DDSCL_FPUPRESERVE                          = $00001000;
3295
 
3296
(****************************************************************************
3297
 *
3298
 * DIRECTDRAW BLT FLAGS
3299
 *
3300
 ****************************************************************************)
3301
 
3302
(*
3303
 * Use the alpha information in the pixel format or the alpha channel surface
3304
 * attached to the destination surface as the alpha channel for this blt.
3305
 *)
3306
  DDBLT_ALPHADEST                         = $00000001;
3307
 
3308
(*
3309
 * Use the dwConstAlphaDest field in the TDDBltFX structure as the alpha channel
3310
 * for the destination surface for this blt.
3311
 *)
3312
  DDBLT_ALPHADESTCONSTOVERRIDE            = $00000002;
3313
 
3314
(*
3315
 * The NEG suffix indicates that the destination surface becomes more
3316
 * transparent as the alpha value increases. (0 is opaque)
3317
 *)
3318
  DDBLT_ALPHADESTNEG                      = $00000004;
3319
 
3320
(*
3321
 * Use the lpDDSAlphaDest field in the TDDBltFX structure as the alpha
3322
 * channel for the destination for this blt.
3323
 *)
3324
  DDBLT_ALPHADESTSURFACEOVERRIDE          = $00000008;
3325
 
3326
(*
3327
 * Use the dwAlphaEdgeBlend field in the TDDBltFX structure as the alpha channel
3328
 * for the edges of the image that border the color key colors.
3329
 *)
3330
  DDBLT_ALPHAEDGEBLEND                    = $00000010;
3331
 
3332
(*
3333
 * Use the alpha information in the pixel format or the alpha channel surface
3334
 * attached to the source surface as the alpha channel for this blt.
3335
 *)
3336
  DDBLT_ALPHASRC                          = $00000020;
3337
 
3338
(*
3339
 * Use the dwConstAlphaSrc field in the TDDBltFX structure as the alpha channel
3340
 * for the source for this blt.
3341
 *)
3342
  DDBLT_ALPHASRCCONSTOVERRIDE             = $00000040;
3343
 
3344
(*
3345
 * The NEG suffix indicates that the source surface becomes more transparent
3346
 * as the alpha value increases. (0 is opaque)
3347
 *)
3348
  DDBLT_ALPHASRCNEG                       = $00000080;
3349
 
3350
(*
3351
 * Use the lpDDSAlphaSrc field in the TDDBltFX structure as the alpha channel
3352
 * for the source for this blt.
3353
 *)
3354
  DDBLT_ALPHASRCSURFACEOVERRIDE           = $00000100;
3355
 
3356
(*
3357
 * Do this blt asynchronously through the FIFO in the order received.  If
3358
 * there is no room in the hardware FIFO fail the call.
3359
 *)
3360
  DDBLT_ASYNC                             = $00000200;
3361
 
3362
(*
3363
 * Uses the dwFillColor field in the TDDBltFX structure as the RGB color
3364
 * to fill the destination rectangle on the destination surface with.
3365
 *)
3366
  DDBLT_COLORFILL                         = $00000400;
3367
 
3368
(*
3369
 * Uses the dwDDFX field in the TDDBltFX structure to specify the effects
3370
 * to use for the blt.
3371
 *)
3372
  DDBLT_DDFX                              = $00000800;
3373
 
3374
(*
3375
 * Uses the dwDDROPS field in the TDDBltFX structure to specify the ROPS
3376
 * that are not part of the Win32 API.
3377
 *)
3378
  DDBLT_DDROPS                            = $00001000;
3379
 
3380
(*
3381
 * Use the color key associated with the destination surface.
3382
 *)
3383
  DDBLT_KEYDEST                           = $00002000;
3384
 
3385
(*
3386
 * Use the dckDestColorkey field in the TDDBltFX structure as the color key
3387
 * for the destination surface.
3388
 *)
3389
  DDBLT_KEYDESTOVERRIDE                   = $00004000;
3390
 
3391
(*
3392
 * Use the color key associated with the source surface.
3393
 *)
3394
  DDBLT_KEYSRC                            = $00008000;
3395
 
3396
(*
3397
 * Use the dckSrcColorkey field in the TDDBltFX structure as the color key
3398
 * for the source surface.
3399
 *)
3400
  DDBLT_KEYSRCOVERRIDE                    = $00010000;
3401
 
3402
(*
3403
 * Use the dwROP field in the TDDBltFX structure for the raster operation
3404
 * for this blt.  These ROPs are the same as the ones defined in the Win32 API.
3405
 *)
3406
  DDBLT_ROP                               = $00020000;
3407
 
3408
(*
3409
 * Use the dwRotationAngle field in the TDDBltFX structure as the angle
3410
 * (specified in 1/100th of a degree) to rotate the surface.
3411
 *)
3412
  DDBLT_ROTATIONANGLE                     = $00040000;
3413
 
3414
(*
3415
 * Z-buffered blt using the z-buffers attached to the source and destination
3416
 * surfaces and the dwZBufferOpCode field in the TDDBltFX structure as the
3417
 * z-buffer opcode.
3418
 *)
3419
  DDBLT_ZBUFFER                           = $00080000;
3420
 
3421
(*
3422
 * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field
3423
 * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
3424
 * for the destination.
3425
 *)
3426
  DDBLT_ZBUFFERDESTCONSTOVERRIDE          = $00100000;
3427
 
3428
(*
3429
 * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode
3430
 * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
3431
 * respectively for the destination.
3432
 *)
3433
  DDBLT_ZBUFFERDESTOVERRIDE               = $00200000;
3434
 
3435
(*
3436
 * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field
3437
 * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
3438
 * for the source.
3439
 *)
3440
  DDBLT_ZBUFFERSRCCONSTOVERRIDE           = $00400000;
3441
 
3442
(*
3443
 * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode
3444
 * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
3445
 * respectively for the source.
3446
 *)
3447
   DDBLT_ZBUFFERSRCOVERRIDE                = $00800000;
3448
 
3449
(*
3450
 * wait until the device is ready to handle the blt
3451
 * this will cause blt to not return DDERR_WASSTILLDRAWING
3452
 *)
3453
  DDBLT_WAIT                              = $01000000;
3454
 
3455
(*
3456
 * Uses the dwFillDepth field in the TDDBltFX structure as the depth value
3457
 * to fill the destination rectangle on the destination Z-buffer surface
3458
 * with.
3459
 *)
3460
  DDBLT_DEPTHFILL                         = $02000000;
3461
 
3462
(*
3463
 * wait until the device is ready to handle the blt
3464
 * this will cause blt to not return DDERR_WASSTILLDRAWING
3465
 *)
3466
  DDBLT_DONOTWAIT                         = $08000000;
3467
 
3468
(****************************************************************************
3469
 *
3470
 * BLTFAST FLAGS
3471
 *
3472
 ****************************************************************************)
3473
 
3474
  DDBLTFAST_NOCOLORKEY                    = $00000000;
3475
  DDBLTFAST_SRCCOLORKEY                   = $00000001;
3476
  DDBLTFAST_DESTCOLORKEY                  = $00000002;
3477
  DDBLTFAST_WAIT                          = $00000010;
3478
  DDBLTFAST_DONOTWAIT                     = $00000020;
3479
 
3480
(****************************************************************************
3481
 *
3482
 * FLIP FLAGS
3483
 *
3484
 ****************************************************************************)
3485
 
3486
 
3487
  DDFLIP_WAIT                          = $00000001;
3488
 
3489
(*
3490
 * Indicates that the target surface contains the even field of video data.
3491
 * This flag is only valid with an overlay surface.
3492
 *)
3493
  DDFLIP_EVEN                          = $00000002;
3494
 
3495
(*
3496
 * Indicates that the target surface contains the odd field of video data.
3497
 * This flag is only valid with an overlay surface.
3498
 *)
3499
  DDFLIP_ODD                           = $00000004;
3500
 
3501
(*
3502
 * Causes DirectDraw to perform the physical flip immediately and return
3503
 * to the application. Typically, what was the front buffer but is now the back
3504
 * buffer will still be visible (depending on timing) until the next vertical
3505
 * retrace. Subsequent operations involving the two flipped surfaces will
3506
 * not check to see if the physical flip has finished (i.e. will not return
3507
 * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)).
3508
 * This allows an application to perform Flips at a higher frequency than the
3509
 * monitor refresh rate, but may introduce visible artifacts.
3510
 * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set,
3511
 * DDFLIP_NOVSYNC has no effect.
3512
 *)
3513
  DDFLIP_NOVSYNC                       = $00000008;
3514
 
3515
 
3516
(*
3517
 * Flip Interval Flags. These flags indicate how many vertical retraces to wait between
3518
 * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each
3519
 * surface involved in the flip until the specified number of vertical retraces has
3520
 * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set,
3521
 * DDFLIP_INTERVALn has no effect.
3522
 *)
3523
 
3524
(*
3525
 * DirectDraw will flip on every other vertical sync
3526
 *)
3527
  DDFLIP_INTERVAL2                     = $02000000;
3528
 
3529
 
3530
(*
3531
 * DirectDraw will flip on every third vertical sync
3532
 *)
3533
  DDFLIP_INTERVAL3                     = $03000000;
3534
 
3535
 
3536
(*
3537
 * DirectDraw will flip on every fourth vertical sync
3538
 *)
3539
  DDFLIP_INTERVAL4                     = $04000000;
3540
 
3541
(*
3542
 * DirectDraw will flip and display a main stereo surface
3543
 *)
3544
  DDFLIP_STEREO                        = $00000010;
3545
 
3546
(*
3547
 * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish
3548
 * to override the default and use time when the accelerator is busy (as denoted by
3549
 * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT.
3550
 *)
3551
  DDFLIP_DONOTWAIT                     = $00000020;
3552
 
3553
(****************************************************************************
3554
 *
3555
 * DIRECTDRAW SURFACE OVERLAY FLAGS
3556
 *
3557
 ****************************************************************************)
3558
 
3559
(*
3560
 * Use the alpha information in the pixel format or the alpha channel surface
3561
 * attached to the destination surface as the alpha channel for the
3562
 * destination overlay.
3563
 *)
3564
  DDOVER_ALPHADEST                        = $00000001;
3565
 
3566
(*
3567
 * Use the dwConstAlphaDest field in the TDDOverlayFX structure as the
3568
 * destination alpha channel for this overlay.
3569
 *)
3570
  DDOVER_ALPHADESTCONSTOVERRIDE           = $00000002;
3571
 
3572
(*
3573
 * The NEG suffix indicates that the destination surface becomes more
3574
 * transparent as the alpha value increases.
3575
 *)
3576
  DDOVER_ALPHADESTNEG                     = $00000004;
3577
 
3578
(*
3579
 * Use the lpDDSAlphaDest field in the TDDOverlayFX structure as the alpha
3580
 * channel destination for this overlay.
3581
 *)
3582
  DDOVER_ALPHADESTSURFACEOVERRIDE         = $00000008;
3583
 
3584
(*
3585
 * Use the dwAlphaEdgeBlend field in the TDDOverlayFX structure as the alpha
3586
 * channel for the edges of the image that border the color key colors.
3587
 *)
3588
  DDOVER_ALPHAEDGEBLEND                   = $00000010;
3589
 
3590
(*
3591
 * Use the alpha information in the pixel format or the alpha channel surface
3592
 * attached to the source surface as the source alpha channel for this overlay.
3593
 *)
3594
  DDOVER_ALPHASRC                         = $00000020;
3595
 
3596
(*
3597
 * Use the dwConstAlphaSrc field in the TDDOverlayFX structure as the source
3598
 * alpha channel for this overlay.
3599
 *)
3600
  DDOVER_ALPHASRCCONSTOVERRIDE            = $00000040;
3601
 
3602
(*
3603
 * The NEG suffix indicates that the source surface becomes more transparent
3604
 * as the alpha value increases.
3605
 *)
3606
  DDOVER_ALPHASRCNEG                      = $00000080;
3607
 
3608
(*
3609
 * Use the lpDDSAlphaSrc field in the TDDOverlayFX structure as the alpha channel
3610
 * source for this overlay.
3611
 *)
3612
  DDOVER_ALPHASRCSURFACEOVERRIDE          = $00000100;
3613
 
3614
(*
3615
 * Turn this overlay off.
3616
 *)
3617
  DDOVER_HIDE                             = $00000200;
3618
 
3619
(*
3620
 * Use the color key associated with the destination surface.
3621
 *)
3622
  DDOVER_KEYDEST                          = $00000400;
3623
 
3624
(*
3625
 * Use the dckDestColorkey field in the TDDOverlayFX structure as the color key
3626
 * for the destination surface
3627
 *)
3628
  DDOVER_KEYDESTOVERRIDE                  = $00000800;
3629
 
3630
(*
3631
 * Use the color key associated with the source surface.
3632
 *)
3633
  DDOVER_KEYSRC                           = $00001000;
3634
 
3635
(*
3636
 * Use the dckSrcColorkey field in the TDDOverlayFX structure as the color key
3637
 * for the source surface.
3638
 *)
3639
  DDOVER_KEYSRCOVERRIDE                   = $00002000;
3640
 
3641
(*
3642
 * Turn this overlay on.
3643
 *)
3644
  DDOVER_SHOW                             = $00004000;
3645
 
3646
(*
3647
 * Add a dirty rect to an emulated overlayed surface.
3648
 *)
3649
  DDOVER_ADDDIRTYRECT                     = $00008000;
3650
 
3651
(*
3652
 * Redraw all dirty rects on an emulated overlayed surface.
3653
 *)
3654
  DDOVER_REFRESHDIRTYRECTS                = $00010000;
3655
 
3656
(*
3657
 * Redraw the entire surface on an emulated overlayed surface.
3658
 *)
3659
  DDOVER_REFRESHALL                      = $00020000;
3660
 
3661
(*
3662
 * Use the overlay FX flags to define special overlay FX
3663
 *)
3664
  DDOVER_DDFX                             = $00080000;
3665
 
3666
(*
3667
 * Autoflip the overlay when ever the video port autoflips
3668
 *)
3669
  DDOVER_AUTOFLIP                         = $00100000;
3670
 
3671
(*
3672
 * Display each field of video port data individually without
3673
 * causing any jittery artifacts
3674
 *)
3675
  DDOVER_BOB                              = $00200000;
3676
 
3677
(*
3678
 * Indicates that bob/weave decisions should not be overridden by other
3679
 * interfaces.
3680
 *)
3681
  DDOVER_OVERRIDEBOBWEAVE                 = $00400000;
3682
 
3683
(*
3684
 * Indicates that the surface memory is composed of interleaved fields.
3685
 *)
3686
  DDOVER_INTERLEAVED                      = $00800000;
3687
 
3688
(*
3689
 * Indicates that bob will be performed using hardware rather than
3690
 * software or emulated.
3691
 *)
3692
  DDOVER_BOBHARDWARE                    = $01000000;
3693
 
3694
(*
3695
 * Indicates that overlay FX structure contains valid ARGB scaling factors.
3696
 *)
3697
  DDOVER_ARGBSCALEFACTORS                 = $02000000;
3698
 
3699
(*
3700
 * Indicates that ARGB scaling factors can be degraded to fit driver capabilities.
3701
 *)
3702
  DDOVER_DEGRADEARGBSCALING               = $04000000;
3703
 
3704
(****************************************************************************
3705
 *
3706
 * DIRECTDRAWSURFACE LOCK FLAGS
3707
 *
3708
 ****************************************************************************)
3709
 
3710
(*
3711
 * The default.  Set to indicate that Lock should return a valid memory pointer
3712
 * to the top of the specified rectangle.  If no rectangle is specified then a
3713
 * pointer to the top of the surface is returned.
3714
 *)
3715
  DDLOCK_SURFACEMEMORYPTR                 = $00000000;    // = default
3716
 
3717
(*
3718
 * Set to indicate that Lock should wait until it can obtain a valid memory
3719
 * pointer before returning.  If this bit is set, Lock will never return
3720
 * DDERR_WASSTILLDRAWING.
3721
 *)
3722
  DDLOCK_WAIT                             = $00000001;
3723
 
3724
(*
3725
 * Set if an event handle is being passed to Lock.  Lock will trigger the event
3726
 * when it can return the surface memory pointer requested.
3727
 *)
3728
  DDLOCK_EVENT                            = $00000002;
3729
 
3730
(*
3731
 * Indicates that the surface being locked will only be read from.
3732
 *)
3733
  DDLOCK_READONLY                         = $00000010;
3734
 
3735
(*
3736
 * Indicates that the surface being locked will only be written to
3737
 *)
3738
  DDLOCK_WRITEONLY                        = $00000020;
3739
 
3740
(*
3741
 * Indicates that a system wide lock should not be taken when this surface
3742
 * is locked. This has several advantages (cursor responsiveness, ability
3743
 * to call more Windows functions, easier debugging) when locking video
3744
 * memory surfaces. However, an application specifying this flag must
3745
 * comply with a number of conditions documented in the help file.
3746
 * Furthermore, this flag cannot be specified when locking the primary.
3747
 *)
3748
  DDLOCK_NOSYSLOCK                        = $00000800;
3749
 
3750
(*
3751
 * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices
3752
 * that were referred to in Draw*PrimtiveVB calls since the start of the
3753
 * frame (or the last lock without this flag) will be modified during the
3754
 * lock. This can be useful when one is only appending data to the vertex
3755
 * buffer
3756
 *)
3757
  DDLOCK_NOOVERWRITE                      = $00001000;
3758
 
3759
(*
3760
 * Indicates that no assumptions will be made about the contents of the
3761
 * surface or vertex buffer during this lock.
3762
 * This enables two things:
3763
 * -    Direct3D or the driver may provide an alternative memory
3764
 *      area as the vertex buffer. This is useful when one plans to clear the
3765
 *      contents of the vertex buffer and fill in new data.
3766
 * -    Drivers sometimes store surface data in a re-ordered format.
3767
 *      When the application locks the surface, the driver is forced to un-re-order
3768
 *      the surface data before allowing the application to see the surface contents.
3769
 *      This flag is a hint to the driver that it can skip the un-re-ordering process
3770
 *      since the application plans to overwrite every single pixel in the surface
3771
 *      or locked rectangle (and so erase any un-re-ordered pixels anyway).
3772
 *      Applications should always set this flag when they intend to overwrite the entire
3773
 *      surface or locked rectangle.
3774
 *)
3775
  DDLOCK_DISCARDCONTENTS                  = $00002000;
3776
 (*
3777
  * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS
3778
  *)
3779
  DDLOCK_OKTOSWAP                         = $00002000;
3780
 
3781
(*
3782
 * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish
3783
 * to override the default and use time when the accelerator is busy (as denoted by
3784
 * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT.
3785
 *)
3786
  DDLOCK_DONOTWAIT                        = $00004000;
3787
 
3788
 
3789
(****************************************************************************
3790
 *
3791
 * DIRECTDRAWSURFACE PAGELOCK FLAGS
3792
 *
3793
 ****************************************************************************)
3794
 
3795
(*
3796
 * No flags defined at present
3797
 *)
3798
 
3799
 
3800
(****************************************************************************
3801
 *
3802
 * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS
3803
 *
3804
 ****************************************************************************)
3805
 
3806
(*
3807
 * No flags defined at present
3808
 *)
3809
 
3810
 
3811
(****************************************************************************
3812
 *
3813
 * DIRECTDRAWSURFACE BLT FX FLAGS
3814
 *
3815
 ****************************************************************************)
3816
 
3817
(*
3818
 * If stretching, use arithmetic stretching along the Y axis for this blt.
3819
 *)
3820
  DDBLTFX_ARITHSTRETCHY                   = $00000001;
3821
 
3822
(*
3823
 * Do this blt mirroring the surface left to right.  Spin the
3824
 * surface around its y-axis.
3825
 *)
3826
  DDBLTFX_MIRRORLEFTRIGHT                 = $00000002;
3827
 
3828
(*
3829
 * Do this blt mirroring the surface up and down.  Spin the surface
3830
 * around its x-axis.
3831
 *)
3832
  DDBLTFX_MIRRORUPDOWN                    = $00000004;
3833
 
3834
(*
3835
 * Schedule this blt to avoid tearing.
3836
 *)
3837
  DDBLTFX_NOTEARING                       = $00000008;
3838
 
3839
(*
3840
 * Do this blt rotating the surface one hundred and eighty degrees.
3841
 *)
3842
  DDBLTFX_ROTATE180                       = $00000010;
3843
 
3844
(*
3845
 * Do this blt rotating the surface two hundred and seventy degrees.
3846
 *)
3847
  DDBLTFX_ROTATE270                       = $00000020;
3848
 
3849
(*
3850
 * Do this blt rotating the surface ninety degrees.
3851
 *)
3852
  DDBLTFX_ROTATE90                        = $00000040;
3853
 
3854
(*
3855
 * Do this z blt using dwZBufferLow and dwZBufferHigh as  range values
3856
 * specified to limit the bits copied from the source surface.
3857
 *)
3858
  DDBLTFX_ZBUFFERRANGE                    = $00000080;
3859
 
3860
(*
3861
 * Do this z blt adding the dwZBufferBaseDest to each of the sources z values
3862
 * before comparing it with the desting z values.
3863
 *)
3864
  DDBLTFX_ZBUFFERBASEDEST                 = $00000100;
3865
 
3866
(****************************************************************************
3867
 *
3868
 * DIRECTDRAWSURFACE OVERLAY FX FLAGS
3869
 *
3870
 ****************************************************************************)
3871
 
3872
(*
3873
 * If stretching, use arithmetic stretching along the Y axis for this overlay.
3874
 *)
3875
  DDOVERFX_ARITHSTRETCHY                  = $00000001;
3876
 
3877
(*
3878
 * Mirror the overlay across the vertical axis
3879
 *)
3880
  DDOVERFX_MIRRORLEFTRIGHT                = $00000002;
3881
 
3882
(*
3883
 * Mirror the overlay across the horizontal axis
3884
 *)
3885
  DDOVERFX_MIRRORUPDOWN                   = $00000004;
3886
 
3887
(****************************************************************************
3888
 *
3889
 * Flags for dwDDFX member of DDSPRITEFX structure
3890
 *
3891
 ****************************************************************************)
3892
(*
3893
 * Use affine transformation matrix in fTransform member.
3894
 *)
3895
  DDSPRITEFX_AFFINETRANSFORM            = $00000001;
3896
 
3897
(*
3898
 * Use RGBA scaling factors in ddrgbaScaleFactors member.
3899
 *)
3900
  DDSPRITEFX_RGBASCALING                        = $00000002;
3901
 
3902
(*
3903
 * Degrade RGBA scaling factors to accommodate driver's capabilities.
3904
 *)
3905
  DDSPRITEFX_DEGRADERGBASCALING         = $00000004;
3906
 
3907
(*
3908
 * Do bilinear filtering of stretched or warped sprite.
3909
 *)
3910
  DDSPRITEFX_BILINEARFILTER                     = $00000008;
3911
 
3912
(*
3913
 * Do "blur" filtering of stretched or warped sprite.
3914
 *)
3915
  DDSPRITEFX_BLURFILTER                         = $00000010;
3916
 
3917
(*
3918
 * Do "flat" filtering of stretched or warped sprite.
3919
 *)
3920
  DDSPRITEFX_FLATFILTER                         = $00000020;
3921
 
3922
(*
3923
 * Degrade filtering operation to accommodate driver's capabilities.
3924
 *)
3925
  DDSPRITEFX_DEGRADEFILTER              = $00000040;
3926
 
3927
(****************************************************************************
3928
 *
3929
 * DIRECTDRAW WAITFORVERTICALBLANK FLAGS
3930
 *
3931
 ****************************************************************************)
3932
 
3933
(*
3934
 * return when the vertical blank interval begins
3935
 *)
3936
  DDWAITVB_BLOCKBEGIN                     = $00000001;
3937
 
3938
(*
3939
 * set up an event to trigger when the vertical blank begins
3940
 *)
3941
  DDWAITVB_BLOCKBEGINEVENT                = $00000002;
3942
 
3943
(*
3944
 * return when the vertical blank interval ends and display begins
3945
 *)
3946
  DDWAITVB_BLOCKEND                       = $00000004;
3947
 
3948
(****************************************************************************
3949
 *
3950
 * DIRECTDRAW GETFLIPSTATUS FLAGS
3951
 *
3952
 ****************************************************************************)
3953
 
3954
(*
3955
 * is it OK to flip now?
3956
 *)
3957
  DDGFS_CANFLIP                   = $00000001;
3958
 
3959
(*
3960
 * is the last flip finished?
3961
 *)
3962
  DDGFS_ISFLIPDONE                = $00000002;
3963
 
3964
(****************************************************************************
3965
 *
3966
 * DIRECTDRAW GETBLTSTATUS FLAGS
3967
 *
3968
 ****************************************************************************)
3969
 
3970
(*
3971
 * is it OK to blt now?
3972
 *)
3973
  DDGBS_CANBLT                    = $00000001;
3974
 
3975
(*
3976
 * is the blt to the surface finished?
3977
 *)
3978
  DDGBS_ISBLTDONE                 = $00000002;
3979
 
3980
 
3981
(****************************************************************************
3982
 *
3983
 * DIRECTDRAW ENUMOVERLAYZORDER FLAGS
3984
 *
3985
 ****************************************************************************)
3986
 
3987
(*
3988
 * Enumerate overlays back to front.
3989
 *)
3990
  DDENUMOVERLAYZ_BACKTOFRONT      = $00000000;
3991
 
3992
(*
3993
 * Enumerate overlays front to back
3994
 *)
3995
  DDENUMOVERLAYZ_FRONTTOBACK      = $00000001;
3996
 
3997
(****************************************************************************
3998
 *
3999
 * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS
4000
 *
4001
 ****************************************************************************)
4002
 
4003
(*
4004
 * Send overlay to front
4005
 *)
4006
  DDOVERZ_SENDTOFRONT             = $00000000;
4007
 
4008
(*
4009
 * Send overlay to back
4010
 *)
4011
  DDOVERZ_SENDTOBACK              = $00000001;
4012
 
4013
(*
4014
 * Move Overlay forward
4015
 *)
4016
  DDOVERZ_MOVEFORWARD             = $00000002;
4017
 
4018
(*
4019
 * Move Overlay backward
4020
 *)
4021
  DDOVERZ_MOVEBACKWARD            = $00000003;
4022
 
4023
(*
4024
 * Move Overlay in front of relative surface
4025
 *)
4026
  DDOVERZ_INSERTINFRONTOF         = $00000004;
4027
 
4028
(*
4029
 * Move Overlay in back of relative surface
4030
 *)
4031
  DDOVERZ_INSERTINBACKOF          = $00000005;
4032
 
4033
(****************************************************************************
4034
 *
4035
 * DIRECTDRAW SETGAMMARAMP FLAGS
4036
 *
4037
 ****************************************************************************)
4038
 
4039
(*
4040
 * Request calibrator to adjust the gamma ramp according to the physical
4041
 * properties of the display so that the result should appear identical
4042
 * on all systems.
4043
 *)
4044
  DDSGR_CALIBRATE                        = $00000001;
4045
 
4046
(****************************************************************************
4047
 *
4048
 * DIRECTDRAW STARTMODETEST FLAGS
4049
 *
4050
 ****************************************************************************)
4051
 
4052
(*
4053
 * Indicates that the mode being tested has passed
4054
 *)
4055
 DDSMT_ISTESTREQUIRED                   = $00000001;
4056
 
4057
 
4058
(****************************************************************************
4059
 *
4060
 * DIRECTDRAW EVALUATEMODE FLAGS
4061
 *
4062
 ****************************************************************************)
4063
 
4064
(*
4065
 * Indicates that the mode being tested has passed
4066
 *)
4067
 DDEM_MODEPASSED                        = $00000001;
4068
 
4069
(*
4070
 * Indicates that the mode being tested has failed
4071
 *)
4072
 DDEM_MODEFAILED                        = $00000002;
4073
 
4074
(*===========================================================================
4075
 *
4076
 *
4077
 * DIRECTDRAW RETURN CODES
4078
 *
4079
 * The return values from DirectDraw Commands and Surface that return an HResult
4080
 * are codes from DirectDraw concerning the results of the action
4081
 * requested by DirectDraw.
4082
 *
4083
 *==========================================================================*)
4084
 
4085
(*
4086
 * Status is OK
4087
 *
4088
 * Issued by: DirectDraw Commands and all callbacks
4089
 *)
4090
  DD_OK                                   = 0;
4091
  DD_FALSE                                = S_FALSE;
4092
 
4093
(****************************************************************************
4094
 *
4095
 * DIRECTDRAW ENUMCALLBACK RETURN VALUES
4096
 *
4097
 * EnumCallback returns are used to control the flow of the DIRECTDRAW and
4098
 * DIRECTDRAWSURFACE object enumerations.   They can only be returned by
4099
 * enumeration callback routines.
4100
 *
4101
 ****************************************************************************)
4102
 
4103
(*
4104
 * stop the enumeration
4105
 *)
4106
  DDENUMRET_CANCEL                        = 0;
4107
 
4108
(*
4109
 * continue the enumeration
4110
 *)
4111
  DDENUMRET_OK                            = 1;
4112
 
4113
(****************************************************************************
4114
 *
4115
 * DIRECTDRAW ERRORS
4116
 *
4117
 * Errors are represented by negative values and cannot be combined.
4118
 *
4119
 ****************************************************************************)
4120
 
4121
  _FACDD = $876;
4122
  MAKE_DDHRESULT = HResult(1 shl 31) or HResult(_FACDD shl 16);
4123
 
4124
 
4125
(*
4126
 * This object is already initialized
4127
 *)
4128
  DDERR_ALREADYINITIALIZED                = MAKE_DDHRESULT + 5;
4129
 
4130
(*
4131
 * This surface can not be attached to the requested surface.
4132
 *)
4133
  DDERR_CANNOTATTACHSURFACE               = MAKE_DDHRESULT + 10;
4134
 
4135
(*
4136
 * This surface can not be detached from the requested surface.
4137
 *)
4138
  DDERR_CANNOTDETACHSURFACE               = MAKE_DDHRESULT + 20;
4139
 
4140
(*
4141
 * Support is currently not available.
4142
 *)
4143
  DDERR_CURRENTLYNOTAVAIL                 = MAKE_DDHRESULT + 40;
4144
 
4145
(*
4146
 * An exception was encountered while performing the requested operation
4147
 *)
4148
  DDERR_EXCEPTION                         = MAKE_DDHRESULT + 55;
4149
 
4150
(*
4151
 * Generic failure.
4152
 *)
4153
  DDERR_GENERIC                           = E_FAIL;
4154
 
4155
(*
4156
 * Height of rectangle provided is not a multiple of reqd alignment
4157
 *)
4158
  DDERR_HEIGHTALIGN                       = MAKE_DDHRESULT + 90;
4159
 
4160
(*
4161
 * Unable to match primary surface creation request with existing
4162
 * primary surface.
4163
 *)
4164
  DDERR_INCOMPATIBLEPRIMARY               = MAKE_DDHRESULT + 95;
4165
 
4166
(*
4167
 * One or more of the caps bits passed to the callback are incorrect.
4168
 *)
4169
  DDERR_INVALIDCAPS                       = MAKE_DDHRESULT + 100;
4170
 
4171
(*
4172
 * DirectDraw does not support provided Cliplist.
4173
 *)
4174
  DDERR_INVALIDCLIPLIST                   = MAKE_DDHRESULT + 110;
4175
 
4176
(*
4177
 * DirectDraw does not support the requested mode
4178
 *)
4179
  DDERR_INVALIDMODE                       = MAKE_DDHRESULT + 120;
4180
 
4181
(*
4182
 * DirectDraw received a pointer that was an invalid DIRECTDRAW object.
4183
 *)
4184
  DDERR_INVALIDOBJECT                     = MAKE_DDHRESULT + 130;
4185
 
4186
(*
4187
 * One or more of the parameters passed to the callback function are
4188
 * incorrect.
4189
 *)
4190
  DDERR_INVALIDPARAMS                     = E_INVALIDARG;
4191
 
4192
(*
4193
 * pixel format was invalid as specified
4194
 *)
4195
  DDERR_INVALIDPIXELFORMAT                = MAKE_DDHRESULT + 145;
4196
 
4197
(*
4198
 * Rectangle provided was invalid.
4199
 *)
4200
  DDERR_INVALIDRECT                       = MAKE_DDHRESULT + 150;
4201
 
4202
(*
4203
 * Operation could not be carried out because one or more surfaces are locked
4204
 *)
4205
  DDERR_LOCKEDSURFACES                    = MAKE_DDHRESULT + 160;
4206
 
4207
(*
4208
 * There is no 3D present.
4209
 *)
4210
  DDERR_NO3D                              = MAKE_DDHRESULT + 170;
4211
 
4212
(*
4213
 * Operation could not be carried out because there is no alpha accleration
4214
 * hardware present or available.
4215
 *)
4216
  DDERR_NOALPHAHW                         = MAKE_DDHRESULT + 180;
4217
 
4218
(*
4219
 * Operation could not be carried out because there is no stereo
4220
 * hardware present or available.
4221
 *)
4222
  DDERR_NOSTEREOHARDWARE          = MAKE_DDHRESULT + 181;
4223
 
4224
(*
4225
 * Operation could not be carried out because there is no hardware
4226
 * present which supports stereo surfaces
4227
 *)
4228
  DDERR_NOSURFACELEFT             = MAKE_DDHRESULT + 182;
4229
 
4230
(*
4231
 * no clip list available
4232
 *)
4233
  DDERR_NOCLIPLIST                        = MAKE_DDHRESULT + 205;
4234
 
4235
(*
4236
 * Operation could not be carried out because there is no color conversion
4237
 * hardware present or available.
4238
 *)
4239
  DDERR_NOCOLORCONVHW                     = MAKE_DDHRESULT + 210;
4240
 
4241
(*
4242
 * Create function called without DirectDraw object method SetCooperativeLevel
4243
 * being called.
4244
 *)
4245
  DDERR_NOCOOPERATIVELEVELSET             = MAKE_DDHRESULT + 212;
4246
 
4247
(*
4248
 * Surface doesn't currently have a color key
4249
 *)
4250
  DDERR_NOCOLORKEY                        = MAKE_DDHRESULT + 215;
4251
 
4252
(*
4253
 * Operation could not be carried out because there is no hardware support
4254
 * of the dest color key.
4255
 *)
4256
  DDERR_NOCOLORKEYHW                      = MAKE_DDHRESULT + 220;
4257
 
4258
(*
4259
 * No DirectDraw support possible with current display driver
4260
 *)
4261
  DDERR_NODIRECTDRAWSUPPORT               = MAKE_DDHRESULT + 222;
4262
 
4263
(*
4264
 * Operation requires the application to have exclusive mode but the
4265
 * application does not have exclusive mode.
4266
 *)
4267
  DDERR_NOEXCLUSIVEMODE                   = MAKE_DDHRESULT + 225;
4268
 
4269
(*
4270
 * Flipping visible surfaces is not supported.
4271
 *)
4272
  DDERR_NOFLIPHW                          = MAKE_DDHRESULT + 230;
4273
 
4274
(*
4275
 * There is no GDI present.
4276
 *)
4277
  DDERR_NOGDI                             = MAKE_DDHRESULT + 240;
4278
 
4279
(*
4280
 * Operation could not be carried out because there is no hardware present
4281
 * or available.
4282
 *)
4283
  DDERR_NOMIRRORHW                        = MAKE_DDHRESULT + 250;
4284
 
4285
(*
4286
 * Requested item was not found
4287
 *)
4288
  DDERR_NOTFOUND                          = MAKE_DDHRESULT + 255;
4289
 
4290
(*
4291
 * Operation could not be carried out because there is no overlay hardware
4292
 * present or available.
4293
 *)
4294
  DDERR_NOOVERLAYHW                       = MAKE_DDHRESULT + 260;
4295
 
4296
(*
4297
 * Operation could not be carried out because the source and destination
4298
 * rectangles are on the same surface and overlap each other.
4299
 *)
4300
  DDERR_OVERLAPPINGRECTS                = MAKE_DDHRESULT + 270;
4301
 
4302
(*
4303
 * Operation could not be carried out because there is no appropriate raster
4304
 * op hardware present or available.
4305
 *)
4306
  DDERR_NORASTEROPHW                      = MAKE_DDHRESULT + 280;
4307
 
4308
(*
4309
 * Operation could not be carried out because there is no rotation hardware
4310
 * present or available.
4311
 *)
4312
  DDERR_NOROTATIONHW                      = MAKE_DDHRESULT + 290;
4313
 
4314
(*
4315
 * Operation could not be carried out because there is no hardware support
4316
 * for stretching
4317
 *)
4318
  DDERR_NOSTRETCHHW                       = MAKE_DDHRESULT + 310;
4319
 
4320
(*
4321
 * DirectDrawSurface is not in 4 bit color palette and the requested operation
4322
 * requires 4 bit color palette.
4323
 *)
4324
  DDERR_NOT4BITCOLOR                      = MAKE_DDHRESULT + 316;
4325
 
4326
(*
4327
 * DirectDrawSurface is not in 4 bit color index palette and the requested
4328
 * operation requires 4 bit color index palette.
4329
 *)
4330
  DDERR_NOT4BITCOLORINDEX                 = MAKE_DDHRESULT + 317;
4331
 
4332
(*
4333
 * DirectDraw Surface is not in 8 bit color mode and the requested operation
4334
 * requires 8 bit color.
4335
 *)
4336
  DDERR_NOT8BITCOLOR                      = MAKE_DDHRESULT + 320;
4337
 
4338
(*
4339
 * Operation could not be carried out because there is no texture mapping
4340
 * hardware present or available.
4341
 *)
4342
  DDERR_NOTEXTUREHW                       = MAKE_DDHRESULT + 330;
4343
 
4344
(*
4345
 * Operation could not be carried out because there is no hardware support
4346
 * for vertical blank synchronized operations.
4347
 *)
4348
  DDERR_NOVSYNCHW                         = MAKE_DDHRESULT + 335;
4349
 
4350
(*
4351
 * Operation could not be carried out because there is no hardware support
4352
 * for zbuffer blting.
4353
 *)
4354
  DDERR_NOZBUFFERHW                       = MAKE_DDHRESULT + 340;
4355
 
4356
(*
4357
 * Overlay surfaces could not be z layered based on their BltOrder because
4358
 * the hardware does not support z layering of overlays.
4359
 *)
4360
  DDERR_NOZOVERLAYHW                      = MAKE_DDHRESULT + 350;
4361
 
4362
(*
4363
 * The hardware needed for the requested operation has already been
4364
 * allocated.
4365
 *)
4366
  DDERR_OUTOFCAPS                         = MAKE_DDHRESULT + 360;
4367
 
4368
(*
4369
 * DirectDraw does not have enough memory to perform the operation.
4370
 *)
4371
  DDERR_OUTOFMEMORY                       = E_OUTOFMEMORY;
4372
 
4373
(*
4374
 * DirectDraw does not have enough memory to perform the operation.
4375
 *)
4376
  DDERR_OUTOFVIDEOMEMORY                  = MAKE_DDHRESULT + 380;
4377
 
4378
(*
4379
 * hardware does not support clipped overlays
4380
 *)
4381
  DDERR_OVERLAYCANTCLIP                   = MAKE_DDHRESULT + 382;
4382
 
4383
(*
4384
 * Can only have ony color key active at one time for overlays
4385
 *)
4386
  DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = MAKE_DDHRESULT + 384;
4387
 
4388
(*
4389
 * Access to this palette is being refused because the palette is already
4390
 * locked by another thread.
4391
 *)
4392
  DDERR_PALETTEBUSY                       = MAKE_DDHRESULT + 387;
4393
 
4394
(*
4395
 * No src color key specified for this operation.
4396
 *)
4397
  DDERR_COLORKEYNOTSET                    = MAKE_DDHRESULT + 400;
4398
 
4399
(*
4400
 * This surface is already attached to the surface it is being attached to.
4401
 *)
4402
  DDERR_SURFACEALREADYATTACHED            = MAKE_DDHRESULT + 410;
4403
 
4404
(*
4405
 * This surface is already a dependency of the surface it is being made a
4406
 * dependency of.
4407
 *)
4408
  DDERR_SURFACEALREADYDEPENDENT           = MAKE_DDHRESULT + 420;
4409
 
4410
(*
4411
 * Access to this surface is being refused because the surface is already
4412
 * locked by another thread.
4413
 *)
4414
  DDERR_SURFACEBUSY                       = MAKE_DDHRESULT + 430;
4415
 
4416
(*
4417
 * Access to this surface is being refused because no driver exists
4418
 * which can supply a pointer to the surface.
4419
 * This is most likely to happen when attempting to lock the primary
4420
 * surface when no DCI provider is present.
4421
 * Will also happen on attempts to lock an optimized surface.
4422
 *)
4423
  DDERR_CANTLOCKSURFACE                   = MAKE_DDHRESULT + 435;
4424
 
4425
(*
4426
 * Access to Surface refused because Surface is obscured.
4427
 *)
4428
  DDERR_SURFACEISOBSCURED                 = MAKE_DDHRESULT + 440;
4429
 
4430
(*
4431
 * Access to this surface is being refused because the surface is gone.
4432
 * The DIRECTDRAWSURFACE object representing this surface should
4433
 * have Restore called on it.
4434
 *)
4435
  DDERR_SURFACELOST                       = MAKE_DDHRESULT + 450;
4436
 
4437
(*
4438
 * The requested surface is not attached.
4439
 *)
4440
  DDERR_SURFACENOTATTACHED                = MAKE_DDHRESULT + 460;
4441
 
4442
(*
4443
 * Height requested by DirectDraw is too large.
4444
 *)
4445
  DDERR_TOOBIGHEIGHT                      = MAKE_DDHRESULT + 470;
4446
 
4447
(*
4448
 * Size requested by DirectDraw is too large --  The individual height and
4449
 * width are OK.
4450
 *)
4451
  DDERR_TOOBIGSIZE                        = MAKE_DDHRESULT + 480;
4452
 
4453
(*
4454
 * Width requested by DirectDraw is too large.
4455
 *)
4456
  DDERR_TOOBIGWIDTH                       = MAKE_DDHRESULT + 490;
4457
 
4458
(*
4459
 * Action not supported.
4460
 *)
4461
  DDERR_UNSUPPORTED                       = E_NOTIMPL;
4462
 
4463
(*
4464
 * FOURCC format requested is unsupported by DirectDraw
4465
 *)
4466
  DDERR_UNSUPPORTEDFORMAT                 = MAKE_DDHRESULT + 510;
4467
 
4468
(*
4469
 * Bitmask in the pixel format requested is unsupported by DirectDraw
4470
 *)
4471
  DDERR_UNSUPPORTEDMASK                   = MAKE_DDHRESULT + 520;
4472
 
4473
(*
4474
 * The specified stream contains invalid data
4475
 *)
4476
  DDERR_INVALIDSTREAM                     = MAKE_DDHRESULT + 521;
4477
 
4478
(*
4479
 * vertical blank is in progress
4480
 *)
4481
  DDERR_VERTICALBLANKINPROGRESS           = MAKE_DDHRESULT + 537;
4482
 
4483
(*
4484
 * Informs DirectDraw that the previous Blt which is transfering information
4485
 * to or from this Surface is incomplete.
4486
 *)
4487
  DDERR_WASSTILLDRAWING                   = MAKE_DDHRESULT + 540;
4488
 
4489
(*
4490
 * The specified surface type requires specification of the COMPLEX flag
4491
 *)
4492
  DDERR_DDSCAPSCOMPLEXREQUIRED            = MAKE_DDHRESULT + 542;
4493
 
4494
(*
4495
 * Rectangle provided was not horizontally aligned on reqd. boundary
4496
 *)
4497
  DDERR_XALIGN                            = MAKE_DDHRESULT + 560;
4498
 
4499
(*
4500
 * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver
4501
 * identifier.
4502
 *)
4503
  DDERR_INVALIDDIRECTDRAWGUID             = MAKE_DDHRESULT + 561;
4504
 
4505
(*
4506
 * A DirectDraw object representing this driver has already been created
4507
 * for this process.
4508
 *)
4509
  DDERR_DIRECTDRAWALREADYCREATED          = MAKE_DDHRESULT + 562;
4510
 
4511
(*
4512
 * A hardware only DirectDraw object creation was attempted but the driver
4513
 * did not support any hardware.
4514
 *)
4515
  DDERR_NODIRECTDRAWHW                    = MAKE_DDHRESULT + 563;
4516
 
4517
(*
4518
 * this process already has created a primary surface
4519
 *)
4520
  DDERR_PRIMARYSURFACEALREADYEXISTS       = MAKE_DDHRESULT + 564;
4521
 
4522
(*
4523
 * software emulation not available.
4524
 *)
4525
  DDERR_NOEMULATION                       = MAKE_DDHRESULT + 565;
4526
 
4527
(*
4528
 * region passed to Clipper::GetClipList is too small.
4529
 *)
4530
  DDERR_REGIONTOOSMALL                    = MAKE_DDHRESULT + 566;
4531
 
4532
(*
4533
 * an attempt was made to set a clip list for a clipper objec that
4534
 * is already monitoring an hwnd.
4535
 *)
4536
  DDERR_CLIPPERISUSINGHWND                = MAKE_DDHRESULT + 567;
4537
 
4538
(*
4539
 * No clipper object attached to surface object
4540
 *)
4541
  DDERR_NOCLIPPERATTACHED                 = MAKE_DDHRESULT + 568;
4542
 
4543
(*
4544
 * Clipper notification requires an HWND or
4545
 * no HWND has previously been set as the CooperativeLevel HWND.
4546
 *)
4547
  DDERR_NOHWND                            = MAKE_DDHRESULT + 569;
4548
 
4549
(*
4550
 * HWND used by DirectDraw CooperativeLevel has been subclassed,
4551
 * this prevents DirectDraw from restoring state.
4552
 *)
4553
  DDERR_HWNDSUBCLASSED                    = MAKE_DDHRESULT + 570;
4554
 
4555
(*
4556
 * The CooperativeLevel HWND has already been set.
4557
 * It can not be reset while the process has surfaces or palettes created.
4558
 *)
4559
  DDERR_HWNDALREADYSET                    = MAKE_DDHRESULT + 571;
4560
 
4561
(*
4562
 * No palette object attached to this surface.
4563
 *)
4564
  DDERR_NOPALETTEATTACHED                 = MAKE_DDHRESULT + 572;
4565
 
4566
(*
4567
 * No hardware support for 16 or 256 color palettes.
4568
 *)
4569
  DDERR_NOPALETTEHW                       = MAKE_DDHRESULT + 573;
4570
 
4571
(*
4572
 * If a clipper object is attached to the source surface passed into a
4573
 * BltFast call.
4574
 *)
4575
  DDERR_BLTFASTCANTCLIP                   = MAKE_DDHRESULT + 574;
4576
 
4577
(*
4578
 * No blter.
4579
 *)
4580
  DDERR_NOBLTHW                           = MAKE_DDHRESULT + 575;
4581
 
4582
(*
4583
 * No DirectDraw ROP hardware.
4584
 *)
4585
  DDERR_NODDROPSHW                        = MAKE_DDHRESULT + 576;
4586
 
4587
(*
4588
 * returned when GetOverlayPosition is called on a hidden overlay
4589
 *)
4590
  DDERR_OVERLAYNOTVISIBLE                 = MAKE_DDHRESULT + 577;
4591
 
4592
(*
4593
 * returned when GetOverlayPosition is called on a overlay that UpdateOverlay
4594
 * has never been called on to establish a destionation.
4595
 *)
4596
  DDERR_NOOVERLAYDEST                     = MAKE_DDHRESULT + 578;
4597
 
4598
(*
4599
 * returned when the position of the overlay on the destionation is no longer
4600
 * legal for that destionation.
4601
 *)
4602
  DDERR_INVALIDPOSITION                   = MAKE_DDHRESULT + 579;
4603
 
4604
(*
4605
 * returned when an overlay member is called for a non-overlay surface
4606
 *)
4607
  DDERR_NOTAOVERLAYSURFACE                = MAKE_DDHRESULT + 580;
4608
 
4609
(*
4610
 * An attempt was made to set the cooperative level when it was already
4611
 * set to exclusive.
4612
 *)
4613
  DDERR_EXCLUSIVEMODEALREADYSET           = MAKE_DDHRESULT + 581;
4614
 
4615
(*
4616
 * An attempt has been made to flip a surface that is not flippable.
4617
 *)
4618
  DDERR_NOTFLIPPABLE                      = MAKE_DDHRESULT + 582;
4619
 
4620
(*
4621
 * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly
4622
 * created.
4623
 *)
4624
  DDERR_CANTDUPLICATE                     = MAKE_DDHRESULT + 583;
4625
 
4626
(*
4627
 * Surface was not locked.  An attempt to unlock a surface that was not
4628
 * locked at all, or by this process, has been attempted.
4629
 *)
4630
  DDERR_NOTLOCKED                         = MAKE_DDHRESULT + 584;
4631
 
4632
(*
4633
 * Windows can not create any more DCs, or a DC was requested for a paltte-indexed
4634
 * surface when the surface had no palette AND the display mode was not palette-indexed
4635
 * (in this case DirectDraw cannot select a proper palette into the DC)
4636
 *)
4637
  DDERR_CANTCREATEDC                      = MAKE_DDHRESULT + 585;
4638
 
4639
(*
4640
 * No DC was ever created for this surface.
4641
 *)
4642
  DDERR_NODC                              = MAKE_DDHRESULT + 586;
4643
 
4644
(*
4645
 * This surface can not be restored because it was created in a different
4646
 * mode.
4647
 *)
4648
  DDERR_WRONGMODE                         = MAKE_DDHRESULT + 587;
4649
 
4650
(*
4651
 * This surface can not be restored because it is an implicitly created
4652
 * surface.
4653
 *)
4654
  DDERR_IMPLICITLYCREATED                 = MAKE_DDHRESULT + 588;
4655
 
4656
(*
4657
 * The surface being used is not a palette-based surface
4658
 *)
4659
  DDERR_NOTPALETTIZED                     = MAKE_DDHRESULT + 589;
4660
 
4661
(*
4662
 * The display is currently in an unsupported mode
4663
 *)
4664
  DDERR_UNSUPPORTEDMODE                   = MAKE_DDHRESULT + 590;
4665
 
4666
(*
4667
 * Operation could not be carried out because there is no mip-map
4668
 * texture mapping hardware present or available.
4669
 *)
4670
  DDERR_NOMIPMAPHW                        = MAKE_DDHRESULT + 591;
4671
 
4672
(*
4673
 * The requested action could not be performed because the surface was of
4674
 * the wrong type.
4675
 *)
4676
  DDERR_INVALIDSURFACETYPE                = MAKE_DDHRESULT + 592;
4677
 
4678
(*
4679
 * Device does not support optimized surfaces, therefore no video memory optimized surfaces
4680
 *)
4681
  DDERR_NOOPTIMIZEHW                      = MAKE_DDHRESULT + 600;
4682
 
4683
(*
4684
 * Surface is an optimized surface, but has not yet been allocated any memory
4685
 *)
4686
  DDERR_NOTLOADED                         = MAKE_DDHRESULT + 601;
4687
 
4688
(*
4689
 * Attempt was made to create or set a device window without first setting
4690
 * the focus window
4691
 *)
4692
  DDERR_NOFOCUSWINDOW                     = MAKE_DDHRESULT + 602;
4693
 
4694
(*
4695
 * Attempt was made to set a palette on a mipmap sublevel
4696
 *)
4697
  DDERR_NOTONMIPMAPSUBLEVEL               = MAKE_DDHRESULT + 603;
4698
 
4699
(*
4700
 * A DC has already been returned for this surface. Only one DC can be
4701
 * retrieved per surface.
4702
 *)
4703
  DDERR_DCALREADYCREATED                  = MAKE_DDHRESULT + 620;
4704
 
4705
(*
4706
 * An attempt was made to allocate non-local video memory from a device
4707
 * that does not support non-local video memory.
4708
 *)
4709
  DDERR_NONONLOCALVIDMEM                  = MAKE_DDHRESULT + 630;
4710
 
4711
(*
4712
 * The attempt to page lock a surface failed.
4713
 *)
4714
  DDERR_CANTPAGELOCK                      = MAKE_DDHRESULT + 640;
4715
 
4716
(*
4717
 * The attempt to page unlock a surface failed.
4718
 *)
4719
  DDERR_CANTPAGEUNLOCK                    = MAKE_DDHRESULT + 660;
4720
 
4721
(*
4722
 * An attempt was made to page unlock a surface with no outstanding page locks.
4723
 *)
4724
  DDERR_NOTPAGELOCKED                     = MAKE_DDHRESULT + 680;
4725
 
4726
(*
4727
 * There is more data available than the specified buffer size could hold
4728
 *)
4729
  DDERR_MOREDATA                                = MAKE_DDHRESULT + 690;
4730
 
4731
(*
4732
 * The data has expired and is therefore no longer valid.
4733
 *)
4734
  DDERR_EXPIRED                           = MAKE_DDHRESULT + 691;
4735
 
4736
(*
4737
 * The mode test has finished executing.
4738
 *)
4739
 DDERR_TESTFINISHED                      = MAKE_DDHRESULT + 692;
4740
 
4741
(*
4742
 * The mode test has switched to a new mode.
4743
 *)
4744
 DDERR_NEWMODE                           = MAKE_DDHRESULT + 693;
4745
 
4746
(*
4747
 * D3D has not yet been initialized.
4748
 *)
4749
 DDERR_D3DNOTINITIALIZED                 = MAKE_DDHRESULT + 694;
4750
 
4751
(*
4752
 * The video port is not active
4753
 *)
4754
  DDERR_VIDEONOTACTIVE                          = MAKE_DDHRESULT + 695;
4755
 
4756
(*
4757
 * The monitor does not have EDID data.
4758
 *)
4759
 DDERR_NOMONITORINFORMATION             = MAKE_DDHRESULT + 696;
4760
 
4761
(*
4762
 * The driver does not enumerate display mode refresh rates.
4763
 *)
4764
 DDERR_NODRIVERSUPPORT                  = MAKE_DDHRESULT + 697;
4765
 
4766
(*
4767
 * Surfaces created by one direct draw device cannot be used directly by
4768
 * another direct draw device.
4769
 *)
4770
  DDERR_DEVICEDOESNTOWNSURFACE                  = MAKE_DDHRESULT + 699;
4771
 
4772
(*
4773
 * An attempt was made to invoke an interface member of a DirectDraw object
4774
 * created by CoCreateInstance() before it was initialized.
4775
 *)
4776
  DDERR_NOTINITIALIZED                    = CO_E_NOTINITIALIZED;
4777
 
4778
(* Alpha bit depth constants *)
4779
 
4780
(*
4781
 * API's
4782
 *)
4783
 
1 daniel-mar 4784
type
4785
  HMonitor = THandle;
4786
 
4 daniel-mar 4787
  TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
4788
      lpDriverName: PAnsiChar; lpContext: Pointer) : BOOL; stdcall;
4789
  TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
4790
      lpDriverName: PWideChar; lpContext: Pointer) : BOOL; stdcall;
4791
{$IFDEF UNICODE}
4792
  TDDEnumCallback = TDDEnumCallbackW;
4793
{$ELSE}
4794
  TDDEnumCallback = TDDEnumCallbackA;
4795
{$ENDIF}
1 daniel-mar 4796
 
4 daniel-mar 4797
  TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
4798
      lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
4799
      stdcall;
4800
  TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
4801
      lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
4802
      stdcall;
4803
 
4804
{$IFDEF UNICODE}
4805
  TDDEnumCallbackEx = TDDEnumCallbackExW;
4806
{$ELSE}
4807
  TDDEnumCallbackEx = TDDEnumCallbackExA;
4808
{$ENDIF}
1 daniel-mar 4809
 
4 daniel-mar 4810
var
4811
  DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA;
4812
       lpContext: Pointer) : HResult; stdcall;
4813
  DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW;
4814
       lpContext: Pointer) : HResult; stdcall;
4815
  DirectDrawEnumerate : function (lpCallback: TDDEnumCallback;
4816
       lpContext: Pointer) : HResult; stdcall;
1 daniel-mar 4817
 
4 daniel-mar 4818
  DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA;
4819
       lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
4820
  DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW;
4821
       lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
4822
  DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx;
4823
       lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 4824
 
4 daniel-mar 4825
  DirectDrawCreate : function (lpGUID: PGUID;
4826
       out lplpDD: IDirectDraw;
4827
       pUnkOuter: IUnknown) : HResult; stdcall;
4828
  DirectDrawCreateEx : function  (lpGUID: PGUID;
4829
       out lplpDD: IDirectDraw7; const iid: TGUID;
4830
       pUnkOuter: IUnknown) : HResult; stdcall;
4831
  DirectDrawCreateClipper : function (dwFlags: DWORD;
4832
       out lplpDDClipper: IDirectDrawClipper;
4833
       pUnkOuter: IUnknown) : HResult; stdcall;
1 daniel-mar 4834
 
4 daniel-mar 4835
const
4836
(*
4837
 * Flags for DirectDrawEnumerateEx
4838
 * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to
4839
 * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx.
4840
 * By default, only the primary display device is enumerated.
4841
 * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES)
4842
 *)
1 daniel-mar 4843
 
4 daniel-mar 4844
(*
4845
 * This flag causes enumeration of any GDI display devices which are part of
4846
 * the Windows Desktop
4847
 *)
4848
  DDENUM_ATTACHEDSECONDARYDEVICES     = $00000001;
4849
 
4850
(*
4851
 * This flag causes enumeration of any GDI display devices which are not
4852
 * part of the Windows Desktop
4853
 *)
4854
  DDENUM_DETACHEDSECONDARYDEVICES     = $00000002;
4855
 
4856
(*
4857
 * This flag causes enumeration of non-display devices
4858
 *)
4859
  DDENUM_NONDISPLAYDEVICES            = $00000004;
4860
 
1 daniel-mar 4861
  REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
4862
  REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
4863
  REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
4864
 
4865
  DDCREATE_HARDWAREONLY       = $00000001;
4866
  DDCREATE_EMULATIONONLY      = $00000002;
4867
 
4 daniel-mar 4868
(*
4869
 * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel
4870
 *)
4871
function GET_WHQL_YEAR(dwWHQLLevel: DWORD) : DWORD;
4872
function GET_WHQL_MONTH(dwWHQLLevel: DWORD) : DWORD;
4873
function GET_WHQL_DAY(dwWHQLLevel: DWORD) : DWORD;
1 daniel-mar 4874
 
4875
 
4876
(*==========================================================================;
4877
 *
4878
 *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
4879
 *
4 daniel-mar 4880
 *  File:       dvp.h
4881
 *  Content:    DirectDrawVideoPort include file
1 daniel-mar 4882
 *
4883
 ***************************************************************************)
4884
 
4885
const
4 daniel-mar 4886
(*
4887
 * GUIDS used by DirectDrawVideoPort objects
4888
 *)
4889
  DDVPTYPE_E_HREFH_VREFH: TGUID =
4890
      (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4891
  DDVPTYPE_E_HREFH_VREFL: TGUID =
4892
      (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4893
  DDVPTYPE_E_HREFL_VREFH: TGUID =
4894
      (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4895
  DDVPTYPE_E_HREFL_VREFL: TGUID =
4896
      (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4897
  DDVPTYPE_CCIR656: TGUID =
4898
      (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4899
  DDVPTYPE_BROOKTREE: TGUID =
4900
      (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4901
  DDVPTYPE_PHILIPS: TGUID =
4902
      (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
1 daniel-mar 4903
 
4 daniel-mar 4904
(*
4905
 * GUIDS used to describe connections
4906
 *)
1 daniel-mar 4907
 
4 daniel-mar 4908
(*============================================================================
4909
 *
4910
 * DirectDraw Structures
4911
 *
4912
 * Various structures used to invoke DirectDraw.
4913
 *
4914
 *==========================================================================*)
1 daniel-mar 4915
 
4916
type
4917
 
4 daniel-mar 4918
(*
4919
 * TDDVideoPortConnect
4920
 *)
4921
  PDDVideoPortConnect = ^TDDVideoPortConnect;
4922
  TDDVideoPortConnect = packed record
4923
    dwSize: DWORD;        // size of the TDDVideoPortConnect structure
1 daniel-mar 4924
    dwPortWidth: DWORD;   // Width of the video port
4925
    guidTypeID: TGUID;    // Description of video port connection
4926
    dwFlags: DWORD;       // Connection flags
4927
    dwReserved1: DWORD;   // Reserved, set to zero.
4928
  end;
4929
 
4 daniel-mar 4930
(*
4931
 * TDDVideoPortCaps
4932
 *)
4933
  PDDVideoPortCaps = ^TDDVideoPortCaps;
4934
  TDDVideoPortCaps = packed record
4935
    dwSize: DWORD;                          // size of the TDDVideoPortCaps structure
1 daniel-mar 4936
    dwFlags: DWORD;                         // indicates which fields contain data
4937
    dwMaxWidth: DWORD;                      // max width of the video port field
4938
    dwMaxVBIWidth: DWORD;                   // max width of the VBI data
4939
    dwMaxHeight: DWORD;                     // max height of the video port field
4940
    dwVideoPortID: DWORD;                   // Video port ID (0 - (dwMaxVideoPorts -1))
4941
    dwCaps: DWORD;                          // Video port capabilities
4942
    dwFX: DWORD;                            // More video port capabilities
4943
    dwNumAutoFlipSurfaces: DWORD;           // Number of autoflippable surfaces
4944
    dwAlignVideoPortBoundary: DWORD;        // Byte restriction of placement within the surface
4945
    dwAlignVideoPortPrescaleWidth: DWORD;   // Byte restriction of width after prescaling
4946
    dwAlignVideoPortCropBoundary: DWORD;    // Byte restriction of left cropping
4947
    dwAlignVideoPortCropWidth: DWORD;       // Byte restriction of cropping width
4948
    dwPreshrinkXStep: DWORD;                // Width can be shrunk in steps of 1/x
4949
    dwPreshrinkYStep: DWORD;                // Height can be shrunk in steps of 1/x
4950
    dwNumVBIAutoFlipSurfaces: DWORD;        // Number of VBI autoflippable surfaces
4 daniel-mar 4951
    dwNumPreferredAutoflip: DWORD;      // Optimal number of autoflippable surfaces for hardware
4952
    wNumFilterTapsX: WORD;              // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.)
4953
    wNumFilterTapsY: WORD;              // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.)
1 daniel-mar 4954
  end;
4955
 
4 daniel-mar 4956
const
4957
(*
4958
 * The dwMaxWidth and dwMaxVBIWidth members are valid
4959
 *)
4960
  DDVPD_WIDTH = $00000001;
1 daniel-mar 4961
 
4 daniel-mar 4962
(*
4963
 * The dwMaxHeight member is valid
4964
 *)
4965
  DDVPD_HEIGHT = $00000002;
1 daniel-mar 4966
 
4 daniel-mar 4967
(*
4968
 * The dwVideoPortID member is valid
4969
 *)
4970
  DDVPD_ID = $00000004;
4971
 
4972
(*
4973
 * The dwCaps member is valid
4974
 *)
4975
  DDVPD_CAPS = $00000008;
4976
 
4977
(*
4978
 * The dwFX member is valid
4979
 *)
4980
  DDVPD_FX = $00000010;
4981
 
4982
(*
4983
 * The dwNumAutoFlipSurfaces member is valid
4984
 *)
4985
  DDVPD_AUTOFLIP = $00000020;
4986
 
4987
(*
4988
 * All of the alignment members are valid
4989
 *)
4990
  DDVPD_ALIGN = $00000040;
4991
 
4992
(*
4993
 * The dwNumPreferredAutoflip member is valid
4994
 *)
4995
  DDVPD_PREFERREDAUTOFLIP = $00000080;
4996
 
4997
(*
4998
 * The wNumFilterTapsX and wNumFilterTapsY fields are valid
4999
 *)
5000
  DDVPD_FILTERQUALITY     = $00000100;
5001
 
5002
type
5003
(*
5004
 * TDDVideoPortDesc
5005
 *)
5006
  PDDVideoPortDesc = ^TDDVideoPortDesc;
5007
  TDDVideoPortDesc = packed record
5008
    dwSize: DWORD;                       // size of the TDDVideoPortDesc structure
1 daniel-mar 5009
    dwFieldWidth: DWORD;                 // width of the video port field
5010
    dwVBIWidth: DWORD;                   // width of the VBI data
5011
    dwFieldHeight: DWORD;                // height of the video port field
5012
    dwMicrosecondsPerField: DWORD;       // Microseconds per video field
5013
    dwMaxPixelsPerSecond: DWORD;         // Maximum pixel rate per second
5014
    dwVideoPortID: DWORD;                // Video port ID (0 - (dwMaxVideoPorts -1))
5015
    dwReserved1: DWORD;                  // Reserved for future use - set to zero
4 daniel-mar 5016
    VideoPortType: TDDVideoPortConnect;  // Description of video port connection
1 daniel-mar 5017
    dwReserved2: DWORD;                  // Reserved for future use - set to zero
5018
    dwReserved3: DWORD;                  // Reserved for future use - set to zero
5019
  end;
5020
 
4 daniel-mar 5021
(*
5022
 * TDDVideoPortInfo
5023
 *)
5024
  PDDVideoPortInfo = ^TDDVideoPortInfo;
5025
  TDDVideoPortInfo = packed record
1 daniel-mar 5026
    dwSize: DWORD;                            // Size of the structure
5027
    dwOriginX: DWORD;                         // Placement of the video data within the surface.
5028
    dwOriginY: DWORD;                         // Placement of the video data within the surface.
5029
    dwVPFlags: DWORD;                         // Video port options
5030
    rCrop: TRect;                             // Cropping rectangle (optional).
5031
    dwPrescaleWidth: DWORD;                   // Determines pre-scaling/zooming in the X direction (optional).
5032
    dwPrescaleHeight: DWORD;                  // Determines pre-scaling/zooming in the Y direction (optional).
4 daniel-mar 5033
    lpddpfInputFormat: PDDPixelFormat;       // Video format written to the video port
5034
    lpddpfVBIInputFormat: PDDPixelFormat;    // Input format of the VBI data
5035
    lpddpfVBIOutputFormat: PDDPixelFormat;   // Output format of the data
1 daniel-mar 5036
    dwVBIHeight: DWORD;                       // Specifies the number of lines of data within the vertical blanking interval.
5037
    dwReserved1: DWORD;                       // Reserved for future use - set to zero
5038
    dwReserved2: DWORD;                       // Reserved for future use - set to zero
5039
  end;
5040
 
4 daniel-mar 5041
(*
5042
 * TDDVideoPortBandWidth
5043
 *)
5044
  PDDVideoPortBandWidth = ^TDDVideoPortBandWidth;
5045
  TDDVideoPortBandWidth = packed record
1 daniel-mar 5046
    dwSize: DWORD;                 // Size of the structure
5047
    dwCaps: DWORD;
5048
    dwOverlay: DWORD;              // Zoom factor at which overlay is supported
5049
    dwColorkey: DWORD;             // Zoom factor at which overlay w/ colorkey is supported
5050
    dwYInterpolate: DWORD;         // Zoom factor at which overlay w/ Y interpolation is supported
5051
    dwYInterpAndColorkey: DWORD;   // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
5052
    dwReserved1: DWORD;            // Reserved for future use - set to zero
5053
    dwReserved2: DWORD;            // Reserved for future use - set to zero
5054
  end;
5055
 
4 daniel-mar 5056
(*
5057
 * TDDVideoPortStatus
5058
 *)
5059
  PDDVideoPortStatus = ^TDDVideoPortStatus;
5060
  TDDVideoPortStatus = record
1 daniel-mar 5061
    dwSize: DWORD;                       // Size of the structure
5062
    bInUse: BOOL;                        // TRUE if video port is currently being used
5063
    dwFlags: DWORD;                      // Currently not used
5064
    dwReserved1: DWORD;                  // Reserved for future use
4 daniel-mar 5065
    VideoPortType: TDDVideoPortConnect;  // Information about the connection
1 daniel-mar 5066
    dwReserved2: DWORD;                  // Reserved for future use
5067
    dwReserved3: DWORD;                  // Reserved for future use
5068
  end;
5069
 
4 daniel-mar 5070
const
5071
(*============================================================================
5072
 *
5073
 * Video Port Flags
5074
 *
5075
 * All flags are bit flags.
5076
 *
5077
 *==========================================================================*)
1 daniel-mar 5078
 
4 daniel-mar 5079
(****************************************************************************
5080
 *
5081
 * VIDEOPORT TDDVideoPortConnect FLAGS
5082
 *
5083
 ****************************************************************************)
1 daniel-mar 5084
 
4 daniel-mar 5085
(*
5086
 * When this is set by the driver and passed to the client, this
5087
 * indicates that the video port is capable of double clocking the data.
5088
 * When this is set by the client, this indicates that the video port
5089
 * should enable double clocking.  This flag is only valid with external
5090
 * syncs.
5091
 *)
5092
  DDVPCONNECT_DOUBLECLOCK = $00000001;
1 daniel-mar 5093
 
4 daniel-mar 5094
(*
5095
 * When this is set by the driver and passed to the client, this
5096
 * indicates that the video port is capable of using an external VACT
5097
 * signal. When this is set by the client, this indicates that the
5098
 * video port should use the external VACT signal.
5099
 *)
5100
  DDVPCONNECT_VACT = $00000002;
1 daniel-mar 5101
 
4 daniel-mar 5102
(*
5103
 * When this is set by the driver and passed to the client, this
5104
 * indicates that the video port is capable of treating even fields
5105
 * like odd fields and visa versa.  When this is set by the client,
5106
 * this indicates that the video port should treat even fields like odd
5107
 * fields.
5108
 *)
5109
  DDVPCONNECT_INVERTPOLARITY = $00000004;
1 daniel-mar 5110
 
4 daniel-mar 5111
(*
5112
 * Indicates that any data written to the video port during the VREF
5113
 * period will not be written into the frame buffer. This flag is read only.
5114
 *)
5115
  DDVPCONNECT_DISCARDSVREFDATA = $00000008;
1 daniel-mar 5116
 
4 daniel-mar 5117
(*
5118
 * When this is set be the driver and passed to the client, this
5119
 * indicates that the device will write half lines into the frame buffer
5120
 * if half lines are provided by the decoder.  If this is set by the client,
5121
 * this indicates that the decoder will be supplying half lines.
5122
 *)
5123
  DDVPCONNECT_HALFLINE = $00000010;
1 daniel-mar 5124
 
4 daniel-mar 5125
(*
5126
 * Indicates that the signal is interlaced. This flag is only
5127
 * set by the client.
5128
 *)
5129
  DDVPCONNECT_INTERLACED = $00000020;
1 daniel-mar 5130
 
4 daniel-mar 5131
(*
5132
 * Indicates that video port is shareable and that this video port
5133
 * will use the even fields.  This flag is only set by the client.
5134
 *)
5135
  DDVPCONNECT_SHAREEVEN = $00000040;
1 daniel-mar 5136
 
4 daniel-mar 5137
(*
5138
 * Indicates that video port is shareable and that this video port
5139
 * will use the odd fields.  This flag is only set by the client.
5140
 *)
5141
  DDVPCONNECT_SHAREODD = $00000080;
1 daniel-mar 5142
 
4 daniel-mar 5143
(****************************************************************************
5144
 *
5145
 * VIDEOPORT TDDVideoPortDesc CAPS
5146
 *
5147
 ****************************************************************************)
1 daniel-mar 5148
 
4 daniel-mar 5149
(*
5150
 * Flip can be performed automatically to avoid tearing.
5151
 *)
5152
  DDVPCAPS_AUTOFLIP = $00000001;
1 daniel-mar 5153
 
4 daniel-mar 5154
(*
5155
 * Supports interlaced video
5156
 *)
5157
  DDVPCAPS_INTERLACED = $00000002;
1 daniel-mar 5158
 
4 daniel-mar 5159
(*
5160
 * Supports non-interlaced video
5161
 *)
5162
  DDVPCAPS_NONINTERLACED = $00000004;
1 daniel-mar 5163
 
4 daniel-mar 5164
(*
5165
 * Indicates that the device can return whether the current field
5166
 * of an interlaced signal is even or odd.
5167
 *)
5168
  DDVPCAPS_READBACKFIELD = $00000008;
1 daniel-mar 5169
 
4 daniel-mar 5170
(*
5171
 * Indicates that the device can return the current line of video
5172
 * being written into the frame buffer.
5173
 *)
5174
  DDVPCAPS_READBACKLINE = $00000010;
5175
 
5176
(*
5177
 * Allows two gen-locked video streams to share a single video port,
5178
 * where one stream uses the even fields and the other uses the odd
5179
 * fields. Separate parameters (including address, scaling,
5180
 * cropping, etc.) are maintained for both fields.)
5181
 *)
5182
  DDVPCAPS_SHAREABLE = $00000020;
5183
 
5184
(*
5185
 * Even fields of video can be automatically discarded.
5186
 *)
5187
  DDVPCAPS_SKIPEVENFIELDS = $00000040;
5188
 
5189
(*
5190
 * Odd fields of video can be automatically discarded.
5191
 *)
5192
  DDVPCAPS_SKIPODDFIELDS = $00000080;
5193
 
5194
(*
5195
 * Indicates that the device is capable of driving the graphics
5196
 * VSYNC with the video port VSYNC.
5197
 *)
5198
  DDVPCAPS_SYNCMASTER = $00000100;
5199
 
5200
(*
5201
 * Indicates that data within the vertical blanking interval can
5202
 * be written to a different surface.
5203
 *)
5204
  DDVPCAPS_VBISURFACE = $00000200;
5205
 
5206
(*
5207
 * Indicates that the video port can perform color operations
5208
 * on the incoming data before it is written to the frame buffer.
5209
 *)
5210
  DDVPCAPS_COLORCONTROL = $00000400;
5211
 
5212
(*
5213
 * Indicates that the video port can accept VBI data in a different
5214
 * width or format than the regular video data.
5215
 *)
5216
  DDVPCAPS_OVERSAMPLEDVBI = $00000800;
5217
 
5218
(*
5219
 * Indicates that the video port can write data directly to system memory
5220
 *)
5221
  DDVPCAPS_SYSTEMMEMORY = $00001000;
5222
 
5223
(*
5224
 * Indicates that the VBI and video portions of the video stream can
5225
 * be controlled by an independent processes.
5226
 *)
5227
  DDVPCAPS_VBIANDVIDEOINDEPENDENT       = $00002000;
5228
 
5229
(*
5230
 * Indicates that the video port contains high quality hardware
5231
 * de-interlacing hardware that should be used instead of the
5232
 * bob/weave algorithms.
5233
 *)
5234
  DDVPCAPS_HARDWAREDEINTERLACE          = $00004000;
5235
 
5236
(****************************************************************************
5237
 *
5238
 * VIDEOPORT TDDVideoPortDesc FX
5239
 *
5240
 ****************************************************************************)
5241
 
5242
(*
5243
 * Limited cropping is available to crop out the vertical interval data.
5244
 *)
5245
  DDVPFX_CROPTOPDATA = $00000001;
5246
 
5247
(*
5248
 * Incoming data can be cropped in the X direction before it is written
5249
 * to the surface.
5250
 *)
5251
  DDVPFX_CROPX = $00000002;
5252
 
5253
(*
5254
 * Incoming data can be cropped in the Y direction before it is written
5255
 * to the surface.
5256
 *)
5257
  DDVPFX_CROPY = $00000004;
5258
 
5259
(*
5260
 * Supports interleaving interlaced fields in memory.
5261
 *)
5262
  DDVPFX_INTERLEAVE = $00000008;
5263
 
5264
(*
5265
 * Supports mirroring left to right as the video data is written
5266
 * into the frame buffer.
5267
 *)
1 daniel-mar 5268
  DDVPFX_MIRRORLEFTRIGHT = $00000010;
5269
 
4 daniel-mar 5270
(*
5271
 * Supports mirroring top to bottom as the video data is written
5272
 * into the frame buffer.
5273
 *)
5274
  DDVPFX_MIRRORUPDOWN = $00000020;
1 daniel-mar 5275
 
4 daniel-mar 5276
(*
5277
 * Data can be arbitrarily shrunk in the X direction before it
5278
 * is written to the surface.
5279
 *)
5280
  DDVPFX_PRESHRINKX = $00000040;
1 daniel-mar 5281
 
4 daniel-mar 5282
(*
5283
 * Data can be arbitrarily shrunk in the Y direction before it
5284
 * is written to the surface.
5285
 *)
5286
  DDVPFX_PRESHRINKY = $00000080;
1 daniel-mar 5287
 
4 daniel-mar 5288
(*
5289
 * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X
5290
 * direction before it is written to the surface.
5291
 *)
5292
  DDVPFX_PRESHRINKXB = $00000100;
5293
 
5294
(*
5295
 * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y
5296
 * direction before it is written to the surface.
5297
 *)
5298
  DDVPFX_PRESHRINKYB = $00000200;
5299
 
5300
(*
5301
 * Data can be shrunk in increments of 1/x in the X direction
5302
 * (where X is specified in the TDDVideoPortCaps.dwPreshrinkXStep)
5303
 * before it is written to the surface.
5304
 *)
5305
  DDVPFX_PRESHRINKXS = $00000400;
5306
 
5307
(*
5308
 * Data can be shrunk in increments of 1/x in the Y direction
5309
 * (where X is specified in the TDDVideoPortCaps.dwPreshrinkYStep)
5310
 * before it is written to the surface.
5311
 *)
5312
  DDVPFX_PRESHRINKYS = $00000800;
5313
 
5314
(*
5315
 * Data can be arbitrarily stretched in the X direction before
5316
 * it is written to the surface.
5317
 *)
5318
  DDVPFX_PRESTRETCHX = $00001000;
5319
 
5320
(*
5321
 * Data can be arbitrarily stretched in the Y direction before
5322
 * it is written to the surface.
5323
 *)
5324
  DDVPFX_PRESTRETCHY = $00002000;
5325
 
5326
(*
5327
 * Data can be integer stretched in the X direction before it is
5328
 * written to the surface.
5329
 *)
5330
  DDVPFX_PRESTRETCHXN = $00004000;
5331
 
5332
(*
5333
 * Data can be integer stretched in the Y direction before it is
5334
 * written to the surface.
5335
 *)
5336
  DDVPFX_PRESTRETCHYN = $00008000;
5337
 
5338
(*
5339
 * Indicates that data within the vertical blanking interval can
5340
 * be converted independently of the remaining video data.
5341
 *)
5342
  DDVPFX_VBICONVERT = $00010000;
5343
 
5344
(*
5345
 * Indicates that scaling can be disabled for data within the
5346
 * vertical blanking interval.
5347
 *)
5348
  DDVPFX_VBINOSCALE = $00020000;
5349
 
5350
(*
5351
 * Indicates that the video data can ignore the left and right
5352
 * cropping coordinates when cropping oversampled VBI data.
5353
 *)
5354
  DDVPFX_IGNOREVBIXCROP = $00040000;
5355
 
5356
(*
5357
 * Indicates that interleaving can be disabled for data within the
5358
 * vertical blanking interval.
5359
 *)
5360
  DDVPFX_VBINOINTERLEAVE     = $00080000;
5361
 
5362
(****************************************************************************
5363
 *
5364
 * VIDEOPORT TDDVideoPortInfo FLAGS
5365
 *
5366
 ****************************************************************************)
5367
 
5368
(*
5369
 * Perform automatic flipping.   Auto-flipping is performed between
5370
 * the overlay surface that was attached to the video port using
5371
 * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that
5372
 * are attached to the surface via the IDirectDrawSurface::AttachSurface
5373
 * method.  The flip order is the order in which the overlay surfaces
5374
 * were. attached.
5375
 *)
5376
  DDVP_AUTOFLIP = $00000001;
5377
 
5378
(*
5379
 * Perform conversion using the ddpfOutputFormat information.
5380
 *)
5381
  DDVP_CONVERT = $00000002;
5382
 
5383
(*
5384
 * Perform cropping using the specified rectangle.
5385
 *)
5386
  DDVP_CROP = $00000004;
5387
 
5388
(*
5389
 * Indicates that interlaced fields should be interleaved in memory.
5390
 *)
5391
  DDVP_INTERLEAVE = $00000008;
5392
 
5393
(*
5394
 * Indicates that the data should be mirrored left to right as it's
5395
 * written into the frame buffer.
5396
 *)
5397
  DDVP_MIRRORLEFTRIGHT = $00000010;
5398
 
5399
(*
5400
 * Indicates that the data should be mirrored top to bottom as it's
5401
 * written into the frame buffer.
5402
 *)
5403
  DDVP_MIRRORUPDOWN = $00000020;
5404
 
5405
(*
5406
 * Perform pre-scaling/zooming based on the pre-scale parameters.
5407
 *)
5408
  DDVP_PRESCALE = $00000040;
5409
 
5410
(*
5411
 * Ignore input of even fields.
5412
 *)
5413
  DDVP_SKIPEVENFIELDS = $00000080;
5414
 
5415
(*
5416
 * Ignore input of odd fields.
5417
 *)
5418
  DDVP_SKIPODDFIELDS = $00000100;
5419
 
5420
(*
5421
 * Drive the graphics VSYNCs using the video port VYSNCs.
5422
 *)
5423
  DDVP_SYNCMASTER = $00000200;
5424
 
5425
(*
5426
 * The ddpfVBIOutputFormatFormat member contains data that should be used
5427
 * to convert the data within the vertical blanking interval.
5428
 *)
5429
  DDVP_VBICONVERT = $00000400;
5430
 
5431
(*
5432
 * Indicates that data within the vertical blanking interval
5433
 * should not be scaled.
5434
 *)
5435
  DDVP_VBINOSCALE = $00000800;
5436
 
5437
(*
5438
 * Indicates that these bob/weave decisions should not be
5439
 * overriden by other interfaces.
5440
 *)
5441
  DDVP_OVERRIDEBOBWEAVE = $00001000;
5442
 
5443
(*
5444
 * Indicates that the video data should ignore the left and right
5445
 * cropping coordinates when cropping the VBI data.
5446
 *)
5447
  DDVP_IGNOREVBIXCROP = $00002000;
5448
 
5449
(*
5450
 * Indicates that interleaving can be disabled for data within the
5451
 * vertical blanking interval.
5452
 *)
5453
  DDVP_VBINOINTERLEAVE                  = $00004000;
5454
 
5455
(*
5456
 * Indicates that the video port should use the hardware
5457
 * de-interlacing hardware.
5458
 *)
5459
  DDVP_HARDWAREDEINTERLACE              = $00008000;
5460
 
5461
(****************************************************************************
5462
 *
5463
 * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS
5464
 *
5465
 ****************************************************************************)
5466
 
5467
(*
5468
 * Return formats for the video data
5469
 *)
1 daniel-mar 5470
  DDVPFORMAT_VIDEO = $00000001;
4 daniel-mar 5471
 
5472
(*
5473
 * Return formats for the VBI data
5474
 *)
1 daniel-mar 5475
  DDVPFORMAT_VBI = $00000002;
5476
 
4 daniel-mar 5477
(****************************************************************************
5478
 *
5479
 * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS
5480
 *
5481
 ****************************************************************************)
1 daniel-mar 5482
 
4 daniel-mar 5483
(*
5484
 * Surface should receive video data (and VBI data if a surface
5485
 * is not explicitly attached for that purpose)
5486
 *)
1 daniel-mar 5487
  DDVPTARGET_VIDEO = $00000001;
4 daniel-mar 5488
 
5489
(*
5490
 * Surface should receive VBI data
5491
 *)
1 daniel-mar 5492
  DDVPTARGET_VBI = $00000002;
5493
 
4 daniel-mar 5494
(****************************************************************************
5495
 *
5496
 * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS
5497
 *
5498
 ****************************************************************************)
1 daniel-mar 5499
 
4 daniel-mar 5500
(*
5501
 * Waits until the beginning of the next VSYNC
5502
 *)
1 daniel-mar 5503
  DDVPWAIT_BEGIN = $00000001;
4 daniel-mar 5504
 
5505
(*
5506
 * Waits until the end of the next/current VSYNC
5507
 *)
1 daniel-mar 5508
  DDVPWAIT_END = $00000002;
4 daniel-mar 5509
 
5510
(*
5511
 * Waits until the beginning of the specified line
5512
 *)
1 daniel-mar 5513
  DDVPWAIT_LINE = $00000003;
5514
 
4 daniel-mar 5515
(****************************************************************************
5516
 *
5517
 * DIRECTDRAWVIDEOPORT FLIP FLAGS
5518
 *
5519
 ****************************************************************************)
1 daniel-mar 5520
 
4 daniel-mar 5521
(*
5522
 * Flips the normal video surface
5523
 *)
1 daniel-mar 5524
  DDVPFLIP_VIDEO = $00000001;
4 daniel-mar 5525
 
5526
(*
5527
 * Flips the VBI surface
5528
 *)
1 daniel-mar 5529
  DDVPFLIP_VBI = $00000002;
5530
 
4 daniel-mar 5531
(****************************************************************************
5532
 *
5533
 * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES
5534
 *
5535
 ****************************************************************************)
1 daniel-mar 5536
 
4 daniel-mar 5537
(*
5538
 * No video signal is present at the video port
5539
 *)
1 daniel-mar 5540
  DDVPSQ_NOSIGNAL = $00000001;
4 daniel-mar 5541
 
5542
(*
5543
 * A valid video signal is present at the video port
5544
 *)
1 daniel-mar 5545
  DDVPSQ_SIGNALOK = $00000002;
5546
 
4 daniel-mar 5547
(****************************************************************************
5548
 *
5549
 * VIDEOPORTBANDWIDTH Flags
5550
 *
5551
 ****************************************************************************)
1 daniel-mar 5552
 
4 daniel-mar 5553
(*
5554
 * The specified height/width refer to the size of the video port data
5555
 * written into memory, after prescaling has occured.
5556
 *)
1 daniel-mar 5557
  DDVPB_VIDEOPORT = $00000001;
4 daniel-mar 5558
 
5559
(*
5560
 * The specified height/width refer to the source size of the overlay.
5561
 *)
1 daniel-mar 5562
  DDVPB_OVERLAY = $00000002;
4 daniel-mar 5563
 
5564
(*
5565
 * This is a query for the device to return which caps this device requires.
5566
 *)
1 daniel-mar 5567
  DDVPB_TYPE = $00000004;
5568
 
4 daniel-mar 5569
(****************************************************************************
5570
 *
5571
 * VIDEOPORTBANDWIDTH Caps
5572
 *
5573
 ****************************************************************************)
1 daniel-mar 5574
 
4 daniel-mar 5575
(*
5576
 * The bandwidth for this device is dependant on the overlay source size.
5577
 *)
1 daniel-mar 5578
  DDVPBCAPS_SOURCE = $00000001;
4 daniel-mar 5579
 
5580
(*
5581
 * The bandwidth for this device is dependant on the overlay destination
5582
 * size.
5583
 *)
1 daniel-mar 5584
  DDVPBCAPS_DESTINATION = $00000002;
5585
 
4 daniel-mar 5586
(****************************************************************************
5587
 *
5588
 * DDVIDEOPORTCONTAINER CreateVideoPort flags
5589
 *
5590
 ****************************************************************************)
1 daniel-mar 5591
 
4 daniel-mar 5592
(*
5593
 * The process only wants to control the VBI portion of the video stream.
5594
 *)
5595
  DDVPCREATE_VBIONLY                    = $00000001;
1 daniel-mar 5596
 
4 daniel-mar 5597
(*
5598
 * The process only wants to control the non-VBI (video) portion of
5599
 * the video stream.
5600
 *)
5601
  DDVPCREATE_VIDEOONLY                  = $00000002;
1 daniel-mar 5602
 
4 daniel-mar 5603
(****************************************************************************
5604
 *
5605
 * DDVIDEOPORTSTATUS flags
5606
 *
5607
 ****************************************************************************)
1 daniel-mar 5608
 
4 daniel-mar 5609
(*
5610
 * The video port interface is only controlling the VBI portion of the
5611
 * video stream
5612
 *)
5613
  DDVPSTATUS_VBIONLY                    = $00000001;
5614
 
5615
(*
5616
 * The video port interface is only controlling the video portion of the
5617
 * video stream
5618
 *)
5619
  DDVPSTATUS_VIDEOONLY                  = $00000002;
5620
 
5621
 
5622
type
5623
(*
5624
 * API's
5625
 *)
5626
 
5627
  TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps;
5628
      lpContext: Pointer) : HResult; stdcall;
5629
 
5630
(*
5631
 * INTERACES FOLLOW:
5632
 *      IDirectDrawVideoPort
5633
 *      IVideoPort
5634
 *)
5635
 
5636
 
5637
(*
5638
 * IDirectDrawVideoPort
5639
 *)
5640
  IDirectDrawVideoPort = interface (IUnknown)
5641
    ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}']
5642
    (*** IDirectDrawVideoPort methods ***)
5643
    function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) : HResult; stdcall;
5644
    function GetBandwidthInfo(var lpddpfFormat: TDDPixelFormat;
5645
        dwWidth: DWORD; dwHeight: DWORD; dwFlags: DWORD;
5646
        var lpBandwidth: TDDVideoPortBandWidth) : HResult; stdcall;
5647
    function GetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
5648
    function GetInputFormats(var lpNumFormats: DWORD; var lpFormats:
5649
        TDDPixelFormat; dwFlags: DWORD) : HResult; stdcall;
5650
    function GetOutputFormats(var lpInputFormat: TDDPixelFormat;
5651
        var lpNumFormats: DWORD; lpFormats: PDDPixelFormat; dwFlags: DWORD)
5652
        : HResult; stdcall;
5653
    function GetFieldPolarity(var lpbVideoField: BOOL) : HResult; stdcall;
5654
    function GetVideoLine(var lpdwLine: DWORD) : HResult; stdcall;
5655
    function GetVideoSignalStatus(varlpdwStatus: DWORD) : HResult; stdcall;
5656
    function SetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
5657
    function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) :
5658
        HResult; stdcall;
5659
    function StartVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
5660
    function StopVideo: HResult; stdcall;
5661
    function UpdateVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
5662
    function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD) :
5663
        HResult; stdcall;
5664
  end;
5665
 
5666
(*
5667
 * IDirectDrawVideoPortContainer
5668
 *)
5669
  IDDVideoPortContainer = interface (IUnknown)
5670
    ['{6C142760-A733-11CE-A521-0020AF0BE560}']
5671
    (*** IDDVideoPortContainer methods ***)
5672
    function CreateVideoPort(dwFlags: DWORD; var lpTDDVideoPortDesc:
5673
        TDDVideoPortDesc; var lplpDDVideoPort: IDirectDrawVideoPort;
5674
        pUnkOuter: IUnknown) : HResult; stdcall;
5675
    function EnumVideoPorts(dwFlags: DWORD;
5676
        lpTDDVideoPortCaps: PDDVideoPortCaps; lpContext: Pointer;
5677
        lpEnumVideoCallback: TDDEnumVideoCallback) : HResult; stdcall;
5678
    function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD;
5679
        lpConnectInfo: PDDVideoPortConnect) : HResult; stdcall;
5680
    function QueryVideoPortStatus(dwPortId: DWORD;
5681
        var lpVPStatus: TDDVideoPortStatus) : HResult; stdcall;
5682
  end;
5683
 
5684
  IID_IDDVideoPortContainer = IDDVideoPortContainer;
5685
  IID_IDirectDrawVideoPort = IDirectDrawVideoPort;
5686
 
5687
 
5688
//Direct3D file
1 daniel-mar 5689
(*==========================================================================;
5690
 *
4 daniel-mar 5691
 *  Copyright (C) 1995-1998 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 5692
 *
4 daniel-mar 5693
 *  Files:   d3dtypes.h d3dcaps.h d3d.h
1 daniel-mar 5694
 *
4 daniel-mar 5695
 *  DirectX 7.0 Delphi adaptation by Erik Unger
5696
 *
5697
 *  Modyfied: 26-Jun-2000
5698
 *
5699
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
5700
 *  E-Mail: DelphiDirectX@next-reality.com
5701
 *
1 daniel-mar 5702
 ***************************************************************************)
5703
 
4 daniel-mar 5704
(* TD3DValue is the fundamental Direct3D fractional data type *)
5705
 
1 daniel-mar 5706
type
4 daniel-mar 5707
  TRefClsID = TGUID;
5708
 
5709
type
1 daniel-mar 5710
  TD3DValue = Single;
4 daniel-mar 5711
  TD3DFixed = LongInt;
5712
  float = TD3DValue;
5713
  PD3DColor = ^TD3DColor;
1 daniel-mar 5714
  TD3DColor = DWORD;
5715
 
4 daniel-mar 5716
function D3DVal(val: variant) : float;
5717
function D3DDivide(a,b: double) : float;
5718
function D3DMultiply(a,b: double) : float;
1 daniel-mar 5719
 
5720
(*
5721
 * Format of CI colors is
5722
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5723
 *  |    alpha      |         color index           |   fraction    |
5724
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5725
 *)
5726
 
4 daniel-mar 5727
// #define CI_GETALPHA(ci)    ((ci) >> 24)
5728
function CI_GETALPHA(ci: DWORD) : DWORD;
1 daniel-mar 5729
 
4 daniel-mar 5730
// #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
5731
function CI_GETINDEX(ci: DWORD) : DWORD;
5732
 
5733
// #define CI_GETFRACTION(ci) ((ci) & 0xff)
5734
function CI_GETFRACTION(ci: DWORD) : DWORD;
5735
 
5736
// #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
5737
function CI_ROUNDINDEX(ci: DWORD) : DWORD;
5738
 
5739
// #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
5740
function CI_MASKALPHA(ci: DWORD) : DWORD;
5741
 
5742
// #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
5743
function CI_MAKE(a,i,f: DWORD) : DWORD;
5744
 
1 daniel-mar 5745
(*
5746
 * Format of RGBA colors is
5747
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5748
 *  |    alpha      |      red      |     green     |     blue      |
5749
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5750
 *)
5751
 
4 daniel-mar 5752
// #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
5753
function RGBA_GETALPHA(rgb: TD3DColor) : DWORD;
1 daniel-mar 5754
 
4 daniel-mar 5755
// #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
5756
function RGBA_GETRED(rgb: TD3DColor) : DWORD;
5757
 
5758
// #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
5759
function RGBA_GETGREEN(rgb: TD3DColor) : DWORD;
5760
 
5761
// #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
5762
function RGBA_GETBLUE(rgb: TD3DColor) : DWORD;
5763
 
5764
// #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
5765
function RGBA_MAKE(r, g, b, a: DWORD) : TD3DColor;
5766
 
1 daniel-mar 5767
(* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
5768
 * The float values must be in the range 0..1
5769
 *)
5770
 
4 daniel-mar 5771
// #define D3DRGB(r, g, b) \
5772
//     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
5773
function D3DRGB(r, g, b: float) : TD3DColor;
1 daniel-mar 5774
 
4 daniel-mar 5775
// #define D3DRGBA(r, g, b, a) \
5776
//     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
5777
//     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
5778
//    )
5779
function D3DRGBA(r, g, b, a: float) : TD3DColor;
5780
 
1 daniel-mar 5781
(*
5782
 * Format of RGB colors is
5783
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5784
 *  |    ignored    |      red      |     green     |     blue      |
5785
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5786
 *)
5787
 
4 daniel-mar 5788
// #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
5789
function RGB_GETRED(rgb: TD3DColor) : DWORD;
1 daniel-mar 5790
 
4 daniel-mar 5791
// #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
5792
function RGB_GETGREEN(rgb: TD3DColor) : DWORD;
5793
 
5794
// #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
5795
function RGB_GETBLUE(rgb: TD3DColor) : DWORD;
5796
 
5797
// #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
5798
function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD) : TD3DColor;
5799
 
5800
// #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
5801
function RGB_MAKE(r, g, b: DWORD) : TD3DColor;
5802
 
5803
// #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
5804
function RGBA_TORGB(rgba: TD3DColor) : TD3DColor;
5805
 
5806
// #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
5807
function RGB_TORGBA(rgb: TD3DColor) : TD3DColor;
5808
 
5809
(*
5810
 * Flags for Enumerate functions
5811
 *)
1 daniel-mar 5812
const
5813
 
4 daniel-mar 5814
(*
5815
 * Stop the enumeration
5816
 *)
1 daniel-mar 5817
 
4 daniel-mar 5818
  D3DENUMRET_CANCEL                        = DDENUMRET_CANCEL;
1 daniel-mar 5819
 
4 daniel-mar 5820
(*
5821
 * Continue the enumeration
5822
 *)
1 daniel-mar 5823
 
4 daniel-mar 5824
  D3DENUMRET_OK                            = DDENUMRET_OK;
5825
 
5826
type
5827
  TD3DValidateCallback = function (lpUserArg: Pointer;
5828
      dwOffset: DWORD): HResult; stdcall;
5829
  TD3DEnumTextureFormatsCallback = function (var lpDdsd: TDDSurfaceDesc;
1 daniel-mar 5830
      lpContext: Pointer): HResult; stdcall;
4 daniel-mar 5831
  TD3DEnumPixelFormatsCallback = function (var lpDDPixFmt: TDDPixelFormat;
5832
      lpContext: Pointer): HResult; stdcall;
1 daniel-mar 5833
 
4 daniel-mar 5834
 
5835
  PD3DMaterialHandle = ^TD3DMaterialHandle;
1 daniel-mar 5836
  TD3DMaterialHandle = DWORD;
5837
 
4 daniel-mar 5838
  PD3DTextureHandle = ^TD3DTextureHandle;
1 daniel-mar 5839
  TD3DTextureHandle = DWORD;
5840
 
4 daniel-mar 5841
  PD3DMatrixHandle = ^TD3DMatrixHandle;
1 daniel-mar 5842
  TD3DMatrixHandle = DWORD;
5843
 
5844
  PD3DColorValue = ^TD3DColorValue;
4 daniel-mar 5845
  TD3DColorValue = packed record
1 daniel-mar 5846
    case Integer of
5847
    0: (
5848
      r: TD3DValue;
5849
      g: TD3DValue;
5850
      b: TD3DValue;
5851
      a: TD3DValue;
4 daniel-mar 5852
     );
1 daniel-mar 5853
    1: (
5854
      dvR: TD3DValue;
5855
      dvG: TD3DValue;
5856
      dvB: TD3DValue;
5857
      dvA: TD3DValue;
4 daniel-mar 5858
     );
1 daniel-mar 5859
  end;
5860
 
5861
  PD3DRect = ^TD3DRect;
4 daniel-mar 5862
  TD3DRect = packed record
1 daniel-mar 5863
    case Integer of
5864
    0: (
4 daniel-mar 5865
      x1: LongInt;
5866
      y1: LongInt;
5867
      x2: LongInt;
5868
      y2: LongInt;
5869
     );
1 daniel-mar 5870
    1: (
4 daniel-mar 5871
      lX1: LongInt;
5872
      lY1: LongInt;
5873
      lX2: LongInt;
5874
      lY2: LongInt;
5875
     );
5876
     2: (
5877
       a: array[0..3] of LongInt;
5878
     );
1 daniel-mar 5879
  end;
5880
 
5881
  PD3DVector = ^TD3DVector;
4 daniel-mar 5882
  TD3DVector = packed record
1 daniel-mar 5883
    case Integer of
5884
    0: (
5885
      x: TD3DValue;
5886
      y: TD3DValue;
5887
      z: TD3DValue;
4 daniel-mar 5888
     );
1 daniel-mar 5889
    1: (
5890
      dvX: TD3DValue;
5891
      dvY: TD3DValue;
5892
      dvZ: TD3DValue;
4 daniel-mar 5893
     );
1 daniel-mar 5894
  end;
5895
 
4 daniel-mar 5896
(******************************************************************
5897
 *                                                                *
5898
 *   D3DVec.inl                                                   *
5899
 *                                                                *
5900
 *   Float-valued 3D vector class for Direct3D.                   *
5901
 *                                                                *
5902
 *   Copyright (c) 1996-1998 Microsoft Corp. All rights reserved. *
5903
 *                                                                *
5904
 ******************************************************************)
1 daniel-mar 5905
 
4 daniel-mar 5906
    // Addition and subtraction
5907
  function VectorAdd(const v1, v2: TD3DVector) : TD3DVector;
5908
  function VectorSub(const v1, v2: TD3DVector) : TD3DVector;
5909
    // Scalar multiplication and division
5910
  function VectorMulS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
5911
  function VectorDivS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
5912
    // Memberwise multiplication and division
5913
  function VectorMul(const v1, v2: TD3DVector) : TD3DVector;
5914
  function VectorDiv(const v1, v2: TD3DVector) : TD3DVector;
5915
    // Vector dominance
5916
  function VectorSmaller(v1, v2: TD3DVector) : boolean;
5917
  function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
5918
    // Bitwise equality
5919
  function VectorEquel(v1, v2: TD3DVector) : boolean;
5920
    // Length-related functions
5921
  function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
5922
  function VectorMagnitude(v: TD3DVector) : TD3DValue;
5923
    // Returns vector with same direction and unit length
5924
  function VectorNormalize(const v: TD3DVector) : TD3DVector;
5925
    // Return min/max component of the input vector
5926
  function VectorMin(v: TD3DVector) : TD3DValue;
5927
  function VectorMax(v: TD3DVector) : TD3DValue;
5928
    // Return memberwise min/max of input vectors
5929
  function VectorMinimize(const v1, v2: TD3DVector) : TD3DVector;
5930
  function VectorMaximize(const v1, v2: TD3DVector) : TD3DVector;
5931
    // Dot and cross product
5932
  function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
5933
  function VectorCrossProduct(const v1, v2: TD3DVector) : TD3DVector;
1 daniel-mar 5934
 
5935
type
4 daniel-mar 5936
(*
5937
 * Vertex data types supported in an ExecuteBuffer.
5938
 *)
1 daniel-mar 5939
 
4 daniel-mar 5940
(*
5941
 * Homogeneous vertices
5942
 *)
1 daniel-mar 5943
 
5944
  PD3DHVertex = ^TD3DHVertex;
4 daniel-mar 5945
  TD3DHVertex = packed record
5946
    dwFlags: DWORD;        (* Homogeneous clipping flags *)
1 daniel-mar 5947
    case Integer of
5948
    0: (
5949
      hx: TD3DValue;
5950
      hy: TD3DValue;
5951
      hz: TD3DValue;
4 daniel-mar 5952
     );
1 daniel-mar 5953
    1: (
5954
      dvHX: TD3DValue;
5955
      dvHY: TD3DValue;
5956
      dvHZ: TD3DValue;
4 daniel-mar 5957
     );
1 daniel-mar 5958
  end;
5959
 
4 daniel-mar 5960
(*
5961
 * Transformed/lit vertices
5962
 *)
1 daniel-mar 5963
 
5964
  PD3DTLVertex = ^TD3DTLVertex;
4 daniel-mar 5965
  TD3DTLVertex = packed record
1 daniel-mar 5966
    case Integer of
5967
    0: (
4 daniel-mar 5968
      sx: TD3DValue;             (* Screen coordinates *)
1 daniel-mar 5969
      sy: TD3DValue;
5970
      sz: TD3DValue;
4 daniel-mar 5971
      rhw: TD3DValue;            (* Reciprocal of homogeneous w *)
5972
      color: TD3DColor;          (* Vertex color *)
5973
      specular: TD3DColor;       (* Specular component of vertex *)
5974
      tu: TD3DValue;             (* Texture coordinates *)
1 daniel-mar 5975
      tv: TD3DValue;
4 daniel-mar 5976
     );
1 daniel-mar 5977
    1: (
5978
      dvSX: TD3DValue;
5979
      dvSY: TD3DValue;
5980
      dvSZ: TD3DValue;
5981
      dvRHW: TD3DValue;
5982
      dcColor: TD3DColor;
5983
      dcSpecular: TD3DColor;
5984
      dvTU: TD3DValue;
5985
      dvTV: TD3DValue;
4 daniel-mar 5986
     );
1 daniel-mar 5987
  end;
5988
 
4 daniel-mar 5989
(*
5990
 * Untransformed/lit vertices
5991
 *)
1 daniel-mar 5992
 
5993
  PD3DLVertex = ^TD3DLVertex;
4 daniel-mar 5994
  TD3DLVertex = packed record
1 daniel-mar 5995
    case Integer of
5996
    0: (
4 daniel-mar 5997
      x: TD3DValue;             (* Homogeneous coordinates *)
1 daniel-mar 5998
      y: TD3DValue;
5999
      z: TD3DValue;
6000
      dwReserved: DWORD;
4 daniel-mar 6001
      color: TD3DColor;         (* Vertex color *)
6002
      specular: TD3DColor;      (* Specular component of vertex *)
6003
      tu: TD3DValue;            (* Texture coordinates *)
1 daniel-mar 6004
      tv: TD3DValue;
4 daniel-mar 6005
     );
1 daniel-mar 6006
    1: (
6007
      dvX: TD3DValue;
6008
      dvY: TD3DValue;
6009
      dvZ: TD3DValue;
4 daniel-mar 6010
      UNIONFILLER1d: DWORD;
1 daniel-mar 6011
      dcColor: TD3DColor;
6012
      dcSpecular: TD3DColor;
6013
      dvTU: TD3DValue;
6014
      dvTV: TD3DValue;
4 daniel-mar 6015
     );
1 daniel-mar 6016
  end;
6017
 
4 daniel-mar 6018
(*
6019
 * Untransformed/unlit vertices
6020
 *)
1 daniel-mar 6021
 
6022
  PD3DVertex = ^TD3DVertex;
4 daniel-mar 6023
  TD3DVertex = packed record
1 daniel-mar 6024
    case Integer of
6025
    0: (
4 daniel-mar 6026
      x: TD3DValue;             (* Homogeneous coordinates *)
1 daniel-mar 6027
      y: TD3DValue;
6028
      z: TD3DValue;
4 daniel-mar 6029
      nx: TD3DValue;            (* Normal *)
1 daniel-mar 6030
      ny: TD3DValue;
6031
      nz: TD3DValue;
4 daniel-mar 6032
      tu: TD3DValue;            (* Texture coordinates *)
1 daniel-mar 6033
      tv: TD3DValue;
4 daniel-mar 6034
     );
1 daniel-mar 6035
    1: (
6036
      dvX: TD3DValue;
6037
      dvY: TD3DValue;
6038
      dvZ: TD3DValue;
6039
      dvNX: TD3DValue;
6040
      dvNY: TD3DValue;
6041
      dvNZ: TD3DValue;
6042
      dvTU: TD3DValue;
6043
      dvTV: TD3DValue;
4 daniel-mar 6044
     );
1 daniel-mar 6045
  end;
6046
 
4 daniel-mar 6047
(*
6048
 * Matrix, viewport, and tranformation structures and definitions.
6049
 *)
1 daniel-mar 6050
 
6051
  PD3DMatrix = ^TD3DMatrix;
4 daniel-mar 6052
  TD3DMatrix = packed record
6053
    case integer of
6054
 
6055
           _21, _22, _23, _24: TD3DValue;
6056
           _31, _32, _33, _34: TD3DValue;
6057
           _41, _42, _43, _44: TD3DValue);
6058
      1 : (m : array [0..3, 0..3] of TD3DValue);
1 daniel-mar 6059
  end;
6060
 
6061
  PD3DViewport = ^TD3DViewport;
4 daniel-mar 6062
  TD3DViewport = packed record
1 daniel-mar 6063
    dwSize: DWORD;
6064
    dwX: DWORD;
4 daniel-mar 6065
    dwY: DWORD;                (* Top left *)
1 daniel-mar 6066
    dwWidth: DWORD;
4 daniel-mar 6067
    dwHeight: DWORD;           (* Dimensions *)
6068
    dvScaleX: TD3DValue;       (* Scale homogeneous to screen *)
6069
    dvScaleY: TD3DValue;       (* Scale homogeneous to screen *)
6070
    dvMaxX: TD3DValue;         (* Min/max homogeneous x coord *)
6071
    dvMaxY: TD3DValue;         (* Min/max homogeneous y coord *)
1 daniel-mar 6072
    dvMinZ: TD3DValue;
4 daniel-mar 6073
    dvMaxZ: TD3DValue;         (* Min/max homogeneous z coord *)
1 daniel-mar 6074
  end;
6075
 
6076
  PD3DViewport2 = ^TD3DViewport2;
4 daniel-mar 6077
  TD3DViewport2 = packed record
1 daniel-mar 6078
    dwSize: DWORD;
6079
    dwX: DWORD;
4 daniel-mar 6080
    dwY: DWORD;                (* Viewport Top left *)
1 daniel-mar 6081
    dwWidth: DWORD;
4 daniel-mar 6082
    dwHeight: DWORD;           (* Viewport Dimensions *)
6083
    dvClipX: TD3DValue;        (* Top left of clip volume *)
1 daniel-mar 6084
    dvClipY: TD3DValue;
4 daniel-mar 6085
    dvClipWidth: TD3DValue;    (* Clip Volume Dimensions *)
1 daniel-mar 6086
    dvClipHeight: TD3DValue;
4 daniel-mar 6087
    dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
6088
    dvMaxZ: TD3DValue;
1 daniel-mar 6089
  end;
6090
 
6091
  PD3DViewport7 = ^TD3DViewport7;
4 daniel-mar 6092
  TD3DViewport7 = packed record
1 daniel-mar 6093
    dwX: DWORD;
4 daniel-mar 6094
    dwY: DWORD;                (* Viewport Top left *)
1 daniel-mar 6095
    dwWidth: DWORD;
4 daniel-mar 6096
    dwHeight: DWORD;           (* Viewport Dimensions *)
6097
    dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
6098
    dvMaxZ: TD3DValue;
1 daniel-mar 6099
  end;
6100
 
4 daniel-mar 6101
(*
6102
 * Values for clip fields.
6103
 *)
1 daniel-mar 6104
 
6105
const
4 daniel-mar 6106
// Max number of user clipping planes, supported in D3D.
6107
  D3DMAXUSERCLIPPLANES  = 32;
1 daniel-mar 6108
 
4 daniel-mar 6109
// These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
6110
//
6111
  D3DCLIPPLANE0 = (1 shl 0);
6112
  D3DCLIPPLANE1 = (1 shl 1);
6113
  D3DCLIPPLANE2 = (1 shl 2);
6114
  D3DCLIPPLANE3 = (1 shl 3);
6115
  D3DCLIPPLANE4 = (1 shl 4);
6116
  D3DCLIPPLANE5 = (1 shl 5);
1 daniel-mar 6117
 
4 daniel-mar 6118
const
6119
  D3DCLIP_LEFT                            = $00000001;
6120
  D3DCLIP_RIGHT                           = $00000002;
6121
  D3DCLIP_TOP                             = $00000004;
6122
  D3DCLIP_BOTTOM                          = $00000008;
6123
  D3DCLIP_FRONT                           = $00000010;
6124
  D3DCLIP_BACK                            = $00000020;
6125
  D3DCLIP_GEN0                            = $00000040;
6126
  D3DCLIP_GEN1                            = $00000080;
6127
  D3DCLIP_GEN2                            = $00000100;
6128
  D3DCLIP_GEN3                            = $00000200;
6129
  D3DCLIP_GEN4                            = $00000400;
6130
  D3DCLIP_GEN5                            = $00000800;
1 daniel-mar 6131
 
4 daniel-mar 6132
(*
6133
 * Values for d3d status.
6134
 *)
1 daniel-mar 6135
 
4 daniel-mar 6136
  D3DSTATUS_CLIPUNIONLEFT                 = D3DCLIP_LEFT;
6137
  D3DSTATUS_CLIPUNIONRIGHT                = D3DCLIP_RIGHT;
6138
  D3DSTATUS_CLIPUNIONTOP                  = D3DCLIP_TOP;
6139
  D3DSTATUS_CLIPUNIONBOTTOM               = D3DCLIP_BOTTOM;
6140
  D3DSTATUS_CLIPUNIONFRONT                = D3DCLIP_FRONT;
6141
  D3DSTATUS_CLIPUNIONBACK                 = D3DCLIP_BACK;
6142
  D3DSTATUS_CLIPUNIONGEN0                 = D3DCLIP_GEN0;
6143
  D3DSTATUS_CLIPUNIONGEN1                 = D3DCLIP_GEN1;
6144
  D3DSTATUS_CLIPUNIONGEN2                 = D3DCLIP_GEN2;
6145
  D3DSTATUS_CLIPUNIONGEN3                 = D3DCLIP_GEN3;
6146
  D3DSTATUS_CLIPUNIONGEN4                 = D3DCLIP_GEN4;
6147
  D3DSTATUS_CLIPUNIONGEN5                 = D3DCLIP_GEN5;
1 daniel-mar 6148
 
4 daniel-mar 6149
  D3DSTATUS_CLIPINTERSECTIONLEFT          = $00001000;
6150
  D3DSTATUS_CLIPINTERSECTIONRIGHT         = $00002000;
6151
  D3DSTATUS_CLIPINTERSECTIONTOP           = $00004000;
6152
  D3DSTATUS_CLIPINTERSECTIONBOTTOM        = $00008000;
6153
  D3DSTATUS_CLIPINTERSECTIONFRONT         = $00010000;
6154
  D3DSTATUS_CLIPINTERSECTIONBACK          = $00020000;
6155
  D3DSTATUS_CLIPINTERSECTIONGEN0          = $00040000;
6156
  D3DSTATUS_CLIPINTERSECTIONGEN1          = $00080000;
6157
  D3DSTATUS_CLIPINTERSECTIONGEN2          = $00100000;
6158
  D3DSTATUS_CLIPINTERSECTIONGEN3          = $00200000;
6159
  D3DSTATUS_CLIPINTERSECTIONGEN4          = $00400000;
6160
  D3DSTATUS_CLIPINTERSECTIONGEN5          = $00800000;
6161
  D3DSTATUS_ZNOTVISIBLE                   = $01000000;
6162
(* Do not use 0x80000000 for any status flags in future as it is reserved *)
1 daniel-mar 6163
 
4 daniel-mar 6164
  D3DSTATUS_CLIPUNIONALL = (
6165
            D3DSTATUS_CLIPUNIONLEFT or
6166
            D3DSTATUS_CLIPUNIONRIGHT or
6167
            D3DSTATUS_CLIPUNIONTOP or
6168
            D3DSTATUS_CLIPUNIONBOTTOM or
6169
            D3DSTATUS_CLIPUNIONFRONT or
6170
            D3DSTATUS_CLIPUNIONBACK or
6171
            D3DSTATUS_CLIPUNIONGEN0 or
6172
            D3DSTATUS_CLIPUNIONGEN1 or
6173
            D3DSTATUS_CLIPUNIONGEN2 or
6174
            D3DSTATUS_CLIPUNIONGEN3 or
6175
            D3DSTATUS_CLIPUNIONGEN4 or
6176
            D3DSTATUS_CLIPUNIONGEN5);
1 daniel-mar 6177
 
4 daniel-mar 6178
  D3DSTATUS_CLIPINTERSECTIONALL = (
6179
            D3DSTATUS_CLIPINTERSECTIONLEFT or
6180
            D3DSTATUS_CLIPINTERSECTIONRIGHT or
6181
            D3DSTATUS_CLIPINTERSECTIONTOP or
6182
            D3DSTATUS_CLIPINTERSECTIONBOTTOM or
6183
            D3DSTATUS_CLIPINTERSECTIONFRONT or
6184
            D3DSTATUS_CLIPINTERSECTIONBACK or
6185
            D3DSTATUS_CLIPINTERSECTIONGEN0 or
6186
            D3DSTATUS_CLIPINTERSECTIONGEN1 or
6187
            D3DSTATUS_CLIPINTERSECTIONGEN2 or
6188
            D3DSTATUS_CLIPINTERSECTIONGEN3 or
6189
            D3DSTATUS_CLIPINTERSECTIONGEN4 or
6190
            D3DSTATUS_CLIPINTERSECTIONGEN5);
1 daniel-mar 6191
 
6192
  D3DSTATUS_DEFAULT = (
4 daniel-mar 6193
            D3DSTATUS_CLIPINTERSECTIONALL or
6194
            D3DSTATUS_ZNOTVISIBLE);
1 daniel-mar 6195
 
4 daniel-mar 6196
(*
6197
 * Options for direct transform calls
6198
 *)
1 daniel-mar 6199
 
6200
  D3DTRANSFORM_CLIPPED       = $00000001;
6201
  D3DTRANSFORM_UNCLIPPED     = $00000002;
6202
 
6203
type
6204
  PD3DTransformData = ^TD3DTransformData;
4 daniel-mar 6205
  TD3DTransformData = packed record
1 daniel-mar 6206
    dwSize: DWORD;
4 daniel-mar 6207
    lpIn: Pointer;             (* Input vertices *)
6208
    dwInSize: DWORD;           (* Stride of input vertices *)
6209
    lpOut: Pointer;            (* Output vertices *)
6210
    dwOutSize: DWORD;          (* Stride of output vertices *)
6211
    lpHOut: ^TD3DHVertex;       (* Output homogeneous vertices *)
6212
    dwClip: DWORD;             (* Clipping hint *)
1 daniel-mar 6213
    dwClipIntersection: DWORD;
4 daniel-mar 6214
    dwClipUnion: DWORD;        (* Union of all clip flags *)
6215
    drExtent: TD3DRect;         (* Extent of transformed vertices *)
1 daniel-mar 6216
  end;
6217
 
4 daniel-mar 6218
(*
6219
 * Structure defining position and direction properties for lighting.
6220
 *)
1 daniel-mar 6221
 
6222
  PD3DLightingElement = ^TD3DLightingElement;
4 daniel-mar 6223
  TD3DLightingElement = packed record
6224
    dvPosition: TD3DVector;           (* Lightable point in model space *)
6225
    dvNormal: TD3DVector;             (* Normalised unit vector *)
1 daniel-mar 6226
  end;
6227
 
4 daniel-mar 6228
(*
6229
 * Structure defining material properties for lighting.
6230
 *)
1 daniel-mar 6231
 
6232
  PD3DMaterial = ^TD3DMaterial;
4 daniel-mar 6233
  TD3DMaterial = packed record
1 daniel-mar 6234
    dwSize: DWORD;
6235
    case Integer of
6236
    0: (
4 daniel-mar 6237
      diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
6238
      ambient: TD3DColorValue;        (* Ambient color RGB *)
6239
      specular: TD3DColorValue;       (* Specular 'shininess' *)
6240
      emissive: TD3DColorValue;       (* Emissive color RGB *)
6241
      power: TD3DValue;               (* Sharpness if specular highlight *)
6242
      hTexture: TD3DTextureHandle;    (* Handle to texture map *)
1 daniel-mar 6243
      dwRampSize: DWORD;
4 daniel-mar 6244
     );
1 daniel-mar 6245
    1: (
6246
      dcvDiffuse: TD3DColorValue;
6247
      dcvAmbient: TD3DColorValue;
6248
      dcvSpecular: TD3DColorValue;
6249
      dcvEmissive: TD3DColorValue;
6250
      dvPower: TD3DValue;
4 daniel-mar 6251
     );
1 daniel-mar 6252
  end;
6253
 
6254
  PD3DMaterial7 = ^TD3DMaterial7;
4 daniel-mar 6255
  TD3DMaterial7 = packed record
1 daniel-mar 6256
    case Integer of
6257
    0: (
4 daniel-mar 6258
      diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
6259
      ambient: TD3DColorValue;        (* Ambient color RGB *)
6260
      specular: TD3DColorValue;       (* Specular 'shininess' *)
6261
      emissive: TD3DColorValue;       (* Emissive color RGB *)
6262
      power: TD3DValue;               (* Sharpness if specular highlight *)
6263
     );
1 daniel-mar 6264
    1: (
6265
      dcvDiffuse: TD3DColorValue;
6266
      dcvAmbient: TD3DColorValue;
6267
      dcvSpecular: TD3DColorValue;
6268
      dcvEmissive: TD3DColorValue;
6269
      dvPower: TD3DValue;
4 daniel-mar 6270
     );
1 daniel-mar 6271
  end;
6272
 
4 daniel-mar 6273
  PD3DLightType = ^TD3DLightType;
1 daniel-mar 6274
  TD3DLightType = (
6275
    D3DLIGHT_INVALID_0,
6276
    D3DLIGHT_POINT,
6277
    D3DLIGHT_SPOT,
6278
    D3DLIGHT_DIRECTIONAL,
4 daniel-mar 6279
// Note: The following light type (D3DLIGHT_PARALLELPOINT)
6280
// is no longer supported from D3D for DX7 onwards.
6281
    D3DLIGHT_PARALLELPOINT,
6282
    D3DLIGHT_GLSPOT);
1 daniel-mar 6283
 
4 daniel-mar 6284
(*
6285
 * Structure defining a light source and its properties.
6286
 *)
1 daniel-mar 6287
 
6288
  PD3DLight = ^TD3DLight;
4 daniel-mar 6289
  TD3DLight = packed record
1 daniel-mar 6290
    dwSize: DWORD;
4 daniel-mar 6291
    dltType: TD3DLightType;     (* Type of light source *)
6292
    dcvColor: TD3DColorValue;   (* Color of light *)
6293
    dvPosition: TD3DVector;     (* Position in world space *)
6294
    dvDirection: TD3DVector;    (* Direction in world space *)
6295
    dvRange: TD3DValue;         (* Cutoff range *)
6296
    dvFalloff: TD3DValue;       (* Falloff *)
6297
    dvAttenuation0: TD3DValue;  (* Constant attenuation *)
6298
    dvAttenuation1: TD3DValue;  (* Linear attenuation *)
6299
    dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
6300
    dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
6301
    dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
1 daniel-mar 6302
  end;
6303
 
6304
  PD3DLight7 = ^TD3DLight7;
4 daniel-mar 6305
  TD3DLight7 = packed record
6306
    dltType: TD3DLightType;     (* Type of light source *)
6307
    dcvDiffuse: TD3DColorValue; (* Diffuse color of light *)
6308
    dcvSpecular: TD3DColorValue;(* Specular color of light *)
6309
    dcvAmbient: TD3DColorValue; (* Ambient color of light *)
6310
    dvPosition: TD3DVector;     (* Position in world space *)
6311
    dvDirection: TD3DVector;    (* Direction in world space *)
6312
    dvRange: TD3DValue;         (* Cutoff range *)
6313
    dvFalloff: TD3DValue;       (* Falloff *)
6314
    dvAttenuation0: TD3DValue;  (* Constant attenuation *)
6315
    dvAttenuation1: TD3DValue;  (* Linear attenuation *)
6316
    dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
6317
    dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
6318
    dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
1 daniel-mar 6319
  end;
6320
 
4 daniel-mar 6321
(*
6322
 * Structure defining a light source and its properties.
6323
 *)
1 daniel-mar 6324
 
4 daniel-mar 6325
(* flags bits *)
1 daniel-mar 6326
const
4 daniel-mar 6327
  D3DLIGHT_ACTIVE                       = $00000001;
6328
  D3DLIGHT_NO_SPECULAR  = $00000002;
6329
  D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE;
1 daniel-mar 6330
 
4 daniel-mar 6331
(* maximum valid light range *)
6332
  D3DLIGHT_RANGE_MAX            = 1.8439088915e+18; //sqrt(FLT_MAX);
1 daniel-mar 6333
 
6334
type
6335
  PD3DLight2 = ^TD3DLight2;
4 daniel-mar 6336
  TD3DLight2 = packed record
1 daniel-mar 6337
    dwSize: DWORD;
4 daniel-mar 6338
    dltType: TD3DLightType;     (* Type of light source *)
6339
    dcvColor: TD3DColorValue;   (* Color of light *)
6340
    dvPosition: TD3DVector;     (* Position in world space *)
6341
    dvDirection: TD3DVector;    (* Direction in world space *)
6342
    dvRange: TD3DValue;         (* Cutoff range *)
6343
    dvFalloff: TD3DValue;       (* Falloff *)
6344
    dvAttenuation0: TD3DValue;  (* Constant attenuation *)
6345
    dvAttenuation1: TD3DValue;  (* Linear attenuation *)
6346
    dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
6347
    dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
6348
    dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
1 daniel-mar 6349
    dwFlags: DWORD;
6350
  end;
6351
 
6352
  PD3DLightData = ^TD3DLightData;
4 daniel-mar 6353
  TD3DLightData = packed record
1 daniel-mar 6354
    dwSize: DWORD;
4 daniel-mar 6355
    lpIn: ^TD3DLightingElement;   (* Input positions and normals *)
6356
    dwInSize: DWORD;             (* Stride of input elements *)
6357
    lpOut: ^TD3DTLVertex;         (* Output colors *)
6358
    dwOutSize: DWORD;            (* Stride of output colors *)
1 daniel-mar 6359
  end;
6360
 
6361
(*
6362
 * Before DX5, these values were in an enum called
4 daniel-mar 6363
 * TD3DColorModel. This was not correct, since they are
1 daniel-mar 6364
 * bit flags. A driver can surface either or both flags
6365
 * in the dcmColorModel member of D3DDEVICEDESC.
6366
 *)
6367
 
6368
type
6369
  TD3DColorModel = DWORD;
4 daniel-mar 6370
 
1 daniel-mar 6371
const
6372
  D3DCOLOR_MONO = 1;
4 daniel-mar 6373
  D3DCOLOR_RGB  = 2;
1 daniel-mar 6374
 
4 daniel-mar 6375
(*
6376
 * Options for clearing
6377
 *)
1 daniel-mar 6378
 
6379
const
4 daniel-mar 6380
  D3DCLEAR_TARGET            = $00000001; (* Clear target surface *)
6381
  D3DCLEAR_ZBUFFER           = $00000002; (* Clear target z buffer *)
6382
  D3DCLEAR_STENCIL           = $00000004; (* Clear stencil planes *)
1 daniel-mar 6383
 
4 daniel-mar 6384
(*
6385
 * Execute buffers are allocated via Direct3D.  These buffers may then
6386
 * be filled by the application with instructions to execute along with
6387
 * vertex data.
6388
 *)
1 daniel-mar 6389
 
4 daniel-mar 6390
(*
6391
 * Supported op codes for execute instructions.
6392
 *)
6393
 
1 daniel-mar 6394
type
4 daniel-mar 6395
  PD3DOpcode = ^TD3DOpcode;
1 daniel-mar 6396
  TD3DOpcode = (
6397
    D3DOP_INVALID_0,
6398
    D3DOP_POINT,
6399
    D3DOP_LINE,
6400
    D3DOP_TRIANGLE,
6401
    D3DOP_MATRIXLOAD,
6402
    D3DOP_MATRIXMULTIPLY,
6403
    D3DOP_STATETRANSFORM,
6404
    D3DOP_STATELIGHT,
6405
    D3DOP_STATERENDER,
6406
    D3DOP_PROCESSVERTICES,
6407
    D3DOP_TEXTURELOAD,
6408
    D3DOP_EXIT,
6409
    D3DOP_BRANCHFORWARD,
6410
    D3DOP_SPAN,
4 daniel-mar 6411
    D3DOP_SETSTATUS);
1 daniel-mar 6412
 
4 daniel-mar 6413
  PD3DInstruction = ^TD3DInstruction;
6414
  TD3DInstruction = packed record
6415
    bOpcode: BYTE;   (* Instruction opcode *)
6416
    bSize: BYTE;     (* Size of each instruction data unit *)
6417
    wCount: WORD;    (* Count of instruction data units to follow *)
1 daniel-mar 6418
  end;
6419
 
4 daniel-mar 6420
(*
6421
 * Structure for texture loads
6422
 *)
1 daniel-mar 6423
 
4 daniel-mar 6424
  PD3DTextureLoad = ^TD3DTextureLoad;
6425
  TD3DTextureLoad = packed record
1 daniel-mar 6426
    hDestTexture: TD3DTextureHandle;
6427
    hSrcTexture: TD3DTextureHandle;
6428
  end;
6429
 
4 daniel-mar 6430
(*
6431
 * Structure for picking
6432
 *)
1 daniel-mar 6433
 
4 daniel-mar 6434
  PD3DPickRecord = ^TD3DPickRecord;
6435
  TD3DPickRecord = packed record
1 daniel-mar 6436
    bOpcode: BYTE;
6437
    bPad: BYTE;
6438
    dwOffset: DWORD;
6439
    dvZ: TD3DValue;
6440
  end;
6441
 
4 daniel-mar 6442
(*
6443
 * The following defines the rendering states which can be set in the
6444
 * execute buffer.
6445
 *)
1 daniel-mar 6446
 
4 daniel-mar 6447
  PD3DShadeMode = ^TD3DShadeMode;
1 daniel-mar 6448
  TD3DShadeMode = (
6449
    D3DSHADE_INVALID_0,
6450
    D3DSHADE_FLAT,
6451
    D3DSHADE_GOURAUD,
4 daniel-mar 6452
    D3DSHADE_PHONG);
1 daniel-mar 6453
 
4 daniel-mar 6454
  PD3DFillMode = ^TD3DFillMode;
1 daniel-mar 6455
  TD3DFillMode = (
6456
    D3DFILL_INVALID_0,
6457
    D3DFILL_POINT,
6458
    D3DFILL_WIREFRAME,
4 daniel-mar 6459
    D3DFILL_SOLID);
1 daniel-mar 6460
 
4 daniel-mar 6461
  PD3DLinePattern = ^TD3DLinePattern;
6462
  TD3DLinePattern = packed record
1 daniel-mar 6463
    wRepeatFactor: WORD;
6464
    wLinePattern: WORD;
6465
  end;
6466
 
4 daniel-mar 6467
  PD3DTextureFilter = ^TD3DTextureFilter;
1 daniel-mar 6468
  TD3DTextureFilter = (
6469
    D3DFILTER_INVALID_0,
6470
    D3DFILTER_NEAREST,
6471
    D3DFILTER_LINEAR,
6472
    D3DFILTER_MIPNEAREST,
6473
    D3DFILTER_MIPLINEAR,
6474
    D3DFILTER_LINEARMIPNEAREST,
4 daniel-mar 6475
    D3DFILTER_LINEARMIPLINEAR);
1 daniel-mar 6476
 
4 daniel-mar 6477
  PD3DBlend = ^TD3DBlend;
1 daniel-mar 6478
  TD3DBlend = (
6479
    D3DBLEND_INVALID_0,
6480
    D3DBLEND_ZERO,
6481
    D3DBLEND_ONE,
6482
    D3DBLEND_SRCCOLOR,
6483
    D3DBLEND_INVSRCCOLOR,
6484
    D3DBLEND_SRCALPHA,
6485
    D3DBLEND_INVSRCALPHA,
6486
    D3DBLEND_DESTALPHA,
6487
    D3DBLEND_INVDESTALPHA,
6488
    D3DBLEND_DESTCOLOR,
6489
    D3DBLEND_INVDESTCOLOR,
6490
    D3DBLEND_SRCALPHASAT,
6491
    D3DBLEND_BOTHSRCALPHA,
4 daniel-mar 6492
    D3DBLEND_BOTHINVSRCALPHA);
1 daniel-mar 6493
 
4 daniel-mar 6494
  PD3DTextureBlend = ^TD3DTextureBlend;
1 daniel-mar 6495
  TD3DTextureBlend = (
6496
    D3DTBLEND_INVALID_0,
6497
    D3DTBLEND_DECAL,
6498
    D3DTBLEND_MODULATE,
6499
    D3DTBLEND_DECALALPHA,
6500
    D3DTBLEND_MODULATEALPHA,
6501
    D3DTBLEND_DECALMASK,
6502
    D3DTBLEND_MODULATEMASK,
6503
    D3DTBLEND_COPY,
4 daniel-mar 6504
    D3DTBLEND_ADD);
1 daniel-mar 6505
 
4 daniel-mar 6506
  PD3DTextureAddress = ^TD3DTextureAddress;
1 daniel-mar 6507
  TD3DTextureAddress = (
6508
    D3DTADDRESS_INVALID_0,
6509
    D3DTADDRESS_WRAP,
6510
    D3DTADDRESS_MIRROR,
6511
    D3DTADDRESS_CLAMP,
4 daniel-mar 6512
    D3DTADDRESS_BORDER);
1 daniel-mar 6513
 
4 daniel-mar 6514
  PD3DCull = ^TD3DCull;
1 daniel-mar 6515
  TD3DCull = (
6516
    D3DCULL_INVALID_0,
6517
    D3DCULL_NONE,
6518
    D3DCULL_CW,
4 daniel-mar 6519
    D3DCULL_CCW);
1 daniel-mar 6520
 
4 daniel-mar 6521
  PD3DCmpFunc = ^TD3DCmpFunc;
1 daniel-mar 6522
  TD3DCmpFunc = (
6523
    D3DCMP_INVALID_0,
6524
    D3DCMP_NEVER,
6525
    D3DCMP_LESS,
6526
    D3DCMP_EQUAL,
6527
    D3DCMP_LESSEQUAL,
6528
    D3DCMP_GREATER,
6529
    D3DCMP_NOTEQUAL,
6530
    D3DCMP_GREATEREQUAL,
4 daniel-mar 6531
    D3DCMP_ALWAYS);
1 daniel-mar 6532
 
4 daniel-mar 6533
  PD3DStencilOp = ^TD3DStencilOp;
1 daniel-mar 6534
  TD3DStencilOp = (
6535
    D3DSTENCILOP_INVALID_0,
6536
    D3DSTENCILOP_KEEP,
6537
    D3DSTENCILOP_ZERO,
6538
    D3DSTENCILOP_REPLACE,
6539
    D3DSTENCILOP_INCRSAT,
6540
    D3DSTENCILOP_DECRSAT,
6541
    D3DSTENCILOP_INVERT,
6542
    D3DSTENCILOP_INCR,
4 daniel-mar 6543
    D3DSTENCILOP_DECR);
6544
 
6545
  PD3DFogMode = ^TD3DFogMode;
1 daniel-mar 6546
  TD3DFogMode = (
6547
    D3DFOG_NONE,
6548
    D3DFOG_EXP,
6549
    D3DFOG_EXP2,
4 daniel-mar 6550
    D3DFOG_LINEAR);
1 daniel-mar 6551
 
4 daniel-mar 6552
  PD3DZBufferType = ^TD3DZBufferType;
1 daniel-mar 6553
  TD3DZBufferType = (
6554
    D3DZB_FALSE,
4 daniel-mar 6555
    D3DZB_TRUE,   // Z buffering
6556
    D3DZB_USEW);  // W buffering
1 daniel-mar 6557
 
4 daniel-mar 6558
  PD3DAntialiasMode = ^TD3DAntialiasMode;
1 daniel-mar 6559
  TD3DAntialiasMode = (
6560
    D3DANTIALIAS_NONE,
6561
    D3DANTIALIAS_SORTDEPENDENT,
4 daniel-mar 6562
    D3DANTIALIAS_SORTINDEPENDENT);
1 daniel-mar 6563
 
4 daniel-mar 6564
// Vertex types supported by Direct3D
6565
  PD3DVertexType = ^TD3DVertexType;
1 daniel-mar 6566
  TD3DVertexType = (
6567
    D3DVT_INVALID_0,
6568
    D3DVT_VERTEX,
6569
    D3DVT_LVERTEX,
4 daniel-mar 6570
    D3DVT_TLVERTEX);
1 daniel-mar 6571
 
4 daniel-mar 6572
// Primitives supported by draw-primitive API
6573
  PD3DPrimitiveType = ^TD3DPrimitiveType;
1 daniel-mar 6574
  TD3DPrimitiveType = (
6575
    D3DPT_INVALID_0,
6576
    D3DPT_POINTLIST,
6577
    D3DPT_LINELIST,
6578
    D3DPT_LINESTRIP,
6579
    D3DPT_TRIANGLELIST,
6580
    D3DPT_TRIANGLESTRIP,
4 daniel-mar 6581
    D3DPT_TRIANGLEFAN);
1 daniel-mar 6582
 
4 daniel-mar 6583
(*
6584
 * Amount to add to a state to generate the override for that state.
6585
 *)
1 daniel-mar 6586
 
6587
const
4 daniel-mar 6588
  D3DSTATE_OVERRIDE_BIAS          = 256;
1 daniel-mar 6589
 
4 daniel-mar 6590
(*
6591
 * A state which sets the override flag for the specified state type.
6592
 *)
1 daniel-mar 6593
 
4 daniel-mar 6594
function D3DSTATE_OVERRIDE(StateType: DWORD) : DWORD;
1 daniel-mar 6595
 
6596
type
4 daniel-mar 6597
  PD3DTransformStateType = ^TD3DTransformStateType;
6598
  TD3DTransformStateType = DWORD;
6599
const
6600
  D3DTRANSFORMSTATE_WORLD         = 1;
6601
  D3DTRANSFORMSTATE_VIEW          = 2;
6602
  D3DTRANSFORMSTATE_PROJECTION    = 3;
6603
  D3DTRANSFORMSTATE_WORLD1        = 4;  // 2nd matrix to blend
6604
  D3DTRANSFORMSTATE_WORLD2        = 5;  // 3rd matrix to blend
6605
  D3DTRANSFORMSTATE_WORLD3        = 6;  // 4th matrix to blend
6606
  D3DTRANSFORMSTATE_TEXTURE0      = 16;
6607
  D3DTRANSFORMSTATE_TEXTURE1      = 17;
6608
  D3DTRANSFORMSTATE_TEXTURE2      = 18;
6609
  D3DTRANSFORMSTATE_TEXTURE3      = 19;
6610
  D3DTRANSFORMSTATE_TEXTURE4      = 20;
6611
  D3DTRANSFORMSTATE_TEXTURE5      = 21;
6612
  D3DTRANSFORMSTATE_TEXTURE6      = 22;
6613
  D3DTRANSFORMSTATE_TEXTURE7      = 23;
1 daniel-mar 6614
 
4 daniel-mar 6615
type
6616
  PD3DLightStateType = ^TD3DLightStateType;
1 daniel-mar 6617
  TD3DLightStateType = (
6618
    D3DLIGHTSTATE_INVALID_0,
6619
    D3DLIGHTSTATE_MATERIAL,
6620
    D3DLIGHTSTATE_AMBIENT,
6621
    D3DLIGHTSTATE_COLORMODEL,
6622
    D3DLIGHTSTATE_FOGMODE,
6623
    D3DLIGHTSTATE_FOGSTART,
6624
    D3DLIGHTSTATE_FOGEND,
6625
    D3DLIGHTSTATE_FOGDENSITY,
4 daniel-mar 6626
    D3DLIGHTSTATE_COLORVERTEX);
1 daniel-mar 6627
 
4 daniel-mar 6628
  PD3DRenderStateType = ^TD3DRenderStateType;
6629
  TD3DRenderStateType = DWORD;
6630
const
6631
    D3DRENDERSTATE_ANTIALIAS          = 2;    (* D3DANTIALIASMODE *)
6632
    D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4;    (* TRUE for perspective correction *)
6633
    D3DRENDERSTATE_ZENABLE            = 7;    (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *)
6634
    D3DRENDERSTATE_FILLMODE           = 8;    (* D3DFILL_MODE        *)
6635
    D3DRENDERSTATE_SHADEMODE          = 9;    (* D3DSHADEMODE *)
6636
    D3DRENDERSTATE_LINEPATTERN        = 10;   (* D3DLINEPATTERN *)
6637
    D3DRENDERSTATE_ZWRITEENABLE       = 14;   (* TRUE to enable z writes *)
6638
    D3DRENDERSTATE_ALPHATESTENABLE    = 15;   (* TRUE to enable alpha tests *)
6639
    D3DRENDERSTATE_LASTPIXEL          = 16;   (* TRUE for last-pixel on lines *)
6640
    D3DRENDERSTATE_SRCBLEND           = 19;   (* D3DBLEND *)
6641
    D3DRENDERSTATE_DESTBLEND          = 20;   (* D3DBLEND *)
6642
    D3DRENDERSTATE_CULLMODE           = 22;   (* D3DCULL *)
6643
    D3DRENDERSTATE_ZFUNC              = 23;   (* D3DCMPFUNC *)
6644
    D3DRENDERSTATE_ALPHAREF           = 24;   (* D3DFIXED *)
6645
    D3DRENDERSTATE_ALPHAFUNC          = 25;   (* D3DCMPFUNC *)
6646
    D3DRENDERSTATE_DITHERENABLE       = 26;   (* TRUE to enable dithering *)
6647
    D3DRENDERSTATE_ALPHABLENDENABLE   = 27;   (* TRUE to enable alpha blending *)
6648
    D3DRENDERSTATE_FOGENABLE          = 28;   (* TRUE to enable fog blending *)
6649
    D3DRENDERSTATE_SPECULARENABLE     = 29;   (* TRUE to enable specular *)
6650
    D3DRENDERSTATE_ZVISIBLE           = 30;   (* TRUE to enable z checking *)
6651
    D3DRENDERSTATE_STIPPLEDALPHA      = 33;   (* TRUE to enable stippled alpha (RGB device only) *)
6652
    D3DRENDERSTATE_FOGCOLOR           = 34;   (* D3DCOLOR *)
6653
    D3DRENDERSTATE_FOGTABLEMODE       = 35;   (* D3DFOGMODE *)
6654
    D3DRENDERSTATE_FOGSTART           = 36;   (* Fog start (for both vertex and pixel fog) *)
6655
    D3DRENDERSTATE_FOGEND             = 37;   (* Fog end      *)
6656
    D3DRENDERSTATE_FOGDENSITY         = 38;   (* Fog density  *)
6657
    D3DRENDERSTATE_EDGEANTIALIAS      = 40;   (* TRUE to enable edge antialiasing *)
6658
    D3DRENDERSTATE_COLORKEYENABLE     = 41;   (* TRUE to enable source colorkeyed textures *)
6659
    D3DRENDERSTATE_ZBIAS              = 47;   (* LONG Z bias *)
6660
    D3DRENDERSTATE_RANGEFOGENABLE     = 48;   (* Enables range-based fog *)
1 daniel-mar 6661
 
4 daniel-mar 6662
    D3DRENDERSTATE_STENCILENABLE      = 52;   (* BOOL enable/disable stenciling *)
6663
    D3DRENDERSTATE_STENCILFAIL        = 53;   (* D3DSTENCILOP to do if stencil test fails *)
6664
    D3DRENDERSTATE_STENCILZFAIL       = 54;   (* D3DSTENCILOP to do if stencil test passes and Z test fails *)
6665
    D3DRENDERSTATE_STENCILPASS        = 55;   (* D3DSTENCILOP to do if both stencil and Z tests pass *)
6666
    D3DRENDERSTATE_STENCILFUNC        = 56;   (* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *)
6667
    D3DRENDERSTATE_STENCILREF         = 57;   (* Reference value used in stencil test *)
6668
    D3DRENDERSTATE_STENCILMASK        = 58;   (* Mask value used in stencil test *)
6669
    D3DRENDERSTATE_STENCILWRITEMASK   = 59;   (* Write mask applied to values written to stencil buffer *)
6670
    D3DRENDERSTATE_TEXTUREFACTOR      = 60;   (* D3DCOLOR used for multi-texture blend *)
1 daniel-mar 6671
 
4 daniel-mar 6672
    (*
6673
     * 128 values [128; 255] are reserved for texture coordinate wrap flags.
6674
     * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
6675
     * a flags word preserves forward compatibility with texture coordinates
6676
     * that are >2D.
6677
     *)
6678
    D3DRENDERSTATE_WRAP0              = 128;  (* wrap for 1st texture coord. set *)
6679
    D3DRENDERSTATE_WRAP1              = 129;  (* wrap for 2nd texture coord. set *)
6680
    D3DRENDERSTATE_WRAP2              = 130;  (* wrap for 3rd texture coord. set *)
6681
    D3DRENDERSTATE_WRAP3              = 131;  (* wrap for 4th texture coord. set *)
6682
    D3DRENDERSTATE_WRAP4              = 132;  (* wrap for 5th texture coord. set *)
6683
    D3DRENDERSTATE_WRAP5              = 133;  (* wrap for 6th texture coord. set *)
6684
    D3DRENDERSTATE_WRAP6              = 134;  (* wrap for 7th texture coord. set *)
6685
    D3DRENDERSTATE_WRAP7              = 135;  (* wrap for 8th texture coord. set *)
6686
    D3DRENDERSTATE_CLIPPING            = 136;
6687
    D3DRENDERSTATE_LIGHTING            = 137;
6688
    D3DRENDERSTATE_EXTENTS             = 138;
6689
    D3DRENDERSTATE_AMBIENT             = 139;
6690
    D3DRENDERSTATE_FOGVERTEXMODE       = 140;
6691
    D3DRENDERSTATE_COLORVERTEX         = 141;
6692
    D3DRENDERSTATE_LOCALVIEWER         = 142;
6693
    D3DRENDERSTATE_NORMALIZENORMALS    = 143;
6694
    D3DRENDERSTATE_COLORKEYBLENDENABLE = 144;
6695
    D3DRENDERSTATE_DIFFUSEMATERIALSOURCE    = 145;
6696
    D3DRENDERSTATE_SPECULARMATERIALSOURCE   = 146;
6697
    D3DRENDERSTATE_AMBIENTMATERIALSOURCE    = 147;
6698
    D3DRENDERSTATE_EMISSIVEMATERIALSOURCE   = 148;
6699
    D3DRENDERSTATE_VERTEXBLEND              = 151;
6700
    D3DRENDERSTATE_CLIPPLANEENABLE          = 152;
1 daniel-mar 6701
 
4 daniel-mar 6702
//
6703
// retired renderstates - not supported for DX7 interfaces
6704
//
6705
    D3DRENDERSTATE_TEXTUREHANDLE      = 1;    (* Texture handle for legacy interfaces (Texture;Texture2) *)
6706
    D3DRENDERSTATE_TEXTUREADDRESS     = 3;    (* D3DTEXTUREADDRESS  *)
6707
    D3DRENDERSTATE_WRAPU              = 5;    (* TRUE for wrapping in u *)
6708
    D3DRENDERSTATE_WRAPV              = 6;    (* TRUE for wrapping in v *)
6709
    D3DRENDERSTATE_MONOENABLE         = 11;   (* TRUE to enable mono rasterization *)
6710
    D3DRENDERSTATE_ROP2               = 12;   (* ROP2 *)
6711
    D3DRENDERSTATE_PLANEMASK          = 13;   (* DWORD physical plane mask *)
6712
    D3DRENDERSTATE_TEXTUREMAG         = 17;   (* D3DTEXTUREFILTER *)
6713
    D3DRENDERSTATE_TEXTUREMIN         = 18;   (* D3DTEXTUREFILTER *)
6714
    D3DRENDERSTATE_TEXTUREMAPBLEND    = 21;   (* D3DTEXTUREBLEND *)
6715
    D3DRENDERSTATE_SUBPIXEL           = 31;   (* TRUE to enable subpixel correction *)
6716
    D3DRENDERSTATE_SUBPIXELX          = 32;   (* TRUE to enable correction in X only *)
6717
    D3DRENDERSTATE_STIPPLEENABLE      = 39;   (* TRUE to enable stippling *)
6718
    D3DRENDERSTATE_BORDERCOLOR        = 43;   (* Border color for texturing w/border *)
6719
    D3DRENDERSTATE_TEXTUREADDRESSU    = 44;   (* Texture addressing mode for U coordinate *)
6720
    D3DRENDERSTATE_TEXTUREADDRESSV    = 45;   (* Texture addressing mode for V coordinate *)
6721
    D3DRENDERSTATE_MIPMAPLODBIAS      = 46;   (* D3DVALUE Mipmap LOD bias *)
6722
    D3DRENDERSTATE_ANISOTROPY         = 49;   (* Max. anisotropy. 1 = no anisotropy *)
6723
    D3DRENDERSTATE_FLUSHBATCH         = 50;   (* Explicit flush for DP batching (DX5 Only) *)
6724
    D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51; (* BOOL enable sort-independent transparency *)
6725
    D3DRENDERSTATE_STIPPLEPATTERN00   = 64;   (* Stipple pattern 01...  *)
6726
    D3DRENDERSTATE_STIPPLEPATTERN01   = 65;
6727
    D3DRENDERSTATE_STIPPLEPATTERN02   = 66;
6728
    D3DRENDERSTATE_STIPPLEPATTERN03   = 67;
6729
    D3DRENDERSTATE_STIPPLEPATTERN04   = 68;
6730
    D3DRENDERSTATE_STIPPLEPATTERN05   = 69;
6731
    D3DRENDERSTATE_STIPPLEPATTERN06   = 70;
6732
    D3DRENDERSTATE_STIPPLEPATTERN07   = 71;
6733
    D3DRENDERSTATE_STIPPLEPATTERN08   = 72;
6734
    D3DRENDERSTATE_STIPPLEPATTERN09   = 73;
6735
    D3DRENDERSTATE_STIPPLEPATTERN10   = 74;
6736
    D3DRENDERSTATE_STIPPLEPATTERN11   = 75;
6737
    D3DRENDERSTATE_STIPPLEPATTERN12   = 76;
6738
    D3DRENDERSTATE_STIPPLEPATTERN13   = 77;
6739
    D3DRENDERSTATE_STIPPLEPATTERN14   = 78;
6740
    D3DRENDERSTATE_STIPPLEPATTERN15   = 79;
6741
    D3DRENDERSTATE_STIPPLEPATTERN16   = 80;
6742
    D3DRENDERSTATE_STIPPLEPATTERN17   = 81;
6743
    D3DRENDERSTATE_STIPPLEPATTERN18   = 82;
6744
    D3DRENDERSTATE_STIPPLEPATTERN19   = 83;
6745
    D3DRENDERSTATE_STIPPLEPATTERN20   = 84;
6746
    D3DRENDERSTATE_STIPPLEPATTERN21   = 85;
6747
    D3DRENDERSTATE_STIPPLEPATTERN22   = 86;
6748
    D3DRENDERSTATE_STIPPLEPATTERN23   = 87;
6749
    D3DRENDERSTATE_STIPPLEPATTERN24   = 88;
6750
    D3DRENDERSTATE_STIPPLEPATTERN25   = 89;
6751
    D3DRENDERSTATE_STIPPLEPATTERN26   = 90;
6752
    D3DRENDERSTATE_STIPPLEPATTERN27   = 91;
6753
    D3DRENDERSTATE_STIPPLEPATTERN28   = 92;
6754
    D3DRENDERSTATE_STIPPLEPATTERN29   = 93;
6755
    D3DRENDERSTATE_STIPPLEPATTERN30   = 94;
6756
    D3DRENDERSTATE_STIPPLEPATTERN31   = 95;
1 daniel-mar 6757
 
4 daniel-mar 6758
//
6759
// retired renderstate names - the values are still used under new naming conventions
6760
//
6761
    D3DRENDERSTATE_FOGTABLESTART      = 36;   (* Fog table start    *)
6762
    D3DRENDERSTATE_FOGTABLEEND        = 37;   (* Fog table end      *)
6763
    D3DRENDERSTATE_FOGTABLEDENSITY    = 38;   (* Fog table density  *)
1 daniel-mar 6764
 
4 daniel-mar 6765
type
6766
// Values for material source
6767
  PD3DMateralColorSource = ^TD3DMateralColorSource;
6768
  TD3DMateralColorSource = (
6769
    D3DMCS_MATERIAL,              // Color from material is used
6770
    D3DMCS_COLOR1,                // Diffuse vertex color is used
6771
    D3DMCS_COLOR2                 // Specular vertex color is used
6772
  );
6773
 
1 daniel-mar 6774
const
4 daniel-mar 6775
  // For back-compatibility with legacy compilations
6776
  D3DRENDERSTATE_BLENDENABLE = D3DRENDERSTATE_ALPHABLENDENABLE;
1 daniel-mar 6777
 
6778
 
4 daniel-mar 6779
// Bias to apply to the texture coordinate set to apply a wrap to.
6780
   D3DRENDERSTATE_WRAPBIAS                = 128;
1 daniel-mar 6781
 
4 daniel-mar 6782
(* Flags to construct the WRAP render states *)
6783
  D3DWRAP_U   = $00000001;
6784
  D3DWRAP_V   = $00000002;
1 daniel-mar 6785
 
4 daniel-mar 6786
(* Flags to construct the WRAP render states for 1D thru 4D texture coordinates *)
6787
  D3DWRAPCOORD_0   = $00000001;    // same as D3DWRAP_U
6788
  D3DWRAPCOORD_1   = $00000002;    // same as D3DWRAP_V
6789
  D3DWRAPCOORD_2   = $00000004;
6790
  D3DWRAPCOORD_3   = $00000008;
1 daniel-mar 6791
 
4 daniel-mar 6792
function D3DRENDERSTATE_STIPPLEPATTERN(y: integer) : TD3DRenderStateType;
6793
 
1 daniel-mar 6794
type
4 daniel-mar 6795
  PD3DState = ^TD3DState;
6796
  TD3DState = packed record
1 daniel-mar 6797
    case Integer of
6798
    0: (
6799
      dtstTransformStateType: TD3DTransformStateType;
4 daniel-mar 6800
      dwArg: Array [ 0..0 ] of DWORD;
6801
     );
1 daniel-mar 6802
    1: (
6803
      dlstLightStateType: TD3DLightStateType;
4 daniel-mar 6804
      dvArg: Array [ 0..0 ] of TD3DValue;
6805
     );
1 daniel-mar 6806
    2: (
6807
      drstRenderStateType: TD3DRenderStateType;
4 daniel-mar 6808
     );
1 daniel-mar 6809
  end;
6810
 
4 daniel-mar 6811
(*
6812
 * Operation used to load matrices
6813
 * hDstMat = hSrcMat
6814
 *)
6815
  PD3DMatrixLoad = ^TD3DMatrixLoad;
6816
  TD3DMatrixLoad = packed record
6817
    hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
6818
    hSrcMatrix: TD3DMatrixHandle;    (* Source matrix *)
1 daniel-mar 6819
  end;
6820
 
4 daniel-mar 6821
(*
6822
 * Operation used to multiply matrices
6823
 * hDstMat = hSrcMat1 * hSrcMat2
6824
 *)
6825
  PD3DMatrixMultiply = ^TD3DMatrixMultiply;
6826
  TD3DMatrixMultiply = packed record
6827
    hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
6828
    hSrcMatrix1: TD3DMatrixHandle;   (* First source matrix *)
6829
    hSrcMatrix2: TD3DMatrixHandle;   (* Second source matrix *)
1 daniel-mar 6830
  end;
6831
 
4 daniel-mar 6832
(*
6833
 * Operation used to transform and light vertices.
6834
 *)
6835
  PD3DProcessVertices = ^TD3DProcessVertices;
6836
  TD3DProcessVertices = packed record
6837
    dwFlags: DWORD;           (* Do we transform or light or just copy? *)
6838
    wStart: WORD;             (* Index to first vertex in source *)
6839
    wDest: WORD;              (* Index to first vertex in local buffer *)
6840
    dwCount: DWORD;           (* Number of vertices to be processed *)
6841
    dwReserved: DWORD;        (* Must be zero *)
1 daniel-mar 6842
  end;
6843
 
6844
const
6845
  D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
6846
  D3DPROCESSVERTICES_TRANSFORM            = $00000001;
6847
  D3DPROCESSVERTICES_COPY                 = $00000002;
6848
  D3DPROCESSVERTICES_OPMASK               = $00000007;
6849
 
6850
  D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
6851
  D3DPROCESSVERTICES_NOCOLOR              = $00000010;
6852
 
6853
 
4 daniel-mar 6854
(*
6855
 * State enumerants for per-stage texture processing.
6856
 *)
1 daniel-mar 6857
type
4 daniel-mar 6858
  PD3DTextureStageStateType = ^TD3DTextureStageStateType;
6859
  TD3DTextureStageStateType = DWORD;
1 daniel-mar 6860
const
4 daniel-mar 6861
  D3DTSS_COLOROP        =  1; (* D3DTEXTUREOP - per-stage blending controls for color channels *)
6862
  D3DTSS_COLORARG1      =  2; (* D3DTA_* (texture arg) *)
6863
  D3DTSS_COLORARG2      =  3; (* D3DTA_* (texture arg) *)
6864
  D3DTSS_ALPHAOP        =  4; (* D3DTEXTUREOP - per-stage blending controls for alpha channel *)
6865
  D3DTSS_ALPHAARG1      =  5; (* D3DTA_* (texture arg) *)
6866
  D3DTSS_ALPHAARG2      =  6; (* D3DTA_* (texture arg) *)
6867
  D3DTSS_BUMPENVMAT00   =  7; (* D3DVALUE (bump mapping matrix) *)
6868
  D3DTSS_BUMPENVMAT01   =  8; (* D3DVALUE (bump mapping matrix) *)
6869
  D3DTSS_BUMPENVMAT10   =  9; (* D3DVALUE (bump mapping matrix) *)
6870
  D3DTSS_BUMPENVMAT11   = 10; (* D3DVALUE (bump mapping matrix) *)
6871
  D3DTSS_TEXCOORDINDEX  = 11; (* identifies which set of texture coordinates index this texture *)
6872
  D3DTSS_ADDRESS        = 12; (* D3DTEXTUREADDRESS for both coordinates *)
6873
  D3DTSS_ADDRESSU       = 13; (* D3DTEXTUREADDRESS for U coordinate *)
6874
  D3DTSS_ADDRESSV       = 14; (* D3DTEXTUREADDRESS for V coordinate *)
6875
  D3DTSS_BORDERCOLOR    = 15; (* D3DCOLOR *)
6876
  D3DTSS_MAGFILTER      = 16; (* D3DTEXTUREMAGFILTER filter to use for magnification *)
6877
  D3DTSS_MINFILTER      = 17; (* D3DTEXTUREMINFILTER filter to use for minification *)
6878
  D3DTSS_MIPFILTER      = 18; (* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification *)
6879
  D3DTSS_MIPMAPLODBIAS  = 19; (* D3DVALUE Mipmap LOD bias *)
6880
  D3DTSS_MAXMIPLEVEL    = 20; (* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) *)
6881
  D3DTSS_MAXANISOTROPY  = 21; (* DWORD maximum anisotropy *)
6882
  D3DTSS_BUMPENVLSCALE  = 22; (* D3DVALUE scale for bump map luminance *)
6883
  D3DTSS_BUMPENVLOFFSET = 23; (* D3DVALUE offset for bump map luminance *)
6884
  D3DTSS_TEXTURETRANSFORMFLAGS = 24; (* D3DTEXTURETRANSFORMFLAGS controls texture transform *)
1 daniel-mar 6885
 
4 daniel-mar 6886
// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
6887
// and normal in the camera space) should be taken as texture coordinates
6888
// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
6889
//
6890
  D3DTSS_TCI_PASSTHRU                             = $00000000;
6891
  D3DTSS_TCI_CAMERASPACENORMAL                    = $00010000;
6892
  D3DTSS_TCI_CAMERASPACEPOSITION                  = $00020000;
6893
  D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR          = $00030000;
1 daniel-mar 6894
 
6895
type
4 daniel-mar 6896
(*
6897
 * Enumerations for COLOROP and ALPHAOP texture blending operations set in
6898
 * texture processing stage controls in D3DRENDERSTATE.
6899
 *)
6900
  PD3DTextureOp = ^TD3DTextureOp;
1 daniel-mar 6901
  TD3DTextureOp = (
6902
    D3DTOP_INVALID_0,
4 daniel-mar 6903
// Control
6904
    D3DTOP_DISABLE   ,      // disables stage
6905
    D3DTOP_SELECTARG1,      // the default
1 daniel-mar 6906
    D3DTOP_SELECTARG2,
4 daniel-mar 6907
 
6908
// Modulate
6909
    D3DTOP_MODULATE  ,      // multiply args together
6910
    D3DTOP_MODULATE2X,      // multiply and  1 bit
6911
    D3DTOP_MODULATE4X,      // multiply and  2 bits
6912
 
6913
// Add
6914
    D3DTOP_ADD        ,   // add arguments together
6915
    D3DTOP_ADDSIGNED  ,   // add with -0.5 bias
6916
    D3DTOP_ADDSIGNED2X,   // as above but left  1 bit
6917
    D3DTOP_SUBTRACT   ,   // Arg1 - Arg2, with no saturation
6918
    D3DTOP_ADDSMOOTH  ,   // add 2 args, subtract product
6919
                          // Arg1 + Arg2 - Arg1*Arg2
6920
                          // = Arg1 + (1-Arg1)*Arg2
6921
 
6922
// Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
6923
    D3DTOP_BLENDDIFFUSEALPHA  , // iterated alpha
6924
    D3DTOP_BLENDTEXTUREALPHA  , // texture alpha
6925
    D3DTOP_BLENDFACTORALPHA   , // alpha from D3DRENDERSTATE_TEXTUREFACTOR
1 daniel-mar 6926
    // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
4 daniel-mar 6927
    D3DTOP_BLENDTEXTUREALPHAPM, // texture alpha
6928
    D3DTOP_BLENDCURRENTALPHA  , // by alpha of current color
6929
 
6930
// Specular mapping
6931
    D3DTOP_PREMODULATE           ,     // modulate with next texture before use
1 daniel-mar 6932
    D3DTOP_MODULATEALPHA_ADDCOLOR,     // Arg1.RGB + Arg1.A*Arg2.RGB
6933
                                       // COLOROP only
6934
    D3DTOP_MODULATECOLOR_ADDALPHA,     // Arg1.RGB*Arg2.RGB + Arg1.A
4 daniel-mar 6935
                                            // COLOROP only
1 daniel-mar 6936
    D3DTOP_MODULATEINVALPHA_ADDCOLOR,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
6937
                                       // COLOROP only
6938
    D3DTOP_MODULATEINVCOLOR_ADDALPHA,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
4 daniel-mar 6939
                                            // COLOROP only
6940
 
6941
// Bump mapping
6942
    D3DTOP_BUMPENVMAP         , // per pixel env map perturbation
6943
    D3DTOP_BUMPENVMAPLUMINANCE, // with luminance channel
1 daniel-mar 6944
    // This can do either diffuse or specular bump mapping with correct input.
6945
    // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
6946
    // where each component has been scaled and offset to make it signed.
6947
    // The result is replicated into all four (including alpha) channels.
6948
    // This is a valid COLOROP only.
6949
    D3DTOP_DOTPRODUCT3
6950
  );
6951
 
4 daniel-mar 6952
(*
6953
 * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
6954
 * set in texture processing stage controls in D3DRENDERSTATE.
6955
 *)
1 daniel-mar 6956
const
4 daniel-mar 6957
  D3DTA_SELECTMASK        = $0000000f;  // mask for arg selector
6958
  D3DTA_DIFFUSE           = $00000000;  // select diffuse color
6959
  D3DTA_CURRENT           = $00000001;  // select result of previous stage
6960
  D3DTA_TEXTURE           = $00000002;  // select texture color
6961
  D3DTA_TFACTOR           = $00000003;  // select RENDERSTATE_TEXTUREFACTOR
6962
  D3DTA_SPECULAR          = $00000004;  // select specular color
6963
  D3DTA_COMPLEMENT        = $00000010;  // take 1.0 - x
6964
  D3DTA_ALPHAREPLICATE    = $00000020;  // replicate alpha to color components
1 daniel-mar 6965
 
4 daniel-mar 6966
(*
6967
 *  IDirect3DTexture2 State Filter Types
6968
 *)
1 daniel-mar 6969
type
4 daniel-mar 6970
  PD3DTextureMagFilter = ^TD3DTextureMagFilter;
1 daniel-mar 6971
  TD3DTextureMagFilter = (
6972
    D3DTFG_INVALID_0,
4 daniel-mar 6973
    D3DTFG_POINT        ,    // nearest
6974
    D3DTFG_LINEAR       ,    // linear interpolation
6975
    D3DTFG_FLATCUBIC    ,    // cubic
6976
    D3DTFG_GAUSSIANCUBIC,    // different cubic kernel
1 daniel-mar 6977
    D3DTFG_ANISOTROPIC
6978
  );
6979
 
4 daniel-mar 6980
  PD3DTextureMinFilter = ^TD3DTextureMinFilter;
1 daniel-mar 6981
  TD3DTextureMinFilter = (
6982
    D3DTFN_INVALID_0,
4 daniel-mar 6983
    D3DTFN_POINT      ,    // nearest
6984
    D3DTFN_LINEAR     ,    // linear interpolation
1 daniel-mar 6985
    D3DTFN_ANISOTROPIC
6986
  );
6987
 
4 daniel-mar 6988
  PD3DTextureMipFilter = ^TD3DTextureMipFilter;
1 daniel-mar 6989
  TD3DTextureMipFilter = (
6990
    D3DTFP_INVALID_0,
4 daniel-mar 6991
    D3DTFP_NONE   ,    // mipmapping disabled (use MAG filter)
6992
    D3DTFP_POINT  ,    // nearest
6993
    D3DTFP_LINEAR      // linear interpolation
1 daniel-mar 6994
  );
6995
 
6996
 
4 daniel-mar 6997
(*
6998
 * Triangle flags
6999
 *)
1 daniel-mar 7000
 
4 daniel-mar 7001
(*
7002
 * Tri strip and fan flags.
7003
 * START loads all three vertices
7004
 * EVEN and ODD load just v3 with even or odd culling
7005
 * START_FLAT contains a count from 0 to 29 that allows the
7006
 * whole strip or fan to be culled in one hit.
7007
 * e.g. for a quad len = 1
7008
 *)
1 daniel-mar 7009
const
7010
  D3DTRIFLAG_START                        = $00000000;
4 daniel-mar 7011
// #define D3DTRIFLAG_STARTFLAT(len) (len)         (* 0 < len < 30 *)
7012
function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
7013
 
7014
const
1 daniel-mar 7015
  D3DTRIFLAG_ODD                          = $0000001e;
7016
  D3DTRIFLAG_EVEN                         = $0000001f;
7017
 
4 daniel-mar 7018
(*
7019
 * Triangle edge flags
7020
 * enable edges for wireframe or antialiasing
7021
 *)
7022
  D3DTRIFLAG_EDGEENABLE1                  = $00000100; (* v0-v1 edge *)
7023
  D3DTRIFLAG_EDGEENABLE2                  = $00000200; (* v1-v2 edge *)
7024
  D3DTRIFLAG_EDGEENABLE3                  = $00000400; (* v2-v0 edge *)
7025
  D3DTRIFLAG_EDGEENABLETRIANGLE = (
7026
      D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3);
1 daniel-mar 7027
 
4 daniel-mar 7028
(*
7029
 * Primitive structures and related defines.  Vertex offsets are to types
7030
 * TD3DVertex, TD3DLVertex, or TD3DTLVertex.
7031
 *)
1 daniel-mar 7032
 
4 daniel-mar 7033
(*
7034
 * Triangle list primitive structure
7035
 *)
1 daniel-mar 7036
type
7037
  PD3DTriangle = ^TD3DTriangle;
4 daniel-mar 7038
  TD3DTriangle = packed record
1 daniel-mar 7039
    case Integer of
7040
    0: (
4 daniel-mar 7041
      v1: WORD;            (* Vertex indices *)
1 daniel-mar 7042
      v2: WORD;
7043
      v3: WORD;
4 daniel-mar 7044
      wFlags: WORD;        (* Edge (and other) flags *)
7045
     );
1 daniel-mar 7046
    1: (
7047
      wV1: WORD;
7048
      wV2: WORD;
7049
      wV3: WORD;
4 daniel-mar 7050
     );
1 daniel-mar 7051
  end;
7052
 
4 daniel-mar 7053
(*
7054
 * Line strip structure.
7055
 * The instruction count - 1 defines the number of line segments.
7056
 *)
1 daniel-mar 7057
  PD3DLine = ^TD3DLine;
4 daniel-mar 7058
  TD3DLine = packed record
1 daniel-mar 7059
    case Integer of
7060
    0: (
4 daniel-mar 7061
      v1: WORD;            (* Vertex indices *)
1 daniel-mar 7062
      v2: WORD;
4 daniel-mar 7063
     );
1 daniel-mar 7064
    1: (
7065
      wV1: WORD;
7066
      wV2: WORD;
4 daniel-mar 7067
     );
1 daniel-mar 7068
  end;
7069
 
4 daniel-mar 7070
(*
7071
 * Span structure
7072
 * Spans join a list of points with the same y value.
7073
 * If the y value changes, a new span is started.
7074
 *)
1 daniel-mar 7075
  PD3DSpan = ^TD3DSpan;
4 daniel-mar 7076
  TD3DSpan = packed record
7077
    wCount: WORD;        (* Number of spans *)
7078
    wFirst: WORD;        (* Index to first vertex *)
1 daniel-mar 7079
  end;
7080
 
4 daniel-mar 7081
(*
7082
 * Point structure
7083
 *)
1 daniel-mar 7084
  PD3DPoint = ^TD3DPoint;
4 daniel-mar 7085
  TD3DPoint = packed record
7086
    wCount: WORD;        (* number of points         *)
7087
    wFirst: WORD;        (* index to first vertex    *)
1 daniel-mar 7088
  end;
7089
 
4 daniel-mar 7090
(*
7091
 * Forward branch structure.
7092
 * Mask is logically anded with the driver status mask
7093
 * if the result equals 'value', the branch is taken.
7094
 *)
1 daniel-mar 7095
  PD3DBranch = ^TD3DBranch;
4 daniel-mar 7096
  TD3DBranch = packed record
7097
    dwMask: DWORD;         (* Bitmask against D3D status *)
1 daniel-mar 7098
    dwValue: DWORD;
4 daniel-mar 7099
    bNegate: BOOL;         (* TRUE to negate comparison *)
7100
    dwOffset: DWORD;       (* How far to branch forward (0 for exit)*)
1 daniel-mar 7101
  end;
7102
 
4 daniel-mar 7103
(*
7104
 * Status used for set status instruction.
7105
 * The D3D status is initialised on device creation
7106
 * and is modified by all execute calls.
7107
 *)
1 daniel-mar 7108
  PD3DStatus = ^TD3DStatus;
4 daniel-mar 7109
  TD3DStatus = packed record
7110
    dwFlags: DWORD;        (* Do we set extents or status *)
7111
    dwStatus: DWORD;       (* D3D status *)
1 daniel-mar 7112
    drExtent: TD3DRect;
7113
  end;
7114
 
7115
const
4 daniel-mar 7116
  D3DSETSTATUS_STATUS    = $00000001;
7117
  D3DSETSTATUS_EXTENTS   = $00000002;
7118
  D3DSETSTATUS_ALL      = (D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS);
1 daniel-mar 7119
 
7120
type
7121
  PD3DClipStatus = ^TD3DClipStatus;
4 daniel-mar 7122
  TD3DClipStatus = packed record
7123
    dwFlags : DWORD; (* Do we set 2d extents, 3D extents or status *)
7124
    dwStatus : DWORD; (* Clip status *)
7125
    minx, maxx : float; (* X extents *)
7126
    miny, maxy : float; (* Y extents *)
7127
    minz, maxz : float; (* Z extents *)
1 daniel-mar 7128
  end;
7129
 
7130
const
7131
  D3DCLIPSTATUS_STATUS        = $00000001;
7132
  D3DCLIPSTATUS_EXTENTS2      = $00000002;
7133
  D3DCLIPSTATUS_EXTENTS3      = $00000004;
7134
 
4 daniel-mar 7135
(*
7136
 * Statistics structure
7137
 *)
1 daniel-mar 7138
type
7139
  PD3DStats = ^TD3DStats;
4 daniel-mar 7140
  TD3DStats = packed record
1 daniel-mar 7141
    dwSize: DWORD;
7142
    dwTrianglesDrawn: DWORD;
7143
    dwLinesDrawn: DWORD;
7144
    dwPointsDrawn: DWORD;
7145
    dwSpansDrawn: DWORD;
7146
    dwVerticesProcessed: DWORD;
7147
  end;
7148
 
4 daniel-mar 7149
(*
7150
 * Execute options.
7151
 * When calling using D3DEXECUTE_UNCLIPPED all the primitives
7152
 * inside the buffer must be contained within the viewport.
7153
 *)
1 daniel-mar 7154
const
7155
  D3DEXECUTE_CLIPPED       = $00000001;
7156
  D3DEXECUTE_UNCLIPPED     = $00000002;
7157
 
7158
type
7159
  PD3DExecuteData = ^TD3DExecuteData;
4 daniel-mar 7160
  TD3DExecuteData = packed record
1 daniel-mar 7161
    dwSize: DWORD;
7162
    dwVertexOffset: DWORD;
7163
    dwVertexCount: DWORD;
7164
    dwInstructionOffset: DWORD;
7165
    dwInstructionLength: DWORD;
7166
    dwHVertexOffset: DWORD;
4 daniel-mar 7167
    dsStatus: TD3DStatus;       (* Status after execute *)
1 daniel-mar 7168
  end;
7169
 
4 daniel-mar 7170
(*
7171
 * Palette flags.
7172
 * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
7173
 *)
1 daniel-mar 7174
 
7175
const
4 daniel-mar 7176
  D3DPAL_FREE     = $00;    (* Renderer may use this entry freely *)
7177
  D3DPAL_READONLY = $40;    (* Renderer may not set this entry *)
7178
  D3DPAL_RESERVED = $80;    (* Renderer may not use this entry *)
1 daniel-mar 7179
 
7180
 
7181
type
7182
  PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
4 daniel-mar 7183
  TD3DVertexBufferDesc = packed record
7184
    dwSize : DWORD;
7185
    dwCaps : DWORD;
7186
    dwFVF : DWORD;
7187
    dwNumVertices : DWORD;
1 daniel-mar 7188
  end;
7189
 
7190
const
4 daniel-mar 7191
(* These correspond to DDSCAPS_* flags *)
7192
  D3DVBCAPS_SYSTEMMEMORY      = $00000800;
7193
  D3DVBCAPS_WRITEONLY         = $00010000;
7194
  D3DVBCAPS_OPTIMIZED         = $80000000;
7195
  D3DVBCAPS_DONOTCLIP         = $00000001;
1 daniel-mar 7196
 
4 daniel-mar 7197
(* Vertex Operations for ProcessVertices *)
7198
  D3DVOP_LIGHT      = (1 shl 10);
7199
  D3DVOP_TRANSFORM  = (1 shl 0);
7200
  D3DVOP_CLIP       = (1 shl 2);
7201
  D3DVOP_EXTENTS    = (1 shl 3);
1 daniel-mar 7202
 
4 daniel-mar 7203
(* The maximum number of vertices user can pass to any d3d
7204
   drawing function or to create vertex buffer with
7205
*)
7206
  D3DMAXNUMVERTICES  =  ((1 shl 16) - 1);
7207
(* The maximum number of primitives user can pass to any d3d
7208
   drawing function.
7209
*)
7210
  D3DMAXNUMPRIMITIVES = ((1 shl 16) - 1);
1 daniel-mar 7211
 
4 daniel-mar 7212
(* Bits for dwFlags in ProcessVertices call *)
7213
  D3DPV_DONOTCOPYDATA = (1 shl 0);
1 daniel-mar 7214
 
4 daniel-mar 7215
//-------------------------------------------------------------------
1 daniel-mar 7216
 
4 daniel-mar 7217
// Flexible vertex format bits
7218
//
7219
  D3DFVF_RESERVED0        = $001;
7220
  D3DFVF_POSITION_MASK    = $00E;
7221
  D3DFVF_XYZ              = $002;
7222
  D3DFVF_XYZRHW           = $004;
7223
  D3DFVF_XYZB1            = $006;
7224
  D3DFVF_XYZB2            = $008;
7225
  D3DFVF_XYZB3            = $00a;
7226
  D3DFVF_XYZB4            = $00c;
7227
  D3DFVF_XYZB5            = $00e;
1 daniel-mar 7228
 
4 daniel-mar 7229
  D3DFVF_NORMAL           = $010;
7230
  D3DFVF_RESERVED1        = $020;
7231
  D3DFVF_DIFFUSE          = $040;
7232
  D3DFVF_SPECULAR         = $080;
1 daniel-mar 7233
 
4 daniel-mar 7234
  D3DFVF_TEXCOUNT_MASK    = $f00;
7235
  D3DFVF_TEXCOUNT_SHIFT   = 8;
7236
  D3DFVF_TEX0             = $000;
7237
  D3DFVF_TEX1             = $100;
7238
  D3DFVF_TEX2             = $200;
7239
  D3DFVF_TEX3             = $300;
7240
  D3DFVF_TEX4             = $400;
7241
  D3DFVF_TEX5             = $500;
7242
  D3DFVF_TEX6             = $600;
7243
  D3DFVF_TEX7             = $700;
7244
  D3DFVF_TEX8             = $800;
1 daniel-mar 7245
 
4 daniel-mar 7246
  D3DFVF_RESERVED2        = $f000;  // 4 reserved bits
1 daniel-mar 7247
 
4 daniel-mar 7248
  D3DFVF_VERTEX = ( D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1 );
7249
  D3DFVF_LVERTEX = ( D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or
7250
                         D3DFVF_SPECULAR or D3DFVF_TEX1 );
7251
  D3DFVF_TLVERTEX = ( D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or
7252
                          D3DFVF_TEX1 );
1 daniel-mar 7253
 
7254
type
4 daniel-mar 7255
  PD3DDP_PtrStride = ^TD3DDP_PtrStride;
7256
  TD3DDP_PtrStride = packed record
7257
    lpvData : pointer;
7258
    dwStride : DWORD;
1 daniel-mar 7259
  end;
7260
 
7261
const
7262
  D3DDP_MAXTEXCOORD = 8;
7263
 
7264
type
7265
  PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData;
4 daniel-mar 7266
  TD3DDrawPrimitiveStridedData = packed record
7267
    position : TD3DDP_PtrStride;
7268
    normal : TD3DDP_PtrStride;
7269
    diffuse : TD3DDP_PtrStride;
7270
    specular : TD3DDP_PtrStride;
7271
    textureCoords : array [0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride;
1 daniel-mar 7272
  end;
7273
 
4 daniel-mar 7274
//---------------------------------------------------------------------
7275
// ComputeSphereVisibility return values
7276
//
1 daniel-mar 7277
const
4 daniel-mar 7278
  D3DVIS_INSIDE_FRUSTUM      = 0;
7279
  D3DVIS_INTERSECT_FRUSTUM   = 1;
7280
  D3DVIS_OUTSIDE_FRUSTUM     = 2;
7281
  D3DVIS_INSIDE_LEFT         = 0;
7282
  D3DVIS_INTERSECT_LEFT      = (1 shl 2);
7283
  D3DVIS_OUTSIDE_LEFT        = (2 shl 2);
7284
  D3DVIS_INSIDE_RIGHT        = 0;
7285
  D3DVIS_INTERSECT_RIGHT     = (1 shl 4);
7286
  D3DVIS_OUTSIDE_RIGHT       = (2 shl 4);
7287
  D3DVIS_INSIDE_TOP          = 0;
7288
  D3DVIS_INTERSECT_TOP       = (1 shl 6);
7289
  D3DVIS_OUTSIDE_TOP         = (2 shl 6);
7290
  D3DVIS_INSIDE_BOTTOM       = 0;
7291
  D3DVIS_INTERSECT_BOTTOM    = (1 shl 8);
7292
  D3DVIS_OUTSIDE_BOTTOM      = (2 shl 8);
7293
  D3DVIS_INSIDE_NEAR         = 0;
7294
  D3DVIS_INTERSECT_NEAR      = (1 shl 10);
7295
  D3DVIS_OUTSIDE_NEAR        = (2 shl 10);
7296
  D3DVIS_INSIDE_FAR          = 0;
7297
  D3DVIS_INTERSECT_FAR       = (1 shl 12);
7298
  D3DVIS_OUTSIDE_FAR         = (2 shl 12);
1 daniel-mar 7299
 
4 daniel-mar 7300
  D3DVIS_MASK_FRUSTUM        = (3 shl 0);
7301
  D3DVIS_MASK_LEFT           = (3 shl 2);
7302
  D3DVIS_MASK_RIGHT          = (3 shl 4);
7303
  D3DVIS_MASK_TOP            = (3 shl 6);
7304
  D3DVIS_MASK_BOTTOM         = (3 shl 8);
7305
  D3DVIS_MASK_NEAR           = (3 shl 10);
7306
  D3DVIS_MASK_FAR            = (3 shl 12);
1 daniel-mar 7307
 
4 daniel-mar 7308
// To be used with GetInfo()
1 daniel-mar 7309
  D3DDEVINFOID_TEXTUREMANAGER    = 1;
7310
  D3DDEVINFOID_D3DTEXTUREMANAGER = 2;
7311
  D3DDEVINFOID_TEXTURING         = 3;
7312
 
7313
type
4 daniel-mar 7314
  PD3DStateBlockType = ^TD3DStateBlockType;
1 daniel-mar 7315
  TD3DStateBlockType = (
4 daniel-mar 7316
    D3DSBT_INVALID_0   ,
7317
    D3DSBT_ALL         , // capture all state
7318
    D3DSBT_PIXELSTATE  , // capture pixel state
7319
    D3DSBT_VERTEXSTATE   // capture vertex state
1 daniel-mar 7320
  );
7321
 
4 daniel-mar 7322
// The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
7323
//
7324
  PD3DVertexBlendFlags = ^TD3DVertexBlendFlags;
1 daniel-mar 7325
  TD3DVertexBlendFlags = (
4 daniel-mar 7326
    D3DVBLEND_DISABLE , // Disable vertex blending
7327
    D3DVBLEND_1WEIGHT , // blend between 2 matrices
7328
    D3DVBLEND_2WEIGHTS, // blend between 3 matrices
7329
    D3DVBLEND_3WEIGHTS  // blend between 4 matrices
1 daniel-mar 7330
  );
7331
 
4 daniel-mar 7332
  PD3DTextureTransformFlags = ^TD3DTextureTransformFlags;
1 daniel-mar 7333
  TD3DTextureTransformFlags = (
4 daniel-mar 7334
    D3DTTFF_DISABLE ,    // texture coordinates are passed directly
7335
    D3DTTFF_COUNT1  ,    // rasterizer should expect 1-D texture coords
7336
    D3DTTFF_COUNT2  ,    // rasterizer should expect 2-D texture coords
7337
    D3DTTFF_COUNT3  ,    // rasterizer should expect 3-D texture coords
7338
    D3DTTFF_COUNT4       // rasterizer should expect 4-D texture coords
1 daniel-mar 7339
  );
7340
 
7341
const
4 daniel-mar 7342
  D3DTTFF_PROJECTED       = TD3DTextureTransformFlags(256); // texcoords to be divided by COUNTth element
1 daniel-mar 7343
 
4 daniel-mar 7344
// Macros to set texture coordinate format bits in the FVF id
1 daniel-mar 7345
 
4 daniel-mar 7346
D3DFVF_TEXTUREFORMAT2 = 0;         // Two floating point values
7347
D3DFVF_TEXTUREFORMAT1 = 3;         // One floating point value
7348
D3DFVF_TEXTUREFORMAT3 = 1;         // Three floating point values
7349
D3DFVF_TEXTUREFORMAT4 = 2;         // Four floating point values
7350
 
7351
function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD) : DWORD;
7352
function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD) : DWORD;
7353
function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD) : DWORD;
7354
function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD) : DWORD;
7355
 
1 daniel-mar 7356
(*==========================================================================;
7357
 *
7358
 *
7359
 *  File:       d3dcaps.h
7360
 *  Content:    Direct3D capabilities include file
7361
 *
7362
 ***************************************************************************)
7363
 
4 daniel-mar 7364
(* Description of capabilities of transform *)
1 daniel-mar 7365
 
7366
type
7367
  PD3DTransformCaps = ^TD3DTransformCaps;
4 daniel-mar 7368
  TD3DTransformCaps = packed record
1 daniel-mar 7369
    dwSize: DWORD;
7370
    dwCaps: DWORD;
7371
  end;
7372
 
7373
const
4 daniel-mar 7374
  D3DTRANSFORMCAPS_CLIP         = $00000001; (* Will clip whilst transforming *)
1 daniel-mar 7375
 
4 daniel-mar 7376
(* Description of capabilities of lighting *)
1 daniel-mar 7377
 
7378
type
7379
  PD3DLightingCaps = ^TD3DLightingCaps;
4 daniel-mar 7380
  TD3DLightingCaps = packed record
1 daniel-mar 7381
    dwSize: DWORD;
4 daniel-mar 7382
    dwCaps: DWORD;                   (* Lighting caps *)
7383
    dwLightingModel: DWORD;          (* Lighting model - RGB or mono *)
7384
    dwNumLights: DWORD;              (* Number of lights that can be handled *)
1 daniel-mar 7385
  end;
7386
 
7387
const
4 daniel-mar 7388
  D3DLIGHTINGMODEL_RGB            = $00000001;
7389
  D3DLIGHTINGMODEL_MONO           = $00000002;
1 daniel-mar 7390
 
4 daniel-mar 7391
  D3DLIGHTCAPS_POINT              = $00000001; (* Point lights supported *)
7392
  D3DLIGHTCAPS_SPOT               = $00000002; (* Spot lights supported *)
7393
  D3DLIGHTCAPS_DIRECTIONAL        = $00000004; (* Directional lights supported *)
7394
  D3DLIGHTCAPS_PARALLELPOINT      = $00000008; (* Parallel point lights supported *)
7395
  D3DLIGHTCAPS_GLSPOT             = $00000010; (* GL syle spot lights supported *)
1 daniel-mar 7396
 
4 daniel-mar 7397
(* Description of capabilities for each primitive type *)
1 daniel-mar 7398
 
7399
type
7400
  PD3DPrimCaps = ^TD3DPrimCaps;
4 daniel-mar 7401
  TD3DPrimCaps = packed record
1 daniel-mar 7402
    dwSize: DWORD;
4 daniel-mar 7403
    dwMiscCaps: DWORD;                 (* Capability flags *)
1 daniel-mar 7404
    dwRasterCaps: DWORD;
7405
    dwZCmpCaps: DWORD;
7406
    dwSrcBlendCaps: DWORD;
7407
    dwDestBlendCaps: DWORD;
7408
    dwAlphaCmpCaps: DWORD;
7409
    dwShadeCaps: DWORD;
7410
    dwTextureCaps: DWORD;
7411
    dwTextureFilterCaps: DWORD;
7412
    dwTextureBlendCaps: DWORD;
7413
    dwTextureAddressCaps: DWORD;
4 daniel-mar 7414
    dwStippleWidth: DWORD;             (* maximum width and height of *)
7415
    dwStippleHeight: DWORD;            (* of supported stipple (up to 32x32) *)
1 daniel-mar 7416
  end;
7417
 
4 daniel-mar 7418
const
7419
(* TD3DPrimCaps dwMiscCaps *)
1 daniel-mar 7420
 
7421
  D3DPMISCCAPS_MASKPLANES         = $00000001;
7422
  D3DPMISCCAPS_MASKZ              = $00000002;
7423
  D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
7424
  D3DPMISCCAPS_CONFORMANT         = $00000008;
7425
  D3DPMISCCAPS_CULLNONE           = $00000010;
7426
  D3DPMISCCAPS_CULLCW             = $00000020;
7427
  D3DPMISCCAPS_CULLCCW            = $00000040;
7428
 
4 daniel-mar 7429
(* TD3DPrimCaps dwRasterCaps *)
1 daniel-mar 7430
 
4 daniel-mar 7431
  D3DPRASTERCAPS_DITHER           = $00000001;
7432
  D3DPRASTERCAPS_ROP2             = $00000002;
7433
  D3DPRASTERCAPS_XOR              = $00000004;
7434
  D3DPRASTERCAPS_PAT              = $00000008;
7435
  D3DPRASTERCAPS_ZTEST            = $00000010;
7436
  D3DPRASTERCAPS_SUBPIXEL         = $00000020;
7437
  D3DPRASTERCAPS_SUBPIXELX        = $00000040;
7438
  D3DPRASTERCAPS_FOGVERTEX        = $00000080;
7439
  D3DPRASTERCAPS_FOGTABLE         = $00000100;
7440
  D3DPRASTERCAPS_STIPPLE          = $00000200;
7441
  D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT   = $00000400;
7442
  D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = $00000800;
7443
  D3DPRASTERCAPS_ANTIALIASEDGES           = $00001000;
7444
  D3DPRASTERCAPS_MIPMAPLODBIAS            = $00002000;
7445
  D3DPRASTERCAPS_ZBIAS                    = $00004000;
7446
  D3DPRASTERCAPS_ZBUFFERLESSHSR           = $00008000;
7447
  D3DPRASTERCAPS_FOGRANGE                 = $00010000;
7448
  D3DPRASTERCAPS_ANISOTROPY               = $00020000;
7449
  D3DPRASTERCAPS_WBUFFER                      = $00040000;
7450
  D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT   = $00080000;
7451
  D3DPRASTERCAPS_WFOG                         = $00100000;
7452
  D3DPRASTERCAPS_ZFOG                         = $00200000;
1 daniel-mar 7453
 
4 daniel-mar 7454
(* TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps *)
1 daniel-mar 7455
 
4 daniel-mar 7456
const
1 daniel-mar 7457
  D3DPCMPCAPS_NEVER               = $00000001;
7458
  D3DPCMPCAPS_LESS                = $00000002;
7459
  D3DPCMPCAPS_EQUAL               = $00000004;
7460
  D3DPCMPCAPS_LESSEQUAL           = $00000008;
7461
  D3DPCMPCAPS_GREATER             = $00000010;
7462
  D3DPCMPCAPS_NOTEQUAL            = $00000020;
7463
  D3DPCMPCAPS_GREATEREQUAL        = $00000040;
7464
  D3DPCMPCAPS_ALWAYS              = $00000080;
7465
 
4 daniel-mar 7466
(* TD3DPrimCaps dwSourceBlendCaps, dwDestBlendCaps *)
1 daniel-mar 7467
 
7468
  D3DPBLENDCAPS_ZERO              = $00000001;
7469
  D3DPBLENDCAPS_ONE               = $00000002;
7470
  D3DPBLENDCAPS_SRCCOLOR          = $00000004;
7471
  D3DPBLENDCAPS_INVSRCCOLOR       = $00000008;
7472
  D3DPBLENDCAPS_SRCALPHA          = $00000010;
7473
  D3DPBLENDCAPS_INVSRCALPHA       = $00000020;
7474
  D3DPBLENDCAPS_DESTALPHA         = $00000040;
7475
  D3DPBLENDCAPS_INVDESTALPHA      = $00000080;
7476
  D3DPBLENDCAPS_DESTCOLOR         = $00000100;
7477
  D3DPBLENDCAPS_INVDESTCOLOR      = $00000200;
7478
  D3DPBLENDCAPS_SRCALPHASAT       = $00000400;
7479
  D3DPBLENDCAPS_BOTHSRCALPHA      = $00000800;
7480
  D3DPBLENDCAPS_BOTHINVSRCALPHA   = $00001000;
7481
 
4 daniel-mar 7482
(* TD3DPrimCaps dwShadeCaps *)
1 daniel-mar 7483
 
7484
  D3DPSHADECAPS_COLORFLATMONO             = $00000001;
7485
  D3DPSHADECAPS_COLORFLATRGB              = $00000002;
7486
  D3DPSHADECAPS_COLORGOURAUDMONO          = $00000004;
7487
  D3DPSHADECAPS_COLORGOURAUDRGB           = $00000008;
7488
  D3DPSHADECAPS_COLORPHONGMONO            = $00000010;
7489
  D3DPSHADECAPS_COLORPHONGRGB             = $00000020;
7490
 
7491
  D3DPSHADECAPS_SPECULARFLATMONO          = $00000040;
7492
  D3DPSHADECAPS_SPECULARFLATRGB           = $00000080;
7493
  D3DPSHADECAPS_SPECULARGOURAUDMONO       = $00000100;
7494
  D3DPSHADECAPS_SPECULARGOURAUDRGB        = $00000200;
7495
  D3DPSHADECAPS_SPECULARPHONGMONO         = $00000400;
7496
  D3DPSHADECAPS_SPECULARPHONGRGB          = $00000800;
7497
 
7498
  D3DPSHADECAPS_ALPHAFLATBLEND            = $00001000;
7499
  D3DPSHADECAPS_ALPHAFLATSTIPPLED         = $00002000;
7500
  D3DPSHADECAPS_ALPHAGOURAUDBLEND         = $00004000;
7501
  D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED      = $00008000;
7502
  D3DPSHADECAPS_ALPHAPHONGBLEND           = $00010000;
7503
  D3DPSHADECAPS_ALPHAPHONGSTIPPLED        = $00020000;
7504
 
7505
  D3DPSHADECAPS_FOGFLAT                   = $00040000;
7506
  D3DPSHADECAPS_FOGGOURAUD                = $00080000;
7507
  D3DPSHADECAPS_FOGPHONG                  = $00100000;
7508
 
4 daniel-mar 7509
(* TD3DPrimCaps dwTextureCaps *)
1 daniel-mar 7510
 
4 daniel-mar 7511
(*
7512
 * Perspective-correct texturing is supported
7513
 *)
7514
  D3DPTEXTURECAPS_PERSPECTIVE     = $00000001;
7515
 
7516
(*
7517
 * Power-of-2 texture dimensions are required
7518
 *)
7519
  D3DPTEXTURECAPS_POW2            = $00000002;
7520
 
7521
(*
7522
 * Alpha in texture pixels is supported
7523
 *)
7524
  D3DPTEXTURECAPS_ALPHA           = $00000004;
7525
 
7526
(*
7527
 * Color-keyed textures are supported
7528
 *)
7529
  D3DPTEXTURECAPS_TRANSPARENCY    = $00000008;
7530
 
7531
(*
7532
 * obsolete, see D3DPTADDRESSCAPS_BORDER
7533
 *)
7534
  D3DPTEXTURECAPS_BORDER          = $00000010;
7535
 
7536
(*
7537
 * Only square textures are supported
7538
 *)
7539
  D3DPTEXTURECAPS_SQUAREONLY      = $00000020;
7540
 
7541
(*
7542
 * Texture indices are not scaled by the texture size prior
7543
 * to interpolation.
7544
 *)
1 daniel-mar 7545
  D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040;
7546
 
4 daniel-mar 7547
(*
7548
 * Device can draw alpha from texture palettes
7549
 *)
7550
  D3DPTEXTURECAPS_ALPHAPALETTE    = $00000080;
1 daniel-mar 7551
 
4 daniel-mar 7552
(*
7553
 * Device can use non-POW2 textures if:
7554
 *  1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
7555
 *  2) D3DRS_WRAP(N) is zero for this texture's coordinates
7556
 *  3) mip mapping is not enabled (use magnification filter only)
7557
 *)
7558
  D3DPTEXTURECAPS_NONPOW2CONDITIONAL  = $00000100;
7559
 
7560
// 0x00000200L unused
7561
 
7562
(*
7563
 * Device can divide transformed texture coordinates by the
7564
 * COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
7565
 *)
7566
  D3DPTEXTURECAPS_PROJECTED  = $00000400;
7567
 
7568
(*
7569
 * Device can do cubemap textures
7570
 *)
7571
  D3DPTEXTURECAPS_CUBEMAP           = $00000800;
7572
 
7573
  D3DPTEXTURECAPS_COLORKEYBLEND     = $00001000;
7574
 
7575
 
7576
(* TD3DPrimCaps dwTextureFilterCaps *)
7577
 
7578
  D3DPTFILTERCAPS_NEAREST         = $00000001;
7579
  D3DPTFILTERCAPS_LINEAR          = $00000002;
7580
  D3DPTFILTERCAPS_MIPNEAREST      = $00000004;
7581
  D3DPTFILTERCAPS_MIPLINEAR       = $00000008;
1 daniel-mar 7582
  D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010;
4 daniel-mar 7583
  D3DPTFILTERCAPS_LINEARMIPLINEAR = $00000020;
1 daniel-mar 7584
 
4 daniel-mar 7585
(* Device3 Min Filter *)
1 daniel-mar 7586
  D3DPTFILTERCAPS_MINFPOINT       = $00000100;
7587
  D3DPTFILTERCAPS_MINFLINEAR      = $00000200;
7588
  D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400;
7589
 
4 daniel-mar 7590
(* Device3 Mip Filter *)
1 daniel-mar 7591
  D3DPTFILTERCAPS_MIPFPOINT       = $00010000;
7592
  D3DPTFILTERCAPS_MIPFLINEAR      = $00020000;
7593
 
4 daniel-mar 7594
(* Device3 Mag Filter *)
1 daniel-mar 7595
  D3DPTFILTERCAPS_MAGFPOINT         = $01000000;
7596
  D3DPTFILTERCAPS_MAGFLINEAR        = $02000000;
7597
  D3DPTFILTERCAPS_MAGFANISOTROPIC   = $04000000;
7598
  D3DPTFILTERCAPS_MAGFAFLATCUBIC    = $08000000;
7599
  D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000;
7600
 
4 daniel-mar 7601
(* TD3DPrimCaps dwTextureBlendCaps *)
1 daniel-mar 7602
 
7603
  D3DPTBLENDCAPS_DECAL            = $00000001;
7604
  D3DPTBLENDCAPS_MODULATE         = $00000002;
7605
  D3DPTBLENDCAPS_DECALALPHA       = $00000004;
7606
  D3DPTBLENDCAPS_MODULATEALPHA    = $00000008;
7607
  D3DPTBLENDCAPS_DECALMASK        = $00000010;
7608
  D3DPTBLENDCAPS_MODULATEMASK     = $00000020;
7609
  D3DPTBLENDCAPS_COPY             = $00000040;
4 daniel-mar 7610
  D3DPTBLENDCAPS_ADD                      = $00000080;
1 daniel-mar 7611
 
4 daniel-mar 7612
(* TD3DPrimCaps dwTextureAddressCaps *)
1 daniel-mar 7613
  D3DPTADDRESSCAPS_WRAP           = $00000001;
7614
  D3DPTADDRESSCAPS_MIRROR         = $00000002;
7615
  D3DPTADDRESSCAPS_CLAMP          = $00000004;
7616
  D3DPTADDRESSCAPS_BORDER         = $00000008;
7617
  D3DPTADDRESSCAPS_INDEPENDENTUV  = $00000010;
7618
 
4 daniel-mar 7619
(* D3DDEVICEDESC dwStencilCaps *)
1 daniel-mar 7620
 
4 daniel-mar 7621
  D3DSTENCILCAPS_KEEP     = $00000001;
7622
  D3DSTENCILCAPS_ZERO     = $00000002;
7623
  D3DSTENCILCAPS_REPLACE  = $00000004;
7624
  D3DSTENCILCAPS_INCRSAT  = $00000008;
7625
  D3DSTENCILCAPS_DECRSAT  = $00000010;
7626
  D3DSTENCILCAPS_INVERT   = $00000020;
7627
  D3DSTENCILCAPS_INCR     = $00000040;
7628
  D3DSTENCILCAPS_DECR     = $00000080;
1 daniel-mar 7629
 
4 daniel-mar 7630
(* D3DDEVICEDESC dwTextureOpCaps *)
1 daniel-mar 7631
 
7632
  D3DTEXOPCAPS_DISABLE                    = $00000001;
7633
  D3DTEXOPCAPS_SELECTARG1                 = $00000002;
7634
  D3DTEXOPCAPS_SELECTARG2                 = $00000004;
7635
  D3DTEXOPCAPS_MODULATE                   = $00000008;
7636
  D3DTEXOPCAPS_MODULATE2X                 = $00000010;
7637
  D3DTEXOPCAPS_MODULATE4X                 = $00000020;
7638
  D3DTEXOPCAPS_ADD                        = $00000040;
7639
  D3DTEXOPCAPS_ADDSIGNED                  = $00000080;
7640
  D3DTEXOPCAPS_ADDSIGNED2X                = $00000100;
7641
  D3DTEXOPCAPS_SUBTRACT                   = $00000200;
7642
  D3DTEXOPCAPS_ADDSMOOTH                  = $00000400;
7643
  D3DTEXOPCAPS_BLENDDIFFUSEALPHA          = $00000800;
7644
  D3DTEXOPCAPS_BLENDTEXTUREALPHA          = $00001000;
7645
  D3DTEXOPCAPS_BLENDFACTORALPHA           = $00002000;
7646
  D3DTEXOPCAPS_BLENDTEXTUREALPHAPM        = $00004000;
7647
  D3DTEXOPCAPS_BLENDCURRENTALPHA          = $00008000;
7648
  D3DTEXOPCAPS_PREMODULATE                = $00010000;
7649
  D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR     = $00020000;
7650
  D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA     = $00040000;
7651
  D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR  = $00080000;
7652
  D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA  = $00100000;
7653
  D3DTEXOPCAPS_BUMPENVMAP                 = $00200000;
7654
  D3DTEXOPCAPS_BUMPENVMAPLUMINANCE        = $00400000;
7655
  D3DTEXOPCAPS_DOTPRODUCT3                = $00800000;
7656
 
4 daniel-mar 7657
(* D3DDEVICEDESC dwFVFCaps flags *)
1 daniel-mar 7658
 
4 daniel-mar 7659
  D3DFVFCAPS_TEXCOORDCOUNTMASK    = $0000ffff; (* mask for texture coordinate count field *)
7660
  D3DFVFCAPS_DONOTSTRIPELEMENTS   = $00080000; (* Device prefers that vertex elements not be stripped *)
1 daniel-mar 7661
 
4 daniel-mar 7662
(*
7663
 * Description for a device.
7664
 * This is used to describe a device that is to be created or to query
7665
 * the current device.
7666
 *)
1 daniel-mar 7667
 
7668
type
4 daniel-mar 7669
  PD3DDeviceDesc = ^TD3DDeviceDesc;
7670
  TD3DDeviceDesc = packed record
7671
    dwSize: DWORD;                       (* Size of TD3DDeviceDesc structure *)
7672
    dwFlags: DWORD;                      (* Indicates which fields have valid data *)
7673
    dcmColorModel: TD3DColorModel;        (* Color model of device *)
7674
    dwDevCaps: DWORD;                    (* Capabilities of device *)
7675
    dtcTransformCaps: TD3DTransformCaps;  (* Capabilities of transform *)
7676
    bClipping: BOOL;                     (* Device can do 3D clipping *)
7677
    dlcLightingCaps: TD3DLightingCaps;    (* Capabilities of lighting *)
1 daniel-mar 7678
    dpcLineCaps: TD3DPrimCaps;
7679
    dpcTriCaps: TD3DPrimCaps;
4 daniel-mar 7680
    dwDeviceRenderBitDepth: DWORD;       (* One of DDBB_8, 16, etc.. *)
7681
    dwDeviceZBufferBitDepth: DWORD;      (* One of DDBD_16, 32, etc.. *)
7682
    dwMaxBufferSize: DWORD;              (* Maximum execute buffer size *)
7683
    dwMaxVertexCount: DWORD;             (* Maximum vertex count *)
7684
    // *** New fields for DX5 *** //
1 daniel-mar 7685
 
7686
    // Width and height caps are 0 for legacy HALs.
7687
    dwMinTextureWidth, dwMinTextureHeight  : DWORD;
7688
    dwMaxTextureWidth, dwMaxTextureHeight  : DWORD;
7689
    dwMinStippleWidth, dwMaxStippleWidth   : DWORD;
7690
    dwMinStippleHeight, dwMaxStippleHeight : DWORD;
7691
 
7692
    // New fields for DX6
4 daniel-mar 7693
    dwMaxTextureRepeat : DWORD;
7694
    dwMaxTextureAspectRatio : DWORD;
7695
    dwMaxAnisotropy : DWORD;
1 daniel-mar 7696
 
7697
    // Guard band that the rasterizer can accommodate
7698
    // Screen-space vertices inside this space but outside the viewport
7699
    // will get clipped properly.
4 daniel-mar 7700
    dvGuardBandLeft : TD3DValue;
7701
    dvGuardBandTop : TD3DValue;
7702
    dvGuardBandRight : TD3DValue;
7703
    dvGuardBandBottom : TD3DValue;
1 daniel-mar 7704
 
4 daniel-mar 7705
    dvExtentsAdjust : TD3DValue;
7706
    dwStencilCaps : DWORD;
1 daniel-mar 7707
 
4 daniel-mar 7708
    dwFVFCaps : DWORD;  (* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware *)
7709
    dwTextureOpCaps : DWORD;
7710
    wMaxTextureBlendStages : WORD;
7711
    wMaxSimultaneousTextures : WORD;
7712
  end;
1 daniel-mar 7713
 
7714
  PD3DDeviceDesc7 = ^TD3DDeviceDesc7;
4 daniel-mar 7715
  TD3DDeviceDesc7 = packed record
7716
    dwDevCaps:               DWORD;             (* Capabilities of device *)
7717
    dpcLineCaps:             TD3DPrimCaps;
7718
    dpcTriCaps:              TD3DPrimCaps;
7719
    dwDeviceRenderBitDepth:  DWORD;             (* One of DDBB_8, 16, etc.. *)
7720
    dwDeviceZBufferBitDepth: DWORD;             (* One of DDBD_16, 32, etc.. *)
1 daniel-mar 7721
 
4 daniel-mar 7722
    dwMinTextureWidth, dwMinTextureHeight: DWORD;
7723
    dwMaxTextureWidth, dwMaxTextureHeight: DWORD;
1 daniel-mar 7724
 
4 daniel-mar 7725
    dwMaxTextureRepeat:                    DWORD;
7726
    dwMaxTextureAspectRatio:               DWORD;
7727
    dwMaxAnisotropy:                       DWORD;
1 daniel-mar 7728
 
4 daniel-mar 7729
    dvGuardBandLeft:                       TD3DValue;
7730
    dvGuardBandTop:                        TD3DValue;
7731
    dvGuardBandRight:                      TD3DValue;
7732
    dvGuardBandBottom:                     TD3DValue;
1 daniel-mar 7733
 
4 daniel-mar 7734
    dvExtentsAdjust:                       TD3DValue;
7735
    dwStencilCaps:                         DWORD;
1 daniel-mar 7736
 
4 daniel-mar 7737
    dwFVFCaps:                             DWORD;
7738
    dwTextureOpCaps:                       DWORD;
7739
    wMaxTextureBlendStages:                WORD;
7740
    wMaxSimultaneousTextures:              WORD;
1 daniel-mar 7741
 
4 daniel-mar 7742
    dwMaxActiveLights:                     DWORD;
7743
    dvMaxVertexW:                          TD3DValue;
7744
    deviceGUID:                            TGUID;
1 daniel-mar 7745
 
4 daniel-mar 7746
    wMaxUserClipPlanes:                    WORD;
7747
    wMaxVertexBlendMatrices:               WORD;
1 daniel-mar 7748
 
4 daniel-mar 7749
    dwVertexProcessingCaps:                DWORD;
1 daniel-mar 7750
 
4 daniel-mar 7751
    dwReserved1:                           DWORD;
7752
    dwReserved2:                           DWORD;
7753
    dwReserved3:                           DWORD;
7754
    dwReserved4:                           DWORD;
1 daniel-mar 7755
  end;
7756
 
4 daniel-mar 7757
const
7758
  D3DDEVICEDESCSIZE = sizeof(TD3DDeviceDesc);
7759
  D3DDEVICEDESC7SIZE = sizeof(TD3DDeviceDesc7);
1 daniel-mar 7760
 
7761
type
4 daniel-mar 7762
  TD3DEnumDevicesCallbackA = function (lpGuid: PGUID; // nil for the default device
7763
      lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
7764
      var lpD3DHWDeviceDesc: TD3DDeviceDesc;
7765
      var lpD3DHELDeviceDesc: TD3DDeviceDesc;
7766
      lpContext : pointer) : HResult; stdcall;
7767
  TD3DEnumDevicesCallback = TD3DEnumDevicesCallbackA;
1 daniel-mar 7768
 
4 daniel-mar 7769
  TD3DEnumDevicesCallback7A = function (
7770
      lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
7771
      const lpD3DDeviceDesc: TD3DDeviceDesc7; lpContext: Pointer) : HResult; stdcall;
7772
  TD3DEnumDevicesCallback7 = TD3DEnumDevicesCallback7A;
1 daniel-mar 7773
 
4 daniel-mar 7774
(* TD3DDeviceDesc dwFlags indicating valid fields *)
1 daniel-mar 7775
 
7776
const
4 daniel-mar 7777
  D3DDD_COLORMODEL            = $00000001; (* dcmColorModel is valid *)
7778
  D3DDD_DEVCAPS               = $00000002; (* dwDevCaps is valid *)
7779
  D3DDD_TRANSFORMCAPS         = $00000004; (* dtcTransformCaps is valid *)
7780
  D3DDD_LIGHTINGCAPS          = $00000008; (* dlcLightingCaps is valid *)
7781
  D3DDD_BCLIPPING             = $00000010; (* bClipping is valid *)
7782
  D3DDD_LINECAPS              = $00000020; (* dpcLineCaps is valid *)
7783
  D3DDD_TRICAPS               = $00000040; (* dpcTriCaps is valid *)
7784
  D3DDD_DEVICERENDERBITDEPTH  = $00000080; (* dwDeviceRenderBitDepth is valid *)
7785
  D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; (* dwDeviceZBufferBitDepth is valid *)
7786
  D3DDD_MAXBUFFERSIZE         = $00000200; (* dwMaxBufferSize is valid *)
7787
  D3DDD_MAXVERTEXCOUNT        = $00000400; (* dwMaxVertexCount is valid *)
1 daniel-mar 7788
 
4 daniel-mar 7789
(* TD3DDeviceDesc dwDevCaps flags *)
1 daniel-mar 7790
 
4 daniel-mar 7791
  D3DDEVCAPS_FLOATTLVERTEX        = $00000001; (* Device accepts floating point *)
7792
                                                    (* for post-transform vertex data *)
7793
  D3DDEVCAPS_SORTINCREASINGZ      = $00000002; (* Device needs data sorted for increasing Z*)
7794
  D3DDEVCAPS_SORTDECREASINGZ      = $00000004; (* Device needs data sorted for decreasing Z*)
7795
  D3DDEVCAPS_SORTEXACT            = $00000008; (* Device needs data sorted exactly *)
1 daniel-mar 7796
 
4 daniel-mar 7797
  D3DDEVCAPS_EXECUTESYSTEMMEMORY  = $00000010; (* Device can use execute buffers from system memory *)
7798
  D3DDEVCAPS_EXECUTEVIDEOMEMORY   = $00000020; (* Device can use execute buffers from video memory *)
7799
  D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; (* Device can use TL buffers from system memory *)
7800
  D3DDEVCAPS_TLVERTEXVIDEOMEMORY  = $00000080; (* Device can use TL buffers from video memory *)
7801
  D3DDEVCAPS_TEXTURESYSTEMMEMORY  = $00000100; (* Device can texture from system memory *)
7802
  D3DDEVCAPS_TEXTUREVIDEOMEMORY   = $00000200; (* Device can texture from device memory *)
7803
  D3DDEVCAPS_DRAWPRIMTLVERTEX     = $00000400; (* Device can draw TLVERTEX primitives *)
7804
  D3DDEVCAPS_CANRENDERAFTERFLIP   = $00000800; (* Device can render without waiting for flip to complete *)
7805
  D3DDEVCAPS_TEXTURENONLOCALVIDMEM   = $00001000; (* Device can texture from nonlocal video memory *)
7806
  D3DDEVCAPS_DRAWPRIMITIVES2         = $00002000; (* Device can support DrawPrimitives2 *)
7807
  D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; (* Device is texturing from separate memory pools *)
7808
  D3DDEVCAPS_DRAWPRIMITIVES2EX       = $00008000; (* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*)
7809
  D3DDEVCAPS_HWTRANSFORMANDLIGHT     = $00010000; (* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also *)
7810
  D3DDEVCAPS_CANBLTSYSTONONLOCAL     = $00020000; (* Device supports a Tex Blt from system memory to non-local vidmem *)
7811
  D3DDEVCAPS_HWRASTERIZATION         = $00080000; (* Device has HW acceleration for rasterization *)
1 daniel-mar 7812
 
4 daniel-mar 7813
(*
7814
 * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
7815
 *)
1 daniel-mar 7816
 
4 daniel-mar 7817
(* device can do texgen *)
7818
  D3DVTXPCAPS_TEXGEN              = $00000001;
7819
(* device can do IDirect3DDevice7 colormaterialsource ops *)
7820
  D3DVTXPCAPS_MATERIALSOURCE7     = $00000002;
7821
(* device can do vertex fog *)
7822
  D3DVTXPCAPS_VERTEXFOG           = $00000004;
7823
(* device can do directional lights *)
7824
  D3DVTXPCAPS_DIRECTIONALLIGHTS   = $00000008;
7825
(* device can do positional lights (includes point and spot) *)
7826
  D3DVTXPCAPS_POSITIONALLIGHTS    = $00000010;
7827
(* device can do local viewer *)
7828
  D3DVTXPCAPS_LOCALVIEWER         = $00000020;
1 daniel-mar 7829
 
4 daniel-mar 7830
  D3DFDS_COLORMODEL        = $00000001; (* Match color model *)
7831
  D3DFDS_GUID              = $00000002; (* Match guid *)
7832
  D3DFDS_HARDWARE          = $00000004; (* Match hardware/software *)
7833
  D3DFDS_TRIANGLES         = $00000008; (* Match in triCaps *)
7834
  D3DFDS_LINES             = $00000010; (* Match in lineCaps  *)
7835
  D3DFDS_MISCCAPS          = $00000020; (* Match primCaps.dwMiscCaps *)
7836
  D3DFDS_RASTERCAPS        = $00000040; (* Match primCaps.dwRasterCaps *)
7837
  D3DFDS_ZCMPCAPS          = $00000080; (* Match primCaps.dwZCmpCaps *)
7838
  D3DFDS_ALPHACMPCAPS      = $00000100; (* Match primCaps.dwAlphaCmpCaps *)
7839
  D3DFDS_SRCBLENDCAPS      = $00000200; (* Match primCaps.dwSourceBlendCaps *)
7840
  D3DFDS_DSTBLENDCAPS      = $00000400; (* Match primCaps.dwDestBlendCaps *)
7841
  D3DFDS_SHADECAPS         = $00000800; (* Match primCaps.dwShadeCaps *)
7842
  D3DFDS_TEXTURECAPS       = $00001000; (* Match primCaps.dwTextureCaps *)
7843
  D3DFDS_TEXTUREFILTERCAPS = $00002000; (* Match primCaps.dwTextureFilterCaps *)
7844
  D3DFDS_TEXTUREBLENDCAPS  = $00004000; (* Match primCaps.dwTextureBlendCaps *)
7845
  D3DFDS_TEXTUREADDRESSCAPS  = $00008000; (* Match primCaps.dwTextureBlendCaps *)
1 daniel-mar 7846
 
4 daniel-mar 7847
(*
7848
 * FindDevice arguments
7849
 *)
1 daniel-mar 7850
type
7851
  PD3DFindDeviceSearch = ^TD3DFindDeviceSearch;
4 daniel-mar 7852
  TD3DFindDeviceSearch = packed record
1 daniel-mar 7853
    dwSize: DWORD;
7854
    dwFlags: DWORD;
7855
    bHardware: BOOL;
7856
    dcmColorModel: TD3DColorModel;
7857
    guid: TGUID;
7858
    dwCaps: DWORD;
7859
    dpcPrimCaps: TD3DPrimCaps;
7860
  end;
7861
 
7862
  PD3DFindDeviceResult = ^TD3DFindDeviceResult;
4 daniel-mar 7863
  TD3DFindDeviceResult = packed record
1 daniel-mar 7864
    dwSize: DWORD;
4 daniel-mar 7865
    guid: TGUID;               (* guid which matched *)
7866
    ddHwDesc: TD3DDeviceDesc;   (* hardware TD3DDeviceDesc *)
7867
    ddSwDesc: TD3DDeviceDesc;   (* software TD3DDeviceDesc *)
1 daniel-mar 7868
  end;
7869
 
4 daniel-mar 7870
(*
7871
 * Description of execute buffer.
7872
 *)
1 daniel-mar 7873
  PD3DExecuteBufferDesc = ^TD3DExecuteBufferDesc;
4 daniel-mar 7874
  TD3DExecuteBufferDesc = packed record
7875
    dwSize: DWORD;         (* size of this structure *)
7876
    dwFlags: DWORD;        (* flags indicating which fields are valid *)
7877
    dwCaps: DWORD;         (* capabilities of execute buffer *)
7878
    dwBufferSize: DWORD;   (* size of execute buffer data *)
7879
    lpData: Pointer;       (* pointer to actual data *)
1 daniel-mar 7880
  end;
7881
 
4 daniel-mar 7882
(* D3DEXECUTEBUFFER dwFlags indicating valid fields *)
1 daniel-mar 7883
 
7884
const
4 daniel-mar 7885
  D3DDEB_BUFSIZE          = $00000001;     (* buffer size valid *)
7886
  D3DDEB_CAPS             = $00000002;     (* caps valid *)
7887
  D3DDEB_LPDATA           = $00000004;     (* lpData valid *)
1 daniel-mar 7888
 
4 daniel-mar 7889
(* D3DEXECUTEBUFFER dwCaps *)
1 daniel-mar 7890
 
4 daniel-mar 7891
  D3DDEBCAPS_SYSTEMMEMORY = $00000001;     (* buffer in system memory *)
7892
  D3DDEBCAPS_VIDEOMEMORY  = $00000002;     (* buffer in device memory *)
7893
  D3DDEBCAPS_MEM          = (D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY);
1 daniel-mar 7894
 
7895
type
7896
  PD3DDevInfo_TextureManager = ^TD3DDevInfo_TextureManager;
4 daniel-mar 7897
  TD3DDevInfo_TextureManager = packed record
7898
    bThrashing:              BOOL;       (* indicates if thrashing *)
7899
    dwApproxBytesDownloaded: DWORD;      (* Approximate number of bytes downloaded by texture manager *)
7900
    dwNumEvicts:             DWORD;      (* number of textures evicted *)
7901
    dwNumVidCreates:         DWORD;      (* number of textures created in video memory *)
7902
    dwNumTexturesUsed:       DWORD;      (* number of textures used *)
7903
    dwNumUsedTexInVid:       DWORD;      (* number of used textures present in video memory *)
7904
    dwWorkingSet:            DWORD;      (* number of textures in video memory *)
7905
    dwWorkingSetBytes:       DWORD;      (* number of bytes in video memory *)
7906
    dwTotalManaged:          DWORD;      (* total number of managed textures *)
7907
    dwTotalBytes:            DWORD;      (* total number of bytes of managed textures *)
7908
    dwLastPri:               DWORD;      (* priority of last texture evicted *)
1 daniel-mar 7909
  end;
7910
 
7911
  PD3DDevInfo_Texturing = ^TD3DDevInfo_Texturing;
4 daniel-mar 7912
  TD3DDevInfo_Texturing = packed record
7913
    dwNumLoads:          DWORD;          (* counts Load() API calls *)
7914
    dwApproxBytesLoaded: DWORD;          (* Approximate number bytes loaded via Load() *)
7915
    dwNumPreLoads:       DWORD;          (* counts PreLoad() API calls *)
7916
    dwNumSet:            DWORD;          (* counts SetTexture() API calls *)
7917
    dwNumCreates:        DWORD;          (* counts texture creates *)
7918
    dwNumDestroys:       DWORD;          (* counts texture destroys *)
7919
    dwNumSetPriorities:  DWORD;          (* counts SetPriority() API calls *)
7920
    dwNumSetLODs:        DWORD;          (* counts SetLOD() API calls *)
7921
    dwNumLocks:          DWORD;          (* counts number of texture locks *)
7922
    dwNumGetDCs:         DWORD;          (* counts number of GetDCs to textures *)
1 daniel-mar 7923
  end;
7924
 
7925
(*==========================================================================;
7926
 *
7927
 *
4 daniel-mar 7928
 *  File:   d3d.h
1 daniel-mar 7929
 *  Content:    Direct3D include file
7930
 *
4 daniel-mar 7931
 ****************************************************************************)
1 daniel-mar 7932
 
4 daniel-mar 7933
function D3DErrorString(Value: HResult) : string;
1 daniel-mar 7934
 
4 daniel-mar 7935
(*
7936
 * Interface IID's
7937
 *)
7938
 
1 daniel-mar 7939
const
4 daniel-mar 7940
(*
7941
 * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer
7942
 *)
7943
  IID_IDirect3DRampDevice: TGUID =
7944
      (D1:$F2086B20;D2:$259F;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
7945
  IID_IDirect3DRGBDevice: TGUID =
7946
      (D1:$A4665C60;D2:$2673;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
7947
  IID_IDirect3DHALDevice: TGUID =
7948
      (D1:$84E63dE0;D2:$46AA;D3:$11CF;D4:($81,$6F,$00,$00,$C0,$20,$15,$6E));
7949
  IID_IDirect3DMMXDevice: TGUID =
7950
      (D1:$881949a1;D2:$d6f3;D3:$11d0;D4:($89,$ab,$00,$a0,$c9,$05,$41,$29));
1 daniel-mar 7951
 
4 daniel-mar 7952
  IID_IDirect3DRefDevice: TGUID =
7953
      (D1:$50936643;D2:$13e9;D3:$11d1;D4:($89,$aa,$00,$a0,$c9,$05,$41,$29));
7954
  IID_IDirect3DNullDevice: TGUID =
7955
      (D1:$8767df22;D2:$bacc;D3:$11d1;D4:($89,$69,$00,$a0,$c9,$06,$29,$a8));
1 daniel-mar 7956
 
4 daniel-mar 7957
  IID_IDirect3DTnLHalDevice: TGUID = '{f5049e78-4861-11d2-a407-00a0c90629a8}';
1 daniel-mar 7958
 
7959
type
7960
  IDirect3D = interface;
7961
  IDirect3D2 = interface;
7962
  IDirect3D3 = interface;
7963
  IDirect3D7 = interface;
7964
  IDirect3DDevice = interface;
7965
  IDirect3DDevice2 = interface;
7966
  IDirect3DDevice3 = interface;
7967
  IDirect3DDevice7 = interface;
7968
  IDirect3DExecuteBuffer = interface;
7969
  IDirect3DLight = interface;
7970
  IDirect3DMaterial = interface;
7971
  IDirect3DMaterial2 = interface;
7972
  IDirect3DMaterial3 = interface;
7973
  IDirect3DTexture = interface;
7974
  IDirect3DTexture2 = interface;
7975
  IDirect3DViewport = interface;
7976
  IDirect3DViewport2 = interface;
7977
  IDirect3DViewport3 = interface;
7978
  IDirect3DVertexBuffer = interface;
7979
  IDirect3DVertexBuffer7 = interface;
7980
 
4 daniel-mar 7981
(*
7982
 * Direct3D interfaces
7983
 *)
7984
 
7985
  IDirect3D = interface (IUnknown)
1 daniel-mar 7986
    ['{3BBA0080-2421-11CF-A31A-00AA00B93356}']
4 daniel-mar 7987
    (*** IDirect3D methods ***)
7988
    function Initialize (lpREFIID: {REFIID} PGUID) : HResult; stdcall;
7989
    function EnumDevices (lpEnumDevicesCallback: TD3DEnumDevicesCallback;
7990
        lpUserArg: Pointer) : HResult; stdcall;
7991
    function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
7992
        pUnkOuter: IUnknown) : HResult; stdcall;
7993
    function CreateMaterial (var lplpDirect3DMaterial: IDirect3DMaterial;
7994
        pUnkOuter: IUnknown) : HResult; stdcall;
7995
    function CreateViewport (var lplpD3DViewport: IDirect3DViewport;
7996
        pUnkOuter: IUnknown) : HResult; stdcall;
7997
    function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
7998
        var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
1 daniel-mar 7999
  end;
8000
 
4 daniel-mar 8001
  IDirect3D2 = interface (IUnknown)
8002
    ['{6aae1ec1-662a-11d0-889d-00aa00bbb76a}']
8003
    (*** IDirect3D2 methods ***)
1 daniel-mar 8004
    function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
4 daniel-mar 8005
        lpUserArg: pointer) : HResult; stdcall;
8006
    function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
8007
        pUnkOuter: IUnknown) : HResult; stdcall;
8008
    function CreateMaterial (var lplpDirect3DMaterial2: IDirect3DMaterial2;
8009
        pUnkOuter: IUnknown) : HResult; stdcall;
8010
    function CreateViewport (var lplpD3DViewport2: IDirect3DViewport2;
8011
        pUnkOuter: IUnknown) : HResult; stdcall;
8012
    function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
8013
        var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
8014
    function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface;
8015
        out lplpD3DDevice2: IDirect3DDevice2) : HResult; stdcall;
1 daniel-mar 8016
  end;
8017
 
4 daniel-mar 8018
  IDirect3D3 = interface (IUnknown)
8019
    ['{bb223240-e72b-11d0-a9b4-00aa00c0993e}']
8020
    (*** IDirect3D3 methods ***)
1 daniel-mar 8021
    function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
4 daniel-mar 8022
        lpUserArg: pointer) : HResult; stdcall;
8023
    function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
8024
        pUnkOuter: IUnknown) : HResult; stdcall;
8025
    function CreateMaterial (var lplpDirect3DMaterial3: IDirect3DMaterial3;
8026
        pUnkOuter: IUnknown) : HResult; stdcall;
8027
    function CreateViewport (var lplpD3DViewport3: IDirect3DViewport3;
8028
        pUnkOuter: IUnknown) : HResult; stdcall;
8029
    function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
8030
        var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
8031
    function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface4;
8032
        out lplpD3DDevice: IDirect3DDevice3; pUnkOuter: IUnknown) : HResult; stdcall;
8033
    function CreateVertexBuffer (var lpVBDesc: TD3DVertexBufferDesc;
8034
        var lpD3DVertexBuffer: IDirect3DVertexBuffer;
8035
        dwFlags: DWORD; pUnkOuter: IUnknown) : HResult; stdcall;
8036
    function EnumZBufferFormats (const riidDevice: TRefClsID; lpEnumCallback:
8037
        TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
8038
    function EvictManagedTextures : HResult; stdcall;
1 daniel-mar 8039
  end;
8040
 
4 daniel-mar 8041
  IDirect3D7 = interface (IUnknown)
8042
    ['{f5049e77-4861-11d2-a407-00a0c90629a8}']
8043
    (*** IDirect3D7 methods ***)
1 daniel-mar 8044
    function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback7;
4 daniel-mar 8045
        lpUserArg: pointer) : HResult; stdcall;
8046
    function CreateDevice (const rclsid: TGUID; lpDDS: IDirectDrawSurface7;
8047
        out lplpD3DDevice: IDirect3DDevice7) : HResult; stdcall;
8048
    function CreateVertexBuffer (const lpVBDesc: TD3DVertexBufferDesc;
8049
        out lplpD3DVertexBuffer: IDirect3DVertexBuffer7;
8050
        dwFlags: DWORD) : HResult; stdcall;
8051
    function EnumZBufferFormats (const riidDevice: TGUID; lpEnumCallback:
8052
        TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
8053
    function EvictManagedTextures : HResult; stdcall;
1 daniel-mar 8054
  end;
4 daniel-mar 8055
 
8056
(*
8057
 * Direct3D Device interfaces
8058
 *)
1 daniel-mar 8059
 
4 daniel-mar 8060
  IDirect3DDevice = interface (IUnknown)
8061
    ['{64108800-957d-11d0-89ab-00a0c9054129}']
8062
    (*** IDirect3DDevice methods ***)
8063
    function Initialize (lpd3d: IDirect3D; lpGUID: PGUID;
8064
        var lpd3ddvdesc: TD3DDeviceDesc) : HResult; stdcall;
8065
    function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
8066
        var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
8067
    function SwapTextureHandles (lpD3DTex1: IDirect3DTexture;
8068
        lpD3DTex2: IDirect3DTexture) : HResult; stdcall;
8069
    function CreateExecuteBuffer (var lpDesc: TD3DExecuteBufferDesc ;
8070
        var lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
8071
        pUnkOuter: IUnknown) : HResult; stdcall;
8072
    function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
8073
    function Execute (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
8074
        lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
8075
    function AddViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
8076
    function DeleteViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
8077
    function NextViewport (lpDirect3DViewport: IDirect3DViewport;
8078
        var lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
8079
    function Pick (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
1 daniel-mar 8080
        lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD;
4 daniel-mar 8081
        var lpRect: TD3DRect) : HResult; stdcall;
8082
    function GetPickRecords (var lpCount: DWORD;
8083
        var lpD3DPickRec: TD3DPickRecord) : HResult; stdcall;
8084
    function EnumTextureFormats (lpd3dEnumTextureProc:
8085
        TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
8086
        HResult; stdcall;
8087
    function CreateMatrix (var lpD3DMatHandle: TD3DMatrixHandle) : HResult; stdcall;
8088
    function SetMatrix (d3dMatHandle: TD3DMatrixHandle;
8089
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8090
    function GetMatrix (var lpD3DMatHandle: TD3DMatrixHandle;
8091
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8092
    function DeleteMatrix (d3dMatHandle: TD3DMatrixHandle) : HResult; stdcall;
1 daniel-mar 8093
    function BeginScene: HResult; stdcall;
8094
    function EndScene: HResult; stdcall;
4 daniel-mar 8095
    function GetDirect3D (var lpD3D: IDirect3D) : HResult; stdcall;
1 daniel-mar 8096
  end;
8097
 
4 daniel-mar 8098
  IDirect3DDevice2 = interface (IUnknown)
8099
    ['{93281501-8cf8-11d0-89ab-00a0c9054129}']
8100
    (*** IDirect3DDevice2 methods ***)
8101
    function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
8102
        var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
8103
    function SwapTextureHandles (lpD3DTex1: IDirect3DTexture2;
8104
        lpD3DTex2: IDirect3DTexture2) : HResult; stdcall;
8105
    function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
8106
    function AddViewport (lpDirect3DViewport2: IDirect3DViewport2) : HResult; stdcall;
8107
    function DeleteViewport (lpDirect3DViewport: IDirect3DViewport2) : HResult; stdcall;
8108
    function NextViewport (lpDirect3DViewport: IDirect3DViewport2;
8109
        var lplpDirect3DViewport: IDirect3DViewport2; dwFlags: DWORD) :
8110
        HResult; stdcall;
8111
    function EnumTextureFormats (
8112
        lpd3dEnumTextureProc: TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
8113
        HResult; stdcall;
1 daniel-mar 8114
    function BeginScene: HResult; stdcall;
8115
    function EndScene: HResult; stdcall;
4 daniel-mar 8116
    function GetDirect3D (var lpD3D: IDirect3D2) : HResult; stdcall;
8117
 
8118
    (*** DrawPrimitive API ***)
8119
    function SetCurrentViewport (lpd3dViewport2: IDirect3DViewport2)
8120
        : HResult; stdcall;
8121
    function GetCurrentViewport (var lplpd3dViewport2: IDirect3DViewport2)
8122
        : HResult; stdcall;
8123
 
8124
    function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface)
8125
        : HResult; stdcall;
8126
    function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface)
8127
        : HResult; stdcall;
8128
 
8129
    function Begin_ (d3dpt: TD3DPrimitiveType; d3dvt: TD3DVertexType;
8130
        dwFlags: DWORD) : HResult; stdcall;
8131
    function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType; dvtVertexType:
8132
        TD3DVertexType; lpvVertices: pointer; dwNumVertices: DWORD;
8133
        dwFlags: DWORD) : HResult; stdcall;
8134
    function Vertex (lpVertexType: pointer) : HResult;  stdcall;
8135
    function Index (wVertexIndex: WORD) : HResult;  stdcall;
8136
    function End_ (dwFlags: DWORD) : HResult; stdcall;
8137
 
8138
    function GetRenderState (dwRenderStateType: TD3DRenderStateType;
8139
        var lpdwRenderState) : HResult; stdcall;
8140
    function SetRenderState (dwRenderStateType: TD3DRenderStateType;
8141
        dwRenderState: DWORD) : HResult; stdcall;
8142
    function GetLightState (dwLightStateType: TD3DLightStateType;
8143
        var lpdwLightState) : HResult; stdcall;
8144
    function SetLightState (dwLightStateType: TD3DLightStateType;
8145
        dwLightState: DWORD) : HResult; stdcall;
8146
    function SetTransform (dtstTransformStateType: TD3DTransformStateType;
8147
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8148
    function GetTransform (dtstTransformStateType: TD3DTransformStateType;
8149
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8150
    function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
8151
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8152
 
8153
    function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
8154
        dvtVertexType: TD3DVertexType; var lpvVertices; dwVertexCount,
8155
        dwFlags: DWORD) : HResult; stdcall;
8156
    function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
8157
        dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwVertexCount: DWORD;
8158
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8159
    function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
8160
    function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
1 daniel-mar 8161
  end;
8162
 
4 daniel-mar 8163
  IDirect3DDevice3 = interface (IUnknown)
8164
    ['{b0ab3b60-33d7-11d1-a981-00c04fd7b174}']
8165
    (*** IDirect3DDevice2 methods ***)
8166
    function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
8167
        var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
8168
    function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
8169
    function AddViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
8170
    function DeleteViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
8171
    function NextViewport (lpDirect3DViewport: IDirect3DViewport3;
8172
        var lplpAnotherViewport: IDirect3DViewport3; dwFlags: DWORD) : HResult; stdcall;
8173
    function EnumTextureFormats (
8174
        lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) :
8175
        HResult; stdcall;
1 daniel-mar 8176
    function BeginScene: HResult; stdcall;
8177
    function EndScene: HResult; stdcall;
4 daniel-mar 8178
    function GetDirect3D (var lpD3D: IDirect3D3) : HResult; stdcall;
8179
    function SetCurrentViewport (lpd3dViewport: IDirect3DViewport3)
8180
        : HResult; stdcall;
8181
    function GetCurrentViewport (var lplpd3dViewport: IDirect3DViewport3)
8182
        : HResult; stdcall;
8183
    function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface4)
8184
        : HResult; stdcall;
8185
    function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface4)
8186
        : HResult; stdcall;
8187
    function Begin_ (d3dpt: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
8188
        dwFlags: DWORD) : HResult; stdcall;
8189
    function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType;
8190
        dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwNumVertices: DWORD;
8191
        dwFlags: DWORD) : HResult; stdcall;
8192
    function Vertex (lpVertex: pointer) : HResult;  stdcall;
8193
    function Index (wVertexIndex: WORD) : HResult;  stdcall;
8194
    function End_ (dwFlags: DWORD) : HResult; stdcall;
8195
    function GetRenderState (dwRenderStateType: TD3DRenderStateType;
8196
        var lpdwRenderState) : HResult; stdcall;
8197
    function SetRenderState (dwRenderStateType: TD3DRenderStateType;
8198
        dwRenderState: DWORD) : HResult; stdcall;
8199
    function GetLightState (dwLightStateType: TD3DLightStateType;
8200
        var lpdwLightState) : HResult; stdcall;
8201
    function SetLightState (dwLightStateType: TD3DLightStateType;
8202
        dwLightState: DWORD) : HResult; stdcall;
8203
    function SetTransform (dtstTransformStateType: TD3DTransformStateType;
8204
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8205
    function GetTransform (dtstTransformStateType: TD3DTransformStateType;
8206
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8207
    function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
8208
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8209
    function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
8210
        dwVertexTypeDesc: DWORD; const lpvVertices;
8211
        dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
8212
    function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
8213
        dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
8214
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8215
    function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
8216
    function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
8217
    function DrawPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
8218
        dwVertexTypeDesc : DWORD;
8219
        var lpVertexArray: TD3DDrawPrimitiveStridedData;
8220
        dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
8221
    function DrawIndexedPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
8222
        dwVertexTypeDesc : DWORD;
8223
        var lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
8224
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8225
    function DrawPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
8226
        lpd3dVertexBuffer: IDirect3DVertexBuffer;
8227
        dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
8228
    function DrawIndexedPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
8229
        lpd3dVertexBuffer: IDirect3DVertexBuffer; var lpwIndices: WORD;
8230
        dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8231
    function ComputeSphereVisibility (var lpCenters: TD3DVector;
8232
        var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
8233
        var lpdwReturnValues: DWORD) : HResult; stdcall;
8234
    function GetTexture (dwStage: DWORD; var lplpTexture: IDirect3DTexture2)
8235
        : HResult; stdcall;
8236
    function SetTexture (dwStage: DWORD; lplpTexture: IDirect3DTexture2)
8237
        : HResult; stdcall;
8238
    function GetTextureStageState (dwStage: DWORD;
8239
        dwState: TD3DTextureStageStateType; var lpdwValue: DWORD) : HResult; stdcall;
8240
    function SetTextureStageState (dwStage: DWORD;
8241
        dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
8242
    function ValidateDevice (var lpdwExtraPasses: DWORD) : HResult; stdcall;
8243
  end;
8244
 
8245
  IDirect3DDevice7 = interface (IUnknown)
8246
    ['{f5049e79-4861-11d2-a407-00a0c90629a8}']
8247
    (*** IDirect3DDevice7 methods ***)
8248
    function GetCaps(out lpD3DDevDesc: TD3DDeviceDesc7) : HResult; stdcall;
8249
    function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) : HResult; stdcall;
8250
    function BeginScene: HResult; stdcall;
8251
    function EndScene: HResult; stdcall;
8252
    function GetDirect3D(out lpD3D: IDirect3D7) : HResult; stdcall;
8253
    function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface7; dwFlags: DWORD) : HResult; stdcall;
8254
    function GetRenderTarget(out lplpRenderTarget: IDirectDrawSurface7) : HResult; stdcall;
8255
    function Clear(dwCount: DWORD; lpRects: PD3DRect; dwFlags, dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
1 daniel-mar 8256
    function SetTransform(dtstTransformStateType: TD3DTransformStateType;
4 daniel-mar 8257
        const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
1 daniel-mar 8258
    function GetTransform(dtstTransformStateType: TD3DTransformStateType;
4 daniel-mar 8259
        out lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8260
    function SetViewport(const lpViewport: TD3DViewport7) : HResult; stdcall;
1 daniel-mar 8261
    function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType;
4 daniel-mar 8262
        const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8263
    function GetViewport(out lpViewport: TD3DViewport7) : HResult; stdcall;
8264
    function SetMaterial(const lpMaterial: TD3DMaterial7) : HResult; stdcall;
8265
    function GetMaterial(out lpMaterial: TD3DMaterial7) : HResult; stdcall;
8266
    function SetLight(dwLightIndex: DWORD; const lpLight: TD3DLight7) : HResult; stdcall;
8267
    function GetLight(dwLightIndex: DWORD; out lpLight: TD3DLight7) : HResult; stdcall;
8268
    function SetRenderState(dwRenderStateType: TD3DRenderStateType; dwRenderState: DWORD) : HResult; stdcall;
8269
    function GetRenderState(dwRenderStateType: TD3DRenderStateType; out dwRenderState: DWORD) : HResult; stdcall;
8270
    function BeginStateBlock : HResult; stdcall;
8271
    function EndStateBlock(out lpdwBlockHandle: DWORD) : HResult; stdcall;
8272
    function PreLoad(lpddsTexture: IDirectDrawSurface7) : HResult; stdcall;
1 daniel-mar 8273
    function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8274
        dwVertexTypeDesc: DWORD; const lpvVertices;
8275
        dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8276
    function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8277
        dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
8278
        const lpwIndices; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8279
    function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
8280
    function GetClipStatus(out lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
1 daniel-mar 8281
    function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8282
        dwVertexTypeDesc : DWORD;
8283
        const lpVertexArray: TD3DDrawPrimitiveStridedData;
8284
        dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8285
    function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8286
        dwVertexTypeDesc : DWORD;
8287
        const lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
8288
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8289
    function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8290
        lpd3dVertexBuffer: IDirect3DVertexBuffer7;
8291
        dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8292
    function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8293
        lpd3dVertexBuffer: IDirect3DVertexBuffer7; dwStartVertex, dwNumVertices: DWORD;
8294
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8295
    function ComputeSphereVisibility(const lpCenters: TD3DVector;
8296
        var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
8297
        var lpdwReturnValues: DWORD) : HResult; stdcall;
8298
    function GetTexture(dwStage: DWORD; out lplpTexture: IDirectDrawSurface7) : HResult; stdcall;
8299
    function SetTexture(dwStage: DWORD; lpTexture: IDirectDrawSurface7) : HResult; stdcall;
8300
    function GetTextureStageState(dwStage: DWORD;
8301
        dwState: TD3DTextureStageStateType; out lpdwValue: DWORD) : HResult; stdcall;
8302
    function SetTextureStageState(dwStage: DWORD;
8303
        dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
8304
    function ValidateDevice(out lpdwExtraPasses: DWORD) : HResult; stdcall;
8305
    function ApplyStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
8306
    function CaptureStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
8307
    function DeleteStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
8308
    function CreateStateBlock(d3dsbType: TD3DStateBlockType; out lpdwBlockHandle: DWORD) : HResult; stdcall;
8309
    function Load(lpDestTex: IDirectDrawSurface7; lpDestPoint: PPoint;
8310
        lpSrcTex: IDirectDrawSurface7; lprcSrcRect: PRect; dwFlags: DWORD) : HResult; stdcall;
8311
    function LightEnable(dwLightIndex: DWORD; bEnable: BOOL) : HResult; stdcall;
8312
    function GetLightEnable(dwLightIndex: DWORD; out bEnable: BOOL) : HResult; stdcall;
8313
    function SetClipPlane(dwIndex: DWORD; var pPlaneEquation: TD3DValue) : HResult; stdcall;
8314
    function GetClipPlane(dwIndex: DWORD; out pPlaneEquation: TD3DValue) : HResult; stdcall;
8315
    function GetInfo(dwDevInfoID: DWORD; pDevInfoStruct: Pointer; dwSize: DWORD) : HResult; stdcall;
1 daniel-mar 8316
  end;
4 daniel-mar 8317
 
8318
(*
8319
 * Execute Buffer interface
8320
 *)
1 daniel-mar 8321
 
4 daniel-mar 8322
  IDirect3DExecuteBuffer = interface (IUnknown)
1 daniel-mar 8323
    ['{4417C145-33AD-11CF-816F-0000C020156E}']
4 daniel-mar 8324
    (*** IDirect3DExecuteBuffer methods ***)
8325
    function Initialize (lpDirect3DDevice: IDirect3DDevice;
8326
        var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
8327
    function Lock (var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
1 daniel-mar 8328
    function Unlock: HResult; stdcall;
4 daniel-mar 8329
    function SetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
8330
    function GetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
8331
    function Validate (var lpdwOffset: DWORD; lpFunc: TD3DValidateCallback;
8332
        lpUserArg: Pointer; dwReserved: DWORD) : HResult; stdcall;
8333
    (*** Warning!  Optimize is defined differently in the header files
8334
         and the online documentation ***)
8335
    function Optimize (dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8336
  end;
8337
 
4 daniel-mar 8338
(*
8339
 * Light interfaces
8340
 *)
8341
 
8342
  IDirect3DLight = interface (IUnknown)
1 daniel-mar 8343
    ['{4417C142-33AD-11CF-816F-0000C020156E}']
4 daniel-mar 8344
    (*** IDirect3DLight methods ***)
8345
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8346
    function SetLight (var lpLight: TD3DLight2) : HResult; stdcall;
8347
    function GetLight (var lpLight: TD3DLight2) : HResult; stdcall;
1 daniel-mar 8348
  end;
8349
 
4 daniel-mar 8350
(*
8351
 * Material interfaces
8352
 *)
8353
 
8354
  IDirect3DMaterial = interface (IUnknown)
1 daniel-mar 8355
    ['{4417C144-33AD-11CF-816F-0000C020156E}']
4 daniel-mar 8356
    (*** IDirect3DMaterial methods ***)
8357
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8358
    function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8359
    function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8360
    function GetHandle (lpDirect3DDevice: IDirect3DDevice;
8361
        var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
1 daniel-mar 8362
    function Reserve: HResult; stdcall;
8363
    function Unreserve: HResult; stdcall;
8364
  end;
8365
 
4 daniel-mar 8366
  IDirect3DMaterial2 = interface (IUnknown)
8367
    ['{93281503-8cf8-11d0-89ab-00a0c9054129}']
8368
    (*** IDirect3DMaterial2 methods ***)
8369
    function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8370
    function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8371
    function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
8372
        var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
1 daniel-mar 8373
  end;
8374
 
4 daniel-mar 8375
  IDirect3DMaterial3 = interface (IUnknown)
8376
    ['{ca9c46f4-d3c5-11d1-b75a-00600852b312}']
8377
    (*** IDirect3DMaterial2 methods ***)
8378
    function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8379
    function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8380
    function GetHandle (lpDirect3DDevice: IDirect3DDevice3;
8381
        var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
1 daniel-mar 8382
  end;
8383
 
4 daniel-mar 8384
(*
8385
 * Texture interfaces
8386
 *)
8387
 
8388
  IDirect3DTexture = interface (IUnknown)
1 daniel-mar 8389
    ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}']
4 daniel-mar 8390
    (*** IDirect3DTexture methods ***)
8391
    function Initialize (lpD3DDevice: IDirect3DDevice;
8392
        lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
8393
    function GetHandle (lpDirect3DDevice: IDirect3DDevice;
8394
        var lpHandle: TD3DTextureHandle) : HResult; stdcall;
8395
    function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
8396
    function Load (lpD3DTexture: IDirect3DTexture) : HResult; stdcall;
1 daniel-mar 8397
    function Unload: HResult; stdcall;
8398
  end;
8399
 
4 daniel-mar 8400
  IDirect3DTexture2 = interface (IUnknown)
8401
    ['{93281502-8cf8-11d0-89ab-00a0c9054129}']
8402
    (*** IDirect3DTexture2 methods ***)
8403
    function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
8404
        var lpHandle: TD3DTextureHandle) : HResult; stdcall;
8405
    function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
8406
    function Load (lpD3DTexture: IDirect3DTexture2) : HResult; stdcall;
1 daniel-mar 8407
  end;
8408
 
4 daniel-mar 8409
(*
8410
 * Viewport interfaces
8411
 *)
8412
 
8413
  IDirect3DViewport = interface (IUnknown)
1 daniel-mar 8414
    ['{4417C146-33AD-11CF-816F-0000C020156E}']
4 daniel-mar 8415
    (*** IDirect3DViewport methods ***)
8416
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8417
    function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
8418
    function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
8419
    function TransformVertices (dwVertexCount: DWORD;
8420
        const lpData: TD3DTransformData; dwFlags: DWORD;
8421
        out lpOffscreen: DWORD) : HResult; stdcall;
8422
    function LightElements (dwElementCount: DWORD;
8423
        var lpData: TD3DLightData) : HResult; stdcall;
8424
    function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
8425
    function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
8426
    function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
8427
        HResult; stdcall;
8428
    function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
8429
        out lpValid: BOOL) : HResult; stdcall;
8430
    function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
8431
        HResult; stdcall;
8432
    function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8433
    function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8434
     function NextLight (lpDirect3DLight: IDirect3DLight;
8435
        out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8436
  end;
8437
 
4 daniel-mar 8438
  IDirect3DViewport2 = interface (IUnknown)
8439
    ['{93281500-8cf8-11d0-89ab-00a0c9054129}']
8440
    (*** IDirect3DViewport2 methods ***)
8441
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8442
    function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
8443
    function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
8444
    function TransformVertices (dwVertexCount: DWORD;
8445
        const lpData: TD3DTransformData; dwFlags: DWORD;
8446
        out lpOffscreen: DWORD) : HResult; stdcall;
8447
    function LightElements (dwElementCount: DWORD;
8448
        var lpData: TD3DLightData) : HResult; stdcall;
8449
    function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
8450
    function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
8451
    function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
8452
        HResult; stdcall;
8453
    function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
8454
        out lpValid: BOOL) : HResult; stdcall;
8455
    function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
8456
        HResult; stdcall;
8457
    function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8458
    function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8459
    function NextLight (lpDirect3DLight: IDirect3DLight;
8460
        out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
8461
    (*** IDirect3DViewport2 methods ***)
8462
    function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
8463
    function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
1 daniel-mar 8464
  end;
8465
 
4 daniel-mar 8466
  IDirect3DViewport3 = interface (IUnknown)
8467
    ['{b0ab3b61-33d7-11d1-a981-00c04fd7b174}']
8468
    (*** IDirect3DViewport3 methods ***)
8469
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8470
    function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
8471
    function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
8472
    function TransformVertices (dwVertexCount: DWORD;
8473
        const lpData: TD3DTransformData; dwFlags: DWORD;
8474
        out lpOffscreen: DWORD) : HResult; stdcall;
8475
    function LightElements (dwElementCount: DWORD;
8476
        var lpData: TD3DLightData) : HResult; stdcall;
8477
    function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
8478
    function GetBackground (var hMat: TD3DMaterialHandle) : HResult; stdcall;
8479
    function SetBackgroundDepth (
8480
        lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
8481
    function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
8482
        out lpValid: BOOL) : HResult; stdcall;
8483
    function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
8484
        HResult; stdcall;
8485
    function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8486
    function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8487
    function NextLight (lpDirect3DLight: IDirect3DLight;
8488
        out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
8489
    function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
8490
    function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
8491
    function SetBackgroundDepth2 (
8492
        lpDDSurface: IDirectDrawSurface4) : HResult; stdcall;
8493
    function GetBackgroundDepth2 (out lplpDDSurface: IDirectDrawSurface4;
8494
        out lpValid: BOOL) : HResult; stdcall;
8495
    function Clear2 (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD;
8496
        dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
1 daniel-mar 8497
  end;
8498
 
4 daniel-mar 8499
  IDirect3DVertexBuffer = interface (IUnknown)
8500
    ['{7a503555-4a83-11d1-a5db-00a0c90367f8}']
8501
    (*** IDirect3DVertexBuffer methods ***)
8502
    function Lock (dwFlags: DWORD; var lplpData: pointer; var lpdwSize: DWORD)
8503
        : HResult; stdcall;
8504
    function Unlock : HResult; stdcall;
8505
    function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
8506
        lpSrcBuffer: IDirect3DVertexBuffer; dwSrcIndex: DWORD;
8507
        lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
8508
    function GetVertexBufferDesc (var lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
8509
    function Optimize(lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8510
  end;
8511
 
4 daniel-mar 8512
  IDirect3DVertexBuffer7 = interface (IUnknown)
8513
    ['{f5049e7d-4861-11d2-a407-00a0c90629a8}']
8514
    (*** IDirect3DVertexBuffer methods ***)
8515
    function Lock (dwFlags: DWORD; out lplpData: Pointer; out lpdwSize: DWORD) : HResult; stdcall;
8516
    function Unlock : HResult; stdcall;
8517
    function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
8518
        lpSrcBuffer: IDirect3DVertexBuffer7; dwSrcIndex: DWORD;
8519
        lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
8520
    function GetVertexBufferDesc (out lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
8521
    function Optimize(lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
8522
    function ProcessVerticesStrided(dwVertexOp, dwDestIndex, dwCount: DWORD;
8523
      lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexTypeDesc: DWORD;
8524
      lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8525
  end;
8526
 
4 daniel-mar 8527
type
8528
  IID_IDirect3D = IDirect3D;
8529
  IID_IDirect3D2 = IDirect3D2;
8530
  IID_IDirect3D3 = IDirect3D3;
8531
  IID_IDirect3D7 = IDirect3D7;
8532
 
8533
  IID_IDirect3DDevice = IDirect3DDevice;
8534
  IID_IDirect3DDevice2 = IDirect3DDevice2;
8535
  IID_IDirect3DDevice3 = IDirect3DDevice3;
8536
  IID_IDirect3DDevice7 = IDirect3DDevice7;
8537
 
8538
  IID_IDirect3DTexture = IDirect3DTexture;
8539
  IID_IDirect3DTexture2 = IDirect3DTexture2;
8540
  IID_IDirect3DLight = IDirect3DLight;
8541
  IID_IDirect3DMaterial = IDirect3DMaterial;
8542
  IID_IDirect3DMaterial2 = IDirect3DMaterial2;
8543
  IID_IDirect3DMaterial3 = IDirect3DMaterial3;
8544
  IID_IDirect3DExecuteBuffer = IDirect3DExecuteBuffer;
8545
  IID_IDirect3DViewport = IDirect3DViewport;
8546
  IID_IDirect3DViewport2 = IDirect3DViewport2;
8547
  IID_IDirect3DViewport3 = IDirect3DViewport3;
8548
  IID_IDirect3DVertexBuffer = IDirect3DVertexBuffer;
8549
  IID_IDirect3DVertexBuffer7 = IDirect3DVertexBuffer7;
8550
 
8551
 
1 daniel-mar 8552
const
4 daniel-mar 8553
(****************************************************************************
8554
 *
8555
 * Flags for IDirect3DDevice::NextViewport
8556
 *
8557
 ****************************************************************************)
1 daniel-mar 8558
 
4 daniel-mar 8559
(*
8560
 * Return the next viewport
8561
 *)
8562
  D3DNEXT_NEXT =        $00000001;
1 daniel-mar 8563
 
4 daniel-mar 8564
(*
8565
 * Return the first viewport
8566
 *)
8567
  D3DNEXT_HEAD =        $00000002;
1 daniel-mar 8568
 
4 daniel-mar 8569
(*
8570
 * Return the last viewport
8571
 *)
8572
  D3DNEXT_TAIL =        $00000004;
1 daniel-mar 8573
 
8574
 
4 daniel-mar 8575
(****************************************************************************
8576
 *
8577
 * Flags for DrawPrimitive/DrawIndexedPrimitive
8578
 *   Also valid for Begin/BeginIndexed
8579
 *   Also valid for VertexBuffer::CreateVertexBuffer
8580
 ****************************************************************************)
1 daniel-mar 8581
 
4 daniel-mar 8582
(*
8583
 * Wait until the device is ready to draw the primitive
8584
 * This will cause DP to not return DDERR_WASSTILLDRAWING
8585
 *)
8586
  D3DDP_WAIT =                                  $00000001;
8587
 
8588
(*
8589
 * Hint that it is acceptable to render the primitive out of order.
8590
 *)
8591
  D3DDP_OUTOFORDER            = $00000002;
8592
 
8593
(*
8594
 * Hint that the primitives have been clipped by the application.
8595
 *)
8596
  D3DDP_DONOTCLIP =                             $00000004;
8597
 
8598
(*
8599
 * Hint that the extents need not be updated.
8600
 *)
8601
  D3DDP_DONOTUPDATEEXTENTS =    $00000008;
8602
 
8603
(*
8604
 * Hint that the lighting should not be applied on vertices.
8605
 *)
8606
 
8607
  D3DDP_DONOTLIGHT            = $00000010;
8608
 
8609
 
8610
(*
8611
 * Direct3D Errors
8612
 * DirectDraw error codes are used when errors not specified here.
8613
 *)
8614
 
1 daniel-mar 8615
const
4 daniel-mar 8616
  MAKE_D3DHRESULT = HResult($88760000);
1 daniel-mar 8617
 
4 daniel-mar 8618
  D3D_OK                          = DD_OK;
8619
  D3DERR_BADMAJORVERSION          = MAKE_D3DHRESULT + 700;
8620
  D3DERR_BADMINORVERSION          = MAKE_D3DHRESULT + 701;
1 daniel-mar 8621
 
4 daniel-mar 8622
(*
8623
 * An invalid device was requested by the application.
8624
 *)
8625
  D3DERR_INVALID_DEVICE   = MAKE_D3DHRESULT + 705;
8626
  D3DERR_INITFAILED       = MAKE_D3DHRESULT + 706;
1 daniel-mar 8627
 
4 daniel-mar 8628
(*
8629
 * SetRenderTarget attempted on a device that was
8630
 * QI'd off the render target.
8631
 *)
8632
  D3DERR_DEVICEAGGREGATED = MAKE_D3DHRESULT + 707;
1 daniel-mar 8633
 
4 daniel-mar 8634
  D3DERR_EXECUTE_CREATE_FAILED    = MAKE_D3DHRESULT + 710;
8635
  D3DERR_EXECUTE_DESTROY_FAILED   = MAKE_D3DHRESULT + 711;
8636
  D3DERR_EXECUTE_LOCK_FAILED      = MAKE_D3DHRESULT + 712;
8637
  D3DERR_EXECUTE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 713;
8638
  D3DERR_EXECUTE_LOCKED           = MAKE_D3DHRESULT + 714;
8639
  D3DERR_EXECUTE_NOT_LOCKED       = MAKE_D3DHRESULT + 715;
1 daniel-mar 8640
 
4 daniel-mar 8641
  D3DERR_EXECUTE_FAILED           = MAKE_D3DHRESULT + 716;
8642
  D3DERR_EXECUTE_CLIPPED_FAILED   = MAKE_D3DHRESULT + 717;
1 daniel-mar 8643
 
4 daniel-mar 8644
  D3DERR_TEXTURE_NO_SUPPORT       = MAKE_D3DHRESULT + 720;
8645
  D3DERR_TEXTURE_CREATE_FAILED    = MAKE_D3DHRESULT + 721;
8646
  D3DERR_TEXTURE_DESTROY_FAILED   = MAKE_D3DHRESULT + 722;
8647
  D3DERR_TEXTURE_LOCK_FAILED      = MAKE_D3DHRESULT + 723;
8648
  D3DERR_TEXTURE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 724;
8649
  D3DERR_TEXTURE_LOAD_FAILED      = MAKE_D3DHRESULT + 725;
8650
  D3DERR_TEXTURE_SWAP_FAILED      = MAKE_D3DHRESULT + 726;
8651
  D3DERR_TEXTURE_LOCKED           = MAKE_D3DHRESULT + 727;
8652
  D3DERR_TEXTURE_NOT_LOCKED       = MAKE_D3DHRESULT + 728;
8653
  D3DERR_TEXTURE_GETSURF_FAILED   = MAKE_D3DHRESULT + 729;
1 daniel-mar 8654
 
4 daniel-mar 8655
  D3DERR_MATRIX_CREATE_FAILED     = MAKE_D3DHRESULT + 730;
8656
  D3DERR_MATRIX_DESTROY_FAILED    = MAKE_D3DHRESULT + 731;
8657
  D3DERR_MATRIX_SETDATA_FAILED    = MAKE_D3DHRESULT + 732;
8658
  D3DERR_MATRIX_GETDATA_FAILED    = MAKE_D3DHRESULT + 733;
8659
  D3DERR_SETVIEWPORTDATA_FAILED   = MAKE_D3DHRESULT + 734;
1 daniel-mar 8660
 
4 daniel-mar 8661
  D3DERR_INVALIDCURRENTVIEWPORT   = MAKE_D3DHRESULT + 735;
8662
  D3DERR_INVALIDPRIMITIVETYPE     = MAKE_D3DHRESULT + 736;
8663
  D3DERR_INVALIDVERTEXTYPE        = MAKE_D3DHRESULT + 737;
8664
  D3DERR_TEXTURE_BADSIZE          = MAKE_D3DHRESULT + 738;
8665
  D3DERR_INVALIDRAMPTEXTURE       = MAKE_D3DHRESULT + 739;
1 daniel-mar 8666
 
4 daniel-mar 8667
  D3DERR_MATERIAL_CREATE_FAILED   = MAKE_D3DHRESULT + 740;
8668
  D3DERR_MATERIAL_DESTROY_FAILED  = MAKE_D3DHRESULT + 741;
8669
  D3DERR_MATERIAL_SETDATA_FAILED  = MAKE_D3DHRESULT + 742;
8670
  D3DERR_MATERIAL_GETDATA_FAILED  = MAKE_D3DHRESULT + 743;
1 daniel-mar 8671
 
4 daniel-mar 8672
  D3DERR_INVALIDPALETTE           = MAKE_D3DHRESULT + 744;
1 daniel-mar 8673
 
4 daniel-mar 8674
  D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY = MAKE_D3DHRESULT + 745;
8675
  D3DERR_ZBUFF_NEEDS_VIDEOMEMORY  = MAKE_D3DHRESULT + 746;
8676
  D3DERR_SURFACENOTINVIDMEM       = MAKE_D3DHRESULT + 747;
1 daniel-mar 8677
 
4 daniel-mar 8678
  D3DERR_LIGHT_SET_FAILED         = MAKE_D3DHRESULT + 750;
8679
  D3DERR_LIGHTHASVIEWPORT         = MAKE_D3DHRESULT + 751;
8680
  D3DERR_LIGHTNOTINTHISVIEWPORT   = MAKE_D3DHRESULT + 752;
1 daniel-mar 8681
 
4 daniel-mar 8682
  D3DERR_SCENE_IN_SCENE           = MAKE_D3DHRESULT + 760;
8683
  D3DERR_SCENE_NOT_IN_SCENE       = MAKE_D3DHRESULT + 761;
8684
  D3DERR_SCENE_BEGIN_FAILED       = MAKE_D3DHRESULT + 762;
8685
  D3DERR_SCENE_END_FAILED         = MAKE_D3DHRESULT + 763;
1 daniel-mar 8686
 
4 daniel-mar 8687
  D3DERR_INBEGIN                  = MAKE_D3DHRESULT + 770;
8688
  D3DERR_NOTINBEGIN               = MAKE_D3DHRESULT + 771;
8689
  D3DERR_NOVIEWPORTS              = MAKE_D3DHRESULT + 772;
8690
  D3DERR_VIEWPORTDATANOTSET       = MAKE_D3DHRESULT + 773;
8691
  D3DERR_VIEWPORTHASNODEVICE      = MAKE_D3DHRESULT + 774;
8692
  D3DERR_NOCURRENTVIEWPORT        = MAKE_D3DHRESULT + 775;
1 daniel-mar 8693
 
4 daniel-mar 8694
  D3DERR_INVALIDVERTEXFORMAT      = MAKE_D3DHRESULT + 2048;
1 daniel-mar 8695
 
4 daniel-mar 8696
(*
8697
 * Attempted to CreateTexture on a surface that had a color key
8698
 *)
8699
  D3DERR_COLORKEYATTACHED                 = MAKE_D3DHRESULT + 2050;
1 daniel-mar 8700
 
4 daniel-mar 8701
  D3DERR_VERTEXBUFFEROPTIMIZED            = MAKE_D3DHRESULT + 2060;
8702
  D3DERR_VBUF_CREATE_FAILED               = MAKE_D3DHRESULT + 2061;
8703
  D3DERR_VERTEXBUFFERLOCKED               = MAKE_D3DHRESULT + 2062;
1 daniel-mar 8704
 
4 daniel-mar 8705
  D3DERR_ZBUFFER_NOTPRESENT               = MAKE_D3DHRESULT + 2070;
8706
  D3DERR_STENCILBUFFER_NOTPRESENT         = MAKE_D3DHRESULT + 2071;
1 daniel-mar 8707
 
4 daniel-mar 8708
  D3DERR_WRONGTEXTUREFORMAT               = MAKE_D3DHRESULT + 2072;
8709
  D3DERR_UNSUPPORTEDCOLOROPERATION        = MAKE_D3DHRESULT + 2073;
8710
  D3DERR_UNSUPPORTEDCOLORARG              = MAKE_D3DHRESULT + 2074;
8711
  D3DERR_UNSUPPORTEDALPHAOPERATION        = MAKE_D3DHRESULT + 2075;
8712
  D3DERR_UNSUPPORTEDALPHAARG              = MAKE_D3DHRESULT + 2076;
8713
  D3DERR_TOOMANYOPERATIONS                = MAKE_D3DHRESULT + 2077;
8714
  D3DERR_CONFLICTINGTEXTUREFILTER         = MAKE_D3DHRESULT + 2078;
8715
  D3DERR_UNSUPPORTEDFACTORVALUE           = MAKE_D3DHRESULT + 2079;
8716
  D3DERR_CONFLICTINGRENDERSTATE           = MAKE_D3DHRESULT + 2081;
8717
  D3DERR_UNSUPPORTEDTEXTUREFILTER         = MAKE_D3DHRESULT + 2082;
8718
  D3DERR_TOOMANYPRIMITIVES                = MAKE_D3DHRESULT + 2083;
8719
  D3DERR_INVALIDMATRIX                    = MAKE_D3DHRESULT + 2084;
8720
  D3DERR_TOOMANYVERTICES                  = MAKE_D3DHRESULT + 2085;
8721
  D3DERR_CONFLICTINGTEXTUREPALETTE        = MAKE_D3DHRESULT + 2086;
1 daniel-mar 8722
 
4 daniel-mar 8723
  D3DERR_INVALIDSTATEBLOCK        = MAKE_D3DHRESULT + 2100;
8724
  D3DERR_INBEGINSTATEBLOCK        = MAKE_D3DHRESULT + 2101;
8725
  D3DERR_NOTINBEGINSTATEBLOCK     = MAKE_D3DHRESULT + 2102;
1 daniel-mar 8726
 
4 daniel-mar 8727
procedure DisableFPUExceptions;
8728
procedure EnableFPUExceptions;
1 daniel-mar 8729
 
4 daniel-mar 8730
(***************************************************************************
8731
 *
8732
 *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
8733
 *
8734
 *  File:       dxfile.h
8735
 *
8736
 *  Content:    DirectX File public header file
8737
 *
8738
 ***************************************************************************)
8739
 
8740
var
8741
  DXFileDLL : HMODULE;
8742
 
8743
function DXFileErrorString(Value: HResult) : string;
8744
 
8745
type
8746
  TDXFileFormat = (
8747
    DXFILEFORMAT_BINARY,
8748
    DXFILEFORMAT_TEXT,
8749
    DXFILEFORMAT_COMPRESSED
8750
  );
8751
 
8752
  TDXFileLoadOptions = (
8753
    DXFILELOAD_FROMFILE,
8754
    DXFILELOAD_FROMRESOURCE,
8755
    DXFILELOAD_FROMMEMORY,
8756
    DXFILELOAD_INVALID_3,
8757
    DXFILELOAD_FROMSTREAM,
8758
    DXFILELOAD_INVALID_5,
8759
    DXFILELOAD_INVALID_6,
8760
    DXFILELOAD_INVALID_7,
8761
    DXFILELOAD_FROMURL
8762
  );
8763
 
8764
  PDXFileLoadResource = ^TDXFileLoadResource;
8765
  TDXFileLoadResource = packed record
8766
    hModule: HModule;
8767
    lpName: PAnsiChar;
8768
    lpType: PAnsiChar;
8769
  end;
8770
 
8771
  PDXFileLoadMemory = ^TDXFileLoadMemory;
8772
  TDXFileLoadMemory = packed record
8773
    lpMemory: Pointer;
8774
    dSize: DWORD;
8775
  end;
8776
 
8777
(*
8778
 * DirectX File object types.
8779
 *)
8780
 
8781
  IDirectXFile = interface;
8782
  IDirectXFileEnumObject = interface;
8783
  IDirectXFileSaveObject = interface;
8784
  IDirectXFileObject = interface;
8785
  IDirectXFileData = interface;
8786
  IDirectXFileDataReference = interface;
8787
  IDirectXFileBinary = interface;
8788
 
8789
(*
8790
 * DirectX File interfaces.
8791
 *)
8792
 
8793
  IDirectXFile = interface (IUnknown)
8794
    ['{3d82ab40-62da-11cf-ab39-0020af71e433}']
8795
    function CreateEnumObject (pvSource: Pointer;
8796
        dwLoadOptions: TDXFileLoadOptions;
8797
        var ppEnumObj: IDirectXFileEnumObject) : HResult; stdcall;
8798
    function CreateSaveObject (szFileName: PChar; dwFileFormat: TDXFileFormat;
8799
        var ppSaveObj: IDirectXFileSaveObject) : HResult; stdcall;
8800
    function RegisterTemplates (pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
8801
  end;
8802
 
8803
  IDirectXFileEnumObject = interface (IUnknown)
8804
    ['{3d82ab41-62da-11cf-ab39-0020af71e433}']
8805
    function GetNextDataObject (var ppDataObj: IDirectXFileData) : HResult; stdcall;
8806
    function GetDataObjectById
8807
        (const rguid: TGUID; var ppDataObj: IDirectXFileData) : HResult; stdcall;
8808
    function GetDataObjectByName
8809
        (szName: PChar; var ppDataObj: IDirectXFileData) : HResult; stdcall;
8810
  end;
8811
 
8812
  IDirectXFileSaveObject = interface (IUnknown)
8813
    ['{3d82ab42-62da-11cf-ab39-0020af71e433}']
8814
    function SaveTemplates
8815
        (cTemplates: DWORD; var ppguidTemplates: PGUID) : HResult; stdcall;
8816
    function CreateDataObject (const rguidTemplate: TGUID; szName: PChar;
8817
        pguid: PGUID; cbSize: DWORD; pvData: Pointer;
8818
        var ppDataObj: IDirectXFileData) : HResult; stdcall;
8819
    function SaveData (pDataObj: IDirectXFileData) : HResult; stdcall;
8820
  end;
8821
 
8822
  IDirectXFileObject = interface (IUnknown)
8823
    ['{3d82ab43-62da-11cf-ab39-0020af71e433}']
8824
    function GetName (pstrNameBuf: PChar; var dwBufLen: DWORD) : HResult; stdcall;
8825
    function GetId (var pGuidBuf: TGUID) : HResult; stdcall;
8826
  end;
8827
 
8828
  IDirectXFileData = interface (IDirectXFileObject)
8829
    ['{3d82ab44-62da-11cf-ab39-0020af71e433}']
8830
    function GetData
8831
        (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer) : HResult; stdcall;
8832
    function GetType (var ppguid: PGUID) : HResult; stdcall;
8833
    function GetNextObject (var ppChildObj: IDirectXFileObject) : HResult; stdcall;
8834
    function AddDataObject (pDataObj: IDirectXFileData) : HResult; stdcall;
8835
    function AddDataReference (szRef: PChar; pguidRef: PGUID) : HResult; stdcall;
8836
    function AddBinaryObject (szName: PChar; pguid: PGUID; szMimeType: PChar;
8837
        pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
8838
  end;
8839
 
8840
  IDirectXFileDataReference = interface (IDirectXFileObject)
8841
    ['{3d82ab45-62da-11cf-ab39-0020af71e433}']
8842
    function Resolve (var ppDataObj: IDirectXFileData) : HResult; stdcall;
8843
  end;
8844
 
8845
  IDirectXFileBinary = interface (IDirectXFileObject)
8846
    ['{3d82ab46-62da-11cf-ab39-0020af71e433}']
8847
    function GetSize (var pcbSize: DWORD) : HResult; stdcall;
8848
    function GetMimeType (var pszMimeType: PChar) : HResult; stdcall;
8849
    function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}) : HResult; stdcall;
8850
  end;
8851
 
8852
const
8853
 
8854
(*
8855
 * DirectXFile Object Class Id (for CoCreateInstance())
8856
 *)
8857
 
8858
   CLSID_CDirectXFile: TGUID =
8859
       (D1:$4516ec43;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
8860
 
8861
(*
8862
 * DirectX File Interface GUIDs.
8863
 *)
8864
 
8865
type
8866
  IID_IDirectXFile = IDirectXFile;
8867
  IID_IDirectXFileEnumObject = IDirectXFileEnumObject;
8868
  IID_IDirectXFileSaveObject = IDirectXFileSaveObject;
8869
  IID_IDirectXFileObject = IDirectXFileObject;
8870
  IID_IDirectXFileData = IDirectXFileData;
8871
  IID_IDirectXFileDataReference = IDirectXFileDataReference;
8872
  IID_IDirectXFileBinary = IDirectXFileBinary;
8873
 
8874
(*
8875
 * DirectX File Header template's GUID.
8876
 *)
8877
const
8878
  TID_DXFILEHeader: TGUID =
8879
      (D1:$3d82ab43;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
8880
 
8881
(*
8882
 * DirectX File errors.
8883
 *)
8884
 
8885
const
8886
  DXFILE_OK = 0;
8887
 
8888
  DXFILEERR_BADOBJECT                 = MAKE_D3DHRESULT or 850;
8889
  DXFILEERR_BADVALUE                  = MAKE_D3DHRESULT or 851;
8890
  DXFILEERR_BADTYPE                   = MAKE_D3DHRESULT or 852;
8891
  DXFILEERR_BADSTREAMHANDLE           = MAKE_D3DHRESULT or 853;
8892
  DXFILEERR_BADALLOC                  = MAKE_D3DHRESULT or 854;
8893
  DXFILEERR_NOTFOUND                  = MAKE_D3DHRESULT or 855;
8894
  DXFILEERR_NOTDONEYET                = MAKE_D3DHRESULT or 856;
8895
  DXFILEERR_FILENOTFOUND              = MAKE_D3DHRESULT or 857;
8896
  DXFILEERR_RESOURCENOTFOUND          = MAKE_D3DHRESULT or 858;
8897
  DXFILEERR_URLNOTFOUND               = MAKE_D3DHRESULT or 859;
8898
  DXFILEERR_BADRESOURCE               = MAKE_D3DHRESULT or 860;
8899
  DXFILEERR_BADFILETYPE               = MAKE_D3DHRESULT or 861;
8900
  DXFILEERR_BADFILEVERSION            = MAKE_D3DHRESULT or 862;
8901
  DXFILEERR_BADFILEFLOATSIZE          = MAKE_D3DHRESULT or 863;
8902
  DXFILEERR_BADFILECOMPRESSIONTYPE    = MAKE_D3DHRESULT or 864;
8903
  DXFILEERR_BADFILE                   = MAKE_D3DHRESULT or 865;
8904
  DXFILEERR_PARSEERROR                = MAKE_D3DHRESULT or 866;
8905
  DXFILEERR_NOTEMPLATE                = MAKE_D3DHRESULT or 867;
8906
  DXFILEERR_BADARRAYSIZE              = MAKE_D3DHRESULT or 868;
8907
  DXFILEERR_BADDATAREFERENCE          = MAKE_D3DHRESULT or 869;
8908
  DXFILEERR_INTERNALERROR             = MAKE_D3DHRESULT or 870;
8909
  DXFILEERR_NOMOREOBJECTS             = MAKE_D3DHRESULT or 871;
8910
  DXFILEERR_BADINTRINSICS             = MAKE_D3DHRESULT or 872;
8911
  DXFILEERR_NOMORESTREAMHANDLES       = MAKE_D3DHRESULT or 873;
8912
  DXFILEERR_NOMOREDATA                = MAKE_D3DHRESULT or 874;
8913
  DXFILEERR_BADCACHEFILE              = MAKE_D3DHRESULT or 875;
8914
  DXFILEERR_NOINTERNET                = MAKE_D3DHRESULT or 876;
8915
 
8916
{$IFDEF D3DRM}
8917
(*
8918
 * API for creating IDirectXFile interface.
8919
 *)
8920
 
8921
var
8922
  DirectXFileCreate : function
8923
    (out lplpDirectXFile: IDirectXFile) : HResult; stdcall;
8924
 
8925
(* D3DRM XFile templates in binary form *)
8926
const
8927
  D3DRM_XTEMPLATE_BYTES = 3215;
8928
  D3DRM_XTEMPLATES: array [0..D3DRM_XTEMPLATE_BYTES-1] of byte = (
8929
        $78, $6f, $66, $20, $30, $33, $30, $32, $62,
8930
        $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
8931
        0, $6, 0, 0, 0, $48, $65, $61, $64, $65,
8932
        $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
8933
        $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
8934
        $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
8935
        $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0,
8936
        $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
8937
        0, $29, 0, $1, 0, $5, 0, 0, 0, $66,
8938
        $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
8939
        $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
8940
        $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
8941
        $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71,
8942
        $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
8943
        $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0,
8944
        0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
8945
        0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1,
8946
        0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
8947
        $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2,
8948
        $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
8949
        $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0,
8950
        0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
8951
        0, 0, $76, $14, 0, $b, 0, $1f, 0, $1,
8952
        0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
8953
        $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f,
8954
        $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
8955
        $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0,
8956
        $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
8957
        $e, 0, $3, 0, $10, 0, 0, 0, $f, 0,
8958
        $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
8959
        0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
8960
        $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
8961
        $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94,
8962
        $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
8963
        $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0,
8964
        0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
8965
        0, $1, 0, $4, 0, 0, 0, $62, $6c, $75,
8966
        $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
8967
        0, $61, $6c, $70, $68, $61, $14, 0, $b, 0,
8968
        $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
8969
        $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0,
8970
        $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
8971
        0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0,
8972
        $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
8973
        0, $1, 0, $5, 0, 0, 0, $67, $72, $65,
8974
        $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
8975
        0, 0, $62, $6c, $75, $65, $14, 0, $b, 0,
8976
        $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
8977
        $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72,
8978
        $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
8979
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
8980
        $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
8981
        $64, $65, $78, $14, 0, $1, 0, $9, 0, 0,
8982
        0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
8983
        $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65,
8984
        $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
8985
        $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f,
8986
        $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
8987
        $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0,
8988
        $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
8989
        0, 0, 0, $74, $72, $75, $65, $66, $61, $6c,
8990
        $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
8991
        $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61,
8992
        $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
8993
        $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33,
8994
        $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
8995
        $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0,
8996
        0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
8997
        0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0,
8998
        $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
8999
        0, $1, 0, $c, 0, 0, 0, $4d, $61, $74,
9000
        $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
9001
        0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf,
9002
        $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
9003
        0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65,
9004
        $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
9005
        0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f,
9006
        $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
9007
        $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f,
9008
        0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
9009
        $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0,
9010
        $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
9011
        $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0,
9012
        $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
9013
        $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0,
9014
        $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
9015
        $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab,
9016
        $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
9017
        $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0,
9018
        $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
9019
        0, $9, 0, 0, 0, $66, $61, $63, $65, $43,
9020
        $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
9021
        $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14,
9022
        0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
9023
        $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0,
9024
        0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
9025
        $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0,
9026
        0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
9027
        $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73,
9028
        $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
9029
        0, $e, 0, $12, 0, $12, 0, $12, 0, $f,
9030
        0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
9031
        0, $4d, $65, $73, $68, $46, $61, $63, $65, $a,
9032
        0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
9033
        $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
9034
        0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
9035
        $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e,
9036
        $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
9037
        0, $1, 0, $11, 0, 0, 0, $66, $61, $63,
9038
        $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
9039
        $69, $63, $65, $73, $e, 0, $1, 0, $12, 0,
9040
        0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
9041
        $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73,
9042
        $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
9043
        $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61,
9044
        $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
9045
        0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94,
9046
        $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
9047
        0, $f, 0, 0, 0, $6e, $46, $61, $63, $65,
9048
        $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
9049
        $14, 0, $34, 0, $1, 0, $9, 0, 0, 0,
9050
        $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
9051
        0, $e, 0, 0, 0, $66, $61, $63, $65, $57,
9052
        $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
9053
        0, $1, 0, $f, 0, 0, 0, $6e, $46, $61,
9054
        $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
9055
        $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
9056
        $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
9057
        $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f,
9058
        $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
9059
        $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
9060
        $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
9061
        0, $6e, $54, $65, $78, $74, $75, $72, $65, $43,
9062
        $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
9063
        0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
9064
        $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
9065
        $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72,
9066
        $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
9067
        $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f,
9068
        $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
9069
        $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65,
9070
        $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
9071
        $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f,
9072
        $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
9073
        $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0,
9074
        0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
9075
        $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0,
9076
        0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
9077
        $65, $78, $65, $73, $14, 0, $34, 0, $29, 0,
9078
        $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
9079
        $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1,
9080
        0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
9081
        $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14,
9082
        0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
9083
        $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b,
9084
        0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
9085
        $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73,
9086
        $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
9087
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
9088
        $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
9089
        $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0,
9090
        $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
9091
        $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f,
9092
        $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
9093
        0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c,
9094
        $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
9095
        0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f,
9096
        $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
9097
        0, $8, 0, 0, 0, $4d, $65, $73, $68, $46,
9098
        $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
9099
        $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
9100
        $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
9101
        $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
9102
        $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
9103
        $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65,
9104
        $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
9105
        $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78,
9106
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
9107
        $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56,
9108
        $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
9109
        $73, $14, 0, $34, 0, $1, 0, $c, 0, 0,
9110
        0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
9111
        $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76,
9112
        $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
9113
        $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e,
9114
        $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
9115
        $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
9116
        $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
9117
        $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62,
9118
        $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
9119
        $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56,
9120
        $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
9121
        0, $1, 0, $6, 0, 0, 0, $56, $65, $63,
9122
        $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
9123
        $65, $72, $74, $69, $63, $65, $73, $e, 0, $1,
9124
        0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
9125
        $69, $63, $65, $73, $f, 0, $14, 0, $29, 0,
9126
        $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
9127
        $65, $73, $14, 0, $34, 0, $1, 0, $8, 0,
9128
        0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
9129
        $1, 0, $5, 0, 0, 0, $66, $61, $63, $65,
9130
        $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
9131
        $46, $61, $63, $65, $73, $f, 0, $14, 0, $e,
9132
        0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
9133
        0, $1f, 0, $1, 0, $14, 0, 0, 0, $46,
9134
        $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
9135
        $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a,
9136
        0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
9137
        $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
9138
        0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
9139
        $78, $34, $78, $34, $1, 0, $b, 0, 0, 0,
9140
        $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
9141
        $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5,
9142
        0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
9143
        $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11,
9144
        $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
9145
        $12, 0, $12, 0, $12, 0, $f, 0, $b, 0,
9146
        $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
9147
        $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5,
9148
        0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
9149
        $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1,
9150
        0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
9151
        $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0,
9152
        $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
9153
        $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56,
9154
        $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
9155
        0, $1f, 0, $1, 0, $e, 0, 0, 0, $54,
9156
        $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
9157
        $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6,
9158
        $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
9159
        $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0,
9160
        0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
9161
        0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65,
9162
        $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
9163
        $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0,
9164
        $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
9165
        $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0,
9166
        $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
9167
        $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0,
9168
        $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
9169
        $79, $70, $65, $14, 0, $29, 0, $1, 0, $5,
9170
        0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
9171
        $34, 0, $1, 0, $e, 0, 0, 0, $54, $69,
9172
        $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
9173
        $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65,
9174
        $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
9175
        $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b,
9176
        0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
9177
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70,
9178
        $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
9179
        $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0,
9180
        $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
9181
        0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f,
9182
        $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
9183
        0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f,
9184
        $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
9185
        $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0,
9186
        $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
9187
        0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf,
9188
        $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
9189
        0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
9190
        0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
9191
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65,
9192
        $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
9193
        $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
9194
        $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
9195
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0,
9196
        $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
9197
        $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61,
9198
        $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
9199
        $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
9200
        $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
9201
        $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0,
9202
        $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
9203
        0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0,
9204
        $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
9205
        0, $1, 0, $5, 0, 0, 0, $6e, $55, $72,
9206
        $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
9207
        $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0,
9208
        $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
9209
        $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1,
9210
        0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
9211
        $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68,
9212
        $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
9213
        $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b,
9214
        $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
9215
        $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49,
9216
        $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
9217
        0, $b, 0, $1f, 0, $1, 0, $4, 0, 0,
9218
        0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
9219
        $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0,
9220
        $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
9221
        0, 0, 0, $64, $61, $74, $61, $31, $14, 0,
9222
        $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
9223
        $74, $61, $32, $14, 0, $28, 0, $1, 0, $5,
9224
        0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
9225
        $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0,
9226
        $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
9227
        0, 0, 0, $f, 0, $14, 0, $b, 0, $1f,
9228
        0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
9229
        $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74,
9230
        $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
9231
        $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72,
9232
        $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
9233
        $65, $79, $14, 0, $31, 0, $1, 0, $5, 0,
9234
        0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
9235
        0, $1f, 0, $1, 0, $b, 0, 0, 0, $50,
9236
        $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
9237
        $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf,
9238
        $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
9239
        $e, 0, $1, 0, $e, 0, 0, 0, $53, $74,
9240
        $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
9241
        $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0,
9242
        $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
9243
        $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0,
9244
        $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
9245
        $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0,
9246
        $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
9247
        $12, 0, 0, 0, $67, $75, $69, $64, $45, $78,
9248
        $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
9249
        $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0,
9250
        $12, 0, $f, 0, $b, 0);
9251
 
9252
//---------------
9253
 
9254
//Direct3DRM file
1 daniel-mar 9255
(*==========================================================================;
9256
 *
4 daniel-mar 9257
 *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
9258
 *
9259
 *  Files:      D3DRMDef.h D3DRMObj.h D3DRM.h D3DRMWin.h RMXFGUID.h RMXFTmpl.h
9260
 *  Content:    Direct3D Retained Mode include files
9261
 *
9262
 *  DirectX 7.0 Delphi adaptation by Erik Unger
9263
 *
9264
 *  Modified: 10-Sep-2000
9265
 *
9266
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
9267
 *  E-Mail: DelphiDirectX@next-reality.com
9268
 *
9269
 *
9270
 ***************************************************************************)
9271
 
9272
var
9273
  D3DRMDLL : HMODULE = 0;
9274
 
9275
(*==========================================================================;
9276
 *
1 daniel-mar 9277
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
9278
 *
9279
 *  File:       d3drmdef.h
9280
 *  Content:    Direct3DRM include file
9281
 *
9282
 ***************************************************************************)
9283
 
9284
type
9285
  PD3DRMVector4D = ^TD3DRMVector4D;
4 daniel-mar 9286
  TD3DRMVector4D = packed record
1 daniel-mar 9287
    x, y, z, w: TD3DValue;
9288
  end;
9289
 
4 daniel-mar 9290
  PD3DRMMatrix4D = ^TD3DRMMatrix4D;
9291
  TD3DRMMatrix4D = array [0..3, 0..3] of TD3DValue;
1 daniel-mar 9292
 
9293
  PD3DRMQuaternion = ^TD3DRMQuaternion;
4 daniel-mar 9294
  TD3DRMQuaternion = packed record
1 daniel-mar 9295
    s: TD3DValue;
9296
    v: TD3DVector;
9297
  end;
9298
 
9299
  PD3DRMRay = ^TD3DRMRay;
4 daniel-mar 9300
  TD3DRMRay = packed record
1 daniel-mar 9301
    dvDir: TD3DVector;
9302
    dvPos: TD3DVector;
9303
  end;
9304
 
9305
  PD3DRMBox = ^TD3DRMBox;
4 daniel-mar 9306
  TD3DRMBox = packed record
1 daniel-mar 9307
    min, max: TD3DVector;
9308
  end;
9309
 
4 daniel-mar 9310
  TD3DRMWrapCallback = procedure (var lpD3DVector: TD3DVector;
9311
      var lpU, lpV: Integer; var lpD3DRMVA, lpD3DRMVB: TD3DVector; lpArg:
9312
      Pointer); stdcall; // unused ?
1 daniel-mar 9313
 
4 daniel-mar 9314
  PD3DRMLightType = ^TD3DRMLightType; // is it 16 or 32 bit ?
1 daniel-mar 9315
  TD3DRMLightType = (
9316
    D3DRMLIGHT_AMBIENT,
9317
    D3DRMLIGHT_POINT,
9318
    D3DRMLIGHT_SPOT,
9319
    D3DRMLIGHT_DIRECTIONAL,
9320
    D3DRMLIGHT_PARALLELPOINT
9321
  );
9322
 
4 daniel-mar 9323
  PD3DRMShadeMode = ^TD3DRMShadeMode;
9324
  TD3DRMShadeMode = WORD;
1 daniel-mar 9325
 
9326
const
9327
  D3DRMSHADE_FLAT = 0;
9328
  D3DRMSHADE_GOURAUD = 1;
9329
  D3DRMSHADE_PHONG = 2;
9330
  D3DRMSHADE_MASK = 7;
9331
  D3DRMSHADE_MAX = 8;
9332
 
9333
type
4 daniel-mar 9334
  PD3DRMLightMode = ^TD3DRMLightMode;
9335
  TD3DRMLightMode = WORD;
1 daniel-mar 9336
 
9337
const
9338
  D3DRMLIGHT_OFF  = 0 * D3DRMSHADE_MAX;
9339
  D3DRMLIGHT_ON   = 1 * D3DRMSHADE_MAX;
9340
  D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX;
9341
  D3DRMLIGHT_MAX  = 8 * D3DRMSHADE_MAX;
9342
 
9343
type
4 daniel-mar 9344
  PD3DRMFillMode = ^TD3DRMFillMode;
9345
  TD3DRMFillMode = WORD;
1 daniel-mar 9346
 
9347
const
9348
  D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX;
9349
  D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX;
9350
  D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX;
9351
  D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX;
9352
  D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX;
9353
 
9354
type
4 daniel-mar 9355
  PD3DRMRenderQuality = ^TD3DRMRenderQuality;
1 daniel-mar 9356
  TD3DRMRenderQuality = DWORD;
9357
 
9358
const
4 daniel-mar 9359
  D3DRMRENDER_WIREFRAME   =
9360
      (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_WIREFRAME);
9361
  D3DRMRENDER_UNLITFLAT   =
9362
      (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_SOLID);
9363
  D3DRMRENDER_FLAT        =
9364
      (D3DRMSHADE_FLAT + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
9365
  D3DRMRENDER_GOURAUD     =
9366
      (D3DRMSHADE_GOURAUD + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
9367
  D3DRMRENDER_PHONG       =
9368
      (D3DRMSHADE_PHONG + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
1 daniel-mar 9369
 
4 daniel-mar 9370
  D3DRMRENDERMODE_BLENDEDTRANSPARENCY   =  1;
9371
  D3DRMRENDERMODE_SORTEDTRANSPARENCY    =  2;
9372
  D3DRMRENDERMODE_LIGHTINMODELSPACE     =  8;
9373
  D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR = 16;
1 daniel-mar 9374
 
9375
type
4 daniel-mar 9376
  PD3DRMTextureQuality = ^TD3DRMTextureQuality;
1 daniel-mar 9377
  TD3DRMTextureQuality = (
4 daniel-mar 9378
    D3DRMTEXTURE_NEAREST,               (* choose nearest texel *)
9379
    D3DRMTEXTURE_LINEAR,                (* interpolate 4 texels *)
9380
    D3DRMTEXTURE_MIPNEAREST,            (* nearest texel in nearest mipmap  *)
9381
    D3DRMTEXTURE_MIPLINEAR,             (* interpolate 2 texels from 2 mipmaps *)
9382
    D3DRMTEXTURE_LINEARMIPNEAREST,      (* interpolate 4 texels in nearest mipmap *)
9383
    D3DRMTEXTURE_LINEARMIPLINEAR        (* interpolate 8 texels from 2 mipmaps *)
1 daniel-mar 9384
  );
9385
 
9386
const
4 daniel-mar 9387
(*
9388
 * Texture flags
9389
 *)
9390
  D3DRMTEXTURE_FORCERESIDENT          = $00000001; (* texture should be kept in video memory *)
9391
  D3DRMTEXTURE_STATIC                 = $00000002; (* texture will not change *)
9392
  D3DRMTEXTURE_DOWNSAMPLEPOINT        = $00000004; (* point filtering should be used when downsampling *)
9393
  D3DRMTEXTURE_DOWNSAMPLEBILINEAR     = $00000008; (* bilinear filtering should be used when downsampling *)
9394
  D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH  = $00000010; (* reduce bit depth when downsampling *)
9395
  D3DRMTEXTURE_DOWNSAMPLENONE         = $00000020; (* texture should never be downsampled *)
9396
  D3DRMTEXTURE_CHANGEDPIXELS          = $00000040; (* pixels have changed *)
9397
  D3DRMTEXTURE_CHANGEDPALETTE         = $00000080; (* palette has changed *)
9398
  D3DRMTEXTURE_INVALIDATEONLY         = $00000100; (* dirty regions are invalid *)
1 daniel-mar 9399
 
4 daniel-mar 9400
(*
9401
 * Shadow flags
9402
 *)
9403
   D3DRMSHADOW_TRUEALPHA               = $00000001; (* shadow should render without artifacts when true alpha is on *)
1 daniel-mar 9404
 
9405
type
4 daniel-mar 9406
  PD3DRMCombineType = ^TD3DRMCombineType;
1 daniel-mar 9407
  TD3DRMCombineType = (
4 daniel-mar 9408
    D3DRMCOMBINE_REPLACE,
9409
    D3DRMCOMBINE_BEFORE,
9410
    D3DRMCOMBINE_AFTER
1 daniel-mar 9411
  );
9412
 
4 daniel-mar 9413
  PD3DRMColorModel = ^TD3DRMColorModel;
1 daniel-mar 9414
  TD3DRMColorModel = TD3DColorModel;
9415
 
4 daniel-mar 9416
  PD3DRMPaletteFlags = ^TD3DRMPaletteFlags;
1 daniel-mar 9417
  TD3DRMPaletteFlags = (
4 daniel-mar 9418
    D3DRMPALETTE_FREE,                  (* renderer may use this entry freely *)
9419
    D3DRMPALETTE_READONLY,              (* fixed but may be used by renderer *)
9420
    D3DRMPALETTE_RESERVED               (* may not be used by renderer *)
1 daniel-mar 9421
  );
9422
 
9423
  PD3DRMPaletteEntry = ^TD3DRMPaletteEntry;
4 daniel-mar 9424
  TD3DRMPaletteEntry = packed record
9425
    red: Byte;          (* 0 .. 255 *)
9426
    green: Byte;        (* 0 .. 255 *)
9427
    blue: Byte;         (* 0 .. 255 *)
9428
    flags: Byte;        (* one of D3DRMPALETTEFLAGS *)
1 daniel-mar 9429
  end;
9430
 
9431
  PD3DRMImage = ^TD3DRMImage;
4 daniel-mar 9432
  TD3DRMImage = packed record
1 daniel-mar 9433
    width, height: Integer;    (* width and height in pixels *)
9434
    aspectx, aspecty: Integer; (* aspect ratio for non-square pixels *)
9435
    depth: Integer;            (* bits per pixel *)
9436
    rgb: Integer;              (* if false, pixels are indices into a
9437
                                   palette otherwise, pixels encode
9438
                                   RGB values. *)
9439
    bytes_per_line: Integer;   (* number of bytes of memory for a
9440
                                   scanline. This must be a multiple
9441
                                   of 4. *)
9442
    buffer1: Pointer;          (* memory to render into (first buffer). *)
9443
    buffer2: Pointer;          (* second rendering buffer for double
9444
                                   buffering, set to NULL for single
9445
                                   buffering. *)
4 daniel-mar 9446
    red_mask: DWORD;
9447
    green_mask: DWORD;
9448
    blue_mask: DWORD;
9449
    alpha_mask: DWORD;        (* if rgb is true, these are masks for
1 daniel-mar 9450
                                   the red, green and blue parts of a
9451
                                   pixel.  Otherwise, these are masks
9452
                                   for the significant bits of the
9453
                                   red, green and blue elements in the
9454
                                   palette.  For instance, most SVGA
9455
                                   displays use 64 intensities of red,
9456
                                   green and blue, so the masks should
9457
                                   all be set to = $fc. *)
9458
    palette_size: Integer;     (* number of entries in palette *)
9459
    palette: PD3DRMPaletteEntry; (* description of the palette (only if
9460
                                   rgb is false).  Must be (1<<depth)
9461
                                   elements. *)
9462
  end;
9463
 
4 daniel-mar 9464
  PD3DRMWrapType = ^TD3DRMWrapType;
1 daniel-mar 9465
  TD3DRMWrapType = (
9466
    D3DRMWRAP_FLAT,
9467
    D3DRMWRAP_CYLINDER,
9468
    D3DRMWRAP_SPHERE,
9469
    D3DRMWRAP_CHROME,
9470
    D3DRMWRAP_SHEET,
9471
    D3DRMWRAP_BOX
9472
  );
9473
 
9474
const
4 daniel-mar 9475
  D3DRMWIREFRAME_CULL             = 1; (* cull backfaces *)
9476
  D3DRMWIREFRAME_HIDDENLINE       = 2; (* lines are obscured by closer objects *)
1 daniel-mar 9477
 
9478
type
4 daniel-mar 9479
(*
9480
 * Do not use righthanded perspective in Viewport2::SetProjection().
9481
 * Set up righthanded mode by using IDirect3DRM3::SetOptions().
9482
 *)
9483
  PD3DRMProjectionType = ^TD3DRMProjectionType;
1 daniel-mar 9484
  TD3DRMProjectionType = (
9485
    D3DRMPROJECT_PERSPECTIVE,
9486
    D3DRMPROJECT_ORTHOGRAPHIC,
4 daniel-mar 9487
    D3DRMPROJECT_RIGHTHANDPERSPECTIVE, (* Only valid pre-DX6 *)
9488
    D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC (* Only valid pre-DX6 *)
1 daniel-mar 9489
  );
9490
 
9491
const
4 daniel-mar 9492
  D3DRMOPTIONS_LEFTHANDED  = 00000001; (* Default *)
9493
  D3DRMOPTIONS_RIGHTHANDED = 00000002;
1 daniel-mar 9494
 
9495
type
4 daniel-mar 9496
  PD3DRMXOFFormat = ^TD3DRMXOFFormat;
1 daniel-mar 9497
  TD3DRMXOFFormat = (
9498
    D3DRMXOF_BINARY,
9499
    D3DRMXOF_COMPRESSED,
9500
    D3DRMXOF_TEXT
9501
  );
9502
 
9503
  TD3DRMSaveOptions = DWORD;
9504
const
9505
  D3DRMXOFSAVE_NORMALS = 1;
9506
  D3DRMXOFSAVE_TEXTURECOORDINATES = 2;
9507
  D3DRMXOFSAVE_MATERIALS = 4;
9508
  D3DRMXOFSAVE_TEXTURENAMES = 8;
9509
  D3DRMXOFSAVE_ALL = 15;
9510
  D3DRMXOFSAVE_TEMPLATES = 16;
9511
  D3DRMXOFSAVE_TEXTURETOPOLOGY = 32;
9512
 
9513
type
4 daniel-mar 9514
  PD3DRMColorSource = ^TD3DRMColorSource;
1 daniel-mar 9515
  TD3DRMColorSource = (
9516
    D3DRMCOLOR_FROMFACE,
9517
    D3DRMCOLOR_FROMVERTEX
9518
  );
9519
 
4 daniel-mar 9520
  PD3DRMFrameConstraint = ^TD3DRMFrameConstraint;
1 daniel-mar 9521
  TD3DRMFrameConstraint = (
4 daniel-mar 9522
    D3DRMCONSTRAIN_Z,           (* use only X and Y rotations *)
9523
    D3DRMCONSTRAIN_Y,           (* use only X and Z rotations *)
9524
    D3DRMCONSTRAIN_X            (* use only Y and Z rotations *)
1 daniel-mar 9525
  );
9526
 
4 daniel-mar 9527
  PD3DRMMaterialMode = ^TD3DRMMaterialMode;
1 daniel-mar 9528
  TD3DRMMaterialMode = (
9529
    D3DRMMATERIAL_FROMMESH,
9530
    D3DRMMATERIAL_FROMPARENT,
9531
    D3DRMMATERIAL_FROMFRAME
9532
  );
9533
 
4 daniel-mar 9534
  PD3DRMFogMode = ^TD3DRMFogMode;
1 daniel-mar 9535
  TD3DRMFogMode = (
4 daniel-mar 9536
    D3DRMFOG_LINEAR,            (* linear between start and end *)
9537
    D3DRMFOG_EXPONENTIAL,       (* density * exp(-distance) *)
9538
    D3DRMFOG_EXPONENTIALSQUARED (* density * exp(-distance*distance) *)
1 daniel-mar 9539
  );
9540
 
4 daniel-mar 9541
  PD3DRMZBufferMode = ^TD3DRMZBufferMode;
1 daniel-mar 9542
  TD3DRMZBufferMode = (
4 daniel-mar 9543
    D3DRMZBUFFER_FROMPARENT,    (* default *)
9544
    D3DRMZBUFFER_ENABLE,        (* enable zbuffering *)
9545
    D3DRMZBUFFER_DISABLE        (* disable zbuffering *)
1 daniel-mar 9546
  );
9547
 
4 daniel-mar 9548
  PD3DRMSortMode = ^TD3DRMSortMode;
1 daniel-mar 9549
  TD3DRMSortMode = (
4 daniel-mar 9550
    D3DRMSORT_FROMPARENT,       (* default *)
9551
    D3DRMSORT_NONE,             (* don't sort child frames *)
9552
    D3DRMSORT_FRONTTOBACK,      (* sort child frames front-to-back *)
9553
    D3DRMSORT_BACKTOFRONT       (* sort child frames back-to-front *)
1 daniel-mar 9554
  );
9555
 
4 daniel-mar 9556
  TD3DRMMaterialOverride = packed record
9557
    dwSize : DWORD;       (* Size of this structure *)
9558
    dwFlags : DWORD;      (* Indicate which fields are valid *)
9559
    dcDiffuse : TD3DColorValue;    (* RGBA *)
9560
    dcAmbient : TD3DColorValue;    (* RGB *)
9561
    dcEmissive : TD3DColorValue;   (* RGB *)
9562
    dcSpecular : TD3DColorValue;   (* RGB *)
9563
    dvPower : TD3DValue;
9564
    lpD3DRMTex : IUnknown;
1 daniel-mar 9565
  end;
9566
 
9567
const
9568
  D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY     = $00000001;
9569
  D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY       = $00000002;
9570
  D3DRMMATERIALOVERRIDE_DIFFUSE               = $00000003;
9571
  D3DRMMATERIALOVERRIDE_AMBIENT               = $00000004;
9572
  D3DRMMATERIALOVERRIDE_EMISSIVE              = $00000008;
9573
  D3DRMMATERIALOVERRIDE_SPECULAR              = $00000010;
9574
  D3DRMMATERIALOVERRIDE_POWER                 = $00000020;
9575
  D3DRMMATERIALOVERRIDE_TEXTURE               = $00000040;
9576
  D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY = $00000080;
9577
  D3DRMMATERIALOVERRIDE_ALL                   = $000000FF;
9578
 
4 daniel-mar 9579
  D3DRMFPTF_ALPHA                           = $00000001;
9580
  D3DRMFPTF_NOALPHA                         = $00000002;
9581
  D3DRMFPTF_PALETTIZED                      = $00000004;
9582
  D3DRMFPTF_NOTPALETTIZED                   = $00000008;
1 daniel-mar 9583
 
4 daniel-mar 9584
  D3DRMSTATECHANGE_UPDATEONLY               = $000000001;
9585
  D3DRMSTATECHANGE_VOLATILE                 = $000000002;
9586
  D3DRMSTATECHANGE_NONVOLATILE              = $000000004;
9587
  D3DRMSTATECHANGE_RENDER                   = $000000020;
9588
  D3DRMSTATECHANGE_LIGHT                    = $000000040;
1 daniel-mar 9589
 
4 daniel-mar 9590
(*
9591
 * Values for flags in RM3::CreateDeviceFromSurface
9592
 *)
9593
  D3DRMDEVICE_NOZBUFFER           = $00000001;
1 daniel-mar 9594
 
4 daniel-mar 9595
(*
9596
 * Values for flags in Object2::SetClientData
9597
 *)
9598
  D3DRMCLIENTDATA_NONE            = $00000001;
9599
  D3DRMCLIENTDATA_LOCALFREE       = $00000002;
9600
  D3DRMCLIENTDATA_IUNKNOWN        = $00000004;
1 daniel-mar 9601
 
4 daniel-mar 9602
(*
9603
 * Values for flags in Frame2::AddMoveCallback.
9604
 *)
9605
  D3DRMCALLBACK_PREORDER                = 0;
9606
  D3DRMCALLBACK_POSTORDER               = 1;
1 daniel-mar 9607
 
4 daniel-mar 9608
(*
9609
 * Values for flags in MeshBuilder2::RayPick.
9610
 *)
9611
  D3DRMRAYPICK_ONLYBOUNDINGBOXES        = 1;
9612
  D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES  = 2;
9613
  D3DRMRAYPICK_INTERPOLATEUV            = 4;
9614
  D3DRMRAYPICK_INTERPOLATECOLOR         = 8;
9615
  D3DRMRAYPICK_INTERPOLATENORMAL        = $10;
1 daniel-mar 9616
 
4 daniel-mar 9617
(*
9618
 * Values for flags in MeshBuilder3::AddFacesIndexed.
9619
 *)
9620
  D3DRMADDFACES_VERTICESONLY             = 1;
1 daniel-mar 9621
 
4 daniel-mar 9622
(*
9623
 * Values for flags in MeshBuilder2::GenerateNormals.
9624
 *)
9625
  D3DRMGENERATENORMALS_PRECOMPACT       = 1;
9626
  D3DRMGENERATENORMALS_USECREASEANGLE   = 2;
1 daniel-mar 9627
 
4 daniel-mar 9628
(*
9629
 * Values for MeshBuilder3::GetParentMesh
9630
 *)
9631
  D3DRMMESHBUILDER_DIRECTPARENT          = 1;
9632
  D3DRMMESHBUILDER_ROOTMESH              = 2;
1 daniel-mar 9633
 
4 daniel-mar 9634
(*
9635
 * Flags for MeshBuilder3::Enable
9636
 *)
9637
  D3DRMMESHBUILDER_RENDERENABLE   = $00000001;
9638
  D3DRMMESHBUILDER_PICKENABLE     = $00000002;
1 daniel-mar 9639
 
4 daniel-mar 9640
(*
9641
 * Flags for Object2::GetAge when used with MeshBuilders
9642
 *)
9643
  D3DRMMESHBUILDERAGE_GEOMETRY    = $00000001;
9644
  D3DRMMESHBUILDERAGE_MATERIALS   = $00000002;
9645
  D3DRMMESHBUILDERAGE_TEXTURES    = $00000004;
1 daniel-mar 9646
 
4 daniel-mar 9647
(*
9648
 * Format flags for MeshBuilder3::AddTriangles.
9649
 *)
9650
  D3DRMFVF_TYPE                   = $00000001;
9651
  D3DRMFVF_NORMAL                 = $00000002;
9652
  D3DRMFVF_COLOR                  = $00000004;
9653
  D3DRMFVF_TEXTURECOORDS          = $00000008;
1 daniel-mar 9654
 
4 daniel-mar 9655
  D3DRMVERTEX_STRIP               = $00000001;
9656
  D3DRMVERTEX_FAN                 = $00000002;
9657
  D3DRMVERTEX_LIST                = $00000004;
1 daniel-mar 9658
 
4 daniel-mar 9659
(*
9660
 * Values for flags in Viewport2::Clear2
9661
 *)
9662
  D3DRMCLEAR_TARGET               = $00000001;
9663
  D3DRMCLEAR_ZBUFFER              = $00000002;
9664
  D3DRMCLEAR_DIRTYRECTS           = $00000004;
9665
  D3DRMCLEAR_ALL                  = (D3DRMCLEAR_TARGET or
9666
                                         D3DRMCLEAR_ZBUFFER or
9667
                                         D3DRMCLEAR_DIRTYRECTS);
1 daniel-mar 9668
 
4 daniel-mar 9669
(*
9670
 * Values for flags in Frame3::SetSceneFogMethod
9671
 *)
9672
  D3DRMFOGMETHOD_VERTEX          = $00000001;
9673
  D3DRMFOGMETHOD_TABLE           = $00000002;
9674
  D3DRMFOGMETHOD_ANY             = $00000004;
1 daniel-mar 9675
 
4 daniel-mar 9676
(*
9677
 * Values for flags in Frame3::SetTraversalOptions
9678
 *)
9679
  D3DRMFRAME_RENDERENABLE        = $00000001;
9680
  D3DRMFRAME_PICKENABLE          = $00000002;
1 daniel-mar 9681
 
9682
type
9683
  TD3DRMAnimationOptions = DWORD;
9684
 
9685
const
4 daniel-mar 9686
  D3DRMANIMATION_OPEN = $01;
9687
  D3DRMANIMATION_CLOSED = $02;
9688
  D3DRMANIMATION_LINEARPOSITION = $04;
9689
  D3DRMANIMATION_SPLINEPOSITION = $08;
1 daniel-mar 9690
  D3DRMANIMATION_SCALEANDROTATION = $00000010;
4 daniel-mar 9691
  D3DRMANIMATION_POSITION = $00000020;
1 daniel-mar 9692
 
9693
type
9694
  TD3DRMInterpolationOptions = DWORD;
9695
const
4 daniel-mar 9696
  D3DRMINTERPOLATION_OPEN = $01;
9697
  D3DRMINTERPOLATION_CLOSED = $02;
9698
  D3DRMINTERPOLATION_NEAREST = $0100;
9699
  D3DRMINTERPOLATION_LINEAR = $04;
9700
  D3DRMINTERPOLATION_SPLINE = $08;
9701
  D3DRMINTERPOLATION_VERTEXCOLOR = $40;
1 daniel-mar 9702
  D3DRMINTERPOLATION_SLERPNORMALS = $80;
9703
 
9704
type
9705
  TD3DRMLoadOptions = DWORD;
9706
 
9707
const
9708
  D3DRMLOAD_FROMFILE  = $00;
9709
  D3DRMLOAD_FROMRESOURCE = $01;
9710
  D3DRMLOAD_FROMMEMORY = $02;
9711
  D3DRMLOAD_FROMSTREAM = $04;
9712
  D3DRMLOAD_FROMURL = $08;
9713
 
9714
  D3DRMLOAD_BYNAME = $10;
9715
  D3DRMLOAD_BYPOSITION = $20;
9716
  D3DRMLOAD_BYGUID = $40;
9717
  D3DRMLOAD_FIRST = $80;
9718
 
9719
  D3DRMLOAD_INSTANCEBYREFERENCE = $100;
9720
  D3DRMLOAD_INSTANCEBYCOPYING = $200;
9721
 
9722
  D3DRMLOAD_ASYNCHRONOUS = $400;
9723
 
9724
type
4 daniel-mar 9725
  PD3DRMLoadResource = ^TD3DRMLoadResource;
9726
  TD3DRMLoadResource = packed record
1 daniel-mar 9727
    hModule: HMODULE;
4 daniel-mar 9728
    lpName: PAnsiChar;
9729
    lpType: PAnsiChar;
1 daniel-mar 9730
  end;
9731
 
9732
  PD3DRMLoadMemory = ^TD3DRMLoadMemory;
4 daniel-mar 9733
  TD3DRMLoadMemory = packed record
1 daniel-mar 9734
    lpMemory: Pointer;
4 daniel-mar 9735
    dwSize: DWORD;
1 daniel-mar 9736
  end;
9737
 
9738
const
4 daniel-mar 9739
  D3DRMPMESHSTATUS_VALID = $01;
9740
  D3DRMPMESHSTATUS_INTERRUPTED = $02;
1 daniel-mar 9741
  D3DRMPMESHSTATUS_BASEMESHCOMPLETE = $04;
4 daniel-mar 9742
  D3DRMPMESHSTATUS_COMPLETE = $08;
9743
  D3DRMPMESHSTATUS_RENDERABLE = $10;
1 daniel-mar 9744
 
9745
  D3DRMPMESHEVENT_BASEMESH = $01;
9746
  D3DRMPMESHEVENT_COMPLETE = $02;
9747
 
9748
type
9749
  PD3DRMPMeshLoadStatus = ^TD3DRMPMeshLoadStatus;
4 daniel-mar 9750
  TD3DRMPMeshLoadStatus = packed record
9751
    dwSize,            // Size of this structure
9752
    dwPMeshSize,       // Total Size (bytes)
9753
    dwBaseMeshSize,    // Total Size of the Base Mesh
9754
    dwBytesLoaded,     // Total bytes loaded
9755
    dwVerticesLoaded,  // Number of vertices loaded
9756
    dwFacesLoaded : DWORD;     // Number of faces loaded
9757
    dwLoadResult : HResult;    // Result of the load operation
9758
    dwFlags : DWORD;
1 daniel-mar 9759
  end;
9760
 
4 daniel-mar 9761
  PD3DRMUserVisualReason = ^TD3DRMUserVisualReason;
1 daniel-mar 9762
  TD3DRMUserVisualReason = (
9763
    D3DRMUSERVISUAL_CANSEE,
9764
    D3DRMUSERVISUAL_RENDER
9765
  );
9766
 
4 daniel-mar 9767
  PD3DRMAnimationKey = ^TD3DRMAnimationKey;
9768
  TD3DRMAnimationKey = packed record
9769
    dwSize : DWORD;
9770
    dwKeyType : DWORD;
9771
    dvTime : TD3DValue;
9772
    dwID : DWORD;
9773
    case integer of
9774
 
9775
      1 : (dvScaleKey : TD3DVector);
9776
      2 : (dvPositionKey : TD3DVector);
9777
      3 : (dvK : array [0..3] of TD3DValue);
9778
    end;
1 daniel-mar 9779
 
4 daniel-mar 9780
procedure D3DRMAnimationGetRotateKey
9781
    (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
1 daniel-mar 9782
 
4 daniel-mar 9783
procedure D3DRMAnimationGetScaleKey
9784
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 9785
 
4 daniel-mar 9786
procedure D3DRMAnimationGetPositionKey
9787
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 9788
 
4 daniel-mar 9789
procedure D3DRMAnimatioSetRotateKey
9790
    (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
1 daniel-mar 9791
 
4 daniel-mar 9792
procedure D3DRMAnimationSetScaleKey
9793
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 9794
 
4 daniel-mar 9795
procedure D3DRMAnimationSetPositionKey
9796
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
9797
 
1 daniel-mar 9798
const
4 daniel-mar 9799
  D3DRMANIMATION_ROTATEKEY = 01;
9800
  D3DRMANIMATION_SCALEKEY = 02;
9801
  D3DRMANIMATION_POSITIONKEY = 03;
1 daniel-mar 9802
 
9803
type
9804
  TD3DRMMapping = DWORD;
4 daniel-mar 9805
  PD3DRMMappingFlag = ^TD3DRMMappingFlag;
1 daniel-mar 9806
  TD3DRMMappingFlag = DWORD;
9807
 
9808
const
4 daniel-mar 9809
  D3DRMMAP_WRAPU = 1;
9810
  D3DRMMAP_WRAPV = 2;
1 daniel-mar 9811
  D3DRMMAP_PERSPCORRECT = 4;
9812
 
9813
type
9814
  PD3DRMVertex = ^TD3DRMVertex;
4 daniel-mar 9815
  TD3DRMVertex = packed record
1 daniel-mar 9816
    position: TD3DVector;
9817
    normal: TD3DVector;
9818
    tu, tv: TD3DValue;
9819
    color: TD3DColor;
9820
  end;
9821
 
4 daniel-mar 9822
  TD3DRMGroupIndex = LongInt; (* group indexes begin a 0 *)
1 daniel-mar 9823
 
9824
const
9825
  D3DRMGROUP_ALLGROUPS = -1;
9826
 
4 daniel-mar 9827
var
9828
(*
9829
 * Create a color from three components in the range 0-1 inclusive.
9830
 *)
9831
  D3DRMCreateColorRGB : function (red, green, blue: TD3DValue) : TD3DColor;
9832
      stdcall;
1 daniel-mar 9833
 
4 daniel-mar 9834
(*
9835
 * Create a color from four components in the range 0-1 inclusive.
9836
 *)
9837
  D3DRMCreateColorRGBA : function (red, green, blue, alpha: TD3DValue)
9838
      : TD3DColor; stdcall;
1 daniel-mar 9839
 
4 daniel-mar 9840
(*
9841
 * Get the red component of a color.
9842
 *)
9843
  D3DRMColorGetRed : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
1 daniel-mar 9844
 
4 daniel-mar 9845
(*
9846
 * Get the green component of a color.
9847
 *)
9848
  D3DRMColorGetGreen : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
1 daniel-mar 9849
 
4 daniel-mar 9850
(*
9851
 * Get the blue component of a color.
9852
 *)
9853
  D3DRMColorGetBlue : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
1 daniel-mar 9854
 
4 daniel-mar 9855
(*
9856
 * Get the alpha component of a color.
9857
 *)
9858
  D3DRMColorGetAlpha : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
1 daniel-mar 9859
 
4 daniel-mar 9860
(*
9861
 * Add two vectors.  Returns its first argument.
9862
 *)
9863
  D3DRMVectorAdd : function (var d, s1, s2: TD3DVector) : PD3DVector; stdcall;
1 daniel-mar 9864
 
4 daniel-mar 9865
(*
9866
 * Subtract two vectors.  Returns its first argument.
9867
 *)
9868
  D3DRMVectorSubtract : function (var d, s1, s2: TD3DVector) : PD3DVector;
9869
      stdcall;
1 daniel-mar 9870
 
4 daniel-mar 9871
(*
9872
 * Reflect a ray about a given normal.  Returns its first argument.
9873
 *)
9874
  D3DRMVectorReflect : function (var d, ray, norm: TD3DVector) : PD3DVector;
9875
      stdcall;
1 daniel-mar 9876
 
4 daniel-mar 9877
(*
9878
 * Calculate the vector cross product.  Returns its first argument.
9879
 *)
9880
  D3DRMVectorCrossProduct : function (var d, s1, s2: TD3DVector) : PD3DVector;
9881
      stdcall;
1 daniel-mar 9882
 
4 daniel-mar 9883
(*
9884
 * Return the vector dot product.
9885
 *)
9886
  D3DRMVectorDotProduct : function (var s1, s2: TD3DVector) : TD3DValue;
9887
      stdcall;
1 daniel-mar 9888
 
4 daniel-mar 9889
(*
9890
 * Scale a vector so that its modulus is 1.  Returns its argument or
9891
 * NULL if there was an error (e.g. a zero vector was passed).
9892
 *)
9893
  D3DRMVectorNormalize : function (var lpv: TD3DVector) : PD3DVector; stdcall;
1 daniel-mar 9894
 
4 daniel-mar 9895
(*
9896
 * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
9897
 *)
9898
  D3DRMVectorModulus : function (var v: TD3DVector) : TD3DValue; stdcall;
1 daniel-mar 9899
 
4 daniel-mar 9900
(*
9901
 * Set the rotation part of a matrix to be a rotation of theta radians
9902
 * around the given axis.
9903
 *)
9904
  D3DRMVectorRotate : function (var r, v, axis: TD3DVector; theta: TD3DValue) :
9905
      PD3DVector; stdcall;
1 daniel-mar 9906
 
4 daniel-mar 9907
(*
9908
 * Scale a vector uniformly in all three axes
9909
 *)
9910
  D3DRMVectorScale : function (var d, s: TD3DVector; factor: TD3DValue) :
9911
      PD3DVector; stdcall;
1 daniel-mar 9912
 
4 daniel-mar 9913
(*
9914
 * Return a random unit vector
9915
 *)
9916
  D3DRMVectorRandom : function (var d: TD3DVector) : PD3DVector; stdcall;
1 daniel-mar 9917
 
4 daniel-mar 9918
(*
9919
 * Returns a unit quaternion that represents a rotation of theta radians
9920
 * around the given axis.
9921
 *)
1 daniel-mar 9922
 
4 daniel-mar 9923
  D3DRMQuaternionFromRotation : function (var quat: TD3DRMQuaternion;
9924
      var v: TD3DVector; theta: TD3DValue) : PD3DRMQuaternion; stdcall;
1 daniel-mar 9925
 
4 daniel-mar 9926
(*
9927
 * Calculate the product of two quaternions
9928
 *)
9929
  D3DRMQuaternionMultiply : function (var q, a, b: TD3DRMQuaternion) :
9930
      PD3DRMQuaternion; stdcall;
1 daniel-mar 9931
 
4 daniel-mar 9932
(*
9933
 * Interpolate between two quaternions
9934
 *)
9935
  D3DRMQuaternionSlerp : function (var q, a, b: TD3DRMQuaternion;
9936
      alpha: TD3DValue) : PD3DRMQuaternion; stdcall;
1 daniel-mar 9937
 
4 daniel-mar 9938
(*
9939
 * Calculate the matrix for the rotation that a unit quaternion represents
9940
 *)
9941
  D3DRMMatrixFromQuaternion : procedure (dmMat: TD3DRMMatrix4D; var lpDqQuat:
9942
      TD3DRMQuaternion); stdcall;
1 daniel-mar 9943
 
4 daniel-mar 9944
(*
9945
 * Calculate the quaternion that corresponds to a rotation matrix
9946
 *)
9947
  D3DRMQuaternionFromMatrix : function (var lpQuat: TD3DRMQuaternion;
9948
      Mat: TD3DRMMatrix4D) : PD3DRMQuaternion; stdcall;
9949
 
1 daniel-mar 9950
(*==========================================================================;
9951
 *
9952
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
9953
 *
4 daniel-mar 9954
 *  File:       d3drmobj.h
1 daniel-mar 9955
 *  Content:    Direct3DRM include file
9956
 *
9957
 ***************************************************************************)
9958
 
4 daniel-mar 9959
(*
9960
 * Direct3DRM Object classes
9961
 *)
9962
 
1 daniel-mar 9963
const
4 daniel-mar 9964
  CLSID_CDirect3DRMDevice: TGUID =
9965
      (D1:$4fa3568e;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9966
  CLSID_CDirect3DRMViewport: TGUID =
9967
      (D1:$4fa3568f;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9968
  CLSID_CDirect3DRMFrame: TGUID =
9969
      (D1:$4fa35690;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9970
  CLSID_CDirect3DRMMesh: TGUID =
9971
      (D1:$4fa35691;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9972
  CLSID_CDirect3DRMMeshBuilder: TGUID =
9973
      (D1:$4fa35692;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9974
  CLSID_CDirect3DRMFace: TGUID =
9975
      (D1:$4fa35693;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9976
  CLSID_CDirect3DRMLight: TGUID =
9977
      (D1:$4fa35694;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9978
  CLSID_CDirect3DRMTexture: TGUID =
9979
      (D1:$4fa35695;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9980
  CLSID_CDirect3DRMWrap: TGUID =
9981
      (D1:$4fa35696;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9982
  CLSID_CDirect3DRMMaterial: TGUID =
9983
      (D1:$4fa35697;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9984
  CLSID_CDirect3DRMAnimation: TGUID =
9985
      (D1:$4fa35698;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9986
  CLSID_CDirect3DRMAnimationSet: TGUID =
9987
      (D1:$4fa35699;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9988
  CLSID_CDirect3DRMUserVisual: TGUID =
9989
      (D1:$4fa3569a;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9990
  CLSID_CDirect3DRMShadow: TGUID =
9991
      (D1:$4fa3569b;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9992
  CLSID_CDirect3DRMViewportInterpolator: TGUID =
9993
      (D1:$0de9eaa1;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
9994
  CLSID_CDirect3DRMFrameInterpolator: TGUID =
9995
      (D1:$0de9eaa2;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
9996
  CLSID_CDirect3DRMMeshInterpolator: TGUID =
9997
      (D1:$0de9eaa3;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
9998
  CLSID_CDirect3DRMLightInterpolator: TGUID =
9999
      (D1:$0de9eaa6;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
10000
  CLSID_CDirect3DRMMaterialInterpolator: TGUID =
10001
      (D1:$0de9eaa7;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
10002
  CLSID_CDirect3DRMTextureInterpolator: TGUID =
10003
      (D1:$0de9eaa8;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
10004
  CLSID_CDirect3DRMProgressiveMesh: TGUID =
10005
      (D1:$4516ec40;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
10006
  CLSID_CDirect3DRMClippedVisual: TGUID =
10007
      (D1:$5434e72d;D2:$6d66;D3:$11d1;D4:($bb,$0b,$00,$00,$f8,$75,$86,$5a));
1 daniel-mar 10008
 
10009
 
10010
 
10011
type
10012
  IDirect3DRMObject = interface;
10013
  IDirect3DRMDevice = interface;
10014
  IDirect3DRMDevice2 = interface;
10015
  IDirect3DRMDevice3 = interface;
10016
  IDirect3DRMViewport = interface;
10017
  IDirect3DRMViewport2 = interface;
10018
  IDirect3DRMFrame = interface;
10019
  IDirect3DRMFrame2 = interface;
10020
  IDirect3DRMFrame3 = interface;
10021
  IDirect3DRMVisual = interface;
10022
  IDirect3DRMMesh = interface;
10023
  IDirect3DRMMeshBuilder = interface;
10024
  IDirect3DRMMeshBuilder2 = interface;
10025
  IDirect3DRMMeshBuilder3 = interface;
10026
  IDirect3DRMFace = interface;
10027
  IDirect3DRMFace2 = interface;
10028
  IDirect3DRMLight = interface;
10029
  IDirect3DRMTexture = interface;
10030
  IDirect3DRMTexture2 = interface;
10031
  IDirect3DRMTexture3 = interface;
10032
  IDirect3DRMWrap = interface;
10033
  IDirect3DRMMaterial = interface;
10034
  IDirect3DRMMaterial2 = interface;
10035
  IDirect3DRMAnimation = interface;
10036
  IDirect3DRMAnimation2 = interface;
10037
  IDirect3DRMAnimationSet = interface;
10038
  IDirect3DRMAnimationSet2 = interface;
4 daniel-mar 10039
  IDirect3DRMArray = interface;
1 daniel-mar 10040
  IDirect3DRMObjectArray = interface;
10041
  IDirect3DRMDeviceArray = interface;
10042
  IDirect3DRMViewportArray = interface;
10043
  IDirect3DRMFrameArray = interface;
10044
  IDirect3DRMVisualArray = interface;
4 daniel-mar 10045
  IDirect3DRMLightArray = interface;
1 daniel-mar 10046
  IDirect3DRMPickedArray = interface;
4 daniel-mar 10047
  IDirect3DRMFaceArray = interface;
10048
  IDirect3DRMAnimationArray = interface;
10049
  IDirect3DRMUserVisual = interface;
10050
  IDirect3DRMShadow = interface;
10051
  IDirect3DRMShadow2 = interface;
10052
  IDirect3DRMInterpolator = interface;
10053
  IDirect3DRMProgressiveMesh = interface;
1 daniel-mar 10054
  IDirect3DRMPicked2Array = interface;
10055
  IDirect3DRMClippedVisual = interface;
10056
 
4 daniel-mar 10057
(*
10058
 * Direct3DRM Object interfaces
10059
 *)
10060
  IID_IDirect3DRMObject =          IDirect3DRMObject;
10061
  IID_IDirect3DRMDevice =          IDirect3DRMDevice;
10062
  IID_IDirect3DRMDevice2 =         IDirect3DRMDevice2;
10063
  IID_IDirect3DRMDevice3 =         IDirect3DRMDevice3;
10064
  IID_IDirect3DRMViewport =        IDirect3DRMViewport;
10065
  IID_IDirect3DRMViewport2 =       IDirect3DRMViewport2;
10066
  IID_IDirect3DRMFrame =           IDirect3DRMFrame;
10067
  IID_IDirect3DRMFrame2 =          IDirect3DRMFrame2;
10068
  IID_IDirect3DRMFrame3 =          IDirect3DRMFrame3;
10069
  IID_IDirect3DRMVisual =          IDirect3DRMVisual;
10070
  IID_IDirect3DRMMesh =            IDirect3DRMMesh;
10071
  IID_IDirect3DRMMeshBuilder =     IDirect3DRMMeshBuilder;
10072
  IID_IDirect3DRMMeshBuilder2 =    IDirect3DRMMeshBuilder2;
10073
  IID_IDirect3DRMMeshBuilder3 =    IDirect3DRMMeshBuilder3;
10074
  IID_IDirect3DRMFace =            IDirect3DRMFace;
10075
  IID_IDirect3DRMFace2 =           IDirect3DRMFace2;
10076
  IID_IDirect3DRMLight =           IDirect3DRMLight;
10077
  IID_IDirect3DRMTexture =         IDirect3DRMTexture;
10078
  IID_IDirect3DRMTexture2 =        IDirect3DRMTexture2;
10079
  IID_IDirect3DRMTexture3 =        IDirect3DRMTexture3;
10080
  IID_IDirect3DRMWrap =            IDirect3DRMWrap;
10081
  IID_IDirect3DRMMaterial =        IDirect3DRMMaterial;
10082
  IID_IDirect3DRMMaterial2 =       IDirect3DRMMaterial2;
10083
  IID_IDirect3DRMAnimation =       IDirect3DRMAnimation;
10084
  IID_IDirect3DRMAnimation2 =      IDirect3DRMAnimation2;
10085
  IID_IDirect3DRMAnimationSet =    IDirect3DRMAnimationSet;
10086
  IID_IDirect3DRMAnimationSet2 =   IDirect3DRMAnimationSet2;
10087
  IID_IDirect3DRMObjectArray =     IDirect3DRMObjectArray;
10088
  IID_IDirect3DRMDeviceArray =     IDirect3DRMDeviceArray;
10089
  IID_IDirect3DRMViewportArray =   IDirect3DRMViewportArray;
10090
  IID_IDirect3DRMFrameArray =      IDirect3DRMFrameArray;
10091
  IID_IDirect3DRMVisualArray =     IDirect3DRMVisualArray;
10092
  IID_IDirect3DRMLightArray =      IDirect3DRMLightArray;
10093
  IID_IDirect3DRMPickedArray =     IDirect3DRMPickedArray;
10094
  IID_IDirect3DRMFaceArray =       IDirect3DRMFaceArray;
10095
  IID_IDirect3DRMAnimationArray =  IDirect3DRMAnimationArray;
10096
  IID_IDirect3DRMUserVisual =      IDirect3DRMUserVisual;
10097
  IID_IDirect3DRMShadow =          IDirect3DRMShadow;
10098
  IID_IDirect3DRMShadow2 =         IDirect3DRMShadow2;
10099
  IID_IDirect3DRMInterpolator =    IDirect3DRMInterpolator;
10100
  IID_IDirect3DRMProgressiveMesh = IDirect3DRMProgressiveMesh;
10101
  IID_IDirect3DRMPicked2Array =    IDirect3DRMPicked2Array;
10102
  IID_IDirect3DRMClippedVisual =   IDirect3DRMClippedVisual;
1 daniel-mar 10103
 
10104
 
10105
 
10106
 
10107
 
4 daniel-mar 10108
  PIDirect3DRMFaceArray = ^IDirect3DRMFaceArray;
1 daniel-mar 10109
 
4 daniel-mar 10110
  TD3DRMObjectCallback = procedure (lpD3DRMobj: IDirect3DRMObject;
10111
      lpArg: Pointer); cdecl;
10112
  TD3DRMFrameMoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame;
10113
      lpArg: Pointer; delta: TD3DValue); cdecl;
10114
  TD3DRMFrame3MoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame3;
10115
      lpArg: Pointer; delta: TD3DValue); cdecl;
10116
  TD3DRMUpdateCallback = procedure (lpobj: IDirect3DRMDevice; lpArg: Pointer;
10117
      iRectCount: Integer; const d3dRectUpdate: TD3DRect); cdecl;
10118
  TD3DRMDevice3UpdateCallback = procedure (lpobj: IDirect3DRMDevice3;
10119
      lpArg: Pointer; iRectCount: Integer; const d3dRectUpdate: TD3DRect);cdecl;
10120
  TD3DRMUserVisualCallback = function (lpD3DRMUV: IDirect3DRMUserVisual;
1 daniel-mar 10121
      lpArg: Pointer; lpD3DRMUVreason: TD3DRMUserVisualReason;
10122
      lpD3DRMDev: IDirect3DRMDevice;
4 daniel-mar 10123
      lpD3DRMview: IDirect3DRMViewport) : Integer; cdecl;
10124
  TD3DRMLoadTextureCallback = function (tex_name: PAnsiChar; lpArg: Pointer;
10125
      out lpD3DRMTex: IDirect3DRMTexture) : HResult; cdecl;
10126
  TD3DRMLoadTexture3Callback = function (tex_name: PAnsiChar; lpArg: Pointer;
10127
      out lpD3DRMTex: IDirect3DRMTexture3) : HResult; cdecl;
10128
  TD3DRMLoadCallback = procedure (lpObject: IDirect3DRMObject;
10129
      const ObjectGuid: TGUID; lpArg: Pointer); cdecl;
10130
  TD3DRMDownSampleCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
10131
      pArg: pointer; pDDSSrc, pDDSDst: IDirectDrawSurface) : HResult; cdecl;
10132
  TD3DRMValidationCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
10133
      pArg: pointer; dwFlags, DWcRects: DWORD; const pRects: TRect) : HResult; cdecl;
1 daniel-mar 10134
 
10135
  PD3DRMPickDesc = ^TD3DRMPickDesc;
4 daniel-mar 10136
  TD3DRMPickDesc = packed record
10137
    ulFaceIdx: DWORD;
10138
    lGroupIdx: LongInt;
1 daniel-mar 10139
    vPosition: TD3DVector;
10140
  end;
10141
 
10142
  PD3DRMPickDesc2 = ^TD3DRMPickDesc2;
4 daniel-mar 10143
  TD3DRMPickDesc2 = packed record
10144
    ulFaceIdx: DWORD;
10145
    lGroupIdx: LongInt;
1 daniel-mar 10146
    dvPosition: TD3DVector;
10147
    tu, tv: TD3DValue;
10148
    dvNormal: TD3DVector;
10149
    dcColor: TD3DColor;
10150
  end;
10151
 
4 daniel-mar 10152
(*
10153
 * Base class
10154
 *)
10155
{$IFDEF D2COM}
10156
  IDirect3DRMObject = class (IUnknown)
10157
{$ELSE}
10158
  IDirect3DRMObject = interface (IUnknown)
10159
    ['{eb16cb00-d271-11ce-ac48-0000c03825a1}']
10160
{$ENDIF}
10161
    (*
10162
     * The methods for IDirect3DRMObject
10163
     *)
10164
    function Clone (pUnkOuter: IUnknown; riid: TGUID;
10165
        var ppvObj: Pointer) : HResult; stdcall;
10166
    function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
10167
        lpArg: Pointer) : HResult; stdcall;
10168
    function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
10169
        lpArg: Pointer) : HResult; stdcall;
10170
    function SetAppData (ulData: DWORD) : HResult; stdcall;
1 daniel-mar 10171
    function GetAppData: DWORD; stdcall;
4 daniel-mar 10172
    function SetName (lpName: PAnsiChar) : HResult; stdcall;
10173
    function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
10174
    function GetClassName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
1 daniel-mar 10175
  end;
10176
 
4 daniel-mar 10177
  IDirect3DRMVisual = interface (IDirect3DRMObject)
1 daniel-mar 10178
  end;
10179
 
4 daniel-mar 10180
  IDirect3DRMDevice = interface (IDirect3DRMObject)
10181
    ['{e9e19280-6e05-11cf-ac4a-0000c03825a1}']
10182
    (*
10183
     * IDirect3DRMDevice methods
10184
     *)
10185
    function Init (width: LongInt; height: LongInt) : HResult; stdcall;
10186
    function InitFromD3D (lpD3D: IDirect3D; lpD3DIMDev: IDirect3DDevice) : HResult; stdcall;
10187
    function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
10188
        width: Integer; height: Integer) : HResult; stdcall;
1 daniel-mar 10189
    function Update: HResult; stdcall;
4 daniel-mar 10190
    function AddUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
10191
        arg: Pointer) : HResult; stdcall;
10192
    function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
10193
        arg: Pointer) : HResult; stdcall;
10194
    function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
1 daniel-mar 10195
    function GetBufferCount: DWORD; stdcall;
4 daniel-mar 10196
    function SetDither (bDither: BOOL) : HResult; stdcall;
10197
    function SetShades (ulShades: DWORD) : HResult; stdcall;
10198
    function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
10199
    function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
10200
    function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
1 daniel-mar 10201
    function GetDither: BOOL; stdcall;
10202
    function GetShades: DWORD; stdcall;
10203
    function GetHeight: DWORD; stdcall;
10204
    function GetWidth: DWORD; stdcall;
10205
    function GetTrianglesDrawn: DWORD; stdcall;
10206
    function GetWireframeOptions: DWORD; stdcall;
10207
    function GetQuality: TD3DRMRenderQuality; stdcall;
10208
    function GetColorModel: TD3DColorModel; stdcall;
10209
    function GetTextureQuality: TD3DRMTextureQuality; stdcall;
4 daniel-mar 10210
    function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
1 daniel-mar 10211
  end;
10212
 
4 daniel-mar 10213
  IDirect3DRMDevice2 = interface (IDirect3DRMDevice)
10214
    ['{4516ec78-8f20-11d0-9b6d-0000c0781bc3}']
10215
    (*
10216
     * IDirect3DRMDevice2 methods
10217
     *)
10218
    function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
10219
    function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw; lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
10220
    function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
10221
    function GetRenderMode : DWORD; stdcall;
10222
    function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
1 daniel-mar 10223
  end;
10224
 
4 daniel-mar 10225
  IDirect3DRMDevice3 = interface (IDirect3DRMObject)
10226
    ['{549f498b-bfeb-11d1-8ed8-00a0c967a482}']
10227
    (*
10228
     * IDirect3DRMDevice methods
10229
     *)
10230
    function Init (width: LongInt; height: LongInt) : HResult; stdcall;
10231
    function InitFromD3D (lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
10232
    function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
10233
        width: Integer; height: Integer) : HResult; stdcall;
10234
    function Update: HResult; stdcall;
10235
    function AddUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
10236
        arg: Pointer) : HResult; stdcall;
10237
    function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
10238
        arg: Pointer) : HResult; stdcall;
10239
    function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
10240
    function GetBufferCount: DWORD; stdcall;
10241
    function SetDither (bDither: BOOL) : HResult; stdcall;
10242
    function SetShades (ulShades: DWORD) : HResult; stdcall;
10243
    function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
10244
    function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
10245
    function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
10246
    function GetDither: BOOL; stdcall;
10247
    function GetShades: DWORD; stdcall;
10248
    function GetHeight: DWORD; stdcall;
10249
    function GetWidth: DWORD; stdcall;
10250
    function GetTrianglesDrawn: DWORD; stdcall;
10251
    function GetWireframeOptions: DWORD; stdcall;
10252
    function GetQuality: TD3DRMRenderQuality; stdcall;
10253
    function GetColorModel: TD3DColorModel; stdcall;
10254
    function GetTextureQuality: TD3DRMTextureQuality; stdcall;
10255
    function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
10256
    (*
10257
     * IDirect3DRMDevice2 methods
10258
     *)
10259
    function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
10260
    function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
10261
            lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
10262
    function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
10263
    function GetRenderMode : DWORD; stdcall;
10264
    function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
10265
    (*
10266
     * IDirect3DRMDevice3 methods
10267
     *)
10268
    function FindPreferredTextureFormat (dwBitDepths, dwFlags: DWORD;
10269
        out lpDDPF: TDDPixelFormat) : HResult; stdcall;
10270
    function RenderStateChange (dwStateNum, dwVal, dwFlags: DWORD) : HResult; stdcall;
10271
 
10272
    function LightStateChange (drsType: TD3DLightStateType; // defined different in header and help
10273
        dwVal, dwFlags: DWORD) : HResult; stdcall;
10274
    function GetStateChangeOptions (dwStateClass, dwStateNum: DWORD;
10275
        var pdwFlags: DWORD) : HResult; stdcall;
10276
    function SetStateChangeOptions ( dwStateClass, dwStateNum, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 10277
  end;
10278
 
4 daniel-mar 10279
  IDirect3DRMViewport = interface (IDirect3DRMObject)
10280
    ['{eb16cb02-d271-11ce-ac48-0000c03825a1}']
10281
    (*
10282
     * IDirect3DRMViewport methods
10283
     *)
10284
    function Init (lpD3DRMDevice: IDirect3DRMDevice;
10285
        lpD3DRMFrameCamera: IDirect3DRMFrame; xpos, ypos,
10286
        width, height: DWORD) : HResult; stdcall;
1 daniel-mar 10287
    function Clear: HResult; stdcall;
4 daniel-mar 10288
    function Render (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
10289
    function SetFront (rvFront: TD3DValue) : HResult; stdcall;
10290
    function SetBack (rvBack: TD3DValue) : HResult; stdcall;
10291
    function SetField (rvField: TD3DValue) : HResult; stdcall;
10292
    function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
10293
    function SetCamera (lpCamera: IDirect3DRMFrame) : HResult; stdcall;
10294
    function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
10295
    function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
10296
    function InverseTransform (out lprvDst: TD3DVector;
10297
        const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
10298
    function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
10299
    function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
10300
    function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
10301
    function GetCamera (out lpCamera: IDirect3DRMFrame) : HResult; stdcall;
10302
    function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
10303
    function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
10304
        TD3DValue) : HResult; stdcall;
10305
    function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
10306
    function GetUniformScaling: BOOL;  stdcall;
10307
    function GetX: LongInt; stdcall;
10308
    function GetY: LongInt; stdcall;
1 daniel-mar 10309
    function GetWidth: DWORD; stdcall;
10310
    function GetHeight: DWORD; stdcall;
10311
    function GetField: TD3DValue; stdcall;
10312
    function GetBack: TD3DValue; stdcall;
10313
    function GetFront: TD3DValue; stdcall;
10314
    function GetProjection: TD3DRMProjectionType; stdcall;
4 daniel-mar 10315
    function GetDirect3DViewport (out lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
1 daniel-mar 10316
  end;
10317
 
4 daniel-mar 10318
  IDirect3DRMViewport2 = interface (IDirect3DRMObject)
10319
    ['{4a1b1be6-bfed-11d1-8ed8-00a0c967a482}']
10320
    (*
10321
     * IDirect3DRMViewport2 methods
10322
     *)
10323
    function Init (lpD3DRMDevice: IDirect3DRMDevice3;
10324
        lpD3DRMFrameCamera: IDirect3DRMFrame3; xpos, ypos,
10325
        width, height: DWORD) : HResult; stdcall;
10326
    function Clear (dwFlags: DWORD): HResult; stdcall;
10327
    function Render (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
10328
    function SetFront (rvFront: TD3DValue) : HResult; stdcall;
10329
    function SetBack (rvBack: TD3DValue) : HResult; stdcall;
10330
    function SetField (rvField: TD3DValue) : HResult; stdcall;
10331
    function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
10332
    function SetCamera (lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
10333
    function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
10334
    function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
10335
    function InverseTransform (out lprvDst: TD3DVector;
10336
        const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
10337
    function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
10338
    function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
10339
    function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
10340
    function GetCamera (out lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
10341
    function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
10342
    function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
10343
        TD3DValue) : HResult; stdcall;
10344
    function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
1 daniel-mar 10345
    function GetUniformScaling: BOOL; stdcall;
4 daniel-mar 10346
    function GetX: LongInt; stdcall;
10347
    function GetY: LongInt; stdcall;
1 daniel-mar 10348
    function GetWidth: DWORD; stdcall;
10349
    function GetHeight: DWORD; stdcall;
10350
    function GetField: TD3DValue; stdcall;
10351
    function GetBack: TD3DValue; stdcall;
10352
    function GetFront: TD3DValue; stdcall;
10353
    function GetProjection: TD3DRMProjectionType; stdcall;
4 daniel-mar 10354
    function GetDirect3DViewport (var lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
10355
    function TransformVectors (dwNumVectors: DWORD; out lpDstVectors:
10356
        TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
10357
    function InverseTransformVectors (dwNumVectors: DWORD; out lpDstVectors:
10358
        TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
1 daniel-mar 10359
  end;
10360
 
4 daniel-mar 10361
  IDirect3DRMFrame = interface (IDirect3DRMVisual)
10362
    ['{eb16cb03-d271-11ce-ac48-0000c03825a1}']
10363
    (*
10364
     * IDirect3DRMFrame methods
10365
     *)
10366
    function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame) : HResult; stdcall;
10367
    function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10368
    function AddMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
10369
        lpArg: Pointer) : HResult; stdcall;
10370
    function AddTransform (rctCombine: TD3DRMCombineType;
10371
        rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
10372
    function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
10373
        TD3DValue) : HResult; stdcall;
10374
    function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
10375
    function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
10376
        rvTheta: TD3DValue) : HResult; stdcall;
10377
    function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
10378
    function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
1 daniel-mar 10379
    function GetColor: TD3DColor; stdcall;
4 daniel-mar 10380
    function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
1 daniel-mar 10381
    function GetMaterialMode: TD3DRMMaterialMode; stdcall;
4 daniel-mar 10382
    function GetParent (out lplpParent: IDirect3DRMFrame) : HResult; stdcall;
10383
    function GetPosition (lpRef: IDirect3DRMFrame; out lprvPos: TD3DVector) : HResult; stdcall;
10384
    function GetRotation (lpRef: IDirect3DRMFrame; out lprvAxis: TD3DVector;
10385
        out lprvTheta: TD3DValue) : HResult; stdcall;
10386
    function GetScene (out lplpRoot: IDirect3DRMFrame) : HResult; stdcall;
1 daniel-mar 10387
    function GetSortMode: TD3DRMSortMode; stdcall;
4 daniel-mar 10388
    function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
10389
    function GetTransform (out rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
10390
    function GetVelocity (lpRef: IDirect3DRMFrame; var lprvVel: TD3DVector;
10391
        fRotVel: BOOL) : HResult; stdcall;
10392
    function GetOrientation (lpRef: IDirect3DRMFrame; var lprvDir: TD3DVector;
10393
        var lprvUp: TD3DVector) : HResult; stdcall;
10394
    function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
10395
    function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
10396
    function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
10397
    function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
1 daniel-mar 10398
        d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
4 daniel-mar 10399
        TD3DRMLoadTextureCallback; lpArgLTP: Pointer) : HResult; stdcall;
10400
    function LookAt (lpTarget, lpRef: IDirect3DRMFrame;
10401
        rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
10402
    function Move (delta: TD3DValue) : HResult; stdcall;
10403
    function DeleteChild (lpChild: IDirect3DRMFrame) : HResult; stdcall;
10404
    function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10405
    function DeleteMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
10406
        lpArg: Pointer) : HResult; stdcall;
10407
    function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
1 daniel-mar 10408
    function GetSceneBackground: TD3DColor; stdcall;
4 daniel-mar 10409
    function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
1 daniel-mar 10410
    function GetSceneFogColor: TD3DColor; stdcall;
10411
    function GetSceneFogEnable: BOOL; stdcall;
10412
    function GetSceneFogMode: TD3DRMFogMode; stdcall;
4 daniel-mar 10413
    function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
10414
    function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
10415
    function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
10416
    function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
10417
    function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture) : HResult; stdcall;
10418
    function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
10419
    function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
10420
    function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
10421
    function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
10422
    function SetColor (rcColor: TD3DColor) : HResult; stdcall;
10423
    function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
1 daniel-mar 10424
    function GetZbufferMode: TD3DRMZBufferMode; stdcall;
4 daniel-mar 10425
    function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
10426
    function SetOrientation (lpRef: IDirect3DRMFrame; rvDx, rvDy, rvDz, rvUx,
10427
        rvUy, rvUz: TD3DValue) : HResult; stdcall;
10428
    function SetPosition (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
10429
    function SetRotation (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ,
10430
        rvTheta: TD3DValue) : HResult; stdcall;
10431
    function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
10432
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
10433
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10434
    function SetVelocity (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue;
10435
        fRotVel: BOOL) : HResult; stdcall;
10436
    function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
10437
    function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
1 daniel-mar 10438
  end;
10439
 
4 daniel-mar 10440
  IDirect3DRMFrame2 = interface (IDirect3DRMFrame)
10441
    ['{c3dfbd60-3988-11d0-9ec2-0000c0291ac3}']
10442
    (*
10443
     * IDirect3DRMFrame2 methods
10444
     *)
10445
    function AddMoveCallback2 (d3drmFMC: TD3DRMFrameMoveCallback; lpArg:
10446
        Pointer; dwFlags: DWORD) : HResult; stdcall;
10447
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10448
    function GetBoxEnable : boolean; stdcall;
10449
    function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
10450
    function GetMaterial (out lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
10451
    function GetInheritAxes : boolean; stdcall;
10452
    function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10453
    function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10454
    function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
10455
    function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
10456
    function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
10457
    function SetMaterial (var lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
10458
    function SetQuaternion (lpRef: IDirect3DRMFrame;
10459
        const quat: TD3DRMQuaternion) : HResult; stdcall;
10460
    function RayPick (lpRefFrame: IDirect3DRMFrame; var ray: TD3DRMRay;
10461
        dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) :
10462
        HResult; stdcall;
10463
    function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
10464
        d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
1 daniel-mar 10465
  end;
10466
 
4 daniel-mar 10467
  IDirect3DRMFrame3 = interface (IDirect3DRMVisual)
10468
    ['{ff6b7f70-a40e-11d1-91f9-0000f8758e66}']
10469
    (*
10470
     * IDirect3DRMFrame3 methods
10471
     *)
10472
    function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame3) : HResult; stdcall;
10473
    function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10474
    function AddMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback;
10475
        lpArg: Pointer; dwFlags: DWORD) : HResult; stdcall;
10476
    function AddTransform (rctCombine: TD3DRMCombineType;
10477
        rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
10478
    function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
10479
        TD3DValue) : HResult; stdcall;
10480
    function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
10481
    function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
10482
        rvTheta: TD3DValue) : HResult; stdcall;
10483
    function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
10484
    function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
1 daniel-mar 10485
    function GetColor: TD3DColor; stdcall;
4 daniel-mar 10486
    function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
1 daniel-mar 10487
    function GetMaterialMode: TD3DRMMaterialMode; stdcall;
4 daniel-mar 10488
    function GetParent (out lplpParent: IDirect3DRMFrame3) : HResult; stdcall;
10489
    function GetPosition (lpRef: IDirect3DRMFrame3; out lprvPos: TD3DVector) : HResult; stdcall;
10490
    function GetRotation (lpRef: IDirect3DRMFrame3; out lprvAxis: TD3DVector;
10491
        out lprvTheta: TD3DValue) : HResult; stdcall;
10492
    function GetScene (out lplpRoot: IDirect3DRMFrame3) : HResult; stdcall;
1 daniel-mar 10493
    function GetSortMode: TD3DRMSortMode; stdcall;
4 daniel-mar 10494
    function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
10495
    function GetTransform (lpRefFrame: IDirect3DRMFrame3;
10496
        var rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
10497
    function GetVelocity (lpRef: IDirect3DRMFrame3; out lprvVel: TD3DVector;
10498
        fRotVel: BOOL) : HResult; stdcall;
10499
    function GetOrientation (lpRef: IDirect3DRMFrame3; out lprvDir: TD3DVector;
10500
        out lprvUp: TD3DVector) : HResult; stdcall;
10501
    function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
10502
    function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
10503
    function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
1 daniel-mar 10504
        d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
4 daniel-mar 10505
        TD3DRMLoadTexture3Callback; lpArgLTP: Pointer) : HResult; stdcall;
10506
    function LookAt (lpTarget, lpRef: IDirect3DRMFrame3;
10507
        rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
10508
    function Move (delta: TD3DValue) : HResult; stdcall;
10509
    function DeleteChild (lpChild: IDirect3DRMFrame3) : HResult; stdcall;
10510
    function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10511
    function DeleteMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback; lpArg: Pointer) : HResult; stdcall;
10512
    function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
1 daniel-mar 10513
    function GetSceneBackground: TD3DColor; stdcall;
4 daniel-mar 10514
    function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
1 daniel-mar 10515
    function GetSceneFogColor: TD3DColor; stdcall;
10516
    function GetSceneFogEnable: BOOL; stdcall;
10517
    function GetSceneFogMode: TD3DRMFogMode; stdcall;
4 daniel-mar 10518
    function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
10519
    function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
10520
    function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
10521
    function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
10522
    function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture3) : HResult; stdcall;
10523
    function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
10524
    function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
10525
    function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
10526
    function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
10527
    function SetColor (rcColor: TD3DColor) : HResult; stdcall;
10528
    function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
1 daniel-mar 10529
    function GetZbufferMode: TD3DRMZBufferMode; stdcall;
4 daniel-mar 10530
    function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
10531
    function SetOrientation (lpRef: IDirect3DRMFrame3; rvDx, rvDy, rvDz, rvUx,
10532
        rvUy, rvUz: TD3DValue) : HResult; stdcall;
10533
    function SetPosition (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue) :
10534
        HResult; stdcall;
10535
    function SetRotation (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ,
10536
        rvTheta: TD3DValue) : HResult; stdcall;
10537
    function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
10538
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
10539
    function SetVelocity (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue;
10540
        fRotVel: BOOL) : HResult; stdcall;
10541
    function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
10542
    function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
10543
 
10544
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10545
    function GetBoxEnable : boolean; stdcall;
10546
    function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
10547
    function GetMaterial (out lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
10548
    function GetInheritAxes : boolean; stdcall;
10549
    function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10550
    function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10551
    function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
10552
    function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
10553
    function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
10554
    function SetMaterial (var lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
10555
    function SetQuaternion (lpRef: IDirect3DRMFrame3;
10556
        const quat: TD3DRMQuaternion) : HResult; stdcall;
10557
    function RayPick (lpRefFrame: IDirect3DRMFrame3; var ray: TD3DRMRay;
10558
        dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) : HResult; stdcall;
10559
    function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
10560
        d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
10561
    function TransformVectors (lpRefFrame: IDirect3DRMFrame3;
10562
        dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
10563
        const lpSrcVectors: TD3DVector) : HResult; stdcall;
10564
    function InverseTransformVectors (lpRefFrame: IDirect3DRMFrame3;
10565
        dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
10566
        const lpSrcVectors: TD3DVector) : HResult; stdcall;
10567
    function SetTraversalOptions (dwFlags: DWORD) : HResult; stdcall;
10568
    function GetTraversalOptions (out lpdwFlags: DWORD) : HResult; stdcall;
10569
    function SetSceneFogMethod (dwFlags: DWORD) : HResult; stdcall;
10570
    function GetSceneFogMethod (out lpdwFlags: DWORD) : HResult; stdcall;
10571
    function SetMaterialOverride (
10572
        const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
10573
    function GetMaterialOverride (
10574
        const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
1 daniel-mar 10575
  end;
10576
 
4 daniel-mar 10577
 
10578
  IDirect3DRMMesh = interface (IDirect3DRMVisual)
10579
    ['{a3a80d01-6e12-11cf-ac4a-0000c03825a1}']
10580
    (*
10581
     * IDirect3DRMMesh methods
10582
     *)
10583
    function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
10584
    function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
10585
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10586
    function AddGroup (vCount, fCount, vPerFace: DWORD; var fData: DWORD;
10587
        var returnId: TD3DRMGroupIndex) : HResult; stdcall;
10588
    function SetVertices (id: TD3DRMGroupIndex; index, count: DWORD;
10589
        var values: TD3DRMVertex) : HResult; stdcall;
10590
    function SetGroupColor (id: TD3DRMGroupIndex; value: TD3DColor) : HResult; stdcall;
10591
    function SetGroupColorRGB (id: TD3DRMGroupIndex; red, green,
10592
        blue: TD3DValue) : HResult; stdcall;
10593
    function SetGroupMapping (id: TD3DRMGroupIndex;
10594
        value: TD3DRMMapping) : HResult; stdcall;
10595
    function SetGroupQuality (id: TD3DRMGroupIndex;
10596
        value: TD3DRMRenderQuality) : HResult; stdcall;
10597
    function SetGroupMaterial (id: TD3DRMGroupIndex; value:
10598
        IDirect3DRMMaterial) : HResult; stdcall;
10599
    function SetGroupTexture (id: TD3DRMGroupIndex; value: IDirect3DRMTexture) : HResult; stdcall;
1 daniel-mar 10600
    function GetGroupCount: DWORD; stdcall;
4 daniel-mar 10601
    function GetGroup (id: TD3DRMGroupIndex; vCount, fCount, vPerFace : PDWORD;
10602
        var fDataSize: DWORD; fData: PDWORD) : HResult; stdcall;
10603
    function GetVertices (id: TD3DRMGroupIndex; index, count : DWORD;
10604
        out returnPtr : TD3DRMVertex) : HResult; stdcall;
10605
    function GetGroupColor (id: TD3DRMGroupIndex) : TD3DColor; stdcall;
10606
    function GetGroupMapping (id: TD3DRMGroupIndex) : TD3DRMMapping; stdcall;
10607
    function GetGroupQuality (id: TD3DRMGroupIndex) : TD3DRMRenderQuality; stdcall;
10608
    function GetGroupMaterial (id: TD3DRMGroupIndex;
10609
        out returnPtr: IDirect3DRMMaterial) : HResult; stdcall;
10610
    function GetGroupTexture (id: TD3DRMGroupIndex;
10611
        out returnPtr: IDirect3DRMTexture) : HResult; stdcall;
1 daniel-mar 10612
  end;
10613
 
4 daniel-mar 10614
  IDirect3DRMProgressiveMesh = interface (IDirect3DRMVisual)
10615
    ['{4516ec79-8f20-11d0-9b6d-0000c0781bc3}']
10616
    (*
10617
     * IDirect3DRMProgressiveMesh methods
10618
     *)
10619
    function Load (lpSource, lpObjID: pointer; dloLoadflags : TD3DRMLoadOptions;
10620
        lpCallback: TD3DRMLoadTextureCallback; lpArg: pointer) : HResult; stdcall;
10621
    function GetLoadStatus (out lpStatus: TD3DRMPMeshLoadStatus) : HResult; stdcall;
10622
    function SetMinRenderDetail (d3dVal: TD3DValue) : HResult; stdcall;
10623
    function Abort (dwFlags: DWORD) : HResult; stdcall;
10624
    function GetFaceDetail (out lpdwCount: DWORD) : HResult; stdcall;
10625
    function GetVertexDetail (out lpdwCount: DWORD) : HResult; stdcall;
10626
    function SetFaceDetail (dwCount: DWORD) : HResult; stdcall;
10627
    function SetVertexDetail (dwCount: DWORD) : HResult; stdcall;
10628
    function GetFaceDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
10629
    function GetVertexDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
10630
    function GetDetail (out lpdvVal: TD3DValue) : HResult; stdcall;
10631
    function SetDetail (lpdvVal: TD3DValue) : HResult; stdcall;
10632
    function RegisterEvents (hEvent: THANDLE; dwFlags, dwReserved: DWORD) : HResult; stdcall;
10633
    function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
10634
    function Duplicate (out lplpD3DRMPMesh: IDirect3DRMProgressiveMesh) : HResult; stdcall;
10635
    function GetBox (out lpBBox: TD3DRMBox) : HResult; stdcall;
10636
    function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
10637
    function GetQuality (out lpdwquality: TD3DRMRenderQuality) : HResult; stdcall;
1 daniel-mar 10638
  end;
10639
 
4 daniel-mar 10640
  IDirect3DRMShadow = interface (IDirect3DRMVisual)
10641
    ['{af359780-6ba3-11cf-ac4a-0000c03825a1}']
10642
    (*
10643
     * IDirect3DRMShadow methods
10644
     *)
10645
    function Init (lpD3DRMVisual: IDirect3DRMVisual;
10646
        lpD3DRMLight: IDirect3DRMLight;
10647
        px, py, pz, nx, ny, nz: TD3DValue) : HResult; stdcall;
1 daniel-mar 10648
  end;
10649
 
4 daniel-mar 10650
  IDirect3DRMShadow2 = interface (IDirect3DRMShadow)
10651
    ['{86b44e25-9c82-11d1-bb0b-00a0c981a0a6}']
10652
    (*
10653
     * IDirect3DRMShadow2 methods
10654
     *)
10655
    function GetVisual (out lplpDirect3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
10656
    function SetVisual (lpDirect3DRMVisual: IDirect3DRMVisual;
10657
        dwFlags: DWORD) : HResult; stdcall;
10658
    function GetLight (out lplpDirect3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10659
    function SetLight (lplpDirect3DRMLight: IDirect3DRMLight;
10660
        dwFlags: DWORD) : HResult; stdcall;
10661
    function GetPlane (
10662
        var pdvPX, pdvPY, pdvPZ, pdvNX, pdvNY, pdvNZ: TD3DValue) : HResult; stdcall;
10663
    function SetPlane (px, py, pz, nx, ny, nz: TD3DValue;
10664
        dwFlags: DWORD) : HResult; stdcall;
10665
    function GetOptions (out pdwOptions: DWORD) : HResult; stdcall;
10666
    function SetOptions (dwOptions: DWORD) : HResult; stdcall;
10667
 
1 daniel-mar 10668
  end;
10669
 
4 daniel-mar 10670
  IDirect3DRMFace = interface (IDirect3DRMObject)
10671
    ['{eb16cb07-d271-11ce-ac48-0000c03825a1}']
10672
    (*
10673
     * IDirect3DRMFace methods
10674
     *)
10675
    function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
10676
    function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
10677
    function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
10678
    function SetColor (color: TD3DColor) : HResult; stdcall;
10679
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
10680
    function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
10681
    function SetMaterial (lpMat: IDirect3DRMMaterial) : HResult; stdcall;
10682
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10683
    function GetVertex (index: DWORD; out lpPosition: TD3DVector;
10684
        out lpNormal: TD3DVector) : HResult; stdcall;
10685
    function GetVertices (var lpdwVertexCount: DWORD;
10686
        out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
10687
    function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
10688
    function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
10689
    function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
10690
    function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
10691
    function GetMaterial (out lpMat: IDirect3DRMMaterial) : HResult; stdcall;
10692
    function GetVertexCount: Integer; stdcall;
10693
    function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
10694
    function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
1 daniel-mar 10695
    function GetColor: TD3DColor; stdcall;
10696
  end;
10697
 
4 daniel-mar 10698
  IDirect3DRMFace2 = interface (IDirect3DRMObject)
10699
    ['{4516ec81-8f20-11d0-9b6d-0000c0781bc3}']
10700
    (*
10701
     * IDirect3DRMFace2 methods
10702
     *)
10703
    function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
10704
    function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
10705
    function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
10706
    function SetColor (color: TD3DColor) : HResult; stdcall;
10707
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
10708
    function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
10709
    function SetMaterial (lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
10710
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10711
    function GetVertex (index: DWORD; out lpPosition: TD3DVector;
10712
        out lpNormal: TD3DVector) : HResult; stdcall;
10713
    function GetVertices (var lpdwVertexCount: DWORD;
10714
        out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
10715
    function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
10716
    function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
10717
    function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
10718
    function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
10719
    function GetMaterial (out lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
10720
    function GetVertexCount: Integer; stdcall;
10721
    function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
10722
    function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
1 daniel-mar 10723
    function GetColor: TD3DColor; stdcall;
10724
  end;
10725
 
4 daniel-mar 10726
  IDirect3DRMMeshBuilder = interface (IDirect3DRMVisual)
10727
    ['{a3a80d02-6e12-11cf-ac4a-0000c03825a1}']
10728
    (*
10729
     * IDirect3DRMMeshBuilder methods
10730
     *)
10731
    function Load (lpvObjSource, lpvObjID: Pointer; d3drmLOFlags:
10732
        TD3DRMLoadOptions; d3drmLoadTextureProc: TD3DRMLoadTextureCallback;
10733
        lpvArg: Pointer) : HResult; stdcall;
10734
    function Save (lpFilename: PChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
10735
        d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
10736
    function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
10737
    function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
10738
    function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
10739
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10740
    function GenerateNormals : HResult; stdcall;
1 daniel-mar 10741
    function GetColorSource: TD3DRMColorSource; stdcall;
4 daniel-mar 10742
    function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
10743
    function AddMeshBuilder (lpD3DRMMeshBuild: IDirect3DRMMeshBuilder) : HResult; stdcall;
10744
    function AddFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
10745
    function AddFace (lpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
10746
    function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
10747
        normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
10748
        lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
10749
    function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
10750
    function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
10751
    function SetColor (color: TD3DColor) : HResult; stdcall;
10752
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
10753
    function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial) : HResult; stdcall;
10754
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10755
    function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
10756
    function SetPerspective (perspective: BOOL) : HResult; stdcall;
10757
    function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
10758
    function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
10759
    function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
10760
    function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
10761
    function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
10762
    function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
10763
    function GetVertices (var vcount: DWORD; var vertices : TD3DVector;
10764
        var ncount : DWORD;
10765
        var normals : TD3DVector;
10766
        var face_data_size, face_data : DWORD) : HResult; stdcall;
10767
    function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
10768
    function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
10769
    function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
10770
    function CreateFace (out lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
1 daniel-mar 10771
    function GetQuality: TD3DRMRenderQuality; stdcall;
10772
    function GetPerspective: BOOL; stdcall;
4 daniel-mar 10773
    function GetFaceCount: Integer; stdcall;
10774
    function GetVertexCount: Integer; stdcall;
10775
    function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
10776
    function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
1 daniel-mar 10777
  end;
10778
 
4 daniel-mar 10779
  IDirect3DRMMeshBuilder2 = interface (IDirect3DRMMeshBuilder)
10780
    ['{4516ec77-8f20-11d0-9b6d-0000c0781bc3}']
10781
    (*
10782
     * IDirect3DRMMeshBuilder2 methods
10783
     *)
10784
    function GenerateNormals2 (
10785
        dvCreaseAngle: TD3DValue; dwFlags: DWORD) : HResult; stdcall;
10786
    function GetFace (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
1 daniel-mar 10787
  end;
10788
 
4 daniel-mar 10789
  IDirect3DRMMeshBuilder3 = interface (IDirect3DRMVisual)
10790
    ['{ff6b7f71-a40e-11d1-91f9-0000f8758e66}']
10791
    (*
10792
     * IDirect3DRMMeshBuilder3 methods
10793
     *)
10794
    function Load (lpvObjSource, lpvObjID: Pointer;
10795
        d3drmLOFlags: TD3DRMLoadOptions;
10796
        d3drmLoadTextureProc: TD3DRMLoadTexture3Callback;
10797
        lpvArg: Pointer) : HResult; stdcall;
10798
    function Save (lpFilename: PAnsiChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
10799
        d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
10800
    function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
10801
    function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
10802
    function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
10803
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10804
    function GenerateNormals (
10805
        dvCreaseAngle: TD3DValue; dwFlags: DWORD): HResult; stdcall;
1 daniel-mar 10806
    function GetColorSource: TD3DRMColorSource; stdcall;
4 daniel-mar 10807
    function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
10808
    function AddMeshBuilder (
10809
        lpD3DRMMeshBuild: IDirect3DRMMeshBuilder3) : HResult; stdcall;
10810
    function AddFrame (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
10811
    function AddFace (lpD3DRMFace: IDirect3DRMFace2) : HResult; stdcall;
10812
    function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
10813
        normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
10814
        lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
10815
    function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
10816
    function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
10817
    function SetColor (color: TD3DColor) : HResult; stdcall;
10818
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
10819
    function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial2) : HResult; stdcall;
10820
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10821
    function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
10822
    function SetPerspective (perspective: BOOL) : HResult; stdcall;
10823
    function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
10824
    function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
10825
    function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
10826
    function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
10827
    function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
10828
    function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
10829
    function GetGeometry (var vcount: DWORD; var vertices : TD3DVector;
10830
        var ncount : DWORD; var normals : TD3DVector;
10831
        var face_data_size, face_data : DWORD) : HResult; stdcall;
10832
    function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
10833
    function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
10834
    function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
10835
    function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
1 daniel-mar 10836
    function GetQuality: TD3DRMRenderQuality; stdcall;
10837
    function GetPerspective: BOOL; stdcall;
4 daniel-mar 10838
    function GetFaceCount: Integer; stdcall;
10839
    function GetVertexCount: Integer; stdcall;
10840
    function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
10841
    function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
10842
    function GetFace
10843
        (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
10844
    function GetVertex (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
10845
    function GetNormal (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
10846
    function DeleteVertices (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
10847
    function DeleteNormals (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
10848
    function DeleteFace (lpFace: IDirect3DRMFace2) : HResult; stdcall;
10849
    function Empty (dwFlags: DWORD) : HResult; stdcall;
10850
    function Optimize (dwFlags: DWORD) : HResult; stdcall;
10851
    function AddFacesIndexed (dwFlags: DWORD; var lpdwvIndices: DWORD;
10852
        lpdwIndexFirst, lpdwCount: PDWORD) : HResult; stdcall;
10853
    function CreateSubMesh (out lplpUnk: IUnknown) : HResult; stdcall;
10854
    function GetParentMesh (dwFlags: DWORD; out lplpUnk: IUnknown) : HResult; stdcall;
10855
    function GetSubMeshes (lpdwCount: PDWORD; lpUnk: IUnknown) : HResult; stdcall;
10856
    function DeleteSubMesh (lplpUnk: IUnknown) : HResult; stdcall;
10857
    function Enable (dwFlags: DWORD) : HResult; stdcall;
10858
    function GetEnable (out lpdwFlags: DWORD) : HResult; stdcall;
10859
    function AddTriangles (dwFlags, dwFormat, dwVertexCount:  DWORD;
10860
        lpData: pointer) : HResult; stdcall;
10861
    function SetVertices
10862
        (dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
10863
    function GetVertices(dwFirst: DWORD; var lpdwCount: DWORD;
10864
        lpdvVector: PD3DVector) : HResult; stdcall;
10865
    function SetNormals(dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
10866
    function GetNormals (dwFirst: DWORD; lpdwCount: PDWORD;
10867
        var lpdvVector: TD3DVector) : HResult; stdcall;
10868
    function GetNormalCount : integer; stdcall;
1 daniel-mar 10869
  end;
10870
 
4 daniel-mar 10871
  IDirect3DRMLight = interface (IDirect3DRMObject)
10872
    ['{eb16cb08-d271-11ce-ac48-0000c03825a1}']
10873
    (*
10874
     * IDirect3DRMLight methods
10875
     *)
10876
    function SetType (d3drmtType: TD3DRMLightType) : HResult; stdcall;
10877
    function SetColor (rcColor: TD3DColor) : HResult; stdcall;
10878
    function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
10879
    function SetRange (rvRange: TD3DValue) : HResult; stdcall;
10880
    function SetUmbra (rvAngle: TD3DValue) : HResult; stdcall;
10881
    function SetPenumbra (rvAngle: TD3DValue) : HResult; stdcall;
10882
    function SetConstantAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
10883
    function SetLinearAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
10884
    function SetQuadraticAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
1 daniel-mar 10885
    function GetRange: TD3DValue; stdcall;
10886
    function GetUmbra: TD3DValue; stdcall;
10887
    function GetPenumbra: TD3DValue; stdcall;
10888
    function GetConstantAttenuation: TD3DValue; stdcall;
10889
    function GetLinearAttenuation: TD3DValue; stdcall;
10890
    function GetQuadraticAttenuation: TD3DValue; stdcall;
10891
    function GetColor: TD3DColor; stdcall;
10892
    function GetType: TD3DRMLightType; stdcall;
4 daniel-mar 10893
    function SetEnableFrame (lpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
10894
    function GetEnableFrame (out lplpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
1 daniel-mar 10895
  end;
10896
 
4 daniel-mar 10897
  IDirect3DRMTexture = interface (IDirect3DRMVisual)
10898
    ['{eb16cb09-d271-11ce-ac48-0000c03825a1}']
10899
    (*
10900
     * IDirect3DRMTexture methods
10901
     *)
10902
    function InitFromFile (filename: PAnsiChar) : HResult; stdcall;
10903
    function InitFromSurface (lpDDS: IDirectDrawSurface) : HResult; stdcall;
10904
    function InitFromResource (rs: HRSRC) : HResult; stdcall;
10905
    function Changed (bPixels, bPalette: BOOL) : HResult; stdcall;
10906
    function SetColors (ulColors: DWORD) : HResult; stdcall;
10907
    function SetShades (ulShades: DWORD) : HResult; stdcall;
10908
    function SetDecalSize (rvWidth, rvHeight: TD3DValue) : HResult; stdcall;
10909
    function SetDecalOrigin (lX, lY: LongInt) : HResult; stdcall;
10910
    function SetDecalScale (dwScale: DWORD) : HResult; stdcall;
10911
    function SetDecalTransparency (bTransp: BOOL) : HResult; stdcall;
10912
    function SetDecalTransparentColor (rcTransp: TD3DColor) : HResult; stdcall;
10913
    function GetDecalSize (out lprvWidth, lprvHeight: TD3DValue) : HResult; stdcall;
10914
    function GetDecalOrigin (out lplX, lplY: LongInt) : HResult; stdcall;
1 daniel-mar 10915
    function GetImage: PD3DRMImage; stdcall;
10916
    function GetShades: DWORD; stdcall;
10917
    function GetColors: DWORD; stdcall;
10918
    function GetDecalScale: DWORD; stdcall;
10919
    function GetDecalTransparency: BOOL; stdcall;
10920
    function GetDecalTransparentColor: TD3DColor; stdcall;
10921
  end;
10922
 
4 daniel-mar 10923
  IDirect3DRMTexture2 = interface (IDirect3DRMTexture)
10924
    ['{120f30c0-1629-11d0-941c-0080c80cfa7b}']
10925
    (*
10926
     * IDirect3DRMTexture2 methods
10927
     *)
10928
    function InitFromImage (const lpImage: TD3DRMImage) : HResult; stdcall;
10929
    function InitFromResource2 (hModule: HModule;
10930
        strName, strType: PAnsiChar) : HResult; stdcall;
10931
    function GenerateMIPMap (dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 10932
  end;
10933
 
4 daniel-mar 10934
  IDirect3DRMTexture3 = interface (IDirect3DRMTexture2)
10935
    ['{ff6b7f73-a40e-11d1-91f9-0000f8758e66}']
10936
    (*
10937
     * IDirect3DRMTexture3 methods
10938
     *)
10939
    function GetSurface
10940
        (dwFlags: DWORD; out lplpDDS: IDirectDrawSurface) : HResult; stdcall;
10941
    function SetCacheOptions (lImportance: integer; dwFlags: DWORD) : HResult; stdcall;
10942
    function GetCacheOptions (var lplImportance: integer; var lpdwFlags: DWORD) : HResult; stdcall;
10943
    function SetDownsampleCallback (
10944
        pCallback: TD3DRMDownSampleCallback; pArg: pointer) : HResult; stdcall;
10945
    function SetValidationCallback (
10946
        pCallback: TD3DRMValidationCallback; pArg: pointer) : HResult; stdcall;
1 daniel-mar 10947
  end;
10948
 
4 daniel-mar 10949
  IDirect3DRMWrap = interface (IDirect3DRMObject)
10950
    ['{eb16cb0a-d271-11ce-ac48-0000c03825a1}']
10951
    (*
10952
     * IDirect3DRMWrap methods
10953
     *)
10954
    function Init (d3drmwt: TD3DRMWrapType; lpd3drmfRef: IDirect3DRMFrame;
10955
        ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue)
10956
        : HResult; stdcall;
10957
    function Apply (lpObject: IDirect3DRMObject) : HResult; stdcall;
10958
    function ApplyRelative(frame: IDirect3DRMFrame; mesh: IDirect3DRMObject) : HResult; stdcall;
1 daniel-mar 10959
  end;
10960
 
4 daniel-mar 10961
  IDirect3DRMMaterial = interface (IDirect3DRMObject)
10962
    ['{eb16cb0b-d271-11ce-ac48-0000c03825a1}']
10963
    (*
10964
     * IDirect3DRMMaterial methods
10965
     *)
10966
    function SetPower (rvPower: TD3DValue) : HResult; stdcall;
10967
    function SetSpecular (r, g, b: TD3DValue) : HResult; stdcall;
10968
    function SetEmissive (r, g, b: TD3DValue) : HResult; stdcall;
1 daniel-mar 10969
    function GetPower: TD3DValue; stdcall;
4 daniel-mar 10970
    function GetSpecular (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
10971
    function GetEmissive (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
1 daniel-mar 10972
  end;
10973
 
4 daniel-mar 10974
  IDirect3DRMMaterial2 = interface (IDirect3DRMMaterial)
10975
    ['{ff6b7f75-a40e-11d1-91f9-0000f8758e66}']
10976
    (*
10977
     * IDirect3DRMMaterial2 methods
10978
     *)
10979
    function GetAmbient(out r,g,b: TD3DValue) : HResult; stdcall;
10980
    function SetAmbient(r,g,b: TD3DValue) : HResult; stdcall;
1 daniel-mar 10981
  end;
10982
 
4 daniel-mar 10983
  IDirect3DRMAnimation = interface (IDirect3DRMObject)
10984
    ['{eb16cb0d-d271-11ce-ac48-0000c03825a1}']
10985
    (*
10986
     * IDirect3DRMAnimation methods
10987
     *)
10988
    function SetOptions (d3drmanimFlags: TD3DRMAnimationOptions) : HResult; stdcall;
10989
    function AddRotateKey (rvTime: TD3DValue; const rqQuat: TD3DRMQuaternion) : HResult; stdcall;
10990
    function AddPositionKey (rvTime, rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
10991
    function AddScaleKey (time, x, y, z: TD3DValue) : HResult; stdcall;
10992
    function DeleteKey (time: TD3DValue) : HResult; stdcall;
10993
    function SetFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
10994
    function SetTime (rvTime: TD3DValue) : HResult; stdcall;
1 daniel-mar 10995
    function GetOptions: TD3DRMAnimationOptions; stdcall;
10996
  end;
10997
 
4 daniel-mar 10998
  IDirect3DRMAnimation2 = interface (IDirect3DRMAnimation)
10999
    ['{ff6b7f77-a40e-11d1-91f9-0000f8758e66}']
11000
    (*
11001
     * IDirect3DRMAnimation methods
11002
     *)
11003
    function GetFrame (out lpD3DFrame: IDirect3DRMFrame3) : HResult; stdcall;
11004
    function DeleteKeyByID (dwID: DWORD) : HResult; stdcall;
11005
    function AddKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
11006
    function ModifyKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
11007
    function GetKeys (dvTimeMin, dvTimeMax: TD3DValue; var lpdwNumKeys: DWORD;
11008
        lpKey: PD3DRMAnimationKey) : HResult; stdcall;
1 daniel-mar 11009
  end;
11010
 
4 daniel-mar 11011
  IDirect3DRMAnimationSet = interface (IDirect3DRMObject)
11012
    ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
11013
    (*
11014
     * IDirect3DRMAnimationSet methods
11015
     *)
11016
    function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
11017
    function Load (lpvObjSource, lpvObjID: Pointer;
11018
        d3drmLOFlags: TD3DRMLoadOptions;
1 daniel-mar 11019
        d3drmLoadTextureProc: TD3DRMLoadTextureCallback; lpArgLTP: Pointer;
4 daniel-mar 11020
        lpParentFrame: IDirect3DRMFrame) : HResult; stdcall;
11021
    function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
11022
    function SetTime (rvTime: TD3DValue) : HResult; stdcall;
1 daniel-mar 11023
  end;
11024
 
4 daniel-mar 11025
  IDirect3DRMAnimationSet2 = interface (IDirect3DRMObject)
11026
    ['{ff6b7f79-a40e-11d1-91f9-0000f8758e66}']
11027
    (*
11028
     * IDirect3DRMAnimationSet methods
11029
     *)
11030
    function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
11031
    function Load (lpvObjSource, lpvObjID: Pointer;
11032
        d3drmLOFlags: TD3DRMLoadOptions;
11033
        d3drmLoadTextureProc: TD3DRMLoadTexture3Callback; lpArgLTP: Pointer;
11034
        lpParentFrame: IDirect3DRMFrame3) : HResult; stdcall;
11035
    function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
11036
    function SetTime (rvTime: TD3DValue) : HResult; stdcall;
11037
    function GetAnimations(out lplpArray: IDirect3DRMAnimationArray) : HResult; stdcall;
1 daniel-mar 11038
  end;
11039
 
4 daniel-mar 11040
  IDirect3DRMUserVisual = interface (IDirect3DRMVisual)
11041
    ['{59163de0-6d43-11cf-ac4a-0000c03825a1}']
11042
    (*
11043
     * IDirect3DRMUserVisual methods
11044
     *)
11045
    function Init (d3drmUVProc: TD3DRMUserVisualCallback;
11046
        lpArg: Pointer) : HResult; stdcall;
1 daniel-mar 11047
  end;
11048
 
4 daniel-mar 11049
  IDirect3DRMArray = interface (IUnknown)
1 daniel-mar 11050
    function GetSize: DWORD; stdcall;
11051
    (* No GetElement method as it would get overloaded
11052
     * in derived classes, and overloading is
11053
     * a no-no in COM
11054
     *)
11055
  end;
11056
 
4 daniel-mar 11057
  IDirect3DRMObjectArray = interface (IDirect3DRMArray)
11058
        ['{242f6bc2-3849-11d0-9b6d-0000c0781bc3}']
11059
    function GetElement (index: DWORD; out lplpD3DRMObject:
11060
        IDirect3DRMObject) : HResult; stdcall;
1 daniel-mar 11061
  end;
11062
 
4 daniel-mar 11063
  IDirect3DRMDeviceArray = interface (IDirect3DRMArray)
11064
    ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
11065
    function GetElement (index: DWORD; out lplpD3DRMDevice:
11066
        IDirect3DRMDevice) : HResult; stdcall;
1 daniel-mar 11067
  end;
11068
 
4 daniel-mar 11069
  IDirect3DRMFrameArray = interface (IDirect3DRMArray)
11070
    ['{eb16cb12-d271-11ce-ac48-0000c03825a1}']
11071
    function GetElement (index: DWORD; out lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
1 daniel-mar 11072
  end;
11073
 
4 daniel-mar 11074
  IDirect3DRMViewportArray = interface (IDirect3DRMArray)
11075
    ['{eb16cb11-d271-11ce-ac48-0000c03825a1}']
11076
    function GetElement (index: DWORD; out lplpD3DRMViewport:
11077
        IDirect3DRMViewport) : HResult; stdcall;
1 daniel-mar 11078
  end;
11079
 
4 daniel-mar 11080
  IDirect3DRMVisualArray = interface (IDirect3DRMArray)
11081
    ['{eb16cb13-d271-11ce-ac48-0000c03825a1}']
11082
    function GetElement (index: DWORD; out lplpD3DRMVisual:
11083
        IDirect3DRMVisual) : HResult; stdcall;
1 daniel-mar 11084
  end;
11085
 
4 daniel-mar 11086
  IDirect3DRMAnimationArray = interface (IDirect3DRMArray)
11087
    ['{d5f1cae0-4bd7-11d1-b974-0060083e45f3}']
11088
    function GetElement (index: DWORD; out lplpD3DRMAnimation2:
11089
        IDirect3DRMAnimation2) : HResult; stdcall;
1 daniel-mar 11090
  end;
11091
 
4 daniel-mar 11092
  IDirect3DRMPickedArray = interface (IDirect3DRMArray)
11093
    ['{eb16cb16-d271-11ce-ac48-0000c03825a1}']
11094
    function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
1 daniel-mar 11095
        out lplpFrameArray: IDirect3DRMFrameArray;
4 daniel-mar 11096
        const lpD3DRMPickDesc: TD3DRMPickDesc) : HResult; stdcall;
11097
 
1 daniel-mar 11098
  end;
11099
 
4 daniel-mar 11100
  IDirect3DRMLightArray = interface (IDirect3DRMArray)
11101
    ['{eb16cb14-d271-11ce-ac48-0000c03825a1}']
11102
    function GetElement (index: DWORD; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
1 daniel-mar 11103
  end;
11104
 
4 daniel-mar 11105
 
11106
  IDirect3DRMFaceArray = interface (IDirect3DRMArray)
11107
    ['{eb16cb17-d271-11ce-ac48-0000c03825a1}']
11108
    function GetElement (index: DWORD; out lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
1 daniel-mar 11109
  end;
11110
 
4 daniel-mar 11111
  IDirect3DRMPicked2Array = interface (IDirect3DRMArray)
11112
    ['{4516ec7b-8f20-11d0-9b6d-0000c0781bc3}']
11113
    function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
11114
        out lplpFrameArray: IDirect3DRMFrameArray; const lpD3DRMPickDesc2:
11115
        TD3DRMPickDesc2) : HResult; stdcall;
1 daniel-mar 11116
  end;
11117
 
4 daniel-mar 11118
  IDirect3DRMInterpolator = interface (IDirect3DRMObject)
11119
    ['{242f6bc1-3849-11d0-9b6d-0000c0781bc3}']
11120
    (*
11121
     * IDirect3DRMInterpolator methods
11122
     *)
11123
    function AttachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
11124
    function GetAttachedObjects
11125
        (lpD3DRMObjectArray: IDirect3DRMObjectArray) : HResult; stdcall;
11126
    function DetachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
11127
    function SetIndex (d3dVal: TD3DValue) : HResult; stdcall;
11128
    function GetIndex : TD3DValue; stdcall;
11129
    function Interpolate (d3dVal: TD3DValue; lpD3DRMObject: IDirect3DRMObject;
11130
        d3drmInterpFlags: TD3DRMInterpolationOptions) : HResult; stdcall;
1 daniel-mar 11131
  end;
11132
 
4 daniel-mar 11133
  IDirect3DRMClippedVisual = interface (IDirect3DRMObject)
11134
    ['{5434e733-6d66-11d1-bb0b-0000f875865a}']
11135
    (*
11136
     * IDirect3DRMClippedVisual methods
11137
     *)
11138
    function Init (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
11139
    function AddPlane (lpRef: IDirect3DRMFrame3;
11140
        const lpdvPoint, lpdvNormal: TD3DVector;
11141
        dwFlags: DWORD; out lpdwReturnID: DWORD) : HResult; stdcall;
11142
    function DeletePlane (dwID, dwFlags: DWORD) : HResult; stdcall;
11143
    function GetPlaneIDs (var lpdwCount: DWORD; out lpdwID: DWORD; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 11144
    function GetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
4 daniel-mar 11145
        out lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 11146
    function SetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
4 daniel-mar 11147
        const lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 11148
  end;
11149
 
4 daniel-mar 11150
(*==========================================================================;
11151
 *
11152
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
11153
 *
11154
 *  File:       d3drm.h
11155
 *  Content:    Direct3DRM include file
11156
 *
11157
 ***************************************************************************)
1 daniel-mar 11158
 
4 daniel-mar 11159
function D3DRMErrorString(Value: HResult) : string;
11160
 
11161
//type
11162
  //TRefClsID = TGUID;
11163
 
11164
type
11165
  TD3DRMDevicePaletteCallback = procedure (lpDirect3DRMDev: IDirect3DRMDevice;
11166
      lpArg: Pointer; dwIndex: DWORD; red, green, blue: LongInt); cdecl;
11167
 
11168
(*
11169
 * Direct3DRM Object Class (for CoCreateInstance())
11170
 *)
11171
const
11172
  CLSID_CDirect3DRM: TGUID =
11173
      (D1:$4516ec41;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
11174
 
11175
type
11176
  IDirect3DRM = interface (IUnknown)
11177
    ['{2bc49361-8327-11cf-ac4a-0000c03825a1}']
11178
    function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
11179
        const riid: TGUID; out ppv) : HResult; stdcall;
11180
    function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame;
11181
        var lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
11182
    function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
11183
    function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
11184
        IDirect3DRMMeshBuilder) : HResult; stdcall;
11185
    function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
11186
    function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
11187
    function CreateAnimationSet (var lplpD3DRMAnimationSet:
11188
        IDirect3DRMAnimationSet) : HResult; stdcall;
11189
    function CreateTexture (var lpImage: TD3DRMImage;
11190
        var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
11191
    function CreateLight (d3drmltLightType: TD3DRMLightType;
11192
        cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11193
    function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
11194
        vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11195
    function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
11196
        IDirect3DRMMaterial) : HResult; stdcall;
11197
    function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
11198
        IDirect3DRMDevice) : HResult; stdcall;
11199
 
11200
    (* Create a Windows Device using DirectDraw surfaces *)
11201
    function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
11202
        lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice) :
11203
        HResult; stdcall;
11204
 
11205
      (* Create a Windows Device using D3D objects *)
11206
    function CreateDeviceFromD3D (lpD3D: IDirect3D; lpD3DDev: IDirect3DDevice;
11207
        var lplpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
11208
 
11209
    function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
11210
        lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
11211
        IDirect3DRMDevice) : HResult; stdcall;
11212
 
11213
    function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
11214
        var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
11215
 
11216
    function CreateShadow (lpVisual: IDirect3DRMVisual;
1 daniel-mar 11217
        lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
4 daniel-mar 11218
        var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
11219
    function CreateViewport (lpDev: IDirect3DRMDevice;
1 daniel-mar 11220
        lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
4 daniel-mar 11221
        var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
11222
    function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
1 daniel-mar 11223
        ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
4 daniel-mar 11224
        var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
11225
    function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
11226
        var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
11227
    function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
11228
        IDirect3DRMTexture) : HResult; stdcall;
11229
    function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
11230
        IDirect3DRMTexture) : HResult; stdcall;
11231
 
11232
    function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11233
    function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11234
    function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
11235
    function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
11236
    function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
11237
 
11238
    function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
11239
    function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
11240
 
11241
    function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
11242
 
11243
    function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
1 daniel-mar 11244
        dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
4 daniel-mar 11245
        TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
11246
        TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
11247
        IDirect3DRMFrame) : HResult; stdcall;
11248
    function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
1 daniel-mar 11249
  end;
11250
 
4 daniel-mar 11251
// Moved from D3DRMObj, to avoid circular unit reference:
11252
 
11253
  IDirect3DRMObject2 = interface (IUnknown)
11254
    ['{4516ec7c-8f20-11d0-9b6d-0000c0781bc3}']
11255
    (*
11256
     * IDirect3DRMObject2 methods
11257
     *)
11258
    function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
11259
        lpArg: Pointer) : HResult; stdcall;
11260
    function Clone (pUnkOuter: IUnknown; const riid: TGUID;
11261
        out ppvObj) : HResult; stdcall;
11262
    function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
11263
        lpArg: Pointer) : HResult; stdcall;
11264
    function GetClientData (dwID: DWORD; out lplpvData: Pointer) : HResult; stdcall;
11265
    function GetDirect3DRM (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
11266
    function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
11267
    function SetClientData (dwID: DWORD; lpvData: pointer; dwFlags: DWORD) : HResult; stdcall;
11268
    function SetName (lpName: PAnsiChar) : HResult; stdcall;
11269
    function GetAge (dwFlags: DWORD; out pdwAge: DWORD) : HResult; stdcall;
11270
  end;
11271
 
11272
  IID_IDirect3DRMObject2 = IDirect3DRMObject2;
11273
 
11274
  IDirect3DRM2 = interface (IUnknown)
11275
    ['{4516ecc8-8f20-11d0-9b6d-0000c0781bc3}']
11276
    function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
11277
        const riid: TGUID; out ppv) : HResult; stdcall;
11278
    function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame2;
11279
        var lplpD3DRMFrame: IDirect3DRMFrame2) : HResult; stdcall;
11280
    function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
11281
    function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
11282
        IDirect3DRMMeshBuilder2) : HResult; stdcall;
11283
    function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
11284
    function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
11285
    function CreateAnimationSet (var lplpD3DRMAnimationSet:
11286
        IDirect3DRMAnimationSet) : HResult; stdcall;
11287
    function CreateTexture (var lpImage: TD3DRMImage;
11288
        var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
11289
    function CreateLight (d3drmltLightType: TD3DRMLightType;
11290
        cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11291
    function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
11292
        vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11293
    function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
11294
        IDirect3DRMMaterial) : HResult; stdcall;
11295
    function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
11296
        IDirect3DRMDevice2) : HResult; stdcall;
11297
 
11298
    (* Create a Windows Device using DirectDraw surfaces *)
11299
    function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
11300
        lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice2) :
11301
        HResult; stdcall;
11302
 
11303
      (* Create a Windows Device using D3D objects *)
11304
    function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
11305
        var lplpD3DRMDevice: IDirect3DRMDevice2) : HResult; stdcall;
11306
 
11307
    function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
11308
        lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
11309
        IDirect3DRMDevice2) : HResult; stdcall;
11310
 
11311
    function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
11312
        var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
11313
 
11314
    function CreateShadow (lpVisual: IDirect3DRMVisual;
1 daniel-mar 11315
        lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
4 daniel-mar 11316
        var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
11317
    function CreateViewport (lpDev: IDirect3DRMDevice;
1 daniel-mar 11318
        lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
4 daniel-mar 11319
        var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
11320
    function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
1 daniel-mar 11321
        ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
4 daniel-mar 11322
        var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
11323
    function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
11324
        var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
11325
    function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
11326
        IDirect3DRMTexture2) : HResult; stdcall;
11327
    function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
11328
        IDirect3DRMTexture2) : HResult; stdcall;
11329
 
11330
    function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11331
    function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11332
    function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
11333
    function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
11334
    function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
11335
 
11336
    function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
11337
    function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject:
11338
        IDirect3DRMObject) : HResult; stdcall;
11339
 
11340
    function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
11341
 
11342
    function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
1 daniel-mar 11343
        dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
4 daniel-mar 11344
        TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
1 daniel-mar 11345
        TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
4 daniel-mar 11346
        IDirect3DRMFrame) : HResult; stdcall;
11347
    function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
11348
    function CreateProgressiveMesh (var lplpD3DRMProgressiveMesh:
11349
        IDirect3DRMProgressiveMesh) : HResult; stdcall;
1 daniel-mar 11350
  end;
11351
 
4 daniel-mar 11352
  IDirect3DRM3 = interface (IUnknown)
11353
    ['{4516ec83-8f20-11d0-9b6d-0000c0781bc3}']
11354
    function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
11355
        const riid: TGUID; out ppv) : HResult; stdcall;
11356
    function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame3;
11357
        out lplpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
11358
    function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
11359
    function CreateMeshBuilder (out lplpD3DRMMeshBuilder:
11360
        IDirect3DRMMeshBuilder3) : HResult; stdcall;
11361
    function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
11362
    function CreateAnimation (out lplpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
11363
    function CreateAnimationSet (out lplpD3DRMAnimationSet:
11364
        IDirect3DRMAnimationSet2) : HResult; stdcall;
11365
    function CreateTexture (const lpImage: TD3DRMImage;
11366
        out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
11367
    function CreateLight (d3drmltLightType: TD3DRMLightType;
11368
        cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11369
    function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
11370
        vGreen, vBlue: TD3DValue; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11371
    function CreateMaterial (vPower: TD3DValue; out lplpD3DRMMaterial:
11372
        IDirect3DRMMaterial2) : HResult; stdcall;
11373
    function CreateDevice (dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
11374
        IDirect3DRMDevice3) : HResult; stdcall;
11375
 
11376
    (* Create a Windows Device using DirectDraw surfaces *)
11377
    function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
11378
        lpDDSBack: IDirectDrawSurface; dwFlags: DWORD;
11379
        out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
11380
 
11381
      (* Create a Windows Device using D3D objects *)
11382
    function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
11383
        out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
11384
 
11385
    function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
11386
        lpGUID: PGUID; width, height: Integer;
11387
        out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
11388
 
11389
    function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
11390
        out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
11391
 
11392
    function CreateShadow (pUnk: IUnknown; lpLight: IDirect3DRMLight;
11393
        px, py, pz, nx, ny, nz: TD3DValue;
11394
        out lplpShadow: IDirect3DRMShadow2) : HResult; stdcall;
11395
    function CreateViewport (lpDev: IDirect3DRMDevice3;
1 daniel-mar 11396
        lpCamera: IDirect3DRMFrame3; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
4 daniel-mar 11397
        out lplpD3DRMViewport: IDirect3DRMViewport2) : HResult; stdcall;
11398
    function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame3;
1 daniel-mar 11399
        ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
4 daniel-mar 11400
        out lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
11401
    function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
11402
        out lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
11403
    function LoadTexture (lpFileName: PAnsiChar; out lplpD3DRMTexture:
11404
        IDirect3DRMTexture3) : HResult; stdcall;
11405
    function LoadTextureFromResource (hModule: HMODULE;
11406
        strName, strType: PAnsiChar;
11407
        out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
1 daniel-mar 11408
 
4 daniel-mar 11409
    function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11410
    function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11411
    function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
11412
    function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
11413
    function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
11414
 
11415
    function GetDevices (out lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
11416
    function GetNamedObject (lpName: PAnsiChar; out lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
11417
 
11418
    function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
11419
 
11420
    function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
1 daniel-mar 11421
        dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
4 daniel-mar 11422
        TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
1 daniel-mar 11423
        TD3DRMLoadTexture3Callback; lpArgLTP: Pointer; lpParentFrame:
4 daniel-mar 11424
        IDirect3DRMFrame3) : HResult; stdcall;
11425
    function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
11426
    function CreateProgressiveMesh (out lplpD3DRMProgressiveMesh:
11427
        IDirect3DRMProgressiveMesh) : HResult; stdcall;
11428
 
11429
    (* Used with IDirect3DRMObject2 *)
11430
    function RegisterClient (const rguid: TGUID; out lpdwID: DWORD) : HResult; stdcall;
11431
    function UnregisterClient (const rguid: TGUID) : HResult; stdcall;
11432
 
11433
    function CreateClippedVisual (lpVisual: IDirect3DRMVisual;
11434
        lpClippedVisual: IDirect3DRMClippedVisual) : HResult; stdcall;
11435
    function SetOptions (dwOptions: DWORD) : HResult; stdcall;
11436
    function GetOptions (out lpdwOptions: DWORD) : HResult; stdcall;
1 daniel-mar 11437
  end;
11438
 
4 daniel-mar 11439
  IID_IDirect3DRM =  IDirect3DRM;
11440
  IID_IDirect3DRM2 = IDirect3DRM2;
11441
  IID_IDirect3DRM3 = IDirect3DRM3;
11442
 
1 daniel-mar 11443
const
4 daniel-mar 11444
  MAKE_D3RMDHRESULT = HResult($88760000);
1 daniel-mar 11445
 
4 daniel-mar 11446
  D3DRM_OK                        = DD_OK;
11447
  D3DRMERR_BADOBJECT              = MAKE_D3RMDHRESULT + 781;
11448
  D3DRMERR_BADTYPE                = MAKE_D3RMDHRESULT + 782;
11449
  D3DRMERR_BADALLOC               = MAKE_D3RMDHRESULT + 783;
11450
  D3DRMERR_FACEUSED               = MAKE_D3RMDHRESULT + 784;
11451
  D3DRMERR_NOTFOUND               = MAKE_D3RMDHRESULT + 785;
11452
  D3DRMERR_NOTDONEYET             = MAKE_D3RMDHRESULT + 786;
11453
  D3DRMERR_FILENOTFOUND           = MAKE_D3RMDHRESULT + 787;
11454
  D3DRMERR_BADFILE                = MAKE_D3RMDHRESULT + 788;
11455
  D3DRMERR_BADDEVICE              = MAKE_D3RMDHRESULT + 789;
11456
  D3DRMERR_BADVALUE               = MAKE_D3RMDHRESULT + 790;
11457
  D3DRMERR_BADMAJORVERSION        = MAKE_D3RMDHRESULT + 791;
11458
  D3DRMERR_BADMINORVERSION        = MAKE_D3RMDHRESULT + 792;
11459
  D3DRMERR_UNABLETOEXECUTE        = MAKE_D3RMDHRESULT + 793;
11460
  D3DRMERR_LIBRARYNOTFOUND        = MAKE_D3RMDHRESULT + 794;
11461
  D3DRMERR_INVALIDLIBRARY         = MAKE_D3RMDHRESULT + 795;
11462
  D3DRMERR_PENDING                = MAKE_D3RMDHRESULT + 796;
11463
  D3DRMERR_NOTENOUGHDATA          = MAKE_D3RMDHRESULT + 797;
11464
  D3DRMERR_REQUESTTOOLARGE        = MAKE_D3RMDHRESULT + 798;
11465
  D3DRMERR_REQUESTTOOSMALL        = MAKE_D3RMDHRESULT + 799;
11466
  D3DRMERR_CONNECTIONLOST         = MAKE_D3RMDHRESULT + 800;
11467
  D3DRMERR_LOADABORTED            = MAKE_D3RMDHRESULT + 801;
11468
  D3DRMERR_NOINTERNET             = MAKE_D3RMDHRESULT + 802;
11469
  D3DRMERR_BADCACHEFILE           = MAKE_D3RMDHRESULT + 803;
11470
  D3DRMERR_BOXNOTSET              = MAKE_D3RMDHRESULT + 804;
11471
  D3DRMERR_BADPMDATA              = MAKE_D3RMDHRESULT + 805;
11472
  D3DRMERR_CLIENTNOTREGISTERED    = MAKE_D3RMDHRESULT + 806;
11473
  D3DRMERR_NOTCREATEDFROMDDS      = MAKE_D3RMDHRESULT + 807;
11474
  D3DRMERR_NOSUCHKEY              = MAKE_D3RMDHRESULT + 808;
11475
  D3DRMERR_INCOMPATABLEKEY        = MAKE_D3RMDHRESULT + 809;
11476
  D3DRMERR_ELEMENTINUSE           = MAKE_D3RMDHRESULT + 810;
11477
  D3DRMERR_TEXTUREFORMATNOTFOUND  = MAKE_D3RMDHRESULT + 811;
1 daniel-mar 11478
 
4 daniel-mar 11479
(* Create a Direct3DRM API *)
11480
var
11481
  Direct3DRMCreate : function (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
11482
 
11483
(*==========================================================================;
11484
 *
11485
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
11486
 *
11487
 *  File:       d3drmwin.h
11488
 *  Content:    Direct3DRM include file
11489
 *
11490
 ***************************************************************************)
11491
 
11492
type
11493
  IDirect3DRMWinDevice = interface (IDirect3DRMObject)
11494
    ['{c5016cc0-d273-11ce-ac48-0000c03825a1}']
11495
    (*
11496
     * IDirect3DRMWinDevice methods
11497
     *)
11498
 
11499
    (* Repaint the window with the last frame which was rendered. *)
11500
    function HandlePaint (hDC: HDC) : HResult; stdcall;
11501
 
11502
    (* Respond to a WM_ACTIVATE message. *)
11503
    function HandleActivate (wparam: WORD) : HResult; stdcall;
11504
  end;
11505
 
11506
(*
11507
 * GUIDS used by Direct3DRM Windows interface
11508
 *)
11509
  IID_IDirect3DRMWinDevice = IDirect3DRMWinDevice;
11510
 
1 daniel-mar 11511
(***************************************************************************
11512
 *
11513
 *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
11514
 *
4 daniel-mar 11515
 *  File:       rmxfguid.h
1 daniel-mar 11516
 *
4 daniel-mar 11517
 *  Content:    Defines GUIDs of D3DRM's templates.
1 daniel-mar 11518
 *
11519
 ***************************************************************************)
4 daniel-mar 11520
 
11521
const
11522
(* {2B957100-9E9A-11cf-AB39-0020AF71E433} *)
11523
  TID_D3DRMInfo: TGUID =
11524
      (D1:$2b957100;D2:$9e9a;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11525
 
4 daniel-mar 11526
(* {3D82AB44-62DA-11cf-AB39-0020AF71E433} *)
11527
  TID_D3DRMMesh: TGUID =
11528
      (D1:$3d82ab44;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11529
 
4 daniel-mar 11530
(* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} *)
11531
  TID_D3DRMVector: TGUID =
11532
      (D1:$3d82ab5e;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11533
 
4 daniel-mar 11534
(* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} *)
11535
  TID_D3DRMMeshFace: TGUID =
11536
      (D1:$3d82ab5f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11537
 
4 daniel-mar 11538
(* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} *)
11539
  TID_D3DRMMaterial: TGUID =
11540
      (D1:$3d82ab4d;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11541
 
4 daniel-mar 11542
(* {35FF44E1-6C7C-11cf-8F52-0040333594A3} *)
11543
  TID_D3DRMMaterialArray: TGUID =
11544
      (D1:$35ff44e1;D2:$6c7c;D3:$11cf;D4:($8F,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11545
 
4 daniel-mar 11546
(* {3D82AB46-62DA-11cf-AB39-0020AF71E433} *)
11547
  TID_D3DRMFrame: TGUID =
11548
      (D1:$3d82ab46;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11549
 
4 daniel-mar 11550
(* {F6F23F41-7686-11cf-8F52-0040333594A3} *)
11551
  TID_D3DRMFrameTransformMatrix: TGUID =
11552
      (D1:$f6f23f41;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11553
 
4 daniel-mar 11554
(* {F6F23F42-7686-11cf-8F52-0040333594A3} *)
11555
  TID_D3DRMMeshMaterialList: TGUID =
11556
      (D1:$f6f23f42;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11557
 
4 daniel-mar 11558
(* {F6F23F40-7686-11cf-8F52-0040333594A3} *)
11559
  TID_D3DRMMeshTextureCoords: TGUID =
11560
      (D1:$f6f23f40;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11561
 
4 daniel-mar 11562
(* {F6F23F43-7686-11cf-8F52-0040333594A3} *)
11563
  TID_D3DRMMeshNormals: TGUID =
11564
      (D1:$f6f23f43;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11565
 
4 daniel-mar 11566
(* {F6F23F44-7686-11cf-8F52-0040333594A3} *)
11567
  TID_D3DRMCoords2d: TGUID =
11568
      (D1:$f6f23f44;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11569
 
4 daniel-mar 11570
(* {F6F23F45-7686-11cf-8F52-0040333594A3} *)
11571
  TID_D3DRMMatrix4x4: TGUID =
11572
      (D1:$f6f23f45;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11573
 
4 daniel-mar 11574
(* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} *)
11575
  TID_D3DRMAnimation: TGUID =
11576
      (D1:$3d82ab4f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11577
 
4 daniel-mar 11578
(* {3D82AB50-62DA-11cf-AB39-0020AF71E433} *)
11579
  TID_D3DRMAnimationSet: TGUID =
11580
      (D1:$3d82ab50;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11581
 
4 daniel-mar 11582
(* {10DD46A8-775B-11cf-8F52-0040333594A3} *)
11583
  TID_D3DRMAnimationKey: TGUID =
11584
      (D1:$10dd46a8;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11585
 
4 daniel-mar 11586
(* {10DD46A9-775B-11cf-8F52-0040333594A3} *)
11587
  TID_D3DRMFloatKeys: TGUID =
11588
      (D1:$10dd46a9;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11589
 
4 daniel-mar 11590
(* {01411840-7786-11cf-8F52-0040333594A3} *)
11591
  TID_D3DRMMaterialAmbientColor: TGUID =
11592
      (D1:$01411840;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11593
 
4 daniel-mar 11594
(* {01411841-7786-11cf-8F52-0040333594A3} *)
11595
  TID_D3DRMMaterialDiffuseColor: TGUID =
11596
      (D1:$01411841;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11597
 
4 daniel-mar 11598
(* {01411842-7786-11cf-8F52-0040333594A3} *)
11599
  TID_D3DRMMaterialSpecularColor: TGUID =
11600
      (D1:$01411842;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11601
 
4 daniel-mar 11602
(* {D3E16E80-7835-11cf-8F52-0040333594A3} *)
11603
  TID_D3DRMMaterialEmissiveColor: TGUID =
11604
      (D1:$d3e16e80;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11605
 
4 daniel-mar 11606
(* {01411843-7786-11cf-8F52-0040333594A3} *)
11607
  TID_D3DRMMaterialPower: TGUID =
11608
      (D1:$01411843;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11609
 
4 daniel-mar 11610
(* {35FF44E0-6C7C-11cf-8F52-0040333594A3} *)
11611
  TID_D3DRMColorRGBA: TGUID =
11612
      (D1:$35ff44e0;D2:$6c7c;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11613
 
4 daniel-mar 11614
(* {D3E16E81-7835-11cf-8F52-0040333594A3} *)
11615
  TID_D3DRMColorRGB: TGUID =
11616
      (D1:$d3e16e81;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11617
 
4 daniel-mar 11618
(* {A42790E0-7810-11cf-8F52-0040333594A3} *)
11619
  TID_D3DRMGuid: TGUID =
11620
      (D1:$a42790e0;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11621
 
4 daniel-mar 11622
(* {A42790E1-7810-11cf-8F52-0040333594A3} *)
11623
  TID_D3DRMTextureFilename: TGUID =
11624
      (D1:$a42790e1;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11625
 
4 daniel-mar 11626
(* {A42790E2-7810-11cf-8F52-0040333594A3} *)
11627
  TID_D3DRMTextureReference: TGUID =
11628
      (D1:$a42790e2;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11629
 
4 daniel-mar 11630
(* {1630B820-7842-11cf-8F52-0040333594A3} *)
11631
  TID_D3DRMIndexedColor: TGUID =
11632
      (D1:$1630b820;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11633
 
4 daniel-mar 11634
(* {1630B821-7842-11cf-8F52-0040333594A3} *)
11635
  TID_D3DRMMeshVertexColors: TGUID =
11636
      (D1:$1630b821;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11637
 
4 daniel-mar 11638
(* {4885AE60-78E8-11cf-8F52-0040333594A3} *)
11639
  TID_D3DRMMaterialWrap: TGUID =
11640
      (D1:$4885ae60;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11641
 
4 daniel-mar 11642
(* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} *)
11643
  TID_D3DRMBoolean: TGUID =
11644
      (D1:$537da6a0;D2:$ca37;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
1 daniel-mar 11645
 
4 daniel-mar 11646
(* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} *)
11647
  TID_D3DRMMeshFaceWraps: TGUID =
11648
      (D1:$ed1ec5c0;D2:$c0a8;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
1 daniel-mar 11649
 
4 daniel-mar 11650
(* {4885AE63-78E8-11cf-8F52-0040333594A3} *)
11651
  TID_D3DRMBoolean2d: TGUID =
11652
      (D1:$4885ae63;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11653
 
11654
(* {F406B180-7B3B-11cf-8F52-0040333594A3} *)
11655
  TID_D3DRMTimedFloatKeys: TGUID =
11656
      (D1:$f406b180;D2:$7b3b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11657
 
11658
(* {E2BF56C0-840F-11cf-8F52-0040333594A3} *)
11659
  TID_D3DRMAnimationOptions: TGUID =
11660
      (D1:$e2bf56c0;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11661
 
11662
(* {E2BF56C1-840F-11cf-8F52-0040333594A3} *)
11663
  TID_D3DRMFramePosition: TGUID =
11664
      (D1:$e2bf56c1;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11665
 
11666
(* {E2BF56C2-840F-11cf-8F52-0040333594A3} *)
11667
  TID_D3DRMFrameVelocity: TGUID =
11668
      (D1:$e2bf56c2;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11669
 
11670
(* {E2BF56C3-840F-11cf-8F52-0040333594A3} *)
11671
  TID_D3DRMFrameRotation: TGUID =
11672
      (D1:$e2bf56c3;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11673
 
11674
(* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} *)
11675
  TID_D3DRMLight: TGUID =
11676
      (D1:$3d82ab4a;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
11677
 
11678
(* {3D82AB51-62DA-11cf-AB39-0020AF71E433} *)
11679
  TID_D3DRMCamera: TGUID =
11680
      (D1:$3d82ab51;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
11681
 
11682
(* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} *)
11683
  TID_D3DRMAppData: TGUID =
11684
      (D1:$e5745280;D2:$b24f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
11685
 
11686
(* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} *)
11687
  TID_D3DRMLightUmbra: TGUID =
11688
      (D1:$aed22740;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
11689
 
11690
(* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} *)
11691
  TID_D3DRMLightRange: TGUID =
11692
      (D1:$aed22742;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
11693
 
11694
(* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} *)
11695
  TID_D3DRMLightPenumbra: TGUID =
11696
      (D1:$aed22741;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
11697
 
11698
(* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} *)
11699
  TID_D3DRMLightAttenuation: TGUID =
11700
      (D1:$a8a98ba0;D2:$c5e5;D3:$11cf;D4:($b9,$41,$00,$80,$c8,$0c,$fa,$7b));
11701
 
11702
(* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} *)
11703
  TID_D3DRMInlineData: TGUID =
11704
      (D1:$3a23eea0;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
11705
 
11706
(* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} *)
11707
  TID_D3DRMUrl: TGUID =
11708
      (D1:$3a23eea1;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
11709
 
11710
(* {8A63C360-997D-11d0-941C-0080C80CFA7B} *)
11711
  TID_D3DRMProgressiveMesh: TGUID =
11712
      (D1:$8A63C360;D2:$997D;D3:$11d0;D4:($94,$1C,$00,$80,$C8,$0C,$FA,$7B));
11713
 
11714
(* {98116AA0-BDBA-11d1-82C0-00A0C9697271} *)
11715
  TID_D3DRMExternalVisual: TGUID =
11716
      (D1:$98116AA0;D2:$BDBA;D3:$11d1;D4:($82,$C0,$00,$A0,$C9,$69,$72,$71));
11717
 
11718
(* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} *)
11719
  TID_D3DRMStringProperty: TGUID =
11720
      (D1:$7f0f21e0;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
11721
 
11722
(* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} *)
11723
  TID_D3DRMPropertyBag: TGUID =
11724
      (D1:$7f0f21e1;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
11725
 
11726
// {7F5D5EA0-D53A-11d1-82C0-00A0C9697271}
11727
  TID_D3DRMRightHanded: TGUID =
11728
      (D1:$7f5d5ea0;D2:$d53a;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
11729
 
11730
(*==========================================================================;
1 daniel-mar 11731
 *
4 daniel-mar 11732
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 11733
 *
11734
 *  File:       rmxftmpl.h
4 daniel-mar 11735
 *  Content:    D3DRM XFile templates in binary form
1 daniel-mar 11736
 *
11737
 ***************************************************************************)
11738
 
11739
const
4 daniel-mar 11740
  D3DRM_XTEMPLATE_BYTES_2  = 3278;
1 daniel-mar 11741
 
4 daniel-mar 11742
  D3DRM_XTEMPLATES_2: array [0..D3DRM_XTEMPLATE_BYTES_2-1] of byte = (
11743
        $78, $6f, $66, $20, $30, $33, $30, $32, $62, $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
11744
        0, $6, 0, 0, 0, $48, $65, $61, $64, $65, $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
11745
        $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
11746
        $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
11747
        0, $29, 0, $1, 0, $5, 0, 0, 0, $66, $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
11748
        $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
11749
        $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
11750
        $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0, 0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
11751
        0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
11752
        $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
11753
        $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0, 0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
11754
        0, 0, $76, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
11755
        $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
11756
        $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
11757
        $e, 0, $3, 0, $10, 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
11758
        0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
11759
        $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
11760
        $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
11761
        0, $1, 0, $4, 0, 0, 0, $62, $6c, $75, $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
11762
        0, $61, $6c, $70, $68, $61, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
11763
        $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0, $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
11764
        0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
11765
        0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
11766
        0, 0, $62, $6c, $75, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
11767
        $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72, $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
11768
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
11769
        $64, $65, $78, $14, 0, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
11770
        $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65, $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
11771
        $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
11772
        $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
11773
        0, 0, 0, $74, $72, $75, $65, $66, $61, $6c, $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
11774
        $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
11775
        $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
11776
        $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
11777
        0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
11778
        0, $1, 0, $c, 0, 0, 0, $4d, $61, $74, $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
11779
        0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
11780
        0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
11781
        0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
11782
        $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
11783
        $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0, $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
11784
        $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0, $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
11785
        $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
11786
        $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
11787
        $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
11788
        0, $9, 0, 0, 0, $66, $61, $63, $65, $43, $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
11789
        $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
11790
        $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0, 0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
11791
        $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
11792
        $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73, $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
11793
        0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
11794
        0, $4d, $65, $73, $68, $46, $61, $63, $65, $a, 0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
11795
        $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
11796
        $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
11797
        0, $1, 0, $11, 0, 0, 0, $66, $61, $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
11798
        $69, $63, $65, $73, $e, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
11799
        $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
11800
        $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
11801
        0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
11802
        0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
11803
        $14, 0, $34, 0, $1, 0, $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
11804
        0, $e, 0, 0, 0, $66, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
11805
        0, $1, 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
11806
        $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
11807
        $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
11808
        $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
11809
        0, $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
11810
        0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
11811
        $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
11812
        $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
11813
        $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65, $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
11814
        $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
11815
        $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0, 0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
11816
        $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
11817
        $65, $78, $65, $73, $14, 0, $34, 0, $29, 0, $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
11818
        $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
11819
        $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14, 0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
11820
        $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b, 0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
11821
        $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73, $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
11822
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
11823
        $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
11824
        $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
11825
        0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
11826
        0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
11827
        0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
11828
        $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
11829
        $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
11830
        $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
11831
        $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
11832
        $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
11833
        $73, $14, 0, $34, 0, $1, 0, $c, 0, 0, 0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
11834
        $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
11835
        $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
11836
        $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
11837
        $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
11838
        $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
11839
        0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
11840
        $65, $72, $74, $69, $63, $65, $73, $e, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
11841
        $69, $63, $65, $73, $f, 0, $14, 0, $29, 0, $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
11842
        $65, $73, $14, 0, $34, 0, $1, 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
11843
        $1, 0, $5, 0, 0, 0, $66, $61, $63, $65, $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
11844
        $46, $61, $63, $65, $73, $f, 0, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
11845
        0, $1f, 0, $1, 0, $14, 0, 0, 0, $46, $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
11846
        $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a, 0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
11847
        $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
11848
        $78, $34, $78, $34, $1, 0, $b, 0, 0, 0, $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
11849
        $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5, 0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
11850
        $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
11851
        $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
11852
        $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5, 0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
11853
        $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
11854
        $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
11855
        $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
11856
        0, $1f, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
11857
        $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6, $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
11858
        $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0, 0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
11859
        0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65, $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
11860
        $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
11861
        $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0, $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
11862
        $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
11863
        $79, $70, $65, $14, 0, $29, 0, $1, 0, $5, 0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
11864
        $34, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
11865
        $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65, $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
11866
        $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
11867
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70, $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
11868
        $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
11869
        0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f, $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
11870
        0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f, $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
11871
        $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
11872
        0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
11873
        0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
11874
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65, $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
11875
        $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
11876
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0, $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
11877
        $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
11878
        $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
11879
        $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0, $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
11880
        0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
11881
        0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
11882
        $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
11883
        $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
11884
        $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68, $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
11885
        $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
11886
        $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
11887
        0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
11888
        $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
11889
        0, 0, 0, $64, $61, $74, $61, $31, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
11890
        $74, $61, $32, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
11891
        $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
11892
        0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
11893
        $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74, $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
11894
        $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
11895
        $65, $79, $14, 0, $31, 0, $1, 0, $5, 0, 0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
11896
        0, $1f, 0, $1, 0, $b, 0, 0, 0, $50, $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
11897
        $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
11898
        $e, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
11899
        $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
11900
        $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0, $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
11901
        $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
11902
        $12, 0, 0, 0, $67, $75, $69, $64, $45, $78, $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
11903
        $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0,
11904
        $b, 0, 0, 0, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $a, 0, $5, 0, $a0,
11905
        $5e, $5d, $7f, $3a, $d5, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $29, 0, $1, 0, $c,
11906
        0, 0, 0, $62, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $14, 0, $b, 0);
1 daniel-mar 11907
 
4 daniel-mar 11908
//---------------
11909
{$ENDIF}
11910
//DirectInput file
1 daniel-mar 11911
(*==========================================================================;
11912
 *
4 daniel-mar 11913
 *  Copyright (C) 1996-1999 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 11914
 *
11915
 *  File:       dinput.h
11916
 *  Content:    DirectInput include file
11917
 *
4 daniel-mar 11918
 *  DirectX 7.0 Delphi adaptation by Erik Unger, input format
11919
 *  variable structure & other fixups by Arne Schäpers (as)
11920
 *
11921
 *  Modified: 10-Sep-2000
11922
 *
11923
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
11924
 *  E-Mail: DelphiDirectX@next-reality.com
11925
 *          a.schaepers@digitalpublishing.de            
11926
 *
11927
 ***************************************************************************)
1 daniel-mar 11928
 
4 daniel-mar 11929
{ Some notes from as:
11930
  1. DirectInput Enum callback functions which are documented with result
11931
  type BOOL in the SDK had to be changed to result type integer because the debug
11932
  version of DINPUT.DLL (which is the same for SDK versions 5.0, 5.2, 6.0, and 6.1)
11933
  explicitely checks for two possible return values:
11934
 
11935
 
11936
  1 - TRUE in C, defined as DIENUM_CONTINUE
11937
 
11938
  In Delphi, TRUE means $FFFFFFFF (= -1) for the LongBool (= BOOL) data
11939
  type, and AL = 1 (upper three bytes undefined) for the Boolean data type.
11940
  The debug version of DINPUT.DLL will throw an external exception
11941
  ("invalid return value for callback") when fed with either value.
11942
 
11943
  This change affects the following methods:
11944
  EnumDevices, EnumObjects, EnumEffects, EnumCreatedEffectObjects
11945
 
11946
  2. Windows 98 and DX6 debug versions DInput and DSound
11947
 
11948
  Under Windows 98, the "debug" setup of the DirectX SDK 6.x skips DInput.DLL
11949
  and DSound.DLL, i.e. makes you end up with the retail version of these two
11950
  files without any notice.
11951
  The debug versions of DInput.DLL and DSound.DLL can be found in the
11952
  \extras\Win98\Win98Dbg folder of the SDK CD; they need to be installed
11953
  "manually".
11954
 
11955
  This problem has been fixed with DX7 where the SDK installs the debug versions
11956
  of DInput and DSound without any "manual" help.
11957
 
11958
}
11959
 
11960
 
11961
var
11962
  DInputDLL : HMODULE;
11963
 
11964
{$IFDEF DIRECTX3}
11965
const DIRECTINPUT_VERSION = $0300;
11966
{$ELSE}
11967
const DIRECTINPUT_VERSION = $0700;
1 daniel-mar 11968
{$ENDIF}
11969
 
4 daniel-mar 11970
function DIErrorString(Value: HResult) : string;
1 daniel-mar 11971
 
4 daniel-mar 11972
//type
11973
//  TRefGUID = packed record
11974
//    case integer of
11975
//    1: (guid : PGUID);
11976
//    2: (dwFlags : DWORD);
11977
//  end;
11978
 
11979
(****************************************************************************
11980
 *
11981
 *      Class IDs
11982
 *
11983
 ****************************************************************************)
1 daniel-mar 11984
const
4 daniel-mar 11985
  CLSID_DirectInput: TGUID =
11986
      (D1:$25E609E0;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
11987
  CLSID_DirectInputDevice: TGUID =
11988
      (D1:$25E609E1;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 11989
 
4 daniel-mar 11990
(****************************************************************************
11991
 *
11992
 *      Predefined object types
11993
 *
11994
 ****************************************************************************)
1 daniel-mar 11995
 
4 daniel-mar 11996
  GUID_XAxis: TGUID =
11997
      (D1:$A36D02E0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
11998
  GUID_YAxis: TGUID =
11999
      (D1:$A36D02E1;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12000
  GUID_ZAxis: TGUID =
12001
      (D1:$A36D02E2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12002
  GUID_RxAxis: TGUID =
12003
      (D1:$A36D02F4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12004
  GUID_RyAxis: TGUID =
12005
      (D1:$A36D02F5;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12006
  GUID_RzAxis: TGUID =
12007
      (D1:$A36D02E3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12008
  GUID_Slider: TGUID =
12009
      (D1:$A36D02E4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12010
 
4 daniel-mar 12011
  GUID_Button: TGUID =
12012
      (D1:$A36D02F0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12013
  GUID_Key: TGUID =
12014
      (D1:$55728220;D2:$D33C;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12015
 
4 daniel-mar 12016
  GUID_POV: TGUID =
12017
      (D1:$A36D02F2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12018
 
4 daniel-mar 12019
  GUID_Unknown: TGUID =
12020
      (D1:$A36D02F3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12021
 
4 daniel-mar 12022
(****************************************************************************
12023
 *
12024
 *      Predefined product GUIDs
12025
 *
12026
 ****************************************************************************)
12027
 
12028
  GUID_SysMouse: TGUID =
12029
      (D1:$6F1D2B60;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12030
  GUID_SysKeyboard: TGUID =
12031
      (D1:$6F1D2B61;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12032
  GUID_Joystick: TGUID =
12033
      (D1:$6F1D2B70;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12034
  GUID_SysMouseEm: TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}';
12035
  GUID_SysMouseEm2: TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}';
12036
  GUID_SysKeyboardEm: TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}';
12037
  GUID_SysKeyboardEm2: TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}';
12038
 
4 daniel-mar 12039
(****************************************************************************
12040
 *
12041
 *      Predefined force feedback effects
12042
 *
12043
 ****************************************************************************)
1 daniel-mar 12044
 
4 daniel-mar 12045
  GUID_ConstantForce: TGUID =
12046
      (D1:$13541C20;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12047
  GUID_RampForce: TGUID =
12048
      (D1:$13541C21;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12049
  GUID_Square: TGUID =
12050
      (D1:$13541C22;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12051
  GUID_Sine: TGUID =
12052
      (D1:$13541C23;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12053
  GUID_Triangle: TGUID =
12054
      (D1:$13541C24;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12055
  GUID_SawtoothUp: TGUID =
12056
      (D1:$13541C25;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12057
  GUID_SawtoothDown: TGUID =
12058
      (D1:$13541C26;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12059
  GUID_Spring: TGUID =
12060
      (D1:$13541C27;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12061
  GUID_Damper: TGUID =
12062
      (D1:$13541C28;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12063
  GUID_Inertia: TGUID =
12064
      (D1:$13541C29;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12065
  GUID_Friction: TGUID =
12066
      (D1:$13541C2A;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12067
  GUID_CustomForce: TGUID =
12068
      (D1:$13541C2B;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
1 daniel-mar 12069
 
12070
 
4 daniel-mar 12071
 
12072
(****************************************************************************
12073
 *
12074
 *      Interfaces and Structures...
12075
 *
12076
 ****************************************************************************)
12077
 
12078
(****************************************************************************
12079
 *
12080
 *      IDirectInputEffect
12081
 *
12082
 ****************************************************************************)
12083
 
1 daniel-mar 12084
const
4 daniel-mar 12085
  DIEFT_ALL                   = $00000000;
1 daniel-mar 12086
 
4 daniel-mar 12087
  DIEFT_CONSTANTFORCE         = $00000001;
12088
  DIEFT_RAMPFORCE             = $00000002;
12089
  DIEFT_PERIODIC              = $00000003;
12090
  DIEFT_CONDITION             = $00000004;
12091
  DIEFT_CUSTOMFORCE           = $00000005;
12092
  DIEFT_HARDWARE              = $000000FF;
1 daniel-mar 12093
 
4 daniel-mar 12094
  DIEFT_FFATTACK              = $00000200;
12095
  DIEFT_FFFADE                = $00000400;
12096
  DIEFT_SATURATION            = $00000800;
12097
  DIEFT_POSNEGCOEFFICIENTS    = $00001000;
12098
  DIEFT_POSNEGSATURATION      = $00002000;
12099
  DIEFT_DEADBAND              = $00004000;
12100
  DIEFT_STARTDELAY            = $00008000;
1 daniel-mar 12101
 
4 daniel-mar 12102
function DIEFT_GETTYPE(n: variant) : byte;
1 daniel-mar 12103
 
12104
const
4 daniel-mar 12105
  DI_DEGREES                  =     100;
12106
  DI_FFNOMINALMAX             =   10000;
12107
  DI_SECONDS                  = 1000000;
1 daniel-mar 12108
 
12109
type
12110
  PDIConstantForce = ^TDIConstantForce;
4 daniel-mar 12111
  TDIConstantForce = packed record
12112
    lMagnitude : LongInt;
1 daniel-mar 12113
  end;
12114
 
12115
  PDIRampForce = ^TDIRampForce;
4 daniel-mar 12116
  TDIRampForce = packed record
12117
    lStart : LongInt;
12118
    lEnd : LongInt;
1 daniel-mar 12119
  end;
12120
 
12121
  PDIPeriodic = ^TDIPeriodic;
4 daniel-mar 12122
  TDIPeriodic = packed record
12123
    dwMagnitude : DWORD;
12124
    lOffset : LongInt;
12125
    dwPhase : DWORD;
12126
    dwPeriod : DWORD;
1 daniel-mar 12127
  end;
12128
 
12129
  PDICondition = ^TDICondition;
4 daniel-mar 12130
  TDICondition = packed record
12131
    lOffset : LongInt;
12132
    lPositiveCoefficient : LongInt;
12133
    lNegativeCoefficient : LongInt;
12134
    dwPositiveSaturation : DWORD;
12135
    dwNegativeSaturation : DWORD;
12136
    lDeadBand : LongInt;
1 daniel-mar 12137
  end;
12138
 
12139
  PDICustomForce = ^TDICustomForce;
4 daniel-mar 12140
  TDICustomForce = packed record
12141
    cChannels : DWORD;
12142
    dwSamplePeriod : DWORD;
12143
    cSamples : DWORD;
12144
    rglForceData : PLongInt;
1 daniel-mar 12145
  end;
12146
 
12147
  PDIEnvelope = ^TDIEnvelope;
4 daniel-mar 12148
  TDIEnvelope = packed record
12149
    dwSize : DWORD;                   (* sizeof(DIENVELOPE)   *)
12150
    dwAttackLevel : DWORD;
12151
    dwAttackTime : DWORD;             (* Microseconds         *)
12152
    dwFadeLevel : DWORD;
12153
    dwFadeTime : DWORD;               (* Microseconds         *)
1 daniel-mar 12154
  end;
12155
 
12156
  PDIEffect_DX5 = ^TDIEffect_DX5;
4 daniel-mar 12157
  TDIEffect_DX5 = packed record
12158
    dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
12159
    dwFlags : DWORD;                  (* DIEFF_*              *)
12160
    dwDuration : DWORD;               (* Microseconds         *)
12161
    dwSamplePeriod : DWORD;           (* Microseconds         *)
12162
    dwGain : DWORD;
12163
    dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
12164
    dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
12165
    cAxes : DWORD;                    (* Number of axes       *)
12166
    rgdwAxes : PDWORD;                (* Array of axes        *)
12167
    rglDirection : PLongInt;          (* Array of directions  *)
12168
    lpEnvelope : PDIEnvelope;         (* Optional             *)
12169
    cbTypeSpecificParams : DWORD;     (* Size of params       *)
12170
    lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
1 daniel-mar 12171
  end;
12172
 
12173
  PDIEffect_DX6 = ^TDIEffect_DX6;
4 daniel-mar 12174
  TDIEffect_DX6 = packed record
12175
    dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
12176
    dwFlags : DWORD;                  (* DIEFF_*              *)
12177
    dwDuration : DWORD;               (* Microseconds         *)
12178
    dwSamplePeriod : DWORD;           (* Microseconds         *)
12179
    dwGain : DWORD;
12180
    dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
12181
    dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
12182
    cAxes : DWORD;                    (* Number of axes       *)
12183
    rgdwAxes : PDWORD;                (* Array of axes        *)
12184
    rglDirection : PLongInt;          (* Array of directions  *)
12185
    lpEnvelope : PDIEnvelope;         (* Optional             *)
12186
    cbTypeSpecificParams : DWORD;     (* Size of params       *)
12187
    lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
12188
    dwStartDelay: DWORD;              (* Microseconds         *)
1 daniel-mar 12189
  end;
12190
 
4 daniel-mar 12191
  PDIEffect = ^TDIEffect;
12192
{$IFDEF DIRECTX5}
12193
  TDIEffect = TDIEffect_DX5;
12194
{$ELSE}
1 daniel-mar 12195
  TDIEffect = TDIEffect_DX6;
12196
{$ENDIF}
12197
 
12198
  PDIFileEffect = ^TDIFileEffect;
4 daniel-mar 12199
  TDIFileEffect = packed record
12200
    dwSize : DWORD;
1 daniel-mar 12201
    GuidEffect: TGUID;
12202
    lpDiEffect: PDIEffect;
4 daniel-mar 12203
    szFriendlyName : array [0..MAX_PATH-1] of AnsiChar;
1 daniel-mar 12204
  end;
12205
 
12206
const
12207
  DIEFF_OBJECTIDS             = $00000001;
12208
  DIEFF_OBJECTOFFSETS         = $00000002;
12209
  DIEFF_CARTESIAN             = $00000010;
12210
  DIEFF_POLAR                 = $00000020;
12211
  DIEFF_SPHERICAL             = $00000040;
12212
 
12213
  DIEP_DURATION               = $00000001;
12214
  DIEP_SAMPLEPERIOD           = $00000002;
4 daniel-mar 12215
  DIEP_GAIN                   = $00000004;
1 daniel-mar 12216
  DIEP_TRIGGERBUTTON          = $00000008;
12217
  DIEP_TRIGGERREPEATINTERVAL  = $00000010;
12218
  DIEP_AXES                   = $00000020;
12219
  DIEP_DIRECTION              = $00000040;
12220
  DIEP_ENVELOPE               = $00000080;
12221
  DIEP_TYPESPECIFICPARAMS     = $00000100;
4 daniel-mar 12222
{$IFDEF DIRECTX5}
12223
  DIEP_ALLPARAMS              = $000001FF;
12224
{$ELSE}
1 daniel-mar 12225
  DIEP_STARTDELAY             = $00000200;
12226
  DIEP_ALLPARAMS_DX5          = $000001FF;
12227
  DIEP_ALLPARAMS              = $000003FF;
12228
{$ENDIF}
12229
  DIEP_START                  = $20000000;
12230
  DIEP_NORESTART              = $40000000;
12231
  DIEP_NODOWNLOAD             = $80000000;
12232
  DIEB_NOTRIGGER              = $FFFFFFFF;
12233
 
12234
  DIES_SOLO                   = $00000001;
12235
  DIES_NODOWNLOAD             = $80000000;
12236
 
12237
  DIEGES_PLAYING              = $00000001;
12238
  DIEGES_EMULATED             = $00000002;
12239
 
4 daniel-mar 12240
 
1 daniel-mar 12241
type
12242
  PDIEffEscape = ^TDIEffEscape;
4 daniel-mar 12243
  TDIEffEscape = packed record
12244
    dwSize : DWORD;
12245
    dwCommand : DWORD;
12246
    lpvInBuffer : pointer;
12247
    cbInBuffer : DWORD;
12248
    lpvOutBuffer : pointer;
12249
    cbOutBuffer : DWORD;
1 daniel-mar 12250
  end;
12251
 
12252
 
4 daniel-mar 12253
//
12254
// IDirectSoundCapture  // as: ???
12255
//
12256
  IDirectInputEffect = interface (IUnknown)
1 daniel-mar 12257
    ['{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}']
4 daniel-mar 12258
    (** IDirectInputEffect methods ***)
12259
    function Initialize(hinst: THandle; dwVersion: DWORD;
12260
        const rguid: TGUID) : HResult;  stdcall;
12261
    function GetEffectGuid(var pguid: TGUID) : HResult;  stdcall;
12262
    function GetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
12263
    function SetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
12264
    function Start(dwIterations: DWORD; dwFlags: DWORD) : HResult;  stdcall;
12265
    function Stop : HResult;  stdcall;
12266
    function GetEffectStatus(var pdwFlags : DWORD) : HResult;  stdcall;
12267
    function Download : HResult;  stdcall;
12268
    function Unload : HResult;  stdcall;
12269
    function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
1 daniel-mar 12270
  end;
12271
 
4 daniel-mar 12272
(****************************************************************************
12273
 *
12274
 *      IDirectInputDevice
12275
 *
12276
 ****************************************************************************)
1 daniel-mar 12277
 
12278
const
4 daniel-mar 12279
  DIDEVTYPE_DEVICE = 1;
12280
  DIDEVTYPE_MOUSE = 2;
1 daniel-mar 12281
  DIDEVTYPE_KEYBOARD = 3;
12282
  DIDEVTYPE_JOYSTICK = 4;
4 daniel-mar 12283
  DIDEVTYPE_HID = $00010000;
1 daniel-mar 12284
 
4 daniel-mar 12285
  DIDEVTYPEMOUSE_UNKNOWN = 1;
1 daniel-mar 12286
  DIDEVTYPEMOUSE_TRADITIONAL = 2;
12287
  DIDEVTYPEMOUSE_FINGERSTICK = 3;
4 daniel-mar 12288
  DIDEVTYPEMOUSE_TOUCHPAD = 4;
12289
  DIDEVTYPEMOUSE_TRACKBALL = 5;
1 daniel-mar 12290
 
4 daniel-mar 12291
  DIDEVTYPEKEYBOARD_UNKNOWN = 0;
12292
  DIDEVTYPEKEYBOARD_PCXT = 1;
12293
  DIDEVTYPEKEYBOARD_OLIVETTI = 2;
12294
  DIDEVTYPEKEYBOARD_PCAT = 3;
12295
  DIDEVTYPEKEYBOARD_PCENH = 4;
12296
  DIDEVTYPEKEYBOARD_NOKIA1050 = 5;
12297
  DIDEVTYPEKEYBOARD_NOKIA9140 = 6;
12298
  DIDEVTYPEKEYBOARD_NEC98 = 7;
1 daniel-mar 12299
  DIDEVTYPEKEYBOARD_NEC98LAPTOP = 8;
4 daniel-mar 12300
  DIDEVTYPEKEYBOARD_NEC98106 = 9;
12301
  DIDEVTYPEKEYBOARD_JAPAN106 = 10;
12302
  DIDEVTYPEKEYBOARD_JAPANAX = 11;
12303
  DIDEVTYPEKEYBOARD_J3100 = 12;
1 daniel-mar 12304
 
4 daniel-mar 12305
  DIDEVTYPEJOYSTICK_UNKNOWN = 1;
1 daniel-mar 12306
  DIDEVTYPEJOYSTICK_TRADITIONAL = 2;
12307
  DIDEVTYPEJOYSTICK_FLIGHTSTICK = 3;
4 daniel-mar 12308
  DIDEVTYPEJOYSTICK_GAMEPAD = 4;
12309
  DIDEVTYPEJOYSTICK_RUDDER = 5;
12310
  DIDEVTYPEJOYSTICK_WHEEL = 6;
1 daniel-mar 12311
  DIDEVTYPEJOYSTICK_HEADTRACKER = 7;
12312
 
4 daniel-mar 12313
function GET_DIDEVICE_TYPE(dwDevType: variant) : byte;
12314
function GET_DIDEVICE_SUBTYPE(dwDevType: variant) : byte;
1 daniel-mar 12315
 
12316
type
12317
  PDIDevCaps_DX3 = ^TDIDevCaps_DX3;
4 daniel-mar 12318
  TDIDevCaps_DX3 = packed record
1 daniel-mar 12319
    dwSize: DWORD;
12320
    dwFlags: DWORD;
12321
    dwDevType: DWORD;
12322
    dwAxes: DWORD;
12323
    dwButtons: DWORD;
12324
    dwPOVs: DWORD;
12325
  end;
12326
 
12327
  PDIDevCaps_DX5 = ^TDIDevCaps_DX5;
4 daniel-mar 12328
  TDIDevCaps_DX5 = packed record
1 daniel-mar 12329
    dwSize: DWORD;
12330
    dwFlags: DWORD;
12331
    dwDevType: DWORD;
12332
    dwAxes: DWORD;
12333
    dwButtons: DWORD;
12334
    dwPOVs: DWORD;
12335
    dwFFSamplePeriod: DWORD;
12336
    dwFFMinTimeResolution: DWORD;
12337
    dwFirmwareRevision: DWORD;
12338
    dwHardwareRevision: DWORD;
12339
    dwFFDriverVersion: DWORD;
12340
  end;
12341
 
4 daniel-mar 12342
  PDIDevCaps = ^TDIDevCaps;
12343
{$IFDEF DIRECTX3}
1 daniel-mar 12344
  TDIDevCaps = TDIDevCaps_DX3;
4 daniel-mar 12345
{$ELSE}
1 daniel-mar 12346
  TDIDevCaps = TDIDevCaps_DX5;
12347
{$ENDIF}
12348
 
12349
const
12350
  DIDC_ATTACHED           = $00000001;
12351
  DIDC_POLLEDDEVICE       = $00000002;
12352
  DIDC_EMULATED           = $00000004;
12353
  DIDC_POLLEDDATAFORMAT   = $00000008;
12354
  DIDC_FORCEFEEDBACK      = $00000100;
12355
  DIDC_FFATTACK           = $00000200;
12356
  DIDC_FFFADE             = $00000400;
12357
  DIDC_SATURATION         = $00000800;
12358
  DIDC_POSNEGCOEFFICIENTS = $00001000;
12359
  DIDC_POSNEGSATURATION   = $00002000;
12360
  DIDC_DEADBAND           = $00004000;
12361
  DIDC_STARTDELAY         = $00008000;
12362
  DIDC_ALIAS              = $00010000;
12363
  DIDC_PHANTOM            = $00020000;
12364
 
4 daniel-mar 12365
  DIDFT_ALL = $00000000;
1 daniel-mar 12366
 
4 daniel-mar 12367
  DIDFT_RELAXIS = $00000001;
12368
  DIDFT_ABSAXIS = $00000002;
12369
  DIDFT_AXIS    = $00000003;
1 daniel-mar 12370
 
4 daniel-mar 12371
  DIDFT_PSHBUTTON = $00000004;
12372
  DIDFT_TGLBUTTON = $00000008;
12373
  DIDFT_BUTTON    = $0000000C;
1 daniel-mar 12374
 
12375
  DIDFT_POV        = $00000010;
12376
  DIDFT_COLLECTION = $00000040;
12377
  DIDFT_NODATA     = $00000080;
12378
 
4 daniel-mar 12379
  DIDFT_ANYINSTANCE = $00FFFF00;
1 daniel-mar 12380
  DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE;
4 daniel-mar 12381
function DIDFT_MAKEINSTANCE(n: variant) : DWORD;
12382
function DIDFT_GETTYPE(n: variant) : byte;
12383
function DIDFT_GETINSTANCE(n: variant) : DWORD;
12384
const
12385
  DIDFT_FFACTUATOR        = $01000000;
12386
  DIDFT_FFEFFECTTRIGGER   = $02000000;
12387
  DIDFT_OUTPUT            = $10000000;
12388
  DIDFT_VENDORDEFINED     = $04000000;
12389
  DIDFT_ALIAS             = $08000000;
1 daniel-mar 12390
 
4 daniel-mar 12391
function DIDFT_ENUMCOLLECTION(n: variant) : DWORD;
12392
const
12393
  DIDFT_NOCOLLECTION = $00FFFF00;
1 daniel-mar 12394
 
12395
 
4 daniel-mar 12396
 
1 daniel-mar 12397
type
12398
  PDIObjectDataFormat = ^TDIObjectDataFormat;
4 daniel-mar 12399
  TDIObjectDataFormat = packed record
1 daniel-mar 12400
    pguid: PGUID;
12401
    dwOfs: DWORD;
12402
    dwType: DWORD;
12403
    dwFlags: DWORD;
12404
  end;
12405
 
12406
  PDIDataFormat = ^TDIDataFormat;
4 daniel-mar 12407
  TDIDataFormat = packed record
12408
    dwSize: DWORD;  
1 daniel-mar 12409
    dwObjSize: DWORD;
4 daniel-mar 12410
    dwFlags: DWORD;  
12411
    dwDataSize: DWORD;  
12412
    dwNumObjs: DWORD;  
1 daniel-mar 12413
    rgodf: PDIObjectDataFormat;
12414
  end;
12415
 
12416
const
12417
  DIDF_ABSAXIS = $00000001;
12418
  DIDF_RELAXIS = $00000002;
12419
 
12420
type
4 daniel-mar 12421
  PDIDeviceObjectInstance_DX3A = ^TDIDeviceObjectInstance_DX3A;
12422
  TDIDeviceObjectInstance_DX3A = packed record
1 daniel-mar 12423
    dwSize: DWORD;
12424
    guidType: TGUID;
12425
    dwOfs: DWORD;
12426
    dwType: DWORD;
12427
    dwFlags: DWORD;
4 daniel-mar 12428
    tszName: Array [0..MAX_PATH-1] of CHAR;
1 daniel-mar 12429
  end;
12430
 
4 daniel-mar 12431
  PDIDeviceObjectInstance_DX3W = ^TDIDeviceObjectInstance_DX3W;
12432
  TDIDeviceObjectInstance_DX3W = packed record
1 daniel-mar 12433
    dwSize: DWORD;
12434
    guidType: TGUID;
12435
    dwOfs: DWORD;
12436
    dwType: DWORD;
12437
    dwFlags: DWORD;
4 daniel-mar 12438
    tszName: Array [0..MAX_PATH-1] of WCHAR;
12439
  end;
12440
 
12441
  PDIDeviceObjectInstance_DX3 = ^TDIDeviceObjectInstance_DX3;
12442
{$IFDEF UNICODE}
12443
  TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3W;
12444
{$ELSE}
12445
  TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3A;
12446
{$ENDIF}
12447
 
12448
  PDIDeviceObjectInstance_DX5A = ^TDIDeviceObjectInstance_DX5A;
12449
  TDIDeviceObjectInstance_DX5A = packed record
12450
    dwSize: DWORD;
12451
    guidType: TGUID;
12452
    dwOfs: DWORD;
12453
    dwType: DWORD;
12454
    dwFlags: DWORD;
12455
    tszName: Array [0..MAX_PATH-1] of CHAR;
1 daniel-mar 12456
    dwFFMaxForce: DWORD;
12457
    dwFFForceResolution: DWORD;
12458
    wCollectionNumber: WORD;
12459
    wDesignatorIndex: WORD;
12460
    wUsagePage: WORD;
12461
    wUsage: WORD;
12462
    dwDimension: DWORD;
12463
    wExponent: WORD;
12464
    wReserved: WORD;
12465
  end;
12466
 
4 daniel-mar 12467
  PDIDeviceObjectInstance_DX5W = ^TDIDeviceObjectInstance_DX5W;
12468
  TDIDeviceObjectInstance_DX5W = packed record
1 daniel-mar 12469
    dwSize: DWORD;
12470
    guidType: TGUID;
12471
    dwOfs: DWORD;
12472
    dwType: DWORD;
12473
    dwFlags: DWORD;
4 daniel-mar 12474
    tszName: Array [0..MAX_PATH-1] of WCHAR;
1 daniel-mar 12475
    dwFFMaxForce: DWORD;
12476
    dwFFForceResolution: DWORD;
12477
    wCollectionNumber: WORD;
12478
    wDesignatorIndex: WORD;
12479
    wUsagePage: WORD;
12480
    wUsage: WORD;
12481
    dwDimension: DWORD;
12482
    wExponent: WORD;
12483
    wReserved: WORD;
12484
  end;
12485
 
4 daniel-mar 12486
  PDIDeviceObjectInstance_DX5 = ^TDIDeviceObjectInstance_DX5;
12487
{$IFDEF UNICODE}
12488
  TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5W;
12489
{$ELSE}
12490
  TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5A;
1 daniel-mar 12491
{$ENDIF}
12492
 
4 daniel-mar 12493
  PDIDeviceObjectInstanceA = ^TDIDeviceObjectInstanceA;
12494
  PDIDeviceObjectInstanceW = ^TDIDeviceObjectInstanceA;
12495
  PDIDeviceObjectInstance = ^TDIDeviceObjectInstance;
12496
{$IFDEF DIRECTX3}
12497
  TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX3A;
12498
  TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX3W;
12499
  TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX3;
12500
{$ELSE}
12501
  TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX5A;
12502
  TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX5W;
12503
  TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX5;
12504
{$ENDIF}
1 daniel-mar 12505
 
4 daniel-mar 12506
  // Bug fix (and deviation from the SDK). Callback *must* return
12507
  // DIENUM_STOP (= 0) or DIENUM_CONTINUE (=1) in order to work
12508
  // with the debug version of DINPUT.DLL
12509
  TDIEnumDeviceObjectsCallbackA = function (
12510
      var lpddoi: TDIDeviceObjectInstanceA; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
12511
  TDIEnumDeviceObjectsCallbackW = function (
12512
      var lpddoi: TDIDeviceObjectInstanceW; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
12513
  TDIEnumDeviceObjectsCallback = function (
12514
      var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
1 daniel-mar 12515
 
4 daniel-mar 12516
  TDIEnumDeviceObjectsProc = function (
12517
      var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
1 daniel-mar 12518
 
12519
const
4 daniel-mar 12520
  DIDOI_FFACTUATOR        = $00000001;
12521
  DIDOI_FFEFFECTTRIGGER   = $00000002;
12522
  DIDOI_POLLED            = $00008000;
12523
  DIDOI_ASPECTPOSITION    = $00000100;
12524
  DIDOI_ASPECTVELOCITY    = $00000200;
12525
  DIDOI_ASPECTACCEL       = $00000300;
12526
  DIDOI_ASPECTFORCE       = $00000400;
12527
  DIDOI_ASPECTMASK        = $00000F00;
12528
  DIDOI_GUIDISUSAGE       = $00010000;
1 daniel-mar 12529
 
12530
type
12531
  PDIPropHeader = ^TDIPropHeader;
4 daniel-mar 12532
  TDIPropHeader = packed record
1 daniel-mar 12533
    dwSize: DWORD;
12534
    dwHeaderSize: DWORD;
12535
    dwObj: DWORD;
12536
    dwHow: DWORD;
12537
  end;
12538
 
12539
const
4 daniel-mar 12540
  DIPH_DEVICE = 0;
1 daniel-mar 12541
  DIPH_BYOFFSET = 1;
4 daniel-mar 12542
  DIPH_BYID = 2;
12543
  DIPH_BYUSAGE = 3;
1 daniel-mar 12544
 
4 daniel-mar 12545
function DIMAKEUSAGEDWORD(UsagePage, Usage: WORD) : DWORD;
1 daniel-mar 12546
 
12547
type
4 daniel-mar 12548
  PDIPropDWord = ^TDIPropDWord;
12549
  TDIPropDWord = packed record
1 daniel-mar 12550
    diph: TDIPropHeader;
12551
    dwData: DWORD;
12552
  end;
12553
 
12554
  PDIPropRange = ^TDIPropRange;
4 daniel-mar 12555
  TDIPropRange = packed record
1 daniel-mar 12556
    diph: TDIPropHeader;
12557
    lMin: Longint;
12558
    lMax: Longint;
12559
  end;
12560
 
4 daniel-mar 12561
const
12562
  DIPROPRANGE_NOMIN = $80000000;
12563
  DIPROPRANGE_NOMAX = $7FFFFFFF;
1 daniel-mar 12564
 
4 daniel-mar 12565
type
1 daniel-mar 12566
  PDIPropCal = ^TDIPropCal;
4 daniel-mar 12567
  TDIPropCal = packed record
1 daniel-mar 12568
    diph: TDIPropHeader;
4 daniel-mar 12569
    lMin:    LongInt;
12570
    lCenter: LongInt;
12571
    lMax:    LongInt;
1 daniel-mar 12572
  end;
12573
 
12574
  PDIPropGUIDAndPath = ^TDIPropGUIDAndPath;
4 daniel-mar 12575
  TDIPropGUIDAndPath = packed record
1 daniel-mar 12576
    diph: TDIPropHeader;
12577
    guidClass: TGUID;
4 daniel-mar 12578
    wszPath: array [0..MAX_PATH-1] of WideChar;
1 daniel-mar 12579
  end;
12580
 
12581
  PDIPropString = ^TDIPropString;
4 daniel-mar 12582
  TDIPropString = packed record
1 daniel-mar 12583
    diph: TDIPropHeader;
4 daniel-mar 12584
    wsz: array [0..MAX_PATH-1] of WideChar;
1 daniel-mar 12585
  end;
12586
 
4 daniel-mar 12587
type
12588
  MAKEDIPROP = PGUID;
1 daniel-mar 12589
 
4 daniel-mar 12590
const
12591
  DIPROP_BUFFERSIZE = MAKEDIPROP(1);
1 daniel-mar 12592
 
4 daniel-mar 12593
  DIPROP_AXISMODE = MAKEDIPROP(2);
1 daniel-mar 12594
 
4 daniel-mar 12595
  DIPROPAXISMODE_ABS = 0;
12596
  DIPROPAXISMODE_REL = 1;
1 daniel-mar 12597
 
4 daniel-mar 12598
  DIPROP_GRANULARITY = MAKEDIPROP(3);
1 daniel-mar 12599
 
4 daniel-mar 12600
  DIPROP_RANGE = MAKEDIPROP(4);
12601
 
12602
  DIPROP_DEADZONE = MAKEDIPROP(5);
12603
 
12604
  DIPROP_SATURATION = MAKEDIPROP(6);
12605
 
12606
  DIPROP_FFGAIN = MAKEDIPROP(7);
12607
 
12608
  DIPROP_FFLOAD = MAKEDIPROP(8);
12609
 
12610
  DIPROP_AUTOCENTER = MAKEDIPROP(9);
12611
 
1 daniel-mar 12612
  DIPROPAUTOCENTER_OFF = 0;
4 daniel-mar 12613
  DIPROPAUTOCENTER_ON = 1;
1 daniel-mar 12614
 
4 daniel-mar 12615
  DIPROP_CALIBRATIONMODE = MAKEDIPROP(10);
1 daniel-mar 12616
 
12617
  DIPROPCALIBRATIONMODE_COOKED = 0;
4 daniel-mar 12618
  DIPROPCALIBRATIONMODE_RAW = 1;
1 daniel-mar 12619
 
4 daniel-mar 12620
  DIPROP_CALIBRATION      = MAKEDIPROP(11);
1 daniel-mar 12621
 
4 daniel-mar 12622
  DIPROP_GUIDANDPATH      = MAKEDIPROP(12);
12623
 
12624
  DIPROP_INSTANCENAME     = MAKEDIPROP(13);
12625
 
12626
  DIPROP_PRODUCTNAME      = MAKEDIPROP(14);
12627
 
12628
  DIPROP_JOYSTICKID       = MAKEDIPROP(15);
12629
 
12630
  DIPROP_GETPORTDISPLAYNAME       = MAKEDIPROP(16);
12631
 
12632
 
12633
  DIPROP_ENABLEREPORTID       = MAKEDIPROP(17);
12634
 
12635
 
12636
  DIPROP_GETPHYSICALRANGE            = MAKEDIPROP(18);
12637
 
12638
  DIPROP_GETLOGICALRANGE            = MAKEDIPROP(19);
12639
 
12640
 
1 daniel-mar 12641
type
12642
  PDIDeviceObjectData = ^TDIDeviceObjectData;
4 daniel-mar 12643
  TDIDeviceObjectData = packed record
1 daniel-mar 12644
    dwOfs: DWORD;
12645
    dwData: DWORD;
12646
    dwTimeStamp: DWORD;
12647
    dwSequence: DWORD;
12648
  end;
12649
 
12650
const
12651
  DIGDD_PEEK = $00000001;
4 daniel-mar 12652
{
12653
#define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \
12654
                         (int) ((dwSequence1) - (dwSequence2))  cmp 0
12655
}
1 daniel-mar 12656
 
4 daniel-mar 12657
  DISCL_EXCLUSIVE  = $00000001;
1 daniel-mar 12658
  DISCL_NONEXCLUSIVE = $00000002;
4 daniel-mar 12659
  DISCL_FOREGROUND = $00000004;
12660
  DISCL_BACKGROUND = $00000008;
12661
  DISCL_NOWINKEY   = $00000010;
1 daniel-mar 12662
 
4 daniel-mar 12663
 
1 daniel-mar 12664
type
4 daniel-mar 12665
 
12666
  PDIDeviceInstance_DX3A = ^TDIDeviceInstance_DX3A;
12667
  TDIDeviceInstance_DX3A = packed record
1 daniel-mar 12668
    dwSize: DWORD;
12669
    guidInstance: TGUID;
12670
    guidProduct: TGUID;
12671
    dwDevType: DWORD;
4 daniel-mar 12672
    tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
12673
    tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
1 daniel-mar 12674
  end;
12675
 
4 daniel-mar 12676
  PDIDeviceInstance_DX3W = ^TDIDeviceInstance_DX3W;
12677
  TDIDeviceInstance_DX3W = packed record
1 daniel-mar 12678
    dwSize: DWORD;
12679
    guidInstance: TGUID;
12680
    guidProduct: TGUID;
12681
    dwDevType: DWORD;
4 daniel-mar 12682
    tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
12683
    tszProductName: Array [0..MAX_PATH-1] of WideChar;
1 daniel-mar 12684
  end;
12685
 
4 daniel-mar 12686
  PDIDeviceInstance_DX3 = ^TDIDeviceInstance_DX3;
12687
{$IFDEF UNICODE}
12688
  TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3W;
12689
{$ELSE}
12690
  TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3A;
1 daniel-mar 12691
{$ENDIF}
12692
 
4 daniel-mar 12693
  PDIDeviceInstance_DX5A = ^TDIDeviceInstance_DX5A;
12694
  TDIDeviceInstance_DX5A = packed record
1 daniel-mar 12695
    dwSize: DWORD;
12696
    guidInstance: TGUID;
12697
    guidProduct: TGUID;
12698
    dwDevType: DWORD;
4 daniel-mar 12699
    tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
12700
    tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
12701
    guidFFDriver: TGUID;
12702
    wUsagePage: WORD;
12703
    wUsage: WORD;
1 daniel-mar 12704
  end;
12705
 
4 daniel-mar 12706
  PDIDeviceInstance_DX5W = ^TDIDeviceInstance_DX5W;
12707
  TDIDeviceInstance_DX5W = packed record
1 daniel-mar 12708
    dwSize: DWORD;
12709
    guidInstance: TGUID;
12710
    guidProduct: TGUID;
12711
    dwDevType: DWORD;
4 daniel-mar 12712
    tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
12713
    tszProductName: Array [0..MAX_PATH-1] of WideChar;
1 daniel-mar 12714
    guidFFDriver: TGUID;
12715
    wUsagePage: WORD;
12716
    wUsage: WORD;
12717
  end;
12718
 
4 daniel-mar 12719
  PDIDeviceInstance_DX5 = ^TDIDeviceInstance_DX5;
12720
{$IFDEF UNICODE}
12721
  TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5W;
12722
{$ELSE}
12723
  TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5A;
1 daniel-mar 12724
{$ENDIF}
12725
 
4 daniel-mar 12726
  PDIDeviceInstanceA = ^TDIDeviceInstanceA;
12727
  PDIDeviceInstanceW = ^TDIDeviceInstanceW;
12728
  PDIDeviceInstance = ^TDIDeviceInstance;
12729
{$IFDEF DIRECTX3}
12730
  TDIDeviceInstanceA = TDIDeviceInstance_DX3A;
12731
  TDIDeviceInstanceW = TDIDeviceInstance_DX3W;
12732
  TDIDeviceInstance = TDIDeviceInstance_DX3;
12733
{$ELSE}
12734
  TDIDeviceInstanceA = TDIDeviceInstance_DX5A;
12735
  TDIDeviceInstanceW = TDIDeviceInstance_DX5W;
12736
  TDIDeviceInstance = TDIDeviceInstance_DX5;
12737
{$ENDIF}
1 daniel-mar 12738
 
4 daniel-mar 12739
  IDirectInputDeviceA = interface (IUnknown)
12740
    ['{5944E680-C92E-11CF-BFC7-444553540000}']
12741
    (*** IDirectInputDeviceA methods ***)
12742
    function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
12743
    function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA;
12744
        pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
12745
    function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
12746
        HResult;  stdcall;
12747
    function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader) :
12748
        HResult;  stdcall;
12749
    function Acquire : HResult;  stdcall;
12750
    function Unacquire : HResult;  stdcall;
12751
    function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
12752
    function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
12753
        var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
12754
    function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
12755
    function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
12756
    function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
12757
    function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj: DWORD;
12758
        dwHow: DWORD) : HResult;  stdcall;
12759
    function GetDeviceInfo(var pdidi: TDIDeviceInstanceA) : HResult;  stdcall;
12760
    function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
12761
    function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
12762
  end;
1 daniel-mar 12763
 
4 daniel-mar 12764
  IDirectInputDeviceW = interface (IUnknown)
1 daniel-mar 12765
    ['{5944E681-C92E-11CF-BFC7-444553540000}']
4 daniel-mar 12766
    (*** IDirectInputDeviceW methods ***)
12767
    function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
1 daniel-mar 12768
    function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW;
4 daniel-mar 12769
        pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
12770
    function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
12771
        HResult;  stdcall;
12772
    function SetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
12773
        HResult;  stdcall;
12774
    function Acquire : HResult;  stdcall;
12775
    function Unacquire : HResult;  stdcall;
12776
    function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
12777
    function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
12778
        var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
12779
    function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
12780
    function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
12781
    function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
1 daniel-mar 12782
    function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj: DWORD;
4 daniel-mar 12783
        dwHow: DWORD) : HResult;  stdcall;
12784
    function GetDeviceInfo(var pdidi: TDIDeviceInstanceW) : HResult;  stdcall;
12785
    function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
12786
    function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
1 daniel-mar 12787
  end;
12788
 
4 daniel-mar 12789
{$IFDEF UNICODE}
12790
  IDirectInputDevice = IDirectInputDeviceW;
12791
{$ELSE}
1 daniel-mar 12792
  IDirectInputDevice = IDirectInputDeviceA;
4 daniel-mar 12793
{$ENDIF}
1 daniel-mar 12794
 
12795
const
4 daniel-mar 12796
  DISFFC_RESET            = $00000001;
12797
  DISFFC_STOPALL          = $00000002;
12798
  DISFFC_PAUSE            = $00000004;
12799
  DISFFC_CONTINUE         = $00000008;
12800
  DISFFC_SETACTUATORSON   = $00000010;
12801
  DISFFC_SETACTUATORSOFF  = $00000020;
1 daniel-mar 12802
 
4 daniel-mar 12803
  DIGFFS_EMPTY            = $00000001;
12804
  DIGFFS_STOPPED          = $00000002;
12805
  DIGFFS_PAUSED           = $00000004;
12806
  DIGFFS_ACTUATORSON      = $00000010;
12807
  DIGFFS_ACTUATORSOFF     = $00000020;
12808
  DIGFFS_POWERON          = $00000040;
12809
  DIGFFS_POWEROFF         = $00000080;
12810
  DIGFFS_SAFETYSWITCHON   = $00000100;
12811
  DIGFFS_SAFETYSWITCHOFF  = $00000200;
12812
  DIGFFS_USERFFSWITCHON   = $00000400;
12813
  DIGFFS_USERFFSWITCHOFF  = $00000800;
12814
  DIGFFS_DEVICELOST       = $80000000;
1 daniel-mar 12815
 
12816
type
12817
  PDIEffectInfoA = ^TDIEffectInfoA;
4 daniel-mar 12818
  TDIEffectInfoA = packed record
12819
    dwSize : DWORD;
12820
    guid : TGUID;
12821
    dwEffType : DWORD;
12822
    dwStaticParams : DWORD;
12823
    dwDynamicParams : DWORD;
12824
    tszName : array [0..MAX_PATH-1] of CHAR;
1 daniel-mar 12825
  end;
12826
 
12827
  PDIEffectInfoW = ^TDIEffectInfoW;
4 daniel-mar 12828
  TDIEffectInfoW = packed record
12829
    dwSize : DWORD;
12830
    guid : TGUID;
12831
    dwEffType : DWORD;
12832
    dwStaticParams : DWORD;
12833
    dwDynamicParams : DWORD;
12834
    tszName : array [0..MAX_PATH-1] of WCHAR;
1 daniel-mar 12835
  end;
12836
 
4 daniel-mar 12837
  PDIEffectInfo = ^TDIEffectInfo;
12838
{$IFDEF UNICODE}
12839
  TDIEffectInfo = TDIEffectInfoW;
12840
{$ELSE}
12841
  TDIEffectInfo = TDIEffectInfoA;
12842
{$ENDIF}
1 daniel-mar 12843
 
4 daniel-mar 12844
const
12845
  DISDD_CONTINUE          = $00000001;
1 daniel-mar 12846
 
4 daniel-mar 12847
  // Bug fix & deviation from the SDK: Must return DIENUM_STOP or
12848
  // DIENUM_CONTINUE (=1) in order to work with the debug version of DINPUT.DLL
12849
type
12850
  TDIEnumEffectsCallbackA =
12851
      function(var pdei: TDIEffectInfoA; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
12852
  TDIEnumEffectsCallbackW =
12853
      function(var pdei: TDIEffectInfoW; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
12854
  TDIEnumEffectsCallback =
12855
      function(var pdei: TDIEffectInfo; pvRef: pointer) : Integer; stdcall; // BOOL; stdcall;
12856
  TDIEnumEffectsProc = TDIEnumEffectsCallback;
1 daniel-mar 12857
 
4 daniel-mar 12858
  TDIEnumCreatedEffectObjectsCallback =
12859
      function(peff: IDirectInputEffect; pvRev: pointer): Integer; stdcall; // BOOL; stdcall;
12860
  TDIEnumCreatedEffectObjectsProc = TDIEnumCreatedEffectObjectsCallback;
1 daniel-mar 12861
 
4 daniel-mar 12862
  IDirectInputDevice2A = interface (IDirectInputDeviceA)
12863
    ['{5944E682-C92E-11CF-BFC7-444553540000}']
12864
    (*** IDirectInputDevice2A methods ***)
12865
    function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
12866
        var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
12867
    function EnumEffects(lpCallback: TDIEnumEffectsCallbackA;
12868
        pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
12869
    function GetEffectInfo(pdei: TDIEffectInfoA; const rguid: TGUID) : HResult;  stdcall;
12870
    function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
12871
    function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
1 daniel-mar 12872
    function EnumCreatedEffectObjects(lpCallback:
4 daniel-mar 12873
        TDIEnumCreatedEffectObjectsCallback;
12874
        pvRef: pointer; fl: DWORD) : HResult;  stdcall;
12875
    function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
12876
    function Poll : HResult;  stdcall;
12877
    function SendDeviceData
12878
        (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
12879
        var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
1 daniel-mar 12880
  end;
12881
 
4 daniel-mar 12882
  IDirectInputDevice2W = interface (IDirectInputDeviceW)
12883
    ['{5944E683-C92E-11CF-BFC7-444553540000}']
12884
    (*** IDirectInputDevice2W methods ***)
12885
    function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
12886
        var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
12887
    function EnumEffects(lpCallback: TDIEnumEffectsCallbackW;
12888
        pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
12889
    function GetEffectInfo(pdei: TDIEffectInfoW; const rguid: TGUID) : HResult;  stdcall;
12890
    function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
12891
    function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
1 daniel-mar 12892
    function EnumCreatedEffectObjects(lpCallback:
4 daniel-mar 12893
        TDIEnumCreatedEffectObjectsCallback;
12894
        pvRef: pointer; fl: DWORD) : HResult;  stdcall;
12895
    function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
12896
    function Poll : HResult;  stdcall;
12897
    function SendDeviceData
12898
        (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
12899
        var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
1 daniel-mar 12900
  end;
12901
 
4 daniel-mar 12902
{$IFDEF UNICODE}
12903
  IDirectInputDevice2 = IDirectInputDevice2W;
12904
{$ELSE}
1 daniel-mar 12905
  IDirectInputDevice2 = IDirectInputDevice2A;
4 daniel-mar 12906
{$ENDIF}
1 daniel-mar 12907
 
4 daniel-mar 12908
const
12909
  DIFEF_DEFAULT               = $00000000;
12910
  DIFEF_INCLUDENONSTANDARD    = $00000001;
12911
  DIFEF_MODIFYIFNEEDED          = $00000010;
1 daniel-mar 12912
 
4 daniel-mar 12913
///Weitermachen:  (as: nur die Deklarationen eingefüllt, die ich zum Testen gebraucht habe)
12914
 
12915
type
12916
  TEnumEffectsInFileCallback = function(gaga, huhu: Integer): HResult;
12917
 
12918
type
12919
  IDirectInputDevice7W = interface (IDirectInputDevice2W)
1 daniel-mar 12920
    ['{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}']
4 daniel-mar 12921
    (*** IDirectInputDevice7A methods ***)
12922
    function EnumEffectsInFile(const lpszFileName: PChar;
12923
      pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
12924
    function WriteEffectToFile(const lpszFileName: PChar;
12925
      dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
1 daniel-mar 12926
  end;
12927
 
4 daniel-mar 12928
  IDirectInputDevice7A = interface (IDirectInputDevice2A)
12929
    ['{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}']
12930
    function EnumEffectsInFile(const lpszFileName: PChar;
12931
      pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
12932
    function WriteEffectToFile(const lpszFileName: PChar;
12933
      dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
12934
  end;
12935
 
12936
{$IFDEF UNICODE}
12937
  IDirectInputDevice7 = IDirectInputDevice7W;
12938
{$ELSE}
1 daniel-mar 12939
  IDirectInputDevice7 = IDirectInputDevice7A;
4 daniel-mar 12940
{$ENDIF}
1 daniel-mar 12941
 
4 daniel-mar 12942
(****************************************************************************
12943
 *
12944
 *      Mouse
12945
 *
12946
 ****************************************************************************)
1 daniel-mar 12947
 
12948
type
4 daniel-mar 12949
  PDIMouseState = ^TDIMouseState;
12950
  TDIMouseState = packed record
1 daniel-mar 12951
    lX: Longint;
12952
    lY: Longint;
12953
    lZ: Longint;
4 daniel-mar 12954
    rgbButtons: Array [0..3] of BYTE;  // up to 4 buttons
1 daniel-mar 12955
  end;
12956
 
4 daniel-mar 12957
  PDIMouseState2 = ^TDIMouseState2;
12958
  TDIMouseState2 = packed record
1 daniel-mar 12959
    lX: Longint;
12960
    lY: Longint;
12961
    lZ: Longint;
4 daniel-mar 12962
    rgbButtons: Array [0..7] of BYTE;  // up to 8 buttons
1 daniel-mar 12963
  end;
12964
 
4 daniel-mar 12965
const
12966
  DIMOFS_X       = 0;
12967
  DIMOFS_Y       = 4;
12968
  DIMOFS_Z       = 8;
12969
  DIMOFS_BUTTON0 = 12;
12970
  DIMOFS_BUTTON1 = 13;
12971
  DIMOFS_BUTTON2 = 14;
12972
  DIMOFS_BUTTON3 = 15;
12973
  // DX7 supports up to 8 mouse buttons
12974
  DIMOFS_BUTTON4 = DIMOFS_BUTTON0+4;
12975
  DIMOFS_BUTTON5 = DIMOFS_BUTTON0+5;
12976
  DIMOFS_BUTTON6 = DIMOFS_BUTTON0+6;
12977
  DIMOFS_BUTTON7 = DIMOFS_BUTTON0+7;
1 daniel-mar 12978
 
4 daniel-mar 12979
 
1 daniel-mar 12980
const
4 daniel-mar 12981
  _c_dfDIMouse_Objects: array[0..6] of TDIObjectDataFormat = (
12982
    (  pguid: @GUID_XAxis;
12983
       dwOfs: DIMOFS_X;
12984
       dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
12985
       dwFlags: 0),
12986
    (  pguid: @GUID_YAxis;
12987
       dwOfs: DIMOFS_Y;
12988
       dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
12989
       dwFlags: 0),
12990
    (  pguid: @GUID_ZAxis;
12991
       dwOfs: DIMOFS_Z;
12992
       dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION;
12993
       dwFlags: 0),
12994
    (  pguid: nil;
12995
       dwOfs: DIMOFS_BUTTON0;
12996
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
12997
       dwFlags: 0),
12998
    (  pguid: nil;
12999
       dwOfs: DIMOFS_BUTTON1;
13000
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13001
       dwFlags: 0),
13002
    (  pguid: nil;
13003
       dwOfs: DIMOFS_BUTTON2;
13004
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13005
       dwFlags: 0),
13006
    (  pguid: nil;
13007
       dwOfs: DIMOFS_BUTTON3;
13008
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13009
       dwFlags: 0)
13010
    );
1 daniel-mar 13011
 
13012
  c_dfDIMouse: TDIDataFormat = (
4 daniel-mar 13013
    dwSize: Sizeof(c_dfDIMouse);              // $18
13014
    dwObjSize: Sizeof(TDIObjectDataFormat);   // $10
13015
    dwFlags: DIDF_RELAXIS;                    //
13016
    dwDataSize: Sizeof(TDIMouseState);        // $10
13017
    dwNumObjs: High(_c_dfDIMouse_Objects)+1;  // 7
13018
    rgodf: @_c_dfDIMouse_Objects[Low(_c_dfDIMouse_Objects)]
1 daniel-mar 13019
  );
13020
 
13021
 
4 daniel-mar 13022
  _c_dfDIMouse2_Objects: array[0..10] of TDIObjectDataFormat = (
13023
    (  pguid: @GUID_XAxis;
13024
       dwOfs: DIMOFS_X;
13025
       dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
13026
       dwFlags: 0),
13027
    (  pguid: @GUID_YAxis;
13028
       dwOfs: DIMOFS_Y;
13029
       dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
13030
       dwFlags: 0),
13031
    (  pguid: @GUID_ZAxis;
13032
       dwOfs: DIMOFS_Z;
13033
       dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION;
13034
       dwFlags: 0),
13035
    (  pguid: nil;
13036
       dwOfs: DIMOFS_BUTTON0;
13037
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13038
       dwFlags: 0),
13039
    (  pguid: nil;
13040
       dwOfs: DIMOFS_BUTTON1;
13041
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13042
       dwFlags: 0),
13043
    (  pguid: nil;
13044
       dwOfs: DIMOFS_BUTTON2;
13045
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13046
       dwFlags: 0),
13047
    (  pguid: nil;
13048
       dwOfs: DIMOFS_BUTTON3;
13049
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13050
       dwFlags: 0),
13051
    // fields introduced with IDirectInputDevice7.GetDeviceState       
13052
    (  pguid: nil;
13053
       dwOfs: DIMOFS_BUTTON4;
13054
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13055
       dwFlags: 0),
13056
    (  pguid: nil;
13057
       dwOfs: DIMOFS_BUTTON5;
13058
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13059
       dwFlags: 0),
13060
    (  pguid: nil;
13061
       dwOfs: DIMOFS_BUTTON6;
13062
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13063
       dwFlags: 0),
13064
    (  pguid: nil;
13065
       dwOfs: DIMOFS_BUTTON7;
13066
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13067
       dwFlags: 0)
13068
    );
1 daniel-mar 13069
 
4 daniel-mar 13070
  c_dfDIMouse2: TDIDataFormat = (
13071
    dwSize: Sizeof(c_dfDIMouse);              // $18
13072
    dwObjSize: Sizeof(TDIObjectDataFormat);   // $10
13073
    dwFlags: DIDF_RELAXIS;                    //
13074
    dwDataSize: Sizeof(TDIMouseState2);        // $14
13075
    dwNumObjs: High(_c_dfDIMouse_Objects)+1;  // 11
13076
    rgodf: @_c_dfDIMouse2_Objects[Low(_c_dfDIMouse2_Objects)]
1 daniel-mar 13077
  );
13078
 
13079
 
4 daniel-mar 13080
(****************************************************************************
13081
 *
13082
 *      DirectInput keyboard scan codes
13083
 *
13084
 ****************************************************************************)
1 daniel-mar 13085
 
13086
const
13087
  DIK_ESCAPE          = $01;
13088
  DIK_1               = $02;
13089
  DIK_2               = $03;
13090
  DIK_3               = $04;
13091
  DIK_4               = $05;
13092
  DIK_5               = $06;
13093
  DIK_6               = $07;
13094
  DIK_7               = $08;
13095
  DIK_8               = $09;
13096
  DIK_9               = $0A;
13097
  DIK_0               = $0B;
4 daniel-mar 13098
  DIK_MINUS           = $0C;    (* - on main keyboard *)
1 daniel-mar 13099
  DIK_EQUALS          = $0D;
4 daniel-mar 13100
  DIK_BACK            = $0E;    (* backspace *)
1 daniel-mar 13101
  DIK_TAB             = $0F;
13102
  DIK_Q               = $10;
13103
  DIK_W               = $11;
13104
  DIK_E               = $12;
13105
  DIK_R               = $13;
13106
  DIK_T               = $14;
13107
  DIK_Y               = $15;
13108
  DIK_U               = $16;
13109
  DIK_I               = $17;
13110
  DIK_O               = $18;
13111
  DIK_P               = $19;
13112
  DIK_LBRACKET        = $1A;
13113
  DIK_RBRACKET        = $1B;
4 daniel-mar 13114
  DIK_RETURN          = $1C;    (* Enter on main keyboard *)
1 daniel-mar 13115
  DIK_LCONTROL        = $1D;
13116
  DIK_A               = $1E;
13117
  DIK_S               = $1F;
13118
  DIK_D               = $20;
13119
  DIK_F               = $21;
13120
  DIK_G               = $22;
13121
  DIK_H               = $23;
13122
  DIK_J               = $24;
13123
  DIK_K               = $25;
13124
  DIK_L               = $26;
13125
  DIK_SEMICOLON       = $27;
13126
  DIK_APOSTROPHE      = $28;
4 daniel-mar 13127
  DIK_GRAVE           = $29;    (* accent grave *)
1 daniel-mar 13128
  DIK_LSHIFT          = $2A;
13129
  DIK_BACKSLASH       = $2B;
13130
  DIK_Z               = $2C;
13131
  DIK_X               = $2D;
13132
  DIK_C               = $2E;
13133
  DIK_V               = $2F;
13134
  DIK_B               = $30;
13135
  DIK_N               = $31;
13136
  DIK_M               = $32;
13137
  DIK_COMMA           = $33;
4 daniel-mar 13138
  DIK_PERIOD          = $34;    (* . on main keyboard *)
13139
  DIK_SLASH           = $35;    (* / on main keyboard *)
1 daniel-mar 13140
  DIK_RSHIFT          = $36;
4 daniel-mar 13141
  DIK_MULTIPLY        = $37;    (* * on numeric keypad *)
13142
  DIK_LMENU           = $38;    (* left Alt *)
1 daniel-mar 13143
  DIK_SPACE           = $39;
13144
  DIK_CAPITAL         = $3A;
13145
  DIK_F1              = $3B;
13146
  DIK_F2              = $3C;
13147
  DIK_F3              = $3D;
13148
  DIK_F4              = $3E;
13149
  DIK_F5              = $3F;
13150
  DIK_F6              = $40;
13151
  DIK_F7              = $41;
13152
  DIK_F8              = $42;
13153
  DIK_F9              = $43;
13154
  DIK_F10             = $44;
13155
  DIK_NUMLOCK         = $45;
4 daniel-mar 13156
  DIK_SCROLL          = $46;    (* Scroll Lock *)
1 daniel-mar 13157
  DIK_NUMPAD7         = $47;
13158
  DIK_NUMPAD8         = $48;
13159
  DIK_NUMPAD9         = $49;
4 daniel-mar 13160
  DIK_SUBTRACT        = $4A;    (* - on numeric keypad *)
1 daniel-mar 13161
  DIK_NUMPAD4         = $4B;
13162
  DIK_NUMPAD5         = $4C;
13163
  DIK_NUMPAD6         = $4D;
4 daniel-mar 13164
  DIK_ADD             = $4E;    (* + on numeric keypad *)
1 daniel-mar 13165
  DIK_NUMPAD1         = $4F;
13166
  DIK_NUMPAD2         = $50;
13167
  DIK_NUMPAD3         = $51;
13168
  DIK_NUMPAD0         = $52;
4 daniel-mar 13169
  DIK_DECIMAL         = $53;    (* . on numeric keypad *)
13170
  // $54 to $56 unassigned
1 daniel-mar 13171
  DIK_F11             = $57;
13172
  DIK_F12             = $58;
4 daniel-mar 13173
  // $59 to $63 unassigned
13174
  DIK_F13             = $64;    (*                     (NEC PC98) *)
13175
  DIK_F14             = $65;    (*                     (NEC PC98) *)
13176
  DIK_F15             = $66;    (*                     (NEC PC98) *)
13177
  // $67 to $6F unassigned
13178
  DIK_KANA            = $70;    (* (Japanese keyboard)            *)
13179
  DIK_CONVERT         = $79;    (* (Japanese keyboard)            *)
13180
  DIK_NOCONVERT       = $7B;    (* (Japanese keyboard)            *)
13181
  DIK_YEN             = $7D;    (* (Japanese keyboard)            *)
13182
  DIK_NUMPADEQUALS    = $8D;    (* = on numeric keypad (NEC PC98) *)
13183
  // $8E to $8F unassigned
13184
  DIK_CIRCUMFLEX      = $90;    (* (Japanese keyboard)            *)
13185
  DIK_AT              = $91;    (*                     (NEC PC98) *)
13186
  DIK_COLON           = $92;    (*                     (NEC PC98) *)
13187
  DIK_UNDERLINE       = $93;    (*                     (NEC PC98) *)
13188
  DIK_KANJI           = $94;    (* (Japanese keyboard)            *)
13189
  DIK_STOP            = $95;    (*                     (NEC PC98) *)
13190
  DIK_AX              = $96;    (*                     (Japan AX) *)
13191
  DIK_UNLABELED       = $97;    (*                        (J3100) *)
13192
  // $98 to $99 unassigned
13193
  DIK_NUMPADENTER     = $9C;    (* Enter on numeric keypad *)
1 daniel-mar 13194
  DIK_RCONTROL        = $9D;
4 daniel-mar 13195
  // $9E to $B2 unassigned
13196
  DIK_NUMPADCOMMA     = $B3;    (* , on numeric keypad (NEC PC98) *)
13197
  // $B4 unassigned
13198
  DIK_DIVIDE          = $B5;    (* / on numeric keypad *)
13199
  // $B6 unassigned
1 daniel-mar 13200
  DIK_SYSRQ           = $B7;
4 daniel-mar 13201
  DIK_RMENU           = $B8;    (* right Alt *)
13202
  // $B9 to $C4 unassigned
13203
  DIK_PAUSE           = $C5;    (* Pause (watch out - not realiable on some kbds) *)
13204
  // $C6 unassigned
13205
  DIK_HOME            = $C7;    (* Home on arrow keypad *)
13206
  DIK_UP              = $C8;    (* UpArrow on arrow keypad *)
13207
  DIK_PRIOR           = $C9;    (* PgUp on arrow keypad *)
13208
  // $CA unassigned
13209
  DIK_LEFT            = $CB;    (* LeftArrow on arrow keypad *)
13210
  DIK_RIGHT           = $CD;    (* RightArrow on arrow keypad *)
13211
  // $CF unassigned
13212
  DIK_END             = $CF;    (* End on arrow keypad *)
13213
  DIK_DOWN            = $D0;    (* DownArrow on arrow keypad *)
13214
  DIK_NEXT            = $D1;    (* PgDn on arrow keypad *)
13215
  DIK_INSERT          = $D2;    (* Insert on arrow keypad *)
13216
  DIK_DELETE          = $D3;    (* Delete on arrow keypad *)
13217
  DIK_LWIN            = $DB;    (* Left Windows key *)
13218
  DIK_RWIN            = $DC;    (* Right Windows key *)
13219
  DIK_APPS            = $DD;    (* AppMenu key *)
13220
  // New with DX 6.1 & Win98
13221
  DIK_POWER           = $DE;
13222
  DIK_SLEEP           = $DF;
13223
  // $E0 to $E2 unassigned
13224
  // $E3 = Wake up ("translated" in German DInput to "Kielwasser" (ship's wake) ;-)
1 daniel-mar 13225
 
4 daniel-mar 13226
(*
13227
 *  Alternate names for keys, to facilitate transition from DOS.
13228
 *)
13229
  DIK_BACKSPACE      = DIK_BACK    ;        (* backspace *)
13230
  DIK_NUMPADSTAR     = DIK_MULTIPLY;        (* * on numeric keypad *)
13231
  DIK_LALT           = DIK_LMENU   ;        (* left Alt *)
13232
  DIK_CAPSLOCK       = DIK_CAPITAL ;        (* CapsLock *)
13233
  DIK_NUMPADMINUS    = DIK_SUBTRACT;        (* - on numeric keypad *)
13234
  DIK_NUMPADPLUS     = DIK_ADD     ;        (* + on numeric keypad *)
13235
  DIK_NUMPADPERIOD   = DIK_DECIMAL ;        (* . on numeric keypad *)
13236
  DIK_NUMPADSLASH    = DIK_DIVIDE  ;        (* / on numeric keypad *)
13237
  DIK_RALT           = DIK_RMENU   ;        (* right Alt *)
13238
  DIK_UPARROW        = DIK_UP      ;        (* UpArrow on arrow keypad *)
13239
  DIK_PGUP           = DIK_PRIOR   ;        (* PgUp on arrow keypad *)
13240
  DIK_LEFTARROW      = DIK_LEFT    ;        (* LeftArrow on arrow keypad *)
13241
  DIK_RIGHTARROW     = DIK_RIGHT   ;        (* RightArrow on arrow keypad *)
13242
  DIK_DOWNARROW      = DIK_DOWN    ;        (* DownArrow on arrow keypad *)
13243
  DIK_PGDN           = DIK_NEXT    ;        (* PgDn on arrow keypad *)
1 daniel-mar 13244
 
4 daniel-mar 13245
(****************************************************************************
13246
 *
13247
 *      Keyboard
13248
 *
13249
 ****************************************************************************)
1 daniel-mar 13250
 
4 daniel-mar 13251
 
1 daniel-mar 13252
type
4 daniel-mar 13253
  TDIKeyboardState = array[0..255] of Byte;
13254
(*
13255
const
13256
  _c_dfDIKeyboard_Objects: array[0..255] of TDIObjectDataFormat = (
13257
    (  pguid: @GUID_Key;
13258
       dwOfs: DIK_ESCAPE;
13259
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13260
       dwFlags: 0),
13261
    // -------- top row (except function keys) on main kbd ------------
13262
    (  pguid: @GUID_Key;
13263
       dwOfs: DIK_1;  // "1" on main kbd, Offset 2
13264
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13265
       dwFlags: 0),
13266
    (  pguid: @GUID_Key;
13267
       dwOfs: DIK_2;  // "2" on main kbd, Offset 3
13268
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13269
       dwFlags: 0),
13270
    (  pguid: @GUID_Key;
13271
       dwOfs: DIK_3;  // "3" on main kbd, etc.
13272
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13273
       dwFlags: 0),
13274
    (  pguid: @GUID_Key;
13275
       dwOfs: DIK_4;
13276
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13277
       dwFlags: 0),
13278
    (  pguid: @GUID_Key;
13279
       dwOfs: DIK_5;
13280
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13281
       dwFlags: 0),
13282
    (  pguid: @GUID_Key;
13283
       dwOfs: DIK_6;
13284
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13285
       dwFlags: 0),
13286
    (  pguid: @GUID_Key;
13287
       dwOfs: DIK_7;
13288
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13289
       dwFlags: 0),
13290
    (  pguid: @GUID_Key;
13291
       dwOfs: DIK_8;
13292
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13293
       dwFlags: 0),
13294
    (  pguid: @GUID_Key;
13295
       dwOfs: DIK_9;
13296
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13297
       dwFlags: 0),
13298
    (  pguid: @GUID_Key;
13299
       dwOfs: DIK_0;  // "0", main kbd
13300
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13301
       dwFlags: 0),
13302
    (  pguid: @GUID_Key;
13303
       dwOfs: DIK_MINUS; // "-" on US kbds, "ß" on german kbds
13304
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13305
       dwFlags: 0),
13306
    (  pguid: @GUID_Key;
13307
       dwOfs: DIK_EQUALS;  // "=" for US, "´" for german
13308
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13309
       dwFlags: 0),
13310
    (  pguid: @GUID_Key;
13311
       dwOfs: DIK_BACK;  // backspace
13312
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13313
       dwFlags: 0),
13314
    // ----------- 2nd row -----------------------
13315
    (  pguid: @GUID_Key;
13316
       dwOfs: DIK_TAB;
13317
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13318
       dwFlags: 0),
13319
    (  pguid: @GUID_Key;
13320
       dwOfs: DIK_Q;
13321
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13322
       dwFlags: 0),
13323
    (  pguid: @GUID_Key;
13324
       dwOfs: DIK_W;
13325
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13326
       dwFlags: 0),
13327
    (  pguid: @GUID_Key;
13328
       dwOfs: DIK_E;
13329
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13330
       dwFlags: 0),
13331
    (  pguid: @GUID_Key;
13332
       dwOfs: DIK_R;
13333
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13334
       dwFlags: 0),
13335
    (  pguid: @GUID_Key;
13336
       dwOfs: DIK_T;
13337
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13338
       dwFlags: 0),
13339
    (  pguid: @GUID_Key;
13340
       dwOfs: DIK_Y;  // "Z" on german & french keyboards
13341
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13342
       dwFlags: 0),
13343
    (  pguid: @GUID_Key;
13344
       dwOfs: DIK_U;
13345
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13346
       dwFlags: 0),
13347
    (  pguid: @GUID_Key;
13348
       dwOfs: DIK_I;
13349
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13350
       dwFlags: 0),
13351
    (  pguid: @GUID_Key;
13352
       dwOfs: DIK_O;
13353
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13354
       dwFlags: 0),
13355
    (  pguid: @GUID_Key;
13356
       dwOfs: DIK_P;
13357
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13358
       dwFlags: 0),
13359
    (  pguid: @GUID_Key;
13360
       dwOfs: DIK_LBRACKET;  // "Ü" on german keyboards
13361
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13362
       dwFlags: 0),
13363
    (  pguid: @GUID_Key;
13364
       dwOfs: DIK_RBRACKET;  // "+" on german keyboards
13365
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13366
       dwFlags: 0),
13367
    (  pguid: @GUID_Key;
13368
       dwOfs: DIK_RETURN;   // Enter on main kbd
13369
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13370
       dwFlags: 0),
13371
    // next row should really start with caps lock but doesn't ;-)
13372
    // (DIK_CAPITAL is Offset $3A, i.e. after 4th row)
13373
    (  pguid: @GUID_Key;
13374
       dwOfs: DIK_LCONTROL;  // Left Ctrl (german kbds: "Strg")
13375
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13376
       dwFlags: 0),
13377
    // ----------- 3rd row ------------------------------
13378
    (  pguid: @GUID_Key;
13379
       dwOfs: DIK_A;
13380
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13381
       dwFlags: 0),
13382
    (  pguid: @GUID_Key;
13383
       dwOfs: DIK_S;
13384
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13385
       dwFlags: 0),
13386
    (  pguid: @GUID_Key;
13387
       dwOfs: DIK_D;
13388
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13389
       dwFlags: 0),
13390
    (  pguid: @GUID_Key;
13391
       dwOfs: DIK_F;
13392
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13393
       dwFlags: 0),
13394
    (  pguid: @GUID_Key;
13395
       dwOfs: DIK_G;
13396
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13397
       dwFlags: 0),
13398
    (  pguid: @GUID_Key;
13399
       dwOfs: DIK_H;
13400
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13401
       dwFlags: 0),
13402
    (  pguid: @GUID_Key;
13403
       dwOfs: DIK_J;
13404
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13405
       dwFlags: 0),
13406
    (  pguid: @GUID_Key;
13407
       dwOfs: DIK_K;
13408
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13409
       dwFlags: 0),
13410
    (  pguid: @GUID_Key;
13411
       dwOfs: DIK_L;
13412
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13413
       dwFlags: 0),
13414
    (  pguid: @GUID_Key;
13415
       dwOfs: DIK_SEMICOLON;  // "Ö" on german kbds
13416
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13417
       dwFlags: 0),
13418
    (  pguid: @GUID_Key;
13419
       dwOfs: DIK_APOSTROPHE;  // "Ä" on german kbds
13420
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13421
       dwFlags: 0),
13422
    (  pguid: @GUID_Key;
13423
       dwOfs: DIK_GRAVE; // accent grave, "'" on german kbds
13424
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13425
       dwFlags: 0),
13426
    // ---------------- 4th row -----------------------
13427
    (  pguid: @GUID_Key;
13428
       dwOfs: DIK_LSHIFT;  // left shift
13429
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13430
       dwFlags: 0),
13431
    (  pguid: @GUID_Key;
13432
       dwOfs: DIK_BACKSLASH;  // "<" on german kbds
13433
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13434
       dwFlags: 0),
13435
    (  pguid: @GUID_Key;
13436
       dwOfs: DIK_Z;     // "Y" on german kbds
13437
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13438
       dwFlags: 0),
13439
    (  pguid: @GUID_Key;
13440
       dwOfs: DIK_X;
13441
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13442
       dwFlags: 0),
13443
    (  pguid: @GUID_Key;
13444
       dwOfs: DIK_C;
13445
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13446
       dwFlags: 0),
13447
    (  pguid: @GUID_Key;
13448
       dwOfs: DIK_V;
13449
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13450
       dwFlags: 0),
13451
    (  pguid: @GUID_Key;
13452
       dwOfs: DIK_B;
13453
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13454
       dwFlags: 0),
13455
    (  pguid: @GUID_Key;
13456
       dwOfs: DIK_N;
13457
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13458
       dwFlags: 0),
13459
    (  pguid: @GUID_Key;
13460
       dwOfs: DIK_M;
13461
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13462
       dwFlags: 0),
13463
    (  pguid: @GUID_Key;
13464
       dwOfs: DIK_COMMA;
13465
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13466
       dwFlags: 0),
13467
    (  pguid: @GUID_Key;
13468
       dwOfs: DIK_PERIOD;  // on main kbd
13469
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13470
       dwFlags: 0),
13471
    (  pguid: @GUID_Key;
13472
       dwOfs: DIK_SLASH;  // "-" on german kbds
13473
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13474
       dwFlags: 0),
13475
    (  pguid: @GUID_Key;
13476
       dwOfs: DIK_RSHIFT;
13477
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13478
       dwFlags: 0),
13479
    // --- misc keys (bye, bye, order) ----------------
13480
    (  pguid: @GUID_Key;
13481
       dwOfs: DIK_MULTIPLY;  // on numeric keypad
13482
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13483
       dwFlags: 0),
13484
    (  pguid: @GUID_Key;
13485
       dwOfs: DIK_LMENU;  // left ALT
13486
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13487
       dwFlags: 0),
13488
    (  pguid: @GUID_Key;
13489
       dwOfs: DIK_SPACE;  // space bar
13490
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13491
       dwFlags: 0),
13492
    (  pguid: @GUID_Key;
13493
       dwOfs: DIK_CAPITAL;   // caps lock (on main kbd, above LSHIFT)
13494
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13495
       dwFlags: 0),
13496
    // ---------- function keys -----------
13497
    (  pguid: @GUID_Key;
13498
       dwOfs: DIK_F1;
13499
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13500
       dwFlags: 0),
13501
    (  pguid: @GUID_Key;
13502
       dwOfs: DIK_F2;
13503
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13504
       dwFlags: 0),
13505
    (  pguid: @GUID_Key;
13506
       dwOfs: DIK_F3;
13507
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13508
       dwFlags: 0),
13509
    (  pguid: @GUID_Key;
13510
       dwOfs: DIK_F4;
13511
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13512
       dwFlags: 0),
13513
    (  pguid: @GUID_Key;
13514
       dwOfs: DIK_F5;
13515
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13516
       dwFlags: 0),
13517
    (  pguid: @GUID_Key;
13518
       dwOfs: DIK_F6;
13519
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13520
       dwFlags: 0),
13521
    (  pguid: @GUID_Key;
13522
       dwOfs: DIK_F7;
13523
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13524
       dwFlags: 0),
13525
    (  pguid: @GUID_Key;
13526
       dwOfs: DIK_F8;
13527
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13528
       dwFlags: 0),
13529
    (  pguid: @GUID_Key;
13530
       dwOfs: DIK_F9;
13531
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13532
       dwFlags: 0),
13533
    (  pguid: @GUID_Key;
13534
       dwOfs: DIK_F10;
13535
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13536
       dwFlags: 0),
13537
    // ------- F11, F12 after numeric keypad (for "historical reasons" -- XT kbd)
13538
 
13539
    // --------- numeric keypad (mostly, that is) -----------
13540
    (  pguid: @GUID_Key;
13541
       dwOfs: DIK_NUMLOCK;   // numeric keypad
13542
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13543
       dwFlags: 0),
13544
    (  pguid: @GUID_Key;
13545
       dwOfs: DIK_SCROLL;  // scroll lock
13546
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13547
       dwFlags: 0),
13548
    (  pguid: @GUID_Key;
13549
       dwOfs: DIK_NUMPAD7;
13550
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13551
       dwFlags: 0),
13552
    (  pguid: @GUID_Key;
13553
       dwOfs: DIK_NUMPAD8;
13554
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13555
       dwFlags: 0),
13556
    (  pguid: @GUID_Key;
13557
       dwOfs: DIK_NUMPAD9;
13558
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13559
       dwFlags: 0),
13560
    (  pguid: @GUID_Key;
13561
       dwOfs: DIK_SUBTRACT;  // "-" on numeric keypad
13562
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13563
       dwFlags: 0),
13564
    (  pguid: @GUID_Key;
13565
       dwOfs: DIK_NUMPAD4;
13566
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13567
       dwFlags: 0),
13568
    (  pguid: @GUID_Key;
13569
       dwOfs: DIK_NUMPAD5;
13570
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13571
       dwFlags: 0),
13572
    (  pguid: @GUID_Key;
13573
       dwOfs: DIK_NUMPAD6;
13574
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13575
       dwFlags: 0),
13576
    (  pguid: @GUID_Key;
13577
       dwOfs: DIK_ADD;   // "+" on numeric keypad
13578
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13579
       dwFlags: 0),
13580
    (  pguid: @GUID_Key;
13581
       dwOfs: DIK_NUMPAD1;
13582
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13583
       dwFlags: 0),
13584
    (  pguid: @GUID_Key;
13585
       dwOfs: DIK_NUMPAD2;
13586
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13587
       dwFlags: 0),
13588
    (  pguid: @GUID_Key;
13589
       dwOfs: DIK_NUMPAD3;
13590
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13591
       dwFlags: 0),
13592
    (  pguid: @GUID_Key;
13593
       dwOfs: DIK_NUMPAD0;  // "0" or "Insert" on numeric keypad
13594
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13595
       dwFlags: 0),
13596
    (  pguid: @GUID_Key;
13597
       dwOfs: DIK_DECIMAL;  // "." or "Del" on numeric keypad
13598
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13599
       dwFlags: 0),
13600
    (  pguid: @GUID_Key;
13601
       dwOfs: $54;
13602
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13603
       dwFlags: 0),
13604
    // "extended" function keys; F13 to F15 only on NEC PC98
13605
    (  pguid: @GUID_Key;
13606
       dwOfs: DIK_F11;
13607
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13608
       dwFlags: 0),
13609
    (  pguid: @GUID_Key;
13610
       dwOfs: DIK_F12;
13611
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13612
       dwFlags: 0),
13613
    // -------------------------------------------------
13614
    // a whole lot of keys for asian kbds only
13615
    // -------------------------------------------------
13616
    (  pguid: @GUID_Key;
13617
       dwOfs: DIK_NUMPADENTER;  // Enter on numeric keypad
13618
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13619
       dwFlags: 0),
13620
    (  pguid: @GUID_Key;
13621
       dwOfs: DIK_RCONTROL;        // right Ctrl on main kbd
13622
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13623
       dwFlags: 0),
13624
    (  pguid: @GUID_Key;   // "," on numeric keypad (NEC PC98 only)
13625
       dwOfs: DIK_NUMPADCOMMA;
13626
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13627
       dwFlags: 0),
13628
    (  pguid: @GUID_Key;
13629
       dwOfs: DIK_DIVIDE;   // "/" on numeric keypad
13630
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13631
       dwFlags: 0),
13632
    (  pguid: @GUID_Key;
13633
       dwOfs: DIK_SYSRQ;   // "System request", "Druck/S-Abf" on german kbds
13634
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13635
       dwFlags: 0),
13636
    (  pguid: @GUID_Key;
13637
       dwOfs: DIK_RMENU;  // right ALT
13638
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13639
       dwFlags: 0),
13640
    (  pguid: @GUID_Key;
13641
       dwOfs: DIK_PAUSE;  // "Pause" - not reliable on some kbds
13642
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13643
       dwFlags: 0),
13644
 
13645
    // ----------- arrow keypad -----------------
13646
    (  pguid: @GUID_Key;
13647
       dwOfs:   DIK_HOME;    // Home on arrow keypad
13648
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13649
       dwFlags: 0),
13650
    (  pguid: @GUID_Key;
13651
       dwOfs: DIK_UP;        // UpArrow on arrow keypad
13652
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13653
       dwFlags: 0),
13654
    (  pguid: @GUID_Key;
13655
       dwOfs: DIK_PRIOR;    // PgUp on arrow keypad
13656
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13657
       dwFlags: 0),
13658
    (  pguid: @GUID_Key;
13659
       dwOfs: DIK_LEFT;    // LeftArrow on arrow keypad
13660
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13661
       dwFlags: 0),
13662
    (  pguid: @GUID_Key;
13663
       dwOfs: DIK_RIGHT;    // RightArrow on arrow keypad
13664
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13665
       dwFlags: 0),
13666
    (  pguid: @GUID_Key;
13667
       dwOfs: DIK_END;    // End on arrow keypad
13668
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13669
       dwFlags: 0),
13670
    (  pguid: @GUID_Key;
13671
       dwOfs: DIK_DOWN;    // DownArrow on arrow keypad
13672
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13673
       dwFlags: 0),
13674
    (  pguid: @GUID_Key;
13675
       dwOfs: DIK_NEXT;    // PgDn on arrow keypad
13676
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13677
       dwFlags: 0),
13678
    (  pguid: @GUID_Key;
13679
       dwOfs: DIK_INSERT;    // Insert on arrow keypad
13680
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13681
       dwFlags: 0),
13682
    (  pguid: @GUID_Key;
13683
       dwOfs: DIK_DELETE;    // Delete on arrow keypad
13684
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13685
       dwFlags: 0),
13686
    (  pguid: @GUID_Key;
13687
       dwOfs: DIK_LWIN;    // Left Windows key
13688
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13689
       dwFlags: 0),
13690
    (  pguid: @GUID_Key;
13691
       dwOfs: DIK_RWIN;    // Right Windows key
13692
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13693
       dwFlags: 0),
13694
    (  pguid: @GUID_Key;
13695
       dwOfs: DIK_APPS;    // AppMenu key
13696
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13697
       dwFlags: 0),
13698
    // -------- added with Win 98 / DirectX 6.1 ------------
13699
    (  pguid: @GUID_Key;
13700
       dwOfs: 222;    // Power on key
13701
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13702
       dwFlags: 0),
13703
    (  pguid: @GUID_Key;
13704
       dwOfs: 223;    // Sleep key
13705
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13706
       dwFlags: 0),
13707
    (  pguid: @GUID_Key;
13708
       dwOfs: 227;   // Wake (up) key. The german "translation"
13709
                     // reads "Kielwasser" (ship's wake) ;-)
13710
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13711
       dwFlags: 0)
13712
  );
13713
*)
13714
 
13715
var  // set by initialization - I was simply too lazy
13716
  _c_dfDIKeyboard_Objects: array[0..255] of TDIObjectDataFormat;
13717
const
13718
  c_dfDIKeyboard: TDIDataFormat = (
13719
    dwSize: Sizeof(c_dfDIKeyboard);
13720
    dwObjSize: Sizeof(TDIObjectDataFormat);
13721
    dwFlags: DIDF_RELAXIS;
13722
    dwDataSize: Sizeof(TDIKeyboardState);
13723
    dwNumObjs: High(_c_dfDIKeyboard_Objects)+1;
13724
    rgodf: @_c_dfDIKeyboard_Objects[Low(_c_dfDIKeyboard_Objects)]
13725
  );
13726
 
13727
(****************************************************************************
13728
 *
13729
 *      Joystick
13730
 *
13731
 ****************************************************************************)
13732
 
13733
 
13734
type
1 daniel-mar 13735
  PDIJoyState = ^TDIJoyState;
4 daniel-mar 13736
  TDIJoyState = packed record
13737
    lX: Longint;   (* x-axis position              *)
13738
    lY: Longint;   (* y-axis position              *)
13739
    lZ: Longint;   (* z-axis position              *)
13740
    lRx: Longint;   (* x-axis rotation              *)
13741
    lRy: Longint;   (* y-axis rotation              *)
13742
    lRz: Longint;   (* z-axis rotation              *)
13743
    rglSlider: Array [0..1] of Longint;   (* extra axes positions         *)
13744
    rgdwPOV: Array [0..3] of DWORD;   (* POV directions               *)
13745
    rgbButtons: Array [0..31] of BYTE;   (* 32 buttons                   *)
1 daniel-mar 13746
  end;
13747
 
4 daniel-mar 13748
  PDIJoyState2 = ^TDIJoyState2;
13749
  TDIJoyState2 = packed record
13750
    lX: Longint;   (* x-axis position              *)
13751
    lY: Longint;   (* y-axis position              *)
13752
    lZ: Longint;   (* z-axis position              *)
13753
    lRx: Longint;   (* x-axis rotation              *)
13754
    lRy: Longint;   (* y-axis rotation              *)
13755
    lRz: Longint;   (* z-axis rotation              *)
13756
    rglSlider: Array [0..1] of Longint;   (* extra axes positions         *)
13757
    rgdwPOV: Array [0..3] of DWORD;   (* POV directions               *)
13758
    rgbButtons: Array [0..127] of BYTE;   (* 128 buttons                  *)
13759
    lVX: Longint;   (* x-axis velocity              *)
13760
    lVY: Longint;   (* y-axis velocity              *)
13761
    lVZ: Longint;   (* z-axis velocity              *)
13762
    lVRx: Longint;   (* x-axis angular velocity      *)
13763
    lVRy: Longint;   (* y-axis angular velocity      *)
13764
    lVRz: Longint;   (* z-axis angular velocity      *)
13765
    rglVSlider: Array [0..1] of Longint;   (* extra axes velocities        *)
13766
    lAX: Longint;   (* x-axis acceleration          *)
13767
    lAY: Longint;   (* y-axis acceleration          *)
13768
    lAZ: Longint;   (* z-axis acceleration          *)
13769
    lARx: Longint;   (* x-axis angular acceleration  *)
13770
    lARy: Longint;   (* y-axis angular acceleration  *)
13771
    lARz: Longint;   (* z-axis angular acceleration  *)
13772
    rglASlider: Array [0..1] of Longint;   (* extra axes accelerations     *)
13773
    lFX: Longint;   (* x-axis force                 *)
13774
    lFY: Longint;   (* y-axis force                 *)
13775
    lFZ: Longint;   (* z-axis force                 *)
13776
    lFRx: Longint;   (* x-axis torque                *)
13777
    lFRy: Longint;   (* y-axis torque                *)
13778
    lFRz: Longint;   (* z-axis torque                *)
13779
    rglFSlider: Array [0..1] of Longint;   (* extra axes forces            *)
1 daniel-mar 13780
  end;
13781
 
13782
 
4 daniel-mar 13783
function DIJOFS_SLIDER(n: variant) : variant;
13784
 
13785
function DIJOFS_POV(n: variant) : variant;
13786
 
13787
function DIJOFS_BUTTON(n: variant) : variant;
13788
const
13789
  DIJOFS_BUTTON_ = 48;
13790
 
13791
const
13792
  DIJOFS_BUTTON0 = DIJOFS_BUTTON_ + 0;
13793
  DIJOFS_BUTTON1 = DIJOFS_BUTTON_ + 1;
13794
  DIJOFS_BUTTON2 = DIJOFS_BUTTON_ + 2;
13795
  DIJOFS_BUTTON3 = DIJOFS_BUTTON_ + 3;
13796
  DIJOFS_BUTTON4 = DIJOFS_BUTTON_ + 4;
13797
  DIJOFS_BUTTON5 = DIJOFS_BUTTON_ + 5;
13798
  DIJOFS_BUTTON6 = DIJOFS_BUTTON_ + 6;
13799
  DIJOFS_BUTTON7 = DIJOFS_BUTTON_ + 7;
13800
  DIJOFS_BUTTON8 = DIJOFS_BUTTON_ + 8;
13801
  DIJOFS_BUTTON9 = DIJOFS_BUTTON_ + 9;
13802
  DIJOFS_BUTTON10 = DIJOFS_BUTTON_ + 10;
13803
  DIJOFS_BUTTON11 = DIJOFS_BUTTON_ + 11;
13804
  DIJOFS_BUTTON12 = DIJOFS_BUTTON_ + 12;
13805
  DIJOFS_BUTTON13 = DIJOFS_BUTTON_ + 13;
13806
  DIJOFS_BUTTON14 = DIJOFS_BUTTON_ + 14;
13807
  DIJOFS_BUTTON15 = DIJOFS_BUTTON_ + 15;
13808
  DIJOFS_BUTTON16 = DIJOFS_BUTTON_ + 16;
13809
  DIJOFS_BUTTON17 = DIJOFS_BUTTON_ + 17;
13810
  DIJOFS_BUTTON18 = DIJOFS_BUTTON_ + 18;
13811
  DIJOFS_BUTTON19 = DIJOFS_BUTTON_ + 19;
13812
  DIJOFS_BUTTON20 = DIJOFS_BUTTON_ + 20;
13813
  DIJOFS_BUTTON21 = DIJOFS_BUTTON_ + 21;
13814
  DIJOFS_BUTTON22 = DIJOFS_BUTTON_ + 22;
13815
  DIJOFS_BUTTON23 = DIJOFS_BUTTON_ + 23;
13816
  DIJOFS_BUTTON24 = DIJOFS_BUTTON_ + 24;
13817
  DIJOFS_BUTTON25 = DIJOFS_BUTTON_ + 25;
13818
  DIJOFS_BUTTON26 = DIJOFS_BUTTON_ + 26;
13819
  DIJOFS_BUTTON27 = DIJOFS_BUTTON_ + 27;
13820
  DIJOFS_BUTTON28 = DIJOFS_BUTTON_ + 28;
13821
  DIJOFS_BUTTON29 = DIJOFS_BUTTON_ + 29;
13822
  DIJOFS_BUTTON30 = DIJOFS_BUTTON_ + 30;
13823
  DIJOFS_BUTTON31 = DIJOFS_BUTTON_ + 31;
13824
 
13825
 
13826
const
13827
  DIJOFS_X  =0;
13828
  DIJOFS_Y  =4;
13829
  DIJOFS_Z  =8;
13830
  DIJOFS_RX =12;
13831
  DIJOFS_RY =16;
13832
  DIJOFS_RZ =20;
13833
 
13834
  _c_dfDIJoystick_Objects: array[0..43] of TDIObjectDataFormat = (
13835
    (  pguid: @GUID_XAxis;
13836
       dwOfs: DIJOFS_X; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13837
    (  pguid: @GUID_YAxis;
13838
       dwOfs: DIJOFS_Y; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13839
    (  pguid: @GUID_ZAxis;
13840
       dwOfs: DIJOFS_Z; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13841
    (  pguid: @GUID_RxAxis;
13842
       dwOfs: DIJOFS_RX; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13843
    (  pguid: @GUID_RyAxis;
13844
       dwOfs: DIJOFS_RY; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13845
    (  pguid: @GUID_RzAxis;
13846
       dwOfs: DIJOFS_RZ; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13847
 
13848
    (  pguid: @GUID_Slider;  // 2 Sliders
13849
       dwOfs: 24; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13850
    (  pguid: @GUID_Slider;
13851
       dwOfs: 28; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13852
 
13853
    (  pguid: @GUID_POV;  // 4 POVs (yes, really)
13854
       dwOfs: 32; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
13855
    (  pguid: @GUID_POV;
13856
       dwOfs: 36; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
13857
    (  pguid: @GUID_POV;
13858
       dwOfs: 40; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
13859
    (  pguid: @GUID_POV;
13860
       dwOfs: 44; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
13861
 
13862
    (  pguid: nil;   // Buttons
13863
       dwOfs: DIJOFS_BUTTON0; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
1 daniel-mar 13864
    (  pguid: nil;
4 daniel-mar 13865
       dwOfs: DIJOFS_BUTTON1; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
1 daniel-mar 13866
    (  pguid: nil;
4 daniel-mar 13867
       dwOfs: DIJOFS_BUTTON2; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13868
    (  pguid: nil;
13869
       dwOfs: DIJOFS_BUTTON3; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13870
    (  pguid: nil;
13871
       dwOfs: DIJOFS_BUTTON4; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13872
    (  pguid: nil;
13873
       dwOfs: DIJOFS_BUTTON5; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13874
    (  pguid: nil;
13875
       dwOfs: DIJOFS_BUTTON6; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13876
    (  pguid: nil;
13877
       dwOfs: DIJOFS_BUTTON7; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13878
    (  pguid: nil;
13879
       dwOfs: DIJOFS_BUTTON8; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13880
    (  pguid: nil;
13881
       dwOfs: DIJOFS_BUTTON9; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13882
    (  pguid: nil;
13883
       dwOfs: DIJOFS_BUTTON10; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13884
    (  pguid: nil;
13885
       dwOfs: DIJOFS_BUTTON11; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13886
    (  pguid: nil;
13887
       dwOfs: DIJOFS_BUTTON12; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13888
    (  pguid: nil;
13889
       dwOfs: DIJOFS_BUTTON13; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13890
    (  pguid: nil;
13891
       dwOfs: DIJOFS_BUTTON14; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13892
    (  pguid: nil;
13893
       dwOfs: DIJOFS_BUTTON15; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13894
    (  pguid: nil;
13895
       dwOfs: DIJOFS_BUTTON16; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13896
    (  pguid: nil;
13897
       dwOfs: DIJOFS_BUTTON17; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13898
    (  pguid: nil;
13899
       dwOfs: DIJOFS_BUTTON18; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13900
    (  pguid: nil;
13901
       dwOfs: DIJOFS_BUTTON19; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13902
    (  pguid: nil;
13903
       dwOfs: DIJOFS_BUTTON20; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13904
    (  pguid: nil;
13905
       dwOfs: DIJOFS_BUTTON21; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13906
    (  pguid: nil;
13907
       dwOfs: DIJOFS_BUTTON22; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13908
    (  pguid: nil;
13909
       dwOfs: DIJOFS_BUTTON23; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13910
    (  pguid: nil;
13911
       dwOfs: DIJOFS_BUTTON24; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13912
    (  pguid: nil;
13913
       dwOfs: DIJOFS_BUTTON25; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13914
    (  pguid: nil;
13915
       dwOfs: DIJOFS_BUTTON26; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13916
    (  pguid: nil;
13917
       dwOfs: DIJOFS_BUTTON27; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13918
    (  pguid: nil;
13919
       dwOfs: DIJOFS_BUTTON28; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13920
    (  pguid: nil;
13921
       dwOfs: DIJOFS_BUTTON29; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13922
    (  pguid: nil;
13923
       dwOfs: DIJOFS_BUTTON30; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13924
    (  pguid: nil;
13925
       dwOfs: DIJOFS_BUTTON31; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0)
1 daniel-mar 13926
  );
13927
 
13928
  c_dfDIJoystick: TDIDataFormat = (
4 daniel-mar 13929
    dwSize: Sizeof(c_dfDIJoystick);
13930
    dwObjSize: Sizeof(TDIObjectDataFormat);  // $10
13931
    dwFlags: DIDF_ABSAXIS;
13932
    dwDataSize: SizeOf(TDIJoyState);         // $10
13933
    dwNumObjs: High(_c_dfDIJoystick_Objects)+1;  // $2C
13934
    rgodf: @_c_dfDIJoystick_Objects[Low(_c_dfDIJoystick_Objects)]
13935
  );
13936
 
13937
var  // Set by initialization part -- didn't want to type in another 656 consts...
13938
  _c_dfDIJoystick2_Objects: array[0..$A3] of TDIObjectDataFormat;
13939
  { Elements $00..$2B: exact copy of _c_dfDIJoystick
13940
    Elements $2C..$8B: more "buttons" with nil GUIDs
13941
    remaining elements ($8B..$A2):
13942
     $8C,$8D,$8E: X axis, Y axis, Z axis with dwFlags = $0200
13943
     $8F,$90,$91: rX axis, rY axis, rZ axis with dwFlags = $0200
13944
     $92, $93: Slider with dwFlags = $0200
13945
     --------
13946
     $94,$95,$96: X axis, Y axis, Z axis with dwFlags = $0300
13947
     $97,$98,$99: rX axis, rY axis, rZ axis with dwFlags = $0300
13948
     $9A,$9B: Slider with dwFlags = $0300
13949
     --------
13950
     $9C,$9D,$9E: X axis, Y axis, Z axis with dwFlags = $0400
13951
     $9F, $A0, $A1: rX axis, rY axis, rZ axis with dwFlags = $0400
13952
     $A2, $A3: Slider with dwFlags = $0400
13953
  }
1 daniel-mar 13954
const
4 daniel-mar 13955
  c_dfDIJoystick2: TDIDataFormat = (
13956
    dwSize: Sizeof(c_dfDIJoystick2);
13957
    dwObjSize: Sizeof(TDIObjectDataFormat);
13958
    dwFlags: DIDF_ABSAXIS;
13959
    dwDataSize: SizeOf(TDIJoyState2);  // $110
13960
    dwNumObjs: High(_c_dfDIJoystick2_Objects)+1;
13961
    rgodf: @_c_dfDIJoystick2_Objects[Low(_c_dfDIJoystick2_Objects)]
13962
  );
1 daniel-mar 13963
 
4 daniel-mar 13964
(****************************************************************************
13965
 *
13966
 *  IDirectInput
13967
 *
13968
 ****************************************************************************)
1 daniel-mar 13969
 
4 daniel-mar 13970
 
13971
  DIENUM_STOP = 0;
1 daniel-mar 13972
  DIENUM_CONTINUE = 1;
13973
 
13974
type
4 daniel-mar 13975
  // as with the other enum functions: must rtn DIENUM_STOP or DIENUM_CONTINUE
13976
  TDIEnumDevicesCallbackA = function (var lpddi: TDIDeviceInstanceA;
13977
      pvRef: Pointer): Integer; stdcall;  // BOOL; stdcall;
13978
  TDIEnumDevicesCallbackW = function (var lpddi: TDIDeviceInstanceW;
13979
      pvRef: Pointer): Integer; stdcall;  // BOOL; stdcall;
13980
  TDIEnumDevicesCallback = function (var lpddi: TDIDeviceInstance;
13981
      pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
13982
  TDIEnumDevicesProc = TDIEnumDevicesCallback;
1 daniel-mar 13983
 
13984
const
4 daniel-mar 13985
  DIEDFL_ALLDEVICES       = $00000000;
13986
  DIEDFL_ATTACHEDONLY     = $00000001;
13987
  DIEDFL_FORCEFEEDBACK    = $00000100;
1 daniel-mar 13988
 
13989
type
4 daniel-mar 13990
 
13991
  IDirectInputW = interface (IUnknown)
1 daniel-mar 13992
    ['{89521361-AA8A-11CF-BFC7-444553540000}']
4 daniel-mar 13993
    (*** IDirectInputW methods ***)
13994
    function CreateDevice(const rguid: TGUID; var lplpDirectInputDevice:
13995
        IDirectInputDeviceW; pUnkOuter: IUnknown) : HResult;  stdcall;
1 daniel-mar 13996
    function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackW;
4 daniel-mar 13997
        pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
13998
    function GetDeviceStatus(const rguidInstance: TGUID) : HResult;  stdcall;
13999
    function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
14000
    function Initialize(hinst: THandle; dwVersion: DWORD) : HResult;  stdcall;
1 daniel-mar 14001
  end;
14002
 
4 daniel-mar 14003
  IDirectInputA = interface (IUnknown)
1 daniel-mar 14004
    ['{89521360-AA8A-11CF-BFC7-444553540000}']
4 daniel-mar 14005
    (*** IDirectInputA methods ***)
14006
    function CreateDevice(const rguid: TGUID; var lplpDirectInputDevice:
14007
        IDirectInputDeviceA; pUnkOuter: IUnknown) : HResult;  stdcall;
1 daniel-mar 14008
    function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackA;
4 daniel-mar 14009
        pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
14010
    function GetDeviceStatus(const rguidInstance: TGUID) : HResult;  stdcall;
14011
    function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
14012
    function Initialize(hinst: THandle; dwVersion: DWORD) : HResult;  stdcall;
1 daniel-mar 14013
  end;
14014
 
4 daniel-mar 14015
{$IFDEF UNICODE}
14016
  IDirectInput = IDirectInputW;
14017
{$ELSE}
1 daniel-mar 14018
  IDirectInput = IDirectInputA;
4 daniel-mar 14019
{$ENDIF}
1 daniel-mar 14020
 
4 daniel-mar 14021
 
14022
  IDirectInput2W = interface (IDirectInputW)
1 daniel-mar 14023
    ['{5944E663-AA8A-11CF-BFC7-444553540000}']
4 daniel-mar 14024
    (*** IDirectInput2W methods ***)
14025
    function FindDevice(const rguidClass: TGUID; ptszName: PWideChar; out pguidInstance: TGUID): HResult;  stdcall;
1 daniel-mar 14026
  end;
14027
 
4 daniel-mar 14028
  IDirectInput2A = interface (IDirectInputA)
1 daniel-mar 14029
    ['{5944E662-AA8A-11CF-BFC7-444553540000}']
4 daniel-mar 14030
    (*** IDirectInput2A methods ***)
14031
    function FindDevice(const rguidClass: TGUID; ptszName: PAnsiChar; out pguidInstance: TGUID): HResult;  stdcall;
1 daniel-mar 14032
  end;
14033
 
4 daniel-mar 14034
{$IFDEF UNICODE}
14035
  IDirectInput2 = IDirectInput2W;
14036
{$ELSE}
1 daniel-mar 14037
  IDirectInput2 = IDirectInput2A;
4 daniel-mar 14038
{$ENDIF}
1 daniel-mar 14039
 
4 daniel-mar 14040
 
14041
type
14042
  IDirectInput7W = interface (IDirectInput2W)
1 daniel-mar 14043
    ['{9A4CB685-236D-11D3-8E9D-00C04F6844AE}']
4 daniel-mar 14044
    {*** IDirectInput7W methods ***}
14045
    function CreateDeviceEx(const rguid, riid: TGUID; out lplpDirectInputDevice;
14046
        pUnkOuter: IUnknown) : HResult; stdcall;
1 daniel-mar 14047
  end;
14048
 
4 daniel-mar 14049
  IDirectInput7A = interface (IDirectInput2A)
1 daniel-mar 14050
    ['{9A4CB684-236D-11D3-8E9D-00C04F6844AE}']
4 daniel-mar 14051
    {*** IDirectInput7A methods ***}
14052
    function CreateDeviceEx(const rguid, riid: TGUID; out lplpDirectInputDevice;
14053
        pUnkOuter: IUnknown) : HResult; stdcall;
1 daniel-mar 14054
  end;
14055
 
4 daniel-mar 14056
{$IFDEF UNICODE}
14057
  IDirectInput7 = IDirectInput7W;
14058
{$ELSE}
1 daniel-mar 14059
  IDirectInput7 = IDirectInput7A;
4 daniel-mar 14060
{$ENDIF}
1 daniel-mar 14061
 
14062
 
4 daniel-mar 14063
var
14064
  DirectInputCreateA : function (hinst: THandle; dwVersion: DWORD;
14065
      out ppDI: IDirectInputA;
14066
      punkOuter: IUnknown) : HResult; stdcall;
14067
  DirectInputCreateW : function (hinst: THandle; dwVersion: DWORD;
14068
      out ppDI: IDirectInputW;
14069
      punkOuter: IUnknown) : HResult; stdcall;
14070
  DirectInputCreate : function (hinst: THandle; dwVersion: DWORD;
14071
      out ppDI: IDirectInput;
14072
      punkOuter: IUnknown) : HResult; stdcall;
14073
 
14074
  DirectInputCreateEx : function (
14075
      hinst: THandle;
14076
      dwVersion: DWORD;
14077
      const riidltf: TGUID;
14078
      out ppvOut;
14079
      punkOuter: IUnknown) : HResult; stdcall;
14080
 
14081
(****************************************************************************
14082
 *
14083
 *      Interfaces
14084
 *
14085
 ****************************************************************************)
14086
type
14087
  IID_IDirectInputW = IDirectInputW;
14088
  IID_IDirectInputA = IDirectInputA;
14089
  IID_IDirectInput = IDirectInput;
14090
 
14091
  IID_IDirectInput2W = IDirectInput2W;
14092
  IID_IDirectInput2A = IDirectInput2A;
14093
  IID_IDirectInput2 = IDirectInput2;
14094
 
14095
  IID_IDirectInput7W = IDirectInput7W;
14096
  IID_IDirectInput7A = IDirectInput7A;
14097
  IID_IDirectInput7 = IDirectInput7;
14098
 
14099
  IID_IDirectInputDeviceW = IDirectInputDeviceW;
14100
  IID_IDirectInputDeviceA = IDirectInputDeviceA;
14101
  IID_IDirectInputDevice = IDirectInputDevice;
14102
 
14103
  IID_IDirectInputDevice2W = IDirectInputDevice2W;
14104
  IID_IDirectInputDevice2A = IDirectInputDevice2A;
14105
  IID_IDirectInputDevice2 = IDirectInputDevice2;
14106
 
14107
  IID_IDirectInputEffect = IDirectInputEffect;
14108
 
14109
  IID_IDirectInputDevice7W = IDirectInputDevice7W;
14110
  IID_IDirectInputDevice7A = IDirectInputDevice7A;
14111
  IID_IDirectInputDevice7 = IDirectInputDevice7;
14112
 
14113
(****************************************************************************
14114
 *
14115
 *  Return Codes
14116
 *
14117
 ****************************************************************************)
14118
 
14119
(*
14120
 *  The operation completed successfully.
14121
 *)
1 daniel-mar 14122
const
4 daniel-mar 14123
  DI_OK = S_OK;
1 daniel-mar 14124
 
4 daniel-mar 14125
(*
14126
 *  The device exists but is not currently attached.
14127
 *)
14128
  DI_NOTATTACHED = S_FALSE;
1 daniel-mar 14129
 
4 daniel-mar 14130
(*
14131
 *  The device buffer overflowed.  Some input was lost.
14132
 *)
14133
  DI_BUFFEROVERFLOW = S_FALSE;
1 daniel-mar 14134
 
4 daniel-mar 14135
(*
14136
 *  The change in device properties had no effect.
14137
 *)
14138
  DI_PROPNOEFFECT = S_FALSE;
1 daniel-mar 14139
 
4 daniel-mar 14140
(*
14141
 *  The operation had no effect.
14142
 *)
14143
  DI_NOEFFECT = S_FALSE;
1 daniel-mar 14144
 
4 daniel-mar 14145
(*
14146
 *  The device is a polled device.  As a result, device buffering
14147
 *  will not collect any data and event notifications will not be
14148
 *  signalled until GetDeviceState is called.
14149
 *)
14150
  DI_POLLEDDEVICE = $00000002;
1 daniel-mar 14151
 
4 daniel-mar 14152
(*
14153
 *  The parameters of the effect were successfully updated by
14154
 *  IDirectInputEffect::SetParameters, but the effect was not
14155
 *  downloaded because the device is not exclusively acquired
14156
 *  or because the DIEP_NODOWNLOAD flag was passed.
14157
 *)
14158
  DI_DOWNLOADSKIPPED = $00000003;
1 daniel-mar 14159
 
4 daniel-mar 14160
(*
14161
 *  The parameters of the effect were successfully updated by
14162
 *  IDirectInputEffect::SetParameters, but in order to change
14163
 *  the parameters, the effect needed to be restarted.
14164
 *)
14165
  DI_EFFECTRESTARTED = $00000004;
1 daniel-mar 14166
 
4 daniel-mar 14167
(*
14168
 *  The parameters of the effect were successfully updated by
14169
 *  IDirectInputEffect::SetParameters, but some of them were
14170
 *  beyond the capabilities of the device and were truncated.
14171
 *)
14172
  DI_TRUNCATED = $00000008;
14173
 
14174
(*
14175
 *  Equal to DI_EFFECTRESTARTED | DI_TRUNCATED.
14176
 *)
14177
  DI_TRUNCATEDANDRESTARTED = $0000000C;
14178
 
14179
  SEVERITY_ERROR_FACILITY_WIN32 =
14180
      HResult(SEVERITY_ERROR shl 31) or HResult(FACILITY_WIN32 shl 16);
14181
 
14182
(*
14183
 *  The application requires a newer version of DirectInput.
14184
 *)
14185
 
14186
  DIERR_OLDDIRECTINPUTVERSION = SEVERITY_ERROR_FACILITY_WIN32
14187
      or ERROR_OLD_WIN_VERSION;
14188
 
14189
(*
14190
 *  The application was written for an unsupported prerelease version
14191
 *  of DirectInput.
14192
 *)
14193
  DIERR_BETADIRECTINPUTVERSION = SEVERITY_ERROR_FACILITY_WIN32
14194
      or ERROR_RMODE_APP;
14195
 
14196
(*
14197
 *  The object could not be created due to an incompatible driver version
14198
 *  or mismatched or incomplete driver components.
14199
 *)
14200
  DIERR_BADDRIVERVER = SEVERITY_ERROR_FACILITY_WIN32
14201
      or ERROR_BAD_DRIVER_LEVEL;
14202
 
14203
(*
14204
 * The device or device instance or effect is not registered with DirectInput.
14205
 *)
14206
  DIERR_DEVICENOTREG = REGDB_E_CLASSNOTREG;
14207
 
14208
(*
14209
 * The requested object does not exist.
14210
 *)
14211
  DIERR_NOTFOUND = SEVERITY_ERROR_FACILITY_WIN32
14212
      or ERROR_FILE_NOT_FOUND;
14213
 
14214
(*
14215
 * The requested object does not exist.
14216
 *)
14217
  DIERR_OBJECTNOTFOUND = SEVERITY_ERROR_FACILITY_WIN32
14218
      or ERROR_FILE_NOT_FOUND;
14219
 
14220
(*
14221
 * An invalid parameter was passed to the returning function,
14222
 * or the object was not in a state that admitted the function
14223
 * to be called.
14224
 *)
14225
  DIERR_INVALIDPARAM = E_INVALIDARG;
14226
 
14227
(*
14228
 * The specified interface is not supported by the object
14229
 *)
14230
  DIERR_NOINTERFACE = E_NOINTERFACE;
14231
 
14232
(*
14233
 * An undetermined error occured inside the DInput subsystem
14234
 *)
14235
  DIERR_GENERIC = E_FAIL;
14236
 
14237
(*
14238
 * The DInput subsystem couldn't allocate sufficient memory to complete the
14239
 * caller's request.
14240
 *)
14241
  DIERR_OUTOFMEMORY = E_OUTOFMEMORY;
14242
 
14243
(*
14244
 * The function called is not supported at this time
14245
 *)
14246
  DIERR_UNSUPPORTED = E_NOTIMPL;
14247
 
14248
(*
14249
 * This object has not been initialized
14250
 *)
14251
  DIERR_NOTINITIALIZED = SEVERITY_ERROR_FACILITY_WIN32
14252
      or ERROR_NOT_READY;
14253
 
14254
(*
14255
 * This object is already initialized
14256
 *)
14257
  DIERR_ALREADYINITIALIZED = SEVERITY_ERROR_FACILITY_WIN32
14258
      or ERROR_ALREADY_INITIALIZED;
14259
 
14260
(*
14261
 * This object does not support aggregation
14262
 *)
14263
  DIERR_NOAGGREGATION = CLASS_E_NOAGGREGATION;
14264
 
14265
(*
14266
 * Another app has a higher priority level, preventing this call from
14267
 * succeeding.
14268
 *)
14269
  DIERR_OTHERAPPHASPRIO = E_ACCESSDENIED;
14270
 
14271
(*
14272
 * Access to the device has been lost.  It must be re-acquired.
14273
 *)
14274
  DIERR_INPUTLOST = SEVERITY_ERROR_FACILITY_WIN32
14275
      or ERROR_READ_FAULT;
14276
 
14277
(*
14278
 * The operation cannot be performed while the device is acquired.
14279
 *)
14280
  DIERR_ACQUIRED = SEVERITY_ERROR_FACILITY_WIN32
14281
      or ERROR_BUSY;
14282
 
14283
(*
14284
 * The operation cannot be performed unless the device is acquired.
14285
 *)
14286
  DIERR_NOTACQUIRED = SEVERITY_ERROR_FACILITY_WIN32
14287
      or ERROR_INVALID_ACCESS;
14288
 
14289
(*
14290
 * The specified property cannot be changed.
14291
 *)
14292
  DIERR_READONLY = E_ACCESSDENIED;
14293
 
14294
(*
14295
 * The device already has an event notification associated with it.
14296
 *)
14297
  DIERR_HANDLEEXISTS = E_ACCESSDENIED;
14298
 
14299
(*
14300
 * Data is not yet available.
14301
 *)
14302
  E_PENDING = HResult($80070007);
14303
 
14304
(*
14305
 * Unable to IDirectInputJoyConfig_Acquire because the user
14306
 * does not have sufficient privileges to change the joystick
14307
 * configuration.
14308
 *)
14309
  DIERR_INSUFFICIENTPRIVS = HResult($80040200);
14310
 
14311
(*
14312
 * The device is full.
14313
 *)
14314
  DIERR_DEVICEFULL = DIERR_INSUFFICIENTPRIVS + 1;
14315
 
14316
(*
14317
 * Not all the requested information fit into the buffer.
14318
 *)
14319
  DIERR_MOREDATA = DIERR_INSUFFICIENTPRIVS + 2;
14320
 
14321
(*
14322
 * The effect is not downloaded.
14323
 *)
14324
  DIERR_NOTDOWNLOADED = DIERR_INSUFFICIENTPRIVS + 3;
14325
 
14326
(*
14327
 *  The device cannot be reinitialized because there are still effects
14328
 *  attached to it.
14329
 *)
14330
  DIERR_HASEFFECTS = DIERR_INSUFFICIENTPRIVS + 4;
14331
 
14332
(*
14333
 *  The operation cannot be performed unless the device is acquired
14334
 *  in DISCL_EXCLUSIVE mode.
14335
 *)
14336
  DIERR_NOTEXCLUSIVEACQUIRED = DIERR_INSUFFICIENTPRIVS + 5;
14337
 
14338
(*
14339
 *  The effect could not be downloaded because essential information
14340
 *  is missing.  For example, no axes have been associated with the
14341
 *  effect, or no type-specific information has been created.
14342
 *)
14343
  DIERR_INCOMPLETEEFFECT = DIERR_INSUFFICIENTPRIVS + 6;
14344
 
14345
(*
14346
 *  Attempted to read buffered device data from a device that is
14347
 *  not buffered.
14348
 *)
14349
  DIERR_NOTBUFFERED = DIERR_INSUFFICIENTPRIVS + 7;
14350
 
14351
(*
14352
 *  An attempt was made to modify parameters of an effect while it is
14353
 *  playing.  Not all hardware devices support altering the parameters
14354
 *  of an effect while it is playing.
14355
 *)
14356
  DIERR_EFFECTPLAYING = DIERR_INSUFFICIENTPRIVS + 8;
14357
 
14358
(*
14359
 *  The operation could not be completed because the device is not
14360
 *  plugged in.
14361
 *)
14362
  DIERR_UNPLUGGED                = $80040209;
14363
 
14364
(*
14365
 *  SendDeviceData failed because more information was requested
14366
 *  to be sent than can be sent to the device.  Some devices have
14367
 *  restrictions on how much data can be sent to them.  (For example,
14368
 *  there might be a limit on the number of buttons that can be
14369
 *  pressed at once.)
14370
 *)
14371
 DIERR_REPORTFULL                = $8004020A;
14372
 
14373
 
14374
(****************************************************************************
14375
 *
14376
 *  Definitions for non-IDirectInput (VJoyD) features defined more recently
14377
 *  than the current sdk files
14378
 *
14379
 ****************************************************************************)
14380
 
14381
(*
14382
 * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure
14383
 * contains mini-driver specific data to be passed by VJoyD to the mini-
14384
 * driver instead of doing a poll.
14385
 *)
14386
  JOY_PASSDRIVERDATA          = $10000000;
14387
 
14388
(*
14389
 * Informs the joystick driver that the configuration has been changed
14390
 * and should be reloaded from the registery.
14391
 * dwFlags is reserved and should be set to zero
14392
 *)
14393
 
14394
function joyConfigChanged(dwFlags: DWORD) : MMRESULT; stdcall;
14395
 
14396
const
14397
(*
14398
 * Hardware Setting indicating that the device is a headtracker
14399
 *)
14400
  JOY_HWS_ISHEADTRACKER       = $02000000;
14401
 
14402
(*
14403
 * Hardware Setting indicating that the VxD is used to replace
14404
 * the standard analog polling
14405
 *)
14406
  JOY_HWS_ISGAMEPORTDRIVER    = $04000000;
14407
 
14408
(*
14409
 * Hardware Setting indicating that the driver needs a standard
14410
 * gameport in order to communicate with the device.
14411
 *)
14412
  JOY_HWS_ISANALOGPORTDRIVER  = $08000000;
14413
 
14414
(*
14415
 * Hardware Setting indicating that VJoyD should not load this
14416
 * driver, it will be loaded externally and will register with
14417
 * VJoyD of it's own accord.
14418
 *)
14419
  JOY_HWS_AUTOLOAD            = $10000000;
14420
 
14421
(*
14422
 * Hardware Setting indicating that the driver acquires any
14423
 * resources needed without needing a devnode through VJoyD.
14424
 *)
14425
  JOY_HWS_NODEVNODE           = $20000000;
14426
 
14427
(*
14428
 * Hardware Setting indicating that the device is a gameport bus
14429
 *)
14430
  JOY_HWS_ISGAMEPORTBUS       = $80000000;
14431
  JOY_HWS_GAMEPORTBUSBUSY     = $00000001;
14432
 
14433
//from older Verion:
14434
(*
14435
 * Hardware Setting indicating that the VxD can be used as
14436
 * a port 201h emulator.
14437
 *)
14438
  JOY_HWS_ISGAMEPORTEMULATOR  = $40000000;
14439
 
14440
 
14441
(*
14442
 * Usage Setting indicating that the settings are volatile and
14443
 * should be removed if still present on a reboot.
14444
 *)
14445
  JOY_US_VOLATILE             = $00000008;
14446
 
14447
(****************************************************************************
14448
 *
14449
 *  Definitions for non-IDirectInput (VJoyD) features defined more recently
14450
 *  than the current ddk files
14451
 *
14452
 ****************************************************************************)
14453
 
14454
(*
14455
 * Poll type in which the do_other field of the JOYOEMPOLLDATA
14456
 * structure contains mini-driver specific data passed from an app.
14457
 *)
14458
  JOY_OEMPOLL_PASSDRIVERDATA  = 7;
14459
 
14460
//DirectPlay file
14461
 
10 daniel-mar 14462
{$IFDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
14463
 
1 daniel-mar 14464
(*==========================================================================;
14465
 *
14466
 *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
14467
 *
4 daniel-mar 14468
 *  File:       dplay.h dplobby.h
14469
 *  Content:    DirectPlay include files
14470
 *
14471
 *  DirectX 7 Delphi adaptation by Erik Unger
14472
 *
14473
 *  Modified: 4-Jun-2000
14474
 *
14475
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
14476
 *  E-Mail: DelphiDirectX@next-reality.com
14477
 *
14478
 ***************************************************************************)
14479
 
14480
var
14481
  DPlayDLL : HMODULE = 0;
14482
 
14483
(*==========================================================================;
14484
 *
14485
 *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
14486
 *
1 daniel-mar 14487
 *  File:       dplay.h
14488
 *  Content:    DirectPlay include file
14489
 *
14490
 ***************************************************************************)
14491
 
4 daniel-mar 14492
function DPErrorString(Value: HResult) : string;
14493
 
1 daniel-mar 14494
const
4 daniel-mar 14495
// {D1EB6D20-8923-11d0-9D97-00A0C90A43CB}
14496
  CLSID_DirectPlay: TGUID =
14497
      (D1:$d1eb6d20;D2:$8923;D3:$11d0;D4:($9d,$97,$00,$a0,$c9,$a,$43,$cb));
1 daniel-mar 14498
 
4 daniel-mar 14499
(*
14500
 * GUIDS used by Service Providers shipped with DirectPlay
14501
 * Use these to identify Service Provider returned by EnumConnections
14502
 *)
1 daniel-mar 14503
 
4 daniel-mar 14504
// GUID for IPX service provider
14505
// {685BC400-9D2C-11cf-A9CD-00AA006886E3}
14506
  DPSPGUID_IPX: TGUID =
14507
      (D1:$685bc400;D2:$9d2c;D3:$11cf;D4:($a9,$cd,$00,$aa,$00,$68,$86,$e3));
1 daniel-mar 14508
 
4 daniel-mar 14509
// GUID for TCP/IP service provider
14510
// 36E95EE0-8577-11cf-960C-0080C7534E82
14511
  DPSPGUID_TCPIP: TGUID =
14512
      (D1:$36E95EE0;D2:$8577;D3:$11cf;D4:($96,$0c,$00,$80,$c7,$53,$4e,$82));
1 daniel-mar 14513
 
4 daniel-mar 14514
// GUID for Serial service provider
14515
// {0F1D6860-88D9-11cf-9C4E-00A0C905425E}
14516
  DPSPGUID_SERIAL: TGUID =
14517
      (D1:$f1d6860;D2:$88d9;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$05,$42,$5e));
1 daniel-mar 14518
 
4 daniel-mar 14519
// GUID for Modem service provider
14520
// {44EAA760-CB68-11cf-9C4E-00A0C905425E}
14521
  DPSPGUID_MODEM: TGUID =
14522
      (D1:$44eaa760;D2:$cb68;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$05,$42,$5e));
1 daniel-mar 14523
 
4 daniel-mar 14524
 
14525
(****************************************************************************
14526
 *
14527
 * DirectPlay Structures
14528
 *
14529
 * Various structures used to invoke DirectPlay.
14530
 *
14531
 ****************************************************************************)
14532
 
1 daniel-mar 14533
type
4 daniel-mar 14534
(*
14535
 * TDPID
14536
 * DirectPlay player and group ID
14537
 *)
14538
  TDPID = DWORD;
1 daniel-mar 14539
  PDPID = ^TDPID;
14540
 
14541
 
14542
const
4 daniel-mar 14543
(*
14544
 * DPID that system messages come from
14545
 *)
14546
  DPID_SYSMSG = 0;
1 daniel-mar 14547
 
4 daniel-mar 14548
(*
14549
 * DPID representing all players in the session
14550
 *)
14551
  DPID_ALLPLAYERS = 0;
14552
 
14553
(*
14554
 * DPID representing the server player
14555
 *)
14556
  DPID_SERVERPLAYER = 1;
14557
 
14558
(*
14559
 * DPID representing the maximum ID in the range of DPID's reserved for
14560
 * use by DirectPlay.
14561
 *)
14562
  DPID_RESERVEDRANGE = 100;
14563
 
14564
(*
14565
 * The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID)
14566
 *)
14567
  DPID_UNKNOWN = $FFFFFFFF;
14568
 
1 daniel-mar 14569
type
4 daniel-mar 14570
(*
14571
 * DPCAPS
14572
 * Used to obtain the capabilities of a DirectPlay object
14573
 *)
1 daniel-mar 14574
  PDPCaps = ^TDPCaps;
4 daniel-mar 14575
  TDPCaps = packed record
1 daniel-mar 14576
    dwSize: DWORD;              // Size of structure, in bytes
14577
    dwFlags: DWORD;             // DPCAPS_xxx flags
14578
    dwMaxBufferSize: DWORD;     // Maximum message size, in bytes,  for this service provider
14579
    dwMaxQueueSize: DWORD;      // Obsolete.
14580
    dwMaxPlayers: DWORD;        // Maximum players/groups (local + remote)
14581
    dwHundredBaud: DWORD;       // Bandwidth in 100 bits per second units;
14582
                                // i.e. 24 is 2400, 96 is 9600, etc.
14583
    dwLatency: DWORD;           // Estimated latency; 0 = unknown
14584
    dwMaxLocalPlayers: DWORD;   // Maximum # of locally created players allowed
14585
    dwHeaderLength: DWORD;      // Maximum header length, in bytes, on messages
14586
                                // added by the service provider
14587
    dwTimeout: DWORD;           // Service provider's suggested timeout value
14588
                                // This is how long DirectPlay will wait for
14589
                                // responses to system messages
14590
  end;
14591
 
4 daniel-mar 14592
const
14593
(*
14594
 * This DirectPlay object is the session host.  If the host exits the
14595
 * session, another application will become the host and receive a
14596
 * DPSYS_HOST system message.
14597
 *)
14598
  DPCAPS_ISHOST = $00000002;
1 daniel-mar 14599
 
4 daniel-mar 14600
(*
14601
 * The service provider bound to this DirectPlay object can optimize
14602
 * group messaging.
14603
 *)
14604
  DPCAPS_GROUPOPTIMIZED = $00000008;
14605
 
14606
(*
14607
 * The service provider bound to this DirectPlay object can optimize
14608
 * keep alives (see DPSESSION_KEEPALIVE)
14609
 *)
14610
  DPCAPS_KEEPALIVEOPTIMIZED = $00000010;
14611
 
14612
(*
14613
 * The service provider bound to this DirectPlay object can optimize
14614
 * guaranteed message delivery.
14615
 *)
14616
  DPCAPS_GUARANTEEDOPTIMIZED = $00000020;
14617
 
14618
(*
14619
 * This DirectPlay object supports guaranteed message delivery.
14620
 *)
14621
  DPCAPS_GUARANTEEDSUPPORTED = $00000040;
14622
 
14623
(*
14624
 * This DirectPlay object supports digital signing of messages.
14625
 *)
14626
  DPCAPS_SIGNINGSUPPORTED = $00000080;
14627
 
14628
(*
14629
 * This DirectPlay object supports encryption of messages.
14630
 *)
14631
  DPCAPS_ENCRYPTIONSUPPORTED = $00000100;
14632
 
14633
(*
14634
 * This DirectPlay player was created on this machine
14635
 *)
14636
  DPPLAYERCAPS_LOCAL = $00000800;
14637
 
14638
(*
14639
 * Current Open settings supports all forms of Cancel
14640
 *)
14641
  DPCAPS_ASYNCCANCELSUPPORTED = $00001000;
14642
 
14643
(*
14644
 * Current Open settings supports CancelAll, but not Cancel
14645
 *)
1 daniel-mar 14646
  DPCAPS_ASYNCCANCELALLSUPPORTED = $00002000;
14647
 
4 daniel-mar 14648
(*
14649
 * Current Open settings supports Send Timeouts for sends
14650
 *)
14651
  DPCAPS_SENDTIMEOUTSUPPORTED = $00004000;
14652
 
14653
(*
14654
 * Current Open settings supports send priority
14655
 *)
14656
  DPCAPS_SENDPRIORITYSUPPORTED = $00008000;
14657
 
14658
(*
14659
 * Current Open settings supports DPSEND_ASYNC flag
14660
 *)
14661
  DPCAPS_ASYNCSUPPORTED = $00010000;
14662
 
1 daniel-mar 14663
type
4 daniel-mar 14664
(*
14665
 * TDPSessionDesc2
14666
 * Used to describe the properties of a DirectPlay
14667
 * session instance
14668
 *)
1 daniel-mar 14669
  PDPSessionDesc2 = ^TDPSessionDesc2;
4 daniel-mar 14670
  TDPSessionDesc2 = packed record
14671
    dwSize: DWORD;             // Size of structure
14672
    dwFlags: DWORD;            // DPSESSION_xxx flags
14673
    guidInstance: TGUID;       // ID for the session instance
14674
    guidApplication: TGUID;    // GUID of the DirectPlay application.
14675
                               // GUID_NULL for all applications.
14676
    dwMaxPlayers: DWORD;       // Maximum # players allowed in session
14677
    dwCurrentPlayers: DWORD;   // Current # players in session (read only)
14678
    case integer of
14679
 
10 daniel-mar 14680
    lpszSessionName: PChar;  // Name of the session
14681
    lpszPassword: PChar;     // Password of the session (optional)
4 daniel-mar 14682
    dwReserved1: DWORD;        // Reserved for future MS use.
14683
    dwReserved2: DWORD;
14684
    dwUser1: DWORD;            // For use by the application
14685
    dwUser2: DWORD;
14686
    dwUser3: DWORD;
14687
    dwUser4: DWORD;
14688
      );
14689
      1 : (
14690
    lpszSessionNameA: PAnsiChar;   // Name of the session
14691
    lpszPasswordA: PAnsiChar       // Password of the session (optional)
14692
      );
14693
      2 : (
14694
    lpszSessionNameW: PWideChar;
14695
    lpszPasswordW: PWideChar
14696
      );
1 daniel-mar 14697
  end;
14698
 
14699
const
4 daniel-mar 14700
(*
14701
 * Applications cannot create new players in this session.
14702
 *)
1 daniel-mar 14703
  DPSESSION_NEWPLAYERSDISABLED = $00000001;
4 daniel-mar 14704
 
14705
(*
14706
 * If the DirectPlay object that created the session, the host,
14707
 * quits, then the host will attempt to migrate to another
14708
 * DirectPlay object so that new players can continue to be created
14709
 * and new applications can join the session.
14710
 *)
14711
  DPSESSION_MIGRATEHOST = $00000004;
14712
 
14713
(*
14714
 * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom
14715
 * fields in player messages.  This cuts two DWORD's off the message
14716
 * overhead.
14717
 *)
14718
  DPSESSION_NOMESSAGEID = $00000008;
14719
 
14720
(*
14721
 * This flag tells DirectPlay to not allow any new applications to
14722
 * join the session.  Applications already in the session can still
14723
 * create new players.
14724
 *)
14725
  DPSESSION_JOINDISABLED = $00000020;
14726
 
14727
(*
14728
 * This flag tells DirectPlay to detect when remote players
14729
 * exit abnormally (e.g. their computer or modem gets unplugged)
14730
 *)
14731
  DPSESSION_KEEPALIVE = $00000040;
14732
 
14733
(*
14734
 * This flag tells DirectPlay not to send a message to all players
14735
 * when a players remote data changes
14736
 *)
14737
  DPSESSION_NODATAMESSAGES = $00000080;
14738
 
14739
(*
14740
 * This flag indicates that the session belongs to a secure server
14741
 * and needs user authentication
14742
 *)
14743
  DPSESSION_SECURESERVER = $00000100;
14744
 
14745
(*
14746
 * This flag indicates that the session is private and requirs a password
14747
 * for EnumSessions as well as Open.
14748
 *)
14749
  DPSESSION_PRIVATE = $00000200;
14750
 
14751
(*
14752
 * This flag indicates that the session requires a password for joining.
14753
 *)
14754
  DPSESSION_PASSWORDREQUIRED = $00000400;
14755
 
14756
(*
14757
 * This flag tells DirectPlay to route all messages through the server
14758
 *)
14759
  DPSESSION_MULTICASTSERVER = $00000800;
14760
 
14761
(*
14762
 * This flag tells DirectPlay to only download information about the
14763
 * DPPLAYER_SERVERPLAYER.
14764
 *)
14765
  DPSESSION_CLIENTSERVER = $00001000;
14766
 
14767
(*
14768
 * This flag tells DirectPlay to use the protocol built into dplay
14769
 * for reliability and statistics all the time.  When this bit is
14770
 * set, only other sessions with this bit set can join or be joined.
14771
 *)
1 daniel-mar 14772
  DPSESSION_DIRECTPLAYPROTOCOL = $00002000;
14773
 
4 daniel-mar 14774
(*
14775
 * This flag tells DirectPlay that preserving order of received
14776
 * packets is not important, when using reliable delivery.  This
14777
 * will allow messages to be indicated out of order if preceding
14778
 * messages have not yet arrived.  Otherwise DPLAY will wait for
14779
 * earlier messages before delivering later reliable messages.
14780
 *)
14781
  DPSESSION_NOPRESERVEORDER = $00004000;
14782
 
14783
 
14784
(*
14785
 * This flag tells DirectPlay to optimize communication for latency
14786
 *)
14787
  DPSESSION_OPTIMIZELATENCY = $00008000;
14788
 
1 daniel-mar 14789
type
4 daniel-mar 14790
(*
14791
 * TDPName
14792
 * Used to hold the name of a DirectPlay entity
14793
 * like a player or a group
14794
 *)
1 daniel-mar 14795
  PDPName = ^TDPName;
4 daniel-mar 14796
  TDPName = packed record
1 daniel-mar 14797
    dwSize: DWORD;    // Size of structure
14798
    dwFlags: DWORD;   // Not used. Must be zero.
14799
    case Integer of
4 daniel-mar 14800
 
10 daniel-mar 14801
    lpszShortName : PChar; // The short or friendly name
14802
    lpszLongName : PChar;  // The long or formal name
4 daniel-mar 14803
      );
14804
      1 : (
14805
    lpszShortNameA : PAnsiChar;
14806
    lpszLongNameA : PAnsiChar;
14807
      );
14808
      2 : (
14809
    lpszShortNameW : PWideChar;
14810
    lpszLongNameW : PWideChar;
14811
      );
1 daniel-mar 14812
  end;
14813
 
14814
(*
14815
 * TDPCredentials
14816
 * Used to hold the user name and password of a DirectPlay user
14817
 *)
14818
 
14819
  PDPCredentials = ^TDPCredentials;
4 daniel-mar 14820
  TDPCredentials = packed record
1 daniel-mar 14821
    dwSize: DWORD;    // Size of structure
14822
    dwFlags: DWORD;   // Not used. Must be zero.
14823
    case Integer of
4 daniel-mar 14824
 
10 daniel-mar 14825
    lpszUsername: PChar;   // User name of the account
14826
    lpszPassword: PChar;   // Password of the account
14827
    lpszDomain:   PChar;   // Domain name of the account
4 daniel-mar 14828
      );
14829
      1 : (
14830
    lpszUsernameA: PAnsiChar;   // User name of the account
14831
    lpszPasswordA: PAnsiChar;   // Password of the account
14832
    lpszDomainA:   PAnsiChar;   // Domain name of the account
14833
      );
14834
      2 : (
14835
    lpszUsernameW: PWideChar;   // User name of the account
14836
    lpszPasswordW: PWideChar;   // Password of the account
14837
    lpszDomainW:   PWideChar;   // Domain name of the account
14838
      );
1 daniel-mar 14839
  end;
14840
 
14841
(*
4 daniel-mar 14842
 * TDPSecurityDesc
1 daniel-mar 14843
 * Used to describe the security properties of a DirectPlay
14844
 * session instance
14845
 *)
14846
  PDPSecurityDesc = ^TDPSecurityDesc;
4 daniel-mar 14847
  TDPSecurityDesc = packed record
1 daniel-mar 14848
    dwSize: DWORD;                  // Size of structure
14849
    dwFlags: DWORD;                 // Not used. Must be zero.
14850
    case Integer of
4 daniel-mar 14851
 
10 daniel-mar 14852
    lpszSSPIProvider : PChar;  // SSPI provider name
14853
    lpszCAPIProvider : PChar;  // CAPI provider name
4 daniel-mar 14854
    dwCAPIProviderType: DWORD;      // Crypto Service Provider type
14855
    dwEncryptionAlgorithm: DWORD;   // Encryption Algorithm type
14856
      );
14857
      1 : (
14858
    lpszSSPIProviderA : PAnsiChar;  // SSPI provider name
14859
    lpszCAPIProviderA : PAnsiChar;  // CAPI provider name
14860
      );
14861
      2 : (
14862
    lpszSSPIProviderW : PWideChar;  // SSPI provider name
14863
    lpszCAPIProviderW : PWideChar;  // CAPI provider name
14864
      );
1 daniel-mar 14865
  end;
14866
 
14867
(*
4 daniel-mar 14868
 * DPACCOUNTDESC
1 daniel-mar 14869
 * Used to describe a user membership account
14870
 *)
4 daniel-mar 14871
 
1 daniel-mar 14872
  PDPAccountDesc = ^TDPAccountDesc;
4 daniel-mar 14873
  TDPAccountDesc = packed record
1 daniel-mar 14874
    dwSize: DWORD;    // Size of structure
14875
    dwFlags: DWORD;   // Not used. Must be zero.
14876
    case Integer of
10 daniel-mar 14877
 
4 daniel-mar 14878
      1 : (lpszAccountIDA : PAnsiChar);
14879
      2 : (lpszAccountIDW : PWideChar);
1 daniel-mar 14880
  end;
14881
 
14882
(*
14883
 * TDPLConnection
14884
 * Used to hold all in the informaion needed to connect
14885
 * an application to a session or create a session
14886
 *)
14887
  PDPLConnection = ^TDPLConnection;
4 daniel-mar 14888
  TDPLConnection = packed record
1 daniel-mar 14889
    dwSize: DWORD;                     // Size of this structure
14890
    dwFlags: DWORD;                    // Flags specific to this structure
14891
    lpSessionDesc: PDPSessionDesc2;    // Pointer to session desc to use on connect
14892
    lpPlayerName: PDPName;             // Pointer to Player name structure
14893
    guidSP: TGUID;                     // GUID of the DPlay SP to use
14894
    lpAddress: Pointer;                // Address for service provider
14895
    dwAddressSize: DWORD;              // Size of address data
14896
  end;
14897
 
14898
(*
14899
 * TDPChat
14900
 * Used to hold the a DirectPlay chat message
14901
 *)
14902
  PDPChat = ^TDPChat;
4 daniel-mar 14903
  TDPChat = packed record
1 daniel-mar 14904
    dwSize: DWORD;
14905
    dwFlags: DWORD;
14906
    case Integer of
10 daniel-mar 14907
 
4 daniel-mar 14908
      1 : (lpszMessageA : PAnsiChar);
14909
      2 : (lpszMessageW : PWideChar);
1 daniel-mar 14910
  end;
14911
 
14912
(*
4 daniel-mar 14913
 * TSGBuffer
1 daniel-mar 14914
 * Scatter Gather Buffer used for SendEx
14915
 *)
14916
  PSGBuffer = ^TSGBuffer;
4 daniel-mar 14917
  TSGBuffer = packed record
14918
    len: UINT;
14919
    pData: PUCHAR;
1 daniel-mar 14920
  end;
14921
 
4 daniel-mar 14922
(****************************************************************************
14923
 *
14924
 * Prototypes for DirectPlay callback functions
14925
 *
14926
 ****************************************************************************)
1 daniel-mar 14927
 
4 daniel-mar 14928
(*
14929
 * Callback for IDirectPlay2::EnumSessions
14930
 *)
14931
  TDPEnumSessionsCallback2 = function(lpThisSD: PDPSessionDesc2;
14932
      var lpdwTimeOut: DWORD; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 14933
 
14934
const
4 daniel-mar 14935
(*
14936
 * This flag is set on the EnumSessions callback dwFlags parameter when
14937
 * the time out has occurred. There will be no session data for this
14938
 * callback. If *lpdwTimeOut is set to a non-zero value and the
14939
 * EnumSessionsCallback function returns TRUE then EnumSessions will
14940
 * continue waiting until the next timeout occurs. Timeouts are in
14941
 * milliseconds.
14942
 *)
1 daniel-mar 14943
  DPESC_TIMEDOUT = $00000001;
14944
 
14945
type
4 daniel-mar 14946
(*
14947
 * Callback for IDirectPlay2.EnumPlayers
14948
 *              IDirectPlay2.EnumGroups
14949
 *              IDirectPlay2.EnumGroupPlayers
14950
 *)
14951
  TDPEnumPlayersCallback2 = function(DPID: TDPID; dwPlayerType: DWORD;
14952
      const lpName: TDPName; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 14953
 
14954
 
4 daniel-mar 14955
(*
14956
 * ANSI callback for DirectPlayEnumerate
14957
 * This callback prototype will be used if compiling
14958
 * for ANSI strings
14959
 *)
14960
  TDPEnumDPCallbackA = function(const lpguidSP: TGUID; lpSPName: PAnsiChar;
14961
      dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 14962
 
4 daniel-mar 14963
(*
14964
 * Unicode callback for DirectPlayEnumerate
14965
 * This callback prototype will be used if compiling
14966
 * for Unicode strings
14967
 *)
14968
  TDPEnumDPCallbackW = function(const lpguidSP: TGUID; lpSPName: PWideChar;
14969
      dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer) : BOOL; stdcall;
14970
 
14971
(*
14972
 * Callback for DirectPlayEnumerate
14973
 *)
14974
{$IFDEF UNICODE}
14975
  TDPEnumDPCallback = TDPEnumDPCallbackW;
14976
{$ELSE}
14977
  TDPEnumDPCallback = TDPEnumDPCallbackA;
14978
{$ENDIF}
14979
 
14980
(*
14981
 * Callback for IDirectPlay3(A/W).EnumConnections
14982
 *)
1 daniel-mar 14983
  TDPEnumConnectionsCallback = function(const lpguidSP: TGUID;
14984
      lpConnection: Pointer; dwConnectionSize: DWORD; const lpName: TDPName;
4 daniel-mar 14985
      dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 14986
 
4 daniel-mar 14987
(*
14988
 * API's
14989
 *)
1 daniel-mar 14990
 
4 daniel-mar 14991
var
14992
  DirectPlayEnumerate : function (lpEnumDPCallback: TDPEnumDPCallback;
14993
      lpContext: Pointer) : HResult; stdcall;
14994
  DirectPlayEnumerateA : function (lpEnumDPCallback: TDPEnumDPCallbackA;
14995
      lpContext: Pointer) : HResult; stdcall;
14996
  DirectPlayEnumerateW : function (lpEnumDPCallback: TDPEnumDPCallbackW;
14997
      lpContext: Pointer) : HResult; stdcall;
1 daniel-mar 14998
 
14999
 
4 daniel-mar 15000
(****************************************************************************
15001
 *
15002
 * IDirectPlay2 (and IDirectPlay2A) Interface
15003
 *
15004
 ****************************************************************************)
1 daniel-mar 15005
 
15006
type
4 daniel-mar 15007
  IDirectPlay2AW = interface (IUnknown)
15008
    (*** IDirectPlay2 methods ***)
15009
    function AddPlayerToGroup(idGroup: TDPID; idPlayer: TDPID) : HResult; stdcall;
1 daniel-mar 15010
    function Close: HResult; stdcall;
4 daniel-mar 15011
    function CreateGroup(out lpidGroup: TDPID; lpGroupName: PDPName;
15012
        lpData: Pointer; dwDataSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
15013
    function CreatePlayer(out lpidPlayer: TDPID; pPlayerName: PDPName;
15014
        hEvent: THandle; lpData: Pointer; dwDataSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
15015
    function DeletePlayerFromGroup(idGroup: TDPID; idPlayer: TDPID) : HResult; stdcall;
15016
    function DestroyGroup(idGroup: TDPID) : HResult; stdcall;
15017
    function DestroyPlayer(idPlayer: TDPID) : HResult; stdcall;
15018
    function EnumGroupPlayers(idGroup: TDPID; lpguidInstance: PGUID;
1 daniel-mar 15019
        lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
4 daniel-mar 15020
        dwFlags: DWORD) : HResult; stdcall;
15021
    function EnumGroups(lpguidInstance: PGUID; lpEnumPlayersCallback2:
15022
        TDPEnumPlayersCallback2; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
15023
    function EnumPlayers(lpguidInstance: PGUID; lpEnumPlayersCallback2:
15024
        TDPEnumPlayersCallback2; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 15025
    function EnumSessions(const lpsd: TDPSessionDesc2; dwTimeout: DWORD;
15026
        lpEnumSessionsCallback2: TDPEnumSessionsCallback2; lpContext: Pointer;
4 daniel-mar 15027
        dwFlags: DWORD) : HResult; stdcall;
15028
    function GetCaps(var lpDPCaps: TDPCaps; dwFlags: DWORD) : HResult; stdcall;
15029
    function GetGroupData(idGroup: TDPID; lpData: Pointer; var lpdwDataSize: DWORD;
15030
        dwFlags: DWORD) : HResult; stdcall;
15031
    function GetGroupName(idGroup: TDPID; lpData: Pointer; var lpdwDataSize: DWORD) :
15032
        HResult; stdcall;
15033
    function GetMessageCount(idPlayer: TDPID; var lpdwCount: DWORD) : HResult; stdcall;
15034
    function GetPlayerAddress(idPlayer: TDPID; lpAddress: Pointer;
15035
        var lpdwAddressSize: DWORD) : HResult; stdcall;
1 daniel-mar 15036
    function GetPlayerCaps(idPlayer: TDPID; var lpPlayerCaps: TDPCaps;
4 daniel-mar 15037
        dwFlags: DWORD) : HResult; stdcall;
15038
    function GetPlayerData(idPlayer: TDPID; lpData: Pointer; var lpdwDataSize: DWORD;
15039
        dwFlags: DWORD) : HResult; stdcall;
15040
    function GetPlayerName(idPlayer: TDPID; lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
15041
    function GetSessionDesc(lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
15042
    function Initialize(const lpGUID: TGUID) : HResult; stdcall;
15043
    function Open(var lpsd: TDPSessionDesc2; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 15044
    function Receive(var lpidFrom: TDPID; var lpidTo: TDPID; dwFlags: DWORD;
4 daniel-mar 15045
        lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
15046
    function Send(idFrom: TDPID; lpidTo: TDPID; dwFlags: DWORD; var lpData;
15047
        lpdwDataSize: DWORD) : HResult; stdcall;
15048
    function SetGroupData(idGroup: TDPID; lpData: Pointer; dwDataSize: DWORD;
15049
        dwFlags: DWORD) : HResult; stdcall;
15050
    function SetGroupName(idGroup: TDPID; lpGroupName: PDPName;
15051
        dwFlags: DWORD) : HResult; stdcall;
15052
    function SetPlayerData(idPlayer: TDPID; lpData: Pointer; dwDataSize: DWORD;
15053
        dwFlags: DWORD) : HResult; stdcall;
15054
    function SetPlayerName(idPlayer: TDPID; lpPlayerName: PDPName;
15055
        dwFlags: DWORD) : HResult; stdcall;
15056
    function SetSessionDesc(var lpSessDesc: TDPSessionDesc2; dwFlags: DWORD) :
15057
        HResult; stdcall;
1 daniel-mar 15058
  end;
15059
 
4 daniel-mar 15060
  IDirectPlay2W = interface (IDirectPlay2AW)
15061
    ['{2B74F7C0-9154-11CF-A9CD-00AA006886E3}']
1 daniel-mar 15062
  end;
4 daniel-mar 15063
  IDirectPlay2A = interface (IDirectPlay2AW)
15064
    ['{9d460580-a822-11cf-960c-0080c7534e82}']
15065
  end;
1 daniel-mar 15066
 
4 daniel-mar 15067
{$IFDEF UNICODE}
15068
  IDirectPlay2 = IDirectPlay2W;
15069
{$ELSE}
15070
  IDirectPlay2 = IDirectPlay2A;
15071
{$ENDIF}
1 daniel-mar 15072
 
4 daniel-mar 15073
(****************************************************************************
15074
 *
15075
 * IDirectPlay3 (and IDirectPlay3A) Interface
15076
 *
15077
 ****************************************************************************)
15078
 
15079
  IDirectPlay3AW = interface (IDirectPlay2AW)
15080
    (*** IDirectPlay3 methods ***)
15081
    function AddGroupToGroup(idParentGroup: TDPID; idGroup: TDPID) : HResult; stdcall;
1 daniel-mar 15082
    function CreateGroupInGroup(idParentGroup: TDPID; var lpidGroup: TDPID;
4 daniel-mar 15083
        lpGroupName: PDPName; lpData: Pointer; dwDataSize: DWORD;
15084
        dwFlags: DWORD) : HResult; stdcall;
15085
    function DeleteGroupFromGroup(idParentGroup: TDPID; idGroup: TDPID) : HResult; stdcall;
15086
    function EnumConnections(lpguidApplication: PGUID;
1 daniel-mar 15087
        lpEnumCallback: TDPEnumConnectionsCallback; lpContext: Pointer;
4 daniel-mar 15088
        dwFlags: DWORD) : HResult; stdcall;
15089
    function EnumGroupsInGroup(idGroup: TDPID; lpguidInstance: PGUID;
1 daniel-mar 15090
        lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
4 daniel-mar 15091
        dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 15092
    function GetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
4 daniel-mar 15093
        lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
15094
    function InitializeConnection(lpConnection: Pointer; dwFlags: DWORD) : HResult; stdcall;
15095
    function SecureOpen(var lpsd: TDPSessionDesc2; dwFlags: DWORD;
15096
        var lpSecurity: TDPSecurityDesc; var lpCredentials: TDPCredentials) : HResult; stdcall;
1 daniel-mar 15097
    function SendChatMessage(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
4 daniel-mar 15098
        var lpChatMessage: TDPChat) : HResult; stdcall;
1 daniel-mar 15099
    function SetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
4 daniel-mar 15100
        var lpConnection: TDPLConnection) : HResult; stdcall;
15101
    function StartSession(dwFlags: DWORD; idGroup: TDPID) : HResult; stdcall;
15102
    function GetGroupFlags(idGroup: TDPID; out lpdwFlags: DWORD) : HResult; stdcall;
15103
    function GetGroupParent(idGroup: TDPID; out lpidParent: TDPID) : HResult; stdcall;
1 daniel-mar 15104
    function GetPlayerAccount(idPlayer: TDPID; dwFlags: DWORD; var lpData;
4 daniel-mar 15105
        var lpdwDataSize: DWORD) : HResult; stdcall;
15106
    function GetPlayerFlags(idPlayer: TDPID; out lpdwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 15107
  end;
15108
 
4 daniel-mar 15109
 
15110
  IDirectPlay3W = interface (IDirectPlay3AW)
15111
    ['{133EFE40-32DC-11D0-9CFB-00A0C90A43CB}']
1 daniel-mar 15112
  end;
4 daniel-mar 15113
  IDirectPlay3A = interface (IDirectPlay3AW)
15114
    ['{133efe41-32dc-11d0-9cfb-00a0c90a43cb}']
15115
  end;
1 daniel-mar 15116
 
4 daniel-mar 15117
{$IFDEF UNICODE}
15118
  IDirectPlay3 = IDirectPlay3W;
15119
{$ELSE}
15120
  IDirectPlay3 = IDirectPlay3A;
15121
{$ENDIF}
1 daniel-mar 15122
 
4 daniel-mar 15123
 
15124
(****************************************************************************
15125
 *
15126
 * IDirectPlay4 (and IDirectPlay4A) Interface
15127
 *
15128
 ****************************************************************************)
15129
 
15130
  IDirectPlay4AW = interface (IDirectPlay3AW)
15131
    (*** IDirectPlay4 methods ***)
15132
    function GetGroupOwner(idGroup: TDPID; out idOwner: TDPID) : HResult; stdcall;
15133
    function SetGroupOwner(idGroup: TDPID; idOwner: TDPID) : HResult; stdcall;
15134
    function SendEx(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD; lpData: Pointer;
1 daniel-mar 15135
        dwDataSize: DWORD; dwPriority: DWORD; dwTimeout: DWORD;
4 daniel-mar 15136
        lpContext: Pointer; lpdwMsgId: PDWORD) : HResult; stdcall;
1 daniel-mar 15137
    function GetMessageQueue(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
4 daniel-mar 15138
        lpdwNumMsgs: PDWORD; lpdwNumBytes: PDWORD) : HResult; stdcall;
15139
    function CancelMessage(dwMessageID: DWORD; dwFlags: DWORD) : HResult; stdcall;
15140
    function CancelPriority(dwMinPriority: DWORD; dwMaxPriority: DWORD; dwFlags: DWORD) : HResult; stdcall;
15141
  end;
1 daniel-mar 15142
 
4 daniel-mar 15143
 
15144
  IDirectPlay4W = interface (IDirectPlay4AW)
15145
    ['{0ab1c530-4745-11D1-a7a1-0000f803abfc}']
1 daniel-mar 15146
  end;
4 daniel-mar 15147
  IDirectPlay4A = interface (IDirectPlay4AW)
15148
    ['{0ab1c531-4745-11D1-a7a1-0000f803abfc}']
15149
  end;
1 daniel-mar 15150
 
4 daniel-mar 15151
{$IFDEF UNICODE}
15152
  IDirectPlay4 = IDirectPlay4W;
15153
{$ELSE}
15154
  IDirectPlay4 = IDirectPlay4A;
15155
{$ENDIF}
15156
 
15157
 
1 daniel-mar 15158
const
4 daniel-mar 15159
(****************************************************************************
15160
 *
15161
 * EnumConnections API flags
15162
 *
15163
 ****************************************************************************)
1 daniel-mar 15164
 
4 daniel-mar 15165
(*
15166
 * Enumerate Service Providers
15167
 *)
15168
  DPCONNECTION_DIRECTPLAY = $00000001;
15169
 
15170
(*
15171
 * Enumerate Lobby Providers
15172
 *)
1 daniel-mar 15173
  DPCONNECTION_DIRECTPLAYLOBBY = $00000002;
15174
 
4 daniel-mar 15175
(****************************************************************************
15176
 *
15177
 * EnumPlayers API flags
15178
 *
15179
 ****************************************************************************)
1 daniel-mar 15180
 
4 daniel-mar 15181
(*
15182
 * Enumerate all players in the current session
15183
 *)
15184
  DPENUMPLAYERS_ALL = $00000000;
15185
  DPENUMGROUPS_ALL = DPENUMPLAYERS_ALL;
15186
 
15187
(*
15188
 * Enumerate only local (created by this application) players
15189
 * or groups
15190
 *)
15191
  DPENUMPLAYERS_LOCAL = $00000008;
15192
  DPENUMGROUPS_LOCAL = DPENUMPLAYERS_LOCAL;
15193
 
15194
(*
15195
 * Enumerate only remote (non-local) players
15196
 * or groups
15197
 *)
15198
  DPENUMPLAYERS_REMOTE = $00000010;
15199
  DPENUMGROUPS_REMOTE = DPENUMPLAYERS_REMOTE;
15200
 
15201
(*
15202
 * Enumerate groups along with the players
15203
 *)
15204
  DPENUMPLAYERS_GROUP = $00000020;
15205
 
15206
(*
15207
 * Enumerate players or groups in another session
15208
 * (must supply lpguidInstance)
15209
 *)
15210
  DPENUMPLAYERS_SESSION = $00000080;
15211
  DPENUMGROUPS_SESSION = DPENUMPLAYERS_SESSION;
15212
 
15213
(*
15214
 * Enumerate server players
15215
 *)
1 daniel-mar 15216
  DPENUMPLAYERS_SERVERPLAYER = $00000100;
15217
 
4 daniel-mar 15218
(*
15219
 * Enumerate spectator players
15220
 *)
15221
  DPENUMPLAYERS_SPECTATOR = $00000200;
1 daniel-mar 15222
 
4 daniel-mar 15223
(*
15224
 * Enumerate shortcut groups
15225
 *)
15226
  DPENUMGROUPS_SHORTCUT = $00000400;
15227
 
15228
(*
15229
 * Enumerate staging area groups
15230
 *)
15231
  DPENUMGROUPS_STAGINGAREA = $00000800;
15232
 
15233
(*
15234
 * Enumerate hidden groups
15235
 *)
15236
  DPENUMGROUPS_HIDDEN = $00001000;
15237
 
15238
(*
15239
 * Enumerate the group's owner
15240
 *)
15241
  DPENUMPLAYERS_OWNER = $00002000;
15242
 
15243
(****************************************************************************
15244
 *
15245
 * CreatePlayer API flags
15246
 *
15247
 ****************************************************************************)
15248
 
15249
(*
15250
 * This flag indicates that this player should be designated
15251
 * the server player. The app should specify this at CreatePlayer.
15252
 *)
1 daniel-mar 15253
  DPPLAYER_SERVERPLAYER = DPENUMPLAYERS_SERVERPLAYER;
15254
 
4 daniel-mar 15255
(*
15256
 * This flag indicates that this player should be designated
15257
 * a spectator. The app should specify this at CreatePlayer.
15258
 *)
15259
  DPPLAYER_SPECTATOR = DPENUMPLAYERS_SPECTATOR;
1 daniel-mar 15260
 
4 daniel-mar 15261
(*
15262
 * This flag indicates that this player was created locally.
15263
 * (returned from GetPlayerFlags)
15264
 *)
15265
  DPPLAYER_LOCAL = DPENUMPLAYERS_LOCAL;
15266
 
15267
(*
15268
 * This flag indicates that this player is the group's owner
15269
 * (Only returned in EnumGroupPlayers)
15270
 *)
15271
  DPPLAYER_OWNER = DPENUMPLAYERS_OWNER;
15272
 
15273
(****************************************************************************
15274
 *
15275
 * CreateGroup API flags
15276
 *
15277
 ****************************************************************************)
15278
 
15279
(*
15280
 * This flag indicates that the StartSession can be called on the group.
15281
 * The app should specify this at CreateGroup, or CreateGroupInGroup.
15282
 *)
1 daniel-mar 15283
  DPGROUP_STAGINGAREA = DPENUMGROUPS_STAGINGAREA;
15284
 
4 daniel-mar 15285
(*
15286
 * This flag indicates that this group was created locally.
15287
 * (returned from GetGroupFlags)
15288
 *)
15289
  DPGROUP_LOCAL = DPENUMGROUPS_LOCAL;
1 daniel-mar 15290
 
4 daniel-mar 15291
(*
15292
 * This flag indicates that this group was created hidden.
15293
 *)
15294
  DPGROUP_HIDDEN = DPENUMGROUPS_HIDDEN;
15295
 
15296
(****************************************************************************
15297
 *
15298
 * EnumSessions API flags
15299
 *
15300
 ****************************************************************************)
15301
 
15302
(*
15303
 * Enumerate sessions which can be joined
15304
 *)
15305
  DPENUMSESSIONS_AVAILABLE = $00000001;
15306
 
15307
(*
15308
 * Enumerate all sessions even if they can't be joined.
15309
 *)
15310
  DPENUMSESSIONS_ALL = $00000002;
15311
 
15312
(*
15313
 * Start an asynchronous enum sessions
15314
 *)
15315
  DPENUMSESSIONS_ASYNC = $00000010;
15316
 
15317
(*
15318
 * Stop an asynchronous enum sessions
15319
 *)
15320
  DPENUMSESSIONS_STOPASYNC = $00000020;
15321
 
15322
(*
15323
 * Enumerate sessions even if they require a password
15324
 *)
1 daniel-mar 15325
  DPENUMSESSIONS_PASSWORDREQUIRED = $00000040;
15326
 
4 daniel-mar 15327
(*
15328
 * Return status about progress of enumeration instead of
15329
 * showing any status dialogs.
15330
 *)
15331
  DPENUMSESSIONS_RETURNSTATUS = $00000080;
1 daniel-mar 15332
 
4 daniel-mar 15333
(****************************************************************************
15334
 *
15335
 * GetCaps and GetPlayerCaps API flags
15336
 *
15337
 ****************************************************************************)
15338
 
15339
(*
15340
 * The latency returned should be for guaranteed message sending.
15341
 * Default is non-guaranteed messaging.
15342
 *)
1 daniel-mar 15343
  DPGETCAPS_GUARANTEED = $00000001;
15344
 
4 daniel-mar 15345
(****************************************************************************
15346
 *
15347
 * GetGroupData, GetPlayerData API flags
15348
 * Remote and local Group/Player data is maintained separately.
15349
 * Default is DPGET_REMOTE.
15350
 *
15351
 ****************************************************************************)
1 daniel-mar 15352
 
4 daniel-mar 15353
(*
15354
 * Get the remote data (set by any DirectPlay object in
15355
 * the session using DPSET_REMOTE)
15356
 *)
1 daniel-mar 15357
  DPGET_REMOTE = $00000000;
15358
 
4 daniel-mar 15359
(*
15360
 * Get the local data (set by this DirectPlay object
15361
 * using DPSET_LOCAL)
15362
 *)
15363
  DPGET_LOCAL = $00000001;
1 daniel-mar 15364
 
4 daniel-mar 15365
(****************************************************************************
15366
 *
15367
 * Open API flags
15368
 *
15369
 ****************************************************************************)
15370
 
15371
(*
15372
 * Join the session that is described by the DPSESSIONDESC2 structure
15373
 *)
15374
  DPOPEN_JOIN = $00000001;
15375
 
15376
(*
15377
 * Create a new session as described by the DPSESSIONDESC2 structure
15378
 *)
15379
  DPOPEN_CREATE = $00000002;
15380
 
15381
(*
15382
 * Return status about progress of open instead of showing
15383
 * any status dialogs.
15384
 *)
1 daniel-mar 15385
  DPOPEN_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
15386
 
4 daniel-mar 15387
(****************************************************************************
15388
 *
15389
 * DPLCONNECTION flags
15390
 *
15391
 ****************************************************************************)
1 daniel-mar 15392
 
4 daniel-mar 15393
(*
15394
 * This application should create a new session as
15395
 * described by the DPSESIONDESC structure
15396
 *)
1 daniel-mar 15397
  DPLCONNECTION_CREATESESSION = DPOPEN_CREATE;
15398
 
4 daniel-mar 15399
(*
15400
 * This application should join the session described by
15401
 * the DPSESIONDESC structure with the lpAddress data
15402
 *)
15403
  DPLCONNECTION_JOINSESSION = DPOPEN_JOIN;
1 daniel-mar 15404
 
4 daniel-mar 15405
(****************************************************************************
15406
 *
15407
 * Receive API flags
15408
 * Default is DPRECEIVE_ALL
15409
 *
15410
 ****************************************************************************)
15411
 
15412
(*
15413
 * Get the first message in the queue
15414
 *)
15415
  DPRECEIVE_ALL = $00000001;
15416
 
15417
(*
15418
 * Get the first message in the queue directed to a specific player
15419
 *)
15420
  DPRECEIVE_TOPLAYER = $00000002;
15421
 
15422
(*
15423
 * Get the first message in the queue from a specific player
15424
 *)
1 daniel-mar 15425
  DPRECEIVE_FROMPLAYER = $00000004;
15426
 
4 daniel-mar 15427
(*
15428
 * Get the message but don't remove it from the queue
15429
 *)
15430
  DPRECEIVE_PEEK = $00000008;
1 daniel-mar 15431
 
4 daniel-mar 15432
(****************************************************************************
15433
 *
15434
 * Send API flags
15435
 *
15436
 ****************************************************************************)
15437
 
15438
(*
15439
 * Send the message using a guaranteed send method.
15440
 * Default is non-guaranteed.
15441
 *)
15442
  DPSEND_GUARANTEED = $00000001;
15443
 
15444
(*
15445
 * This flag is obsolete. It is ignored by DirectPlay
15446
 *)
15447
  DPSEND_HIGHPRIORITY = $00000002;
15448
 
15449
(*
15450
 * This flag is obsolete. It is ignored by DirectPlay
15451
 *)
15452
  DPSEND_OPENSTREAM = $00000008;
15453
 
15454
(*
15455
 * This flag is obsolete. It is ignored by DirectPlay
15456
 *)
15457
  DPSEND_CLOSESTREAM = $00000010;
15458
 
15459
(*
15460
 * Send the message digitally signed to ensure authenticity.
15461
 *)
15462
  DPSEND_SIGNED = $00000020;
15463
 
15464
(*
15465
 * Send the message with encryption to ensure privacy.
15466
 *)
15467
  DPSEND_ENCRYPTED = $00000040;
15468
 
15469
(*
15470
 * The message is a lobby system message
15471
 *)
1 daniel-mar 15472
  DPSEND_LOBBYSYSTEMMESSAGE = $00000080;
15473
 
4 daniel-mar 15474
(*
15475
 * andyco - added this so we can make addforward async.
15476
 * needs to be sanitized when we add / expose full async
15477
 * support.  8/3/97.
15478
 *)
15479
  DPSEND_ASYNC = $00000200;
1 daniel-mar 15480
 
4 daniel-mar 15481
(*
15482
 * When a message is completed, don't tell me.
15483
 * by default the application is notified with a system message.
15484
 *)
15485
  DPSEND_NOSENDCOMPLETEMSG = $00000400;
15486
 
15487
 
15488
(*
15489
 * Maximum priority for sends available to applications
15490
 *)
15491
  DPSEND_MAX_PRI = $0000FFFF;
15492
  DPSEND_MAX_PRIORITY = DPSEND_MAX_PRI;
15493
 
15494
(****************************************************************************
15495
 *
15496
 * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName,
15497
 * SetSessionDesc API flags.
15498
 * Default is DPSET_REMOTE.
15499
 *
15500
 ****************************************************************************)
15501
 
15502
(*
15503
 * Propagate the data to all players in the session
15504
 *)
15505
  DPSET_REMOTE = $00000000;
15506
 
15507
(*
15508
 * Do not propagate the data to other players
15509
 *)
15510
  DPSET_LOCAL = $00000001;
15511
 
15512
(*
15513
 * Used with DPSET_REMOTE, use guaranteed message send to
15514
 * propagate the data
15515
 *)
1 daniel-mar 15516
  DPSET_GUARANTEED = $00000002;
15517
 
4 daniel-mar 15518
(****************************************************************************
15519
 *
15520
 * GetMessageQueue API flags.
15521
 * Default is DPMESSAGEQUEUE_SEND
15522
 *
15523
 ****************************************************************************)
1 daniel-mar 15524
 
4 daniel-mar 15525
(*
15526
 * Get Send Queue - requires Service Provider Support
15527
 *)
15528
  DPMESSAGEQUEUE_SEND = $00000001;
1 daniel-mar 15529
 
4 daniel-mar 15530
(*
15531
 * Get Receive Queue
15532
 *)
15533
  DPMESSAGEQUEUE_RECEIVE = $00000002;
1 daniel-mar 15534
 
4 daniel-mar 15535
(****************************************************************************
15536
 *
15537
 * Connect API flags
15538
 *
15539
 ****************************************************************************)
15540
 
15541
(*
15542
 * Start an asynchronous connect which returns status codes
15543
 *)
1 daniel-mar 15544
  DPCONNECT_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
15545
 
4 daniel-mar 15546
(****************************************************************************
15547
 *
15548
 * DirectPlay system messages and message data structures
15549
 *
15550
 * All system message come 'From' player DPID_SYSMSG.  To determine what type
15551
 * of message it is, cast the lpData from Receive to TDPMsg_Generic and check
15552
 * the dwType member against one of the following DPSYS_xxx constants. Once
15553
 * a match is found, cast the lpData to the corresponding of the DPMSG_xxx
15554
 * structures to access the data of the message.
15555
 *
15556
 ****************************************************************************)
1 daniel-mar 15557
 
4 daniel-mar 15558
(*
15559
 * A new player or group has been created in the session
15560
 * Use TDPMsg_CreatePlayerOrGroup.  Check dwPlayerType to see if it
15561
 * is a player or a group.
15562
 *)
15563
  DPSYS_CREATEPLAYERORGROUP = $0003;
15564
 
15565
(*
15566
 * A player has been deleted from the session
15567
 * Use TDPMsg_DestroyPlayerOrGroup
15568
 *)
15569
  DPSYS_DESTROYPLAYERORGROUP = $0005;
15570
 
15571
(*
15572
 * A player has been added to a group
15573
 * Use DPMSG_ADDPLAYERTOGROUP
15574
 *)
15575
  DPSYS_ADDPLAYERTOGROUP = $0007;
15576
 
15577
(*
15578
 * A player has been removed from a group
15579
 * Use DPMSG_DELETEPLAYERFROMGROUP
15580
 *)
1 daniel-mar 15581
  DPSYS_DELETEPLAYERFROMGROUP = $0021;
15582
 
4 daniel-mar 15583
(*
15584
 * This DirectPlay object lost its connection with all the
15585
 * other players in the session.
15586
 * Use DPMSG_SESSIONLOST.
15587
 *)
15588
  DPSYS_SESSIONLOST = $0031;
1 daniel-mar 15589
 
4 daniel-mar 15590
(*
15591
 * The current host has left the session.
15592
 * This DirectPlay object is now the host.
15593
 * Use DPMSG_HOST.
15594
 *)
15595
  DPSYS_HOST = $0101;
1 daniel-mar 15596
 
4 daniel-mar 15597
(*
15598
 * The remote data associated with a player or
15599
 * group has changed. Check dwPlayerType to see
15600
 * if it is a player or a group
15601
 * Use DPMSG_SETPLAYERORGROUPDATA
15602
 *)
15603
  DPSYS_SETPLAYERORGROUPDATA = $0102;
1 daniel-mar 15604
 
4 daniel-mar 15605
(*
15606
 * The name of a player or group has changed.
15607
 * Check dwPlayerType to see if it is a player
15608
 * or a group.
15609
 * Use TDPMsg_SetPlayerOrGroupName
15610
 *)
15611
  DPSYS_SETPLAYERORGROUPNAME = $0103;
1 daniel-mar 15612
 
4 daniel-mar 15613
(*
15614
 * The session description has changed.
15615
 * Use DPMSG_SETSESSIONDESC
15616
 *)
15617
  DPSYS_SETSESSIONDESC = $0104;
15618
 
15619
(*
15620
 * A group has been added to a group
15621
 * Use TDPMsg_AddGroupToGroup
15622
 *)
15623
  DPSYS_ADDGROUPTOGROUP = $0105;
15624
 
15625
(*
15626
 * A group has been removed from a group
15627
 * Use DPMsg_DeleteGroupFromGroup
15628
 *)
15629
  DPSYS_DELETEGROUPFROMGROUP = $0106;
15630
 
15631
(*
15632
 * A secure player-player message has arrived.
15633
 * Use DPMSG_SECUREMESSAGE
15634
 *)
15635
  DPSYS_SECUREMESSAGE = $0107;
15636
 
15637
(*
15638
 * Start a new session.
15639
 * Use DPMSG_STARTSESSION
15640
 *)
15641
  DPSYS_STARTSESSION = $0108;
15642
 
15643
(*
15644
 * A chat message has arrived
15645
 * Use DPMSG_CHAT
15646
 *)
15647
  DPSYS_CHAT = $0109;
15648
 
15649
(*
15650
 * The owner of a group has changed
15651
 * Use DPMSG_SETGROUPOWNER
15652
 *)
15653
  DPSYS_SETGROUPOWNER = $010A;
15654
 
15655
(*
15656
 * An async send has finished, failed or been cancelled
15657
 * Use DPMSG_SENDCOMPLETE
15658
 *)
15659
  DPSYS_SENDCOMPLETE = $010D;
15660
 
15661
(*
15662
 * Used in the dwPlayerType field to indicate if it applies to a group
15663
 * or a player
15664
 *)
15665
  DPPLAYERTYPE_GROUP = $00000000;
15666
  DPPLAYERTYPE_PLAYER = $00000001;
15667
 
1 daniel-mar 15668
type
4 daniel-mar 15669
(*
15670
 * TDPMsg_Generic
15671
 * Generic message structure used to identify the message type.
15672
 *)
1 daniel-mar 15673
  PDPMsg_Generic = ^TDPMsg_Generic;
4 daniel-mar 15674
  TDPMsg_Generic = packed record
1 daniel-mar 15675
    dwType: DWORD;   // Message type
15676
  end;
15677
 
4 daniel-mar 15678
(*
15679
 * TDPMsg_CreatePlayerOrGroup
15680
 * System message generated when a new player or group
15681
 * created in the session with information about it.
15682
 *)
1 daniel-mar 15683
  PDPMsg_CreatePlayerOrGroup = ^TDPMsg_CreatePlayerOrGroup;
4 daniel-mar 15684
  TDPMsg_CreatePlayerOrGroup = packed record
1 daniel-mar 15685
    dwType: DWORD;             // Message type
15686
    dwPlayerType: DWORD;       // Is it a player or group
4 daniel-mar 15687
    DPID: TDPID;               // ID of the player or group
1 daniel-mar 15688
    dwCurrentPlayers: DWORD;   // current # players & groups in session
15689
    lpData: Pointer;           // pointer to remote data
15690
    dwDataSize: DWORD;         // size of remote data
15691
    dpnName: TDPName;           // structure with name info
15692
                               // the following fields are only available when using
15693
                               // the IDirectPlay3 interface or greater
4 daniel-mar 15694
    dpIdParent: TDPID;         // id of parent group
1 daniel-mar 15695
    dwFlags: DWORD;            // player or group flags
15696
  end;
15697
 
4 daniel-mar 15698
(*
15699
 * TDPMsg_DestroyPlayerOrGroup
15700
 * System message generated when a player or group is being
15701
 * destroyed in the session with information about it.
15702
 *)
15703
  PDPMsg_DestroyPlayerOrGroup= ^TDPMsg_DestroyPlayerOrGroup;
15704
  TDPMsg_DestroyPlayerOrGroup = packed record
1 daniel-mar 15705
    dwType: DWORD;             // Message type
15706
    dwPlayerType: DWORD;       // Is it a player or group
4 daniel-mar 15707
    DPID: TDPID;                // player ID being deleted
1 daniel-mar 15708
    lpLocalData: Pointer;      // copy of players local data
15709
    dwLocalDataSize: DWORD;    // sizeof local data
15710
    lpRemoteData: Pointer;     // copy of players remote data
15711
    dwRemoteDataSize: DWORD;   // sizeof remote data
15712
                               // the following fields are only available when using
15713
                               // the IDirectPlay3 interface or greater
15714
    dpnName: TDPName;           // structure with name info
15715
    dpIdParent: TDPID;          // id of parent group
15716
    dwFlags: DWORD;            // player or group flags
15717
  end;
15718
 
4 daniel-mar 15719
(*
15720
 * DPMSG_ADDPLAYERTOGROUP
15721
 * System message generated when a player is being added
15722
 * to a group.
15723
 *)
15724
  PDPMsg_AddPlayerToGroup = ^TDPMsg_AddPlayerToGroup;
15725
  TDPMsg_AddPlayerToGroup = packed record
1 daniel-mar 15726
    dwType: DWORD;      // Message type
15727
    dpIdGroup: TDPID;    // group ID being added to
15728
    dpIdPlayer: TDPID;   // player ID being added
15729
  end;
15730
 
4 daniel-mar 15731
(*
15732
 * DPMSG_DELETEPLAYERFROMGROUP
15733
 * System message generated when a player is being
15734
 * removed from a group
15735
 *)
15736
  PDPMsg_DeletePlayerFromGroup = ^TDPMsg_DeletePlayerFromGroup;
15737
  TDPMsg_DeletePlayerFromGroup = TDPMsg_AddPlayerToGroup;
1 daniel-mar 15738
 
4 daniel-mar 15739
(*
15740
 * TDPMsg_AddGroupToGroup
15741
 * System message generated when a group is being added
15742
 * to a group.
15743
 *)
1 daniel-mar 15744
  PDPMsg_AddGroupToGroup = ^TDPMsg_AddGroupToGroup;
4 daniel-mar 15745
  TDPMsg_AddGroupToGroup = packed record
1 daniel-mar 15746
    dwType: DWORD;           // Message type
15747
    dpIdParentGroup: TDPID;   // group ID being added to
15748
    dpIdGroup: TDPID;         // group ID being added
15749
  end;
15750
 
4 daniel-mar 15751
(*
15752
 * DPMsg_DeleteGroupFromGroup
15753
 * System message generated when a GROUP is being
15754
 * removed from a group
15755
 *)
15756
  PDPMsg_DeleteGroupFromGroup = ^TDPMsg_DeleteGroupFromGroup;
1 daniel-mar 15757
  TDPMsg_DeleteGroupFromGroup = TDPMsg_AddGroupToGroup;
15758
 
4 daniel-mar 15759
(*
15760
 * DPMSG_SETPLAYERORGROUPDATA
15761
 * System message generated when remote data for a player or
15762
 * group has changed.
15763
 *)
1 daniel-mar 15764
  PDPMsg_SetPlayerOrGroupData = ^TDPMsg_SetPlayerOrGroupData;
4 daniel-mar 15765
  TDPMsg_SetPlayerOrGroupData = packed record
1 daniel-mar 15766
    dwType: DWORD;         // Message type
15767
    dwPlayerType: DWORD;   // Is it a player or group
4 daniel-mar 15768
    DPID: TDPID;           // ID of player or group
1 daniel-mar 15769
    lpData: Pointer;       // pointer to remote data
15770
    dwDataSize: DWORD;     // size of remote data
15771
  end;
15772
 
4 daniel-mar 15773
(*
15774
 * DPMSG_SETPLAYERORGROUPNAME
15775
 * System message generated when the name of a player or
15776
 * group has changed.
15777
 *)
1 daniel-mar 15778
  PDPMsg_SetPlayerOrGroupName = ^TDPMsg_SetPlayerOrGroupName;
4 daniel-mar 15779
  TDPMsg_SetPlayerOrGroupName = packed record
1 daniel-mar 15780
    dwType: DWORD;         // Message type
15781
    dwPlayerType: DWORD;   // Is it a player or group
4 daniel-mar 15782
    DPID: TDPID;           // ID of player or group
15783
    dpnName: TDPName;      // structure with new name info
1 daniel-mar 15784
  end;
15785
 
4 daniel-mar 15786
(*
15787
 * DPMSG_SETSESSIONDESC
15788
 * System message generated when session desc has changed
15789
 *)
1 daniel-mar 15790
  PDPMsg_SetSessionDesc = ^TDPMsg_SetSessionDesc;
4 daniel-mar 15791
  TDPMsg_SetSessionDesc = packed record
1 daniel-mar 15792
    dwType: DWORD;            // Message type
15793
    dpDesc: TDPSessionDesc2;   // Session desc
15794
  end;
15795
 
4 daniel-mar 15796
(*
15797
 * DPMSG_HOST
15798
 * System message generated when the host has migrated to this
15799
 * DirectPlay object.
15800
 *
15801
 *)
1 daniel-mar 15802
  PDPMsg_Host = ^TDPMsg_Host;
15803
  TDPMsg_Host = TDPMsg_Generic;
15804
 
4 daniel-mar 15805
(*
15806
 * DPMSG_SESSIONLOST
15807
 * System message generated when the connection to the session is lost.
15808
 *
15809
 *)
1 daniel-mar 15810
  PDPMsg_SessionLost = ^TDPMsg_SessionLost;
15811
  TDPMsg_SessionLost = TDPMsg_Generic;
15812
 
4 daniel-mar 15813
(*
15814
 * DPMSG_SECUREMESSAGE
15815
 * System message generated when a player requests a secure send
15816
 *)
1 daniel-mar 15817
  PDPMsg_SecureMessage = ^TDPMsg_SecureMessage;
4 daniel-mar 15818
  TDPMsg_SecureMessage = packed record
1 daniel-mar 15819
    dwType: DWORD;       // Message Type
15820
    dwFlags: DWORD;      // Signed/Encrypted
15821
    dpIdFrom: TDPID;      // ID of Sending Player
15822
    lpData: Pointer;     // Player message
15823
    dwDataSize: DWORD;   // Size of player message
15824
  end;
15825
 
4 daniel-mar 15826
(*
15827
 * DPMSG_STARTSESSION
15828
 * System message containing all information required to
15829
 * start a new session
15830
 *)
1 daniel-mar 15831
  PDPMsg_StartSession = ^TDPMsg_StartSession;
4 daniel-mar 15832
  TDPMsg_StartSession = packed record
1 daniel-mar 15833
    dwType: DWORD;             // Message type
4 daniel-mar 15834
    lpConn: PDPLConnection;   // TDPLConnection structure
1 daniel-mar 15835
  end;
15836
 
4 daniel-mar 15837
(*
15838
 * DPMSG_CHAT
15839
 * System message containing a chat message
15840
 *)
1 daniel-mar 15841
  PDPMsg_Chat = ^TDPMsg_Chat;
4 daniel-mar 15842
  TDPMsg_Chat = packed record
1 daniel-mar 15843
    dwType: DWORD;        // Message type
15844
    dwFlags: DWORD;       // Message flags
15845
    idFromPlayer: TDPID;  // ID of the Sending Player
15846
    idToPlayer: TDPID;    // ID of the To Player
15847
    idToGroup: TDPID;     // ID of the To Group
15848
    lpChat: PDPChat;      // Pointer to a structure containing the chat message
15849
  end;
15850
 
4 daniel-mar 15851
(*
15852
 * DPMSG_SETGROUPOWNER
15853
 * System message generated when the owner of a group has changed
15854
 *)
1 daniel-mar 15855
  PDPMsg_SetGroupOwner = ^TDPMsg_SetGroupOwner;
4 daniel-mar 15856
  TDPMsg_SetGroupOwner = packed record
1 daniel-mar 15857
    dwType: DWORD;        // Message type
15858
    idGroup: TDPID;       // ID of the group
15859
    idNewOwner: TDPID;    // ID of the player that is the new owner
15860
    idOldOwner: TDPID;    // ID of the player that used to be the owner
15861
  end;
15862
 
4 daniel-mar 15863
(*
15864
 * DPMSG_SENDCOMPLETE
15865
 * System message generated when finished with an Async Send message
15866
 *
15867
 * NOTE SENDPARMS has an overlay for DPMSG_SENDCOMPLETE, don't
15868
 *                change this message w/o changing SENDPARMS.
15869
 *)
15870
  PDPMsg_SendComplete = ^TDPMsg_SendComplete;
15871
  TDPMsg_SendComplete = packed record
1 daniel-mar 15872
    dwType: DWORD;        // Message type
15873
    idFrom: TDPID;
15874
    idTo: TDPID;
15875
    dwFlags: DWORD;
15876
    dwPriority: DWORD;
15877
    dwTimeout: DWORD;
15878
    lpvContext: Pointer;
15879
    dwMsgID: DWORD;
15880
    hr: HRESULT;
15881
    dwSendTime: DWORD;
15882
  end;
15883
 
4 daniel-mar 15884
(****************************************************************************
15885
 *
15886
 * DIRECTPLAY ERRORS
15887
 *
15888
 * Errors are represented by negative values and cannot be combined.
15889
 *
15890
 ****************************************************************************)
1 daniel-mar 15891
const
4 daniel-mar 15892
  MAKE_DPHRESULT = HResult($88770000);
1 daniel-mar 15893
 
4 daniel-mar 15894
  DP_OK = S_OK;
15895
  DPERR_ALREADYINITIALIZED = MAKE_DPHRESULT + 5;
15896
  DPERR_ACCESSDENIED = MAKE_DPHRESULT + 10;
15897
  DPERR_ACTIVEPLAYERS = MAKE_DPHRESULT + 20;
15898
  DPERR_BUFFERTOOSMALL = MAKE_DPHRESULT + 30;
15899
  DPERR_CANTADDPLAYER = MAKE_DPHRESULT + 40;
15900
  DPERR_CANTCREATEGROUP = MAKE_DPHRESULT + 50;
15901
  DPERR_CANTCREATEPLAYER = MAKE_DPHRESULT + 60;
15902
  DPERR_CANTCREATESESSION = MAKE_DPHRESULT + 70;
15903
  DPERR_CAPSNOTAVAILABLEYET = MAKE_DPHRESULT + 80;
15904
  DPERR_EXCEPTION = MAKE_DPHRESULT + 90;
15905
  DPERR_GENERIC = E_FAIL;
15906
  DPERR_INVALIDFLAGS = MAKE_DPHRESULT + 120;
15907
  DPERR_INVALIDOBJECT = MAKE_DPHRESULT + 130;
15908
  DPERR_INVALIDPARAM = E_INVALIDARG;
15909
  DPERR_INVALIDPARAMS = DPERR_INVALIDPARAM;
15910
  DPERR_INVALIDPLAYER = MAKE_DPHRESULT + 150;
15911
  DPERR_INVALIDGROUP = MAKE_DPHRESULT + 155;
15912
  DPERR_NOCAPS = MAKE_DPHRESULT + 160;
15913
  DPERR_NOCONNECTION = MAKE_DPHRESULT + 170;
15914
  DPERR_NOMEMORY = E_OUTOFMEMORY;
15915
  DPERR_OUTOFMEMORY = DPERR_NOMEMORY;
15916
  DPERR_NOMESSAGES = MAKE_DPHRESULT + 190;
15917
  DPERR_NONAMESERVERFOUND = MAKE_DPHRESULT + 200;
15918
  DPERR_NOPLAYERS = MAKE_DPHRESULT + 210;
15919
  DPERR_NOSESSIONS = MAKE_DPHRESULT + 220;
15920
  DPERR_PENDING = E_PENDING;
15921
  DPERR_SENDTOOBIG = MAKE_DPHRESULT + 230;
15922
  DPERR_TIMEOUT = MAKE_DPHRESULT + 240;
15923
  DPERR_UNAVAILABLE = MAKE_DPHRESULT + 250;
15924
  DPERR_UNSUPPORTED = E_NOTIMPL;
15925
  DPERR_BUSY = MAKE_DPHRESULT + 270;
15926
  DPERR_USERCANCEL = MAKE_DPHRESULT + 280;
15927
  DPERR_NOINTERFACE = E_NOINTERFACE;
15928
  DPERR_CANNOTCREATESERVER = MAKE_DPHRESULT + 290;
15929
  DPERR_PLAYERLOST = MAKE_DPHRESULT + 300;
15930
  DPERR_SESSIONLOST = MAKE_DPHRESULT + 310;
15931
  DPERR_UNINITIALIZED = MAKE_DPHRESULT + 320;
15932
  DPERR_NONEWPLAYERS = MAKE_DPHRESULT + 330;
15933
  DPERR_INVALIDPASSWORD = MAKE_DPHRESULT + 340;
15934
  DPERR_CONNECTING = MAKE_DPHRESULT + 350;
15935
  DPERR_CONNECTIONLOST = MAKE_DPHRESULT + 360;
15936
  DPERR_UNKNOWNMESSAGE = MAKE_DPHRESULT + 370;
15937
  DPERR_CANCELFAILED = MAKE_DPHRESULT + 380;
15938
  DPERR_INVALIDPRIORITY = MAKE_DPHRESULT + 390;
15939
  DPERR_NOTHANDLED = MAKE_DPHRESULT + 400;
15940
  DPERR_CANCELLED = MAKE_DPHRESULT + 410;
15941
  DPERR_ABORTED = MAKE_DPHRESULT + 420;
1 daniel-mar 15942
 
15943
 
4 daniel-mar 15944
  DPERR_BUFFERTOOLARGE = MAKE_DPHRESULT + 1000;
15945
  DPERR_CANTCREATEPROCESS = MAKE_DPHRESULT + 1010;
15946
  DPERR_APPNOTSTARTED = MAKE_DPHRESULT + 1020;
15947
  DPERR_INVALIDINTERFACE = MAKE_DPHRESULT + 1030;
15948
  DPERR_NOSERVICEPROVIDER = MAKE_DPHRESULT + 1040;
15949
  DPERR_UNKNOWNAPPLICATION = MAKE_DPHRESULT + 1050;
15950
  DPERR_NOTLOBBIED = MAKE_DPHRESULT + 1070;
15951
  DPERR_SERVICEPROVIDERLOADED = MAKE_DPHRESULT + 1080;
15952
  DPERR_ALREADYREGISTERED = MAKE_DPHRESULT + 1090;
15953
  DPERR_NOTREGISTERED = MAKE_DPHRESULT + 1100;
1 daniel-mar 15954
 
4 daniel-mar 15955
//
15956
// Security related errors
15957
//
15958
  DPERR_AUTHENTICATIONFAILED = MAKE_DPHRESULT + 2000;
15959
  DPERR_CANTLOADSSPI = MAKE_DPHRESULT + 2010;
15960
  DPERR_ENCRYPTIONFAILED = MAKE_DPHRESULT + 2020;
15961
  DPERR_SIGNFAILED = MAKE_DPHRESULT + 2030;
15962
  DPERR_CANTLOADSECURITYPACKAGE = MAKE_DPHRESULT + 2040;
15963
  DPERR_ENCRYPTIONNOTSUPPORTED = MAKE_DPHRESULT + 2050;
15964
  DPERR_CANTLOADCAPI = MAKE_DPHRESULT + 2060;
15965
  DPERR_NOTLOGGEDIN = MAKE_DPHRESULT + 2070;
15966
  DPERR_LOGONDENIED = MAKE_DPHRESULT + 2080;
15967
 
15968
(****************************************************************************
15969
 *
15970
 *      dplay 1.0 obsolete structures + interfaces
15971
 *      Included for compatibility only. New apps should
15972
 *      use IDirectPlay2
15973
 *
15974
 ****************************************************************************)
15975
 
15976
  DPOPEN_OPENSESSION = DPOPEN_JOIN;
1 daniel-mar 15977
  DPOPEN_CREATESESSION = DPOPEN_CREATE;
15978
 
15979
  DPENUMSESSIONS_PREVIOUS = $00000004;
15980
 
15981
  DPENUMPLAYERS_PREVIOUS = $00000004;
15982
 
15983
  DPSEND_GUARANTEE = DPSEND_GUARANTEED;
4 daniel-mar 15984
  DPSEND_TRYONCE = $00000004;
1 daniel-mar 15985
 
15986
  DPCAPS_NAMESERVICE = $00000001;
4 daniel-mar 15987
  DPCAPS_NAMESERVER = DPCAPS_ISHOST;
15988
  DPCAPS_GUARANTEED = $00000004;
1 daniel-mar 15989
 
4 daniel-mar 15990
  DPLONGNAMELEN = 52;
15991
  DPSHORTNAMELEN = 20;
1 daniel-mar 15992
  DPSESSIONNAMELEN = 32;
4 daniel-mar 15993
  DPPASSWORDLEN = 16;
15994
  DPUSERRESERVED = 16;
1 daniel-mar 15995
 
4 daniel-mar 15996
  DPSYS_ADDPLAYER = $0003;
1 daniel-mar 15997
  DPSYS_DELETEPLAYER = $0005;
15998
 
4 daniel-mar 15999
  DPSYS_DELETEGROUP = $0020;
1 daniel-mar 16000
  DPSYS_DELETEPLAYERFROMGRP = $0021;
4 daniel-mar 16001
  DPSYS_CONNECT = $484b;
1 daniel-mar 16002
 
16003
type
16004
  PDPMsg_AddPlayer = ^TDPMsg_AddPlayer;
4 daniel-mar 16005
  TDPMsg_AddPlayer = packed record
1 daniel-mar 16006
    dwType: DWORD;
16007
    dwPlayerType: DWORD;
4 daniel-mar 16008
    DPID: TDPID;
1 daniel-mar 16009
    szLongName: array[0..DPLONGNAMELEN-1] of Char;
16010
    szShortName: array[0..DPSHORTNAMELEN-1] of Char;
16011
    dwCurrentPlayers: DWORD;
16012
  end;
16013
 
16014
  PDPMsg_AddGroup = ^TDPMsg_AddGroup;
16015
  TDPMsg_AddGroup = TDPMsg_AddPlayer;
16016
 
16017
  PDPMsg_GroupAdd = ^TDPMsg_GroupAdd;
4 daniel-mar 16018
  TDPMsg_GroupAdd = packed record
1 daniel-mar 16019
    dwType: DWORD;
16020
    dpIdGroup: TDPID;
16021
    dpIdPlayer: TDPID;
16022
  end;
16023
 
16024
  PDPMsg_GroupDelete = ^TDPMsg_GroupDelete;
16025
  TDPMsg_GroupDelete = TDPMsg_GroupAdd;
16026
 
16027
  PDPMsg_DeletePlayer = ^TDPMsg_DeletePlayer;
4 daniel-mar 16028
  TDPMsg_DeletePlayer = packed record
1 daniel-mar 16029
    dwType: DWORD;
4 daniel-mar 16030
    DPID: TDPID;
1 daniel-mar 16031
  end;
16032
 
4 daniel-mar 16033
  TDPEnumPlayersCallback = function(dpId: TDPID; lpFriendlyName: PChar;
16034
      lpFormalName: PChar; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 16035
 
16036
  PDPSessionDesc = ^TDPSessionDesc;
4 daniel-mar 16037
  TDPSessionDesc = packed record
1 daniel-mar 16038
    dwSize: DWORD;
16039
    guidSession: TGUID;
16040
    dwSession: DWORD;
16041
    dwMaxPlayers: DWORD;
16042
    dwCurrentPlayers: DWORD;
16043
    dwFlags: DWORD;
4 daniel-mar 16044
    szSessionName: Array [0..DPSESSIONNAMELEN-1] of char;
16045
    szUserField: Array [0..DPUSERRESERVED-1] of char;
1 daniel-mar 16046
    dwReserved1: DWORD;
4 daniel-mar 16047
    szPassword: Array [0..DPPASSWORDLEN-1] of char;
1 daniel-mar 16048
    dwReserved2: DWORD;
16049
    dwUser1: DWORD;
16050
    dwUser2: DWORD;
16051
    dwUser3: DWORD;
16052
    dwUser4: DWORD;
16053
  end;
16054
 
4 daniel-mar 16055
  TDPEnumSessionsCallback = function(const lpDPSessionDesc: TDPSessionDesc;
16056
      lpContext: Pointer; var lpdwTimeOut: DWORD; dwFlags: DWORD) : BOOL; stdcall;
1 daniel-mar 16057
 
16058
type
4 daniel-mar 16059
  IDirectPlay = interface (IUnknown)
16060
    ['{5454e9a0-db65-11ce-921c-00aa006c4972}']
16061
    (*** IDirectPlay methods ***)
16062
    function AddPlayerToGroup(pidGroup: TDPID; pidPlayer: TDPID) : HResult; stdcall;
1 daniel-mar 16063
    function Close: HResult; stdcall;
4 daniel-mar 16064
    function CreatePlayer(out lppidID: TDPID; lpPlayerFriendlyName: PChar;
16065
        lpPlayerFormalName: PChar; lpEvent: PHandle) : HResult; stdcall;
16066
    function CreateGroup(out lppidID: TDPID; lpGroupFriendlyName: PChar;
16067
        lpGroupFormalName: PChar) : HResult; stdcall;
16068
    function DeletePlayerFromGroup(pidGroup: TDPID; pidPlayer: TDPID) : HResult; stdcall;
16069
    function DestroyPlayer(pidID: TDPID) : HResult; stdcall;
16070
    function DestroyGroup(pidID: TDPID) : HResult; stdcall;
16071
    function EnableNewPlayers(bEnable: BOOL) : HResult; stdcall;
1 daniel-mar 16072
    function EnumGroupPlayers(pidGroupPID: TDPID; lpEnumPlayersCallback:
4 daniel-mar 16073
        TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 16074
    function EnumGroups(dwSessionID: DWORD; lpEnumPlayersCallback:
4 daniel-mar 16075
        TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 16076
    function EnumPlayers(dwSessionId: DWORD; lpEnumPlayersCallback:
4 daniel-mar 16077
        TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
16078
    function EnumSessions(var lpSDesc: TDPSessionDesc; dwTimeout: DWORD;
16079
        lpEnumSessionsCallback: TDPEnumSessionsCallback; lpContext: Pointer;
16080
        dwFlags: DWORD) : HResult; stdcall;
16081
    function GetCaps(var lpDPCaps: TDPCaps) : HResult; stdcall;
16082
    function GetMessageCount(pidID: TDPID; var lpdwCount: DWORD) : HResult; stdcall;
16083
    function GetPlayerCaps(pidID: TDPID; var lpDPPlayerCaps: TDPCaps) : HResult; stdcall;
16084
    function GetPlayerName(pidID: TDPID; lpPlayerFriendlyName: PChar;
16085
        var lpdwFriendlyNameLength: DWORD; lpPlayerFormalName: PChar;
16086
        var lpdwFormalNameLength: DWORD) : HResult; stdcall;
16087
    function Initialize(const lpGUID: TGUID) : HResult; stdcall;
16088
    function Open(var lpSDesc: TDPSessionDesc) : HResult; stdcall;
1 daniel-mar 16089
    function Receive(var lppidFrom, lppidTo: TDPID; dwFlags: DWORD;
4 daniel-mar 16090
        var lpvBuffer; var lpdwSize: DWORD) : HResult; stdcall;
16091
    function SaveSession(lpSessionName: PChar) : HResult; stdcall;
1 daniel-mar 16092
    function Send(pidFrom: TDPID; pidTo: TDPID; dwFlags: DWORD;
4 daniel-mar 16093
        var lpvBuffer; dwBuffSize: DWORD) : HResult; stdcall;
16094
    function SetPlayerName(pidID: TDPID; lpPlayerFriendlyName: PChar;
16095
        lpPlayerFormalName: PChar) : HResult; stdcall;
1 daniel-mar 16096
  end;
16097
 
4 daniel-mar 16098
(*
16099
 * GUIDS used by DirectPlay objects
16100
 *)
16101
  IID_IDirectPlay2W = IDirectPlay2W;
16102
  IID_IDirectPlay2A = IDirectPlay2A;
16103
  IID_IDirectPlay2 =  IDirectPlay2;
1 daniel-mar 16104
 
4 daniel-mar 16105
  IID_IDirectPlay3W = IDirectPlay3W;
16106
  IID_IDirectPlay3A = IDirectPlay3A;
16107
  IID_IDirectPlay3 =  IDirectPlay3;
1 daniel-mar 16108
 
4 daniel-mar 16109
  IID_IDirectPlay4W = IDirectPlay4W;
16110
  IID_IDirectPlay4A = IDirectPlay4A;
16111
  IID_IDirectPlay4 =  IDirectPlay4;
16112
 
16113
  IID_IDirectPlay = IDirectPlay;
16114
 
16115
var
16116
  DirectPlayCreate : function (lpGUID: PGUID; out lplpDP: IDirectPlay;
16117
      pUnk: IUnknown) : HResult; stdcall;
16118
 
1 daniel-mar 16119
(*==========================================================================;
16120
 *
16121
 *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
16122
 *
16123
 *  File:       dplobby.h
16124
 *  Content:    DirectPlayLobby include file
16125
 ***************************************************************************)
16126
 
4 daniel-mar 16127
(*
16128
 * GUIDS used by DirectPlay objects
16129
 *)
1 daniel-mar 16130
 
16131
const
4 daniel-mar 16132
(* {2FE8F810-B2A5-11d0-A787-0000F803ABFC} *)
16133
  CLSID_DirectPlayLobby: TGUID =
16134
      (D1:$2fe8f810;D2:$b2a5;D3:$11d0;D4:($a7,$87,$00,$00,$f8,$3,$ab,$fc));
1 daniel-mar 16135
 
4 daniel-mar 16136
(****************************************************************************
16137
 *
16138
 * IDirectPlayLobby Structures
16139
 *
16140
 * Various structures used to invoke DirectPlayLobby.
16141
 *
16142
 ****************************************************************************)
1 daniel-mar 16143
 
16144
type
4 daniel-mar 16145
(*
16146
 * TDPLAppInfo
16147
 * Used to hold information about a registered DirectPlay
16148
 * application
16149
 *)
1 daniel-mar 16150
  PDPLAppInfo = ^TDPLAppInfo;
4 daniel-mar 16151
  TDPLAppInfo = packed record
1 daniel-mar 16152
    dwSize: DWORD;            // Size of this structure
16153
    guidApplication: TGUID;   // GUID of the Application
16154
    case Integer of           // Pointer to the Application Name
10 daniel-mar 16155
      0: (lpszAppName: PChar);
4 daniel-mar 16156
      1: (lpszAppNameW: PWideChar);
16157
      3: (lpszAppNameA: PChar);
1 daniel-mar 16158
  end;
16159
 
4 daniel-mar 16160
(*
16161
 * TDPCompoundAddressElement
16162
 *
16163
 * An array of these is passed to CreateCompoundAddresses()
16164
 *)
1 daniel-mar 16165
  PDPCompoundAddressElement = ^TDPCompoundAddressElement;
4 daniel-mar 16166
  TDPCompoundAddressElement = packed record
1 daniel-mar 16167
    guidDataType: TGUID;
16168
    dwDataSize: DWORD;
16169
    lpData: Pointer;
4 daniel-mar 16170
  end;                                
1 daniel-mar 16171
 
4 daniel-mar 16172
(*
16173
 * TDPApplicationDesc
16174
 * Used to register a DirectPlay application
16175
 *)
1 daniel-mar 16176
  PDPApplicationDesc = ^TDPApplicationDesc;
4 daniel-mar 16177
  TDPApplicationDesc = packed record
1 daniel-mar 16178
    dwSize: DWORD;
16179
    dwFlags: DWORD;
4 daniel-mar 16180
    case integer of
10 daniel-mar 16181
 
4 daniel-mar 16182
           guidApplication: TGUID;
10 daniel-mar 16183
           lpszFilename: PChar;
16184
           lpszCommandLine: PChar;
16185
           lpszPath: PChar;
16186
           lpszCurrentDirectory: PChar;
4 daniel-mar 16187
           lpszDescriptionA: PAnsiChar;
16188
           lpszDescriptionW: PWideChar);
16189
      1 : (lpszApplicationNameA: PAnsiChar;
16190
           filler1: TGUID;
16191
           lpszFilenameA: PAnsiChar;
16192
           lpszCommandLineA: PAnsiChar;
16193
           lpszPathA: PAnsiChar;
16194
           lpszCurrentDirectoryA: PAnsiChar);
16195
      2 : (lpszApplicationNameW: PWideChar;
16196
           filler2: TGUID;
16197
           lpszFilenameW: PWideChar;
16198
           lpszCommandLineW: PWideChar;
16199
           lpszPathW: PWideChar;
16200
           lpszCurrentDirectoryW: PWideChar);
1 daniel-mar 16201
  end;
16202
 
4 daniel-mar 16203
(*
16204
 * TDPApplicationDesc2
16205
 * Used to register a DirectPlay application
16206
 *)
1 daniel-mar 16207
  PDPApplicationDesc2 = ^TDPApplicationDesc2;
4 daniel-mar 16208
  TDPApplicationDesc2 = packed record
1 daniel-mar 16209
    dwSize: DWORD;
16210
    dwFlags: DWORD;
4 daniel-mar 16211
    case integer of
10 daniel-mar 16212
 
4 daniel-mar 16213
           guidApplication: TGUID;
10 daniel-mar 16214
           lpszFilename: PChar;
16215
           lpszCommandLine: PChar;
16216
           lpszPath: PChar;
16217
           lpszCurrentDirectory: PChar;
4 daniel-mar 16218
           lpszDescriptionA: PAnsiChar;
16219
           lpszDescriptionW: PWideChar;
10 daniel-mar 16220
           lpszAppLauncherName: PChar);
4 daniel-mar 16221
      1 : (lpszApplicationNameA: PAnsiChar;
16222
           filler1: TGUID;
16223
           lpszFilenameA: PAnsiChar;
16224
           lpszCommandLineA: PAnsiChar;
16225
           lpszPathA: PAnsiChar;
16226
           lpszCurrentDirectoryA: PAnsiChar;
16227
           filler3: PChar;
16228
           filler4: PChar;
16229
           lpszAppLauncherNameA: PAnsiChar);
16230
      2 : (lpszApplicationNameW: PWideChar;
16231
           filler2: TGUID;
16232
           lpszFilenameW: PWideChar;
16233
           lpszCommandLineW: PWideChar;
16234
           lpszPathW: PWideChar;
16235
           lpszCurrentDirectoryW: PWideChar;
16236
           filler5: PChar;
16237
           filler6: PChar;
16238
           lpszAppLauncherNameW: PWideChar);
1 daniel-mar 16239
  end;
16240
 
16241
 
4 daniel-mar 16242
(****************************************************************************
16243
 *
16244
 * Enumeration Method Callback Prototypes
16245
 *
16246
 ****************************************************************************)
1 daniel-mar 16247
 
4 daniel-mar 16248
(*
16249
 * Callback for EnumAddress()
16250
 *)
16251
  TDPEnumAdressCallback = function(const guidDataType: TGUID;
16252
      dwDataSize: DWORD; lpData: Pointer; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 16253
 
4 daniel-mar 16254
(*
16255
 * Callback for EnumAddressTypes()
16256
 *)
1 daniel-mar 16257
  TDPLEnumAddressTypesCallback = function(const guidDataType: TGUID;
4 daniel-mar 16258
      lpContext: Pointer; dwFlags: DWORD) : BOOL; stdcall;
1 daniel-mar 16259
 
4 daniel-mar 16260
(*
16261
 * Callback for EnumLocalApplications()
16262
 *)
1 daniel-mar 16263
  TDPLEnumLocalApplicationsCallback = function(const lpAppInfo: TDPLAppInfo;
4 daniel-mar 16264
      lpContext: Pointer; dwFlags: DWORD) : BOOL; stdcall;
1 daniel-mar 16265
 
4 daniel-mar 16266
(****************************************************************************
16267
 *
16268
 * IDirectPlayLobby (and IDirectPlayLobbyA) Interface
16269
 *
16270
 ****************************************************************************)
1 daniel-mar 16271
 
16272
type
4 daniel-mar 16273
  IDirectPlayLobbyAW = interface (IUnknown)
16274
    (*** IDirectPlayLobby methods ***)
1 daniel-mar 16275
    function Connect(dwFlags: DWORD; out lplpDP: IDirectPlay2;
4 daniel-mar 16276
        pUnk: IUnknown) : HResult; stdcall;
16277
    function CreateAddress(const guidSP, guidDataType: TGUID; var lpData;
16278
        dwDataSize: DWORD; var lpAddress; var lpdwAddressSize: DWORD) : HResult; stdcall;
16279
    function EnumAddress(lpEnumAddressCallback: TDPEnumAdressCallback;
16280
        var lpAddress; dwAddressSize: DWORD; lpContext : Pointer) : HResult; stdcall;
1 daniel-mar 16281
    function EnumAddressTypes(lpEnumAddressTypeCallback:
16282
        TDPLEnumAddressTypesCallback; const guidSP: TGUID; lpContext: Pointer;
4 daniel-mar 16283
        dwFlags: DWORD) : HResult; stdcall;
16284
    function EnumLocalApplications(lpEnumLocalAppCallback: TDPLEnumLocalApplicationsCallback;
16285
        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
16286
    function GetConnectionSettings(dwAppID: DWORD; lpData: PDPLConnection;
16287
        var lpdwDataSize: DWORD) : HResult; stdcall;
1 daniel-mar 16288
    function ReceiveLobbyMessage(dwFlags: DWORD; dwAppID: DWORD;
4 daniel-mar 16289
        var lpdwMessageFlags: DWORD; lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
1 daniel-mar 16290
    function RunApplication(dwFlags: DWORD; var lpdwAppId: DWORD;
4 daniel-mar 16291
        const lpConn: TDPLConnection; hReceiveEvent: THandle) : HResult; stdcall;
1 daniel-mar 16292
    function SendLobbyMessage(dwFlags: DWORD; dwAppID: DWORD; const lpData;
4 daniel-mar 16293
        dwDataSize: DWORD) : HResult; stdcall;
1 daniel-mar 16294
    function SetConnectionSettings(dwFlags: DWORD; dwAppID: DWORD;
4 daniel-mar 16295
        var lpConn: TDPLConnection) : HResult; stdcall;
1 daniel-mar 16296
    function SetLobbyMessageEvent(dwFlags: DWORD; dwAppID: DWORD;
4 daniel-mar 16297
        hReceiveEvent: THandle) : HResult; stdcall;
1 daniel-mar 16298
  end;
16299
 
4 daniel-mar 16300
  IDirectPlayLobbyW = interface (IDirectPlayLobbyAW)
16301
    ['{AF465C71-9588-11CF-A020-00AA006157AC}']
1 daniel-mar 16302
  end;
4 daniel-mar 16303
  IDirectPlayLobbyA = interface (IDirectPlayLobbyAW)
16304
    ['{26C66A70-B367-11cf-A024-00AA006157AC}']
16305
  end;
1 daniel-mar 16306
 
4 daniel-mar 16307
{$IFDEF UNICODE}
16308
  IDirectPlayLobby = IDirectPlayLobbyW;
16309
{$ELSE}
16310
  IDirectPlayLobby = IDirectPlayLobbyA;
16311
{$ENDIF}
1 daniel-mar 16312
 
4 daniel-mar 16313
 
16314
(****************************************************************************
16315
 *
16316
 * IDirectPlayLobby2 (and IDirectPlayLobby2A) Interface
16317
 *
16318
 ****************************************************************************)
16319
 
16320
  IDirectPlayLobby2AW = interface(IDirectPlayLobbyAW)
16321
    (*** IDirectPlayLobby2 methods ***)
1 daniel-mar 16322
    function CreateCompoundAddress(const lpElements: TDPCompoundAddressElement;
4 daniel-mar 16323
        dwElementCount: DWORD; lpAddress: Pointer; var lpdwAddressSize: DWORD) : HResult; stdcall;
1 daniel-mar 16324
  end;
16325
 
4 daniel-mar 16326
  IDirectPlayLobby2W = interface (IDirectPlayLobby2AW)
16327
    ['{0194C220-A303-11D0-9C4F-00A0C905425E}']
1 daniel-mar 16328
  end;
4 daniel-mar 16329
  IDirectPlayLobby2A = interface (IDirectPlayLobby2AW)
16330
    ['{1BB4AF80-A303-11d0-9C4F-00A0C905425E}']
16331
  end;
1 daniel-mar 16332
 
4 daniel-mar 16333
{$IFDEF UNICODE}
16334
  IDirectPlayLobby2 = IDirectPlayLobby2W;
16335
{$ELSE}
16336
  IDirectPlayLobby2 = IDirectPlayLobby2A;
16337
{$ENDIF}
1 daniel-mar 16338
 
4 daniel-mar 16339
(****************************************************************************
16340
 *
16341
 * IDirectPlayLobby3 (and IDirectPlayLobby3A) Interface
16342
 *
16343
 ****************************************************************************)
16344
 
16345
  IDirectPlayLobby3AW = interface(IDirectPlayLobby2AW)
16346
    (*** IDirectPlayLobby3 methods ***)
16347
    function ConnectEx(dwFlags: DWORD; const riid: TGUID;
16348
        out lplpDP; pUnk: IUnknown) : HResult; stdcall;
16349
    function RegisterApplication(dwFlags: DWORD;
16350
        var lpAppDesc: TDPApplicationDesc) : HResult; stdcall;
16351
    function UnregisterApplication(dwFlags: DWORD;
16352
         const guidApplication: TGUID) : HResult; stdcall;
16353
    function WaitForConnectionSettings(dwFlags: DWORD) : HResult; stdcall;
16354
        end;
16355
 
16356
  IDirectPlayLobby3W = interface (IDirectPlayLobby3AW)
1 daniel-mar 16357
    ['{2DB72490-652C-11d1-A7A8-0000F803ABFC}']
16358
  end;
4 daniel-mar 16359
  IDirectPlayLobby3A = interface (IDirectPlayLobby3AW)
1 daniel-mar 16360
    ['{2DB72491-652C-11d1-A7A8-0000F803ABFC}']
16361
  end;
16362
 
4 daniel-mar 16363
{$IFDEF UNICODE}
16364
  IDirectPlayLobby3 = IDirectPlayLobby3W;
16365
{$ELSE}
16366
  IDirectPlayLobby3 = IDirectPlayLobby3A;
16367
{$ENDIF}
1 daniel-mar 16368
 
4 daniel-mar 16369
  IID_IDirectPlayLobbyW =  IDirectPlayLobbyW;
16370
  IID_IDirectPlayLobbyA =  IDirectPlayLobbyA;
16371
  IID_IDirectPlayLobby =   IDirectPlayLobby;
1 daniel-mar 16372
 
4 daniel-mar 16373
  IID_IDirectPlayLobby2W = IDirectPlayLobby2W;
16374
  IID_IDirectPlayLobby2A = IDirectPlayLobby2A;
16375
  IID_IDirectPlayLobby2 =  IDirectPlayLobby2;
1 daniel-mar 16376
 
4 daniel-mar 16377
  IID_IDirectPlayLobby3W = IDirectPlayLobby3W;
16378
  IID_IDirectPlayLobby3A = IDirectPlayLobby3A;
16379
  IID_IDirectPlayLobby3 =  IDirectPlayLobby3;
16380
 
16381
(****************************************************************************
16382
 *
16383
 * DirectPlayLobby API Prototypes
16384
 *
16385
 ****************************************************************************)
16386
 
16387
var
16388
  DirectPlayLobbyCreateW : function (lpguidSP: PGUID; out lplpDPL:
16389
      IDirectPlayLobbyW; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
16390
  DirectPlayLobbyCreateA : function (lpguidSP: PGUID; out lplpDPL:
16391
      IDirectPlayLobbyA; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
16392
  DirectPlayLobbyCreate : function (lpguidSP: PGUID; out lplpDPL:
16393
      IDirectPlayLobby; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
16394
 
1 daniel-mar 16395
const
4 daniel-mar 16396
(****************************************************************************
16397
 *
16398
 * DirectPlayLobby Flags
16399
 *
16400
 ****************************************************************************)
1 daniel-mar 16401
 
4 daniel-mar 16402
(*
16403
 *  This flag is used by IDirectPlayLobby.WaitForConnectionSettings to
16404
 *  cancel a current wait that is in progress.
16405
 *)
16406
 DPLWAIT_CANCEL = $00000001;
1 daniel-mar 16407
 
4 daniel-mar 16408
(*
16409
 *      This is a message flag used by ReceiveLobbyMessage.  It can be
16410
 *      returned in the dwMessageFlags parameter to indicate a message from
16411
 *      the system.
16412
 *)
16413
  DPLMSG_SYSTEM = $00000001;
1 daniel-mar 16414
 
4 daniel-mar 16415
(*
16416
 *      This is a message flag used by ReceiveLobbyMessage and SendLobbyMessage.
16417
 *  It is used to indicate that the message is a standard lobby message.
16418
 *  TDPLMsg_SetProperty, TDPLMsg_SetPropertyResponse, TDPLMsg_GetProperty,
16419
 *      TDPLMsg_GetPropertyResponse
16420
 *)
16421
  DPLMSG_STANDARD = $00000002;
1 daniel-mar 16422
 
4 daniel-mar 16423
type
16424
(****************************************************************************
16425
 *
16426
 * DirectPlayLobby messages and message data structures
16427
 *
16428
 * All system messages have a dwMessageFlags value of DPLMSG_SYSTEM returned
16429
 * from a call to ReceiveLobbyMessage.
16430
 *
16431
 * All standard messages have a dwMessageFlags value of DPLMSG_STANDARD returned
16432
 * from a call to ReceiveLobbyMessage.
16433
 *
16434
 ****************************************************************************)
1 daniel-mar 16435
 
4 daniel-mar 16436
(*
16437
 * TDPLMsg_Generic
16438
 * Generic message structure used to identify the message type.
16439
 *)
1 daniel-mar 16440
  PDPLMsg_Generic = ^TDPLMsg_Generic;
4 daniel-mar 16441
  TDPLMsg_Generic = packed record
1 daniel-mar 16442
    dwType: DWORD;   // Message type
16443
  end;
16444
 
4 daniel-mar 16445
(*
16446
 * TDPLMsg_SystemMessage
16447
 * Generic message format for all system messages --
16448
 * DPLSYS_CONNECTIONSETTINGSREAD, DPLSYS_DPLYCONNECTSUCCEEDED,
16449
 * DPLSYS_DPLAYCONNECTFAILED, DPLSYS_APPTERMINATED, DPLSYS_NEWCONNECTIONSETTINGS
16450
 *)
1 daniel-mar 16451
  PDPLMsg_SystemMessage = ^TDPLMsg_SystemMessage;
4 daniel-mar 16452
  TDPLMsg_SystemMessage = packed record
16453
    dwType: DWORD;         // Message type
16454
    guidInstance: TGUID;    // Instance GUID of the dplay session the message corresponds to
1 daniel-mar 16455
  end;
16456
 
4 daniel-mar 16457
(*
16458
 *  TDPLMsg_SetProperty
16459
 *  Standard message sent by an application to a lobby to set a
16460
 *  property
16461
 *)
1 daniel-mar 16462
  PDPLMsg_SetProperty = ^TDPLMsg_SetProperty;
4 daniel-mar 16463
  TDPLMsg_SetProperty = packed record
1 daniel-mar 16464
    dwType: DWORD;                           // Message type
16465
    dwRequestID: DWORD;                      // Request ID (DPL_NOCONFIRMATION if no confirmation desired)
16466
    guidPlayer: TGUID;                       // Player GUID
16467
    guidPropertyTag: TGUID;                  // Property GUID
16468
    dwDataSize: DWORD;                       // Size of data
4 daniel-mar 16469
    dwPropertyData: array[0..0] of DWORD;    // Buffer containing data
1 daniel-mar 16470
  end;
16471
 
16472
const
16473
  DPL_NOCONFIRMATION = 0;
16474
 
16475
type
4 daniel-mar 16476
(*
16477
 *  TDPLMsg_SetPropertyResponse
16478
 *  Standard message returned by a lobby to confirm a
16479
 *  TDPLMsg_SetProperty message.
16480
 *)
1 daniel-mar 16481
  PDPLMsg_SetPropertyResponse = ^TDPLMsg_SetPropertyResponse;
4 daniel-mar 16482
  TDPLMsg_SetPropertyResponse = packed record
1 daniel-mar 16483
    dwType: DWORD;            // Message type
16484
    dwRequestID: DWORD;       // Request ID
16485
    guidPlayer: TGUID;        // Player GUID
16486
    guidPropertyTag: TGUID;   // Property GUID
16487
    hr: HResult;              // Return Code
16488
  end;
16489
 
4 daniel-mar 16490
(*
16491
 *  TDPLMsg_GetProperty
16492
 *  Standard message sent by an application to a lobby to request
16493
 *      the current value of a property
16494
 *)
1 daniel-mar 16495
  PDPLMsg_GetProperty = ^TDPLMsg_GetProperty;
4 daniel-mar 16496
  TDPLMsg_GetProperty = packed record
1 daniel-mar 16497
    dwType: DWORD;            // Message type
16498
    dwRequestID: DWORD;       // Request ID
16499
    guidPlayer: TGUID;        // Player GUID
16500
    guidPropertyTag: TGUID;   // Property GUID
16501
  end;
4 daniel-mar 16502
  LPDPLMSG_GETPROPERTY = ^TDPLMsg_GetProperty;
1 daniel-mar 16503
 
4 daniel-mar 16504
(*
16505
 *  TDPLMsg_GetPropertyResponse
16506
 *  Standard message returned by a lobby in response to a
16507
 *      TDPLMsg_GetProperty message.
16508
 *)
1 daniel-mar 16509
  PDPLMsg_GetPropertyResponse = ^TDPLMsg_GetPropertyResponse;
4 daniel-mar 16510
  TDPLMsg_GetPropertyResponse = packed record
1 daniel-mar 16511
    dwType: DWORD;                           // Message type
16512
    dwRequestID: DWORD;                      // Request ID
16513
    guidPlayer: TGUID;                       // Player GUID
16514
    guidPropertyTag: TGUID;                  // Property GUID
16515
    hr: HResult;                             // Return Code
16516
    dwDataSize: DWORD;                       // Size of data
16517
    dwPropertyData: array[0..0] of DWORD;    // Buffer containing data
16518
  end;
16519
 
4 daniel-mar 16520
(*
16521
 *  TDPLMsg_NewSessionHost
16522
 *  Standard message returned by a lobby in response to a
16523
 *  the session host migrating to a new client
16524
 *)
1 daniel-mar 16525
  PDPLMsg_NewSessionHost = ^TDPLMsg_NewSessionHost;
4 daniel-mar 16526
  TDPLMsg_NewSessionHost = packed record
1 daniel-mar 16527
    dwType: DWORD;            // Message type
4 daniel-mar 16528
    guidInstance: TGUID;      // Property GUID
1 daniel-mar 16529
  end;
16530
 
4 daniel-mar 16531
const
16532
(******************************************
16533
 *
16534
 *      DirectPlay Lobby message dwType values
16535
 *
16536
 *****************************************)
1 daniel-mar 16537
 
4 daniel-mar 16538
(*
16539
 *  The application has read the connection settings.
16540
 *  It is now O.K. for the lobby client to release
16541
 *  its IDirectPlayLobby interface.
16542
 *)
1 daniel-mar 16543
  DPLSYS_CONNECTIONSETTINGSREAD = $00000001;
16544
 
4 daniel-mar 16545
(*
16546
 *  The application's call to DirectPlayConnect failed
16547
 *)
16548
  DPLSYS_DPLAYCONNECTFAILED = $00000002;
1 daniel-mar 16549
 
4 daniel-mar 16550
(*
16551
 *  The application has created a DirectPlay session.
16552
 *)
16553
  DPLSYS_DPLAYCONNECTSUCCEEDED = $00000003;
1 daniel-mar 16554
 
4 daniel-mar 16555
(*
16556
 *  The application has terminated.
16557
 *)
16558
  DPLSYS_APPTERMINATED = $00000004;
1 daniel-mar 16559
 
4 daniel-mar 16560
(*
16561
 *  The message is a TDPLMsg_SetProperty message.
16562
 *)
16563
  DPLSYS_SETPROPERTY = $00000005;
16564
 
16565
(*
16566
 *  The message is a TDPLMsg_SetPropertyResponse message.
16567
 *)
16568
  DPLSYS_SETPROPERTYRESPONSE = $00000006;
16569
 
16570
(*
16571
 *  The message is a TDPLMsg_GetProperty message.
16572
 *)
16573
  DPLSYS_GETPROPERTY = $00000007;
16574
 
16575
(*
16576
 *  The message is a TDPLMsg_GetPropertyResponse message.
16577
 *)
16578
  DPLSYS_GETPROPERTYRESPONSE = $00000008;
16579
 
16580
(*
16581
 *  The message is a TDPLMsg_NewSessionHost message.
16582
 *)
16583
  DPLSYS_NEWSESSIONHOST = $00000009;
16584
 
16585
(*
16586
 *  New connection settings are available.
16587
 *)
16588
  DPLSYS_NEWCONNECTIONSETTINGS = $0000000A;
16589
 
16590
(****************************************************************************
16591
 *
16592
 * DirectPlay defined property GUIDs and associated data structures
16593
 *
16594
 ****************************************************************************)
16595
 
16596
(*
16597
 * DPLPROPERTY_MessagesSupported
16598
 *
16599
 * Request whether the lobby supports standard.  Lobby with respond with either
16600
 * TRUE or FALSE or may not respond at all.
16601
 *
16602
 * Property data is a single BOOL with TRUE or FALSE
16603
 *)
16604
// {762CCDA1-D916-11d0-BA39-00C04FD7ED67}
16605
  DPLPROPERTY_MessagesSupported: TGUID =
16606
      (D1:$762ccda1;D2:$d916;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
16607
 
16608
(*
16609
 * DPLPROPERTY_LobbyGuid
16610
 *
16611
 * Request the GUID that identifies the lobby software that the application
16612
 * is communicating with.
16613
 *
16614
 * Property data is a single GUID.
16615
 *)
16616
// {F56920A0-D218-11d0-BA39-00C04FD7ED67}
16617
  DPLPROPERTY_LobbyGuid: TGUID =
16618
      (D1:$F56920A0;D2:$D218;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
16619
 
16620
(*
16621
 * DPLPROPERTY_PlayerGuid
16622
 *
16623
 * Request the GUID that identifies the player on this machine for sending
16624
 * property data back to the lobby.
16625
 *
16626
 * Property data is the DPLDATA_PLAYERDATA structure
16627
 *)
16628
// {B4319322-D20D-11d0-BA39-00C04FD7ED67}
16629
  DPLPROPERTY_PlayerGuid: TGUID =
16630
      (D1:$b4319322;D2:$d20d;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
16631
 
1 daniel-mar 16632
type
4 daniel-mar 16633
(*
16634
 * TDPLData_PlayerGUID
16635
 *
16636
 * Data structure to hold the GUID of the player and player creation flags
16637
 * from the lobby.
16638
 *)
1 daniel-mar 16639
  PDPLData_PlayerGUID = ^TDPLData_PlayerGUID;
4 daniel-mar 16640
  TDPLData_PlayerGUID = packed record
1 daniel-mar 16641
    guidPlayer: TGUID;
16642
    dwPlayerFlags: DWORD;
16643
  end;
16644
 
16645
const
4 daniel-mar 16646
(*
16647
 * DPLPROPERTY_PlayerScore
16648
 *
16649
 * Used to send an array of long integers to the lobby indicating the
16650
 * score of a player.
16651
 *
16652
 * Property data is the TDPLData_PlayerScore structure.
16653
 *)
16654
// {48784000-D219-11d0-BA39-00C04FD7ED67}
16655
  DPLPROPERTY_PlayerScore: TGUID =
16656
      (D1:$48784000;D2:$d219;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
1 daniel-mar 16657
 
16658
type
4 daniel-mar 16659
(*
16660
 * TDPLData_PlayerScore
16661
 *
16662
 * Data structure to hold an array of long integers representing a player score.
16663
 * Application must allocate enough memory to hold all the scores.
16664
 *)
1 daniel-mar 16665
  PDPLData_PlayerScore = ^TDPLData_PlayerScore;
4 daniel-mar 16666
  TDPLData_PlayerScore = packed record
1 daniel-mar 16667
    dwScoreCount: DWORD;
4 daniel-mar 16668
    Score: array[0..0] of LongInt;
1 daniel-mar 16669
  end;
16670
 
4 daniel-mar 16671
(****************************************************************************
16672
 *
16673
 * DirectPlay Address ID's
16674
 *
16675
 ****************************************************************************)
1 daniel-mar 16676
 
4 daniel-mar 16677
(* DirectPlay Address
16678
 *
16679
 * A DirectPlay address consists of multiple chunks of data, each tagged
16680
 * with a GUID signifying the type of data in the chunk. The chunk also
16681
 * has a length so that unknown chunk types can be skipped.
16682
 *
16683
 * The EnumAddress() function is used to parse these address data chunks.
16684
 *)
1 daniel-mar 16685
 
4 daniel-mar 16686
(*
16687
 * TDPAddress
16688
 *
16689
 * Header for block of address data elements
16690
 *)
1 daniel-mar 16691
  PDPAddress = ^TDPAddress;
4 daniel-mar 16692
  TDPAddress = packed record
1 daniel-mar 16693
    guidDataType: TGUID;
16694
    dwDataSize: DWORD;
16695
  end;
16696
 
16697
const
4 daniel-mar 16698
(*
16699
 * DPAID_TotalSize
16700
 *
16701
 * Chunk is a DWORD containing size of entire TDPAddress structure
16702
 *)
1 daniel-mar 16703
 
4 daniel-mar 16704
// {1318F560-912C-11d0-9DAA-00A0C90A43CB}
16705
  DPAID_TotalSize: TGUID =
16706
      (D1:$1318f560;D2:$912c;D3:$11d0;D4:($9d,$aa,$00,$a0,$c9,$a,$43,$cb));
1 daniel-mar 16707
 
4 daniel-mar 16708
(*
16709
 * DPAID_ServiceProvider
16710
 *
16711
 * Chunk is a GUID describing the service provider that created the chunk.
16712
 * All addresses must contain this chunk.
16713
 *)
1 daniel-mar 16714
 
4 daniel-mar 16715
// {07D916C0-E0AF-11cf-9C4E-00A0C905425E}
16716
  DPAID_ServiceProvider: TGUID =
16717
      (D1:$7d916c0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
16718
 
16719
(*
16720
 * DPAID_LobbyProvider
16721
 *
16722
 * Chunk is a GUID describing the lobby provider that created the chunk.
16723
 * All addresses must contain this chunk.
16724
 *)
16725
 
16726
// {59B95640-9667-11d0-A77D-0000F803ABFC}
16727
  DPAID_LobbyProvider: TGUID =
16728
      (D1:$59b95640;D2:$9667;D3:$11d0;D4:($a7,$7d,$00,$00,$f8,$3,$ab,$fc));
16729
 
16730
(*
16731
 * DPAID_Phone and DPAID_PhoneW
16732
 *
16733
 * Chunk is a string containing a phone number (i.e. "1-800-555-1212")
16734
 * in ANSI or UNICODE format
16735
 *)
16736
 
16737
// {78EC89A0-E0AF-11cf-9C4E-00A0C905425E}
16738
  DPAID_Phone: TGUID =
16739
      (D1:$78ec89a0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
16740
 
16741
// {BA5A7A70-9DBF-11d0-9CC1-00A0C905425E}
16742
  DPAID_PhoneW: TGUID =
16743
      (D1:$ba5a7a70;D2:$9dbf;D3:$11d0;D4:($9c,$c1,$00,$a0,$c9,$5,$42,$5e));
16744
 
16745
(*
16746
 * DPAID_Modem and DPAID_ModemW
16747
 *
16748
 * Chunk is a string containing a modem name registered with TAPI
16749
 * in ANSI or UNICODE format
16750
 *)
16751
 
16752
// {F6DCC200-A2FE-11d0-9C4F-00A0C905425E}
16753
  DPAID_Modem: TGUID =
16754
      (D1:$f6dcc200;D2:$a2fe;D3:$11d0;D4:($9c,$4f,$00,$a0,$c9,$5,$42,$5e));
16755
 
16756
// {01FD92E0-A2FF-11d0-9C4F-00A0C905425E}
16757
  DPAID_ModemW: TGUID =
16758
      (D1:$1fd92e0;D2:$a2ff;D3:$11d0;D4:($9c,$4f,$00,$a0,$c9,$5,$42,$5e));
16759
 
16760
(*
16761
 * DPAID_Inet and DPAID_InetW
16762
 *
16763
 * Chunk is a string containing a TCP/IP host name or an IP address
16764
 * (i.e. "dplay.microsoft.com" or "137.55.100.173") in ANSI or UNICODE format
16765
 *)
16766
 
16767
// {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E}
16768
  DPAID_INet: TGUID =
16769
      (D1:$c4a54da0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
16770
 
16771
// {E63232A0-9DBF-11d0-9CC1-00A0C905425E}
16772
  DPAID_INetW: TGUID =
16773
      (D1:$e63232a0;D2:$9dbf;D3:$11d0;D4:($9c,$c1,$00,$a0,$c9,$5,$42,$5e));
16774
 
16775
(*
16776
 * DPAID_InetPort
16777
 *
16778
 * Chunk is the port number used for creating the apps TCP and UDP sockets.
16779
 * WORD value (i.e. 47624)
16780
 *)
16781
 
16782
// {E4524541-8EA5-11d1-8A96-006097B01411}
16783
  DPAID_INetPort: TGUID =
16784
      (D1:$e4524541;D2:$8ea5;D3:$11d1;D4:($8a,$96,$00,$60,$97,$b0,$14,$11));
16785
 
16786
//@@BEGIN_MSINTERNAL
16787
(*
16788
 * DPAID_MaxMessageSize
16789
 *
16790
 * Tells DPLAY what the maximum allowed message size is.  Enables SPs to
16791
 *      combat Denial of Service attacks
16792
 *)
16793
 
16794
 // this terrible hack is needed so the SP can work with the Elmer build.
16795
 // it can be removed when the MSINTERNAL stuff is removed
16796
{$DEFINE MAXMSGSIZEGUIDDEFINED}
16797
 
16798
// {F5D09980-F0C4-11d1-8326-006097B01411}
16799
  DPAID_MaxMessageSize: TGUID =
16800
      (D1:$f5d09980;D2:$f0c4;D3:$11d1;D4:($83,$26,$00,$60,$97,$b0,$14,$11));
16801
//@@END_MSINTERNAL
16802
 
16803
(*
16804
 * TDPComPortAddress
16805
 *
16806
 * Used to specify com port settings. The constants that define baud rate,
16807
 * stop bits and parity are defined in WINBASE.H. The constants for flow
16808
 * control are given below.
16809
 *)
16810
 
16811
  DPCPA_NOFLOW       = 0;           // no flow control
16812
  DPCPA_XONXOFFFLOW  = 1;           // software flow control
16813
  DPCPA_RTSFLOW      = 2;           // hardware flow control with RTS
16814
  DPCPA_DTRFLOW      = 3;           // hardware flow control with DTR
16815
  DPCPA_RTSDTRFLOW   = 4;           // hardware flow control with RTS and DTR
16816
 
1 daniel-mar 16817
type
16818
  PDPComPortAddress = ^TDPComPortAddress;
4 daniel-mar 16819
  TDPComPortAddress = packed record
1 daniel-mar 16820
    dwComPort: DWORD;       // COM port to use (1-4)
16821
    dwBaudRate: DWORD;      // baud rate (100-256k)
16822
    dwStopBits: DWORD;      // no. stop bits (1-2)
16823
    dwParity: DWORD;        // parity (none, odd, even, mark)
16824
    dwFlowControl: DWORD;   // flow control (none, xon/xoff, rts, dtr)
16825
  end;
16826
 
16827
const
4 daniel-mar 16828
(*
16829
 * DPAID_ComPort
16830
 *
16831
 * Chunk contains a TDPComPortAddress structure defining the serial port.
16832
 *)
1 daniel-mar 16833
 
4 daniel-mar 16834
// {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E}
16835
  DPAID_ComPort: TGUID =
16836
      (D1:$f2f0ce00;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
1 daniel-mar 16837
 
4 daniel-mar 16838
(****************************************************************************
16839
 *
16840
 *      dplobby 1.0 obsolete definitions
16841
 *      Included for compatibility only.
16842
 *
16843
 ****************************************************************************)
16844
 
1 daniel-mar 16845
  DPLAD_SYSTEM = DPLMSG_SYSTEM;
10 daniel-mar 16846
 
16847
{$ENDIF} // IFDEF UseDirectPlay
4 daniel-mar 16848
 
1 daniel-mar 16849
 
4 daniel-mar 16850
//DirectSetup file
1 daniel-mar 16851
(*==========================================================================
16852
 *
16853
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
16854
 *
16855
 *  File:       dsetup.h
16856
 *  Content:    DirectXSetup, error codes and flags
16857
 *
4 daniel-mar 16858
 *  DirectX 7.0 Delphi adaptation by Erik Unger
16859
 *
16860
 *  Modyfied: 05-Oct-99
16861
 *
16862
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
16863
 *  E-Mail: DelphiDirectX@next-reality.com
16864
 *
1 daniel-mar 16865
 ***************************************************************************)
16866
 
4 daniel-mar 16867
var
16868
  DSetupDLL : HModule;
16869
 
16870
type
16871
  PDLSVersion = ^TDLSVersion;
16872
  TDLSVersion = packed record
16873
    dwVersionMS: DWORD;
16874
    dwVersionLS: DWORD;
16875
  end;
16876
 
16877
 
1 daniel-mar 16878
const
4 daniel-mar 16879
  FOURCC_VERS : array[0..3] of Char = ('v','e','r','s');
1 daniel-mar 16880
 
16881
// DSETUP Error Codes, must remain compatible with previous setup.
16882
  DSETUPERR_SUCCESS_RESTART     = HResult(1);
16883
  DSETUPERR_SUCCESS             = HResult(0);
16884
  DSETUPERR_BADWINDOWSVERSION   = HResult(-1);
16885
  DSETUPERR_SOURCEFILENOTFOUND  = HResult(-2);
16886
  DSETUPERR_BADSOURCESIZE       = HResult(-3);
16887
  DSETUPERR_BADSOURCETIME       = HResult(-4);
16888
  DSETUPERR_NOCOPY              = HResult(-5);
16889
  DSETUPERR_OUTOFDISKSPACE      = HResult(-6);
16890
  DSETUPERR_CANTFINDINF         = HResult(-7);
16891
  DSETUPERR_CANTFINDDIR         = HResult(-8);
16892
  DSETUPERR_INTERNAL            = HResult(-9);
4 daniel-mar 16893
  DSETUPERR_NTWITHNO3D          = HResult(-10);  // REM: obsolete, you'll never see this
1 daniel-mar 16894
  DSETUPERR_UNKNOWNOS           = HResult(-11);
16895
  DSETUPERR_USERHITCANCEL       = HResult(-12);
16896
  DSETUPERR_NOTPREINSTALLEDONNT = HResult(-13);
4 daniel-mar 16897
  DSETUPERR_NEWERVERSION        = HResult(-14);  
1 daniel-mar 16898
 
16899
// DSETUP flags. DirectX 5.0 apps should use these flags only.
16900
  DSETUP_DDRAWDRV     = $00000008;   (* install DirectDraw Drivers           *)
16901
  DSETUP_DSOUNDDRV    = $00000010;   (* install DirectSound Drivers          *)
16902
  DSETUP_DXCORE       = $00010000;   (* install DirectX runtime              *)
16903
  DSETUP_DIRECTX = DSETUP_DXCORE or DSETUP_DDRAWDRV or DSETUP_DSOUNDDRV;
16904
  DSETUP_TESTINSTALL  = $00020000;   (* just test install, don't do anything *)
4 daniel-mar 16905
  DSETUP_USEROLDERFLAG= $02000000;   (* enable return DSETUPERR_NEWERVERSION *)
16906
// Bug #22730
16907
  DSETUP_NTINSTALL              = $00080000;   (* install on Win2K platform *)
1 daniel-mar 16908
 
16909
// These OBSOLETE flags are here for compatibility with pre-DX5 apps only.
16910
// They are present to allow DX3 apps to be recompiled with DX5 and still work.
16911
// DO NOT USE THEM for DX5. They will go away in future DX releases.
16912
  DSETUP_DDRAW         = $00000001; (* OBSOLETE. install DirectDraw           *)
16913
  DSETUP_DSOUND        = $00000002; (* OBSOLETE. install DirectSound          *)
16914
  DSETUP_DPLAY         = $00000004; (* OBSOLETE. install DirectPlay           *)
16915
  DSETUP_DPLAYSP       = $00000020; (* OBSOLETE. install DirectPlay Providers *)
16916
  DSETUP_DVIDEO        = $00000040; (* OBSOLETE. install DirectVideo          *)
16917
  DSETUP_D3D           = $00000200; (* OBSOLETE. install Direct3D             *)
16918
  DSETUP_DINPUT        = $00000800; (* OBSOLETE. install DirectInput          *)
16919
  DSETUP_DIRECTXSETUP  = $00001000; (* OBSOLETE. install DirectXSetup DLL's   *)
16920
  DSETUP_NOUI          = $00002000; (* OBSOLETE. install DirectX with NO UI   *)
16921
  DSETUP_PROMPTFORDRIVERS = $10000000; (* OBSOLETE. prompt when replacing display/audio drivers *)
16922
  DSETUP_RESTOREDRIVERS = $20000000;(* OBSOLETE. restore display/audio drivers *)
16923
 
16924
//******************************************************************
16925
// DirectX Setup Callback mechanism
16926
//******************************************************************
16927
 
16928
// DSETUP Message Info Codes, passed to callback as Reason parameter.
16929
  DSETUP_CB_MSG_NOMESSAGE                 = 0;
16930
  DSETUP_CB_MSG_CANTINSTALL_UNKNOWNOS     = 1;
16931
  DSETUP_CB_MSG_CANTINSTALL_NT            = 2;
16932
  DSETUP_CB_MSG_CANTINSTALL_BETA          = 3;
16933
  DSETUP_CB_MSG_CANTINSTALL_NOTWIN32      = 4;
16934
  DSETUP_CB_MSG_CANTINSTALL_WRONGLANGUAGE = 5;
16935
  DSETUP_CB_MSG_CANTINSTALL_WRONGPLATFORM = 6;
16936
  DSETUP_CB_MSG_PREINSTALL_NT             = 7;
16937
  DSETUP_CB_MSG_NOTPREINSTALLEDONNT       = 8;
16938
  DSETUP_CB_MSG_SETUP_INIT_FAILED         = 9;
16939
  DSETUP_CB_MSG_INTERNAL_ERROR            = 10;
16940
  DSETUP_CB_MSG_CHECK_DRIVER_UPGRADE      = 11;
16941
  DSETUP_CB_MSG_OUTOFDISKSPACE            = 12;
16942
  DSETUP_CB_MSG_BEGIN_INSTALL             = 13;
16943
  DSETUP_CB_MSG_BEGIN_INSTALL_RUNTIME     = 14;
16944
  DSETUP_CB_MSG_BEGIN_INSTALL_DRIVERS     = 15;
16945
  DSETUP_CB_MSG_BEGIN_RESTORE_DRIVERS     = 16;
16946
  DSETUP_CB_MSG_FILECOPYERROR             = 17;
16947
 
16948
 
16949
  DSETUP_CB_UPGRADE_TYPE_MASK      = $000F;
16950
  DSETUP_CB_UPGRADE_KEEP           = $0001;
16951
  DSETUP_CB_UPGRADE_SAFE           = $0002;
16952
  DSETUP_CB_UPGRADE_FORCE          = $0004;
16953
  DSETUP_CB_UPGRADE_UNKNOWN        = $0008;
16954
 
16955
  DSETUP_CB_UPGRADE_HASWARNINGS    = $0100;
16956
  DSETUP_CB_UPGRADE_CANTBACKUP     = $0200;
16957
 
16958
  DSETUP_CB_UPGRADE_DEVICE_ACTIVE  = $0800;
16959
 
16960
  DSETUP_CB_UPGRADE_DEVICE_DISPLAY = $1000;
16961
  DSETUP_CB_UPGRADE_DEVICE_MEDIA   = $2000;
16962
 
4 daniel-mar 16963
 
1 daniel-mar 16964
type
16965
  PDSetup_CB_UpgradeInfo = ^TDSetup_CB_UpgradeInfo;
16966
  TDSetup_CB_UpgradeInfo = record
16967
    UpgradeFlags: DWORD;
16968
  end;
16969
 
16970
  PDSetup_CB_FileCopyError = ^TDSetup_CB_FileCopyError;
16971
  TDSetup_CB_FileCopyError = record
16972
    dwError: DWORD;
16973
  end;
16974
 
16975
//
16976
// Data Structures
16977
//
16978
  PDirectXRegisterAppA = ^TDirectXRegisterAppA;
16979
  TDirectXRegisterAppA = record
16980
    dwSize: DWORD;
16981
    dwFlags: DWORD;
16982
    lpszApplicationName: PAnsiChar;
16983
    lpGUID: PGUID;
16984
    lpszFilename: PAnsiChar;
16985
    lpszCommandLine: PAnsiChar;
16986
    lpszPath: PAnsiChar;
16987
    lpszCurrentDirectory: PAnsiChar;
16988
  end;
16989
 
16990
  PDirectXRegisterApp2A = ^TDirectXRegisterApp2A;
16991
  TDirectXRegisterApp2A = record
16992
    dwSize: DWORD;
16993
    dwFlags: DWORD;
16994
    lpszApplicationName: PAnsiChar;
16995
    lpGUID: PGUID;
16996
    lpszFilename: PAnsiChar;
16997
    lpszCommandLine: PAnsiChar;
16998
    lpszPath: PAnsiChar;
16999
    lpszCurrentDirectory: PAnsiChar;
17000
    lpszLauncherName: PAnsiChar;
17001
  end;
17002
 
17003
  PDirectXRegisterAppW = ^TDirectXRegisterAppW;
17004
  TDirectXRegisterAppW = record
17005
    dwSize: DWORD;
17006
    dwFlags: DWORD;
17007
    lpszApplicationName: PWideChar;
17008
    lpGUID: PGUID;
17009
    lpszFilename: PWideChar;
17010
    lpszCommandLine: PWideChar;
17011
    lpszPath: PWideChar;
17012
    lpszCurrentDirectory: PWideChar;
17013
  end;
17014
 
17015
  PDirectXRegisterApp2W = ^TDirectXRegisterApp2W;
17016
  TDirectXRegisterApp2W = record
17017
    dwSize: DWORD;
17018
    dwFlags: DWORD;
17019
    lpszApplicationName: PWideChar;
17020
    lpGUID: PGUID;
17021
    lpszFilename: PWideChar;
17022
    lpszCommandLine: PWideChar;
17023
    lpszPath: PWideChar;
17024
    lpszCurrentDirectory: PWideChar;
17025
    lpszLauncherName: PWideChar;
17026
  end;
17027
 
4 daniel-mar 17028
  PDirectXRegisterApp = ^TDirectXRegisterApp;
17029
  PDirectXRegisterApp2 = ^TDirectXRegisterApp2;
17030
{$IFDEF UNICODE}
17031
  TDirectXRegisterApp = TDirectXRegisterAppW;
17032
  TDirectXRegisterApp2 = TDirectXRegisterApp2W;
17033
{$ELSE}
1 daniel-mar 17034
  TDirectXRegisterApp = TDirectXRegisterAppA;
17035
  TDirectXRegisterApp2 = TDirectXRegisterApp2A;
4 daniel-mar 17036
{$ENDIF}
1 daniel-mar 17037
 
4 daniel-mar 17038
//
17039
// API
17040
//
17041
var
17042
  DirectXSetupW : function (hWnd: HWND; lpszRootPath: PWideChar; dwFlags: DWORD) : Integer; stdcall;
17043
  DirectXSetupA : function (hWnd: HWND; lpszRootPath: PAnsiChar; dwFlags: DWORD) : Integer; stdcall;
10 daniel-mar 17044
  DirectXSetup : function (hWnd: HWND; lpszRootPath: PChar; dwFlags: DWORD) : Integer; stdcall;
1 daniel-mar 17045
 
4 daniel-mar 17046
  DirectXDeviceDriverSetupW : function (hWnd: HWND; lpszDriverClass: PWideChar;
17047
     lpszDriverPath: PWideChar; dwFlags: DWORD) : Integer; stdcall;
17048
  DirectXDeviceDriverSetupA : function (hWnd: HWND; lpszDriverClass: PAnsiChar;
17049
     lpszDriverPath: PAnsiChar; dwFlags: DWORD) : Integer; stdcall;
10 daniel-mar 17050
  DirectXDeviceDriverSetup : function (hWnd: HWND; lpszDriverClass: PChar;
17051
     lpszDriverPath: PChar; dwFlags: DWORD) : Integer; stdcall;
1 daniel-mar 17052
 
4 daniel-mar 17053
  DirectXRegisterApplicationW : function
17054
     (hWnd: HWND; const lpDXRegApp: TDirectXRegisterAppW) : Integer; stdcall;
17055
  DirectXRegisterApplicationA : function
17056
     (hWnd: HWND; const lpDXRegApp: TDirectXRegisterAppA) : Integer; stdcall;
17057
  DirectXRegisterApplication : function
17058
     (hWnd: HWND; const lpDXRegApp: TDirectXRegisterApp) : Integer; stdcall;
1 daniel-mar 17059
 
4 daniel-mar 17060
  DirectXUnRegisterApplication : function
17061
     (hWnd: HWND; const lpGUID: TGUID) : Integer; stdcall;
1 daniel-mar 17062
 
4 daniel-mar 17063
type
17064
  TDSetup_Callback = function (Reason: DWORD; MsgType: DWORD; // Same as flags to MessageBox
17065
      szMessage: PChar; szName: PChar; pInfo: Pointer) : DWORD; stdcall;
1 daniel-mar 17066
 
4 daniel-mar 17067
var
17068
  DirectXSetupSetCallback : function (Callback: TDSetup_Callback) : Integer; stdcall;
1 daniel-mar 17069
 
4 daniel-mar 17070
  DirectXSetupGetVersion : function (out lpdwVersion, lpdwMinorVersion: DWORD) : Integer; stdcall;
1 daniel-mar 17071
 
4 daniel-mar 17072
//DirectSound file
1 daniel-mar 17073
(*==========================================================================;
17074
 *
4 daniel-mar 17075
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 17076
 *
17077
 *  File:       dsound.h
17078
 *  Content:    DirectSound include file
17079
 *
4 daniel-mar 17080
 *  DirectX 7.0 Delphi adaptation by Erik Unger
17081
 *
17082
 *  Modified: 10-Sep-2000
17083
 *
17084
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
17085
 *  E-Mail: DelphiDirectX@next-reality.com
17086
 *
17087
 ***************************************************************************)
1 daniel-mar 17088
 
4 daniel-mar 17089
{
17090
  Windows 98 and debug versions DInput and DSound
1 daniel-mar 17091
 
4 daniel-mar 17092
  Under Windows 98, the "debug" setup of the DirectX SDK 6.x skips DInput.DLL
17093
  and DSound.DLL, i.e. makes you end up with the retail version of these two
17094
  files without any notice.
17095
  The debug versions of DInput.DLL and DSound.DLL can be found in the
17096
  \extras\Win98\Win98Dbg folder of the SDK CD; they need to be installed
17097
  "manually".
17098
}
17099
 
17100
 
17101
var
17102
  DSoundDLL : HMODULE;
17103
 
17104
function DSErrorString(Value: HResult) : string;
17105
 
1 daniel-mar 17106
const
4 daniel-mar 17107
  _FACDS = $878;
17108
function MAKE_DSHResult(code: DWORD) : HResult;
17109
 
17110
const
17111
  FLT_MIN = 1.175494351E-38;
17112
  FLT_MAX = 3.402823466E+38;
17113
 
17114
const
17115
// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000}
1 daniel-mar 17116
  CLSID_DirectSound: TGUID = '{47D4D946-62E8-11cf-93BC-444553540000}';
17117
 
4 daniel-mar 17118
// DirectSound Capture Component GUID {B0210780-89CD-11d0-AF08-00A0C925CD16}
17119
  CLSID_DirectSoundCapture: TGUID = '{47D4D946-62E8-11cf-93BC-444553540000}';
1 daniel-mar 17120
 
4 daniel-mar 17121
//
17122
// Structures
17123
//
1 daniel-mar 17124
type
17125
  IDirectSound = interface;
17126
  IDirectSoundBuffer = interface;
17127
  IDirectSound3DListener = interface;
17128
  IDirectSound3DBuffer = interface;
17129
  IDirectSoundCapture = interface;
17130
  IDirectSoundCaptureBuffer = interface;
17131
  IDirectSoundNotify = interface;
4 daniel-mar 17132
  IKsPropertySet = interface;
1 daniel-mar 17133
 
17134
  PDSCaps = ^TDSCaps;
4 daniel-mar 17135
  TDSCaps = packed record
1 daniel-mar 17136
    dwSize: DWORD;
17137
    dwFlags: DWORD;
17138
    dwMinSecondarySampleRate: DWORD;
17139
    dwMaxSecondarySampleRate: DWORD;
17140
    dwPrimaryBuffers: DWORD;
17141
    dwMaxHwMixingAllBuffers: DWORD;
17142
    dwMaxHwMixingStaticBuffers: DWORD;
17143
    dwMaxHwMixingStreamingBuffers: DWORD;
17144
    dwFreeHwMixingAllBuffers: DWORD;
17145
    dwFreeHwMixingStaticBuffers: DWORD;
17146
    dwFreeHwMixingStreamingBuffers: DWORD;
17147
    dwMaxHw3DAllBuffers: DWORD;
17148
    dwMaxHw3DStaticBuffers: DWORD;
17149
    dwMaxHw3DStreamingBuffers: DWORD;
17150
    dwFreeHw3DAllBuffers: DWORD;
17151
    dwFreeHw3DStaticBuffers: DWORD;
17152
    dwFreeHw3DStreamingBuffers: DWORD;
17153
    dwTotalHwMemBytes: DWORD;
17154
    dwFreeHwMemBytes: DWORD;
17155
    dwMaxContigFreeHwMemBytes: DWORD;
17156
    dwUnlockTransferRateHwBuffers: DWORD;
17157
    dwPlayCpuOverheadSwBuffers: DWORD;
17158
    dwReserved1: DWORD;
17159
    dwReserved2: DWORD;
17160
  end;
4 daniel-mar 17161
  PCDSCaps = ^TDSCaps;
1 daniel-mar 17162
 
17163
  PDSBCaps = ^TDSBCaps;
4 daniel-mar 17164
  TDSBCaps = packed record
1 daniel-mar 17165
    dwSize: DWORD;
17166
    dwFlags: DWORD;
17167
    dwBufferBytes: DWORD;
17168
    dwUnlockTransferRate: DWORD;
17169
    dwPlayCpuOverhead: DWORD;
17170
  end;
4 daniel-mar 17171
  PCDSBCaps = ^TDSBCaps;
1 daniel-mar 17172
 
4 daniel-mar 17173
  TDSBufferDesc_DX6 = packed record
1 daniel-mar 17174
    dwSize: DWORD;
17175
    dwFlags: DWORD;
17176
    dwBufferBytes: DWORD;
17177
    dwReserved: DWORD;
17178
    lpwfxFormat: PWaveFormatEx;
17179
  end;
17180
 
4 daniel-mar 17181
  TDSBufferDesc1 = TDSBufferDesc_DX6;
17182
  PDSBufferDesc1 = ^TDSBufferDesc1;
17183
  PCDSBufferDesc1 = PDSBufferDesc1;
1 daniel-mar 17184
 
4 daniel-mar 17185
  TDSBufferDesc_DX7 = packed record
1 daniel-mar 17186
    dwSize: DWORD;
17187
    dwFlags: DWORD;
17188
    dwBufferBytes: DWORD;
17189
    dwReserved: DWORD;
17190
    lpwfxFormat: PWaveFormatEx;
4 daniel-mar 17191
    guid3DAlgorithm: TGUID;
1 daniel-mar 17192
  end;
17193
 
4 daniel-mar 17194
{$IFDEF DIRECTX6}
17195
  TDSBufferDesc = TDSBufferDesc_DX6;
17196
{$ELSE}
17197
  TDSBufferDesc = TDSBufferDesc_DX7;
17198
{$ENDIF}
1 daniel-mar 17199
 
4 daniel-mar 17200
  PDSBufferDesc = ^TDSBufferDesc;
17201
  PCDSBufferDesc = PDSBufferDesc;
1 daniel-mar 17202
 
4 daniel-mar 17203
(***
17204
// Snipped from D3DTypes.pas:
17205
 
17206
  TD3DValue = Single;
17207
 
17208
  PD3DVector = ^TD3DVector;
17209
  TD3DVector = packed record
17210
    case Integer of
17211
    0: (
17212
      x: TD3DValue;
17213
      y: TD3DValue;
17214
      z: TD3DValue;
17215
     );
17216
    1: (
17217
      dvX: TD3DValue;
17218
      dvY: TD3DValue;
17219
      dvZ: TD3DValue;
17220
     );
17221
  end;
17222
*)
17223
 
1 daniel-mar 17224
  PDS3DBuffer = ^TDS3DBuffer;
4 daniel-mar 17225
  TDS3DBuffer = packed record
1 daniel-mar 17226
    dwSize: DWORD;
17227
    vPosition: TD3DVector;
17228
    vVelocity: TD3DVector;
17229
    dwInsideConeAngle: DWORD;
17230
    dwOutsideConeAngle: DWORD;
17231
    vConeOrientation: TD3DVector;
4 daniel-mar 17232
    lConeOutsideVolume: LongInt;
1 daniel-mar 17233
    flMinDistance: TD3DValue;
17234
    flMaxDistance: TD3DValue;
17235
    dwMode: DWORD;
17236
  end;
4 daniel-mar 17237
  TCDS3DBuffer = ^TDS3DBuffer;
1 daniel-mar 17238
 
17239
  PDS3DListener = ^TDS3DListener;
4 daniel-mar 17240
  TDS3DListener = packed record
1 daniel-mar 17241
    dwSize: DWORD;
17242
    vPosition: TD3DVector;
17243
    vVelocity: TD3DVector;
17244
    vOrientFront: TD3DVector;
17245
    vOrientTop: TD3DVector;
17246
    flDistanceFactor: TD3DValue;
17247
    flRolloffFactor: TD3DValue;
17248
    flDopplerFactor: TD3DValue;
17249
  end;
4 daniel-mar 17250
  PCDS3DListener = ^TDS3DListener;
1 daniel-mar 17251
 
17252
  PDSCCaps = ^TDSCCaps;
4 daniel-mar 17253
  TDSCCaps = packed record
1 daniel-mar 17254
    dwSize: DWORD;
17255
    dwFlags: DWORD;
17256
    dwFormats: DWORD;
17257
    dwChannels: DWORD;
17258
  end;
4 daniel-mar 17259
  PCDSCCaps = ^TDSCCaps;
1 daniel-mar 17260
 
17261
  PDSCBufferDesc = ^TDSCBufferDesc;
4 daniel-mar 17262
  TDSCBufferDesc = packed record
1 daniel-mar 17263
    dwSize: DWORD;
17264
    dwFlags: DWORD;
17265
    dwBufferBytes: DWORD;
17266
    dwReserved: DWORD;
17267
    lpwfxFormat: PWaveFormatEx;
17268
  end;
4 daniel-mar 17269
  PCDSCBufferDesc = ^TDSCBufferDesc;
1 daniel-mar 17270
 
17271
  PDSCBCaps = ^TDSCBCaps;
4 daniel-mar 17272
  TDSCBCaps = packed record
1 daniel-mar 17273
    dwSize: DWORD;
17274
    dwFlags: DWORD;
17275
    dwBufferBytes: DWORD;
17276
    dwReserved: DWORD;
17277
  end;
4 daniel-mar 17278
  PCDSCBCaps = ^TDSCBCaps;
1 daniel-mar 17279
 
17280
  PDSBPositionNotify = ^TDSBPositionNotify;
4 daniel-mar 17281
  TDSBPositionNotify = packed record
1 daniel-mar 17282
    dwOffset: DWORD;
17283
    hEventNotify: THandle;
17284
  end;
4 daniel-mar 17285
  PCDSBPositionNotify = ^TDSBPositionNotify;
1 daniel-mar 17286
 
4 daniel-mar 17287
//
17288
// DirectSound API
17289
//
17290
  TDSEnumCallbackW = function (lpGuid: PGUID; lpstrDescription: PWideChar;
17291
      lpstrModule: PWideChar; lpContext: Pointer) : BOOL; stdcall;
17292
  TDSEnumCallbackA = function (lpGuid: PGUID; lpstrDescription: PAnsiChar;
17293
      lpstrModule: PAnsiChar; lpContext: Pointer) : BOOL; stdcall;
17294
{$IFDEF UNICODE}
17295
  TDSEnumCallback = TDSEnumCallbackW;
17296
{$ELSE}
17297
  TDSEnumCallback = TDSEnumCallbackA;
17298
{$ENDIF}
1 daniel-mar 17299
 
4 daniel-mar 17300
//
17301
// IDirectSound
17302
//
17303
  IDirectSound = interface (IUnknown)
1 daniel-mar 17304
    ['{279AFA83-4981-11CE-A521-0020AF0BE560}']
17305
    // IDirectSound methods
17306
    function CreateSoundBuffer(const lpDSBufferDesc: TDSBufferDesc;
4 daniel-mar 17307
        out lpIDirectSoundBuffer: IDirectSoundBuffer;
17308
        pUnkOuter: IUnknown) : HResult; stdcall;
17309
    function GetCaps(var lpDSCaps: TDSCaps) : HResult; stdcall;
1 daniel-mar 17310
    function DuplicateSoundBuffer(lpDsbOriginal: IDirectSoundBuffer;
4 daniel-mar 17311
        out lpDsbDuplicate: IDirectSoundBuffer) : HResult; stdcall;
17312
    function SetCooperativeLevel(hwnd: HWND; dwLevel: DWORD) : HResult; stdcall;
1 daniel-mar 17313
    function Compact: HResult; stdcall;
4 daniel-mar 17314
    function GetSpeakerConfig(var lpdwSpeakerConfig: DWORD) : HResult; stdcall;
17315
    function SetSpeakerConfig(dwSpeakerConfig: DWORD) : HResult; stdcall;
17316
    function Initialize(lpGuid: PGUID) : HResult; stdcall;
1 daniel-mar 17317
  end;
17318
 
4 daniel-mar 17319
//
17320
// IDirectSoundBuffer
17321
//
17322
  IDirectSoundBuffer = interface (IUnknown)
1 daniel-mar 17323
    ['{279AFA85-4981-11CE-A521-0020AF0BE560}']
17324
    // IDirectSoundBuffer methods
4 daniel-mar 17325
    function GetCaps(var lpDSCaps: TDSBCaps) : HResult; stdcall;
17326
    function GetCurrentPosition
17327
        (lpdwCapturePosition, lpdwReadPosition : PDWORD) : HResult; stdcall;
17328
    function GetFormat(lpwfxFormat: PWaveFormatEx; dwSizeAllocated: DWORD;
17329
        lpdwSizeWritten: PWORD) : HResult; stdcall;
17330
    function GetVolume(var lplVolume: integer) : HResult; stdcall;
17331
    function GetPan(var lplPan: integer) : HResult; stdcall;
17332
    function GetFrequency(var lpdwFrequency: DWORD) : HResult; stdcall;
17333
    function GetStatus(var lpdwStatus: DWORD) : HResult; stdcall;
17334
    function Initialize(lpDirectSound: IDirectSound;
17335
        const lpcDSBufferDesc: TDSBufferDesc) : HResult; stdcall;
17336
    function Lock(dwWriteCursor, dwWriteBytes: DWORD;
1 daniel-mar 17337
        var lplpvAudioPtr1: Pointer; var lpdwAudioBytes1: DWORD;
17338
        var lplpvAudioPtr2: Pointer; var lpdwAudioBytes2: DWORD;
4 daniel-mar 17339
        dwFlags: DWORD) : HResult; stdcall;
17340
    function Play(dwReserved1,dwReserved2,dwFlags: DWORD) : HResult; stdcall;
17341
    function SetCurrentPosition(dwPosition: DWORD) : HResult; stdcall;
17342
    function SetFormat(const lpcfxFormat: TWaveFormatEx) : HResult; stdcall;
17343
    function SetVolume(lVolume: integer) : HResult; stdcall;
17344
    function SetPan(lPan: integer) : HResult; stdcall;
17345
    function SetFrequency(dwFrequency: DWORD) : HResult; stdcall;
1 daniel-mar 17346
    function Stop: HResult; stdcall;
17347
    function Unlock(lpvAudioPtr1: Pointer; dwAudioBytes1: DWORD;
4 daniel-mar 17348
        lpvAudioPtr2: Pointer; dwAudioBytes2: DWORD) : HResult; stdcall;
1 daniel-mar 17349
    function Restore: HResult; stdcall;
17350
  end;
17351
 
4 daniel-mar 17352
//
17353
// IDirectSound3DListener
17354
//
17355
  IDirectSound3DListener = interface (IUnknown)
1 daniel-mar 17356
    ['{279AFA84-4981-11CE-A521-0020AF0BE560}']
4 daniel-mar 17357
    // IDirectSound3D methods
17358
    function GetAllParameters(var lpListener: TDS3DListener) : HResult; stdcall;
17359
    function GetDistanceFactor(var lpflDistanceFactor: TD3DValue) : HResult; stdcall;
17360
    function GetDopplerFactor(var lpflDopplerFactor: TD3DValue) : HResult; stdcall;
17361
    function GetOrientation
17362
        (var lpvOrientFront, lpvOrientTop: TD3DVector) : HResult; stdcall;
17363
    function GetPosition(var lpvPosition: TD3DVector) : HResult; stdcall;
17364
    function GetRolloffFactor(var lpflRolloffFactor: TD3DValue) : HResult; stdcall;
17365
    function GetVelocity(var lpvVelocity: TD3DVector) : HResult; stdcall;
17366
    function SetAllParameters
17367
        (const lpcListener: TDS3DListener; dwApply: DWORD) : HResult; stdcall;
17368
    function SetDistanceFactor
17369
        (flDistanceFactor: TD3DValue; dwApply: DWORD) : HResult; stdcall;
17370
    function SetDopplerFactor
17371
        (flDopplerFactor: TD3DValue; dwApply: DWORD) : HResult; stdcall;
1 daniel-mar 17372
    function SetOrientation(xFront, yFront, zFront, xTop, yTop, zTop: TD3DValue;
4 daniel-mar 17373
        dwApply: DWORD) : HResult; stdcall;
17374
    function SetPosition(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
17375
    function SetRolloffFactor
17376
        (flRolloffFactor: TD3DValue; dwApply: DWORD) : HResult; stdcall;
17377
    function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
1 daniel-mar 17378
    function CommitDeferredSettings: HResult; stdcall;
17379
  end;
17380
 
17381
 
4 daniel-mar 17382
//
17383
// IDirectSound3DBuffer
17384
//
17385
  IDirectSound3DBuffer = interface (IUnknown)
1 daniel-mar 17386
    ['{279AFA86-4981-11CE-A521-0020AF0BE560}']
4 daniel-mar 17387
    // IDirectSoundBuffer3D methods
17388
    function GetAllParameters(var lpDs3dBuffer: TDS3DBuffer) : HResult; stdcall;
17389
    function GetConeAngles
17390
        (var lpdwInsideConeAngle, lpdwOutsideConeAngle: DWORD) : HResult; stdcall;
17391
    function GetConeOrientation(var lpvOrientation: TD3DVector) : HResult; stdcall;
17392
    function GetConeOutsideVolume(var lplConeOutsideVolume: integer) : HResult; stdcall;
17393
    function GetMaxDistance(var lpflMaxDistance: TD3DValue) : HResult; stdcall;
17394
    function GetMinDistance(var lpflMinDistance: TD3DValue) : HResult; stdcall;
17395
    function GetMode(var lpdwMode: DWORD) : HResult; stdcall;
17396
    function GetPosition(var lpvPosition: TD3DVector) : HResult; stdcall;
17397
    function GetVelocity(var lpvVelocity: TD3DVector) : HResult; stdcall;
17398
    function SetAllParameters
17399
        (const lpcDs3dBuffer: TDS3DBuffer; dwApply: DWORD) : HResult; stdcall;
17400
    function SetConeAngles
17401
        (dwInsideConeAngle, dwOutsideConeAngle, dwApply: DWORD) : HResult; stdcall;
17402
    function SetConeOrientation(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
17403
    function SetConeOutsideVolume
17404
        (lConeOutsideVolume: LongInt; dwApply: DWORD) : HResult; stdcall;
17405
    function SetMaxDistance(flMaxDistance: TD3DValue; dwApply: DWORD) : HResult; stdcall;
17406
    function SetMinDistance(flMinDistance: TD3DValue; dwApply: DWORD) : HResult; stdcall;
17407
    function SetMode(dwMode: DWORD; dwApply: DWORD) : HResult; stdcall;
17408
    function SetPosition(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
17409
    function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD) : HResult; stdcall;
1 daniel-mar 17410
  end;
17411
 
17412
 
4 daniel-mar 17413
//
17414
// IDirectSoundCapture
17415
//
17416
  IDirectSoundCapture = interface (IUnknown)
17417
    ['{b0210781-89cd-11d0-af08-00a0c925cd16}']
1 daniel-mar 17418
    // IDirectSoundCapture methods
17419
    function CreateCaptureBuffer(const lpDSCBufferDesc: TDSCBufferDesc;
4 daniel-mar 17420
        var lplpDirectSoundCaptureBuffer: IDirectSoundCaptureBuffer;
17421
        pUnkOuter: IUnknown) : HResult; stdcall;
17422
    function GetCaps(var lpdwCaps: TDSCCaps) : HResult; stdcall;
17423
    function Initialize(lpGuid: PGUID) : HResult; stdcall;
1 daniel-mar 17424
  end;
17425
 
17426
 
4 daniel-mar 17427
//
17428
// IDirectSoundCaptureBuffer
17429
//
17430
  IDirectSoundCaptureBuffer = interface (IUnknown)
17431
    ['{b0210782-89cd-11d0-af08-00a0c925cd16}']
1 daniel-mar 17432
    // IDirectSoundCaptureBuffer methods
4 daniel-mar 17433
    function GetCaps(var lpdwCaps: TDSCBCaps) : HResult; stdcall;
17434
    function GetCurrentPosition
17435
        (lpdwCapturePosition, lpdwReadPosition: PDWORD) : HResult; stdcall;
17436
    function GetFormat(lpwfxFormat: PWaveFormatEx; dwSizeAllocated: DWORD;
17437
        lpdwSizeWritten : PDWORD) : HResult; stdcall;
17438
    function GetStatus(var lpdwStatus: DWORD) : HResult; stdcall;
1 daniel-mar 17439
    function Initialize(lpDirectSoundCapture: IDirectSoundCapture;
4 daniel-mar 17440
        const lpcDSBufferDesc: TDSCBufferDesc) : HResult; stdcall;
17441
    function Lock(dwReadCursor, dwReadBytes: DWORD;
1 daniel-mar 17442
        var lplpvAudioPtr1: Pointer; var lpdwAudioBytes1: DWORD;
17443
        var lplpvAudioPtr2: Pointer; var lpdwAudioBytes2: DWORD;
4 daniel-mar 17444
        dwFlags: DWORD) : HResult; stdcall;
17445
    function Start(dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 17446
    function Stop: HResult; stdcall;
17447
    function Unlock(lpvAudioPtr1: Pointer; dwAudioBytes1: DWORD;
4 daniel-mar 17448
        lpvAudioPtr2: Pointer; dwAudioBytes2: DWORD) : HResult; stdcall;
1 daniel-mar 17449
  end;
17450
 
4 daniel-mar 17451
//
17452
// IDirectSoundNotify
17453
//
17454
  IDirectSoundNotify = interface (IUnknown)
17455
    ['{b0210783-89cd-11d0-af08-00a0c925cd16}']
1 daniel-mar 17456
    // IDirectSoundNotify methods
17457
    function SetNotificationPositions(cPositionNotifies: DWORD;
4 daniel-mar 17458
        const lpcPositionNotifies: TDSBPositionNotify) : HResult; stdcall;
1 daniel-mar 17459
  end;
17460
 
4 daniel-mar 17461
//
17462
// IKsPropertySet
17463
//
17464
  IKsPropertySet = interface (IUnknown)
17465
    ['{31efac30-515c-11d0-a9aa-00aa0061be93}']
17466
    // IKsPropertySet methods
17467
    function Get(const rguidPropSet: TGUID; ulId: DWORD; var pInstanceData;
17468
        ulInstanceLength: DWORD; var pPropertyData; ulDataLength: DWORD;
17469
        var pulBytesReturned: DWORD) : HResult; stdcall;
17470
    // Warning: The following method is defined as Set() in DirectX
17471
    //          which is a reserved word in Delphi!
17472
    function SetProperty(const rguidPropSet: TGUID; ulId: DWORD;
17473
        var pInstanceData; ulInstanceLength: DWORD;
17474
        var pPropertyData; pulDataLength: DWORD) : HResult; stdcall;
17475
    function QuerySupport(const rguidPropSet: TGUID; ulId: DWORD;
17476
        var pulTypeSupport: DWORD) : HResult; stdcall;
17477
  end;
1 daniel-mar 17478
 
4 daniel-mar 17479
 
1 daniel-mar 17480
const
17481
  KSPROPERTY_SUPPORT_GET = $00000001;
17482
  KSPROPERTY_SUPPORT_SET = $00000002;
17483
 
4 daniel-mar 17484
//
17485
// GUID's for all the objects
17486
//
1 daniel-mar 17487
type
4 daniel-mar 17488
  IID_IDirectSound = IDirectSound;
17489
  IID_IDirectSoundBuffer = IDirectSoundBuffer;
17490
  IID_IDirectSound3DListener = IDirectSound3DListener;
17491
  IID_IDirectSound3DBuffer = IDirectSound3DBuffer;
17492
  IID_IDirectSoundCapture = IDirectSoundCapture;
17493
  IID_IDirectSoundCaptureBuffer = IDirectSoundCaptureBuffer;
17494
  IID_IDirectSoundNotify = IDirectSoundNotify;
17495
  IID_IKsPropertySet = IKsPropertySet;
1 daniel-mar 17496
 
4 daniel-mar 17497
//
17498
// Creation Routines
17499
//
17500
var
17501
    DirectSoundCreate : function ( lpGuid: PGUID; out ppDS: IDirectSound;
17502
        pUnkOuter: IUnknown) : HResult; stdcall;
1 daniel-mar 17503
 
4 daniel-mar 17504
    DirectSoundEnumerateW : function (lpDSEnumCallback: TDSEnumCallbackW;
17505
        lpContext: Pointer) : HResult; stdcall;
17506
    DirectSoundEnumerateA : function (lpDSEnumCallback: TDSEnumCallbackA;
17507
        lpContext: Pointer) : HResult; stdcall;
17508
    DirectSoundEnumerate : function (lpDSEnumCallback: TDSEnumCallback;
17509
        lpContext: Pointer) : HResult; stdcall;
1 daniel-mar 17510
 
4 daniel-mar 17511
    DirectSoundCaptureCreate : function (lpGUID: PGUID;
17512
        out lplpDSC: IDirectSoundCapture;
17513
        pUnkOuter: IUnknown) : HResult; stdcall;
17514
 
17515
    DirectSoundCaptureEnumerateW : function (lpDSEnumCallback: TDSEnumCallbackW;
17516
        lpContext: Pointer) : HResult; stdcall;
17517
    DirectSoundCaptureEnumerateA : function (lpDSEnumCallback: TDSEnumCallbackA;
17518
        lpContext: Pointer) : HResult; stdcall;
17519
    DirectSoundCaptureEnumerate : function(lpDSEnumCallback: TDSEnumCallback;
17520
        lpContext: Pointer) : HResult; stdcall;
17521
 
17522
 
17523
//
17524
// Return Codes
17525
//
17526
 
1 daniel-mar 17527
const
4 daniel-mar 17528
  MAKE_DSHRESULT_ = HResult($88780000);
1 daniel-mar 17529
 
4 daniel-mar 17530
  DS_OK = 0;
1 daniel-mar 17531
 
4 daniel-mar 17532
// The function completed successfully, but we had to substitute the 3D algorithm
17533
  DS_NO_VIRTUALIZATION = MAKE_DSHRESULT_ + 10;
1 daniel-mar 17534
 
4 daniel-mar 17535
// The call failed because resources (such as a priority level)
17536
// were already being used by another caller.
17537
  DSERR_ALLOCATED = MAKE_DSHRESULT_ + 10;
1 daniel-mar 17538
 
4 daniel-mar 17539
// The control (vol,pan,etc.) requested by the caller is not available.
17540
  DSERR_CONTROLUNAVAIL = MAKE_DSHRESULT_ + 30;
17541
 
17542
// An invalid parameter was passed to the returning function
17543
  DSERR_INVALIDPARAM = E_INVALIDARG;
17544
 
17545
// This call is not valid for the current state of this object
17546
  DSERR_INVALIDCALL = MAKE_DSHRESULT_ + 50;
17547
 
17548
// An undetermined error occured inside the DirectSound subsystem
17549
  DSERR_GENERIC = E_FAIL;
17550
 
17551
// The caller does not have the priority level required for the function to
17552
// succeed.
17553
  DSERR_PRIOLEVELNEEDED = MAKE_DSHRESULT_ + 70;
17554
 
17555
// Not enough free memory is available to complete the operation
17556
  DSERR_OUTOFMEMORY = E_OUTOFMEMORY;
17557
 
17558
// The specified WAVE format is not supported
17559
  DSERR_BADFORMAT = MAKE_DSHRESULT_ + 100;
17560
 
17561
// The function called is not supported at this time
17562
  DSERR_UNSUPPORTED = E_NOTIMPL;
17563
 
17564
// No sound driver is available for use
17565
  DSERR_NODRIVER = MAKE_DSHRESULT_ + 120;
17566
 
17567
// This object is already initialized
17568
  DSERR_ALREADYINITIALIZED = MAKE_DSHRESULT_ + 130;
17569
 
17570
// This object does not support aggregation
17571
  DSERR_NOAGGREGATION = CLASS_E_NOAGGREGATION;
17572
 
17573
// The buffer memory has been lost, and must be restored.
17574
  DSERR_BUFFERLOST = MAKE_DSHRESULT_ + 150;
17575
 
17576
// Another app has a higher priority level, preventing this call from
17577
// succeeding.
17578
  DSERR_OTHERAPPHASPRIO = MAKE_DSHRESULT_ + 160;
17579
 
17580
// This object has not been initialized
17581
  DSERR_UNINITIALIZED = MAKE_DSHRESULT_ + 170;
17582
 
17583
// The requested COM interface is not available
17584
  DSERR_NOINTERFACE = E_NOINTERFACE;
17585
 
17586
// Access is denied
17587
  DSERR_ACCESSDENIED = E_ACCESSDENIED;
17588
 
17589
//
17590
// Flags
17591
//
17592
 
17593
  DSCAPS_PRIMARYMONO = $00000001;
17594
  DSCAPS_PRIMARYSTEREO = $00000002;
17595
  DSCAPS_PRIMARY8BIT = $00000004;
17596
  DSCAPS_PRIMARY16BIT = $00000008;
17597
  DSCAPS_CONTINUOUSRATE = $00000010;
17598
  DSCAPS_EMULDRIVER = $00000020;
17599
  DSCAPS_CERTIFIED = $00000040;
17600
  DSCAPS_SECONDARYMONO = $00000100;
17601
  DSCAPS_SECONDARYSTEREO = $00000200;
17602
  DSCAPS_SECONDARY8BIT = $00000400;
17603
  DSCAPS_SECONDARY16BIT = $00000800;
17604
 
17605
  DSSCL_NORMAL = $00000001;
17606
  DSSCL_PRIORITY = $00000002;
17607
  DSSCL_EXCLUSIVE = $00000003;
17608
  DSSCL_WRITEPRIMARY = $00000004;
17609
 
1 daniel-mar 17610
  DSSPEAKER_HEADPHONE = $00000001;
4 daniel-mar 17611
  DSSPEAKER_MONO = $00000002;
17612
  DSSPEAKER_QUAD = $00000003;
17613
  DSSPEAKER_STEREO = $00000004;
17614
  DSSPEAKER_SURROUND = $00000005;
17615
  DSSPEAKER_5POINT1 = $00000006;
1 daniel-mar 17616
 
4 daniel-mar 17617
  DSSPEAKER_GEOMETRY_MIN     = $00000005;  //   5 degrees
17618
  DSSPEAKER_GEOMETRY_NARROW  = $0000000A;  //  10 degrees
17619
  DSSPEAKER_GEOMETRY_WIDE    = $00000014;  //  20 degrees
17620
  DSSPEAKER_GEOMETRY_MAX     = $000000B4;  // 180 degrees
1 daniel-mar 17621
 
4 daniel-mar 17622
function DSSPEAKER_COMBINED(c, g: variant) : DWORD;
17623
function DSSPEAKER_CONFIG(a: variant) : byte;
17624
function DSSPEAKER_GEOMETRY(a: variant) : byte;
17625
 
17626
const
17627
  DSBCAPS_PRIMARYBUFFER = $00000001;
17628
  DSBCAPS_STATIC = $00000002;
17629
  DSBCAPS_LOCHARDWARE = $00000004;
17630
  DSBCAPS_LOCSOFTWARE = $00000008;
17631
  DSBCAPS_CTRL3D = $00000010;
17632
  DSBCAPS_CTRLFREQUENCY = $00000020;
17633
  DSBCAPS_CTRLPAN = $00000040;
17634
  DSBCAPS_CTRLVOLUME = $00000080;
17635
  DSBCAPS_CTRLPOSITIONNOTIFY = $00000100;
17636
  DSBCAPS_STICKYFOCUS = $00004000;
17637
  DSBCAPS_GLOBALFOCUS = $00008000;
1 daniel-mar 17638
  DSBCAPS_GETCURRENTPOSITION2 = $00010000;
17639
  DSBCAPS_MUTE3DATMAXDISTANCE = $00020000;
17640
  DSBCAPS_LOCDEFER            = $00040000;
17641
 
4 daniel-mar 17642
  DSBPLAY_LOOPING = $00000001;
17643
  DSBPLAY_LOCHARDWARE = $00000002;
17644
  DSBPLAY_LOCSOFTWARE = $00000004;
17645
  DSBPLAY_TERMINATEBY_TIME = $00000008;
17646
  DSBPLAY_TERMINATEBY_DISTANCE = $000000010;
17647
  DSBPLAY_TERMINATEBY_PRIORITY = $000000020;
1 daniel-mar 17648
 
4 daniel-mar 17649
  DSBSTATUS_PLAYING = $00000001;
17650
  DSBSTATUS_BUFFERLOST = $00000002;
17651
  DSBSTATUS_LOOPING = $00000004;
17652
  DSBSTATUS_LOCHARDWARE = $00000008;
17653
  DSBSTATUS_LOCSOFTWARE = $00000010;
17654
  DSBSTATUS_TERMINATED = $00000020;
1 daniel-mar 17655
 
17656
  DSBLOCK_FROMWRITECURSOR = $00000001;
4 daniel-mar 17657
  DSBLOCK_ENTIREBUFFER = $00000002;
1 daniel-mar 17658
 
4 daniel-mar 17659
  DSBFREQUENCY_MIN = 100;
17660
  DSBFREQUENCY_MAX = 100000;
17661
  DSBFREQUENCY_ORIGINAL = 0;
1 daniel-mar 17662
 
4 daniel-mar 17663
  DSBPAN_LEFT = -10000;
17664
  DSBPAN_CENTER = 0;
17665
  DSBPAN_RIGHT = 10000;
1 daniel-mar 17666
 
4 daniel-mar 17667
  DSBVOLUME_MIN = -10000;
17668
  DSBVOLUME_MAX = 0;
1 daniel-mar 17669
 
4 daniel-mar 17670
  DSBSIZE_MIN = 4;
17671
  DSBSIZE_MAX = $0FFFFFFF;
1 daniel-mar 17672
 
4 daniel-mar 17673
  DS3DMODE_NORMAL = $00000000;
17674
  DS3DMODE_HEADRELATIVE = $00000001;
17675
  DS3DMODE_DISABLE = $00000002;
1 daniel-mar 17676
 
4 daniel-mar 17677
  DS3D_IMMEDIATE = $00000000;
17678
  DS3D_DEFERRED = $00000001;
17679
 
17680
  DS3D_MINDISTANCEFACTOR = FLT_MIN;
17681
  DS3D_MAXDISTANCEFACTOR = FLT_MAX;
1 daniel-mar 17682
  DS3D_DEFAULTDISTANCEFACTOR = 1.0;
17683
 
4 daniel-mar 17684
  DS3D_MINROLLOFFFACTOR = 0.0;
17685
  DS3D_MAXROLLOFFFACTOR = 10.0;
17686
  DS3D_DEFAULTROLLOFFFACTOR = 1.0;
1 daniel-mar 17687
 
4 daniel-mar 17688
  DS3D_MINDOPPLERFACTOR = 0.0;
17689
  DS3D_MAXDOPPLERFACTOR = 10.0;
17690
  DS3D_DEFAULTDOPPLERFACTOR = 1.0;
1 daniel-mar 17691
 
4 daniel-mar 17692
  DS3D_DEFAULTMINDISTANCE = 1.0;
17693
  DS3D_DEFAULTMAXDISTANCE = 1000000000.0;
1 daniel-mar 17694
 
4 daniel-mar 17695
  DS3D_MINCONEANGLE = 0;
17696
  DS3D_MAXCONEANGLE = 360;
17697
  DS3D_DEFAULTCONEANGLE = 360;
1 daniel-mar 17698
 
17699
  DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX;
17700
 
4 daniel-mar 17701
  DSCCAPS_EMULDRIVER = $00000020;
17702
  DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED;
1 daniel-mar 17703
 
4 daniel-mar 17704
  DSCBCAPS_WAVEMAPPED = $80000000;
1 daniel-mar 17705
 
17706
 
17707
 
4 daniel-mar 17708
  DSBCAPS_CTRLDEFAULT = $000000E0;
17709
  DSBCAPS_CTRLALL = $000001F0;
1 daniel-mar 17710
 
4 daniel-mar 17711
  DSCBLOCK_ENTIREBUFFER = $00000001;
1 daniel-mar 17712
 
4 daniel-mar 17713
  DSCBSTATUS_CAPTURING = $00000001;
17714
  DSCBSTATUS_LOOPING = $00000002;
17715
 
17716
  DSCBSTART_LOOPING = $00000001;
17717
 
17718
  DSBPN_OFFSETSTOP = DWORD(-1);
17719
 
17720
//
17721
// DirectSound3D Algorithms
17722
//
17723
 
17724
// Default DirectSound3D algorithm {00000000-0000-0000-0000-000000000000}
1 daniel-mar 17725
  DS3DALG_DEFAULT: TGUID = '{00000000-0000-0000-0000-000000000000}';
17726
 
4 daniel-mar 17727
// No virtualization {C241333F-1C1B-11d2-94F5-00C04FC28ACA}
17728
  DS3DALG_NO_VIRTUALIZATION: TGUID = '';
1 daniel-mar 17729
 
4 daniel-mar 17730
// High-quality HRTF algorithm {C2413340-1C1B-11d2-94F5-00C04FC28ACA}
17731
  DS3DALG_HRTF_FULL: TGUID = '{C2413340-1C1B-11d2-94F5-00C04FC28ACA}';
1 daniel-mar 17732
 
4 daniel-mar 17733
// Lower-quality HRTF algorithm {C2413342-1C1B-11d2-94F5-00C04FC28ACA}
17734
  DS3DALG_HRTF_LIGHT: TGUID = '{C2413342-1C1B-11d2-94F5-00C04FC28ACA}';
1 daniel-mar 17735
 
4 daniel-mar 17736
//DirectMusic file
17737
(*==========================================================================;
17738
 *
17739
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
17740
 *
17741
 *  Files:      dls1.h dls2.h dmdls.h dmerror.h dmksctrl.h
17742
                dmusicc.h dmusici.h dmusicf.h dmusbuff.h
17743
 *  Content:    DirectMusic, DirectSetup
17744
 *
17745
 *  DirectX 7.0 Delphi adaptation by Erik Unger
17746
 *
17747
 *  Modyfied: 10-Sep-2000
17748
 *
17749
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
17750
 *  E-Mail: DelphiDirectX@next-reality.com
17751
 *
17752
 ***************************************************************************)
1 daniel-mar 17753
 
17754
 
4 daniel-mar 17755
function MAKE_HRESULT(sev,fac,code: DWORD) : HResult;
1 daniel-mar 17756
 
4 daniel-mar 17757
type
17758
  mmioFOURCC = array [0..3] of Char;
1 daniel-mar 17759
 
4 daniel-mar 17760
 
17761
(*==========================================================================;
1 daniel-mar 17762
//
17763
//  dls1.h
17764
//
17765
//
17766
//  Description:
17767
//
17768
//  Interface defines and structures for the Instrument Collection Form
17769
//  RIFF DLS.
17770
//
17771
//
17772
//  Written by Sonic Foundry 1996.  Released for public use.
17773
//
4 daniel-mar 17774
//=========================================================================*)
1 daniel-mar 17775
 
4 daniel-mar 17776
(*//////////////////////////////////////////////////////////////////////////
1 daniel-mar 17777
//
17778
//
17779
// Layout of an instrument collection:
17780
//
17781
//
17782
// RIFF [] 'DLS ' [dlid,colh,INSTLIST,WAVEPOOL,INFOLIST]
17783
//
17784
// INSTLIST
17785
// LIST [] 'lins'
17786
//               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
17787
//               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
17788
//               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
17789
//
17790
// RGNLIST
4 daniel-mar 17791
// LIST [] 'lrgn'
1 daniel-mar 17792
//               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
17793
//               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
17794
//               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
17795
//
17796
// ARTLIST
17797
// LIST [] 'lart'
17798
//         'art1' level 1 Articulation connection graph
17799
//         'art2' level 2 Articulation connection graph
17800
//         '3rd1' Possible 3rd party articulation structure 1
17801
//         '3rd2' Possible 3rd party articulation structure 2 .... and so on
17802
//
17803
// WAVEPOOL
17804
// ptbl [] [pool table]
17805
// LIST [] 'wvpl'
17806
//               [path],
17807
//               [path],
17808
//               LIST [] 'wave' [dlid,RIFFWAVE]
17809
//               LIST [] 'wave' [dlid,RIFFWAVE]
17810
//               LIST [] 'wave' [dlid,RIFFWAVE]
17811
//               LIST [] 'wave' [dlid,RIFFWAVE]
17812
//               LIST [] 'wave' [dlid,RIFFWAVE]
17813
//
17814
// INFOLIST
17815
// LIST [] 'INFO'
17816
//               'icmt' 'One of those crazy comments.'
17817
//               'icop' 'Copyright (C) 1996 Sonic Foundry'
17818
//
4 daniel-mar 17819
////////////////////////////////////////////////////////////////////////(*)
1 daniel-mar 17820
 
4 daniel-mar 17821
(*/////////////////////////////////////////////////////////////////////////
17822
// FOURCC's used in the DLS file
17823
////////////////////////////////////////////////////////////////////////(*)
1 daniel-mar 17824
 
17825
const
4 daniel-mar 17826
  FOURCC_DLS   : mmioFOURCC = ('D','L','S',' ');
17827
  FOURCC_DLID  : mmioFOURCC = ('d','l','i','d');
17828
  FOURCC_COLH  : mmioFOURCC = ('c','o','l','h');
17829
  FOURCC_WVPL  : mmioFOURCC = ('w','v','p','l');
17830
  FOURCC_PTBL  : mmioFOURCC = ('p','t','b','l');
17831
  FOURCC_PATH  : mmioFOURCC = ('p','a','t','h');
17832
  FOURCC_wave  : mmioFOURCC = ('w','a','v','e');
17833
  FOURCC_LINS  : mmioFOURCC = ('l','i','n','s');
17834
  FOURCC_INS   : mmioFOURCC = ('i','n','s',' ');
17835
  FOURCC_INSH  : mmioFOURCC = ('i','n','s','h');
17836
  FOURCC_LRGN  : mmioFOURCC = ('l','r','g','n');
17837
  FOURCC_RGN   : mmioFOURCC = ('r','g','n',' ');
17838
  FOURCC_RGNH  : mmioFOURCC = ('r','g','n','h');
17839
  FOURCC_LART  : mmioFOURCC = ('l','a','r','t');
17840
  FOURCC_ART1  : mmioFOURCC = ('a','r','t','1');
17841
  FOURCC_WLNK  : mmioFOURCC = ('w','l','n','k');
17842
  FOURCC_WSMP  : mmioFOURCC = ('w','s','m','p');
17843
  //FOURCC_VERS  : mmioFOURCC = ('v','e','r','s');
1 daniel-mar 17844
 
4 daniel-mar 17845
(*/////////////////////////////////////////////////////////////////////////
17846
// Articulation connection graph definitions
17847
////////////////////////////////////////////////////////////////////////(*)
1 daniel-mar 17848
 
4 daniel-mar 17849
(* Generic Sources *)
17850
  CONN_SRC_NONE              = $0000;
17851
  CONN_SRC_LFO               = $0001;
17852
  CONN_SRC_KEYONVELOCITY     = $0002;
17853
  CONN_SRC_KEYNUMBER         = $0003;
17854
  CONN_SRC_EG1               = $0004;
17855
  CONN_SRC_EG2               = $0005;
17856
  CONN_SRC_PITCHWHEEL        = $0006;
1 daniel-mar 17857
 
4 daniel-mar 17858
(* Midi Controllers 0-127 *)
17859
  CONN_SRC_CC1               = $0081;
17860
  CONN_SRC_CC7               = $0087;
17861
  CONN_SRC_CC10              = $008a;
17862
  CONN_SRC_CC11              = $008b;
1 daniel-mar 17863
 
4 daniel-mar 17864
(* Generic Destinations *)
17865
  CONN_DST_NONE              = $0000;
17866
  CONN_DST_ATTENUATION       = $0001;
17867
  CONN_DST_PITCH             = $0003;
17868
  CONN_DST_PAN               = $0004;
1 daniel-mar 17869
 
4 daniel-mar 17870
(* LFO Destinations *)
17871
  CONN_DST_LFO_FREQUENCY     = $0104;
17872
  CONN_DST_LFO_STARTDELAY    = $0105;
1 daniel-mar 17873
 
4 daniel-mar 17874
(* EG1 Destinations *)
17875
  CONN_DST_EG1_ATTACKTIME    = $0206;
17876
  CONN_DST_EG1_DECAYTIME     = $0207;
17877
  CONN_DST_EG1_RELEASETIME   = $0209;
17878
  CONN_DST_EG1_SUSTAINLEVEL  = $020a;
1 daniel-mar 17879
 
4 daniel-mar 17880
(* EG2 Destinations *)
17881
  CONN_DST_EG2_ATTACKTIME    = $030a;
17882
  CONN_DST_EG2_DECAYTIME     = $030b;
17883
  CONN_DST_EG2_RELEASETIME   = $030d;
17884
  CONN_DST_EG2_SUSTAINLEVEL  = $030e;
1 daniel-mar 17885
 
4 daniel-mar 17886
  CONN_TRN_NONE              = $0000;
17887
  CONN_TRN_CONCAVE           = $0001;
1 daniel-mar 17888
 
17889
type
4 daniel-mar 17890
  PDLSId = ^TDLSId;
17891
  TDLSId = packed record
17892
    ulData1 : ULONG;
1 daniel-mar 17893
    usData2 : Word;
17894
    usData3 : Word;
4 daniel-mar 17895
    abData4 : array [0..7] of BYTE;
1 daniel-mar 17896
  end;
17897
 
4 daniel-mar 17898
//  PDLSVersion = ^TDLSVersion;
17899
//  TDLSVersion = packed record
17900
//    dwVersionMS,
17901
//    dwVersionLS : DWORD;
17902
//  end;
17903
 
17904
  PConnection = ^TConnection;
17905
  TConnection = packed record
17906
    usSource : Word;
17907
    usControl : Word;
17908
    SuDestination : Word;
17909
    usTransform :  Word;
17910
    lScale : LongInt;
1 daniel-mar 17911
  end;
17912
 
4 daniel-mar 17913
(* Level 1 Articulation Data *)
1 daniel-mar 17914
 
4 daniel-mar 17915
  PConnectionList = ^TConnectionList;
17916
  TConnectionList = packed record
17917
    cbSize : ULONG;            (* size of the connection list structure *)
17918
    cConnections : ULONG;      (* count of connections in the list *)
1 daniel-mar 17919
  end;
17920
 
4 daniel-mar 17921
(*/////////////////////////////////////////////////////////////////////////
1 daniel-mar 17922
// Generic type defines for regions and instruments
4 daniel-mar 17923
////////////////////////////////////////////////////////////////////////(*)
17924
 
17925
  PRGNRange = ^TRGNRange;
17926
  TRGNRange = packed record
17927
    usLow : Word;
1 daniel-mar 17928
    usHigh : Word;
17929
  end;
17930
 
17931
const
4 daniel-mar 17932
  F_INSTRUMENT_DRUMS      = $80000000;
1 daniel-mar 17933
 
17934
type
4 daniel-mar 17935
  PMIDILocale = ^TMIDILocale;
17936
  TMIDILocale = packed record
17937
    ulBank : ULONG;
17938
    ulInstrument : ULONG;
1 daniel-mar 17939
  end;
17940
 
4 daniel-mar 17941
(*/////////////////////////////////////////////////////////////////////////
1 daniel-mar 17942
// Header structures found in an DLS file for collection, instruments, and
17943
// regions.
4 daniel-mar 17944
////////////////////////////////////////////////////////////////////////(*)
17945
 
1 daniel-mar 17946
const
4 daniel-mar 17947
  F_RGN_OPTION_SELFNONEXCLUSIVE  = $0001;
1 daniel-mar 17948
 
17949
type
4 daniel-mar 17950
  PRGNHeader = ^TRGNHeader;
17951
  TRGNHeader = packed record
17952
    RangeKey : TRGNRange;          (* Key range  *)
17953
    RangeVelocity : TRGNRange;     (* Velocity Range  *)
17954
    fusOptions : Word   ;          (* Synthesis options for this range *)
17955
    usKeyGroup : Word   ;          (* Key grouping for non simultaneous play *)
17956
                                   (* 0 = no group, 1 up is group *)
17957
                                   (* for Level 1 only groups 1-15 are allowed *)
17958
  end;
1 daniel-mar 17959
 
4 daniel-mar 17960
  PInstHeader = ^TInstHeader;
17961
  TInstHeader = packed record
17962
    cRegions : ULONG;                (* Count of regions in this instrument *)
17963
    Locale : TMIDILocale;            (* Intended MIDI locale of this instrument *)
1 daniel-mar 17964
  end;
17965
 
4 daniel-mar 17966
  PDLSHeader = ^TDLSHeader;
17967
  TDLSHeader = packed record
17968
    cInstruments : ULONG;
1 daniel-mar 17969
  end;
17970
 
4 daniel-mar 17971
(*////////////////////////////////////////////////////////////////////////////
1 daniel-mar 17972
// definitions for the Wave link structure
4 daniel-mar 17973
///////////////////////////////////////////////////////////////////////////(*)
1 daniel-mar 17974
 
4 daniel-mar 17975
(* ****  For level 1 only WAVELINK_CHANNEL_MONO is valid  **** *)
17976
(* ulChannel allows for up to 32 channels of audio with each bit position *)
17977
(* specifiying a channel of playback *)
1 daniel-mar 17978
 
17979
const
4 daniel-mar 17980
  WAVELINK_CHANNEL_LEFT    = $0001;
17981
  WAVELINK_CHANNEL_RIGHT   = $0002;
1 daniel-mar 17982
 
4 daniel-mar 17983
  F_WAVELINK_PHASE_MASTER  = $0001;
1 daniel-mar 17984
 
17985
type
4 daniel-mar 17986
  PWaveLink = ^TWaveLink;
17987
  TWaveLink = packed record  (* any paths or links are stored right after struct *)
17988
    fusOptions :   Word;     (* options flags for this wave *)
17989
    usPhaseGroup : Word;     (* Phase grouping for locking channels *)
17990
    ulChannel :    ULONG;    (* channel placement *)
17991
    ulTableIndex : ULONG;    (* index into the wave pool table, 0 based *)
1 daniel-mar 17992
  end;
17993
 
17994
const
4 daniel-mar 17995
  POOL_CUE_NULL  = $ffffffff;
1 daniel-mar 17996
 
17997
type
4 daniel-mar 17998
  PPoolCUE = ^TPoolCUE;
17999
  TPoolCUE = packed record
18000
    ulOffset : ULONG;
1 daniel-mar 18001
  end;
18002
 
4 daniel-mar 18003
  PPoolTable = ^TPoolTable;
18004
  TPoolTable = packed record
18005
    cbSize : ULONG;             (* size of the pool table structure *)
18006
    cCues :  ULONG;             (* count of cues in the list *)
1 daniel-mar 18007
  end;
18008
 
4 daniel-mar 18009
(*////////////////////////////////////////////////////////////////////////////
1 daniel-mar 18010
// Structures for the "wsmp" chunk
4 daniel-mar 18011
///////////////////////////////////////////////////////////////////////////(*)
18012
 
1 daniel-mar 18013
const
4 daniel-mar 18014
  F_WSMP_NO_TRUNCATION     = $0001;
18015
  F_WSMP_NO_COMPRESSION    = $0002;
1 daniel-mar 18016
 
18017
type
4 daniel-mar 18018
  PWSMPL = ^TWSMPL;
18019
  TWSMPL = packed record
18020
    cbSize :        ULONG;
18021
    usUnityNote :   Word;       (* MIDI Unity Playback Note *)
18022
    sFineTune :     SmallInt;   (* Fine Tune in log tuning *)
18023
    lAttenuation :  Integer;    (* Overall Attenuation to be applied to data *)
18024
    fulOptions :    ULONG;      (* Flag options  *)
18025
    cSampleLoops :  ULONG;      (* Count of Sample loops, 0 loops is one shot *)
1 daniel-mar 18026
  end;
18027
 
18028
 
4 daniel-mar 18029
(* This loop type is a normal forward playing loop which is continually *)
18030
(* played until the envelope reaches an off threshold in the release *)
18031
(* portion of the volume envelope *)
18032
 
1 daniel-mar 18033
const
4 daniel-mar 18034
  WLOOP_TYPE_FORWARD  = 0;
1 daniel-mar 18035
 
18036
type
4 daniel-mar 18037
  TWLoop = packed record
18038
    cbSize :   ULONG;
18039
    ulType :   ULONG;           (* Loop Type *)
18040
    ulStart :  ULONG;           (* Start of loop in samples *)
18041
    ulLength : ULONG;           (* Length of loop in samples *)
1 daniel-mar 18042
  end;
18043
 
4 daniel-mar 18044
(*******************************************************************************
1 daniel-mar 18045
 
18046
dls2.h
18047
 
18048
Description:
18049
 
18050
Interface defines and structures for the DLS2 extensions of DLS.
18051
 
18052
 
18053
  Written by Microsoft 1998.  Released for public use.
18054
 
4 daniel-mar 18055
*******************************************************************************)
1 daniel-mar 18056
 
4 daniel-mar 18057
(*
18058
  FOURCC's used in the DLS2 file, in addition to DLS1 chunks
18059
*)
1 daniel-mar 18060
const
4 daniel-mar 18061
  FOURCC_RGN2  : mmioFOURCC = ('r','g','n','2');
18062
  FOURCC_LAR2  : mmioFOURCC = ('l','a','r','2');
18063
  FOURCC_ART2  : mmioFOURCC = ('a','r','t','2');
18064
  FOURCC_CDL   : mmioFOURCC = ('c','d','l',' ');
18065
//  FOURCC_DLID  : mmioFOURCC = ('d','l','i','d');
1 daniel-mar 18066
 
4 daniel-mar 18067
(*
18068
  Articulation connection graph definitions. These are in addition to
18069
  the definitions in the DLS1 header.
18070
*)
1 daniel-mar 18071
 
4 daniel-mar 18072
const
18073
(* Generic Sources (in addition to DLS1 sources. *)
18074
  CONN_SRC_POLYPRESSURE           = $0007;      (* Polyphonic Pressure *)
18075
  CONN_SRC_CHANNELPRESSURE      = $0008;        (* Channel Pressure *)
18076
  CONN_SRC_VIBRATO                    = $0009;  (* Vibrato LFO *)
18077
  CONN_SRC_MONOPRESSURE     = $000a; (* MIDI Mono pressure *)
1 daniel-mar 18078
 
18079
 
4 daniel-mar 18080
(* Midi Controllers *)
18081
  CONN_SRC_CC91                     = $00db;    (* Reverb Send *)
18082
  CONN_SRC_CC93                     = $00dd;    (* Chorus Send *)
1 daniel-mar 18083
 
18084
 
4 daniel-mar 18085
(* Generic Destinations *)
18086
  CONN_DST_GAIN                 = $0001;        (* Same as CONN_DST_ ATTENUATION *)
18087
  CONN_DST_KEYNUMBER            = $0005;        (* Key Number Generator *)
1 daniel-mar 18088
 
4 daniel-mar 18089
(* Audio Channel Output Destinations *)
18090
  CONN_DST_LEFT                     = $0010;    (* Left Channel Send *)
18091
  CONN_DST_RIGHT                        = $0011;        (* Right Channel Send *)
18092
  CONN_DST_CENTER                         = $0012;      (* Center Channel Send *)
18093
  CONN_DST_LEFTREAR                     = $0013;        (* Left Rear Channel Send *)
18094
  CONN_DST_RIGHTREAR            = $0014;        (* Right Rear Channel Send *)
18095
  CONN_DST_LFE_CHANNEL  = $0015;        (* LFE Channel Send *)
18096
  CONN_DST_CHORUS                         = $0080;      (* Chorus Send *)
18097
  CONN_DST_REVERB                         = $0081;      (* Reverb Send *)
1 daniel-mar 18098
 
4 daniel-mar 18099
(* Vibrato LFO Destinations *)
18100
  CONN_DST_VIB_FREQUENCY                = $0114;        (* Vibrato Frequency *)
18101
  CONN_DST_VIB_STARTDELAY         = $0115;      (* Vibrato Start Delay *)
1 daniel-mar 18102
 
4 daniel-mar 18103
(* EG1 Destinations *)
18104
  CONN_DST_EG1_DELAYTIME                = $020B;        (* EG1 Delay Time *)
18105
  CONN_DST_EG1_HOLDTIME         = $020C;        (* EG1 Hold Time *)
1 daniel-mar 18106
 
18107
 
4 daniel-mar 18108
(*      EG2 Destinations *)
18109
  CONN_DST_EG2_DELAYTIME                = $030F;        (* EG2 Delay Time *)
18110
  CONN_DST_EG2_HOLDTIME         = $0310;        (* EG2 Hold Time *)
1 daniel-mar 18111
 
18112
 
4 daniel-mar 18113
(* Filter Destinations *)
18114
  CONN_DST_FILTER_CUTOFF                = $0500;        (* Filter Cutoff Frequency *)
18115
  CONN_DST_FILTER_Q                     = $0501;        (* Filter Resonance *)
1 daniel-mar 18116
 
18117
 
4 daniel-mar 18118
(* Transforms *)
18119
  CONN_TRN_CONVEX                       = $0002;        (* Convex Transform *)
18120
  CONN_TRN_SWITCH                       = $0003;        (* Switch Transform *)
1 daniel-mar 18121
 
18122
 
4 daniel-mar 18123
(*      Conditional chunk operators *)
18124
  DLS_CDL_AND                          = $0001; (* X = X & Y *)
18125
  DLS_CDL_OR                           = $0002; (* X = X | Y *)
18126
  DLS_CDL_XOR                          = $0003; (* X = X ^ Y *)
18127
  DLS_CDL_ADD                        = $0004;   (* X = X + Y *)
18128
  DLS_CDL_SUBTRACT         = $0005;     (* X = X - Y *)
18129
  DLS_CDL_MULTIPLY           = $0006;   (* X = X * Y *)
18130
  DLS_CDL_DIVIDE                     = $0007;   (* X = X / Y *)
18131
  DLS_CDL_LOGICAL_AND      = $0008;     (* X = X && Y *)
18132
  DLS_CDL_LOGICAL_OR       = $0009;     (* X = X || Y *)
18133
  DLS_CDL_LT                           = $000A; (* X = (X < Y) *)
18134
  DLS_CDL_LE                           = $000B; (* X = (X <= Y) *)
18135
  DLS_CDL_GT                       = $000C;     (* X = (X > Y) *)
18136
  DLS_CDL_GE                       = $000D;     (* X = (X >= Y) *)
18137
  DLS_CDL_EQ                       = $000E;     (* X = (X == Y) *)
18138
  DLS_CDL_NOT                        = $000F;   (* X = !X *)
18139
  DLS_CDL_CONST            = $0010;     (* 32-bit constant *)
18140
  DLS_CDL_QUERY            = $0011;     (* 32-bit value returned from query *)
18141
  DLS_CDL_QUERYSUPPORTED = $0012;       (* Test to see if DLSID Query is supported *)
1 daniel-mar 18142
 
4 daniel-mar 18143
(*
18144
Loop and release
18145
*)
1 daniel-mar 18146
 
4 daniel-mar 18147
  WLOOP_TYPE_RELEASE  = 2;
1 daniel-mar 18148
 
4 daniel-mar 18149
(*
18150
DLSID queries for <cdl-ck>
18151
*)
1 daniel-mar 18152
 
4 daniel-mar 18153
  DLSID_GMInHardware : TGUID =        '{178f2f24-c364-11d1-a760-0000f875ac12}';
18154
  DLSID_GSInHardware : TGUID =        '{178f2f25-c364-11d1-a760-0000f875ac12}';
18155
  DLSID_XGInHardware : TGUID =        '{178f2f26-c364-11d1-a760-0000f875ac12}';
18156
  DLSID_SupportsDLS1 : TGUID =        '{178f2f27-c364-11d1-a760-0000f875ac12}';
18157
  DLSID_SupportsDLS2 : TGUID =        '{f14599e5-4689-11d2-afa6-00aa0024d8b6}';
18158
  DLSID_SampleMemorySize : TGUID =    '{178f2f28-c364-11d1-a760-0000f875ac12}';
18159
  DLSID_ManufacturersID : TGUID =     '{b03e1181-8095-11d2-a1ef-00600833dbd8}';
18160
  DLSID_ProductID : TGUID =           '{b03e1182-8095-11d2-a1ef-00600833dbd8}';
18161
  DLSID_SamplePlaybackRate : TGUID =  '{2a91f713-a4bf-11d2-bbdf-00600833dbd8}';
1 daniel-mar 18162
 
4 daniel-mar 18163
(************************************************************************
18164
*                                                                       *
18165
*   dmdls.h -- DLS download definitions for DirectMusic API's           *
18166
*                                                                       *
18167
*   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
18168
*                                                                       *
18169
************************************************************************)
1 daniel-mar 18170
 
18171
type
4 daniel-mar 18172
  TPCent =   LongInt;  (* Pitch cents *)
18173
  TGCent =   LongInt;  (* Gain cents *)
18174
  TTCent =   LongInt;  (* Time cents *)
18175
  TPercent = LongInt;  (* Per.. cent! *)
1 daniel-mar 18176
 
18177
  PReference_Time = ^TReference_Time;
4 daniel-mar 18178
  TReference_Time = LongLong;
1 daniel-mar 18179
 
4 daniel-mar 18180
  TFourCC = DWORD;   (* a four character code *)
1 daniel-mar 18181
 
4 daniel-mar 18182
//function MAKEFOURCC (ch0, ch1, ch2, ch3: Char) : TFourCC;
1 daniel-mar 18183
 
18184
type
4 daniel-mar 18185
  TDMus_DownloadInfor = packed record
18186
    dwDLType:                DWORD;      (* Instrument or Wave *)
18187
    dwDLId:                  DWORD;      (* Unique identifier to tag this download. *)
18188
    dwNumOffsetTableEntries: DWORD;      (* Number of index in the offset address table. *)
18189
    cbSize:                  DWORD;      (* Total size of this memory chunk. *)
1 daniel-mar 18190
  end;
18191
 
18192
const
4 daniel-mar 18193
  DMUS_DOWNLOADINFO_INSTRUMENT   = 1;
18194
  DMUS_DOWNLOADINFO_WAVE         = 2;
18195
  DMUS_DOWNLOADINFO_INSTRUMENT2  = 3;   (* New version for better DLS2 support. *)
1 daniel-mar 18196
 
4 daniel-mar 18197
  DMUS_DEFAULT_SIZE_OFFSETTABLE  = 1;
1 daniel-mar 18198
 
4 daniel-mar 18199
(* Flags for DMUS_INSTRUMENT's ulFlags member *)
1 daniel-mar 18200
 
4 daniel-mar 18201
  DMUS_INSTRUMENT_GM_INSTRUMENT  = 1 shl 0;
1 daniel-mar 18202
 
18203
type
4 daniel-mar 18204
  TDMus_OffsetTable = packed record
18205
    ulOffsetTable : array [0..DMUS_DEFAULT_SIZE_OFFSETTABLE-1] of ULONG;
1 daniel-mar 18206
  end;
18207
 
4 daniel-mar 18208
  TDMus_Instrument = packed record
18209
    ulPatch:          ULONG;
18210
    ulFirstRegionIdx: ULONG;
18211
    ulGlobalArtIdx:   ULONG;                 (* If zero the instrument does not have an articulation *)
18212
    ulFirstExtCkIdx:  ULONG;                 (* If zero no 3rd party entenstion chunks associated with the instrument *)
18213
    ulCopyrightIdx:   ULONG;                 (* If zero no Copyright information associated with the instrument *)
18214
    ulFlags:          ULONG;
1 daniel-mar 18215
  end;
18216
 
4 daniel-mar 18217
  TDMus_Region = packed record
18218
    RangeKey:         TRGNRange;
18219
    RangeVelocity:    TRGNRange;
18220
    fusOptions:       Word;
18221
    usKeyGroup:       Word;
18222
    ulRegionArtIdx:   ULONG;                 (* If zero the region does not have an articulation *)
18223
    ulNextRegionIdx:  ULONG;                 (* If zero no more regions *)
18224
    ulFirstExtCkIdx:  ULONG;                 (* If zero no 3rd party entenstion chunks associated with the region *)
18225
    WaveLink:         TWaveLink;
18226
    WSMP:             TWSMPL;                (*  If WSMP.cSampleLoops > 1 then a WLOOP is included *)
18227
    WLOOP:            array [0..0] of TWLoop;
1 daniel-mar 18228
  end;
18229
 
4 daniel-mar 18230
  TDMus_LFOParams = packed record
18231
    pcFrequency:   TPCent;
18232
    tcDelay:       TTCent;
18233
    gcVolumeScale: TGCent;
18234
    pcPitchScale:  TPCent;
18235
    gcMWToVolume:  TGCent;
18236
    pcMWToPitch:   TPCent;
1 daniel-mar 18237
  end;
18238
 
4 daniel-mar 18239
  TDMus_VEGParams = packed record
18240
    tcAttack:      TTCent;
18241
    tcDecay:       TTCent;
18242
    ptSustain:     TPercent;
18243
    tcRelease:     TTCent;
18244
    tcVel2Attack:  TTCent;
18245
    tcKey2Decay:   TTCent;
1 daniel-mar 18246
  end;
18247
 
4 daniel-mar 18248
  TDMus_PEGParams = packed record
18249
    tcAttack:      TTCent;
18250
    tcDecay:       TTCent;
18251
    ptSustain:     TPercent;
18252
    tcRelease:     TTCent;
18253
    tcVel2Attack:  TTCent;
18254
    tcKey2Decay:   TTCent;
18255
    pcRange:       TPCent;
1 daniel-mar 18256
  end;
18257
 
4 daniel-mar 18258
  TDMus_MSCParams = packed record
18259
    ptDefaultPan: TPercent;
1 daniel-mar 18260
  end;
18261
 
4 daniel-mar 18262
  TDMus_ArticParams = packed record
18263
    LFO:      TDMus_LFOParams;
18264
    VolEG:    TDMus_VEGParams;
18265
    PitchEG:  TDMus_PEGParams;
18266
    Misc:     TDMus_MSCParams;
1 daniel-mar 18267
  end;
18268
 
4 daniel-mar 18269
  TDMus_Articulation = packed record
18270
    ulArt1Idx:       ULONG;                  (* If zero no DLS Level 1 articulation chunk *)
18271
    ulFirstExtCkIdx: ULONG;                  (* If zero no 3rd party entenstion chunks associated with the articulation *)
1 daniel-mar 18272
  end;
18273
 
18274
const
18275
  DMUS_MIN_DATA_SIZE = 4;
18276
 
4 daniel-mar 18277
(*  The actual number is determined by cbSize of struct _DMUS_EXTENSIONCHUNK *)
18278
 
1 daniel-mar 18279
type
4 daniel-mar 18280
  DMus_ExtensionChunk = packed record
18281
    cbSize:                      ULONG;           (*  Size of extension chunk  *)
18282
    ulNextExtCkIdx:              ULONG;           (*  If zero no more 3rd party entenstion chunks *)
18283
    ExtCkID:                     TFourCC;
18284
    byExtCk: array [0..DMUS_MIN_DATA_SIZE-1] of BYTE;  (*  The actual number that follows is determined by cbSize *)
1 daniel-mar 18285
  end;
18286
 
4 daniel-mar 18287
(*  The actual number is determined by cbSize of struct _DMUS_COPYRIGHT *)
1 daniel-mar 18288
 
4 daniel-mar 18289
  TDmus_Copyright = packed record
18290
    cbSize:                          ULONG;              (*  Size of copyright information *)
18291
    byCopyright: array [0..DMUS_MIN_DATA_SIZE-1] of BYTE;               (*  The actual number that follows is determined by cbSize *)
1 daniel-mar 18292
  end;
18293
 
4 daniel-mar 18294
  TDMus_WaveData = packed record
18295
    cbSize:                     ULONG;          
18296
    byData: array [0..DMUS_MIN_DATA_SIZE-1] of BYTE;
1 daniel-mar 18297
  end;
18298
 
4 daniel-mar 18299
  TDMus_Wave = packed record
18300
    ulFirstExtCkIdx: ULONG;              (* If zero no 3rd party entenstion chunks associated with the wave *)
18301
    ulCopyrightIdx:  ULONG;              (* If zero no Copyright information associated with the wave *)
18302
    ulWaveDataIdx:   ULONG;              (* Location of actual wave data. *)
18303
///    WaveformatEx:    TWaveFormatEx;
1 daniel-mar 18304
  end;
18305
 
4 daniel-mar 18306
  PDMus_NoteRange = ^TDMus_NoteRange;
18307
  TDMus_NoteRange = packed record
18308
    dwLowNote:  DWORD;           (* Sets the low note for the range of MIDI note events to which the instrument responds.*)
18309
    dwHighNote: DWORD;           (* Sets the high note for the range of MIDI note events to which the instrument responds.*)
1 daniel-mar 18310
  end;
18311
 
4 daniel-mar 18312
(************************************************************************
18313
*                                                                       *
18314
*   dmerror.h -- Error code returned by DirectMusic API's               *
18315
*                                                                       *
18316
*   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
18317
*                                                                       *
18318
************************************************************************)
1 daniel-mar 18319
 
4 daniel-mar 18320
const
18321
  FACILITY_DIRECTMUSIC      = $878;       (* Shared with DirectSound *)
18322
  DMUS_ERRBASE              = $1000;      (* Make error codes human readable in hex *)
1 daniel-mar 18323
 
4 daniel-mar 18324
  MAKE_DMHRESULTSUCCESS = (0 shl 31) or (FACILITY_DIRECTMUSIC shl 16) or DMUS_ERRBASE;
18325
  MAKE_DMHRESULTERROR =   (1 shl 31) or (FACILITY_DIRECTMUSIC shl 16) or DMUS_ERRBASE;
1 daniel-mar 18326
 
18327
 
4 daniel-mar 18328
(* DMUS_S_PARTIALLOAD
18329
 *
18330
 * The object could only load partially. This can happen if some components are
18331
 * not registered properly, such as embedded tracks and tools.
18332
 *)
18333
  DMUS_S_PARTIALLOAD               = MAKE_DMHRESULTSUCCESS + $091;
1 daniel-mar 18334
 
4 daniel-mar 18335
(* DMUS_S_PARTIALDOWNLOAD
18336
 *
18337
 * This code indicates that a band download was only successful in reaching
18338
 * some, but not all, of the referenced ports. Some samples may not play
18339
 * correctly.
18340
 *)
18341
  DMUS_S_PARTIALDOWNLOAD          = MAKE_DMHRESULTSUCCESS + $092;
1 daniel-mar 18342
 
4 daniel-mar 18343
(* DMUS_S_REQUEUE
18344
 *
18345
 * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the
18346
 * performance that it should cue the PMsg again automatically.
18347
 *)
18348
  DMUS_S_REQUEUE                   = MAKE_DMHRESULTSUCCESS + $200;
1 daniel-mar 18349
 
4 daniel-mar 18350
(* DMUS_S_FREE
18351
 *
18352
 * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the
18353
 * performance that it should free the PMsg automatically.
18354
 *)
18355
  DMUS_S_FREE                      = MAKE_DMHRESULTSUCCESS + $201;
1 daniel-mar 18356
 
4 daniel-mar 18357
(* DMUS_S_END
18358
 *
18359
 * Return value from IDirectMusicTrack::Play() which indicates to the
18360
 * segment that the track has no more data after mtEnd.
18361
 *)
18362
  DMUS_S_END                       = MAKE_DMHRESULTSUCCESS + $202;
1 daniel-mar 18363
 
4 daniel-mar 18364
(* DMUS_S_STRING_TRUNCATED
18365
 *
18366
 * Returned string has been truncated to fit the buffer size.
18367
 *)
18368
  DMUS_S_STRING_TRUNCATED          = MAKE_DMHRESULTSUCCESS + $210;
1 daniel-mar 18369
 
4 daniel-mar 18370
(* DMUS_S_LAST_TOOL
18371
 *
18372
 * Returned from IDirectMusicGraph::StampPMsg(), this indicates that the PMsg
18373
 * is already stamped with the last tool in the graph. The returned PMsg's
18374
 * tool pointer is now NULL.
18375
 *)
18376
  DMUS_S_LAST_TOOL                 = MAKE_DMHRESULTSUCCESS + $211;
1 daniel-mar 18377
 
4 daniel-mar 18378
(* DMUS_S_OVER_CHORD
18379
 *
18380
 * Returned from IDirectMusicPerformance::MusicToMIDI(), this indicates
18381
 * that no note has been calculated because the music value has the note
18382
 * at a position higher than the top note of the chord. This applies only
18383
 * to DMUS_PLAYMODE_NORMALCHORD play mode. This success code indicates
18384
 * that the caller should not do anything with the note. It is not meant
18385
 * to be played against this chord.
18386
 *)
18387
  DMUS_S_OVER_CHORD                = MAKE_DMHRESULTSUCCESS + $212;
1 daniel-mar 18388
 
4 daniel-mar 18389
(* DMUS_S_UP_OCTAVE
18390
 *
18391
 * Returned from IDirectMusicPerformance::MIDIToMusic(),  and
18392
 * IDirectMusicPerformance::MusicToMIDI(), this indicates
18393
 * that the note conversion generated a note value that is below 0,
18394
 * so it has been bumped up one or more octaves to be in the proper
18395
 * MIDI range of 0 through 127.
18396
 * Note that this is valid for MIDIToMusic() when using play modes
18397
 * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of
18398
 * which store MIDI values in wMusicValue. With MusicToMIDI(), it is
18399
 * valid for all play modes.
18400
 * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code.
18401
 *)
18402
  DMUS_S_UP_OCTAVE                 = MAKE_DMHRESULTSUCCESS + $213;
1 daniel-mar 18403
 
4 daniel-mar 18404
(* DMUS_S_DOWN_OCTAVE
18405
 *
18406
 * Returned from IDirectMusicPerformance::MIDIToMusic(),  and
18407
 * IDirectMusicPerformance::MusicToMIDI(), this indicates
18408
 * that the note conversion generated a note value that is above 127,
18409
 * so it has been bumped down one or more octaves to be in the proper
18410
 * MIDI range of 0 through 127.
18411
 * Note that this is valid for MIDIToMusic() when using play modes
18412
 * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of
18413
 * which store MIDI values in wMusicValue. With MusicToMIDI(), it is
18414
 * valid for all play modes.
18415
 * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code.
18416
 *)
18417
  DMUS_S_DOWN_OCTAVE               = MAKE_DMHRESULTSUCCESS + $214;
1 daniel-mar 18418
 
4 daniel-mar 18419
(* DMUS_S_NOBUFFERCONTROL
18420
 *
18421
 * Although the audio output from the port will be routed to the
18422
 * same device as the given DirectSound buffer, buffer controls
18423
 * such as pan and volume will not affect the output.
18424
 *
18425
 *)
18426
  DMUS_S_NOBUFFERCONTROL          = MAKE_DMHRESULTSUCCESS + $215;
1 daniel-mar 18427
 
4 daniel-mar 18428
(* DMUS_E_DRIVER_FAILED
18429
 *
18430
 * An unexpected error was returned from a device driver, indicating
18431
 * possible failure of the driver or hardware.
18432
 *)
18433
  DMUS_E_DRIVER_FAILED            = MAKE_DMHRESULTERROR + $0101;
1 daniel-mar 18434
 
4 daniel-mar 18435
(* DMUS_E_PORTS_OPEN
18436
 *
18437
 * The requested operation cannot be performed while there are
18438
 * instantiated ports in any process in the system.
18439
 *)
18440
  DMUS_E_PORTS_OPEN               = MAKE_DMHRESULTERROR + $0102;
1 daniel-mar 18441
 
4 daniel-mar 18442
(* DMUS_E_DEVICE_IN_USE
18443
 *
18444
 * The requested device is already in use (possibly by a non-DirectMusic
18445
 * client) and cannot be opened again.
18446
 *)
18447
  DMUS_E_DEVICE_IN_USE            = MAKE_DMHRESULTERROR + $0103;
1 daniel-mar 18448
 
4 daniel-mar 18449
(* DMUS_E_INSUFFICIENTBUFFER
18450
 *
18451
 * Buffer is not large enough for requested operation.
18452
 *)
18453
  DMUS_E_INSUFFICIENTBUFFER       = MAKE_DMHRESULTERROR + $0104;
1 daniel-mar 18454
 
4 daniel-mar 18455
(* DMUS_E_BUFFERNOTSET
18456
 *
18457
 * No buffer was prepared for the download data.
18458
 *)
18459
  DMUS_E_BUFFERNOTSET             = MAKE_DMHRESULTERROR + $0105;
1 daniel-mar 18460
 
4 daniel-mar 18461
(* DMUS_E_BUFFERNOTAVAILABLE
18462
 *
18463
 * Download failed due to inability to access or create download buffer.
18464
 *)
18465
  DMUS_E_BUFFERNOTAVAILABLE       = MAKE_DMHRESULTERROR + $0106;
1 daniel-mar 18466
 
4 daniel-mar 18467
(* DMUS_E_NOTADLSCOL
18468
 *
18469
 * Error parsing DLS collection. File is corrupt.
18470
 *)
18471
  DMUS_E_NOTADLSCOL               = MAKE_DMHRESULTERROR + $0108;
1 daniel-mar 18472
 
4 daniel-mar 18473
(* DMUS_E_INVALIDOFFSET
18474
 *
18475
 * Wave chunks in DLS collection file are at incorrect offsets.
18476
 *)
18477
  DMUS_E_INVALIDOFFSET            = MAKE_DMHRESULTERROR + $0109;
1 daniel-mar 18478
 
4 daniel-mar 18479
(* DMUS_E_ALREADY_LOADED
18480
 *
18481
 * Second attempt to load a DLS collection that is currently open.
18482
 *)
18483
  DMUS_E_ALREADY_LOADED           = MAKE_DMHRESULTERROR + $0111;
1 daniel-mar 18484
 
4 daniel-mar 18485
(* DMUS_E_INVALIDPOS
18486
 *
18487
 * Error reading wave data from DLS collection. Indicates bad file.
18488
 *)
18489
  DMUS_E_INVALIDPOS               = MAKE_DMHRESULTERROR + $0113;
1 daniel-mar 18490
 
4 daniel-mar 18491
(* DMUS_E_INVALIDPATCH
18492
 *
18493
 * There is no instrument in the collection that matches patch number.
18494
 *)
18495
  DMUS_E_INVALIDPATCH             = MAKE_DMHRESULTERROR + $0114;
1 daniel-mar 18496
 
4 daniel-mar 18497
(* DMUS_E_CANNOTSEEK
18498
 *
18499
 * The IStream* doesn't support Seek().
18500
 *)
18501
  DMUS_E_CANNOTSEEK               = MAKE_DMHRESULTERROR + $0115;
1 daniel-mar 18502
 
4 daniel-mar 18503
(* DMUS_E_CANNOTWRITE
18504
 *
18505
 * The IStream* doesn't support Write().
18506
 *)
18507
  DMUS_E_CANNOTWRITE              = MAKE_DMHRESULTERROR + $0116;
1 daniel-mar 18508
 
4 daniel-mar 18509
(* DMUS_E_CHUNKNOTFOUND
18510
 *
18511
 * The RIFF parser doesn't contain a required chunk while parsing file.
18512
 *)
18513
  DMUS_E_CHUNKNOTFOUND            = MAKE_DMHRESULTERROR + $0117;
1 daniel-mar 18514
 
4 daniel-mar 18515
(* DMUS_E_INVALID_DOWNLOADID
18516
 *
18517
 * Invalid download id was used in the process of creating a download buffer.
18518
 *)
18519
  DMUS_E_INVALID_DOWNLOADID       = MAKE_DMHRESULTERROR + $0119;
1 daniel-mar 18520
 
4 daniel-mar 18521
(* DMUS_E_NOT_DOWNLOADED_TO_PORT
18522
 *
18523
 * Tried to unload an object that was not downloaded or previously unloaded.
18524
 *)
18525
  DMUS_E_NOT_DOWNLOADED_TO_PORT   = MAKE_DMHRESULTERROR + $0120;
1 daniel-mar 18526
 
4 daniel-mar 18527
(* DMUS_E_ALREADY_DOWNLOADED
18528
 *
18529
 * Buffer was already downloaded to synth.
18530
 *)
18531
  DMUS_E_ALREADY_DOWNLOADED       = MAKE_DMHRESULTERROR + $0121;
1 daniel-mar 18532
 
4 daniel-mar 18533
(* DMUS_E_UNKNOWN_PROPERTY
18534
 *
18535
 * The specified property item was not recognized by the target object.
18536
 *)
18537
  DMUS_E_UNKNOWN_PROPERTY         = MAKE_DMHRESULTERROR + $0122;
1 daniel-mar 18538
 
4 daniel-mar 18539
(* DMUS_E_SET_UNSUPPORTED
18540
 *
18541
 * The specified property item may not be set on the target object.
18542
 *)
18543
  DMUS_E_SET_UNSUPPORTED          = MAKE_DMHRESULTERROR + $0123;
1 daniel-mar 18544
 
4 daniel-mar 18545
(* DMUS_E_GET_UNSUPPORTED
18546
 *
18547
 * The specified property item may not be retrieved from the target object.
18548
 *)
18549
  DMUS_E_GET_UNSUPPORTED          = MAKE_DMHRESULTERROR + $0124;
1 daniel-mar 18550
 
4 daniel-mar 18551
(* DMUS_E_NOTMONO
18552
 *
18553
 * Wave chunk has more than one interleaved channel. DLS format requires MONO.
18554
 *)
18555
  DMUS_E_NOTMONO                  = MAKE_DMHRESULTERROR + $0125;
1 daniel-mar 18556
 
4 daniel-mar 18557
(* DMUS_E_BADARTICULATION
18558
 *
18559
 * Invalid articulation chunk in DLS collection.
18560
 *)
18561
  DMUS_E_BADARTICULATION          = MAKE_DMHRESULTERROR + $0126;
1 daniel-mar 18562
 
4 daniel-mar 18563
(* DMUS_E_BADINSTRUMENT
18564
 *
18565
 * Invalid instrument chunk in DLS collection.
18566
 *)
18567
  DMUS_E_BADINSTRUMENT            = MAKE_DMHRESULTERROR + $0127;
1 daniel-mar 18568
 
4 daniel-mar 18569
(* DMUS_E_BADWAVELINK
18570
 *
18571
 * Wavelink chunk in DLS collection points to invalid wave.
18572
 *)
18573
  DMUS_E_BADWAVELINK              = MAKE_DMHRESULTERROR + $0128;
1 daniel-mar 18574
 
4 daniel-mar 18575
(* DMUS_E_NOARTICULATION
18576
 *
18577
 * Articulation missing from instrument in DLS collection.
18578
 *)
18579
  DMUS_E_NOARTICULATION           = MAKE_DMHRESULTERROR + $0129;
1 daniel-mar 18580
 
4 daniel-mar 18581
(* DMUS_E_NOTPCM
18582
 *
18583
 * Downoaded DLS wave is not in PCM format.
18584
*)
18585
  DMUS_E_NOTPCM                   = MAKE_DMHRESULTERROR + $012A;
1 daniel-mar 18586
 
4 daniel-mar 18587
(* DMUS_E_BADWAVE
18588
 *
18589
 * Bad wave chunk in DLS collection
18590
 *)
18591
  DMUS_E_BADWAVE                  = MAKE_DMHRESULTERROR + $012B;
1 daniel-mar 18592
 
4 daniel-mar 18593
(* DMUS_E_BADOFFSETTABLE
18594
 *
18595
 * Offset Table for download buffer has errors.
18596
 *)
18597
  DMUS_E_BADOFFSETTABLE           = MAKE_DMHRESULTERROR + $012C;
1 daniel-mar 18598
 
4 daniel-mar 18599
(* DMUS_E_UNKNOWNDOWNLOAD
18600
 *
18601
 * Attempted to download unknown data type.
18602
 *)
18603
  DMUS_E_UNKNOWNDOWNLOAD          = MAKE_DMHRESULTERROR + $012D;
1 daniel-mar 18604
 
4 daniel-mar 18605
(* DMUS_E_NOSYNTHSINK
18606
 *
18607
 * The operation could not be completed because no sink was connected to
18608
 * the synthesizer.
18609
 *)
18610
  DMUS_E_NOSYNTHSINK              = MAKE_DMHRESULTERROR + $012E;
1 daniel-mar 18611
 
4 daniel-mar 18612
(* DMUS_E_ALREADYOPEN
18613
 *
18614
 * An attempt was made to open the software synthesizer while it was already
18615
 * open.
18616
 * ASSERT?
18617
 *)
18618
  DMUS_E_ALREADYOPEN              = MAKE_DMHRESULTERROR + $012F;
1 daniel-mar 18619
 
4 daniel-mar 18620
(* DMUS_E_ALREADYCLOSE
18621
 *
18622
 * An attempt was made to close the software synthesizer while it was already
18623
 * open.
18624
 * ASSERT?
18625
 *)
18626
  DMUS_E_ALREADYCLOSED            = MAKE_DMHRESULTERROR + $0130;
1 daniel-mar 18627
 
4 daniel-mar 18628
(* DMUS_E_SYNTHNOTCONFIGURED
18629
 *
18630
 * The operation could not be completed because the software synth has not
18631
 * yet been fully configured.
18632
 * ASSERT?
18633
 *)
18634
  DMUS_E_SYNTHNOTCONFIGURED       = MAKE_DMHRESULTERROR + $0131;
1 daniel-mar 18635
 
4 daniel-mar 18636
(* DMUS_E_SYNTHACTIVE
18637
 *
18638
 * The operation cannot be carried out while the synthesizer is active.
18639
 *)
18640
  DMUS_E_SYNTHACTIVE              = MAKE_DMHRESULTERROR + $0132;
1 daniel-mar 18641
 
4 daniel-mar 18642
(* DMUS_E_CANNOTREAD
18643
 *
18644
 * An error occurred while attempting to read from the IStream* object.
18645
 *)
18646
  DMUS_E_CANNOTREAD               = MAKE_DMHRESULTERROR + $0133;
1 daniel-mar 18647
 
4 daniel-mar 18648
(* DMUS_E_DMUSIC_RELEASED
18649
 *
18650
 * The operation cannot be performed because the final instance of the
18651
 * DirectMusic object was released. Ports cannot be used after final
18652
 * release of the DirectMusic object.
18653
 *)
18654
  DMUS_E_DMUSIC_RELEASED          = MAKE_DMHRESULTERROR + $0134;
1 daniel-mar 18655
 
4 daniel-mar 18656
(* DMUS_E_BUFFER_EMPTY
18657
 *
18658
 * There was no data in the referenced buffer.
18659
 *)
18660
  DMUS_E_BUFFER_EMPTY             = MAKE_DMHRESULTERROR + $0135;
1 daniel-mar 18661
 
4 daniel-mar 18662
(* DMUS_E_BUFFER_FULL
18663
 *
18664
 * There is insufficient space to insert the given event into the buffer.
18665
 *)
18666
  DMUS_E_BUFFER_FULL              = MAKE_DMHRESULTERROR + $0136;
1 daniel-mar 18667
 
4 daniel-mar 18668
(* DMUS_E_PORT_NOT_CAPTURE
18669
 *
18670
 * The given operation could not be carried out because the port is a
18671
 * capture port.
18672
 *)
18673
  DMUS_E_PORT_NOT_CAPTURE         = MAKE_DMHRESULTERROR + $0137;
1 daniel-mar 18674
 
4 daniel-mar 18675
(* DMUS_E_PORT_NOT_RENDER
18676
 *
18677
 * The given operation could not be carried out because the port is a
18678
 * render port.
18679
 *)
18680
  DMUS_E_PORT_NOT_RENDER          = MAKE_DMHRESULTERROR + $0138;
1 daniel-mar 18681
 
4 daniel-mar 18682
(* DMUS_E_DSOUND_NOT_SET
18683
 *
18684
 * The port could not be created because no DirectSound has been specified.
18685
 * Specify a DirectSound interface via the IDirectMusic::SetDirectSound
18686
 * method; pass NULL to have DirectMusic manage usage of DirectSound.
18687
 *)
18688
  DMUS_E_DSOUND_NOT_SET           = MAKE_DMHRESULTERROR + $0139;
1 daniel-mar 18689
 
4 daniel-mar 18690
(* DMUS_E_ALREADY_ACTIVATED
18691
 *
18692
 * The operation cannot be carried out while the port is active.
18693
 *)
18694
  DMUS_E_ALREADY_ACTIVATED        = MAKE_DMHRESULTERROR + $013A;
1 daniel-mar 18695
 
4 daniel-mar 18696
(* DMUS_E_INVALIDBUFFER
18697
 *
18698
 * Invalid DirectSound buffer was handed to port.
18699
 *)
18700
  DMUS_E_INVALIDBUFFER            = MAKE_DMHRESULTERROR + $013B;
1 daniel-mar 18701
 
4 daniel-mar 18702
(* DMUS_E_WAVEFORMATNOTSUPPORTED
18703
 *
18704
 * Invalid buffer format was handed to the synth sink.
18705
 *)
18706
  DMUS_E_WAVEFORMATNOTSUPPORTED   = MAKE_DMHRESULTERROR + $013C;
1 daniel-mar 18707
 
4 daniel-mar 18708
(* DMUS_E_SYNTHINACTIVE
18709
 *
18710
 * The operation cannot be carried out while the synthesizer is inactive.
18711
 *)
18712
  DMUS_E_SYNTHINACTIVE            = MAKE_DMHRESULTERROR + $013D;
1 daniel-mar 18713
 
4 daniel-mar 18714
(* DMUS_E_DSOUND_ALREADY_SET
18715
 *
18716
 * IDirectMusic::SetDirectSound has already been called. It may not be
18717
 * changed while in use.
18718
 *)
18719
  DMUS_E_DSOUND_ALREADY_SET       = MAKE_DMHRESULTERROR + $013E;
1 daniel-mar 18720
 
4 daniel-mar 18721
(* DMUS_E_INVALID_EVENT
18722
 *
18723
 * The given event is invalid (either it is not a valid MIDI message
18724
 * or it makes use of running status). The event cannot be packed
18725
 * into the buffer.
18726
 *)
18727
  DMUS_E_INVALID_EVENT            = MAKE_DMHRESULTERROR + $013F;
1 daniel-mar 18728
 
4 daniel-mar 18729
(* DMUS_E_UNSUPPORTED_STREAM
18730
 *
18731
 * The IStream* object does not contain data supported by the loading object.
18732
 *)
18733
  DMUS_E_UNSUPPORTED_STREAM       = MAKE_DMHRESULTERROR + $0150;
1 daniel-mar 18734
 
4 daniel-mar 18735
(* DMUS_E_ALREADY_INITED
18736
 *
18737
 * The object has already been initialized.
18738
 *)
18739
  DMUS_E_ALREADY_INITED           = MAKE_DMHRESULTERROR + $0151;
1 daniel-mar 18740
 
4 daniel-mar 18741
(* DMUS_E_INVALID_BAND
18742
 *
18743
 * The file does not contain a valid band.
18744
 *)
18745
  DMUS_E_INVALID_BAND             = MAKE_DMHRESULTERROR + $0152;
1 daniel-mar 18746
 
4 daniel-mar 18747
(* DMUS_E_TRACK_HDR_NOT_FIRST_CK
18748
 *
18749
 * The IStream* object's data does not have a track header as the first chunk,
18750
 * and therefore can not be read by the segment object.
18751
 *)
18752
  DMUS_E_TRACK_HDR_NOT_FIRST_CK   = MAKE_DMHRESULTERROR + $0155;
1 daniel-mar 18753
 
4 daniel-mar 18754
(* DMUS_E_TOOL_HDR_NOT_FIRST_CK
18755
 *
18756
 * The IStream* object's data does not have a tool header as the first chunk,
18757
 * and therefore can not be read by the graph object.
18758
 *)
18759
  DMUS_E_TOOL_HDR_NOT_FIRST_CK    = MAKE_DMHRESULTERROR + $0156;
1 daniel-mar 18760
 
4 daniel-mar 18761
(* DMUS_E_INVALID_TRACK_HDR
18762
 *
18763
 * The IStream* object's data contains an invalid track header (ckid is 0 and
18764
 * fccType is NULL,) and therefore can not be read by the segment object.
18765
 *)
18766
  DMUS_E_INVALID_TRACK_HDR        = MAKE_DMHRESULTERROR + $0157;
1 daniel-mar 18767
 
4 daniel-mar 18768
(* DMUS_E_INVALID_TOOL_HDR
18769
 *
18770
 * The IStream* object's data contains an invalid tool header (ckid is 0 and
18771
 * fccType is NULL,) and therefore can not be read by the graph object.
18772
 *)
18773
  DMUS_E_INVALID_TOOL_HDR         = MAKE_DMHRESULTERROR + $0158;
1 daniel-mar 18774
 
4 daniel-mar 18775
(* DMUS_E_ALL_TOOLS_FAILED
18776
 *
18777
 * The graph object was unable to load all tools from the IStream* object data.
18778
 * This may be due to errors in the stream, or the tools being incorrectly
18779
 * registered on the client.
18780
 *)
18781
  DMUS_E_ALL_TOOLS_FAILED         = MAKE_DMHRESULTERROR + $0159;
1 daniel-mar 18782
 
4 daniel-mar 18783
(* DMUS_E_ALL_TRACKS_FAILED
18784
 *
18785
 * The segment object was unable to load all tracks from the IStream* object data.
18786
 * This may be due to errors in the stream, or the tracks being incorrectly
18787
 * registered on the client.
18788
 *)
18789
  DMUS_E_ALL_TRACKS_FAILED        = MAKE_DMHRESULTERROR + $0160;
1 daniel-mar 18790
 
4 daniel-mar 18791
(* DMUS_E_NOT_FOUND
18792
 *
18793
 * The requested item was not contained by the object.
18794
 *)
18795
  DMUS_E_NOT_FOUND                = MAKE_DMHRESULTERROR + $0161;
1 daniel-mar 18796
 
4 daniel-mar 18797
(* DMUS_E_NOT_INIT
18798
 *
18799
 * A required object is not initialized or failed to initialize.
18800
 *)
18801
  DMUS_E_NOT_INIT                 = MAKE_DMHRESULTERROR + $0162;
1 daniel-mar 18802
 
4 daniel-mar 18803
(* DMUS_E_TYPE_DISABLED
18804
 *
18805
 * The requested parameter type is currently disabled. Parameter types may
18806
 * be enabled and disabled by certain calls to SetParam().
18807
 *)
18808
  DMUS_E_TYPE_DISABLED            = MAKE_DMHRESULTERROR + $0163;
1 daniel-mar 18809
 
4 daniel-mar 18810
(* DMUS_E_TYPE_UNSUPPORTED
18811
 *
18812
 * The requested parameter type is not supported on the object.
18813
 *)
18814
  DMUS_E_TYPE_UNSUPPORTED         = MAKE_DMHRESULTERROR + $0164;
1 daniel-mar 18815
 
4 daniel-mar 18816
(* DMUS_E_TIME_PAST
18817
 *
18818
 * The time is in the past, and the operation can not succeed.
18819
 *)
18820
  DMUS_E_TIME_PAST                = MAKE_DMHRESULTERROR + $0165;
1 daniel-mar 18821
 
4 daniel-mar 18822
(* DMUS_E_TRACK_NOT_FOUND
18823
 *
18824
 * The requested track is not contained by the segment.
18825
 *)
18826
  DMUS_E_TRACK_NOT_FOUND        = MAKE_DMHRESULTERROR + $0166;
1 daniel-mar 18827
 
4 daniel-mar 18828
(* DMUS_E_NO_MASTER_CLOCK
18829
 *
18830
 * There is no master clock in the performance. Be sure to call
18831
 * IDirectMusicPerformance::Init().
18832
 *)
18833
  DMUS_E_NO_MASTER_CLOCK          = MAKE_DMHRESULTERROR + $0170;
1 daniel-mar 18834
 
4 daniel-mar 18835
(* DMUS_E_LOADER_NOCLASSID
18836
 *
18837
 * The class id field is required and missing in the DMUS_OBJECTDESC.
18838
 *)
18839
  DMUS_E_LOADER_NOCLASSID         = MAKE_DMHRESULTERROR + $0180;
1 daniel-mar 18840
 
4 daniel-mar 18841
(* DMUS_E_LOADER_BADPATH
18842
 *
18843
 * The requested file path is invalid.
18844
 *)
18845
  DMUS_E_LOADER_BADPATH           = MAKE_DMHRESULTERROR + $0181;
1 daniel-mar 18846
 
4 daniel-mar 18847
(* DMUS_E_LOADER_FAILEDOPEN
18848
 *
18849
 * File open failed - either file doesn't exist or is locked.
18850
 *)
18851
  DMUS_E_LOADER_FAILEDOPEN        = MAKE_DMHRESULTERROR + $0182;
1 daniel-mar 18852
 
4 daniel-mar 18853
(* DMUS_E_LOADER_FORMATNOTSUPPORTED
18854
 *
18855
 * Search data type is not supported.
18856
 *)
18857
  DMUS_E_LOADER_FORMATNOTSUPPORTED    = MAKE_DMHRESULTERROR + $0183;
1 daniel-mar 18858
 
4 daniel-mar 18859
(* DMUS_E_LOADER_FAILEDCREATE
18860
 *
18861
 * Unable to find or create object.
18862
 *)
18863
  DMUS_E_LOADER_FAILEDCREATE      = MAKE_DMHRESULTERROR + $0184;
1 daniel-mar 18864
 
4 daniel-mar 18865
(* DMUS_E_LOADER_OBJECTNOTFOUND
18866
 *
18867
 * Object was not found.
18868
 *)
18869
  DMUS_E_LOADER_OBJECTNOTFOUND    = MAKE_DMHRESULTERROR + $0185;
1 daniel-mar 18870
 
4 daniel-mar 18871
(* DMUS_E_LOADER_NOFILENAME
18872
 *
18873
 * The file name is missing from the DMUS_OBJECTDESC.
18874
 *)
18875
  DMUS_E_LOADER_NOFILENAME          = MAKE_DMHRESULTERROR + $0186;
1 daniel-mar 18876
 
4 daniel-mar 18877
(* DMUS_E_INVALIDFILE
18878
 *
18879
 * The file requested is not a valid file.
18880
 *)
18881
  DMUS_E_INVALIDFILE              = MAKE_DMHRESULTERROR + $0200;
1 daniel-mar 18882
 
4 daniel-mar 18883
(* DMUS_E_ALREADY_EXISTS
18884
 *
18885
 * The tool is already contained in the graph. Create a new instance.
18886
 *)
18887
  DMUS_E_ALREADY_EXISTS           = MAKE_DMHRESULTERROR + $0201;
1 daniel-mar 18888
 
4 daniel-mar 18889
(* DMUS_E_OUT_OF_RANGE
18890
 *
18891
 * Value is out of range, for instance the requested length is longer than
18892
 * the segment.
18893
 *)
18894
  DMUS_E_OUT_OF_RANGE             = MAKE_DMHRESULTERROR + $0202;
1 daniel-mar 18895
 
4 daniel-mar 18896
(* DMUS_E_SEGMENT_INIT_FAILED
18897
 *
18898
 * Segment initialization failed, most likely due to a critical memory situation.
18899
 *)
18900
  DMUS_E_SEGMENT_INIT_FAILED      = MAKE_DMHRESULTERROR + $0203;
1 daniel-mar 18901
 
4 daniel-mar 18902
(* DMUS_E_ALREADY_SENT
18903
 *
18904
 * The DMUS_PMSG has already been sent to the performance object via
18905
 * IDirectMusicPerformance::SendPMsg().
18906
 *)
18907
  DMUS_E_ALREADY_SENT             = MAKE_DMHRESULTERROR + $0204;
1 daniel-mar 18908
 
4 daniel-mar 18909
(* DMUS_E_CANNOT_FREE
18910
 *
18911
 * The DMUS_PMSG was either not allocated by the performance via
18912
 * IDirectMusicPerformance::AllocPMsg(), or it was already freed via
18913
 * IDirectMusicPerformance::FreePMsg().
18914
 *)
18915
  DMUS_E_CANNOT_FREE              = MAKE_DMHRESULTERROR + $0205;
1 daniel-mar 18916
 
4 daniel-mar 18917
(* DMUS_E_CANNOT_OPEN_PORT
18918
 *
18919
 * The default system port could not be opened.
18920
 *)
18921
  DMUS_E_CANNOT_OPEN_PORT         = MAKE_DMHRESULTERROR + $0206;
1 daniel-mar 18922
 
4 daniel-mar 18923
(* DMUS_E_CONNOT_CONVERT
18924
 *
18925
 * A call to MIDIToMusic() or MusicToMIDI() resulted in an error because
18926
 * the requested conversion could not happen. This usually occurs when the
18927
 * provided DMUS_CHORD_KEY structure has an invalid chord or scale pattern.
18928
 *)
18929
  DMUS_E_CONNOT_CONVERT           = MAKE_DMHRESULTERROR + $0207;
1 daniel-mar 18930
 
4 daniel-mar 18931
(* DMUS_E_DESCEND_CHUNK_FAIL
18932
 *
18933
 * DMUS_E_DESCEND_CHUNK_FAIL is returned when the end of the file
18934
 * was reached before the desired chunk was found.
18935
 *)
18936
  DMUS_E_DESCEND_CHUNK_FAIL       = MAKE_DMHRESULTERROR + $0210;
1 daniel-mar 18937
 
4 daniel-mar 18938
 
18939
(************************************************************************
18940
*                                                                       *
18941
*   dmksctrl.h -- Definition of IKsControl                              *
18942
*                                                                       *
18943
*   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
18944
*                                                                       *
18945
*                                                                       *
18946
*   This header file contains the definition of IKsControl, which       *
18947
*   duplicates definitions from ks.h and ksproxy.h. Your code should    *
18948
*   include ks.h and ksproxy.h directly if you have them (they are      *
18949
*   provided in the Windows 98 DDK and will be in the Windows NT 5      *
18950
*   SDK).                                                               *
18951
*                                                                       *
18952
************************************************************************)
1 daniel-mar 18953
 
4 daniel-mar 18954
(*
18955
 * Warning: This will prevent the rest of ks.h from being pulled in if ks.h is
18956
 * included after dmksctrl.h. Make sure you do not include both headers in
18957
 * the same source file.
18958
 *)
1 daniel-mar 18959
 
18960
type
4 daniel-mar 18961
  PKsIdentifier = ^TKsIdentifier;
18962
  TKsIdentifier = packed record
18963
    case integer of
18964
      1 : (
18965
             Set_: TGUID;
18966
             Id : ULONG;
18967
             Flags: ULONG
18968
          );
18969
      2 : (Alignment: LONGLONG);
1 daniel-mar 18970
  end;
18971
 
4 daniel-mar 18972
  PKsProperty = ^TKsProperty;
18973
  TKsProperty = TKsIdentifier;
1 daniel-mar 18974
 
4 daniel-mar 18975
  PKsMethod = ^TKsMethod;
18976
  TKsMethod = TKsIdentifier;
1 daniel-mar 18977
 
4 daniel-mar 18978
  PKsEvent = ^TKsEvent;
18979
  TKsEvent = TKsIdentifier;
1 daniel-mar 18980
 
18981
const
4 daniel-mar 18982
  KSMETHOD_TYPE_NONE                  = $00000000;
18983
  KSMETHOD_TYPE_READ                  = $00000001;
18984
  KSMETHOD_TYPE_WRITE                 = $00000002;
18985
  KSMETHOD_TYPE_MODIFY                = $00000003;
18986
  KSMETHOD_TYPE_SOURCE                = $00000004;
1 daniel-mar 18987
 
4 daniel-mar 18988
  KSMETHOD_TYPE_SEND                  = $00000001;
18989
  KSMETHOD_TYPE_SETSUPPORT            = $00000100;
18990
  KSMETHOD_TYPE_BASICSUPPORT          = $00000200;
1 daniel-mar 18991
 
4 daniel-mar 18992
  KSPROPERTY_TYPE_GET                 = $00000001;
18993
  KSPROPERTY_TYPE_SET                 = $00000002;
18994
  KSPROPERTY_TYPE_SETSUPPORT          = $00000100;
18995
  KSPROPERTY_TYPE_BASICSUPPORT        = $00000200;
18996
  KSPROPERTY_TYPE_RELATIONS           = $00000400;
18997
  KSPROPERTY_TYPE_SERIALIZESET        = $00000800;
18998
  KSPROPERTY_TYPE_UNSERIALIZESET      = $00001000;
18999
  KSPROPERTY_TYPE_SERIALIZERAW        = $00002000;
19000
  KSPROPERTY_TYPE_UNSERIALIZERAW      = $00004000;
19001
  KSPROPERTY_TYPE_SERIALIZESIZE       = $00008000;
19002
  KSPROPERTY_TYPE_DEFAULTVALUES       = $00010000;
1 daniel-mar 19003
 
4 daniel-mar 19004
  KSPROPERTY_TYPE_TOPOLOGY            = $10000000;
1 daniel-mar 19005
 
19006
type
4 daniel-mar 19007
  IKsControl = interface (IUnknown)
19008
    ['{28F54685-06FD-11D2-B27A-00A0C9223196}']
19009
    function KsProperty (const pProperty: TKsProperty; PropertyLength: ULONG;
19010
        var PropertyData; DataLength: ULONG; out BytesReturned: ULONG) : HResult; stdcall;
19011
    function KsMethod(const Method: TKsMethod; MethodLength: ULONG;
19012
        var MethodData; DataLength: ULONG; out BytesReturned: ULONG) : HResult; stdcall;
19013
    function KsEvent (const Event: TKsEvent; EventLength: ULONG;
19014
        var EventData; DataLength: ULONG; out BytesReturned: ULONG) : HResult; stdcall;
1 daniel-mar 19015
  end;
19016
 
4 daniel-mar 19017
type
19018
  IID_IKsControl = IKsControl;
19019
  STATIC_IID_IKsControl = IID_IKsControl;
1 daniel-mar 19020
 
19021
 
19022
const
4 daniel-mar 19023
(* These formats are in ksmedia.h
19024
 *)
19025
  KSDATAFORMAT_SUBTYPE_MIDI : TGUID = '{1D262760-E957-11CF-A5D6-28DB04C10000}';
1 daniel-mar 19026
 
4 daniel-mar 19027
  KSDATAFORMAT_SUBTYPE_DIRECTMUSIC : TGUID = '{1a82f8bc-3f8b-11d2-b774-0060083316c1}';
19028
 
19029
(************************************************************************
19030
*                                                                       *
19031
*   dmusicc.h -- This module defines the DirectMusic core API's         *
19032
*                                                                       *
19033
*   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
19034
*                                                                       *
19035
************************************************************************)
1 daniel-mar 19036
 
19037
const
19038
  DMUS_MAX_DESCRIPTION = 128;
4 daniel-mar 19039
  DMUS_MAX_DRIVER = 128;
1 daniel-mar 19040
 
19041
type
4 daniel-mar 19042
  PDMus_BufferDesc = ^TDMus_BufferDesc;
19043
  TDMus_BufferDesc = packed record
19044
    dwSize,
19045
    dwFlags : DWORD;
1 daniel-mar 19046
    guidBufferFormat : TGUID;
4 daniel-mar 19047
    cbBuffer : DWORD;
1 daniel-mar 19048
  end;
19049
 
19050
const
4 daniel-mar 19051
(* DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS
19052
 * and DMUS_PORTPARAMS.
19053
 *)
19054
  DMUS_EFFECT_NONE             = $00000000;
19055
  DMUS_EFFECT_REVERB           = $00000001;
19056
  DMUS_EFFECT_CHORUS           = $00000002;
1 daniel-mar 19057
 
4 daniel-mar 19058
(* For DMUS_PORTCAPS dwClass
19059
 *)
19060
  DMUS_PC_INPUTCLASS        = 0;
19061
  DMUS_PC_OUTPUTCLASS       = 1;
1 daniel-mar 19062
 
4 daniel-mar 19063
(* For DMUS_PORTCAPS dwFlags
19064
 *)
19065
  DMUS_PC_DLS              = $00000001;
19066
  DMUS_PC_EXTERNAL         = $00000002;
19067
  DMUS_PC_SOFTWARESYNTH    = $00000004;
19068
  DMUS_PC_MEMORYSIZEFIXED  = $00000008;
19069
  DMUS_PC_GMINHARDWARE     = $00000010;
19070
  DMUS_PC_GSINHARDWARE     = $00000020;
19071
  DMUS_PC_XGINHARDWARE     = $00000040;
19072
  DMUS_PC_DIRECTSOUND      = $00000080;
19073
  DMUS_PC_SHAREABLE        = $00000100;
19074
  DMUS_PC_DLS2             = $00000200;
19075
  DMUS_PC_SYSTEMMEMORY     = $7FFFFFFF;
1 daniel-mar 19076
 
19077
type
4 daniel-mar 19078
  PDMus_PortCaps = ^TDMus_PortCaps;
19079
  TDMus_PortCaps = packed record
19080
    dwSize:              DWORD;
19081
    dwFlags:             DWORD;
19082
    guidPort:            TGUID;
19083
    dwClass:             DWORD;
19084
    dwType:              DWORD;
19085
    dwMemorySize:        DWORD;
19086
    dwMaxChannelGroups:  DWORD;
19087
    dwMaxVoices:         DWORD;
19088
    dwMaxAudioChannels:  DWORD;
19089
    dwEffectFlags:       DWORD;
19090
    wszDescription:      array [0..DMUS_MAX_DESCRIPTION-1] of WideChar;
1 daniel-mar 19091
  end;
19092
 
19093
const
4 daniel-mar 19094
(* Values for DMUS_PORTCAPS dwType. This field indicates the underlying
19095
 * driver type of the port.
19096
 *)
19097
  DMUS_PORT_WINMM_DRIVER      = 0;
19098
  DMUS_PORT_USER_MODE_SYNTH   = 1;
19099
  DMUS_PORT_KERNEL_MODE       = 2;
1 daniel-mar 19100
 
4 daniel-mar 19101
(* These flags (set in dwValidParams) indicate which other members of the *)
19102
(* DMUS_PORTPARAMS are valid. *)
19103
(* *)
19104
  DMUS_PORTPARAMS_VOICES           = $00000001;
19105
  DMUS_PORTPARAMS_CHANNELGROUPS    = $00000002;
19106
  DMUS_PORTPARAMS_AUDIOCHANNELS    = $00000004;
19107
  DMUS_PORTPARAMS_SAMPLERATE       = $00000008;
19108
  DMUS_PORTPARAMS_EFFECTS          = $00000020;
19109
  DMUS_PORTPARAMS_SHARE            = $00000040;
1 daniel-mar 19110
 
19111
type
4 daniel-mar 19112
  PDMus_PortParams = ^TDMus_PortParams;
19113
  TDMus_PortParams = packed record
19114
    dwSize:          DWORD;
19115
    dwValidParams:   DWORD;
19116
    dwVoices:        DWORD;
19117
    dwChannelGroups: DWORD;
19118
    dwAudioChannels: DWORD;
19119
    dwSampleRate:    DWORD;
19120
    dwEffectFlags:   DWORD;
19121
    fShare:          BOOL;
1 daniel-mar 19122
  end;
19123
 
4 daniel-mar 19124
  PDMus_SynthStats = ^TDMus_SynthStats;
19125
  TDMus_SynthStats = packed record
19126
    dwSize:        DWORD;        (* Size in bytes of the structure *)
19127
    dwValidStats:  DWORD;        (* Flags indicating which fields below are valid. *)
19128
    dwVoices:      DWORD;        (* Average number of voices playing. *)
19129
    dwTotalCPU:    DWORD;        (* Total CPU usage as percent * 100. *)
19130
    dwCPUPerVoice: DWORD;        (* CPU per voice as percent * 100. *)
19131
    dwLostNotes:   DWORD;        (* Number of notes lost in 1 second. *)
19132
    dwFreeMemory:  DWORD;        (* Free memory in bytes *)
19133
    lPeakVolume:   LongInt;      (* Decibel level * 100. *)
1 daniel-mar 19134
  end;
19135
 
19136
const
4 daniel-mar 19137
  DMUS_SYNTHSTATS_VOICES          = 1 shl 0;
19138
  DMUS_SYNTHSTATS_TOTAL_CPU       = 1 shl 1;
19139
  DMUS_SYNTHSTATS_CPU_PER_VOICE   = 1 shl 2;
19140
  DMUS_SYNTHSTATS_LOST_NOTES      = 1 shl 3;
19141
  DMUS_SYNTHSTATS_PEAK_VOLUME     = 1 shl 4;
19142
  DMUS_SYNTHSTATS_FREE_MEMORY     = 1 shl 5;
1 daniel-mar 19143
 
4 daniel-mar 19144
  DMUS_SYNTHSTATS_SYSTEMMEMORY   = DMUS_PC_SYSTEMMEMORY;
1 daniel-mar 19145
 
19146
type
4 daniel-mar 19147
  TDMus_Waves_Reverb_Params = packed record
19148
    fInGain,        (* Input gain in dB (to avoid output overflows) *)
19149
    fReverbMix,     (* Reverb mix in dB. 0dB means 100% wet reverb (no direct signal)
19150
                    Negative values gives less wet signal.
19151
                    The coeficients are calculated so that the overall output level stays
19152
                    (approximately) constant regardless of the ammount of reverb mix. *)
19153
    fReverbTime,    (* The reverb decay time, in milliseconds. *)
19154
    fHighFreqRTRatio : Single; (* The ratio of the high frequencies to the global reverb time.
19155
                    Unless very 'splashy-bright' reverbs are wanted, this should be set to
19156
                    a value < 1.0.
19157
                    For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the
19158
                    decay time for high frequencies will be 100ms.*)
19159
 
1 daniel-mar 19160
  end;
19161
 
19162
 
4 daniel-mar 19163
(*  Note: Default values for Reverb are:
19164
    fInGain             = 0.0dB   (no change in level)
19165
    fReverbMix          = -10.0dB   (a reasonable reverb mix)
19166
    fReverbTime         = 1000.0ms (one second global reverb time)
19167
    fHighFreqRTRatio    = 0.001    (the ratio of the high frequencies to the global reverb time)
19168
*)
1 daniel-mar 19169
 
4 daniel-mar 19170
  TDMus_ClockType = (
19171
    DMUS_CLOCK_SYSTEM,
19172
    DMUS_CLOCK_WAVE
19173
  );
19174
 
19175
  PDMus_ClockInfo = ^TDMus_ClockInfo;
19176
  TDMus_ClockInfo = packed record
19177
    dwSize : WORD;
19178
    ctType : TDMus_ClockType;
19179
    guidClock : TGUID;          (* Identifies this time source *)
19180
    wszDescription : array [0..DMUS_MAX_DESCRIPTION-1] of WideChar;
1 daniel-mar 19181
  end;
19182
 
4 daniel-mar 19183
const
19184
  DMUS_EVENT_STRUCTURED   = $00000001;  (* Unstructured data (SysEx, etc.) *)
19185
 
19186
(* Standard values for voice priorities. Numerically higher priorities are higher in priority.
19187
 * These priorities are used to set the voice priority for all voices on a channel. They are
19188
 * used in the dwPriority parameter of IDirectMusicPort::GetPriority and returned in the
19189
 * lpwPriority parameter of pdwPriority.
19190
 *
19191
 * These priorities are shared with DirectSound.
19192
 *)
19193
 
19194
const
19195
  DAUD_CRITICAL_VOICE_PRIORITY    = $F0000000;
19196
  DAUD_HIGH_VOICE_PRIORITY        = $C0000000;
19197
  DAUD_STANDARD_VOICE_PRIORITY    = $80000000;
19198
  DAUD_LOW_VOICE_PRIORITY         = $40000000;
19199
  DAUD_PERSIST_VOICE_PRIORITY     = $10000000;
19200
 
19201
(* These are the default priorities assigned if not overridden. By default priorities are
19202
 * equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as
19203
 * channel 5 on channel group 2;.
19204
 *
19205
 * In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16
19206
 * except for 10.
19207
 *)
19208
  DAUD_CHAN1_VOICE_PRIORITY_OFFSET    = $0000000E;
19209
  DAUD_CHAN2_VOICE_PRIORITY_OFFSET    = $0000000D;
19210
  DAUD_CHAN3_VOICE_PRIORITY_OFFSET    = $0000000C;
19211
  DAUD_CHAN4_VOICE_PRIORITY_OFFSET    = $0000000B;
19212
  DAUD_CHAN5_VOICE_PRIORITY_OFFSET    = $0000000A;
19213
  DAUD_CHAN6_VOICE_PRIORITY_OFFSET    = $00000009;
19214
  DAUD_CHAN7_VOICE_PRIORITY_OFFSET    = $00000008;
19215
  DAUD_CHAN8_VOICE_PRIORITY_OFFSET    = $00000007;
19216
  DAUD_CHAN9_VOICE_PRIORITY_OFFSET    = $00000006;
19217
  DAUD_CHAN10_VOICE_PRIORITY_OFFSET   = $0000000F;
19218
  DAUD_CHAN11_VOICE_PRIORITY_OFFSET   = $00000005;
19219
  DAUD_CHAN12_VOICE_PRIORITY_OFFSET   = $00000004;
19220
  DAUD_CHAN13_VOICE_PRIORITY_OFFSET   = $00000003;
19221
  DAUD_CHAN14_VOICE_PRIORITY_OFFSET   = $00000002;
19222
  DAUD_CHAN15_VOICE_PRIORITY_OFFSET   = $00000001;
19223
  DAUD_CHAN16_VOICE_PRIORITY_OFFSET   = $00000000;
19224
 
19225
 
19226
  DAUD_CHAN1_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN1_VOICE_PRIORITY_OFFSET);
19227
  DAUD_CHAN2_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN2_VOICE_PRIORITY_OFFSET);
19228
  DAUD_CHAN3_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN3_VOICE_PRIORITY_OFFSET);
19229
  DAUD_CHAN4_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN4_VOICE_PRIORITY_OFFSET);
19230
  DAUD_CHAN5_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN5_VOICE_PRIORITY_OFFSET);
19231
  DAUD_CHAN6_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN6_VOICE_PRIORITY_OFFSET);
19232
  DAUD_CHAN7_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN7_VOICE_PRIORITY_OFFSET);
19233
  DAUD_CHAN8_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN8_VOICE_PRIORITY_OFFSET);
19234
  DAUD_CHAN9_DEF_VOICE_PRIORITY   = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN9_VOICE_PRIORITY_OFFSET);
19235
  DAUD_CHAN10_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN10_VOICE_PRIORITY_OFFSET);
19236
  DAUD_CHAN11_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN11_VOICE_PRIORITY_OFFSET);
19237
  DAUD_CHAN12_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN12_VOICE_PRIORITY_OFFSET);
19238
  DAUD_CHAN13_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN13_VOICE_PRIORITY_OFFSET);
19239
  DAUD_CHAN14_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN14_VOICE_PRIORITY_OFFSET);
19240
  DAUD_CHAN15_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN15_VOICE_PRIORITY_OFFSET);
19241
  DAUD_CHAN16_DEF_VOICE_PRIORITY  = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN16_VOICE_PRIORITY_OFFSET);
19242
 
1 daniel-mar 19243
type
19244
  IDirectMusicBuffer = interface;
4 daniel-mar 19245
  IDirectMusicPort = interface;
19246
  IDirectMusicThru = interface;
19247
  IReferenceClock = interface;
19248
  PIReferenceClock = IReferenceClock;
1 daniel-mar 19249
 
4 daniel-mar 19250
  IDirectMusic = interface (IUnknown)
19251
    ['{6536115a-7b2d-11d2-ba18-0000f875ac12}']
19252
    function EnumPort (dwIndex: DWORD;
19253
                       var pPortCaps: TDMus_PortCaps) : HResult; stdcall;
19254
    function CreateMusicBuffer (var pBufferDesc: TDMus_BufferDesc;
19255
                                out ppBuffer: IDirectMusicBuffer;
19256
                                pUnkOuter: IUnknown) : HResult; stdcall;
19257
    function CreatePort (const rclsidPort: TGUID;
19258
                         const pPortParams: TDMus_PortParams;
19259
                         out ppPort: IDirectMusicPort;
19260
                         pUnkOuter: IUnknown) : HResult; stdcall;
19261
    function EnumMasterClock (dwIndex: DWORD;
19262
                              var lpClockInfo: TDMus_ClockInfo) : HResult; stdcall;
19263
    function GetMasterClock (pguidClock: PGUID;
19264
                             ppReferenceClock : PIReferenceClock) : HResult; stdcall;
19265
    function SetMasterClock (const rguidClock: TGUID) : HResult; stdcall;
19266
    function Activate (fEnable: BOOL) : HResult; stdcall;
19267
    function GetDefaultPort (out pguidPort: TGUID) : HResult; stdcall;
19268
    function SetDirectSound (pDirectSound: IDirectSound;
19269
                             hWnd: HWND) : HResult; stdcall;
1 daniel-mar 19270
 
19271
  end;
19272
 
4 daniel-mar 19273
  IDirectMusicBuffer = interface (IUnknown)
19274
    ['{d2ac2878-b39b-11d1-8704-00600893b1bd}']
1 daniel-mar 19275
    function Flush : HResult; stdcall;
4 daniel-mar 19276
    function TotalTime (out prtTime: TReference_Time) : HResult; stdcall;
19277
    function PackStructured (const rt: TReference_Time;
19278
                             dwChannelGroup: DWORD;
19279
                             dwChannelMessage: DWORD ) : HResult; stdcall;
19280
    function PackUnstructured (const rt: TReference_Time;
19281
                               dwChannelGroup: DWORD;
19282
                               cb: DWORD;
19283
                               const lpb) : HResult; stdcall;
1 daniel-mar 19284
    function ResetReadPtr : HResult; stdcall;
4 daniel-mar 19285
    function GetNextEvent (out prt: TReference_Time;
19286
                           out pdwChannelGroup: DWORD;
19287
                           out pdwLength: DWORD;
19288
                           out ppData: Pointer) : HResult; stdcall;
19289
 
19290
    function GetRawBufferPtr (out ppData: Pointer) : HResult; stdcall;
19291
    function GetStartTime (out prt: TReference_Time) : HResult; stdcall;
19292
    function GetUsedBytes (out pcb: DWORD) : HResult; stdcall;
19293
    function GetMaxBytes (out pcb: DWORD) : HResult; stdcall;
19294
    function GetBufferFormat (out pGuidFormat: TGUID) : HResult; stdcall;
19295
    function SetStartTime (const rt: TReference_Time) : HResult; stdcall;
19296
    function SetUsedBytes (cb: DWORD) : HResult; stdcall;
1 daniel-mar 19297
  end;
4 daniel-mar 19298
 
19299
 
19300
(* Format of DirectMusic events in a buffer
19301
 *
19302
 * A buffer contains 1 or more events, each with the following header.
19303
 * Immediately following the header is the event data. The header+data
19304
 * size is rounded to the nearest quadword (8 bytes).
19305
 *)
19306
 
19307
  TDMus_EventHeader = packed record
19308
    cbEvent:        DWORD;                   (* Unrounded bytes in event *)
19309
    dwChannelGroup: DWORD;                   (* Channel group of event *)
19310
    rtDelta:        TReference_Time;         (* Delta from start time of entire buffer *)
19311
    dwFlags:        DWORD;                   (* Flags DMUS_EVENT_xxx *)
1 daniel-mar 19312
  end;
19313
 
4 daniel-mar 19314
  IDirectMusicInstrument = interface (IUnknown)
19315
    ['{d2ac287d-b39b-11d1-8704-00600893b1bd}']
19316
    function GetPatch (out pdwPatch: DWORD ) : HResult; stdcall;
19317
    function SetPatch (dwPatch: DWORD) : HResult; stdcall;
1 daniel-mar 19318
  end;
19319
 
4 daniel-mar 19320
  IDirectMusicDownloadedInstrument = interface (IUnknown)
19321
    ['{d2ac287e-b39b-11d1-8704-00600893b1bd}']
19322
    (* None at this time *)
1 daniel-mar 19323
  end;
19324
 
4 daniel-mar 19325
  IDirectMusicCollection = interface (IUnknown)
19326
    ['{d2ac287c-b39b-11d1-8704-00600893b1bd}']
19327
    function GetInstrument (dwPatch: DWORD;
19328
                            out ppInstrument: IDirectMusicInstrument) : HResult; stdcall;
19329
    function EnumInstrument (dwIndex: DWORD;
19330
                             out pdwPatch: DWORD;
19331
                             pwszName: LPWSTR;
19332
                             dwNameLen: DWORD) : HResult; stdcall;
1 daniel-mar 19333
  end;
19334
 
4 daniel-mar 19335
 
19336
  IDirectMusicDownload = interface (IUnknown)
19337
    ['{d2ac287b-b39b-11d1-8704-00600893b1bd}']
19338
    function GetBuffer (out ppvBuffer: Pointer;
19339
                        out pdwSize: DWORD) : HResult; stdcall;
1 daniel-mar 19340
  end;
19341
 
4 daniel-mar 19342
  IDirectMusicPortDownload = interface (IUnknown)
19343
    ['{d2ac287a-b39b-11d1-8704-00600893b1bd}']
19344
    function GetBuffer (dwDLId: DWORD;
19345
                        out ppIDMDownload: IDirectMusicDownload) : HResult; stdcall;
19346
    function AllocateBuffer (dwSize: DWORD;
19347
                             out ppIDMDownload: IDirectMusicDownload) : HResult; stdcall;
19348
    function GetDLId (out pdwStartDLId: DWORD;
19349
                      dwCount: DWORD) : HResult; stdcall;
19350
    function GetAppend (out pdwAppend: DWORD) : HResult; stdcall;
19351
    function Download (pIDMDownload: IDirectMusicDownload) : HResult; stdcall;
1 daniel-mar 19352
    function Unload(pIDMDownload: IDirectMusicDownload) : HResult; stdcall;
19353
  end;
19354
 
4 daniel-mar 19355
  IDirectMusicPort = interface (IUnknown)
19356
    ['{08f2d8c9-37c2-11d2-b9f9-0000f875ac12}']
19357
    function PlayBuffer (pBuffer: IDirectMusicBuffer) : HResult; stdcall;
19358
    function SetReadNotificationHandle (hEvent: THANDLE) : HResult; stdcall;
19359
    function Read (pBuffer: IDirectMusicBuffer) : HResult; stdcall;
19360
    function DownloadInstrument (pInstrument: IDirectMusicInstrument;
19361
                                 out ppDownloadedInstrument: IDirectMusicDownloadedInstrument;
19362
                                 pNoteRanges: PDMus_NoteRange;
19363
                                 dwNumNoteRanges: DWORD) : HResult; stdcall;
19364
    function UnloadInstrument (pDownloadedInstrument: IDirectMusicDownloadedInstrument) : HResult; stdcall;
19365
    function GetLatencyClock (out ppClock: IReferenceClock) : HResult; stdcall;
19366
    function GetRunningStats (var pStats: TDMus_SynthStats) : HResult; stdcall;
1 daniel-mar 19367
    function Compact : HResult; stdcall;
4 daniel-mar 19368
    function GetCaps (var pPortCaps: TDMus_PortCaps) : HResult; stdcall;
19369
    function DeviceIoControl (dwIoControlCode: DWORD;
19370
                              const lpInBuffer;
19371
                              nInBufferSize: DWORD;
19372
                              out lpOutBuffer;
19373
                              nOutBufferSize: DWORD;
19374
                              out lpBytesReturned: DWORD;
19375
                              var lpOverlapped: TOVERLAPPED) : HResult; stdcall;
19376
    function SetNumChannelGroups (dwChannelGroups: DWORD) : HResult; stdcall;
19377
    function GetNumChannelGroups (out pdwChannelGroups: DWORD) : HResult; stdcall;
19378
    function Activate (fActive: BOOL) : HResult; stdcall;
19379
    function SetChannelPriority (dwChannelGroup, dwChannel,
19380
                                 dwPriority: DWORD) : HResult; stdcall;
19381
    function GetChannelPriority (dwChannelGroup, dwChannel: DWORD;
19382
                                 out pdwPriority: DWORD) : HResult; stdcall;
19383
    function SetDirectSound (pDirectSound: IDirectSound;
19384
                             pDirectSoundBuffer: IDirectSoundBuffer) : HResult; stdcall;
19385
    function GetFormat (pWaveFormatEx: PWaveFormatEx;
19386
                        var pdwWaveFormatExSize: DWORD;
19387
                        out pdwBufferSize: DWORD) : HResult; stdcall;
19388
end;
1 daniel-mar 19389
 
4 daniel-mar 19390
  IDirectMusicThru = interface (IUnknown)
19391
    ['{ced153e7-3606-11d2-b9f9-0000f875ac12}']
19392
    function ThruChannel (dwSourceChannelGroup,
19393
                          dwSourceChannel,
19394
                          dwDestinationChannelGroup,
19395
                          dwDestinationChannel: DWORD;
19396
                          pDestinationPort: IDirectMusicPort) : HResult; stdcall;
1 daniel-mar 19397
  end;
19398
 
19399
 
4 daniel-mar 19400
  IReferenceClock = interface (IUnknown)
19401
    ['{56a86897-0ad4-11ce-b03a-0020af0ba770}']
19402
    (*  get the time now *)
19403
    function GetTime (out pTime: TReference_Time) : HResult; stdcall;
1 daniel-mar 19404
 
4 daniel-mar 19405
    (*  ask for an async notification that a time has elapsed *)
19406
    function AdviseTime (const baseTime,                  (*  base time *)
19407
                         streamTime: TReference_Time;     (*  stream offset time *)
19408
                         hEvent: THANDLE;                 (*  advise via this event *)
19409
                         var pdwAdviseCookie: DWORD) : HResult; stdcall;   (*  where your cookie goes *)
1 daniel-mar 19410
 
4 daniel-mar 19411
    (*  ask for an async periodic notification that a time has elapsed *)
19412
    function AdvisePeriodic (const startTime,                  (*  starting at this time *)
19413
                             periodTime: TReference_Time;      (*  time between notifications *)
19414
                             hSemaphore: THANDLE;              (*  advise via a semaphore *)
19415
                             var pdwAdviseCookie: DWORD) : HResult; stdcall;   (*  where your cookie goes *)
1 daniel-mar 19416
 
4 daniel-mar 19417
    (*  cancel a request for notification *)
19418
    function Unadvise (dwAdviseCookie: DWORD) : HResult; stdcall;
1 daniel-mar 19419
  end;
19420
 
4 daniel-mar 19421
type
19422
  IID_IDirectMusic = IDirectMusic;
19423
  IID_IDirectMusicBuffer = IDirectMusicBuffer;
19424
  IID_IDirectMusicPort = IDirectMusicPort;
19425
  IID_IDirectMusicThru = IDirectMusicThru;
19426
  IID_IDirectMusicPortDownload = IDirectMusicPortDownload;
19427
  IID_IDirectMusicDownload = IDirectMusicDownload;
19428
  IID_IDirectMusicCollection = IDirectMusicCollection;
19429
  IID_IDirectMusicInstrument = IDirectMusicInstrument;
19430
  IID_IDirectMusicDownloadedInstrument = IDirectMusicDownloadedInstrument;
19431
  IID_IReferenceClock = IReferenceClock;
1 daniel-mar 19432
 
19433
const
4 daniel-mar 19434
  CLSID_DirectMusic: TGUID = '{636b9f10-0c7d-11d1-95b2-0020afdc7421}';
1 daniel-mar 19435
 
4 daniel-mar 19436
  CLSID_DirectMusicCollection: TGUID = '{480ff4b0-28b2-11d1-bef7-00c04fbf8fef}';
19437
  CLSID_DirectMusicSynth: TGUID = '{58C2B4D0-46E7-11D1-89AC-00A0C9054129}';
1 daniel-mar 19438
 
4 daniel-mar 19439
(* Property Query GUID_DMUS_PROP_GM_Hardware - Local GM set, no need to download
19440
 * Property Query GUID_DMUS_PROP_GS_Hardware - Local GS set, no need to download
19441
 * Property Query GUID_DMUS_PROP_XG_Hardware - Local XG set, no need to download
19442
 * Property Query GUID_DMUS_PROP_DLS1        - Support DLS level 1
19443
 * Property Query GUID_DMUS_PROP_XG_Capable  - Support minimum requirements of XG
19444
 * Property Query GUID_DMUS_PROP_GS_Capable  - Support minimum requirements of GS
19445
 * Property Query GUID_DMUS_PROP_SynthSink_DSOUND - Synthsink talks to DSound
19446
 * Property Query GUID_DMUS_PROP_SynthSink_WAVE - Synthsink talks to Wave device
19447
 *
19448
 * Item 0: Supported
19449
 * Returns a DWORD which is non-zero if the feature is supported
19450
 *)
19451
  GUID_DMUS_PROP_GM_Hardware: TGUID = '{178f2f24-c364-11d1-a760-0000f875ac12}';
19452
  GUID_DMUS_PROP_GS_Hardware: TGUID = '{178f2f25-c364-11d1-a760-0000f875ac12}';
19453
  GUID_DMUS_PROP_XG_Hardware: TGUID = '{178f2f26-c364-11d1-a760-0000f875ac12}';
19454
  GUID_DMUS_PROP_XG_Capable: TGUID = '{6496aba1-61b0-11d2-afa6-00aa0024d8b6}';
19455
  GUID_DMUS_PROP_GS_Capable: TGUID = '{6496aba2-61b0-11d2-afa6-00aa0024d8b6}';
19456
  GUID_DMUS_PROP_DLS1: TGUID = '{178f2f27-c364-11d1-a760-0000f875ac12}';
19457
  GUID_DMUS_PROP_DLS2: TGUID = '{f14599e5-4689-11d2-afa6-00aa0024d8b6}';
19458
  GUID_DMUS_PROP_INSTRUMENT2: TGUID = '{865fd372-9f67-11d2-872a-00600893b1bd}';
19459
  GUID_DMUS_PROP_SynthSink_DSOUND: TGUID = '{0aa97844-c877-11d1-870c-00600893b1bd}';
19460
  GUID_DMUS_PROP_SynthSink_WAVE: TGUID = '{0aa97845-c877-11d1-870c-00600893b1bd}';
19461
  GUID_DMUS_PROP_SampleMemorySize: TGUID = '{178f2f28-c364-11d1-a760-0000f875ac12}';
19462
  GUID_DMUS_PROP_SamplePlaybackRate: TGUID = '{2a91f713-a4bf-11d2-bbdf-00600833dbd8}';
1 daniel-mar 19463
 
4 daniel-mar 19464
(* Property Get/Set GUID_DMUS_PROP_WriteLatency
19465
 *
19466
 * Item 0: Synth buffer write latency, in milliseconds
19467
 * Get/Set SynthSink latency, the average time after the play head that the next buffer gets written.
19468
 *)
19469
  GUID_DMUS_PROP_WriteLatency: TGUID = '{268a0fa0-60f2-11d2-afa6-00aa0024d8b6}';
1 daniel-mar 19470
 
4 daniel-mar 19471
(* Property Get/Set GUID_DMUS_PROP_WritePeriod
19472
 *
19473
 * Item 0: Synth buffer write period, in milliseconds
19474
 * Get/Set SynthSink buffer write period, time span between successive writes.
19475
 *)
19476
  GUID_DMUS_PROP_WritePeriod: TGUID = '{268a0fa1-60f2-11d2-afa6-00aa0024d8b6}';
1 daniel-mar 19477
 
4 daniel-mar 19478
(* Property Get GUID_DMUS_PROP_MemorySize
19479
 *
19480
 * Item 0: Memory size
19481
 * Returns a DWORD containing the total number of bytes of sample RAM
19482
 *)
19483
  GUID_DMUS_PROP_MemorySize: TGUID = '{178f2f28-c364-11d1-a760-0000f875ac12}';
1 daniel-mar 19484
 
4 daniel-mar 19485
(* Property Set GUID_DMUS_PROP_WavesReverb
19486
 *
19487
 * Item 0: DMUS_WAVES_REVERB structure
19488
 * Sets reverb parameters
19489
 *)
19490
  GUID_DMUS_PROP_WavesReverb: TGUID = '{04cb5622-32e5-11d2-afa6-00aa0024d8b6}';
1 daniel-mar 19491
 
4 daniel-mar 19492
(* Property Set GUID_DMUS_PROP_Effects
19493
 *
19494
 * Item 0: DWORD with effects flags.
19495
 * Get/Set effects bits, same as dwEffectFlags in DMUS_PORTPARAMS and DMUS_PORTCAPS:
19496
 * DMUS_EFFECT_NONE
19497
 * DMUS_EFFECT_REVERB
19498
 * DMUS_EFFECT_CHORUS
19499
 *)
19500
  GUID_DMUS_PROP_Effects: TGUID = '{cda8d611-684a-11d2-871e-00600893b1bd}';
1 daniel-mar 19501
 
4 daniel-mar 19502
(* Property Set GUID_DMUS_PROP_LegacyCaps
19503
 *
19504
 * Item 0: The MIDINCAPS or MIDIOUTCAPS which describes the port's underlying WinMM device. This property is only supported
19505
 * by ports which wrap WinMM devices.
19506
 *)
1 daniel-mar 19507
 
4 daniel-mar 19508
  GUID_DMUS_PROP_LegacyCaps: TGUID = '{cfa7cdc2-00a1-11d2-aad5-0000f875ac12}';
1 daniel-mar 19509
 
4 daniel-mar 19510
(* Property Set GUID_DMUS_Volume
19511
 *
19512
 * Item 0: A long which contains an offset, in 1/100 dB, to be added to the final volume
19513
 *
19514
 *)
19515
  GUID_DMUS_PROP_Volume: TGUID = '{fedfae25-e46e-11d1-aace-0000f875ac12}';
1 daniel-mar 19516
 
4 daniel-mar 19517
(* Min and Max values for setting volume with GUID_DMUS_PROP_Volume *)
1 daniel-mar 19518
 
4 daniel-mar 19519
  DMUS_VOLUME_MAX =    2000;        (* +20 dB *)
19520
  DMUS_VOLUME_MIN =  -20000;        (* -200 dB *)
1 daniel-mar 19521
 
4 daniel-mar 19522
(************************************************************************
19523
*                                                                       *
19524
*   dmusici.h -- This module contains the API for the                   *
19525
*                DirectMusic performance layer                          *
19526
*                                                                       *
19527
*   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
19528
*                                                                       *
19529
************************************************************************)
1 daniel-mar 19530
 
19531
type
4 daniel-mar 19532
  TTransition_Type = WORD;
19533
  PMusic_Time = ^TMusic_Time;
19534
  TMusic_Time = LongInt;
1 daniel-mar 19535
 
19536
const
4 daniel-mar 19537
  DMUS_PPQ       = 768;     (* parts per quarter note *)
1 daniel-mar 19538
 
4 daniel-mar 19539
type
19540
  TDMus_CommandT_Types = (
19541
    DMUS_COMMANDT_GROOVE,
19542
    DMUS_COMMANDT_FILL  ,
19543
    DMUS_COMMANDT_INTRO ,
19544
    DMUS_COMMANDT_BREAK ,
19545
    DMUS_COMMANDT_END   ,
19546
    DMUS_COMMANDT_ENDANDINTRO
19547
  );
1 daniel-mar 19548
 
4 daniel-mar 19549
  TDMus_ShapeT_Types = (
19550
    DMUS_SHAPET_FALLING ,
19551
    DMUS_SHAPET_LEVEL   ,
19552
    DMUS_SHAPET_LOOPABLE,
19553
    DMUS_SHAPET_LOUD    ,
19554
    DMUS_SHAPET_QUIET   ,
19555
    DMUS_SHAPET_PEAKING ,
19556
    DMUS_SHAPET_RANDOM  ,
19557
    DMUS_SHAPET_RISING  ,
19558
    DMUS_SHAPET_SONG
19559
  );
1 daniel-mar 19560
 
4 daniel-mar 19561
type
19562
  TDMus_ComposeF_Flags = DWORD;
1 daniel-mar 19563
const
19564
  DMUS_COMPOSEF_NONE              = 0;
19565
  DMUS_COMPOSEF_ALIGN             = $1;
19566
  DMUS_COMPOSEF_OVERLAP           = $2;
19567
  DMUS_COMPOSEF_IMMEDIATE         = $4;
19568
  DMUS_COMPOSEF_GRID              = $8;
19569
  DMUS_COMPOSEF_BEAT              = $10;
19570
  DMUS_COMPOSEF_MEASURE           = $20;
19571
  DMUS_COMPOSEF_AFTERPREPARETIME  = $40;
19572
  DMUS_COMPOSEF_MODULATE          = $1000;
19573
  DMUS_COMPOSEF_LONG              = $2000;
19574
 
4 daniel-mar 19575
 
19576
type
19577
(* DMUS_PMsgF_FLAGS fill the TDMus_PMsg's dwFlags member *)
19578
  TDMus_PMsgF_Flags = DWORD;
1 daniel-mar 19579
const
4 daniel-mar 19580
  DMUS_PMsgF_REFTIME          = 1;      (* if rtTime is valid *)
19581
  DMUS_PMsgF_MUSICTIME        = 2;      (* if mtTime is valid *)
19582
  DMUS_PMsgF_TOOL_IMMEDIATE   = 4;      (* if PMSG should be processed immediately *)
19583
  DMUS_PMsgF_TOOL_QUEUE       = 8;      (* if PMSG should be processed a little early, at Queue time *)
19584
  DMUS_PMsgF_TOOL_ATTIME      = 16;     (* if PMSG should be processed at the time stamp *)
19585
  DMUS_PMsgF_TOOL_FLUSH       = 32;     (* if PMSG is being flushed *)
19586
  (* The values of DMUS_TIME_RESOLVE_FLAGS may also be used inside the *)
19587
  (* TDMus_PMsg's dwFlags member. *)
1 daniel-mar 19588
 
19589
type
4 daniel-mar 19590
(* DMUS_PMsgT_TYPES fill the TDMus_PMsg's dwType member *)
19591
  TDMus_PMsgT_Types = (
19592
    DMUS_PMsgT_MIDI            ,      (* MIDI short message *)
19593
    DMUS_PMsgT_NOTE            ,      (* Interactive Music Note *)
19594
    DMUS_PMsgT_SYSEX           ,      (* MIDI long message (system exclusive message) *)
19595
    DMUS_PMsgT_NOTIFICATION    ,      (* Notification message *)
19596
    DMUS_PMsgT_TEMPO           ,      (* Tempo message *)
19597
    DMUS_PMsgT_CURVE           ,      (* Control change / pitch bend, etc. curve *)
19598
    DMUS_PMsgT_TIMESIG         ,      (* Time signature *)
19599
    DMUS_PMsgT_PATCH           ,      (* Patch changes *)
19600
    DMUS_PMsgT_TRANSPOSE       ,      (* Transposition messages *)
19601
    DMUS_PMsgT_CHANNEL_PRIORITY,      (* Channel priority *)
19602
    DMUS_PMsgT_STOP            ,      (* Stop message *)
19603
    DMUS_PMsgT_DIRTY                  (* Tells Tools that cache GetParam() info to refresh *)
19604
  );
19605
const
19606
  DMUS_PMsgT_USER             = TDMus_PMsgT_Types(255); (* User message *)
1 daniel-mar 19607
 
4 daniel-mar 19608
type
19609
(* DMUS_SEGF_FLAGS correspond to IDirectMusicPerformance::PlaySegment, and other API *)
19610
  TDMus_SegF_Flags = DWORD;
1 daniel-mar 19611
const
4 daniel-mar 19612
  DMUS_SEGF_REFTIME           = 64;     (* time parameter is in reference time  *)
19613
  DMUS_SEGF_SECONDARY         = 128;    (* secondary segment *)
19614
  DMUS_SEGF_QUEUE             = 256;    (* queue at the end of the primary segment queue (primary only) *)
19615
  DMUS_SEGF_CONTROL           = 512;    (* play as a control track (secondary segments only) *)
19616
  DMUS_SEGF_AFTERPREPARETIME  = 1 shl 10;  (* play after the prepare time (See IDirectMusicPerformance::GetPrepareTime) *)
19617
  DMUS_SEGF_GRID              = 1 shl 11;  (* play on grid boundary *)
19618
  DMUS_SEGF_BEAT              = 1 shl 12;  (* play on beat boundary *)
19619
  DMUS_SEGF_MEASURE           = 1 shl 13;  (* play on measure boundary *)
19620
  DMUS_SEGF_DEFAULT           = 1 shl 14;  (* use segment's default boundary *)
19621
  DMUS_SEGF_NOINVALIDATE      = 1 shl 15;  (* play without invalidating the currently playing segment(s) *)
1 daniel-mar 19622
 
4 daniel-mar 19623
(* DMUS_TIME_RESOLVE_FLAGS correspond to IDirectMusicPerformance::GetResolvedTime, and can *)
19624
(* also be used interchangeably with the corresponding DMUS_SEGF_FLAGS, since their values *)
19625
(* are intentionally the same *)
1 daniel-mar 19626
type
4 daniel-mar 19627
  TDMus_Time_Resolve_Flags = DWORD;
19628
const
19629
  DMUS_TIME_RESOLVE_AFTERPREPARETIME  = 1 shl 10;  (* resolve to a time after the prepare time *)
19630
  DMUS_TIME_RESOLVE_GRID              = 1 shl 11;  (* resolve to a time on a grid boundary *)
19631
  DMUS_TIME_RESOLVE_BEAT              = 1 shl 12;  (* resolve to a time on a beat boundary *)
19632
  DMUS_TIME_RESOLVE_MEASURE           = 1 shl 13;  (* resolve to a time on a measure boundary *)
1 daniel-mar 19633
 
4 daniel-mar 19634
(* The following flags are sent in the IDirectMusicTrack::Play() method *)
19635
(* inside the dwFlags parameter *)
19636
type
19637
  TDMus_TrackF_Flags = DWORD;
1 daniel-mar 19638
const
4 daniel-mar 19639
  DMUS_TRACKF_SEEK   = 1;      (* set on a seek *)
19640
  DMUS_TRACKF_LOOP   = 2;      (* set on a loop (repeat) *)
19641
  DMUS_TRACKF_START  = 4;      (* set on first call to Play *)
19642
  DMUS_TRACKF_FLUSH  = 8;      (* set when this call is in response to a flush on the perfomance *)
19643
  DMUS_TRACKF_DIRTY  = 16;     (* set when the track should consider any cached values from a previous call to GetParam to be invalidated *)
1 daniel-mar 19644
 
4 daniel-mar 19645
  DMUS_MAXSUBCHORD = 8;
19646
 
1 daniel-mar 19647
type
4 daniel-mar 19648
  IDirectMusicTrack =                interface;
19649
  IDirectMusicPerformance =          interface;
19650
  IDirectMusicSegment =              interface;
19651
  IDirectMusicSegmentState =         interface;
19652
  IDirectMusicTool =                 interface;
19653
  IDirectMusicGraph =                interface;
1 daniel-mar 19654
 
19655
 
4 daniel-mar 19656
  PIDirectMusicSegmentState = ^IDirectMusicSegmentState;
1 daniel-mar 19657
 
4 daniel-mar 19658
  TDMus_PMsg_Part = record
19659
    dwSize:          DWORD;
19660
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
19661
    mtTime:          TMusic_Time;          (* music time *)
19662
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
19663
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
19664
                                           (* use this to determine the port/channel. *)
19665
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
19666
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
19667
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
19668
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
19669
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
19670
                                           (* identify a specific event. For DirectX 6.0, *)
19671
                                           (* this field should always be 0. *)
19672
    dwGroupID:       DWORD;                (* Track group id *)
19673
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
19674
  end;
1 daniel-mar 19675
 
4 daniel-mar 19676
(* every TDMus_PMsg is based off of this structure. The Performance needs
19677
   to access these members consistently in every PMSG that goes through it. *)
1 daniel-mar 19678
 
4 daniel-mar 19679
    (* begin DMUS_PMsg_PART *)
19680
  PDMus_PMsg = ^TDMus_PMsg;  
19681
  TDMus_PMsg = TDMus_PMsg_Part;
19682
    (* end DMUS_PMsg_PART *)
1 daniel-mar 19683
 
4 daniel-mar 19684
(* DMUS_NOTIFICATION_PMsg *)
19685
  PDMus_Notification_PMsg = ^TDMus_Notification_PMsg;
19686
  TDMus_Notification_PMsg = record
19687
    (* begin DMUS_PMsg_PART *)
19688
    dwSize:          DWORD;
19689
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
19690
    mtTime:          TMusic_Time;          (* music time *)
19691
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
19692
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
19693
                                           (* use this to determine the port/channel. *)
19694
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
19695
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
19696
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
19697
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
19698
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
19699
                                           (* identify a specific event. For DirectX 6.0, *)
19700
                                           (* this field should always be 0. *)
19701
    dwGroupID:       DWORD;                (* Track group id *)
19702
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
19703
    (* end DMUS_PMsg_PART *)
1 daniel-mar 19704
 
4 daniel-mar 19705
    guidNotificationType: TGUID;
19706
    dwNotificationOption: DWORD;
19707
    dwField1:             DWORD;
19708
    dwField2:             DWORD;
19709
  end;
1 daniel-mar 19710
 
4 daniel-mar 19711
  TDMus_SubChord = packed record
19712
    dwChordPattern:    DWORD;    (* Notes in the subchord *)
19713
    dwScalePattern:    DWORD;    (* Notes in the scale *)
19714
    dwInversionPoints: DWORD;    (* Where inversions can occur *)
19715
    dwLevels:          DWORD;    (* Which levels are supported by this subchord *)
19716
    bChordRoot:        BYTE;     (* Root of the subchord *)
19717
    bScaleRoot:        BYTE;     (* Root of the scale *)
19718
  end;
1 daniel-mar 19719
 
4 daniel-mar 19720
  TDMus_Chord_Key = packed record
19721
    wszName: array [0..15] of WideChar;  (* Name of the chord *)
19722
    wMeasure:       WORD;                (* Measure this falls on *)
19723
    bBeat:          BYTE;                (* Beat this falls on *)
19724
    bSubChordCount: BYTE;                (* Number of chords in the list of subchords *)
19725
    SubChordList: array [0..DMUS_MAXSUBCHORD-1] of TDMus_SubChord; (* List of sub chords *)
19726
    dwScale:        DWORD;               (* Scale underlying the entire chord *)
19727
    bKey:           BYTE;                (* Key underlying the entire chord *)
1 daniel-mar 19728
  end;
19729
 
4 daniel-mar 19730
(* Time Signature structure, used by IDirectMusicStyle *)
19731
(* Also used as a parameter for GetParam() and SetParam *)
19732
  TDMus_TimeSignature = packed record
19733
    mtTime:           TMusic_Time;
19734
    bBeatsPerMeasure: BYTE;          (* beats per measure (top of time sig) *)
19735
    bBeat:            BYTE;          (* what note receives the beat (bottom of time sig.) *)
19736
                                     (* we can assume that 0 means 256th note *)
19737
    wGridsPerBeat:    WORD;          (* grids per beat *)
1 daniel-mar 19738
  end;
4 daniel-mar 19739
 
19740
(*/////////////////////////////////////////////////////////////////////
19741
// IDirectMusicSegmentState *)
19742
  IDirectMusicSegmentState = interface (IUnknown)
19743
    ['{a3afdcc7-d3ee-11d1-bc8d-00a0c922e6eb}']
19744
    function GetRepeats (out pdwRepeats: DWORD) : HResult; stdcall;
19745
    function GetSegment (out ppSegment: IDirectMusicSegment) : HResult; stdcall;
19746
    function GetStartTime (out pmtStart: TMusic_Time) : HResult; stdcall;
19747
    function GetSeek (out pmtSeek: TMusic_Time) : HResult; stdcall;
19748
    function GetStartPoint (out pmtStart: TMusic_Time) : HResult; stdcall;
19749
  end;
1 daniel-mar 19750
 
4 daniel-mar 19751
(*////////////////////////////////////////////////////////////////////
19752
// IDirectMusicSegment *)
19753
  IDirectMusicSegment = interface (IUnknown)
19754
    ['{f96029a2-4282-11d2-8717-00600893b1bd}']
19755
    function GetLength (out pmtLength: TMusic_Time) : HResult; stdcall;
19756
    function SetLength (mtLength: TMusic_Time) : HResult; stdcall;
19757
    function GetRepeats (out pdwRepeats: DWORD) : HResult; stdcall;
19758
    function SetRepeats (dwRepeats: DWORD) : HResult; stdcall;
19759
    function GetDefaultResolution (out pdwResolution: DWORD) : HResult; stdcall;
19760
    function SetDefaultResolution (dwResolution: DWORD) : HResult; stdcall;
19761
    function GetTrack (const rguidType: TGUID;
19762
                       dwGroupBits, dwIndex: DWORD;
19763
                       out ppTrack: IDirectMusicTrack) : HResult; stdcall;
19764
    function GetTrackGroup (pTrack: IDirectMusicTrack;
19765
                            out pdwGroupBits: DWORD) : HResult; stdcall;
19766
    function InsertTrack (pTrack: IDirectMusicTrack;
19767
                          dwGroupBits: DWORD) : HResult; stdcall;
19768
    function RemoveTrack (pTrack: IDirectMusicTrack) : HResult; stdcall;
19769
    function InitPlay (out ppSegState: IDirectMusicSegmentState;
19770
                       pPerformance: IDirectMusicPerformance;
19771
                       dwFlags: DWORD) : HResult; stdcall;
19772
    function GetGraph (out ppGraph: IDirectMusicGraph) : HResult; stdcall;
19773
    function SetGraph (pGraph: IDirectMusicGraph) : HResult; stdcall;
19774
    function AddNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
19775
    function RemoveNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
19776
    function GetParam (const rguidType: TGUID;
19777
                       dwGroupBits, dwIndex: DWORD;
19778
                       mtTime:       TMusic_Time;
19779
                       out pmtNext:  TMusic_Time;
19780
                       pParam: Pointer) : HResult; stdcall;
19781
    function SetParam (const rguidType: TGUID;
19782
                       dwGroupBits, dwIndex: DWORD;
19783
                       mtTime: TMusic_Time;
19784
                       pParam: Pointer) : HResult; stdcall;
19785
    function Clone (mtStart: TMusic_Time;
19786
                    mtEnd:   TMusic_Time;
19787
                    out ppSegment: IDirectMusicSegment) : HResult; stdcall;
19788
    function SetStartPoint (mtStart: TMusic_Time) : HResult; stdcall;
19789
    function GetStartPoint (out pmtStart: TMusic_Time) : HResult; stdcall;
19790
    function SetLoopPoints (mtStart: TMusic_Time;
19791
                            mtEnd:   TMusic_Time) : HResult; stdcall;
19792
    function GetLoopPoints (out pmtStart, pmtEnd: TMusic_Time) : HResult; stdcall;
19793
    function SetPChannelsUsed (dwNumPChannels: DWORD;
19794
                               var paPChannels: DWORD) : HResult; stdcall;
19795
  end;
1 daniel-mar 19796
 
19797
 
4 daniel-mar 19798
(*////////////////////////////////////////////////////////////////////
19799
// IDirectMusicTrack *)
19800
  IDirectMusicTrack = interface (IUnknown)
19801
    ['{f96029a1-4282-11d2-8717-00600893b1bd}']
19802
    function Init (pSegment: IDirectMusicSegment) : HResult; stdcall;
19803
    function InitPlay (pSegmentState: IDirectMusicSegmentState;
19804
                       pPerformance:  IDirectMusicPerformance;
19805
                       out ppStateData: Pointer;
19806
                       dwVirtualTrackID, dwFlags: DWORD) : HResult; stdcall;
19807
    function EndPlay (pStateData: Pointer) : HResult; stdcall;
19808
    function Play    (pStateData: Pointer;
19809
                      mtStart:    TMusic_Time;
19810
                      mtEnd:      TMusic_Time;
19811
                      mtOffset:   TMusic_Time;
19812
                      dwFlags:    DWORD;
19813
                      pPerf:      IDirectMusicPerformance;
19814
                      pSegSt:     IDirectMusicSegmentState;
19815
                      dwVirtualID:DWORD) : HResult; stdcall;
19816
    function GetParam (const rguidType: TGUID;
19817
                       mtTime:      TMusic_Time;
19818
                       out pmtNext: TMusic_Time;
19819
                       pParam: Pointer) : HResult; stdcall;
19820
    function SetParam (const rguidType: TGUID;
19821
                       mtTime: TMusic_Time;
19822
                       pParam: Pointer) : HResult; stdcall;
19823
    function IsParamSupported  (const rguidType: TGUID) : HResult; stdcall;
19824
    function AddNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
19825
    function RemoveNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
19826
    function Clone (mtStart: TMusic_Time;
19827
                    mtEnd:   TMusic_Time;
19828
                    out ppTrack: IDirectMusicTrack) : HResult; stdcall;
19829
  end;
19830
 
19831
PIDirectMusic = ^IDirectMusic;
19832
 
19833
(*////////////////////////////////////////////////////////////////////
19834
// IDirectMusicPerformance *)
19835
  IDirectMusicPerformance = interface (IUnknown)
19836
    ['{07d43d03-6523-11d2-871d-00600893b1bd}']
19837
    function Init (ppDirectMusic: PIDirectMusic;
19838
                   pDirectSound: IDirectSound;
19839
                   hWnd: HWND ) : HResult; stdcall;
19840
    function PlaySegment (pSegment: IDirectMusicSegment;
19841
                          dwFlags: DWORD;
19842
                          i64StartTime: LongLong;
19843
                          ppSegmentState: PIDirectMusicSegmentState) : HResult; stdcall;
19844
    function Stop (pSegment: IDirectMusicSegment;
19845
                   pSegmentState: IDirectMusicSegmentState;
19846
                   mtTime: TMusic_Time;
19847
                   dwFlags: DWORD) : HResult; stdcall;
19848
    function GetSegmentState (out ppSegmentState: IDirectMusicSegmentState;
19849
                              mtTime: TMusic_Time) : HResult; stdcall;
19850
    function SetPrepareTime (dwMilliSeconds: DWORD) : HResult; stdcall;
19851
    function GetPrepareTime (out pdwMilliSeconds: DWORD) : HResult; stdcall;
19852
    function SetBumperLength (dwMilliSeconds: DWORD) : HResult; stdcall;
19853
    function GetBumperLength (out pdwMilliSeconds: DWORD) : HResult; stdcall;
19854
    function SendPMsg (out pPMSG: TDMus_PMsg) : HResult; stdcall;
19855
    function MusicToReferenceTime (mtTime: TMusic_Time;
19856
                                   out prtTime: TReference_Time) : HResult; stdcall;
19857
    function ReferenceToMusicTime (rtTime: TReference_Time;
19858
                                   out pmtTime: TMusic_Time) : HResult; stdcall;
19859
    function IsPlaying (pSegment: IDirectMusicSegment;
19860
                        pSegState: IDirectMusicSegmentState) : HResult; stdcall;
19861
    function GetTime (prtNow: PReference_Time;
19862
                      pmtNow: PMusic_Time) : HResult; stdcall;
19863
    function AllocPMsg (cb: ULONG;
19864
                        out ppPMSG: PDMus_PMsg) : HResult; stdcall;
19865
    function FreePMsg (pPMSG: PDMus_PMsg) : HResult; stdcall;
19866
    function GetGraph (out ppGraph: IDirectMusicGraph) : HResult; stdcall;
19867
    function SetGraph (pGraph: IDirectMusicGraph) : HResult; stdcall;
19868
    function SetNotificationHandle (hNotification: THANDLE;
19869
                                    rtMinimum: TReference_Time) : HResult; stdcall;
19870
    function GetNotificationPMsg (out ppNotificationPMsg: PDMus_Notification_PMsg) : HResult; stdcall;
19871
    function AddNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
19872
    function RemoveNotificationType (const rguidNotificationType: TGUID) : HResult; stdcall;
19873
    function AddPort (pPort: IDirectMusicPort) : HResult; stdcall;
19874
    function RemovePort (pPort: IDirectMusicPort) : HResult; stdcall;
19875
    function AssignPChannelBlock (dwBlockNum: DWORD;
19876
                                  pPort: IDirectMusicPort;
19877
                                  dwGroup: DWORD) : HResult; stdcall;
19878
    function AssignPChannel (dwPChannel: DWORD;
19879
                             pPort: IDirectMusicPort;
19880
                             dwGroup, dwMChannel: DWORD) : HResult; stdcall;
19881
    function PChannelInfo (dwPChannel: DWORD;
19882
                           out ppPort: IDirectMusicPort;
19883
                           out pdwGroup, pdwMChannel: DWORD ) : HResult; stdcall;
19884
    function DownloadInstrument (pInst: IDirectMusicInstrument;
19885
                                 dwPChannel: DWORD;
19886
                                 out ppDownInst: IDirectMusicDownloadedInstrument;
19887
                                 var pNoteRanges: TDMus_NoteRange;
19888
                                 dwNumNoteRanges: DWORD;
19889
                                 out ppPort: IDirectMusicPort;
19890
                                 out pdwGroup, pdwMChannel: DWORD) : HResult; stdcall;
19891
    function Invalidate (mtTime: TMusic_Time;
19892
                         dwFlags: DWORD) : HResult; stdcall;
19893
    function GetParam (const rguidType: TGUID;
19894
                       dwGroupBits, dwIndex: DWORD;
19895
                       mtTime:      TMusic_Time;
19896
                       out pmtNext: TMusic_Time;
19897
                       pParam: Pointer) : HResult; stdcall;
19898
    function SetParam (const rguidType: TGUID;
19899
                       dwGroupBits, dwIndex: DWORD;
19900
                       mtTime: TMusic_Time;
19901
                       pParam: Pointer) : HResult; stdcall;
19902
    function GetGlobalParam (const rguidType: TGUID;
19903
                             pParam: Pointer;
19904
                             dwSize: DWORD) : HResult; stdcall;
19905
    function SetGlobalParam (const rguidType: TGUID;
19906
                             pParam: Pointer;
19907
                             dwSize: DWORD) : HResult; stdcall;
19908
    function GetLatencyTime (out prtTime: TReference_Time) : HResult; stdcall;
19909
    function GetQueueTime (out prtTime: TReference_Time) : HResult; stdcall;
19910
    function AdjustTime (rtAmount: TReference_Time) : HResult; stdcall;
19911
    function CloseDown : HResult; stdcall;
19912
    function GetResolvedTime (rtTime: TReference_Time;
19913
                              out prtResolved: TReference_Time;
19914
                              dwTimeResolveFlags: DWORD) : HResult; stdcall;
19915
    function MIDIToMusic (bMIDIValue: BYTE;
19916
                          const pChord: TDMus_Chord_Key;
19917
                          bPlayMode, bChordLevel: Byte;
19918
                          out pwMusicValue: WORD) : HResult; stdcall;
19919
    function MusicToMIDI (wMusicValue: WORD;
19920
                          const pChord: TDMus_Chord_Key;
19921
                          bPlayMode, bChordLevel: BYTE;
19922
                          out pbMIDIValue: BYTE) : HResult; stdcall;
19923
    function TimeToRhythm (mtTime: TMusic_Time;
19924
                           const pTimeSig: TDMus_TimeSignature;
19925
                           out pwMeasure: WORD;
19926
                           out pbBeat, pbGrid: BYTE;
19927
                           out pnOffset: SmallInt) : HResult; stdcall;
19928
    function RhythmToTime (wMeasure: WORD;
19929
                           bBeat, bGrid: BYTE;
19930
                           nOffset: SmallInt;
19931
                           const pTimeSig: TDMus_TimeSignature;
19932
                           out pmtTime: TMusic_Time) : HResult; stdcall;
19933
end;
19934
 
19935
(*////////////////////////////////////////////////////////////////////
19936
// IDirectMusicTool *)
19937
  IDirectMusicTool = interface (IUnknown)
19938
    ['{d2ac28ba-b39b-11d1-8704-00600893b1bd}']
19939
    function Init (pGraph: IDirectMusicGraph) : HResult; stdcall;
19940
    function GetMsgDeliveryType (out pdwDeliveryType: DWORD) : HResult; stdcall;
19941
    function GetMediaTypeArraySize (out pdwNumElements: DWORD) : HResult; stdcall;
19942
    function GetMediaTypes (out padwMediaTypes: PDWORD;
19943
                            dwNumElements: DWORD) : HResult; stdcall;
19944
    function ProcessPMsg (pPerf: IDirectMusicPerformance;
19945
                          var pPMSG: TDMus_PMsg) : HResult; stdcall;
19946
    function Flush (pPerf: IDirectMusicPerformance;
19947
                    const pPMSG: TDMus_PMsg;
19948
                    rtTime: TReference_Time) : HResult; stdcall;
19949
end;
19950
 
19951
(*////////////////////////////////////////////////////////////////////
19952
// IDirectMusicGraph *)
19953
  IDirectMusicGraph = interface (IUnknown)
19954
    ['{2befc277-5497-11d2-bccb-00a0c922e6eb}']
19955
    function StampPMsg (var pPMSG: TDMus_PMsg ) : HResult; stdcall;
19956
    function InsertTool (pTool: IDirectMusicTool;
19957
                         var pdwPChannels: DWORD;
19958
                         cPChannels: DWORD;
19959
                         lIndex: LongInt) : HResult; stdcall;
19960
    function GetTool (dwIndex: DWORD;
19961
                      out ppTool: IDirectMusicTool) : HResult; stdcall;
19962
    function RemoveTool (pTool: IDirectMusicTool) : HResult; stdcall;
19963
  end;
19964
 
19965
 
19966
(* DMUS_NOTE_PMsg *)
19967
  TDMus_Note_PMsg = packed record
19968
    (* begin DMUS_PMsg_PART *)
19969
    dwSize:          DWORD;
19970
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
19971
    mtTime:          TMusic_Time;          (* music time *)
19972
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
19973
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
19974
                                           (* use this to determine the port/channel. *)
19975
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
19976
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
19977
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
19978
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
19979
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
19980
                                           (* identify a specific event. For DirectX 6.0, *)
19981
                                           (* this field should always be 0. *)
19982
    dwGroupID:       DWORD;                (* Track group id *)
19983
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
19984
    (* end DMUS_PMsg_PART *)
19985
 
19986
    mtDuration: TMusic_Time;    (* duration *)
19987
    wMusicValue:    WORD;       (* Description of note in chord and key. *)
19988
    wMeasure:       WORD;       (* Measure in which this note occurs *)
19989
    nOffset:        SmallInt;   (* Offset from grid at which this note occurs *)
19990
    bBeat:          BYTE;       (* Beat (in measure) at which this note occurs *)
19991
    bGrid:          BYTE;       (* Grid offset from beat at which this note occurs *)
19992
    bVelocity:      BYTE;       (* Note velocity *)
19993
    bFlags:         BYTE;       (* see DMUS_NOTE_FLAGS *)
19994
    bTimeRange:     BYTE;       (* Range to randomize time. *)
19995
    bDurRange:      BYTE;       (* Range to randomize duration. *)
19996
    bVelRange:      BYTE;       (* Range to randomize velocity. *)
19997
    bPlayModeFlags: BYTE;       (* Play mode *)
19998
    bSubChordLevel: BYTE;       (* Which subchord level this note uses.  *)
19999
    bMidiValue:     BYTE;       (* The MIDI note value, converted from wMusicValue *)
20000
    cTranspose:     char;       (* Transposition to add to midi note value after converted from wMusicValue. *)
20001
  end;
20002
 
20003
  TDMus_NoteF_Flags = DWORD;
1 daniel-mar 20004
const
4 daniel-mar 20005
  DMUS_NOTEF_NOTEON = 1;     (* Set if this is a MIDI Note On. Otherwise, it is MIDI Note Off *)
1 daniel-mar 20006
 
4 daniel-mar 20007
(* The DMUS_PLAYMODE_FLAGS are used to determine how to convert wMusicValue
20008
   into the appropriate bMidiValue.
20009
*)
1 daniel-mar 20010
type
4 daniel-mar 20011
  TDMus_PlayMode_Flags = DWORD;
20012
const
20013
   DMUS_PLAYMODE_KEY_ROOT          = 1;  (* Transpose on top of the key root. *)
20014
   DMUS_PLAYMODE_CHORD_ROOT        = 2;  (* Transpose on top of the chord root. *)
20015
   DMUS_PLAYMODE_SCALE_INTERVALS   = 4;  (* Use scale intervals from scale pattern. *)
20016
   DMUS_PLAYMODE_CHORD_INTERVALS   = 8;  (* Use chord intervals from chord pattern. *)
20017
   DMUS_PLAYMODE_NONE              = 16; (* No mode. Indicates the parent part's mode should be used. *)
1 daniel-mar 20018
 
4 daniel-mar 20019
(* The following are playback modes that can be created by combining the DMUS_PLAYMODE_FLAGS
20020
   in various ways:
20021
*)
1 daniel-mar 20022
 
4 daniel-mar 20023
(* Fixed. wMusicValue holds final MIDI note value. This is used for drums, sound effects, and sequenced
20024
   notes that should not be transposed by the chord or scale.
20025
*)
1 daniel-mar 20026
  DMUS_PLAYMODE_FIXED            = 0;
4 daniel-mar 20027
(* In fixed to key, the musicvalue is again a fixed MIDI value, but it
20028
   is transposed on top of the key root.
20029
*)
1 daniel-mar 20030
  DMUS_PLAYMODE_FIXEDTOKEY       = DMUS_PLAYMODE_KEY_ROOT;
4 daniel-mar 20031
(* In fixed to chord, the musicvalue is also a fixed MIDI value, but it
20032
   is transposed on top of the chord root.
20033
*)
1 daniel-mar 20034
  DMUS_PLAYMODE_FIXEDTOCHORD     = DMUS_PLAYMODE_CHORD_ROOT;
4 daniel-mar 20035
(* In Pedalpoint, the key root is used and the notes only track the intervals in
20036
   the scale. The chord root and intervals are completely ignored. This is useful
20037
   for melodic lines that play relative to the key root.
20038
*)
1 daniel-mar 20039
  DMUS_PLAYMODE_PEDALPOINT       = (DMUS_PLAYMODE_KEY_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS);
4 daniel-mar 20040
(* In the Melodic mode, the chord root is used but the notes only track the intervals in
20041
   the scale. The key root and chord intervals are completely ignored. This is useful
20042
   for melodic lines that play relative to the chord root.
20043
*)
1 daniel-mar 20044
  DMUS_PLAYMODE_MELODIC          = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS);
4 daniel-mar 20045
(* Normal chord mode is the prevalent playback mode.
20046
   The notes track the intervals in the chord, which is based on the chord root.
20047
   If there is a scale component to the MusicValue, the additional intervals
20048
   are pulled from the scale and added.
20049
   If the chord does not have an interval to match the chord component of
20050
   the MusicValue, the note is silent.
20051
*)
1 daniel-mar 20052
  DMUS_PLAYMODE_NORMALCHORD      = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_CHORD_INTERVALS);
4 daniel-mar 20053
(* If it is desirable to play a note that is above the top of the chord, the
20054
   always play mode (known as "purpleized" in a former life) finds a position
20055
   for the note by using intervals from the scale. Essentially, this mode is
20056
   a combination of the Normal and Melodic playback modes, where a failure
20057
   in Normal causes a second try in Melodic mode.
20058
*)
1 daniel-mar 20059
  DMUS_PLAYMODE_ALWAYSPLAY       = (DMUS_PLAYMODE_MELODIC or DMUS_PLAYMODE_NORMALCHORD);
20060
 
4 daniel-mar 20061
(*  Legacy names for modes... *)
1 daniel-mar 20062
  DMUS_PLAYMODE_PURPLEIZED       = DMUS_PLAYMODE_ALWAYSPLAY;
20063
  DMUS_PLAYMODE_SCALE_ROOT       = DMUS_PLAYMODE_KEY_ROOT;
20064
  DMUS_PLAYMODE_FIXEDTOSCALE     = DMUS_PLAYMODE_FIXEDTOKEY;
20065
 
4 daniel-mar 20066
type
20067
(* DMUS_MIDI_PMsg *)
20068
  TDMus_Midi_PMsg = record
20069
    (* begin DMUS_PMsg_PART *)
20070
    dwSize:          DWORD;
20071
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
20072
    mtTime:          TMusic_Time;          (* music time *)
20073
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
20074
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
20075
                                           (* use this to determine the port/channel. *)
20076
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
20077
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
20078
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
20079
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
20080
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
20081
                                           (* identify a specific event. For DirectX 6.0, *)
20082
                                           (* this field should always be 0. *)
20083
    dwGroupID:       DWORD;                (* Track group id *)
20084
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
20085
    (* end DMUS_PMsg_PART *)
1 daniel-mar 20086
 
4 daniel-mar 20087
    bStatus: BYTE;
20088
    bByte1:  BYTE;
20089
    bByte2:  BYTE;
20090
    bPad: array [0..0] of BYTE;
20091
  end;
1 daniel-mar 20092
 
4 daniel-mar 20093
(* DMUS_PATCH_PMsg *)
20094
  TDMus_Patch_PMsg = packed record
20095
    (* begin DMUS_PMsg_PART *)
20096
    dwSize:          DWORD;
20097
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
20098
    mtTime:          TMusic_Time;          (* music time *)
20099
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
20100
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
20101
                                           (* use this to determine the port/channel. *)
20102
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
20103
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
20104
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
20105
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
20106
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
20107
                                           (* identify a specific event. For DirectX 6.0, *)
20108
                                           (* this field should always be 0. *)
20109
    dwGroupID:       DWORD;                (* Track group id *)
20110
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
20111
    (* end DMUS_PMsg_PART *)
20112
 
20113
    byInstrument: BYTE;
20114
    byMSB:        BYTE;
20115
    byLSB:        BYTE;
20116
    byPad: array [0..0] of BYTE;
20117
  end;
20118
 
20119
(* DMUS_TRANSPOSE_PMsg *)
20120
  TDMus_Transpose_PMsg = packed record
20121
    (* begin DMUS_PMsg_PART *)
20122
    dwSize:          DWORD;
20123
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
20124
    mtTime:          TMusic_Time;          (* music time *)
20125
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
20126
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
20127
                                           (* use this to determine the port/channel. *)
20128
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
20129
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
20130
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
20131
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
20132
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
20133
                                           (* identify a specific event. For DirectX 6.0, *)
20134
                                           (* this field should always be 0. *)
20135
    dwGroupID:       DWORD;                (* Track group id *)
20136
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
20137
    (* end DMUS_PMsg_PART *)
20138
 
20139
    nTranspose: SmallInt;
20140
  end;
20141
 
20142
(* DMUS_CHANNEL_PRIORITY_PMsg *)
20143
  TDMus_Channel_Priority_PMsg = packed record
20144
    (* begin DMUS_PMsg_PART *)
20145
    dwSize:          DWORD;
20146
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
20147
    mtTime:          TMusic_Time;          (* music time *)
20148
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
20149
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
20150
                                           (* use this to determine the port/channel. *)
20151
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
20152
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
20153
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
20154
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
20155
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
20156
                                           (* identify a specific event. For DirectX 6.0, *)
20157
                                           (* this field should always be 0. *)
20158
    dwGroupID:       DWORD;                (* Track group id *)
20159
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
20160
    (* end DMUS_PMsg_PART *)
20161
 
20162
    dwChannelPriority: DWORD;
20163
  end;
20164
 
20165
(* DMUS_TEMPO_PMsg *)
20166
  TDMus_Tempo_PMsg = packed record
20167
    (* begin DMUS_PMsg_PART *)
20168
    dwSize:          DWORD;
20169
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
20170
    mtTime:          TMusic_Time;          (* music time *)
20171
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
20172
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
20173
                                           (* use this to determine the port/channel. *)
20174
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
20175
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
20176
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
20177
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
20178
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
20179
                                           (* identify a specific event. For DirectX 6.0, *)
20180
                                           (* this field should always be 0. *)
20181
    dwGroupID:       DWORD;                (* Track group id *)
20182
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
20183
    (* end DMUS_PMsg_PART *)
20184
 
20185
    dblTempo: double;                      (* the tempo *)
20186
  end;
20187
 
1 daniel-mar 20188
const
4 daniel-mar 20189
  DMUS_TEMPO_MAX         = 1000;
20190
  DMUS_TEMPO_MIN         = 1;
1 daniel-mar 20191
 
4 daniel-mar 20192
  DMUS_MASTERTEMPO_MAX   = 100.0;
20193
  DMUS_MASTERTEMPO_MIN   = 0.01;
20194
 
1 daniel-mar 20195
type
4 daniel-mar 20196
(* DMUS_SYSEX_PMsg *)
20197
  TDMus_SysEx_PMsg = packed record
20198
    (* begin DMUS_PMsg_PART *)
20199
    dwSize:          DWORD;
20200
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
20201
    mtTime:          TMusic_Time;          (* music time *)
20202
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
20203
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
20204
                                           (* use this to determine the port/channel. *)
20205
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
20206
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
20207
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
20208
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
20209
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
20210
                                           (* identify a specific event. For DirectX 6.0, *)
20211
                                           (* this field should always be 0. *)
20212
    dwGroupID:       DWORD;                (* Track group id *)
20213
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
20214
    (* end DMUS_PMsg_PART *)
1 daniel-mar 20215
 
4 daniel-mar 20216
    dwLen:     DWORD;                      (* length of the data *)
20217
    abData: array [0..0] of BYTE;          (* array of data, length equal to dwLen *)
20218
  end;
1 daniel-mar 20219
 
4 daniel-mar 20220
(* DMUS_CURVE_PMsg *)
20221
  TDMus_Curve_PMsg = packed record
20222
    (* begin DMUS_PMsg_PART *)
20223
    dwSize:          DWORD;
20224
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
20225
    mtTime:          TMusic_Time;          (* music time *)
20226
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
20227
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
20228
                                           (* use this to determine the port/channel. *)
20229
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
20230
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
20231
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
20232
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
20233
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
20234
                                           (* identify a specific event. For DirectX 6.0, *)
20235
                                           (* this field should always be 0. *)
20236
    dwGroupID:       DWORD;                (* Track group id *)
20237
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
20238
    (* end DMUS_PMsg_PART *)
20239
 
20240
    mtDuration:      TMusic_Time;     (* how long this curve lasts *)
20241
    mtOriginalStart: TMusic_Time;     (* must be set to either zero when this PMSG is created or to the original mtTime of the curve *)
20242
    mtResetDuration: TMusic_Time;     (* how long after the curve is finished to reset to the
20243
                                        reset value, nResetValue *)
20244
    nStartValue:     SmallInt;        (* curve's start value *)
20245
    nEndValue:       SmallInt;        (* curve's end value *)
20246
    nResetValue:     SmallInt;        (* curve's reset value, sent after mtResetDuration or
20247
                                        upon a flush or invalidation *)
20248
    wMeasure:        WORD;            (* Measure in which this curve occurs *)
20249
    nOffset:         SmallInt;        (* Offset from grid at which this curve occurs *)
20250
    bBeat:           BYTE;            (* Beat (in measure) at which this curve occurs *)
20251
    bGrid:           BYTE;            (* Grid offset from beat at which this curve occurs *)
20252
    bType:           BYTE;            (* type of curve *)
20253
    bCurveShape:     BYTE;            (* shape of curve *)
20254
    bCCData:         BYTE;            (* CC# if this is a control change type *)
20255
    bFlags:          BYTE;            (* set to 1 if the nResetValue must be sent when the
20256
                                        time is reached or an invalidate occurs because
20257
                                        of a transition. If 0, the curve stays
20258
                                        permanently stuck at the new value. All bits besides
20259
                                        1 are reserved. *)
20260
  end;
20261
 
20262
  TDMus_Curve_Flags = DWORD;
1 daniel-mar 20263
const
4 daniel-mar 20264
  DMUS_CURVE_RESET = 1;           (* Set if the curve needs to be reset. *)
1 daniel-mar 20265
 
4 daniel-mar 20266
(* Curve shapes *)
20267
type
20268
  TDMus_Curve_Shapes = (
20269
    DMUS_CURVES_LINEAR ,
20270
    DMUS_CURVES_INSTANT,
20271
    DMUS_CURVES_EXP    ,
20272
    DMUS_CURVES_LOG    ,
20273
    DMUS_CURVES_SINE  
20274
  );
1 daniel-mar 20275
 
4 daniel-mar 20276
const
20277
(* curve types *)
20278
  DMUS_CURVET_PBCURVE      = $03;
20279
  DMUS_CURVET_CCCURVE      = $04;
20280
  DMUS_CURVET_MATCURVE     = $05;
20281
  DMUS_CURVET_PATCURVE     = $06;
1 daniel-mar 20282
 
4 daniel-mar 20283
type
20284
(* DMUS_TIMESIG_PMsg *)
20285
  TDMus_TimeSig_PMsg = packed record
20286
    (* begin DMUS_PMsg_PART *)
20287
    dwSize:          DWORD;
20288
    rtTime:          TReference_Time;      (* real time (in 100 nanosecond increments) *)
20289
    mtTime:          TMusic_Time;          (* music time *)
20290
    dwFlags:         DWORD;                (* various bits (see DMUS_PMsg_FLAGS enumeration) *)
20291
    dwPChannel:      DWORD;                (* Performance Channel. The Performance can *)
20292
                                           (* use this to determine the port/channel. *)
20293
    dwVirtualTrackID:DWORD;                (* virtual track ID *)
20294
    pTool:           IDirectMusicTool;     (* tool interface pointer *)
20295
    pGraph:          IDirectMusicGraph;    (* tool graph interface pointer *)
20296
    dwType:          DWORD;                (* PMSG type (see DMUS_PMsgT_TYPES defines) *)
20297
    dwVoiceID:       DWORD;                (* unique voice id which allows synthesizers to *)
20298
                                           (* identify a specific event. For DirectX 6.0, *)
20299
                                           (* this field should always be 0. *)
20300
    dwGroupID:       DWORD;                (* Track group id *)
20301
    punkUser:        IUnknown;             (* user com pointer, auto released upon PMSG free *)
20302
    (* end DMUS_PMsg_PART *)
20303
 
20304
    (* Time signatures define how many beats per measure, which note receives *)
20305
    (* the beat, and the grid resolution. *)
20306
    bBeatsPerMeasure: BYTE;          (* beats per measure (top of time sig) *)
20307
    bBeat:            BYTE;          (* what note receives the beat (bottom of time sig.) *)
20308
                                     (* we can assume that 0 means 256th note *)
20309
    wGridsPerBeat:    WORD;          (* grids per beat *)
20310
  end;
20311
 
1 daniel-mar 20312
const
4 daniel-mar 20313
(* notification type values *)
20314
(* The following correspond to GUID_NOTIFICATION_SEGMENT *)
1 daniel-mar 20315
  DMUS_NOTIFICATION_SEGSTART     = 0;
20316
  DMUS_NOTIFICATION_SEGEND       = 1;
20317
  DMUS_NOTIFICATION_SEGALMOSTEND = 2;
20318
  DMUS_NOTIFICATION_SEGLOOP      = 3;
20319
  DMUS_NOTIFICATION_SEGABORT     = 4;
4 daniel-mar 20320
(* The following correspond to GUID_NOTIFICATION_PERFORMANCE *)
1 daniel-mar 20321
  DMUS_NOTIFICATION_MUSICSTARTED = 0;
20322
  DMUS_NOTIFICATION_MUSICSTOPPED = 1;
4 daniel-mar 20323
(* The following corresponds to GUID_NOTIFICATION_MEASUREANDBEAT *)
1 daniel-mar 20324
  DMUS_NOTIFICATION_MEASUREBEAT  = 0;
4 daniel-mar 20325
(* The following corresponds to GUID_NOTIFICATION_CHORD *)
1 daniel-mar 20326
  DMUS_NOTIFICATION_CHORD        = 0;
4 daniel-mar 20327
(* The following correspond to GUID_NOTIFICATION_COMMAND *)
20328
  DMUS_NOTIFICATION_GROOVE        = 0;
20329
  DMUS_NOTIFICATION_EMBELLISHMENT = 1;
1 daniel-mar 20330
 
4 daniel-mar 20331
const
20332
  DMUS_MAX_NAME          = 64;         (* Maximum object name length. *)
20333
  DMUS_MAX_CATEGORY      = 64;         (* Maximum object category name length. *)
20334
  DMUS_MAX_FILENAME      = MAX_PATH;
20335
 
1 daniel-mar 20336
type
4 daniel-mar 20337
  PDMus_Version = ^TDMus_Version;
20338
  TDMus_Version = packed record
20339
    dwVersionMS: DWORD;
20340
    dwVersionLS: DWORD;
1 daniel-mar 20341
  end;
20342
 
4 daniel-mar 20343
(*      The DMUSOBJECTDESC structure is used to communicate everything you could *)
20344
(*      possibly use to describe a DirectMusic object.  *)
20345
  PDMus_ObjectDesc = ^TDMus_ObjectDesc;
20346
  TDMus_ObjectDesc = packed record
20347
    dwSize:      DWORD;                     (* Size of this structure. *)
20348
    dwValidData: DWORD;                     (* Flags indicating which fields below are valid. *)
20349
    guidObject:  TGUID;                     (* Unique ID for this object. *)
20350
    guidClass:   TGUID;                     (* GUID for the class of object. *)
20351
    ftDate:      TFileTime;                 (* Last edited date of object. *)
20352
    vVersion:    TDMus_Version;              (* Version. *)
20353
    wszName:     array [0..DMUS_MAX_NAME-1] of WCHAR; (* Name of object. *)
20354
    wszCategory: array [0..DMUS_MAX_CATEGORY-1] of WCHAR; (* Category for object (optional). *)
20355
    wszFileName: array [0..DMUS_MAX_FILENAME-1] of WCHAR; (* File path. *)
20356
    llMemLength: LongLong;                     (* Size of Memory data. *)
20357
    pbMemData:   Pointer;                   (* Memory pointer for data. *)
20358
    dwDummy:     DWORD; ///?
20359
  end;
1 daniel-mar 20360
 
4 daniel-mar 20361
(*      Flags for dwValidData. When set, a flag indicates that the  *)
20362
(*      corresponding field in DMUSOBJECTDESC holds valid data. *)
1 daniel-mar 20363
const
4 daniel-mar 20364
  DMUS_OBJ_OBJECT         = (1 shl 0);     (* Object GUID is valid. *)
20365
  DMUS_OBJ_CLASS          = (1 shl 1);     (* Class GUID is valid. *)
20366
  DMUS_OBJ_NAME           = (1 shl 2);     (* Name is valid. *)
20367
  DMUS_OBJ_CATEGORY       = (1 shl 3);     (* Category is valid. *)
20368
  DMUS_OBJ_FILENAME       = (1 shl 4);     (* File path is valid. *)
20369
  DMUS_OBJ_FULLPATH       = (1 shl 5);     (* Path is full path. *)
20370
  DMUS_OBJ_URL            = (1 shl 6);     (* Path is URL. *)
20371
  DMUS_OBJ_VERSION        = (1 shl 7);     (* Version is valid. *)
20372
  DMUS_OBJ_DATE           = (1 shl 8);     (* Date is valid. *)
20373
  DMUS_OBJ_LOADED         = (1 shl 9);     (* Object is currently loaded in memory. *)
20374
  DMUS_OBJ_MEMORY         = (1 shl 10);    (* Object is pointed to by pbMemData. *)
1 daniel-mar 20375
 
4 daniel-mar 20376
  DMUSB_LOADED    = (1 shl 0);        (* Set when band has been loaded *)
20377
  DMUSB_DEFAULT   = (1 shl 1);        (* Set when band is default band for a style *)
20378
 
1 daniel-mar 20379
type
4 daniel-mar 20380
  IDirectMusicBand =                 interface;
20381
  IDirectMusicChordMap =             interface;
20382
  IDirectMusicLoader =               interface;
20383
  IDirectMusicObject =               interface;
1 daniel-mar 20384
 
20385
 
4 daniel-mar 20386
  IDirectMusicBand = interface (IUnknown)
20387
    ['{d2ac28c0-b39b-11d1-8704-00600893b1bd}']
20388
    function CreateSegment (out ppSegment: IDirectMusicSegment) : HResult; stdcall;
20389
    function Download      (pPerformance: IDirectMusicPerformance) : HResult; stdcall;
20390
    function Unload        (pPerformance: IDirectMusicPerformance) : HResult; stdcall;
1 daniel-mar 20391
  end;
20392
 
4 daniel-mar 20393
  IDirectMusicObject = interface (IUnknown)
20394
    ['{d2ac28b5-b39b-11d1-8704-00600893b1bd}']
20395
    function GetDescriptor (out pDesc: TDMus_ObjectDesc) : HResult; stdcall;
20396
    function SetDescriptor (const pDesc: TDMus_ObjectDesc) : HResult; stdcall;
20397
    function ParseDescriptor (var pStream;
20398
                              out pDesc: TDMus_ObjectDesc) : HResult; stdcall;
20399
  end;
1 daniel-mar 20400
 
4 daniel-mar 20401
  IDirectMusicLoader = interface (IUnknown)
20402
    ['{2ffaaca2-5dca-11d2-afa6-00aa0024d8b6}']
20403
    function GetObject (const pDesc: TDMus_ObjectDesc;
20404
                        const riid : TGUID;
20405
                        out ppv) : HResult; stdcall;
20406
    function SetObject (const pDesc: TDMus_ObjectDesc) : HResult; stdcall;
20407
    function SetSearchDirectory (const rguidClass: TGUID;
20408
                                 pwzPath: PWideChar;
20409
                                 fClear:  BOOL) : HResult; stdcall;
20410
    function ScanDirectory (const rguidClass: TGUID;
20411
                            pwzFileExtension,
20412
                            pwzScanFileName: PWideChar) : HResult; stdcall;
20413
    function CacheObject (pObject: IDirectMusicObject) : HResult; stdcall;
20414
    function ReleaseObject (pObject: IDirectMusicObject) : HResult; stdcall;
20415
    function ClearCache (const rguidClass: TGUID) : HResult; stdcall;
20416
    function EnableCache (const rguidClass: TGUID;
20417
                          fEnable: BOOL) : HResult; stdcall;
20418
    function EnumObject (const rguidClass: TGUID;
20419
                         dwIndex: DWORD;
20420
                         const pDesc: TDMus_ObjectDesc) : HResult; stdcall;
1 daniel-mar 20421
  end;
20422
 
4 daniel-mar 20423
(*  Stream object supports IDirectMusicGetLoader interface to access loader while file parsing. *)
1 daniel-mar 20424
 
4 daniel-mar 20425
  IDirectMusicGetLoader = interface (IUnknown)
20426
    ['{68a04844-d13d-11d1-afa6-00aa0024d8b6}']
20427
    function GetLoader (out ppLoader: IDirectMusicLoader) : HResult; stdcall;
1 daniel-mar 20428
  end;
20429
 
4 daniel-mar 20430
(*/////////////////////////////////////////////////////////////////////
20431
// IDirectMusicStyle *)
20432
  IDirectMusicStyle = interface (IUnknown)
20433
    ['{d2ac28bd-b39b-11d1-8704-00600893b1bd}']
20434
    function GetBand (pwszName: PWideChar;
20435
                      out ppBand: IDirectMusicBand) : HResult; stdcall;
20436
    function EnumBand (dwIndex: DWORD;
20437
                       pwszName: PWideChar) : HResult; stdcall;
20438
    function GetDefaultBand (out ppBand: IDirectMusicBand) : HResult; stdcall;
20439
    function EnumMotif (dwIndex: DWORD;
20440
                        pwszName: PWideChar) : HResult; stdcall;
20441
    function GetMotif (pwszName: PWideChar;
20442
                       out ppSegment: IDirectMusicSegment) : HResult; stdcall;
20443
    function GetDefaultChordMap (out ppChordMap: IDirectMusicChordMap) : HResult; stdcall;
20444
    function EnumChordMap (dwIndex: DWORD;
20445
                           pwszName: PWideChar) : HResult; stdcall;
20446
    function GetChordMap (pwszName: PWideChar;
20447
                          out ppChordMap: IDirectMusicChordMap) : HResult; stdcall;
20448
    function GetTimeSignature (out pTimeSig: TDMus_TimeSignature) : HResult; stdcall;
20449
    function GetEmbellishmentLength (dwType, dwLevel: DWORD;
20450
                                     out pdwMin, pdwMax: DWORD) : HResult; stdcall;
20451
    function GetTempo (out pTempo: double) : HResult; stdcall;
20452
  end;
1 daniel-mar 20453
 
4 daniel-mar 20454
(*/////////////////////////////////////////////////////////////////////
20455
// IDirectMusicChordMap *)
20456
  IDirectMusicChordMap = interface (IUnknown)
20457
    ['{d2ac28be-b39b-11d1-8704-00600893b1bd}']
20458
    function GetScale (out pdwScale: DWORD) : HResult; stdcall;
1 daniel-mar 20459
  end;
20460
 
4 daniel-mar 20461
(*/////////////////////////////////////////////////////////////////////
20462
// IDirectMusicComposer *)
20463
  IDirectMusicComposer = interface (IUnknown)
20464
    ['{d2ac28bf-b39b-11d1-8704-00600893b1bd}']
20465
    function ComposeSegmentFromTemplate (pStyle: IDirectMusicStyle;
20466
                                         pTempSeg: IDirectMusicSegment;
20467
                                         wActivity: WORD;
20468
                                         pChordMap: IDirectMusicChordMap;
20469
                                         out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
20470
    function ComposeSegmentFromShape (pStyle: IDirectMusicStyle;
20471
                                      wNumMeasures,
20472
                                      wShape,
20473
                                      wActivity: WORD;
20474
                                      fIntro:    BOOL;
20475
                                      fEnd:      BOOL;
20476
                                      pChordMap: IDirectMusicChordMap;
20477
                                      out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
20478
    function ComposeTransition (pFromSeg: IDirectMusicSegment;
20479
                                pToSeg:   IDirectMusicSegment;
20480
                                mtTime:   TMusic_Time;
20481
                                wCommand: WORD;
20482
                                dwFlags:  DWORD;
20483
                                pChordMap:IDirectMusicChordMap;
20484
                                out ppSectionSeg: IDirectMusicSegment) : HResult; stdcall;
20485
    function AutoTransition (pPerformance: IDirectMusicPerformance;
20486
                             pToSeg:       IDirectMusicSegment;
20487
                             wCommand:     WORD;
20488
                             dwFlags:      DWORD;
20489
                             pChordMap:    IDirectMusicChordMap;
20490
                             out ppTransSeg:      IDirectMusicSegment;
20491
                             out ppToSegState:    IDirectMusicSegmentState;
20492
                             out ppTransSegState: IDirectMusicSegmentState) : HResult; stdcall;
20493
    function ComposeTemplateFromShape (wNumMeasures: WORD;
20494
                                       wShape:       WORD;
20495
                                       fIntro:       BOOL;
20496
                                       fEnd:         BOOL;
20497
                                       wEndLength:   WORD;
20498
                                       out ppTempSeg:IDirectMusicSegment) : HResult; stdcall;
20499
    function ChangeChordMap (pSectionSeg: IDirectMusicSegment;
20500
                             fTrackScale: BOOL;
20501
                             pChordMap:   IDirectMusicChordMap) : HResult; stdcall;
1 daniel-mar 20502
  end;
20503
 
4 daniel-mar 20504
const  
20505
(* CLSID's *)
20506
  CLSID_DirectMusicPerformance : TGUID = '{d2ac2881-b39b-11d1-8704-00600893b1bd}';
20507
  CLSID_DirectMusicSegment : TGUID = '{d2ac2882-b39b-11d1-8704-00600893b1bd}';
20508
  CLSID_DirectMusicSegmentState : TGUID = '{d2ac2883-b39b-11d1-8704-00600893b1bd}';
20509
  CLSID_DirectMusicGraph : TGUID = '{d2ac2884-b39b-11d1-8704-00600893b1bd}';
20510
  CLSID_DirectMusicTempoTrack : TGUID = '{d2ac2885-b39b-11d1-8704-00600893b1bd}';
20511
  CLSID_DirectMusicSeqTrack : TGUID = '{d2ac2886-b39b-11d1-8704-00600893b1bd}';
20512
  CLSID_DirectMusicSysExTrack : TGUID = '{d2ac2887-b39b-11d1-8704-00600893b1bd}';
20513
  CLSID_DirectMusicTimeSigTrack : TGUID = '{d2ac2888-b39b-11d1-8704-00600893b1bd}';
20514
  CLSID_DirectMusicStyle : TGUID = '{d2ac288a-b39b-11d1-8704-00600893b1bd}';
20515
  CLSID_DirectMusicChordTrack : TGUID = '{d2ac288b-b39b-11d1-8704-00600893b1bd}';
20516
  CLSID_DirectMusicCommandTrack : TGUID = '{d2ac288c-b39b-11d1-8704-00600893b1bd}';
20517
  CLSID_DirectMusicStyleTrack : TGUID = '{d2ac288d-b39b-11d1-8704-00600893b1bd}';
20518
  CLSID_DirectMusicMotifTrack : TGUID = '{d2ac288e-b39b-11d1-8704-00600893b1bd}';
20519
  CLSID_DirectMusicChordMap : TGUID = '{d2ac288f-b39b-11d1-8704-00600893b1bd}';
20520
  CLSID_DirectMusicComposer : TGUID = '{d2ac2890-b39b-11d1-8704-00600893b1bd}';
20521
  CLSID_DirectMusicSignPostTrack : TGUID = '{f17e8672-c3b4-11d1-870b-00600893b1bd}';
20522
  CLSID_DirectMusicLoader : TGUID = '{d2ac2892-b39b-11d1-8704-00600893b1bd}';
20523
  CLSID_DirectMusicBandTrack : TGUID = '{d2ac2894-b39b-11d1-8704-00600893b1bd}';
20524
  CLSID_DirectMusicBand : TGUID = '{79ba9e00-b6ee-11d1-86be-00c04fbf8fef}';
20525
  CLSID_DirectMusicChordMapTrack : TGUID = '{d2ac2896-b39b-11d1-8704-00600893b1bd}';
20526
  CLSID_DirectMusicMuteTrack : TGUID = '{d2ac2898-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20527
 
4 daniel-mar 20528
(* Special GUID for all object types. This is used by the loader. *)
20529
  GUID_DirectMusicAllTypes : TGUID = '{d2ac2893-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20530
 
4 daniel-mar 20531
(* Notification guids *)
20532
  GUID_NOTIFICATION_SEGMENT : TGUID = '{d2ac2899-b39b-11d1-8704-00600893b1bd}';
20533
  GUID_NOTIFICATION_PERFORMANCE : TGUID = '{81f75bc5-4e5d-11d2-bcc7-00a0c922e6eb}';
20534
  GUID_NOTIFICATION_MEASUREANDBEAT : TGUID = '{d2ac289a-b39b-11d1-8704-00600893b1bd}';
20535
  GUID_NOTIFICATION_CHORD : TGUID = '{d2ac289b-b39b-11d1-8704-00600893b1bd}';
20536
  GUID_NOTIFICATION_COMMAND : TGUID = '{d2ac289c-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20537
 
4 daniel-mar 20538
(* Track param type guids *)
20539
(* Use to get/set a DMUS_COMMAND_PARAM param in the Command track *)
20540
  GUID_CommandParam : TGUID = '{d2ac289d-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20541
 
4 daniel-mar 20542
(* Use to get a DMUS_COMMAND_PARAM_2 param in the Command track *)
20543
  GUID_CommandParam2 : TGUID = '{28f97ef7-9538-11d2-97a9-00c04fa36e58}';
1 daniel-mar 20544
 
4 daniel-mar 20545
(* Use to get/set a DMUS_CHORD_PARAM param in the Chord track *)
20546
  GUID_ChordParam : TGUID = '{d2ac289e-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20547
 
4 daniel-mar 20548
(* Use to get a DMUS_RHYTHM_PARAM param in the Chord track *)
20549
  GUID_RhythmParam : TGUID = '{d2ac289f-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20550
 
4 daniel-mar 20551
(* Use to get/set an IDirectMusicStyle param in the Style track *)
20552
  GUID_IDirectMusicStyle : TGUID = '{d2ac28a1-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20553
 
4 daniel-mar 20554
(* Use to get a DMUS_TIMESIGNATURE param in the Style and TimeSig tracks *)
20555
  GUID_TimeSignature : TGUID = '{d2ac28a4-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20556
 
4 daniel-mar 20557
(* Use to get/set a DMUS_TEMPO_PARAM param in the Tempo track *)
20558
  GUID_TempoParam : TGUID = '{d2ac28a5-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20559
 
4 daniel-mar 20560
(* Use to set an IDirectMusicBand param in the Band track *)
20561
  GUID_IDirectMusicBand : TGUID = '{d2ac28ac-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20562
 
4 daniel-mar 20563
(* Use to get/set an IDirectMusicChordMap param in the ChordMap track *)
20564
  GUID_IDirectMusicChordMap : TGUID = '{d2ac28ad-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20565
 
4 daniel-mar 20566
(* Use to get/set a DMUS_MUTE_PARAM param in the Mute track *)
20567
  GUID_MuteParam : TGUID = '{d2ac28af-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20568
 
4 daniel-mar 20569
(* These guids are used in IDirectMusicSegment::SetParam to tell the band track to perform various actions.
20570
 *)
20571
(* Download bands for the IDirectMusicSegment *)
20572
  GUID_Download : TGUID = '{d2ac28a7-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20573
 
4 daniel-mar 20574
(* Unload bands for the IDirectMusicSegment *)
20575
  GUID_Unload : TGUID = '{d2ac28a8-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20576
 
4 daniel-mar 20577
(* Connect segment's bands to an IDirectMusicCollection *)
20578
  GUID_ConnectToDLSCollection : TGUID = '{1db1ae6b-e92e-11d1-a8c5-00c04fa3726e}';
1 daniel-mar 20579
 
4 daniel-mar 20580
(* Enable/disable autodownloading of bands *)
20581
  GUID_Enable_Auto_Download : TGUID = '{d2ac28a9-b39b-11d1-8704-00600893b1bd}';
20582
  GUID_Disable_Auto_Download : TGUID = '{d2ac28aa-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20583
 
4 daniel-mar 20584
(* Clear all bands *)
20585
  GUID_Clear_All_Bands : TGUID = '{d2ac28ab-b39b-11d1-8704-00600893b1bd}';
1 daniel-mar 20586
 
4 daniel-mar 20587
(* Set segment to manage all program changes, bank selects, etc. for simple playback of a standard MIDI file *)
20588
  _GUID_StandardMIDIFile = '{06621075-e92e-11d1-a8c5-00c04fa3726e}';
20589
  GUID_StandardMIDIFile : TGUID = _GUID_StandardMIDIFile;
20590
(* For compatibility with beta releases... *)
20591
  GUID_IgnoreBankSelectForGM : TGUID = _GUID_StandardMIDIFile;
1 daniel-mar 20592
 
4 daniel-mar 20593
(* Disable/enable param guids. Use these in SetParam calls to disable or enable sending
20594
 * specific PMsg types.
20595
 *)
20596
  GUID_DisableTimeSig : TGUID = '{45fc707b-1db4-11d2-bcac-00a0c922e6eb}';
20597
  GUID_EnableTimeSig : TGUID = '{45fc707c-1db4-11d2-bcac-00a0c922e6eb}';
20598
  GUID_DisableTempo : TGUID = '{45fc707d-1db4-11d2-bcac-00a0c922e6eb}';
20599
  GUID_EnableTempo : TGUID = '{45fc707e-1db4-11d2-bcac-00a0c922e6eb}';
1 daniel-mar 20600
 
4 daniel-mar 20601
(* Used in SetParam calls for pattern-based tracks.  A nonzero value seeds the random number
20602
generator for variation selection; a value of zero reverts to the default behavior of
20603
getting the seed from the system clock.
20604
*)
20605
  GUID_SeedVariations : TGUID = '{65b76fa5-ff37-11d2-814e-00c04fa36e58}';
20606
 
20607
(* Global data guids *)
20608
  GUID_PerfMasterTempo : TGUID = '{d2ac28b0-b39b-11d1-8704-00600893b1bd}';
20609
  GUID_PerfMasterVolume : TGUID = '{d2ac28b1-b39b-11d1-8704-00600893b1bd}';
20610
  GUID_PerfMasterGrooveLevel : TGUID = '{d2ac28b2-b39b-11d1-8704-00600893b1bd}';
20611
  GUID_PerfAutoDownload : TGUID = '{fb09565b-3631-11d2-bcb8-00a0c922e6eb}';
1 daniel-mar 20612
 
4 daniel-mar 20613
(* GUID for default GM/GS dls collection. *)
20614
  GUID_DefaultGMCollection : TGUID = '{f17e8673-c3b4-11d1-870b-00600893b1bd}';
1 daniel-mar 20615
 
4 daniel-mar 20616
type
20617
(* IID's *)
20618
  IID_IDirectMusicLoader = IDirectMusicLoader;
20619
  IID_IDirectMusicGetLoader = IDirectMusicGetLoader;
20620
  IID_IDirectMusicObject = IDirectMusicObject;
20621
  IID_IDirectMusicSegment = IDirectMusicSegment;
20622
  IID_IDirectMusicSegmentState = IDirectMusicSegmentState;
20623
  IID_IDirectMusicTrack = IDirectMusicTrack;
20624
  IID_IDirectMusicPerformance = IDirectMusicPerformance;
20625
  IID_IDirectMusicTool = IDirectMusicTool;
20626
  IID_IDirectMusicGraph = IDirectMusicGraph;
20627
  IID_IDirectMusicStyle = IDirectMusicStyle;
20628
  IID_IDirectMusicChordMap = IDirectMusicChordMap;
20629
  IID_IDirectMusicComposer = IDirectMusicComposer;
20630
  IID_IDirectMusicBand = IDirectMusicBand;
1 daniel-mar 20631
 
4 daniel-mar 20632
const  
20633
(* Alternate interface IDs, available in DX7 release and after. *)
20634
  IID_IDirectMusicPerformance2 : TGUID = '{6fc2cae0-bc78-11d2-afa6-00aa0024d8b6}';
20635
  IID_IDirectMusicSegment2 : TGUID = '{d38894d1-c052-11d2-872f-00600893b1bd}';
1 daniel-mar 20636
 
4 daniel-mar 20637
(************************************************************************
20638
*                                                                       *
20639
*   dmusicf.h -- This module defines the DirectMusic file formats       *
20640
*                                                                       *
20641
*   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
20642
*                                                                       *
20643
************************************************************************)
1 daniel-mar 20644
 
4 daniel-mar 20645
//type IDirectMusicCollection = interface;
1 daniel-mar 20646
 
4 daniel-mar 20647
const
20648
(* Common chunks *)
1 daniel-mar 20649
 
4 daniel-mar 20650
  DMUS_FOURCC_GUID_CHUNK        : mmioFOURCC = ('g','u','i','d');
20651
  DMUS_FOURCC_INFO_LIST         : mmioFOURCC = ('I','N','F','O');
20652
  DMUS_FOURCC_UNFO_LIST         : mmioFOURCC = ('U','N','F','O');
20653
  DMUS_FOURCC_UNAM_CHUNK        : mmioFOURCC = ('U','N','A','M');
20654
  DMUS_FOURCC_UART_CHUNK        : mmioFOURCC = ('U','A','R','T');
20655
  DMUS_FOURCC_UCOP_CHUNK        : mmioFOURCC = ('U','C','O','P');
20656
  DMUS_FOURCC_USBJ_CHUNK        : mmioFOURCC = ('U','S','B','J');
20657
  DMUS_FOURCC_UCMT_CHUNK        : mmioFOURCC = ('U','C','M','T');
20658
  DMUS_FOURCC_CATEGORY_CHUNK    : mmioFOURCC = ('c','a','t','g');
20659
  DMUS_FOURCC_VERSION_CHUNK     : mmioFOURCC = ('v','e','r','s');
20660
 
20661
(* The following structures are used by the Tracks, and are the packed structures *)
20662
(* that are passed to the Tracks inside the IStream. *)
20663
 
20664
type
20665
  TDMus_IO_Seq_Item = packed record
20666
    mtTime:     TMusic_Time;
20667
    mtDuration: TMusic_Time;
20668
    dwPChannel: DWORD;
20669
    nOffset:    SmallInt;
20670
    bStatus:    BYTE;
20671
    bByte1:     BYTE;
20672
    bByte2:     BYTE;
1 daniel-mar 20673
  end;
20674
 
4 daniel-mar 20675
  TDMus_IO_Curve_Item = packed record
20676
    mtStart:          TMusic_Time;
20677
    mtDuration:       TMusic_Time;
20678
    mtResetDuration:  TMusic_Time;
20679
    dwPChannel:       DWORD;
20680
       nOffset:       SmallInt;
20681
       nStartValue:   SmallInt;
20682
       nEndValue:     SmallInt;
20683
       nResetValue:   SmallInt;
20684
    bType:            BYTE;
20685
    bCurveShape:      BYTE;
20686
    bCCData:          BYTE;
20687
    bFlags:           BYTE;
20688
  end;
1 daniel-mar 20689
 
4 daniel-mar 20690
  TDMus_IO_Tempo_Item = packed record
20691
    lTime:    TMusic_Time;
20692
    dblTempo: double;
1 daniel-mar 20693
  end;
20694
 
4 daniel-mar 20695
  TDMus_IO_SysEx_Item = packed record
20696
    mtTime:        TMusic_Time;
20697
    dwPChannel:    DWORD;
20698
    dwSysExLength: DWORD;
20699
  end;
1 daniel-mar 20700
 
4 daniel-mar 20701
  TDMus_IO_TimeSignature_Item = packed record
20702
    lTime:            TMusic_Time;
20703
    bBeatsPerMeasure: BYTE;            (* beats per measure (top of time sig) *)
20704
    bBeat:            BYTE;            (* what note receives the beat (bottom of time sig.) *)
20705
                                       (* we can assume that 0 means 256th note *)
20706
    wGridsPerBeat:    WORD;            (* grids per beat *)
1 daniel-mar 20707
  end;
20708
 
4 daniel-mar 20709
(* PARAM structures, used by GetParam() and SetParam() *)
20710
  TDMus_Command_Param = packed record
20711
    bCommand:     BYTE;
20712
    bGrooveLevel: BYTE;
20713
    bGrooveRange: BYTE;
20714
  end;
1 daniel-mar 20715
 
4 daniel-mar 20716
  TDMus_Command_Param_2 = packed record
20717
    mtTime : TMusic_Time;
20718
    bCommand:     BYTE;
20719
    bGrooveLevel: BYTE;
20720
    bGrooveRange: BYTE;
1 daniel-mar 20721
  end;
20722
 
4 daniel-mar 20723
  TDMus_Chord_Param = TDMus_Chord_Key; (* DMUS_CHORD_KEY defined in dmusici.h *)
1 daniel-mar 20724
 
4 daniel-mar 20725
  TDMus_Rhythm_Param = packed record
20726
    TimeSig:         TDMus_TimeSignature;
20727
    dwRhythmPattern: DWORD;
1 daniel-mar 20728
  end;
20729
 
4 daniel-mar 20730
  TDMus_Tempo_Param = packed record
20731
    mtTime:   TMusic_Time;
20732
    dblTempo: double;
20733
  end;
1 daniel-mar 20734
 
4 daniel-mar 20735
  TDMus_Mute_Param = packed record
20736
    dwPChannel:    DWORD;
20737
    dwPChannelMap: DWORD;
20738
    fMute:         BOOL;
1 daniel-mar 20739
  end;
20740
 
20741
const
4 daniel-mar 20742
(* Style chunks *)
1 daniel-mar 20743
 
4 daniel-mar 20744
  DMUS_FOURCC_STYLE_FORM        : mmioFOURCC = ('D','M','S','T');
20745
  DMUS_FOURCC_STYLE_CHUNK       : mmioFOURCC = ('s','t','y','h');
20746
  DMUS_FOURCC_PART_LIST         : mmioFOURCC = ('p','a','r','t');
20747
  DMUS_FOURCC_PART_CHUNK        : mmioFOURCC = ('p','r','t','h');
20748
  DMUS_FOURCC_NOTE_CHUNK        : mmioFOURCC = ('n','o','t','e');
20749
  DMUS_FOURCC_CURVE_CHUNK       : mmioFOURCC = ('c','r','v','e');
20750
  DMUS_FOURCC_PATTERN_LIST      : mmioFOURCC = ('p','t','t','n');
20751
  DMUS_FOURCC_PATTERN_CHUNK     : mmioFOURCC = ('p','t','n','h');
20752
  DMUS_FOURCC_RHYTHM_CHUNK      : mmioFOURCC = ('r','h','t','m');
20753
  DMUS_FOURCC_PARTREF_LIST      : mmioFOURCC = ('p','r','e','f');
20754
  DMUS_FOURCC_PARTREF_CHUNK     : mmioFOURCC = ('p','r','f','c');
20755
  DMUS_FOURCC_STYLE_PERS_REF_LIST   : mmioFOURCC = ('p', 'r', 'r', 'f');
20756
  DMUS_FOURCC_MOTIFSETTINGS_CHUNK   : mmioFOURCC = ('m', 't', 'f', 's');
1 daniel-mar 20757
 
4 daniel-mar 20758
(* Flags used by variations: these make up the DWORDs in dwVariationChoices.               *)
1 daniel-mar 20759
 
4 daniel-mar 20760
(* These flags determine the types of chords supported by a given variation in DirectMusic *)
20761
(* mode.  The first seven flags (bits 1-7) are set if the variation supports major chords  *)
20762
(* rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation         *)
20763
(* supports major chords rooted in the tonic, second, and fourth scale positions.  The     *)
20764
(* next seven flags serve the same purpose, but for minor chords, and the following seven  *)
20765
(* flags serve the same purpose for chords that are not major or minor (e.g., SUS 4        *)
20766
(* chords).  Bits 22, 23, and 24 are set if the variation supports chords rooted in the    *)
20767
(* scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones,       *)
20768
(* respectively.  For example, to support a C# minor chord in the scale of C Major,        *)
20769
(* bits 8 (for tonic minor) and 24 (for sharp) need to be set.  Bits 25, 26, an 27 handle  *)
20770
(* chords that are triads, 6th or 7th chords, and chords with extensions, respectively.    *)
20771
(* bits 28 and 29 handle chords that are followed by tonic and dominant chords,            *)
20772
(* respectively.                                                                           *)
20773
  DMUS_VARIATIONF_MAJOR        = $0000007F; (* Seven positions in the scale - major chords. *)
20774
  DMUS_VARIATIONF_MINOR        = $00003F80; (* Seven positions in the scale - minor chords. *)
20775
  DMUS_VARIATIONF_OTHER        = $001FC000; (* Seven positions in the scale - other chords. *)
20776
  DMUS_VARIATIONF_ROOT_SCALE   = $00200000; (* Handles chord roots in the scale. *)
20777
  DMUS_VARIATIONF_ROOT_FLAT    = $00400000; (* Handles flat chord roots (based on scale notes). *)
20778
  DMUS_VARIATIONF_ROOT_SHARP   = $00800000; (* Handles sharp chord roots (based on scale notes). *)
20779
  DMUS_VARIATIONF_TYPE_TRIAD   = $01000000; (* Handles simple chords - triads. *)
20780
  DMUS_VARIATIONF_TYPE_6AND7   = $02000000; (* Handles simple chords - 6 and 7. *)
20781
  DMUS_VARIATIONF_TYPE_COMPLEX = $04000000; (* Handles complex chords. *)
20782
  DMUS_VARIATIONF_DEST_TO1     = $08000000; (* Handles transitions to 1 chord. *)
20783
  DMUS_VARIATIONF_DEST_TO5     = $10000000; (* Handles transitions to 5 chord. *)
1 daniel-mar 20784
 
4 daniel-mar 20785
(* The top three bits of the variation flags are the Mode bits.  If all are 0, it's IMA. *)
20786
(* If the smallest is 1, it's Direct Music. *)
20787
  DMUS_VARIATIONF_MODES        = $E0000000;
20788
  DMUS_VARIATIONF_IMA25_MODE   = $00000000;
20789
  DMUS_VARIATIONF_DMUS_MODE    = $20000000;
1 daniel-mar 20790
 
4 daniel-mar 20791
//#pragma pack(2)
1 daniel-mar 20792
 
4 daniel-mar 20793
type BYTE2 = Word;
1 daniel-mar 20794
 
4 daniel-mar 20795
type
20796
  TDMus_IO_TimeSig = packed record
20797
    (* Time signatures define how many beats per measure, which note receives *)
20798
    (* the beat, and the grid resolution. *)
20799
    bBeatsPerMeasure: BYTE2;      (* beats per measure (top of time sig) *)
20800
    bBeat:            BYTE2;      (* what note receives the beat (bottom of time sig.) *)
20801
                                 (* we can assume that 0 means 256th note *)
20802
    wGridsPerBeat:    WORD;      (* grids per beat *)
20803
  end;
1 daniel-mar 20804
 
4 daniel-mar 20805
  TDMus_IO_Style = packed record
20806
    timeSig:  TDMus_IO_TimeSig;           (* Styles have a default Time Signature *)
20807
    dblTempo: double;
20808
  end;
1 daniel-mar 20809
 
4 daniel-mar 20810
  TDMus_IO_Version = packed record
20811
    dwVersionMS: DWORD;                      (* Version # high-order 32 bits *)
20812
    dwVersionLS: DWORD;                      (* Version # low-order 32 bits  *)
20813
  end;
1 daniel-mar 20814
 
4 daniel-mar 20815
  TDMus_IO_Pattern = packed record
20816
    timeSig:        TDMus_IO_TimeSig;    (* Patterns can override the Style's Time sig. *)
20817
    bGrooveBottom:  BYTE2;                (* bottom of groove range *)
20818
    bGrooveTop:     BYTE2;                (* top of groove range *)
20819
    wEmbellishment: WORD;                (* Fill, Break, Intro, End, Normal, Motif *)
20820
    wNbrMeasures:   WORD;                (* length in measures *)
20821
  end;
1 daniel-mar 20822
 
4 daniel-mar 20823
  TDMus_IO_StylePart = packed record
20824
    timeSig:        TDMus_IO_TimeSig;   (* can override pattern's *)
20825
    dwVariationChoices: array [0..31] of DWORD; (* MOAW choice bitfield *)
20826
    guidPartID:     TGUID;              (* identifies the part *)
20827
    wNbrMeasures:   WORD;               (* length of the Part *)
20828
    bPlayModeFlags: BYTE2;               (* see PLAYMODE flags *)
20829
    bInvertUpper:   BYTE2;               (* inversion upper limit *)
20830
    bInvertLower:   BYTE2;               (* inversion lower limit *)
20831
  end;
1 daniel-mar 20832
 
4 daniel-mar 20833
  TDMus_IO_PartRef = packed record
20834
    guidPartID:       TGUID;     (* unique ID for matching up with parts *)
20835
    wLogicalPartID:   WORD;      (* corresponds to port/device/midi channel *)
20836
    bVariationLockID: BYTE2;      (* parts with the same ID lock variations. *)
20837
                                 (* high bit is used to identify master Part *)
20838
    bSubChordLevel:   BYTE2;      (* tells which sub chord level this part wants *)
20839
    bPriority:        BYTE2;      (* 256 priority levels. Parts with lower priority *)
20840
                                 (* aren't played first when a device runs out of *)
20841
                                 (* notes *)
20842
    bRandomVariation: BYTE2;      (* when set, matching variations play in random order *)
20843
                                 (* when clear, matching variations play sequentially *)
20844
  end;
1 daniel-mar 20845
 
4 daniel-mar 20846
  TDMus_IO_StyleNote = packed record
20847
    mtGridStart:    TMusic_Time ;(* when this note occurs *)
20848
    dwVariation:    DWORD;       (* variation bits *)
20849
    mtDuration:     TMusic_Time; (* how long this note lasts *)
20850
    nTimeOffset:    SmallInt;    (* offset from mtGridStart *)
20851
    wMusicValue:    WORD;        (* Position in scale. *)
20852
    bVelocity:      BYTE2;        (* Note velocity. *)
20853
    bTimeRange:     BYTE2;        (* Range to randomize start time. *)
20854
    bDurRange:      BYTE2;        (* Range to randomize duration. *)
20855
    bVelRange:      BYTE2;        (* Range to randomize velocity. *)
20856
    bInversionID:   BYTE2;        (* Identifies inversion group to which this note belongs *)
20857
    bPlayModeFlags: BYTE2;        (* Can override part *)
20858
  end;
1 daniel-mar 20859
 
4 daniel-mar 20860
  TDMus_IO_StyleCurve = packed record
20861
    mtGridStart:     TMusic_Time; (* when this curve occurs *)
20862
    dwVariation:     DWORD;       (* variation bits *)
20863
    mtDuration:      TMusic_Time; (* how long this curve lasts *)
20864
    mtResetDuration: TMusic_Time; (* how long after the end of the curve to reset the curve *)
20865
    nTimeOffset:     SmallInt;    (* offset from mtGridStart *)
20866
    nStartValue:     SmallInt;    (* curve's start value *)
20867
    nEndValue:       SmallInt;    (* curve's end value *)
20868
    nResetValue:     SmallInt;    (* the value to which to reset the curve *)
20869
    bEventType:      BYTE2;        (* type of curve *)
20870
    bCurveShape:     BYTE2;        (* shape of curve *)
20871
    bCCData:         BYTE2;        (* CC# *)
20872
    bFlags:          BYTE2;        (* Bit 1=TRUE means to send nResetValue. Otherwise, don't.
20873
                                    Other bits are reserved. *)
20874
  end;
1 daniel-mar 20875
 
4 daniel-mar 20876
  TDMus_IO_MotifSettings = packed record
20877
    dwRepeats:    DWORD;          (* Number of repeats. By default, 0. *)
20878
    mtPlayStart:  TMusic_Time;    (* Start of playback. By default, 0. *)
20879
    mtLoopStart:  TMusic_Time;    (* Start of looping portion. By default, 0. *)
20880
    mtLoopEnd:    TMusic_Time;    (* End of loop. Must be greater than mtLoopStart. By default equal to length of motif. *)
20881
    dwResolution: DWORD;          (* Default resolution. *)
20882
  end;
1 daniel-mar 20883
 
4 daniel-mar 20884
//#pragma pack()
1 daniel-mar 20885
 
4 daniel-mar 20886
(*
20887
RIFF
20888
(
20889
    'DMST'          // Style
20890
    <styh-ck>       // Style header chunk
20891
    <guid-ck>       // Every Style has a GUID
20892
    [<UNFO-list>]   // Name, author, copyright info., comments
20893
    [<vers-ck>]     // version chunk
20894
    <part-list>...  // List of parts in the Style, used by patterns
20895
    <pttn-list>...  // List of patterns in the Style
20896
    <DMBD-form>...  // List of bands in the Style
20897
    [<motf-list>]   // List of motifs in the Style
20898
    [<prrf-list>]   // List of chord map references in the Style
20899
)
1 daniel-mar 20900
 
4 daniel-mar 20901
    // <styh-ck>
20902
    styh
20903
    (
20904
        <DMUS_IO_STYLE>
20905
    )
1 daniel-mar 20906
 
4 daniel-mar 20907
    // <guid-ck>
20908
    guid
20909
    (
20910
        <GUID>
20911
    )
1 daniel-mar 20912
 
4 daniel-mar 20913
    // <vers-ck>
20914
    vers
20915
    (
20916
        <DMUS_IO_VERSION>
20917
    )
1 daniel-mar 20918
 
4 daniel-mar 20919
    // <part-list>
20920
    LIST
20921
    (
20922
        'part'
20923
        <prth-ck>       // Part header chunk
20924
        [<UNFO-list>]
20925
        [<note-ck>]     // List of notes in Part
20926
        [<crve-ck>]     // List of curves in Part
20927
    )
1 daniel-mar 20928
 
4 daniel-mar 20929
        // <orth-ck>
20930
        prth
20931
        (
20932
            <DMUS_IO_STYLEPART>
20933
        )
1 daniel-mar 20934
 
4 daniel-mar 20935
        // <note-ck>
20936
        'note'
20937
        (
20938
            // sizeof DMUS_IO_STYLENOTE:DWORD
20939
            <DMUS_IO_STYLENOTE>...
20940
        )
1 daniel-mar 20941
 
4 daniel-mar 20942
        // <crve-ck>
20943
        'crve'
20944
        (
20945
            // sizeof DMUS_IO_STYLECURVE:DWORD
20946
            <DMUS_IO_STYLECURVE>...
20947
        )
1 daniel-mar 20948
 
4 daniel-mar 20949
    // <pttn-list>
20950
    LIST
20951
    (
20952
        'pttn'
20953
        <ptnh-ck>       // Pattern header chunk
20954
        <rhtm-ck>       // List of rhythms for chord matching
20955
        [<UNFO-list>]
20956
        [<mtfs-ck>]     // Motif settings chunk
20957
        <pref-list>...  // List of part reference id's
20958
    )
1 daniel-mar 20959
 
4 daniel-mar 20960
        // <ptnh-ck>
20961
        ptnh
20962
        (
20963
            <DMUS_IO_PATTERN>
20964
        )
1 daniel-mar 20965
 
4 daniel-mar 20966
        // <rhtm-ck>
20967
        'rhtm'
20968
        (
20969
            // DWORD's representing rhythms for chord matching based on number
20970
            // of measures in the pattern
20971
        )
1 daniel-mar 20972
 
4 daniel-mar 20973
        // pref-list
20974
        LIST
20975
        (
20976
            'pref'
20977
            <prfc-ck>   // part ref chunk
20978
        )
1 daniel-mar 20979
 
4 daniel-mar 20980
        // <prfc-ck>
20981
        prfc
20982
        (
20983
            <DMUS_IO_PARTREF>
20984
        )
1 daniel-mar 20985
 
4 daniel-mar 20986
        // <mtfs-ck>
20987
        mtfs
20988
        (
20989
            <DMUS_IO_MOTIFSETTINGS>
20990
        )
1 daniel-mar 20991
 
4 daniel-mar 20992
    // <prrf-list>
20993
    LIST
20994
    (
20995
        'prrf'
20996
        // some number of <DMRF>
20997
    )
20998
*)
1 daniel-mar 20999
 
4 daniel-mar 21000
(* Chord and command file formats *)
21001
const
21002
  DMUS_FOURCC_CHORDTRACK_LIST         : mmioFOURCC = ('c','o','r','d');
21003
  DMUS_FOURCC_CHORDTRACKHEADER_CHUNK  : mmioFOURCC = ('c','r','d','h');
21004
  DMUS_FOURCC_CHORDTRACKBODY_CHUNK    : mmioFOURCC = ('c','r','d','b');
1 daniel-mar 21005
 
4 daniel-mar 21006
  DMUS_FOURCC_COMMANDTRACK_CHUNK      : mmioFOURCC = ('c','m','n','d');
1 daniel-mar 21007
 
4 daniel-mar 21008
type
21009
  TDMus_IO_Chord = packed record
21010
    wszName: array [0..15] of WCHAR; (* Name of the chord *)
21011
    mtTime:      TMusic_Time;    (* Time of this chord *)
21012
    wMeasure:    WORD;           (* Measure this falls on *)
21013
    bBeat:       BYTE;           (* Beat this falls on *)
1 daniel-mar 21014
  end;
21015
 
4 daniel-mar 21016
  TDMus_IO_SubChord = packed record
21017
    dwChordPattern:    DWORD;    (* Notes in the subchord *)
21018
    dwScalePattern:    DWORD;    (* Notes in the scale *)
21019
    dwInversionPoints: DWORD;    (* Where inversions can occur *)
21020
    dwLevels:          DWORD;    (* Which levels are supported by this subchord *)
21021
    bChordRoot:        BYTE;     (* Root of the subchord *)
21022
    bScaleRoot:        BYTE;     (* Root of the scale *)
1 daniel-mar 21023
  end;
21024
 
4 daniel-mar 21025
  TDMus_IO_Command = packed record
21026
    mtTime:       TMusic_Time;   (* Time of this command *)
21027
    wMeasure:     WORD;          (* Measure this falls on *)
21028
    bBeat:        BYTE;          (* Beat this falls on *)
21029
    bCommand:     BYTE;          (* Command type (see #defines below) *)
21030
    bGrooveLevel: BYTE;          (* Groove level (0 if command is not a groove) *)
21031
    bGrooveRange: BYTE;          (* Groove range  *)
1 daniel-mar 21032
  end;
21033
 
4 daniel-mar 21034
(*
1 daniel-mar 21035
 
4 daniel-mar 21036
    // <cord-list>
21037
    LIST
21038
    (
21039
        'cord'
21040
        <crdh-ck>
21041
        <crdb-ck>       // Chord body chunk
21042
    )
1 daniel-mar 21043
 
4 daniel-mar 21044
        // <crdh-ck>
21045
        crdh
21046
        (
21047
            // Scale: dword (upper 8 bits for root, lower 24 for scale)
21048
        )
1 daniel-mar 21049
 
4 daniel-mar 21050
        // <crdb-ck>
21051
        crdb
21052
        (
21053
            // sizeof DMUS_IO_CHORD:dword
21054
            <DMUS_IO_CHORD>
21055
            // # of DMUS_IO_SUBCHORDS:dword
21056
            // sizeof DMUS_IO_SUBCHORDS:dword
21057
            // a number of <DMUS_IO_SUBCHORD>
21058
        )
1 daniel-mar 21059
 
21060
 
4 daniel-mar 21061
    // <cmnd-list>
21062
    'cmnd'
21063
    (
21064
        //sizeof DMUS_IO_COMMAND: DWORD
21065
        <DMUS_IO_COMMAND>...
21066
    )
1 daniel-mar 21067
 
4 daniel-mar 21068
*)
1 daniel-mar 21069
 
4 daniel-mar 21070
(*  File io for DirectMusic Tool and ToolGraph objects
21071
*)
1 daniel-mar 21072
 
4 daniel-mar 21073
(* RIFF ids: *)
21074
const
21075
  DMUS_FOURCC_TOOLGRAPH_FORM  : mmioFOURCC = ('D','M','T','G');
21076
  DMUS_FOURCC_TOOL_LIST       : mmioFOURCC = ('t','o','l','l');
21077
  DMUS_FOURCC_TOOL_FORM       : mmioFOURCC = ('D','M','T','L');
21078
  DMUS_FOURCC_TOOL_CHUNK      : mmioFOURCC = ('t','o','l','h');
21079
 
21080
(* io structures: *)
1 daniel-mar 21081
type
4 daniel-mar 21082
  TDMus_IO_Tool_Header = packed record
21083
    guidClassID:    TGUID;       (* Class id of tool. *)
21084
    lIndex:         LongInt;     (* Position in graph. *)
21085
    cPChannels:     DWORD;       (* Number of items in channels array. *)
21086
    ckid:           TFourCC;     (* chunk ID of tool's data chunk if 0 fccType valid. *)
21087
    fccType:        TFourCC;     (* list type if NULL ckid valid. *)
21088
    dwPChannels: array [0..0] of DWORD; (* Array of PChannels, size determined by cPChannels. *)
1 daniel-mar 21089
  end;
21090
 
4 daniel-mar 21091
(*
21092
RIFF
21093
(
21094
    'DMTG'          // DirectMusic ToolGraph chunk
21095
    [<guid-ck>]     // GUID for ToolGraph
21096
    [<vers-ck>]     // Optional version info
21097
    [<UNFO-list>]   // Name, author, copyright info., comments
21098
    <toll-list>     // List of Tools
21099
)
1 daniel-mar 21100
 
4 daniel-mar 21101
    // <guid-ck>
21102
    'guid'
21103
    (
21104
        <GUID>
21105
    )
1 daniel-mar 21106
 
4 daniel-mar 21107
    // <vers-ck>
21108
    vers
21109
    (
21110
        <DMUS_IO_VERSION>
21111
    )
1 daniel-mar 21112
 
4 daniel-mar 21113
    // <toll-list>
21114
    LIST
21115
    (
21116
        'toll'          // List of tools
21117
        <DMTL-form>...  // Each tool is encapsulated in a RIFF chunk
21118
    )
1 daniel-mar 21119
 
4 daniel-mar 21120
// <DMTL-form>      // Tools can be embedded in a graph or stored as separate files.
21121
RIFF
21122
(
21123
    'DMTL'
21124
    <tolh-ck>
21125
    [<guid-ck>]     // Optional GUID for tool object instance (not to be confused with Class id in track header)
21126
    [<vers-ck>]     // Optional version info
21127
    [<UNFO-list>]   // Optional name, author, copyright info., comments
21128
    [<data>]        // Tool data. Must be a RIFF readable chunk.
21129
)
1 daniel-mar 21130
 
4 daniel-mar 21131
    // <tolh-ck>            // Tool header chunk
21132
    (
21133
        'tolh'
21134
        <DMUS_IO_TOOL_HEADER>   // Tool header
21135
    )
21136
*)
1 daniel-mar 21137
 
4 daniel-mar 21138
(*  File io for DirectMusic Band Track object *)
1 daniel-mar 21139
 
21140
 
4 daniel-mar 21141
(* RIFF ids: *)
1 daniel-mar 21142
const
4 daniel-mar 21143
  DMUS_FOURCC_BANDTRACK_FORM  : mmioFOURCC = ('D','M','B','T');
21144
  DMUS_FOURCC_BANDTRACK_CHUNK : mmioFOURCC = ('b','d','t','h');
21145
  DMUS_FOURCC_BANDS_LIST      : mmioFOURCC = ('l','b','d','l');
21146
  DMUS_FOURCC_BAND_LIST       : mmioFOURCC = ('l','b','n','d');
21147
  DMUS_FOURCC_BANDITEM_CHUNK  : mmioFOURCC = ('b','d','i','h');
1 daniel-mar 21148
 
21149
type
4 daniel-mar 21150
(*  io structures *)
21151
  TDMus_IO_Band_Track_Header = packed record
21152
    bAutoDownload: BOOL;    (* Determines if Auto-Download is enabled. *)
1 daniel-mar 21153
  end;
21154
 
4 daniel-mar 21155
  TDMus_IO_Band_Item_Header = packed record
21156
    lBandTime: TMusic_Time;   (* Position in track list. *)
1 daniel-mar 21157
  end;
21158
 
4 daniel-mar 21159
(*
21160
RIFF
21161
(
21162
    'DMBT'          // DirectMusic Band Track form-type
21163
    [<bdth-ck>]     // Band track header
21164
    [<guid-ck>]     // GUID for band track
21165
    [<vers-ck>]     // Optional version info
21166
    [<UNFO-list>]   // Name, author, copyright info., comments
21167
    <lbdl-list>     // List of Band Lists
21168
)
1 daniel-mar 21169
 
4 daniel-mar 21170
    // <bnth-ck>
21171
    'bdth'
21172
    (
21173
        <DMUS_IO_BAND_TRACK_HEADER>
21174
    )
1 daniel-mar 21175
 
4 daniel-mar 21176
    // <guid-ck>
21177
    'guid'
21178
    (
21179
        <GUID>
21180
    )
1 daniel-mar 21181
 
4 daniel-mar 21182
    // <vers-ck>
21183
    vers
21184
    (
21185
        <DMUS_IO_VERSION>
21186
    )
1 daniel-mar 21187
 
4 daniel-mar 21188
    // <lbdl-list>
21189
    LIST
21190
    (
21191
        'lbdl'          // List of bands
21192
        <lbnd-list>     // Each band is encapsulated in a list
21193
    )
1 daniel-mar 21194
 
4 daniel-mar 21195
        // <lbnd-list>
21196
        LIST
21197
        (
21198
            'lbnd'
21199
            <bdih-ck>
21200
            <DMBD-form> // Band
21201
        )
1 daniel-mar 21202
 
4 daniel-mar 21203
            // <bdih-ck>            // band item header
21204
            (
21205
                <DMUS_IO_BAND_ITEM_HEADER>  // Band item header
21206
            )
21207
*)      
1 daniel-mar 21208
 
21209
 
4 daniel-mar 21210
(*  File io for DirectMusic Band object
21211
*)
1 daniel-mar 21212
 
4 daniel-mar 21213
(* RIFF ids: *)
1 daniel-mar 21214
const
4 daniel-mar 21215
  DMUS_FOURCC_BAND_FORM           : mmioFOURCC = ('D','M','B','D');
21216
  DMUS_FOURCC_INSTRUMENTS_LIST    : mmioFOURCC = ('l','b','i','l');
21217
  DMUS_FOURCC_INSTRUMENT_LIST     : mmioFOURCC = ('l','b','i','n');
21218
  DMUS_FOURCC_INSTRUMENT_CHUNK    : mmioFOURCC = ('b','i','n','s');
1 daniel-mar 21219
 
4 daniel-mar 21220
(* Flags for DMUS_IO_INSTRUMENT
21221
 *)
21222
  DMUS_IO_INST_PATCH          = (1 shl 0);        (* dwPatch is valid. *)
21223
  DMUS_IO_INST_BANKSELECT     = (1 shl 1);        (* dwPatch contains a valid Bank Select MSB and LSB part *)
21224
  DMUS_IO_INST_ASSIGN_PATCH   = (1 shl 3);        (* dwAssignPatch is valid *)
21225
  DMUS_IO_INST_NOTERANGES     = (1 shl 4);        (* dwNoteRanges is valid *)
21226
  DMUS_IO_INST_PAN            = (1 shl 5);        (* bPan is valid *)
21227
  DMUS_IO_INST_VOLUME         = (1 shl 6);        (* bVolume is valid *)
21228
  DMUS_IO_INST_TRANSPOSE      = (1 shl 7);        (* nTranspose is valid *)
21229
  DMUS_IO_INST_GM             = (1 shl 8);        (* Instrument is from GM collection *)
21230
  DMUS_IO_INST_GS             = (1 shl 9);        (* Instrument is from GS collection *)
21231
  DMUS_IO_INST_XG             = (1 shl 10);       (* Instrument is from XG collection *)
21232
  DMUS_IO_INST_CHANNEL_PRIORITY = (1 shl 11);     (* dwChannelPriority is valid *)
21233
  DMUS_IO_INST_USE_DEFAULT_GM_SET = (1 shl 12);   (* Always use the default GM set for this patch,  *)
21234
                                                  (* don't rely on the synth caps stating GM or GS in hardware. *)
1 daniel-mar 21235
type
4 daniel-mar 21236
(*  io structures *)
21237
  TDMus_IO_Instruments = packed record
21238
    dwPatch:           DWORD;    (* MSB, LSB and Program change to define instrument *)
21239
    dwAssignPatch:     DWORD;    (* MSB, LSB and Program change to assign to instrument when downloading *)
21240
    dwNoteRanges: array [0..3] of DWORD;(* 128 bits: one for each MIDI note instrument needs to able to play *)
21241
    dwPChannel:        DWORD;    (* PChannel instrument plays on *)
21242
    dwFlags:           DWORD;    (* DMUS_IO_INST_ flags *)
21243
    bPan:              BYTE;     (* Pan for instrument *)
21244
    bVolume:           BYTE;     (* Volume for instrument *)
21245
    nTranspose:        SmallInt; (* Number of semitones to transpose notes *)
21246
    dwChannelPriority: DWORD;    (* Channel priority *)
1 daniel-mar 21247
  end;
21248
 
4 daniel-mar 21249
(*
21250
// <DMBD-form> bands can be embedded in other forms
21251
RIFF
21252
(
21253
    'DMBD'          // DirectMusic Band chunk
21254
    [<guid-ck>]     // GUID for band
21255
    [<vers-ck>]     // Optional version info
21256
    [<UNFO-list>]   // Name, author, copyright info., comments
21257
    <lbil-list>     // List of Instruments
21258
)
1 daniel-mar 21259
 
4 daniel-mar 21260
    // <guid-ck>
21261
    'guid'
21262
    (
21263
        <GUID>
21264
    )
1 daniel-mar 21265
 
4 daniel-mar 21266
    // <vers-ck>
21267
    vers
21268
    (
21269
        <DMUS_IO_VERSION>
21270
    )
1 daniel-mar 21271
 
4 daniel-mar 21272
    // <lbil-list>
21273
    LIST
21274
    (
21275
        'lbil'          // List of instruments
21276
        <lbin-list>     // Each instrument is encapsulated in a list
21277
    )
1 daniel-mar 21278
 
4 daniel-mar 21279
        // <lbin-list>
21280
        LIST
21281
        (
21282
            'lbin'
21283
            <bins-ck>
21284
            [<DMRF-list>]       // Optional reference to DLS Collection file.
21285
        )
1 daniel-mar 21286
 
4 daniel-mar 21287
            // <bins-ck>            // Instrument chunk
21288
            (
21289
                'bins'
21290
                <DMUS_IO_INSTRUMENT>    // Instrument header
21291
            )
21292
*)
1 daniel-mar 21293
 
4 daniel-mar 21294
(*  File io for DirectMusic Segment object *)
21295
 
21296
(* RIFF ids: *)
21297
const
21298
  DMUS_FOURCC_SEGMENT_FORM    : mmioFOURCC = ('D','M','S','G');
21299
  DMUS_FOURCC_SEGMENT_CHUNK   : mmioFOURCC = ('s','e','g','h');
21300
  DMUS_FOURCC_TRACK_LIST      : mmioFOURCC = ('t','r','k','l');
21301
  DMUS_FOURCC_TRACK_FORM      : mmioFOURCC = ('D','M','T','K');
21302
  DMUS_FOURCC_TRACK_CHUNK     : mmioFOURCC = ('t','r','k','h');
21303
 
21304
(*  io structures:*)
1 daniel-mar 21305
type
4 daniel-mar 21306
  TDMus_IO_Segment_Header = packed record
21307
    dwRepeats:    DWORD;         (* Number of repeats. By default, 0. *)
21308
    mtLength:     TMusic_Time;   (* Length, in music time. *)
21309
    mtPlayStart:  TMusic_Time;   (* Start of playback. By default, 0. *)
21310
    mtLoopStart:  TMusic_Time;   (* Start of looping portion. By default, 0. *)
21311
    mtLoopEnd:    TMusic_Time;   (* End of loop. Must be greater than dwPlayStart. By default equal to length. *)
21312
    dwResolution: DWORD;         (* Default resolution. *)
1 daniel-mar 21313
  end;
21314
 
4 daniel-mar 21315
  TDMus_IO_Track_Header = packed record
21316
    guidClassID: TGUID;          (* Class id of track. *)
21317
    dwPosition:  DWORD;          (* Position in track list. *)
21318
    dwGroup:     DWORD;          (* Group bits for track. *)
21319
    ckid:        TFourCC;        (* chunk ID of track's data chunk if 0 fccType valid. *)
21320
    fccType:     TFourCC;        (* list type if NULL ckid valid *)
21321
  end;
1 daniel-mar 21322
 
4 daniel-mar 21323
(*
21324
RIFF
21325
(
21326
    'DMSG'          // DirectMusic Segment chunk
21327
    <segh-ck>       // Segment header chunk
21328
    [<guid-ck>]     // GUID for segment
21329
    [<vers-ck>]     // Optional version info
21330
    [<UNFO-list>]   // Name, author, copyright info., comments
21331
    <trkl-list>     // List of Tracks
21332
    [<DMTG-form>]   // Optional ToolGraph
21333
)
1 daniel-mar 21334
 
4 daniel-mar 21335
    // <segh-ck>        
21336
    'segh'
21337
    (
21338
        <DMUS_IO_SEGMENT_HEADER>
21339
    )
21340
 
21341
    // <guid-ck>
21342
    'guid'
21343
    (
21344
        <GUID>
21345
    )
1 daniel-mar 21346
 
4 daniel-mar 21347
    // <vers-ck>
21348
    vers
21349
    (
21350
        <DMUS_IO_VERSION>
21351
    )
1 daniel-mar 21352
 
4 daniel-mar 21353
    // <trkl-list>
21354
    LIST
21355
    (
21356
        'trkl'          // List of tracks
21357
        <DMTK-form>...  // Each track is encapsulated in a RIFF chunk
21358
    )
1 daniel-mar 21359
 
4 daniel-mar 21360
// <DMTK-form>      // Tracks can be embedded in a segment or stored as separate files.
21361
RIFF
21362
(
21363
    'DMTK'
21364
    <trkh-ck>
21365
    [<guid-ck>]     // Optional GUID for track object instance (not to be confused with Class id in track header)
21366
    [<vers-ck>]     // Optional version info
21367
    [<UNFO-list>]   // Optional name, author, copyright info., comments
21368
    [<data>]        // Track data. Must be a RIFF readable chunk.
21369
)
1 daniel-mar 21370
 
4 daniel-mar 21371
    // <trkh-ck>            // Track header chunk
21372
    (
21373
        'trkh'
21374
        <DMUS_IO_TRACK_HEADER>  // Track header
21375
    )
21376
*)
1 daniel-mar 21377
 
4 daniel-mar 21378
(*  File io for DirectMusic reference chunk.
21379
    This is used to embed a reference to an object.
21380
*)
1 daniel-mar 21381
 
4 daniel-mar 21382
(*  RIFF ids: *)
1 daniel-mar 21383
const
4 daniel-mar 21384
  DMUS_FOURCC_REF_LIST        : mmioFOURCC = ('D','M','R','F');
21385
  DMUS_FOURCC_REF_CHUNK       : mmioFOURCC = ('r','e','f','h');
21386
  DMUS_FOURCC_DATE_CHUNK      : mmioFOURCC = ('d','a','t','e');
21387
  DMUS_FOURCC_NAME_CHUNK      : mmioFOURCC = ('n','a','m','e');
21388
  DMUS_FOURCC_FILE_CHUNK      : mmioFOURCC = ('f','i','l','e');
1 daniel-mar 21389
 
21390
type
4 daniel-mar 21391
  TDMus_IO_Reference = packed record
21392
    guidClassID: TGUID;      (* Class id is always required. *)
21393
    dwValidData: DWORD;      (* Flags. *)
1 daniel-mar 21394
  end;
21395
 
4 daniel-mar 21396
(*
21397
LIST
21398
(
21399
    'DMRF'          // DirectMusic Reference chunk
21400
    <refh-ck>       // Reference header chunk
21401
    [<guid-ck>]     // Optional object GUID.
21402
    [<date-ck>]     // Optional file date.
21403
    [<name-ck>]     // Optional name.
21404
    [<file-ck>]     // Optional file name.
21405
    [<catg-ck>]     // Optional category name.
21406
    [<vers-ck>]     // Optional version info.
21407
)
1 daniel-mar 21408
 
4 daniel-mar 21409
    // <refh-ck>
21410
    'refh'
21411
    (
21412
        <DMUS_IO_REFERENCE>
21413
    )
1 daniel-mar 21414
 
4 daniel-mar 21415
    // <guid-ck>
21416
    'guid'
21417
    (
21418
        <GUID>
21419
    )
21420
 
21421
    // <date-ck>
21422
    date
21423
    (
21424
        <FILETIME>
21425
    )
21426
 
21427
    // <name-ck>
21428
    name
21429
    (
21430
        // Name, stored as NULL terminated string of WCHARs
21431
    )
21432
 
21433
    // <file-ck>
21434
    file
21435
    (
21436
        // File name, stored as NULL terminated string of WCHARs
21437
    )
21438
 
21439
    // <catg-ck>
21440
    catg
21441
    (
21442
        // Category name, stored as NULL terminated string of WCHARs
21443
    )
21444
 
21445
    // <vers-ck>
21446
    vers
21447
    (
21448
        <DMUS_IO_VERSION>
21449
    )
21450
*)
21451
 
21452
(* Chord Maps *)
1 daniel-mar 21453
const
4 daniel-mar 21454
(* runtime chunks *)
21455
  DMUS_FOURCC_CHORDMAP_FORM       : mmioFOURCC = ('D','M','P','R');
21456
  DMUS_FOURCC_IOCHORDMAP_CHUNK    : mmioFOURCC = ('p','e','r','h');
21457
  DMUS_FOURCC_SUBCHORD_CHUNK      : mmioFOURCC = ('c','h','d','t');
21458
  DMUS_FOURCC_CHORDENTRY_CHUNK    : mmioFOURCC = ('c','h','e','h');
21459
  DMUS_FOURCC_SUBCHORDID_CHUNK    : mmioFOURCC = ('s','b','c','n');
21460
  DMUS_FOURCC_IONEXTCHORD_CHUNK   : mmioFOURCC = ('n','c','r','d');
21461
  DMUS_FOURCC_NEXTCHORDSEQ_CHUNK  : mmioFOURCC = ('n','c','s','q');
21462
  DMUS_FOURCC_IOSIGNPOST_CHUNK    : mmioFOURCC = ('s','p','s','h');
21463
  DMUS_FOURCC_CHORDNAME_CHUNK     : mmioFOURCC = ('I','N','A','M');
1 daniel-mar 21464
 
4 daniel-mar 21465
(* runtime list chunks *)
21466
  DMUS_FOURCC_CHORDENTRY_LIST     : mmioFOURCC = ('c','h','o','e');
21467
  DMUS_FOURCC_CHORDMAP_LIST       : mmioFOURCC = ('c','m','a','p');
21468
  DMUS_FOURCC_CHORD_LIST          : mmioFOURCC = ('c','h','r','d');
21469
  DMUS_FOURCC_CHORDPALETTE_LIST   : mmioFOURCC = ('c','h','p','l');
21470
  DMUS_FOURCC_CADENCE_LIST        : mmioFOURCC = ('c','a','d','e');
21471
  DMUS_FOURCC_SIGNPOSTITEM_LIST   : mmioFOURCC = ('s','p','s','t');
1 daniel-mar 21472
 
4 daniel-mar 21473
  DMUS_FOURCC_SIGNPOST_LIST       : mmioFOURCC = ('s','p','s','q');
1 daniel-mar 21474
 
4 daniel-mar 21475
(* values for dwChord field of DMUS_IO_PERS_SIGNPOST *)
21476
(* DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST) *)
1 daniel-mar 21477
  DMUS_SIGNPOSTF_A       = 1;
21478
  DMUS_SIGNPOSTF_B       = 2;
21479
  DMUS_SIGNPOSTF_C       = 4;
21480
  DMUS_SIGNPOSTF_D       = 8;
21481
  DMUS_SIGNPOSTF_E       = $10;
21482
  DMUS_SIGNPOSTF_F       = $20;
21483
  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);
21484
  DMUS_SIGNPOSTF_1       = $100;
21485
  DMUS_SIGNPOSTF_2       = $200;
21486
  DMUS_SIGNPOSTF_3       = $400;
21487
  DMUS_SIGNPOSTF_4       = $800;
21488
  DMUS_SIGNPOSTF_5       = $1000;
21489
  DMUS_SIGNPOSTF_6       = $2000;
21490
  DMUS_SIGNPOSTF_7       = $4000;
21491
  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);
21492
  DMUS_SIGNPOSTF_CADENCE = $8000;
21493
 
4 daniel-mar 21494
(* values for dwChord field of DMUS_IO_PERS_SIGNPOST *)
21495
  DMUS_SPOSTCADENCEF_1 = 2;   (* Use the first cadence chord. *)
21496
  DMUS_SPOSTCADENCEF_2 = 4;   (* Use the second cadence chord. *)
1 daniel-mar 21497
 
21498
type
4 daniel-mar 21499
(* run time data structs *)
21500
  TDMus_IO_ChordMap = packed record
21501
    wszLoadName: array [0..19] of WCHAR;
21502
    dwScalePattern: DWORD;
21503
    dwFlags:        DWORD;
1 daniel-mar 21504
  end;
21505
 
4 daniel-mar 21506
  TDMus_IO_ChordMap_SubChord = packed record
21507
    dwChordPattern:  DWORD;
21508
    dwScalePattern:  DWORD;
1 daniel-mar 21509
    dwInvertPattern: DWORD;
4 daniel-mar 21510
    bChordRoot:      BYTE;
21511
    bScaleRoot:      BYTE;
21512
    wCFlags:         WORD;
21513
    dwLevels:        DWORD;    (* parts or which subchord levels this chord supports *)
1 daniel-mar 21514
  end;
21515
 
4 daniel-mar 21516
(* Legacy name... *)
21517
  TDMus_IO_Pers_SubChord = TDMus_IO_ChordMap_SubChord;
1 daniel-mar 21518
 
4 daniel-mar 21519
  TDMus_IO_ChordEntry = packed record
21520
    dwFlags:       DWORD;
21521
    wConnectionID: WORD;     (* replaces runtime "pointer to this" *)
1 daniel-mar 21522
  end;
21523
 
4 daniel-mar 21524
  TDMus_IO_NextChord = packed record
21525
    dwFlags:       DWORD;
21526
    nWeight:       WORD;
21527
    wMinBeats:     WORD;
21528
    wMaxBeats:     WORD;
21529
    wConnectionID: WORD;     (* points to an ioChordEntry *)
1 daniel-mar 21530
  end;
21531
 
4 daniel-mar 21532
  TDMus_IO_ChordMap_SignPost = packed record
21533
    dwChords: DWORD;     (* 1bit per group *)
21534
    dwFlags:  DWORD;
1 daniel-mar 21535
  end;
21536
 
4 daniel-mar 21537
(* Legacy name... *)
21538
  TDMus_IO_Pers_SignPost = TDMus_IO_ChordMap_SignPost;
1 daniel-mar 21539
 
4 daniel-mar 21540
(*
21541
RIFF
21542
(
21543
    'DMPR'
21544
    <perh-ck>           // Chord map header chunk
21545
    [<guid-ck>]         // guid chunk
21546
    [<vers-ck>]         // version chunk (two DWORDS)
21547
    [<UNFO-list>]       // Unfo chunk
21548
    <chdt-ck>           // subchord database
21549
    <chpl-list>         // chord palette
21550
    <cmap-list>         // chord map
21551
    <spsq-list>         // signpost list
21552
 )
21553
 
21554
<cmap-list> ::= LIST('cmap' <choe-list> )
21555
 
21556
<choe-list> ::= LIST('choe'
21557
                                <cheh-ck>   // chord entry data
21558
                                <chrd-list> // chord definition
21559
                                <ncsq-ck>   // connecting(next) chords
21560
                     )
21561
 
21562
<chrd-list> ::= LIST('chrd'
21563
                                <INAM-ck>   // name of chord in wide char format
21564
                                <sbcn-ck>   // list of subchords composing chord
21565
                    )
21566
 
21567
<chpl-list> ::= LIST('chpl'
21568
                                <chrd-list> ... // chord definition
21569
                    )
21570
 
21571
<spsq-list> ::== LIST('spsq' <spst-list> ... )
21572
 
21573
<spst-list> ::= LIST('spst'
21574
                             <spsh-ck>
21575
                             <chrd-list>
21576
                             [<cade-list>]
21577
                    )
21578
 
21579
<cade-list> ::= LIST('cade' <chrd-list> ...)
21580
 
21581
<perh-ck> ::= perh(<DMUS_IO_CHORDMAP>)
21582
 
21583
<chdt-ck> ::= chdt(<cbChordSize::WORD>
21584
                   <DMUS_IO_PERS_SUBCHORD> ... )
21585
 
21586
<cheh-ck> ::= cheh(<DMUS_IO_CHORDENTRY>)
21587
 
21588
<sbcn-ck> ::= sbcn(<cSubChordID:WORD> ...)
21589
 
21590
<ncsq-ck> ::= ncsq(<wNextChordSize:WORD>
21591
                   <DMUS_IO_NEXTCHORD>...)
21592
 
21593
<spsh-ck> ::= spsh(<DMUS_IO_PERS_SIGNPOST>)
21594
 
21595
*)
21596
 
21597
(* Signpost tracks *)
1 daniel-mar 21598
const
4 daniel-mar 21599
  DMUS_FOURCC_SIGNPOST_TRACK_CHUNK    : mmioFOURCC = ( 's', 'g', 'n', 'p' );
1 daniel-mar 21600
 
21601
type
4 daniel-mar 21602
  TDMus_IO_SignPost = packed record
21603
    mtTime:   TMusic_Time;
21604
    dwChords: DWORD;
21605
    wMeasure: WORD;
1 daniel-mar 21606
  end;
21607
 
4 daniel-mar 21608
(*
21609
 
21610
    // <sgnp-list>
21611
    'sgnp'
21612
    (
21613
        //sizeof DMUS_IO_SIGNPOST: DWORD
21614
        <DMUS_IO_SIGNPOST>...
21615
    )
21616
 
21617
*)
21618
 
1 daniel-mar 21619
const
4 daniel-mar 21620
  DMUS_FOURCC_MUTE_CHUNK  : mmioFOURCC = ('m','u','t','e');
1 daniel-mar 21621
 
21622
type
4 daniel-mar 21623
  TDMus_IO_Mute = packed record
21624
    mtTime: TMusic_Time;
21625
    dwPChannel:    DWORD;
21626
    dwPChannelMap: DWORD;
1 daniel-mar 21627
  end;
21628
 
4 daniel-mar 21629
(*
1 daniel-mar 21630
 
4 daniel-mar 21631
    // <mute-list>
21632
    'mute'
21633
    (
21634
        //sizeof DMUS_IO_MUTE:DWORD
21635
        <DMUS_IO_MUTE>...
21636
    )
1 daniel-mar 21637
 
21638
 
4 daniel-mar 21639
*)
1 daniel-mar 21640
 
21641
const
4 daniel-mar 21642
(* Used for both style and chord map tracks *)
1 daniel-mar 21643
 
4 daniel-mar 21644
  DMUS_FOURCC_TIME_STAMP_CHUNK   : mmioFOURCC = ('s', 't', 'm', 'p');
1 daniel-mar 21645
 
4 daniel-mar 21646
(* Style tracks *)
1 daniel-mar 21647
 
4 daniel-mar 21648
  DMUS_FOURCC_STYLE_TRACK_LIST   : mmioFOURCC = ('s', 't', 't', 'r');
21649
  DMUS_FOURCC_STYLE_REF_LIST     : mmioFOURCC = ('s', 't', 'r', 'f');
21650
 
21651
(*
21652
 
21653
    // <sttr-list>
21654
    LIST('sttr'
21655
    (
21656
        // some number of <strf-list>
21657
    )
21658
 
21659
    // <strf-list>
21660
    LIST('strf'
21661
    (
21662
        <stmp-ck>
21663
        <DMRF>
21664
    )
21665
 
21666
    // <stmp-ck> defined in ..\dmcompos\dmcompp.h
21667
 
21668
*)
21669
 
21670
(* Chord map tracks *)
21671
 
21672
  DMUS_FOURCC_PERS_TRACK_LIST : mmioFOURCC = ('p', 'f', 't', 'r');
21673
  DMUS_FOURCC_PERS_REF_LIST   : mmioFOURCC = ('p', 'f', 'r', 'f');
21674
 
21675
(*
21676
 
21677
    // <pftr-list>
21678
    LIST('pftr'
21679
    (
21680
        // some number of <pfrf-list>
21681
    )
21682
 
21683
    // <pfrf-list>
21684
    LIST('pfrf'
21685
    (
21686
        <stmp-ck>
21687
        <DMRF>
21688
    )
21689
 
21690
  // <stmp-ck>
21691
  'stmp'
21692
  (
21693
    // time:DWORD
21694
  )
21695
 
21696
 
21697
 
21698
*)
21699
 
21700
  DMUS_FOURCC_TEMPO_TRACK    : mmioFOURCC = ('t','e','t','r');
21701
 
21702
(*
21703
    // tempo list
21704
    'tetr'
21705
    (
21706
        // sizeof DMUS_IO_TEMPO_ITEM: DWORD
21707
        <DMUS_IO_TEMPO_ITEM>...
21708
    )
21709
  *)
21710
 
21711
  DMUS_FOURCC_SEQ_TRACK      : mmioFOURCC = ('s','e','q','t');
21712
  DMUS_FOURCC_SEQ_LIST       : mmioFOURCC = ('e','v','t','l');
21713
  DMUS_FOURCC_CURVE_LIST     : mmioFOURCC = ('c','u','r','l');
21714
 
21715
(*
21716
    // sequence track
21717
    'seqt'
21718
    (
21719
        // sequence list
21720
        'evtl'
21721
        (
21722
            // sizeof DMUS_IO_SEQ_ITEM: DWORD
21723
            <DMUS_IO_SEQ_ITEM>...
21724
        )
21725
        // curve list
21726
        'curl'
21727
        (
21728
            // sizeof DMUS_IO_CURVE_ITEM: DWORD
21729
            <DMUS_IO_CURVE_ITEM>...
21730
        )
21731
    )
21732
*)
21733
 
21734
  DMUS_FOURCC_SYSEX_TRACK    : mmioFOURCC = ('s','y','e','x');
21735
 
21736
(*
21737
    // sysex track
21738
    'syex'
21739
    (
21740
        // list of:
21741
        // {
21742
        //      <DMUS_IO_SYSEX_ITEM>
21743
        //      sys-ex: data
21744
        // }...
21745
    )
21746
*)
21747
 
21748
  DMUS_FOURCC_TIMESIGNATURE_TRACK : mmioFOURCC = ('t','i','m','s');
21749
 
21750
(*
21751
    // time signature track
21752
    'tims'
21753
    (
21754
        // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD
21755
        <DMUS_IO_TIMESIGNATURE_ITEM>...
21756
    )
21757
*)
21758
 
21759
(***************************************************************************
21760
*                                                                          *
21761
*   DMusBuff.h -- This module defines the buffer format for DirectMusic    *
21762
*                 Shared file between user mode and kernel mode components *
21763
*                                                                          *
21764
*   Copyright (c) 1998, Microsoft Corp. All rights reserved.               *
21765
*                                                                          *
21766
***************************************************************************)
21767
 
21768
(* The number of bytes to allocate for an event with 'cb' data bytes.
21769
 *)
21770
function QWORD_ALIGN(x: DWORD) : DWORD;
21771
 
21772
function DMUS_EVENT_SIZE(cb: DWORD) : DWORD;
21773
 
21774
 
21775
 
21776
Implementation
21777
 
21778
//DirectDraw file
21779
 
21780
 
21781
{
21782
#define GET_WHQL_YEAR( dwWHQLLevel ) \
21783
    ( (dwWHQLLevel) / 0x10000 )
21784
#define GET_WHQL_MONTH( dwWHQLLevel ) \
21785
    ( ( (dwWHQLLevel) / 0x100 ) & 0x00ff )
21786
#define GET_WHQL_DAY( dwWHQLLevel ) \
21787
    ( (dwWHQLLevel) & 0xff )
21788
}
21789
function GET_WHQL_YEAR(dwWHQLLevel: DWORD) : DWORD;
1 daniel-mar 21790
begin
4 daniel-mar 21791
  Result := (dwWHQLLevel) div $10000;
1 daniel-mar 21792
end;
21793
 
4 daniel-mar 21794
function GET_WHQL_MONTH(dwWHQLLevel: DWORD) : DWORD;
1 daniel-mar 21795
begin
4 daniel-mar 21796
  Result := ( (dwWHQLLevel) div $100 ) and $00ff;
1 daniel-mar 21797
end;
21798
 
4 daniel-mar 21799
function GET_WHQL_DAY(dwWHQLLevel: DWORD) : DWORD;
1 daniel-mar 21800
begin
4 daniel-mar 21801
  Result := (dwWHQLLevel) and $ff;
1 daniel-mar 21802
end;
21803
 
21804
 
4 daniel-mar 21805
function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
21806
begin
21807
  Result := DWORD(byte(ch0) shl 0) or
21808
            DWORD(byte(ch1) shl 8) or
21809
            DWORD(byte(ch2) shl 16) or
21810
            DWORD(byte(ch3) shl 24);
21811
end;
1 daniel-mar 21812
 
4 daniel-mar 21813
function DDErrorString(Value: HResult) : string;
21814
begin
21815
  case Value of
21816
    DD_OK: Result := 'The request completed successfully.';
21817
    DDERR_ALREADYINITIALIZED: Result := 'This object is already initialized.';
21818
    DDERR_BLTFASTCANTCLIP: Result := ' if a clipper object is attached to the source surface passed into a BltFast call.';
21819
    DDERR_CANNOTATTACHSURFACE: Result := 'This surface can not be attached to the requested surface.';
21820
    DDERR_CANNOTDETACHSURFACE: Result := 'This surface can not be detached from the requested surface.';
21821
    DDERR_CANTCREATEDC: Result := 'Windows can not create any more DCs.';
21822
    DDERR_CANTDUPLICATE: Result := 'Cannot duplicate primary & 3D surfaces, or surfaces that are implicitly created.';
21823
    DDERR_CLIPPERISUSINGHWND: Result := 'An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.';
21824
    DDERR_COLORKEYNOTSET: Result := 'No src color key specified for this operation.';
21825
    DDERR_CURRENTLYNOTAVAIL: Result := 'Support is currently not available.';
21826
    DDERR_DIRECTDRAWALREADYCREATED: Result := 'A DirectDraw object representing this driver has already been created for this process.';
21827
    DDERR_EXCEPTION: Result := 'An exception was encountered while performing the requested operation.';
21828
    DDERR_EXCLUSIVEMODEALREADYSET: Result := 'An attempt was made to set the cooperative level when it was already set to exclusive.';
21829
    DDERR_GENERIC: Result := 'Generic failure.';
21830
    DDERR_HEIGHTALIGN: Result := 'Height of rectangle provided is not a multiple of reqd alignment.';
21831
    DDERR_HWNDALREADYSET: Result := 'The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.';
21832
    DDERR_HWNDSUBCLASSED: Result := 'HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.';
21833
    DDERR_IMPLICITLYCREATED: Result := 'This surface can not be restored because it is an implicitly created surface.';
21834
    DDERR_INCOMPATIBLEPRIMARY: Result := 'Unable to match primary surface creation request with existing primary surface.';
21835
    DDERR_INVALIDCAPS: Result := 'One or more of the caps bits passed to the callback are incorrect.';
21836
    DDERR_INVALIDCLIPLIST: Result := 'DirectDraw does not support the provided cliplist.';
21837
    DDERR_INVALIDDIRECTDRAWGUID: Result := 'The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.';
21838
    DDERR_INVALIDMODE: Result := 'DirectDraw does not support the requested mode.';
21839
    DDERR_INVALIDOBJECT: Result := 'DirectDraw received a pointer that was an invalid DIRECTDRAW object.';
21840
    DDERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the function are incorrect.';
21841
    DDERR_INVALIDPIXELFORMAT: Result := 'The pixel format was invalid as specified.';
21842
    DDERR_INVALIDPOSITION: Result := 'Returned when the position of the overlay on the destination is no longer legal for that destination.';
21843
    DDERR_INVALIDRECT: Result := 'Rectangle provided was invalid.';
21844
    DDERR_LOCKEDSURFACES: Result := 'Operation could not be carried out because one or more surfaces are locked.';
21845
    DDERR_NO3D: Result := 'There is no 3D present.';
21846
    DDERR_NOALPHAHW: Result := 'Operation could not be carried out because there is no alpha accleration hardware present or available.';
21847
    DDERR_NOBLTHW: Result := 'No blitter hardware present.';
21848
    DDERR_NOCLIPLIST: Result := 'No cliplist available.';
21849
    DDERR_NOCLIPPERATTACHED: Result := 'No clipper object attached to surface object.';
21850
    DDERR_NOCOLORCONVHW: Result := 'Operation could not be carried out because there is no color conversion hardware present or available.';
21851
    DDERR_NOCOLORKEY: Result := 'Surface does not currently have a color key';
21852
    DDERR_NOCOLORKEYHW: Result := 'Operation could not be carried out because there is no hardware support of the destination color key.';
21853
    DDERR_NOCOOPERATIVELEVELSET: Result := 'Create function called without DirectDraw object method SetCooperativeLevel being called.';
21854
    DDERR_NODC: Result := 'No DC was ever created for this surface.';
21855
    DDERR_NODDROPSHW: Result := 'No DirectDraw ROP hardware.';
21856
    DDERR_NODIRECTDRAWHW: Result := 'A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.';
21857
    DDERR_NOEMULATION: Result := 'Software emulation not available.';
21858
    DDERR_NOEXCLUSIVEMODE: Result := 'Operation requires the application to have exclusive mode but the application does not have exclusive mode.';
21859
    DDERR_NOFLIPHW: Result := 'Flipping visible surfaces is not supported.';
21860
    DDERR_NOGDI: Result := 'There is no GDI present.';
21861
    DDERR_NOHWND: Result := 'Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.';
21862
    DDERR_NOMIRRORHW: Result := 'Operation could not be carried out because there is no hardware present or available.';
21863
    DDERR_NOOVERLAYDEST: Result := 'Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.';
21864
    DDERR_NOOVERLAYHW: Result := 'Operation could not be carried out because there is no overlay hardware present or available.';
21865
    DDERR_NOPALETTEATTACHED: Result := 'No palette object attached to this surface.';
21866
    DDERR_NOPALETTEHW: Result := 'No hardware support for 16 or 256 color palettes.';
21867
    DDERR_NORASTEROPHW: Result := 'Operation could not be carried out because there is no appropriate raster op hardware present or available.';
21868
    DDERR_NOROTATIONHW: Result := 'Operation could not be carried out because there is no rotation hardware present or available.';
21869
    DDERR_NOSTRETCHHW: Result := 'Operation could not be carried out because there is no hardware support for stretching.';
21870
    DDERR_NOT4BITCOLOR: Result := 'DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.';
21871
    DDERR_NOT4BITCOLORINDEX: Result := 'DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.';
21872
    DDERR_NOT8BITCOLOR: Result := 'DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.';
21873
    DDERR_NOTAOVERLAYSURFACE: Result := 'Returned when an overlay member is called for a non-overlay surface.';
21874
    DDERR_NOTEXTUREHW: Result := 'Operation could not be carried out because there is no texture mapping hardware present or available.';
21875
    DDERR_NOTFLIPPABLE: Result := 'An attempt has been made to flip a surface that is not flippable.';
21876
    DDERR_NOTFOUND: Result := 'Requested item was not found.';
21877
    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.';
21878
    DDERR_NOTPALETTIZED: Result := 'The surface being used is not a palette-based surface.';
21879
    DDERR_NOVSYNCHW: Result := 'Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.';
21880
    DDERR_NOZBUFFERHW: Result := 'Operation could not be carried out because there is no hardware support for zbuffer blitting.';
21881
    DDERR_NOZOVERLAYHW: Result := 'Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.';
21882
    DDERR_OUTOFCAPS: Result := 'The hardware needed for the requested operation has already been allocated.';
21883
    DDERR_OUTOFMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.';
21884
    DDERR_OUTOFVIDEOMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.';
21885
    DDERR_OVERLAYCANTCLIP: Result := 'The hardware does not support clipped overlays.';
21886
    DDERR_OVERLAYCOLORKEYONLYONEACTIVE: Result := 'Can only have ony color key active at one time for overlays.';
21887
    DDERR_OVERLAYNOTVISIBLE: Result := 'Returned when GetOverlayPosition is called on a hidden overlay.';
21888
    DDERR_PALETTEBUSY: Result := 'Access to this palette is being refused because the palette is already locked by another thread.';
21889
    DDERR_PRIMARYSURFACEALREADYEXISTS: Result := 'This process already has created a primary surface.';
21890
    DDERR_REGIONTOOSMALL: Result := 'Region passed to Clipper::GetClipList is too small.';
21891
    DDERR_SURFACEALREADYATTACHED: Result := 'This surface is already attached to the surface it is being attached to.';
21892
    DDERR_SURFACEALREADYDEPENDENT: Result := 'This surface is already a dependency of the surface it is being made a dependency of.';
21893
    DDERR_SURFACEBUSY: Result := 'Access to this surface is being refused because the surface is already locked by another thread.';
21894
    DDERR_SURFACEISOBSCURED: Result := 'Access to surface refused because the surface is obscured.';
21895
    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.';
21896
    DDERR_SURFACENOTATTACHED: Result := 'The requested surface is not attached.';
21897
    DDERR_TOOBIGHEIGHT: Result := 'Height requested by DirectDraw is too large.';
21898
    DDERR_TOOBIGSIZE: Result := 'Size requested by DirectDraw is too large, but the individual height and width are OK.';
21899
    DDERR_TOOBIGWIDTH: Result := 'Width requested by DirectDraw is too large.';
21900
    DDERR_UNSUPPORTED: Result := 'Action not supported.';
21901
    DDERR_UNSUPPORTEDFORMAT: Result := 'FOURCC format requested is unsupported by DirectDraw.';
21902
    DDERR_UNSUPPORTEDMASK: Result := 'Bitmask in the pixel format requested is unsupported by DirectDraw.';
21903
    DDERR_VERTICALBLANKINPROGRESS: Result := 'Vertical blank is in progress.';
21904
    DDERR_WASSTILLDRAWING: Result := 'Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.';
21905
    DDERR_WRONGMODE: Result := 'This surface can not be restored because it was created in a different mode.';
21906
    DDERR_XALIGN: Result := 'Rectangle provided was not horizontally aligned on required boundary.';
21907
    // new:
21908
    DDERR_OVERLAPPINGRECTS: Result := 'Operation could not be carried out because the source and destination rectangles are on the same surface and overlap each other.';
21909
    DDERR_INVALIDSTREAM: Result := 'The specified stream contains invalid data';
21910
    DDERR_UNSUPPORTEDMODE: Result := 'The display is currently in an unsupported mode';
21911
    DDERR_NOMIPMAPHW: Result := 'Operation could not be carried out because there is no mip-map texture mapping hardware present or available.';
21912
    DDERR_INVALIDSURFACETYPE: Result := 'The requested action could not be performed because the surface was of the wrong type.';
21913
    DDERR_NOOPTIMIZEHW: Result := 'Device does not support optimized surfaces, therefore no video memory optimized surfaces';
21914
    DDERR_NOTLOADED: Result := 'Surface is an optimized surface, but has not yet been allocated any memory';
21915
    DDERR_NOFOCUSWINDOW: Result := 'Attempt was made to create or set a device window without first setting the focus window';
21916
    DDERR_DCALREADYCREATED: Result := 'A DC has already been returned for this surface. Only one DC can be retrieved per surface.';
21917
    DDERR_NONONLOCALVIDMEM: Result := 'An attempt was made to allocate non-local video memory from a device that does not support non-local video memory.';
21918
    DDERR_CANTPAGELOCK: Result := 'The attempt to page lock a surface failed.';
21919
    DDERR_CANTPAGEUNLOCK: Result := 'The attempt to page unlock a surface failed.';
21920
    DDERR_NOTPAGELOCKED: Result := 'An attempt was made to page unlock a surface with no outstanding page locks.';
21921
    DDERR_MOREDATA: Result := 'There is more data available than the specified buffer size could hold';
21922
    DDERR_EXPIRED: Result := 'The data has expired and is therefore no longer valid.';
21923
    DDERR_VIDEONOTACTIVE: Result := 'The video port is not active';
21924
    DDERR_DEVICEDOESNTOWNSURFACE: Result := 'Surfaces created by one direct draw device cannot be used directly by another direct draw device.';
21925
    DDERR_NOTINITIALIZED: Result := 'An attempt was made to invoke an interface member of a DirectDraw object created by CoCreateInstance() before it was initialized.';
21926
    else Result := 'Unrecognized Error';
21927
  end;
21928
end;
1 daniel-mar 21929
 
4 daniel-mar 21930
//Direct3D file
1 daniel-mar 21931
 
4 daniel-mar 21932
function DXFileErrorString(Value: HResult) : string;
1 daniel-mar 21933
begin
4 daniel-mar 21934
  case Value of
21935
    DXFILE_OK: Result := 'Command completed successfully. Equivalent to DD_OK.';
21936
    DXFILEERR_BADVALUE: Result := 'Parameter is invalid.';
21937
    DXFILEERR_BADTYPE: Result := 'Object type is invalid.';
21938
    DXFILEERR_BADALLOC: Result := 'Memory allocation failed.';
21939
    DXFILEERR_NOTFOUND: Result := 'Object could not be found.';
21940
    DXFILEERR_FILENOTFOUND: Result := 'File could not be found.';
21941
    DXFILEERR_RESOURCENOTFOUND: Result := 'Resource could not be found.';
21942
    DXFILEERR_URLNOTFOUND: Result := 'URL could not be found.';
21943
    DXFILEERR_BADRESOURCE: Result := 'Resource is invalid.';
21944
    DXFILEERR_BADFILETYPE: Result := 'File is not a DirectX file.';
21945
    DXFILEERR_BADFILEVERSION: Result := 'File version is not valid.';
21946
    DXFILEERR_BADFILEFLOATSIZE: Result := 'Floating-point size is invalid.';
21947
    DXFILEERR_BADFILE: Result := 'File is invalid.';
21948
    DXFILEERR_PARSEERROR: Result := 'File could not be parsed.';
21949
    DXFILEERR_BADARRAYSIZE: Result := 'Array size is invalid.';
21950
    DXFILEERR_BADDATAREFERENCE: Result := 'Data reference is invalid.';
21951
    DXFILEERR_NOMOREOBJECTS: Result := 'All objects have been enumerated.';
21952
    DXFILEERR_NOMOREDATA: Result := 'No further data is available.';
21953
    else Result := 'Unrecognized Error';
21954
  end;
1 daniel-mar 21955
end;
21956
 
4 daniel-mar 21957
function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD) : DWORD;
1 daniel-mar 21958
begin
4 daniel-mar 21959
  Result := (D3DFVF_TEXTUREFORMAT3 shl (CoordIndex*2 + 16));
21960
end;
21961
 
21962
function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD) : DWORD;
21963
begin
21964
  Result := (D3DFVF_TEXTUREFORMAT2);
21965
end;
21966
 
21967
function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD) : DWORD;
21968
begin
21969
  Result := (D3DFVF_TEXTUREFORMAT4 shl (CoordIndex*2 + 16));
21970
end;
21971
 
21972
function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD) : DWORD;
21973
begin
21974
  Result := (D3DFVF_TEXTUREFORMAT1 shl (CoordIndex*2 + 16));
21975
end;
21976
 
21977
 
21978
function D3DVal(val: variant) : float;
21979
begin
1 daniel-mar 21980
  Result := val;
21981
end;
21982
 
4 daniel-mar 21983
function D3DDivide(a,b: double) : float;
1 daniel-mar 21984
begin
21985
  Result := a / b;
21986
end;
21987
 
4 daniel-mar 21988
function D3DMultiply(a,b: double) : float;
1 daniel-mar 21989
begin
21990
  Result := a * b;
21991
end;
21992
 
4 daniel-mar 21993
// #define CI_GETALPHA(ci)    ((ci) >> 24)
21994
function CI_GETALPHA(ci: DWORD) : DWORD;
1 daniel-mar 21995
begin
21996
  Result := ci shr 24;
21997
end;
21998
 
4 daniel-mar 21999
// #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
22000
function CI_GETINDEX(ci: DWORD) : DWORD;
1 daniel-mar 22001
begin
4 daniel-mar 22002
  Result := (ci shr 8) and $ffff;
1 daniel-mar 22003
end;
22004
 
4 daniel-mar 22005
// #define CI_GETFRACTION(ci) ((ci) & 0xff)
22006
function CI_GETFRACTION(ci: DWORD) : DWORD;
1 daniel-mar 22007
begin
4 daniel-mar 22008
  Result := ci and $ff;
1 daniel-mar 22009
end;
22010
 
4 daniel-mar 22011
// #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
22012
function CI_ROUNDINDEX(ci: DWORD) : DWORD;
1 daniel-mar 22013
begin
4 daniel-mar 22014
  Result := CI_GETINDEX(ci + $80);
1 daniel-mar 22015
end;
22016
 
4 daniel-mar 22017
// #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
22018
function CI_MASKALPHA(ci: DWORD) : DWORD;
1 daniel-mar 22019
begin
4 daniel-mar 22020
  Result := ci and $ffffff;
1 daniel-mar 22021
end;
22022
 
4 daniel-mar 22023
// #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
22024
function CI_MAKE(a,i,f: DWORD) : DWORD;
1 daniel-mar 22025
begin
22026
  Result := (a shl 24) or (i shl 8) or f;
22027
end;
22028
 
4 daniel-mar 22029
// #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
22030
function RGBA_GETALPHA(rgb: TD3DColor) : DWORD;
1 daniel-mar 22031
begin
22032
  Result := rgb shr 24;
22033
end;
22034
 
4 daniel-mar 22035
// #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
22036
function RGBA_GETRED(rgb: TD3DColor) : DWORD;
1 daniel-mar 22037
begin
4 daniel-mar 22038
  Result := (rgb shr 16) and $ff;
1 daniel-mar 22039
end;
22040
 
4 daniel-mar 22041
// #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
22042
function RGBA_GETGREEN(rgb: TD3DColor) : DWORD;
1 daniel-mar 22043
begin
4 daniel-mar 22044
  Result := (rgb shr 8) and $ff;
1 daniel-mar 22045
end;
22046
 
4 daniel-mar 22047
// #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
22048
function RGBA_GETBLUE(rgb: TD3DColor) : DWORD;
1 daniel-mar 22049
begin
4 daniel-mar 22050
  Result := rgb and $ff;
1 daniel-mar 22051
end;
22052
 
4 daniel-mar 22053
// #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
22054
function RGBA_MAKE(r, g, b, a: DWORD) : TD3DColor;
1 daniel-mar 22055
begin
22056
  Result := (a shl 24) or (r shl 16) or (g shl 8) or b;
22057
end;
22058
 
4 daniel-mar 22059
// #define D3DRGB(r, g, b) \
22060
//     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
22061
function D3DRGB(r, g, b: float) : TD3DColor;
1 daniel-mar 22062
begin
4 daniel-mar 22063
  Result := $ff000000 or (round(r * 255) shl 16)
22064
                      or (round(g * 255) shl 8)
22065
                      or round(b * 255);
1 daniel-mar 22066
end;
22067
 
4 daniel-mar 22068
// #define D3DRGBA(r, g, b, a) \
22069
//     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
22070
//     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
22071
//    )
22072
function D3DRGBA(r, g, b, a: float) : TD3DColor;
1 daniel-mar 22073
begin
4 daniel-mar 22074
  Result := (round(a * 255) shl 24) or (round(r * 255) shl 16)
22075
                                    or (round(g * 255) shl 8)
22076
                                    or round(b * 255);
1 daniel-mar 22077
end;
22078
 
4 daniel-mar 22079
// #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
22080
function RGB_GETRED(rgb: TD3DColor) : DWORD;
1 daniel-mar 22081
begin
4 daniel-mar 22082
  Result := (rgb shr 16) and $ff;
1 daniel-mar 22083
end;
22084
 
4 daniel-mar 22085
// #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
22086
function RGB_GETGREEN(rgb: TD3DColor) : DWORD;
1 daniel-mar 22087
begin
4 daniel-mar 22088
  Result := (rgb shr 8) and $ff;
1 daniel-mar 22089
end;
22090
 
4 daniel-mar 22091
// #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
22092
function RGB_GETBLUE(rgb: TD3DColor) : DWORD;
1 daniel-mar 22093
begin
4 daniel-mar 22094
  Result := rgb and $ff;
1 daniel-mar 22095
end;
22096
 
4 daniel-mar 22097
// #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
22098
function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD) : TD3DColor;
1 daniel-mar 22099
begin
4 daniel-mar 22100
  Result := (x shl 24) or (rgba and $00ffffff);
1 daniel-mar 22101
end;
22102
 
4 daniel-mar 22103
// #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
22104
function RGB_MAKE(r, g, b: DWORD) : TD3DColor;
1 daniel-mar 22105
begin
22106
  Result := (r shl 16) or (g shl 8) or b;
22107
end;
22108
 
4 daniel-mar 22109
// #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
22110
function RGBA_TORGB(rgba: TD3DColor) : TD3DColor;
1 daniel-mar 22111
begin
4 daniel-mar 22112
  Result := rgba and $00ffffff;
1 daniel-mar 22113
end;
22114
 
4 daniel-mar 22115
// #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
22116
function RGB_TORGBA(rgb: TD3DColor) : TD3DColor;
1 daniel-mar 22117
begin
4 daniel-mar 22118
  Result := rgb or $ff000000;
1 daniel-mar 22119
end;
22120
 
4 daniel-mar 22121
 
22122
function D3DSTATE_OVERRIDE(StateType: DWORD) : DWORD;
1 daniel-mar 22123
begin
4 daniel-mar 22124
  Result := StateType + D3DSTATE_OVERRIDE_BIAS;
22125
end;
22126
 
22127
function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
22128
begin
22129
  if not (len in [1..29]) then len := 0;
22130
  result := len;
22131
end;
22132
 
22133
// #define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y))
22134
function D3DRENDERSTATE_STIPPLEPATTERN(y: integer) : TD3DRenderStateType;
22135
begin
22136
  Result := TD3DRenderStateType(Ord(D3DRENDERSTATE_STIPPLEPATTERN00) + y);
22137
end;
22138
 
22139
 
22140
 
22141
 
22142
    // Addition and subtraction
22143
function VectorAdd(const v1, v2: TD3DVector) : TD3DVector;
22144
begin
1 daniel-mar 22145
  result.x := v1.x+v2.x;
22146
  result.y := v1.y+v2.y;
22147
  result.z := v1.z+v2.z;
22148
end;
22149
 
4 daniel-mar 22150
function VectorSub(const v1, v2: TD3DVector) : TD3DVector;
1 daniel-mar 22151
begin
22152
  result.x := v1.x-v2.x;
22153
  result.y := v1.y-v2.y;
22154
  result.z := v1.z-v2.z;
22155
end;
22156
 
4 daniel-mar 22157
    // Scalar multiplication and division
22158
function VectorMulS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
1 daniel-mar 22159
begin
22160
  result.x := v.x*s;
22161
  result.y := v.y*s;
22162
  result.z := v.z*s;
22163
end;
22164
 
4 daniel-mar 22165
function VectorDivS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
1 daniel-mar 22166
begin
22167
  result.x := v.x/s;
22168
  result.y := v.y/s;
22169
  result.z := v.z/s;
22170
end;
22171
 
4 daniel-mar 22172
    // Memberwise multiplication and division
22173
function VectorMul(const v1, v2: TD3DVector) : TD3DVector;
1 daniel-mar 22174
begin
22175
  result.x := v1.x*v2.x;
22176
  result.y := v1.y*v2.y;
22177
  result.z := v1.z*v2.z;
22178
end;
22179
 
4 daniel-mar 22180
function VectorDiv(const v1, v2: TD3DVector) : TD3DVector;
1 daniel-mar 22181
begin
22182
  result.x := v1.x/v2.x;
22183
  result.y := v1.y/v2.y;
22184
  result.z := v1.z/v2.z;
22185
end;
22186
 
4 daniel-mar 22187
    // Vector dominance
1 daniel-mar 22188
function VectorSmaller(v1, v2: TD3DVector) : boolean;
22189
begin
22190
  result := (v1.x < v2.x) and (v1.y < v2.y) and (v1.z < v2.z);
22191
end;
22192
 
22193
function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
22194
begin
22195
  result := (v1.x <= v2.x) and (v1.y <= v2.y) and (v1.z <= v2.z);
22196
end;
22197
 
4 daniel-mar 22198
    // Bitwise equality
1 daniel-mar 22199
function VectorEquel(v1, v2: TD3DVector) : boolean;
22200
begin
22201
  result := (v1.x = v2.x) and (v1.y = v2.y) and (v1.z = v2.z);
22202
end;
22203
 
4 daniel-mar 22204
    // Length-related functions
1 daniel-mar 22205
function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
22206
begin
22207
  result := (v.x*v.x) + (v.y*v.y) + (v.z*v.z);
22208
end;
22209
 
22210
function VectorMagnitude(v: TD3DVector) : TD3DValue;
22211
begin
4 daniel-mar 22212
  result := sqrt((v.x*v.x) + (v.y*v.y) + (v.z*v.z));
1 daniel-mar 22213
end;
22214
 
4 daniel-mar 22215
    // Returns vector with same direction and unit length
22216
function VectorNormalize(const v: TD3DVector) : TD3DVector;
1 daniel-mar 22217
begin
22218
  result := VectorDivS(v,VectorMagnitude(v));
22219
end;
22220
 
4 daniel-mar 22221
    // Return min/max component of the input vector
1 daniel-mar 22222
function VectorMin(v: TD3DVector) : TD3DValue;
22223
var
22224
  ret : TD3DValue;
22225
begin
22226
  ret := v.x;
22227
  if (v.y < ret) then ret := v.y;
22228
  if (v.z < ret) then ret := v.z;
22229
  result := ret;
22230
end;
22231
 
22232
function VectorMax(v: TD3DVector) : TD3DValue;
22233
var
22234
  ret : TD3DValue;
22235
begin
22236
  ret := v.x;
22237
  if (ret < v.y) then ret := v.y;
22238
  if (ret < v.z) then ret := v.z;
22239
  result := ret;
22240
end;
22241
 
4 daniel-mar 22242
    // Return memberwise min/max of input vectors
22243
function VectorMinimize(const v1, v2: TD3DVector) : TD3DVector;
1 daniel-mar 22244
begin
22245
  if v1.x < v2.x then result.x := v1.x else result.x := v2.x;
22246
  if v1.y < v2.y then result.y := v1.y else result.y := v2.y;
22247
  if v1.z < v2.z then result.z := v1.z else result.z := v2.z;
22248
end;
22249
 
4 daniel-mar 22250
function VectorMaximize(const v1, v2: TD3DVector) : TD3DVector;
1 daniel-mar 22251
begin
22252
  if v1.x > v2.x then result.x := v1.x else result.x := v2.x;
22253
  if v1.y > v2.y then result.y := v1.y else result.y := v2.y;
22254
  if v1.z > v2.z then result.z := v1.z else result.z := v2.z;
22255
end;
22256
 
4 daniel-mar 22257
    // Dot and cross product
1 daniel-mar 22258
function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
22259
begin
22260
  result := (v1.x*v2.x) + (v1.y * v2.y) + (v1.z*v2.z);
22261
end;
22262
 
4 daniel-mar 22263
function VectorCrossProduct(const v1, v2: TD3DVector) : TD3DVector;
1 daniel-mar 22264
begin
22265
  result.x := (v1.y*v2.z) - (v1.z*v2.y);
22266
  result.y := (v1.z*v2.x) - (v1.x*v2.z);
22267
  result.z := (v1.x*v2.y) - (v1.y*v2.x);
22268
end;
22269
 
4 daniel-mar 22270
procedure DisableFPUExceptions;
22271
var
22272
  FPUControlWord: WORD;
22273
asm
22274
  FSTCW   FPUControlWord;
22275
  OR      FPUControlWord, $4 + $1; { Divide by zero + invalid operation }
22276
  FLDCW   FPUControlWord;
22277
end;
22278
 
22279
procedure EnableFPUExceptions;
22280
var
22281
  FPUControlWord: WORD;
22282
asm
22283
  FSTCW   FPUControlWord;
22284
  AND     FPUControlWord, $FFFF - $4 - $1; { Divide by zero + invalid operation }
22285
  FLDCW   FPUControlWord;
22286
end;
22287
 
22288
function D3DErrorString(Value: HResult) : string; //Full description not available yet
1 daniel-mar 22289
begin
4 daniel-mar 22290
  case Value of
22291
    D3D_OK: Result := 'No error';
22292
 
22293
    D3DERR_BADMAJORVERSION: Result := 'D3DERR_BADMAJORVERSION';
22294
    D3DERR_BADMINORVERSION: Result := 'D3DERR_BADMINORVERSION';
22295
 
22296
    D3DERR_INVALID_DEVICE: Result := 'D3DERR_INITFAILED';
22297
    D3DERR_INITFAILED: Result := 'D3DERR_INITFAILED';
22298
 
22299
    D3DERR_DEVICEAGGREGATED: Result := 'D3DERR_DEVICEAGGREGATED';
22300
 
22301
    D3DERR_EXECUTE_CREATE_FAILED: Result := 'D3DERR_EXECUTE_CREATE_FAILED';
22302
    D3DERR_EXECUTE_DESTROY_FAILED: Result := 'D3DERR_EXECUTE_DESTROY_FAILED';
22303
    D3DERR_EXECUTE_LOCK_FAILED: Result := 'D3DERR_EXECUTE_LOCK_FAILED';
22304
    D3DERR_EXECUTE_UNLOCK_FAILED: Result := 'D3DERR_EXECUTE_UNLOCK_FAILED';
22305
    D3DERR_EXECUTE_LOCKED: Result := 'D3DERR_EXECUTE_LOCKED';
22306
    D3DERR_EXECUTE_NOT_LOCKED: Result := 'D3DERR_EXECUTE_NOT_LOCKED';
22307
 
22308
    D3DERR_EXECUTE_FAILED: Result := 'D3DERR_EXECUTE_FAILED';
22309
    D3DERR_EXECUTE_CLIPPED_FAILED: Result := 'D3DERR_EXECUTE_CLIPPED_FAILED';
22310
 
22311
    D3DERR_TEXTURE_NO_SUPPORT: Result := 'D3DERR_TEXTURE_NO_SUPPORT';
22312
    D3DERR_TEXTURE_CREATE_FAILED: Result := 'D3DERR_TEXTURE_CREATE_FAILED';
22313
    D3DERR_TEXTURE_DESTROY_FAILED: Result := 'D3DERR_TEXTURE_DESTROY_FAILED';
22314
    D3DERR_TEXTURE_LOCK_FAILED: Result := 'D3DERR_TEXTURE_LOCK_FAILED';
22315
    D3DERR_TEXTURE_UNLOCK_FAILED: Result := 'D3DERR_TEXTURE_UNLOCK_FAILED';
22316
    D3DERR_TEXTURE_LOAD_FAILED: Result := 'D3DERR_TEXTURE_LOAD_FAILED';
22317
    D3DERR_TEXTURE_SWAP_FAILED: Result := 'D3DERR_TEXTURE_SWAP_FAILED';
22318
    D3DERR_TEXTURE_LOCKED: Result := 'D3DERR_TEXTURELOCKED';
22319
    D3DERR_TEXTURE_NOT_LOCKED: Result := 'D3DERR_TEXTURE_NOT_LOCKED';
22320
    D3DERR_TEXTURE_GETSURF_FAILED: Result := 'D3DERR_TEXTURE_GETSURF_FAILED';
22321
 
22322
    D3DERR_MATRIX_CREATE_FAILED: Result := 'D3DERR_MATRIX_CREATE_FAILED';
22323
    D3DERR_MATRIX_DESTROY_FAILED: Result := 'D3DERR_MATRIX_DESTROY_FAILED';
22324
    D3DERR_MATRIX_SETDATA_FAILED: Result := 'D3DERR_MATRIX_SETDATA_FAILED';
22325
    D3DERR_MATRIX_GETDATA_FAILED: Result := 'D3DERR_MATRIX_GETDATA_FAILED';
22326
    D3DERR_SETVIEWPORTDATA_FAILED: Result := 'D3DERR_SETVIEWPORTDATA_FAILED';
22327
 
22328
    D3DERR_INVALIDCURRENTVIEWPORT: Result := 'D3DERR_INVALIDCURRENTVIEWPORT';
22329
    D3DERR_INVALIDPRIMITIVETYPE: Result := 'D3DERR_INVALIDPRIMITIVETYPE';
22330
    D3DERR_INVALIDVERTEXTYPE: Result := 'D3DERR_INVALIDVERTEXTYPE';
22331
    D3DERR_TEXTURE_BADSIZE: Result := 'D3DERR_TEXTURE_BADSIZE';
22332
    D3DERR_INVALIDRAMPTEXTURE: Result := 'D3DERR_INVALIDRAMPTEXTURE';
22333
 
22334
    D3DERR_MATERIAL_CREATE_FAILED: Result := 'D3DERR_MATERIAL_CREATE_FAILED';
22335
    D3DERR_MATERIAL_DESTROY_FAILED: Result := 'D3DERR_MATERIAL_DESTROY_FAILED';
22336
    D3DERR_MATERIAL_SETDATA_FAILED: Result := 'D3DERR_MATERIAL_SETDATA_FAILED';
22337
    D3DERR_MATERIAL_GETDATA_FAILED: Result := 'D3DERR_MATERIAL_GETDATA_FAILED';
22338
 
22339
    D3DERR_INVALIDPALETTE: Result := 'D3DERR_INVALIDPALETTE';
22340
 
22341
    D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY: Result := 'D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY';
22342
    D3DERR_ZBUFF_NEEDS_VIDEOMEMORY: Result := 'D3DERR_ZBUFF_NEEDS_VIDEOMEMORY';
22343
    D3DERR_SURFACENOTINVIDMEM: Result := 'D3DERR_SURFACENOTINVIDMEM';
22344
 
22345
    D3DERR_LIGHT_SET_FAILED: Result := 'D3DERR_LIGHT_SET_FAILED';
22346
    D3DERR_LIGHTHASVIEWPORT: Result := 'D3DERR_LIGHTHASVIEWPORT';
22347
    D3DERR_LIGHTNOTINTHISVIEWPORT: Result := 'D3DERR_LIGHTNOTINTHISVIEWPORT';
22348
 
22349
    D3DERR_SCENE_IN_SCENE: Result := 'D3DERR_SCENE_IN_SCENE';
22350
    D3DERR_SCENE_NOT_IN_SCENE: Result := 'D3DERR_SCENE_NOT_IN_SCENE';
22351
    D3DERR_SCENE_BEGIN_FAILED: Result := 'D3DERR_SCENE_BEGIN_FAILED';
22352
    D3DERR_SCENE_END_FAILED: Result := 'D3DERR_SCENE_END_FAILED';
22353
 
22354
    D3DERR_INBEGIN: Result := 'D3DERR_INBEGIN';
22355
    D3DERR_NOTINBEGIN: Result := 'D3DERR_NOTINBEGIN';
22356
    D3DERR_NOVIEWPORTS: Result := 'D3DERR_NOVIEWPORTS';
22357
    D3DERR_VIEWPORTDATANOTSET: Result := 'D3DERR_VIEWPORTDATANOTSET';
22358
    D3DERR_VIEWPORTHASNODEVICE: Result := 'D3DERR_VIEWPORTHASNODEVICE';
22359
    D3DERR_NOCURRENTVIEWPORT: Result := 'D3DERR_NOCURRENTVIEWPORT';
22360
 
22361
    D3DERR_INVALIDVERTEXFORMAT: Result := 'D3DERR_INVALIDVERTEXFORMAT';
22362
 
22363
    D3DERR_COLORKEYATTACHED: Result := 'D3DERR_COLORKEYATTACHED';
22364
 
22365
    D3DERR_VERTEXBUFFEROPTIMIZED: Result := 'D3DERR_VERTEXBUFFEROPTIMIZED';
22366
    D3DERR_VBUF_CREATE_FAILED: Result := 'D3DERR_VBUF_CREATE_FAILED';
22367
    D3DERR_VERTEXBUFFERLOCKED: Result := 'D3DERR_VERTEXBUFFERLOCKED';
22368
 
22369
    D3DERR_ZBUFFER_NOTPRESENT: Result := 'D3DERR_ZBUFFER_NOTPRESENT';
22370
    D3DERR_STENCILBUFFER_NOTPRESENT: Result := 'D3DERR_STENCILBUFFER_NOTPRESENT';
22371
 
22372
    D3DERR_WRONGTEXTUREFORMAT: Result := 'D3DERR_WRONGTEXTUREFORMAT';
22373
    D3DERR_UNSUPPORTEDCOLOROPERATION: Result := 'D3DERR_UNSUPPORTEDCOLOROPERATION';
22374
    D3DERR_UNSUPPORTEDCOLORARG: Result := 'D3DERR_UNSUPPORTEDCOLORARG';
22375
    D3DERR_UNSUPPORTEDALPHAOPERATION: Result := 'D3DERR_UNSUPPORTEDALPHAOPERATION';
22376
    D3DERR_UNSUPPORTEDALPHAARG: Result := 'D3DERR_UNSUPPORTEDALPHAARG';
22377
    D3DERR_TOOMANYOPERATIONS: Result := 'D3DERR_TOOMANYOPERATIONS';
22378
    D3DERR_CONFLICTINGTEXTUREFILTER: Result := 'D3DERR_CONFLICTINGTEXTUREFILTER';
22379
    D3DERR_UNSUPPORTEDFACTORVALUE: Result := 'D3DERR_UNSUPPORTEDFACTORVALUE';
22380
 
22381
    D3DERR_CONFLICTINGRENDERSTATE: Result := 'D3DERR_CONFLICTINGRENDERSTATE';
22382
    D3DERR_UNSUPPORTEDTEXTUREFILTER: Result := 'D3DERR_UNSUPPORTEDTEXTUREFILTER';
22383
    D3DERR_TOOMANYPRIMITIVES: Result := 'D3DERR_TOOMANYPRIMITIVES';
22384
    D3DERR_INVALIDMATRIX: Result := 'D3DERR_INVALIDMATRIX';
22385
    D3DERR_TOOMANYVERTICES: Result := 'D3DERR_TOOMANYVERTICES';
22386
    D3DERR_CONFLICTINGTEXTUREPALETTE: Result := 'D3DERR_CONFLICTINGTEXTUREPALETTE';
22387
 
22388
    else Result := 'Unrecognized Error';
22389
  end;
1 daniel-mar 22390
end;
4 daniel-mar 22391
{$IFDEF D3DRM}
22392
//Direct3DRM file
1 daniel-mar 22393
 
4 daniel-mar 22394
(*==========================================================================;
22395
 *
22396
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
22397
 *
22398
 *  File:       d3drmdef.h
22399
 *  Content:    Direct3DRM include file
22400
 *
22401
 ***************************************************************************)
22402
 
22403
procedure D3DRMAnimationGetRotateKey
22404
    (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
1 daniel-mar 22405
begin
4 daniel-mar 22406
  rmQuat := rmKey.dqRotateKey;
1 daniel-mar 22407
end;
22408
 
4 daniel-mar 22409
procedure D3DRMAnimationGetScaleKey
22410
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 22411
begin
4 daniel-mar 22412
  dvVec := rmKey.dvScaleKey;
1 daniel-mar 22413
end;
22414
 
4 daniel-mar 22415
procedure D3DRMAnimationGetPositionKey
22416
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 22417
begin
4 daniel-mar 22418
  dvVec := rmKey.dvPositionKey;
1 daniel-mar 22419
end;
22420
 
4 daniel-mar 22421
procedure D3DRMAnimatioSetRotateKey
22422
    (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
1 daniel-mar 22423
begin
4 daniel-mar 22424
  rmKey.dqRotateKey := rmQuat;
1 daniel-mar 22425
end;
22426
 
4 daniel-mar 22427
procedure D3DRMAnimationSetScaleKey
22428
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 22429
begin
4 daniel-mar 22430
  rmKey.dvScaleKey := dvVec;
1 daniel-mar 22431
end;
22432
 
4 daniel-mar 22433
procedure D3DRMAnimationSetPositionKey
22434
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 22435
begin
4 daniel-mar 22436
  rmKey.dvPositionKey := dvVec;
1 daniel-mar 22437
end;
22438
 
4 daniel-mar 22439
(*==========================================================================;
22440
 *
22441
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
22442
 *
22443
 *  File:       d3drm.h
22444
 *  Content:    Direct3DRM include file
22445
 *
22446
 ***************************************************************************)
1 daniel-mar 22447
 
4 daniel-mar 22448
function D3DRMErrorString(Value: HResult) : string;
1 daniel-mar 22449
begin
4 daniel-mar 22450
  case Value of
22451
    D3DRM_OK: Result := 'No error. Equivalent to DD_OK.';
22452
    D3DRMERR_BADALLOC: Result := 'Out of memory.';
22453
    D3DRMERR_BADDEVICE: Result := 'Device is not compatible with renderer.';
22454
    D3DRMERR_BADFILE: Result := 'Data file is corrupt.';
22455
    D3DRMERR_BADMAJORVERSION: Result := 'Bad DLL major version.';
22456
    D3DRMERR_BADMINORVERSION: Result := 'Bad DLL minor version.';
22457
    D3DRMERR_BADOBJECT: Result := 'Object expected in argument.';
22458
    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.';
22459
    D3DRMERR_BADTYPE: Result := 'Bad argument type passed.';
22460
    D3DRMERR_BADVALUE: Result := 'Bad argument value passed.';
22461
    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.';
22462
    D3DRMERR_CLIENTNOTREGISTERED: Result := 'Client has not been registered. Call IDirect3DRM3::RegisterClient.';
22463
    D3DRMERR_CONNECTIONLOST: Result := 'Data connection was lost during a load, clone, or duplicate.';
22464
    D3DRMERR_ELEMENTINUSE: Result := 'Element can´t be modified or deleted while in use. To empty a submesh, call Empty() against its parent.';
22465
//    D3DRMERR_ENTRYINUSE: Result := 'Vertex or normal entries are currently in use by a face and cannot be deleted.';
22466
    D3DRMERR_FACEUSED: Result := 'Face already used in a mesh.';
22467
    D3DRMERR_FILENOTFOUND: Result := 'File cannot be opened.';
22468
//    D3DRMERR_INCOMPATIBLEKEY: Result := 'Specified animation key is incompatible. The key cannot be modified.';
22469
    D3DRMERR_INVALIDLIBRARY: Result := 'Specified libary is invalid.';
22470
//    D3DRMERR_INVALIDOBJECT: Result := 'Method received a pointer to an object that is invalid.';
22471
//    D3DRMERR_INVALIDPARAMS: Result := 'One of the parameters passed to the method is invalid.';
22472
    D3DRMERR_LIBRARYNOTFOUND: Result := 'Specified libary not found.';
22473
    D3DRMERR_LOADABORTED: Result := 'Load aborted by user.';
22474
    D3DRMERR_NOSUCHKEY: Result := 'Specified animation key does not exist.';
22475
    D3DRMERR_NOTCREATEDFROMDDS: Result := 'Specified texture was not created from a DirectDraw Surface.';
22476
    D3DRMERR_NOTDONEYET: Result := 'Unimplemented.';
22477
    D3DRMERR_NOTENOUGHDATA: Result := 'Not enough data has been loaded to perform the requested operation.';
22478
    D3DRMERR_NOTFOUND: Result := 'Object not found in specified place.';
22479
//    D3DRMERR_OUTOFRANGE: Result := 'Specified value is out of range.';
22480
    D3DRMERR_PENDING: Result := 'Data required to supply the requested information has not finished loading.';
22481
    D3DRMERR_REQUESTTOOLARGE: Result := 'Attempt was made to set a level of detail in a progressive mesh greater than the maximum available.';
22482
    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).';
22483
    D3DRMERR_TEXTUREFORMATNOTFOUND: Result := 'Texture format could not be found that meets the specified criteria and that the underlying Immediate Mode device supports.';
22484
    D3DRMERR_UNABLETOEXECUTE: Result := 'Unable to carry out procedure.';
22485
    DDERR_INVALIDOBJECT: Result := 'Received pointer that was an invalid object.';
22486
    DDERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the method are incorrect.';
22487
    DDERR_NOTFOUND: Result := 'The requested item was not found.';
22488
    DDERR_NOTINITIALIZED: Result := 'An attempt was made to call an interface method of an object created by CoCreateInstance before the object was initialized.';
22489
    DDERR_OUTOFMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.';
22490
    else Result := 'Unrecognized Error';
22491
  end;
1 daniel-mar 22492
end;
4 daniel-mar 22493
{$ENDIF}
22494
//DirectInput file
1 daniel-mar 22495
 
4 daniel-mar 22496
 
22497
function DIMAKEUSAGEDWORD(UsagePage, Usage: WORD) : DWORD;
1 daniel-mar 22498
begin
4 daniel-mar 22499
  Result := Usage or (UsagePage shl 16);
1 daniel-mar 22500
end;
22501
 
4 daniel-mar 22502
 
22503
function DIEFT_GETTYPE(n: variant) : byte;
1 daniel-mar 22504
begin
4 daniel-mar 22505
  Result := byte(n);
1 daniel-mar 22506
end;
22507
 
4 daniel-mar 22508
function GET_DIDEVICE_TYPE(dwDevType: variant) : byte;
1 daniel-mar 22509
begin
4 daniel-mar 22510
  Result := byte(dwDevType);
1 daniel-mar 22511
end;
22512
 
4 daniel-mar 22513
function GET_DIDEVICE_SUBTYPE(dwDevType: variant) : byte;
1 daniel-mar 22514
begin
4 daniel-mar 22515
  Result := hi(word(dwDevType));
1 daniel-mar 22516
end;
22517
 
4 daniel-mar 22518
function DIDFT_MAKEINSTANCE(n: variant) : DWORD;
1 daniel-mar 22519
begin
4 daniel-mar 22520
  Result := word(n) shl 8;
1 daniel-mar 22521
end;
22522
 
4 daniel-mar 22523
function DIDFT_GETTYPE(n: variant) : byte;
22524
begin
22525
  Result := byte(n);
22526
end;
1 daniel-mar 22527
 
4 daniel-mar 22528
function DIDFT_GETINSTANCE(n: variant) : DWORD;
22529
begin
22530
  Result := word(n) shr 8;
22531
end;
1 daniel-mar 22532
 
4 daniel-mar 22533
function DIDFT_ENUMCOLLECTION(n: variant) : DWORD;
1 daniel-mar 22534
begin
4 daniel-mar 22535
  Result := word(n) shl 8;
1 daniel-mar 22536
end;
22537
 
4 daniel-mar 22538
function DIJOFS_SLIDER(n: variant) : variant;
1 daniel-mar 22539
begin
4 daniel-mar 22540
  Result := n * 4 + 24;
1 daniel-mar 22541
end;
22542
 
4 daniel-mar 22543
function DIJOFS_POV(n: variant) : variant;
1 daniel-mar 22544
begin
4 daniel-mar 22545
  Result := n * 4 + 32;
1 daniel-mar 22546
end;
22547
 
4 daniel-mar 22548
function DIJOFS_BUTTON(n: variant) : variant;
1 daniel-mar 22549
begin
4 daniel-mar 22550
  Result := 48 + n;
1 daniel-mar 22551
end;
22552
 
4 daniel-mar 22553
function DIErrorString(Value: HResult) : string;
22554
var
22555
  sValue: array[0..255] of char;
1 daniel-mar 22556
begin
4 daniel-mar 22557
  case Value of
22558
    DI_OK: Result := 'The operation completed successfully.';
22559
    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."';
22560
//    DI_BUFFEROVERFLOW: Result := 'The device buffer overflowed and some input was lost. This value is equal to the S_FALSE standard COM return value.';
22561
    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.';
22562
    DI_EFFECTRESTARTED: Result := 'The effect was stopped, the parameters were updated, and the effect was restarted.';
22563
//    DI_NOEFFECT: Result := 'The operation had no effect. This value is equal to the S_FALSE standard COM return value.';
22564
//    DI_NOTATTACHED: Result := 'The device exists but is not currently attached. This value is equal to the S_FALSE standard COM return value.';
22565
    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.';
22566
//    DI_PROPNOEFFECT: Result := 'The change in device properties had no effect. This value is equal to the S_FALSE standard COM return value.';
22567
    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.';
22568
    DI_TRUNCATEDANDRESTARTED: Result := 'Equal to DI_EFFECTRESTARTED | DI_TRUNCATED.';
22569
    DIERR_ACQUIRED: Result := 'The operation cannot be performed while the device is acquired.';
22570
    DIERR_ALREADYINITIALIZED: Result := 'This object is already initialized';
22571
    DIERR_BADDRIVERVER: Result := 'The object could not be created due to an incompatible driver version or mismatched or incomplete driver components.';
22572
    DIERR_BETADIRECTINPUTVERSION: Result := 'The application was written for an unsupported prerelease version of DirectInput.';
22573
    DIERR_DEVICEFULL: Result := 'The device is full.';
22574
    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.';
22575
    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.';
22576
    DIERR_HASEFFECTS: Result := 'The device cannot be reinitialized because there are still effects attached to it.';
22577
    DIERR_GENERIC: Result := 'An undetermined error occurred inside the DirectInput subsystem. This value is equal to the E_FAIL standard COM return value.';
22578
//    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.';
22579
    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.';
22580
    DIERR_INPUTLOST: Result := 'Access to the input device has been lost. It must be reacquired.';
22581
    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.';
22582
    DIERR_MOREDATA: Result := 'Not all the requested information fitted into the buffer.';
22583
    DIERR_NOAGGREGATION: Result := 'This object does not support aggregation.';
22584
    DIERR_NOINTERFACE: Result := 'The specified interface is not supported by the object. This value is equal to the E_NOINTERFACE standard COM return value.';
22585
    DIERR_NOTACQUIRED: Result := 'The operation cannot be performed unless the device is acquired.';
22586
    DIERR_NOTBUFFERED: Result := 'The device is not buffered. Set the DIPROP_BUFFERSIZE property to enable buffering.';
22587
    DIERR_NOTDOWNLOADED: Result := 'The effect is not downloaded.';
22588
    DIERR_NOTEXCLUSIVEACQUIRED: Result := 'The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode.';
22589
    DIERR_NOTFOUND: Result := 'The requested object does not exist.';
22590
    DIERR_NOTINITIALIZED: Result := 'This object has not been initialized.';
22591
//    DIERR_OBJECTNOTFOUND: Result := 'The requested object does not exist.';
22592
    DIERR_OLDDIRECTINPUTVERSION: Result := 'The application requires a newer version of DirectInput.';
22593
    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. "';
22594
    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.';
22595
//    DIERR_READONLY: Result := 'The specified property cannot be changed. This value is equal to the E_ACCESSDENIED standard COM return value.';
22596
    DIERR_UNSUPPORTED: Result := 'The function called is not supported at this time. This value is equal to the E_NOTIMPL standard COM return value.';
22597
    E_PENDING: Result := 'Data is not yet available.';
22598
    HResult($800405CC): Result := 'No more memory for effects of this kind (not documented)';
22599
      else Result := 'Unrecognized Error: $' + sValue;
22600
  end;
1 daniel-mar 22601
end;
22602
 
4 daniel-mar 22603
function joyConfigChanged(dwFlags: DWORD) : MMRESULT; external 'WinMM.dll';
22604
 
22605
procedure Init_c_dfDIKeyboard_Objects;  // XRef: Initialization
22606
var x: Cardinal;
1 daniel-mar 22607
begin
4 daniel-mar 22608
  for x := 0 to 255 do
22609
  with _c_dfDIKeyboard_Objects[x] do
22610
  begin
22611
    pGuid := @GUID_Key; dwOfs := x; dwFlags := 0;
22612
    dwType := $80000000 or DIDFT_BUTTON or x shl 8;
22613
  end;
1 daniel-mar 22614
end;
22615
 
4 daniel-mar 22616
procedure Init_c_dfDIJoystick2_Objects;  // XRef: Initialization
22617
var x,y, OfVal: Cardinal;
1 daniel-mar 22618
begin
4 daniel-mar 22619
  Move(_c_dfDIJoystick_Objects,_c_dfDIJoystick2_Objects,SizeOf(_c_dfDIJoystick_Objects));
22620
  // all those empty "buttons"
22621
  for x := $2C to $8B do
22622
    Move(_c_dfDIJoystick_Objects[$2B],_c_dfDIJoystick2_Objects[x],SizeOf(TDIObjectDataFormat));
22623
  for x := 0 to 2 do
22624
  begin  // 3 more blocks of X axis..Sliders
22625
    Move(_c_dfDIJoystick_Objects,_c_dfDIJoystick2_Objects[$8C+8*x],8*SizeOf(TDIObjectDataFormat));
22626
    for y := 0 to 7 do _c_dfDIJoystick2_Objects[$8C+8*x+y].dwFlags := (x+1) shl 8;
22627
  end;
22628
  OfVal := _c_dfDIJoystick2_Objects[$2B].dwOfs+1;
22629
  for x := $2C to $A3 do
22630
  begin
22631
    _c_dfDIJoystick2_Objects[x].dwOfs := OfVal;
22632
    if x < $8C then Inc(OfVal) else Inc(OfVal,4);
22633
  end;
1 daniel-mar 22634
end;
22635
 
4 daniel-mar 22636
//DirectPlay file
22637
 
22638
(*==========================================================================;
22639
 *
22640
 *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
22641
 *
22642
 *  File:       dplay.h
22643
 *  Content:    DirectPlay include file
22644
 *
22645
 ***************************************************************************)
22646
 
10 daniel-mar 22647
{$IFDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
4 daniel-mar 22648
function DPErrorString(Value: HResult) : string;
1 daniel-mar 22649
begin
4 daniel-mar 22650
  case Value of
22651
    CLASS_E_NOAGGREGATION: Result := 'A non-NULL value was passed for the pUnkOuter parameter in DirectPlayCreate, DirectPlayLobbyCreate, or IDirectPlayLobby2::Connect.';
22652
    DPERR_ACCESSDENIED: Result := 'The session is full or an incorrect password was supplied.';
22653
    DPERR_ACTIVEPLAYERS: Result := 'The requested operation cannot be performed because there are existing active players.';
22654
    DPERR_ALREADYINITIALIZED: Result := 'This object is already initialized.';
22655
    DPERR_APPNOTSTARTED: Result := 'The application has not been started yet.';
22656
    DPERR_AUTHENTICATIONFAILED: Result := 'The password or credentials supplied could not be authenticated.';
22657
    DPERR_BUFFERTOOLARGE: Result := 'The data buffer is too large to store.';
22658
    DPERR_BUSY: Result := 'A message cannot be sent because the transmission medium is busy.';
22659
    DPERR_BUFFERTOOSMALL: Result := 'The supplied buffer is not large enough to contain the requested data.';
22660
    DPERR_CANTADDPLAYER: Result := 'The player cannot be added to the session.';
22661
    DPERR_CANTCREATEGROUP: Result := 'A new group cannot be created.';
22662
    DPERR_CANTCREATEPLAYER: Result := 'A new player cannot be created.';
22663
    DPERR_CANTCREATEPROCESS: Result := 'Cannot start the application.';
22664
    DPERR_CANTCREATESESSION: Result := 'A new session cannot be created.';
22665
    DPERR_CANTLOADCAPI: Result := 'No credentials were supplied and the CryptoAPI package (CAPI) to use for cryptography services cannot be loaded.';
22666
    DPERR_CANTLOADSECURITYPACKAGE: Result := 'The software security package cannot be loaded.';
22667
    DPERR_CANTLOADSSPI: Result := 'No credentials were supplied and the software security package (SSPI) that will prompt for credentials cannot be loaded.';
22668
    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.';
22669
    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.';
22670
    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.';
22671
    DPERR_EXCEPTION: Result := 'An exception occurred when processing the request.';
22672
    DPERR_GENERIC: Result := 'An undefined error condition occurred.';
22673
//    DPERR_INVALIDCREDENTIALS: Result := 'The credentials supplied (as to IDirectPlay3::SecureOpen) were not valid.';
22674
    DPERR_INVALIDFLAGS: Result := 'The flags passed to this method are invalid.';
22675
    DPERR_INVALIDGROUP: Result := 'The group ID is not recognized as a valid group ID for this game session.';
22676
    DPERR_INVALIDINTERFACE: Result := 'The interface parameter is invalid.';
22677
    DPERR_INVALIDOBJECT: Result := 'The DirectPlay object pointer is invalid.';
22678
    DPERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the method are invalid.';
22679
    DPERR_INVALIDPASSWORD: Result := 'An invalid password was supplied when attempting to join a session that requires a password.';
22680
    DPERR_INVALIDPLAYER: Result := 'The player ID is not recognized as a valid player ID for this game session.';
22681
    DPERR_LOGONDENIED: Result := 'The session could not be opened because credentials are required and either no credentials were supplied or the credentials were invalid.';
22682
    DPERR_NOCAPS: Result := 'The communication link that DirectPlay is attempting to use is not capable of this function.';
22683
    DPERR_NOCONNECTION: Result := 'No communication link was established.';
22684
    DPERR_NOINTERFACE: Result := 'The interface is not supported.';
22685
    DPERR_NOMESSAGES: Result := 'There are no messages in the receive queue.';
22686
    DPERR_NONAMESERVERFOUND: Result := 'No name server (host) could be found or created. A host must exist to create a player.';
22687
    DPERR_NONEWPLAYERS: Result := 'The session is not accepting any new players.';
22688
    DPERR_NOPLAYERS: Result := 'There are no active players in the session.';
22689
    DPERR_NOSESSIONS: Result := 'There are no existing sessions for this game.';
22690
    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.';
22691
    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.';
22692
    DPERR_OUTOFMEMORY: Result := 'There is insufficient memory to perform the requested operation.';
22693
    DPERR_PLAYERLOST: Result := 'A player has lost the connection to the session.';
22694
    DPERR_SENDTOOBIG: Result := 'The message being sent by the IDirectPlay3::Send method is too large.';
22695
    DPERR_SESSIONLOST: Result := 'The connection to the session has been lost.';
22696
    DPERR_SIGNFAILED: Result := 'The requested information could not be digitally signed. Digital signatures are used to establish the authenticity of messages.';
22697
    DPERR_TIMEOUT: Result := 'The operation could not be completed in the specified time.';
22698
    DPERR_UNAVAILABLE: Result := 'The requested function is not available at this time.';
22699
    DPERR_UNINITIALIZED: Result := 'The requested object has not been initialized.';
22700
    DPERR_UNKNOWNAPPLICATION: Result := 'An unknown application was specified.';
22701
    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.';
22702
    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.';
22703
    else Result := 'Unrecognized Error';
22704
  end;
1 daniel-mar 22705
end;
10 daniel-mar 22706
{$ENDIF} // UseDirectPlay
1 daniel-mar 22707
 
4 daniel-mar 22708
//DirectSetup file
1 daniel-mar 22709
 
4 daniel-mar 22710
(*==========================================================================
22711
 *
22712
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
22713
 *
22714
 *  File:       dsetup.h
22715
 *  Content:    DirectXSetup, error codes and flags
22716
 ***************************************************************************)
1 daniel-mar 22717
 
4 daniel-mar 22718
procedure LoadDSetup;
1 daniel-mar 22719
 
4 daniel-mar 22720
  function RegGetStringValue(Hive: HKEY; const KeyName, ValueName: string): string;
22721
  var EnvKey  : HKEY;
22722
      Buf     : array[0..255] of char;
22723
      BufSize : DWord;
22724
      RegType : DWord;
22725
      rc      : DWord;
22726
  begin
22727
    Result := '';
22728
    BufSize := Sizeof(Buf);
22729
    ZeroMemory(@Buf, BufSize);
22730
    RegType := REG_SZ;
22731
    try
22732
      if (RegOpenKeyEx(Hive, PChar(KeyName), 0, KEY_READ, EnvKey) = ERROR_SUCCESS) then
22733
      begin
22734
        try
22735
          if (ValueName = '') then rc := RegQueryValueEx(EnvKey, nil, nil, @RegType, @Buf, @BufSize)
22736
            else rc := RegQueryValueEx(EnvKey, PChar(ValueName), nil, @RegType, @Buf, @BufSize);
22737
          if rc = ERROR_SUCCESS then Result := string(Buf);
22738
        finally
22739
          RegCloseKey(EnvKey);
22740
        end;
22741
      end;
22742
    finally
22743
      RegCloseKey(Hive);
22744
    end;
22745
  end;
1 daniel-mar 22746
 
22747
 
4 daniel-mar 22748
  function ExistFile(const FileName: string): Boolean;
22749
  var hFile: THandle;
22750
  begin
22751
    hFile := CreateFile(PChar(FileName), 0, 0, nil, OPEN_EXISTING, 0, 0);
22752
    Result := hFile <> INVALID_HANDLE_VALUE;
22753
    if hFile = INVALID_HANDLE_VALUE then CloseHandle(hFile);
22754
  end;
1 daniel-mar 22755
 
4 daniel-mar 22756
  function GetDSetupDLLPath : string;
22757
  begin
22758
     Result := RegGetStringValue(HKEY_LOCAL_MACHINE,
22759
                                 'Software\Microsoft\Windows\CurrentVersion\Uninstall\DirectXDrivers',
22760
                                 'UninstallString');
22761
     if Result <> '' then
22762
       Result := Copy(Result,1,Length(Result)-Length('dxsetup.exe')) + 'DSetup.dll';
22763
  end;
1 daniel-mar 22764
 
4 daniel-mar 22765
begin
22766
  DSetupDLL := LoadLibrary(PChar(GetDSetupDLLPath));
1 daniel-mar 22767
 
4 daniel-mar 22768
  DirectXSetupA := GetProcAddress(DSetupDLL,'DirectXSetupA');
22769
  DirectXSetupW := GetProcAddress(DSetupDLL,'DirectXSetupW');
22770
{$IFDEF UNICODE}
22771
  DirectXSetup := DirectXSetupW;
22772
{$ELSE}
22773
  DirectXSetup := DirectXSetupA;
22774
{$ENDIF}
1 daniel-mar 22775
 
4 daniel-mar 22776
  DirectXDeviceDriverSetupA :=
22777
      GetProcAddress(DSetupDLL,'DirectXDeviceDriverSetupA');
22778
  DirectXDeviceDriverSetupW :=
22779
      GetProcAddress(DSetupDLL,'DirectXDeviceDriverSetupW');
22780
{$IFDEF UNICODE}
22781
  DirectXDeviceDriverSetup := DirectXDeviceDriverSetupW;
22782
{$ELSE}
22783
  DirectXDeviceDriverSetup := DirectXDeviceDriverSetupA;
22784
{$ENDIF}
1 daniel-mar 22785
 
4 daniel-mar 22786
  DirectXRegisterApplicationA :=
22787
       GetProcAddress(DSetupDLL,'DirectXRegisterApplicationA');
22788
  DirectXRegisterApplicationW :=
22789
       GetProcAddress(DSetupDLL,'DirectXRegisterApplicationW');
22790
{$IFDEF UNICODE}
22791
  DirectXRegisterApplication := DirectXRegisterApplicationW;
22792
{$ELSE}
22793
  DirectXRegisterApplication := DirectXRegisterApplicationA;
22794
{$ENDIF}
1 daniel-mar 22795
 
4 daniel-mar 22796
  DirectXUnRegisterApplication :=
22797
      GetProcAddress(DSetupDLL,'DirectXUnRegisterApplication');
1 daniel-mar 22798
 
4 daniel-mar 22799
  DirectXSetupSetCallback :=
22800
      GetProcAddress(DSetupDLL,'DirectXSetupSetCallback');
1 daniel-mar 22801
 
4 daniel-mar 22802
  DirectXSetupGetVersion := GetProcAddress(DSetupDLL,'DirectXSetupGetVersion');
22803
 
22804
end;
22805
 
22806
//DirectSound file
22807
 
22808
function MAKE_DSHRESULT(code: DWORD) : HResult;
1 daniel-mar 22809
begin
4 daniel-mar 22810
  Result := HResult(1 shl 31) or HResult(_FACDS shl 16)
22811
      or HResult(code);
1 daniel-mar 22812
end;
22813
 
4 daniel-mar 22814
function DSSPEAKER_COMBINED(c, g: variant) : DWORD;
1 daniel-mar 22815
begin
4 daniel-mar 22816
  Result := byte(c) or (byte(g) shl 16)
1 daniel-mar 22817
end;
22818
 
4 daniel-mar 22819
function DSSPEAKER_CONFIG(a: variant) : byte;
1 daniel-mar 22820
begin
4 daniel-mar 22821
  Result := byte(a);
1 daniel-mar 22822
end;
22823
 
4 daniel-mar 22824
function DSSPEAKER_GEOMETRY(a: variant) : byte;
22825
begin
22826
  Result := byte(a shr 16 and $FF);
22827
end;
1 daniel-mar 22828
 
22829
 
4 daniel-mar 22830
function DSErrorString(Value: HResult) : string;
1 daniel-mar 22831
begin
4 daniel-mar 22832
  case Value of
22833
    DS_OK: Result := 'The request completed successfully.';
22834
    DSERR_ALLOCATED: Result := 'The request failed because resources, such as a priority level, were already in use by another caller.';
22835
    DSERR_ALREADYINITIALIZED: Result := 'The object is already initialized.';
22836
    DSERR_BADFORMAT: Result := 'The specified wave format is not supported.';
22837
    DSERR_BUFFERLOST: Result := 'The buffer memory has been lost and must be restored.';
22838
    DSERR_CONTROLUNAVAIL: Result := 'The control (volume, pan, and so forth) requested by the caller is not available.';
22839
    DSERR_GENERIC: Result := 'An undetermined error occurred inside the DirectSound subsystem.';
22840
    DSERR_INVALIDCALL: Result := 'This function is not valid for the current state of this object.';
22841
    DSERR_INVALIDPARAM: Result := 'An invalid parameter was passed to the returning function.';
22842
    DSERR_NOAGGREGATION: Result := 'The object does not support aggregation.';
22843
    DSERR_NODRIVER: Result := 'No sound driver is available for use.';
22844
    DSERR_NOINTERFACE: Result := 'The requested COM interface is not available.';
22845
    DSERR_OTHERAPPHASPRIO: Result := 'Another application has a higher priority level, preventing this call from succeeding.';
22846
    DSERR_OUTOFMEMORY: Result := 'The DirectSound subsystem could not allocate sufficient memory to complete the caller´s request.';
22847
    DSERR_PRIOLEVELNEEDED: Result := 'The caller does not have the priority level required for the function to succeed.';
22848
    DSERR_UNINITIALIZED: Result := 'The IDirectSound::Initialize method has not been called or has not been called successfully before other methods were called.';
22849
    DSERR_UNSUPPORTED: Result := 'The function called is not supported at this time.';
22850
    else Result := 'Unrecognized Error';
22851
  end;
1 daniel-mar 22852
end;
22853
 
4 daniel-mar 22854
//DirectMusic file
22855
 
22856
function MAKE_HRESULT(sev,fac,code: DWORD) : HResult;
1 daniel-mar 22857
begin
4 daniel-mar 22858
  Result := (sev shl 31) or (fac shl 16) or code;
1 daniel-mar 22859
end;
22860
 
4 daniel-mar 22861
//function MAKEFOURCC (ch0, ch1, ch2, ch3: Char) : TFourCC;
22862
//type
22863
//  tfcc = array [0..3] of Char;
22864
//begin
22865
//  tfcc(Result)[0] := ch0;
22866
//  tfcc(Result)[1] := ch1;
22867
//  tfcc(Result)[2] := ch2;
22868
//  tfcc(Result)[3] := ch3;
22869
//end;
22870
 
22871
function QWORD_ALIGN(x: DWORD) : DWORD;
1 daniel-mar 22872
begin
4 daniel-mar 22873
  Result := (x + 7) and (not 7); //  (((x) + 7) & ~7)
1 daniel-mar 22874
end;
22875
 
4 daniel-mar 22876
function DMUS_EVENT_SIZE(cb: DWORD) : DWORD;
1 daniel-mar 22877
begin
4 daniel-mar 22878
  Result := QWORD_ALIGN(SizeOf(TDMus_EventHeader) + cb); // QWORD_ALIGN(sizeof(DMUS_EVENTHEADER) + cb)
1 daniel-mar 22879
end;
22880
 
4 daniel-mar 22881
function IsNTandDelphiRunning : boolean;
22882
var
22883
  OSVersion  : TOSVersionInfo;
22884
  AppName    : array[0..255] of char;
1 daniel-mar 22885
begin
4 daniel-mar 22886
  OSVersion.dwOsVersionInfoSize := sizeof(OSVersion);
22887
  GetVersionEx(OSVersion);
22888
  // Not running in NT or program is not Delphi itself ?
22889
  AppName[0] := #0;
22890
  lstrcat(AppName, PChar(ParamStr(0)));  // ParamStr(0) = Application.ExeName
22891
  {$IFDEF VER12UP}
22892
  CharUpperBuff(AppName, High(AppName) + 1);
22893
  {$ELSE}
22894
  CharUpperBuff(AppName, SizeOf(AppName));
22895
  {$ENDIF}
22896
  result := ( (OSVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) and
22897
              (Pos('DELPHI32.EXE', AppName) = Length(AppName) - Length('DELPHI32.EXE') + 1) );
1 daniel-mar 22898
end;
22899
 
4 daniel-mar 22900
initialization
22901
begin
22902
  {DirectDraw}
1 daniel-mar 22903
 
4 daniel-mar 22904
  if not IsNTandDelphiRunning then
22905
  begin
22906
    DDrawDLL := LoadLibrary('DDraw.dll');
22907
    DirectDrawEnumerateA := GetProcAddress(DDrawDLL,'DirectDrawEnumerateA');
22908
    DirectDrawEnumerateW := GetProcAddress(DDrawDLL,'DirectDrawEnumerateW');
22909
{$IFDEF UNICODE}
22910
    DirectDrawEnumerate := DirectDrawEnumerateW;
22911
{$ELSE}
22912
    DirectDrawEnumerate := DirectDrawEnumerateA;
22913
{$ENDIF}
22914
 
22915
    DirectDrawEnumerateExA := GetProcAddress(DDrawDLL,'DirectDrawEnumerateExA');
22916
    DirectDrawEnumerateExW := GetProcAddress(DDrawDLL,'DirectDrawEnumerateExW');
22917
{$IFDEF UNICODE}
22918
    DirectDrawEnumerateEx := DirectDrawEnumerateExW;
22919
{$ELSE}
22920
    DirectDrawEnumerateEx := DirectDrawEnumerateExA;
22921
{$ENDIF}
22922
 
22923
    DirectDrawCreate := GetProcAddress(DDrawDLL,'DirectDrawCreate');
22924
    DirectDrawCreateEx := GetProcAddress(DDrawDLL,'DirectDrawCreateEx');
22925
    DirectDrawCreateClipper := GetProcAddress(DDrawDLL,'DirectDrawCreateClipper');
22926
{$IFDEF WINNT}
22927
    NtDirectDrawCreate := GetProcAddress(DDrawDLL,'NtDirectDrawCreate');
22928
{$ENDIF}
22929
  end;
22930
  {DirectDraw}
22931
  {Direct3D}
22932
  DisableFPUExceptions;
22933
  {$IFDEF D3DRM}
22934
  if not IsNTandDelphiRunning then
22935
  begin
22936
    DXFileDLL := LoadLibrary('D3DXOF.DLL');
22937
    DirectXFileCreate := GetProcAddress(DXFileDLL,'DirectXFileCreate');
22938
  end;
22939
  {Direct3D}
22940
  {Direct3DRM}
22941
  if not IsNTandDelphiRunning then
22942
  begin
22943
    D3DRMDLL := LoadLibrary('D3DRM.dll');
22944
    //d3drmdef:
22945
    D3DRMCreateColorRGB := GetProcAddress(D3DRMDLL,'D3DRMCreateColorRGB');
22946
    D3DRMCreateColorRGBA := GetProcAddress(D3DRMDLL,'D3DRMCreateColorRGBA');
22947
    D3DRMColorGetRed := GetProcAddress(D3DRMDLL,'D3DRMColorGetRed');
22948
    D3DRMColorGetGreen := GetProcAddress(D3DRMDLL,'D3DRMColorGetGreen');
22949
    D3DRMColorGetBlue := GetProcAddress(D3DRMDLL,'D3DRMColorGetBlue');
22950
    D3DRMColorGetAlpha := GetProcAddress(D3DRMDLL,'D3DRMColorGetAlpha');
22951
    D3DRMVectorAdd := GetProcAddress(D3DRMDLL,'D3DRMVectorAdd');
22952
    D3DRMVectorSubtract := GetProcAddress(D3DRMDLL,'D3DRMVectorSubtract');
22953
    D3DRMVectorReflect := GetProcAddress(D3DRMDLL,'D3DRMVectorReflect');
22954
    D3DRMVectorCrossProduct := GetProcAddress(D3DRMDLL,'D3DRMVectorCrossProduct');
22955
    D3DRMVectorDotProduct := GetProcAddress(D3DRMDLL,'D3DRMVectorDotProduct');
22956
    D3DRMVectorNormalize := GetProcAddress(D3DRMDLL,'D3DRMVectorNormalize');
22957
    D3DRMVectorModulus := GetProcAddress(D3DRMDLL,'D3DRMVectorModulus');
22958
    D3DRMVectorRotate := GetProcAddress(D3DRMDLL,'D3DRMVectorRotate');
22959
    D3DRMVectorScale := GetProcAddress(D3DRMDLL,'D3DRMVectorScale');
22960
    D3DRMVectorRandom := GetProcAddress(D3DRMDLL,'D3DRMVectorRandom');
22961
    D3DRMQuaternionFromRotation := GetProcAddress(D3DRMDLL,'D3DRMQuaternionFromRotation');
22962
    D3DRMQuaternionMultiply := GetProcAddress(D3DRMDLL,'D3DRMQuaternionMultiply');
22963
    D3DRMQuaternionSlerp := GetProcAddress(D3DRMDLL,'D3DRMQuaternionSlerp');
22964
    D3DRMMatrixFromQuaternion := GetProcAddress(D3DRMDLL,'D3DRMMatrixFromQuaternion');
22965
    D3DRMQuaternionFromMatrix := GetProcAddress(D3DRMDLL,'D3DRMQuaternionFromMatrix');
22966
    //d3drm:
22967
    Direct3DRMCreate := GetProcAddress(D3DRMDLL,'Direct3DRMCreate');
22968
  end;
22969
  {$ENDIF}
22970
  {Direct3DRM}
22971
  {DirectInput}
22972
  Init_c_dfDIKeyboard_Objects;  // set kbd GUIDs & flags
22973
  Init_c_dfDIJoystick2_Objects;  // construct Joystick2 from Joystick fmt
22974
 
22975
  if not IsNTandDelphiRunning then
22976
  begin
22977
    DInputDLL := LoadLibrary('DInput.dll');
22978
 
22979
    DirectInputCreateA := GetProcAddress(DInputDLL,'DirectInputCreateA');
22980
    DirectInputCreateW := GetProcAddress(DInputDLL,'DirectInputCreateW');
22981
    // no A/W version
22982
    DirectInputCreateEx := GetProcAddress(DInputDLL,'DirectInputCreateEx');
22983
{$IFDEF UNICODE}
22984
    DirectInputCreate := DirectInputCreateW;
22985
{$ELSE}
22986
    DirectInputCreate := DirectInputCreateA;
22987
{$ENDIF}
22988
  end;
22989
  {DirectInput}
10 daniel-mar 22990
  {$IFDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
4 daniel-mar 22991
  {DirectPlay}
22992
  if not IsNTandDelphiRunning then
22993
  begin
22994
    DPlayDLL := LoadLibrary('DPlayX.dll');
22995
 
22996
    DirectPlayEnumerateA := GetProcAddress(DPlayDLL,'DirectPlayEnumerateA');
22997
    DirectPlayEnumerateW := GetProcAddress(DPlayDLL,'DirectPlayEnumerateW');
22998
  {$IFDEF UNICODE}
22999
    DirectPlayEnumerate := DirectPlayEnumerateW;
23000
  {$ELSE}
23001
    DirectPlayEnumerate := DirectPlayEnumerateA;
23002
  {$ENDIF}
23003
 
23004
    DirectPlayCreate := GetProcAddress(DPlayDLL,'DirectPlayCreate');
23005
 
23006
//  File:       dplay.h
23007
 
23008
    DirectPlayLobbyCreateW := GetProcAddress(DPlayDLL,'DirectPlayLobbyCreateW');
23009
    DirectPlayLobbyCreateA := GetProcAddress(DPlayDLL,'DirectPlayLobbyCreateA');
23010
  {$IFDEF UNICODE}
23011
    DirectPlayLobbyCreate := DirectPlayLobbyCreateW;
23012
  {$ELSE}
23013
    DirectPlayLobbyCreate := DirectPlayLobbyCreateA;
23014
  {$ENDIF}
23015
 
23016
  end;
23017
  {DirectPlay}
10 daniel-mar 23018
  {$ENDIF} // UseDirectPlay
4 daniel-mar 23019
  {DirectSetup}
23020
  if not IsNTandDelphiRunning then
23021
  begin
23022
    LoadDSetup;
23023
  end;
23024
  {DirectSetup}
23025
  {DirectSound}
23026
  if not IsNTandDelphiRunning then
23027
  begin
23028
    DSoundDLL := LoadLibrary('DSound.dll');
23029
    DirectSoundCreate := GetProcAddress(DSoundDLL,'DirectSoundCreate');
23030
 
23031
    DirectSoundEnumerateW := GetProcAddress(DSoundDLL,'DirectSoundEnumerateW');
23032
    DirectSoundEnumerateA := GetProcAddress(DSoundDLL,'DirectSoundEnumerateA');
23033
  {$IFDEF UNICODE}
23034
    DirectSoundEnumerate := DirectSoundEnumerateW;
23035
  {$ELSE}
23036
    DirectSoundEnumerate := DirectSoundEnumerateA;
23037
  {$ENDIF}
23038
 
23039
    DirectSoundCaptureCreate :=
23040
        GetProcAddress(DSoundDLL,'DirectSoundCaptureCreate');
23041
 
23042
    DirectSoundCaptureEnumerateW :=
23043
        GetProcAddress(DSoundDLL,'DirectSoundCaptureEnumerateW');
23044
    DirectSoundCaptureEnumerateA :=
23045
        GetProcAddress(DSoundDLL,'DirectSoundCaptureEnumerateA');
23046
  {$IFDEF UNICODE}
23047
    DirectSoundCaptureEnumerate := DirectSoundCaptureEnumerateW;
23048
  {$ELSE}
23049
    DirectSoundCaptureEnumerate := DirectSoundCaptureEnumerateA;
23050
  {$ENDIF}
23051
  end;
23052
  {DirectSound}
23053
end;
23054
 
23055
finalization
23056
begin
23057
  {DirectDraw}
23058
  if DDrawDLL <> 0 then FreeLibrary(DDrawDLL);
23059
  {DirectDraw}
23060
  {Direct3D}
23061
  FreeLibrary(DXFileDLL);
23062
  {Direct3D}
23063
  {Direct3DRM}
23064
  {$IFDEF D3DRM}
23065
  if D3DRMDLL <> 0 then FreeLibrary(D3DRMDLL);
23066
  {$ENDIF}
23067
  {Direct3DRM}
23068
  {DirectInput}
23069
  FreeLibrary(DInputDLL);
23070
  {DirectInput}
10 daniel-mar 23071
  {$IFDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
4 daniel-mar 23072
  {DirectPlay}
23073
  if DPlayDLL <> 0 then FreeLibrary(DPlayDLL);
23074
  {DirectPlay}
10 daniel-mar 23075
  {$ENDIF}
4 daniel-mar 23076
  {DirectSetup}
23077
  FreeLibrary(DSetupDLL);
23078
  {DirectSetup}
23079
  {DirectSound}
23080
  FreeLibrary(DSoundDLL);
23081
  {DirectSound}
23082
end;
23083
 
23084
 
23085
End.