Subversion Repositories spacemission

Rev

Rev 1 | 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
1 daniel-mar 30
 
4 daniel-mar 31
Join in order:
32
  1) DirectDraw
33
  2) Direct3D
34
  3) Direct3DRM
35
  4) DirectInput
36
  5) DirectPlay
37
  6) DirectSetup
38
  7) DirectSound
39
  8) DirectMusic
40
}
41
Unit DirectX;
1 daniel-mar 42
 
4 daniel-mar 43
Interface
1 daniel-mar 44
 
4 daniel-mar 45
{Delphi version marks}
1 daniel-mar 46
 
4 daniel-mar 47
{$I DelphiXcfg.inc}
1 daniel-mar 48
 
4 daniel-mar 49
{$MINENUMSIZE 4}
50
{$ALIGN ON}
1 daniel-mar 51
 
4 daniel-mar 52
uses
53
  Windows, MMSystem;
54
//DirectDraw file
1 daniel-mar 55
(*==========================================================================;
56
 *
4 daniel-mar 57
 *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 58
 *
4 daniel-mar 59
 *  Files:      ddraw.h dvp.h
60
 *  Content:    DirectDraw and DirectDrawVideoPort include files
1 daniel-mar 61
 *
4 daniel-mar 62
 *  DirectX 7.0 Delphi adaptation by Erik Unger
63
 *
64
 *  Modified: 10-Sep-2000
65
 *
66
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
67
 *  E-Mail: DelphiDirectX@next-reality.com
68
 *
69
 *
1 daniel-mar 70
 ***************************************************************************)
71
 
4 daniel-mar 72
var
73
  DDrawDLL : HMODULE = 0;
1 daniel-mar 74
 
4 daniel-mar 75
function DDErrorString(Value: HResult) : string;
1 daniel-mar 76
 
4 daniel-mar 77
function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
1 daniel-mar 78
 
4 daniel-mar 79
(*
80
 * FOURCC codes for DX compressed-texture pixel formats
81
 *)
1 daniel-mar 82
const
4 daniel-mar 83
  FOURCC_DXT1 = 'DXT1';
84
  FOURCC_DXT2 = 'DXT2';
85
  FOURCC_DXT3 = 'DXT3';
86
  FOURCC_DXT4 = 'DXT4';
87
  FOURCC_DXT5 = 'DXT5';
88
 
89
(*
90
 * GUIDS used by DirectDraw objects
91
 *)
92
const
1 daniel-mar 93
  CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
4 daniel-mar 94
  CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';
95
  CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';
1 daniel-mar 96
 
97
const
4 daniel-mar 98
  DD_ROP_SPACE = (256 div 32);       // space required to store ROP array
1 daniel-mar 99
 
4 daniel-mar 100
  MAX_DDDEVICEID_STRING = 512;
1 daniel-mar 101
 
4 daniel-mar 102
(*
103
 * Flags for the IDirectDraw4::GetDeviceIdentifier method
104
 *)
1 daniel-mar 105
 
4 daniel-mar 106
(*
107
 * This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped
108
 * with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the
109
 * host adapter, but is typically physcially located on a separate card. The stacked secondary's information is
110
 * returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities
111
 * of the DirectDraw object involved.
112
 *)
113
  DDGDI_GETHOSTIDENTIFIER         = $00000001;
114
 
115
(*============================================================================
116
 *
117
 * DirectDraw Structures
118
 *
119
 * Various structures used to invoke DirectDraw.
120
 *
121
 *==========================================================================*)
122
 
123
var
124
  NilGUID : TGUID{$IfNDef VER6UP} absolute 0{$EndIf};
125
 
1 daniel-mar 126
type
4 daniel-mar 127
  TRefGUID = packed record
128
    case integer of
129
    1: (guid : PGUID);
130
    2: (dwFlags : DWORD);
131
  end;
132
 
1 daniel-mar 133
  IDirectDraw = interface;
134
  IDirectDraw2 = interface;
135
  IDirectDraw4 = interface;
136
  IDirectDraw7 = interface;
137
  IDirectDrawSurface = interface;
138
  IDirectDrawSurface2 = interface;
139
  IDirectDrawSurface3 = interface;
140
  IDirectDrawSurface4 = interface;
141
  IDirectDrawSurface7 = interface;
4 daniel-mar 142
 
1 daniel-mar 143
  IDirectDrawPalette = interface;
144
  IDirectDrawClipper = interface;
145
  IDirectDrawColorControl = interface;
146
  IDirectDrawGammaControl = interface;
147
 
4 daniel-mar 148
(*
149
 * Generic pixel format with 8-bit RGB and alpha components
150
 *)
1 daniel-mar 151
  PDDARGB = ^TDDARGB;
4 daniel-mar 152
  TDDARGB = packed record
153
    blue:     BYTE;
154
    green:    BYTE;
155
    red:      BYTE;
156
    alpha:    BYTE;
1 daniel-mar 157
  end;
158
 
4 daniel-mar 159
(*
160
 * This version of the structure remains for backwards source compatibility.
161
 * The DDARGB structure is the one that should be used for all DirectDraw APIs.
162
 *)
1 daniel-mar 163
  PDDRGBA = ^TDDRGBA;
4 daniel-mar 164
  TDDRGBA = packed record
165
    red   : BYTE;
166
    green : BYTE;
167
    blue  : BYTE;
168
    alpha : BYTE;
1 daniel-mar 169
  end;
170
 
4 daniel-mar 171
(*
172
 * TDDColorKey
173
 *)
1 daniel-mar 174
  PDDColorKey = ^TDDColorKey;
4 daniel-mar 175
  TDDColorKey = packed record
1 daniel-mar 176
    dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to
4 daniel-mar 177
                                   // be treated as Color Key, inclusive
1 daniel-mar 178
    dwColorSpaceHighValue: DWORD;  // high boundary of color space that is
4 daniel-mar 179
                                   // to be treated as Color Key, inclusive
1 daniel-mar 180
  end;
181
 
4 daniel-mar 182
// Delphi 5 can't handle interface in variant records
183
// so we have to use pointers instead (which can be type-casted into interfaces):
1 daniel-mar 184
 
4 daniel-mar 185
{$IFDEF VER5UP}
186
  PDirectDrawSurface = Pointer;              
187
{$ELSE}
188
  PDirectDrawSurface = IDirectDrawSurface;
189
{$ENDIF}
1 daniel-mar 190
 
4 daniel-mar 191
(*
192
 * TDDBltFX
193
 * Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
194
 *)
1 daniel-mar 195
  PDDBltFX = ^TDDBltFX;
4 daniel-mar 196
  TDDBltFX = packed record
197
    dwSize                        : DWORD;     // size of structure
198
    dwDDFX                        : DWORD;     // FX operations
199
    dwROP                         : DWORD;     // Win32 raster operations
200
    dwDDROP                       : DWORD;     // Raster operations new for DirectDraw
201
    dwRotationAngle               : DWORD;     // Rotation angle for blt
202
    dwZBufferOpCode               : DWORD;     // ZBuffer compares
203
    dwZBufferLow                  : DWORD;     // Low limit of Z buffer
204
    dwZBufferHigh                 : DWORD;     // High limit of Z buffer
205
    dwZBufferBaseDest             : DWORD;     // Destination base value
206
    dwZDestConstBitDepth          : DWORD;     // Bit depth used to specify Z constant for destination
207
    case integer of
1 daniel-mar 208
    0: (
4 daniel-mar 209
      dwZDestConst                : DWORD      // Constant to use as Z buffer for dest
210
     );
1 daniel-mar 211
    1: (
4 daniel-mar 212
      lpDDSZBufferDest            : PDirectDrawSurface; // Surface to use as Z buffer for dest
213
      dwZSrcConstBitDepth         : DWORD;     // Bit depth used to specify Z constant for source
214
      case integer of
215
      0: (
216
        dwZSrcConst               : DWORD;     // Constant to use as Z buffer for src
217
       );
218
      1: (
219
        lpDDSZBufferSrc           : PDirectDrawSurface; // Surface to use as Z buffer for src
220
        dwAlphaEdgeBlendBitDepth  : DWORD;     // Bit depth used to specify constant for alpha edge blend
221
        dwAlphaEdgeBlend          : DWORD;     // Alpha for edge blending
222
        dwReserved                : DWORD;
223
        dwAlphaDestConstBitDepth  : DWORD;     // Bit depth used to specify alpha constant for destination
224
        case integer of
225
        0: (
226
          dwAlphaDestConst        : DWORD;     // Constant to use as Alpha Channel
227
         );
228
        1: (
229
          lpDDSAlphaDest          : PDirectDrawSurface; // Surface to use as Alpha Channel
230
          dwAlphaSrcConstBitDepth : DWORD;     // Bit depth used to specify alpha constant for source
231
          case integer of
232
          0: (
233
            dwAlphaSrcConst       : DWORD;     // Constant to use as Alpha Channel
234
          );
235
          1: (
236
            lpDDSAlphaSrc         : PDirectDrawSurface; // Surface to use as Alpha Channel
237
            case integer of
238
            0: (
239
              dwFillColor         : DWORD;     // color in RGB or Palettized
240
            );
241
            1: (
242
              dwFillDepth         : DWORD;     // depth value for z-buffer
243
            );
244
            2: (
245
              dwFillPixel         : DWORD;     // pixel value
246
            );
247
            3: (
248
              lpDDSPattern        : PDirectDrawSurface; // Surface to use as pattern
249
              ddckDestColorkey    : TDDColorKey; // DestColorkey override
250
              ddckSrcColorkey     : TDDColorKey; // SrcColorkey override
251
            )
252
        )
253
      )
254
    )
255
  )
1 daniel-mar 256
  end;
257
 
4 daniel-mar 258
(*
259
 * TDDSCaps
260
 *)
1 daniel-mar 261
  PDDSCaps = ^TDDSCaps;
4 daniel-mar 262
  TDDSCaps = packed record
1 daniel-mar 263
    dwCaps: DWORD;         // capabilities of surface wanted
264
  end;
265
 
4 daniel-mar 266
(*
267
 * TDDOSCaps
268
 *)
1 daniel-mar 269
  PDDOSCaps = ^TDDOSCaps;
4 daniel-mar 270
  TDDOSCaps = packed record
1 daniel-mar 271
    dwCaps: DWORD;         // capabilities of surface wanted
272
  end;
273
 
4 daniel-mar 274
(*
275
 * This structure is used internally by DirectDraw.
276
 *)
1 daniel-mar 277
  PDDSCapsEx = ^TDDSCapsEx;
4 daniel-mar 278
  TDDSCapsEx = packed record
279
    dwCaps2 : DWORD;
280
    dwCaps3 : DWORD;
281
    dwCaps4 : DWORD;
1 daniel-mar 282
  end;
283
 
4 daniel-mar 284
(*
285
 * TDDSCaps2
286
 *)
1 daniel-mar 287
  PDDSCaps2 = ^TDDSCaps2;
4 daniel-mar 288
  TDDSCaps2 = packed record
1 daniel-mar 289
    dwCaps: DWORD;         // capabilities of surface wanted
4 daniel-mar 290
    dwCaps2 : DWORD;
291
    dwCaps3 : DWORD;
292
    dwCaps4 : DWORD;
1 daniel-mar 293
  end;
294
 
4 daniel-mar 295
(*
296
 * TDDCaps
297
 *)
298
(*
299
 * This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X.
300
 * It is present for back compatability.
301
 *)
1 daniel-mar 302
  PDDCaps_DX3 = ^TDDCaps_DX3;
4 daniel-mar 303
  TDDCaps_DX3 = packed record
1 daniel-mar 304
    dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
305
    dwCaps: DWORD;                 // driver specific capabilities
306
    dwCaps2: DWORD;                // more driver specific capabilites
307
    dwCKeyCaps: DWORD;             // color key capabilities of the surface
308
    dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
309
    dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
310
    dwPalCaps: DWORD;              // palette capabilities
311
    dwSVCaps: DWORD;               // stereo vision capabilities
312
    dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
313
    dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
314
    dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
315
    dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
316
    dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
317
    dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
318
    dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
319
    dwVidMemTotal: DWORD;          // total amount of video memory
320
    dwVidMemFree: DWORD;           // amount of free video memory
321
    dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
322
    dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
323
    dwNumFourCCCodes: DWORD;       // number of four cc codes
324
    dwAlignBoundarySrc: DWORD;     // source rectangle alignment
325
    dwAlignSizeSrc: DWORD;         // source rectangle byte size
326
    dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
327
    dwAlignSizeDest: DWORD;        // dest rectangle byte size
328
    dwAlignStrideAlign: DWORD;     // stride alignment
4 daniel-mar 329
    dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
1 daniel-mar 330
    ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
331
    dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
332
    dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
333
    dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
334
    dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
335
    dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
336
    dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
337
    dwReserved1: DWORD;            // reserved
338
    dwReserved2: DWORD;            // reserved
339
    dwReserved3: DWORD;            // reserved
340
    dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
341
    dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
342
    dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
4 daniel-mar 343
    dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
1 daniel-mar 344
    dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
345
    dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
346
    dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
4 daniel-mar 347
    dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
1 daniel-mar 348
    dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
349
    dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
350
    dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
4 daniel-mar 351
    dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
352
    dwReserved4 : DWORD;
353
    dwReserved5 : DWORD;
354
    dwReserved6 : DWORD;
1 daniel-mar 355
  end;
356
 
4 daniel-mar 357
(*
358
 * This structure is the TDDCaps structure as it was in version 5 of Direct X.
359
 * It is present for back compatability.
360
 *)
1 daniel-mar 361
  PDDCaps_DX5 = ^TDDCaps_DX5;
4 daniel-mar 362
  TDDCaps_DX5 = packed record
1 daniel-mar 363
    dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
364
    dwCaps: DWORD;                 // driver specific capabilities
365
    dwCaps2: DWORD;                // more driver specific capabilites
366
    dwCKeyCaps: DWORD;             // color key capabilities of the surface
367
    dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
368
    dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
369
    dwPalCaps: DWORD;              // palette capabilities
370
    dwSVCaps: DWORD;               // stereo vision capabilities
371
    dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
372
    dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
373
    dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
374
    dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
375
    dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
376
    dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
377
    dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
378
    dwVidMemTotal: DWORD;          // total amount of video memory
379
    dwVidMemFree: DWORD;           // amount of free video memory
380
    dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
381
    dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
382
    dwNumFourCCCodes: DWORD;       // number of four cc codes
383
    dwAlignBoundarySrc: DWORD;     // source rectangle alignment
384
    dwAlignSizeSrc: DWORD;         // source rectangle byte size
385
    dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
386
    dwAlignSizeDest: DWORD;        // dest rectangle byte size
387
    dwAlignStrideAlign: DWORD;     // stride alignment
4 daniel-mar 388
    dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
1 daniel-mar 389
    ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
390
    dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
391
    dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
392
    dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
393
    dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
394
    dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
395
    dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
396
    dwReserved1: DWORD;            // reserved
397
    dwReserved2: DWORD;            // reserved
398
    dwReserved3: DWORD;            // reserved
399
    dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
400
    dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
401
    dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
4 daniel-mar 402
    dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
1 daniel-mar 403
    dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
404
    dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
405
    dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
4 daniel-mar 406
    dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
1 daniel-mar 407
    dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
408
    dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
409
    dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
4 daniel-mar 410
    dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
411
    // Members added for DX5:
412
    dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
413
    dwCurrVideoPorts: DWORD;       // current number of video ports used
414
    dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
415
    dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
416
    dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
417
    dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
418
    dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
419
    dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
1 daniel-mar 420
  end;
421
 
422
  PDDCaps_DX6 = ^TDDCaps_DX6;
4 daniel-mar 423
  TDDCaps_DX6 = packed record
1 daniel-mar 424
    dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
425
    dwCaps: DWORD;                 // driver specific capabilities
426
    dwCaps2: DWORD;                // more driver specific capabilites
427
    dwCKeyCaps: DWORD;             // color key capabilities of the surface
428
    dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
429
    dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
430
    dwPalCaps: DWORD;              // palette capabilities
431
    dwSVCaps: DWORD;               // stereo vision capabilities
432
    dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
433
    dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
434
    dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
435
    dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
436
    dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
437
    dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
438
    dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
439
    dwVidMemTotal: DWORD;          // total amount of video memory
440
    dwVidMemFree: DWORD;           // amount of free video memory
441
    dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
442
    dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
443
    dwNumFourCCCodes: DWORD;       // number of four cc codes
444
    dwAlignBoundarySrc: DWORD;     // source rectangle alignment
445
    dwAlignSizeSrc: DWORD;         // source rectangle byte size
446
    dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
447
    dwAlignSizeDest: DWORD;        // dest rectangle byte size
448
    dwAlignStrideAlign: DWORD;     // stride alignment
4 daniel-mar 449
    dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
450
    ddsOldCaps: TDDSCaps;          // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6
1 daniel-mar 451
    dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
452
    dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
453
    dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
454
    dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
455
    dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
456
    dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
457
    dwReserved1: DWORD;            // reserved
458
    dwReserved2: DWORD;            // reserved
459
    dwReserved3: DWORD;            // reserved
460
    dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
461
    dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
462
    dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
4 daniel-mar 463
    dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
1 daniel-mar 464
    dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
465
    dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
466
    dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
4 daniel-mar 467
    dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
1 daniel-mar 468
    dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
469
    dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
470
    dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
4 daniel-mar 471
    dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
472
    // Members added for DX5:
473
    dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
474
    dwCurrVideoPorts: DWORD;       // current number of video ports used
475
    dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
476
    dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
477
    dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
478
    dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
479
    dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
480
    dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
481
    // Members added for DX6 release
482
    ddsCaps : TDDSCaps2 ;          // Surface Caps
1 daniel-mar 483
  end;
484
 
4 daniel-mar 485
  TDDCaps_DX7 = TDDCaps_DX6;
486
 
487
  PDDCaps = ^TDDCaps;
488
 
489
{$IFDEF DIRECTX3}
1 daniel-mar 490
  TDDCaps = TDDCaps_DX3;
4 daniel-mar 491
{$ELSE}
492
  {$IFDEF DIRECTX5}
493
    TDDCaps = TDDCaps_DX5;
494
  {$ELSE}
495
    {$IFDEF DIRECTX6}
496
      TDDCaps = TDDCaps_DX6;
497
    {$ELSE}
498
      TDDCaps = TDDCaps_DX7;
499
    {$ENDIF}
500
  {$ENDIF}
1 daniel-mar 501
{$ENDIF}
502
 
503
 
504
 
4 daniel-mar 505
 
506
(*
507
 * TDDPixelFormat
508
 *)
509
  PDDPixelFormat_DX5 = ^TDDPixelFormat_DX5;
510
  TDDPixelFormat_DX5 = packed record
511
    dwSize: DWORD;                 // size of structure
512
    dwFlags: DWORD;                // pixel format flags
513
    dwFourCC: DWORD;               // (FOURCC code)
1 daniel-mar 514
    case Integer of
4 daniel-mar 515
    0: (
516
      dwZBufferBitDepth: DWORD;      // how many bits for z buffers
517
     );
518
    1: (
519
      dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
520
     );
521
    2: (
522
      dwRGBBitCount: DWORD;          // how many bits per pixel
523
      dwRBitMask: DWORD;             // mask for red bit
524
      dwGBitMask: DWORD;             // mask for green bits
525
      dwBBitMask: DWORD;             // mask for blue bits
526
      dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
527
     );
528
    3: (
529
      dwYUVBitCount: DWORD;          // how many bits per pixel
530
      dwYBitMask: DWORD;             // mask for Y bits
531
      dwUBitMask: DWORD;             // mask for U bits
532
      dwVBitMask: DWORD;             // mask for V bits
533
      case Integer of
1 daniel-mar 534
      0: (
4 daniel-mar 535
        dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
536
       );
1 daniel-mar 537
      1: (
4 daniel-mar 538
        dwRGBZBitMask: DWORD;
539
       );
1 daniel-mar 540
      2: (
4 daniel-mar 541
        dwYUVZBitMask: DWORD;
542
       );
543
     );
544
  end;
545
 
546
  PDDPixelFormat_DX6 = ^TDDPixelFormat_DX6;
547
  TDDPixelFormat_DX6 = packed record
548
    dwSize: DWORD;                 // size of structure
549
    dwFlags: DWORD;                // pixel format flags
550
    dwFourCC: DWORD;               // (FOURCC code)
551
    case Integer of
552
      1: (
553
          dwRGBBitCount : DWORD;  // how many bits per pixel
554
          dwRBitMask : DWORD;  // mask for red bit
555
          dwGBitMask : DWORD;  // mask for green bits
556
          dwBBitMask : DWORD;  // mask for blue bits
557
          dwRGBAlphaBitMask : DWORD; // mask for alpha channel
558
          );
559
      2: (
560
          dwYUVBitCount : DWORD;  // how many bits per pixel
561
          dwYBitMask : DWORD;  // mask for Y bits
562
          dwUBitMask : DWORD;  // mask for U bits
563
          dwVBitMask : DWORD;  // mask for V bits
564
          dwYUVAlphaBitMask : DWORD; // mask for alpha channel
565
          );
1 daniel-mar 566
      3: (
4 daniel-mar 567
          dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits)
568
          dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
569
          dwZBitMask : DWORD;  // mask for Z bits
570
          dwStencilBitMask : DWORD; // mask for stencil bits
571
          dwLuminanceAlphaBitMask : DWORD;// mask for alpha channel
572
          );
1 daniel-mar 573
      4: (
4 daniel-mar 574
          dwAlphaBitDepth : DWORD; // how many bits for alpha channels
575
          dwLuminanceBitMask : DWORD; // mask for luminance bits
576
          dwBumpDvBitMask : DWORD;        // mask for bump map V delta bits
577
          dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map
578
          dwRGBZBitMask : DWORD;  // mask for Z channel
579
          );
1 daniel-mar 580
      5: (
4 daniel-mar 581
           dwLuminanceBitCount : DWORD; // how many bits per pixel
582
           dwBumpDuBitMask : DWORD;       // mask for bump map U delta bits
583
           Fill1, Fill2    : DWORD;
584
           dwYUVZBitMask   : DWORD;  // mask for Z channel
585
         );
586
      6: ( dwBumpBitCount  : DWORD;         // how many bits per "buxel", total
587
         );
1 daniel-mar 588
  end;
589
 
4 daniel-mar 590
  TDDPixelFormat_DX3 = TDDPixelFormat_DX5;
591
  TDDPixelFormat_DX7 = TDDPixelFormat_DX6;
1 daniel-mar 592
 
4 daniel-mar 593
  PDDPixelFormat = ^TDDPixelFormat;
594
{$IFDEF DIRECTX3}
595
  TDDPixelFormat = TDDPixelFormat_DX3;
596
{$ELSE}
597
  {$IFDEF DIRECTX5}
598
    TDDPixelFormat = TDDPixelFormat_DX5;
599
  {$ELSE}
600
    {$IFDEF DIRECTX6}
601
      TDDPixelFormat = TDDPixelFormat_DX6;
602
    {$ELSE}
603
      TDDPixelFormat = TDDPixelFormat_DX7;
604
    {$ENDIF}
605
  {$ENDIF}
606
{$ENDIF}
1 daniel-mar 607
 
4 daniel-mar 608
(*
609
 * TDDOverlayFX
610
 *)
611
  PDDOverlayFX = ^TDDOverlayFX;
612
  TDDOverlayFX = packed record
1 daniel-mar 613
    dwSize: DWORD;                         // size of structure
614
    dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
615
    dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
616
    dwReserved: DWORD;
617
    dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
618
    case Integer of
619
    0: (
4 daniel-mar 620
      dwAlphaDestConst: DWORD;               // Constant to use as alpha channel for dest
621
      dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
622
      dwAlphaSrcConst: DWORD;                // Constant to use as alpha channel for src
623
      dckDestColorkey: TDDColorKey;                // DestColorkey override
624
      dckSrcColorkey: TDDColorKey;                 // DestColorkey override
625
      dwDDFX: DWORD;                         // Overlay FX
626
      dwFlags: DWORD;                        // flags
627
     );
1 daniel-mar 628
    1: (
4 daniel-mar 629
      lpDDSAlphaDest: PDirectDrawSurface;     // Surface to use as alpha channel for dest
630
      filler: DWORD;
631
      lpDDSAlphaSrc: PDirectDrawSurface;      // Surface to use as alpha channel for src
632
     );
1 daniel-mar 633
  end;
634
 
4 daniel-mar 635
(*
636
 * TDDBltBatch: BltBatch entry structure
637
 *)
1 daniel-mar 638
  PDDBltBatch = ^TDDBltBatch;
4 daniel-mar 639
  TDDBltBatch = packed record
1 daniel-mar 640
    lprDest: PRect;
641
    lpDDSSrc: IDirectDrawSurface;
642
    lprSrc: PRect;
643
    dwFlags: DWORD;
4 daniel-mar 644
    lpDDBltFx: TDDBltFX;
1 daniel-mar 645
  end;
646
 
4 daniel-mar 647
(*
648
 * TDDGammaRamp
649
 *)
1 daniel-mar 650
  PDDGammaRamp = ^TDDGammaRamp;
4 daniel-mar 651
  TDDGammaRamp = packed record
652
    red   : array[0..255] of WORD;
653
    green : array[0..255] of WORD;
654
    blue  : array[0..255] of WORD;
1 daniel-mar 655
  end;
656
 
4 daniel-mar 657
(*
658
 *  This is the structure within which DirectDraw returns data about the current graphics driver and chipset
659
 *)
1 daniel-mar 660
 
661
  PDDDeviceIdentifier = ^TDDDeviceIdentifier;
4 daniel-mar 662
  TDDDeviceIdentifier = packed record
1 daniel-mar 663
    //
664
    // These elements are for presentation to the user only. They should not be used to identify particular
665
    // drivers, since this is unreliable and many different strings may be associated with the same
666
    // device, and the same driver from different vendors.
667
    //
668
    szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
669
    szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
670
 
671
    //
672
    // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
673
    // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
674
    // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
675
    //
676
    // This version has the form:
677
    //  wProduct = HIWORD(liDriverVersion.HighPart)
678
    //  wVersion = LOWORD(liDriverVersion.HighPart)
679
    //  wSubVersion = HIWORD(liDriverVersion.LowPart)
680
    //  wBuild = LOWORD(liDriverVersion.LowPart)
681
    //
682
    liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
683
 
684
    //
685
    // These elements can be used to identify particular chipsets. Use with extreme caution.
686
    //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
687
    //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
688
    //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
689
    //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
690
    //
691
    dwVendorId: DWORD;
692
    dwDeviceId: DWORD;
693
    dwSubSysId: DWORD;
694
    dwRevision: DWORD;
695
 
696
    //
697
    // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
698
    // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
699
    // reprofile the graphics subsystem.
700
    // This element can also be used to identify particular problematic drivers.
701
    //
702
    guidDeviceIdentifier: TGUID;
703
  end;
704
 
705
  PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;
4 daniel-mar 706
  TDDDeviceIdentifier2 = packed record
1 daniel-mar 707
    //
708
    // These elements are for presentation to the user only. They should not be used to identify particular
709
    // drivers, since this is unreliable and many different strings may be associated with the same
710
    // device, and the same driver from different vendors.
711
    //
712
    szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
713
    szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
714
 
715
    //
716
    // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
717
    // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
718
    // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
719
    //
720
    // This version has the form:
721
    //  wProduct = HIWORD(liDriverVersion.HighPart)
722
    //  wVersion = LOWORD(liDriverVersion.HighPart)
723
    //  wSubVersion = HIWORD(liDriverVersion.LowPart)
724
    //  wBuild = LOWORD(liDriverVersion.LowPart)
725
    //
726
    liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
727
 
728
    //
729
    // These elements can be used to identify particular chipsets. Use with extreme caution.
730
    //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
731
    //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
732
    //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
733
    //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
734
    //
735
    dwVendorId: DWORD;
736
    dwDeviceId: DWORD;
737
    dwSubSysId: DWORD;
738
    dwRevision: DWORD;
739
 
740
    //
741
    // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
742
    // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
743
    // reprofile the graphics subsystem.
744
    // This element can also be used to identify particular problematic drivers.
745
    //
746
    guidDeviceIdentifier: TGUID;
747
 
4 daniel-mar 748
    (*
749
     * This element is used to determine the Windows Hardware Quality Lab (WHQL)
750
     * certification level for this driver/device pair.
751
     *)
1 daniel-mar 752
    dwWHQLLevel: DWORD;
753
  end;
754
 
4 daniel-mar 755
(*
756
 * callbacks
757
 *)
1 daniel-mar 758
  TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;
759
      Code: DWORD; lpContext: Pointer): HResult; stdcall;
760
  TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
761
 
4 daniel-mar 762
(*
763
 * TDDSurfaceDesc
764
 *)
765
  PDDSurfaceDesc_DX5 = ^TDDSurfaceDesc_DX5;
766
  TDDSurfaceDesc_DX5 = packed record
767
    dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
768
    dwFlags: DWORD;                // determines what fields are valid
769
    dwHeight: DWORD;               // height of surface to be created
770
    dwWidth: DWORD;                // width of input surface
771
    case Integer of
772
    0: (
773
      dwLinearSize : DWORD;       // unused at the moment
774
     );
775
    1: (
776
      lPitch: LongInt;                 // distance to start of next line (return value only)
777
      dwBackBufferCount: DWORD;      // number of back buffers requested
778
      case Integer of
779
      0: (
780
        dwMipMapCount: DWORD;          // number of mip-map levels requested
781
        dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
782
        dwReserved: DWORD;             // reserved
783
        lpSurface: Pointer;              // pointer to the associated surface memory
784
        ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
785
        ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
786
        ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
787
        ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
788
        ddpfPixelFormat: TDDPixelFormat_DX5; // pixel format description of the surface
789
        ddsCaps: TDDSCaps;                // direct draw surface capabilities
790
       );
791
      1: (
792
        dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
793
       );
794
      2: (
795
        dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
796
       );
797
     );
798
  end;
1 daniel-mar 799
 
4 daniel-mar 800
  PDDSurfaceDesc_DX6 = ^TDDSurfaceDesc_DX6;
801
  TDDSurfaceDesc_DX6 = packed record
802
    dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
803
    dwFlags: DWORD;                // determines what fields are valid
804
    dwHeight: DWORD;               // height of surface to be created
805
    dwWidth: DWORD;                // width of input surface
806
    case Integer of
807
    0: (
808
      dwLinearSize : DWORD;       // unused at the moment
809
     );
810
    1: (
811
      lPitch: LongInt;                 // distance to start of next line (return value only)
812
      dwBackBufferCount: DWORD;      // number of back buffers requested
813
      case Integer of
814
      0: (
815
        dwMipMapCount: DWORD;          // number of mip-map levels requested
816
        dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
817
        dwReserved: DWORD;             // reserved
818
        lpSurface: Pointer;              // pointer to the associated surface memory
819
        ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
820
        ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
821
        ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
822
        ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
823
        ddpfPixelFormat: TDDPixelFormat_DX6; // pixel format description of the surface
824
        ddsCaps: TDDSCaps;                // direct draw surface capabilities
825
       );
826
      1: (
827
        dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
828
       );
829
      2: (
830
        dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
831
       );
832
     );
833
  end;
1 daniel-mar 834
 
4 daniel-mar 835
  PDDSurfaceDesc = ^TDDSurfaceDesc;
836
{$IFDEF DIRECTX5}
837
  TDDSurfaceDesc = TDDSurfaceDesc_DX5;
838
{$ELSE}
839
  TDDSurfaceDesc = TDDSurfaceDesc_DX6;
840
{$ENDIF}
1 daniel-mar 841
 
842
 
4 daniel-mar 843
(*
844
 * TDDSurfaceDesc2
845
 *)
846
  PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
847
  TDDSurfaceDesc2 = packed record
848
    dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
849
    dwFlags: DWORD;                // determines what fields are valid
850
    dwHeight: DWORD;               // height of surface to be created
851
    dwWidth: DWORD;                // width of input surface
852
    case Integer of
853
    0: (
854
      lPitch : LongInt;                  // distance to start of next line (return value only)
855
     );
856
    1: (
857
      dwLinearSize : DWORD;              // Formless late-allocated optimized surface size
858
      dwBackBufferCount: DWORD;          // number of back buffers requested
859
      case Integer of
860
      0: (
861
        dwMipMapCount: DWORD;            // number of mip-map levels requested
862
        dwAlphaBitDepth: DWORD;          // depth of alpha buffer requested
863
        dwReserved: DWORD;               // reserved
864
        lpSurface: Pointer;              // pointer to the associated surface memory
865
        ddckCKDestOverlay: TDDColorKey;  // color key for destination overlay use
866
        ddckCKDestBlt: TDDColorKey;      // color key for destination blt use
867
        ddckCKSrcOverlay: TDDColorKey;   // color key for source overlay use
868
        ddckCKSrcBlt: TDDColorKey;       // color key for source blt use
869
        ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface
870
        ddsCaps: TDDSCaps2;              // direct draw surface capabilities
871
        dwTextureStage: DWORD;           // stage in multitexture cascade
872
       );
873
      1: (
874
        dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
875
       );
876
     );
877
  end;
1 daniel-mar 878
 
4 daniel-mar 879
(*
880
 * TDDOptSurfaceDesc
881
 *)
1 daniel-mar 882
 
4 daniel-mar 883
  PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
884
  TDDOptSurfaceDesc = packed record
885
    dwSize : DWORD;             // size of the DDOPTSURFACEDESC structure
886
    dwFlags : DWORD;            // determines what fields are valid
887
    ddSCaps : TDDSCaps2;        // Common caps like: Memory type
888
    ddOSCaps : TDDOSCaps;       // Common caps like: Memory type
889
    guid : TGUID;               // Compression technique GUID
890
    dwCompressionRatio : DWORD; // Compression ratio
891
  end;
892
 
893
(*
894
 * DDCOLORCONTROL
895
 *)
896
  PDDColorControl = ^TDDColorControl;
897
  TDDColorControl = packed record
898
    dwSize: DWORD;
899
    dwFlags: DWORD;
900
    lBrightness: LongInt;
901
    lContrast: LongInt;
902
    lHue: LongInt;
903
    lSaturation: LongInt;
904
    lSharpness: LongInt;
905
    lGamma: LongInt;
906
    lColorEnable: LongInt;
907
    dwReserved1: DWORD;
908
  end;
909
 
910
(*
911
 * callbacks
912
 *)
913
 
914
{$IFNDEF WINNT}
915
  TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc;
916
      lpContext: Pointer) : HResult; stdcall;
917
  TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2;
918
      lpContext: Pointer) : HResult; stdcall;
919
  TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface;
920
      const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer) : HResult; stdcall;
921
  TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4;
922
      const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
923
  TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7;
924
      const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
925
{$ENDIF}
926
 
927
(*
928
 * INTERACES FOLLOW:
929
 *      IDirectDraw
930
 *      IDirectDrawClipper
931
 *      IDirectDrawPalette
932
 *      IDirectDrawSurface
933
 *)
934
 
935
(*
936
 * IDirectDraw
937
 *)
938
 
939
  IDirectDraw = interface (IUnknown)
1 daniel-mar 940
    ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
4 daniel-mar 941
    (*** IDirectDraw methods ***)
1 daniel-mar 942
    function Compact: HResult; stdcall;
4 daniel-mar 943
    function CreateClipper (dwFlags: DWORD;
944
        out lplpDDClipper: IDirectDrawClipper;
945
        pUnkOuter: IUnknown) : HResult; stdcall;
946
    function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
947
        out lplpDDPalette: IDirectDrawPalette;
948
        pUnkOuter: IUnknown) : HResult; stdcall;
949
    function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
950
        out lplpDDSurface: IDirectDrawSurface;
951
        pUnkOuter: IUnknown) : HResult; stdcall;
952
    function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
953
        out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
954
    function EnumDisplayModes (dwFlags: DWORD;
955
        lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
956
        lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
957
    function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
958
        lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
959
        HResult; stdcall;
1 daniel-mar 960
    function FlipToGDISurface: HResult; stdcall;
4 daniel-mar 961
    function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
962
    function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
963
    function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
964
    function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) :
965
        HResult; stdcall;
966
    function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
967
    function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
968
    function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
969
    function Initialize (lpGUID: PGUID) : HResult; stdcall;
1 daniel-mar 970
    function RestoreDisplayMode: HResult; stdcall;
4 daniel-mar 971
    function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
972
    (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
973
    function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD;
974
        dwBpp: DWORD) : HResult; stdcall;
975
    function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
976
        HResult; stdcall;
1 daniel-mar 977
  end;
978
 
4 daniel-mar 979
  IDirectDraw2 = interface (IUnknown)
1 daniel-mar 980
    ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
4 daniel-mar 981
    (*** IDirectDraw methods ***)
1 daniel-mar 982
    function Compact: HResult; stdcall;
4 daniel-mar 983
    function CreateClipper (dwFlags: DWORD;
984
        out lplpDDClipper: IDirectDrawClipper;
985
        pUnkOuter: IUnknown) : HResult; stdcall;
986
    function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
987
        out lplpDDPalette: IDirectDrawPalette;
988
        pUnkOuter: IUnknown) : HResult; stdcall;
989
    function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
990
        out lplpDDSurface: IDirectDrawSurface;
991
        pUnkOuter: IUnknown) : HResult; stdcall;
992
    function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
993
        out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
994
    function EnumDisplayModes (dwFlags: DWORD;
995
        lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
996
        lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
997
    function EnumSurfaces (dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc;
998
        lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
999
        HResult; stdcall;
1 daniel-mar 1000
    function FlipToGDISurface: HResult; stdcall;
4 daniel-mar 1001
    function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
1002
    function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1003
    function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
1004
    function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) : HResult; stdcall;
1005
    function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
1006
    function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
1007
    function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
1008
    function Initialize (lpGUID: PGUID) : HResult; stdcall;
1 daniel-mar 1009
    function RestoreDisplayMode: HResult; stdcall;
4 daniel-mar 1010
    function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
1011
(*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
1012
    function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
1013
        dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
1014
    function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
1015
        HResult; stdcall;
1016
    (*** Added in the v2 interface ***)
1017
    function GetAvailableVidMem (var lpDDSCaps: TDDSCaps;
1018
        out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
1 daniel-mar 1019
  end;
1020
 
4 daniel-mar 1021
  IDirectDraw4 = interface (IUnknown)
1022
    ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}']
1023
    (*** IDirectDraw methods ***)
1 daniel-mar 1024
    function Compact: HResult; stdcall;
4 daniel-mar 1025
    function CreateClipper (dwFlags: DWORD;
1026
        out lplpDDClipper: IDirectDrawClipper;
1027
        pUnkOuter: IUnknown) : HResult; stdcall;
1028
    function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
1029
        out lplpDDPalette: IDirectDrawPalette;
1030
        pUnkOuter: IUnknown) : HResult; stdcall;
1031
    function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
1032
        out lplpDDSurface: IDirectDrawSurface4;
1033
        pUnkOuter: IUnknown) : HResult; stdcall;
1034
    function DuplicateSurface (lpDDSurface: IDirectDrawSurface4;
1035
        out lplpDupDDSurface: IDirectDrawSurface4) : HResult; stdcall;
1036
    function EnumDisplayModes (dwFlags: DWORD;
1037
        lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
1038
        lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
1039
    function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
1040
        lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2) :
1041
        HResult; stdcall;
1 daniel-mar 1042
    function FlipToGDISurface: HResult; stdcall;
4 daniel-mar 1043
    function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
1044
    function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1045
    function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
1046
    function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface4) :
1047
        HResult; stdcall;
1048
    function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
1049
    function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
1050
    function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
1051
    function Initialize (lpGUID: PGUID) : HResult; stdcall;
1 daniel-mar 1052
    function RestoreDisplayMode: HResult; stdcall;
4 daniel-mar 1053
    function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
1054
(*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
1055
    function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
1056
        dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
1057
    function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
1058
        HResult; stdcall;
1059
    (*** Added in the v2 interface ***)
1060
    function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
1061
        out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
1062
    (*** Added in the V4 Interface ***)
1063
    function GetSurfaceFromDC (hdc : Windows.HDC;
1064
        out lpDDS4: IDirectDrawSurface4) : HResult; stdcall;
1065
    function RestoreAllSurfaces : HResult; stdcall;
1066
    function TestCooperativeLevel : HResult; stdcall;
1067
    function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier;
1068
        dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 1069
  end;
1070
 
4 daniel-mar 1071
  IDirectDraw7 = interface (IUnknown)
1072
    ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}']
1073
    (*** IDirectDraw methods ***)
1 daniel-mar 1074
    function Compact: HResult; stdcall;
4 daniel-mar 1075
    function CreateClipper (dwFlags: DWORD;
1076
        out lplpDDClipper: IDirectDrawClipper;
1077
        pUnkOuter: IUnknown) : HResult; stdcall;
1078
    function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
1079
        out lplpDDPalette: IDirectDrawPalette;
1080
        pUnkOuter: IUnknown) : HResult; stdcall;
1081
    function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
1082
        out lplpDDSurface: IDirectDrawSurface7;
1083
        pUnkOuter: IUnknown) : HResult; stdcall;
1084
    function DuplicateSurface (lpDDSurface: IDirectDrawSurface7;
1085
        out lplpDupDDSurface: IDirectDrawSurface7) : HResult; stdcall;
1086
    function EnumDisplayModes (dwFlags: DWORD;
1087
        lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
1088
        lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
1089
    function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
1090
        lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) :
1091
        HResult; stdcall;
1 daniel-mar 1092
    function FlipToGDISurface: HResult; stdcall;
4 daniel-mar 1093
    function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
1094
    function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1095
    function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
1096
    function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface7) :
1097
        HResult; stdcall;
1098
    function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
1099
    function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
1100
    function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
1101
    function Initialize (lpGUID: PGUID) : HResult; stdcall;
1 daniel-mar 1102
    function RestoreDisplayMode: HResult; stdcall;
4 daniel-mar 1103
    function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
1104
    function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
1105
        dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
1106
    function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
1107
        HResult; stdcall;
1108
    (*** Added in the v2 interface ***)
1109
    function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
1110
        out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
1111
    (*** Added in the V4 Interface ***)
1112
    function GetSurfaceFromDC (hdc : Windows.HDC;
1113
        out lpDDS: IDirectDrawSurface7) : HResult; stdcall;
1114
    function RestoreAllSurfaces : HResult; stdcall;
1115
    function TestCooperativeLevel : HResult; stdcall;
1116
    function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier2;
1117
        dwFlags: DWORD) : HResult; stdcall;
1118
    function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD) : HResult; stdcall;
1119
    function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD) : HResult; stdcall;
1 daniel-mar 1120
  end;
1121
 
1122
 
4 daniel-mar 1123
 
1124
(*
1125
 * IDirectDrawPalette
1126
 *)
1127
 
1128
  IDirectDrawPalette = interface (IUnknown)
1 daniel-mar 1129
    ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
4 daniel-mar 1130
    (*** IDirectDrawPalette methods ***)
1131
    function GetCaps (out lpdwCaps: DWORD) : HResult; stdcall;
1132
    function GetEntries (dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;
1133
        lpEntries: pointer) : HResult; stdcall;
1134
    function Initialize (lpDD: IDirectDraw; dwFlags: DWORD;
1135
        lpDDColorTable: pointer) : HResult; stdcall;
1136
    function SetEntries (dwFlags: DWORD; dwStartingEntry: DWORD;
1137
        dwCount: DWORD; lpEntries: pointer) : HResult; stdcall;
1 daniel-mar 1138
  end;
1139
 
4 daniel-mar 1140
(*
1141
 * IDirectDrawClipper
1142
 *)
1 daniel-mar 1143
 
4 daniel-mar 1144
  IDirectDrawClipper = interface (IUnknown)
1 daniel-mar 1145
    ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
4 daniel-mar 1146
    (*** IDirectDrawClipper methods ***)
1147
    function GetClipList (lpRect: PRect; lpClipList: PRgnData;
1148
        var lpdwSize: DWORD) : HResult; stdcall;
1149
    function GetHWnd (out lphWnd: HWND) : HResult; stdcall;
1150
    function Initialize (lpDD: IDirectDraw; dwFlags: DWORD) : HResult; stdcall;
1151
    function IsClipListChanged (out lpbChanged: BOOL) : HResult; stdcall;
1152
    function SetClipList (lpClipList: PRgnData; dwFlags: DWORD) : HResult; stdcall;
1153
    function SetHWnd (dwFlags: DWORD; hWnd: HWND) : HResult; stdcall;
1 daniel-mar 1154
  end;
1155
 
4 daniel-mar 1156
(*
1157
 * IDirectDrawSurface and related interfaces
1158
 *)
1 daniel-mar 1159
 
4 daniel-mar 1160
  IDirectDrawSurface = interface (IUnknown)
1 daniel-mar 1161
    ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
4 daniel-mar 1162
    (*** IDirectDrawSurface methods ***)
1163
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface) :
1164
        HResult; stdcall;
1165
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1166
    function Blt (lpDestRect: PRect;
1167
        lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
1168
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1169
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1170
        dwFlags: DWORD) : HResult; stdcall;
1171
    function BltFast (dwX: DWORD; dwY: DWORD;
1172
        lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
1173
        dwTrans: DWORD) : HResult; stdcall;
1174
    function DeleteAttachedSurface (dwFlags: DWORD;
1175
        lpDDSAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
1176
    function EnumAttachedSurfaces (lpContext: Pointer;
1177
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1178
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1179
        lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1180
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface;
1181
        dwFlags: DWORD) : HResult; stdcall;
1182
    function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
1183
        (*out*)var lplpDDAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
1184
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1185
    function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
1186
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1187
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1188
        HResult; stdcall;
1189
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1190
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1191
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1192
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1193
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1194
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1195
    function Initialize (lpDD: IDirectDraw;
1196
        out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1 daniel-mar 1197
    function IsLost: HResult; stdcall;
4 daniel-mar 1198
    function Lock (lpDestRect: PRect; out lpDDSurfaceDesc:
1199
        TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle) : HResult; stdcall;
1200
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1201
    function _Restore: HResult; stdcall;
1202
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1203
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1204
        HResult; stdcall;
1205
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1206
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1207
    function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
1208
    function UpdateOverlay (lpSrcRect: PRect;
1209
        lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect;
1210
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1211
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1212
    function UpdateOverlayZOrder (dwFlags: DWORD;
1213
        lpDDSReference: IDirectDrawSurface) : HResult; stdcall;
1 daniel-mar 1214
  end;
1215
 
4 daniel-mar 1216
(*
1217
 * IDirectDrawSurface2 and related interfaces
1218
 *)
1 daniel-mar 1219
 
4 daniel-mar 1220
  IDirectDrawSurface2 = interface (IUnknown)
1221
    ['{57805885-6eec-11cf-9441-a82303c10e27}']
1222
    (*** IDirectDrawSurface methods ***)
1223
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface2) :
1224
        HResult; stdcall;
1225
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1226
    function Blt (lpDestRect: PRect;
1227
        lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
1228
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1229
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1230
        dwFlags: DWORD) : HResult; stdcall;
1231
    function BltFast (dwX: DWORD; dwY: DWORD;
1232
        lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
1233
        dwTrans: DWORD) : HResult; stdcall;
1234
    function DeleteAttachedSurface (dwFlags: DWORD;
1235
        lpDDSAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
1236
    function EnumAttachedSurfaces (lpContext: Pointer;
1237
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1238
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1239
        lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1240
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface2;
1241
        dwFlags: DWORD) : HResult; stdcall;
1242
    function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
1243
        out lplpDDAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
1244
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1245
    function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
1246
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1247
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1248
        HResult; stdcall;
1249
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1250
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1251
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1252
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1253
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1254
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1255
    function Initialize (lpDD: IDirectDraw;
1256
        out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1 daniel-mar 1257
    function IsLost: HResult; stdcall;
4 daniel-mar 1258
    function Lock (lpDestRect: PRect;
1259
        out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
1260
        hEvent: THandle) : HResult; stdcall;
1261
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1262
    function _Restore: HResult; stdcall;
1263
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1264
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1265
        HResult; stdcall;
1266
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1267
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1268
    function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
1269
    function UpdateOverlay (lpSrcRect: PRect;
1270
        lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect;
1271
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1272
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1273
    function UpdateOverlayZOrder (dwFlags: DWORD;
1274
        lpDDSReference: IDirectDrawSurface2) : HResult; stdcall;
1275
    (*** Added in the v2 interface ***)
1276
    function GetDDInterface (var lplpDD: IDirectDraw) : HResult; stdcall;
1277
    function PageLock (dwFlags: DWORD) : HResult; stdcall;
1278
    function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 1279
  end;
1280
 
4 daniel-mar 1281
  IDirectDrawSurface3 = interface (IUnknown)
1 daniel-mar 1282
    ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']
4 daniel-mar 1283
    (*** IDirectDrawSurface methods ***)
1284
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface3) :
1285
        HResult; stdcall;
1286
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1287
    function Blt (lpDestRect: PRect;
1288
        lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
1289
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1290
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1291
        dwFlags: DWORD) : HResult; stdcall;
1292
    function BltFast (dwX: DWORD; dwY: DWORD;
1293
        lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
1294
        dwTrans: DWORD) : HResult; stdcall;
1295
    function DeleteAttachedSurface (dwFlags: DWORD;
1296
        lpDDSAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
1297
    function EnumAttachedSurfaces (lpContext: Pointer;
1298
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1299
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1300
        lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
1301
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface3;
1302
        dwFlags: DWORD) : HResult; stdcall;
1303
    function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
1304
        out lplpDDAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
1305
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1306
    function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
1307
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1308
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1309
        HResult; stdcall;
1310
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1311
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1312
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1313
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1314
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1315
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1316
    function Initialize (lpDD: IDirectDraw;
1317
        out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
1 daniel-mar 1318
    function IsLost: HResult; stdcall;
4 daniel-mar 1319
    function Lock (lpDestRect: PRect;
1320
        out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
1321
        hEvent: THandle) : HResult; stdcall;
1322
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1323
    function _Restore: HResult; stdcall;
1324
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1325
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1326
        HResult; stdcall;
1327
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1328
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1329
    function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
1330
    function UpdateOverlay (lpSrcRect: PRect;
1331
        lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect;
1332
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1333
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1334
    function UpdateOverlayZOrder (dwFlags: DWORD;
1335
        lpDDSReference: IDirectDrawSurface3) : HResult; stdcall;
1336
    (*** Added in the v2 interface ***)
1337
    function GetDDInterface (out lplpDD: IDirectDraw) : HResult; stdcall;
1338
    function PageLock (dwFlags: DWORD) : HResult; stdcall;
1339
    function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
1340
    (*** Added in the V3 interface ***)
1341
    function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 1342
  end;
1343
 
4 daniel-mar 1344
(*
1345
 * IDirectDrawSurface4 and related interfaces
1346
 *)
1347
  IDirectDrawSurface4 = interface (IUnknown)
1 daniel-mar 1348
    ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']
4 daniel-mar 1349
    (*** IDirectDrawSurface methods ***)
1350
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface4) :
1351
        HResult; stdcall;
1352
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1353
    function Blt (lpDestRect: PRect;
1354
        lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
1355
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1356
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1357
        dwFlags: DWORD) : HResult; stdcall;
1358
    function BltFast (dwX: DWORD; dwY: DWORD;
1359
        lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
1360
        dwTrans: DWORD) : HResult; stdcall;
1361
    function DeleteAttachedSurface (dwFlags: DWORD;
1362
        lpDDSAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
1363
    function EnumAttachedSurfaces (lpContext: Pointer;
1364
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
1365
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1366
        lpfnCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
1367
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface4;
1368
        dwFlags: DWORD) : HResult; stdcall;
1369
    function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
1370
        out lplpDDAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
1371
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1372
    function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
1373
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1374
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1375
        HResult; stdcall;
1376
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1377
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1378
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1379
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1380
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1381
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1382
    function Initialize (lpDD: IDirectDraw;
1383
        out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1 daniel-mar 1384
    function IsLost: HResult; stdcall;
4 daniel-mar 1385
    function Lock (lpDestRect: PRect;
1386
        out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
1387
        hEvent: THandle) : HResult; stdcall;
1388
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1389
    function _Restore: HResult; stdcall;
1390
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1391
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1392
        HResult; stdcall;
1393
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1394
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1395
    function Unlock (lpRect: PRect) : HResult; stdcall;
1396
    function UpdateOverlay (lpSrcRect: PRect;
1397
        lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect;
1398
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1399
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1400
    function UpdateOverlayZOrder (dwFlags: DWORD;
1401
        lpDDSReference: IDirectDrawSurface4) : HResult; stdcall;
1402
    (*** Added in the v2 interface ***)
1403
    function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
1404
    function PageLock (dwFlags: DWORD) : HResult; stdcall;
1405
    function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
1406
    (*** Added in the V3 interface ***)
1407
    function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
1408
    (*** Added in the v4 interface ***)
1409
    function SetPrivateData(const guidTag: TGUID; lpData: pointer;
1410
        cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
1411
    function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
1412
        var lpcbBufferSize: DWORD) : HResult; stdcall;
1413
    function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
1414
    function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
1415
    function ChangeUniquenessValue : HResult; stdcall;
1 daniel-mar 1416
  end;
1417
 
4 daniel-mar 1418
  IDirectDrawSurface7 = interface (IUnknown)
1419
    ['{06675a80-3b9b-11d2-b92f-00609797ea5b}']
1420
    (*** IDirectDrawSurface methods ***)
1421
    function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface7) :
1422
        HResult; stdcall;
1423
    function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
1424
    function Blt (lpDestRect: PRect;
1425
        lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
1426
        dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
1427
    function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
1428
        dwFlags: DWORD) : HResult; stdcall;
1429
    function BltFast (dwX: DWORD; dwY: DWORD;
1430
        lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
1431
        dwTrans: DWORD) : HResult; stdcall;
1432
    function DeleteAttachedSurface (dwFlags: DWORD;
1433
        lpDDSAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
1434
    function EnumAttachedSurfaces (lpContext: Pointer;
1435
        lpEnumSurfacesCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
1436
    function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
1437
        lpfnCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
1438
    function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface7;
1439
        dwFlags: DWORD) : HResult; stdcall;
1440
    function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
1441
        out lplpDDAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
1442
    function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
1443
    function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
1444
    function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1445
    function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
1446
        HResult; stdcall;
1447
    function GetDC (out lphDC: HDC) : HResult; stdcall;
1448
    function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
1449
    function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
1450
    function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1451
    function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
1452
    function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1453
    function Initialize (lpDD: IDirectDraw;
1454
        out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
1 daniel-mar 1455
    function IsLost: HResult; stdcall;
4 daniel-mar 1456
    function Lock (lpDestRect: PRect;
1457
        out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
1458
        hEvent: THandle) : HResult; stdcall;
1459
    function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
1460
    function _Restore: HResult; stdcall;
1461
    function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
1462
    function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
1463
        HResult; stdcall;
1464
    function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
1465
    function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
1466
    function Unlock (lpRect: PRect) : HResult; stdcall;
1467
    function UpdateOverlay (lpSrcRect: PRect;
1468
        lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect;
1469
        dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
1470
    function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
1471
    function UpdateOverlayZOrder (dwFlags: DWORD;
1472
        lpDDSReference: IDirectDrawSurface7) : HResult; stdcall;
1473
    (*** Added in the v2 interface ***)
1474
    function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
1475
    function PageLock (dwFlags: DWORD) : HResult; stdcall;
1476
    function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
1477
    (*** Added in the V3 interface ***)
1478
    function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
1479
    (*** Added in the v4 interface ***)
1480
    function SetPrivateData(const guidTag: TGUID; lpData: pointer;
1481
        cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
1482
    function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
1483
        var lpcbBufferSize: DWORD) : HResult; stdcall;
1484
    function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
1485
    function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
1486
    function ChangeUniquenessValue : HResult; stdcall;
1487
    (*** Moved Texture7 methods here ***)
1488
    function SetPriority(dwPriority: DWORD) : HResult; stdcall;
1489
    function GetPriority(out lpdwPriority: DWORD) : HResult; stdcall;
1490
    function SetLOD(dwMaxLOD: DWORD) : HResult; stdcall;
1491
    function GetLOD(out lpdwMaxLOD: DWORD) : HResult; stdcall;
1 daniel-mar 1492
  end;
1493
 
4 daniel-mar 1494
  IDirectDrawColorControl = interface (IUnknown)
1 daniel-mar 1495
    ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
4 daniel-mar 1496
    function GetColorControls(out lpColorControl: TDDColorControl) : HResult; stdcall;
1497
    function SetColorControls(const lpColorControl: TDDColorControl) : HResult; stdcall;
1 daniel-mar 1498
  end;
1499
 
4 daniel-mar 1500
(*
1501
 * IDirectDrawGammaControl
1502
 *)
1503
  IDirectDrawGammaControl = interface (IUnknown)
1 daniel-mar 1504
    ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
4 daniel-mar 1505
    function GetGammaRamp (dwFlags: DWORD; out lpRampData: TDDGammaRamp)
1506
        : HResult; stdcall;
1507
    function SetGammaRamp (dwFlags: DWORD; const lpRampData: TDDGammaRamp)
1508
        : HResult; stdcall;
1 daniel-mar 1509
  end;
1510
 
4 daniel-mar 1511
type
1512
  IID_IDirectDraw = IDirectDraw;
1513
  IID_IDirectDraw2 = IDirectDraw2;
1514
  IID_IDirectDraw4 = IDirectDraw4;
1515
  IID_IDirectDraw7 = IDirectDraw7;
1516
  IID_IDirectDrawSurface = IDirectDrawSurface;
1517
  IID_IDirectDrawSurface2 = IDirectDrawSurface2;
1518
  IID_IDirectDrawSurface3 = IDirectDrawSurface3;
1519
  IID_IDirectDrawSurface4 = IDirectDrawSurface4;
1520
  IID_IDirectDrawSurface7 = IDirectDrawSurface7;
1 daniel-mar 1521
 
4 daniel-mar 1522
  IID_IDirectDrawPalette = IDirectDrawPalette;
1523
  IID_IDirectDrawClipper = IDirectDrawClipper;
1524
  IID_IDirectDrawColorControl = IDirectDrawColorControl;
1525
  IID_IDirectDrawGammaControl = IDirectDrawGammaControl;
1 daniel-mar 1526
 
4 daniel-mar 1527
const  
1528
(*
1529
 * ddsCaps field is valid.
1530
 *)
1 daniel-mar 1531
  DDSD_CAPS               = $00000001;     // default
4 daniel-mar 1532
 
1533
(*
1534
 * dwHeight field is valid.
1535
 *)
1 daniel-mar 1536
  DDSD_HEIGHT             = $00000002;
4 daniel-mar 1537
 
1538
(*
1539
 * dwWidth field is valid.
1540
 *)
1 daniel-mar 1541
  DDSD_WIDTH              = $00000004;
4 daniel-mar 1542
 
1543
(*
1544
 * lPitch is valid.
1545
 *)
1 daniel-mar 1546
  DDSD_PITCH              = $00000008;
4 daniel-mar 1547
 
1548
(*
1549
 * dwBackBufferCount is valid.
1550
 *)
1 daniel-mar 1551
  DDSD_BACKBUFFERCOUNT    = $00000020;
4 daniel-mar 1552
 
1553
(*
1554
 * dwZBufferBitDepth is valid.  (shouldnt be used in DDSURFACEDESC2)
1555
 *)
1 daniel-mar 1556
  DDSD_ZBUFFERBITDEPTH    = $00000040;
4 daniel-mar 1557
 
1558
(*
1559
 * dwAlphaBitDepth is valid.
1560
 *)
1561
   DDSD_ALPHABITDEPTH      = $00000080;
1562
 
1563
(*
1564
 * lpSurface is valid.
1565
 *)
1566
  DDSD_LPSURFACE           = $00000800;
1567
 
1568
(*
1569
 * ddpfPixelFormat is valid.
1570
 *)
1 daniel-mar 1571
  DDSD_PIXELFORMAT        = $00001000;
4 daniel-mar 1572
 
1573
(*
1574
 * ddckCKDestOverlay is valid.
1575
 *)
1 daniel-mar 1576
  DDSD_CKDESTOVERLAY      = $00002000;
4 daniel-mar 1577
 
1578
(*
1579
 * ddckCKDestBlt is valid.
1580
 *)
1 daniel-mar 1581
  DDSD_CKDESTBLT          = $00004000;
4 daniel-mar 1582
 
1583
(*
1584
 * ddckCKSrcOverlay is valid.
1585
 *)
1 daniel-mar 1586
  DDSD_CKSRCOVERLAY       = $00008000;
4 daniel-mar 1587
 
1588
(*
1589
 * ddckCKSrcBlt is valid.
1590
 *)
1 daniel-mar 1591
  DDSD_CKSRCBLT           = $00010000;
4 daniel-mar 1592
 
1593
(*
1594
 * dwMipMapCount is valid.
1595
 *)
1 daniel-mar 1596
  DDSD_MIPMAPCOUNT        = $00020000;
4 daniel-mar 1597
 
1598
 (*
1599
  * dwRefreshRate is valid
1600
  *)
1 daniel-mar 1601
  DDSD_REFRESHRATE        = $00040000;
4 daniel-mar 1602
 
1603
(*
1604
 * dwLinearSize is valid
1605
 *)
1606
  DDSD_LINEARSIZE         = $00080000;
1607
 
1608
(*
1609
 * dwTextureStage is valid
1610
 *)
1 daniel-mar 1611
  DDSD_TEXTURESTAGE       = $00100000;
1612
 
4 daniel-mar 1613
(*
1614
 * All input fields are valid.
1615
 *)
1616
  DDSD_ALL                = $001ff9ee;
1 daniel-mar 1617
 
1618
 
4 daniel-mar 1619
(*
1620
 * guid field is valid.
1621
 *)
1622
  DDOSD_GUID                  = $00000001;
1 daniel-mar 1623
 
4 daniel-mar 1624
(*
1625
 * dwCompressionRatio field is valid.
1626
 *)
1627
  DDOSD_COMPRESSION_RATIO     = $00000002;
1 daniel-mar 1628
 
4 daniel-mar 1629
(*
1630
 * ddSCaps field is valid.
1631
 *)
1632
  DDOSD_SCAPS                 = $00000004;
1 daniel-mar 1633
 
4 daniel-mar 1634
(*
1635
 * ddOSCaps field is valid.
1636
 *)
1637
  DDOSD_OSCAPS                = $00000008;
1 daniel-mar 1638
 
4 daniel-mar 1639
(*
1640
 * All input fields are valid.
1641
 *)
1642
  DDOSD_ALL                   = $0000000f;
1 daniel-mar 1643
 
4 daniel-mar 1644
(*
1645
 * The surface's optimized pixelformat is compressed
1646
 *)
1647
  DDOSDCAPS_OPTCOMPRESSED                       = $00000001;
1 daniel-mar 1648
 
4 daniel-mar 1649
(*
1650
 * The surface's optimized pixelformat is reordered
1651
 *)
1652
  DDOSDCAPS_OPTREORDERED                        = $00000002;
1 daniel-mar 1653
 
4 daniel-mar 1654
(*
1655
 * The opt surface is a monolithic mipmap
1656
 *)
1657
  DDOSDCAPS_MONOLITHICMIPMAP            = $00000004;
1 daniel-mar 1658
 
4 daniel-mar 1659
(*
1660
 * The valid Surf caps:
1661
 *   DDSCAPS_SYSTEMMEMORY       = $00000800;
1662
 *   DDSCAPS_VIDEOMEMORY        = $00004000;
1663
 *   DDSCAPS_LOCALVIDMEM        = $10000000;
1664
 *   DDSCAPS_NONLOCALVIDMEM     = $20000000;
1665
 *)
1666
  DDOSDCAPS_VALIDSCAPS          = $30004800;
1 daniel-mar 1667
 
4 daniel-mar 1668
(*
1669
 * The valid OptSurf caps
1670
 *)
1671
  DDOSDCAPS_VALIDOSCAPS                 = $00000007;
1 daniel-mar 1672
 
1673
 
4 daniel-mar 1674
(*
1675
 * DDCOLORCONTROL
1676
 *)
1 daniel-mar 1677
 
4 daniel-mar 1678
(*
1679
 * lBrightness field is valid.
1680
 *)
1681
  DDCOLOR_BRIGHTNESS            = $00000001;
1 daniel-mar 1682
 
4 daniel-mar 1683
(*
1684
 * lContrast field is valid.
1685
 *)
1686
  DDCOLOR_CONTRAST              = $00000002;
1687
 
1688
(*
1689
 * lHue field is valid.
1690
 *)
1691
  DDCOLOR_HUE                   = $00000004;
1692
 
1693
(*
1694
 * lSaturation field is valid.
1695
 *)
1696
  DDCOLOR_SATURATION            = $00000008;
1697
 
1698
(*
1699
 * lSharpness field is valid.
1700
 *)
1701
  DDCOLOR_SHARPNESS             = $00000010;
1702
 
1703
(*
1704
 * lGamma field is valid.
1705
 *)
1706
  DDCOLOR_GAMMA                 = $00000020;
1707
 
1708
(*
1709
 * lColorEnable field is valid.
1710
 *)
1711
  DDCOLOR_COLORENABLE           = $00000040;
1712
 
1713
 
1714
 
1715
(*============================================================================
1716
 *
1717
 * Direct Draw Capability Flags
1718
 *
1719
 * These flags are used to describe the capabilities of a given Surface.
1720
 * All flags are bit flags.
1721
 *
1722
 *==========================================================================*)
1723
 
1724
(****************************************************************************
1725
 *
1726
 * DIRECTDRAWSURFACE CAPABILITY FLAGS
1727
 *
1728
 ****************************************************************************)
1729
(*
1730
 * This bit currently has no meaning.
1731
 *)
1732
  DDSCAPS_RESERVED1                       = $00000001;
1733
 
1734
(*
1735
 * Indicates that this surface contains alpha-only information.
1736
 * (To determine if a surface is RGBA/YUVA, the pixel format must be
1737
 * interrogated.)
1738
 *)
1739
  DDSCAPS_ALPHA                           = $00000002;
1740
 
1741
(*
1742
 * Indicates that this surface is a backbuffer.  It is generally
1743
 * set by CreateSurface when the DDSCAPS_FLIP capability bit is set.
1744
 * It indicates that this surface is THE back buffer of a surface
1745
 * flipping structure.  DirectDraw supports N surfaces in a
1746
 * surface flipping structure.  Only the surface that immediately
1747
 * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set.
1748
 * The other surfaces are identified as back buffers by the presence
1749
 * of the DDSCAPS_FLIP capability, their attachment order, and the
1750
 * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER
1751
 * capabilities.  The bit is sent to CreateSurface when a standalone
1752
 * back buffer is being created.  This surface could be attached to
1753
 * a front buffer and/or back buffers to form a flipping surface
1754
 * structure after the CreateSurface call.  See AddAttachments for
1755
 * a detailed description of the behaviors in this case.
1756
 *)
1757
  DDSCAPS_BACKBUFFER                      = $00000004;
1758
 
1759
(*
1760
 * Indicates a complex surface structure is being described.  A
1761
 * complex surface structure results in the creation of more than
1762
 * one surface.  The additional surfaces are attached to the root
1763
 * surface.  The complex structure can only be destroyed by
1764
 * destroying the root.
1765
 *)
1766
  DDSCAPS_COMPLEX                         = $00000008;
1767
 
1768
(*
1769
 * Indicates that this surface is a part of a surface flipping structure.
1770
 * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and
1771
 * DDSCAP_BACKBUFFER bits are not set.  They are set by CreateSurface
1772
 * on the resulting creations.  The dwBackBufferCount field in the
1773
 * TDDSurfaceDesc structure must be set to at least 1 in order for
1774
 * the CreateSurface call to succeed.  The DDSCAPS_COMPLEX capability
1775
 * must always be set with creating multiple surfaces through CreateSurface.
1776
 *)
1777
  DDSCAPS_FLIP                            = $00000010;
1778
 
1779
(*
1780
 * Indicates that this surface is THE front buffer of a surface flipping
1781
 * structure.  It is generally set by CreateSurface when the DDSCAPS_FLIP
1782
 * capability bit is set.
1783
 * If this capability is sent to CreateSurface then a standalonw front buffer
1784
 * is created.  This surface will not have the DDSCAPS_FLIP capability.
1785
 * It can be attached to other back buffers to form a flipping structure.
1786
 * See AddAttachments for a detailed description of the behaviors in this
1787
 * case.
1788
 *)
1789
  DDSCAPS_FRONTBUFFER                     = $00000020;
1790
 
1791
(*
1792
 * Indicates that this surface is any offscreen surface that is not an overlay,
1793
 * texture, zbuffer, front buffer, back buffer, or alpha surface.  It is used
1794
 * to identify plain vanilla surfaces.
1795
 *)
1796
  DDSCAPS_OFFSCREENPLAIN                  = $00000040;
1797
 
1798
(*
1799
 * Indicates that this surface is an overlay.  It may or may not be directly visible
1800
 * depending on whether or not it is currently being overlayed onto the primary
1801
 * surface.  DDSCAPS_VISIBLE can be used to determine whether or not it is being
1802
 * overlayed at the moment.
1803
 *)
1804
  DDSCAPS_OVERLAY                         = $00000080;
1805
 
1806
(*
1807
 * Indicates that unique DirectDrawPalette objects can be created and
1808
 * attached to this surface.
1809
 *)
1810
  DDSCAPS_PALETTE                         = $00000100;
1811
 
1812
(*
1813
 * Indicates that this surface is the primary surface.  The primary
1814
 * surface represents what the user is seeing at the moment.
1815
 *)
1816
  DDSCAPS_PRIMARYSURFACE                  = $00000200;
1817
 
1818
(*
1819
 * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now
1820
 * obsolete.
1821
 *)
1822
  DDSCAPS_RESERVED3              = $00000400;
1823
(*
1824
 * Indicates that this surface is the primary surface for the left eye.
1825
 * The primary surface for the left eye represents what the user is seeing
1826
 * at the moment with the users left eye.  When this surface is created the
1827
 * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users
1828
 * right eye.
1829
 *)
1830
  DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3;
1831
 
1832
(*
1833
 * Indicates that this surface memory was allocated in system memory
1834
 *)
1835
  DDSCAPS_SYSTEMMEMORY                    = $00000800;
1836
 
1837
(*
1838
 * Indicates that this surface can be used as a 3D texture.  It does not
1839
 * indicate whether or not the surface is being used for that purpose.
1840
 *)
1841
  DDSCAPS_TEXTURE                         = $00001000;
1842
 
1843
(*
1844
 * Indicates that a surface may be a destination for 3D rendering.  This
1845
 * bit must be set in order to query for a Direct3D Device Interface
1846
 * from this surface.
1847
 *)
1848
  DDSCAPS_3DDEVICE                        = $00002000;
1849
 
1850
(*
1851
 * Indicates that this surface exists in video memory.
1852
 *)
1853
  DDSCAPS_VIDEOMEMORY                     = $00004000;
1854
 
1855
(*
1856
 * Indicates that changes made to this surface are immediately visible.
1857
 * It is always set for the primary surface and is set for overlays while
1858
 * they are being overlayed and texture maps while they are being textured.
1859
 *)
1860
  DDSCAPS_VISIBLE                         = $00008000;
1861
 
1862
(*
1863
 * Indicates that only writes are permitted to the surface.  Read accesses
1864
 * from the surface may or may not generate a protection fault, but the
1865
 * results of a read from this surface will not be meaningful.  READ ONLY.
1866
 *)
1867
  DDSCAPS_WRITEONLY                       = $00010000;
1868
 
1869
(*
1870
 * Indicates that this surface is a z buffer. A z buffer does not contain
1871
 * displayable information.  Instead it contains bit depth information that is
1872
 * used to determine which pixels are visible and which are obscured.
1873
 *)
1874
  DDSCAPS_ZBUFFER                         = $00020000;
1875
 
1876
(*
1877
 * Indicates surface will have a DC associated long term
1878
 *)
1879
  DDSCAPS_OWNDC                           = $00040000;
1880
 
1881
(*
1882
 * Indicates surface should be able to receive live video
1883
 *)
1884
  DDSCAPS_LIVEVIDEO                       = $00080000;
1885
 
1886
(*
1887
 * Indicates surface should be able to have a stream decompressed
1888
 * to it by the hardware.
1889
 *)
1890
  DDSCAPS_HWCODEC                         = $00100000;
1891
 
1892
(*
1893
 * Surface is a ModeX surface.
1894
 *
1895
 *)
1896
  DDSCAPS_MODEX                           = $00200000;
1897
 
1898
(*
1899
 * Indicates surface is one level of a mip-map. This surface will
1900
 * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map.
1901
 * This can be done explicitly, by creating a number of surfaces and
1902
 * attaching them with AddAttachedSurface or by implicitly by CreateSurface.
1903
 * If this bit is set then DDSCAPS_TEXTURE must also be set.
1904
 *)
1905
  DDSCAPS_MIPMAP                          = $00400000;
1906
 
1907
(*
1908
 * This bit is reserved. It should not be specified.
1909
 *)
1910
  DDSCAPS_RESERVED2                       = $00800000;
1911
 
1912
(*
1913
 * Indicates that memory for the surface is not allocated until the surface
1914
 * is loaded (via the Direct3D texture Load() function).
1915
 *)
1916
  DDSCAPS_ALLOCONLOAD                     = $04000000;
1917
 
1918
(*
1919
 * Indicates that the surface will recieve data from a video port.
1920
 *)
1921
  DDSCAPS_VIDEOPORT                       = $08000000;
1922
 
1923
(*
1924
 * Indicates that a video memory surface is resident in true, local video
1925
 * memory rather than non-local video memory. If this flag is specified then
1926
 * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
1927
 * DDSCAPS_NONLOCALVIDMEM.
1928
 *)
1929
  DDSCAPS_LOCALVIDMEM                     = $10000000;
1930
 
1931
(*
1932
 * Indicates that a video memory surface is resident in non-local video
1933
 * memory rather than true, local video memory. If this flag is specified
1934
 * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
1935
 * DDSCAPS_LOCALVIDMEM.
1936
 *)
1937
  DDSCAPS_NONLOCALVIDMEM                  = $20000000;
1938
 
1939
(*
1940
 * Indicates that this surface is a standard VGA mode surface, and not a
1941
 * ModeX surface. (This flag will never be set in combination with the
1942
 * DDSCAPS_MODEX flag).
1943
 *)
1944
  DDSCAPS_STANDARDVGAMODE                 = $40000000;
1945
 
1946
(*
1947
 * Indicates that this surface will be an optimized surface. This flag is
1948
 * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface
1949
 * will be created without any underlying video memory until loaded.
1950
 *)
1951
  DDSCAPS_OPTIMIZED                       = $80000000;
1952
 
1953
 
1954
 
1955
(*
1956
 * Indicates that this surface will receive data from a video port using
1957
 * the de-interlacing hardware.  This allows the driver to allocate memory
1958
 * for any extra buffers that may be required.  The DDSCAPS_VIDEOPORT and
1959
 * DDSCAPS_OVERLAY flags must also be set.
1960
 *)
1961
  DDSCAPS2_HARDWAREDEINTERLACE            = $00000002;
1962
 
1963
(*
1964
 * Indicates to the driver that this surface will be locked very frequently
1965
 * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap
1966
 * set must also have DDSCAPS_TEXTURE. This cap cannot be used with
1967
 * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE.
1968
 *)
1969
  DDSCAPS2_HINTDYNAMIC                  = $00000004;
1970
 
1971
(*
1972
 * Indicates to the driver that this surface can be re-ordered/retiled on
1973
 * load. This operation will not change the size of the texture. It is
1974
 * relatively fast and symmetrical, since the application may lock these
1975
 * bits (although it will take a performance hit when doing so). Surfaces
1976
 * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be
1977
 * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE.
1978
 *)
1979
  DDSCAPS2_HINTSTATIC                   = $00000008;
1980
 
1981
(*
1982
 * Indicates that the client would like this texture surface to be managed by the
1983
 * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have
1984
 * DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY.
1985
 *)
1986
  DDSCAPS2_TEXTUREMANAGE                  = $00000010;
1987
 
1988
(*
1989
 * These bits are reserved for internal use *)
1990
  DDSCAPS2_RESERVED1                      = $00000020;
1991
  DDSCAPS2_RESERVED2                      = $00000040;
1992
 
1993
(*
1994
 * Indicates to the driver that this surface will never be locked again.
1995
 * The driver is free to optimize this surface via retiling and actual compression.
1996
 * All calls to Lock() or Blts from this surface will fail. Surfaces with this
1997
 * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with
1998
 * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC.
1999
 *)
2000
  DDSCAPS2_OPAQUE                         = $00000080;
2001
 
2002
(*
2003
 * Applications should set this bit at CreateSurface time to indicate that they
2004
 * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set.
2005
 *)
2006
  DDSCAPS2_HINTANTIALIASING               = $00000100;
2007
 
2008
(*
2009
 * This flag is used at CreateSurface time to indicate that this set of
2010
 * surfaces is a cubic environment map
2011
 *)
2012
  DDSCAPS2_CUBEMAP                        = $00000200;
2013
 
2014
(*
2015
 * These flags preform two functions:
2016
 * - At CreateSurface time, they define which of the six cube faces are
2017
 *   required by the application.
2018
 * - After creation, each face in the cubemap will have exactly one of these
2019
 *   bits set.
2020
 *)
2021
  DDSCAPS2_CUBEMAP_POSITIVEX              = $00000400;
2022
  DDSCAPS2_CUBEMAP_NEGATIVEX              = $00000800;
2023
  DDSCAPS2_CUBEMAP_POSITIVEY              = $00001000;
2024
  DDSCAPS2_CUBEMAP_NEGATIVEY              = $00002000;
2025
  DDSCAPS2_CUBEMAP_POSITIVEZ              = $00004000;
2026
  DDSCAPS2_CUBEMAP_NEGATIVEZ              = $00008000;
2027
 
2028
(*
2029
 * This macro may be used to specify all faces of a cube map at CreateSurface time
2030
 *)
2031
  DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or
2032
                                DDSCAPS2_CUBEMAP_NEGATIVEX or
2033
                                DDSCAPS2_CUBEMAP_POSITIVEY or
2034
                                DDSCAPS2_CUBEMAP_NEGATIVEY or
2035
                                DDSCAPS2_CUBEMAP_POSITIVEZ or
2036
                                DDSCAPS2_CUBEMAP_NEGATIVEZ );
2037
 
2038
 
2039
(*
2040
 * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards
2041
 * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface
2042
 * constructs such as Cube Maps, wherein there are more than one mipmap surface attached
2043
 * to the root surface.
2044
 * This caps bit is ignored by CreateSurface
2045
 *)
2046
  DDSCAPS2_MIPMAPSUBLEVEL                 = $00010000;
2047
 
2048
(* This flag indicates that the texture should be managed by D3D only *)
2049
  DDSCAPS2_D3DTEXTUREMANAGE               = $00020000;
2050
 
2051
(* This flag indicates that the managed surface can be safely lost *)
2052
  DDSCAPS2_DONOTPERSIST                   = $00040000;
2053
 
2054
(* indicates that this surface is part of a stereo flipping chain *)
2055
  DDSCAPS2_STEREOSURFACELEFT              = $00080000;
2056
 
2057
 
2058
 
2059
 (****************************************************************************
2060
 *
2061
 * DIRECTDRAW DRIVER CAPABILITY FLAGS
2062
 *
2063
 ****************************************************************************)
2064
 
2065
(*
2066
 * Display hardware has 3D acceleration.
2067
 *)
2068
  DDCAPS_3D                       = $00000001;
2069
 
2070
(*
2071
 * Indicates that DirectDraw will support only dest rectangles that are aligned
2072
 * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively.
2073
 * READ ONLY.
2074
 *)
2075
  DDCAPS_ALIGNBOUNDARYDEST        = $00000002;
2076
 
2077
(*
2078
 * Indicates that DirectDraw will support only source rectangles  whose sizes in
2079
 * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively.  READ ONLY.
2080
 *)
2081
  DDCAPS_ALIGNSIZEDEST            = $00000004;
2082
(*
2083
 * Indicates that DirectDraw will support only source rectangles that are aligned
2084
 * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively.
2085
 * READ ONLY.
2086
 *)
2087
  DDCAPS_ALIGNBOUNDARYSRC         = $00000008;
2088
 
2089
(*
2090
 * Indicates that DirectDraw will support only source rectangles  whose sizes in
2091
 * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively.  READ ONLY.
2092
 *)
2093
  DDCAPS_ALIGNSIZESRC             = $00000010;
2094
 
2095
(*
2096
 * Indicates that DirectDraw will create video memory surfaces that have a stride
2097
 * alignment equal to DIRECTDRAWCAPS.dwAlignStride.  READ ONLY.
2098
 *)
2099
  DDCAPS_ALIGNSTRIDE              = $00000020;
2100
 
2101
(*
2102
 * Display hardware is capable of blt operations.
2103
 *)
2104
  DDCAPS_BLT                      = $00000040;
2105
 
2106
(*
2107
 * Display hardware is capable of asynchronous blt operations.
2108
 *)
2109
  DDCAPS_BLTQUEUE                 = $00000080;
2110
 
2111
(*
2112
 * Display hardware is capable of color space conversions during the blt operation.
2113
 *)
2114
  DDCAPS_BLTFOURCC                = $00000100;
2115
 
2116
(*
2117
 * Display hardware is capable of stretching during blt operations.
2118
 *)
2119
  DDCAPS_BLTSTRETCH               = $00000200;
2120
 
2121
(*
2122
 * Display hardware is shared with GDI.
2123
 *)
2124
  DDCAPS_GDI                      = $00000400;
2125
 
2126
(*
2127
 * Display hardware can overlay.
2128
 *)
2129
  DDCAPS_OVERLAY                  = $00000800;
2130
 
2131
(*
2132
 * Set if display hardware supports overlays but can not clip them.
2133
 *)
2134
  DDCAPS_OVERLAYCANTCLIP          = $00001000;
2135
 
2136
(*
2137
 * Indicates that overlay hardware is capable of color space conversions during
2138
 * the overlay operation.
2139
 *)
2140
  DDCAPS_OVERLAYFOURCC            = $00002000;
2141
 
2142
(*
2143
 * Indicates that stretching can be done by the overlay hardware.
2144
 *)
2145
  DDCAPS_OVERLAYSTRETCH           = $00004000;
2146
 
2147
(*
2148
 * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces
2149
 * other than the primary surface.
2150
 *)
2151
  DDCAPS_PALETTE                  = $00008000;
2152
 
2153
(*
2154
 * Indicates that palette changes can be syncd with the veritcal refresh.
2155
 *)
2156
  DDCAPS_PALETTEVSYNC             = $00010000;
2157
 
2158
(*
2159
 * Display hardware can return the current scan line.
2160
 *)
2161
  DDCAPS_READSCANLINE             = $00020000;
2162
 
2163
(*
2164
 * Display hardware has stereo vision capabilities.  DDSCAPS_PRIMARYSURFACELEFT
2165
 * can be created.
2166
 *)
2167
  DDCAPS_STEREOVIEW               = $00040000;
2168
 
2169
(*
2170
 * Display hardware is capable of generating a vertical blank interrupt.
2171
 *)
2172
  DDCAPS_VBI                      = $00080000;
2173
 
2174
(*
2175
 * Supports the use of z buffers with blt operations.
2176
 *)
2177
  DDCAPS_ZBLTS                    = $00100000;
2178
 
2179
(*
2180
 * Supports Z Ordering of overlays.
2181
 *)
2182
  DDCAPS_ZOVERLAYS                = $00200000;
2183
 
2184
(*
2185
 * Supports color key
2186
 *)
2187
  DDCAPS_COLORKEY                 = $00400000;
2188
 
2189
(*
2190
 * Supports alpha surfaces
2191
 *)
2192
  DDCAPS_ALPHA                    = $00800000;
2193
 
2194
(*
2195
 * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set)
2196
 *)
2197
  DDCAPS_COLORKEYHWASSIST         = $01000000;
2198
 
2199
(*
2200
 * no hardware support at all
2201
 *)
2202
  DDCAPS_NOHARDWARE               = $02000000;
2203
 
2204
(*
2205
 * Display hardware is capable of color fill with bltter
2206
 *)
2207
  DDCAPS_BLTCOLORFILL             = $04000000;
2208
 
2209
(*
2210
 * Display hardware is bank switched, and potentially very slow at
2211
 * random access to VRAM.
2212
 *)
2213
  DDCAPS_BANKSWITCHED             = $08000000;
2214
 
2215
(*
2216
 * Display hardware is capable of depth filling Z-buffers with bltter
2217
 *)
2218
  DDCAPS_BLTDEPTHFILL             = $10000000;
2219
 
2220
(*
2221
 * Display hardware is capable of clipping while bltting.
2222
 *)
2223
  DDCAPS_CANCLIP                  = $20000000;
2224
 
2225
(*
2226
 * Display hardware is capable of clipping while stretch bltting.
2227
 *)
2228
  DDCAPS_CANCLIPSTRETCHED         = $40000000;
2229
 
2230
(*
2231
 * Display hardware is capable of bltting to or from system memory
2232
 *)
2233
  DDCAPS_CANBLTSYSMEM             = $80000000;
2234
 
2235
 
2236
 (****************************************************************************
2237
 *
2238
 * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2)
2239
 *
2240
 ****************************************************************************)
2241
 
2242
(*
2243
 * Display hardware is certified
2244
 *)
2245
  DDCAPS2_CERTIFIED               = $00000001;
2246
 
2247
(*
2248
 * Driver cannot interleave 2D operations (lock and blt) to surfaces with
2249
 * Direct3D rendering operations between calls to BeginScene() and EndScene()
2250
 *)
2251
  DDCAPS2_NO2DDURING3DSCENE       = $00000002;
2252
 
2253
(*
2254
 * Display hardware contains a video port
2255
 *)
2256
  DDCAPS2_VIDEOPORT               = $00000004;
2257
 
2258
(*
2259
 * The overlay can be automatically flipped according to the video port
2260
 * VSYNCs, providing automatic doubled buffered display of video port
2261
 * data using an overlay
2262
 *)
2263
  DDCAPS2_AUTOFLIPOVERLAY         = $00000008;
2264
 
2265
(*
2266
 * Overlay can display each field of interlaced data individually while
2267
 * it is interleaved in memory without causing jittery artifacts.
2268
 *)
2269
  DDCAPS2_CANBOBINTERLEAVED     = $00000010;
2270
 
2271
(*
2272
 * Overlay can display each field of interlaced data individually while
2273
 * it is not interleaved in memory without causing jittery artifacts.
2274
 *)
2275
  DDCAPS2_CANBOBNONINTERLEAVED  = $00000020;
2276
 
2277
(*
2278
 * The overlay surface contains color controls (brightness, sharpness, etc.)
2279
 *)
2280
  DDCAPS2_COLORCONTROLOVERLAY   = $00000040;
2281
 
2282
(*
2283
 * The primary surface contains color controls (gamma, etc.)
2284
 *)
2285
  DDCAPS2_COLORCONTROLPRIMARY   = $00000080;
2286
 
2287
(*
2288
 * RGBZ -> RGB supported for 16:16 RGB:Z
2289
 *)
2290
  DDCAPS2_CANDROPZ16BIT         = $00000100;
2291
 
2292
(*
2293
 * Driver supports non-local video memory.
2294
 *)
2295
  DDCAPS2_NONLOCALVIDMEM          = $00000200;
2296
 
2297
(*
2298
 * Dirver supports non-local video memory but has different capabilities for
2299
 * non-local video memory surfaces. If this bit is set then so must
2300
 * DDCAPS2_NONLOCALVIDMEM.
2301
 *)
2302
  DDCAPS2_NONLOCALVIDMEMCAPS      = $00000400;
2303
 
2304
(*
2305
 * Driver neither requires nor prefers surfaces to be pagelocked when performing
2306
 * blts involving system memory surfaces
2307
 *)
2308
  DDCAPS2_NOPAGELOCKREQUIRED      = $00000800;
2309
 
2310
(*
2311
 * Driver can create surfaces which are wider than the primary surface
2312
 *)
2313
  DDCAPS2_WIDESURFACES            = $00001000;
2314
 
2315
(*
2316
 * Driver supports bob without using a video port by handling the
2317
 * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip.
2318
 *)
2319
  DDCAPS2_CANFLIPODDEVEN          = $00002000;
2320
 
2321
(*
2322
 * Driver supports bob using hardware
2323
 *)
2324
  DDCAPS2_CANBOBHARDWARE          = $00004000;
2325
 
2326
(*
2327
 * Driver supports bltting any FOURCC surface to another surface of the same FOURCC
2328
 *)
2329
  DDCAPS2_COPYFOURCC              = $00008000;
2330
 
2331
 
2332
(*
2333
 * Driver supports loadable gamma ramps for the primary surface
2334
 *)
2335
  DDCAPS2_PRIMARYGAMMA            = $00020000;
2336
 
2337
(*
2338
 * Driver can render in windowed mode.
2339
 *)
2340
  DDCAPS2_CANRENDERWINDOWED       = $00080000;
2341
 
2342
(*
2343
 * A calibrator is available to adjust the gamma ramp according to the
2344
 * physical display properties so that the result will be identical on
2345
 * all calibrated systems.
2346
 *)
2347
  DDCAPS2_CANCALIBRATEGAMMA       = $00100000;
2348
 
2349
(*
2350
 * Indicates that the driver will respond to DDFLIP_INTERVALn flags
2351
 *)
2352
  DDCAPS2_FLIPINTERVAL            = $00200000;
2353
 
2354
(*
2355
 * Indicates that the driver will respond to DDFLIP_NOVSYNC
2356
 *)
2357
   DDCAPS2_FLIPNOVSYNC             = $00400000;
2358
 
2359
(*
2360
 * Driver supports management of video memory, if this flag is ON,
2361
 * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on
2362
 * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on
2363
 *)
2364
  DDCAPS2_CANMANAGETEXTURE        = $00800000;
2365
 
2366
(*
2367
 * The Direct3D texture manager uses this cap to decide whether to put managed
2368
 * surfaces in non-local video memory. If the cap is set, the texture manager will
2369
 * put managed surfaces in non-local vidmem. Drivers that cannot texture from
2370
 * local vidmem SHOULD NOT set this cap.
2371
 *)
2372
  DDCAPS2_TEXMANINNONLOCALVIDMEM  = $01000000;
2373
 
2374
(*
2375
 * Indicates that the driver supports DX7 type of stereo in at least one mode (which may
2376
 * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher)
2377
 * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of
2378
 * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application
2379
 * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode.
2380
 *)
2381
  DDCAPS2_STEREO                  = $02000000;
2382
 
2383
(*
2384
 * This caps bit is intended for internal DirectDraw use.
2385
 * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set.
2386
 * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and
2387
 *  all the assoicated system memory blt caps must be correct).
2388
 * -It implies that the system->video blt caps in DDCAPS also apply to system to
2389
 *  nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops
2390
 *  members of DDCAPS (DDCORECAPS) are filled in correctly.
2391
 * -Any blt from system to nonlocal memory that matches these caps bits will
2392
 *  be passed to the driver.
2393
 *
2394
 * NOTE: This is intended to enable the driver itself to do efficient reordering
2395
 * of textures. This is NOT meant to imply that hardware can write into AGP memory.
2396
 * This operation is not currently supported.
2397
 *)
2398
  DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL   = $04000000;
2399
 
2400
(****************************************************************************
2401
 *
2402
 * DIRECTDRAW FX ALPHA CAPABILITY FLAGS
2403
 *
2404
 ****************************************************************************)
2405
 
2406
(*
2407
 * Supports alpha blending around the edge of a source color keyed surface.
2408
 * For Blt.
2409
 *)
1 daniel-mar 2410
  DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
4 daniel-mar 2411
 
2412
(*
2413
 * Supports alpha information in the pixel format.  The bit depth of alpha
2414
 * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
2415
 * more opaque as the alpha value increases.  (0 is transparent.)
2416
 * For Blt.
2417
 *)
1 daniel-mar 2418
  DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
4 daniel-mar 2419
 
2420
(*
2421
 * Supports alpha information in the pixel format.  The bit depth of alpha
2422
 * information in the pixel format can be 1,2,4, or 8.  The alpha value
2423
 * becomes more transparent as the alpha value increases.  (0 is opaque.)
2424
 * This flag can only be set if DDCAPS_ALPHA is set.
2425
 * For Blt.
2426
 *)
1 daniel-mar 2427
  DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
4 daniel-mar 2428
 
2429
(*
2430
 * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
2431
 * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
2432
 * (0 is transparent.)
2433
 * For Blt.
2434
 *)
1 daniel-mar 2435
  DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
4 daniel-mar 2436
 
2437
(*
2438
 * The depth of the alpha channel data can range can be 1,2,4, or 8.
2439
 * The NEG suffix indicates that this alpha channel becomes more transparent
2440
 * as the alpha value increases. (0 is opaque.)  This flag can only be set if
2441
 * DDCAPS_ALPHA is set.
2442
 * For Blt.
2443
 *)
1 daniel-mar 2444
  DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
4 daniel-mar 2445
 
2446
(*
2447
 * Supports alpha blending around the edge of a source color keyed surface.
2448
 * For Overlays.
2449
 *)
1 daniel-mar 2450
  DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
4 daniel-mar 2451
 
2452
(*
2453
 * Supports alpha information in the pixel format.  The bit depth of alpha
2454
 * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
2455
 * more opaque as the alpha value increases.  (0 is transparent.)
2456
 * For Overlays.
2457
 *)
1 daniel-mar 2458
  DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
4 daniel-mar 2459
 
2460
(*
2461
 * Supports alpha information in the pixel format.  The bit depth of alpha
2462
 * information in the pixel format can be 1,2,4, or 8.  The alpha value
2463
 * becomes more transparent as the alpha value increases.  (0 is opaque.)
2464
 * This flag can only be set if DDCAPS_ALPHA is set.
2465
 * For Overlays.
2466
 *)
1 daniel-mar 2467
  DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
4 daniel-mar 2468
 
2469
(*
2470
 * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
2471
 * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
2472
 * (0 is transparent.)
2473
 * For Overlays.
2474
 *)
1 daniel-mar 2475
  DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
4 daniel-mar 2476
 
2477
(*
2478
 * The depth of the alpha channel data can range can be 1,2,4, or 8.  
2479
 * The NEG suffix indicates that this alpha channel becomes more transparent
2480
 * as the alpha value increases. (0 is opaque.)  This flag can only be set if
2481
 * DDCAPS_ALPHA is set.
2482
 * For Overlays.
2483
 *)
1 daniel-mar 2484
  DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
2485
 
4 daniel-mar 2486
(****************************************************************************
2487
 *
2488
 * DIRECTDRAW FX CAPABILITY FLAGS
2489
 *
2490
 ****************************************************************************)
1 daniel-mar 2491
 
4 daniel-mar 2492
(*
2493
 * Uses arithmetic operations to stretch and shrink surfaces during blt
2494
 * rather than pixel doubling techniques.  Along the Y axis.
2495
 *)
1 daniel-mar 2496
  DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
4 daniel-mar 2497
 
2498
(*
2499
 * Uses arithmetic operations to stretch during blt
2500
 * rather than pixel doubling techniques.  Along the Y axis. Only
2501
 * works for x1, x2, etc.
2502
 *)
1 daniel-mar 2503
  DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
4 daniel-mar 2504
 
2505
(*
2506
 * Supports mirroring left to right in blt.
2507
 *)
1 daniel-mar 2508
  DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
4 daniel-mar 2509
 
2510
(*
2511
 * Supports mirroring top to bottom in blt.
2512
 *)
1 daniel-mar 2513
  DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
4 daniel-mar 2514
 
2515
(*
2516
 * Supports arbitrary rotation for blts.
2517
 *)
1 daniel-mar 2518
  DDFXCAPS_BLTROTATION            = $00000100;
4 daniel-mar 2519
 
2520
(*
2521
 * Supports 90 degree rotations for blts.
2522
 *)
2523
   DDFXCAPS_BLTROTATION90          = $00000200;
2524
 
2525
(*
2526
 * DirectDraw supports arbitrary shrinking of a surface along the
2527
 * x axis (horizontal direction) for blts.
2528
 *)
1 daniel-mar 2529
  DDFXCAPS_BLTSHRINKX             = $00000400;
4 daniel-mar 2530
 
2531
(*
2532
 * DirectDraw supports integer shrinking (1x,2x,) of a surface
2533
 * along the x axis (horizontal direction) for blts.
2534
 *)
1 daniel-mar 2535
  DDFXCAPS_BLTSHRINKXN            = $00000800;
4 daniel-mar 2536
 
2537
(*
2538
 * DirectDraw supports arbitrary shrinking of a surface along the
2539
 * y axis (horizontal direction) for blts.  
2540
 *)
1 daniel-mar 2541
  DDFXCAPS_BLTSHRINKY             = $00001000;
4 daniel-mar 2542
 
2543
(*
2544
 * DirectDraw supports integer shrinking (1x,2x,) of a surface
2545
 * along the y axis (vertical direction) for blts.
2546
 *)
1 daniel-mar 2547
  DDFXCAPS_BLTSHRINKYN            = $00002000;
4 daniel-mar 2548
 
2549
(*
2550
 * DirectDraw supports arbitrary stretching of a surface along the
2551
 * x axis (horizontal direction) for blts.
2552
 *)
1 daniel-mar 2553
  DDFXCAPS_BLTSTRETCHX            = $00004000;
4 daniel-mar 2554
 
2555
(*
2556
 * DirectDraw supports integer stretching (1x,2x,) of a surface
2557
 * along the x axis (horizontal direction) for blts.
2558
 *)
1 daniel-mar 2559
  DDFXCAPS_BLTSTRETCHXN           = $00008000;
4 daniel-mar 2560
 
2561
(*
2562
 * DirectDraw supports arbitrary stretching of a surface along the
2563
 * y axis (horizontal direction) for blts.  
2564
 *)
1 daniel-mar 2565
  DDFXCAPS_BLTSTRETCHY            = $00010000;
4 daniel-mar 2566
 
2567
(*
2568
 * DirectDraw supports integer stretching (1x,2x,) of a surface
2569
 * along the y axis (vertical direction) for blts.  
2570
 *)
1 daniel-mar 2571
  DDFXCAPS_BLTSTRETCHYN           = $00020000;
4 daniel-mar 2572
 
2573
(*
2574
 * Uses arithmetic operations to stretch and shrink surfaces during
2575
 * overlay rather than pixel doubling techniques.  Along the Y axis
2576
 * for overlays.
2577
 *)
1 daniel-mar 2578
  DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
4 daniel-mar 2579
 
2580
(*
2581
 * Uses arithmetic operations to stretch surfaces during
2582
 * overlay rather than pixel doubling techniques.  Along the Y axis
2583
 * for overlays. Only works for x1, x2, etc.
2584
 *)
1 daniel-mar 2585
  DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
4 daniel-mar 2586
 
2587
(*
2588
 * DirectDraw supports arbitrary shrinking of a surface along the
2589
 * x axis (horizontal direction) for overlays.
2590
 *)
1 daniel-mar 2591
  DDFXCAPS_OVERLAYSHRINKX         = $00080000;
4 daniel-mar 2592
 
2593
(*
2594
 * DirectDraw supports integer shrinking (1x,2x,) of a surface
2595
 * along the x axis (horizontal direction) for overlays.
2596
 *)
1 daniel-mar 2597
  DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
4 daniel-mar 2598
 
2599
(*
2600
 * DirectDraw supports arbitrary shrinking of a surface along the
2601
 * y axis (horizontal direction) for overlays.
2602
 *)
1 daniel-mar 2603
  DDFXCAPS_OVERLAYSHRINKY         = $00200000;
4 daniel-mar 2604
 
2605
(*
2606
 * DirectDraw supports integer shrinking (1x,2x,) of a surface
2607
 * along the y axis (vertical direction) for overlays.  
2608
 *)
1 daniel-mar 2609
  DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
4 daniel-mar 2610
 
2611
(*
2612
 * DirectDraw supports arbitrary stretching of a surface along the
2613
 * x axis (horizontal direction) for overlays.
2614
 *)
1 daniel-mar 2615
  DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
4 daniel-mar 2616
 
2617
(*
2618
 * DirectDraw supports integer stretching (1x,2x,) of a surface
2619
 * along the x axis (horizontal direction) for overlays.
2620
 *)
1 daniel-mar 2621
  DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
4 daniel-mar 2622
 
2623
(*
2624
 * DirectDraw supports arbitrary stretching of a surface along the
2625
 * y axis (horizontal direction) for overlays.  
2626
 *)
1 daniel-mar 2627
  DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
4 daniel-mar 2628
 
2629
(*
2630
 * DirectDraw supports integer stretching (1x,2x,) of a surface
2631
 * along the y axis (vertical direction) for overlays.  
2632
 *)
1 daniel-mar 2633
  DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
4 daniel-mar 2634
 
2635
(*
2636
 * DirectDraw supports mirroring of overlays across the vertical axis
2637
 *)
1 daniel-mar 2638
  DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
4 daniel-mar 2639
 
2640
(*
2641
 * DirectDraw supports mirroring of overlays across the horizontal axis
2642
 *)
1 daniel-mar 2643
  DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
2644
 
4 daniel-mar 2645
(*
2646
 * Driver can do alpha blending for blits.
2647
 *)
2648
  DDFXCAPS_BLTALPHA             = $00000001;
1 daniel-mar 2649
 
4 daniel-mar 2650
(*
2651
 * Driver can do geometric transformations (or warps) for blits.
2652
 *)
2653
  DDFXCAPS_BLTTRANSFORM         = $00000002;
2654
 
2655
(*
2656
 * Driver can do surface-reconstruction filtering for warped blits.
2657
 *)
2658
  DDFXCAPS_BLTFILTER           = DDFXCAPS_BLTARITHSTRETCHY;
2659
 
2660
(*
2661
 * Driver can do alpha blending for overlays.
2662
 *)
2663
  DDFXCAPS_OVERLAYALPHA                 = $00000004;
2664
 
2665
(*
2666
 * Driver can do geometric transformations (or warps) for overlays.
2667
 *)
2668
  DDFXCAPS_OVERLAYTRANSFORM     = $20000000;
2669
 
2670
(*
2671
 * Driver can do surface-reconstruction filtering for warped overlays.
2672
 *)
2673
  DDFXCAPS_OVERLAYFILTER              = DDFXCAPS_OVERLAYARITHSTRETCHY;
2674
 
2675
(****************************************************************************
2676
 *
2677
 * DIRECTDRAW STEREO VIEW CAPABILITIES
2678
 *
2679
 ****************************************************************************)
2680
 
2681
(*
2682
 * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete
2683
 * The stereo view is accomplished via enigma encoding.
2684
 *)
2685
  DDSVCAPS_RESERVED1                 = $00000001;
2686
  DDSVCAPS_ENIGMA                 = DDSVCAPS_RESERVED1;
2687
 
2688
(*
2689
 * This flag used to be DDSVCAPS_FLICKER, which is now obsolete
2690
 * The stereo view is accomplished via high frequency flickering.
2691
 *)
2692
  DDSVCAPS_RESERVED2                = $00000002;
2693
  DDSVCAPS_FLICKER                = DDSVCAPS_RESERVED2;
2694
 
2695
(*
2696
 * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete
2697
 * The stereo view is accomplished via red and blue filters applied
2698
 * to the left and right eyes.  All images must adapt their colorspaces
2699
 * for this process.
2700
 *)
2701
  DDSVCAPS_RESERVED3                = $00000004;
2702
  DDSVCAPS_REDBLUE                = DDSVCAPS_RESERVED3;
2703
 
2704
(*
2705
 * This flag used to be DDSVCAPS_SPLIT, which is now obsolete
2706
 * The stereo view is accomplished with split screen technology.
2707
 *)
2708
  DDSVCAPS_RESERVED4                  = $00000008;
2709
  DDSVCAPS_SPLIT                  = DDSVCAPS_RESERVED4;
2710
 
2711
(*
2712
 * The stereo view is accomplished with switching technology
2713
 *)
1 daniel-mar 2714
  DDSVCAPS_STEREOSEQUENTIAL       = $00000010;
2715
 
4 daniel-mar 2716
(****************************************************************************
2717
 *
2718
 * DIRECTDRAWPALETTE CAPABILITIES
2719
 *
2720
 ****************************************************************************)
1 daniel-mar 2721
 
4 daniel-mar 2722
(*
2723
 * Index is 4 bits.  There are sixteen color entries in the palette table.
2724
 *)
2725
  DDPCAPS_4BIT                    = $00000001;
1 daniel-mar 2726
 
4 daniel-mar 2727
(*
2728
 * Index is onto a 8 bit color index.  This field is only valid with the
2729
 * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target
2730
 * surface is in 8bpp. Each color entry is one byte long and is an index
2731
 * into destination surface's 8bpp palette.
2732
 *)
2733
  DDPCAPS_8BITENTRIES             = $00000002;
1 daniel-mar 2734
 
4 daniel-mar 2735
(*
2736
 * Index is 8 bits.  There are 256 color entries in the palette table.
2737
 *)
2738
  DDPCAPS_8BIT                    = $00000004;
1 daniel-mar 2739
 
4 daniel-mar 2740
(*
2741
 * Indicates that this DIRECTDRAWPALETTE should use the palette color array
2742
 * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE
2743
 * object.
2744
 * This flag is obsolete. DirectDraw always initializes the color array from
2745
 * the lpDDColorArray parameter. The definition remains for source-level
2746
 * compatibility.
2747
 *)
2748
  DDPCAPS_INITIALIZE              = $00000008;
1 daniel-mar 2749
 
4 daniel-mar 2750
(*
2751
 * This palette is the one attached to the primary surface.  Changing this
2752
 * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified
2753
 * and supported.
2754
 *)
2755
  DDPCAPS_PRIMARYSURFACE          = $00000010;
1 daniel-mar 2756
 
4 daniel-mar 2757
(*
2758
 * This palette is the one attached to the primary surface left.  Changing
2759
 * this table has immediate effect on the display for the left eye unless
2760
 * DDPSETPAL_VSYNC is specified and supported.
2761
 *)
2762
  DDPCAPS_PRIMARYSURFACELEFT      = $00000020;
1 daniel-mar 2763
 
4 daniel-mar 2764
(*
2765
 * This palette can have all 256 entries defined
2766
 *)
2767
  DDPCAPS_ALLOW256                = $00000040;
1 daniel-mar 2768
 
4 daniel-mar 2769
(*
2770
 * This palette can have modifications to it synced with the monitors
2771
 * refresh rate.
2772
 *)
2773
  DDPCAPS_VSYNC                   = $00000080;
1 daniel-mar 2774
 
4 daniel-mar 2775
(*
2776
 * Index is 1 bit.  There are two color entries in the palette table.
2777
 *)
2778
  DDPCAPS_1BIT                    = $00000100;
1 daniel-mar 2779
 
4 daniel-mar 2780
(*
2781
 * Index is 2 bit.  There are four color entries in the palette table.
2782
 *)
2783
  DDPCAPS_2BIT                    = $00000200;
1 daniel-mar 2784
 
4 daniel-mar 2785
(*
2786
 * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value
2787
 *)
2788
  DDPCAPS_ALPHA                 = $00000400;
1 daniel-mar 2789
 
4 daniel-mar 2790
(****************************************************************************
2791
 *
2792
 * DIRECTDRAWPALETTE SETENTRY CONSTANTS
2793
 *
2794
 ****************************************************************************)
1 daniel-mar 2795
 
2796
 
4 daniel-mar 2797
(****************************************************************************
2798
 *
2799
 * DIRECTDRAWPALETTE GETENTRY CONSTANTS
2800
 *
2801
 ****************************************************************************)
1 daniel-mar 2802
 
4 daniel-mar 2803
(* 0 is the only legal value *)
1 daniel-mar 2804
 
4 daniel-mar 2805
(****************************************************************************
2806
 *
2807
 * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
2808
 *
2809
 ****************************************************************************)
1 daniel-mar 2810
 
4 daniel-mar 2811
(*
2812
 * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData
2813
 * must be set to sizeof(IUnknown^). DirectDraw will call AddRef through this
2814
 * pointer and Release when the private data is destroyed. This includes when
2815
 * the surface or palette is destroyed before such priovate data is destroyed.
2816
 *)
2817
  DDSPD_IUNKNOWNPOINTER           = $00000001;
1 daniel-mar 2818
 
4 daniel-mar 2819
(*
2820
 * Private data is only valid for the current state of the object,
2821
 * as determined by the uniqueness value.
2822
 *)
2823
  DDSPD_VOLATILE                  = $00000002;
1 daniel-mar 2824
 
4 daniel-mar 2825
(****************************************************************************
2826
 *
2827
 * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
2828
 *
2829
 ****************************************************************************)
1 daniel-mar 2830
 
2831
 
4 daniel-mar 2832
(****************************************************************************
2833
 *
2834
 * DIRECTDRAW BITDEPTH CONSTANTS
2835
 *
2836
 * NOTE:  These are only used to indicate supported bit depths.   These
2837
 * are flags only, they are not to be used as an actual bit depth.   The
2838
 * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual
2839
 * bit depths in a surface or for changing the display mode.
2840
 *
2841
 ****************************************************************************)
1 daniel-mar 2842
 
4 daniel-mar 2843
(*
2844
 * 1 bit per pixel.
2845
 *)
2846
  DDBD_1                  = $00004000;
1 daniel-mar 2847
 
4 daniel-mar 2848
(*
2849
 * 2 bits per pixel.
2850
 *)
2851
  DDBD_2                  = $00002000;
1 daniel-mar 2852
 
4 daniel-mar 2853
(*
2854
 * 4 bits per pixel.
2855
 *)
2856
  DDBD_4                  = $00001000;
1 daniel-mar 2857
 
4 daniel-mar 2858
(*
2859
 * 8 bits per pixel.
2860
 *)
2861
  DDBD_8                  = $00000800;
1 daniel-mar 2862
 
4 daniel-mar 2863
(*
2864
 * 16 bits per pixel.
2865
 *)
2866
  DDBD_16                 = $00000400;
1 daniel-mar 2867
 
4 daniel-mar 2868
(*
2869
 * 24 bits per pixel.
2870
 *)
2871
  DDBD_24                 = $00000200;
1 daniel-mar 2872
 
4 daniel-mar 2873
(*
2874
 * 32 bits per pixel.
2875
 *)
2876
  DDBD_32                 = $00000100;
1 daniel-mar 2877
 
4 daniel-mar 2878
(****************************************************************************
2879
 *
2880
 * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS
2881
 *
2882
 ****************************************************************************)
1 daniel-mar 2883
 
4 daniel-mar 2884
(*
2885
 * Set if the structure contains a color space.  Not set if the structure
2886
 * contains a single color key.
2887
 *)
2888
  DDCKEY_COLORSPACE       = $00000001;
1 daniel-mar 2889
 
4 daniel-mar 2890
(*
2891
 * Set if the structure specifies a color key or color space which is to be
2892
 * used as a destination color key for blt operations.
2893
 *)
2894
  DDCKEY_DESTBLT          = $00000002;
1 daniel-mar 2895
 
4 daniel-mar 2896
(*
2897
 * Set if the structure specifies a color key or color space which is to be
2898
 * used as a destination color key for overlay operations.
2899
 *)
2900
  DDCKEY_DESTOVERLAY      = $00000004;
1 daniel-mar 2901
 
4 daniel-mar 2902
(*
2903
 * Set if the structure specifies a color key or color space which is to be
2904
 * used as a source color key for blt operations.
2905
 *)
2906
  DDCKEY_SRCBLT           = $00000008;
1 daniel-mar 2907
 
4 daniel-mar 2908
(*
2909
 * Set if the structure specifies a color key or color space which is to be
2910
 * used as a source color key for overlay operations.
2911
 *)
2912
  DDCKEY_SRCOVERLAY       = $00000010;
1 daniel-mar 2913
 
2914
 
4 daniel-mar 2915
(****************************************************************************
2916
 *
2917
 * DIRECTDRAW COLOR KEY CAPABILITY FLAGS
2918
 *
2919
 ****************************************************************************)
1 daniel-mar 2920
 
4 daniel-mar 2921
(*
2922
 * Supports transparent blting using a color key to identify the replaceable
2923
 * bits of the destination surface for RGB colors.
2924
 *)
2925
  DDCKEYCAPS_DESTBLT                      = $00000001;
1 daniel-mar 2926
 
4 daniel-mar 2927
(*
2928
 * Supports transparent blting using a color space to identify the replaceable
2929
 * bits of the destination surface for RGB colors.
2930
 *)
2931
  DDCKEYCAPS_DESTBLTCLRSPACE              = $00000002;
1 daniel-mar 2932
 
4 daniel-mar 2933
(*
2934
 * Supports transparent blting using a color space to identify the replaceable
2935
 * bits of the destination surface for YUV colors.
2936
 *)
2937
  DDCKEYCAPS_DESTBLTCLRSPACEYUV           = $00000004;
1 daniel-mar 2938
 
4 daniel-mar 2939
(*
2940
 * Supports transparent blting using a color key to identify the replaceable
2941
 * bits of the destination surface for YUV colors.
2942
 *)
2943
  DDCKEYCAPS_DESTBLTYUV                   = $00000008;
1 daniel-mar 2944
 
4 daniel-mar 2945
(*
2946
 * Supports overlaying using colorkeying of the replaceable bits of the surface
2947
 * being overlayed for RGB colors.
2948
 *)
2949
  DDCKEYCAPS_DESTOVERLAY                  = $00000010;
1 daniel-mar 2950
 
4 daniel-mar 2951
(*
2952
 * Supports a color space as the color key for the destination for RGB colors.
2953
 *)
2954
  DDCKEYCAPS_DESTOVERLAYCLRSPACE          = $00000020;
1 daniel-mar 2955
 
4 daniel-mar 2956
(*
2957
 * Supports a color space as the color key for the destination for YUV colors.
2958
 *)
2959
  DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV       = $00000040;
1 daniel-mar 2960
 
4 daniel-mar 2961
(*
2962
 * Supports only one active destination color key value for visible overlay
2963
 * surfaces.
2964
 *)
2965
  DDCKEYCAPS_DESTOVERLAYONEACTIVE         = $00000080;
1 daniel-mar 2966
 
4 daniel-mar 2967
(*
2968
 * Supports overlaying using colorkeying of the replaceable bits of the
2969
 * surface being overlayed for YUV colors.
2970
 *)
2971
  DDCKEYCAPS_DESTOVERLAYYUV               = $00000100;
1 daniel-mar 2972
 
4 daniel-mar 2973
(*
2974
 * Supports transparent blting using the color key for the source with
2975
 * this surface for RGB colors.
2976
 *)
2977
  DDCKEYCAPS_SRCBLT                       = $00000200;
1 daniel-mar 2978
 
4 daniel-mar 2979
(*
2980
 * Supports transparent blting using a color space for the source with
2981
 * this surface for RGB colors.
2982
 *)
2983
  DDCKEYCAPS_SRCBLTCLRSPACE               = $00000400;
1 daniel-mar 2984
 
4 daniel-mar 2985
(*
2986
 * Supports transparent blting using a color space for the source with
2987
 * this surface for YUV colors.
2988
 *)
2989
  DDCKEYCAPS_SRCBLTCLRSPACEYUV            = $00000800;
1 daniel-mar 2990
 
4 daniel-mar 2991
(*
2992
 * Supports transparent blting using the color key for the source with
2993
 * this surface for YUV colors.
2994
 *)
2995
  DDCKEYCAPS_SRCBLTYUV                    = $00001000;
1 daniel-mar 2996
 
4 daniel-mar 2997
(*
2998
 * Supports overlays using the color key for the source with this
2999
 * overlay surface for RGB colors.
3000
 *)
3001
  DDCKEYCAPS_SRCOVERLAY                   = $00002000;
1 daniel-mar 3002
 
4 daniel-mar 3003
(*
3004
 * Supports overlays using a color space as the source color key for
3005
 * the overlay surface for RGB colors.
3006
 *)
3007
  DDCKEYCAPS_SRCOVERLAYCLRSPACE           = $00004000;
1 daniel-mar 3008
 
4 daniel-mar 3009
(*
3010
 * Supports overlays using a color space as the source color key for
3011
 * the overlay surface for YUV colors.
3012
 *)
3013
  DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV        = $00008000;
1 daniel-mar 3014
 
4 daniel-mar 3015
(*
3016
 * Supports only one active source color key value for visible
3017
 * overlay surfaces.
3018
 *)
3019
  DDCKEYCAPS_SRCOVERLAYONEACTIVE          = $00010000;
1 daniel-mar 3020
 
4 daniel-mar 3021
(*
3022
 * Supports overlays using the color key for the source with this
3023
 * overlay surface for YUV colors.
3024
 *)
3025
  DDCKEYCAPS_SRCOVERLAYYUV                = $00020000;
1 daniel-mar 3026
 
4 daniel-mar 3027
(*
3028
 * there are no bandwidth trade-offs for using colorkey with an overlay
3029
 *)
3030
  DDCKEYCAPS_NOCOSTOVERLAY                = $00040000;
1 daniel-mar 3031
 
3032
 
4 daniel-mar 3033
(****************************************************************************
3034
 *
3035
 * DIRECTDRAW PIXELFORMAT FLAGS
3036
 *
3037
 ****************************************************************************)
1 daniel-mar 3038
 
4 daniel-mar 3039
(*
3040
 * The surface has alpha channel information in the pixel format.
3041
 *)
3042
  DDPF_ALPHAPIXELS                        = $00000001;
1 daniel-mar 3043
 
4 daniel-mar 3044
(*
3045
 * The pixel format contains alpha only information
3046
 *)
3047
  DDPF_ALPHA                              = $00000002;
1 daniel-mar 3048
 
4 daniel-mar 3049
(*
3050
 * The FourCC code is valid.
3051
 *)
3052
  DDPF_FOURCC                             = $00000004;
1 daniel-mar 3053
 
4 daniel-mar 3054
(*
3055
 * The surface is 4-bit color indexed.
3056
 *)
3057
  DDPF_PALETTEINDEXED4                    = $00000008;
1 daniel-mar 3058
 
4 daniel-mar 3059
(*
3060
 * The surface is indexed into a palette which stores indices
3061
 * into the destination surface's 8-bit palette.
3062
 *)
3063
  DDPF_PALETTEINDEXEDTO8                  = $00000010;
3064
 
3065
(*
3066
 * The surface is 8-bit color indexed.
3067
 *)
3068
  DDPF_PALETTEINDEXED8                    = $00000020;
3069
 
3070
(*
3071
 * The RGB data in the pixel format structure is valid.
3072
 *)
3073
  DDPF_RGB                                = $00000040;
3074
 
3075
(*
3076
 * The surface will accept pixel data in the format specified
3077
 * and compress it during the write.
3078
 *)
3079
  DDPF_COMPRESSED                         = $00000080;
3080
 
3081
(*
3082
 * The surface will accept RGB data and translate it during
3083
 * the write to YUV data.  The format of the data to be written
3084
 * will be contained in the pixel format structure.  The DDPF_RGB
3085
 * flag will be set.
3086
 *)
3087
  DDPF_RGBTOYUV                           = $00000100;
3088
 
3089
(*
3090
 * pixel format is YUV - YUV data in pixel format struct is valid
3091
 *)
3092
  DDPF_YUV                                = $00000200;
3093
 
3094
(*
3095
 * pixel format is a z buffer only surface
3096
 *)
3097
  DDPF_ZBUFFER                            = $00000400;
3098
 
3099
(*
3100
 * The surface is 1-bit color indexed.
3101
 *)
3102
  DDPF_PALETTEINDEXED1                    = $00000800;
3103
 
3104
(*
3105
 * The surface is 2-bit color indexed.
3106
 *)
3107
  DDPF_PALETTEINDEXED2                    = $00001000;
3108
 
3109
(*
3110
 * The surface contains Z information in the pixels
3111
 *)
3112
  DDPF_ZPIXELS                          = $00002000;
3113
 
3114
(*
3115
 * The surface contains stencil information along with Z
3116
 *)
3117
  DDPF_STENCILBUFFER                    = $00004000;
3118
 
3119
(*
3120
 * Premultiplied alpha format -- the color components have been
3121
 * premultiplied by the alpha component.
3122
 *)
3123
  DDPF_ALPHAPREMULT                     = $00008000;
3124
 
3125
 
3126
(*
3127
 * Luminance data in the pixel format is valid.
3128
 * Use this flag for luminance-only or luminance+alpha surfaces,
3129
 * the bit depth is then ddpf.dwLuminanceBitCount.
3130
 *)
3131
  DDPF_LUMINANCE                          = $00020000;
3132
 
3133
(*
3134
 * Luminance data in the pixel format is valid.
3135
 * Use this flag when hanging luminance off bumpmap surfaces,
3136
 * the bit mask for the luminance portion of the pixel is then
3137
 * ddpf.dwBumpLuminanceBitMask
3138
 *)
3139
  DDPF_BUMPLUMINANCE                      = $00040000;
3140
 
3141
(*
3142
 * Bump map dUdV data in the pixel format is valid.
3143
 *)
3144
  DDPF_BUMPDUDV                           = $00080000;
3145
 
3146
(*===========================================================================
3147
 *
3148
 *
3149
 * DIRECTDRAW CALLBACK FLAGS
3150
 *
3151
 *
3152
 *==========================================================================*)
3153
 
3154
(****************************************************************************
3155
 *
3156
 * DIRECTDRAW ENUMSURFACES FLAGS
3157
 *
3158
 ****************************************************************************)
3159
 
3160
(*
3161
 * Enumerate all of the surfaces that meet the search criterion.
3162
 *)
3163
  DDENUMSURFACES_ALL                      = $00000001;
3164
 
3165
(*
3166
 * A search hit is a surface that matches the surface description.
3167
 *)
3168
  DDENUMSURFACES_MATCH                    = $00000002;
3169
 
3170
(*
3171
 * A search hit is a surface that does not match the surface description.
3172
 *)
3173
  DDENUMSURFACES_NOMATCH                  = $00000004;
3174
 
3175
(*
3176
 * Enumerate the first surface that can be created which meets the search criterion.
3177
 *)
3178
  DDENUMSURFACES_CANBECREATED             = $00000008;
3179
 
3180
(*
3181
 * Enumerate the surfaces that already exist that meet the search criterion.
3182
 *)
3183
  DDENUMSURFACES_DOESEXIST                = $00000010;
3184
 
3185
(****************************************************************************
3186
 *
3187
 * DIRECTDRAW SETDISPLAYMODE FLAGS
3188
 *
3189
 ****************************************************************************)
3190
 
3191
(*
3192
 * The desired mode is a standard VGA mode
3193
 *)
3194
  DDSDM_STANDARDVGAMODE                   = $00000001;
3195
 
3196
(****************************************************************************
3197
 *
3198
 * DIRECTDRAW ENUMDISPLAYMODES FLAGS
3199
 *
3200
 ****************************************************************************)
3201
 
3202
(*
3203
 * Enumerate Modes with different refresh rates.  EnumDisplayModes guarantees
3204
 * that a particular mode will be enumerated only once.  This flag specifies whether
3205
 * the refresh rate is taken into account when determining if a mode is unique.
3206
 *)
3207
  DDEDM_REFRESHRATES                      = $00000001;
3208
 
3209
(*
3210
 * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA
3211
 * modes such as mode 0x13 in addition to the usual ModeX modes (which are always
3212
 * enumerated if the application has previously called SetCooperativeLevel with the
3213
 * DDSCL_ALLOWMODEX flag set).
3214
 *)
3215
  DDEDM_STANDARDVGAMODES                  = $00000002;
3216
 
3217
 
3218
(****************************************************************************
3219
 *
3220
 * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS
3221
 *
3222
 ****************************************************************************)
3223
 
3224
(*
3225
 * Exclusive mode owner will be responsible for the entire primary surface.
3226
 * GDI can be ignored. used with DD
3227
 *)
3228
  DDSCL_FULLSCREEN                        = $00000001;
3229
 
3230
(*
3231
 * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode
3232
 *)
3233
  DDSCL_ALLOWREBOOT                       = $00000002;
3234
 
3235
(*
3236
 * prevents DDRAW from modifying the application window.
3237
 * prevents DDRAW from minimize/restore the application window on activation.
3238
 *)
3239
  DDSCL_NOWINDOWCHANGES                   = $00000004;
3240
 
3241
(*
3242
 * app wants to work as a regular Windows application
3243
 *)
3244
  DDSCL_NORMAL                            = $00000008;
3245
 
3246
(*
3247
 * app wants exclusive access
3248
 *)
3249
  DDSCL_EXCLUSIVE                         = $00000010;
3250
 
3251
 
3252
(*
3253
 * app can deal with non-windows display modes
3254
 *)
3255
  DDSCL_ALLOWMODEX                        = $00000040;
3256
 
3257
(*
3258
 * this window will receive the focus messages
3259
 *)
3260
  DDSCL_SETFOCUSWINDOW                    = $00000080;
3261
 
3262
(*
3263
 * this window is associated with the DDRAW object and will
3264
 * cover the screen in fullscreen mode
3265
 *)
3266
  DDSCL_SETDEVICEWINDOW                   = $00000100;
3267
 
3268
(*
3269
 * app wants DDRAW to create a window to be associated with the
3270
 * DDRAW object
3271
 *)
3272
  DDSCL_CREATEDEVICEWINDOW                = $00000200;
3273
 
3274
(*
3275
 * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D
3276
 * take the global crtisec more frequently.
3277
 *)
3278
  DDSCL_MULTITHREADED                     = $00000400;
3279
 
3280
(*
3281
 * App hints that it would like to keep the FPU set up for optimal Direct3D
3282
 * performance (single precision and exceptions disabled) so Direct3D
3283
 * does not need to explicitly set the FPU each time
3284
 *)
3285
  DDSCL_FPUSETUP                          = $00000800;
3286
 
3287
(*
3288
 * App specifies that it needs either double precision FPU or FPU exceptions
3289
 * enabled. This makes Direct3D explicitly set the FPU state eah time it is
3290
 * called. Setting the flag will reduce Direct3D performance. The flag is
3291
 * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP
3292
 *)
3293
  DDSCL_FPUPRESERVE                          = $00001000;
3294
 
3295
(****************************************************************************
3296
 *
3297
 * DIRECTDRAW BLT FLAGS
3298
 *
3299
 ****************************************************************************)
3300
 
3301
(*
3302
 * Use the alpha information in the pixel format or the alpha channel surface
3303
 * attached to the destination surface as the alpha channel for this blt.
3304
 *)
3305
  DDBLT_ALPHADEST                         = $00000001;
3306
 
3307
(*
3308
 * Use the dwConstAlphaDest field in the TDDBltFX structure as the alpha channel
3309
 * for the destination surface for this blt.
3310
 *)
3311
  DDBLT_ALPHADESTCONSTOVERRIDE            = $00000002;
3312
 
3313
(*
3314
 * The NEG suffix indicates that the destination surface becomes more
3315
 * transparent as the alpha value increases. (0 is opaque)
3316
 *)
3317
  DDBLT_ALPHADESTNEG                      = $00000004;
3318
 
3319
(*
3320
 * Use the lpDDSAlphaDest field in the TDDBltFX structure as the alpha
3321
 * channel for the destination for this blt.
3322
 *)
3323
  DDBLT_ALPHADESTSURFACEOVERRIDE          = $00000008;
3324
 
3325
(*
3326
 * Use the dwAlphaEdgeBlend field in the TDDBltFX structure as the alpha channel
3327
 * for the edges of the image that border the color key colors.
3328
 *)
3329
  DDBLT_ALPHAEDGEBLEND                    = $00000010;
3330
 
3331
(*
3332
 * Use the alpha information in the pixel format or the alpha channel surface
3333
 * attached to the source surface as the alpha channel for this blt.
3334
 *)
3335
  DDBLT_ALPHASRC                          = $00000020;
3336
 
3337
(*
3338
 * Use the dwConstAlphaSrc field in the TDDBltFX structure as the alpha channel
3339
 * for the source for this blt.
3340
 *)
3341
  DDBLT_ALPHASRCCONSTOVERRIDE             = $00000040;
3342
 
3343
(*
3344
 * The NEG suffix indicates that the source surface becomes more transparent
3345
 * as the alpha value increases. (0 is opaque)
3346
 *)
3347
  DDBLT_ALPHASRCNEG                       = $00000080;
3348
 
3349
(*
3350
 * Use the lpDDSAlphaSrc field in the TDDBltFX structure as the alpha channel
3351
 * for the source for this blt.
3352
 *)
3353
  DDBLT_ALPHASRCSURFACEOVERRIDE           = $00000100;
3354
 
3355
(*
3356
 * Do this blt asynchronously through the FIFO in the order received.  If
3357
 * there is no room in the hardware FIFO fail the call.
3358
 *)
3359
  DDBLT_ASYNC                             = $00000200;
3360
 
3361
(*
3362
 * Uses the dwFillColor field in the TDDBltFX structure as the RGB color
3363
 * to fill the destination rectangle on the destination surface with.
3364
 *)
3365
  DDBLT_COLORFILL                         = $00000400;
3366
 
3367
(*
3368
 * Uses the dwDDFX field in the TDDBltFX structure to specify the effects
3369
 * to use for the blt.
3370
 *)
3371
  DDBLT_DDFX                              = $00000800;
3372
 
3373
(*
3374
 * Uses the dwDDROPS field in the TDDBltFX structure to specify the ROPS
3375
 * that are not part of the Win32 API.
3376
 *)
3377
  DDBLT_DDROPS                            = $00001000;
3378
 
3379
(*
3380
 * Use the color key associated with the destination surface.
3381
 *)
3382
  DDBLT_KEYDEST                           = $00002000;
3383
 
3384
(*
3385
 * Use the dckDestColorkey field in the TDDBltFX structure as the color key
3386
 * for the destination surface.
3387
 *)
3388
  DDBLT_KEYDESTOVERRIDE                   = $00004000;
3389
 
3390
(*
3391
 * Use the color key associated with the source surface.
3392
 *)
3393
  DDBLT_KEYSRC                            = $00008000;
3394
 
3395
(*
3396
 * Use the dckSrcColorkey field in the TDDBltFX structure as the color key
3397
 * for the source surface.
3398
 *)
3399
  DDBLT_KEYSRCOVERRIDE                    = $00010000;
3400
 
3401
(*
3402
 * Use the dwROP field in the TDDBltFX structure for the raster operation
3403
 * for this blt.  These ROPs are the same as the ones defined in the Win32 API.
3404
 *)
3405
  DDBLT_ROP                               = $00020000;
3406
 
3407
(*
3408
 * Use the dwRotationAngle field in the TDDBltFX structure as the angle
3409
 * (specified in 1/100th of a degree) to rotate the surface.
3410
 *)
3411
  DDBLT_ROTATIONANGLE                     = $00040000;
3412
 
3413
(*
3414
 * Z-buffered blt using the z-buffers attached to the source and destination
3415
 * surfaces and the dwZBufferOpCode field in the TDDBltFX structure as the
3416
 * z-buffer opcode.
3417
 *)
3418
  DDBLT_ZBUFFER                           = $00080000;
3419
 
3420
(*
3421
 * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field
3422
 * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
3423
 * for the destination.
3424
 *)
3425
  DDBLT_ZBUFFERDESTCONSTOVERRIDE          = $00100000;
3426
 
3427
(*
3428
 * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode
3429
 * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
3430
 * respectively for the destination.
3431
 *)
3432
  DDBLT_ZBUFFERDESTOVERRIDE               = $00200000;
3433
 
3434
(*
3435
 * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field
3436
 * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
3437
 * for the source.
3438
 *)
3439
  DDBLT_ZBUFFERSRCCONSTOVERRIDE           = $00400000;
3440
 
3441
(*
3442
 * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode
3443
 * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
3444
 * respectively for the source.
3445
 *)
3446
   DDBLT_ZBUFFERSRCOVERRIDE                = $00800000;
3447
 
3448
(*
3449
 * wait until the device is ready to handle the blt
3450
 * this will cause blt to not return DDERR_WASSTILLDRAWING
3451
 *)
3452
  DDBLT_WAIT                              = $01000000;
3453
 
3454
(*
3455
 * Uses the dwFillDepth field in the TDDBltFX structure as the depth value
3456
 * to fill the destination rectangle on the destination Z-buffer surface
3457
 * with.
3458
 *)
3459
  DDBLT_DEPTHFILL                         = $02000000;
3460
 
3461
(*
3462
 * wait until the device is ready to handle the blt
3463
 * this will cause blt to not return DDERR_WASSTILLDRAWING
3464
 *)
3465
  DDBLT_DONOTWAIT                         = $08000000;
3466
 
3467
(****************************************************************************
3468
 *
3469
 * BLTFAST FLAGS
3470
 *
3471
 ****************************************************************************)
3472
 
3473
  DDBLTFAST_NOCOLORKEY                    = $00000000;
3474
  DDBLTFAST_SRCCOLORKEY                   = $00000001;
3475
  DDBLTFAST_DESTCOLORKEY                  = $00000002;
3476
  DDBLTFAST_WAIT                          = $00000010;
3477
  DDBLTFAST_DONOTWAIT                     = $00000020;
3478
 
3479
(****************************************************************************
3480
 *
3481
 * FLIP FLAGS
3482
 *
3483
 ****************************************************************************)
3484
 
3485
 
3486
  DDFLIP_WAIT                          = $00000001;
3487
 
3488
(*
3489
 * Indicates that the target surface contains the even field of video data.
3490
 * This flag is only valid with an overlay surface.
3491
 *)
3492
  DDFLIP_EVEN                          = $00000002;
3493
 
3494
(*
3495
 * Indicates that the target surface contains the odd field of video data.
3496
 * This flag is only valid with an overlay surface.
3497
 *)
3498
  DDFLIP_ODD                           = $00000004;
3499
 
3500
(*
3501
 * Causes DirectDraw to perform the physical flip immediately and return
3502
 * to the application. Typically, what was the front buffer but is now the back
3503
 * buffer will still be visible (depending on timing) until the next vertical
3504
 * retrace. Subsequent operations involving the two flipped surfaces will
3505
 * not check to see if the physical flip has finished (i.e. will not return
3506
 * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)).
3507
 * This allows an application to perform Flips at a higher frequency than the
3508
 * monitor refresh rate, but may introduce visible artifacts.
3509
 * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set,
3510
 * DDFLIP_NOVSYNC has no effect.
3511
 *)
3512
  DDFLIP_NOVSYNC                       = $00000008;
3513
 
3514
 
3515
(*
3516
 * Flip Interval Flags. These flags indicate how many vertical retraces to wait between
3517
 * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each
3518
 * surface involved in the flip until the specified number of vertical retraces has
3519
 * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set,
3520
 * DDFLIP_INTERVALn has no effect.
3521
 *)
3522
 
3523
(*
3524
 * DirectDraw will flip on every other vertical sync
3525
 *)
3526
  DDFLIP_INTERVAL2                     = $02000000;
3527
 
3528
 
3529
(*
3530
 * DirectDraw will flip on every third vertical sync
3531
 *)
3532
  DDFLIP_INTERVAL3                     = $03000000;
3533
 
3534
 
3535
(*
3536
 * DirectDraw will flip on every fourth vertical sync
3537
 *)
3538
  DDFLIP_INTERVAL4                     = $04000000;
3539
 
3540
(*
3541
 * DirectDraw will flip and display a main stereo surface
3542
 *)
3543
  DDFLIP_STEREO                        = $00000010;
3544
 
3545
(*
3546
 * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish
3547
 * to override the default and use time when the accelerator is busy (as denoted by
3548
 * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT.
3549
 *)
3550
  DDFLIP_DONOTWAIT                     = $00000020;
3551
 
3552
(****************************************************************************
3553
 *
3554
 * DIRECTDRAW SURFACE OVERLAY FLAGS
3555
 *
3556
 ****************************************************************************)
3557
 
3558
(*
3559
 * Use the alpha information in the pixel format or the alpha channel surface
3560
 * attached to the destination surface as the alpha channel for the
3561
 * destination overlay.
3562
 *)
3563
  DDOVER_ALPHADEST                        = $00000001;
3564
 
3565
(*
3566
 * Use the dwConstAlphaDest field in the TDDOverlayFX structure as the
3567
 * destination alpha channel for this overlay.
3568
 *)
3569
  DDOVER_ALPHADESTCONSTOVERRIDE           = $00000002;
3570
 
3571
(*
3572
 * The NEG suffix indicates that the destination surface becomes more
3573
 * transparent as the alpha value increases.
3574
 *)
3575
  DDOVER_ALPHADESTNEG                     = $00000004;
3576
 
3577
(*
3578
 * Use the lpDDSAlphaDest field in the TDDOverlayFX structure as the alpha
3579
 * channel destination for this overlay.
3580
 *)
3581
  DDOVER_ALPHADESTSURFACEOVERRIDE         = $00000008;
3582
 
3583
(*
3584
 * Use the dwAlphaEdgeBlend field in the TDDOverlayFX structure as the alpha
3585
 * channel for the edges of the image that border the color key colors.
3586
 *)
3587
  DDOVER_ALPHAEDGEBLEND                   = $00000010;
3588
 
3589
(*
3590
 * Use the alpha information in the pixel format or the alpha channel surface
3591
 * attached to the source surface as the source alpha channel for this overlay.
3592
 *)
3593
  DDOVER_ALPHASRC                         = $00000020;
3594
 
3595
(*
3596
 * Use the dwConstAlphaSrc field in the TDDOverlayFX structure as the source
3597
 * alpha channel for this overlay.
3598
 *)
3599
  DDOVER_ALPHASRCCONSTOVERRIDE            = $00000040;
3600
 
3601
(*
3602
 * The NEG suffix indicates that the source surface becomes more transparent
3603
 * as the alpha value increases.
3604
 *)
3605
  DDOVER_ALPHASRCNEG                      = $00000080;
3606
 
3607
(*
3608
 * Use the lpDDSAlphaSrc field in the TDDOverlayFX structure as the alpha channel
3609
 * source for this overlay.
3610
 *)
3611
  DDOVER_ALPHASRCSURFACEOVERRIDE          = $00000100;
3612
 
3613
(*
3614
 * Turn this overlay off.
3615
 *)
3616
  DDOVER_HIDE                             = $00000200;
3617
 
3618
(*
3619
 * Use the color key associated with the destination surface.
3620
 *)
3621
  DDOVER_KEYDEST                          = $00000400;
3622
 
3623
(*
3624
 * Use the dckDestColorkey field in the TDDOverlayFX structure as the color key
3625
 * for the destination surface
3626
 *)
3627
  DDOVER_KEYDESTOVERRIDE                  = $00000800;
3628
 
3629
(*
3630
 * Use the color key associated with the source surface.
3631
 *)
3632
  DDOVER_KEYSRC                           = $00001000;
3633
 
3634
(*
3635
 * Use the dckSrcColorkey field in the TDDOverlayFX structure as the color key
3636
 * for the source surface.
3637
 *)
3638
  DDOVER_KEYSRCOVERRIDE                   = $00002000;
3639
 
3640
(*
3641
 * Turn this overlay on.
3642
 *)
3643
  DDOVER_SHOW                             = $00004000;
3644
 
3645
(*
3646
 * Add a dirty rect to an emulated overlayed surface.
3647
 *)
3648
  DDOVER_ADDDIRTYRECT                     = $00008000;
3649
 
3650
(*
3651
 * Redraw all dirty rects on an emulated overlayed surface.
3652
 *)
3653
  DDOVER_REFRESHDIRTYRECTS                = $00010000;
3654
 
3655
(*
3656
 * Redraw the entire surface on an emulated overlayed surface.
3657
 *)
3658
  DDOVER_REFRESHALL                      = $00020000;
3659
 
3660
(*
3661
 * Use the overlay FX flags to define special overlay FX
3662
 *)
3663
  DDOVER_DDFX                             = $00080000;
3664
 
3665
(*
3666
 * Autoflip the overlay when ever the video port autoflips
3667
 *)
3668
  DDOVER_AUTOFLIP                         = $00100000;
3669
 
3670
(*
3671
 * Display each field of video port data individually without
3672
 * causing any jittery artifacts
3673
 *)
3674
  DDOVER_BOB                              = $00200000;
3675
 
3676
(*
3677
 * Indicates that bob/weave decisions should not be overridden by other
3678
 * interfaces.
3679
 *)
3680
  DDOVER_OVERRIDEBOBWEAVE                 = $00400000;
3681
 
3682
(*
3683
 * Indicates that the surface memory is composed of interleaved fields.
3684
 *)
3685
  DDOVER_INTERLEAVED                      = $00800000;
3686
 
3687
(*
3688
 * Indicates that bob will be performed using hardware rather than
3689
 * software or emulated.
3690
 *)
3691
  DDOVER_BOBHARDWARE                    = $01000000;
3692
 
3693
(*
3694
 * Indicates that overlay FX structure contains valid ARGB scaling factors.
3695
 *)
3696
  DDOVER_ARGBSCALEFACTORS                 = $02000000;
3697
 
3698
(*
3699
 * Indicates that ARGB scaling factors can be degraded to fit driver capabilities.
3700
 *)
3701
  DDOVER_DEGRADEARGBSCALING               = $04000000;
3702
 
3703
(****************************************************************************
3704
 *
3705
 * DIRECTDRAWSURFACE LOCK FLAGS
3706
 *
3707
 ****************************************************************************)
3708
 
3709
(*
3710
 * The default.  Set to indicate that Lock should return a valid memory pointer
3711
 * to the top of the specified rectangle.  If no rectangle is specified then a
3712
 * pointer to the top of the surface is returned.
3713
 *)
3714
  DDLOCK_SURFACEMEMORYPTR                 = $00000000;    // = default
3715
 
3716
(*
3717
 * Set to indicate that Lock should wait until it can obtain a valid memory
3718
 * pointer before returning.  If this bit is set, Lock will never return
3719
 * DDERR_WASSTILLDRAWING.
3720
 *)
3721
  DDLOCK_WAIT                             = $00000001;
3722
 
3723
(*
3724
 * Set if an event handle is being passed to Lock.  Lock will trigger the event
3725
 * when it can return the surface memory pointer requested.
3726
 *)
3727
  DDLOCK_EVENT                            = $00000002;
3728
 
3729
(*
3730
 * Indicates that the surface being locked will only be read from.
3731
 *)
3732
  DDLOCK_READONLY                         = $00000010;
3733
 
3734
(*
3735
 * Indicates that the surface being locked will only be written to
3736
 *)
3737
  DDLOCK_WRITEONLY                        = $00000020;
3738
 
3739
(*
3740
 * Indicates that a system wide lock should not be taken when this surface
3741
 * is locked. This has several advantages (cursor responsiveness, ability
3742
 * to call more Windows functions, easier debugging) when locking video
3743
 * memory surfaces. However, an application specifying this flag must
3744
 * comply with a number of conditions documented in the help file.
3745
 * Furthermore, this flag cannot be specified when locking the primary.
3746
 *)
3747
  DDLOCK_NOSYSLOCK                        = $00000800;
3748
 
3749
(*
3750
 * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices
3751
 * that were referred to in Draw*PrimtiveVB calls since the start of the
3752
 * frame (or the last lock without this flag) will be modified during the
3753
 * lock. This can be useful when one is only appending data to the vertex
3754
 * buffer
3755
 *)
3756
  DDLOCK_NOOVERWRITE                      = $00001000;
3757
 
3758
(*
3759
 * Indicates that no assumptions will be made about the contents of the
3760
 * surface or vertex buffer during this lock.
3761
 * This enables two things:
3762
 * -    Direct3D or the driver may provide an alternative memory
3763
 *      area as the vertex buffer. This is useful when one plans to clear the
3764
 *      contents of the vertex buffer and fill in new data.
3765
 * -    Drivers sometimes store surface data in a re-ordered format.
3766
 *      When the application locks the surface, the driver is forced to un-re-order
3767
 *      the surface data before allowing the application to see the surface contents.
3768
 *      This flag is a hint to the driver that it can skip the un-re-ordering process
3769
 *      since the application plans to overwrite every single pixel in the surface
3770
 *      or locked rectangle (and so erase any un-re-ordered pixels anyway).
3771
 *      Applications should always set this flag when they intend to overwrite the entire
3772
 *      surface or locked rectangle.
3773
 *)
3774
  DDLOCK_DISCARDCONTENTS                  = $00002000;
3775
 (*
3776
  * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS
3777
  *)
3778
  DDLOCK_OKTOSWAP                         = $00002000;
3779
 
3780
(*
3781
 * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish
3782
 * to override the default and use time when the accelerator is busy (as denoted by
3783
 * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT.
3784
 *)
3785
  DDLOCK_DONOTWAIT                        = $00004000;
3786
 
3787
 
3788
(****************************************************************************
3789
 *
3790
 * DIRECTDRAWSURFACE PAGELOCK FLAGS
3791
 *
3792
 ****************************************************************************)
3793
 
3794
(*
3795
 * No flags defined at present
3796
 *)
3797
 
3798
 
3799
(****************************************************************************
3800
 *
3801
 * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS
3802
 *
3803
 ****************************************************************************)
3804
 
3805
(*
3806
 * No flags defined at present
3807
 *)
3808
 
3809
 
3810
(****************************************************************************
3811
 *
3812
 * DIRECTDRAWSURFACE BLT FX FLAGS
3813
 *
3814
 ****************************************************************************)
3815
 
3816
(*
3817
 * If stretching, use arithmetic stretching along the Y axis for this blt.
3818
 *)
3819
  DDBLTFX_ARITHSTRETCHY                   = $00000001;
3820
 
3821
(*
3822
 * Do this blt mirroring the surface left to right.  Spin the
3823
 * surface around its y-axis.
3824
 *)
3825
  DDBLTFX_MIRRORLEFTRIGHT                 = $00000002;
3826
 
3827
(*
3828
 * Do this blt mirroring the surface up and down.  Spin the surface
3829
 * around its x-axis.
3830
 *)
3831
  DDBLTFX_MIRRORUPDOWN                    = $00000004;
3832
 
3833
(*
3834
 * Schedule this blt to avoid tearing.
3835
 *)
3836
  DDBLTFX_NOTEARING                       = $00000008;
3837
 
3838
(*
3839
 * Do this blt rotating the surface one hundred and eighty degrees.
3840
 *)
3841
  DDBLTFX_ROTATE180                       = $00000010;
3842
 
3843
(*
3844
 * Do this blt rotating the surface two hundred and seventy degrees.
3845
 *)
3846
  DDBLTFX_ROTATE270                       = $00000020;
3847
 
3848
(*
3849
 * Do this blt rotating the surface ninety degrees.
3850
 *)
3851
  DDBLTFX_ROTATE90                        = $00000040;
3852
 
3853
(*
3854
 * Do this z blt using dwZBufferLow and dwZBufferHigh as  range values
3855
 * specified to limit the bits copied from the source surface.
3856
 *)
3857
  DDBLTFX_ZBUFFERRANGE                    = $00000080;
3858
 
3859
(*
3860
 * Do this z blt adding the dwZBufferBaseDest to each of the sources z values
3861
 * before comparing it with the desting z values.
3862
 *)
3863
  DDBLTFX_ZBUFFERBASEDEST                 = $00000100;
3864
 
3865
(****************************************************************************
3866
 *
3867
 * DIRECTDRAWSURFACE OVERLAY FX FLAGS
3868
 *
3869
 ****************************************************************************)
3870
 
3871
(*
3872
 * If stretching, use arithmetic stretching along the Y axis for this overlay.
3873
 *)
3874
  DDOVERFX_ARITHSTRETCHY                  = $00000001;
3875
 
3876
(*
3877
 * Mirror the overlay across the vertical axis
3878
 *)
3879
  DDOVERFX_MIRRORLEFTRIGHT                = $00000002;
3880
 
3881
(*
3882
 * Mirror the overlay across the horizontal axis
3883
 *)
3884
  DDOVERFX_MIRRORUPDOWN                   = $00000004;
3885
 
3886
(****************************************************************************
3887
 *
3888
 * Flags for dwDDFX member of DDSPRITEFX structure
3889
 *
3890
 ****************************************************************************)
3891
(*
3892
 * Use affine transformation matrix in fTransform member.
3893
 *)
3894
  DDSPRITEFX_AFFINETRANSFORM            = $00000001;
3895
 
3896
(*
3897
 * Use RGBA scaling factors in ddrgbaScaleFactors member.
3898
 *)
3899
  DDSPRITEFX_RGBASCALING                        = $00000002;
3900
 
3901
(*
3902
 * Degrade RGBA scaling factors to accommodate driver's capabilities.
3903
 *)
3904
  DDSPRITEFX_DEGRADERGBASCALING         = $00000004;
3905
 
3906
(*
3907
 * Do bilinear filtering of stretched or warped sprite.
3908
 *)
3909
  DDSPRITEFX_BILINEARFILTER                     = $00000008;
3910
 
3911
(*
3912
 * Do "blur" filtering of stretched or warped sprite.
3913
 *)
3914
  DDSPRITEFX_BLURFILTER                         = $00000010;
3915
 
3916
(*
3917
 * Do "flat" filtering of stretched or warped sprite.
3918
 *)
3919
  DDSPRITEFX_FLATFILTER                         = $00000020;
3920
 
3921
(*
3922
 * Degrade filtering operation to accommodate driver's capabilities.
3923
 *)
3924
  DDSPRITEFX_DEGRADEFILTER              = $00000040;
3925
 
3926
(****************************************************************************
3927
 *
3928
 * DIRECTDRAW WAITFORVERTICALBLANK FLAGS
3929
 *
3930
 ****************************************************************************)
3931
 
3932
(*
3933
 * return when the vertical blank interval begins
3934
 *)
3935
  DDWAITVB_BLOCKBEGIN                     = $00000001;
3936
 
3937
(*
3938
 * set up an event to trigger when the vertical blank begins
3939
 *)
3940
  DDWAITVB_BLOCKBEGINEVENT                = $00000002;
3941
 
3942
(*
3943
 * return when the vertical blank interval ends and display begins
3944
 *)
3945
  DDWAITVB_BLOCKEND                       = $00000004;
3946
 
3947
(****************************************************************************
3948
 *
3949
 * DIRECTDRAW GETFLIPSTATUS FLAGS
3950
 *
3951
 ****************************************************************************)
3952
 
3953
(*
3954
 * is it OK to flip now?
3955
 *)
3956
  DDGFS_CANFLIP                   = $00000001;
3957
 
3958
(*
3959
 * is the last flip finished?
3960
 *)
3961
  DDGFS_ISFLIPDONE                = $00000002;
3962
 
3963
(****************************************************************************
3964
 *
3965
 * DIRECTDRAW GETBLTSTATUS FLAGS
3966
 *
3967
 ****************************************************************************)
3968
 
3969
(*
3970
 * is it OK to blt now?
3971
 *)
3972
  DDGBS_CANBLT                    = $00000001;
3973
 
3974
(*
3975
 * is the blt to the surface finished?
3976
 *)
3977
  DDGBS_ISBLTDONE                 = $00000002;
3978
 
3979
 
3980
(****************************************************************************
3981
 *
3982
 * DIRECTDRAW ENUMOVERLAYZORDER FLAGS
3983
 *
3984
 ****************************************************************************)
3985
 
3986
(*
3987
 * Enumerate overlays back to front.
3988
 *)
3989
  DDENUMOVERLAYZ_BACKTOFRONT      = $00000000;
3990
 
3991
(*
3992
 * Enumerate overlays front to back
3993
 *)
3994
  DDENUMOVERLAYZ_FRONTTOBACK      = $00000001;
3995
 
3996
(****************************************************************************
3997
 *
3998
 * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS
3999
 *
4000
 ****************************************************************************)
4001
 
4002
(*
4003
 * Send overlay to front
4004
 *)
4005
  DDOVERZ_SENDTOFRONT             = $00000000;
4006
 
4007
(*
4008
 * Send overlay to back
4009
 *)
4010
  DDOVERZ_SENDTOBACK              = $00000001;
4011
 
4012
(*
4013
 * Move Overlay forward
4014
 *)
4015
  DDOVERZ_MOVEFORWARD             = $00000002;
4016
 
4017
(*
4018
 * Move Overlay backward
4019
 *)
4020
  DDOVERZ_MOVEBACKWARD            = $00000003;
4021
 
4022
(*
4023
 * Move Overlay in front of relative surface
4024
 *)
4025
  DDOVERZ_INSERTINFRONTOF         = $00000004;
4026
 
4027
(*
4028
 * Move Overlay in back of relative surface
4029
 *)
4030
  DDOVERZ_INSERTINBACKOF          = $00000005;
4031
 
4032
(****************************************************************************
4033
 *
4034
 * DIRECTDRAW SETGAMMARAMP FLAGS
4035
 *
4036
 ****************************************************************************)
4037
 
4038
(*
4039
 * Request calibrator to adjust the gamma ramp according to the physical
4040
 * properties of the display so that the result should appear identical
4041
 * on all systems.
4042
 *)
4043
  DDSGR_CALIBRATE                        = $00000001;
4044
 
4045
(****************************************************************************
4046
 *
4047
 * DIRECTDRAW STARTMODETEST FLAGS
4048
 *
4049
 ****************************************************************************)
4050
 
4051
(*
4052
 * Indicates that the mode being tested has passed
4053
 *)
4054
 DDSMT_ISTESTREQUIRED                   = $00000001;
4055
 
4056
 
4057
(****************************************************************************
4058
 *
4059
 * DIRECTDRAW EVALUATEMODE FLAGS
4060
 *
4061
 ****************************************************************************)
4062
 
4063
(*
4064
 * Indicates that the mode being tested has passed
4065
 *)
4066
 DDEM_MODEPASSED                        = $00000001;
4067
 
4068
(*
4069
 * Indicates that the mode being tested has failed
4070
 *)
4071
 DDEM_MODEFAILED                        = $00000002;
4072
 
4073
(*===========================================================================
4074
 *
4075
 *
4076
 * DIRECTDRAW RETURN CODES
4077
 *
4078
 * The return values from DirectDraw Commands and Surface that return an HResult
4079
 * are codes from DirectDraw concerning the results of the action
4080
 * requested by DirectDraw.
4081
 *
4082
 *==========================================================================*)
4083
 
4084
(*
4085
 * Status is OK
4086
 *
4087
 * Issued by: DirectDraw Commands and all callbacks
4088
 *)
4089
  DD_OK                                   = 0;
4090
  DD_FALSE                                = S_FALSE;
4091
 
4092
(****************************************************************************
4093
 *
4094
 * DIRECTDRAW ENUMCALLBACK RETURN VALUES
4095
 *
4096
 * EnumCallback returns are used to control the flow of the DIRECTDRAW and
4097
 * DIRECTDRAWSURFACE object enumerations.   They can only be returned by
4098
 * enumeration callback routines.
4099
 *
4100
 ****************************************************************************)
4101
 
4102
(*
4103
 * stop the enumeration
4104
 *)
4105
  DDENUMRET_CANCEL                        = 0;
4106
 
4107
(*
4108
 * continue the enumeration
4109
 *)
4110
  DDENUMRET_OK                            = 1;
4111
 
4112
(****************************************************************************
4113
 *
4114
 * DIRECTDRAW ERRORS
4115
 *
4116
 * Errors are represented by negative values and cannot be combined.
4117
 *
4118
 ****************************************************************************)
4119
 
4120
  _FACDD = $876;
4121
  MAKE_DDHRESULT = HResult(1 shl 31) or HResult(_FACDD shl 16);
4122
 
4123
 
4124
(*
4125
 * This object is already initialized
4126
 *)
4127
  DDERR_ALREADYINITIALIZED                = MAKE_DDHRESULT + 5;
4128
 
4129
(*
4130
 * This surface can not be attached to the requested surface.
4131
 *)
4132
  DDERR_CANNOTATTACHSURFACE               = MAKE_DDHRESULT + 10;
4133
 
4134
(*
4135
 * This surface can not be detached from the requested surface.
4136
 *)
4137
  DDERR_CANNOTDETACHSURFACE               = MAKE_DDHRESULT + 20;
4138
 
4139
(*
4140
 * Support is currently not available.
4141
 *)
4142
  DDERR_CURRENTLYNOTAVAIL                 = MAKE_DDHRESULT + 40;
4143
 
4144
(*
4145
 * An exception was encountered while performing the requested operation
4146
 *)
4147
  DDERR_EXCEPTION                         = MAKE_DDHRESULT + 55;
4148
 
4149
(*
4150
 * Generic failure.
4151
 *)
4152
  DDERR_GENERIC                           = E_FAIL;
4153
 
4154
(*
4155
 * Height of rectangle provided is not a multiple of reqd alignment
4156
 *)
4157
  DDERR_HEIGHTALIGN                       = MAKE_DDHRESULT + 90;
4158
 
4159
(*
4160
 * Unable to match primary surface creation request with existing
4161
 * primary surface.
4162
 *)
4163
  DDERR_INCOMPATIBLEPRIMARY               = MAKE_DDHRESULT + 95;
4164
 
4165
(*
4166
 * One or more of the caps bits passed to the callback are incorrect.
4167
 *)
4168
  DDERR_INVALIDCAPS                       = MAKE_DDHRESULT + 100;
4169
 
4170
(*
4171
 * DirectDraw does not support provided Cliplist.
4172
 *)
4173
  DDERR_INVALIDCLIPLIST                   = MAKE_DDHRESULT + 110;
4174
 
4175
(*
4176
 * DirectDraw does not support the requested mode
4177
 *)
4178
  DDERR_INVALIDMODE                       = MAKE_DDHRESULT + 120;
4179
 
4180
(*
4181
 * DirectDraw received a pointer that was an invalid DIRECTDRAW object.
4182
 *)
4183
  DDERR_INVALIDOBJECT                     = MAKE_DDHRESULT + 130;
4184
 
4185
(*
4186
 * One or more of the parameters passed to the callback function are
4187
 * incorrect.
4188
 *)
4189
  DDERR_INVALIDPARAMS                     = E_INVALIDARG;
4190
 
4191
(*
4192
 * pixel format was invalid as specified
4193
 *)
4194
  DDERR_INVALIDPIXELFORMAT                = MAKE_DDHRESULT + 145;
4195
 
4196
(*
4197
 * Rectangle provided was invalid.
4198
 *)
4199
  DDERR_INVALIDRECT                       = MAKE_DDHRESULT + 150;
4200
 
4201
(*
4202
 * Operation could not be carried out because one or more surfaces are locked
4203
 *)
4204
  DDERR_LOCKEDSURFACES                    = MAKE_DDHRESULT + 160;
4205
 
4206
(*
4207
 * There is no 3D present.
4208
 *)
4209
  DDERR_NO3D                              = MAKE_DDHRESULT + 170;
4210
 
4211
(*
4212
 * Operation could not be carried out because there is no alpha accleration
4213
 * hardware present or available.
4214
 *)
4215
  DDERR_NOALPHAHW                         = MAKE_DDHRESULT + 180;
4216
 
4217
(*
4218
 * Operation could not be carried out because there is no stereo
4219
 * hardware present or available.
4220
 *)
4221
  DDERR_NOSTEREOHARDWARE          = MAKE_DDHRESULT + 181;
4222
 
4223
(*
4224
 * Operation could not be carried out because there is no hardware
4225
 * present which supports stereo surfaces
4226
 *)
4227
  DDERR_NOSURFACELEFT             = MAKE_DDHRESULT + 182;
4228
 
4229
(*
4230
 * no clip list available
4231
 *)
4232
  DDERR_NOCLIPLIST                        = MAKE_DDHRESULT + 205;
4233
 
4234
(*
4235
 * Operation could not be carried out because there is no color conversion
4236
 * hardware present or available.
4237
 *)
4238
  DDERR_NOCOLORCONVHW                     = MAKE_DDHRESULT + 210;
4239
 
4240
(*
4241
 * Create function called without DirectDraw object method SetCooperativeLevel
4242
 * being called.
4243
 *)
4244
  DDERR_NOCOOPERATIVELEVELSET             = MAKE_DDHRESULT + 212;
4245
 
4246
(*
4247
 * Surface doesn't currently have a color key
4248
 *)
4249
  DDERR_NOCOLORKEY                        = MAKE_DDHRESULT + 215;
4250
 
4251
(*
4252
 * Operation could not be carried out because there is no hardware support
4253
 * of the dest color key.
4254
 *)
4255
  DDERR_NOCOLORKEYHW                      = MAKE_DDHRESULT + 220;
4256
 
4257
(*
4258
 * No DirectDraw support possible with current display driver
4259
 *)
4260
  DDERR_NODIRECTDRAWSUPPORT               = MAKE_DDHRESULT + 222;
4261
 
4262
(*
4263
 * Operation requires the application to have exclusive mode but the
4264
 * application does not have exclusive mode.
4265
 *)
4266
  DDERR_NOEXCLUSIVEMODE                   = MAKE_DDHRESULT + 225;
4267
 
4268
(*
4269
 * Flipping visible surfaces is not supported.
4270
 *)
4271
  DDERR_NOFLIPHW                          = MAKE_DDHRESULT + 230;
4272
 
4273
(*
4274
 * There is no GDI present.
4275
 *)
4276
  DDERR_NOGDI                             = MAKE_DDHRESULT + 240;
4277
 
4278
(*
4279
 * Operation could not be carried out because there is no hardware present
4280
 * or available.
4281
 *)
4282
  DDERR_NOMIRRORHW                        = MAKE_DDHRESULT + 250;
4283
 
4284
(*
4285
 * Requested item was not found
4286
 *)
4287
  DDERR_NOTFOUND                          = MAKE_DDHRESULT + 255;
4288
 
4289
(*
4290
 * Operation could not be carried out because there is no overlay hardware
4291
 * present or available.
4292
 *)
4293
  DDERR_NOOVERLAYHW                       = MAKE_DDHRESULT + 260;
4294
 
4295
(*
4296
 * Operation could not be carried out because the source and destination
4297
 * rectangles are on the same surface and overlap each other.
4298
 *)
4299
  DDERR_OVERLAPPINGRECTS                = MAKE_DDHRESULT + 270;
4300
 
4301
(*
4302
 * Operation could not be carried out because there is no appropriate raster
4303
 * op hardware present or available.
4304
 *)
4305
  DDERR_NORASTEROPHW                      = MAKE_DDHRESULT + 280;
4306
 
4307
(*
4308
 * Operation could not be carried out because there is no rotation hardware
4309
 * present or available.
4310
 *)
4311
  DDERR_NOROTATIONHW                      = MAKE_DDHRESULT + 290;
4312
 
4313
(*
4314
 * Operation could not be carried out because there is no hardware support
4315
 * for stretching
4316
 *)
4317
  DDERR_NOSTRETCHHW                       = MAKE_DDHRESULT + 310;
4318
 
4319
(*
4320
 * DirectDrawSurface is not in 4 bit color palette and the requested operation
4321
 * requires 4 bit color palette.
4322
 *)
4323
  DDERR_NOT4BITCOLOR                      = MAKE_DDHRESULT + 316;
4324
 
4325
(*
4326
 * DirectDrawSurface is not in 4 bit color index palette and the requested
4327
 * operation requires 4 bit color index palette.
4328
 *)
4329
  DDERR_NOT4BITCOLORINDEX                 = MAKE_DDHRESULT + 317;
4330
 
4331
(*
4332
 * DirectDraw Surface is not in 8 bit color mode and the requested operation
4333
 * requires 8 bit color.
4334
 *)
4335
  DDERR_NOT8BITCOLOR                      = MAKE_DDHRESULT + 320;
4336
 
4337
(*
4338
 * Operation could not be carried out because there is no texture mapping
4339
 * hardware present or available.
4340
 *)
4341
  DDERR_NOTEXTUREHW                       = MAKE_DDHRESULT + 330;
4342
 
4343
(*
4344
 * Operation could not be carried out because there is no hardware support
4345
 * for vertical blank synchronized operations.
4346
 *)
4347
  DDERR_NOVSYNCHW                         = MAKE_DDHRESULT + 335;
4348
 
4349
(*
4350
 * Operation could not be carried out because there is no hardware support
4351
 * for zbuffer blting.
4352
 *)
4353
  DDERR_NOZBUFFERHW                       = MAKE_DDHRESULT + 340;
4354
 
4355
(*
4356
 * Overlay surfaces could not be z layered based on their BltOrder because
4357
 * the hardware does not support z layering of overlays.
4358
 *)
4359
  DDERR_NOZOVERLAYHW                      = MAKE_DDHRESULT + 350;
4360
 
4361
(*
4362
 * The hardware needed for the requested operation has already been
4363
 * allocated.
4364
 *)
4365
  DDERR_OUTOFCAPS                         = MAKE_DDHRESULT + 360;
4366
 
4367
(*
4368
 * DirectDraw does not have enough memory to perform the operation.
4369
 *)
4370
  DDERR_OUTOFMEMORY                       = E_OUTOFMEMORY;
4371
 
4372
(*
4373
 * DirectDraw does not have enough memory to perform the operation.
4374
 *)
4375
  DDERR_OUTOFVIDEOMEMORY                  = MAKE_DDHRESULT + 380;
4376
 
4377
(*
4378
 * hardware does not support clipped overlays
4379
 *)
4380
  DDERR_OVERLAYCANTCLIP                   = MAKE_DDHRESULT + 382;
4381
 
4382
(*
4383
 * Can only have ony color key active at one time for overlays
4384
 *)
4385
  DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = MAKE_DDHRESULT + 384;
4386
 
4387
(*
4388
 * Access to this palette is being refused because the palette is already
4389
 * locked by another thread.
4390
 *)
4391
  DDERR_PALETTEBUSY                       = MAKE_DDHRESULT + 387;
4392
 
4393
(*
4394
 * No src color key specified for this operation.
4395
 *)
4396
  DDERR_COLORKEYNOTSET                    = MAKE_DDHRESULT + 400;
4397
 
4398
(*
4399
 * This surface is already attached to the surface it is being attached to.
4400
 *)
4401
  DDERR_SURFACEALREADYATTACHED            = MAKE_DDHRESULT + 410;
4402
 
4403
(*
4404
 * This surface is already a dependency of the surface it is being made a
4405
 * dependency of.
4406
 *)
4407
  DDERR_SURFACEALREADYDEPENDENT           = MAKE_DDHRESULT + 420;
4408
 
4409
(*
4410
 * Access to this surface is being refused because the surface is already
4411
 * locked by another thread.
4412
 *)
4413
  DDERR_SURFACEBUSY                       = MAKE_DDHRESULT + 430;
4414
 
4415
(*
4416
 * Access to this surface is being refused because no driver exists
4417
 * which can supply a pointer to the surface.
4418
 * This is most likely to happen when attempting to lock the primary
4419
 * surface when no DCI provider is present.
4420
 * Will also happen on attempts to lock an optimized surface.
4421
 *)
4422
  DDERR_CANTLOCKSURFACE                   = MAKE_DDHRESULT + 435;
4423
 
4424
(*
4425
 * Access to Surface refused because Surface is obscured.
4426
 *)
4427
  DDERR_SURFACEISOBSCURED                 = MAKE_DDHRESULT + 440;
4428
 
4429
(*
4430
 * Access to this surface is being refused because the surface is gone.
4431
 * The DIRECTDRAWSURFACE object representing this surface should
4432
 * have Restore called on it.
4433
 *)
4434
  DDERR_SURFACELOST                       = MAKE_DDHRESULT + 450;
4435
 
4436
(*
4437
 * The requested surface is not attached.
4438
 *)
4439
  DDERR_SURFACENOTATTACHED                = MAKE_DDHRESULT + 460;
4440
 
4441
(*
4442
 * Height requested by DirectDraw is too large.
4443
 *)
4444
  DDERR_TOOBIGHEIGHT                      = MAKE_DDHRESULT + 470;
4445
 
4446
(*
4447
 * Size requested by DirectDraw is too large --  The individual height and
4448
 * width are OK.
4449
 *)
4450
  DDERR_TOOBIGSIZE                        = MAKE_DDHRESULT + 480;
4451
 
4452
(*
4453
 * Width requested by DirectDraw is too large.
4454
 *)
4455
  DDERR_TOOBIGWIDTH                       = MAKE_DDHRESULT + 490;
4456
 
4457
(*
4458
 * Action not supported.
4459
 *)
4460
  DDERR_UNSUPPORTED                       = E_NOTIMPL;
4461
 
4462
(*
4463
 * FOURCC format requested is unsupported by DirectDraw
4464
 *)
4465
  DDERR_UNSUPPORTEDFORMAT                 = MAKE_DDHRESULT + 510;
4466
 
4467
(*
4468
 * Bitmask in the pixel format requested is unsupported by DirectDraw
4469
 *)
4470
  DDERR_UNSUPPORTEDMASK                   = MAKE_DDHRESULT + 520;
4471
 
4472
(*
4473
 * The specified stream contains invalid data
4474
 *)
4475
  DDERR_INVALIDSTREAM                     = MAKE_DDHRESULT + 521;
4476
 
4477
(*
4478
 * vertical blank is in progress
4479
 *)
4480
  DDERR_VERTICALBLANKINPROGRESS           = MAKE_DDHRESULT + 537;
4481
 
4482
(*
4483
 * Informs DirectDraw that the previous Blt which is transfering information
4484
 * to or from this Surface is incomplete.
4485
 *)
4486
  DDERR_WASSTILLDRAWING                   = MAKE_DDHRESULT + 540;
4487
 
4488
(*
4489
 * The specified surface type requires specification of the COMPLEX flag
4490
 *)
4491
  DDERR_DDSCAPSCOMPLEXREQUIRED            = MAKE_DDHRESULT + 542;
4492
 
4493
(*
4494
 * Rectangle provided was not horizontally aligned on reqd. boundary
4495
 *)
4496
  DDERR_XALIGN                            = MAKE_DDHRESULT + 560;
4497
 
4498
(*
4499
 * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver
4500
 * identifier.
4501
 *)
4502
  DDERR_INVALIDDIRECTDRAWGUID             = MAKE_DDHRESULT + 561;
4503
 
4504
(*
4505
 * A DirectDraw object representing this driver has already been created
4506
 * for this process.
4507
 *)
4508
  DDERR_DIRECTDRAWALREADYCREATED          = MAKE_DDHRESULT + 562;
4509
 
4510
(*
4511
 * A hardware only DirectDraw object creation was attempted but the driver
4512
 * did not support any hardware.
4513
 *)
4514
  DDERR_NODIRECTDRAWHW                    = MAKE_DDHRESULT + 563;
4515
 
4516
(*
4517
 * this process already has created a primary surface
4518
 *)
4519
  DDERR_PRIMARYSURFACEALREADYEXISTS       = MAKE_DDHRESULT + 564;
4520
 
4521
(*
4522
 * software emulation not available.
4523
 *)
4524
  DDERR_NOEMULATION                       = MAKE_DDHRESULT + 565;
4525
 
4526
(*
4527
 * region passed to Clipper::GetClipList is too small.
4528
 *)
4529
  DDERR_REGIONTOOSMALL                    = MAKE_DDHRESULT + 566;
4530
 
4531
(*
4532
 * an attempt was made to set a clip list for a clipper objec that
4533
 * is already monitoring an hwnd.
4534
 *)
4535
  DDERR_CLIPPERISUSINGHWND                = MAKE_DDHRESULT + 567;
4536
 
4537
(*
4538
 * No clipper object attached to surface object
4539
 *)
4540
  DDERR_NOCLIPPERATTACHED                 = MAKE_DDHRESULT + 568;
4541
 
4542
(*
4543
 * Clipper notification requires an HWND or
4544
 * no HWND has previously been set as the CooperativeLevel HWND.
4545
 *)
4546
  DDERR_NOHWND                            = MAKE_DDHRESULT + 569;
4547
 
4548
(*
4549
 * HWND used by DirectDraw CooperativeLevel has been subclassed,
4550
 * this prevents DirectDraw from restoring state.
4551
 *)
4552
  DDERR_HWNDSUBCLASSED                    = MAKE_DDHRESULT + 570;
4553
 
4554
(*
4555
 * The CooperativeLevel HWND has already been set.
4556
 * It can not be reset while the process has surfaces or palettes created.
4557
 *)
4558
  DDERR_HWNDALREADYSET                    = MAKE_DDHRESULT + 571;
4559
 
4560
(*
4561
 * No palette object attached to this surface.
4562
 *)
4563
  DDERR_NOPALETTEATTACHED                 = MAKE_DDHRESULT + 572;
4564
 
4565
(*
4566
 * No hardware support for 16 or 256 color palettes.
4567
 *)
4568
  DDERR_NOPALETTEHW                       = MAKE_DDHRESULT + 573;
4569
 
4570
(*
4571
 * If a clipper object is attached to the source surface passed into a
4572
 * BltFast call.
4573
 *)
4574
  DDERR_BLTFASTCANTCLIP                   = MAKE_DDHRESULT + 574;
4575
 
4576
(*
4577
 * No blter.
4578
 *)
4579
  DDERR_NOBLTHW                           = MAKE_DDHRESULT + 575;
4580
 
4581
(*
4582
 * No DirectDraw ROP hardware.
4583
 *)
4584
  DDERR_NODDROPSHW                        = MAKE_DDHRESULT + 576;
4585
 
4586
(*
4587
 * returned when GetOverlayPosition is called on a hidden overlay
4588
 *)
4589
  DDERR_OVERLAYNOTVISIBLE                 = MAKE_DDHRESULT + 577;
4590
 
4591
(*
4592
 * returned when GetOverlayPosition is called on a overlay that UpdateOverlay
4593
 * has never been called on to establish a destionation.
4594
 *)
4595
  DDERR_NOOVERLAYDEST                     = MAKE_DDHRESULT + 578;
4596
 
4597
(*
4598
 * returned when the position of the overlay on the destionation is no longer
4599
 * legal for that destionation.
4600
 *)
4601
  DDERR_INVALIDPOSITION                   = MAKE_DDHRESULT + 579;
4602
 
4603
(*
4604
 * returned when an overlay member is called for a non-overlay surface
4605
 *)
4606
  DDERR_NOTAOVERLAYSURFACE                = MAKE_DDHRESULT + 580;
4607
 
4608
(*
4609
 * An attempt was made to set the cooperative level when it was already
4610
 * set to exclusive.
4611
 *)
4612
  DDERR_EXCLUSIVEMODEALREADYSET           = MAKE_DDHRESULT + 581;
4613
 
4614
(*
4615
 * An attempt has been made to flip a surface that is not flippable.
4616
 *)
4617
  DDERR_NOTFLIPPABLE                      = MAKE_DDHRESULT + 582;
4618
 
4619
(*
4620
 * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly
4621
 * created.
4622
 *)
4623
  DDERR_CANTDUPLICATE                     = MAKE_DDHRESULT + 583;
4624
 
4625
(*
4626
 * Surface was not locked.  An attempt to unlock a surface that was not
4627
 * locked at all, or by this process, has been attempted.
4628
 *)
4629
  DDERR_NOTLOCKED                         = MAKE_DDHRESULT + 584;
4630
 
4631
(*
4632
 * Windows can not create any more DCs, or a DC was requested for a paltte-indexed
4633
 * surface when the surface had no palette AND the display mode was not palette-indexed
4634
 * (in this case DirectDraw cannot select a proper palette into the DC)
4635
 *)
4636
  DDERR_CANTCREATEDC                      = MAKE_DDHRESULT + 585;
4637
 
4638
(*
4639
 * No DC was ever created for this surface.
4640
 *)
4641
  DDERR_NODC                              = MAKE_DDHRESULT + 586;
4642
 
4643
(*
4644
 * This surface can not be restored because it was created in a different
4645
 * mode.
4646
 *)
4647
  DDERR_WRONGMODE                         = MAKE_DDHRESULT + 587;
4648
 
4649
(*
4650
 * This surface can not be restored because it is an implicitly created
4651
 * surface.
4652
 *)
4653
  DDERR_IMPLICITLYCREATED                 = MAKE_DDHRESULT + 588;
4654
 
4655
(*
4656
 * The surface being used is not a palette-based surface
4657
 *)
4658
  DDERR_NOTPALETTIZED                     = MAKE_DDHRESULT + 589;
4659
 
4660
(*
4661
 * The display is currently in an unsupported mode
4662
 *)
4663
  DDERR_UNSUPPORTEDMODE                   = MAKE_DDHRESULT + 590;
4664
 
4665
(*
4666
 * Operation could not be carried out because there is no mip-map
4667
 * texture mapping hardware present or available.
4668
 *)
4669
  DDERR_NOMIPMAPHW                        = MAKE_DDHRESULT + 591;
4670
 
4671
(*
4672
 * The requested action could not be performed because the surface was of
4673
 * the wrong type.
4674
 *)
4675
  DDERR_INVALIDSURFACETYPE                = MAKE_DDHRESULT + 592;
4676
 
4677
(*
4678
 * Device does not support optimized surfaces, therefore no video memory optimized surfaces
4679
 *)
4680
  DDERR_NOOPTIMIZEHW                      = MAKE_DDHRESULT + 600;
4681
 
4682
(*
4683
 * Surface is an optimized surface, but has not yet been allocated any memory
4684
 *)
4685
  DDERR_NOTLOADED                         = MAKE_DDHRESULT + 601;
4686
 
4687
(*
4688
 * Attempt was made to create or set a device window without first setting
4689
 * the focus window
4690
 *)
4691
  DDERR_NOFOCUSWINDOW                     = MAKE_DDHRESULT + 602;
4692
 
4693
(*
4694
 * Attempt was made to set a palette on a mipmap sublevel
4695
 *)
4696
  DDERR_NOTONMIPMAPSUBLEVEL               = MAKE_DDHRESULT + 603;
4697
 
4698
(*
4699
 * A DC has already been returned for this surface. Only one DC can be
4700
 * retrieved per surface.
4701
 *)
4702
  DDERR_DCALREADYCREATED                  = MAKE_DDHRESULT + 620;
4703
 
4704
(*
4705
 * An attempt was made to allocate non-local video memory from a device
4706
 * that does not support non-local video memory.
4707
 *)
4708
  DDERR_NONONLOCALVIDMEM                  = MAKE_DDHRESULT + 630;
4709
 
4710
(*
4711
 * The attempt to page lock a surface failed.
4712
 *)
4713
  DDERR_CANTPAGELOCK                      = MAKE_DDHRESULT + 640;
4714
 
4715
(*
4716
 * The attempt to page unlock a surface failed.
4717
 *)
4718
  DDERR_CANTPAGEUNLOCK                    = MAKE_DDHRESULT + 660;
4719
 
4720
(*
4721
 * An attempt was made to page unlock a surface with no outstanding page locks.
4722
 *)
4723
  DDERR_NOTPAGELOCKED                     = MAKE_DDHRESULT + 680;
4724
 
4725
(*
4726
 * There is more data available than the specified buffer size could hold
4727
 *)
4728
  DDERR_MOREDATA                                = MAKE_DDHRESULT + 690;
4729
 
4730
(*
4731
 * The data has expired and is therefore no longer valid.
4732
 *)
4733
  DDERR_EXPIRED                           = MAKE_DDHRESULT + 691;
4734
 
4735
(*
4736
 * The mode test has finished executing.
4737
 *)
4738
 DDERR_TESTFINISHED                      = MAKE_DDHRESULT + 692;
4739
 
4740
(*
4741
 * The mode test has switched to a new mode.
4742
 *)
4743
 DDERR_NEWMODE                           = MAKE_DDHRESULT + 693;
4744
 
4745
(*
4746
 * D3D has not yet been initialized.
4747
 *)
4748
 DDERR_D3DNOTINITIALIZED                 = MAKE_DDHRESULT + 694;
4749
 
4750
(*
4751
 * The video port is not active
4752
 *)
4753
  DDERR_VIDEONOTACTIVE                          = MAKE_DDHRESULT + 695;
4754
 
4755
(*
4756
 * The monitor does not have EDID data.
4757
 *)
4758
 DDERR_NOMONITORINFORMATION             = MAKE_DDHRESULT + 696;
4759
 
4760
(*
4761
 * The driver does not enumerate display mode refresh rates.
4762
 *)
4763
 DDERR_NODRIVERSUPPORT                  = MAKE_DDHRESULT + 697;
4764
 
4765
(*
4766
 * Surfaces created by one direct draw device cannot be used directly by
4767
 * another direct draw device.
4768
 *)
4769
  DDERR_DEVICEDOESNTOWNSURFACE                  = MAKE_DDHRESULT + 699;
4770
 
4771
(*
4772
 * An attempt was made to invoke an interface member of a DirectDraw object
4773
 * created by CoCreateInstance() before it was initialized.
4774
 *)
4775
  DDERR_NOTINITIALIZED                    = CO_E_NOTINITIALIZED;
4776
 
4777
(* Alpha bit depth constants *)
4778
 
4779
(*
4780
 * API's
4781
 *)
4782
 
1 daniel-mar 4783
type
4784
  HMonitor = THandle;
4785
 
4 daniel-mar 4786
  TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
4787
      lpDriverName: PAnsiChar; lpContext: Pointer) : BOOL; stdcall;
4788
  TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
4789
      lpDriverName: PWideChar; lpContext: Pointer) : BOOL; stdcall;
4790
{$IFDEF UNICODE}
4791
  TDDEnumCallback = TDDEnumCallbackW;
4792
{$ELSE}
4793
  TDDEnumCallback = TDDEnumCallbackA;
4794
{$ENDIF}
1 daniel-mar 4795
 
4 daniel-mar 4796
  TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
4797
      lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
4798
      stdcall;
4799
  TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
4800
      lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
4801
      stdcall;
4802
 
4803
{$IFDEF UNICODE}
4804
  TDDEnumCallbackEx = TDDEnumCallbackExW;
4805
{$ELSE}
4806
  TDDEnumCallbackEx = TDDEnumCallbackExA;
4807
{$ENDIF}
1 daniel-mar 4808
 
4 daniel-mar 4809
var
4810
  DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA;
4811
       lpContext: Pointer) : HResult; stdcall;
4812
  DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW;
4813
       lpContext: Pointer) : HResult; stdcall;
4814
  DirectDrawEnumerate : function (lpCallback: TDDEnumCallback;
4815
       lpContext: Pointer) : HResult; stdcall;
1 daniel-mar 4816
 
4 daniel-mar 4817
  DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA;
4818
       lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
4819
  DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW;
4820
       lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
4821
  DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx;
4822
       lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 4823
 
4 daniel-mar 4824
  DirectDrawCreate : function (lpGUID: PGUID;
4825
       out lplpDD: IDirectDraw;
4826
       pUnkOuter: IUnknown) : HResult; stdcall;
4827
  DirectDrawCreateEx : function  (lpGUID: PGUID;
4828
       out lplpDD: IDirectDraw7; const iid: TGUID;
4829
       pUnkOuter: IUnknown) : HResult; stdcall;
4830
  DirectDrawCreateClipper : function (dwFlags: DWORD;
4831
       out lplpDDClipper: IDirectDrawClipper;
4832
       pUnkOuter: IUnknown) : HResult; stdcall;
1 daniel-mar 4833
 
4 daniel-mar 4834
const
4835
(*
4836
 * Flags for DirectDrawEnumerateEx
4837
 * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to
4838
 * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx.
4839
 * By default, only the primary display device is enumerated.
4840
 * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES)
4841
 *)
1 daniel-mar 4842
 
4 daniel-mar 4843
(*
4844
 * This flag causes enumeration of any GDI display devices which are part of
4845
 * the Windows Desktop
4846
 *)
4847
  DDENUM_ATTACHEDSECONDARYDEVICES     = $00000001;
4848
 
4849
(*
4850
 * This flag causes enumeration of any GDI display devices which are not
4851
 * part of the Windows Desktop
4852
 *)
4853
  DDENUM_DETACHEDSECONDARYDEVICES     = $00000002;
4854
 
4855
(*
4856
 * This flag causes enumeration of non-display devices
4857
 *)
4858
  DDENUM_NONDISPLAYDEVICES            = $00000004;
4859
 
1 daniel-mar 4860
  REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
4861
  REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
4862
  REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
4863
 
4864
  DDCREATE_HARDWAREONLY       = $00000001;
4865
  DDCREATE_EMULATIONONLY      = $00000002;
4866
 
4 daniel-mar 4867
(*
4868
 * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel
4869
 *)
4870
function GET_WHQL_YEAR(dwWHQLLevel: DWORD) : DWORD;
4871
function GET_WHQL_MONTH(dwWHQLLevel: DWORD) : DWORD;
4872
function GET_WHQL_DAY(dwWHQLLevel: DWORD) : DWORD;
1 daniel-mar 4873
 
4874
 
4875
(*==========================================================================;
4876
 *
4877
 *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
4878
 *
4 daniel-mar 4879
 *  File:       dvp.h
4880
 *  Content:    DirectDrawVideoPort include file
1 daniel-mar 4881
 *
4882
 ***************************************************************************)
4883
 
4884
const
4 daniel-mar 4885
(*
4886
 * GUIDS used by DirectDrawVideoPort objects
4887
 *)
4888
  DDVPTYPE_E_HREFH_VREFH: TGUID =
4889
      (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4890
  DDVPTYPE_E_HREFH_VREFL: TGUID =
4891
      (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4892
  DDVPTYPE_E_HREFL_VREFH: TGUID =
4893
      (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4894
  DDVPTYPE_E_HREFL_VREFL: TGUID =
4895
      (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4896
  DDVPTYPE_CCIR656: TGUID =
4897
      (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4898
  DDVPTYPE_BROOKTREE: TGUID =
4899
      (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
4900
  DDVPTYPE_PHILIPS: TGUID =
4901
      (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
1 daniel-mar 4902
 
4 daniel-mar 4903
(*
4904
 * GUIDS used to describe connections
4905
 *)
1 daniel-mar 4906
 
4 daniel-mar 4907
(*============================================================================
4908
 *
4909
 * DirectDraw Structures
4910
 *
4911
 * Various structures used to invoke DirectDraw.
4912
 *
4913
 *==========================================================================*)
1 daniel-mar 4914
 
4915
type
4916
 
4 daniel-mar 4917
(*
4918
 * TDDVideoPortConnect
4919
 *)
4920
  PDDVideoPortConnect = ^TDDVideoPortConnect;
4921
  TDDVideoPortConnect = packed record
4922
    dwSize: DWORD;        // size of the TDDVideoPortConnect structure
1 daniel-mar 4923
    dwPortWidth: DWORD;   // Width of the video port
4924
    guidTypeID: TGUID;    // Description of video port connection
4925
    dwFlags: DWORD;       // Connection flags
4926
    dwReserved1: DWORD;   // Reserved, set to zero.
4927
  end;
4928
 
4 daniel-mar 4929
(*
4930
 * TDDVideoPortCaps
4931
 *)
4932
  PDDVideoPortCaps = ^TDDVideoPortCaps;
4933
  TDDVideoPortCaps = packed record
4934
    dwSize: DWORD;                          // size of the TDDVideoPortCaps structure
1 daniel-mar 4935
    dwFlags: DWORD;                         // indicates which fields contain data
4936
    dwMaxWidth: DWORD;                      // max width of the video port field
4937
    dwMaxVBIWidth: DWORD;                   // max width of the VBI data
4938
    dwMaxHeight: DWORD;                     // max height of the video port field
4939
    dwVideoPortID: DWORD;                   // Video port ID (0 - (dwMaxVideoPorts -1))
4940
    dwCaps: DWORD;                          // Video port capabilities
4941
    dwFX: DWORD;                            // More video port capabilities
4942
    dwNumAutoFlipSurfaces: DWORD;           // Number of autoflippable surfaces
4943
    dwAlignVideoPortBoundary: DWORD;        // Byte restriction of placement within the surface
4944
    dwAlignVideoPortPrescaleWidth: DWORD;   // Byte restriction of width after prescaling
4945
    dwAlignVideoPortCropBoundary: DWORD;    // Byte restriction of left cropping
4946
    dwAlignVideoPortCropWidth: DWORD;       // Byte restriction of cropping width
4947
    dwPreshrinkXStep: DWORD;                // Width can be shrunk in steps of 1/x
4948
    dwPreshrinkYStep: DWORD;                // Height can be shrunk in steps of 1/x
4949
    dwNumVBIAutoFlipSurfaces: DWORD;        // Number of VBI autoflippable surfaces
4 daniel-mar 4950
    dwNumPreferredAutoflip: DWORD;      // Optimal number of autoflippable surfaces for hardware
4951
    wNumFilterTapsX: WORD;              // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.)
4952
    wNumFilterTapsY: WORD;              // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.)
1 daniel-mar 4953
  end;
4954
 
4 daniel-mar 4955
const
4956
(*
4957
 * The dwMaxWidth and dwMaxVBIWidth members are valid
4958
 *)
4959
  DDVPD_WIDTH = $00000001;
1 daniel-mar 4960
 
4 daniel-mar 4961
(*
4962
 * The dwMaxHeight member is valid
4963
 *)
4964
  DDVPD_HEIGHT = $00000002;
1 daniel-mar 4965
 
4 daniel-mar 4966
(*
4967
 * The dwVideoPortID member is valid
4968
 *)
4969
  DDVPD_ID = $00000004;
4970
 
4971
(*
4972
 * The dwCaps member is valid
4973
 *)
4974
  DDVPD_CAPS = $00000008;
4975
 
4976
(*
4977
 * The dwFX member is valid
4978
 *)
4979
  DDVPD_FX = $00000010;
4980
 
4981
(*
4982
 * The dwNumAutoFlipSurfaces member is valid
4983
 *)
4984
  DDVPD_AUTOFLIP = $00000020;
4985
 
4986
(*
4987
 * All of the alignment members are valid
4988
 *)
4989
  DDVPD_ALIGN = $00000040;
4990
 
4991
(*
4992
 * The dwNumPreferredAutoflip member is valid
4993
 *)
4994
  DDVPD_PREFERREDAUTOFLIP = $00000080;
4995
 
4996
(*
4997
 * The wNumFilterTapsX and wNumFilterTapsY fields are valid
4998
 *)
4999
  DDVPD_FILTERQUALITY     = $00000100;
5000
 
5001
type
5002
(*
5003
 * TDDVideoPortDesc
5004
 *)
5005
  PDDVideoPortDesc = ^TDDVideoPortDesc;
5006
  TDDVideoPortDesc = packed record
5007
    dwSize: DWORD;                       // size of the TDDVideoPortDesc structure
1 daniel-mar 5008
    dwFieldWidth: DWORD;                 // width of the video port field
5009
    dwVBIWidth: DWORD;                   // width of the VBI data
5010
    dwFieldHeight: DWORD;                // height of the video port field
5011
    dwMicrosecondsPerField: DWORD;       // Microseconds per video field
5012
    dwMaxPixelsPerSecond: DWORD;         // Maximum pixel rate per second
5013
    dwVideoPortID: DWORD;                // Video port ID (0 - (dwMaxVideoPorts -1))
5014
    dwReserved1: DWORD;                  // Reserved for future use - set to zero
4 daniel-mar 5015
    VideoPortType: TDDVideoPortConnect;  // Description of video port connection
1 daniel-mar 5016
    dwReserved2: DWORD;                  // Reserved for future use - set to zero
5017
    dwReserved3: DWORD;                  // Reserved for future use - set to zero
5018
  end;
5019
 
4 daniel-mar 5020
(*
5021
 * TDDVideoPortInfo
5022
 *)
5023
  PDDVideoPortInfo = ^TDDVideoPortInfo;
5024
  TDDVideoPortInfo = packed record
1 daniel-mar 5025
    dwSize: DWORD;                            // Size of the structure
5026
    dwOriginX: DWORD;                         // Placement of the video data within the surface.
5027
    dwOriginY: DWORD;                         // Placement of the video data within the surface.
5028
    dwVPFlags: DWORD;                         // Video port options
5029
    rCrop: TRect;                             // Cropping rectangle (optional).
5030
    dwPrescaleWidth: DWORD;                   // Determines pre-scaling/zooming in the X direction (optional).
5031
    dwPrescaleHeight: DWORD;                  // Determines pre-scaling/zooming in the Y direction (optional).
4 daniel-mar 5032
    lpddpfInputFormat: PDDPixelFormat;       // Video format written to the video port
5033
    lpddpfVBIInputFormat: PDDPixelFormat;    // Input format of the VBI data
5034
    lpddpfVBIOutputFormat: PDDPixelFormat;   // Output format of the data
1 daniel-mar 5035
    dwVBIHeight: DWORD;                       // Specifies the number of lines of data within the vertical blanking interval.
5036
    dwReserved1: DWORD;                       // Reserved for future use - set to zero
5037
    dwReserved2: DWORD;                       // Reserved for future use - set to zero
5038
  end;
5039
 
4 daniel-mar 5040
(*
5041
 * TDDVideoPortBandWidth
5042
 *)
5043
  PDDVideoPortBandWidth = ^TDDVideoPortBandWidth;
5044
  TDDVideoPortBandWidth = packed record
1 daniel-mar 5045
    dwSize: DWORD;                 // Size of the structure
5046
    dwCaps: DWORD;
5047
    dwOverlay: DWORD;              // Zoom factor at which overlay is supported
5048
    dwColorkey: DWORD;             // Zoom factor at which overlay w/ colorkey is supported
5049
    dwYInterpolate: DWORD;         // Zoom factor at which overlay w/ Y interpolation is supported
5050
    dwYInterpAndColorkey: DWORD;   // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
5051
    dwReserved1: DWORD;            // Reserved for future use - set to zero
5052
    dwReserved2: DWORD;            // Reserved for future use - set to zero
5053
  end;
5054
 
4 daniel-mar 5055
(*
5056
 * TDDVideoPortStatus
5057
 *)
5058
  PDDVideoPortStatus = ^TDDVideoPortStatus;
5059
  TDDVideoPortStatus = record
1 daniel-mar 5060
    dwSize: DWORD;                       // Size of the structure
5061
    bInUse: BOOL;                        // TRUE if video port is currently being used
5062
    dwFlags: DWORD;                      // Currently not used
5063
    dwReserved1: DWORD;                  // Reserved for future use
4 daniel-mar 5064
    VideoPortType: TDDVideoPortConnect;  // Information about the connection
1 daniel-mar 5065
    dwReserved2: DWORD;                  // Reserved for future use
5066
    dwReserved3: DWORD;                  // Reserved for future use
5067
  end;
5068
 
4 daniel-mar 5069
const
5070
(*============================================================================
5071
 *
5072
 * Video Port Flags
5073
 *
5074
 * All flags are bit flags.
5075
 *
5076
 *==========================================================================*)
1 daniel-mar 5077
 
4 daniel-mar 5078
(****************************************************************************
5079
 *
5080
 * VIDEOPORT TDDVideoPortConnect FLAGS
5081
 *
5082
 ****************************************************************************)
1 daniel-mar 5083
 
4 daniel-mar 5084
(*
5085
 * When this is set by the driver and passed to the client, this
5086
 * indicates that the video port is capable of double clocking the data.
5087
 * When this is set by the client, this indicates that the video port
5088
 * should enable double clocking.  This flag is only valid with external
5089
 * syncs.
5090
 *)
5091
  DDVPCONNECT_DOUBLECLOCK = $00000001;
1 daniel-mar 5092
 
4 daniel-mar 5093
(*
5094
 * When this is set by the driver and passed to the client, this
5095
 * indicates that the video port is capable of using an external VACT
5096
 * signal. When this is set by the client, this indicates that the
5097
 * video port should use the external VACT signal.
5098
 *)
5099
  DDVPCONNECT_VACT = $00000002;
1 daniel-mar 5100
 
4 daniel-mar 5101
(*
5102
 * When this is set by the driver and passed to the client, this
5103
 * indicates that the video port is capable of treating even fields
5104
 * like odd fields and visa versa.  When this is set by the client,
5105
 * this indicates that the video port should treat even fields like odd
5106
 * fields.
5107
 *)
5108
  DDVPCONNECT_INVERTPOLARITY = $00000004;
1 daniel-mar 5109
 
4 daniel-mar 5110
(*
5111
 * Indicates that any data written to the video port during the VREF
5112
 * period will not be written into the frame buffer. This flag is read only.
5113
 *)
5114
  DDVPCONNECT_DISCARDSVREFDATA = $00000008;
1 daniel-mar 5115
 
4 daniel-mar 5116
(*
5117
 * When this is set be the driver and passed to the client, this
5118
 * indicates that the device will write half lines into the frame buffer
5119
 * if half lines are provided by the decoder.  If this is set by the client,
5120
 * this indicates that the decoder will be supplying half lines.
5121
 *)
5122
  DDVPCONNECT_HALFLINE = $00000010;
1 daniel-mar 5123
 
4 daniel-mar 5124
(*
5125
 * Indicates that the signal is interlaced. This flag is only
5126
 * set by the client.
5127
 *)
5128
  DDVPCONNECT_INTERLACED = $00000020;
1 daniel-mar 5129
 
4 daniel-mar 5130
(*
5131
 * Indicates that video port is shareable and that this video port
5132
 * will use the even fields.  This flag is only set by the client.
5133
 *)
5134
  DDVPCONNECT_SHAREEVEN = $00000040;
1 daniel-mar 5135
 
4 daniel-mar 5136
(*
5137
 * Indicates that video port is shareable and that this video port
5138
 * will use the odd fields.  This flag is only set by the client.
5139
 *)
5140
  DDVPCONNECT_SHAREODD = $00000080;
1 daniel-mar 5141
 
4 daniel-mar 5142
(****************************************************************************
5143
 *
5144
 * VIDEOPORT TDDVideoPortDesc CAPS
5145
 *
5146
 ****************************************************************************)
1 daniel-mar 5147
 
4 daniel-mar 5148
(*
5149
 * Flip can be performed automatically to avoid tearing.
5150
 *)
5151
  DDVPCAPS_AUTOFLIP = $00000001;
1 daniel-mar 5152
 
4 daniel-mar 5153
(*
5154
 * Supports interlaced video
5155
 *)
5156
  DDVPCAPS_INTERLACED = $00000002;
1 daniel-mar 5157
 
4 daniel-mar 5158
(*
5159
 * Supports non-interlaced video
5160
 *)
5161
  DDVPCAPS_NONINTERLACED = $00000004;
1 daniel-mar 5162
 
4 daniel-mar 5163
(*
5164
 * Indicates that the device can return whether the current field
5165
 * of an interlaced signal is even or odd.
5166
 *)
5167
  DDVPCAPS_READBACKFIELD = $00000008;
1 daniel-mar 5168
 
4 daniel-mar 5169
(*
5170
 * Indicates that the device can return the current line of video
5171
 * being written into the frame buffer.
5172
 *)
5173
  DDVPCAPS_READBACKLINE = $00000010;
5174
 
5175
(*
5176
 * Allows two gen-locked video streams to share a single video port,
5177
 * where one stream uses the even fields and the other uses the odd
5178
 * fields. Separate parameters (including address, scaling,
5179
 * cropping, etc.) are maintained for both fields.)
5180
 *)
5181
  DDVPCAPS_SHAREABLE = $00000020;
5182
 
5183
(*
5184
 * Even fields of video can be automatically discarded.
5185
 *)
5186
  DDVPCAPS_SKIPEVENFIELDS = $00000040;
5187
 
5188
(*
5189
 * Odd fields of video can be automatically discarded.
5190
 *)
5191
  DDVPCAPS_SKIPODDFIELDS = $00000080;
5192
 
5193
(*
5194
 * Indicates that the device is capable of driving the graphics
5195
 * VSYNC with the video port VSYNC.
5196
 *)
5197
  DDVPCAPS_SYNCMASTER = $00000100;
5198
 
5199
(*
5200
 * Indicates that data within the vertical blanking interval can
5201
 * be written to a different surface.
5202
 *)
5203
  DDVPCAPS_VBISURFACE = $00000200;
5204
 
5205
(*
5206
 * Indicates that the video port can perform color operations
5207
 * on the incoming data before it is written to the frame buffer.
5208
 *)
5209
  DDVPCAPS_COLORCONTROL = $00000400;
5210
 
5211
(*
5212
 * Indicates that the video port can accept VBI data in a different
5213
 * width or format than the regular video data.
5214
 *)
5215
  DDVPCAPS_OVERSAMPLEDVBI = $00000800;
5216
 
5217
(*
5218
 * Indicates that the video port can write data directly to system memory
5219
 *)
5220
  DDVPCAPS_SYSTEMMEMORY = $00001000;
5221
 
5222
(*
5223
 * Indicates that the VBI and video portions of the video stream can
5224
 * be controlled by an independent processes.
5225
 *)
5226
  DDVPCAPS_VBIANDVIDEOINDEPENDENT       = $00002000;
5227
 
5228
(*
5229
 * Indicates that the video port contains high quality hardware
5230
 * de-interlacing hardware that should be used instead of the
5231
 * bob/weave algorithms.
5232
 *)
5233
  DDVPCAPS_HARDWAREDEINTERLACE          = $00004000;
5234
 
5235
(****************************************************************************
5236
 *
5237
 * VIDEOPORT TDDVideoPortDesc FX
5238
 *
5239
 ****************************************************************************)
5240
 
5241
(*
5242
 * Limited cropping is available to crop out the vertical interval data.
5243
 *)
5244
  DDVPFX_CROPTOPDATA = $00000001;
5245
 
5246
(*
5247
 * Incoming data can be cropped in the X direction before it is written
5248
 * to the surface.
5249
 *)
5250
  DDVPFX_CROPX = $00000002;
5251
 
5252
(*
5253
 * Incoming data can be cropped in the Y direction before it is written
5254
 * to the surface.
5255
 *)
5256
  DDVPFX_CROPY = $00000004;
5257
 
5258
(*
5259
 * Supports interleaving interlaced fields in memory.
5260
 *)
5261
  DDVPFX_INTERLEAVE = $00000008;
5262
 
5263
(*
5264
 * Supports mirroring left to right as the video data is written
5265
 * into the frame buffer.
5266
 *)
1 daniel-mar 5267
  DDVPFX_MIRRORLEFTRIGHT = $00000010;
5268
 
4 daniel-mar 5269
(*
5270
 * Supports mirroring top to bottom as the video data is written
5271
 * into the frame buffer.
5272
 *)
5273
  DDVPFX_MIRRORUPDOWN = $00000020;
1 daniel-mar 5274
 
4 daniel-mar 5275
(*
5276
 * Data can be arbitrarily shrunk in the X direction before it
5277
 * is written to the surface.
5278
 *)
5279
  DDVPFX_PRESHRINKX = $00000040;
1 daniel-mar 5280
 
4 daniel-mar 5281
(*
5282
 * Data can be arbitrarily shrunk in the Y direction before it
5283
 * is written to the surface.
5284
 *)
5285
  DDVPFX_PRESHRINKY = $00000080;
1 daniel-mar 5286
 
4 daniel-mar 5287
(*
5288
 * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X
5289
 * direction before it is written to the surface.
5290
 *)
5291
  DDVPFX_PRESHRINKXB = $00000100;
5292
 
5293
(*
5294
 * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y
5295
 * direction before it is written to the surface.
5296
 *)
5297
  DDVPFX_PRESHRINKYB = $00000200;
5298
 
5299
(*
5300
 * Data can be shrunk in increments of 1/x in the X direction
5301
 * (where X is specified in the TDDVideoPortCaps.dwPreshrinkXStep)
5302
 * before it is written to the surface.
5303
 *)
5304
  DDVPFX_PRESHRINKXS = $00000400;
5305
 
5306
(*
5307
 * Data can be shrunk in increments of 1/x in the Y direction
5308
 * (where X is specified in the TDDVideoPortCaps.dwPreshrinkYStep)
5309
 * before it is written to the surface.
5310
 *)
5311
  DDVPFX_PRESHRINKYS = $00000800;
5312
 
5313
(*
5314
 * Data can be arbitrarily stretched in the X direction before
5315
 * it is written to the surface.
5316
 *)
5317
  DDVPFX_PRESTRETCHX = $00001000;
5318
 
5319
(*
5320
 * Data can be arbitrarily stretched in the Y direction before
5321
 * it is written to the surface.
5322
 *)
5323
  DDVPFX_PRESTRETCHY = $00002000;
5324
 
5325
(*
5326
 * Data can be integer stretched in the X direction before it is
5327
 * written to the surface.
5328
 *)
5329
  DDVPFX_PRESTRETCHXN = $00004000;
5330
 
5331
(*
5332
 * Data can be integer stretched in the Y direction before it is
5333
 * written to the surface.
5334
 *)
5335
  DDVPFX_PRESTRETCHYN = $00008000;
5336
 
5337
(*
5338
 * Indicates that data within the vertical blanking interval can
5339
 * be converted independently of the remaining video data.
5340
 *)
5341
  DDVPFX_VBICONVERT = $00010000;
5342
 
5343
(*
5344
 * Indicates that scaling can be disabled for data within the
5345
 * vertical blanking interval.
5346
 *)
5347
  DDVPFX_VBINOSCALE = $00020000;
5348
 
5349
(*
5350
 * Indicates that the video data can ignore the left and right
5351
 * cropping coordinates when cropping oversampled VBI data.
5352
 *)
5353
  DDVPFX_IGNOREVBIXCROP = $00040000;
5354
 
5355
(*
5356
 * Indicates that interleaving can be disabled for data within the
5357
 * vertical blanking interval.
5358
 *)
5359
  DDVPFX_VBINOINTERLEAVE     = $00080000;
5360
 
5361
(****************************************************************************
5362
 *
5363
 * VIDEOPORT TDDVideoPortInfo FLAGS
5364
 *
5365
 ****************************************************************************)
5366
 
5367
(*
5368
 * Perform automatic flipping.   Auto-flipping is performed between
5369
 * the overlay surface that was attached to the video port using
5370
 * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that
5371
 * are attached to the surface via the IDirectDrawSurface::AttachSurface
5372
 * method.  The flip order is the order in which the overlay surfaces
5373
 * were. attached.
5374
 *)
5375
  DDVP_AUTOFLIP = $00000001;
5376
 
5377
(*
5378
 * Perform conversion using the ddpfOutputFormat information.
5379
 *)
5380
  DDVP_CONVERT = $00000002;
5381
 
5382
(*
5383
 * Perform cropping using the specified rectangle.
5384
 *)
5385
  DDVP_CROP = $00000004;
5386
 
5387
(*
5388
 * Indicates that interlaced fields should be interleaved in memory.
5389
 *)
5390
  DDVP_INTERLEAVE = $00000008;
5391
 
5392
(*
5393
 * Indicates that the data should be mirrored left to right as it's
5394
 * written into the frame buffer.
5395
 *)
5396
  DDVP_MIRRORLEFTRIGHT = $00000010;
5397
 
5398
(*
5399
 * Indicates that the data should be mirrored top to bottom as it's
5400
 * written into the frame buffer.
5401
 *)
5402
  DDVP_MIRRORUPDOWN = $00000020;
5403
 
5404
(*
5405
 * Perform pre-scaling/zooming based on the pre-scale parameters.
5406
 *)
5407
  DDVP_PRESCALE = $00000040;
5408
 
5409
(*
5410
 * Ignore input of even fields.
5411
 *)
5412
  DDVP_SKIPEVENFIELDS = $00000080;
5413
 
5414
(*
5415
 * Ignore input of odd fields.
5416
 *)
5417
  DDVP_SKIPODDFIELDS = $00000100;
5418
 
5419
(*
5420
 * Drive the graphics VSYNCs using the video port VYSNCs.
5421
 *)
5422
  DDVP_SYNCMASTER = $00000200;
5423
 
5424
(*
5425
 * The ddpfVBIOutputFormatFormat member contains data that should be used
5426
 * to convert the data within the vertical blanking interval.
5427
 *)
5428
  DDVP_VBICONVERT = $00000400;
5429
 
5430
(*
5431
 * Indicates that data within the vertical blanking interval
5432
 * should not be scaled.
5433
 *)
5434
  DDVP_VBINOSCALE = $00000800;
5435
 
5436
(*
5437
 * Indicates that these bob/weave decisions should not be
5438
 * overriden by other interfaces.
5439
 *)
5440
  DDVP_OVERRIDEBOBWEAVE = $00001000;
5441
 
5442
(*
5443
 * Indicates that the video data should ignore the left and right
5444
 * cropping coordinates when cropping the VBI data.
5445
 *)
5446
  DDVP_IGNOREVBIXCROP = $00002000;
5447
 
5448
(*
5449
 * Indicates that interleaving can be disabled for data within the
5450
 * vertical blanking interval.
5451
 *)
5452
  DDVP_VBINOINTERLEAVE                  = $00004000;
5453
 
5454
(*
5455
 * Indicates that the video port should use the hardware
5456
 * de-interlacing hardware.
5457
 *)
5458
  DDVP_HARDWAREDEINTERLACE              = $00008000;
5459
 
5460
(****************************************************************************
5461
 *
5462
 * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS
5463
 *
5464
 ****************************************************************************)
5465
 
5466
(*
5467
 * Return formats for the video data
5468
 *)
1 daniel-mar 5469
  DDVPFORMAT_VIDEO = $00000001;
4 daniel-mar 5470
 
5471
(*
5472
 * Return formats for the VBI data
5473
 *)
1 daniel-mar 5474
  DDVPFORMAT_VBI = $00000002;
5475
 
4 daniel-mar 5476
(****************************************************************************
5477
 *
5478
 * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS
5479
 *
5480
 ****************************************************************************)
1 daniel-mar 5481
 
4 daniel-mar 5482
(*
5483
 * Surface should receive video data (and VBI data if a surface
5484
 * is not explicitly attached for that purpose)
5485
 *)
1 daniel-mar 5486
  DDVPTARGET_VIDEO = $00000001;
4 daniel-mar 5487
 
5488
(*
5489
 * Surface should receive VBI data
5490
 *)
1 daniel-mar 5491
  DDVPTARGET_VBI = $00000002;
5492
 
4 daniel-mar 5493
(****************************************************************************
5494
 *
5495
 * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS
5496
 *
5497
 ****************************************************************************)
1 daniel-mar 5498
 
4 daniel-mar 5499
(*
5500
 * Waits until the beginning of the next VSYNC
5501
 *)
1 daniel-mar 5502
  DDVPWAIT_BEGIN = $00000001;
4 daniel-mar 5503
 
5504
(*
5505
 * Waits until the end of the next/current VSYNC
5506
 *)
1 daniel-mar 5507
  DDVPWAIT_END = $00000002;
4 daniel-mar 5508
 
5509
(*
5510
 * Waits until the beginning of the specified line
5511
 *)
1 daniel-mar 5512
  DDVPWAIT_LINE = $00000003;
5513
 
4 daniel-mar 5514
(****************************************************************************
5515
 *
5516
 * DIRECTDRAWVIDEOPORT FLIP FLAGS
5517
 *
5518
 ****************************************************************************)
1 daniel-mar 5519
 
4 daniel-mar 5520
(*
5521
 * Flips the normal video surface
5522
 *)
1 daniel-mar 5523
  DDVPFLIP_VIDEO = $00000001;
4 daniel-mar 5524
 
5525
(*
5526
 * Flips the VBI surface
5527
 *)
1 daniel-mar 5528
  DDVPFLIP_VBI = $00000002;
5529
 
4 daniel-mar 5530
(****************************************************************************
5531
 *
5532
 * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES
5533
 *
5534
 ****************************************************************************)
1 daniel-mar 5535
 
4 daniel-mar 5536
(*
5537
 * No video signal is present at the video port
5538
 *)
1 daniel-mar 5539
  DDVPSQ_NOSIGNAL = $00000001;
4 daniel-mar 5540
 
5541
(*
5542
 * A valid video signal is present at the video port
5543
 *)
1 daniel-mar 5544
  DDVPSQ_SIGNALOK = $00000002;
5545
 
4 daniel-mar 5546
(****************************************************************************
5547
 *
5548
 * VIDEOPORTBANDWIDTH Flags
5549
 *
5550
 ****************************************************************************)
1 daniel-mar 5551
 
4 daniel-mar 5552
(*
5553
 * The specified height/width refer to the size of the video port data
5554
 * written into memory, after prescaling has occured.
5555
 *)
1 daniel-mar 5556
  DDVPB_VIDEOPORT = $00000001;
4 daniel-mar 5557
 
5558
(*
5559
 * The specified height/width refer to the source size of the overlay.
5560
 *)
1 daniel-mar 5561
  DDVPB_OVERLAY = $00000002;
4 daniel-mar 5562
 
5563
(*
5564
 * This is a query for the device to return which caps this device requires.
5565
 *)
1 daniel-mar 5566
  DDVPB_TYPE = $00000004;
5567
 
4 daniel-mar 5568
(****************************************************************************
5569
 *
5570
 * VIDEOPORTBANDWIDTH Caps
5571
 *
5572
 ****************************************************************************)
1 daniel-mar 5573
 
4 daniel-mar 5574
(*
5575
 * The bandwidth for this device is dependant on the overlay source size.
5576
 *)
1 daniel-mar 5577
  DDVPBCAPS_SOURCE = $00000001;
4 daniel-mar 5578
 
5579
(*
5580
 * The bandwidth for this device is dependant on the overlay destination
5581
 * size.
5582
 *)
1 daniel-mar 5583
  DDVPBCAPS_DESTINATION = $00000002;
5584
 
4 daniel-mar 5585
(****************************************************************************
5586
 *
5587
 * DDVIDEOPORTCONTAINER CreateVideoPort flags
5588
 *
5589
 ****************************************************************************)
1 daniel-mar 5590
 
4 daniel-mar 5591
(*
5592
 * The process only wants to control the VBI portion of the video stream.
5593
 *)
5594
  DDVPCREATE_VBIONLY                    = $00000001;
1 daniel-mar 5595
 
4 daniel-mar 5596
(*
5597
 * The process only wants to control the non-VBI (video) portion of
5598
 * the video stream.
5599
 *)
5600
  DDVPCREATE_VIDEOONLY                  = $00000002;
1 daniel-mar 5601
 
4 daniel-mar 5602
(****************************************************************************
5603
 *
5604
 * DDVIDEOPORTSTATUS flags
5605
 *
5606
 ****************************************************************************)
1 daniel-mar 5607
 
4 daniel-mar 5608
(*
5609
 * The video port interface is only controlling the VBI portion of the
5610
 * video stream
5611
 *)
5612
  DDVPSTATUS_VBIONLY                    = $00000001;
5613
 
5614
(*
5615
 * The video port interface is only controlling the video portion of the
5616
 * video stream
5617
 *)
5618
  DDVPSTATUS_VIDEOONLY                  = $00000002;
5619
 
5620
 
5621
type
5622
(*
5623
 * API's
5624
 *)
5625
 
5626
  TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps;
5627
      lpContext: Pointer) : HResult; stdcall;
5628
 
5629
(*
5630
 * INTERACES FOLLOW:
5631
 *      IDirectDrawVideoPort
5632
 *      IVideoPort
5633
 *)
5634
 
5635
 
5636
(*
5637
 * IDirectDrawVideoPort
5638
 *)
5639
  IDirectDrawVideoPort = interface (IUnknown)
5640
    ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}']
5641
    (*** IDirectDrawVideoPort methods ***)
5642
    function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) : HResult; stdcall;
5643
    function GetBandwidthInfo(var lpddpfFormat: TDDPixelFormat;
5644
        dwWidth: DWORD; dwHeight: DWORD; dwFlags: DWORD;
5645
        var lpBandwidth: TDDVideoPortBandWidth) : HResult; stdcall;
5646
    function GetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
5647
    function GetInputFormats(var lpNumFormats: DWORD; var lpFormats:
5648
        TDDPixelFormat; dwFlags: DWORD) : HResult; stdcall;
5649
    function GetOutputFormats(var lpInputFormat: TDDPixelFormat;
5650
        var lpNumFormats: DWORD; lpFormats: PDDPixelFormat; dwFlags: DWORD)
5651
        : HResult; stdcall;
5652
    function GetFieldPolarity(var lpbVideoField: BOOL) : HResult; stdcall;
5653
    function GetVideoLine(var lpdwLine: DWORD) : HResult; stdcall;
5654
    function GetVideoSignalStatus(varlpdwStatus: DWORD) : HResult; stdcall;
5655
    function SetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
5656
    function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) :
5657
        HResult; stdcall;
5658
    function StartVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
5659
    function StopVideo: HResult; stdcall;
5660
    function UpdateVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
5661
    function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD) :
5662
        HResult; stdcall;
5663
  end;
5664
 
5665
(*
5666
 * IDirectDrawVideoPortContainer
5667
 *)
5668
  IDDVideoPortContainer = interface (IUnknown)
5669
    ['{6C142760-A733-11CE-A521-0020AF0BE560}']
5670
    (*** IDDVideoPortContainer methods ***)
5671
    function CreateVideoPort(dwFlags: DWORD; var lpTDDVideoPortDesc:
5672
        TDDVideoPortDesc; var lplpDDVideoPort: IDirectDrawVideoPort;
5673
        pUnkOuter: IUnknown) : HResult; stdcall;
5674
    function EnumVideoPorts(dwFlags: DWORD;
5675
        lpTDDVideoPortCaps: PDDVideoPortCaps; lpContext: Pointer;
5676
        lpEnumVideoCallback: TDDEnumVideoCallback) : HResult; stdcall;
5677
    function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD;
5678
        lpConnectInfo: PDDVideoPortConnect) : HResult; stdcall;
5679
    function QueryVideoPortStatus(dwPortId: DWORD;
5680
        var lpVPStatus: TDDVideoPortStatus) : HResult; stdcall;
5681
  end;
5682
 
5683
  IID_IDDVideoPortContainer = IDDVideoPortContainer;
5684
  IID_IDirectDrawVideoPort = IDirectDrawVideoPort;
5685
 
5686
 
5687
//Direct3D file
1 daniel-mar 5688
(*==========================================================================;
5689
 *
4 daniel-mar 5690
 *  Copyright (C) 1995-1998 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 5691
 *
4 daniel-mar 5692
 *  Files:   d3dtypes.h d3dcaps.h d3d.h
1 daniel-mar 5693
 *
4 daniel-mar 5694
 *  DirectX 7.0 Delphi adaptation by Erik Unger
5695
 *
5696
 *  Modyfied: 26-Jun-2000
5697
 *
5698
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
5699
 *  E-Mail: DelphiDirectX@next-reality.com
5700
 *
1 daniel-mar 5701
 ***************************************************************************)
5702
 
4 daniel-mar 5703
(* TD3DValue is the fundamental Direct3D fractional data type *)
5704
 
1 daniel-mar 5705
type
4 daniel-mar 5706
  TRefClsID = TGUID;
5707
 
5708
type
1 daniel-mar 5709
  TD3DValue = Single;
4 daniel-mar 5710
  TD3DFixed = LongInt;
5711
  float = TD3DValue;
5712
  PD3DColor = ^TD3DColor;
1 daniel-mar 5713
  TD3DColor = DWORD;
5714
 
4 daniel-mar 5715
function D3DVal(val: variant) : float;
5716
function D3DDivide(a,b: double) : float;
5717
function D3DMultiply(a,b: double) : float;
1 daniel-mar 5718
 
5719
(*
5720
 * Format of CI colors is
5721
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5722
 *  |    alpha      |         color index           |   fraction    |
5723
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5724
 *)
5725
 
4 daniel-mar 5726
// #define CI_GETALPHA(ci)    ((ci) >> 24)
5727
function CI_GETALPHA(ci: DWORD) : DWORD;
1 daniel-mar 5728
 
4 daniel-mar 5729
// #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
5730
function CI_GETINDEX(ci: DWORD) : DWORD;
5731
 
5732
// #define CI_GETFRACTION(ci) ((ci) & 0xff)
5733
function CI_GETFRACTION(ci: DWORD) : DWORD;
5734
 
5735
// #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
5736
function CI_ROUNDINDEX(ci: DWORD) : DWORD;
5737
 
5738
// #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
5739
function CI_MASKALPHA(ci: DWORD) : DWORD;
5740
 
5741
// #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
5742
function CI_MAKE(a,i,f: DWORD) : DWORD;
5743
 
1 daniel-mar 5744
(*
5745
 * Format of RGBA colors is
5746
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5747
 *  |    alpha      |      red      |     green     |     blue      |
5748
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5749
 *)
5750
 
4 daniel-mar 5751
// #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
5752
function RGBA_GETALPHA(rgb: TD3DColor) : DWORD;
1 daniel-mar 5753
 
4 daniel-mar 5754
// #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
5755
function RGBA_GETRED(rgb: TD3DColor) : DWORD;
5756
 
5757
// #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
5758
function RGBA_GETGREEN(rgb: TD3DColor) : DWORD;
5759
 
5760
// #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
5761
function RGBA_GETBLUE(rgb: TD3DColor) : DWORD;
5762
 
5763
// #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
5764
function RGBA_MAKE(r, g, b, a: DWORD) : TD3DColor;
5765
 
1 daniel-mar 5766
(* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
5767
 * The float values must be in the range 0..1
5768
 *)
5769
 
4 daniel-mar 5770
// #define D3DRGB(r, g, b) \
5771
//     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
5772
function D3DRGB(r, g, b: float) : TD3DColor;
1 daniel-mar 5773
 
4 daniel-mar 5774
// #define D3DRGBA(r, g, b, a) \
5775
//     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
5776
//     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
5777
//    )
5778
function D3DRGBA(r, g, b, a: float) : TD3DColor;
5779
 
1 daniel-mar 5780
(*
5781
 * Format of RGB colors is
5782
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5783
 *  |    ignored    |      red      |     green     |     blue      |
5784
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5785
 *)
5786
 
4 daniel-mar 5787
// #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
5788
function RGB_GETRED(rgb: TD3DColor) : DWORD;
1 daniel-mar 5789
 
4 daniel-mar 5790
// #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
5791
function RGB_GETGREEN(rgb: TD3DColor) : DWORD;
5792
 
5793
// #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
5794
function RGB_GETBLUE(rgb: TD3DColor) : DWORD;
5795
 
5796
// #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
5797
function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD) : TD3DColor;
5798
 
5799
// #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
5800
function RGB_MAKE(r, g, b: DWORD) : TD3DColor;
5801
 
5802
// #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
5803
function RGBA_TORGB(rgba: TD3DColor) : TD3DColor;
5804
 
5805
// #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
5806
function RGB_TORGBA(rgb: TD3DColor) : TD3DColor;
5807
 
5808
(*
5809
 * Flags for Enumerate functions
5810
 *)
1 daniel-mar 5811
const
5812
 
4 daniel-mar 5813
(*
5814
 * Stop the enumeration
5815
 *)
1 daniel-mar 5816
 
4 daniel-mar 5817
  D3DENUMRET_CANCEL                        = DDENUMRET_CANCEL;
1 daniel-mar 5818
 
4 daniel-mar 5819
(*
5820
 * Continue the enumeration
5821
 *)
1 daniel-mar 5822
 
4 daniel-mar 5823
  D3DENUMRET_OK                            = DDENUMRET_OK;
5824
 
5825
type
5826
  TD3DValidateCallback = function (lpUserArg: Pointer;
5827
      dwOffset: DWORD): HResult; stdcall;
5828
  TD3DEnumTextureFormatsCallback = function (var lpDdsd: TDDSurfaceDesc;
1 daniel-mar 5829
      lpContext: Pointer): HResult; stdcall;
4 daniel-mar 5830
  TD3DEnumPixelFormatsCallback = function (var lpDDPixFmt: TDDPixelFormat;
5831
      lpContext: Pointer): HResult; stdcall;
1 daniel-mar 5832
 
4 daniel-mar 5833
 
5834
  PD3DMaterialHandle = ^TD3DMaterialHandle;
1 daniel-mar 5835
  TD3DMaterialHandle = DWORD;
5836
 
4 daniel-mar 5837
  PD3DTextureHandle = ^TD3DTextureHandle;
1 daniel-mar 5838
  TD3DTextureHandle = DWORD;
5839
 
4 daniel-mar 5840
  PD3DMatrixHandle = ^TD3DMatrixHandle;
1 daniel-mar 5841
  TD3DMatrixHandle = DWORD;
5842
 
5843
  PD3DColorValue = ^TD3DColorValue;
4 daniel-mar 5844
  TD3DColorValue = packed record
1 daniel-mar 5845
    case Integer of
5846
    0: (
5847
      r: TD3DValue;
5848
      g: TD3DValue;
5849
      b: TD3DValue;
5850
      a: TD3DValue;
4 daniel-mar 5851
     );
1 daniel-mar 5852
    1: (
5853
      dvR: TD3DValue;
5854
      dvG: TD3DValue;
5855
      dvB: TD3DValue;
5856
      dvA: TD3DValue;
4 daniel-mar 5857
     );
1 daniel-mar 5858
  end;
5859
 
5860
  PD3DRect = ^TD3DRect;
4 daniel-mar 5861
  TD3DRect = packed record
1 daniel-mar 5862
    case Integer of
5863
    0: (
4 daniel-mar 5864
      x1: LongInt;
5865
      y1: LongInt;
5866
      x2: LongInt;
5867
      y2: LongInt;
5868
     );
1 daniel-mar 5869
    1: (
4 daniel-mar 5870
      lX1: LongInt;
5871
      lY1: LongInt;
5872
      lX2: LongInt;
5873
      lY2: LongInt;
5874
     );
5875
     2: (
5876
       a: array[0..3] of LongInt;
5877
     );
1 daniel-mar 5878
  end;
5879
 
5880
  PD3DVector = ^TD3DVector;
4 daniel-mar 5881
  TD3DVector = packed record
1 daniel-mar 5882
    case Integer of
5883
    0: (
5884
      x: TD3DValue;
5885
      y: TD3DValue;
5886
      z: TD3DValue;
4 daniel-mar 5887
     );
1 daniel-mar 5888
    1: (
5889
      dvX: TD3DValue;
5890
      dvY: TD3DValue;
5891
      dvZ: TD3DValue;
4 daniel-mar 5892
     );
1 daniel-mar 5893
  end;
5894
 
4 daniel-mar 5895
(******************************************************************
5896
 *                                                                *
5897
 *   D3DVec.inl                                                   *
5898
 *                                                                *
5899
 *   Float-valued 3D vector class for Direct3D.                   *
5900
 *                                                                *
5901
 *   Copyright (c) 1996-1998 Microsoft Corp. All rights reserved. *
5902
 *                                                                *
5903
 ******************************************************************)
1 daniel-mar 5904
 
4 daniel-mar 5905
    // Addition and subtraction
5906
  function VectorAdd(const v1, v2: TD3DVector) : TD3DVector;
5907
  function VectorSub(const v1, v2: TD3DVector) : TD3DVector;
5908
    // Scalar multiplication and division
5909
  function VectorMulS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
5910
  function VectorDivS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
5911
    // Memberwise multiplication and division
5912
  function VectorMul(const v1, v2: TD3DVector) : TD3DVector;
5913
  function VectorDiv(const v1, v2: TD3DVector) : TD3DVector;
5914
    // Vector dominance
5915
  function VectorSmaller(v1, v2: TD3DVector) : boolean;
5916
  function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
5917
    // Bitwise equality
5918
  function VectorEquel(v1, v2: TD3DVector) : boolean;
5919
    // Length-related functions
5920
  function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
5921
  function VectorMagnitude(v: TD3DVector) : TD3DValue;
5922
    // Returns vector with same direction and unit length
5923
  function VectorNormalize(const v: TD3DVector) : TD3DVector;
5924
    // Return min/max component of the input vector
5925
  function VectorMin(v: TD3DVector) : TD3DValue;
5926
  function VectorMax(v: TD3DVector) : TD3DValue;
5927
    // Return memberwise min/max of input vectors
5928
  function VectorMinimize(const v1, v2: TD3DVector) : TD3DVector;
5929
  function VectorMaximize(const v1, v2: TD3DVector) : TD3DVector;
5930
    // Dot and cross product
5931
  function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
5932
  function VectorCrossProduct(const v1, v2: TD3DVector) : TD3DVector;
1 daniel-mar 5933
 
5934
type
4 daniel-mar 5935
(*
5936
 * Vertex data types supported in an ExecuteBuffer.
5937
 *)
1 daniel-mar 5938
 
4 daniel-mar 5939
(*
5940
 * Homogeneous vertices
5941
 *)
1 daniel-mar 5942
 
5943
  PD3DHVertex = ^TD3DHVertex;
4 daniel-mar 5944
  TD3DHVertex = packed record
5945
    dwFlags: DWORD;        (* Homogeneous clipping flags *)
1 daniel-mar 5946
    case Integer of
5947
    0: (
5948
      hx: TD3DValue;
5949
      hy: TD3DValue;
5950
      hz: TD3DValue;
4 daniel-mar 5951
     );
1 daniel-mar 5952
    1: (
5953
      dvHX: TD3DValue;
5954
      dvHY: TD3DValue;
5955
      dvHZ: TD3DValue;
4 daniel-mar 5956
     );
1 daniel-mar 5957
  end;
5958
 
4 daniel-mar 5959
(*
5960
 * Transformed/lit vertices
5961
 *)
1 daniel-mar 5962
 
5963
  PD3DTLVertex = ^TD3DTLVertex;
4 daniel-mar 5964
  TD3DTLVertex = packed record
1 daniel-mar 5965
    case Integer of
5966
    0: (
4 daniel-mar 5967
      sx: TD3DValue;             (* Screen coordinates *)
1 daniel-mar 5968
      sy: TD3DValue;
5969
      sz: TD3DValue;
4 daniel-mar 5970
      rhw: TD3DValue;            (* Reciprocal of homogeneous w *)
5971
      color: TD3DColor;          (* Vertex color *)
5972
      specular: TD3DColor;       (* Specular component of vertex *)
5973
      tu: TD3DValue;             (* Texture coordinates *)
1 daniel-mar 5974
      tv: TD3DValue;
4 daniel-mar 5975
     );
1 daniel-mar 5976
    1: (
5977
      dvSX: TD3DValue;
5978
      dvSY: TD3DValue;
5979
      dvSZ: TD3DValue;
5980
      dvRHW: TD3DValue;
5981
      dcColor: TD3DColor;
5982
      dcSpecular: TD3DColor;
5983
      dvTU: TD3DValue;
5984
      dvTV: TD3DValue;
4 daniel-mar 5985
     );
1 daniel-mar 5986
  end;
5987
 
4 daniel-mar 5988
(*
5989
 * Untransformed/lit vertices
5990
 *)
1 daniel-mar 5991
 
5992
  PD3DLVertex = ^TD3DLVertex;
4 daniel-mar 5993
  TD3DLVertex = packed record
1 daniel-mar 5994
    case Integer of
5995
    0: (
4 daniel-mar 5996
      x: TD3DValue;             (* Homogeneous coordinates *)
1 daniel-mar 5997
      y: TD3DValue;
5998
      z: TD3DValue;
5999
      dwReserved: DWORD;
4 daniel-mar 6000
      color: TD3DColor;         (* Vertex color *)
6001
      specular: TD3DColor;      (* Specular component of vertex *)
6002
      tu: TD3DValue;            (* Texture coordinates *)
1 daniel-mar 6003
      tv: TD3DValue;
4 daniel-mar 6004
     );
1 daniel-mar 6005
    1: (
6006
      dvX: TD3DValue;
6007
      dvY: TD3DValue;
6008
      dvZ: TD3DValue;
4 daniel-mar 6009
      UNIONFILLER1d: DWORD;
1 daniel-mar 6010
      dcColor: TD3DColor;
6011
      dcSpecular: TD3DColor;
6012
      dvTU: TD3DValue;
6013
      dvTV: TD3DValue;
4 daniel-mar 6014
     );
1 daniel-mar 6015
  end;
6016
 
4 daniel-mar 6017
(*
6018
 * Untransformed/unlit vertices
6019
 *)
1 daniel-mar 6020
 
6021
  PD3DVertex = ^TD3DVertex;
4 daniel-mar 6022
  TD3DVertex = packed record
1 daniel-mar 6023
    case Integer of
6024
    0: (
4 daniel-mar 6025
      x: TD3DValue;             (* Homogeneous coordinates *)
1 daniel-mar 6026
      y: TD3DValue;
6027
      z: TD3DValue;
4 daniel-mar 6028
      nx: TD3DValue;            (* Normal *)
1 daniel-mar 6029
      ny: TD3DValue;
6030
      nz: TD3DValue;
4 daniel-mar 6031
      tu: TD3DValue;            (* Texture coordinates *)
1 daniel-mar 6032
      tv: TD3DValue;
4 daniel-mar 6033
     );
1 daniel-mar 6034
    1: (
6035
      dvX: TD3DValue;
6036
      dvY: TD3DValue;
6037
      dvZ: TD3DValue;
6038
      dvNX: TD3DValue;
6039
      dvNY: TD3DValue;
6040
      dvNZ: TD3DValue;
6041
      dvTU: TD3DValue;
6042
      dvTV: TD3DValue;
4 daniel-mar 6043
     );
1 daniel-mar 6044
  end;
6045
 
4 daniel-mar 6046
(*
6047
 * Matrix, viewport, and tranformation structures and definitions.
6048
 *)
1 daniel-mar 6049
 
6050
  PD3DMatrix = ^TD3DMatrix;
4 daniel-mar 6051
  TD3DMatrix = packed record
6052
    case integer of
6053
 
6054
           _21, _22, _23, _24: TD3DValue;
6055
           _31, _32, _33, _34: TD3DValue;
6056
           _41, _42, _43, _44: TD3DValue);
6057
      1 : (m : array [0..3, 0..3] of TD3DValue);
1 daniel-mar 6058
  end;
6059
 
6060
  PD3DViewport = ^TD3DViewport;
4 daniel-mar 6061
  TD3DViewport = packed record
1 daniel-mar 6062
    dwSize: DWORD;
6063
    dwX: DWORD;
4 daniel-mar 6064
    dwY: DWORD;                (* Top left *)
1 daniel-mar 6065
    dwWidth: DWORD;
4 daniel-mar 6066
    dwHeight: DWORD;           (* Dimensions *)
6067
    dvScaleX: TD3DValue;       (* Scale homogeneous to screen *)
6068
    dvScaleY: TD3DValue;       (* Scale homogeneous to screen *)
6069
    dvMaxX: TD3DValue;         (* Min/max homogeneous x coord *)
6070
    dvMaxY: TD3DValue;         (* Min/max homogeneous y coord *)
1 daniel-mar 6071
    dvMinZ: TD3DValue;
4 daniel-mar 6072
    dvMaxZ: TD3DValue;         (* Min/max homogeneous z coord *)
1 daniel-mar 6073
  end;
6074
 
6075
  PD3DViewport2 = ^TD3DViewport2;
4 daniel-mar 6076
  TD3DViewport2 = packed record
1 daniel-mar 6077
    dwSize: DWORD;
6078
    dwX: DWORD;
4 daniel-mar 6079
    dwY: DWORD;                (* Viewport Top left *)
1 daniel-mar 6080
    dwWidth: DWORD;
4 daniel-mar 6081
    dwHeight: DWORD;           (* Viewport Dimensions *)
6082
    dvClipX: TD3DValue;        (* Top left of clip volume *)
1 daniel-mar 6083
    dvClipY: TD3DValue;
4 daniel-mar 6084
    dvClipWidth: TD3DValue;    (* Clip Volume Dimensions *)
1 daniel-mar 6085
    dvClipHeight: TD3DValue;
4 daniel-mar 6086
    dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
6087
    dvMaxZ: TD3DValue;
1 daniel-mar 6088
  end;
6089
 
6090
  PD3DViewport7 = ^TD3DViewport7;
4 daniel-mar 6091
  TD3DViewport7 = packed record
1 daniel-mar 6092
    dwX: DWORD;
4 daniel-mar 6093
    dwY: DWORD;                (* Viewport Top left *)
1 daniel-mar 6094
    dwWidth: DWORD;
4 daniel-mar 6095
    dwHeight: DWORD;           (* Viewport Dimensions *)
6096
    dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
6097
    dvMaxZ: TD3DValue;
1 daniel-mar 6098
  end;
6099
 
4 daniel-mar 6100
(*
6101
 * Values for clip fields.
6102
 *)
1 daniel-mar 6103
 
6104
const
4 daniel-mar 6105
// Max number of user clipping planes, supported in D3D.
6106
  D3DMAXUSERCLIPPLANES  = 32;
1 daniel-mar 6107
 
4 daniel-mar 6108
// These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
6109
//
6110
  D3DCLIPPLANE0 = (1 shl 0);
6111
  D3DCLIPPLANE1 = (1 shl 1);
6112
  D3DCLIPPLANE2 = (1 shl 2);
6113
  D3DCLIPPLANE3 = (1 shl 3);
6114
  D3DCLIPPLANE4 = (1 shl 4);
6115
  D3DCLIPPLANE5 = (1 shl 5);
1 daniel-mar 6116
 
4 daniel-mar 6117
const
6118
  D3DCLIP_LEFT                            = $00000001;
6119
  D3DCLIP_RIGHT                           = $00000002;
6120
  D3DCLIP_TOP                             = $00000004;
6121
  D3DCLIP_BOTTOM                          = $00000008;
6122
  D3DCLIP_FRONT                           = $00000010;
6123
  D3DCLIP_BACK                            = $00000020;
6124
  D3DCLIP_GEN0                            = $00000040;
6125
  D3DCLIP_GEN1                            = $00000080;
6126
  D3DCLIP_GEN2                            = $00000100;
6127
  D3DCLIP_GEN3                            = $00000200;
6128
  D3DCLIP_GEN4                            = $00000400;
6129
  D3DCLIP_GEN5                            = $00000800;
1 daniel-mar 6130
 
4 daniel-mar 6131
(*
6132
 * Values for d3d status.
6133
 *)
1 daniel-mar 6134
 
4 daniel-mar 6135
  D3DSTATUS_CLIPUNIONLEFT                 = D3DCLIP_LEFT;
6136
  D3DSTATUS_CLIPUNIONRIGHT                = D3DCLIP_RIGHT;
6137
  D3DSTATUS_CLIPUNIONTOP                  = D3DCLIP_TOP;
6138
  D3DSTATUS_CLIPUNIONBOTTOM               = D3DCLIP_BOTTOM;
6139
  D3DSTATUS_CLIPUNIONFRONT                = D3DCLIP_FRONT;
6140
  D3DSTATUS_CLIPUNIONBACK                 = D3DCLIP_BACK;
6141
  D3DSTATUS_CLIPUNIONGEN0                 = D3DCLIP_GEN0;
6142
  D3DSTATUS_CLIPUNIONGEN1                 = D3DCLIP_GEN1;
6143
  D3DSTATUS_CLIPUNIONGEN2                 = D3DCLIP_GEN2;
6144
  D3DSTATUS_CLIPUNIONGEN3                 = D3DCLIP_GEN3;
6145
  D3DSTATUS_CLIPUNIONGEN4                 = D3DCLIP_GEN4;
6146
  D3DSTATUS_CLIPUNIONGEN5                 = D3DCLIP_GEN5;
1 daniel-mar 6147
 
4 daniel-mar 6148
  D3DSTATUS_CLIPINTERSECTIONLEFT          = $00001000;
6149
  D3DSTATUS_CLIPINTERSECTIONRIGHT         = $00002000;
6150
  D3DSTATUS_CLIPINTERSECTIONTOP           = $00004000;
6151
  D3DSTATUS_CLIPINTERSECTIONBOTTOM        = $00008000;
6152
  D3DSTATUS_CLIPINTERSECTIONFRONT         = $00010000;
6153
  D3DSTATUS_CLIPINTERSECTIONBACK          = $00020000;
6154
  D3DSTATUS_CLIPINTERSECTIONGEN0          = $00040000;
6155
  D3DSTATUS_CLIPINTERSECTIONGEN1          = $00080000;
6156
  D3DSTATUS_CLIPINTERSECTIONGEN2          = $00100000;
6157
  D3DSTATUS_CLIPINTERSECTIONGEN3          = $00200000;
6158
  D3DSTATUS_CLIPINTERSECTIONGEN4          = $00400000;
6159
  D3DSTATUS_CLIPINTERSECTIONGEN5          = $00800000;
6160
  D3DSTATUS_ZNOTVISIBLE                   = $01000000;
6161
(* Do not use 0x80000000 for any status flags in future as it is reserved *)
1 daniel-mar 6162
 
4 daniel-mar 6163
  D3DSTATUS_CLIPUNIONALL = (
6164
            D3DSTATUS_CLIPUNIONLEFT or
6165
            D3DSTATUS_CLIPUNIONRIGHT or
6166
            D3DSTATUS_CLIPUNIONTOP or
6167
            D3DSTATUS_CLIPUNIONBOTTOM or
6168
            D3DSTATUS_CLIPUNIONFRONT or
6169
            D3DSTATUS_CLIPUNIONBACK or
6170
            D3DSTATUS_CLIPUNIONGEN0 or
6171
            D3DSTATUS_CLIPUNIONGEN1 or
6172
            D3DSTATUS_CLIPUNIONGEN2 or
6173
            D3DSTATUS_CLIPUNIONGEN3 or
6174
            D3DSTATUS_CLIPUNIONGEN4 or
6175
            D3DSTATUS_CLIPUNIONGEN5);
1 daniel-mar 6176
 
4 daniel-mar 6177
  D3DSTATUS_CLIPINTERSECTIONALL = (
6178
            D3DSTATUS_CLIPINTERSECTIONLEFT or
6179
            D3DSTATUS_CLIPINTERSECTIONRIGHT or
6180
            D3DSTATUS_CLIPINTERSECTIONTOP or
6181
            D3DSTATUS_CLIPINTERSECTIONBOTTOM or
6182
            D3DSTATUS_CLIPINTERSECTIONFRONT or
6183
            D3DSTATUS_CLIPINTERSECTIONBACK or
6184
            D3DSTATUS_CLIPINTERSECTIONGEN0 or
6185
            D3DSTATUS_CLIPINTERSECTIONGEN1 or
6186
            D3DSTATUS_CLIPINTERSECTIONGEN2 or
6187
            D3DSTATUS_CLIPINTERSECTIONGEN3 or
6188
            D3DSTATUS_CLIPINTERSECTIONGEN4 or
6189
            D3DSTATUS_CLIPINTERSECTIONGEN5);
1 daniel-mar 6190
 
6191
  D3DSTATUS_DEFAULT = (
4 daniel-mar 6192
            D3DSTATUS_CLIPINTERSECTIONALL or
6193
            D3DSTATUS_ZNOTVISIBLE);
1 daniel-mar 6194
 
4 daniel-mar 6195
(*
6196
 * Options for direct transform calls
6197
 *)
1 daniel-mar 6198
 
6199
  D3DTRANSFORM_CLIPPED       = $00000001;
6200
  D3DTRANSFORM_UNCLIPPED     = $00000002;
6201
 
6202
type
6203
  PD3DTransformData = ^TD3DTransformData;
4 daniel-mar 6204
  TD3DTransformData = packed record
1 daniel-mar 6205
    dwSize: DWORD;
4 daniel-mar 6206
    lpIn: Pointer;             (* Input vertices *)
6207
    dwInSize: DWORD;           (* Stride of input vertices *)
6208
    lpOut: Pointer;            (* Output vertices *)
6209
    dwOutSize: DWORD;          (* Stride of output vertices *)
6210
    lpHOut: ^TD3DHVertex;       (* Output homogeneous vertices *)
6211
    dwClip: DWORD;             (* Clipping hint *)
1 daniel-mar 6212
    dwClipIntersection: DWORD;
4 daniel-mar 6213
    dwClipUnion: DWORD;        (* Union of all clip flags *)
6214
    drExtent: TD3DRect;         (* Extent of transformed vertices *)
1 daniel-mar 6215
  end;
6216
 
4 daniel-mar 6217
(*
6218
 * Structure defining position and direction properties for lighting.
6219
 *)
1 daniel-mar 6220
 
6221
  PD3DLightingElement = ^TD3DLightingElement;
4 daniel-mar 6222
  TD3DLightingElement = packed record
6223
    dvPosition: TD3DVector;           (* Lightable point in model space *)
6224
    dvNormal: TD3DVector;             (* Normalised unit vector *)
1 daniel-mar 6225
  end;
6226
 
4 daniel-mar 6227
(*
6228
 * Structure defining material properties for lighting.
6229
 *)
1 daniel-mar 6230
 
6231
  PD3DMaterial = ^TD3DMaterial;
4 daniel-mar 6232
  TD3DMaterial = packed record
1 daniel-mar 6233
    dwSize: DWORD;
6234
    case Integer of
6235
    0: (
4 daniel-mar 6236
      diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
6237
      ambient: TD3DColorValue;        (* Ambient color RGB *)
6238
      specular: TD3DColorValue;       (* Specular 'shininess' *)
6239
      emissive: TD3DColorValue;       (* Emissive color RGB *)
6240
      power: TD3DValue;               (* Sharpness if specular highlight *)
6241
      hTexture: TD3DTextureHandle;    (* Handle to texture map *)
1 daniel-mar 6242
      dwRampSize: DWORD;
4 daniel-mar 6243
     );
1 daniel-mar 6244
    1: (
6245
      dcvDiffuse: TD3DColorValue;
6246
      dcvAmbient: TD3DColorValue;
6247
      dcvSpecular: TD3DColorValue;
6248
      dcvEmissive: TD3DColorValue;
6249
      dvPower: TD3DValue;
4 daniel-mar 6250
     );
1 daniel-mar 6251
  end;
6252
 
6253
  PD3DMaterial7 = ^TD3DMaterial7;
4 daniel-mar 6254
  TD3DMaterial7 = packed record
1 daniel-mar 6255
    case Integer of
6256
    0: (
4 daniel-mar 6257
      diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
6258
      ambient: TD3DColorValue;        (* Ambient color RGB *)
6259
      specular: TD3DColorValue;       (* Specular 'shininess' *)
6260
      emissive: TD3DColorValue;       (* Emissive color RGB *)
6261
      power: TD3DValue;               (* Sharpness if specular highlight *)
6262
     );
1 daniel-mar 6263
    1: (
6264
      dcvDiffuse: TD3DColorValue;
6265
      dcvAmbient: TD3DColorValue;
6266
      dcvSpecular: TD3DColorValue;
6267
      dcvEmissive: TD3DColorValue;
6268
      dvPower: TD3DValue;
4 daniel-mar 6269
     );
1 daniel-mar 6270
  end;
6271
 
4 daniel-mar 6272
  PD3DLightType = ^TD3DLightType;
1 daniel-mar 6273
  TD3DLightType = (
6274
    D3DLIGHT_INVALID_0,
6275
    D3DLIGHT_POINT,
6276
    D3DLIGHT_SPOT,
6277
    D3DLIGHT_DIRECTIONAL,
4 daniel-mar 6278
// Note: The following light type (D3DLIGHT_PARALLELPOINT)
6279
// is no longer supported from D3D for DX7 onwards.
6280
    D3DLIGHT_PARALLELPOINT,
6281
    D3DLIGHT_GLSPOT);
1 daniel-mar 6282
 
4 daniel-mar 6283
(*
6284
 * Structure defining a light source and its properties.
6285
 *)
1 daniel-mar 6286
 
6287
  PD3DLight = ^TD3DLight;
4 daniel-mar 6288
  TD3DLight = packed record
1 daniel-mar 6289
    dwSize: DWORD;
4 daniel-mar 6290
    dltType: TD3DLightType;     (* Type of light source *)
6291
    dcvColor: TD3DColorValue;   (* Color of light *)
6292
    dvPosition: TD3DVector;     (* Position in world space *)
6293
    dvDirection: TD3DVector;    (* Direction in world space *)
6294
    dvRange: TD3DValue;         (* Cutoff range *)
6295
    dvFalloff: TD3DValue;       (* Falloff *)
6296
    dvAttenuation0: TD3DValue;  (* Constant attenuation *)
6297
    dvAttenuation1: TD3DValue;  (* Linear attenuation *)
6298
    dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
6299
    dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
6300
    dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
1 daniel-mar 6301
  end;
6302
 
6303
  PD3DLight7 = ^TD3DLight7;
4 daniel-mar 6304
  TD3DLight7 = packed record
6305
    dltType: TD3DLightType;     (* Type of light source *)
6306
    dcvDiffuse: TD3DColorValue; (* Diffuse color of light *)
6307
    dcvSpecular: TD3DColorValue;(* Specular color of light *)
6308
    dcvAmbient: TD3DColorValue; (* Ambient color of light *)
6309
    dvPosition: TD3DVector;     (* Position in world space *)
6310
    dvDirection: TD3DVector;    (* Direction in world space *)
6311
    dvRange: TD3DValue;         (* Cutoff range *)
6312
    dvFalloff: TD3DValue;       (* Falloff *)
6313
    dvAttenuation0: TD3DValue;  (* Constant attenuation *)
6314
    dvAttenuation1: TD3DValue;  (* Linear attenuation *)
6315
    dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
6316
    dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
6317
    dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
1 daniel-mar 6318
  end;
6319
 
4 daniel-mar 6320
(*
6321
 * Structure defining a light source and its properties.
6322
 *)
1 daniel-mar 6323
 
4 daniel-mar 6324
(* flags bits *)
1 daniel-mar 6325
const
4 daniel-mar 6326
  D3DLIGHT_ACTIVE                       = $00000001;
6327
  D3DLIGHT_NO_SPECULAR  = $00000002;
6328
  D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE;
1 daniel-mar 6329
 
4 daniel-mar 6330
(* maximum valid light range *)
6331
  D3DLIGHT_RANGE_MAX            = 1.8439088915e+18; //sqrt(FLT_MAX);
1 daniel-mar 6332
 
6333
type
6334
  PD3DLight2 = ^TD3DLight2;
4 daniel-mar 6335
  TD3DLight2 = packed record
1 daniel-mar 6336
    dwSize: DWORD;
4 daniel-mar 6337
    dltType: TD3DLightType;     (* Type of light source *)
6338
    dcvColor: TD3DColorValue;   (* Color of light *)
6339
    dvPosition: TD3DVector;     (* Position in world space *)
6340
    dvDirection: TD3DVector;    (* Direction in world space *)
6341
    dvRange: TD3DValue;         (* Cutoff range *)
6342
    dvFalloff: TD3DValue;       (* Falloff *)
6343
    dvAttenuation0: TD3DValue;  (* Constant attenuation *)
6344
    dvAttenuation1: TD3DValue;  (* Linear attenuation *)
6345
    dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
6346
    dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
6347
    dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
1 daniel-mar 6348
    dwFlags: DWORD;
6349
  end;
6350
 
6351
  PD3DLightData = ^TD3DLightData;
4 daniel-mar 6352
  TD3DLightData = packed record
1 daniel-mar 6353
    dwSize: DWORD;
4 daniel-mar 6354
    lpIn: ^TD3DLightingElement;   (* Input positions and normals *)
6355
    dwInSize: DWORD;             (* Stride of input elements *)
6356
    lpOut: ^TD3DTLVertex;         (* Output colors *)
6357
    dwOutSize: DWORD;            (* Stride of output colors *)
1 daniel-mar 6358
  end;
6359
 
6360
(*
6361
 * Before DX5, these values were in an enum called
4 daniel-mar 6362
 * TD3DColorModel. This was not correct, since they are
1 daniel-mar 6363
 * bit flags. A driver can surface either or both flags
6364
 * in the dcmColorModel member of D3DDEVICEDESC.
6365
 *)
6366
 
6367
type
6368
  TD3DColorModel = DWORD;
4 daniel-mar 6369
 
1 daniel-mar 6370
const
6371
  D3DCOLOR_MONO = 1;
4 daniel-mar 6372
  D3DCOLOR_RGB  = 2;
1 daniel-mar 6373
 
4 daniel-mar 6374
(*
6375
 * Options for clearing
6376
 *)
1 daniel-mar 6377
 
6378
const
4 daniel-mar 6379
  D3DCLEAR_TARGET            = $00000001; (* Clear target surface *)
6380
  D3DCLEAR_ZBUFFER           = $00000002; (* Clear target z buffer *)
6381
  D3DCLEAR_STENCIL           = $00000004; (* Clear stencil planes *)
1 daniel-mar 6382
 
4 daniel-mar 6383
(*
6384
 * Execute buffers are allocated via Direct3D.  These buffers may then
6385
 * be filled by the application with instructions to execute along with
6386
 * vertex data.
6387
 *)
1 daniel-mar 6388
 
4 daniel-mar 6389
(*
6390
 * Supported op codes for execute instructions.
6391
 *)
6392
 
1 daniel-mar 6393
type
4 daniel-mar 6394
  PD3DOpcode = ^TD3DOpcode;
1 daniel-mar 6395
  TD3DOpcode = (
6396
    D3DOP_INVALID_0,
6397
    D3DOP_POINT,
6398
    D3DOP_LINE,
6399
    D3DOP_TRIANGLE,
6400
    D3DOP_MATRIXLOAD,
6401
    D3DOP_MATRIXMULTIPLY,
6402
    D3DOP_STATETRANSFORM,
6403
    D3DOP_STATELIGHT,
6404
    D3DOP_STATERENDER,
6405
    D3DOP_PROCESSVERTICES,
6406
    D3DOP_TEXTURELOAD,
6407
    D3DOP_EXIT,
6408
    D3DOP_BRANCHFORWARD,
6409
    D3DOP_SPAN,
4 daniel-mar 6410
    D3DOP_SETSTATUS);
1 daniel-mar 6411
 
4 daniel-mar 6412
  PD3DInstruction = ^TD3DInstruction;
6413
  TD3DInstruction = packed record
6414
    bOpcode: BYTE;   (* Instruction opcode *)
6415
    bSize: BYTE;     (* Size of each instruction data unit *)
6416
    wCount: WORD;    (* Count of instruction data units to follow *)
1 daniel-mar 6417
  end;
6418
 
4 daniel-mar 6419
(*
6420
 * Structure for texture loads
6421
 *)
1 daniel-mar 6422
 
4 daniel-mar 6423
  PD3DTextureLoad = ^TD3DTextureLoad;
6424
  TD3DTextureLoad = packed record
1 daniel-mar 6425
    hDestTexture: TD3DTextureHandle;
6426
    hSrcTexture: TD3DTextureHandle;
6427
  end;
6428
 
4 daniel-mar 6429
(*
6430
 * Structure for picking
6431
 *)
1 daniel-mar 6432
 
4 daniel-mar 6433
  PD3DPickRecord = ^TD3DPickRecord;
6434
  TD3DPickRecord = packed record
1 daniel-mar 6435
    bOpcode: BYTE;
6436
    bPad: BYTE;
6437
    dwOffset: DWORD;
6438
    dvZ: TD3DValue;
6439
  end;
6440
 
4 daniel-mar 6441
(*
6442
 * The following defines the rendering states which can be set in the
6443
 * execute buffer.
6444
 *)
1 daniel-mar 6445
 
4 daniel-mar 6446
  PD3DShadeMode = ^TD3DShadeMode;
1 daniel-mar 6447
  TD3DShadeMode = (
6448
    D3DSHADE_INVALID_0,
6449
    D3DSHADE_FLAT,
6450
    D3DSHADE_GOURAUD,
4 daniel-mar 6451
    D3DSHADE_PHONG);
1 daniel-mar 6452
 
4 daniel-mar 6453
  PD3DFillMode = ^TD3DFillMode;
1 daniel-mar 6454
  TD3DFillMode = (
6455
    D3DFILL_INVALID_0,
6456
    D3DFILL_POINT,
6457
    D3DFILL_WIREFRAME,
4 daniel-mar 6458
    D3DFILL_SOLID);
1 daniel-mar 6459
 
4 daniel-mar 6460
  PD3DLinePattern = ^TD3DLinePattern;
6461
  TD3DLinePattern = packed record
1 daniel-mar 6462
    wRepeatFactor: WORD;
6463
    wLinePattern: WORD;
6464
  end;
6465
 
4 daniel-mar 6466
  PD3DTextureFilter = ^TD3DTextureFilter;
1 daniel-mar 6467
  TD3DTextureFilter = (
6468
    D3DFILTER_INVALID_0,
6469
    D3DFILTER_NEAREST,
6470
    D3DFILTER_LINEAR,
6471
    D3DFILTER_MIPNEAREST,
6472
    D3DFILTER_MIPLINEAR,
6473
    D3DFILTER_LINEARMIPNEAREST,
4 daniel-mar 6474
    D3DFILTER_LINEARMIPLINEAR);
1 daniel-mar 6475
 
4 daniel-mar 6476
  PD3DBlend = ^TD3DBlend;
1 daniel-mar 6477
  TD3DBlend = (
6478
    D3DBLEND_INVALID_0,
6479
    D3DBLEND_ZERO,
6480
    D3DBLEND_ONE,
6481
    D3DBLEND_SRCCOLOR,
6482
    D3DBLEND_INVSRCCOLOR,
6483
    D3DBLEND_SRCALPHA,
6484
    D3DBLEND_INVSRCALPHA,
6485
    D3DBLEND_DESTALPHA,
6486
    D3DBLEND_INVDESTALPHA,
6487
    D3DBLEND_DESTCOLOR,
6488
    D3DBLEND_INVDESTCOLOR,
6489
    D3DBLEND_SRCALPHASAT,
6490
    D3DBLEND_BOTHSRCALPHA,
4 daniel-mar 6491
    D3DBLEND_BOTHINVSRCALPHA);
1 daniel-mar 6492
 
4 daniel-mar 6493
  PD3DTextureBlend = ^TD3DTextureBlend;
1 daniel-mar 6494
  TD3DTextureBlend = (
6495
    D3DTBLEND_INVALID_0,
6496
    D3DTBLEND_DECAL,
6497
    D3DTBLEND_MODULATE,
6498
    D3DTBLEND_DECALALPHA,
6499
    D3DTBLEND_MODULATEALPHA,
6500
    D3DTBLEND_DECALMASK,
6501
    D3DTBLEND_MODULATEMASK,
6502
    D3DTBLEND_COPY,
4 daniel-mar 6503
    D3DTBLEND_ADD);
1 daniel-mar 6504
 
4 daniel-mar 6505
  PD3DTextureAddress = ^TD3DTextureAddress;
1 daniel-mar 6506
  TD3DTextureAddress = (
6507
    D3DTADDRESS_INVALID_0,
6508
    D3DTADDRESS_WRAP,
6509
    D3DTADDRESS_MIRROR,
6510
    D3DTADDRESS_CLAMP,
4 daniel-mar 6511
    D3DTADDRESS_BORDER);
1 daniel-mar 6512
 
4 daniel-mar 6513
  PD3DCull = ^TD3DCull;
1 daniel-mar 6514
  TD3DCull = (
6515
    D3DCULL_INVALID_0,
6516
    D3DCULL_NONE,
6517
    D3DCULL_CW,
4 daniel-mar 6518
    D3DCULL_CCW);
1 daniel-mar 6519
 
4 daniel-mar 6520
  PD3DCmpFunc = ^TD3DCmpFunc;
1 daniel-mar 6521
  TD3DCmpFunc = (
6522
    D3DCMP_INVALID_0,
6523
    D3DCMP_NEVER,
6524
    D3DCMP_LESS,
6525
    D3DCMP_EQUAL,
6526
    D3DCMP_LESSEQUAL,
6527
    D3DCMP_GREATER,
6528
    D3DCMP_NOTEQUAL,
6529
    D3DCMP_GREATEREQUAL,
4 daniel-mar 6530
    D3DCMP_ALWAYS);
1 daniel-mar 6531
 
4 daniel-mar 6532
  PD3DStencilOp = ^TD3DStencilOp;
1 daniel-mar 6533
  TD3DStencilOp = (
6534
    D3DSTENCILOP_INVALID_0,
6535
    D3DSTENCILOP_KEEP,
6536
    D3DSTENCILOP_ZERO,
6537
    D3DSTENCILOP_REPLACE,
6538
    D3DSTENCILOP_INCRSAT,
6539
    D3DSTENCILOP_DECRSAT,
6540
    D3DSTENCILOP_INVERT,
6541
    D3DSTENCILOP_INCR,
4 daniel-mar 6542
    D3DSTENCILOP_DECR);
6543
 
6544
  PD3DFogMode = ^TD3DFogMode;
1 daniel-mar 6545
  TD3DFogMode = (
6546
    D3DFOG_NONE,
6547
    D3DFOG_EXP,
6548
    D3DFOG_EXP2,
4 daniel-mar 6549
    D3DFOG_LINEAR);
1 daniel-mar 6550
 
4 daniel-mar 6551
  PD3DZBufferType = ^TD3DZBufferType;
1 daniel-mar 6552
  TD3DZBufferType = (
6553
    D3DZB_FALSE,
4 daniel-mar 6554
    D3DZB_TRUE,   // Z buffering
6555
    D3DZB_USEW);  // W buffering
1 daniel-mar 6556
 
4 daniel-mar 6557
  PD3DAntialiasMode = ^TD3DAntialiasMode;
1 daniel-mar 6558
  TD3DAntialiasMode = (
6559
    D3DANTIALIAS_NONE,
6560
    D3DANTIALIAS_SORTDEPENDENT,
4 daniel-mar 6561
    D3DANTIALIAS_SORTINDEPENDENT);
1 daniel-mar 6562
 
4 daniel-mar 6563
// Vertex types supported by Direct3D
6564
  PD3DVertexType = ^TD3DVertexType;
1 daniel-mar 6565
  TD3DVertexType = (
6566
    D3DVT_INVALID_0,
6567
    D3DVT_VERTEX,
6568
    D3DVT_LVERTEX,
4 daniel-mar 6569
    D3DVT_TLVERTEX);
1 daniel-mar 6570
 
4 daniel-mar 6571
// Primitives supported by draw-primitive API
6572
  PD3DPrimitiveType = ^TD3DPrimitiveType;
1 daniel-mar 6573
  TD3DPrimitiveType = (
6574
    D3DPT_INVALID_0,
6575
    D3DPT_POINTLIST,
6576
    D3DPT_LINELIST,
6577
    D3DPT_LINESTRIP,
6578
    D3DPT_TRIANGLELIST,
6579
    D3DPT_TRIANGLESTRIP,
4 daniel-mar 6580
    D3DPT_TRIANGLEFAN);
1 daniel-mar 6581
 
4 daniel-mar 6582
(*
6583
 * Amount to add to a state to generate the override for that state.
6584
 *)
1 daniel-mar 6585
 
6586
const
4 daniel-mar 6587
  D3DSTATE_OVERRIDE_BIAS          = 256;
1 daniel-mar 6588
 
4 daniel-mar 6589
(*
6590
 * A state which sets the override flag for the specified state type.
6591
 *)
1 daniel-mar 6592
 
4 daniel-mar 6593
function D3DSTATE_OVERRIDE(StateType: DWORD) : DWORD;
1 daniel-mar 6594
 
6595
type
4 daniel-mar 6596
  PD3DTransformStateType = ^TD3DTransformStateType;
6597
  TD3DTransformStateType = DWORD;
6598
const
6599
  D3DTRANSFORMSTATE_WORLD         = 1;
6600
  D3DTRANSFORMSTATE_VIEW          = 2;
6601
  D3DTRANSFORMSTATE_PROJECTION    = 3;
6602
  D3DTRANSFORMSTATE_WORLD1        = 4;  // 2nd matrix to blend
6603
  D3DTRANSFORMSTATE_WORLD2        = 5;  // 3rd matrix to blend
6604
  D3DTRANSFORMSTATE_WORLD3        = 6;  // 4th matrix to blend
6605
  D3DTRANSFORMSTATE_TEXTURE0      = 16;
6606
  D3DTRANSFORMSTATE_TEXTURE1      = 17;
6607
  D3DTRANSFORMSTATE_TEXTURE2      = 18;
6608
  D3DTRANSFORMSTATE_TEXTURE3      = 19;
6609
  D3DTRANSFORMSTATE_TEXTURE4      = 20;
6610
  D3DTRANSFORMSTATE_TEXTURE5      = 21;
6611
  D3DTRANSFORMSTATE_TEXTURE6      = 22;
6612
  D3DTRANSFORMSTATE_TEXTURE7      = 23;
1 daniel-mar 6613
 
4 daniel-mar 6614
type
6615
  PD3DLightStateType = ^TD3DLightStateType;
1 daniel-mar 6616
  TD3DLightStateType = (
6617
    D3DLIGHTSTATE_INVALID_0,
6618
    D3DLIGHTSTATE_MATERIAL,
6619
    D3DLIGHTSTATE_AMBIENT,
6620
    D3DLIGHTSTATE_COLORMODEL,
6621
    D3DLIGHTSTATE_FOGMODE,
6622
    D3DLIGHTSTATE_FOGSTART,
6623
    D3DLIGHTSTATE_FOGEND,
6624
    D3DLIGHTSTATE_FOGDENSITY,
4 daniel-mar 6625
    D3DLIGHTSTATE_COLORVERTEX);
1 daniel-mar 6626
 
4 daniel-mar 6627
  PD3DRenderStateType = ^TD3DRenderStateType;
6628
  TD3DRenderStateType = DWORD;
6629
const
6630
    D3DRENDERSTATE_ANTIALIAS          = 2;    (* D3DANTIALIASMODE *)
6631
    D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4;    (* TRUE for perspective correction *)
6632
    D3DRENDERSTATE_ZENABLE            = 7;    (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *)
6633
    D3DRENDERSTATE_FILLMODE           = 8;    (* D3DFILL_MODE        *)
6634
    D3DRENDERSTATE_SHADEMODE          = 9;    (* D3DSHADEMODE *)
6635
    D3DRENDERSTATE_LINEPATTERN        = 10;   (* D3DLINEPATTERN *)
6636
    D3DRENDERSTATE_ZWRITEENABLE       = 14;   (* TRUE to enable z writes *)
6637
    D3DRENDERSTATE_ALPHATESTENABLE    = 15;   (* TRUE to enable alpha tests *)
6638
    D3DRENDERSTATE_LASTPIXEL          = 16;   (* TRUE for last-pixel on lines *)
6639
    D3DRENDERSTATE_SRCBLEND           = 19;   (* D3DBLEND *)
6640
    D3DRENDERSTATE_DESTBLEND          = 20;   (* D3DBLEND *)
6641
    D3DRENDERSTATE_CULLMODE           = 22;   (* D3DCULL *)
6642
    D3DRENDERSTATE_ZFUNC              = 23;   (* D3DCMPFUNC *)
6643
    D3DRENDERSTATE_ALPHAREF           = 24;   (* D3DFIXED *)
6644
    D3DRENDERSTATE_ALPHAFUNC          = 25;   (* D3DCMPFUNC *)
6645
    D3DRENDERSTATE_DITHERENABLE       = 26;   (* TRUE to enable dithering *)
6646
    D3DRENDERSTATE_ALPHABLENDENABLE   = 27;   (* TRUE to enable alpha blending *)
6647
    D3DRENDERSTATE_FOGENABLE          = 28;   (* TRUE to enable fog blending *)
6648
    D3DRENDERSTATE_SPECULARENABLE     = 29;   (* TRUE to enable specular *)
6649
    D3DRENDERSTATE_ZVISIBLE           = 30;   (* TRUE to enable z checking *)
6650
    D3DRENDERSTATE_STIPPLEDALPHA      = 33;   (* TRUE to enable stippled alpha (RGB device only) *)
6651
    D3DRENDERSTATE_FOGCOLOR           = 34;   (* D3DCOLOR *)
6652
    D3DRENDERSTATE_FOGTABLEMODE       = 35;   (* D3DFOGMODE *)
6653
    D3DRENDERSTATE_FOGSTART           = 36;   (* Fog start (for both vertex and pixel fog) *)
6654
    D3DRENDERSTATE_FOGEND             = 37;   (* Fog end      *)
6655
    D3DRENDERSTATE_FOGDENSITY         = 38;   (* Fog density  *)
6656
    D3DRENDERSTATE_EDGEANTIALIAS      = 40;   (* TRUE to enable edge antialiasing *)
6657
    D3DRENDERSTATE_COLORKEYENABLE     = 41;   (* TRUE to enable source colorkeyed textures *)
6658
    D3DRENDERSTATE_ZBIAS              = 47;   (* LONG Z bias *)
6659
    D3DRENDERSTATE_RANGEFOGENABLE     = 48;   (* Enables range-based fog *)
1 daniel-mar 6660
 
4 daniel-mar 6661
    D3DRENDERSTATE_STENCILENABLE      = 52;   (* BOOL enable/disable stenciling *)
6662
    D3DRENDERSTATE_STENCILFAIL        = 53;   (* D3DSTENCILOP to do if stencil test fails *)
6663
    D3DRENDERSTATE_STENCILZFAIL       = 54;   (* D3DSTENCILOP to do if stencil test passes and Z test fails *)
6664
    D3DRENDERSTATE_STENCILPASS        = 55;   (* D3DSTENCILOP to do if both stencil and Z tests pass *)
6665
    D3DRENDERSTATE_STENCILFUNC        = 56;   (* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *)
6666
    D3DRENDERSTATE_STENCILREF         = 57;   (* Reference value used in stencil test *)
6667
    D3DRENDERSTATE_STENCILMASK        = 58;   (* Mask value used in stencil test *)
6668
    D3DRENDERSTATE_STENCILWRITEMASK   = 59;   (* Write mask applied to values written to stencil buffer *)
6669
    D3DRENDERSTATE_TEXTUREFACTOR      = 60;   (* D3DCOLOR used for multi-texture blend *)
1 daniel-mar 6670
 
4 daniel-mar 6671
    (*
6672
     * 128 values [128; 255] are reserved for texture coordinate wrap flags.
6673
     * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
6674
     * a flags word preserves forward compatibility with texture coordinates
6675
     * that are >2D.
6676
     *)
6677
    D3DRENDERSTATE_WRAP0              = 128;  (* wrap for 1st texture coord. set *)
6678
    D3DRENDERSTATE_WRAP1              = 129;  (* wrap for 2nd texture coord. set *)
6679
    D3DRENDERSTATE_WRAP2              = 130;  (* wrap for 3rd texture coord. set *)
6680
    D3DRENDERSTATE_WRAP3              = 131;  (* wrap for 4th texture coord. set *)
6681
    D3DRENDERSTATE_WRAP4              = 132;  (* wrap for 5th texture coord. set *)
6682
    D3DRENDERSTATE_WRAP5              = 133;  (* wrap for 6th texture coord. set *)
6683
    D3DRENDERSTATE_WRAP6              = 134;  (* wrap for 7th texture coord. set *)
6684
    D3DRENDERSTATE_WRAP7              = 135;  (* wrap for 8th texture coord. set *)
6685
    D3DRENDERSTATE_CLIPPING            = 136;
6686
    D3DRENDERSTATE_LIGHTING            = 137;
6687
    D3DRENDERSTATE_EXTENTS             = 138;
6688
    D3DRENDERSTATE_AMBIENT             = 139;
6689
    D3DRENDERSTATE_FOGVERTEXMODE       = 140;
6690
    D3DRENDERSTATE_COLORVERTEX         = 141;
6691
    D3DRENDERSTATE_LOCALVIEWER         = 142;
6692
    D3DRENDERSTATE_NORMALIZENORMALS    = 143;
6693
    D3DRENDERSTATE_COLORKEYBLENDENABLE = 144;
6694
    D3DRENDERSTATE_DIFFUSEMATERIALSOURCE    = 145;
6695
    D3DRENDERSTATE_SPECULARMATERIALSOURCE   = 146;
6696
    D3DRENDERSTATE_AMBIENTMATERIALSOURCE    = 147;
6697
    D3DRENDERSTATE_EMISSIVEMATERIALSOURCE   = 148;
6698
    D3DRENDERSTATE_VERTEXBLEND              = 151;
6699
    D3DRENDERSTATE_CLIPPLANEENABLE          = 152;
1 daniel-mar 6700
 
4 daniel-mar 6701
//
6702
// retired renderstates - not supported for DX7 interfaces
6703
//
6704
    D3DRENDERSTATE_TEXTUREHANDLE      = 1;    (* Texture handle for legacy interfaces (Texture;Texture2) *)
6705
    D3DRENDERSTATE_TEXTUREADDRESS     = 3;    (* D3DTEXTUREADDRESS  *)
6706
    D3DRENDERSTATE_WRAPU              = 5;    (* TRUE for wrapping in u *)
6707
    D3DRENDERSTATE_WRAPV              = 6;    (* TRUE for wrapping in v *)
6708
    D3DRENDERSTATE_MONOENABLE         = 11;   (* TRUE to enable mono rasterization *)
6709
    D3DRENDERSTATE_ROP2               = 12;   (* ROP2 *)
6710
    D3DRENDERSTATE_PLANEMASK          = 13;   (* DWORD physical plane mask *)
6711
    D3DRENDERSTATE_TEXTUREMAG         = 17;   (* D3DTEXTUREFILTER *)
6712
    D3DRENDERSTATE_TEXTUREMIN         = 18;   (* D3DTEXTUREFILTER *)
6713
    D3DRENDERSTATE_TEXTUREMAPBLEND    = 21;   (* D3DTEXTUREBLEND *)
6714
    D3DRENDERSTATE_SUBPIXEL           = 31;   (* TRUE to enable subpixel correction *)
6715
    D3DRENDERSTATE_SUBPIXELX          = 32;   (* TRUE to enable correction in X only *)
6716
    D3DRENDERSTATE_STIPPLEENABLE      = 39;   (* TRUE to enable stippling *)
6717
    D3DRENDERSTATE_BORDERCOLOR        = 43;   (* Border color for texturing w/border *)
6718
    D3DRENDERSTATE_TEXTUREADDRESSU    = 44;   (* Texture addressing mode for U coordinate *)
6719
    D3DRENDERSTATE_TEXTUREADDRESSV    = 45;   (* Texture addressing mode for V coordinate *)
6720
    D3DRENDERSTATE_MIPMAPLODBIAS      = 46;   (* D3DVALUE Mipmap LOD bias *)
6721
    D3DRENDERSTATE_ANISOTROPY         = 49;   (* Max. anisotropy. 1 = no anisotropy *)
6722
    D3DRENDERSTATE_FLUSHBATCH         = 50;   (* Explicit flush for DP batching (DX5 Only) *)
6723
    D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51; (* BOOL enable sort-independent transparency *)
6724
    D3DRENDERSTATE_STIPPLEPATTERN00   = 64;   (* Stipple pattern 01...  *)
6725
    D3DRENDERSTATE_STIPPLEPATTERN01   = 65;
6726
    D3DRENDERSTATE_STIPPLEPATTERN02   = 66;
6727
    D3DRENDERSTATE_STIPPLEPATTERN03   = 67;
6728
    D3DRENDERSTATE_STIPPLEPATTERN04   = 68;
6729
    D3DRENDERSTATE_STIPPLEPATTERN05   = 69;
6730
    D3DRENDERSTATE_STIPPLEPATTERN06   = 70;
6731
    D3DRENDERSTATE_STIPPLEPATTERN07   = 71;
6732
    D3DRENDERSTATE_STIPPLEPATTERN08   = 72;
6733
    D3DRENDERSTATE_STIPPLEPATTERN09   = 73;
6734
    D3DRENDERSTATE_STIPPLEPATTERN10   = 74;
6735
    D3DRENDERSTATE_STIPPLEPATTERN11   = 75;
6736
    D3DRENDERSTATE_STIPPLEPATTERN12   = 76;
6737
    D3DRENDERSTATE_STIPPLEPATTERN13   = 77;
6738
    D3DRENDERSTATE_STIPPLEPATTERN14   = 78;
6739
    D3DRENDERSTATE_STIPPLEPATTERN15   = 79;
6740
    D3DRENDERSTATE_STIPPLEPATTERN16   = 80;
6741
    D3DRENDERSTATE_STIPPLEPATTERN17   = 81;
6742
    D3DRENDERSTATE_STIPPLEPATTERN18   = 82;
6743
    D3DRENDERSTATE_STIPPLEPATTERN19   = 83;
6744
    D3DRENDERSTATE_STIPPLEPATTERN20   = 84;
6745
    D3DRENDERSTATE_STIPPLEPATTERN21   = 85;
6746
    D3DRENDERSTATE_STIPPLEPATTERN22   = 86;
6747
    D3DRENDERSTATE_STIPPLEPATTERN23   = 87;
6748
    D3DRENDERSTATE_STIPPLEPATTERN24   = 88;
6749
    D3DRENDERSTATE_STIPPLEPATTERN25   = 89;
6750
    D3DRENDERSTATE_STIPPLEPATTERN26   = 90;
6751
    D3DRENDERSTATE_STIPPLEPATTERN27   = 91;
6752
    D3DRENDERSTATE_STIPPLEPATTERN28   = 92;
6753
    D3DRENDERSTATE_STIPPLEPATTERN29   = 93;
6754
    D3DRENDERSTATE_STIPPLEPATTERN30   = 94;
6755
    D3DRENDERSTATE_STIPPLEPATTERN31   = 95;
1 daniel-mar 6756
 
4 daniel-mar 6757
//
6758
// retired renderstate names - the values are still used under new naming conventions
6759
//
6760
    D3DRENDERSTATE_FOGTABLESTART      = 36;   (* Fog table start    *)
6761
    D3DRENDERSTATE_FOGTABLEEND        = 37;   (* Fog table end      *)
6762
    D3DRENDERSTATE_FOGTABLEDENSITY    = 38;   (* Fog table density  *)
1 daniel-mar 6763
 
4 daniel-mar 6764
type
6765
// Values for material source
6766
  PD3DMateralColorSource = ^TD3DMateralColorSource;
6767
  TD3DMateralColorSource = (
6768
    D3DMCS_MATERIAL,              // Color from material is used
6769
    D3DMCS_COLOR1,                // Diffuse vertex color is used
6770
    D3DMCS_COLOR2                 // Specular vertex color is used
6771
  );
6772
 
1 daniel-mar 6773
const
4 daniel-mar 6774
  // For back-compatibility with legacy compilations
6775
  D3DRENDERSTATE_BLENDENABLE = D3DRENDERSTATE_ALPHABLENDENABLE;
1 daniel-mar 6776
 
6777
 
4 daniel-mar 6778
// Bias to apply to the texture coordinate set to apply a wrap to.
6779
   D3DRENDERSTATE_WRAPBIAS                = 128;
1 daniel-mar 6780
 
4 daniel-mar 6781
(* Flags to construct the WRAP render states *)
6782
  D3DWRAP_U   = $00000001;
6783
  D3DWRAP_V   = $00000002;
1 daniel-mar 6784
 
4 daniel-mar 6785
(* Flags to construct the WRAP render states for 1D thru 4D texture coordinates *)
6786
  D3DWRAPCOORD_0   = $00000001;    // same as D3DWRAP_U
6787
  D3DWRAPCOORD_1   = $00000002;    // same as D3DWRAP_V
6788
  D3DWRAPCOORD_2   = $00000004;
6789
  D3DWRAPCOORD_3   = $00000008;
1 daniel-mar 6790
 
4 daniel-mar 6791
function D3DRENDERSTATE_STIPPLEPATTERN(y: integer) : TD3DRenderStateType;
6792
 
1 daniel-mar 6793
type
4 daniel-mar 6794
  PD3DState = ^TD3DState;
6795
  TD3DState = packed record
1 daniel-mar 6796
    case Integer of
6797
    0: (
6798
      dtstTransformStateType: TD3DTransformStateType;
4 daniel-mar 6799
      dwArg: Array [ 0..0 ] of DWORD;
6800
     );
1 daniel-mar 6801
    1: (
6802
      dlstLightStateType: TD3DLightStateType;
4 daniel-mar 6803
      dvArg: Array [ 0..0 ] of TD3DValue;
6804
     );
1 daniel-mar 6805
    2: (
6806
      drstRenderStateType: TD3DRenderStateType;
4 daniel-mar 6807
     );
1 daniel-mar 6808
  end;
6809
 
4 daniel-mar 6810
(*
6811
 * Operation used to load matrices
6812
 * hDstMat = hSrcMat
6813
 *)
6814
  PD3DMatrixLoad = ^TD3DMatrixLoad;
6815
  TD3DMatrixLoad = packed record
6816
    hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
6817
    hSrcMatrix: TD3DMatrixHandle;    (* Source matrix *)
1 daniel-mar 6818
  end;
6819
 
4 daniel-mar 6820
(*
6821
 * Operation used to multiply matrices
6822
 * hDstMat = hSrcMat1 * hSrcMat2
6823
 *)
6824
  PD3DMatrixMultiply = ^TD3DMatrixMultiply;
6825
  TD3DMatrixMultiply = packed record
6826
    hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
6827
    hSrcMatrix1: TD3DMatrixHandle;   (* First source matrix *)
6828
    hSrcMatrix2: TD3DMatrixHandle;   (* Second source matrix *)
1 daniel-mar 6829
  end;
6830
 
4 daniel-mar 6831
(*
6832
 * Operation used to transform and light vertices.
6833
 *)
6834
  PD3DProcessVertices = ^TD3DProcessVertices;
6835
  TD3DProcessVertices = packed record
6836
    dwFlags: DWORD;           (* Do we transform or light or just copy? *)
6837
    wStart: WORD;             (* Index to first vertex in source *)
6838
    wDest: WORD;              (* Index to first vertex in local buffer *)
6839
    dwCount: DWORD;           (* Number of vertices to be processed *)
6840
    dwReserved: DWORD;        (* Must be zero *)
1 daniel-mar 6841
  end;
6842
 
6843
const
6844
  D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
6845
  D3DPROCESSVERTICES_TRANSFORM            = $00000001;
6846
  D3DPROCESSVERTICES_COPY                 = $00000002;
6847
  D3DPROCESSVERTICES_OPMASK               = $00000007;
6848
 
6849
  D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
6850
  D3DPROCESSVERTICES_NOCOLOR              = $00000010;
6851
 
6852
 
4 daniel-mar 6853
(*
6854
 * State enumerants for per-stage texture processing.
6855
 *)
1 daniel-mar 6856
type
4 daniel-mar 6857
  PD3DTextureStageStateType = ^TD3DTextureStageStateType;
6858
  TD3DTextureStageStateType = DWORD;
1 daniel-mar 6859
const
4 daniel-mar 6860
  D3DTSS_COLOROP        =  1; (* D3DTEXTUREOP - per-stage blending controls for color channels *)
6861
  D3DTSS_COLORARG1      =  2; (* D3DTA_* (texture arg) *)
6862
  D3DTSS_COLORARG2      =  3; (* D3DTA_* (texture arg) *)
6863
  D3DTSS_ALPHAOP        =  4; (* D3DTEXTUREOP - per-stage blending controls for alpha channel *)
6864
  D3DTSS_ALPHAARG1      =  5; (* D3DTA_* (texture arg) *)
6865
  D3DTSS_ALPHAARG2      =  6; (* D3DTA_* (texture arg) *)
6866
  D3DTSS_BUMPENVMAT00   =  7; (* D3DVALUE (bump mapping matrix) *)
6867
  D3DTSS_BUMPENVMAT01   =  8; (* D3DVALUE (bump mapping matrix) *)
6868
  D3DTSS_BUMPENVMAT10   =  9; (* D3DVALUE (bump mapping matrix) *)
6869
  D3DTSS_BUMPENVMAT11   = 10; (* D3DVALUE (bump mapping matrix) *)
6870
  D3DTSS_TEXCOORDINDEX  = 11; (* identifies which set of texture coordinates index this texture *)
6871
  D3DTSS_ADDRESS        = 12; (* D3DTEXTUREADDRESS for both coordinates *)
6872
  D3DTSS_ADDRESSU       = 13; (* D3DTEXTUREADDRESS for U coordinate *)
6873
  D3DTSS_ADDRESSV       = 14; (* D3DTEXTUREADDRESS for V coordinate *)
6874
  D3DTSS_BORDERCOLOR    = 15; (* D3DCOLOR *)
6875
  D3DTSS_MAGFILTER      = 16; (* D3DTEXTUREMAGFILTER filter to use for magnification *)
6876
  D3DTSS_MINFILTER      = 17; (* D3DTEXTUREMINFILTER filter to use for minification *)
6877
  D3DTSS_MIPFILTER      = 18; (* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification *)
6878
  D3DTSS_MIPMAPLODBIAS  = 19; (* D3DVALUE Mipmap LOD bias *)
6879
  D3DTSS_MAXMIPLEVEL    = 20; (* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) *)
6880
  D3DTSS_MAXANISOTROPY  = 21; (* DWORD maximum anisotropy *)
6881
  D3DTSS_BUMPENVLSCALE  = 22; (* D3DVALUE scale for bump map luminance *)
6882
  D3DTSS_BUMPENVLOFFSET = 23; (* D3DVALUE offset for bump map luminance *)
6883
  D3DTSS_TEXTURETRANSFORMFLAGS = 24; (* D3DTEXTURETRANSFORMFLAGS controls texture transform *)
1 daniel-mar 6884
 
4 daniel-mar 6885
// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
6886
// and normal in the camera space) should be taken as texture coordinates
6887
// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
6888
//
6889
  D3DTSS_TCI_PASSTHRU                             = $00000000;
6890
  D3DTSS_TCI_CAMERASPACENORMAL                    = $00010000;
6891
  D3DTSS_TCI_CAMERASPACEPOSITION                  = $00020000;
6892
  D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR          = $00030000;
1 daniel-mar 6893
 
6894
type
4 daniel-mar 6895
(*
6896
 * Enumerations for COLOROP and ALPHAOP texture blending operations set in
6897
 * texture processing stage controls in D3DRENDERSTATE.
6898
 *)
6899
  PD3DTextureOp = ^TD3DTextureOp;
1 daniel-mar 6900
  TD3DTextureOp = (
6901
    D3DTOP_INVALID_0,
4 daniel-mar 6902
// Control
6903
    D3DTOP_DISABLE   ,      // disables stage
6904
    D3DTOP_SELECTARG1,      // the default
1 daniel-mar 6905
    D3DTOP_SELECTARG2,
4 daniel-mar 6906
 
6907
// Modulate
6908
    D3DTOP_MODULATE  ,      // multiply args together
6909
    D3DTOP_MODULATE2X,      // multiply and  1 bit
6910
    D3DTOP_MODULATE4X,      // multiply and  2 bits
6911
 
6912
// Add
6913
    D3DTOP_ADD        ,   // add arguments together
6914
    D3DTOP_ADDSIGNED  ,   // add with -0.5 bias
6915
    D3DTOP_ADDSIGNED2X,   // as above but left  1 bit
6916
    D3DTOP_SUBTRACT   ,   // Arg1 - Arg2, with no saturation
6917
    D3DTOP_ADDSMOOTH  ,   // add 2 args, subtract product
6918
                          // Arg1 + Arg2 - Arg1*Arg2
6919
                          // = Arg1 + (1-Arg1)*Arg2
6920
 
6921
// Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
6922
    D3DTOP_BLENDDIFFUSEALPHA  , // iterated alpha
6923
    D3DTOP_BLENDTEXTUREALPHA  , // texture alpha
6924
    D3DTOP_BLENDFACTORALPHA   , // alpha from D3DRENDERSTATE_TEXTUREFACTOR
1 daniel-mar 6925
    // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
4 daniel-mar 6926
    D3DTOP_BLENDTEXTUREALPHAPM, // texture alpha
6927
    D3DTOP_BLENDCURRENTALPHA  , // by alpha of current color
6928
 
6929
// Specular mapping
6930
    D3DTOP_PREMODULATE           ,     // modulate with next texture before use
1 daniel-mar 6931
    D3DTOP_MODULATEALPHA_ADDCOLOR,     // Arg1.RGB + Arg1.A*Arg2.RGB
6932
                                       // COLOROP only
6933
    D3DTOP_MODULATECOLOR_ADDALPHA,     // Arg1.RGB*Arg2.RGB + Arg1.A
4 daniel-mar 6934
                                            // COLOROP only
1 daniel-mar 6935
    D3DTOP_MODULATEINVALPHA_ADDCOLOR,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
6936
                                       // COLOROP only
6937
    D3DTOP_MODULATEINVCOLOR_ADDALPHA,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
4 daniel-mar 6938
                                            // COLOROP only
6939
 
6940
// Bump mapping
6941
    D3DTOP_BUMPENVMAP         , // per pixel env map perturbation
6942
    D3DTOP_BUMPENVMAPLUMINANCE, // with luminance channel
1 daniel-mar 6943
    // This can do either diffuse or specular bump mapping with correct input.
6944
    // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
6945
    // where each component has been scaled and offset to make it signed.
6946
    // The result is replicated into all four (including alpha) channels.
6947
    // This is a valid COLOROP only.
6948
    D3DTOP_DOTPRODUCT3
6949
  );
6950
 
4 daniel-mar 6951
(*
6952
 * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
6953
 * set in texture processing stage controls in D3DRENDERSTATE.
6954
 *)
1 daniel-mar 6955
const
4 daniel-mar 6956
  D3DTA_SELECTMASK        = $0000000f;  // mask for arg selector
6957
  D3DTA_DIFFUSE           = $00000000;  // select diffuse color
6958
  D3DTA_CURRENT           = $00000001;  // select result of previous stage
6959
  D3DTA_TEXTURE           = $00000002;  // select texture color
6960
  D3DTA_TFACTOR           = $00000003;  // select RENDERSTATE_TEXTUREFACTOR
6961
  D3DTA_SPECULAR          = $00000004;  // select specular color
6962
  D3DTA_COMPLEMENT        = $00000010;  // take 1.0 - x
6963
  D3DTA_ALPHAREPLICATE    = $00000020;  // replicate alpha to color components
1 daniel-mar 6964
 
4 daniel-mar 6965
(*
6966
 *  IDirect3DTexture2 State Filter Types
6967
 *)
1 daniel-mar 6968
type
4 daniel-mar 6969
  PD3DTextureMagFilter = ^TD3DTextureMagFilter;
1 daniel-mar 6970
  TD3DTextureMagFilter = (
6971
    D3DTFG_INVALID_0,
4 daniel-mar 6972
    D3DTFG_POINT        ,    // nearest
6973
    D3DTFG_LINEAR       ,    // linear interpolation
6974
    D3DTFG_FLATCUBIC    ,    // cubic
6975
    D3DTFG_GAUSSIANCUBIC,    // different cubic kernel
1 daniel-mar 6976
    D3DTFG_ANISOTROPIC
6977
  );
6978
 
4 daniel-mar 6979
  PD3DTextureMinFilter = ^TD3DTextureMinFilter;
1 daniel-mar 6980
  TD3DTextureMinFilter = (
6981
    D3DTFN_INVALID_0,
4 daniel-mar 6982
    D3DTFN_POINT      ,    // nearest
6983
    D3DTFN_LINEAR     ,    // linear interpolation
1 daniel-mar 6984
    D3DTFN_ANISOTROPIC
6985
  );
6986
 
4 daniel-mar 6987
  PD3DTextureMipFilter = ^TD3DTextureMipFilter;
1 daniel-mar 6988
  TD3DTextureMipFilter = (
6989
    D3DTFP_INVALID_0,
4 daniel-mar 6990
    D3DTFP_NONE   ,    // mipmapping disabled (use MAG filter)
6991
    D3DTFP_POINT  ,    // nearest
6992
    D3DTFP_LINEAR      // linear interpolation
1 daniel-mar 6993
  );
6994
 
6995
 
4 daniel-mar 6996
(*
6997
 * Triangle flags
6998
 *)
1 daniel-mar 6999
 
4 daniel-mar 7000
(*
7001
 * Tri strip and fan flags.
7002
 * START loads all three vertices
7003
 * EVEN and ODD load just v3 with even or odd culling
7004
 * START_FLAT contains a count from 0 to 29 that allows the
7005
 * whole strip or fan to be culled in one hit.
7006
 * e.g. for a quad len = 1
7007
 *)
1 daniel-mar 7008
const
7009
  D3DTRIFLAG_START                        = $00000000;
4 daniel-mar 7010
// #define D3DTRIFLAG_STARTFLAT(len) (len)         (* 0 < len < 30 *)
7011
function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
7012
 
7013
const
1 daniel-mar 7014
  D3DTRIFLAG_ODD                          = $0000001e;
7015
  D3DTRIFLAG_EVEN                         = $0000001f;
7016
 
4 daniel-mar 7017
(*
7018
 * Triangle edge flags
7019
 * enable edges for wireframe or antialiasing
7020
 *)
7021
  D3DTRIFLAG_EDGEENABLE1                  = $00000100; (* v0-v1 edge *)
7022
  D3DTRIFLAG_EDGEENABLE2                  = $00000200; (* v1-v2 edge *)
7023
  D3DTRIFLAG_EDGEENABLE3                  = $00000400; (* v2-v0 edge *)
7024
  D3DTRIFLAG_EDGEENABLETRIANGLE = (
7025
      D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3);
1 daniel-mar 7026
 
4 daniel-mar 7027
(*
7028
 * Primitive structures and related defines.  Vertex offsets are to types
7029
 * TD3DVertex, TD3DLVertex, or TD3DTLVertex.
7030
 *)
1 daniel-mar 7031
 
4 daniel-mar 7032
(*
7033
 * Triangle list primitive structure
7034
 *)
1 daniel-mar 7035
type
7036
  PD3DTriangle = ^TD3DTriangle;
4 daniel-mar 7037
  TD3DTriangle = packed record
1 daniel-mar 7038
    case Integer of
7039
    0: (
4 daniel-mar 7040
      v1: WORD;            (* Vertex indices *)
1 daniel-mar 7041
      v2: WORD;
7042
      v3: WORD;
4 daniel-mar 7043
      wFlags: WORD;        (* Edge (and other) flags *)
7044
     );
1 daniel-mar 7045
    1: (
7046
      wV1: WORD;
7047
      wV2: WORD;
7048
      wV3: WORD;
4 daniel-mar 7049
     );
1 daniel-mar 7050
  end;
7051
 
4 daniel-mar 7052
(*
7053
 * Line strip structure.
7054
 * The instruction count - 1 defines the number of line segments.
7055
 *)
1 daniel-mar 7056
  PD3DLine = ^TD3DLine;
4 daniel-mar 7057
  TD3DLine = packed record
1 daniel-mar 7058
    case Integer of
7059
    0: (
4 daniel-mar 7060
      v1: WORD;            (* Vertex indices *)
1 daniel-mar 7061
      v2: WORD;
4 daniel-mar 7062
     );
1 daniel-mar 7063
    1: (
7064
      wV1: WORD;
7065
      wV2: WORD;
4 daniel-mar 7066
     );
1 daniel-mar 7067
  end;
7068
 
4 daniel-mar 7069
(*
7070
 * Span structure
7071
 * Spans join a list of points with the same y value.
7072
 * If the y value changes, a new span is started.
7073
 *)
1 daniel-mar 7074
  PD3DSpan = ^TD3DSpan;
4 daniel-mar 7075
  TD3DSpan = packed record
7076
    wCount: WORD;        (* Number of spans *)
7077
    wFirst: WORD;        (* Index to first vertex *)
1 daniel-mar 7078
  end;
7079
 
4 daniel-mar 7080
(*
7081
 * Point structure
7082
 *)
1 daniel-mar 7083
  PD3DPoint = ^TD3DPoint;
4 daniel-mar 7084
  TD3DPoint = packed record
7085
    wCount: WORD;        (* number of points         *)
7086
    wFirst: WORD;        (* index to first vertex    *)
1 daniel-mar 7087
  end;
7088
 
4 daniel-mar 7089
(*
7090
 * Forward branch structure.
7091
 * Mask is logically anded with the driver status mask
7092
 * if the result equals 'value', the branch is taken.
7093
 *)
1 daniel-mar 7094
  PD3DBranch = ^TD3DBranch;
4 daniel-mar 7095
  TD3DBranch = packed record
7096
    dwMask: DWORD;         (* Bitmask against D3D status *)
1 daniel-mar 7097
    dwValue: DWORD;
4 daniel-mar 7098
    bNegate: BOOL;         (* TRUE to negate comparison *)
7099
    dwOffset: DWORD;       (* How far to branch forward (0 for exit)*)
1 daniel-mar 7100
  end;
7101
 
4 daniel-mar 7102
(*
7103
 * Status used for set status instruction.
7104
 * The D3D status is initialised on device creation
7105
 * and is modified by all execute calls.
7106
 *)
1 daniel-mar 7107
  PD3DStatus = ^TD3DStatus;
4 daniel-mar 7108
  TD3DStatus = packed record
7109
    dwFlags: DWORD;        (* Do we set extents or status *)
7110
    dwStatus: DWORD;       (* D3D status *)
1 daniel-mar 7111
    drExtent: TD3DRect;
7112
  end;
7113
 
7114
const
4 daniel-mar 7115
  D3DSETSTATUS_STATUS    = $00000001;
7116
  D3DSETSTATUS_EXTENTS   = $00000002;
7117
  D3DSETSTATUS_ALL      = (D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS);
1 daniel-mar 7118
 
7119
type
7120
  PD3DClipStatus = ^TD3DClipStatus;
4 daniel-mar 7121
  TD3DClipStatus = packed record
7122
    dwFlags : DWORD; (* Do we set 2d extents, 3D extents or status *)
7123
    dwStatus : DWORD; (* Clip status *)
7124
    minx, maxx : float; (* X extents *)
7125
    miny, maxy : float; (* Y extents *)
7126
    minz, maxz : float; (* Z extents *)
1 daniel-mar 7127
  end;
7128
 
7129
const
7130
  D3DCLIPSTATUS_STATUS        = $00000001;
7131
  D3DCLIPSTATUS_EXTENTS2      = $00000002;
7132
  D3DCLIPSTATUS_EXTENTS3      = $00000004;
7133
 
4 daniel-mar 7134
(*
7135
 * Statistics structure
7136
 *)
1 daniel-mar 7137
type
7138
  PD3DStats = ^TD3DStats;
4 daniel-mar 7139
  TD3DStats = packed record
1 daniel-mar 7140
    dwSize: DWORD;
7141
    dwTrianglesDrawn: DWORD;
7142
    dwLinesDrawn: DWORD;
7143
    dwPointsDrawn: DWORD;
7144
    dwSpansDrawn: DWORD;
7145
    dwVerticesProcessed: DWORD;
7146
  end;
7147
 
4 daniel-mar 7148
(*
7149
 * Execute options.
7150
 * When calling using D3DEXECUTE_UNCLIPPED all the primitives
7151
 * inside the buffer must be contained within the viewport.
7152
 *)
1 daniel-mar 7153
const
7154
  D3DEXECUTE_CLIPPED       = $00000001;
7155
  D3DEXECUTE_UNCLIPPED     = $00000002;
7156
 
7157
type
7158
  PD3DExecuteData = ^TD3DExecuteData;
4 daniel-mar 7159
  TD3DExecuteData = packed record
1 daniel-mar 7160
    dwSize: DWORD;
7161
    dwVertexOffset: DWORD;
7162
    dwVertexCount: DWORD;
7163
    dwInstructionOffset: DWORD;
7164
    dwInstructionLength: DWORD;
7165
    dwHVertexOffset: DWORD;
4 daniel-mar 7166
    dsStatus: TD3DStatus;       (* Status after execute *)
1 daniel-mar 7167
  end;
7168
 
4 daniel-mar 7169
(*
7170
 * Palette flags.
7171
 * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
7172
 *)
1 daniel-mar 7173
 
7174
const
4 daniel-mar 7175
  D3DPAL_FREE     = $00;    (* Renderer may use this entry freely *)
7176
  D3DPAL_READONLY = $40;    (* Renderer may not set this entry *)
7177
  D3DPAL_RESERVED = $80;    (* Renderer may not use this entry *)
1 daniel-mar 7178
 
7179
 
7180
type
7181
  PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
4 daniel-mar 7182
  TD3DVertexBufferDesc = packed record
7183
    dwSize : DWORD;
7184
    dwCaps : DWORD;
7185
    dwFVF : DWORD;
7186
    dwNumVertices : DWORD;
1 daniel-mar 7187
  end;
7188
 
7189
const
4 daniel-mar 7190
(* These correspond to DDSCAPS_* flags *)
7191
  D3DVBCAPS_SYSTEMMEMORY      = $00000800;
7192
  D3DVBCAPS_WRITEONLY         = $00010000;
7193
  D3DVBCAPS_OPTIMIZED         = $80000000;
7194
  D3DVBCAPS_DONOTCLIP         = $00000001;
1 daniel-mar 7195
 
4 daniel-mar 7196
(* Vertex Operations for ProcessVertices *)
7197
  D3DVOP_LIGHT      = (1 shl 10);
7198
  D3DVOP_TRANSFORM  = (1 shl 0);
7199
  D3DVOP_CLIP       = (1 shl 2);
7200
  D3DVOP_EXTENTS    = (1 shl 3);
1 daniel-mar 7201
 
4 daniel-mar 7202
(* The maximum number of vertices user can pass to any d3d
7203
   drawing function or to create vertex buffer with
7204
*)
7205
  D3DMAXNUMVERTICES  =  ((1 shl 16) - 1);
7206
(* The maximum number of primitives user can pass to any d3d
7207
   drawing function.
7208
*)
7209
  D3DMAXNUMPRIMITIVES = ((1 shl 16) - 1);
1 daniel-mar 7210
 
4 daniel-mar 7211
(* Bits for dwFlags in ProcessVertices call *)
7212
  D3DPV_DONOTCOPYDATA = (1 shl 0);
1 daniel-mar 7213
 
4 daniel-mar 7214
//-------------------------------------------------------------------
1 daniel-mar 7215
 
4 daniel-mar 7216
// Flexible vertex format bits
7217
//
7218
  D3DFVF_RESERVED0        = $001;
7219
  D3DFVF_POSITION_MASK    = $00E;
7220
  D3DFVF_XYZ              = $002;
7221
  D3DFVF_XYZRHW           = $004;
7222
  D3DFVF_XYZB1            = $006;
7223
  D3DFVF_XYZB2            = $008;
7224
  D3DFVF_XYZB3            = $00a;
7225
  D3DFVF_XYZB4            = $00c;
7226
  D3DFVF_XYZB5            = $00e;
1 daniel-mar 7227
 
4 daniel-mar 7228
  D3DFVF_NORMAL           = $010;
7229
  D3DFVF_RESERVED1        = $020;
7230
  D3DFVF_DIFFUSE          = $040;
7231
  D3DFVF_SPECULAR         = $080;
1 daniel-mar 7232
 
4 daniel-mar 7233
  D3DFVF_TEXCOUNT_MASK    = $f00;
7234
  D3DFVF_TEXCOUNT_SHIFT   = 8;
7235
  D3DFVF_TEX0             = $000;
7236
  D3DFVF_TEX1             = $100;
7237
  D3DFVF_TEX2             = $200;
7238
  D3DFVF_TEX3             = $300;
7239
  D3DFVF_TEX4             = $400;
7240
  D3DFVF_TEX5             = $500;
7241
  D3DFVF_TEX6             = $600;
7242
  D3DFVF_TEX7             = $700;
7243
  D3DFVF_TEX8             = $800;
1 daniel-mar 7244
 
4 daniel-mar 7245
  D3DFVF_RESERVED2        = $f000;  // 4 reserved bits
1 daniel-mar 7246
 
4 daniel-mar 7247
  D3DFVF_VERTEX = ( D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1 );
7248
  D3DFVF_LVERTEX = ( D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or
7249
                         D3DFVF_SPECULAR or D3DFVF_TEX1 );
7250
  D3DFVF_TLVERTEX = ( D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or
7251
                          D3DFVF_TEX1 );
1 daniel-mar 7252
 
7253
type
4 daniel-mar 7254
  PD3DDP_PtrStride = ^TD3DDP_PtrStride;
7255
  TD3DDP_PtrStride = packed record
7256
    lpvData : pointer;
7257
    dwStride : DWORD;
1 daniel-mar 7258
  end;
7259
 
7260
const
7261
  D3DDP_MAXTEXCOORD = 8;
7262
 
7263
type
7264
  PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData;
4 daniel-mar 7265
  TD3DDrawPrimitiveStridedData = packed record
7266
    position : TD3DDP_PtrStride;
7267
    normal : TD3DDP_PtrStride;
7268
    diffuse : TD3DDP_PtrStride;
7269
    specular : TD3DDP_PtrStride;
7270
    textureCoords : array [0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride;
1 daniel-mar 7271
  end;
7272
 
4 daniel-mar 7273
//---------------------------------------------------------------------
7274
// ComputeSphereVisibility return values
7275
//
1 daniel-mar 7276
const
4 daniel-mar 7277
  D3DVIS_INSIDE_FRUSTUM      = 0;
7278
  D3DVIS_INTERSECT_FRUSTUM   = 1;
7279
  D3DVIS_OUTSIDE_FRUSTUM     = 2;
7280
  D3DVIS_INSIDE_LEFT         = 0;
7281
  D3DVIS_INTERSECT_LEFT      = (1 shl 2);
7282
  D3DVIS_OUTSIDE_LEFT        = (2 shl 2);
7283
  D3DVIS_INSIDE_RIGHT        = 0;
7284
  D3DVIS_INTERSECT_RIGHT     = (1 shl 4);
7285
  D3DVIS_OUTSIDE_RIGHT       = (2 shl 4);
7286
  D3DVIS_INSIDE_TOP          = 0;
7287
  D3DVIS_INTERSECT_TOP       = (1 shl 6);
7288
  D3DVIS_OUTSIDE_TOP         = (2 shl 6);
7289
  D3DVIS_INSIDE_BOTTOM       = 0;
7290
  D3DVIS_INTERSECT_BOTTOM    = (1 shl 8);
7291
  D3DVIS_OUTSIDE_BOTTOM      = (2 shl 8);
7292
  D3DVIS_INSIDE_NEAR         = 0;
7293
  D3DVIS_INTERSECT_NEAR      = (1 shl 10);
7294
  D3DVIS_OUTSIDE_NEAR        = (2 shl 10);
7295
  D3DVIS_INSIDE_FAR          = 0;
7296
  D3DVIS_INTERSECT_FAR       = (1 shl 12);
7297
  D3DVIS_OUTSIDE_FAR         = (2 shl 12);
1 daniel-mar 7298
 
4 daniel-mar 7299
  D3DVIS_MASK_FRUSTUM        = (3 shl 0);
7300
  D3DVIS_MASK_LEFT           = (3 shl 2);
7301
  D3DVIS_MASK_RIGHT          = (3 shl 4);
7302
  D3DVIS_MASK_TOP            = (3 shl 6);
7303
  D3DVIS_MASK_BOTTOM         = (3 shl 8);
7304
  D3DVIS_MASK_NEAR           = (3 shl 10);
7305
  D3DVIS_MASK_FAR            = (3 shl 12);
1 daniel-mar 7306
 
4 daniel-mar 7307
// To be used with GetInfo()
1 daniel-mar 7308
  D3DDEVINFOID_TEXTUREMANAGER    = 1;
7309
  D3DDEVINFOID_D3DTEXTUREMANAGER = 2;
7310
  D3DDEVINFOID_TEXTURING         = 3;
7311
 
7312
type
4 daniel-mar 7313
  PD3DStateBlockType = ^TD3DStateBlockType;
1 daniel-mar 7314
  TD3DStateBlockType = (
4 daniel-mar 7315
    D3DSBT_INVALID_0   ,
7316
    D3DSBT_ALL         , // capture all state
7317
    D3DSBT_PIXELSTATE  , // capture pixel state
7318
    D3DSBT_VERTEXSTATE   // capture vertex state
1 daniel-mar 7319
  );
7320
 
4 daniel-mar 7321
// The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
7322
//
7323
  PD3DVertexBlendFlags = ^TD3DVertexBlendFlags;
1 daniel-mar 7324
  TD3DVertexBlendFlags = (
4 daniel-mar 7325
    D3DVBLEND_DISABLE , // Disable vertex blending
7326
    D3DVBLEND_1WEIGHT , // blend between 2 matrices
7327
    D3DVBLEND_2WEIGHTS, // blend between 3 matrices
7328
    D3DVBLEND_3WEIGHTS  // blend between 4 matrices
1 daniel-mar 7329
  );
7330
 
4 daniel-mar 7331
  PD3DTextureTransformFlags = ^TD3DTextureTransformFlags;
1 daniel-mar 7332
  TD3DTextureTransformFlags = (
4 daniel-mar 7333
    D3DTTFF_DISABLE ,    // texture coordinates are passed directly
7334
    D3DTTFF_COUNT1  ,    // rasterizer should expect 1-D texture coords
7335
    D3DTTFF_COUNT2  ,    // rasterizer should expect 2-D texture coords
7336
    D3DTTFF_COUNT3  ,    // rasterizer should expect 3-D texture coords
7337
    D3DTTFF_COUNT4       // rasterizer should expect 4-D texture coords
1 daniel-mar 7338
  );
7339
 
7340
const
4 daniel-mar 7341
  D3DTTFF_PROJECTED       = TD3DTextureTransformFlags(256); // texcoords to be divided by COUNTth element
1 daniel-mar 7342
 
4 daniel-mar 7343
// Macros to set texture coordinate format bits in the FVF id
1 daniel-mar 7344
 
4 daniel-mar 7345
D3DFVF_TEXTUREFORMAT2 = 0;         // Two floating point values
7346
D3DFVF_TEXTUREFORMAT1 = 3;         // One floating point value
7347
D3DFVF_TEXTUREFORMAT3 = 1;         // Three floating point values
7348
D3DFVF_TEXTUREFORMAT4 = 2;         // Four floating point values
7349
 
7350
function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD) : DWORD;
7351
function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD) : DWORD;
7352
function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD) : DWORD;
7353
function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD) : DWORD;
7354
 
1 daniel-mar 7355
(*==========================================================================;
7356
 *
7357
 *
7358
 *  File:       d3dcaps.h
7359
 *  Content:    Direct3D capabilities include file
7360
 *
7361
 ***************************************************************************)
7362
 
4 daniel-mar 7363
(* Description of capabilities of transform *)
1 daniel-mar 7364
 
7365
type
7366
  PD3DTransformCaps = ^TD3DTransformCaps;
4 daniel-mar 7367
  TD3DTransformCaps = packed record
1 daniel-mar 7368
    dwSize: DWORD;
7369
    dwCaps: DWORD;
7370
  end;
7371
 
7372
const
4 daniel-mar 7373
  D3DTRANSFORMCAPS_CLIP         = $00000001; (* Will clip whilst transforming *)
1 daniel-mar 7374
 
4 daniel-mar 7375
(* Description of capabilities of lighting *)
1 daniel-mar 7376
 
7377
type
7378
  PD3DLightingCaps = ^TD3DLightingCaps;
4 daniel-mar 7379
  TD3DLightingCaps = packed record
1 daniel-mar 7380
    dwSize: DWORD;
4 daniel-mar 7381
    dwCaps: DWORD;                   (* Lighting caps *)
7382
    dwLightingModel: DWORD;          (* Lighting model - RGB or mono *)
7383
    dwNumLights: DWORD;              (* Number of lights that can be handled *)
1 daniel-mar 7384
  end;
7385
 
7386
const
4 daniel-mar 7387
  D3DLIGHTINGMODEL_RGB            = $00000001;
7388
  D3DLIGHTINGMODEL_MONO           = $00000002;
1 daniel-mar 7389
 
4 daniel-mar 7390
  D3DLIGHTCAPS_POINT              = $00000001; (* Point lights supported *)
7391
  D3DLIGHTCAPS_SPOT               = $00000002; (* Spot lights supported *)
7392
  D3DLIGHTCAPS_DIRECTIONAL        = $00000004; (* Directional lights supported *)
7393
  D3DLIGHTCAPS_PARALLELPOINT      = $00000008; (* Parallel point lights supported *)
7394
  D3DLIGHTCAPS_GLSPOT             = $00000010; (* GL syle spot lights supported *)
1 daniel-mar 7395
 
4 daniel-mar 7396
(* Description of capabilities for each primitive type *)
1 daniel-mar 7397
 
7398
type
7399
  PD3DPrimCaps = ^TD3DPrimCaps;
4 daniel-mar 7400
  TD3DPrimCaps = packed record
1 daniel-mar 7401
    dwSize: DWORD;
4 daniel-mar 7402
    dwMiscCaps: DWORD;                 (* Capability flags *)
1 daniel-mar 7403
    dwRasterCaps: DWORD;
7404
    dwZCmpCaps: DWORD;
7405
    dwSrcBlendCaps: DWORD;
7406
    dwDestBlendCaps: DWORD;
7407
    dwAlphaCmpCaps: DWORD;
7408
    dwShadeCaps: DWORD;
7409
    dwTextureCaps: DWORD;
7410
    dwTextureFilterCaps: DWORD;
7411
    dwTextureBlendCaps: DWORD;
7412
    dwTextureAddressCaps: DWORD;
4 daniel-mar 7413
    dwStippleWidth: DWORD;             (* maximum width and height of *)
7414
    dwStippleHeight: DWORD;            (* of supported stipple (up to 32x32) *)
1 daniel-mar 7415
  end;
7416
 
4 daniel-mar 7417
const
7418
(* TD3DPrimCaps dwMiscCaps *)
1 daniel-mar 7419
 
7420
  D3DPMISCCAPS_MASKPLANES         = $00000001;
7421
  D3DPMISCCAPS_MASKZ              = $00000002;
7422
  D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
7423
  D3DPMISCCAPS_CONFORMANT         = $00000008;
7424
  D3DPMISCCAPS_CULLNONE           = $00000010;
7425
  D3DPMISCCAPS_CULLCW             = $00000020;
7426
  D3DPMISCCAPS_CULLCCW            = $00000040;
7427
 
4 daniel-mar 7428
(* TD3DPrimCaps dwRasterCaps *)
1 daniel-mar 7429
 
4 daniel-mar 7430
  D3DPRASTERCAPS_DITHER           = $00000001;
7431
  D3DPRASTERCAPS_ROP2             = $00000002;
7432
  D3DPRASTERCAPS_XOR              = $00000004;
7433
  D3DPRASTERCAPS_PAT              = $00000008;
7434
  D3DPRASTERCAPS_ZTEST            = $00000010;
7435
  D3DPRASTERCAPS_SUBPIXEL         = $00000020;
7436
  D3DPRASTERCAPS_SUBPIXELX        = $00000040;
7437
  D3DPRASTERCAPS_FOGVERTEX        = $00000080;
7438
  D3DPRASTERCAPS_FOGTABLE         = $00000100;
7439
  D3DPRASTERCAPS_STIPPLE          = $00000200;
7440
  D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT   = $00000400;
7441
  D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = $00000800;
7442
  D3DPRASTERCAPS_ANTIALIASEDGES           = $00001000;
7443
  D3DPRASTERCAPS_MIPMAPLODBIAS            = $00002000;
7444
  D3DPRASTERCAPS_ZBIAS                    = $00004000;
7445
  D3DPRASTERCAPS_ZBUFFERLESSHSR           = $00008000;
7446
  D3DPRASTERCAPS_FOGRANGE                 = $00010000;
7447
  D3DPRASTERCAPS_ANISOTROPY               = $00020000;
7448
  D3DPRASTERCAPS_WBUFFER                      = $00040000;
7449
  D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT   = $00080000;
7450
  D3DPRASTERCAPS_WFOG                         = $00100000;
7451
  D3DPRASTERCAPS_ZFOG                         = $00200000;
1 daniel-mar 7452
 
4 daniel-mar 7453
(* TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps *)
1 daniel-mar 7454
 
4 daniel-mar 7455
const
1 daniel-mar 7456
  D3DPCMPCAPS_NEVER               = $00000001;
7457
  D3DPCMPCAPS_LESS                = $00000002;
7458
  D3DPCMPCAPS_EQUAL               = $00000004;
7459
  D3DPCMPCAPS_LESSEQUAL           = $00000008;
7460
  D3DPCMPCAPS_GREATER             = $00000010;
7461
  D3DPCMPCAPS_NOTEQUAL            = $00000020;
7462
  D3DPCMPCAPS_GREATEREQUAL        = $00000040;
7463
  D3DPCMPCAPS_ALWAYS              = $00000080;
7464
 
4 daniel-mar 7465
(* TD3DPrimCaps dwSourceBlendCaps, dwDestBlendCaps *)
1 daniel-mar 7466
 
7467
  D3DPBLENDCAPS_ZERO              = $00000001;
7468
  D3DPBLENDCAPS_ONE               = $00000002;
7469
  D3DPBLENDCAPS_SRCCOLOR          = $00000004;
7470
  D3DPBLENDCAPS_INVSRCCOLOR       = $00000008;
7471
  D3DPBLENDCAPS_SRCALPHA          = $00000010;
7472
  D3DPBLENDCAPS_INVSRCALPHA       = $00000020;
7473
  D3DPBLENDCAPS_DESTALPHA         = $00000040;
7474
  D3DPBLENDCAPS_INVDESTALPHA      = $00000080;
7475
  D3DPBLENDCAPS_DESTCOLOR         = $00000100;
7476
  D3DPBLENDCAPS_INVDESTCOLOR      = $00000200;
7477
  D3DPBLENDCAPS_SRCALPHASAT       = $00000400;
7478
  D3DPBLENDCAPS_BOTHSRCALPHA      = $00000800;
7479
  D3DPBLENDCAPS_BOTHINVSRCALPHA   = $00001000;
7480
 
4 daniel-mar 7481
(* TD3DPrimCaps dwShadeCaps *)
1 daniel-mar 7482
 
7483
  D3DPSHADECAPS_COLORFLATMONO             = $00000001;
7484
  D3DPSHADECAPS_COLORFLATRGB              = $00000002;
7485
  D3DPSHADECAPS_COLORGOURAUDMONO          = $00000004;
7486
  D3DPSHADECAPS_COLORGOURAUDRGB           = $00000008;
7487
  D3DPSHADECAPS_COLORPHONGMONO            = $00000010;
7488
  D3DPSHADECAPS_COLORPHONGRGB             = $00000020;
7489
 
7490
  D3DPSHADECAPS_SPECULARFLATMONO          = $00000040;
7491
  D3DPSHADECAPS_SPECULARFLATRGB           = $00000080;
7492
  D3DPSHADECAPS_SPECULARGOURAUDMONO       = $00000100;
7493
  D3DPSHADECAPS_SPECULARGOURAUDRGB        = $00000200;
7494
  D3DPSHADECAPS_SPECULARPHONGMONO         = $00000400;
7495
  D3DPSHADECAPS_SPECULARPHONGRGB          = $00000800;
7496
 
7497
  D3DPSHADECAPS_ALPHAFLATBLEND            = $00001000;
7498
  D3DPSHADECAPS_ALPHAFLATSTIPPLED         = $00002000;
7499
  D3DPSHADECAPS_ALPHAGOURAUDBLEND         = $00004000;
7500
  D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED      = $00008000;
7501
  D3DPSHADECAPS_ALPHAPHONGBLEND           = $00010000;
7502
  D3DPSHADECAPS_ALPHAPHONGSTIPPLED        = $00020000;
7503
 
7504
  D3DPSHADECAPS_FOGFLAT                   = $00040000;
7505
  D3DPSHADECAPS_FOGGOURAUD                = $00080000;
7506
  D3DPSHADECAPS_FOGPHONG                  = $00100000;
7507
 
4 daniel-mar 7508
(* TD3DPrimCaps dwTextureCaps *)
1 daniel-mar 7509
 
4 daniel-mar 7510
(*
7511
 * Perspective-correct texturing is supported
7512
 *)
7513
  D3DPTEXTURECAPS_PERSPECTIVE     = $00000001;
7514
 
7515
(*
7516
 * Power-of-2 texture dimensions are required
7517
 *)
7518
  D3DPTEXTURECAPS_POW2            = $00000002;
7519
 
7520
(*
7521
 * Alpha in texture pixels is supported
7522
 *)
7523
  D3DPTEXTURECAPS_ALPHA           = $00000004;
7524
 
7525
(*
7526
 * Color-keyed textures are supported
7527
 *)
7528
  D3DPTEXTURECAPS_TRANSPARENCY    = $00000008;
7529
 
7530
(*
7531
 * obsolete, see D3DPTADDRESSCAPS_BORDER
7532
 *)
7533
  D3DPTEXTURECAPS_BORDER          = $00000010;
7534
 
7535
(*
7536
 * Only square textures are supported
7537
 *)
7538
  D3DPTEXTURECAPS_SQUAREONLY      = $00000020;
7539
 
7540
(*
7541
 * Texture indices are not scaled by the texture size prior
7542
 * to interpolation.
7543
 *)
1 daniel-mar 7544
  D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040;
7545
 
4 daniel-mar 7546
(*
7547
 * Device can draw alpha from texture palettes
7548
 *)
7549
  D3DPTEXTURECAPS_ALPHAPALETTE    = $00000080;
1 daniel-mar 7550
 
4 daniel-mar 7551
(*
7552
 * Device can use non-POW2 textures if:
7553
 *  1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
7554
 *  2) D3DRS_WRAP(N) is zero for this texture's coordinates
7555
 *  3) mip mapping is not enabled (use magnification filter only)
7556
 *)
7557
  D3DPTEXTURECAPS_NONPOW2CONDITIONAL  = $00000100;
7558
 
7559
// 0x00000200L unused
7560
 
7561
(*
7562
 * Device can divide transformed texture coordinates by the
7563
 * COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
7564
 *)
7565
  D3DPTEXTURECAPS_PROJECTED  = $00000400;
7566
 
7567
(*
7568
 * Device can do cubemap textures
7569
 *)
7570
  D3DPTEXTURECAPS_CUBEMAP           = $00000800;
7571
 
7572
  D3DPTEXTURECAPS_COLORKEYBLEND     = $00001000;
7573
 
7574
 
7575
(* TD3DPrimCaps dwTextureFilterCaps *)
7576
 
7577
  D3DPTFILTERCAPS_NEAREST         = $00000001;
7578
  D3DPTFILTERCAPS_LINEAR          = $00000002;
7579
  D3DPTFILTERCAPS_MIPNEAREST      = $00000004;
7580
  D3DPTFILTERCAPS_MIPLINEAR       = $00000008;
1 daniel-mar 7581
  D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010;
4 daniel-mar 7582
  D3DPTFILTERCAPS_LINEARMIPLINEAR = $00000020;
1 daniel-mar 7583
 
4 daniel-mar 7584
(* Device3 Min Filter *)
1 daniel-mar 7585
  D3DPTFILTERCAPS_MINFPOINT       = $00000100;
7586
  D3DPTFILTERCAPS_MINFLINEAR      = $00000200;
7587
  D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400;
7588
 
4 daniel-mar 7589
(* Device3 Mip Filter *)
1 daniel-mar 7590
  D3DPTFILTERCAPS_MIPFPOINT       = $00010000;
7591
  D3DPTFILTERCAPS_MIPFLINEAR      = $00020000;
7592
 
4 daniel-mar 7593
(* Device3 Mag Filter *)
1 daniel-mar 7594
  D3DPTFILTERCAPS_MAGFPOINT         = $01000000;
7595
  D3DPTFILTERCAPS_MAGFLINEAR        = $02000000;
7596
  D3DPTFILTERCAPS_MAGFANISOTROPIC   = $04000000;
7597
  D3DPTFILTERCAPS_MAGFAFLATCUBIC    = $08000000;
7598
  D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000;
7599
 
4 daniel-mar 7600
(* TD3DPrimCaps dwTextureBlendCaps *)
1 daniel-mar 7601
 
7602
  D3DPTBLENDCAPS_DECAL            = $00000001;
7603
  D3DPTBLENDCAPS_MODULATE         = $00000002;
7604
  D3DPTBLENDCAPS_DECALALPHA       = $00000004;
7605
  D3DPTBLENDCAPS_MODULATEALPHA    = $00000008;
7606
  D3DPTBLENDCAPS_DECALMASK        = $00000010;
7607
  D3DPTBLENDCAPS_MODULATEMASK     = $00000020;
7608
  D3DPTBLENDCAPS_COPY             = $00000040;
4 daniel-mar 7609
  D3DPTBLENDCAPS_ADD                      = $00000080;
1 daniel-mar 7610
 
4 daniel-mar 7611
(* TD3DPrimCaps dwTextureAddressCaps *)
1 daniel-mar 7612
  D3DPTADDRESSCAPS_WRAP           = $00000001;
7613
  D3DPTADDRESSCAPS_MIRROR         = $00000002;
7614
  D3DPTADDRESSCAPS_CLAMP          = $00000004;
7615
  D3DPTADDRESSCAPS_BORDER         = $00000008;
7616
  D3DPTADDRESSCAPS_INDEPENDENTUV  = $00000010;
7617
 
4 daniel-mar 7618
(* D3DDEVICEDESC dwStencilCaps *)
1 daniel-mar 7619
 
4 daniel-mar 7620
  D3DSTENCILCAPS_KEEP     = $00000001;
7621
  D3DSTENCILCAPS_ZERO     = $00000002;
7622
  D3DSTENCILCAPS_REPLACE  = $00000004;
7623
  D3DSTENCILCAPS_INCRSAT  = $00000008;
7624
  D3DSTENCILCAPS_DECRSAT  = $00000010;
7625
  D3DSTENCILCAPS_INVERT   = $00000020;
7626
  D3DSTENCILCAPS_INCR     = $00000040;
7627
  D3DSTENCILCAPS_DECR     = $00000080;
1 daniel-mar 7628
 
4 daniel-mar 7629
(* D3DDEVICEDESC dwTextureOpCaps *)
1 daniel-mar 7630
 
7631
  D3DTEXOPCAPS_DISABLE                    = $00000001;
7632
  D3DTEXOPCAPS_SELECTARG1                 = $00000002;
7633
  D3DTEXOPCAPS_SELECTARG2                 = $00000004;
7634
  D3DTEXOPCAPS_MODULATE                   = $00000008;
7635
  D3DTEXOPCAPS_MODULATE2X                 = $00000010;
7636
  D3DTEXOPCAPS_MODULATE4X                 = $00000020;
7637
  D3DTEXOPCAPS_ADD                        = $00000040;
7638
  D3DTEXOPCAPS_ADDSIGNED                  = $00000080;
7639
  D3DTEXOPCAPS_ADDSIGNED2X                = $00000100;
7640
  D3DTEXOPCAPS_SUBTRACT                   = $00000200;
7641
  D3DTEXOPCAPS_ADDSMOOTH                  = $00000400;
7642
  D3DTEXOPCAPS_BLENDDIFFUSEALPHA          = $00000800;
7643
  D3DTEXOPCAPS_BLENDTEXTUREALPHA          = $00001000;
7644
  D3DTEXOPCAPS_BLENDFACTORALPHA           = $00002000;
7645
  D3DTEXOPCAPS_BLENDTEXTUREALPHAPM        = $00004000;
7646
  D3DTEXOPCAPS_BLENDCURRENTALPHA          = $00008000;
7647
  D3DTEXOPCAPS_PREMODULATE                = $00010000;
7648
  D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR     = $00020000;
7649
  D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA     = $00040000;
7650
  D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR  = $00080000;
7651
  D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA  = $00100000;
7652
  D3DTEXOPCAPS_BUMPENVMAP                 = $00200000;
7653
  D3DTEXOPCAPS_BUMPENVMAPLUMINANCE        = $00400000;
7654
  D3DTEXOPCAPS_DOTPRODUCT3                = $00800000;
7655
 
4 daniel-mar 7656
(* D3DDEVICEDESC dwFVFCaps flags *)
1 daniel-mar 7657
 
4 daniel-mar 7658
  D3DFVFCAPS_TEXCOORDCOUNTMASK    = $0000ffff; (* mask for texture coordinate count field *)
7659
  D3DFVFCAPS_DONOTSTRIPELEMENTS   = $00080000; (* Device prefers that vertex elements not be stripped *)
1 daniel-mar 7660
 
4 daniel-mar 7661
(*
7662
 * Description for a device.
7663
 * This is used to describe a device that is to be created or to query
7664
 * the current device.
7665
 *)
1 daniel-mar 7666
 
7667
type
4 daniel-mar 7668
  PD3DDeviceDesc = ^TD3DDeviceDesc;
7669
  TD3DDeviceDesc = packed record
7670
    dwSize: DWORD;                       (* Size of TD3DDeviceDesc structure *)
7671
    dwFlags: DWORD;                      (* Indicates which fields have valid data *)
7672
    dcmColorModel: TD3DColorModel;        (* Color model of device *)
7673
    dwDevCaps: DWORD;                    (* Capabilities of device *)
7674
    dtcTransformCaps: TD3DTransformCaps;  (* Capabilities of transform *)
7675
    bClipping: BOOL;                     (* Device can do 3D clipping *)
7676
    dlcLightingCaps: TD3DLightingCaps;    (* Capabilities of lighting *)
1 daniel-mar 7677
    dpcLineCaps: TD3DPrimCaps;
7678
    dpcTriCaps: TD3DPrimCaps;
4 daniel-mar 7679
    dwDeviceRenderBitDepth: DWORD;       (* One of DDBB_8, 16, etc.. *)
7680
    dwDeviceZBufferBitDepth: DWORD;      (* One of DDBD_16, 32, etc.. *)
7681
    dwMaxBufferSize: DWORD;              (* Maximum execute buffer size *)
7682
    dwMaxVertexCount: DWORD;             (* Maximum vertex count *)
7683
    // *** New fields for DX5 *** //
1 daniel-mar 7684
 
7685
    // Width and height caps are 0 for legacy HALs.
7686
    dwMinTextureWidth, dwMinTextureHeight  : DWORD;
7687
    dwMaxTextureWidth, dwMaxTextureHeight  : DWORD;
7688
    dwMinStippleWidth, dwMaxStippleWidth   : DWORD;
7689
    dwMinStippleHeight, dwMaxStippleHeight : DWORD;
7690
 
7691
    // New fields for DX6
4 daniel-mar 7692
    dwMaxTextureRepeat : DWORD;
7693
    dwMaxTextureAspectRatio : DWORD;
7694
    dwMaxAnisotropy : DWORD;
1 daniel-mar 7695
 
7696
    // Guard band that the rasterizer can accommodate
7697
    // Screen-space vertices inside this space but outside the viewport
7698
    // will get clipped properly.
4 daniel-mar 7699
    dvGuardBandLeft : TD3DValue;
7700
    dvGuardBandTop : TD3DValue;
7701
    dvGuardBandRight : TD3DValue;
7702
    dvGuardBandBottom : TD3DValue;
1 daniel-mar 7703
 
4 daniel-mar 7704
    dvExtentsAdjust : TD3DValue;
7705
    dwStencilCaps : DWORD;
1 daniel-mar 7706
 
4 daniel-mar 7707
    dwFVFCaps : DWORD;  (* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware *)
7708
    dwTextureOpCaps : DWORD;
7709
    wMaxTextureBlendStages : WORD;
7710
    wMaxSimultaneousTextures : WORD;
7711
  end;
1 daniel-mar 7712
 
7713
  PD3DDeviceDesc7 = ^TD3DDeviceDesc7;
4 daniel-mar 7714
  TD3DDeviceDesc7 = packed record
7715
    dwDevCaps:               DWORD;             (* Capabilities of device *)
7716
    dpcLineCaps:             TD3DPrimCaps;
7717
    dpcTriCaps:              TD3DPrimCaps;
7718
    dwDeviceRenderBitDepth:  DWORD;             (* One of DDBB_8, 16, etc.. *)
7719
    dwDeviceZBufferBitDepth: DWORD;             (* One of DDBD_16, 32, etc.. *)
1 daniel-mar 7720
 
4 daniel-mar 7721
    dwMinTextureWidth, dwMinTextureHeight: DWORD;
7722
    dwMaxTextureWidth, dwMaxTextureHeight: DWORD;
1 daniel-mar 7723
 
4 daniel-mar 7724
    dwMaxTextureRepeat:                    DWORD;
7725
    dwMaxTextureAspectRatio:               DWORD;
7726
    dwMaxAnisotropy:                       DWORD;
1 daniel-mar 7727
 
4 daniel-mar 7728
    dvGuardBandLeft:                       TD3DValue;
7729
    dvGuardBandTop:                        TD3DValue;
7730
    dvGuardBandRight:                      TD3DValue;
7731
    dvGuardBandBottom:                     TD3DValue;
1 daniel-mar 7732
 
4 daniel-mar 7733
    dvExtentsAdjust:                       TD3DValue;
7734
    dwStencilCaps:                         DWORD;
1 daniel-mar 7735
 
4 daniel-mar 7736
    dwFVFCaps:                             DWORD;
7737
    dwTextureOpCaps:                       DWORD;
7738
    wMaxTextureBlendStages:                WORD;
7739
    wMaxSimultaneousTextures:              WORD;
1 daniel-mar 7740
 
4 daniel-mar 7741
    dwMaxActiveLights:                     DWORD;
7742
    dvMaxVertexW:                          TD3DValue;
7743
    deviceGUID:                            TGUID;
1 daniel-mar 7744
 
4 daniel-mar 7745
    wMaxUserClipPlanes:                    WORD;
7746
    wMaxVertexBlendMatrices:               WORD;
1 daniel-mar 7747
 
4 daniel-mar 7748
    dwVertexProcessingCaps:                DWORD;
1 daniel-mar 7749
 
4 daniel-mar 7750
    dwReserved1:                           DWORD;
7751
    dwReserved2:                           DWORD;
7752
    dwReserved3:                           DWORD;
7753
    dwReserved4:                           DWORD;
1 daniel-mar 7754
  end;
7755
 
4 daniel-mar 7756
const
7757
  D3DDEVICEDESCSIZE = sizeof(TD3DDeviceDesc);
7758
  D3DDEVICEDESC7SIZE = sizeof(TD3DDeviceDesc7);
1 daniel-mar 7759
 
7760
type
4 daniel-mar 7761
  TD3DEnumDevicesCallbackA = function (lpGuid: PGUID; // nil for the default device
7762
      lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
7763
      var lpD3DHWDeviceDesc: TD3DDeviceDesc;
7764
      var lpD3DHELDeviceDesc: TD3DDeviceDesc;
7765
      lpContext : pointer) : HResult; stdcall;
7766
  TD3DEnumDevicesCallback = TD3DEnumDevicesCallbackA;
1 daniel-mar 7767
 
4 daniel-mar 7768
  TD3DEnumDevicesCallback7A = function (
7769
      lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
7770
      const lpD3DDeviceDesc: TD3DDeviceDesc7; lpContext: Pointer) : HResult; stdcall;
7771
  TD3DEnumDevicesCallback7 = TD3DEnumDevicesCallback7A;
1 daniel-mar 7772
 
4 daniel-mar 7773
(* TD3DDeviceDesc dwFlags indicating valid fields *)
1 daniel-mar 7774
 
7775
const
4 daniel-mar 7776
  D3DDD_COLORMODEL            = $00000001; (* dcmColorModel is valid *)
7777
  D3DDD_DEVCAPS               = $00000002; (* dwDevCaps is valid *)
7778
  D3DDD_TRANSFORMCAPS         = $00000004; (* dtcTransformCaps is valid *)
7779
  D3DDD_LIGHTINGCAPS          = $00000008; (* dlcLightingCaps is valid *)
7780
  D3DDD_BCLIPPING             = $00000010; (* bClipping is valid *)
7781
  D3DDD_LINECAPS              = $00000020; (* dpcLineCaps is valid *)
7782
  D3DDD_TRICAPS               = $00000040; (* dpcTriCaps is valid *)
7783
  D3DDD_DEVICERENDERBITDEPTH  = $00000080; (* dwDeviceRenderBitDepth is valid *)
7784
  D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; (* dwDeviceZBufferBitDepth is valid *)
7785
  D3DDD_MAXBUFFERSIZE         = $00000200; (* dwMaxBufferSize is valid *)
7786
  D3DDD_MAXVERTEXCOUNT        = $00000400; (* dwMaxVertexCount is valid *)
1 daniel-mar 7787
 
4 daniel-mar 7788
(* TD3DDeviceDesc dwDevCaps flags *)
1 daniel-mar 7789
 
4 daniel-mar 7790
  D3DDEVCAPS_FLOATTLVERTEX        = $00000001; (* Device accepts floating point *)
7791
                                                    (* for post-transform vertex data *)
7792
  D3DDEVCAPS_SORTINCREASINGZ      = $00000002; (* Device needs data sorted for increasing Z*)
7793
  D3DDEVCAPS_SORTDECREASINGZ      = $00000004; (* Device needs data sorted for decreasing Z*)
7794
  D3DDEVCAPS_SORTEXACT            = $00000008; (* Device needs data sorted exactly *)
1 daniel-mar 7795
 
4 daniel-mar 7796
  D3DDEVCAPS_EXECUTESYSTEMMEMORY  = $00000010; (* Device can use execute buffers from system memory *)
7797
  D3DDEVCAPS_EXECUTEVIDEOMEMORY   = $00000020; (* Device can use execute buffers from video memory *)
7798
  D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; (* Device can use TL buffers from system memory *)
7799
  D3DDEVCAPS_TLVERTEXVIDEOMEMORY  = $00000080; (* Device can use TL buffers from video memory *)
7800
  D3DDEVCAPS_TEXTURESYSTEMMEMORY  = $00000100; (* Device can texture from system memory *)
7801
  D3DDEVCAPS_TEXTUREVIDEOMEMORY   = $00000200; (* Device can texture from device memory *)
7802
  D3DDEVCAPS_DRAWPRIMTLVERTEX     = $00000400; (* Device can draw TLVERTEX primitives *)
7803
  D3DDEVCAPS_CANRENDERAFTERFLIP   = $00000800; (* Device can render without waiting for flip to complete *)
7804
  D3DDEVCAPS_TEXTURENONLOCALVIDMEM   = $00001000; (* Device can texture from nonlocal video memory *)
7805
  D3DDEVCAPS_DRAWPRIMITIVES2         = $00002000; (* Device can support DrawPrimitives2 *)
7806
  D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; (* Device is texturing from separate memory pools *)
7807
  D3DDEVCAPS_DRAWPRIMITIVES2EX       = $00008000; (* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*)
7808
  D3DDEVCAPS_HWTRANSFORMANDLIGHT     = $00010000; (* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also *)
7809
  D3DDEVCAPS_CANBLTSYSTONONLOCAL     = $00020000; (* Device supports a Tex Blt from system memory to non-local vidmem *)
7810
  D3DDEVCAPS_HWRASTERIZATION         = $00080000; (* Device has HW acceleration for rasterization *)
1 daniel-mar 7811
 
4 daniel-mar 7812
(*
7813
 * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
7814
 *)
1 daniel-mar 7815
 
4 daniel-mar 7816
(* device can do texgen *)
7817
  D3DVTXPCAPS_TEXGEN              = $00000001;
7818
(* device can do IDirect3DDevice7 colormaterialsource ops *)
7819
  D3DVTXPCAPS_MATERIALSOURCE7     = $00000002;
7820
(* device can do vertex fog *)
7821
  D3DVTXPCAPS_VERTEXFOG           = $00000004;
7822
(* device can do directional lights *)
7823
  D3DVTXPCAPS_DIRECTIONALLIGHTS   = $00000008;
7824
(* device can do positional lights (includes point and spot) *)
7825
  D3DVTXPCAPS_POSITIONALLIGHTS    = $00000010;
7826
(* device can do local viewer *)
7827
  D3DVTXPCAPS_LOCALVIEWER         = $00000020;
1 daniel-mar 7828
 
4 daniel-mar 7829
  D3DFDS_COLORMODEL        = $00000001; (* Match color model *)
7830
  D3DFDS_GUID              = $00000002; (* Match guid *)
7831
  D3DFDS_HARDWARE          = $00000004; (* Match hardware/software *)
7832
  D3DFDS_TRIANGLES         = $00000008; (* Match in triCaps *)
7833
  D3DFDS_LINES             = $00000010; (* Match in lineCaps  *)
7834
  D3DFDS_MISCCAPS          = $00000020; (* Match primCaps.dwMiscCaps *)
7835
  D3DFDS_RASTERCAPS        = $00000040; (* Match primCaps.dwRasterCaps *)
7836
  D3DFDS_ZCMPCAPS          = $00000080; (* Match primCaps.dwZCmpCaps *)
7837
  D3DFDS_ALPHACMPCAPS      = $00000100; (* Match primCaps.dwAlphaCmpCaps *)
7838
  D3DFDS_SRCBLENDCAPS      = $00000200; (* Match primCaps.dwSourceBlendCaps *)
7839
  D3DFDS_DSTBLENDCAPS      = $00000400; (* Match primCaps.dwDestBlendCaps *)
7840
  D3DFDS_SHADECAPS         = $00000800; (* Match primCaps.dwShadeCaps *)
7841
  D3DFDS_TEXTURECAPS       = $00001000; (* Match primCaps.dwTextureCaps *)
7842
  D3DFDS_TEXTUREFILTERCAPS = $00002000; (* Match primCaps.dwTextureFilterCaps *)
7843
  D3DFDS_TEXTUREBLENDCAPS  = $00004000; (* Match primCaps.dwTextureBlendCaps *)
7844
  D3DFDS_TEXTUREADDRESSCAPS  = $00008000; (* Match primCaps.dwTextureBlendCaps *)
1 daniel-mar 7845
 
4 daniel-mar 7846
(*
7847
 * FindDevice arguments
7848
 *)
1 daniel-mar 7849
type
7850
  PD3DFindDeviceSearch = ^TD3DFindDeviceSearch;
4 daniel-mar 7851
  TD3DFindDeviceSearch = packed record
1 daniel-mar 7852
    dwSize: DWORD;
7853
    dwFlags: DWORD;
7854
    bHardware: BOOL;
7855
    dcmColorModel: TD3DColorModel;
7856
    guid: TGUID;
7857
    dwCaps: DWORD;
7858
    dpcPrimCaps: TD3DPrimCaps;
7859
  end;
7860
 
7861
  PD3DFindDeviceResult = ^TD3DFindDeviceResult;
4 daniel-mar 7862
  TD3DFindDeviceResult = packed record
1 daniel-mar 7863
    dwSize: DWORD;
4 daniel-mar 7864
    guid: TGUID;               (* guid which matched *)
7865
    ddHwDesc: TD3DDeviceDesc;   (* hardware TD3DDeviceDesc *)
7866
    ddSwDesc: TD3DDeviceDesc;   (* software TD3DDeviceDesc *)
1 daniel-mar 7867
  end;
7868
 
4 daniel-mar 7869
(*
7870
 * Description of execute buffer.
7871
 *)
1 daniel-mar 7872
  PD3DExecuteBufferDesc = ^TD3DExecuteBufferDesc;
4 daniel-mar 7873
  TD3DExecuteBufferDesc = packed record
7874
    dwSize: DWORD;         (* size of this structure *)
7875
    dwFlags: DWORD;        (* flags indicating which fields are valid *)
7876
    dwCaps: DWORD;         (* capabilities of execute buffer *)
7877
    dwBufferSize: DWORD;   (* size of execute buffer data *)
7878
    lpData: Pointer;       (* pointer to actual data *)
1 daniel-mar 7879
  end;
7880
 
4 daniel-mar 7881
(* D3DEXECUTEBUFFER dwFlags indicating valid fields *)
1 daniel-mar 7882
 
7883
const
4 daniel-mar 7884
  D3DDEB_BUFSIZE          = $00000001;     (* buffer size valid *)
7885
  D3DDEB_CAPS             = $00000002;     (* caps valid *)
7886
  D3DDEB_LPDATA           = $00000004;     (* lpData valid *)
1 daniel-mar 7887
 
4 daniel-mar 7888
(* D3DEXECUTEBUFFER dwCaps *)
1 daniel-mar 7889
 
4 daniel-mar 7890
  D3DDEBCAPS_SYSTEMMEMORY = $00000001;     (* buffer in system memory *)
7891
  D3DDEBCAPS_VIDEOMEMORY  = $00000002;     (* buffer in device memory *)
7892
  D3DDEBCAPS_MEM          = (D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY);
1 daniel-mar 7893
 
7894
type
7895
  PD3DDevInfo_TextureManager = ^TD3DDevInfo_TextureManager;
4 daniel-mar 7896
  TD3DDevInfo_TextureManager = packed record
7897
    bThrashing:              BOOL;       (* indicates if thrashing *)
7898
    dwApproxBytesDownloaded: DWORD;      (* Approximate number of bytes downloaded by texture manager *)
7899
    dwNumEvicts:             DWORD;      (* number of textures evicted *)
7900
    dwNumVidCreates:         DWORD;      (* number of textures created in video memory *)
7901
    dwNumTexturesUsed:       DWORD;      (* number of textures used *)
7902
    dwNumUsedTexInVid:       DWORD;      (* number of used textures present in video memory *)
7903
    dwWorkingSet:            DWORD;      (* number of textures in video memory *)
7904
    dwWorkingSetBytes:       DWORD;      (* number of bytes in video memory *)
7905
    dwTotalManaged:          DWORD;      (* total number of managed textures *)
7906
    dwTotalBytes:            DWORD;      (* total number of bytes of managed textures *)
7907
    dwLastPri:               DWORD;      (* priority of last texture evicted *)
1 daniel-mar 7908
  end;
7909
 
7910
  PD3DDevInfo_Texturing = ^TD3DDevInfo_Texturing;
4 daniel-mar 7911
  TD3DDevInfo_Texturing = packed record
7912
    dwNumLoads:          DWORD;          (* counts Load() API calls *)
7913
    dwApproxBytesLoaded: DWORD;          (* Approximate number bytes loaded via Load() *)
7914
    dwNumPreLoads:       DWORD;          (* counts PreLoad() API calls *)
7915
    dwNumSet:            DWORD;          (* counts SetTexture() API calls *)
7916
    dwNumCreates:        DWORD;          (* counts texture creates *)
7917
    dwNumDestroys:       DWORD;          (* counts texture destroys *)
7918
    dwNumSetPriorities:  DWORD;          (* counts SetPriority() API calls *)
7919
    dwNumSetLODs:        DWORD;          (* counts SetLOD() API calls *)
7920
    dwNumLocks:          DWORD;          (* counts number of texture locks *)
7921
    dwNumGetDCs:         DWORD;          (* counts number of GetDCs to textures *)
1 daniel-mar 7922
  end;
7923
 
7924
(*==========================================================================;
7925
 *
7926
 *
4 daniel-mar 7927
 *  File:   d3d.h
1 daniel-mar 7928
 *  Content:    Direct3D include file
7929
 *
4 daniel-mar 7930
 ****************************************************************************)
1 daniel-mar 7931
 
4 daniel-mar 7932
function D3DErrorString(Value: HResult) : string;
1 daniel-mar 7933
 
4 daniel-mar 7934
(*
7935
 * Interface IID's
7936
 *)
7937
 
1 daniel-mar 7938
const
4 daniel-mar 7939
(*
7940
 * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer
7941
 *)
7942
  IID_IDirect3DRampDevice: TGUID =
7943
      (D1:$F2086B20;D2:$259F;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
7944
  IID_IDirect3DRGBDevice: TGUID =
7945
      (D1:$A4665C60;D2:$2673;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
7946
  IID_IDirect3DHALDevice: TGUID =
7947
      (D1:$84E63dE0;D2:$46AA;D3:$11CF;D4:($81,$6F,$00,$00,$C0,$20,$15,$6E));
7948
  IID_IDirect3DMMXDevice: TGUID =
7949
      (D1:$881949a1;D2:$d6f3;D3:$11d0;D4:($89,$ab,$00,$a0,$c9,$05,$41,$29));
1 daniel-mar 7950
 
4 daniel-mar 7951
  IID_IDirect3DRefDevice: TGUID =
7952
      (D1:$50936643;D2:$13e9;D3:$11d1;D4:($89,$aa,$00,$a0,$c9,$05,$41,$29));
7953
  IID_IDirect3DNullDevice: TGUID =
7954
      (D1:$8767df22;D2:$bacc;D3:$11d1;D4:($89,$69,$00,$a0,$c9,$06,$29,$a8));
1 daniel-mar 7955
 
4 daniel-mar 7956
  IID_IDirect3DTnLHalDevice: TGUID = '{f5049e78-4861-11d2-a407-00a0c90629a8}';
1 daniel-mar 7957
 
7958
type
7959
  IDirect3D = interface;
7960
  IDirect3D2 = interface;
7961
  IDirect3D3 = interface;
7962
  IDirect3D7 = interface;
7963
  IDirect3DDevice = interface;
7964
  IDirect3DDevice2 = interface;
7965
  IDirect3DDevice3 = interface;
7966
  IDirect3DDevice7 = interface;
7967
  IDirect3DExecuteBuffer = interface;
7968
  IDirect3DLight = interface;
7969
  IDirect3DMaterial = interface;
7970
  IDirect3DMaterial2 = interface;
7971
  IDirect3DMaterial3 = interface;
7972
  IDirect3DTexture = interface;
7973
  IDirect3DTexture2 = interface;
7974
  IDirect3DViewport = interface;
7975
  IDirect3DViewport2 = interface;
7976
  IDirect3DViewport3 = interface;
7977
  IDirect3DVertexBuffer = interface;
7978
  IDirect3DVertexBuffer7 = interface;
7979
 
4 daniel-mar 7980
(*
7981
 * Direct3D interfaces
7982
 *)
7983
 
7984
  IDirect3D = interface (IUnknown)
1 daniel-mar 7985
    ['{3BBA0080-2421-11CF-A31A-00AA00B93356}']
4 daniel-mar 7986
    (*** IDirect3D methods ***)
7987
    function Initialize (lpREFIID: {REFIID} PGUID) : HResult; stdcall;
7988
    function EnumDevices (lpEnumDevicesCallback: TD3DEnumDevicesCallback;
7989
        lpUserArg: Pointer) : HResult; stdcall;
7990
    function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
7991
        pUnkOuter: IUnknown) : HResult; stdcall;
7992
    function CreateMaterial (var lplpDirect3DMaterial: IDirect3DMaterial;
7993
        pUnkOuter: IUnknown) : HResult; stdcall;
7994
    function CreateViewport (var lplpD3DViewport: IDirect3DViewport;
7995
        pUnkOuter: IUnknown) : HResult; stdcall;
7996
    function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
7997
        var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
1 daniel-mar 7998
  end;
7999
 
4 daniel-mar 8000
  IDirect3D2 = interface (IUnknown)
8001
    ['{6aae1ec1-662a-11d0-889d-00aa00bbb76a}']
8002
    (*** IDirect3D2 methods ***)
1 daniel-mar 8003
    function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
4 daniel-mar 8004
        lpUserArg: pointer) : HResult; stdcall;
8005
    function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
8006
        pUnkOuter: IUnknown) : HResult; stdcall;
8007
    function CreateMaterial (var lplpDirect3DMaterial2: IDirect3DMaterial2;
8008
        pUnkOuter: IUnknown) : HResult; stdcall;
8009
    function CreateViewport (var lplpD3DViewport2: IDirect3DViewport2;
8010
        pUnkOuter: IUnknown) : HResult; stdcall;
8011
    function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
8012
        var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
8013
    function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface;
8014
        out lplpD3DDevice2: IDirect3DDevice2) : HResult; stdcall;
1 daniel-mar 8015
  end;
8016
 
4 daniel-mar 8017
  IDirect3D3 = interface (IUnknown)
8018
    ['{bb223240-e72b-11d0-a9b4-00aa00c0993e}']
8019
    (*** IDirect3D3 methods ***)
1 daniel-mar 8020
    function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
4 daniel-mar 8021
        lpUserArg: pointer) : HResult; stdcall;
8022
    function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
8023
        pUnkOuter: IUnknown) : HResult; stdcall;
8024
    function CreateMaterial (var lplpDirect3DMaterial3: IDirect3DMaterial3;
8025
        pUnkOuter: IUnknown) : HResult; stdcall;
8026
    function CreateViewport (var lplpD3DViewport3: IDirect3DViewport3;
8027
        pUnkOuter: IUnknown) : HResult; stdcall;
8028
    function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
8029
        var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
8030
    function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface4;
8031
        out lplpD3DDevice: IDirect3DDevice3; pUnkOuter: IUnknown) : HResult; stdcall;
8032
    function CreateVertexBuffer (var lpVBDesc: TD3DVertexBufferDesc;
8033
        var lpD3DVertexBuffer: IDirect3DVertexBuffer;
8034
        dwFlags: DWORD; pUnkOuter: IUnknown) : HResult; stdcall;
8035
    function EnumZBufferFormats (const riidDevice: TRefClsID; lpEnumCallback:
8036
        TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
8037
    function EvictManagedTextures : HResult; stdcall;
1 daniel-mar 8038
  end;
8039
 
4 daniel-mar 8040
  IDirect3D7 = interface (IUnknown)
8041
    ['{f5049e77-4861-11d2-a407-00a0c90629a8}']
8042
    (*** IDirect3D7 methods ***)
1 daniel-mar 8043
    function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback7;
4 daniel-mar 8044
        lpUserArg: pointer) : HResult; stdcall;
8045
    function CreateDevice (const rclsid: TGUID; lpDDS: IDirectDrawSurface7;
8046
        out lplpD3DDevice: IDirect3DDevice7) : HResult; stdcall;
8047
    function CreateVertexBuffer (const lpVBDesc: TD3DVertexBufferDesc;
8048
        out lplpD3DVertexBuffer: IDirect3DVertexBuffer7;
8049
        dwFlags: DWORD) : HResult; stdcall;
8050
    function EnumZBufferFormats (const riidDevice: TGUID; lpEnumCallback:
8051
        TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
8052
    function EvictManagedTextures : HResult; stdcall;
1 daniel-mar 8053
  end;
4 daniel-mar 8054
 
8055
(*
8056
 * Direct3D Device interfaces
8057
 *)
1 daniel-mar 8058
 
4 daniel-mar 8059
  IDirect3DDevice = interface (IUnknown)
8060
    ['{64108800-957d-11d0-89ab-00a0c9054129}']
8061
    (*** IDirect3DDevice methods ***)
8062
    function Initialize (lpd3d: IDirect3D; lpGUID: PGUID;
8063
        var lpd3ddvdesc: TD3DDeviceDesc) : HResult; stdcall;
8064
    function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
8065
        var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
8066
    function SwapTextureHandles (lpD3DTex1: IDirect3DTexture;
8067
        lpD3DTex2: IDirect3DTexture) : HResult; stdcall;
8068
    function CreateExecuteBuffer (var lpDesc: TD3DExecuteBufferDesc ;
8069
        var lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
8070
        pUnkOuter: IUnknown) : HResult; stdcall;
8071
    function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
8072
    function Execute (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
8073
        lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
8074
    function AddViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
8075
    function DeleteViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
8076
    function NextViewport (lpDirect3DViewport: IDirect3DViewport;
8077
        var lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
8078
    function Pick (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
1 daniel-mar 8079
        lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD;
4 daniel-mar 8080
        var lpRect: TD3DRect) : HResult; stdcall;
8081
    function GetPickRecords (var lpCount: DWORD;
8082
        var lpD3DPickRec: TD3DPickRecord) : HResult; stdcall;
8083
    function EnumTextureFormats (lpd3dEnumTextureProc:
8084
        TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
8085
        HResult; stdcall;
8086
    function CreateMatrix (var lpD3DMatHandle: TD3DMatrixHandle) : HResult; stdcall;
8087
    function SetMatrix (d3dMatHandle: TD3DMatrixHandle;
8088
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8089
    function GetMatrix (var lpD3DMatHandle: TD3DMatrixHandle;
8090
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8091
    function DeleteMatrix (d3dMatHandle: TD3DMatrixHandle) : HResult; stdcall;
1 daniel-mar 8092
    function BeginScene: HResult; stdcall;
8093
    function EndScene: HResult; stdcall;
4 daniel-mar 8094
    function GetDirect3D (var lpD3D: IDirect3D) : HResult; stdcall;
1 daniel-mar 8095
  end;
8096
 
4 daniel-mar 8097
  IDirect3DDevice2 = interface (IUnknown)
8098
    ['{93281501-8cf8-11d0-89ab-00a0c9054129}']
8099
    (*** IDirect3DDevice2 methods ***)
8100
    function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
8101
        var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
8102
    function SwapTextureHandles (lpD3DTex1: IDirect3DTexture2;
8103
        lpD3DTex2: IDirect3DTexture2) : HResult; stdcall;
8104
    function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
8105
    function AddViewport (lpDirect3DViewport2: IDirect3DViewport2) : HResult; stdcall;
8106
    function DeleteViewport (lpDirect3DViewport: IDirect3DViewport2) : HResult; stdcall;
8107
    function NextViewport (lpDirect3DViewport: IDirect3DViewport2;
8108
        var lplpDirect3DViewport: IDirect3DViewport2; dwFlags: DWORD) :
8109
        HResult; stdcall;
8110
    function EnumTextureFormats (
8111
        lpd3dEnumTextureProc: TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
8112
        HResult; stdcall;
1 daniel-mar 8113
    function BeginScene: HResult; stdcall;
8114
    function EndScene: HResult; stdcall;
4 daniel-mar 8115
    function GetDirect3D (var lpD3D: IDirect3D2) : HResult; stdcall;
8116
 
8117
    (*** DrawPrimitive API ***)
8118
    function SetCurrentViewport (lpd3dViewport2: IDirect3DViewport2)
8119
        : HResult; stdcall;
8120
    function GetCurrentViewport (var lplpd3dViewport2: IDirect3DViewport2)
8121
        : HResult; stdcall;
8122
 
8123
    function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface)
8124
        : HResult; stdcall;
8125
    function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface)
8126
        : HResult; stdcall;
8127
 
8128
    function Begin_ (d3dpt: TD3DPrimitiveType; d3dvt: TD3DVertexType;
8129
        dwFlags: DWORD) : HResult; stdcall;
8130
    function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType; dvtVertexType:
8131
        TD3DVertexType; lpvVertices: pointer; dwNumVertices: DWORD;
8132
        dwFlags: DWORD) : HResult; stdcall;
8133
    function Vertex (lpVertexType: pointer) : HResult;  stdcall;
8134
    function Index (wVertexIndex: WORD) : HResult;  stdcall;
8135
    function End_ (dwFlags: DWORD) : HResult; stdcall;
8136
 
8137
    function GetRenderState (dwRenderStateType: TD3DRenderStateType;
8138
        var lpdwRenderState) : HResult; stdcall;
8139
    function SetRenderState (dwRenderStateType: TD3DRenderStateType;
8140
        dwRenderState: DWORD) : HResult; stdcall;
8141
    function GetLightState (dwLightStateType: TD3DLightStateType;
8142
        var lpdwLightState) : HResult; stdcall;
8143
    function SetLightState (dwLightStateType: TD3DLightStateType;
8144
        dwLightState: DWORD) : HResult; stdcall;
8145
    function SetTransform (dtstTransformStateType: TD3DTransformStateType;
8146
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8147
    function GetTransform (dtstTransformStateType: TD3DTransformStateType;
8148
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8149
    function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
8150
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8151
 
8152
    function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
8153
        dvtVertexType: TD3DVertexType; var lpvVertices; dwVertexCount,
8154
        dwFlags: DWORD) : HResult; stdcall;
8155
    function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
8156
        dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwVertexCount: DWORD;
8157
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8158
    function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
8159
    function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
1 daniel-mar 8160
  end;
8161
 
4 daniel-mar 8162
  IDirect3DDevice3 = interface (IUnknown)
8163
    ['{b0ab3b60-33d7-11d1-a981-00c04fd7b174}']
8164
    (*** IDirect3DDevice2 methods ***)
8165
    function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
8166
        var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
8167
    function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
8168
    function AddViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
8169
    function DeleteViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
8170
    function NextViewport (lpDirect3DViewport: IDirect3DViewport3;
8171
        var lplpAnotherViewport: IDirect3DViewport3; dwFlags: DWORD) : HResult; stdcall;
8172
    function EnumTextureFormats (
8173
        lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) :
8174
        HResult; stdcall;
1 daniel-mar 8175
    function BeginScene: HResult; stdcall;
8176
    function EndScene: HResult; stdcall;
4 daniel-mar 8177
    function GetDirect3D (var lpD3D: IDirect3D3) : HResult; stdcall;
8178
    function SetCurrentViewport (lpd3dViewport: IDirect3DViewport3)
8179
        : HResult; stdcall;
8180
    function GetCurrentViewport (var lplpd3dViewport: IDirect3DViewport3)
8181
        : HResult; stdcall;
8182
    function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface4)
8183
        : HResult; stdcall;
8184
    function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface4)
8185
        : HResult; stdcall;
8186
    function Begin_ (d3dpt: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
8187
        dwFlags: DWORD) : HResult; stdcall;
8188
    function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType;
8189
        dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwNumVertices: DWORD;
8190
        dwFlags: DWORD) : HResult; stdcall;
8191
    function Vertex (lpVertex: pointer) : HResult;  stdcall;
8192
    function Index (wVertexIndex: WORD) : HResult;  stdcall;
8193
    function End_ (dwFlags: DWORD) : HResult; stdcall;
8194
    function GetRenderState (dwRenderStateType: TD3DRenderStateType;
8195
        var lpdwRenderState) : HResult; stdcall;
8196
    function SetRenderState (dwRenderStateType: TD3DRenderStateType;
8197
        dwRenderState: DWORD) : HResult; stdcall;
8198
    function GetLightState (dwLightStateType: TD3DLightStateType;
8199
        var lpdwLightState) : HResult; stdcall;
8200
    function SetLightState (dwLightStateType: TD3DLightStateType;
8201
        dwLightState: DWORD) : HResult; stdcall;
8202
    function SetTransform (dtstTransformStateType: TD3DTransformStateType;
8203
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8204
    function GetTransform (dtstTransformStateType: TD3DTransformStateType;
8205
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8206
    function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
8207
        var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8208
    function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
8209
        dwVertexTypeDesc: DWORD; const lpvVertices;
8210
        dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
8211
    function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
8212
        dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
8213
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8214
    function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
8215
    function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
8216
    function DrawPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
8217
        dwVertexTypeDesc : DWORD;
8218
        var lpVertexArray: TD3DDrawPrimitiveStridedData;
8219
        dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
8220
    function DrawIndexedPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
8221
        dwVertexTypeDesc : DWORD;
8222
        var lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
8223
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8224
    function DrawPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
8225
        lpd3dVertexBuffer: IDirect3DVertexBuffer;
8226
        dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
8227
    function DrawIndexedPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
8228
        lpd3dVertexBuffer: IDirect3DVertexBuffer; var lpwIndices: WORD;
8229
        dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8230
    function ComputeSphereVisibility (var lpCenters: TD3DVector;
8231
        var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
8232
        var lpdwReturnValues: DWORD) : HResult; stdcall;
8233
    function GetTexture (dwStage: DWORD; var lplpTexture: IDirect3DTexture2)
8234
        : HResult; stdcall;
8235
    function SetTexture (dwStage: DWORD; lplpTexture: IDirect3DTexture2)
8236
        : HResult; stdcall;
8237
    function GetTextureStageState (dwStage: DWORD;
8238
        dwState: TD3DTextureStageStateType; var lpdwValue: DWORD) : HResult; stdcall;
8239
    function SetTextureStageState (dwStage: DWORD;
8240
        dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
8241
    function ValidateDevice (var lpdwExtraPasses: DWORD) : HResult; stdcall;
8242
  end;
8243
 
8244
  IDirect3DDevice7 = interface (IUnknown)
8245
    ['{f5049e79-4861-11d2-a407-00a0c90629a8}']
8246
    (*** IDirect3DDevice7 methods ***)
8247
    function GetCaps(out lpD3DDevDesc: TD3DDeviceDesc7) : HResult; stdcall;
8248
    function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) : HResult; stdcall;
8249
    function BeginScene: HResult; stdcall;
8250
    function EndScene: HResult; stdcall;
8251
    function GetDirect3D(out lpD3D: IDirect3D7) : HResult; stdcall;
8252
    function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface7; dwFlags: DWORD) : HResult; stdcall;
8253
    function GetRenderTarget(out lplpRenderTarget: IDirectDrawSurface7) : HResult; stdcall;
8254
    function Clear(dwCount: DWORD; lpRects: PD3DRect; dwFlags, dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
1 daniel-mar 8255
    function SetTransform(dtstTransformStateType: TD3DTransformStateType;
4 daniel-mar 8256
        const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
1 daniel-mar 8257
    function GetTransform(dtstTransformStateType: TD3DTransformStateType;
4 daniel-mar 8258
        out lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8259
    function SetViewport(const lpViewport: TD3DViewport7) : HResult; stdcall;
1 daniel-mar 8260
    function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType;
4 daniel-mar 8261
        const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
8262
    function GetViewport(out lpViewport: TD3DViewport7) : HResult; stdcall;
8263
    function SetMaterial(const lpMaterial: TD3DMaterial7) : HResult; stdcall;
8264
    function GetMaterial(out lpMaterial: TD3DMaterial7) : HResult; stdcall;
8265
    function SetLight(dwLightIndex: DWORD; const lpLight: TD3DLight7) : HResult; stdcall;
8266
    function GetLight(dwLightIndex: DWORD; out lpLight: TD3DLight7) : HResult; stdcall;
8267
    function SetRenderState(dwRenderStateType: TD3DRenderStateType; dwRenderState: DWORD) : HResult; stdcall;
8268
    function GetRenderState(dwRenderStateType: TD3DRenderStateType; out dwRenderState: DWORD) : HResult; stdcall;
8269
    function BeginStateBlock : HResult; stdcall;
8270
    function EndStateBlock(out lpdwBlockHandle: DWORD) : HResult; stdcall;
8271
    function PreLoad(lpddsTexture: IDirectDrawSurface7) : HResult; stdcall;
1 daniel-mar 8272
    function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8273
        dwVertexTypeDesc: DWORD; const lpvVertices;
8274
        dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8275
    function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8276
        dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
8277
        const lpwIndices; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8278
    function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
8279
    function GetClipStatus(out lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
1 daniel-mar 8280
    function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8281
        dwVertexTypeDesc : DWORD;
8282
        const lpVertexArray: TD3DDrawPrimitiveStridedData;
8283
        dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8284
    function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8285
        dwVertexTypeDesc : DWORD;
8286
        const lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
8287
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8288
    function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8289
        lpd3dVertexBuffer: IDirect3DVertexBuffer7;
8290
        dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8291
    function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
4 daniel-mar 8292
        lpd3dVertexBuffer: IDirect3DVertexBuffer7; dwStartVertex, dwNumVertices: DWORD;
8293
        var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
8294
    function ComputeSphereVisibility(const lpCenters: TD3DVector;
8295
        var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
8296
        var lpdwReturnValues: DWORD) : HResult; stdcall;
8297
    function GetTexture(dwStage: DWORD; out lplpTexture: IDirectDrawSurface7) : HResult; stdcall;
8298
    function SetTexture(dwStage: DWORD; lpTexture: IDirectDrawSurface7) : HResult; stdcall;
8299
    function GetTextureStageState(dwStage: DWORD;
8300
        dwState: TD3DTextureStageStateType; out lpdwValue: DWORD) : HResult; stdcall;
8301
    function SetTextureStageState(dwStage: DWORD;
8302
        dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
8303
    function ValidateDevice(out lpdwExtraPasses: DWORD) : HResult; stdcall;
8304
    function ApplyStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
8305
    function CaptureStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
8306
    function DeleteStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
8307
    function CreateStateBlock(d3dsbType: TD3DStateBlockType; out lpdwBlockHandle: DWORD) : HResult; stdcall;
8308
    function Load(lpDestTex: IDirectDrawSurface7; lpDestPoint: PPoint;
8309
        lpSrcTex: IDirectDrawSurface7; lprcSrcRect: PRect; dwFlags: DWORD) : HResult; stdcall;
8310
    function LightEnable(dwLightIndex: DWORD; bEnable: BOOL) : HResult; stdcall;
8311
    function GetLightEnable(dwLightIndex: DWORD; out bEnable: BOOL) : HResult; stdcall;
8312
    function SetClipPlane(dwIndex: DWORD; var pPlaneEquation: TD3DValue) : HResult; stdcall;
8313
    function GetClipPlane(dwIndex: DWORD; out pPlaneEquation: TD3DValue) : HResult; stdcall;
8314
    function GetInfo(dwDevInfoID: DWORD; pDevInfoStruct: Pointer; dwSize: DWORD) : HResult; stdcall;
1 daniel-mar 8315
  end;
4 daniel-mar 8316
 
8317
(*
8318
 * Execute Buffer interface
8319
 *)
1 daniel-mar 8320
 
4 daniel-mar 8321
  IDirect3DExecuteBuffer = interface (IUnknown)
1 daniel-mar 8322
    ['{4417C145-33AD-11CF-816F-0000C020156E}']
4 daniel-mar 8323
    (*** IDirect3DExecuteBuffer methods ***)
8324
    function Initialize (lpDirect3DDevice: IDirect3DDevice;
8325
        var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
8326
    function Lock (var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
1 daniel-mar 8327
    function Unlock: HResult; stdcall;
4 daniel-mar 8328
    function SetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
8329
    function GetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
8330
    function Validate (var lpdwOffset: DWORD; lpFunc: TD3DValidateCallback;
8331
        lpUserArg: Pointer; dwReserved: DWORD) : HResult; stdcall;
8332
    (*** Warning!  Optimize is defined differently in the header files
8333
         and the online documentation ***)
8334
    function Optimize (dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8335
  end;
8336
 
4 daniel-mar 8337
(*
8338
 * Light interfaces
8339
 *)
8340
 
8341
  IDirect3DLight = interface (IUnknown)
1 daniel-mar 8342
    ['{4417C142-33AD-11CF-816F-0000C020156E}']
4 daniel-mar 8343
    (*** IDirect3DLight methods ***)
8344
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8345
    function SetLight (var lpLight: TD3DLight2) : HResult; stdcall;
8346
    function GetLight (var lpLight: TD3DLight2) : HResult; stdcall;
1 daniel-mar 8347
  end;
8348
 
4 daniel-mar 8349
(*
8350
 * Material interfaces
8351
 *)
8352
 
8353
  IDirect3DMaterial = interface (IUnknown)
1 daniel-mar 8354
    ['{4417C144-33AD-11CF-816F-0000C020156E}']
4 daniel-mar 8355
    (*** IDirect3DMaterial methods ***)
8356
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8357
    function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8358
    function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8359
    function GetHandle (lpDirect3DDevice: IDirect3DDevice;
8360
        var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
1 daniel-mar 8361
    function Reserve: HResult; stdcall;
8362
    function Unreserve: HResult; stdcall;
8363
  end;
8364
 
4 daniel-mar 8365
  IDirect3DMaterial2 = interface (IUnknown)
8366
    ['{93281503-8cf8-11d0-89ab-00a0c9054129}']
8367
    (*** IDirect3DMaterial2 methods ***)
8368
    function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8369
    function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8370
    function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
8371
        var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
1 daniel-mar 8372
  end;
8373
 
4 daniel-mar 8374
  IDirect3DMaterial3 = interface (IUnknown)
8375
    ['{ca9c46f4-d3c5-11d1-b75a-00600852b312}']
8376
    (*** IDirect3DMaterial2 methods ***)
8377
    function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8378
    function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
8379
    function GetHandle (lpDirect3DDevice: IDirect3DDevice3;
8380
        var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
1 daniel-mar 8381
  end;
8382
 
4 daniel-mar 8383
(*
8384
 * Texture interfaces
8385
 *)
8386
 
8387
  IDirect3DTexture = interface (IUnknown)
1 daniel-mar 8388
    ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}']
4 daniel-mar 8389
    (*** IDirect3DTexture methods ***)
8390
    function Initialize (lpD3DDevice: IDirect3DDevice;
8391
        lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
8392
    function GetHandle (lpDirect3DDevice: IDirect3DDevice;
8393
        var lpHandle: TD3DTextureHandle) : HResult; stdcall;
8394
    function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
8395
    function Load (lpD3DTexture: IDirect3DTexture) : HResult; stdcall;
1 daniel-mar 8396
    function Unload: HResult; stdcall;
8397
  end;
8398
 
4 daniel-mar 8399
  IDirect3DTexture2 = interface (IUnknown)
8400
    ['{93281502-8cf8-11d0-89ab-00a0c9054129}']
8401
    (*** IDirect3DTexture2 methods ***)
8402
    function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
8403
        var lpHandle: TD3DTextureHandle) : HResult; stdcall;
8404
    function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
8405
    function Load (lpD3DTexture: IDirect3DTexture2) : HResult; stdcall;
1 daniel-mar 8406
  end;
8407
 
4 daniel-mar 8408
(*
8409
 * Viewport interfaces
8410
 *)
8411
 
8412
  IDirect3DViewport = interface (IUnknown)
1 daniel-mar 8413
    ['{4417C146-33AD-11CF-816F-0000C020156E}']
4 daniel-mar 8414
    (*** IDirect3DViewport methods ***)
8415
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8416
    function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
8417
    function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
8418
    function TransformVertices (dwVertexCount: DWORD;
8419
        const lpData: TD3DTransformData; dwFlags: DWORD;
8420
        out lpOffscreen: DWORD) : HResult; stdcall;
8421
    function LightElements (dwElementCount: DWORD;
8422
        var lpData: TD3DLightData) : HResult; stdcall;
8423
    function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
8424
    function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
8425
    function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
8426
        HResult; stdcall;
8427
    function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
8428
        out lpValid: BOOL) : HResult; stdcall;
8429
    function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
8430
        HResult; stdcall;
8431
    function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8432
    function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8433
     function NextLight (lpDirect3DLight: IDirect3DLight;
8434
        out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8435
  end;
8436
 
4 daniel-mar 8437
  IDirect3DViewport2 = interface (IUnknown)
8438
    ['{93281500-8cf8-11d0-89ab-00a0c9054129}']
8439
    (*** IDirect3DViewport2 methods ***)
8440
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8441
    function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
8442
    function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
8443
    function TransformVertices (dwVertexCount: DWORD;
8444
        const lpData: TD3DTransformData; dwFlags: DWORD;
8445
        out lpOffscreen: DWORD) : HResult; stdcall;
8446
    function LightElements (dwElementCount: DWORD;
8447
        var lpData: TD3DLightData) : HResult; stdcall;
8448
    function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
8449
    function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
8450
    function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
8451
        HResult; stdcall;
8452
    function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
8453
        out lpValid: BOOL) : HResult; stdcall;
8454
    function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
8455
        HResult; stdcall;
8456
    function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8457
    function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8458
    function NextLight (lpDirect3DLight: IDirect3DLight;
8459
        out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
8460
    (*** IDirect3DViewport2 methods ***)
8461
    function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
8462
    function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
1 daniel-mar 8463
  end;
8464
 
4 daniel-mar 8465
  IDirect3DViewport3 = interface (IUnknown)
8466
    ['{b0ab3b61-33d7-11d1-a981-00c04fd7b174}']
8467
    (*** IDirect3DViewport3 methods ***)
8468
    function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
8469
    function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
8470
    function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
8471
    function TransformVertices (dwVertexCount: DWORD;
8472
        const lpData: TD3DTransformData; dwFlags: DWORD;
8473
        out lpOffscreen: DWORD) : HResult; stdcall;
8474
    function LightElements (dwElementCount: DWORD;
8475
        var lpData: TD3DLightData) : HResult; stdcall;
8476
    function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
8477
    function GetBackground (var hMat: TD3DMaterialHandle) : HResult; stdcall;
8478
    function SetBackgroundDepth (
8479
        lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
8480
    function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
8481
        out lpValid: BOOL) : HResult; stdcall;
8482
    function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
8483
        HResult; stdcall;
8484
    function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8485
    function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
8486
    function NextLight (lpDirect3DLight: IDirect3DLight;
8487
        out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
8488
    function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
8489
    function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
8490
    function SetBackgroundDepth2 (
8491
        lpDDSurface: IDirectDrawSurface4) : HResult; stdcall;
8492
    function GetBackgroundDepth2 (out lplpDDSurface: IDirectDrawSurface4;
8493
        out lpValid: BOOL) : HResult; stdcall;
8494
    function Clear2 (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD;
8495
        dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
1 daniel-mar 8496
  end;
8497
 
4 daniel-mar 8498
  IDirect3DVertexBuffer = interface (IUnknown)
8499
    ['{7a503555-4a83-11d1-a5db-00a0c90367f8}']
8500
    (*** IDirect3DVertexBuffer methods ***)
8501
    function Lock (dwFlags: DWORD; var lplpData: pointer; var lpdwSize: DWORD)
8502
        : HResult; stdcall;
8503
    function Unlock : HResult; stdcall;
8504
    function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
8505
        lpSrcBuffer: IDirect3DVertexBuffer; dwSrcIndex: DWORD;
8506
        lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
8507
    function GetVertexBufferDesc (var lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
8508
    function Optimize(lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8509
  end;
8510
 
4 daniel-mar 8511
  IDirect3DVertexBuffer7 = interface (IUnknown)
8512
    ['{f5049e7d-4861-11d2-a407-00a0c90629a8}']
8513
    (*** IDirect3DVertexBuffer methods ***)
8514
    function Lock (dwFlags: DWORD; out lplpData: Pointer; out lpdwSize: DWORD) : HResult; stdcall;
8515
    function Unlock : HResult; stdcall;
8516
    function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
8517
        lpSrcBuffer: IDirect3DVertexBuffer7; dwSrcIndex: DWORD;
8518
        lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
8519
    function GetVertexBufferDesc (out lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
8520
    function Optimize(lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
8521
    function ProcessVerticesStrided(dwVertexOp, dwDestIndex, dwCount: DWORD;
8522
      lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexTypeDesc: DWORD;
8523
      lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 8524
  end;
8525
 
4 daniel-mar 8526
type
8527
  IID_IDirect3D = IDirect3D;
8528
  IID_IDirect3D2 = IDirect3D2;
8529
  IID_IDirect3D3 = IDirect3D3;
8530
  IID_IDirect3D7 = IDirect3D7;
8531
 
8532
  IID_IDirect3DDevice = IDirect3DDevice;
8533
  IID_IDirect3DDevice2 = IDirect3DDevice2;
8534
  IID_IDirect3DDevice3 = IDirect3DDevice3;
8535
  IID_IDirect3DDevice7 = IDirect3DDevice7;
8536
 
8537
  IID_IDirect3DTexture = IDirect3DTexture;
8538
  IID_IDirect3DTexture2 = IDirect3DTexture2;
8539
  IID_IDirect3DLight = IDirect3DLight;
8540
  IID_IDirect3DMaterial = IDirect3DMaterial;
8541
  IID_IDirect3DMaterial2 = IDirect3DMaterial2;
8542
  IID_IDirect3DMaterial3 = IDirect3DMaterial3;
8543
  IID_IDirect3DExecuteBuffer = IDirect3DExecuteBuffer;
8544
  IID_IDirect3DViewport = IDirect3DViewport;
8545
  IID_IDirect3DViewport2 = IDirect3DViewport2;
8546
  IID_IDirect3DViewport3 = IDirect3DViewport3;
8547
  IID_IDirect3DVertexBuffer = IDirect3DVertexBuffer;
8548
  IID_IDirect3DVertexBuffer7 = IDirect3DVertexBuffer7;
8549
 
8550
 
1 daniel-mar 8551
const
4 daniel-mar 8552
(****************************************************************************
8553
 *
8554
 * Flags for IDirect3DDevice::NextViewport
8555
 *
8556
 ****************************************************************************)
1 daniel-mar 8557
 
4 daniel-mar 8558
(*
8559
 * Return the next viewport
8560
 *)
8561
  D3DNEXT_NEXT =        $00000001;
1 daniel-mar 8562
 
4 daniel-mar 8563
(*
8564
 * Return the first viewport
8565
 *)
8566
  D3DNEXT_HEAD =        $00000002;
1 daniel-mar 8567
 
4 daniel-mar 8568
(*
8569
 * Return the last viewport
8570
 *)
8571
  D3DNEXT_TAIL =        $00000004;
1 daniel-mar 8572
 
8573
 
4 daniel-mar 8574
(****************************************************************************
8575
 *
8576
 * Flags for DrawPrimitive/DrawIndexedPrimitive
8577
 *   Also valid for Begin/BeginIndexed
8578
 *   Also valid for VertexBuffer::CreateVertexBuffer
8579
 ****************************************************************************)
1 daniel-mar 8580
 
4 daniel-mar 8581
(*
8582
 * Wait until the device is ready to draw the primitive
8583
 * This will cause DP to not return DDERR_WASSTILLDRAWING
8584
 *)
8585
  D3DDP_WAIT =                                  $00000001;
8586
 
8587
(*
8588
 * Hint that it is acceptable to render the primitive out of order.
8589
 *)
8590
  D3DDP_OUTOFORDER            = $00000002;
8591
 
8592
(*
8593
 * Hint that the primitives have been clipped by the application.
8594
 *)
8595
  D3DDP_DONOTCLIP =                             $00000004;
8596
 
8597
(*
8598
 * Hint that the extents need not be updated.
8599
 *)
8600
  D3DDP_DONOTUPDATEEXTENTS =    $00000008;
8601
 
8602
(*
8603
 * Hint that the lighting should not be applied on vertices.
8604
 *)
8605
 
8606
  D3DDP_DONOTLIGHT            = $00000010;
8607
 
8608
 
8609
(*
8610
 * Direct3D Errors
8611
 * DirectDraw error codes are used when errors not specified here.
8612
 *)
8613
 
1 daniel-mar 8614
const
4 daniel-mar 8615
  MAKE_D3DHRESULT = HResult($88760000);
1 daniel-mar 8616
 
4 daniel-mar 8617
  D3D_OK                          = DD_OK;
8618
  D3DERR_BADMAJORVERSION          = MAKE_D3DHRESULT + 700;
8619
  D3DERR_BADMINORVERSION          = MAKE_D3DHRESULT + 701;
1 daniel-mar 8620
 
4 daniel-mar 8621
(*
8622
 * An invalid device was requested by the application.
8623
 *)
8624
  D3DERR_INVALID_DEVICE   = MAKE_D3DHRESULT + 705;
8625
  D3DERR_INITFAILED       = MAKE_D3DHRESULT + 706;
1 daniel-mar 8626
 
4 daniel-mar 8627
(*
8628
 * SetRenderTarget attempted on a device that was
8629
 * QI'd off the render target.
8630
 *)
8631
  D3DERR_DEVICEAGGREGATED = MAKE_D3DHRESULT + 707;
1 daniel-mar 8632
 
4 daniel-mar 8633
  D3DERR_EXECUTE_CREATE_FAILED    = MAKE_D3DHRESULT + 710;
8634
  D3DERR_EXECUTE_DESTROY_FAILED   = MAKE_D3DHRESULT + 711;
8635
  D3DERR_EXECUTE_LOCK_FAILED      = MAKE_D3DHRESULT + 712;
8636
  D3DERR_EXECUTE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 713;
8637
  D3DERR_EXECUTE_LOCKED           = MAKE_D3DHRESULT + 714;
8638
  D3DERR_EXECUTE_NOT_LOCKED       = MAKE_D3DHRESULT + 715;
1 daniel-mar 8639
 
4 daniel-mar 8640
  D3DERR_EXECUTE_FAILED           = MAKE_D3DHRESULT + 716;
8641
  D3DERR_EXECUTE_CLIPPED_FAILED   = MAKE_D3DHRESULT + 717;
1 daniel-mar 8642
 
4 daniel-mar 8643
  D3DERR_TEXTURE_NO_SUPPORT       = MAKE_D3DHRESULT + 720;
8644
  D3DERR_TEXTURE_CREATE_FAILED    = MAKE_D3DHRESULT + 721;
8645
  D3DERR_TEXTURE_DESTROY_FAILED   = MAKE_D3DHRESULT + 722;
8646
  D3DERR_TEXTURE_LOCK_FAILED      = MAKE_D3DHRESULT + 723;
8647
  D3DERR_TEXTURE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 724;
8648
  D3DERR_TEXTURE_LOAD_FAILED      = MAKE_D3DHRESULT + 725;
8649
  D3DERR_TEXTURE_SWAP_FAILED      = MAKE_D3DHRESULT + 726;
8650
  D3DERR_TEXTURE_LOCKED           = MAKE_D3DHRESULT + 727;
8651
  D3DERR_TEXTURE_NOT_LOCKED       = MAKE_D3DHRESULT + 728;
8652
  D3DERR_TEXTURE_GETSURF_FAILED   = MAKE_D3DHRESULT + 729;
1 daniel-mar 8653
 
4 daniel-mar 8654
  D3DERR_MATRIX_CREATE_FAILED     = MAKE_D3DHRESULT + 730;
8655
  D3DERR_MATRIX_DESTROY_FAILED    = MAKE_D3DHRESULT + 731;
8656
  D3DERR_MATRIX_SETDATA_FAILED    = MAKE_D3DHRESULT + 732;
8657
  D3DERR_MATRIX_GETDATA_FAILED    = MAKE_D3DHRESULT + 733;
8658
  D3DERR_SETVIEWPORTDATA_FAILED   = MAKE_D3DHRESULT + 734;
1 daniel-mar 8659
 
4 daniel-mar 8660
  D3DERR_INVALIDCURRENTVIEWPORT   = MAKE_D3DHRESULT + 735;
8661
  D3DERR_INVALIDPRIMITIVETYPE     = MAKE_D3DHRESULT + 736;
8662
  D3DERR_INVALIDVERTEXTYPE        = MAKE_D3DHRESULT + 737;
8663
  D3DERR_TEXTURE_BADSIZE          = MAKE_D3DHRESULT + 738;
8664
  D3DERR_INVALIDRAMPTEXTURE       = MAKE_D3DHRESULT + 739;
1 daniel-mar 8665
 
4 daniel-mar 8666
  D3DERR_MATERIAL_CREATE_FAILED   = MAKE_D3DHRESULT + 740;
8667
  D3DERR_MATERIAL_DESTROY_FAILED  = MAKE_D3DHRESULT + 741;
8668
  D3DERR_MATERIAL_SETDATA_FAILED  = MAKE_D3DHRESULT + 742;
8669
  D3DERR_MATERIAL_GETDATA_FAILED  = MAKE_D3DHRESULT + 743;
1 daniel-mar 8670
 
4 daniel-mar 8671
  D3DERR_INVALIDPALETTE           = MAKE_D3DHRESULT + 744;
1 daniel-mar 8672
 
4 daniel-mar 8673
  D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY = MAKE_D3DHRESULT + 745;
8674
  D3DERR_ZBUFF_NEEDS_VIDEOMEMORY  = MAKE_D3DHRESULT + 746;
8675
  D3DERR_SURFACENOTINVIDMEM       = MAKE_D3DHRESULT + 747;
1 daniel-mar 8676
 
4 daniel-mar 8677
  D3DERR_LIGHT_SET_FAILED         = MAKE_D3DHRESULT + 750;
8678
  D3DERR_LIGHTHASVIEWPORT         = MAKE_D3DHRESULT + 751;
8679
  D3DERR_LIGHTNOTINTHISVIEWPORT   = MAKE_D3DHRESULT + 752;
1 daniel-mar 8680
 
4 daniel-mar 8681
  D3DERR_SCENE_IN_SCENE           = MAKE_D3DHRESULT + 760;
8682
  D3DERR_SCENE_NOT_IN_SCENE       = MAKE_D3DHRESULT + 761;
8683
  D3DERR_SCENE_BEGIN_FAILED       = MAKE_D3DHRESULT + 762;
8684
  D3DERR_SCENE_END_FAILED         = MAKE_D3DHRESULT + 763;
1 daniel-mar 8685
 
4 daniel-mar 8686
  D3DERR_INBEGIN                  = MAKE_D3DHRESULT + 770;
8687
  D3DERR_NOTINBEGIN               = MAKE_D3DHRESULT + 771;
8688
  D3DERR_NOVIEWPORTS              = MAKE_D3DHRESULT + 772;
8689
  D3DERR_VIEWPORTDATANOTSET       = MAKE_D3DHRESULT + 773;
8690
  D3DERR_VIEWPORTHASNODEVICE      = MAKE_D3DHRESULT + 774;
8691
  D3DERR_NOCURRENTVIEWPORT        = MAKE_D3DHRESULT + 775;
1 daniel-mar 8692
 
4 daniel-mar 8693
  D3DERR_INVALIDVERTEXFORMAT      = MAKE_D3DHRESULT + 2048;
1 daniel-mar 8694
 
4 daniel-mar 8695
(*
8696
 * Attempted to CreateTexture on a surface that had a color key
8697
 *)
8698
  D3DERR_COLORKEYATTACHED                 = MAKE_D3DHRESULT + 2050;
1 daniel-mar 8699
 
4 daniel-mar 8700
  D3DERR_VERTEXBUFFEROPTIMIZED            = MAKE_D3DHRESULT + 2060;
8701
  D3DERR_VBUF_CREATE_FAILED               = MAKE_D3DHRESULT + 2061;
8702
  D3DERR_VERTEXBUFFERLOCKED               = MAKE_D3DHRESULT + 2062;
1 daniel-mar 8703
 
4 daniel-mar 8704
  D3DERR_ZBUFFER_NOTPRESENT               = MAKE_D3DHRESULT + 2070;
8705
  D3DERR_STENCILBUFFER_NOTPRESENT         = MAKE_D3DHRESULT + 2071;
1 daniel-mar 8706
 
4 daniel-mar 8707
  D3DERR_WRONGTEXTUREFORMAT               = MAKE_D3DHRESULT + 2072;
8708
  D3DERR_UNSUPPORTEDCOLOROPERATION        = MAKE_D3DHRESULT + 2073;
8709
  D3DERR_UNSUPPORTEDCOLORARG              = MAKE_D3DHRESULT + 2074;
8710
  D3DERR_UNSUPPORTEDALPHAOPERATION        = MAKE_D3DHRESULT + 2075;
8711
  D3DERR_UNSUPPORTEDALPHAARG              = MAKE_D3DHRESULT + 2076;
8712
  D3DERR_TOOMANYOPERATIONS                = MAKE_D3DHRESULT + 2077;
8713
  D3DERR_CONFLICTINGTEXTUREFILTER         = MAKE_D3DHRESULT + 2078;
8714
  D3DERR_UNSUPPORTEDFACTORVALUE           = MAKE_D3DHRESULT + 2079;
8715
  D3DERR_CONFLICTINGRENDERSTATE           = MAKE_D3DHRESULT + 2081;
8716
  D3DERR_UNSUPPORTEDTEXTUREFILTER         = MAKE_D3DHRESULT + 2082;
8717
  D3DERR_TOOMANYPRIMITIVES                = MAKE_D3DHRESULT + 2083;
8718
  D3DERR_INVALIDMATRIX                    = MAKE_D3DHRESULT + 2084;
8719
  D3DERR_TOOMANYVERTICES                  = MAKE_D3DHRESULT + 2085;
8720
  D3DERR_CONFLICTINGTEXTUREPALETTE        = MAKE_D3DHRESULT + 2086;
1 daniel-mar 8721
 
4 daniel-mar 8722
  D3DERR_INVALIDSTATEBLOCK        = MAKE_D3DHRESULT + 2100;
8723
  D3DERR_INBEGINSTATEBLOCK        = MAKE_D3DHRESULT + 2101;
8724
  D3DERR_NOTINBEGINSTATEBLOCK     = MAKE_D3DHRESULT + 2102;
1 daniel-mar 8725
 
4 daniel-mar 8726
procedure DisableFPUExceptions;
8727
procedure EnableFPUExceptions;
1 daniel-mar 8728
 
4 daniel-mar 8729
(***************************************************************************
8730
 *
8731
 *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
8732
 *
8733
 *  File:       dxfile.h
8734
 *
8735
 *  Content:    DirectX File public header file
8736
 *
8737
 ***************************************************************************)
8738
 
8739
var
8740
  DXFileDLL : HMODULE;
8741
 
8742
function DXFileErrorString(Value: HResult) : string;
8743
 
8744
type
8745
  TDXFileFormat = (
8746
    DXFILEFORMAT_BINARY,
8747
    DXFILEFORMAT_TEXT,
8748
    DXFILEFORMAT_COMPRESSED
8749
  );
8750
 
8751
  TDXFileLoadOptions = (
8752
    DXFILELOAD_FROMFILE,
8753
    DXFILELOAD_FROMRESOURCE,
8754
    DXFILELOAD_FROMMEMORY,
8755
    DXFILELOAD_INVALID_3,
8756
    DXFILELOAD_FROMSTREAM,
8757
    DXFILELOAD_INVALID_5,
8758
    DXFILELOAD_INVALID_6,
8759
    DXFILELOAD_INVALID_7,
8760
    DXFILELOAD_FROMURL
8761
  );
8762
 
8763
  PDXFileLoadResource = ^TDXFileLoadResource;
8764
  TDXFileLoadResource = packed record
8765
    hModule: HModule;
8766
    lpName: PAnsiChar;
8767
    lpType: PAnsiChar;
8768
  end;
8769
 
8770
  PDXFileLoadMemory = ^TDXFileLoadMemory;
8771
  TDXFileLoadMemory = packed record
8772
    lpMemory: Pointer;
8773
    dSize: DWORD;
8774
  end;
8775
 
8776
(*
8777
 * DirectX File object types.
8778
 *)
8779
 
8780
  IDirectXFile = interface;
8781
  IDirectXFileEnumObject = interface;
8782
  IDirectXFileSaveObject = interface;
8783
  IDirectXFileObject = interface;
8784
  IDirectXFileData = interface;
8785
  IDirectXFileDataReference = interface;
8786
  IDirectXFileBinary = interface;
8787
 
8788
(*
8789
 * DirectX File interfaces.
8790
 *)
8791
 
8792
  IDirectXFile = interface (IUnknown)
8793
    ['{3d82ab40-62da-11cf-ab39-0020af71e433}']
8794
    function CreateEnumObject (pvSource: Pointer;
8795
        dwLoadOptions: TDXFileLoadOptions;
8796
        var ppEnumObj: IDirectXFileEnumObject) : HResult; stdcall;
8797
    function CreateSaveObject (szFileName: PChar; dwFileFormat: TDXFileFormat;
8798
        var ppSaveObj: IDirectXFileSaveObject) : HResult; stdcall;
8799
    function RegisterTemplates (pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
8800
  end;
8801
 
8802
  IDirectXFileEnumObject = interface (IUnknown)
8803
    ['{3d82ab41-62da-11cf-ab39-0020af71e433}']
8804
    function GetNextDataObject (var ppDataObj: IDirectXFileData) : HResult; stdcall;
8805
    function GetDataObjectById
8806
        (const rguid: TGUID; var ppDataObj: IDirectXFileData) : HResult; stdcall;
8807
    function GetDataObjectByName
8808
        (szName: PChar; var ppDataObj: IDirectXFileData) : HResult; stdcall;
8809
  end;
8810
 
8811
  IDirectXFileSaveObject = interface (IUnknown)
8812
    ['{3d82ab42-62da-11cf-ab39-0020af71e433}']
8813
    function SaveTemplates
8814
        (cTemplates: DWORD; var ppguidTemplates: PGUID) : HResult; stdcall;
8815
    function CreateDataObject (const rguidTemplate: TGUID; szName: PChar;
8816
        pguid: PGUID; cbSize: DWORD; pvData: Pointer;
8817
        var ppDataObj: IDirectXFileData) : HResult; stdcall;
8818
    function SaveData (pDataObj: IDirectXFileData) : HResult; stdcall;
8819
  end;
8820
 
8821
  IDirectXFileObject = interface (IUnknown)
8822
    ['{3d82ab43-62da-11cf-ab39-0020af71e433}']
8823
    function GetName (pstrNameBuf: PChar; var dwBufLen: DWORD) : HResult; stdcall;
8824
    function GetId (var pGuidBuf: TGUID) : HResult; stdcall;
8825
  end;
8826
 
8827
  IDirectXFileData = interface (IDirectXFileObject)
8828
    ['{3d82ab44-62da-11cf-ab39-0020af71e433}']
8829
    function GetData
8830
        (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer) : HResult; stdcall;
8831
    function GetType (var ppguid: PGUID) : HResult; stdcall;
8832
    function GetNextObject (var ppChildObj: IDirectXFileObject) : HResult; stdcall;
8833
    function AddDataObject (pDataObj: IDirectXFileData) : HResult; stdcall;
8834
    function AddDataReference (szRef: PChar; pguidRef: PGUID) : HResult; stdcall;
8835
    function AddBinaryObject (szName: PChar; pguid: PGUID; szMimeType: PChar;
8836
        pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
8837
  end;
8838
 
8839
  IDirectXFileDataReference = interface (IDirectXFileObject)
8840
    ['{3d82ab45-62da-11cf-ab39-0020af71e433}']
8841
    function Resolve (var ppDataObj: IDirectXFileData) : HResult; stdcall;
8842
  end;
8843
 
8844
  IDirectXFileBinary = interface (IDirectXFileObject)
8845
    ['{3d82ab46-62da-11cf-ab39-0020af71e433}']
8846
    function GetSize (var pcbSize: DWORD) : HResult; stdcall;
8847
    function GetMimeType (var pszMimeType: PChar) : HResult; stdcall;
8848
    function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}) : HResult; stdcall;
8849
  end;
8850
 
8851
const
8852
 
8853
(*
8854
 * DirectXFile Object Class Id (for CoCreateInstance())
8855
 *)
8856
 
8857
   CLSID_CDirectXFile: TGUID =
8858
       (D1:$4516ec43;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
8859
 
8860
(*
8861
 * DirectX File Interface GUIDs.
8862
 *)
8863
 
8864
type
8865
  IID_IDirectXFile = IDirectXFile;
8866
  IID_IDirectXFileEnumObject = IDirectXFileEnumObject;
8867
  IID_IDirectXFileSaveObject = IDirectXFileSaveObject;
8868
  IID_IDirectXFileObject = IDirectXFileObject;
8869
  IID_IDirectXFileData = IDirectXFileData;
8870
  IID_IDirectXFileDataReference = IDirectXFileDataReference;
8871
  IID_IDirectXFileBinary = IDirectXFileBinary;
8872
 
8873
(*
8874
 * DirectX File Header template's GUID.
8875
 *)
8876
const
8877
  TID_DXFILEHeader: TGUID =
8878
      (D1:$3d82ab43;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
8879
 
8880
(*
8881
 * DirectX File errors.
8882
 *)
8883
 
8884
const
8885
  DXFILE_OK = 0;
8886
 
8887
  DXFILEERR_BADOBJECT                 = MAKE_D3DHRESULT or 850;
8888
  DXFILEERR_BADVALUE                  = MAKE_D3DHRESULT or 851;
8889
  DXFILEERR_BADTYPE                   = MAKE_D3DHRESULT or 852;
8890
  DXFILEERR_BADSTREAMHANDLE           = MAKE_D3DHRESULT or 853;
8891
  DXFILEERR_BADALLOC                  = MAKE_D3DHRESULT or 854;
8892
  DXFILEERR_NOTFOUND                  = MAKE_D3DHRESULT or 855;
8893
  DXFILEERR_NOTDONEYET                = MAKE_D3DHRESULT or 856;
8894
  DXFILEERR_FILENOTFOUND              = MAKE_D3DHRESULT or 857;
8895
  DXFILEERR_RESOURCENOTFOUND          = MAKE_D3DHRESULT or 858;
8896
  DXFILEERR_URLNOTFOUND               = MAKE_D3DHRESULT or 859;
8897
  DXFILEERR_BADRESOURCE               = MAKE_D3DHRESULT or 860;
8898
  DXFILEERR_BADFILETYPE               = MAKE_D3DHRESULT or 861;
8899
  DXFILEERR_BADFILEVERSION            = MAKE_D3DHRESULT or 862;
8900
  DXFILEERR_BADFILEFLOATSIZE          = MAKE_D3DHRESULT or 863;
8901
  DXFILEERR_BADFILECOMPRESSIONTYPE    = MAKE_D3DHRESULT or 864;
8902
  DXFILEERR_BADFILE                   = MAKE_D3DHRESULT or 865;
8903
  DXFILEERR_PARSEERROR                = MAKE_D3DHRESULT or 866;
8904
  DXFILEERR_NOTEMPLATE                = MAKE_D3DHRESULT or 867;
8905
  DXFILEERR_BADARRAYSIZE              = MAKE_D3DHRESULT or 868;
8906
  DXFILEERR_BADDATAREFERENCE          = MAKE_D3DHRESULT or 869;
8907
  DXFILEERR_INTERNALERROR             = MAKE_D3DHRESULT or 870;
8908
  DXFILEERR_NOMOREOBJECTS             = MAKE_D3DHRESULT or 871;
8909
  DXFILEERR_BADINTRINSICS             = MAKE_D3DHRESULT or 872;
8910
  DXFILEERR_NOMORESTREAMHANDLES       = MAKE_D3DHRESULT or 873;
8911
  DXFILEERR_NOMOREDATA                = MAKE_D3DHRESULT or 874;
8912
  DXFILEERR_BADCACHEFILE              = MAKE_D3DHRESULT or 875;
8913
  DXFILEERR_NOINTERNET                = MAKE_D3DHRESULT or 876;
8914
 
8915
{$IFDEF D3DRM}
8916
(*
8917
 * API for creating IDirectXFile interface.
8918
 *)
8919
 
8920
var
8921
  DirectXFileCreate : function
8922
    (out lplpDirectXFile: IDirectXFile) : HResult; stdcall;
8923
 
8924
(* D3DRM XFile templates in binary form *)
8925
const
8926
  D3DRM_XTEMPLATE_BYTES = 3215;
8927
  D3DRM_XTEMPLATES: array [0..D3DRM_XTEMPLATE_BYTES-1] of byte = (
8928
        $78, $6f, $66, $20, $30, $33, $30, $32, $62,
8929
        $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
8930
        0, $6, 0, 0, 0, $48, $65, $61, $64, $65,
8931
        $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
8932
        $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
8933
        $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
8934
        $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0,
8935
        $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
8936
        0, $29, 0, $1, 0, $5, 0, 0, 0, $66,
8937
        $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
8938
        $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
8939
        $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
8940
        $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71,
8941
        $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
8942
        $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0,
8943
        0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
8944
        0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1,
8945
        0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
8946
        $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2,
8947
        $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
8948
        $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0,
8949
        0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
8950
        0, 0, $76, $14, 0, $b, 0, $1f, 0, $1,
8951
        0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
8952
        $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f,
8953
        $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
8954
        $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0,
8955
        $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
8956
        $e, 0, $3, 0, $10, 0, 0, 0, $f, 0,
8957
        $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
8958
        0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
8959
        $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
8960
        $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94,
8961
        $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
8962
        $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0,
8963
        0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
8964
        0, $1, 0, $4, 0, 0, 0, $62, $6c, $75,
8965
        $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
8966
        0, $61, $6c, $70, $68, $61, $14, 0, $b, 0,
8967
        $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
8968
        $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0,
8969
        $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
8970
        0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0,
8971
        $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
8972
        0, $1, 0, $5, 0, 0, 0, $67, $72, $65,
8973
        $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
8974
        0, 0, $62, $6c, $75, $65, $14, 0, $b, 0,
8975
        $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
8976
        $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72,
8977
        $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
8978
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
8979
        $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
8980
        $64, $65, $78, $14, 0, $1, 0, $9, 0, 0,
8981
        0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
8982
        $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65,
8983
        $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
8984
        $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f,
8985
        $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
8986
        $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0,
8987
        $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
8988
        0, 0, 0, $74, $72, $75, $65, $66, $61, $6c,
8989
        $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
8990
        $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61,
8991
        $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
8992
        $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33,
8993
        $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
8994
        $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0,
8995
        0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
8996
        0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0,
8997
        $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
8998
        0, $1, 0, $c, 0, 0, 0, $4d, $61, $74,
8999
        $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
9000
        0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf,
9001
        $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
9002
        0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65,
9003
        $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
9004
        0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f,
9005
        $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
9006
        $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f,
9007
        0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
9008
        $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0,
9009
        $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
9010
        $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0,
9011
        $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
9012
        $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0,
9013
        $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
9014
        $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab,
9015
        $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
9016
        $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0,
9017
        $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
9018
        0, $9, 0, 0, 0, $66, $61, $63, $65, $43,
9019
        $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
9020
        $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14,
9021
        0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
9022
        $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0,
9023
        0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
9024
        $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0,
9025
        0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
9026
        $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73,
9027
        $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
9028
        0, $e, 0, $12, 0, $12, 0, $12, 0, $f,
9029
        0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
9030
        0, $4d, $65, $73, $68, $46, $61, $63, $65, $a,
9031
        0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
9032
        $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
9033
        0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
9034
        $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e,
9035
        $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
9036
        0, $1, 0, $11, 0, 0, 0, $66, $61, $63,
9037
        $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
9038
        $69, $63, $65, $73, $e, 0, $1, 0, $12, 0,
9039
        0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
9040
        $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73,
9041
        $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
9042
        $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61,
9043
        $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
9044
        0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94,
9045
        $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
9046
        0, $f, 0, 0, 0, $6e, $46, $61, $63, $65,
9047
        $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
9048
        $14, 0, $34, 0, $1, 0, $9, 0, 0, 0,
9049
        $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
9050
        0, $e, 0, 0, 0, $66, $61, $63, $65, $57,
9051
        $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
9052
        0, $1, 0, $f, 0, 0, 0, $6e, $46, $61,
9053
        $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
9054
        $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
9055
        $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
9056
        $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f,
9057
        $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
9058
        $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
9059
        $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
9060
        0, $6e, $54, $65, $78, $74, $75, $72, $65, $43,
9061
        $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
9062
        0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
9063
        $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
9064
        $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72,
9065
        $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
9066
        $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f,
9067
        $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
9068
        $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65,
9069
        $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
9070
        $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f,
9071
        $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
9072
        $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0,
9073
        0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
9074
        $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0,
9075
        0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
9076
        $65, $78, $65, $73, $14, 0, $34, 0, $29, 0,
9077
        $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
9078
        $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1,
9079
        0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
9080
        $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14,
9081
        0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
9082
        $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b,
9083
        0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
9084
        $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73,
9085
        $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
9086
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
9087
        $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
9088
        $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0,
9089
        $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
9090
        $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f,
9091
        $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
9092
        0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c,
9093
        $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
9094
        0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f,
9095
        $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
9096
        0, $8, 0, 0, 0, $4d, $65, $73, $68, $46,
9097
        $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
9098
        $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
9099
        $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
9100
        $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
9101
        $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
9102
        $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65,
9103
        $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
9104
        $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78,
9105
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
9106
        $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56,
9107
        $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
9108
        $73, $14, 0, $34, 0, $1, 0, $c, 0, 0,
9109
        0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
9110
        $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76,
9111
        $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
9112
        $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e,
9113
        $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
9114
        $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
9115
        $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
9116
        $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62,
9117
        $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
9118
        $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56,
9119
        $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
9120
        0, $1, 0, $6, 0, 0, 0, $56, $65, $63,
9121
        $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
9122
        $65, $72, $74, $69, $63, $65, $73, $e, 0, $1,
9123
        0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
9124
        $69, $63, $65, $73, $f, 0, $14, 0, $29, 0,
9125
        $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
9126
        $65, $73, $14, 0, $34, 0, $1, 0, $8, 0,
9127
        0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
9128
        $1, 0, $5, 0, 0, 0, $66, $61, $63, $65,
9129
        $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
9130
        $46, $61, $63, $65, $73, $f, 0, $14, 0, $e,
9131
        0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
9132
        0, $1f, 0, $1, 0, $14, 0, 0, 0, $46,
9133
        $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
9134
        $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a,
9135
        0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
9136
        $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
9137
        0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
9138
        $78, $34, $78, $34, $1, 0, $b, 0, 0, 0,
9139
        $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
9140
        $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5,
9141
        0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
9142
        $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11,
9143
        $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
9144
        $12, 0, $12, 0, $12, 0, $f, 0, $b, 0,
9145
        $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
9146
        $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5,
9147
        0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
9148
        $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1,
9149
        0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
9150
        $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0,
9151
        $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
9152
        $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56,
9153
        $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
9154
        0, $1f, 0, $1, 0, $e, 0, 0, 0, $54,
9155
        $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
9156
        $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6,
9157
        $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
9158
        $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0,
9159
        0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
9160
        0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65,
9161
        $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
9162
        $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0,
9163
        $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
9164
        $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0,
9165
        $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
9166
        $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0,
9167
        $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
9168
        $79, $70, $65, $14, 0, $29, 0, $1, 0, $5,
9169
        0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
9170
        $34, 0, $1, 0, $e, 0, 0, 0, $54, $69,
9171
        $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
9172
        $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65,
9173
        $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
9174
        $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b,
9175
        0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
9176
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70,
9177
        $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
9178
        $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0,
9179
        $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
9180
        0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f,
9181
        $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
9182
        0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f,
9183
        $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
9184
        $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0,
9185
        $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
9186
        0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf,
9187
        $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
9188
        0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
9189
        0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
9190
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65,
9191
        $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
9192
        $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
9193
        $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
9194
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0,
9195
        $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
9196
        $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61,
9197
        $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
9198
        $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
9199
        $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
9200
        $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0,
9201
        $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
9202
        0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0,
9203
        $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
9204
        0, $1, 0, $5, 0, 0, 0, $6e, $55, $72,
9205
        $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
9206
        $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0,
9207
        $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
9208
        $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1,
9209
        0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
9210
        $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68,
9211
        $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
9212
        $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b,
9213
        $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
9214
        $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49,
9215
        $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
9216
        0, $b, 0, $1f, 0, $1, 0, $4, 0, 0,
9217
        0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
9218
        $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0,
9219
        $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
9220
        0, 0, 0, $64, $61, $74, $61, $31, $14, 0,
9221
        $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
9222
        $74, $61, $32, $14, 0, $28, 0, $1, 0, $5,
9223
        0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
9224
        $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0,
9225
        $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
9226
        0, 0, 0, $f, 0, $14, 0, $b, 0, $1f,
9227
        0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
9228
        $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74,
9229
        $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
9230
        $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72,
9231
        $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
9232
        $65, $79, $14, 0, $31, 0, $1, 0, $5, 0,
9233
        0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
9234
        0, $1f, 0, $1, 0, $b, 0, 0, 0, $50,
9235
        $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
9236
        $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf,
9237
        $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
9238
        $e, 0, $1, 0, $e, 0, 0, 0, $53, $74,
9239
        $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
9240
        $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0,
9241
        $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
9242
        $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0,
9243
        $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
9244
        $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0,
9245
        $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
9246
        $12, 0, 0, 0, $67, $75, $69, $64, $45, $78,
9247
        $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
9248
        $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0,
9249
        $12, 0, $f, 0, $b, 0);
9250
 
9251
//---------------
9252
 
9253
//Direct3DRM file
1 daniel-mar 9254
(*==========================================================================;
9255
 *
4 daniel-mar 9256
 *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
9257
 *
9258
 *  Files:      D3DRMDef.h D3DRMObj.h D3DRM.h D3DRMWin.h RMXFGUID.h RMXFTmpl.h
9259
 *  Content:    Direct3D Retained Mode include files
9260
 *
9261
 *  DirectX 7.0 Delphi adaptation by Erik Unger
9262
 *
9263
 *  Modified: 10-Sep-2000
9264
 *
9265
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
9266
 *  E-Mail: DelphiDirectX@next-reality.com
9267
 *
9268
 *
9269
 ***************************************************************************)
9270
 
9271
var
9272
  D3DRMDLL : HMODULE = 0;
9273
 
9274
(*==========================================================================;
9275
 *
1 daniel-mar 9276
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
9277
 *
9278
 *  File:       d3drmdef.h
9279
 *  Content:    Direct3DRM include file
9280
 *
9281
 ***************************************************************************)
9282
 
9283
type
9284
  PD3DRMVector4D = ^TD3DRMVector4D;
4 daniel-mar 9285
  TD3DRMVector4D = packed record
1 daniel-mar 9286
    x, y, z, w: TD3DValue;
9287
  end;
9288
 
4 daniel-mar 9289
  PD3DRMMatrix4D = ^TD3DRMMatrix4D;
9290
  TD3DRMMatrix4D = array [0..3, 0..3] of TD3DValue;
1 daniel-mar 9291
 
9292
  PD3DRMQuaternion = ^TD3DRMQuaternion;
4 daniel-mar 9293
  TD3DRMQuaternion = packed record
1 daniel-mar 9294
    s: TD3DValue;
9295
    v: TD3DVector;
9296
  end;
9297
 
9298
  PD3DRMRay = ^TD3DRMRay;
4 daniel-mar 9299
  TD3DRMRay = packed record
1 daniel-mar 9300
    dvDir: TD3DVector;
9301
    dvPos: TD3DVector;
9302
  end;
9303
 
9304
  PD3DRMBox = ^TD3DRMBox;
4 daniel-mar 9305
  TD3DRMBox = packed record
1 daniel-mar 9306
    min, max: TD3DVector;
9307
  end;
9308
 
4 daniel-mar 9309
  TD3DRMWrapCallback = procedure (var lpD3DVector: TD3DVector;
9310
      var lpU, lpV: Integer; var lpD3DRMVA, lpD3DRMVB: TD3DVector; lpArg:
9311
      Pointer); stdcall; // unused ?
1 daniel-mar 9312
 
4 daniel-mar 9313
  PD3DRMLightType = ^TD3DRMLightType; // is it 16 or 32 bit ?
1 daniel-mar 9314
  TD3DRMLightType = (
9315
    D3DRMLIGHT_AMBIENT,
9316
    D3DRMLIGHT_POINT,
9317
    D3DRMLIGHT_SPOT,
9318
    D3DRMLIGHT_DIRECTIONAL,
9319
    D3DRMLIGHT_PARALLELPOINT
9320
  );
9321
 
4 daniel-mar 9322
  PD3DRMShadeMode = ^TD3DRMShadeMode;
9323
  TD3DRMShadeMode = WORD;
1 daniel-mar 9324
 
9325
const
9326
  D3DRMSHADE_FLAT = 0;
9327
  D3DRMSHADE_GOURAUD = 1;
9328
  D3DRMSHADE_PHONG = 2;
9329
  D3DRMSHADE_MASK = 7;
9330
  D3DRMSHADE_MAX = 8;
9331
 
9332
type
4 daniel-mar 9333
  PD3DRMLightMode = ^TD3DRMLightMode;
9334
  TD3DRMLightMode = WORD;
1 daniel-mar 9335
 
9336
const
9337
  D3DRMLIGHT_OFF  = 0 * D3DRMSHADE_MAX;
9338
  D3DRMLIGHT_ON   = 1 * D3DRMSHADE_MAX;
9339
  D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX;
9340
  D3DRMLIGHT_MAX  = 8 * D3DRMSHADE_MAX;
9341
 
9342
type
4 daniel-mar 9343
  PD3DRMFillMode = ^TD3DRMFillMode;
9344
  TD3DRMFillMode = WORD;
1 daniel-mar 9345
 
9346
const
9347
  D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX;
9348
  D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX;
9349
  D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX;
9350
  D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX;
9351
  D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX;
9352
 
9353
type
4 daniel-mar 9354
  PD3DRMRenderQuality = ^TD3DRMRenderQuality;
1 daniel-mar 9355
  TD3DRMRenderQuality = DWORD;
9356
 
9357
const
4 daniel-mar 9358
  D3DRMRENDER_WIREFRAME   =
9359
      (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_WIREFRAME);
9360
  D3DRMRENDER_UNLITFLAT   =
9361
      (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_SOLID);
9362
  D3DRMRENDER_FLAT        =
9363
      (D3DRMSHADE_FLAT + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
9364
  D3DRMRENDER_GOURAUD     =
9365
      (D3DRMSHADE_GOURAUD + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
9366
  D3DRMRENDER_PHONG       =
9367
      (D3DRMSHADE_PHONG + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
1 daniel-mar 9368
 
4 daniel-mar 9369
  D3DRMRENDERMODE_BLENDEDTRANSPARENCY   =  1;
9370
  D3DRMRENDERMODE_SORTEDTRANSPARENCY    =  2;
9371
  D3DRMRENDERMODE_LIGHTINMODELSPACE     =  8;
9372
  D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR = 16;
1 daniel-mar 9373
 
9374
type
4 daniel-mar 9375
  PD3DRMTextureQuality = ^TD3DRMTextureQuality;
1 daniel-mar 9376
  TD3DRMTextureQuality = (
4 daniel-mar 9377
    D3DRMTEXTURE_NEAREST,               (* choose nearest texel *)
9378
    D3DRMTEXTURE_LINEAR,                (* interpolate 4 texels *)
9379
    D3DRMTEXTURE_MIPNEAREST,            (* nearest texel in nearest mipmap  *)
9380
    D3DRMTEXTURE_MIPLINEAR,             (* interpolate 2 texels from 2 mipmaps *)
9381
    D3DRMTEXTURE_LINEARMIPNEAREST,      (* interpolate 4 texels in nearest mipmap *)
9382
    D3DRMTEXTURE_LINEARMIPLINEAR        (* interpolate 8 texels from 2 mipmaps *)
1 daniel-mar 9383
  );
9384
 
9385
const
4 daniel-mar 9386
(*
9387
 * Texture flags
9388
 *)
9389
  D3DRMTEXTURE_FORCERESIDENT          = $00000001; (* texture should be kept in video memory *)
9390
  D3DRMTEXTURE_STATIC                 = $00000002; (* texture will not change *)
9391
  D3DRMTEXTURE_DOWNSAMPLEPOINT        = $00000004; (* point filtering should be used when downsampling *)
9392
  D3DRMTEXTURE_DOWNSAMPLEBILINEAR     = $00000008; (* bilinear filtering should be used when downsampling *)
9393
  D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH  = $00000010; (* reduce bit depth when downsampling *)
9394
  D3DRMTEXTURE_DOWNSAMPLENONE         = $00000020; (* texture should never be downsampled *)
9395
  D3DRMTEXTURE_CHANGEDPIXELS          = $00000040; (* pixels have changed *)
9396
  D3DRMTEXTURE_CHANGEDPALETTE         = $00000080; (* palette has changed *)
9397
  D3DRMTEXTURE_INVALIDATEONLY         = $00000100; (* dirty regions are invalid *)
1 daniel-mar 9398
 
4 daniel-mar 9399
(*
9400
 * Shadow flags
9401
 *)
9402
   D3DRMSHADOW_TRUEALPHA               = $00000001; (* shadow should render without artifacts when true alpha is on *)
1 daniel-mar 9403
 
9404
type
4 daniel-mar 9405
  PD3DRMCombineType = ^TD3DRMCombineType;
1 daniel-mar 9406
  TD3DRMCombineType = (
4 daniel-mar 9407
    D3DRMCOMBINE_REPLACE,
9408
    D3DRMCOMBINE_BEFORE,
9409
    D3DRMCOMBINE_AFTER
1 daniel-mar 9410
  );
9411
 
4 daniel-mar 9412
  PD3DRMColorModel = ^TD3DRMColorModel;
1 daniel-mar 9413
  TD3DRMColorModel = TD3DColorModel;
9414
 
4 daniel-mar 9415
  PD3DRMPaletteFlags = ^TD3DRMPaletteFlags;
1 daniel-mar 9416
  TD3DRMPaletteFlags = (
4 daniel-mar 9417
    D3DRMPALETTE_FREE,                  (* renderer may use this entry freely *)
9418
    D3DRMPALETTE_READONLY,              (* fixed but may be used by renderer *)
9419
    D3DRMPALETTE_RESERVED               (* may not be used by renderer *)
1 daniel-mar 9420
  );
9421
 
9422
  PD3DRMPaletteEntry = ^TD3DRMPaletteEntry;
4 daniel-mar 9423
  TD3DRMPaletteEntry = packed record
9424
    red: Byte;          (* 0 .. 255 *)
9425
    green: Byte;        (* 0 .. 255 *)
9426
    blue: Byte;         (* 0 .. 255 *)
9427
    flags: Byte;        (* one of D3DRMPALETTEFLAGS *)
1 daniel-mar 9428
  end;
9429
 
9430
  PD3DRMImage = ^TD3DRMImage;
4 daniel-mar 9431
  TD3DRMImage = packed record
1 daniel-mar 9432
    width, height: Integer;    (* width and height in pixels *)
9433
    aspectx, aspecty: Integer; (* aspect ratio for non-square pixels *)
9434
    depth: Integer;            (* bits per pixel *)
9435
    rgb: Integer;              (* if false, pixels are indices into a
9436
                                   palette otherwise, pixels encode
9437
                                   RGB values. *)
9438
    bytes_per_line: Integer;   (* number of bytes of memory for a
9439
                                   scanline. This must be a multiple
9440
                                   of 4. *)
9441
    buffer1: Pointer;          (* memory to render into (first buffer). *)
9442
    buffer2: Pointer;          (* second rendering buffer for double
9443
                                   buffering, set to NULL for single
9444
                                   buffering. *)
4 daniel-mar 9445
    red_mask: DWORD;
9446
    green_mask: DWORD;
9447
    blue_mask: DWORD;
9448
    alpha_mask: DWORD;        (* if rgb is true, these are masks for
1 daniel-mar 9449
                                   the red, green and blue parts of a
9450
                                   pixel.  Otherwise, these are masks
9451
                                   for the significant bits of the
9452
                                   red, green and blue elements in the
9453
                                   palette.  For instance, most SVGA
9454
                                   displays use 64 intensities of red,
9455
                                   green and blue, so the masks should
9456
                                   all be set to = $fc. *)
9457
    palette_size: Integer;     (* number of entries in palette *)
9458
    palette: PD3DRMPaletteEntry; (* description of the palette (only if
9459
                                   rgb is false).  Must be (1<<depth)
9460
                                   elements. *)
9461
  end;
9462
 
4 daniel-mar 9463
  PD3DRMWrapType = ^TD3DRMWrapType;
1 daniel-mar 9464
  TD3DRMWrapType = (
9465
    D3DRMWRAP_FLAT,
9466
    D3DRMWRAP_CYLINDER,
9467
    D3DRMWRAP_SPHERE,
9468
    D3DRMWRAP_CHROME,
9469
    D3DRMWRAP_SHEET,
9470
    D3DRMWRAP_BOX
9471
  );
9472
 
9473
const
4 daniel-mar 9474
  D3DRMWIREFRAME_CULL             = 1; (* cull backfaces *)
9475
  D3DRMWIREFRAME_HIDDENLINE       = 2; (* lines are obscured by closer objects *)
1 daniel-mar 9476
 
9477
type
4 daniel-mar 9478
(*
9479
 * Do not use righthanded perspective in Viewport2::SetProjection().
9480
 * Set up righthanded mode by using IDirect3DRM3::SetOptions().
9481
 *)
9482
  PD3DRMProjectionType = ^TD3DRMProjectionType;
1 daniel-mar 9483
  TD3DRMProjectionType = (
9484
    D3DRMPROJECT_PERSPECTIVE,
9485
    D3DRMPROJECT_ORTHOGRAPHIC,
4 daniel-mar 9486
    D3DRMPROJECT_RIGHTHANDPERSPECTIVE, (* Only valid pre-DX6 *)
9487
    D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC (* Only valid pre-DX6 *)
1 daniel-mar 9488
  );
9489
 
9490
const
4 daniel-mar 9491
  D3DRMOPTIONS_LEFTHANDED  = 00000001; (* Default *)
9492
  D3DRMOPTIONS_RIGHTHANDED = 00000002;
1 daniel-mar 9493
 
9494
type
4 daniel-mar 9495
  PD3DRMXOFFormat = ^TD3DRMXOFFormat;
1 daniel-mar 9496
  TD3DRMXOFFormat = (
9497
    D3DRMXOF_BINARY,
9498
    D3DRMXOF_COMPRESSED,
9499
    D3DRMXOF_TEXT
9500
  );
9501
 
9502
  TD3DRMSaveOptions = DWORD;
9503
const
9504
  D3DRMXOFSAVE_NORMALS = 1;
9505
  D3DRMXOFSAVE_TEXTURECOORDINATES = 2;
9506
  D3DRMXOFSAVE_MATERIALS = 4;
9507
  D3DRMXOFSAVE_TEXTURENAMES = 8;
9508
  D3DRMXOFSAVE_ALL = 15;
9509
  D3DRMXOFSAVE_TEMPLATES = 16;
9510
  D3DRMXOFSAVE_TEXTURETOPOLOGY = 32;
9511
 
9512
type
4 daniel-mar 9513
  PD3DRMColorSource = ^TD3DRMColorSource;
1 daniel-mar 9514
  TD3DRMColorSource = (
9515
    D3DRMCOLOR_FROMFACE,
9516
    D3DRMCOLOR_FROMVERTEX
9517
  );
9518
 
4 daniel-mar 9519
  PD3DRMFrameConstraint = ^TD3DRMFrameConstraint;
1 daniel-mar 9520
  TD3DRMFrameConstraint = (
4 daniel-mar 9521
    D3DRMCONSTRAIN_Z,           (* use only X and Y rotations *)
9522
    D3DRMCONSTRAIN_Y,           (* use only X and Z rotations *)
9523
    D3DRMCONSTRAIN_X            (* use only Y and Z rotations *)
1 daniel-mar 9524
  );
9525
 
4 daniel-mar 9526
  PD3DRMMaterialMode = ^TD3DRMMaterialMode;
1 daniel-mar 9527
  TD3DRMMaterialMode = (
9528
    D3DRMMATERIAL_FROMMESH,
9529
    D3DRMMATERIAL_FROMPARENT,
9530
    D3DRMMATERIAL_FROMFRAME
9531
  );
9532
 
4 daniel-mar 9533
  PD3DRMFogMode = ^TD3DRMFogMode;
1 daniel-mar 9534
  TD3DRMFogMode = (
4 daniel-mar 9535
    D3DRMFOG_LINEAR,            (* linear between start and end *)
9536
    D3DRMFOG_EXPONENTIAL,       (* density * exp(-distance) *)
9537
    D3DRMFOG_EXPONENTIALSQUARED (* density * exp(-distance*distance) *)
1 daniel-mar 9538
  );
9539
 
4 daniel-mar 9540
  PD3DRMZBufferMode = ^TD3DRMZBufferMode;
1 daniel-mar 9541
  TD3DRMZBufferMode = (
4 daniel-mar 9542
    D3DRMZBUFFER_FROMPARENT,    (* default *)
9543
    D3DRMZBUFFER_ENABLE,        (* enable zbuffering *)
9544
    D3DRMZBUFFER_DISABLE        (* disable zbuffering *)
1 daniel-mar 9545
  );
9546
 
4 daniel-mar 9547
  PD3DRMSortMode = ^TD3DRMSortMode;
1 daniel-mar 9548
  TD3DRMSortMode = (
4 daniel-mar 9549
    D3DRMSORT_FROMPARENT,       (* default *)
9550
    D3DRMSORT_NONE,             (* don't sort child frames *)
9551
    D3DRMSORT_FRONTTOBACK,      (* sort child frames front-to-back *)
9552
    D3DRMSORT_BACKTOFRONT       (* sort child frames back-to-front *)
1 daniel-mar 9553
  );
9554
 
4 daniel-mar 9555
  TD3DRMMaterialOverride = packed record
9556
    dwSize : DWORD;       (* Size of this structure *)
9557
    dwFlags : DWORD;      (* Indicate which fields are valid *)
9558
    dcDiffuse : TD3DColorValue;    (* RGBA *)
9559
    dcAmbient : TD3DColorValue;    (* RGB *)
9560
    dcEmissive : TD3DColorValue;   (* RGB *)
9561
    dcSpecular : TD3DColorValue;   (* RGB *)
9562
    dvPower : TD3DValue;
9563
    lpD3DRMTex : IUnknown;
1 daniel-mar 9564
  end;
9565
 
9566
const
9567
  D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY     = $00000001;
9568
  D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY       = $00000002;
9569
  D3DRMMATERIALOVERRIDE_DIFFUSE               = $00000003;
9570
  D3DRMMATERIALOVERRIDE_AMBIENT               = $00000004;
9571
  D3DRMMATERIALOVERRIDE_EMISSIVE              = $00000008;
9572
  D3DRMMATERIALOVERRIDE_SPECULAR              = $00000010;
9573
  D3DRMMATERIALOVERRIDE_POWER                 = $00000020;
9574
  D3DRMMATERIALOVERRIDE_TEXTURE               = $00000040;
9575
  D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY = $00000080;
9576
  D3DRMMATERIALOVERRIDE_ALL                   = $000000FF;
9577
 
4 daniel-mar 9578
  D3DRMFPTF_ALPHA                           = $00000001;
9579
  D3DRMFPTF_NOALPHA                         = $00000002;
9580
  D3DRMFPTF_PALETTIZED                      = $00000004;
9581
  D3DRMFPTF_NOTPALETTIZED                   = $00000008;
1 daniel-mar 9582
 
4 daniel-mar 9583
  D3DRMSTATECHANGE_UPDATEONLY               = $000000001;
9584
  D3DRMSTATECHANGE_VOLATILE                 = $000000002;
9585
  D3DRMSTATECHANGE_NONVOLATILE              = $000000004;
9586
  D3DRMSTATECHANGE_RENDER                   = $000000020;
9587
  D3DRMSTATECHANGE_LIGHT                    = $000000040;
1 daniel-mar 9588
 
4 daniel-mar 9589
(*
9590
 * Values for flags in RM3::CreateDeviceFromSurface
9591
 *)
9592
  D3DRMDEVICE_NOZBUFFER           = $00000001;
1 daniel-mar 9593
 
4 daniel-mar 9594
(*
9595
 * Values for flags in Object2::SetClientData
9596
 *)
9597
  D3DRMCLIENTDATA_NONE            = $00000001;
9598
  D3DRMCLIENTDATA_LOCALFREE       = $00000002;
9599
  D3DRMCLIENTDATA_IUNKNOWN        = $00000004;
1 daniel-mar 9600
 
4 daniel-mar 9601
(*
9602
 * Values for flags in Frame2::AddMoveCallback.
9603
 *)
9604
  D3DRMCALLBACK_PREORDER                = 0;
9605
  D3DRMCALLBACK_POSTORDER               = 1;
1 daniel-mar 9606
 
4 daniel-mar 9607
(*
9608
 * Values for flags in MeshBuilder2::RayPick.
9609
 *)
9610
  D3DRMRAYPICK_ONLYBOUNDINGBOXES        = 1;
9611
  D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES  = 2;
9612
  D3DRMRAYPICK_INTERPOLATEUV            = 4;
9613
  D3DRMRAYPICK_INTERPOLATECOLOR         = 8;
9614
  D3DRMRAYPICK_INTERPOLATENORMAL        = $10;
1 daniel-mar 9615
 
4 daniel-mar 9616
(*
9617
 * Values for flags in MeshBuilder3::AddFacesIndexed.
9618
 *)
9619
  D3DRMADDFACES_VERTICESONLY             = 1;
1 daniel-mar 9620
 
4 daniel-mar 9621
(*
9622
 * Values for flags in MeshBuilder2::GenerateNormals.
9623
 *)
9624
  D3DRMGENERATENORMALS_PRECOMPACT       = 1;
9625
  D3DRMGENERATENORMALS_USECREASEANGLE   = 2;
1 daniel-mar 9626
 
4 daniel-mar 9627
(*
9628
 * Values for MeshBuilder3::GetParentMesh
9629
 *)
9630
  D3DRMMESHBUILDER_DIRECTPARENT          = 1;
9631
  D3DRMMESHBUILDER_ROOTMESH              = 2;
1 daniel-mar 9632
 
4 daniel-mar 9633
(*
9634
 * Flags for MeshBuilder3::Enable
9635
 *)
9636
  D3DRMMESHBUILDER_RENDERENABLE   = $00000001;
9637
  D3DRMMESHBUILDER_PICKENABLE     = $00000002;
1 daniel-mar 9638
 
4 daniel-mar 9639
(*
9640
 * Flags for Object2::GetAge when used with MeshBuilders
9641
 *)
9642
  D3DRMMESHBUILDERAGE_GEOMETRY    = $00000001;
9643
  D3DRMMESHBUILDERAGE_MATERIALS   = $00000002;
9644
  D3DRMMESHBUILDERAGE_TEXTURES    = $00000004;
1 daniel-mar 9645
 
4 daniel-mar 9646
(*
9647
 * Format flags for MeshBuilder3::AddTriangles.
9648
 *)
9649
  D3DRMFVF_TYPE                   = $00000001;
9650
  D3DRMFVF_NORMAL                 = $00000002;
9651
  D3DRMFVF_COLOR                  = $00000004;
9652
  D3DRMFVF_TEXTURECOORDS          = $00000008;
1 daniel-mar 9653
 
4 daniel-mar 9654
  D3DRMVERTEX_STRIP               = $00000001;
9655
  D3DRMVERTEX_FAN                 = $00000002;
9656
  D3DRMVERTEX_LIST                = $00000004;
1 daniel-mar 9657
 
4 daniel-mar 9658
(*
9659
 * Values for flags in Viewport2::Clear2
9660
 *)
9661
  D3DRMCLEAR_TARGET               = $00000001;
9662
  D3DRMCLEAR_ZBUFFER              = $00000002;
9663
  D3DRMCLEAR_DIRTYRECTS           = $00000004;
9664
  D3DRMCLEAR_ALL                  = (D3DRMCLEAR_TARGET or
9665
                                         D3DRMCLEAR_ZBUFFER or
9666
                                         D3DRMCLEAR_DIRTYRECTS);
1 daniel-mar 9667
 
4 daniel-mar 9668
(*
9669
 * Values for flags in Frame3::SetSceneFogMethod
9670
 *)
9671
  D3DRMFOGMETHOD_VERTEX          = $00000001;
9672
  D3DRMFOGMETHOD_TABLE           = $00000002;
9673
  D3DRMFOGMETHOD_ANY             = $00000004;
1 daniel-mar 9674
 
4 daniel-mar 9675
(*
9676
 * Values for flags in Frame3::SetTraversalOptions
9677
 *)
9678
  D3DRMFRAME_RENDERENABLE        = $00000001;
9679
  D3DRMFRAME_PICKENABLE          = $00000002;
1 daniel-mar 9680
 
9681
type
9682
  TD3DRMAnimationOptions = DWORD;
9683
 
9684
const
4 daniel-mar 9685
  D3DRMANIMATION_OPEN = $01;
9686
  D3DRMANIMATION_CLOSED = $02;
9687
  D3DRMANIMATION_LINEARPOSITION = $04;
9688
  D3DRMANIMATION_SPLINEPOSITION = $08;
1 daniel-mar 9689
  D3DRMANIMATION_SCALEANDROTATION = $00000010;
4 daniel-mar 9690
  D3DRMANIMATION_POSITION = $00000020;
1 daniel-mar 9691
 
9692
type
9693
  TD3DRMInterpolationOptions = DWORD;
9694
const
4 daniel-mar 9695
  D3DRMINTERPOLATION_OPEN = $01;
9696
  D3DRMINTERPOLATION_CLOSED = $02;
9697
  D3DRMINTERPOLATION_NEAREST = $0100;
9698
  D3DRMINTERPOLATION_LINEAR = $04;
9699
  D3DRMINTERPOLATION_SPLINE = $08;
9700
  D3DRMINTERPOLATION_VERTEXCOLOR = $40;
1 daniel-mar 9701
  D3DRMINTERPOLATION_SLERPNORMALS = $80;
9702
 
9703
type
9704
  TD3DRMLoadOptions = DWORD;
9705
 
9706
const
9707
  D3DRMLOAD_FROMFILE  = $00;
9708
  D3DRMLOAD_FROMRESOURCE = $01;
9709
  D3DRMLOAD_FROMMEMORY = $02;
9710
  D3DRMLOAD_FROMSTREAM = $04;
9711
  D3DRMLOAD_FROMURL = $08;
9712
 
9713
  D3DRMLOAD_BYNAME = $10;
9714
  D3DRMLOAD_BYPOSITION = $20;
9715
  D3DRMLOAD_BYGUID = $40;
9716
  D3DRMLOAD_FIRST = $80;
9717
 
9718
  D3DRMLOAD_INSTANCEBYREFERENCE = $100;
9719
  D3DRMLOAD_INSTANCEBYCOPYING = $200;
9720
 
9721
  D3DRMLOAD_ASYNCHRONOUS = $400;
9722
 
9723
type
4 daniel-mar 9724
  PD3DRMLoadResource = ^TD3DRMLoadResource;
9725
  TD3DRMLoadResource = packed record
1 daniel-mar 9726
    hModule: HMODULE;
4 daniel-mar 9727
    lpName: PAnsiChar;
9728
    lpType: PAnsiChar;
1 daniel-mar 9729
  end;
9730
 
9731
  PD3DRMLoadMemory = ^TD3DRMLoadMemory;
4 daniel-mar 9732
  TD3DRMLoadMemory = packed record
1 daniel-mar 9733
    lpMemory: Pointer;
4 daniel-mar 9734
    dwSize: DWORD;
1 daniel-mar 9735
  end;
9736
 
9737
const
4 daniel-mar 9738
  D3DRMPMESHSTATUS_VALID = $01;
9739
  D3DRMPMESHSTATUS_INTERRUPTED = $02;
1 daniel-mar 9740
  D3DRMPMESHSTATUS_BASEMESHCOMPLETE = $04;
4 daniel-mar 9741
  D3DRMPMESHSTATUS_COMPLETE = $08;
9742
  D3DRMPMESHSTATUS_RENDERABLE = $10;
1 daniel-mar 9743
 
9744
  D3DRMPMESHEVENT_BASEMESH = $01;
9745
  D3DRMPMESHEVENT_COMPLETE = $02;
9746
 
9747
type
9748
  PD3DRMPMeshLoadStatus = ^TD3DRMPMeshLoadStatus;
4 daniel-mar 9749
  TD3DRMPMeshLoadStatus = packed record
9750
    dwSize,            // Size of this structure
9751
    dwPMeshSize,       // Total Size (bytes)
9752
    dwBaseMeshSize,    // Total Size of the Base Mesh
9753
    dwBytesLoaded,     // Total bytes loaded
9754
    dwVerticesLoaded,  // Number of vertices loaded
9755
    dwFacesLoaded : DWORD;     // Number of faces loaded
9756
    dwLoadResult : HResult;    // Result of the load operation
9757
    dwFlags : DWORD;
1 daniel-mar 9758
  end;
9759
 
4 daniel-mar 9760
  PD3DRMUserVisualReason = ^TD3DRMUserVisualReason;
1 daniel-mar 9761
  TD3DRMUserVisualReason = (
9762
    D3DRMUSERVISUAL_CANSEE,
9763
    D3DRMUSERVISUAL_RENDER
9764
  );
9765
 
4 daniel-mar 9766
  PD3DRMAnimationKey = ^TD3DRMAnimationKey;
9767
  TD3DRMAnimationKey = packed record
9768
    dwSize : DWORD;
9769
    dwKeyType : DWORD;
9770
    dvTime : TD3DValue;
9771
    dwID : DWORD;
9772
    case integer of
9773
 
9774
      1 : (dvScaleKey : TD3DVector);
9775
      2 : (dvPositionKey : TD3DVector);
9776
      3 : (dvK : array [0..3] of TD3DValue);
9777
    end;
1 daniel-mar 9778
 
4 daniel-mar 9779
procedure D3DRMAnimationGetRotateKey
9780
    (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
1 daniel-mar 9781
 
4 daniel-mar 9782
procedure D3DRMAnimationGetScaleKey
9783
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 9784
 
4 daniel-mar 9785
procedure D3DRMAnimationGetPositionKey
9786
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 9787
 
4 daniel-mar 9788
procedure D3DRMAnimatioSetRotateKey
9789
    (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
1 daniel-mar 9790
 
4 daniel-mar 9791
procedure D3DRMAnimationSetScaleKey
9792
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
1 daniel-mar 9793
 
4 daniel-mar 9794
procedure D3DRMAnimationSetPositionKey
9795
    (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
9796
 
1 daniel-mar 9797
const
4 daniel-mar 9798
  D3DRMANIMATION_ROTATEKEY = 01;
9799
  D3DRMANIMATION_SCALEKEY = 02;
9800
  D3DRMANIMATION_POSITIONKEY = 03;
1 daniel-mar 9801
 
9802
type
9803
  TD3DRMMapping = DWORD;
4 daniel-mar 9804
  PD3DRMMappingFlag = ^TD3DRMMappingFlag;
1 daniel-mar 9805
  TD3DRMMappingFlag = DWORD;
9806
 
9807
const
4 daniel-mar 9808
  D3DRMMAP_WRAPU = 1;
9809
  D3DRMMAP_WRAPV = 2;
1 daniel-mar 9810
  D3DRMMAP_PERSPCORRECT = 4;
9811
 
9812
type
9813
  PD3DRMVertex = ^TD3DRMVertex;
4 daniel-mar 9814
  TD3DRMVertex = packed record
1 daniel-mar 9815
    position: TD3DVector;
9816
    normal: TD3DVector;
9817
    tu, tv: TD3DValue;
9818
    color: TD3DColor;
9819
  end;
9820
 
4 daniel-mar 9821
  TD3DRMGroupIndex = LongInt; (* group indexes begin a 0 *)
1 daniel-mar 9822
 
9823
const
9824
  D3DRMGROUP_ALLGROUPS = -1;
9825
 
4 daniel-mar 9826
var
9827
(*
9828
 * Create a color from three components in the range 0-1 inclusive.
9829
 *)
9830
  D3DRMCreateColorRGB : function (red, green, blue: TD3DValue) : TD3DColor;
9831
      stdcall;
1 daniel-mar 9832
 
4 daniel-mar 9833
(*
9834
 * Create a color from four components in the range 0-1 inclusive.
9835
 *)
9836
  D3DRMCreateColorRGBA : function (red, green, blue, alpha: TD3DValue)
9837
      : TD3DColor; stdcall;
1 daniel-mar 9838
 
4 daniel-mar 9839
(*
9840
 * Get the red component of a color.
9841
 *)
9842
  D3DRMColorGetRed : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
1 daniel-mar 9843
 
4 daniel-mar 9844
(*
9845
 * Get the green component of a color.
9846
 *)
9847
  D3DRMColorGetGreen : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
1 daniel-mar 9848
 
4 daniel-mar 9849
(*
9850
 * Get the blue component of a color.
9851
 *)
9852
  D3DRMColorGetBlue : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
1 daniel-mar 9853
 
4 daniel-mar 9854
(*
9855
 * Get the alpha component of a color.
9856
 *)
9857
  D3DRMColorGetAlpha : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
1 daniel-mar 9858
 
4 daniel-mar 9859
(*
9860
 * Add two vectors.  Returns its first argument.
9861
 *)
9862
  D3DRMVectorAdd : function (var d, s1, s2: TD3DVector) : PD3DVector; stdcall;
1 daniel-mar 9863
 
4 daniel-mar 9864
(*
9865
 * Subtract two vectors.  Returns its first argument.
9866
 *)
9867
  D3DRMVectorSubtract : function (var d, s1, s2: TD3DVector) : PD3DVector;
9868
      stdcall;
1 daniel-mar 9869
 
4 daniel-mar 9870
(*
9871
 * Reflect a ray about a given normal.  Returns its first argument.
9872
 *)
9873
  D3DRMVectorReflect : function (var d, ray, norm: TD3DVector) : PD3DVector;
9874
      stdcall;
1 daniel-mar 9875
 
4 daniel-mar 9876
(*
9877
 * Calculate the vector cross product.  Returns its first argument.
9878
 *)
9879
  D3DRMVectorCrossProduct : function (var d, s1, s2: TD3DVector) : PD3DVector;
9880
      stdcall;
1 daniel-mar 9881
 
4 daniel-mar 9882
(*
9883
 * Return the vector dot product.
9884
 *)
9885
  D3DRMVectorDotProduct : function (var s1, s2: TD3DVector) : TD3DValue;
9886
      stdcall;
1 daniel-mar 9887
 
4 daniel-mar 9888
(*
9889
 * Scale a vector so that its modulus is 1.  Returns its argument or
9890
 * NULL if there was an error (e.g. a zero vector was passed).
9891
 *)
9892
  D3DRMVectorNormalize : function (var lpv: TD3DVector) : PD3DVector; stdcall;
1 daniel-mar 9893
 
4 daniel-mar 9894
(*
9895
 * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
9896
 *)
9897
  D3DRMVectorModulus : function (var v: TD3DVector) : TD3DValue; stdcall;
1 daniel-mar 9898
 
4 daniel-mar 9899
(*
9900
 * Set the rotation part of a matrix to be a rotation of theta radians
9901
 * around the given axis.
9902
 *)
9903
  D3DRMVectorRotate : function (var r, v, axis: TD3DVector; theta: TD3DValue) :
9904
      PD3DVector; stdcall;
1 daniel-mar 9905
 
4 daniel-mar 9906
(*
9907
 * Scale a vector uniformly in all three axes
9908
 *)
9909
  D3DRMVectorScale : function (var d, s: TD3DVector; factor: TD3DValue) :
9910
      PD3DVector; stdcall;
1 daniel-mar 9911
 
4 daniel-mar 9912
(*
9913
 * Return a random unit vector
9914
 *)
9915
  D3DRMVectorRandom : function (var d: TD3DVector) : PD3DVector; stdcall;
1 daniel-mar 9916
 
4 daniel-mar 9917
(*
9918
 * Returns a unit quaternion that represents a rotation of theta radians
9919
 * around the given axis.
9920
 *)
1 daniel-mar 9921
 
4 daniel-mar 9922
  D3DRMQuaternionFromRotation : function (var quat: TD3DRMQuaternion;
9923
      var v: TD3DVector; theta: TD3DValue) : PD3DRMQuaternion; stdcall;
1 daniel-mar 9924
 
4 daniel-mar 9925
(*
9926
 * Calculate the product of two quaternions
9927
 *)
9928
  D3DRMQuaternionMultiply : function (var q, a, b: TD3DRMQuaternion) :
9929
      PD3DRMQuaternion; stdcall;
1 daniel-mar 9930
 
4 daniel-mar 9931
(*
9932
 * Interpolate between two quaternions
9933
 *)
9934
  D3DRMQuaternionSlerp : function (var q, a, b: TD3DRMQuaternion;
9935
      alpha: TD3DValue) : PD3DRMQuaternion; stdcall;
1 daniel-mar 9936
 
4 daniel-mar 9937
(*
9938
 * Calculate the matrix for the rotation that a unit quaternion represents
9939
 *)
9940
  D3DRMMatrixFromQuaternion : procedure (dmMat: TD3DRMMatrix4D; var lpDqQuat:
9941
      TD3DRMQuaternion); stdcall;
1 daniel-mar 9942
 
4 daniel-mar 9943
(*
9944
 * Calculate the quaternion that corresponds to a rotation matrix
9945
 *)
9946
  D3DRMQuaternionFromMatrix : function (var lpQuat: TD3DRMQuaternion;
9947
      Mat: TD3DRMMatrix4D) : PD3DRMQuaternion; stdcall;
9948
 
1 daniel-mar 9949
(*==========================================================================;
9950
 *
9951
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
9952
 *
4 daniel-mar 9953
 *  File:       d3drmobj.h
1 daniel-mar 9954
 *  Content:    Direct3DRM include file
9955
 *
9956
 ***************************************************************************)
9957
 
4 daniel-mar 9958
(*
9959
 * Direct3DRM Object classes
9960
 *)
9961
 
1 daniel-mar 9962
const
4 daniel-mar 9963
  CLSID_CDirect3DRMDevice: TGUID =
9964
      (D1:$4fa3568e;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9965
  CLSID_CDirect3DRMViewport: TGUID =
9966
      (D1:$4fa3568f;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9967
  CLSID_CDirect3DRMFrame: TGUID =
9968
      (D1:$4fa35690;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9969
  CLSID_CDirect3DRMMesh: TGUID =
9970
      (D1:$4fa35691;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9971
  CLSID_CDirect3DRMMeshBuilder: TGUID =
9972
      (D1:$4fa35692;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9973
  CLSID_CDirect3DRMFace: TGUID =
9974
      (D1:$4fa35693;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9975
  CLSID_CDirect3DRMLight: TGUID =
9976
      (D1:$4fa35694;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9977
  CLSID_CDirect3DRMTexture: TGUID =
9978
      (D1:$4fa35695;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9979
  CLSID_CDirect3DRMWrap: TGUID =
9980
      (D1:$4fa35696;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9981
  CLSID_CDirect3DRMMaterial: TGUID =
9982
      (D1:$4fa35697;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9983
  CLSID_CDirect3DRMAnimation: TGUID =
9984
      (D1:$4fa35698;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9985
  CLSID_CDirect3DRMAnimationSet: TGUID =
9986
      (D1:$4fa35699;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9987
  CLSID_CDirect3DRMUserVisual: TGUID =
9988
      (D1:$4fa3569a;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9989
  CLSID_CDirect3DRMShadow: TGUID =
9990
      (D1:$4fa3569b;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
9991
  CLSID_CDirect3DRMViewportInterpolator: TGUID =
9992
      (D1:$0de9eaa1;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
9993
  CLSID_CDirect3DRMFrameInterpolator: TGUID =
9994
      (D1:$0de9eaa2;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
9995
  CLSID_CDirect3DRMMeshInterpolator: TGUID =
9996
      (D1:$0de9eaa3;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
9997
  CLSID_CDirect3DRMLightInterpolator: TGUID =
9998
      (D1:$0de9eaa6;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
9999
  CLSID_CDirect3DRMMaterialInterpolator: TGUID =
10000
      (D1:$0de9eaa7;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
10001
  CLSID_CDirect3DRMTextureInterpolator: TGUID =
10002
      (D1:$0de9eaa8;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
10003
  CLSID_CDirect3DRMProgressiveMesh: TGUID =
10004
      (D1:$4516ec40;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
10005
  CLSID_CDirect3DRMClippedVisual: TGUID =
10006
      (D1:$5434e72d;D2:$6d66;D3:$11d1;D4:($bb,$0b,$00,$00,$f8,$75,$86,$5a));
1 daniel-mar 10007
 
10008
 
10009
 
10010
type
10011
  IDirect3DRMObject = interface;
10012
  IDirect3DRMDevice = interface;
10013
  IDirect3DRMDevice2 = interface;
10014
  IDirect3DRMDevice3 = interface;
10015
  IDirect3DRMViewport = interface;
10016
  IDirect3DRMViewport2 = interface;
10017
  IDirect3DRMFrame = interface;
10018
  IDirect3DRMFrame2 = interface;
10019
  IDirect3DRMFrame3 = interface;
10020
  IDirect3DRMVisual = interface;
10021
  IDirect3DRMMesh = interface;
10022
  IDirect3DRMMeshBuilder = interface;
10023
  IDirect3DRMMeshBuilder2 = interface;
10024
  IDirect3DRMMeshBuilder3 = interface;
10025
  IDirect3DRMFace = interface;
10026
  IDirect3DRMFace2 = interface;
10027
  IDirect3DRMLight = interface;
10028
  IDirect3DRMTexture = interface;
10029
  IDirect3DRMTexture2 = interface;
10030
  IDirect3DRMTexture3 = interface;
10031
  IDirect3DRMWrap = interface;
10032
  IDirect3DRMMaterial = interface;
10033
  IDirect3DRMMaterial2 = interface;
10034
  IDirect3DRMAnimation = interface;
10035
  IDirect3DRMAnimation2 = interface;
10036
  IDirect3DRMAnimationSet = interface;
10037
  IDirect3DRMAnimationSet2 = interface;
4 daniel-mar 10038
  IDirect3DRMArray = interface;
1 daniel-mar 10039
  IDirect3DRMObjectArray = interface;
10040
  IDirect3DRMDeviceArray = interface;
10041
  IDirect3DRMViewportArray = interface;
10042
  IDirect3DRMFrameArray = interface;
10043
  IDirect3DRMVisualArray = interface;
4 daniel-mar 10044
  IDirect3DRMLightArray = interface;
1 daniel-mar 10045
  IDirect3DRMPickedArray = interface;
4 daniel-mar 10046
  IDirect3DRMFaceArray = interface;
10047
  IDirect3DRMAnimationArray = interface;
10048
  IDirect3DRMUserVisual = interface;
10049
  IDirect3DRMShadow = interface;
10050
  IDirect3DRMShadow2 = interface;
10051
  IDirect3DRMInterpolator = interface;
10052
  IDirect3DRMProgressiveMesh = interface;
1 daniel-mar 10053
  IDirect3DRMPicked2Array = interface;
10054
  IDirect3DRMClippedVisual = interface;
10055
 
4 daniel-mar 10056
(*
10057
 * Direct3DRM Object interfaces
10058
 *)
10059
  IID_IDirect3DRMObject =          IDirect3DRMObject;
10060
  IID_IDirect3DRMDevice =          IDirect3DRMDevice;
10061
  IID_IDirect3DRMDevice2 =         IDirect3DRMDevice2;
10062
  IID_IDirect3DRMDevice3 =         IDirect3DRMDevice3;
10063
  IID_IDirect3DRMViewport =        IDirect3DRMViewport;
10064
  IID_IDirect3DRMViewport2 =       IDirect3DRMViewport2;
10065
  IID_IDirect3DRMFrame =           IDirect3DRMFrame;
10066
  IID_IDirect3DRMFrame2 =          IDirect3DRMFrame2;
10067
  IID_IDirect3DRMFrame3 =          IDirect3DRMFrame3;
10068
  IID_IDirect3DRMVisual =          IDirect3DRMVisual;
10069
  IID_IDirect3DRMMesh =            IDirect3DRMMesh;
10070
  IID_IDirect3DRMMeshBuilder =     IDirect3DRMMeshBuilder;
10071
  IID_IDirect3DRMMeshBuilder2 =    IDirect3DRMMeshBuilder2;
10072
  IID_IDirect3DRMMeshBuilder3 =    IDirect3DRMMeshBuilder3;
10073
  IID_IDirect3DRMFace =            IDirect3DRMFace;
10074
  IID_IDirect3DRMFace2 =           IDirect3DRMFace2;
10075
  IID_IDirect3DRMLight =           IDirect3DRMLight;
10076
  IID_IDirect3DRMTexture =         IDirect3DRMTexture;
10077
  IID_IDirect3DRMTexture2 =        IDirect3DRMTexture2;
10078
  IID_IDirect3DRMTexture3 =        IDirect3DRMTexture3;
10079
  IID_IDirect3DRMWrap =            IDirect3DRMWrap;
10080
  IID_IDirect3DRMMaterial =        IDirect3DRMMaterial;
10081
  IID_IDirect3DRMMaterial2 =       IDirect3DRMMaterial2;
10082
  IID_IDirect3DRMAnimation =       IDirect3DRMAnimation;
10083
  IID_IDirect3DRMAnimation2 =      IDirect3DRMAnimation2;
10084
  IID_IDirect3DRMAnimationSet =    IDirect3DRMAnimationSet;
10085
  IID_IDirect3DRMAnimationSet2 =   IDirect3DRMAnimationSet2;
10086
  IID_IDirect3DRMObjectArray =     IDirect3DRMObjectArray;
10087
  IID_IDirect3DRMDeviceArray =     IDirect3DRMDeviceArray;
10088
  IID_IDirect3DRMViewportArray =   IDirect3DRMViewportArray;
10089
  IID_IDirect3DRMFrameArray =      IDirect3DRMFrameArray;
10090
  IID_IDirect3DRMVisualArray =     IDirect3DRMVisualArray;
10091
  IID_IDirect3DRMLightArray =      IDirect3DRMLightArray;
10092
  IID_IDirect3DRMPickedArray =     IDirect3DRMPickedArray;
10093
  IID_IDirect3DRMFaceArray =       IDirect3DRMFaceArray;
10094
  IID_IDirect3DRMAnimationArray =  IDirect3DRMAnimationArray;
10095
  IID_IDirect3DRMUserVisual =      IDirect3DRMUserVisual;
10096
  IID_IDirect3DRMShadow =          IDirect3DRMShadow;
10097
  IID_IDirect3DRMShadow2 =         IDirect3DRMShadow2;
10098
  IID_IDirect3DRMInterpolator =    IDirect3DRMInterpolator;
10099
  IID_IDirect3DRMProgressiveMesh = IDirect3DRMProgressiveMesh;
10100
  IID_IDirect3DRMPicked2Array =    IDirect3DRMPicked2Array;
10101
  IID_IDirect3DRMClippedVisual =   IDirect3DRMClippedVisual;
1 daniel-mar 10102
 
10103
 
10104
 
10105
 
10106
 
4 daniel-mar 10107
  PIDirect3DRMFaceArray = ^IDirect3DRMFaceArray;
1 daniel-mar 10108
 
4 daniel-mar 10109
  TD3DRMObjectCallback = procedure (lpD3DRMobj: IDirect3DRMObject;
10110
      lpArg: Pointer); cdecl;
10111
  TD3DRMFrameMoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame;
10112
      lpArg: Pointer; delta: TD3DValue); cdecl;
10113
  TD3DRMFrame3MoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame3;
10114
      lpArg: Pointer; delta: TD3DValue); cdecl;
10115
  TD3DRMUpdateCallback = procedure (lpobj: IDirect3DRMDevice; lpArg: Pointer;
10116
      iRectCount: Integer; const d3dRectUpdate: TD3DRect); cdecl;
10117
  TD3DRMDevice3UpdateCallback = procedure (lpobj: IDirect3DRMDevice3;
10118
      lpArg: Pointer; iRectCount: Integer; const d3dRectUpdate: TD3DRect);cdecl;
10119
  TD3DRMUserVisualCallback = function (lpD3DRMUV: IDirect3DRMUserVisual;
1 daniel-mar 10120
      lpArg: Pointer; lpD3DRMUVreason: TD3DRMUserVisualReason;
10121
      lpD3DRMDev: IDirect3DRMDevice;
4 daniel-mar 10122
      lpD3DRMview: IDirect3DRMViewport) : Integer; cdecl;
10123
  TD3DRMLoadTextureCallback = function (tex_name: PAnsiChar; lpArg: Pointer;
10124
      out lpD3DRMTex: IDirect3DRMTexture) : HResult; cdecl;
10125
  TD3DRMLoadTexture3Callback = function (tex_name: PAnsiChar; lpArg: Pointer;
10126
      out lpD3DRMTex: IDirect3DRMTexture3) : HResult; cdecl;
10127
  TD3DRMLoadCallback = procedure (lpObject: IDirect3DRMObject;
10128
      const ObjectGuid: TGUID; lpArg: Pointer); cdecl;
10129
  TD3DRMDownSampleCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
10130
      pArg: pointer; pDDSSrc, pDDSDst: IDirectDrawSurface) : HResult; cdecl;
10131
  TD3DRMValidationCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
10132
      pArg: pointer; dwFlags, DWcRects: DWORD; const pRects: TRect) : HResult; cdecl;
1 daniel-mar 10133
 
10134
  PD3DRMPickDesc = ^TD3DRMPickDesc;
4 daniel-mar 10135
  TD3DRMPickDesc = packed record
10136
    ulFaceIdx: DWORD;
10137
    lGroupIdx: LongInt;
1 daniel-mar 10138
    vPosition: TD3DVector;
10139
  end;
10140
 
10141
  PD3DRMPickDesc2 = ^TD3DRMPickDesc2;
4 daniel-mar 10142
  TD3DRMPickDesc2 = packed record
10143
    ulFaceIdx: DWORD;
10144
    lGroupIdx: LongInt;
1 daniel-mar 10145
    dvPosition: TD3DVector;
10146
    tu, tv: TD3DValue;
10147
    dvNormal: TD3DVector;
10148
    dcColor: TD3DColor;
10149
  end;
10150
 
4 daniel-mar 10151
(*
10152
 * Base class
10153
 *)
10154
{$IFDEF D2COM}
10155
  IDirect3DRMObject = class (IUnknown)
10156
{$ELSE}
10157
  IDirect3DRMObject = interface (IUnknown)
10158
    ['{eb16cb00-d271-11ce-ac48-0000c03825a1}']
10159
{$ENDIF}
10160
    (*
10161
     * The methods for IDirect3DRMObject
10162
     *)
10163
    function Clone (pUnkOuter: IUnknown; riid: TGUID;
10164
        var ppvObj: Pointer) : HResult; stdcall;
10165
    function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
10166
        lpArg: Pointer) : HResult; stdcall;
10167
    function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
10168
        lpArg: Pointer) : HResult; stdcall;
10169
    function SetAppData (ulData: DWORD) : HResult; stdcall;
1 daniel-mar 10170
    function GetAppData: DWORD; stdcall;
4 daniel-mar 10171
    function SetName (lpName: PAnsiChar) : HResult; stdcall;
10172
    function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
10173
    function GetClassName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
1 daniel-mar 10174
  end;
10175
 
4 daniel-mar 10176
  IDirect3DRMVisual = interface (IDirect3DRMObject)
1 daniel-mar 10177
  end;
10178
 
4 daniel-mar 10179
  IDirect3DRMDevice = interface (IDirect3DRMObject)
10180
    ['{e9e19280-6e05-11cf-ac4a-0000c03825a1}']
10181
    (*
10182
     * IDirect3DRMDevice methods
10183
     *)
10184
    function Init (width: LongInt; height: LongInt) : HResult; stdcall;
10185
    function InitFromD3D (lpD3D: IDirect3D; lpD3DIMDev: IDirect3DDevice) : HResult; stdcall;
10186
    function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
10187
        width: Integer; height: Integer) : HResult; stdcall;
1 daniel-mar 10188
    function Update: HResult; stdcall;
4 daniel-mar 10189
    function AddUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
10190
        arg: Pointer) : HResult; stdcall;
10191
    function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
10192
        arg: Pointer) : HResult; stdcall;
10193
    function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
1 daniel-mar 10194
    function GetBufferCount: DWORD; stdcall;
4 daniel-mar 10195
    function SetDither (bDither: BOOL) : HResult; stdcall;
10196
    function SetShades (ulShades: DWORD) : HResult; stdcall;
10197
    function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
10198
    function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
10199
    function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
1 daniel-mar 10200
    function GetDither: BOOL; stdcall;
10201
    function GetShades: DWORD; stdcall;
10202
    function GetHeight: DWORD; stdcall;
10203
    function GetWidth: DWORD; stdcall;
10204
    function GetTrianglesDrawn: DWORD; stdcall;
10205
    function GetWireframeOptions: DWORD; stdcall;
10206
    function GetQuality: TD3DRMRenderQuality; stdcall;
10207
    function GetColorModel: TD3DColorModel; stdcall;
10208
    function GetTextureQuality: TD3DRMTextureQuality; stdcall;
4 daniel-mar 10209
    function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
1 daniel-mar 10210
  end;
10211
 
4 daniel-mar 10212
  IDirect3DRMDevice2 = interface (IDirect3DRMDevice)
10213
    ['{4516ec78-8f20-11d0-9b6d-0000c0781bc3}']
10214
    (*
10215
     * IDirect3DRMDevice2 methods
10216
     *)
10217
    function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
10218
    function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw; lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
10219
    function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
10220
    function GetRenderMode : DWORD; stdcall;
10221
    function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
1 daniel-mar 10222
  end;
10223
 
4 daniel-mar 10224
  IDirect3DRMDevice3 = interface (IDirect3DRMObject)
10225
    ['{549f498b-bfeb-11d1-8ed8-00a0c967a482}']
10226
    (*
10227
     * IDirect3DRMDevice methods
10228
     *)
10229
    function Init (width: LongInt; height: LongInt) : HResult; stdcall;
10230
    function InitFromD3D (lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
10231
    function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
10232
        width: Integer; height: Integer) : HResult; stdcall;
10233
    function Update: HResult; stdcall;
10234
    function AddUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
10235
        arg: Pointer) : HResult; stdcall;
10236
    function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
10237
        arg: Pointer) : HResult; stdcall;
10238
    function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
10239
    function GetBufferCount: DWORD; stdcall;
10240
    function SetDither (bDither: BOOL) : HResult; stdcall;
10241
    function SetShades (ulShades: DWORD) : HResult; stdcall;
10242
    function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
10243
    function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
10244
    function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
10245
    function GetDither: BOOL; stdcall;
10246
    function GetShades: DWORD; stdcall;
10247
    function GetHeight: DWORD; stdcall;
10248
    function GetWidth: DWORD; stdcall;
10249
    function GetTrianglesDrawn: DWORD; stdcall;
10250
    function GetWireframeOptions: DWORD; stdcall;
10251
    function GetQuality: TD3DRMRenderQuality; stdcall;
10252
    function GetColorModel: TD3DColorModel; stdcall;
10253
    function GetTextureQuality: TD3DRMTextureQuality; stdcall;
10254
    function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
10255
    (*
10256
     * IDirect3DRMDevice2 methods
10257
     *)
10258
    function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
10259
    function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
10260
            lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
10261
    function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
10262
    function GetRenderMode : DWORD; stdcall;
10263
    function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
10264
    (*
10265
     * IDirect3DRMDevice3 methods
10266
     *)
10267
    function FindPreferredTextureFormat (dwBitDepths, dwFlags: DWORD;
10268
        out lpDDPF: TDDPixelFormat) : HResult; stdcall;
10269
    function RenderStateChange (dwStateNum, dwVal, dwFlags: DWORD) : HResult; stdcall;
10270
 
10271
    function LightStateChange (drsType: TD3DLightStateType; // defined different in header and help
10272
        dwVal, dwFlags: DWORD) : HResult; stdcall;
10273
    function GetStateChangeOptions (dwStateClass, dwStateNum: DWORD;
10274
        var pdwFlags: DWORD) : HResult; stdcall;
10275
    function SetStateChangeOptions ( dwStateClass, dwStateNum, dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 10276
  end;
10277
 
4 daniel-mar 10278
  IDirect3DRMViewport = interface (IDirect3DRMObject)
10279
    ['{eb16cb02-d271-11ce-ac48-0000c03825a1}']
10280
    (*
10281
     * IDirect3DRMViewport methods
10282
     *)
10283
    function Init (lpD3DRMDevice: IDirect3DRMDevice;
10284
        lpD3DRMFrameCamera: IDirect3DRMFrame; xpos, ypos,
10285
        width, height: DWORD) : HResult; stdcall;
1 daniel-mar 10286
    function Clear: HResult; stdcall;
4 daniel-mar 10287
    function Render (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
10288
    function SetFront (rvFront: TD3DValue) : HResult; stdcall;
10289
    function SetBack (rvBack: TD3DValue) : HResult; stdcall;
10290
    function SetField (rvField: TD3DValue) : HResult; stdcall;
10291
    function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
10292
    function SetCamera (lpCamera: IDirect3DRMFrame) : HResult; stdcall;
10293
    function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
10294
    function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
10295
    function InverseTransform (out lprvDst: TD3DVector;
10296
        const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
10297
    function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
10298
    function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
10299
    function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
10300
    function GetCamera (out lpCamera: IDirect3DRMFrame) : HResult; stdcall;
10301
    function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
10302
    function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
10303
        TD3DValue) : HResult; stdcall;
10304
    function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
10305
    function GetUniformScaling: BOOL;  stdcall;
10306
    function GetX: LongInt; stdcall;
10307
    function GetY: LongInt; stdcall;
1 daniel-mar 10308
    function GetWidth: DWORD; stdcall;
10309
    function GetHeight: DWORD; stdcall;
10310
    function GetField: TD3DValue; stdcall;
10311
    function GetBack: TD3DValue; stdcall;
10312
    function GetFront: TD3DValue; stdcall;
10313
    function GetProjection: TD3DRMProjectionType; stdcall;
4 daniel-mar 10314
    function GetDirect3DViewport (out lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
1 daniel-mar 10315
  end;
10316
 
4 daniel-mar 10317
  IDirect3DRMViewport2 = interface (IDirect3DRMObject)
10318
    ['{4a1b1be6-bfed-11d1-8ed8-00a0c967a482}']
10319
    (*
10320
     * IDirect3DRMViewport2 methods
10321
     *)
10322
    function Init (lpD3DRMDevice: IDirect3DRMDevice3;
10323
        lpD3DRMFrameCamera: IDirect3DRMFrame3; xpos, ypos,
10324
        width, height: DWORD) : HResult; stdcall;
10325
    function Clear (dwFlags: DWORD): HResult; stdcall;
10326
    function Render (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
10327
    function SetFront (rvFront: TD3DValue) : HResult; stdcall;
10328
    function SetBack (rvBack: TD3DValue) : HResult; stdcall;
10329
    function SetField (rvField: TD3DValue) : HResult; stdcall;
10330
    function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
10331
    function SetCamera (lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
10332
    function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
10333
    function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
10334
    function InverseTransform (out lprvDst: TD3DVector;
10335
        const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
10336
    function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
10337
    function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
10338
    function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
10339
    function GetCamera (out lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
10340
    function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
10341
    function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
10342
        TD3DValue) : HResult; stdcall;
10343
    function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
1 daniel-mar 10344
    function GetUniformScaling: BOOL; stdcall;
4 daniel-mar 10345
    function GetX: LongInt; stdcall;
10346
    function GetY: LongInt; stdcall;
1 daniel-mar 10347
    function GetWidth: DWORD; stdcall;
10348
    function GetHeight: DWORD; stdcall;
10349
    function GetField: TD3DValue; stdcall;
10350
    function GetBack: TD3DValue; stdcall;
10351
    function GetFront: TD3DValue; stdcall;
10352
    function GetProjection: TD3DRMProjectionType; stdcall;
4 daniel-mar 10353
    function GetDirect3DViewport (var lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
10354
    function TransformVectors (dwNumVectors: DWORD; out lpDstVectors:
10355
        TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
10356
    function InverseTransformVectors (dwNumVectors: DWORD; out lpDstVectors:
10357
        TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
1 daniel-mar 10358
  end;
10359
 
4 daniel-mar 10360
  IDirect3DRMFrame = interface (IDirect3DRMVisual)
10361
    ['{eb16cb03-d271-11ce-ac48-0000c03825a1}']
10362
    (*
10363
     * IDirect3DRMFrame methods
10364
     *)
10365
    function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame) : HResult; stdcall;
10366
    function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10367
    function AddMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
10368
        lpArg: Pointer) : HResult; stdcall;
10369
    function AddTransform (rctCombine: TD3DRMCombineType;
10370
        rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
10371
    function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
10372
        TD3DValue) : HResult; stdcall;
10373
    function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
10374
    function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
10375
        rvTheta: TD3DValue) : HResult; stdcall;
10376
    function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
10377
    function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
1 daniel-mar 10378
    function GetColor: TD3DColor; stdcall;
4 daniel-mar 10379
    function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
1 daniel-mar 10380
    function GetMaterialMode: TD3DRMMaterialMode; stdcall;
4 daniel-mar 10381
    function GetParent (out lplpParent: IDirect3DRMFrame) : HResult; stdcall;
10382
    function GetPosition (lpRef: IDirect3DRMFrame; out lprvPos: TD3DVector) : HResult; stdcall;
10383
    function GetRotation (lpRef: IDirect3DRMFrame; out lprvAxis: TD3DVector;
10384
        out lprvTheta: TD3DValue) : HResult; stdcall;
10385
    function GetScene (out lplpRoot: IDirect3DRMFrame) : HResult; stdcall;
1 daniel-mar 10386
    function GetSortMode: TD3DRMSortMode; stdcall;
4 daniel-mar 10387
    function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
10388
    function GetTransform (out rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
10389
    function GetVelocity (lpRef: IDirect3DRMFrame; var lprvVel: TD3DVector;
10390
        fRotVel: BOOL) : HResult; stdcall;
10391
    function GetOrientation (lpRef: IDirect3DRMFrame; var lprvDir: TD3DVector;
10392
        var lprvUp: TD3DVector) : HResult; stdcall;
10393
    function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
10394
    function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
10395
    function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
10396
    function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
1 daniel-mar 10397
        d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
4 daniel-mar 10398
        TD3DRMLoadTextureCallback; lpArgLTP: Pointer) : HResult; stdcall;
10399
    function LookAt (lpTarget, lpRef: IDirect3DRMFrame;
10400
        rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
10401
    function Move (delta: TD3DValue) : HResult; stdcall;
10402
    function DeleteChild (lpChild: IDirect3DRMFrame) : HResult; stdcall;
10403
    function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10404
    function DeleteMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
10405
        lpArg: Pointer) : HResult; stdcall;
10406
    function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
1 daniel-mar 10407
    function GetSceneBackground: TD3DColor; stdcall;
4 daniel-mar 10408
    function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
1 daniel-mar 10409
    function GetSceneFogColor: TD3DColor; stdcall;
10410
    function GetSceneFogEnable: BOOL; stdcall;
10411
    function GetSceneFogMode: TD3DRMFogMode; stdcall;
4 daniel-mar 10412
    function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
10413
    function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
10414
    function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
10415
    function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
10416
    function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture) : HResult; stdcall;
10417
    function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
10418
    function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
10419
    function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
10420
    function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
10421
    function SetColor (rcColor: TD3DColor) : HResult; stdcall;
10422
    function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
1 daniel-mar 10423
    function GetZbufferMode: TD3DRMZBufferMode; stdcall;
4 daniel-mar 10424
    function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
10425
    function SetOrientation (lpRef: IDirect3DRMFrame; rvDx, rvDy, rvDz, rvUx,
10426
        rvUy, rvUz: TD3DValue) : HResult; stdcall;
10427
    function SetPosition (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
10428
    function SetRotation (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ,
10429
        rvTheta: TD3DValue) : HResult; stdcall;
10430
    function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
10431
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
10432
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10433
    function SetVelocity (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue;
10434
        fRotVel: BOOL) : HResult; stdcall;
10435
    function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
10436
    function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
1 daniel-mar 10437
  end;
10438
 
4 daniel-mar 10439
  IDirect3DRMFrame2 = interface (IDirect3DRMFrame)
10440
    ['{c3dfbd60-3988-11d0-9ec2-0000c0291ac3}']
10441
    (*
10442
     * IDirect3DRMFrame2 methods
10443
     *)
10444
    function AddMoveCallback2 (d3drmFMC: TD3DRMFrameMoveCallback; lpArg:
10445
        Pointer; dwFlags: DWORD) : HResult; stdcall;
10446
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10447
    function GetBoxEnable : boolean; stdcall;
10448
    function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
10449
    function GetMaterial (out lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
10450
    function GetInheritAxes : boolean; stdcall;
10451
    function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10452
    function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10453
    function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
10454
    function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
10455
    function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
10456
    function SetMaterial (var lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
10457
    function SetQuaternion (lpRef: IDirect3DRMFrame;
10458
        const quat: TD3DRMQuaternion) : HResult; stdcall;
10459
    function RayPick (lpRefFrame: IDirect3DRMFrame; var ray: TD3DRMRay;
10460
        dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) :
10461
        HResult; stdcall;
10462
    function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
10463
        d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
1 daniel-mar 10464
  end;
10465
 
4 daniel-mar 10466
  IDirect3DRMFrame3 = interface (IDirect3DRMVisual)
10467
    ['{ff6b7f70-a40e-11d1-91f9-0000f8758e66}']
10468
    (*
10469
     * IDirect3DRMFrame3 methods
10470
     *)
10471
    function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame3) : HResult; stdcall;
10472
    function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10473
    function AddMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback;
10474
        lpArg: Pointer; dwFlags: DWORD) : HResult; stdcall;
10475
    function AddTransform (rctCombine: TD3DRMCombineType;
10476
        rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
10477
    function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
10478
        TD3DValue) : HResult; stdcall;
10479
    function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
10480
    function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
10481
        rvTheta: TD3DValue) : HResult; stdcall;
10482
    function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
10483
    function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
1 daniel-mar 10484
    function GetColor: TD3DColor; stdcall;
4 daniel-mar 10485
    function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
1 daniel-mar 10486
    function GetMaterialMode: TD3DRMMaterialMode; stdcall;
4 daniel-mar 10487
    function GetParent (out lplpParent: IDirect3DRMFrame3) : HResult; stdcall;
10488
    function GetPosition (lpRef: IDirect3DRMFrame3; out lprvPos: TD3DVector) : HResult; stdcall;
10489
    function GetRotation (lpRef: IDirect3DRMFrame3; out lprvAxis: TD3DVector;
10490
        out lprvTheta: TD3DValue) : HResult; stdcall;
10491
    function GetScene (out lplpRoot: IDirect3DRMFrame3) : HResult; stdcall;
1 daniel-mar 10492
    function GetSortMode: TD3DRMSortMode; stdcall;
4 daniel-mar 10493
    function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
10494
    function GetTransform (lpRefFrame: IDirect3DRMFrame3;
10495
        var rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
10496
    function GetVelocity (lpRef: IDirect3DRMFrame3; out lprvVel: TD3DVector;
10497
        fRotVel: BOOL) : HResult; stdcall;
10498
    function GetOrientation (lpRef: IDirect3DRMFrame3; out lprvDir: TD3DVector;
10499
        out lprvUp: TD3DVector) : HResult; stdcall;
10500
    function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
10501
    function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
10502
    function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
1 daniel-mar 10503
        d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
4 daniel-mar 10504
        TD3DRMLoadTexture3Callback; lpArgLTP: Pointer) : HResult; stdcall;
10505
    function LookAt (lpTarget, lpRef: IDirect3DRMFrame3;
10506
        rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
10507
    function Move (delta: TD3DValue) : HResult; stdcall;
10508
    function DeleteChild (lpChild: IDirect3DRMFrame3) : HResult; stdcall;
10509
    function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10510
    function DeleteMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback; lpArg: Pointer) : HResult; stdcall;
10511
    function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
1 daniel-mar 10512
    function GetSceneBackground: TD3DColor; stdcall;
4 daniel-mar 10513
    function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
1 daniel-mar 10514
    function GetSceneFogColor: TD3DColor; stdcall;
10515
    function GetSceneFogEnable: BOOL; stdcall;
10516
    function GetSceneFogMode: TD3DRMFogMode; stdcall;
4 daniel-mar 10517
    function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
10518
    function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
10519
    function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
10520
    function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
10521
    function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture3) : HResult; stdcall;
10522
    function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
10523
    function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
10524
    function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
10525
    function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
10526
    function SetColor (rcColor: TD3DColor) : HResult; stdcall;
10527
    function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
1 daniel-mar 10528
    function GetZbufferMode: TD3DRMZBufferMode; stdcall;
4 daniel-mar 10529
    function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
10530
    function SetOrientation (lpRef: IDirect3DRMFrame3; rvDx, rvDy, rvDz, rvUx,
10531
        rvUy, rvUz: TD3DValue) : HResult; stdcall;
10532
    function SetPosition (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue) :
10533
        HResult; stdcall;
10534
    function SetRotation (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ,
10535
        rvTheta: TD3DValue) : HResult; stdcall;
10536
    function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
10537
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
10538
    function SetVelocity (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue;
10539
        fRotVel: BOOL) : HResult; stdcall;
10540
    function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
10541
    function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
10542
 
10543
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10544
    function GetBoxEnable : boolean; stdcall;
10545
    function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
10546
    function GetMaterial (out lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
10547
    function GetInheritAxes : boolean; stdcall;
10548
    function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10549
    function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10550
    function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
10551
    function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
10552
    function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
10553
    function SetMaterial (var lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
10554
    function SetQuaternion (lpRef: IDirect3DRMFrame3;
10555
        const quat: TD3DRMQuaternion) : HResult; stdcall;
10556
    function RayPick (lpRefFrame: IDirect3DRMFrame3; var ray: TD3DRMRay;
10557
        dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) : HResult; stdcall;
10558
    function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
10559
        d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
10560
    function TransformVectors (lpRefFrame: IDirect3DRMFrame3;
10561
        dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
10562
        const lpSrcVectors: TD3DVector) : HResult; stdcall;
10563
    function InverseTransformVectors (lpRefFrame: IDirect3DRMFrame3;
10564
        dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
10565
        const lpSrcVectors: TD3DVector) : HResult; stdcall;
10566
    function SetTraversalOptions (dwFlags: DWORD) : HResult; stdcall;
10567
    function GetTraversalOptions (out lpdwFlags: DWORD) : HResult; stdcall;
10568
    function SetSceneFogMethod (dwFlags: DWORD) : HResult; stdcall;
10569
    function GetSceneFogMethod (out lpdwFlags: DWORD) : HResult; stdcall;
10570
    function SetMaterialOverride (
10571
        const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
10572
    function GetMaterialOverride (
10573
        const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
1 daniel-mar 10574
  end;
10575
 
4 daniel-mar 10576
 
10577
  IDirect3DRMMesh = interface (IDirect3DRMVisual)
10578
    ['{a3a80d01-6e12-11cf-ac4a-0000c03825a1}']
10579
    (*
10580
     * IDirect3DRMMesh methods
10581
     *)
10582
    function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
10583
    function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
10584
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10585
    function AddGroup (vCount, fCount, vPerFace: DWORD; var fData: DWORD;
10586
        var returnId: TD3DRMGroupIndex) : HResult; stdcall;
10587
    function SetVertices (id: TD3DRMGroupIndex; index, count: DWORD;
10588
        var values: TD3DRMVertex) : HResult; stdcall;
10589
    function SetGroupColor (id: TD3DRMGroupIndex; value: TD3DColor) : HResult; stdcall;
10590
    function SetGroupColorRGB (id: TD3DRMGroupIndex; red, green,
10591
        blue: TD3DValue) : HResult; stdcall;
10592
    function SetGroupMapping (id: TD3DRMGroupIndex;
10593
        value: TD3DRMMapping) : HResult; stdcall;
10594
    function SetGroupQuality (id: TD3DRMGroupIndex;
10595
        value: TD3DRMRenderQuality) : HResult; stdcall;
10596
    function SetGroupMaterial (id: TD3DRMGroupIndex; value:
10597
        IDirect3DRMMaterial) : HResult; stdcall;
10598
    function SetGroupTexture (id: TD3DRMGroupIndex; value: IDirect3DRMTexture) : HResult; stdcall;
1 daniel-mar 10599
    function GetGroupCount: DWORD; stdcall;
4 daniel-mar 10600
    function GetGroup (id: TD3DRMGroupIndex; vCount, fCount, vPerFace : PDWORD;
10601
        var fDataSize: DWORD; fData: PDWORD) : HResult; stdcall;
10602
    function GetVertices (id: TD3DRMGroupIndex; index, count : DWORD;
10603
        out returnPtr : TD3DRMVertex) : HResult; stdcall;
10604
    function GetGroupColor (id: TD3DRMGroupIndex) : TD3DColor; stdcall;
10605
    function GetGroupMapping (id: TD3DRMGroupIndex) : TD3DRMMapping; stdcall;
10606
    function GetGroupQuality (id: TD3DRMGroupIndex) : TD3DRMRenderQuality; stdcall;
10607
    function GetGroupMaterial (id: TD3DRMGroupIndex;
10608
        out returnPtr: IDirect3DRMMaterial) : HResult; stdcall;
10609
    function GetGroupTexture (id: TD3DRMGroupIndex;
10610
        out returnPtr: IDirect3DRMTexture) : HResult; stdcall;
1 daniel-mar 10611
  end;
10612
 
4 daniel-mar 10613
  IDirect3DRMProgressiveMesh = interface (IDirect3DRMVisual)
10614
    ['{4516ec79-8f20-11d0-9b6d-0000c0781bc3}']
10615
    (*
10616
     * IDirect3DRMProgressiveMesh methods
10617
     *)
10618
    function Load (lpSource, lpObjID: pointer; dloLoadflags : TD3DRMLoadOptions;
10619
        lpCallback: TD3DRMLoadTextureCallback; lpArg: pointer) : HResult; stdcall;
10620
    function GetLoadStatus (out lpStatus: TD3DRMPMeshLoadStatus) : HResult; stdcall;
10621
    function SetMinRenderDetail (d3dVal: TD3DValue) : HResult; stdcall;
10622
    function Abort (dwFlags: DWORD) : HResult; stdcall;
10623
    function GetFaceDetail (out lpdwCount: DWORD) : HResult; stdcall;
10624
    function GetVertexDetail (out lpdwCount: DWORD) : HResult; stdcall;
10625
    function SetFaceDetail (dwCount: DWORD) : HResult; stdcall;
10626
    function SetVertexDetail (dwCount: DWORD) : HResult; stdcall;
10627
    function GetFaceDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
10628
    function GetVertexDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
10629
    function GetDetail (out lpdvVal: TD3DValue) : HResult; stdcall;
10630
    function SetDetail (lpdvVal: TD3DValue) : HResult; stdcall;
10631
    function RegisterEvents (hEvent: THANDLE; dwFlags, dwReserved: DWORD) : HResult; stdcall;
10632
    function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
10633
    function Duplicate (out lplpD3DRMPMesh: IDirect3DRMProgressiveMesh) : HResult; stdcall;
10634
    function GetBox (out lpBBox: TD3DRMBox) : HResult; stdcall;
10635
    function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
10636
    function GetQuality (out lpdwquality: TD3DRMRenderQuality) : HResult; stdcall;
1 daniel-mar 10637
  end;
10638
 
4 daniel-mar 10639
  IDirect3DRMShadow = interface (IDirect3DRMVisual)
10640
    ['{af359780-6ba3-11cf-ac4a-0000c03825a1}']
10641
    (*
10642
     * IDirect3DRMShadow methods
10643
     *)
10644
    function Init (lpD3DRMVisual: IDirect3DRMVisual;
10645
        lpD3DRMLight: IDirect3DRMLight;
10646
        px, py, pz, nx, ny, nz: TD3DValue) : HResult; stdcall;
1 daniel-mar 10647
  end;
10648
 
4 daniel-mar 10649
  IDirect3DRMShadow2 = interface (IDirect3DRMShadow)
10650
    ['{86b44e25-9c82-11d1-bb0b-00a0c981a0a6}']
10651
    (*
10652
     * IDirect3DRMShadow2 methods
10653
     *)
10654
    function GetVisual (out lplpDirect3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
10655
    function SetVisual (lpDirect3DRMVisual: IDirect3DRMVisual;
10656
        dwFlags: DWORD) : HResult; stdcall;
10657
    function GetLight (out lplpDirect3DRMLight: IDirect3DRMLight) : HResult; stdcall;
10658
    function SetLight (lplpDirect3DRMLight: IDirect3DRMLight;
10659
        dwFlags: DWORD) : HResult; stdcall;
10660
    function GetPlane (
10661
        var pdvPX, pdvPY, pdvPZ, pdvNX, pdvNY, pdvNZ: TD3DValue) : HResult; stdcall;
10662
    function SetPlane (px, py, pz, nx, ny, nz: TD3DValue;
10663
        dwFlags: DWORD) : HResult; stdcall;
10664
    function GetOptions (out pdwOptions: DWORD) : HResult; stdcall;
10665
    function SetOptions (dwOptions: DWORD) : HResult; stdcall;
10666
 
1 daniel-mar 10667
  end;
10668
 
4 daniel-mar 10669
  IDirect3DRMFace = interface (IDirect3DRMObject)
10670
    ['{eb16cb07-d271-11ce-ac48-0000c03825a1}']
10671
    (*
10672
     * IDirect3DRMFace methods
10673
     *)
10674
    function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
10675
    function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
10676
    function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
10677
    function SetColor (color: TD3DColor) : HResult; stdcall;
10678
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
10679
    function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
10680
    function SetMaterial (lpMat: IDirect3DRMMaterial) : HResult; stdcall;
10681
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10682
    function GetVertex (index: DWORD; out lpPosition: TD3DVector;
10683
        out lpNormal: TD3DVector) : HResult; stdcall;
10684
    function GetVertices (var lpdwVertexCount: DWORD;
10685
        out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
10686
    function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
10687
    function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
10688
    function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
10689
    function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
10690
    function GetMaterial (out lpMat: IDirect3DRMMaterial) : HResult; stdcall;
10691
    function GetVertexCount: Integer; stdcall;
10692
    function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
10693
    function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
1 daniel-mar 10694
    function GetColor: TD3DColor; stdcall;
10695
  end;
10696
 
4 daniel-mar 10697
  IDirect3DRMFace2 = interface (IDirect3DRMObject)
10698
    ['{4516ec81-8f20-11d0-9b6d-0000c0781bc3}']
10699
    (*
10700
     * IDirect3DRMFace2 methods
10701
     *)
10702
    function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
10703
    function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
10704
    function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
10705
    function SetColor (color: TD3DColor) : HResult; stdcall;
10706
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
10707
    function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
10708
    function SetMaterial (lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
10709
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10710
    function GetVertex (index: DWORD; out lpPosition: TD3DVector;
10711
        out lpNormal: TD3DVector) : HResult; stdcall;
10712
    function GetVertices (var lpdwVertexCount: DWORD;
10713
        out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
10714
    function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
10715
    function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
10716
    function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
10717
    function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
10718
    function GetMaterial (out lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
10719
    function GetVertexCount: Integer; stdcall;
10720
    function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
10721
    function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
1 daniel-mar 10722
    function GetColor: TD3DColor; stdcall;
10723
  end;
10724
 
4 daniel-mar 10725
  IDirect3DRMMeshBuilder = interface (IDirect3DRMVisual)
10726
    ['{a3a80d02-6e12-11cf-ac4a-0000c03825a1}']
10727
    (*
10728
     * IDirect3DRMMeshBuilder methods
10729
     *)
10730
    function Load (lpvObjSource, lpvObjID: Pointer; d3drmLOFlags:
10731
        TD3DRMLoadOptions; d3drmLoadTextureProc: TD3DRMLoadTextureCallback;
10732
        lpvArg: Pointer) : HResult; stdcall;
10733
    function Save (lpFilename: PChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
10734
        d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
10735
    function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
10736
    function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
10737
    function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
10738
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10739
    function GenerateNormals : HResult; stdcall;
1 daniel-mar 10740
    function GetColorSource: TD3DRMColorSource; stdcall;
4 daniel-mar 10741
    function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
10742
    function AddMeshBuilder (lpD3DRMMeshBuild: IDirect3DRMMeshBuilder) : HResult; stdcall;
10743
    function AddFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
10744
    function AddFace (lpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
10745
    function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
10746
        normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
10747
        lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
10748
    function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
10749
    function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
10750
    function SetColor (color: TD3DColor) : HResult; stdcall;
10751
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
10752
    function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial) : HResult; stdcall;
10753
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10754
    function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
10755
    function SetPerspective (perspective: BOOL) : HResult; stdcall;
10756
    function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
10757
    function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
10758
    function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
10759
    function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
10760
    function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
10761
    function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
10762
    function GetVertices (var vcount: DWORD; var vertices : TD3DVector;
10763
        var ncount : DWORD;
10764
        var normals : TD3DVector;
10765
        var face_data_size, face_data : DWORD) : HResult; stdcall;
10766
    function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
10767
    function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
10768
    function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
10769
    function CreateFace (out lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
1 daniel-mar 10770
    function GetQuality: TD3DRMRenderQuality; stdcall;
10771
    function GetPerspective: BOOL; stdcall;
4 daniel-mar 10772
    function GetFaceCount: Integer; stdcall;
10773
    function GetVertexCount: Integer; stdcall;
10774
    function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
10775
    function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
1 daniel-mar 10776
  end;
10777
 
4 daniel-mar 10778
  IDirect3DRMMeshBuilder2 = interface (IDirect3DRMMeshBuilder)
10779
    ['{4516ec77-8f20-11d0-9b6d-0000c0781bc3}']
10780
    (*
10781
     * IDirect3DRMMeshBuilder2 methods
10782
     *)
10783
    function GenerateNormals2 (
10784
        dvCreaseAngle: TD3DValue; dwFlags: DWORD) : HResult; stdcall;
10785
    function GetFace (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
1 daniel-mar 10786
  end;
10787
 
4 daniel-mar 10788
  IDirect3DRMMeshBuilder3 = interface (IDirect3DRMVisual)
10789
    ['{ff6b7f71-a40e-11d1-91f9-0000f8758e66}']
10790
    (*
10791
     * IDirect3DRMMeshBuilder3 methods
10792
     *)
10793
    function Load (lpvObjSource, lpvObjID: Pointer;
10794
        d3drmLOFlags: TD3DRMLoadOptions;
10795
        d3drmLoadTextureProc: TD3DRMLoadTexture3Callback;
10796
        lpvArg: Pointer) : HResult; stdcall;
10797
    function Save (lpFilename: PAnsiChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
10798
        d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
10799
    function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
10800
    function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
10801
    function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
10802
    function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
10803
    function GenerateNormals (
10804
        dvCreaseAngle: TD3DValue; dwFlags: DWORD): HResult; stdcall;
1 daniel-mar 10805
    function GetColorSource: TD3DRMColorSource; stdcall;
4 daniel-mar 10806
    function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
10807
    function AddMeshBuilder (
10808
        lpD3DRMMeshBuild: IDirect3DRMMeshBuilder3) : HResult; stdcall;
10809
    function AddFrame (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
10810
    function AddFace (lpD3DRMFace: IDirect3DRMFace2) : HResult; stdcall;
10811
    function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
10812
        normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
10813
        lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
10814
    function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
10815
    function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
10816
    function SetColor (color: TD3DColor) : HResult; stdcall;
10817
    function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
10818
    function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial2) : HResult; stdcall;
10819
    function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
10820
    function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
10821
    function SetPerspective (perspective: BOOL) : HResult; stdcall;
10822
    function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
10823
    function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
10824
    function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
10825
    function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
10826
    function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
10827
    function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
10828
    function GetGeometry (var vcount: DWORD; var vertices : TD3DVector;
10829
        var ncount : DWORD; var normals : TD3DVector;
10830
        var face_data_size, face_data : DWORD) : HResult; stdcall;
10831
    function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
10832
    function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
10833
    function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
10834
    function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
1 daniel-mar 10835
    function GetQuality: TD3DRMRenderQuality; stdcall;
10836
    function GetPerspective: BOOL; stdcall;
4 daniel-mar 10837
    function GetFaceCount: Integer; stdcall;
10838
    function GetVertexCount: Integer; stdcall;
10839
    function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
10840
    function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
10841
    function GetFace
10842
        (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
10843
    function GetVertex (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
10844
    function GetNormal (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
10845
    function DeleteVertices (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
10846
    function DeleteNormals (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
10847
    function DeleteFace (lpFace: IDirect3DRMFace2) : HResult; stdcall;
10848
    function Empty (dwFlags: DWORD) : HResult; stdcall;
10849
    function Optimize (dwFlags: DWORD) : HResult; stdcall;
10850
    function AddFacesIndexed (dwFlags: DWORD; var lpdwvIndices: DWORD;
10851
        lpdwIndexFirst, lpdwCount: PDWORD) : HResult; stdcall;
10852
    function CreateSubMesh (out lplpUnk: IUnknown) : HResult; stdcall;
10853
    function GetParentMesh (dwFlags: DWORD; out lplpUnk: IUnknown) : HResult; stdcall;
10854
    function GetSubMeshes (lpdwCount: PDWORD; lpUnk: IUnknown) : HResult; stdcall;
10855
    function DeleteSubMesh (lplpUnk: IUnknown) : HResult; stdcall;
10856
    function Enable (dwFlags: DWORD) : HResult; stdcall;
10857
    function GetEnable (out lpdwFlags: DWORD) : HResult; stdcall;
10858
    function AddTriangles (dwFlags, dwFormat, dwVertexCount:  DWORD;
10859
        lpData: pointer) : HResult; stdcall;
10860
    function SetVertices
10861
        (dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
10862
    function GetVertices(dwFirst: DWORD; var lpdwCount: DWORD;
10863
        lpdvVector: PD3DVector) : HResult; stdcall;
10864
    function SetNormals(dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
10865
    function GetNormals (dwFirst: DWORD; lpdwCount: PDWORD;
10866
        var lpdvVector: TD3DVector) : HResult; stdcall;
10867
    function GetNormalCount : integer; stdcall;
1 daniel-mar 10868
  end;
10869
 
4 daniel-mar 10870
  IDirect3DRMLight = interface (IDirect3DRMObject)
10871
    ['{eb16cb08-d271-11ce-ac48-0000c03825a1}']
10872
    (*
10873
     * IDirect3DRMLight methods
10874
     *)
10875
    function SetType (d3drmtType: TD3DRMLightType) : HResult; stdcall;
10876
    function SetColor (rcColor: TD3DColor) : HResult; stdcall;
10877
    function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
10878
    function SetRange (rvRange: TD3DValue) : HResult; stdcall;
10879
    function SetUmbra (rvAngle: TD3DValue) : HResult; stdcall;
10880
    function SetPenumbra (rvAngle: TD3DValue) : HResult; stdcall;
10881
    function SetConstantAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
10882
    function SetLinearAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
10883
    function SetQuadraticAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
1 daniel-mar 10884
    function GetRange: TD3DValue; stdcall;
10885
    function GetUmbra: TD3DValue; stdcall;
10886
    function GetPenumbra: TD3DValue; stdcall;
10887
    function GetConstantAttenuation: TD3DValue; stdcall;
10888
    function GetLinearAttenuation: TD3DValue; stdcall;
10889
    function GetQuadraticAttenuation: TD3DValue; stdcall;
10890
    function GetColor: TD3DColor; stdcall;
10891
    function GetType: TD3DRMLightType; stdcall;
4 daniel-mar 10892
    function SetEnableFrame (lpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
10893
    function GetEnableFrame (out lplpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
1 daniel-mar 10894
  end;
10895
 
4 daniel-mar 10896
  IDirect3DRMTexture = interface (IDirect3DRMVisual)
10897
    ['{eb16cb09-d271-11ce-ac48-0000c03825a1}']
10898
    (*
10899
     * IDirect3DRMTexture methods
10900
     *)
10901
    function InitFromFile (filename: PAnsiChar) : HResult; stdcall;
10902
    function InitFromSurface (lpDDS: IDirectDrawSurface) : HResult; stdcall;
10903
    function InitFromResource (rs: HRSRC) : HResult; stdcall;
10904
    function Changed (bPixels, bPalette: BOOL) : HResult; stdcall;
10905
    function SetColors (ulColors: DWORD) : HResult; stdcall;
10906
    function SetShades (ulShades: DWORD) : HResult; stdcall;
10907
    function SetDecalSize (rvWidth, rvHeight: TD3DValue) : HResult; stdcall;
10908
    function SetDecalOrigin (lX, lY: LongInt) : HResult; stdcall;
10909
    function SetDecalScale (dwScale: DWORD) : HResult; stdcall;
10910
    function SetDecalTransparency (bTransp: BOOL) : HResult; stdcall;
10911
    function SetDecalTransparentColor (rcTransp: TD3DColor) : HResult; stdcall;
10912
    function GetDecalSize (out lprvWidth, lprvHeight: TD3DValue) : HResult; stdcall;
10913
    function GetDecalOrigin (out lplX, lplY: LongInt) : HResult; stdcall;
1 daniel-mar 10914
    function GetImage: PD3DRMImage; stdcall;
10915
    function GetShades: DWORD; stdcall;
10916
    function GetColors: DWORD; stdcall;
10917
    function GetDecalScale: DWORD; stdcall;
10918
    function GetDecalTransparency: BOOL; stdcall;
10919
    function GetDecalTransparentColor: TD3DColor; stdcall;
10920
  end;
10921
 
4 daniel-mar 10922
  IDirect3DRMTexture2 = interface (IDirect3DRMTexture)
10923
    ['{120f30c0-1629-11d0-941c-0080c80cfa7b}']
10924
    (*
10925
     * IDirect3DRMTexture2 methods
10926
     *)
10927
    function InitFromImage (const lpImage: TD3DRMImage) : HResult; stdcall;
10928
    function InitFromResource2 (hModule: HModule;
10929
        strName, strType: PAnsiChar) : HResult; stdcall;
10930
    function GenerateMIPMap (dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 10931
  end;
10932
 
4 daniel-mar 10933
  IDirect3DRMTexture3 = interface (IDirect3DRMTexture2)
10934
    ['{ff6b7f73-a40e-11d1-91f9-0000f8758e66}']
10935
    (*
10936
     * IDirect3DRMTexture3 methods
10937
     *)
10938
    function GetSurface
10939
        (dwFlags: DWORD; out lplpDDS: IDirectDrawSurface) : HResult; stdcall;
10940
    function SetCacheOptions (lImportance: integer; dwFlags: DWORD) : HResult; stdcall;
10941
    function GetCacheOptions (var lplImportance: integer; var lpdwFlags: DWORD) : HResult; stdcall;
10942
    function SetDownsampleCallback (
10943
        pCallback: TD3DRMDownSampleCallback; pArg: pointer) : HResult; stdcall;
10944
    function SetValidationCallback (
10945
        pCallback: TD3DRMValidationCallback; pArg: pointer) : HResult; stdcall;
1 daniel-mar 10946
  end;
10947
 
4 daniel-mar 10948
  IDirect3DRMWrap = interface (IDirect3DRMObject)
10949
    ['{eb16cb0a-d271-11ce-ac48-0000c03825a1}']
10950
    (*
10951
     * IDirect3DRMWrap methods
10952
     *)
10953
    function Init (d3drmwt: TD3DRMWrapType; lpd3drmfRef: IDirect3DRMFrame;
10954
        ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue)
10955
        : HResult; stdcall;
10956
    function Apply (lpObject: IDirect3DRMObject) : HResult; stdcall;
10957
    function ApplyRelative(frame: IDirect3DRMFrame; mesh: IDirect3DRMObject) : HResult; stdcall;
1 daniel-mar 10958
  end;
10959
 
4 daniel-mar 10960
  IDirect3DRMMaterial = interface (IDirect3DRMObject)
10961
    ['{eb16cb0b-d271-11ce-ac48-0000c03825a1}']
10962
    (*
10963
     * IDirect3DRMMaterial methods
10964
     *)
10965
    function SetPower (rvPower: TD3DValue) : HResult; stdcall;
10966
    function SetSpecular (r, g, b: TD3DValue) : HResult; stdcall;
10967
    function SetEmissive (r, g, b: TD3DValue) : HResult; stdcall;
1 daniel-mar 10968
    function GetPower: TD3DValue; stdcall;
4 daniel-mar 10969
    function GetSpecular (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
10970
    function GetEmissive (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
1 daniel-mar 10971
  end;
10972
 
4 daniel-mar 10973
  IDirect3DRMMaterial2 = interface (IDirect3DRMMaterial)
10974
    ['{ff6b7f75-a40e-11d1-91f9-0000f8758e66}']
10975
    (*
10976
     * IDirect3DRMMaterial2 methods
10977
     *)
10978
    function GetAmbient(out r,g,b: TD3DValue) : HResult; stdcall;
10979
    function SetAmbient(r,g,b: TD3DValue) : HResult; stdcall;
1 daniel-mar 10980
  end;
10981
 
4 daniel-mar 10982
  IDirect3DRMAnimation = interface (IDirect3DRMObject)
10983
    ['{eb16cb0d-d271-11ce-ac48-0000c03825a1}']
10984
    (*
10985
     * IDirect3DRMAnimation methods
10986
     *)
10987
    function SetOptions (d3drmanimFlags: TD3DRMAnimationOptions) : HResult; stdcall;
10988
    function AddRotateKey (rvTime: TD3DValue; const rqQuat: TD3DRMQuaternion) : HResult; stdcall;
10989
    function AddPositionKey (rvTime, rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
10990
    function AddScaleKey (time, x, y, z: TD3DValue) : HResult; stdcall;
10991
    function DeleteKey (time: TD3DValue) : HResult; stdcall;
10992
    function SetFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
10993
    function SetTime (rvTime: TD3DValue) : HResult; stdcall;
1 daniel-mar 10994
    function GetOptions: TD3DRMAnimationOptions; stdcall;
10995
  end;
10996
 
4 daniel-mar 10997
  IDirect3DRMAnimation2 = interface (IDirect3DRMAnimation)
10998
    ['{ff6b7f77-a40e-11d1-91f9-0000f8758e66}']
10999
    (*
11000
     * IDirect3DRMAnimation methods
11001
     *)
11002
    function GetFrame (out lpD3DFrame: IDirect3DRMFrame3) : HResult; stdcall;
11003
    function DeleteKeyByID (dwID: DWORD) : HResult; stdcall;
11004
    function AddKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
11005
    function ModifyKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
11006
    function GetKeys (dvTimeMin, dvTimeMax: TD3DValue; var lpdwNumKeys: DWORD;
11007
        lpKey: PD3DRMAnimationKey) : HResult; stdcall;
1 daniel-mar 11008
  end;
11009
 
4 daniel-mar 11010
  IDirect3DRMAnimationSet = interface (IDirect3DRMObject)
11011
    ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
11012
    (*
11013
     * IDirect3DRMAnimationSet methods
11014
     *)
11015
    function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
11016
    function Load (lpvObjSource, lpvObjID: Pointer;
11017
        d3drmLOFlags: TD3DRMLoadOptions;
1 daniel-mar 11018
        d3drmLoadTextureProc: TD3DRMLoadTextureCallback; lpArgLTP: Pointer;
4 daniel-mar 11019
        lpParentFrame: IDirect3DRMFrame) : HResult; stdcall;
11020
    function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
11021
    function SetTime (rvTime: TD3DValue) : HResult; stdcall;
1 daniel-mar 11022
  end;
11023
 
4 daniel-mar 11024
  IDirect3DRMAnimationSet2 = interface (IDirect3DRMObject)
11025
    ['{ff6b7f79-a40e-11d1-91f9-0000f8758e66}']
11026
    (*
11027
     * IDirect3DRMAnimationSet methods
11028
     *)
11029
    function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
11030
    function Load (lpvObjSource, lpvObjID: Pointer;
11031
        d3drmLOFlags: TD3DRMLoadOptions;
11032
        d3drmLoadTextureProc: TD3DRMLoadTexture3Callback; lpArgLTP: Pointer;
11033
        lpParentFrame: IDirect3DRMFrame3) : HResult; stdcall;
11034
    function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
11035
    function SetTime (rvTime: TD3DValue) : HResult; stdcall;
11036
    function GetAnimations(out lplpArray: IDirect3DRMAnimationArray) : HResult; stdcall;
1 daniel-mar 11037
  end;
11038
 
4 daniel-mar 11039
  IDirect3DRMUserVisual = interface (IDirect3DRMVisual)
11040
    ['{59163de0-6d43-11cf-ac4a-0000c03825a1}']
11041
    (*
11042
     * IDirect3DRMUserVisual methods
11043
     *)
11044
    function Init (d3drmUVProc: TD3DRMUserVisualCallback;
11045
        lpArg: Pointer) : HResult; stdcall;
1 daniel-mar 11046
  end;
11047
 
4 daniel-mar 11048
  IDirect3DRMArray = interface (IUnknown)
1 daniel-mar 11049
    function GetSize: DWORD; stdcall;
11050
    (* No GetElement method as it would get overloaded
11051
     * in derived classes, and overloading is
11052
     * a no-no in COM
11053
     *)
11054
  end;
11055
 
4 daniel-mar 11056
  IDirect3DRMObjectArray = interface (IDirect3DRMArray)
11057
        ['{242f6bc2-3849-11d0-9b6d-0000c0781bc3}']
11058
    function GetElement (index: DWORD; out lplpD3DRMObject:
11059
        IDirect3DRMObject) : HResult; stdcall;
1 daniel-mar 11060
  end;
11061
 
4 daniel-mar 11062
  IDirect3DRMDeviceArray = interface (IDirect3DRMArray)
11063
    ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
11064
    function GetElement (index: DWORD; out lplpD3DRMDevice:
11065
        IDirect3DRMDevice) : HResult; stdcall;
1 daniel-mar 11066
  end;
11067
 
4 daniel-mar 11068
  IDirect3DRMFrameArray = interface (IDirect3DRMArray)
11069
    ['{eb16cb12-d271-11ce-ac48-0000c03825a1}']
11070
    function GetElement (index: DWORD; out lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
1 daniel-mar 11071
  end;
11072
 
4 daniel-mar 11073
  IDirect3DRMViewportArray = interface (IDirect3DRMArray)
11074
    ['{eb16cb11-d271-11ce-ac48-0000c03825a1}']
11075
    function GetElement (index: DWORD; out lplpD3DRMViewport:
11076
        IDirect3DRMViewport) : HResult; stdcall;
1 daniel-mar 11077
  end;
11078
 
4 daniel-mar 11079
  IDirect3DRMVisualArray = interface (IDirect3DRMArray)
11080
    ['{eb16cb13-d271-11ce-ac48-0000c03825a1}']
11081
    function GetElement (index: DWORD; out lplpD3DRMVisual:
11082
        IDirect3DRMVisual) : HResult; stdcall;
1 daniel-mar 11083
  end;
11084
 
4 daniel-mar 11085
  IDirect3DRMAnimationArray = interface (IDirect3DRMArray)
11086
    ['{d5f1cae0-4bd7-11d1-b974-0060083e45f3}']
11087
    function GetElement (index: DWORD; out lplpD3DRMAnimation2:
11088
        IDirect3DRMAnimation2) : HResult; stdcall;
1 daniel-mar 11089
  end;
11090
 
4 daniel-mar 11091
  IDirect3DRMPickedArray = interface (IDirect3DRMArray)
11092
    ['{eb16cb16-d271-11ce-ac48-0000c03825a1}']
11093
    function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
1 daniel-mar 11094
        out lplpFrameArray: IDirect3DRMFrameArray;
4 daniel-mar 11095
        const lpD3DRMPickDesc: TD3DRMPickDesc) : HResult; stdcall;
11096
 
1 daniel-mar 11097
  end;
11098
 
4 daniel-mar 11099
  IDirect3DRMLightArray = interface (IDirect3DRMArray)
11100
    ['{eb16cb14-d271-11ce-ac48-0000c03825a1}']
11101
    function GetElement (index: DWORD; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
1 daniel-mar 11102
  end;
11103
 
4 daniel-mar 11104
 
11105
  IDirect3DRMFaceArray = interface (IDirect3DRMArray)
11106
    ['{eb16cb17-d271-11ce-ac48-0000c03825a1}']
11107
    function GetElement (index: DWORD; out lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
1 daniel-mar 11108
  end;
11109
 
4 daniel-mar 11110
  IDirect3DRMPicked2Array = interface (IDirect3DRMArray)
11111
    ['{4516ec7b-8f20-11d0-9b6d-0000c0781bc3}']
11112
    function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
11113
        out lplpFrameArray: IDirect3DRMFrameArray; const lpD3DRMPickDesc2:
11114
        TD3DRMPickDesc2) : HResult; stdcall;
1 daniel-mar 11115
  end;
11116
 
4 daniel-mar 11117
  IDirect3DRMInterpolator = interface (IDirect3DRMObject)
11118
    ['{242f6bc1-3849-11d0-9b6d-0000c0781bc3}']
11119
    (*
11120
     * IDirect3DRMInterpolator methods
11121
     *)
11122
    function AttachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
11123
    function GetAttachedObjects
11124
        (lpD3DRMObjectArray: IDirect3DRMObjectArray) : HResult; stdcall;
11125
    function DetachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
11126
    function SetIndex (d3dVal: TD3DValue) : HResult; stdcall;
11127
    function GetIndex : TD3DValue; stdcall;
11128
    function Interpolate (d3dVal: TD3DValue; lpD3DRMObject: IDirect3DRMObject;
11129
        d3drmInterpFlags: TD3DRMInterpolationOptions) : HResult; stdcall;
1 daniel-mar 11130
  end;
11131
 
4 daniel-mar 11132
  IDirect3DRMClippedVisual = interface (IDirect3DRMObject)
11133
    ['{5434e733-6d66-11d1-bb0b-0000f875865a}']
11134
    (*
11135
     * IDirect3DRMClippedVisual methods
11136
     *)
11137
    function Init (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
11138
    function AddPlane (lpRef: IDirect3DRMFrame3;
11139
        const lpdvPoint, lpdvNormal: TD3DVector;
11140
        dwFlags: DWORD; out lpdwReturnID: DWORD) : HResult; stdcall;
11141
    function DeletePlane (dwID, dwFlags: DWORD) : HResult; stdcall;
11142
    function GetPlaneIDs (var lpdwCount: DWORD; out lpdwID: DWORD; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 11143
    function GetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
4 daniel-mar 11144
        out lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 11145
    function SetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
4 daniel-mar 11146
        const lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 11147
  end;
11148
 
4 daniel-mar 11149
(*==========================================================================;
11150
 *
11151
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
11152
 *
11153
 *  File:       d3drm.h
11154
 *  Content:    Direct3DRM include file
11155
 *
11156
 ***************************************************************************)
1 daniel-mar 11157
 
4 daniel-mar 11158
function D3DRMErrorString(Value: HResult) : string;
11159
 
11160
//type
11161
  //TRefClsID = TGUID;
11162
 
11163
type
11164
  TD3DRMDevicePaletteCallback = procedure (lpDirect3DRMDev: IDirect3DRMDevice;
11165
      lpArg: Pointer; dwIndex: DWORD; red, green, blue: LongInt); cdecl;
11166
 
11167
(*
11168
 * Direct3DRM Object Class (for CoCreateInstance())
11169
 *)
11170
const
11171
  CLSID_CDirect3DRM: TGUID =
11172
      (D1:$4516ec41;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
11173
 
11174
type
11175
  IDirect3DRM = interface (IUnknown)
11176
    ['{2bc49361-8327-11cf-ac4a-0000c03825a1}']
11177
    function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
11178
        const riid: TGUID; out ppv) : HResult; stdcall;
11179
    function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame;
11180
        var lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
11181
    function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
11182
    function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
11183
        IDirect3DRMMeshBuilder) : HResult; stdcall;
11184
    function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
11185
    function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
11186
    function CreateAnimationSet (var lplpD3DRMAnimationSet:
11187
        IDirect3DRMAnimationSet) : HResult; stdcall;
11188
    function CreateTexture (var lpImage: TD3DRMImage;
11189
        var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
11190
    function CreateLight (d3drmltLightType: TD3DRMLightType;
11191
        cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11192
    function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
11193
        vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11194
    function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
11195
        IDirect3DRMMaterial) : HResult; stdcall;
11196
    function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
11197
        IDirect3DRMDevice) : HResult; stdcall;
11198
 
11199
    (* Create a Windows Device using DirectDraw surfaces *)
11200
    function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
11201
        lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice) :
11202
        HResult; stdcall;
11203
 
11204
      (* Create a Windows Device using D3D objects *)
11205
    function CreateDeviceFromD3D (lpD3D: IDirect3D; lpD3DDev: IDirect3DDevice;
11206
        var lplpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
11207
 
11208
    function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
11209
        lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
11210
        IDirect3DRMDevice) : HResult; stdcall;
11211
 
11212
    function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
11213
        var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
11214
 
11215
    function CreateShadow (lpVisual: IDirect3DRMVisual;
1 daniel-mar 11216
        lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
4 daniel-mar 11217
        var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
11218
    function CreateViewport (lpDev: IDirect3DRMDevice;
1 daniel-mar 11219
        lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
4 daniel-mar 11220
        var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
11221
    function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
1 daniel-mar 11222
        ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
4 daniel-mar 11223
        var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
11224
    function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
11225
        var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
11226
    function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
11227
        IDirect3DRMTexture) : HResult; stdcall;
11228
    function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
11229
        IDirect3DRMTexture) : HResult; stdcall;
11230
 
11231
    function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11232
    function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11233
    function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
11234
    function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
11235
    function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
11236
 
11237
    function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
11238
    function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
11239
 
11240
    function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
11241
 
11242
    function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
1 daniel-mar 11243
        dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
4 daniel-mar 11244
        TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
11245
        TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
11246
        IDirect3DRMFrame) : HResult; stdcall;
11247
    function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
1 daniel-mar 11248
  end;
11249
 
4 daniel-mar 11250
// Moved from D3DRMObj, to avoid circular unit reference:
11251
 
11252
  IDirect3DRMObject2 = interface (IUnknown)
11253
    ['{4516ec7c-8f20-11d0-9b6d-0000c0781bc3}']
11254
    (*
11255
     * IDirect3DRMObject2 methods
11256
     *)
11257
    function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
11258
        lpArg: Pointer) : HResult; stdcall;
11259
    function Clone (pUnkOuter: IUnknown; const riid: TGUID;
11260
        out ppvObj) : HResult; stdcall;
11261
    function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
11262
        lpArg: Pointer) : HResult; stdcall;
11263
    function GetClientData (dwID: DWORD; out lplpvData: Pointer) : HResult; stdcall;
11264
    function GetDirect3DRM (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
11265
    function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
11266
    function SetClientData (dwID: DWORD; lpvData: pointer; dwFlags: DWORD) : HResult; stdcall;
11267
    function SetName (lpName: PAnsiChar) : HResult; stdcall;
11268
    function GetAge (dwFlags: DWORD; out pdwAge: DWORD) : HResult; stdcall;
11269
  end;
11270
 
11271
  IID_IDirect3DRMObject2 = IDirect3DRMObject2;
11272
 
11273
  IDirect3DRM2 = interface (IUnknown)
11274
    ['{4516ecc8-8f20-11d0-9b6d-0000c0781bc3}']
11275
    function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
11276
        const riid: TGUID; out ppv) : HResult; stdcall;
11277
    function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame2;
11278
        var lplpD3DRMFrame: IDirect3DRMFrame2) : HResult; stdcall;
11279
    function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
11280
    function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
11281
        IDirect3DRMMeshBuilder2) : HResult; stdcall;
11282
    function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
11283
    function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
11284
    function CreateAnimationSet (var lplpD3DRMAnimationSet:
11285
        IDirect3DRMAnimationSet) : HResult; stdcall;
11286
    function CreateTexture (var lpImage: TD3DRMImage;
11287
        var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
11288
    function CreateLight (d3drmltLightType: TD3DRMLightType;
11289
        cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11290
    function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
11291
        vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11292
    function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
11293
        IDirect3DRMMaterial) : HResult; stdcall;
11294
    function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
11295
        IDirect3DRMDevice2) : HResult; stdcall;
11296
 
11297
    (* Create a Windows Device using DirectDraw surfaces *)
11298
    function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
11299
        lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice2) :
11300
        HResult; stdcall;
11301
 
11302
      (* Create a Windows Device using D3D objects *)
11303
    function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
11304
        var lplpD3DRMDevice: IDirect3DRMDevice2) : HResult; stdcall;
11305
 
11306
    function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
11307
        lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
11308
        IDirect3DRMDevice2) : HResult; stdcall;
11309
 
11310
    function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
11311
        var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
11312
 
11313
    function CreateShadow (lpVisual: IDirect3DRMVisual;
1 daniel-mar 11314
        lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
4 daniel-mar 11315
        var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
11316
    function CreateViewport (lpDev: IDirect3DRMDevice;
1 daniel-mar 11317
        lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
4 daniel-mar 11318
        var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
11319
    function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
1 daniel-mar 11320
        ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
4 daniel-mar 11321
        var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
11322
    function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
11323
        var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
11324
    function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
11325
        IDirect3DRMTexture2) : HResult; stdcall;
11326
    function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
11327
        IDirect3DRMTexture2) : HResult; stdcall;
11328
 
11329
    function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11330
    function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11331
    function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
11332
    function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
11333
    function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
11334
 
11335
    function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
11336
    function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject:
11337
        IDirect3DRMObject) : HResult; stdcall;
11338
 
11339
    function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
11340
 
11341
    function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
1 daniel-mar 11342
        dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
4 daniel-mar 11343
        TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
1 daniel-mar 11344
        TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
4 daniel-mar 11345
        IDirect3DRMFrame) : HResult; stdcall;
11346
    function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
11347
    function CreateProgressiveMesh (var lplpD3DRMProgressiveMesh:
11348
        IDirect3DRMProgressiveMesh) : HResult; stdcall;
1 daniel-mar 11349
  end;
11350
 
4 daniel-mar 11351
  IDirect3DRM3 = interface (IUnknown)
11352
    ['{4516ec83-8f20-11d0-9b6d-0000c0781bc3}']
11353
    function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
11354
        const riid: TGUID; out ppv) : HResult; stdcall;
11355
    function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame3;
11356
        out lplpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
11357
    function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
11358
    function CreateMeshBuilder (out lplpD3DRMMeshBuilder:
11359
        IDirect3DRMMeshBuilder3) : HResult; stdcall;
11360
    function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
11361
    function CreateAnimation (out lplpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
11362
    function CreateAnimationSet (out lplpD3DRMAnimationSet:
11363
        IDirect3DRMAnimationSet2) : HResult; stdcall;
11364
    function CreateTexture (const lpImage: TD3DRMImage;
11365
        out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
11366
    function CreateLight (d3drmltLightType: TD3DRMLightType;
11367
        cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11368
    function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
11369
        vGreen, vBlue: TD3DValue; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
11370
    function CreateMaterial (vPower: TD3DValue; out lplpD3DRMMaterial:
11371
        IDirect3DRMMaterial2) : HResult; stdcall;
11372
    function CreateDevice (dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
11373
        IDirect3DRMDevice3) : HResult; stdcall;
11374
 
11375
    (* Create a Windows Device using DirectDraw surfaces *)
11376
    function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
11377
        lpDDSBack: IDirectDrawSurface; dwFlags: DWORD;
11378
        out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
11379
 
11380
      (* Create a Windows Device using D3D objects *)
11381
    function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
11382
        out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
11383
 
11384
    function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
11385
        lpGUID: PGUID; width, height: Integer;
11386
        out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
11387
 
11388
    function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
11389
        out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
11390
 
11391
    function CreateShadow (pUnk: IUnknown; lpLight: IDirect3DRMLight;
11392
        px, py, pz, nx, ny, nz: TD3DValue;
11393
        out lplpShadow: IDirect3DRMShadow2) : HResult; stdcall;
11394
    function CreateViewport (lpDev: IDirect3DRMDevice3;
1 daniel-mar 11395
        lpCamera: IDirect3DRMFrame3; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
4 daniel-mar 11396
        out lplpD3DRMViewport: IDirect3DRMViewport2) : HResult; stdcall;
11397
    function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame3;
1 daniel-mar 11398
        ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
4 daniel-mar 11399
        out lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
11400
    function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
11401
        out lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
11402
    function LoadTexture (lpFileName: PAnsiChar; out lplpD3DRMTexture:
11403
        IDirect3DRMTexture3) : HResult; stdcall;
11404
    function LoadTextureFromResource (hModule: HMODULE;
11405
        strName, strType: PAnsiChar;
11406
        out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
1 daniel-mar 11407
 
4 daniel-mar 11408
    function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11409
    function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
11410
    function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
11411
    function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
11412
    function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
11413
 
11414
    function GetDevices (out lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
11415
    function GetNamedObject (lpName: PAnsiChar; out lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
11416
 
11417
    function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
11418
 
11419
    function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
1 daniel-mar 11420
        dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
4 daniel-mar 11421
        TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
1 daniel-mar 11422
        TD3DRMLoadTexture3Callback; lpArgLTP: Pointer; lpParentFrame:
4 daniel-mar 11423
        IDirect3DRMFrame3) : HResult; stdcall;
11424
    function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
11425
    function CreateProgressiveMesh (out lplpD3DRMProgressiveMesh:
11426
        IDirect3DRMProgressiveMesh) : HResult; stdcall;
11427
 
11428
    (* Used with IDirect3DRMObject2 *)
11429
    function RegisterClient (const rguid: TGUID; out lpdwID: DWORD) : HResult; stdcall;
11430
    function UnregisterClient (const rguid: TGUID) : HResult; stdcall;
11431
 
11432
    function CreateClippedVisual (lpVisual: IDirect3DRMVisual;
11433
        lpClippedVisual: IDirect3DRMClippedVisual) : HResult; stdcall;
11434
    function SetOptions (dwOptions: DWORD) : HResult; stdcall;
11435
    function GetOptions (out lpdwOptions: DWORD) : HResult; stdcall;
1 daniel-mar 11436
  end;
11437
 
4 daniel-mar 11438
  IID_IDirect3DRM =  IDirect3DRM;
11439
  IID_IDirect3DRM2 = IDirect3DRM2;
11440
  IID_IDirect3DRM3 = IDirect3DRM3;
11441
 
1 daniel-mar 11442
const
4 daniel-mar 11443
  MAKE_D3RMDHRESULT = HResult($88760000);
1 daniel-mar 11444
 
4 daniel-mar 11445
  D3DRM_OK                        = DD_OK;
11446
  D3DRMERR_BADOBJECT              = MAKE_D3RMDHRESULT + 781;
11447
  D3DRMERR_BADTYPE                = MAKE_D3RMDHRESULT + 782;
11448
  D3DRMERR_BADALLOC               = MAKE_D3RMDHRESULT + 783;
11449
  D3DRMERR_FACEUSED               = MAKE_D3RMDHRESULT + 784;
11450
  D3DRMERR_NOTFOUND               = MAKE_D3RMDHRESULT + 785;
11451
  D3DRMERR_NOTDONEYET             = MAKE_D3RMDHRESULT + 786;
11452
  D3DRMERR_FILENOTFOUND           = MAKE_D3RMDHRESULT + 787;
11453
  D3DRMERR_BADFILE                = MAKE_D3RMDHRESULT + 788;
11454
  D3DRMERR_BADDEVICE              = MAKE_D3RMDHRESULT + 789;
11455
  D3DRMERR_BADVALUE               = MAKE_D3RMDHRESULT + 790;
11456
  D3DRMERR_BADMAJORVERSION        = MAKE_D3RMDHRESULT + 791;
11457
  D3DRMERR_BADMINORVERSION        = MAKE_D3RMDHRESULT + 792;
11458
  D3DRMERR_UNABLETOEXECUTE        = MAKE_D3RMDHRESULT + 793;
11459
  D3DRMERR_LIBRARYNOTFOUND        = MAKE_D3RMDHRESULT + 794;
11460
  D3DRMERR_INVALIDLIBRARY         = MAKE_D3RMDHRESULT + 795;
11461
  D3DRMERR_PENDING                = MAKE_D3RMDHRESULT + 796;
11462
  D3DRMERR_NOTENOUGHDATA          = MAKE_D3RMDHRESULT + 797;
11463
  D3DRMERR_REQUESTTOOLARGE        = MAKE_D3RMDHRESULT + 798;
11464
  D3DRMERR_REQUESTTOOSMALL        = MAKE_D3RMDHRESULT + 799;
11465
  D3DRMERR_CONNECTIONLOST         = MAKE_D3RMDHRESULT + 800;
11466
  D3DRMERR_LOADABORTED            = MAKE_D3RMDHRESULT + 801;
11467
  D3DRMERR_NOINTERNET             = MAKE_D3RMDHRESULT + 802;
11468
  D3DRMERR_BADCACHEFILE           = MAKE_D3RMDHRESULT + 803;
11469
  D3DRMERR_BOXNOTSET              = MAKE_D3RMDHRESULT + 804;
11470
  D3DRMERR_BADPMDATA              = MAKE_D3RMDHRESULT + 805;
11471
  D3DRMERR_CLIENTNOTREGISTERED    = MAKE_D3RMDHRESULT + 806;
11472
  D3DRMERR_NOTCREATEDFROMDDS      = MAKE_D3RMDHRESULT + 807;
11473
  D3DRMERR_NOSUCHKEY              = MAKE_D3RMDHRESULT + 808;
11474
  D3DRMERR_INCOMPATABLEKEY        = MAKE_D3RMDHRESULT + 809;
11475
  D3DRMERR_ELEMENTINUSE           = MAKE_D3RMDHRESULT + 810;
11476
  D3DRMERR_TEXTUREFORMATNOTFOUND  = MAKE_D3RMDHRESULT + 811;
1 daniel-mar 11477
 
4 daniel-mar 11478
(* Create a Direct3DRM API *)
11479
var
11480
  Direct3DRMCreate : function (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
11481
 
11482
(*==========================================================================;
11483
 *
11484
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
11485
 *
11486
 *  File:       d3drmwin.h
11487
 *  Content:    Direct3DRM include file
11488
 *
11489
 ***************************************************************************)
11490
 
11491
type
11492
  IDirect3DRMWinDevice = interface (IDirect3DRMObject)
11493
    ['{c5016cc0-d273-11ce-ac48-0000c03825a1}']
11494
    (*
11495
     * IDirect3DRMWinDevice methods
11496
     *)
11497
 
11498
    (* Repaint the window with the last frame which was rendered. *)
11499
    function HandlePaint (hDC: HDC) : HResult; stdcall;
11500
 
11501
    (* Respond to a WM_ACTIVATE message. *)
11502
    function HandleActivate (wparam: WORD) : HResult; stdcall;
11503
  end;
11504
 
11505
(*
11506
 * GUIDS used by Direct3DRM Windows interface
11507
 *)
11508
  IID_IDirect3DRMWinDevice = IDirect3DRMWinDevice;
11509
 
1 daniel-mar 11510
(***************************************************************************
11511
 *
11512
 *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
11513
 *
4 daniel-mar 11514
 *  File:       rmxfguid.h
1 daniel-mar 11515
 *
4 daniel-mar 11516
 *  Content:    Defines GUIDs of D3DRM's templates.
1 daniel-mar 11517
 *
11518
 ***************************************************************************)
4 daniel-mar 11519
 
11520
const
11521
(* {2B957100-9E9A-11cf-AB39-0020AF71E433} *)
11522
  TID_D3DRMInfo: TGUID =
11523
      (D1:$2b957100;D2:$9e9a;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11524
 
4 daniel-mar 11525
(* {3D82AB44-62DA-11cf-AB39-0020AF71E433} *)
11526
  TID_D3DRMMesh: TGUID =
11527
      (D1:$3d82ab44;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11528
 
4 daniel-mar 11529
(* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} *)
11530
  TID_D3DRMVector: TGUID =
11531
      (D1:$3d82ab5e;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11532
 
4 daniel-mar 11533
(* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} *)
11534
  TID_D3DRMMeshFace: TGUID =
11535
      (D1:$3d82ab5f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11536
 
4 daniel-mar 11537
(* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} *)
11538
  TID_D3DRMMaterial: TGUID =
11539
      (D1:$3d82ab4d;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11540
 
4 daniel-mar 11541
(* {35FF44E1-6C7C-11cf-8F52-0040333594A3} *)
11542
  TID_D3DRMMaterialArray: TGUID =
11543
      (D1:$35ff44e1;D2:$6c7c;D3:$11cf;D4:($8F,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11544
 
4 daniel-mar 11545
(* {3D82AB46-62DA-11cf-AB39-0020AF71E433} *)
11546
  TID_D3DRMFrame: TGUID =
11547
      (D1:$3d82ab46;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11548
 
4 daniel-mar 11549
(* {F6F23F41-7686-11cf-8F52-0040333594A3} *)
11550
  TID_D3DRMFrameTransformMatrix: TGUID =
11551
      (D1:$f6f23f41;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11552
 
4 daniel-mar 11553
(* {F6F23F42-7686-11cf-8F52-0040333594A3} *)
11554
  TID_D3DRMMeshMaterialList: TGUID =
11555
      (D1:$f6f23f42;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11556
 
4 daniel-mar 11557
(* {F6F23F40-7686-11cf-8F52-0040333594A3} *)
11558
  TID_D3DRMMeshTextureCoords: TGUID =
11559
      (D1:$f6f23f40;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11560
 
4 daniel-mar 11561
(* {F6F23F43-7686-11cf-8F52-0040333594A3} *)
11562
  TID_D3DRMMeshNormals: TGUID =
11563
      (D1:$f6f23f43;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11564
 
4 daniel-mar 11565
(* {F6F23F44-7686-11cf-8F52-0040333594A3} *)
11566
  TID_D3DRMCoords2d: TGUID =
11567
      (D1:$f6f23f44;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11568
 
4 daniel-mar 11569
(* {F6F23F45-7686-11cf-8F52-0040333594A3} *)
11570
  TID_D3DRMMatrix4x4: TGUID =
11571
      (D1:$f6f23f45;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11572
 
4 daniel-mar 11573
(* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} *)
11574
  TID_D3DRMAnimation: TGUID =
11575
      (D1:$3d82ab4f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11576
 
4 daniel-mar 11577
(* {3D82AB50-62DA-11cf-AB39-0020AF71E433} *)
11578
  TID_D3DRMAnimationSet: TGUID =
11579
      (D1:$3d82ab50;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
1 daniel-mar 11580
 
4 daniel-mar 11581
(* {10DD46A8-775B-11cf-8F52-0040333594A3} *)
11582
  TID_D3DRMAnimationKey: TGUID =
11583
      (D1:$10dd46a8;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11584
 
4 daniel-mar 11585
(* {10DD46A9-775B-11cf-8F52-0040333594A3} *)
11586
  TID_D3DRMFloatKeys: TGUID =
11587
      (D1:$10dd46a9;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11588
 
4 daniel-mar 11589
(* {01411840-7786-11cf-8F52-0040333594A3} *)
11590
  TID_D3DRMMaterialAmbientColor: TGUID =
11591
      (D1:$01411840;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11592
 
4 daniel-mar 11593
(* {01411841-7786-11cf-8F52-0040333594A3} *)
11594
  TID_D3DRMMaterialDiffuseColor: TGUID =
11595
      (D1:$01411841;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11596
 
4 daniel-mar 11597
(* {01411842-7786-11cf-8F52-0040333594A3} *)
11598
  TID_D3DRMMaterialSpecularColor: TGUID =
11599
      (D1:$01411842;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11600
 
4 daniel-mar 11601
(* {D3E16E80-7835-11cf-8F52-0040333594A3} *)
11602
  TID_D3DRMMaterialEmissiveColor: TGUID =
11603
      (D1:$d3e16e80;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11604
 
4 daniel-mar 11605
(* {01411843-7786-11cf-8F52-0040333594A3} *)
11606
  TID_D3DRMMaterialPower: TGUID =
11607
      (D1:$01411843;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11608
 
4 daniel-mar 11609
(* {35FF44E0-6C7C-11cf-8F52-0040333594A3} *)
11610
  TID_D3DRMColorRGBA: TGUID =
11611
      (D1:$35ff44e0;D2:$6c7c;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
1 daniel-mar 11612
 
4 daniel-mar 11613
(* {D3E16E81-7835-11cf-8F52-0040333594A3} *)
11614
  TID_D3DRMColorRGB: TGUID =
11615
      (D1:$d3e16e81;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11616
 
4 daniel-mar 11617
(* {A42790E0-7810-11cf-8F52-0040333594A3} *)
11618
  TID_D3DRMGuid: TGUID =
11619
      (D1:$a42790e0;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11620
 
4 daniel-mar 11621
(* {A42790E1-7810-11cf-8F52-0040333594A3} *)
11622
  TID_D3DRMTextureFilename: TGUID =
11623
      (D1:$a42790e1;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11624
 
4 daniel-mar 11625
(* {A42790E2-7810-11cf-8F52-0040333594A3} *)
11626
  TID_D3DRMTextureReference: TGUID =
11627
      (D1:$a42790e2;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11628
 
4 daniel-mar 11629
(* {1630B820-7842-11cf-8F52-0040333594A3} *)
11630
  TID_D3DRMIndexedColor: TGUID =
11631
      (D1:$1630b820;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11632
 
4 daniel-mar 11633
(* {1630B821-7842-11cf-8F52-0040333594A3} *)
11634
  TID_D3DRMMeshVertexColors: TGUID =
11635
      (D1:$1630b821;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11636
 
4 daniel-mar 11637
(* {4885AE60-78E8-11cf-8F52-0040333594A3} *)
11638
  TID_D3DRMMaterialWrap: TGUID =
11639
      (D1:$4885ae60;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
1 daniel-mar 11640
 
4 daniel-mar 11641
(* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} *)
11642
  TID_D3DRMBoolean: TGUID =
11643
      (D1:$537da6a0;D2:$ca37;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
1 daniel-mar 11644
 
4 daniel-mar 11645
(* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} *)
11646
  TID_D3DRMMeshFaceWraps: TGUID =
11647
      (D1:$ed1ec5c0;D2:$c0a8;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
1 daniel-mar 11648
 
4 daniel-mar 11649
(* {4885AE63-78E8-11cf-8F52-0040333594A3} *)
11650
  TID_D3DRMBoolean2d: TGUID =
11651
      (D1:$4885ae63;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11652
 
11653
(* {F406B180-7B3B-11cf-8F52-0040333594A3} *)
11654
  TID_D3DRMTimedFloatKeys: TGUID =
11655
      (D1:$f406b180;D2:$7b3b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11656
 
11657
(* {E2BF56C0-840F-11cf-8F52-0040333594A3} *)
11658
  TID_D3DRMAnimationOptions: TGUID =
11659
      (D1:$e2bf56c0;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11660
 
11661
(* {E2BF56C1-840F-11cf-8F52-0040333594A3} *)
11662
  TID_D3DRMFramePosition: TGUID =
11663
      (D1:$e2bf56c1;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11664
 
11665
(* {E2BF56C2-840F-11cf-8F52-0040333594A3} *)
11666
  TID_D3DRMFrameVelocity: TGUID =
11667
      (D1:$e2bf56c2;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11668
 
11669
(* {E2BF56C3-840F-11cf-8F52-0040333594A3} *)
11670
  TID_D3DRMFrameRotation: TGUID =
11671
      (D1:$e2bf56c3;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
11672
 
11673
(* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} *)
11674
  TID_D3DRMLight: TGUID =
11675
      (D1:$3d82ab4a;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
11676
 
11677
(* {3D82AB51-62DA-11cf-AB39-0020AF71E433} *)
11678
  TID_D3DRMCamera: TGUID =
11679
      (D1:$3d82ab51;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
11680
 
11681
(* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} *)
11682
  TID_D3DRMAppData: TGUID =
11683
      (D1:$e5745280;D2:$b24f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
11684
 
11685
(* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} *)
11686
  TID_D3DRMLightUmbra: TGUID =
11687
      (D1:$aed22740;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
11688
 
11689
(* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} *)
11690
  TID_D3DRMLightRange: TGUID =
11691
      (D1:$aed22742;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
11692
 
11693
(* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} *)
11694
  TID_D3DRMLightPenumbra: TGUID =
11695
      (D1:$aed22741;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
11696
 
11697
(* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} *)
11698
  TID_D3DRMLightAttenuation: TGUID =
11699
      (D1:$a8a98ba0;D2:$c5e5;D3:$11cf;D4:($b9,$41,$00,$80,$c8,$0c,$fa,$7b));
11700
 
11701
(* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} *)
11702
  TID_D3DRMInlineData: TGUID =
11703
      (D1:$3a23eea0;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
11704
 
11705
(* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} *)
11706
  TID_D3DRMUrl: TGUID =
11707
      (D1:$3a23eea1;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
11708
 
11709
(* {8A63C360-997D-11d0-941C-0080C80CFA7B} *)
11710
  TID_D3DRMProgressiveMesh: TGUID =
11711
      (D1:$8A63C360;D2:$997D;D3:$11d0;D4:($94,$1C,$00,$80,$C8,$0C,$FA,$7B));
11712
 
11713
(* {98116AA0-BDBA-11d1-82C0-00A0C9697271} *)
11714
  TID_D3DRMExternalVisual: TGUID =
11715
      (D1:$98116AA0;D2:$BDBA;D3:$11d1;D4:($82,$C0,$00,$A0,$C9,$69,$72,$71));
11716
 
11717
(* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} *)
11718
  TID_D3DRMStringProperty: TGUID =
11719
      (D1:$7f0f21e0;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
11720
 
11721
(* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} *)
11722
  TID_D3DRMPropertyBag: TGUID =
11723
      (D1:$7f0f21e1;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
11724
 
11725
// {7F5D5EA0-D53A-11d1-82C0-00A0C9697271}
11726
  TID_D3DRMRightHanded: TGUID =
11727
      (D1:$7f5d5ea0;D2:$d53a;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
11728
 
11729
(*==========================================================================;
1 daniel-mar 11730
 *
4 daniel-mar 11731
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 11732
 *
11733
 *  File:       rmxftmpl.h
4 daniel-mar 11734
 *  Content:    D3DRM XFile templates in binary form
1 daniel-mar 11735
 *
11736
 ***************************************************************************)
11737
 
11738
const
4 daniel-mar 11739
  D3DRM_XTEMPLATE_BYTES_2  = 3278;
1 daniel-mar 11740
 
4 daniel-mar 11741
  D3DRM_XTEMPLATES_2: array [0..D3DRM_XTEMPLATE_BYTES_2-1] of byte = (
11742
        $78, $6f, $66, $20, $30, $33, $30, $32, $62, $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
11743
        0, $6, 0, 0, 0, $48, $65, $61, $64, $65, $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
11744
        $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
11745
        $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
11746
        0, $29, 0, $1, 0, $5, 0, 0, 0, $66, $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
11747
        $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
11748
        $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
11749
        $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0, 0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
11750
        0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
11751
        $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
11752
        $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0, 0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
11753
        0, 0, $76, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
11754
        $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
11755
        $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
11756
        $e, 0, $3, 0, $10, 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
11757
        0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
11758
        $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
11759
        $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
11760
        0, $1, 0, $4, 0, 0, 0, $62, $6c, $75, $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
11761
        0, $61, $6c, $70, $68, $61, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
11762
        $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0, $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
11763
        0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
11764
        0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
11765
        0, 0, $62, $6c, $75, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
11766
        $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72, $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
11767
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
11768
        $64, $65, $78, $14, 0, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
11769
        $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65, $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
11770
        $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
11771
        $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
11772
        0, 0, 0, $74, $72, $75, $65, $66, $61, $6c, $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
11773
        $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
11774
        $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
11775
        $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
11776
        0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
11777
        0, $1, 0, $c, 0, 0, 0, $4d, $61, $74, $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
11778
        0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
11779
        0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
11780
        0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
11781
        $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
11782
        $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0, $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
11783
        $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0, $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
11784
        $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
11785
        $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
11786
        $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
11787
        0, $9, 0, 0, 0, $66, $61, $63, $65, $43, $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
11788
        $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
11789
        $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0, 0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
11790
        $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
11791
        $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73, $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
11792
        0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
11793
        0, $4d, $65, $73, $68, $46, $61, $63, $65, $a, 0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
11794
        $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
11795
        $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
11796
        0, $1, 0, $11, 0, 0, 0, $66, $61, $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
11797
        $69, $63, $65, $73, $e, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
11798
        $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
11799
        $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
11800
        0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
11801
        0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
11802
        $14, 0, $34, 0, $1, 0, $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
11803
        0, $e, 0, 0, 0, $66, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
11804
        0, $1, 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
11805
        $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
11806
        $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
11807
        $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
11808
        0, $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
11809
        0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
11810
        $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
11811
        $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
11812
        $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65, $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
11813
        $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
11814
        $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0, 0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
11815
        $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
11816
        $65, $78, $65, $73, $14, 0, $34, 0, $29, 0, $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
11817
        $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
11818
        $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14, 0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
11819
        $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b, 0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
11820
        $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73, $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
11821
        $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
11822
        $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
11823
        $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
11824
        0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
11825
        0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
11826
        0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
11827
        $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
11828
        $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
11829
        $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
11830
        $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
11831
        $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
11832
        $73, $14, 0, $34, 0, $1, 0, $c, 0, 0, 0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
11833
        $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
11834
        $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
11835
        $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
11836
        $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
11837
        $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
11838
        0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
11839
        $65, $72, $74, $69, $63, $65, $73, $e, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
11840
        $69, $63, $65, $73, $f, 0, $14, 0, $29, 0, $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
11841
        $65, $73, $14, 0, $34, 0, $1, 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
11842
        $1, 0, $5, 0, 0, 0, $66, $61, $63, $65, $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
11843
        $46, $61, $63, $65, $73, $f, 0, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
11844
        0, $1f, 0, $1, 0, $14, 0, 0, 0, $46, $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
11845
        $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a, 0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
11846
        $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
11847
        $78, $34, $78, $34, $1, 0, $b, 0, 0, 0, $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
11848
        $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5, 0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
11849
        $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
11850
        $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
11851
        $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5, 0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
11852
        $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
11853
        $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
11854
        $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
11855
        0, $1f, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
11856
        $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6, $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
11857
        $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0, 0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
11858
        0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65, $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
11859
        $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
11860
        $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0, $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
11861
        $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
11862
        $79, $70, $65, $14, 0, $29, 0, $1, 0, $5, 0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
11863
        $34, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
11864
        $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65, $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
11865
        $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
11866
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70, $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
11867
        $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
11868
        0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f, $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
11869
        0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f, $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
11870
        $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
11871
        0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
11872
        0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
11873
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65, $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
11874
        $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
11875
        $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0, $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
11876
        $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
11877
        $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
11878
        $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0, $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
11879
        0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
11880
        0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
11881
        $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
11882
        $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
11883
        $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68, $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
11884
        $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
11885
        $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
11886
        0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
11887
        $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
11888
        0, 0, 0, $64, $61, $74, $61, $31, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
11889
        $74, $61, $32, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
11890
        $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
11891
        0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
11892
        $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74, $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
11893
        $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
11894
        $65, $79, $14, 0, $31, 0, $1, 0, $5, 0, 0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
11895
        0, $1f, 0, $1, 0, $b, 0, 0, 0, $50, $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
11896
        $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
11897
        $e, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
11898
        $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
11899
        $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0, $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
11900
        $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
11901
        $12, 0, 0, 0, $67, $75, $69, $64, $45, $78, $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
11902
        $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0,
11903
        $b, 0, 0, 0, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $a, 0, $5, 0, $a0,
11904
        $5e, $5d, $7f, $3a, $d5, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $29, 0, $1, 0, $c,
11905
        0, 0, 0, $62, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $14, 0, $b, 0);
1 daniel-mar 11906
 
4 daniel-mar 11907
//---------------
11908
{$ENDIF}
11909
//DirectInput file
1 daniel-mar 11910
(*==========================================================================;
11911
 *
4 daniel-mar 11912
 *  Copyright (C) 1996-1999 Microsoft Corporation.  All Rights Reserved.
1 daniel-mar 11913
 *
11914
 *  File:       dinput.h
11915
 *  Content:    DirectInput include file
11916
 *
4 daniel-mar 11917
 *  DirectX 7.0 Delphi adaptation by Erik Unger, input format
11918
 *  variable structure & other fixups by Arne Schäpers (as)
11919
 *
11920
 *  Modified: 10-Sep-2000
11921
 *
11922
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
11923
 *  E-Mail: DelphiDirectX@next-reality.com
11924
 *          a.schaepers@digitalpublishing.de            
11925
 *
11926
 ***************************************************************************)
1 daniel-mar 11927
 
4 daniel-mar 11928
{ Some notes from as:
11929
  1. DirectInput Enum callback functions which are documented with result
11930
  type BOOL in the SDK had to be changed to result type integer because the debug
11931
  version of DINPUT.DLL (which is the same for SDK versions 5.0, 5.2, 6.0, and 6.1)
11932
  explicitely checks for two possible return values:
11933
 
11934
 
11935
  1 - TRUE in C, defined as DIENUM_CONTINUE
11936
 
11937
  In Delphi, TRUE means $FFFFFFFF (= -1) for the LongBool (= BOOL) data
11938
  type, and AL = 1 (upper three bytes undefined) for the Boolean data type.
11939
  The debug version of DINPUT.DLL will throw an external exception
11940
  ("invalid return value for callback") when fed with either value.
11941
 
11942
  This change affects the following methods:
11943
  EnumDevices, EnumObjects, EnumEffects, EnumCreatedEffectObjects
11944
 
11945
  2. Windows 98 and DX6 debug versions DInput and DSound
11946
 
11947
  Under Windows 98, the "debug" setup of the DirectX SDK 6.x skips DInput.DLL
11948
  and DSound.DLL, i.e. makes you end up with the retail version of these two
11949
  files without any notice.
11950
  The debug versions of DInput.DLL and DSound.DLL can be found in the
11951
  \extras\Win98\Win98Dbg folder of the SDK CD; they need to be installed
11952
  "manually".
11953
 
11954
  This problem has been fixed with DX7 where the SDK installs the debug versions
11955
  of DInput and DSound without any "manual" help.
11956
 
11957
}
11958
 
11959
 
11960
var
11961
  DInputDLL : HMODULE;
11962
 
11963
{$IFDEF DIRECTX3}
11964
const DIRECTINPUT_VERSION = $0300;
11965
{$ELSE}
11966
const DIRECTINPUT_VERSION = $0700;
1 daniel-mar 11967
{$ENDIF}
11968
 
4 daniel-mar 11969
function DIErrorString(Value: HResult) : string;
1 daniel-mar 11970
 
4 daniel-mar 11971
//type
11972
//  TRefGUID = packed record
11973
//    case integer of
11974
//    1: (guid : PGUID);
11975
//    2: (dwFlags : DWORD);
11976
//  end;
11977
 
11978
(****************************************************************************
11979
 *
11980
 *      Class IDs
11981
 *
11982
 ****************************************************************************)
1 daniel-mar 11983
const
4 daniel-mar 11984
  CLSID_DirectInput: TGUID =
11985
      (D1:$25E609E0;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
11986
  CLSID_DirectInputDevice: TGUID =
11987
      (D1:$25E609E1;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 11988
 
4 daniel-mar 11989
(****************************************************************************
11990
 *
11991
 *      Predefined object types
11992
 *
11993
 ****************************************************************************)
1 daniel-mar 11994
 
4 daniel-mar 11995
  GUID_XAxis: TGUID =
11996
      (D1:$A36D02E0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
11997
  GUID_YAxis: TGUID =
11998
      (D1:$A36D02E1;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
11999
  GUID_ZAxis: TGUID =
12000
      (D1:$A36D02E2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12001
  GUID_RxAxis: TGUID =
12002
      (D1:$A36D02F4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12003
  GUID_RyAxis: TGUID =
12004
      (D1:$A36D02F5;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12005
  GUID_RzAxis: TGUID =
12006
      (D1:$A36D02E3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12007
  GUID_Slider: TGUID =
12008
      (D1:$A36D02E4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12009
 
4 daniel-mar 12010
  GUID_Button: TGUID =
12011
      (D1:$A36D02F0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12012
  GUID_Key: TGUID =
12013
      (D1:$55728220;D2:$D33C;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12014
 
4 daniel-mar 12015
  GUID_POV: TGUID =
12016
      (D1:$A36D02F2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12017
 
4 daniel-mar 12018
  GUID_Unknown: TGUID =
12019
      (D1:$A36D02F3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12020
 
4 daniel-mar 12021
(****************************************************************************
12022
 *
12023
 *      Predefined product GUIDs
12024
 *
12025
 ****************************************************************************)
12026
 
12027
  GUID_SysMouse: TGUID =
12028
      (D1:$6F1D2B60;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12029
  GUID_SysKeyboard: TGUID =
12030
      (D1:$6F1D2B61;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
12031
  GUID_Joystick: TGUID =
12032
      (D1:$6F1D2B70;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
1 daniel-mar 12033
  GUID_SysMouseEm: TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}';
12034
  GUID_SysMouseEm2: TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}';
12035
  GUID_SysKeyboardEm: TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}';
12036
  GUID_SysKeyboardEm2: TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}';
12037
 
4 daniel-mar 12038
(****************************************************************************
12039
 *
12040
 *      Predefined force feedback effects
12041
 *
12042
 ****************************************************************************)
1 daniel-mar 12043
 
4 daniel-mar 12044
  GUID_ConstantForce: TGUID =
12045
      (D1:$13541C20;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12046
  GUID_RampForce: TGUID =
12047
      (D1:$13541C21;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12048
  GUID_Square: TGUID =
12049
      (D1:$13541C22;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12050
  GUID_Sine: TGUID =
12051
      (D1:$13541C23;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12052
  GUID_Triangle: TGUID =
12053
      (D1:$13541C24;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12054
  GUID_SawtoothUp: TGUID =
12055
      (D1:$13541C25;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12056
  GUID_SawtoothDown: TGUID =
12057
      (D1:$13541C26;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12058
  GUID_Spring: TGUID =
12059
      (D1:$13541C27;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12060
  GUID_Damper: TGUID =
12061
      (D1:$13541C28;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12062
  GUID_Inertia: TGUID =
12063
      (D1:$13541C29;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12064
  GUID_Friction: TGUID =
12065
      (D1:$13541C2A;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
12066
  GUID_CustomForce: TGUID =
12067
      (D1:$13541C2B;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
1 daniel-mar 12068
 
12069
 
4 daniel-mar 12070
 
12071
(****************************************************************************
12072
 *
12073
 *      Interfaces and Structures...
12074
 *
12075
 ****************************************************************************)
12076
 
12077
(****************************************************************************
12078
 *
12079
 *      IDirectInputEffect
12080
 *
12081
 ****************************************************************************)
12082
 
1 daniel-mar 12083
const
4 daniel-mar 12084
  DIEFT_ALL                   = $00000000;
1 daniel-mar 12085
 
4 daniel-mar 12086
  DIEFT_CONSTANTFORCE         = $00000001;
12087
  DIEFT_RAMPFORCE             = $00000002;
12088
  DIEFT_PERIODIC              = $00000003;
12089
  DIEFT_CONDITION             = $00000004;
12090
  DIEFT_CUSTOMFORCE           = $00000005;
12091
  DIEFT_HARDWARE              = $000000FF;
1 daniel-mar 12092
 
4 daniel-mar 12093
  DIEFT_FFATTACK              = $00000200;
12094
  DIEFT_FFFADE                = $00000400;
12095
  DIEFT_SATURATION            = $00000800;
12096
  DIEFT_POSNEGCOEFFICIENTS    = $00001000;
12097
  DIEFT_POSNEGSATURATION      = $00002000;
12098
  DIEFT_DEADBAND              = $00004000;
12099
  DIEFT_STARTDELAY            = $00008000;
1 daniel-mar 12100
 
4 daniel-mar 12101
function DIEFT_GETTYPE(n: variant) : byte;
1 daniel-mar 12102
 
12103
const
4 daniel-mar 12104
  DI_DEGREES                  =     100;
12105
  DI_FFNOMINALMAX             =   10000;
12106
  DI_SECONDS                  = 1000000;
1 daniel-mar 12107
 
12108
type
12109
  PDIConstantForce = ^TDIConstantForce;
4 daniel-mar 12110
  TDIConstantForce = packed record
12111
    lMagnitude : LongInt;
1 daniel-mar 12112
  end;
12113
 
12114
  PDIRampForce = ^TDIRampForce;
4 daniel-mar 12115
  TDIRampForce = packed record
12116
    lStart : LongInt;
12117
    lEnd : LongInt;
1 daniel-mar 12118
  end;
12119
 
12120
  PDIPeriodic = ^TDIPeriodic;
4 daniel-mar 12121
  TDIPeriodic = packed record
12122
    dwMagnitude : DWORD;
12123
    lOffset : LongInt;
12124
    dwPhase : DWORD;
12125
    dwPeriod : DWORD;
1 daniel-mar 12126
  end;
12127
 
12128
  PDICondition = ^TDICondition;
4 daniel-mar 12129
  TDICondition = packed record
12130
    lOffset : LongInt;
12131
    lPositiveCoefficient : LongInt;
12132
    lNegativeCoefficient : LongInt;
12133
    dwPositiveSaturation : DWORD;
12134
    dwNegativeSaturation : DWORD;
12135
    lDeadBand : LongInt;
1 daniel-mar 12136
  end;
12137
 
12138
  PDICustomForce = ^TDICustomForce;
4 daniel-mar 12139
  TDICustomForce = packed record
12140
    cChannels : DWORD;
12141
    dwSamplePeriod : DWORD;
12142
    cSamples : DWORD;
12143
    rglForceData : PLongInt;
1 daniel-mar 12144
  end;
12145
 
12146
  PDIEnvelope = ^TDIEnvelope;
4 daniel-mar 12147
  TDIEnvelope = packed record
12148
    dwSize : DWORD;                   (* sizeof(DIENVELOPE)   *)
12149
    dwAttackLevel : DWORD;
12150
    dwAttackTime : DWORD;             (* Microseconds         *)
12151
    dwFadeLevel : DWORD;
12152
    dwFadeTime : DWORD;               (* Microseconds         *)
1 daniel-mar 12153
  end;
12154
 
12155
  PDIEffect_DX5 = ^TDIEffect_DX5;
4 daniel-mar 12156
  TDIEffect_DX5 = packed record
12157
    dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
12158
    dwFlags : DWORD;                  (* DIEFF_*              *)
12159
    dwDuration : DWORD;               (* Microseconds         *)
12160
    dwSamplePeriod : DWORD;           (* Microseconds         *)
12161
    dwGain : DWORD;
12162
    dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
12163
    dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
12164
    cAxes : DWORD;                    (* Number of axes       *)
12165
    rgdwAxes : PDWORD;                (* Array of axes        *)
12166
    rglDirection : PLongInt;          (* Array of directions  *)
12167
    lpEnvelope : PDIEnvelope;         (* Optional             *)
12168
    cbTypeSpecificParams : DWORD;     (* Size of params       *)
12169
    lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
1 daniel-mar 12170
  end;
12171
 
12172
  PDIEffect_DX6 = ^TDIEffect_DX6;
4 daniel-mar 12173
  TDIEffect_DX6 = packed record
12174
    dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
12175
    dwFlags : DWORD;                  (* DIEFF_*              *)
12176
    dwDuration : DWORD;               (* Microseconds         *)
12177
    dwSamplePeriod : DWORD;           (* Microseconds         *)
12178
    dwGain : DWORD;
12179
    dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
12180
    dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
12181
    cAxes : DWORD;                    (* Number of axes       *)
12182
    rgdwAxes : PDWORD;                (* Array of axes        *)
12183
    rglDirection : PLongInt;          (* Array of directions  *)
12184
    lpEnvelope : PDIEnvelope;         (* Optional             *)
12185
    cbTypeSpecificParams : DWORD;     (* Size of params       *)
12186
    lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
12187
    dwStartDelay: DWORD;              (* Microseconds         *)
1 daniel-mar 12188
  end;
12189
 
4 daniel-mar 12190
  PDIEffect = ^TDIEffect;
12191
{$IFDEF DIRECTX5}
12192
  TDIEffect = TDIEffect_DX5;
12193
{$ELSE}
1 daniel-mar 12194
  TDIEffect = TDIEffect_DX6;
12195
{$ENDIF}
12196
 
12197
  PDIFileEffect = ^TDIFileEffect;
4 daniel-mar 12198
  TDIFileEffect = packed record
12199
    dwSize : DWORD;
1 daniel-mar 12200
    GuidEffect: TGUID;
12201
    lpDiEffect: PDIEffect;
4 daniel-mar 12202
    szFriendlyName : array [0..MAX_PATH-1] of AnsiChar;
1 daniel-mar 12203
  end;
12204
 
12205
const
12206
  DIEFF_OBJECTIDS             = $00000001;
12207
  DIEFF_OBJECTOFFSETS         = $00000002;
12208
  DIEFF_CARTESIAN             = $00000010;
12209
  DIEFF_POLAR                 = $00000020;
12210
  DIEFF_SPHERICAL             = $00000040;
12211
 
12212
  DIEP_DURATION               = $00000001;
12213
  DIEP_SAMPLEPERIOD           = $00000002;
4 daniel-mar 12214
  DIEP_GAIN                   = $00000004;
1 daniel-mar 12215
  DIEP_TRIGGERBUTTON          = $00000008;
12216
  DIEP_TRIGGERREPEATINTERVAL  = $00000010;
12217
  DIEP_AXES                   = $00000020;
12218
  DIEP_DIRECTION              = $00000040;
12219
  DIEP_ENVELOPE               = $00000080;
12220
  DIEP_TYPESPECIFICPARAMS     = $00000100;
4 daniel-mar 12221
{$IFDEF DIRECTX5}
12222
  DIEP_ALLPARAMS              = $000001FF;
12223
{$ELSE}
1 daniel-mar 12224
  DIEP_STARTDELAY             = $00000200;
12225
  DIEP_ALLPARAMS_DX5          = $000001FF;
12226
  DIEP_ALLPARAMS              = $000003FF;
12227
{$ENDIF}
12228
  DIEP_START                  = $20000000;
12229
  DIEP_NORESTART              = $40000000;
12230
  DIEP_NODOWNLOAD             = $80000000;
12231
  DIEB_NOTRIGGER              = $FFFFFFFF;
12232
 
12233
  DIES_SOLO                   = $00000001;
12234
  DIES_NODOWNLOAD             = $80000000;
12235
 
12236
  DIEGES_PLAYING              = $00000001;
12237
  DIEGES_EMULATED             = $00000002;
12238
 
4 daniel-mar 12239
 
1 daniel-mar 12240
type
12241
  PDIEffEscape = ^TDIEffEscape;
4 daniel-mar 12242
  TDIEffEscape = packed record
12243
    dwSize : DWORD;
12244
    dwCommand : DWORD;
12245
    lpvInBuffer : pointer;
12246
    cbInBuffer : DWORD;
12247
    lpvOutBuffer : pointer;
12248
    cbOutBuffer : DWORD;
1 daniel-mar 12249
  end;
12250
 
12251
 
4 daniel-mar 12252
//
12253
// IDirectSoundCapture  // as: ???
12254
//
12255
  IDirectInputEffect = interface (IUnknown)
1 daniel-mar 12256
    ['{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}']
4 daniel-mar 12257
    (** IDirectInputEffect methods ***)
12258
    function Initialize(hinst: THandle; dwVersion: DWORD;
12259
        const rguid: TGUID) : HResult;  stdcall;
12260
    function GetEffectGuid(var pguid: TGUID) : HResult;  stdcall;
12261
    function GetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
12262
    function SetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
12263
    function Start(dwIterations: DWORD; dwFlags: DWORD) : HResult;  stdcall;
12264
    function Stop : HResult;  stdcall;
12265
    function GetEffectStatus(var pdwFlags : DWORD) : HResult;  stdcall;
12266
    function Download : HResult;  stdcall;
12267
    function Unload : HResult;  stdcall;
12268
    function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
1 daniel-mar 12269
  end;
12270
 
4 daniel-mar 12271
(****************************************************************************
12272
 *
12273
 *      IDirectInputDevice
12274
 *
12275
 ****************************************************************************)
1 daniel-mar 12276
 
12277
const
4 daniel-mar 12278
  DIDEVTYPE_DEVICE = 1;
12279
  DIDEVTYPE_MOUSE = 2;
1 daniel-mar 12280
  DIDEVTYPE_KEYBOARD = 3;
12281
  DIDEVTYPE_JOYSTICK = 4;
4 daniel-mar 12282
  DIDEVTYPE_HID = $00010000;
1 daniel-mar 12283
 
4 daniel-mar 12284
  DIDEVTYPEMOUSE_UNKNOWN = 1;
1 daniel-mar 12285
  DIDEVTYPEMOUSE_TRADITIONAL = 2;
12286
  DIDEVTYPEMOUSE_FINGERSTICK = 3;
4 daniel-mar 12287
  DIDEVTYPEMOUSE_TOUCHPAD = 4;
12288
  DIDEVTYPEMOUSE_TRACKBALL = 5;
1 daniel-mar 12289
 
4 daniel-mar 12290
  DIDEVTYPEKEYBOARD_UNKNOWN = 0;
12291
  DIDEVTYPEKEYBOARD_PCXT = 1;
12292
  DIDEVTYPEKEYBOARD_OLIVETTI = 2;
12293
  DIDEVTYPEKEYBOARD_PCAT = 3;
12294
  DIDEVTYPEKEYBOARD_PCENH = 4;
12295
  DIDEVTYPEKEYBOARD_NOKIA1050 = 5;
12296
  DIDEVTYPEKEYBOARD_NOKIA9140 = 6;
12297
  DIDEVTYPEKEYBOARD_NEC98 = 7;
1 daniel-mar 12298
  DIDEVTYPEKEYBOARD_NEC98LAPTOP = 8;
4 daniel-mar 12299
  DIDEVTYPEKEYBOARD_NEC98106 = 9;
12300
  DIDEVTYPEKEYBOARD_JAPAN106 = 10;
12301
  DIDEVTYPEKEYBOARD_JAPANAX = 11;
12302
  DIDEVTYPEKEYBOARD_J3100 = 12;
1 daniel-mar 12303
 
4 daniel-mar 12304
  DIDEVTYPEJOYSTICK_UNKNOWN = 1;
1 daniel-mar 12305
  DIDEVTYPEJOYSTICK_TRADITIONAL = 2;
12306
  DIDEVTYPEJOYSTICK_FLIGHTSTICK = 3;
4 daniel-mar 12307
  DIDEVTYPEJOYSTICK_GAMEPAD = 4;
12308
  DIDEVTYPEJOYSTICK_RUDDER = 5;
12309
  DIDEVTYPEJOYSTICK_WHEEL = 6;
1 daniel-mar 12310
  DIDEVTYPEJOYSTICK_HEADTRACKER = 7;
12311
 
4 daniel-mar 12312
function GET_DIDEVICE_TYPE(dwDevType: variant) : byte;
12313
function GET_DIDEVICE_SUBTYPE(dwDevType: variant) : byte;
1 daniel-mar 12314
 
12315
type
12316
  PDIDevCaps_DX3 = ^TDIDevCaps_DX3;
4 daniel-mar 12317
  TDIDevCaps_DX3 = packed record
1 daniel-mar 12318
    dwSize: DWORD;
12319
    dwFlags: DWORD;
12320
    dwDevType: DWORD;
12321
    dwAxes: DWORD;
12322
    dwButtons: DWORD;
12323
    dwPOVs: DWORD;
12324
  end;
12325
 
12326
  PDIDevCaps_DX5 = ^TDIDevCaps_DX5;
4 daniel-mar 12327
  TDIDevCaps_DX5 = packed record
1 daniel-mar 12328
    dwSize: DWORD;
12329
    dwFlags: DWORD;
12330
    dwDevType: DWORD;
12331
    dwAxes: DWORD;
12332
    dwButtons: DWORD;
12333
    dwPOVs: DWORD;
12334
    dwFFSamplePeriod: DWORD;
12335
    dwFFMinTimeResolution: DWORD;
12336
    dwFirmwareRevision: DWORD;
12337
    dwHardwareRevision: DWORD;
12338
    dwFFDriverVersion: DWORD;
12339
  end;
12340
 
4 daniel-mar 12341
  PDIDevCaps = ^TDIDevCaps;
12342
{$IFDEF DIRECTX3}
1 daniel-mar 12343
  TDIDevCaps = TDIDevCaps_DX3;
4 daniel-mar 12344
{$ELSE}
1 daniel-mar 12345
  TDIDevCaps = TDIDevCaps_DX5;
12346
{$ENDIF}
12347
 
12348
const
12349
  DIDC_ATTACHED           = $00000001;
12350
  DIDC_POLLEDDEVICE       = $00000002;
12351
  DIDC_EMULATED           = $00000004;
12352
  DIDC_POLLEDDATAFORMAT   = $00000008;
12353
  DIDC_FORCEFEEDBACK      = $00000100;
12354
  DIDC_FFATTACK           = $00000200;
12355
  DIDC_FFFADE             = $00000400;
12356
  DIDC_SATURATION         = $00000800;
12357
  DIDC_POSNEGCOEFFICIENTS = $00001000;
12358
  DIDC_POSNEGSATURATION   = $00002000;
12359
  DIDC_DEADBAND           = $00004000;
12360
  DIDC_STARTDELAY         = $00008000;
12361
  DIDC_ALIAS              = $00010000;
12362
  DIDC_PHANTOM            = $00020000;
12363
 
4 daniel-mar 12364
  DIDFT_ALL = $00000000;
1 daniel-mar 12365
 
4 daniel-mar 12366
  DIDFT_RELAXIS = $00000001;
12367
  DIDFT_ABSAXIS = $00000002;
12368
  DIDFT_AXIS    = $00000003;
1 daniel-mar 12369
 
4 daniel-mar 12370
  DIDFT_PSHBUTTON = $00000004;
12371
  DIDFT_TGLBUTTON = $00000008;
12372
  DIDFT_BUTTON    = $0000000C;
1 daniel-mar 12373
 
12374
  DIDFT_POV        = $00000010;
12375
  DIDFT_COLLECTION = $00000040;
12376
  DIDFT_NODATA     = $00000080;
12377
 
4 daniel-mar 12378
  DIDFT_ANYINSTANCE = $00FFFF00;
1 daniel-mar 12379
  DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE;
4 daniel-mar 12380
function DIDFT_MAKEINSTANCE(n: variant) : DWORD;
12381
function DIDFT_GETTYPE(n: variant) : byte;
12382
function DIDFT_GETINSTANCE(n: variant) : DWORD;
12383
const
12384
  DIDFT_FFACTUATOR        = $01000000;
12385
  DIDFT_FFEFFECTTRIGGER   = $02000000;
12386
  DIDFT_OUTPUT            = $10000000;
12387
  DIDFT_VENDORDEFINED     = $04000000;
12388
  DIDFT_ALIAS             = $08000000;
1 daniel-mar 12389
 
4 daniel-mar 12390
function DIDFT_ENUMCOLLECTION(n: variant) : DWORD;
12391
const
12392
  DIDFT_NOCOLLECTION = $00FFFF00;
1 daniel-mar 12393
 
12394
 
4 daniel-mar 12395
 
1 daniel-mar 12396
type
12397
  PDIObjectDataFormat = ^TDIObjectDataFormat;
4 daniel-mar 12398
  TDIObjectDataFormat = packed record
1 daniel-mar 12399
    pguid: PGUID;
12400
    dwOfs: DWORD;
12401
    dwType: DWORD;
12402
    dwFlags: DWORD;
12403
  end;
12404
 
12405
  PDIDataFormat = ^TDIDataFormat;
4 daniel-mar 12406
  TDIDataFormat = packed record
12407
    dwSize: DWORD;  
1 daniel-mar 12408
    dwObjSize: DWORD;
4 daniel-mar 12409
    dwFlags: DWORD;  
12410
    dwDataSize: DWORD;  
12411
    dwNumObjs: DWORD;  
1 daniel-mar 12412
    rgodf: PDIObjectDataFormat;
12413
  end;
12414
 
12415
const
12416
  DIDF_ABSAXIS = $00000001;
12417
  DIDF_RELAXIS = $00000002;
12418
 
12419
type
4 daniel-mar 12420
  PDIDeviceObjectInstance_DX3A = ^TDIDeviceObjectInstance_DX3A;
12421
  TDIDeviceObjectInstance_DX3A = packed record
1 daniel-mar 12422
    dwSize: DWORD;
12423
    guidType: TGUID;
12424
    dwOfs: DWORD;
12425
    dwType: DWORD;
12426
    dwFlags: DWORD;
4 daniel-mar 12427
    tszName: Array [0..MAX_PATH-1] of CHAR;
1 daniel-mar 12428
  end;
12429
 
4 daniel-mar 12430
  PDIDeviceObjectInstance_DX3W = ^TDIDeviceObjectInstance_DX3W;
12431
  TDIDeviceObjectInstance_DX3W = packed record
1 daniel-mar 12432
    dwSize: DWORD;
12433
    guidType: TGUID;
12434
    dwOfs: DWORD;
12435
    dwType: DWORD;
12436
    dwFlags: DWORD;
4 daniel-mar 12437
    tszName: Array [0..MAX_PATH-1] of WCHAR;
12438
  end;
12439
 
12440
  PDIDeviceObjectInstance_DX3 = ^TDIDeviceObjectInstance_DX3;
12441
{$IFDEF UNICODE}
12442
  TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3W;
12443
{$ELSE}
12444
  TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3A;
12445
{$ENDIF}
12446
 
12447
  PDIDeviceObjectInstance_DX5A = ^TDIDeviceObjectInstance_DX5A;
12448
  TDIDeviceObjectInstance_DX5A = packed record
12449
    dwSize: DWORD;
12450
    guidType: TGUID;
12451
    dwOfs: DWORD;
12452
    dwType: DWORD;
12453
    dwFlags: DWORD;
12454
    tszName: Array [0..MAX_PATH-1] of CHAR;
1 daniel-mar 12455
    dwFFMaxForce: DWORD;
12456
    dwFFForceResolution: DWORD;
12457
    wCollectionNumber: WORD;
12458
    wDesignatorIndex: WORD;
12459
    wUsagePage: WORD;
12460
    wUsage: WORD;
12461
    dwDimension: DWORD;
12462
    wExponent: WORD;
12463
    wReserved: WORD;
12464
  end;
12465
 
4 daniel-mar 12466
  PDIDeviceObjectInstance_DX5W = ^TDIDeviceObjectInstance_DX5W;
12467
  TDIDeviceObjectInstance_DX5W = packed record
1 daniel-mar 12468
    dwSize: DWORD;
12469
    guidType: TGUID;
12470
    dwOfs: DWORD;
12471
    dwType: DWORD;
12472
    dwFlags: DWORD;
4 daniel-mar 12473
    tszName: Array [0..MAX_PATH-1] of WCHAR;
1 daniel-mar 12474
    dwFFMaxForce: DWORD;
12475
    dwFFForceResolution: DWORD;
12476
    wCollectionNumber: WORD;
12477
    wDesignatorIndex: WORD;
12478
    wUsagePage: WORD;
12479
    wUsage: WORD;
12480
    dwDimension: DWORD;
12481
    wExponent: WORD;
12482
    wReserved: WORD;
12483
  end;
12484
 
4 daniel-mar 12485
  PDIDeviceObjectInstance_DX5 = ^TDIDeviceObjectInstance_DX5;
12486
{$IFDEF UNICODE}
12487
  TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5W;
12488
{$ELSE}
12489
  TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5A;
1 daniel-mar 12490
{$ENDIF}
12491
 
4 daniel-mar 12492
  PDIDeviceObjectInstanceA = ^TDIDeviceObjectInstanceA;
12493
  PDIDeviceObjectInstanceW = ^TDIDeviceObjectInstanceA;
12494
  PDIDeviceObjectInstance = ^TDIDeviceObjectInstance;
12495
{$IFDEF DIRECTX3}
12496
  TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX3A;
12497
  TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX3W;
12498
  TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX3;
12499
{$ELSE}
12500
  TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX5A;
12501
  TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX5W;
12502
  TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX5;
12503
{$ENDIF}
1 daniel-mar 12504
 
4 daniel-mar 12505
  // Bug fix (and deviation from the SDK). Callback *must* return
12506
  // DIENUM_STOP (= 0) or DIENUM_CONTINUE (=1) in order to work
12507
  // with the debug version of DINPUT.DLL
12508
  TDIEnumDeviceObjectsCallbackA = function (
12509
      var lpddoi: TDIDeviceObjectInstanceA; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
12510
  TDIEnumDeviceObjectsCallbackW = function (
12511
      var lpddoi: TDIDeviceObjectInstanceW; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
12512
  TDIEnumDeviceObjectsCallback = function (
12513
      var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
1 daniel-mar 12514
 
4 daniel-mar 12515
  TDIEnumDeviceObjectsProc = function (
12516
      var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
1 daniel-mar 12517
 
12518
const
4 daniel-mar 12519
  DIDOI_FFACTUATOR        = $00000001;
12520
  DIDOI_FFEFFECTTRIGGER   = $00000002;
12521
  DIDOI_POLLED            = $00008000;
12522
  DIDOI_ASPECTPOSITION    = $00000100;
12523
  DIDOI_ASPECTVELOCITY    = $00000200;
12524
  DIDOI_ASPECTACCEL       = $00000300;
12525
  DIDOI_ASPECTFORCE       = $00000400;
12526
  DIDOI_ASPECTMASK        = $00000F00;
12527
  DIDOI_GUIDISUSAGE       = $00010000;
1 daniel-mar 12528
 
12529
type
12530
  PDIPropHeader = ^TDIPropHeader;
4 daniel-mar 12531
  TDIPropHeader = packed record
1 daniel-mar 12532
    dwSize: DWORD;
12533
    dwHeaderSize: DWORD;
12534
    dwObj: DWORD;
12535
    dwHow: DWORD;
12536
  end;
12537
 
12538
const
4 daniel-mar 12539
  DIPH_DEVICE = 0;
1 daniel-mar 12540
  DIPH_BYOFFSET = 1;
4 daniel-mar 12541
  DIPH_BYID = 2;
12542
  DIPH_BYUSAGE = 3;
1 daniel-mar 12543
 
4 daniel-mar 12544
function DIMAKEUSAGEDWORD(UsagePage, Usage: WORD) : DWORD;
1 daniel-mar 12545
 
12546
type
4 daniel-mar 12547
  PDIPropDWord = ^TDIPropDWord;
12548
  TDIPropDWord = packed record
1 daniel-mar 12549
    diph: TDIPropHeader;
12550
    dwData: DWORD;
12551
  end;
12552
 
12553
  PDIPropRange = ^TDIPropRange;
4 daniel-mar 12554
  TDIPropRange = packed record
1 daniel-mar 12555
    diph: TDIPropHeader;
12556
    lMin: Longint;
12557
    lMax: Longint;
12558
  end;
12559
 
4 daniel-mar 12560
const
12561
  DIPROPRANGE_NOMIN = $80000000;
12562
  DIPROPRANGE_NOMAX = $7FFFFFFF;
1 daniel-mar 12563
 
4 daniel-mar 12564
type
1 daniel-mar 12565
  PDIPropCal = ^TDIPropCal;
4 daniel-mar 12566
  TDIPropCal = packed record
1 daniel-mar 12567
    diph: TDIPropHeader;
4 daniel-mar 12568
    lMin:    LongInt;
12569
    lCenter: LongInt;
12570
    lMax:    LongInt;
1 daniel-mar 12571
  end;
12572
 
12573
  PDIPropGUIDAndPath = ^TDIPropGUIDAndPath;
4 daniel-mar 12574
  TDIPropGUIDAndPath = packed record
1 daniel-mar 12575
    diph: TDIPropHeader;
12576
    guidClass: TGUID;
4 daniel-mar 12577
    wszPath: array [0..MAX_PATH-1] of WideChar;
1 daniel-mar 12578
  end;
12579
 
12580
  PDIPropString = ^TDIPropString;
4 daniel-mar 12581
  TDIPropString = packed record
1 daniel-mar 12582
    diph: TDIPropHeader;
4 daniel-mar 12583
    wsz: array [0..MAX_PATH-1] of WideChar;
1 daniel-mar 12584
  end;
12585
 
4 daniel-mar 12586
type
12587
  MAKEDIPROP = PGUID;
1 daniel-mar 12588
 
4 daniel-mar 12589
const
12590
  DIPROP_BUFFERSIZE = MAKEDIPROP(1);
1 daniel-mar 12591
 
4 daniel-mar 12592
  DIPROP_AXISMODE = MAKEDIPROP(2);
1 daniel-mar 12593
 
4 daniel-mar 12594
  DIPROPAXISMODE_ABS = 0;
12595
  DIPROPAXISMODE_REL = 1;
1 daniel-mar 12596
 
4 daniel-mar 12597
  DIPROP_GRANULARITY = MAKEDIPROP(3);
1 daniel-mar 12598
 
4 daniel-mar 12599
  DIPROP_RANGE = MAKEDIPROP(4);
12600
 
12601
  DIPROP_DEADZONE = MAKEDIPROP(5);
12602
 
12603
  DIPROP_SATURATION = MAKEDIPROP(6);
12604
 
12605
  DIPROP_FFGAIN = MAKEDIPROP(7);
12606
 
12607
  DIPROP_FFLOAD = MAKEDIPROP(8);
12608
 
12609
  DIPROP_AUTOCENTER = MAKEDIPROP(9);
12610
 
1 daniel-mar 12611
  DIPROPAUTOCENTER_OFF = 0;
4 daniel-mar 12612
  DIPROPAUTOCENTER_ON = 1;
1 daniel-mar 12613
 
4 daniel-mar 12614
  DIPROP_CALIBRATIONMODE = MAKEDIPROP(10);
1 daniel-mar 12615
 
12616
  DIPROPCALIBRATIONMODE_COOKED = 0;
4 daniel-mar 12617
  DIPROPCALIBRATIONMODE_RAW = 1;
1 daniel-mar 12618
 
4 daniel-mar 12619
  DIPROP_CALIBRATION      = MAKEDIPROP(11);
1 daniel-mar 12620
 
4 daniel-mar 12621
  DIPROP_GUIDANDPATH      = MAKEDIPROP(12);
12622
 
12623
  DIPROP_INSTANCENAME     = MAKEDIPROP(13);
12624
 
12625
  DIPROP_PRODUCTNAME      = MAKEDIPROP(14);
12626
 
12627
  DIPROP_JOYSTICKID       = MAKEDIPROP(15);
12628
 
12629
  DIPROP_GETPORTDISPLAYNAME       = MAKEDIPROP(16);
12630
 
12631
 
12632
  DIPROP_ENABLEREPORTID       = MAKEDIPROP(17);
12633
 
12634
 
12635
  DIPROP_GETPHYSICALRANGE            = MAKEDIPROP(18);
12636
 
12637
  DIPROP_GETLOGICALRANGE            = MAKEDIPROP(19);
12638
 
12639
 
1 daniel-mar 12640
type
12641
  PDIDeviceObjectData = ^TDIDeviceObjectData;
4 daniel-mar 12642
  TDIDeviceObjectData = packed record
1 daniel-mar 12643
    dwOfs: DWORD;
12644
    dwData: DWORD;
12645
    dwTimeStamp: DWORD;
12646
    dwSequence: DWORD;
12647
  end;
12648
 
12649
const
12650
  DIGDD_PEEK = $00000001;
4 daniel-mar 12651
{
12652
#define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \
12653
                         (int) ((dwSequence1) - (dwSequence2))  cmp 0
12654
}
1 daniel-mar 12655
 
4 daniel-mar 12656
  DISCL_EXCLUSIVE  = $00000001;
1 daniel-mar 12657
  DISCL_NONEXCLUSIVE = $00000002;
4 daniel-mar 12658
  DISCL_FOREGROUND = $00000004;
12659
  DISCL_BACKGROUND = $00000008;
12660
  DISCL_NOWINKEY   = $00000010;
1 daniel-mar 12661
 
4 daniel-mar 12662
 
1 daniel-mar 12663
type
4 daniel-mar 12664
 
12665
  PDIDeviceInstance_DX3A = ^TDIDeviceInstance_DX3A;
12666
  TDIDeviceInstance_DX3A = packed record
1 daniel-mar 12667
    dwSize: DWORD;
12668
    guidInstance: TGUID;
12669
    guidProduct: TGUID;
12670
    dwDevType: DWORD;
4 daniel-mar 12671
    tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
12672
    tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
1 daniel-mar 12673
  end;
12674
 
4 daniel-mar 12675
  PDIDeviceInstance_DX3W = ^TDIDeviceInstance_DX3W;
12676
  TDIDeviceInstance_DX3W = packed record
1 daniel-mar 12677
    dwSize: DWORD;
12678
    guidInstance: TGUID;
12679
    guidProduct: TGUID;
12680
    dwDevType: DWORD;
4 daniel-mar 12681
    tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
12682
    tszProductName: Array [0..MAX_PATH-1] of WideChar;
1 daniel-mar 12683
  end;
12684
 
4 daniel-mar 12685
  PDIDeviceInstance_DX3 = ^TDIDeviceInstance_DX3;
12686
{$IFDEF UNICODE}
12687
  TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3W;
12688
{$ELSE}
12689
  TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3A;
1 daniel-mar 12690
{$ENDIF}
12691
 
4 daniel-mar 12692
  PDIDeviceInstance_DX5A = ^TDIDeviceInstance_DX5A;
12693
  TDIDeviceInstance_DX5A = packed record
1 daniel-mar 12694
    dwSize: DWORD;
12695
    guidInstance: TGUID;
12696
    guidProduct: TGUID;
12697
    dwDevType: DWORD;
4 daniel-mar 12698
    tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
12699
    tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
12700
    guidFFDriver: TGUID;
12701
    wUsagePage: WORD;
12702
    wUsage: WORD;
1 daniel-mar 12703
  end;
12704
 
4 daniel-mar 12705
  PDIDeviceInstance_DX5W = ^TDIDeviceInstance_DX5W;
12706
  TDIDeviceInstance_DX5W = packed record
1 daniel-mar 12707
    dwSize: DWORD;
12708
    guidInstance: TGUID;
12709
    guidProduct: TGUID;
12710
    dwDevType: DWORD;
4 daniel-mar 12711
    tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
12712
    tszProductName: Array [0..MAX_PATH-1] of WideChar;
1 daniel-mar 12713
    guidFFDriver: TGUID;
12714
    wUsagePage: WORD;
12715
    wUsage: WORD;
12716
  end;
12717
 
4 daniel-mar 12718
  PDIDeviceInstance_DX5 = ^TDIDeviceInstance_DX5;
12719
{$IFDEF UNICODE}
12720
  TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5W;
12721
{$ELSE}
12722
  TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5A;
1 daniel-mar 12723
{$ENDIF}
12724
 
4 daniel-mar 12725
  PDIDeviceInstanceA = ^TDIDeviceInstanceA;
12726
  PDIDeviceInstanceW = ^TDIDeviceInstanceW;
12727
  PDIDeviceInstance = ^TDIDeviceInstance;
12728
{$IFDEF DIRECTX3}
12729
  TDIDeviceInstanceA = TDIDeviceInstance_DX3A;
12730
  TDIDeviceInstanceW = TDIDeviceInstance_DX3W;
12731
  TDIDeviceInstance = TDIDeviceInstance_DX3;
12732
{$ELSE}
12733
  TDIDeviceInstanceA = TDIDeviceInstance_DX5A;
12734
  TDIDeviceInstanceW = TDIDeviceInstance_DX5W;
12735
  TDIDeviceInstance = TDIDeviceInstance_DX5;
12736
{$ENDIF}
1 daniel-mar 12737
 
4 daniel-mar 12738
  IDirectInputDeviceA = interface (IUnknown)
12739
    ['{5944E680-C92E-11CF-BFC7-444553540000}']
12740
    (*** IDirectInputDeviceA methods ***)
12741
    function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
12742
    function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA;
12743
        pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
12744
    function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
12745
        HResult;  stdcall;
12746
    function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader) :
12747
        HResult;  stdcall;
12748
    function Acquire : HResult;  stdcall;
12749
    function Unacquire : HResult;  stdcall;
12750
    function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
12751
    function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
12752
        var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
12753
    function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
12754
    function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
12755
    function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
12756
    function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj: DWORD;
12757
        dwHow: DWORD) : HResult;  stdcall;
12758
    function GetDeviceInfo(var pdidi: TDIDeviceInstanceA) : HResult;  stdcall;
12759
    function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
12760
    function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
12761
  end;
1 daniel-mar 12762
 
4 daniel-mar 12763
  IDirectInputDeviceW = interface (IUnknown)
1 daniel-mar 12764
    ['{5944E681-C92E-11CF-BFC7-444553540000}']
4 daniel-mar 12765
    (*** IDirectInputDeviceW methods ***)
12766
    function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
1 daniel-mar 12767
    function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW;
4 daniel-mar 12768
        pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
12769
    function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
12770
        HResult;  stdcall;
12771
    function SetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
12772
        HResult;  stdcall;
12773
    function Acquire : HResult;  stdcall;
12774
    function Unacquire : HResult;  stdcall;
12775
    function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
12776
    function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
12777
        var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
12778
    function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
12779
    function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
12780
    function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
1 daniel-mar 12781
    function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj: DWORD;
4 daniel-mar 12782
        dwHow: DWORD) : HResult;  stdcall;
12783
    function GetDeviceInfo(var pdidi: TDIDeviceInstanceW) : HResult;  stdcall;
12784
    function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
12785
    function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
1 daniel-mar 12786
  end;
12787
 
4 daniel-mar 12788
{$IFDEF UNICODE}
12789
  IDirectInputDevice = IDirectInputDeviceW;
12790
{$ELSE}
1 daniel-mar 12791
  IDirectInputDevice = IDirectInputDeviceA;
4 daniel-mar 12792
{$ENDIF}
1 daniel-mar 12793
 
12794
const
4 daniel-mar 12795
  DISFFC_RESET            = $00000001;
12796
  DISFFC_STOPALL          = $00000002;
12797
  DISFFC_PAUSE            = $00000004;
12798
  DISFFC_CONTINUE         = $00000008;
12799
  DISFFC_SETACTUATORSON   = $00000010;
12800
  DISFFC_SETACTUATORSOFF  = $00000020;
1 daniel-mar 12801
 
4 daniel-mar 12802
  DIGFFS_EMPTY            = $00000001;
12803
  DIGFFS_STOPPED          = $00000002;
12804
  DIGFFS_PAUSED           = $00000004;
12805
  DIGFFS_ACTUATORSON      = $00000010;
12806
  DIGFFS_ACTUATORSOFF     = $00000020;
12807
  DIGFFS_POWERON          = $00000040;
12808
  DIGFFS_POWEROFF         = $00000080;
12809
  DIGFFS_SAFETYSWITCHON   = $00000100;
12810
  DIGFFS_SAFETYSWITCHOFF  = $00000200;
12811
  DIGFFS_USERFFSWITCHON   = $00000400;
12812
  DIGFFS_USERFFSWITCHOFF  = $00000800;
12813
  DIGFFS_DEVICELOST       = $80000000;
1 daniel-mar 12814
 
12815
type
12816
  PDIEffectInfoA = ^TDIEffectInfoA;
4 daniel-mar 12817
  TDIEffectInfoA = packed record
12818
    dwSize : DWORD;
12819
    guid : TGUID;
12820
    dwEffType : DWORD;
12821
    dwStaticParams : DWORD;
12822
    dwDynamicParams : DWORD;
12823
    tszName : array [0..MAX_PATH-1] of CHAR;
1 daniel-mar 12824
  end;
12825
 
12826
  PDIEffectInfoW = ^TDIEffectInfoW;
4 daniel-mar 12827
  TDIEffectInfoW = packed record
12828
    dwSize : DWORD;
12829
    guid : TGUID;
12830
    dwEffType : DWORD;
12831
    dwStaticParams : DWORD;
12832
    dwDynamicParams : DWORD;
12833
    tszName : array [0..MAX_PATH-1] of WCHAR;
1 daniel-mar 12834
  end;
12835
 
4 daniel-mar 12836
  PDIEffectInfo = ^TDIEffectInfo;
12837
{$IFDEF UNICODE}
12838
  TDIEffectInfo = TDIEffectInfoW;
12839
{$ELSE}
12840
  TDIEffectInfo = TDIEffectInfoA;
12841
{$ENDIF}
1 daniel-mar 12842
 
4 daniel-mar 12843
const
12844
  DISDD_CONTINUE          = $00000001;
1 daniel-mar 12845
 
4 daniel-mar 12846
  // Bug fix & deviation from the SDK: Must return DIENUM_STOP or
12847
  // DIENUM_CONTINUE (=1) in order to work with the debug version of DINPUT.DLL
12848
type
12849
  TDIEnumEffectsCallbackA =
12850
      function(var pdei: TDIEffectInfoA; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
12851
  TDIEnumEffectsCallbackW =
12852
      function(var pdei: TDIEffectInfoW; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
12853
  TDIEnumEffectsCallback =
12854
      function(var pdei: TDIEffectInfo; pvRef: pointer) : Integer; stdcall; // BOOL; stdcall;
12855
  TDIEnumEffectsProc = TDIEnumEffectsCallback;
1 daniel-mar 12856
 
4 daniel-mar 12857
  TDIEnumCreatedEffectObjectsCallback =
12858
      function(peff: IDirectInputEffect; pvRev: pointer): Integer; stdcall; // BOOL; stdcall;
12859
  TDIEnumCreatedEffectObjectsProc = TDIEnumCreatedEffectObjectsCallback;
1 daniel-mar 12860
 
4 daniel-mar 12861
  IDirectInputDevice2A = interface (IDirectInputDeviceA)
12862
    ['{5944E682-C92E-11CF-BFC7-444553540000}']
12863
    (*** IDirectInputDevice2A methods ***)
12864
    function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
12865
        var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
12866
    function EnumEffects(lpCallback: TDIEnumEffectsCallbackA;
12867
        pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
12868
    function GetEffectInfo(pdei: TDIEffectInfoA; const rguid: TGUID) : HResult;  stdcall;
12869
    function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
12870
    function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
1 daniel-mar 12871
    function EnumCreatedEffectObjects(lpCallback:
4 daniel-mar 12872
        TDIEnumCreatedEffectObjectsCallback;
12873
        pvRef: pointer; fl: DWORD) : HResult;  stdcall;
12874
    function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
12875
    function Poll : HResult;  stdcall;
12876
    function SendDeviceData
12877
        (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
12878
        var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
1 daniel-mar 12879
  end;
12880
 
4 daniel-mar 12881
  IDirectInputDevice2W = interface (IDirectInputDeviceW)
12882
    ['{5944E683-C92E-11CF-BFC7-444553540000}']
12883
    (*** IDirectInputDevice2W methods ***)
12884
    function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
12885
        var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
12886
    function EnumEffects(lpCallback: TDIEnumEffectsCallbackW;
12887
        pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
12888
    function GetEffectInfo(pdei: TDIEffectInfoW; const rguid: TGUID) : HResult;  stdcall;
12889
    function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
12890
    function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
1 daniel-mar 12891
    function EnumCreatedEffectObjects(lpCallback:
4 daniel-mar 12892
        TDIEnumCreatedEffectObjectsCallback;
12893
        pvRef: pointer; fl: DWORD) : HResult;  stdcall;
12894
    function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
12895
    function Poll : HResult;  stdcall;
12896
    function SendDeviceData
12897
        (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
12898
        var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
1 daniel-mar 12899
  end;
12900
 
4 daniel-mar 12901
{$IFDEF UNICODE}
12902
  IDirectInputDevice2 = IDirectInputDevice2W;
12903
{$ELSE}
1 daniel-mar 12904
  IDirectInputDevice2 = IDirectInputDevice2A;
4 daniel-mar 12905
{$ENDIF}
1 daniel-mar 12906
 
4 daniel-mar 12907
const
12908
  DIFEF_DEFAULT               = $00000000;
12909
  DIFEF_INCLUDENONSTANDARD    = $00000001;
12910
  DIFEF_MODIFYIFNEEDED          = $00000010;
1 daniel-mar 12911
 
4 daniel-mar 12912
///Weitermachen:  (as: nur die Deklarationen eingefüllt, die ich zum Testen gebraucht habe)
12913
 
12914
type
12915
  TEnumEffectsInFileCallback = function(gaga, huhu: Integer): HResult;
12916
 
12917
type
12918
  IDirectInputDevice7W = interface (IDirectInputDevice2W)
1 daniel-mar 12919
    ['{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}']
4 daniel-mar 12920
    (*** IDirectInputDevice7A methods ***)
12921
    function EnumEffectsInFile(const lpszFileName: PChar;
12922
      pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
12923
    function WriteEffectToFile(const lpszFileName: PChar;
12924
      dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
1 daniel-mar 12925
  end;
12926
 
4 daniel-mar 12927
  IDirectInputDevice7A = interface (IDirectInputDevice2A)
12928
    ['{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}']
12929
    function EnumEffectsInFile(const lpszFileName: PChar;
12930
      pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
12931
    function WriteEffectToFile(const lpszFileName: PChar;
12932
      dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
12933
  end;
12934
 
12935
{$IFDEF UNICODE}
12936
  IDirectInputDevice7 = IDirectInputDevice7W;
12937
{$ELSE}
1 daniel-mar 12938
  IDirectInputDevice7 = IDirectInputDevice7A;
4 daniel-mar 12939
{$ENDIF}
1 daniel-mar 12940
 
4 daniel-mar 12941
(****************************************************************************
12942
 *
12943
 *      Mouse
12944
 *
12945
 ****************************************************************************)
1 daniel-mar 12946
 
12947
type
4 daniel-mar 12948
  PDIMouseState = ^TDIMouseState;
12949
  TDIMouseState = packed record
1 daniel-mar 12950
    lX: Longint;
12951
    lY: Longint;
12952
    lZ: Longint;
4 daniel-mar 12953
    rgbButtons: Array [0..3] of BYTE;  // up to 4 buttons
1 daniel-mar 12954
  end;
12955
 
4 daniel-mar 12956
  PDIMouseState2 = ^TDIMouseState2;
12957
  TDIMouseState2 = packed record
1 daniel-mar 12958
    lX: Longint;
12959
    lY: Longint;
12960
    lZ: Longint;
4 daniel-mar 12961
    rgbButtons: Array [0..7] of BYTE;  // up to 8 buttons
1 daniel-mar 12962
  end;
12963
 
4 daniel-mar 12964
const
12965
  DIMOFS_X       = 0;
12966
  DIMOFS_Y       = 4;
12967
  DIMOFS_Z       = 8;
12968
  DIMOFS_BUTTON0 = 12;
12969
  DIMOFS_BUTTON1 = 13;
12970
  DIMOFS_BUTTON2 = 14;
12971
  DIMOFS_BUTTON3 = 15;
12972
  // DX7 supports up to 8 mouse buttons
12973
  DIMOFS_BUTTON4 = DIMOFS_BUTTON0+4;
12974
  DIMOFS_BUTTON5 = DIMOFS_BUTTON0+5;
12975
  DIMOFS_BUTTON6 = DIMOFS_BUTTON0+6;
12976
  DIMOFS_BUTTON7 = DIMOFS_BUTTON0+7;
1 daniel-mar 12977
 
4 daniel-mar 12978
 
1 daniel-mar 12979
const
4 daniel-mar 12980
  _c_dfDIMouse_Objects: array[0..6] of TDIObjectDataFormat = (
12981
    (  pguid: @GUID_XAxis;
12982
       dwOfs: DIMOFS_X;
12983
       dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
12984
       dwFlags: 0),
12985
    (  pguid: @GUID_YAxis;
12986
       dwOfs: DIMOFS_Y;
12987
       dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
12988
       dwFlags: 0),
12989
    (  pguid: @GUID_ZAxis;
12990
       dwOfs: DIMOFS_Z;
12991
       dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION;
12992
       dwFlags: 0),
12993
    (  pguid: nil;
12994
       dwOfs: DIMOFS_BUTTON0;
12995
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
12996
       dwFlags: 0),
12997
    (  pguid: nil;
12998
       dwOfs: DIMOFS_BUTTON1;
12999
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13000
       dwFlags: 0),
13001
    (  pguid: nil;
13002
       dwOfs: DIMOFS_BUTTON2;
13003
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13004
       dwFlags: 0),
13005
    (  pguid: nil;
13006
       dwOfs: DIMOFS_BUTTON3;
13007
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13008
       dwFlags: 0)
13009
    );
1 daniel-mar 13010
 
13011
  c_dfDIMouse: TDIDataFormat = (
4 daniel-mar 13012
    dwSize: Sizeof(c_dfDIMouse);              // $18
13013
    dwObjSize: Sizeof(TDIObjectDataFormat);   // $10
13014
    dwFlags: DIDF_RELAXIS;                    //
13015
    dwDataSize: Sizeof(TDIMouseState);        // $10
13016
    dwNumObjs: High(_c_dfDIMouse_Objects)+1;  // 7
13017
    rgodf: @_c_dfDIMouse_Objects[Low(_c_dfDIMouse_Objects)]
1 daniel-mar 13018
  );
13019
 
13020
 
4 daniel-mar 13021
  _c_dfDIMouse2_Objects: array[0..10] of TDIObjectDataFormat = (
13022
    (  pguid: @GUID_XAxis;
13023
       dwOfs: DIMOFS_X;
13024
       dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
13025
       dwFlags: 0),
13026
    (  pguid: @GUID_YAxis;
13027
       dwOfs: DIMOFS_Y;
13028
       dwType: DIDFT_AXIS or DIDFT_NOCOLLECTION;
13029
       dwFlags: 0),
13030
    (  pguid: @GUID_ZAxis;
13031
       dwOfs: DIMOFS_Z;
13032
       dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION;
13033
       dwFlags: 0),
13034
    (  pguid: nil;
13035
       dwOfs: DIMOFS_BUTTON0;
13036
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13037
       dwFlags: 0),
13038
    (  pguid: nil;
13039
       dwOfs: DIMOFS_BUTTON1;
13040
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13041
       dwFlags: 0),
13042
    (  pguid: nil;
13043
       dwOfs: DIMOFS_BUTTON2;
13044
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13045
       dwFlags: 0),
13046
    (  pguid: nil;
13047
       dwOfs: DIMOFS_BUTTON3;
13048
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13049
       dwFlags: 0),
13050
    // fields introduced with IDirectInputDevice7.GetDeviceState       
13051
    (  pguid: nil;
13052
       dwOfs: DIMOFS_BUTTON4;
13053
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13054
       dwFlags: 0),
13055
    (  pguid: nil;
13056
       dwOfs: DIMOFS_BUTTON5;
13057
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13058
       dwFlags: 0),
13059
    (  pguid: nil;
13060
       dwOfs: DIMOFS_BUTTON6;
13061
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13062
       dwFlags: 0),
13063
    (  pguid: nil;
13064
       dwOfs: DIMOFS_BUTTON7;
13065
       dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13066
       dwFlags: 0)
13067
    );
1 daniel-mar 13068
 
4 daniel-mar 13069
  c_dfDIMouse2: TDIDataFormat = (
13070
    dwSize: Sizeof(c_dfDIMouse);              // $18
13071
    dwObjSize: Sizeof(TDIObjectDataFormat);   // $10
13072
    dwFlags: DIDF_RELAXIS;                    //
13073
    dwDataSize: Sizeof(TDIMouseState2);        // $14
13074
    dwNumObjs: High(_c_dfDIMouse_Objects)+1;  // 11
13075
    rgodf: @_c_dfDIMouse2_Objects[Low(_c_dfDIMouse2_Objects)]
1 daniel-mar 13076
  );
13077
 
13078
 
4 daniel-mar 13079
(****************************************************************************
13080
 *
13081
 *      DirectInput keyboard scan codes
13082
 *
13083
 ****************************************************************************)
1 daniel-mar 13084
 
13085
const
13086
  DIK_ESCAPE          = $01;
13087
  DIK_1               = $02;
13088
  DIK_2               = $03;
13089
  DIK_3               = $04;
13090
  DIK_4               = $05;
13091
  DIK_5               = $06;
13092
  DIK_6               = $07;
13093
  DIK_7               = $08;
13094
  DIK_8               = $09;
13095
  DIK_9               = $0A;
13096
  DIK_0               = $0B;
4 daniel-mar 13097
  DIK_MINUS           = $0C;    (* - on main keyboard *)
1 daniel-mar 13098
  DIK_EQUALS          = $0D;
4 daniel-mar 13099
  DIK_BACK            = $0E;    (* backspace *)
1 daniel-mar 13100
  DIK_TAB             = $0F;
13101
  DIK_Q               = $10;
13102
  DIK_W               = $11;
13103
  DIK_E               = $12;
13104
  DIK_R               = $13;
13105
  DIK_T               = $14;
13106
  DIK_Y               = $15;
13107
  DIK_U               = $16;
13108
  DIK_I               = $17;
13109
  DIK_O               = $18;
13110
  DIK_P               = $19;
13111
  DIK_LBRACKET        = $1A;
13112
  DIK_RBRACKET        = $1B;
4 daniel-mar 13113
  DIK_RETURN          = $1C;    (* Enter on main keyboard *)
1 daniel-mar 13114
  DIK_LCONTROL        = $1D;
13115
  DIK_A               = $1E;
13116
  DIK_S               = $1F;
13117
  DIK_D               = $20;
13118
  DIK_F               = $21;
13119
  DIK_G               = $22;
13120
  DIK_H               = $23;
13121
  DIK_J               = $24;
13122
  DIK_K               = $25;
13123
  DIK_L               = $26;
13124
  DIK_SEMICOLON       = $27;
13125
  DIK_APOSTROPHE      = $28;
4 daniel-mar 13126
  DIK_GRAVE           = $29;    (* accent grave *)
1 daniel-mar 13127
  DIK_LSHIFT          = $2A;
13128
  DIK_BACKSLASH       = $2B;
13129
  DIK_Z               = $2C;
13130
  DIK_X               = $2D;
13131
  DIK_C               = $2E;
13132
  DIK_V               = $2F;
13133
  DIK_B               = $30;
13134
  DIK_N               = $31;
13135
  DIK_M               = $32;
13136
  DIK_COMMA           = $33;
4 daniel-mar 13137
  DIK_PERIOD          = $34;    (* . on main keyboard *)
13138
  DIK_SLASH           = $35;    (* / on main keyboard *)
1 daniel-mar 13139
  DIK_RSHIFT          = $36;
4 daniel-mar 13140
  DIK_MULTIPLY        = $37;    (* * on numeric keypad *)
13141
  DIK_LMENU           = $38;    (* left Alt *)
1 daniel-mar 13142
  DIK_SPACE           = $39;
13143
  DIK_CAPITAL         = $3A;
13144
  DIK_F1              = $3B;
13145
  DIK_F2              = $3C;
13146
  DIK_F3              = $3D;
13147
  DIK_F4              = $3E;
13148
  DIK_F5              = $3F;
13149
  DIK_F6              = $40;
13150
  DIK_F7              = $41;
13151
  DIK_F8              = $42;
13152
  DIK_F9              = $43;
13153
  DIK_F10             = $44;
13154
  DIK_NUMLOCK         = $45;
4 daniel-mar 13155
  DIK_SCROLL          = $46;    (* Scroll Lock *)
1 daniel-mar 13156
  DIK_NUMPAD7         = $47;
13157
  DIK_NUMPAD8         = $48;
13158
  DIK_NUMPAD9         = $49;
4 daniel-mar 13159
  DIK_SUBTRACT        = $4A;    (* - on numeric keypad *)
1 daniel-mar 13160
  DIK_NUMPAD4         = $4B;
13161
  DIK_NUMPAD5         = $4C;
13162
  DIK_NUMPAD6         = $4D;
4 daniel-mar 13163
  DIK_ADD             = $4E;    (* + on numeric keypad *)
1 daniel-mar 13164
  DIK_NUMPAD1         = $4F;
13165
  DIK_NUMPAD2         = $50;
13166
  DIK_NUMPAD3         = $51;
13167
  DIK_NUMPAD0         = $52;
4 daniel-mar 13168
  DIK_DECIMAL         = $53;    (* . on numeric keypad *)
13169
  // $54 to $56 unassigned
1 daniel-mar 13170
  DIK_F11             = $57;
13171
  DIK_F12             = $58;
4 daniel-mar 13172
  // $59 to $63 unassigned
13173
  DIK_F13             = $64;    (*                     (NEC PC98) *)
13174
  DIK_F14             = $65;    (*                     (NEC PC98) *)
13175
  DIK_F15             = $66;    (*                     (NEC PC98) *)
13176
  // $67 to $6F unassigned
13177
  DIK_KANA            = $70;    (* (Japanese keyboard)            *)
13178
  DIK_CONVERT         = $79;    (* (Japanese keyboard)            *)
13179
  DIK_NOCONVERT       = $7B;    (* (Japanese keyboard)            *)
13180
  DIK_YEN             = $7D;    (* (Japanese keyboard)            *)
13181
  DIK_NUMPADEQUALS    = $8D;    (* = on numeric keypad (NEC PC98) *)
13182
  // $8E to $8F unassigned
13183
  DIK_CIRCUMFLEX      = $90;    (* (Japanese keyboard)            *)
13184
  DIK_AT              = $91;    (*                     (NEC PC98) *)
13185
  DIK_COLON           = $92;    (*                     (NEC PC98) *)
13186
  DIK_UNDERLINE       = $93;    (*                     (NEC PC98) *)
13187
  DIK_KANJI           = $94;    (* (Japanese keyboard)            *)
13188
  DIK_STOP            = $95;    (*                     (NEC PC98) *)
13189
  DIK_AX              = $96;    (*                     (Japan AX) *)
13190
  DIK_UNLABELED       = $97;    (*                        (J3100) *)
13191
  // $98 to $99 unassigned
13192
  DIK_NUMPADENTER     = $9C;    (* Enter on numeric keypad *)
1 daniel-mar 13193
  DIK_RCONTROL        = $9D;
4 daniel-mar 13194
  // $9E to $B2 unassigned
13195
  DIK_NUMPADCOMMA     = $B3;    (* , on numeric keypad (NEC PC98) *)
13196
  // $B4 unassigned
13197
  DIK_DIVIDE          = $B5;    (* / on numeric keypad *)
13198
  // $B6 unassigned
1 daniel-mar 13199
  DIK_SYSRQ           = $B7;
4 daniel-mar 13200
  DIK_RMENU           = $B8;    (* right Alt *)
13201
  // $B9 to $C4 unassigned
13202
  DIK_PAUSE           = $C5;    (* Pause (watch out - not realiable on some kbds) *)
13203
  // $C6 unassigned
13204
  DIK_HOME            = $C7;    (* Home on arrow keypad *)
13205
  DIK_UP              = $C8;    (* UpArrow on arrow keypad *)
13206
  DIK_PRIOR           = $C9;    (* PgUp on arrow keypad *)
13207
  // $CA unassigned
13208
  DIK_LEFT            = $CB;    (* LeftArrow on arrow keypad *)
13209
  DIK_RIGHT           = $CD;    (* RightArrow on arrow keypad *)
13210
  // $CF unassigned
13211
  DIK_END             = $CF;    (* End on arrow keypad *)
13212
  DIK_DOWN            = $D0;    (* DownArrow on arrow keypad *)
13213
  DIK_NEXT            = $D1;    (* PgDn on arrow keypad *)
13214
  DIK_INSERT          = $D2;    (* Insert on arrow keypad *)
13215
  DIK_DELETE          = $D3;    (* Delete on arrow keypad *)
13216
  DIK_LWIN            = $DB;    (* Left Windows key *)
13217
  DIK_RWIN            = $DC;    (* Right Windows key *)
13218
  DIK_APPS            = $DD;    (* AppMenu key *)
13219
  // New with DX 6.1 & Win98
13220
  DIK_POWER           = $DE;
13221
  DIK_SLEEP           = $DF;
13222
  // $E0 to $E2 unassigned
13223
  // $E3 = Wake up ("translated" in German DInput to "Kielwasser" (ship's wake) ;-)
1 daniel-mar 13224
 
4 daniel-mar 13225
(*
13226
 *  Alternate names for keys, to facilitate transition from DOS.
13227
 *)
13228
  DIK_BACKSPACE      = DIK_BACK    ;        (* backspace *)
13229
  DIK_NUMPADSTAR     = DIK_MULTIPLY;        (* * on numeric keypad *)
13230
  DIK_LALT           = DIK_LMENU   ;        (* left Alt *)
13231
  DIK_CAPSLOCK       = DIK_CAPITAL ;        (* CapsLock *)
13232
  DIK_NUMPADMINUS    = DIK_SUBTRACT;        (* - on numeric keypad *)
13233
  DIK_NUMPADPLUS     = DIK_ADD     ;        (* + on numeric keypad *)
13234
  DIK_NUMPADPERIOD   = DIK_DECIMAL ;        (* . on numeric keypad *)
13235
  DIK_NUMPADSLASH    = DIK_DIVIDE  ;        (* / on numeric keypad *)
13236
  DIK_RALT           = DIK_RMENU   ;        (* right Alt *)
13237
  DIK_UPARROW        = DIK_UP      ;        (* UpArrow on arrow keypad *)
13238
  DIK_PGUP           = DIK_PRIOR   ;        (* PgUp on arrow keypad *)
13239
  DIK_LEFTARROW      = DIK_LEFT    ;        (* LeftArrow on arrow keypad *)
13240
  DIK_RIGHTARROW     = DIK_RIGHT   ;        (* RightArrow on arrow keypad *)
13241
  DIK_DOWNARROW      = DIK_DOWN    ;        (* DownArrow on arrow keypad *)
13242
  DIK_PGDN           = DIK_NEXT    ;        (* PgDn on arrow keypad *)
1 daniel-mar 13243
 
4 daniel-mar 13244
(****************************************************************************
13245
 *
13246
 *      Keyboard
13247
 *
13248
 ****************************************************************************)
1 daniel-mar 13249
 
4 daniel-mar 13250
 
1 daniel-mar 13251
type
4 daniel-mar 13252
  TDIKeyboardState = array[0..255] of Byte;
13253
(*
13254
const
13255
  _c_dfDIKeyboard_Objects: array[0..255] of TDIObjectDataFormat = (
13256
    (  pguid: @GUID_Key;
13257
       dwOfs: DIK_ESCAPE;
13258
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13259
       dwFlags: 0),
13260
    // -------- top row (except function keys) on main kbd ------------
13261
    (  pguid: @GUID_Key;
13262
       dwOfs: DIK_1;  // "1" on main kbd, Offset 2
13263
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13264
       dwFlags: 0),
13265
    (  pguid: @GUID_Key;
13266
       dwOfs: DIK_2;  // "2" on main kbd, Offset 3
13267
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13268
       dwFlags: 0),
13269
    (  pguid: @GUID_Key;
13270
       dwOfs: DIK_3;  // "3" on main kbd, etc.
13271
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13272
       dwFlags: 0),
13273
    (  pguid: @GUID_Key;
13274
       dwOfs: DIK_4;
13275
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13276
       dwFlags: 0),
13277
    (  pguid: @GUID_Key;
13278
       dwOfs: DIK_5;
13279
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13280
       dwFlags: 0),
13281
    (  pguid: @GUID_Key;
13282
       dwOfs: DIK_6;
13283
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13284
       dwFlags: 0),
13285
    (  pguid: @GUID_Key;
13286
       dwOfs: DIK_7;
13287
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13288
       dwFlags: 0),
13289
    (  pguid: @GUID_Key;
13290
       dwOfs: DIK_8;
13291
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13292
       dwFlags: 0),
13293
    (  pguid: @GUID_Key;
13294
       dwOfs: DIK_9;
13295
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13296
       dwFlags: 0),
13297
    (  pguid: @GUID_Key;
13298
       dwOfs: DIK_0;  // "0", main kbd
13299
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13300
       dwFlags: 0),
13301
    (  pguid: @GUID_Key;
13302
       dwOfs: DIK_MINUS; // "-" on US kbds, "ß" on german kbds
13303
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13304
       dwFlags: 0),
13305
    (  pguid: @GUID_Key;
13306
       dwOfs: DIK_EQUALS;  // "=" for US, "´" for german
13307
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13308
       dwFlags: 0),
13309
    (  pguid: @GUID_Key;
13310
       dwOfs: DIK_BACK;  // backspace
13311
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13312
       dwFlags: 0),
13313
    // ----------- 2nd row -----------------------
13314
    (  pguid: @GUID_Key;
13315
       dwOfs: DIK_TAB;
13316
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13317
       dwFlags: 0),
13318
    (  pguid: @GUID_Key;
13319
       dwOfs: DIK_Q;
13320
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13321
       dwFlags: 0),
13322
    (  pguid: @GUID_Key;
13323
       dwOfs: DIK_W;
13324
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13325
       dwFlags: 0),
13326
    (  pguid: @GUID_Key;
13327
       dwOfs: DIK_E;
13328
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13329
       dwFlags: 0),
13330
    (  pguid: @GUID_Key;
13331
       dwOfs: DIK_R;
13332
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13333
       dwFlags: 0),
13334
    (  pguid: @GUID_Key;
13335
       dwOfs: DIK_T;
13336
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13337
       dwFlags: 0),
13338
    (  pguid: @GUID_Key;
13339
       dwOfs: DIK_Y;  // "Z" on german & french keyboards
13340
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13341
       dwFlags: 0),
13342
    (  pguid: @GUID_Key;
13343
       dwOfs: DIK_U;
13344
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13345
       dwFlags: 0),
13346
    (  pguid: @GUID_Key;
13347
       dwOfs: DIK_I;
13348
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13349
       dwFlags: 0),
13350
    (  pguid: @GUID_Key;
13351
       dwOfs: DIK_O;
13352
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13353
       dwFlags: 0),
13354
    (  pguid: @GUID_Key;
13355
       dwOfs: DIK_P;
13356
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13357
       dwFlags: 0),
13358
    (  pguid: @GUID_Key;
13359
       dwOfs: DIK_LBRACKET;  // "Ü" on german keyboards
13360
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13361
       dwFlags: 0),
13362
    (  pguid: @GUID_Key;
13363
       dwOfs: DIK_RBRACKET;  // "+" on german keyboards
13364
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13365
       dwFlags: 0),
13366
    (  pguid: @GUID_Key;
13367
       dwOfs: DIK_RETURN;   // Enter on main kbd
13368
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13369
       dwFlags: 0),
13370
    // next row should really start with caps lock but doesn't ;-)
13371
    // (DIK_CAPITAL is Offset $3A, i.e. after 4th row)
13372
    (  pguid: @GUID_Key;
13373
       dwOfs: DIK_LCONTROL;  // Left Ctrl (german kbds: "Strg")
13374
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13375
       dwFlags: 0),
13376
    // ----------- 3rd row ------------------------------
13377
    (  pguid: @GUID_Key;
13378
       dwOfs: DIK_A;
13379
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13380
       dwFlags: 0),
13381
    (  pguid: @GUID_Key;
13382
       dwOfs: DIK_S;
13383
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13384
       dwFlags: 0),
13385
    (  pguid: @GUID_Key;
13386
       dwOfs: DIK_D;
13387
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13388
       dwFlags: 0),
13389
    (  pguid: @GUID_Key;
13390
       dwOfs: DIK_F;
13391
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13392
       dwFlags: 0),
13393
    (  pguid: @GUID_Key;
13394
       dwOfs: DIK_G;
13395
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13396
       dwFlags: 0),
13397
    (  pguid: @GUID_Key;
13398
       dwOfs: DIK_H;
13399
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13400
       dwFlags: 0),
13401
    (  pguid: @GUID_Key;
13402
       dwOfs: DIK_J;
13403
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13404
       dwFlags: 0),
13405
    (  pguid: @GUID_Key;
13406
       dwOfs: DIK_K;
13407
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13408
       dwFlags: 0),
13409
    (  pguid: @GUID_Key;
13410
       dwOfs: DIK_L;
13411
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13412
       dwFlags: 0),
13413
    (  pguid: @GUID_Key;
13414
       dwOfs: DIK_SEMICOLON;  // "Ö" on german kbds
13415
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13416
       dwFlags: 0),
13417
    (  pguid: @GUID_Key;
13418
       dwOfs: DIK_APOSTROPHE;  // "Ä" on german kbds
13419
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13420
       dwFlags: 0),
13421
    (  pguid: @GUID_Key;
13422
       dwOfs: DIK_GRAVE; // accent grave, "'" on german kbds
13423
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13424
       dwFlags: 0),
13425
    // ---------------- 4th row -----------------------
13426
    (  pguid: @GUID_Key;
13427
       dwOfs: DIK_LSHIFT;  // left shift
13428
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13429
       dwFlags: 0),
13430
    (  pguid: @GUID_Key;
13431
       dwOfs: DIK_BACKSLASH;  // "<" on german kbds
13432
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13433
       dwFlags: 0),
13434
    (  pguid: @GUID_Key;
13435
       dwOfs: DIK_Z;     // "Y" on german kbds
13436
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13437
       dwFlags: 0),
13438
    (  pguid: @GUID_Key;
13439
       dwOfs: DIK_X;
13440
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13441
       dwFlags: 0),
13442
    (  pguid: @GUID_Key;
13443
       dwOfs: DIK_C;
13444
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13445
       dwFlags: 0),
13446
    (  pguid: @GUID_Key;
13447
       dwOfs: DIK_V;
13448
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13449
       dwFlags: 0),
13450
    (  pguid: @GUID_Key;
13451
       dwOfs: DIK_B;
13452
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13453
       dwFlags: 0),
13454
    (  pguid: @GUID_Key;
13455
       dwOfs: DIK_N;
13456
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13457
       dwFlags: 0),
13458
    (  pguid: @GUID_Key;
13459
       dwOfs: DIK_M;
13460
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13461
       dwFlags: 0),
13462
    (  pguid: @GUID_Key;
13463
       dwOfs: DIK_COMMA;
13464
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13465
       dwFlags: 0),
13466
    (  pguid: @GUID_Key;
13467
       dwOfs: DIK_PERIOD;  // on main kbd
13468
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13469
       dwFlags: 0),
13470
    (  pguid: @GUID_Key;
13471
       dwOfs: DIK_SLASH;  // "-" on german kbds
13472
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13473
       dwFlags: 0),
13474
    (  pguid: @GUID_Key;
13475
       dwOfs: DIK_RSHIFT;
13476
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13477
       dwFlags: 0),
13478
    // --- misc keys (bye, bye, order) ----------------
13479
    (  pguid: @GUID_Key;
13480
       dwOfs: DIK_MULTIPLY;  // on numeric keypad
13481
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13482
       dwFlags: 0),
13483
    (  pguid: @GUID_Key;
13484
       dwOfs: DIK_LMENU;  // left ALT
13485
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13486
       dwFlags: 0),
13487
    (  pguid: @GUID_Key;
13488
       dwOfs: DIK_SPACE;  // space bar
13489
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13490
       dwFlags: 0),
13491
    (  pguid: @GUID_Key;
13492
       dwOfs: DIK_CAPITAL;   // caps lock (on main kbd, above LSHIFT)
13493
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13494
       dwFlags: 0),
13495
    // ---------- function keys -----------
13496
    (  pguid: @GUID_Key;
13497
       dwOfs: DIK_F1;
13498
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13499
       dwFlags: 0),
13500
    (  pguid: @GUID_Key;
13501
       dwOfs: DIK_F2;
13502
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13503
       dwFlags: 0),
13504
    (  pguid: @GUID_Key;
13505
       dwOfs: DIK_F3;
13506
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13507
       dwFlags: 0),
13508
    (  pguid: @GUID_Key;
13509
       dwOfs: DIK_F4;
13510
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13511
       dwFlags: 0),
13512
    (  pguid: @GUID_Key;
13513
       dwOfs: DIK_F5;
13514
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13515
       dwFlags: 0),
13516
    (  pguid: @GUID_Key;
13517
       dwOfs: DIK_F6;
13518
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13519
       dwFlags: 0),
13520
    (  pguid: @GUID_Key;
13521
       dwOfs: DIK_F7;
13522
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13523
       dwFlags: 0),
13524
    (  pguid: @GUID_Key;
13525
       dwOfs: DIK_F8;
13526
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13527
       dwFlags: 0),
13528
    (  pguid: @GUID_Key;
13529
       dwOfs: DIK_F9;
13530
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13531
       dwFlags: 0),
13532
    (  pguid: @GUID_Key;
13533
       dwOfs: DIK_F10;
13534
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13535
       dwFlags: 0),
13536
    // ------- F11, F12 after numeric keypad (for "historical reasons" -- XT kbd)
13537
 
13538
    // --------- numeric keypad (mostly, that is) -----------
13539
    (  pguid: @GUID_Key;
13540
       dwOfs: DIK_NUMLOCK;   // numeric keypad
13541
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13542
       dwFlags: 0),
13543
    (  pguid: @GUID_Key;
13544
       dwOfs: DIK_SCROLL;  // scroll lock
13545
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13546
       dwFlags: 0),
13547
    (  pguid: @GUID_Key;
13548
       dwOfs: DIK_NUMPAD7;
13549
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13550
       dwFlags: 0),
13551
    (  pguid: @GUID_Key;
13552
       dwOfs: DIK_NUMPAD8;
13553
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13554
       dwFlags: 0),
13555
    (  pguid: @GUID_Key;
13556
       dwOfs: DIK_NUMPAD9;
13557
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13558
       dwFlags: 0),
13559
    (  pguid: @GUID_Key;
13560
       dwOfs: DIK_SUBTRACT;  // "-" on numeric keypad
13561
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13562
       dwFlags: 0),
13563
    (  pguid: @GUID_Key;
13564
       dwOfs: DIK_NUMPAD4;
13565
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13566
       dwFlags: 0),
13567
    (  pguid: @GUID_Key;
13568
       dwOfs: DIK_NUMPAD5;
13569
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13570
       dwFlags: 0),
13571
    (  pguid: @GUID_Key;
13572
       dwOfs: DIK_NUMPAD6;
13573
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13574
       dwFlags: 0),
13575
    (  pguid: @GUID_Key;
13576
       dwOfs: DIK_ADD;   // "+" on numeric keypad
13577
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13578
       dwFlags: 0),
13579
    (  pguid: @GUID_Key;
13580
       dwOfs: DIK_NUMPAD1;
13581
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13582
       dwFlags: 0),
13583
    (  pguid: @GUID_Key;
13584
       dwOfs: DIK_NUMPAD2;
13585
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13586
       dwFlags: 0),
13587
    (  pguid: @GUID_Key;
13588
       dwOfs: DIK_NUMPAD3;
13589
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13590
       dwFlags: 0),
13591
    (  pguid: @GUID_Key;
13592
       dwOfs: DIK_NUMPAD0;  // "0" or "Insert" on numeric keypad
13593
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13594
       dwFlags: 0),
13595
    (  pguid: @GUID_Key;
13596
       dwOfs: DIK_DECIMAL;  // "." or "Del" on numeric keypad
13597
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13598
       dwFlags: 0),
13599
    (  pguid: @GUID_Key;
13600
       dwOfs: $54;
13601
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13602
       dwFlags: 0),
13603
    // "extended" function keys; F13 to F15 only on NEC PC98
13604
    (  pguid: @GUID_Key;
13605
       dwOfs: DIK_F11;
13606
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13607
       dwFlags: 0),
13608
    (  pguid: @GUID_Key;
13609
       dwOfs: DIK_F12;
13610
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13611
       dwFlags: 0),
13612
    // -------------------------------------------------
13613
    // a whole lot of keys for asian kbds only
13614
    // -------------------------------------------------
13615
    (  pguid: @GUID_Key;
13616
       dwOfs: DIK_NUMPADENTER;  // Enter on numeric keypad
13617
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13618
       dwFlags: 0),
13619
    (  pguid: @GUID_Key;
13620
       dwOfs: DIK_RCONTROL;        // right Ctrl on main kbd
13621
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13622
       dwFlags: 0),
13623
    (  pguid: @GUID_Key;   // "," on numeric keypad (NEC PC98 only)
13624
       dwOfs: DIK_NUMPADCOMMA;
13625
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13626
       dwFlags: 0),
13627
    (  pguid: @GUID_Key;
13628
       dwOfs: DIK_DIVIDE;   // "/" on numeric keypad
13629
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13630
       dwFlags: 0),
13631
    (  pguid: @GUID_Key;
13632
       dwOfs: DIK_SYSRQ;   // "System request", "Druck/S-Abf" on german kbds
13633
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13634
       dwFlags: 0),
13635
    (  pguid: @GUID_Key;
13636
       dwOfs: DIK_RMENU;  // right ALT
13637
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13638
       dwFlags: 0),
13639
    (  pguid: @GUID_Key;
13640
       dwOfs: DIK_PAUSE;  // "Pause" - not reliable on some kbds
13641
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13642
       dwFlags: 0),
13643
 
13644
    // ----------- arrow keypad -----------------
13645
    (  pguid: @GUID_Key;
13646
       dwOfs:   DIK_HOME;    // Home on arrow keypad
13647
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13648
       dwFlags: 0),
13649
    (  pguid: @GUID_Key;
13650
       dwOfs: DIK_UP;        // UpArrow on arrow keypad
13651
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13652
       dwFlags: 0),
13653
    (  pguid: @GUID_Key;
13654
       dwOfs: DIK_PRIOR;    // PgUp on arrow keypad
13655
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13656
       dwFlags: 0),
13657
    (  pguid: @GUID_Key;
13658
       dwOfs: DIK_LEFT;    // LeftArrow on arrow keypad
13659
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13660
       dwFlags: 0),
13661
    (  pguid: @GUID_Key;
13662
       dwOfs: DIK_RIGHT;    // RightArrow on arrow keypad
13663
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13664
       dwFlags: 0),
13665
    (  pguid: @GUID_Key;
13666
       dwOfs: DIK_END;    // End on arrow keypad
13667
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13668
       dwFlags: 0),
13669
    (  pguid: @GUID_Key;
13670
       dwOfs: DIK_DOWN;    // DownArrow on arrow keypad
13671
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13672
       dwFlags: 0),
13673
    (  pguid: @GUID_Key;
13674
       dwOfs: DIK_NEXT;    // PgDn on arrow keypad
13675
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13676
       dwFlags: 0),
13677
    (  pguid: @GUID_Key;
13678
       dwOfs: DIK_INSERT;    // Insert on arrow keypad
13679
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13680
       dwFlags: 0),
13681
    (  pguid: @GUID_Key;
13682
       dwOfs: DIK_DELETE;    // Delete on arrow keypad
13683
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13684
       dwFlags: 0),
13685
    (  pguid: @GUID_Key;
13686
       dwOfs: DIK_LWIN;    // Left Windows key
13687
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13688
       dwFlags: 0),
13689
    (  pguid: @GUID_Key;
13690
       dwOfs: DIK_RWIN;    // Right Windows key
13691
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13692
       dwFlags: 0),
13693
    (  pguid: @GUID_Key;
13694
       dwOfs: DIK_APPS;    // AppMenu key
13695
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13696
       dwFlags: 0),
13697
    // -------- added with Win 98 / DirectX 6.1 ------------
13698
    (  pguid: @GUID_Key;
13699
       dwOfs: 222;    // Power on key
13700
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13701
       dwFlags: 0),
13702
    (  pguid: @GUID_Key;
13703
       dwOfs: 223;    // Sleep key
13704
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13705
       dwFlags: 0),
13706
    (  pguid: @GUID_Key;
13707
       dwOfs: 227;   // Wake (up) key. The german "translation"
13708
                     // reads "Kielwasser" (ship's wake) ;-)
13709
       dwType: DIDFT_BUTTON or DIDFT_NOCOLLECTION;
13710
       dwFlags: 0)
13711
  );
13712
*)
13713
 
13714
var  // set by initialization - I was simply too lazy
13715
  _c_dfDIKeyboard_Objects: array[0..255] of TDIObjectDataFormat;
13716
const
13717
  c_dfDIKeyboard: TDIDataFormat = (
13718
    dwSize: Sizeof(c_dfDIKeyboard);
13719
    dwObjSize: Sizeof(TDIObjectDataFormat);
13720
    dwFlags: DIDF_RELAXIS;
13721
    dwDataSize: Sizeof(TDIKeyboardState);
13722
    dwNumObjs: High(_c_dfDIKeyboard_Objects)+1;
13723
    rgodf: @_c_dfDIKeyboard_Objects[Low(_c_dfDIKeyboard_Objects)]
13724
  );
13725
 
13726
(****************************************************************************
13727
 *
13728
 *      Joystick
13729
 *
13730
 ****************************************************************************)
13731
 
13732
 
13733
type
1 daniel-mar 13734
  PDIJoyState = ^TDIJoyState;
4 daniel-mar 13735
  TDIJoyState = packed record
13736
    lX: Longint;   (* x-axis position              *)
13737
    lY: Longint;   (* y-axis position              *)
13738
    lZ: Longint;   (* z-axis position              *)
13739
    lRx: Longint;   (* x-axis rotation              *)
13740
    lRy: Longint;   (* y-axis rotation              *)
13741
    lRz: Longint;   (* z-axis rotation              *)
13742
    rglSlider: Array [0..1] of Longint;   (* extra axes positions         *)
13743
    rgdwPOV: Array [0..3] of DWORD;   (* POV directions               *)
13744
    rgbButtons: Array [0..31] of BYTE;   (* 32 buttons                   *)
1 daniel-mar 13745
  end;
13746
 
4 daniel-mar 13747
  PDIJoyState2 = ^TDIJoyState2;
13748
  TDIJoyState2 = packed record
13749
    lX: Longint;   (* x-axis position              *)
13750
    lY: Longint;   (* y-axis position              *)
13751
    lZ: Longint;   (* z-axis position              *)
13752
    lRx: Longint;   (* x-axis rotation              *)
13753
    lRy: Longint;   (* y-axis rotation              *)
13754
    lRz: Longint;   (* z-axis rotation              *)
13755
    rglSlider: Array [0..1] of Longint;   (* extra axes positions         *)
13756
    rgdwPOV: Array [0..3] of DWORD;   (* POV directions               *)
13757
    rgbButtons: Array [0..127] of BYTE;   (* 128 buttons                  *)
13758
    lVX: Longint;   (* x-axis velocity              *)
13759
    lVY: Longint;   (* y-axis velocity              *)
13760
    lVZ: Longint;   (* z-axis velocity              *)
13761
    lVRx: Longint;   (* x-axis angular velocity      *)
13762
    lVRy: Longint;   (* y-axis angular velocity      *)
13763
    lVRz: Longint;   (* z-axis angular velocity      *)
13764
    rglVSlider: Array [0..1] of Longint;   (* extra axes velocities        *)
13765
    lAX: Longint;   (* x-axis acceleration          *)
13766
    lAY: Longint;   (* y-axis acceleration          *)
13767
    lAZ: Longint;   (* z-axis acceleration          *)
13768
    lARx: Longint;   (* x-axis angular acceleration  *)
13769
    lARy: Longint;   (* y-axis angular acceleration  *)
13770
    lARz: Longint;   (* z-axis angular acceleration  *)
13771
    rglASlider: Array [0..1] of Longint;   (* extra axes accelerations     *)
13772
    lFX: Longint;   (* x-axis force                 *)
13773
    lFY: Longint;   (* y-axis force                 *)
13774
    lFZ: Longint;   (* z-axis force                 *)
13775
    lFRx: Longint;   (* x-axis torque                *)
13776
    lFRy: Longint;   (* y-axis torque                *)
13777
    lFRz: Longint;   (* z-axis torque                *)
13778
    rglFSlider: Array [0..1] of Longint;   (* extra axes forces            *)
1 daniel-mar 13779
  end;
13780
 
13781
 
4 daniel-mar 13782
function DIJOFS_SLIDER(n: variant) : variant;
13783
 
13784
function DIJOFS_POV(n: variant) : variant;
13785
 
13786
function DIJOFS_BUTTON(n: variant) : variant;
13787
const
13788
  DIJOFS_BUTTON_ = 48;
13789
 
13790
const
13791
  DIJOFS_BUTTON0 = DIJOFS_BUTTON_ + 0;
13792
  DIJOFS_BUTTON1 = DIJOFS_BUTTON_ + 1;
13793
  DIJOFS_BUTTON2 = DIJOFS_BUTTON_ + 2;
13794
  DIJOFS_BUTTON3 = DIJOFS_BUTTON_ + 3;
13795
  DIJOFS_BUTTON4 = DIJOFS_BUTTON_ + 4;
13796
  DIJOFS_BUTTON5 = DIJOFS_BUTTON_ + 5;
13797
  DIJOFS_BUTTON6 = DIJOFS_BUTTON_ + 6;
13798
  DIJOFS_BUTTON7 = DIJOFS_BUTTON_ + 7;
13799
  DIJOFS_BUTTON8 = DIJOFS_BUTTON_ + 8;
13800
  DIJOFS_BUTTON9 = DIJOFS_BUTTON_ + 9;
13801
  DIJOFS_BUTTON10 = DIJOFS_BUTTON_ + 10;
13802
  DIJOFS_BUTTON11 = DIJOFS_BUTTON_ + 11;
13803
  DIJOFS_BUTTON12 = DIJOFS_BUTTON_ + 12;
13804
  DIJOFS_BUTTON13 = DIJOFS_BUTTON_ + 13;
13805
  DIJOFS_BUTTON14 = DIJOFS_BUTTON_ + 14;
13806
  DIJOFS_BUTTON15 = DIJOFS_BUTTON_ + 15;
13807
  DIJOFS_BUTTON16 = DIJOFS_BUTTON_ + 16;
13808
  DIJOFS_BUTTON17 = DIJOFS_BUTTON_ + 17;
13809
  DIJOFS_BUTTON18 = DIJOFS_BUTTON_ + 18;
13810
  DIJOFS_BUTTON19 = DIJOFS_BUTTON_ + 19;
13811
  DIJOFS_BUTTON20 = DIJOFS_BUTTON_ + 20;
13812
  DIJOFS_BUTTON21 = DIJOFS_BUTTON_ + 21;
13813
  DIJOFS_BUTTON22 = DIJOFS_BUTTON_ + 22;
13814
  DIJOFS_BUTTON23 = DIJOFS_BUTTON_ + 23;
13815
  DIJOFS_BUTTON24 = DIJOFS_BUTTON_ + 24;
13816
  DIJOFS_BUTTON25 = DIJOFS_BUTTON_ + 25;
13817
  DIJOFS_BUTTON26 = DIJOFS_BUTTON_ + 26;
13818
  DIJOFS_BUTTON27 = DIJOFS_BUTTON_ + 27;
13819
  DIJOFS_BUTTON28 = DIJOFS_BUTTON_ + 28;
13820
  DIJOFS_BUTTON29 = DIJOFS_BUTTON_ + 29;
13821
  DIJOFS_BUTTON30 = DIJOFS_BUTTON_ + 30;
13822
  DIJOFS_BUTTON31 = DIJOFS_BUTTON_ + 31;
13823
 
13824
 
13825
const
13826
  DIJOFS_X  =0;
13827
  DIJOFS_Y  =4;
13828
  DIJOFS_Z  =8;
13829
  DIJOFS_RX =12;
13830
  DIJOFS_RY =16;
13831
  DIJOFS_RZ =20;
13832
 
13833
  _c_dfDIJoystick_Objects: array[0..43] of TDIObjectDataFormat = (
13834
    (  pguid: @GUID_XAxis;
13835
       dwOfs: DIJOFS_X; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13836
    (  pguid: @GUID_YAxis;
13837
       dwOfs: DIJOFS_Y; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13838
    (  pguid: @GUID_ZAxis;
13839
       dwOfs: DIJOFS_Z; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13840
    (  pguid: @GUID_RxAxis;
13841
       dwOfs: DIJOFS_RX; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13842
    (  pguid: @GUID_RyAxis;
13843
       dwOfs: DIJOFS_RY; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13844
    (  pguid: @GUID_RzAxis;
13845
       dwOfs: DIJOFS_RZ; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13846
 
13847
    (  pguid: @GUID_Slider;  // 2 Sliders
13848
       dwOfs: 24; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13849
    (  pguid: @GUID_Slider;
13850
       dwOfs: 28; dwType: $80000000 or DIDFT_AXIS or DIDFT_NOCOLLECTION; dwFlags: $100),
13851
 
13852
    (  pguid: @GUID_POV;  // 4 POVs (yes, really)
13853
       dwOfs: 32; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
13854
    (  pguid: @GUID_POV;
13855
       dwOfs: 36; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
13856
    (  pguid: @GUID_POV;
13857
       dwOfs: 40; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
13858
    (  pguid: @GUID_POV;
13859
       dwOfs: 44; dwType: $80000000 or DIDFT_POV or DIDFT_NOCOLLECTION; dwFlags: 0),
13860
 
13861
    (  pguid: nil;   // Buttons
13862
       dwOfs: DIJOFS_BUTTON0; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
1 daniel-mar 13863
    (  pguid: nil;
4 daniel-mar 13864
       dwOfs: DIJOFS_BUTTON1; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
1 daniel-mar 13865
    (  pguid: nil;
4 daniel-mar 13866
       dwOfs: DIJOFS_BUTTON2; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13867
    (  pguid: nil;
13868
       dwOfs: DIJOFS_BUTTON3; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13869
    (  pguid: nil;
13870
       dwOfs: DIJOFS_BUTTON4; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13871
    (  pguid: nil;
13872
       dwOfs: DIJOFS_BUTTON5; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13873
    (  pguid: nil;
13874
       dwOfs: DIJOFS_BUTTON6; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13875
    (  pguid: nil;
13876
       dwOfs: DIJOFS_BUTTON7; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13877
    (  pguid: nil;
13878
       dwOfs: DIJOFS_BUTTON8; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13879
    (  pguid: nil;
13880
       dwOfs: DIJOFS_BUTTON9; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13881
    (  pguid: nil;
13882
       dwOfs: DIJOFS_BUTTON10; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13883
    (  pguid: nil;
13884
       dwOfs: DIJOFS_BUTTON11; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13885
    (  pguid: nil;
13886
       dwOfs: DIJOFS_BUTTON12; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13887
    (  pguid: nil;
13888
       dwOfs: DIJOFS_BUTTON13; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13889
    (  pguid: nil;
13890
       dwOfs: DIJOFS_BUTTON14; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13891
    (  pguid: nil;
13892
       dwOfs: DIJOFS_BUTTON15; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13893
    (  pguid: nil;
13894
       dwOfs: DIJOFS_BUTTON16; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13895
    (  pguid: nil;
13896
       dwOfs: DIJOFS_BUTTON17; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13897
    (  pguid: nil;
13898
       dwOfs: DIJOFS_BUTTON18; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13899
    (  pguid: nil;
13900
       dwOfs: DIJOFS_BUTTON19; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13901
    (  pguid: nil;
13902
       dwOfs: DIJOFS_BUTTON20; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13903
    (  pguid: nil;
13904
       dwOfs: DIJOFS_BUTTON21; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13905
    (  pguid: nil;
13906
       dwOfs: DIJOFS_BUTTON22; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13907
    (  pguid: nil;
13908
       dwOfs: DIJOFS_BUTTON23; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13909
    (  pguid: nil;
13910
       dwOfs: DIJOFS_BUTTON24; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13911
    (  pguid: nil;
13912
       dwOfs: DIJOFS_BUTTON25; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13913
    (  pguid: nil;
13914
       dwOfs: DIJOFS_BUTTON26; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13915
    (  pguid: nil;
13916
       dwOfs: DIJOFS_BUTTON27; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13917
    (  pguid: nil;
13918
       dwOfs: DIJOFS_BUTTON28; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13919
    (  pguid: nil;
13920
       dwOfs: DIJOFS_BUTTON29; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13921
    (  pguid: nil;
13922
       dwOfs: DIJOFS_BUTTON30; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0),
13923
    (  pguid: nil;
13924
       dwOfs: DIJOFS_BUTTON31; dwType: $80000000 or DIDFT_BUTTON or DIDFT_NOCOLLECTION; dwFlags: 0)
1 daniel-mar 13925
  );
13926
 
13927
  c_dfDIJoystick: TDIDataFormat = (
4 daniel-mar 13928
    dwSize: Sizeof(c_dfDIJoystick);
13929
    dwObjSize: Sizeof(TDIObjectDataFormat);  // $10
13930
    dwFlags: DIDF_ABSAXIS;
13931
    dwDataSize: SizeOf(TDIJoyState);         // $10
13932
    dwNumObjs: High(_c_dfDIJoystick_Objects)+1;  // $2C
13933
    rgodf: @_c_dfDIJoystick_Objects[Low(_c_dfDIJoystick_Objects)]
13934
  );
13935
 
13936
var  // Set by initialization part -- didn't want to type in another 656 consts...
13937
  _c_dfDIJoystick2_Objects: array[0..$A3] of TDIObjectDataFormat;
13938
  { Elements $00..$2B: exact copy of _c_dfDIJoystick
13939
    Elements $2C..$8B: more "buttons" with nil GUIDs
13940
    remaining elements ($8B..$A2):
13941
     $8C,$8D,$8E: X axis, Y axis, Z axis with dwFlags = $0200
13942
     $8F,$90,$91: rX axis, rY axis, rZ axis with dwFlags = $0200
13943
     $92, $93: Slider with dwFlags = $0200
13944
     --------
13945
     $94,$95,$96: X axis, Y axis, Z axis with dwFlags = $0300
13946
     $97,$98,$99: rX axis, rY axis, rZ axis with dwFlags = $0300
13947
     $9A,$9B: Slider with dwFlags = $0300
13948
     --------
13949
     $9C,$9D,$9E: X axis, Y axis, Z axis with dwFlags = $0400
13950
     $9F, $A0, $A1: rX axis, rY axis, rZ axis with dwFlags = $0400
13951
     $A2, $A3: Slider with dwFlags = $0400
13952
  }
1 daniel-mar 13953
const
4 daniel-mar 13954
  c_dfDIJoystick2: TDIDataFormat = (
13955
    dwSize: Sizeof(c_dfDIJoystick2);
13956
    dwObjSize: Sizeof(TDIObjectDataFormat);
13957
    dwFlags: DIDF_ABSAXIS;
13958
    dwDataSize: SizeOf(TDIJoyState2);  // $110
13959
    dwNumObjs: High(_c_dfDIJoystick2_Objects)+1;
13960
    rgodf: @_c_dfDIJoystick2_Objects[Low(_c_dfDIJoystick2_Objects)]
13961
  );
1 daniel-mar 13962
 
4 daniel-mar 13963
(****************************************************************************
13964
 *
13965
 *  IDirectInput
13966
 *
13967
 ****************************************************************************)
1 daniel-mar 13968
 
4 daniel-mar 13969
 
13970
  DIENUM_STOP = 0;
1 daniel-mar 13971
  DIENUM_CONTINUE = 1;
13972
 
13973
type
4 daniel-mar 13974
  // as with the other enum functions: must rtn DIENUM_STOP or DIENUM_CONTINUE
13975
  TDIEnumDevicesCallbackA = function (var lpddi: TDIDeviceInstanceA;
13976
      pvRef: Pointer): Integer; stdcall;  // BOOL; stdcall;
13977
  TDIEnumDevicesCallbackW = function (var lpddi: TDIDeviceInstanceW;
13978
      pvRef: Pointer): Integer; stdcall;  // BOOL; stdcall;
13979
  TDIEnumDevicesCallback = function (var lpddi: TDIDeviceInstance;
13980
      pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
13981
  TDIEnumDevicesProc = TDIEnumDevicesCallback;
1 daniel-mar 13982
 
13983
const
4 daniel-mar 13984
  DIEDFL_ALLDEVICES       = $00000000;
13985
  DIEDFL_ATTACHEDONLY     = $00000001;
13986
  DIEDFL_FORCEFEEDBACK    = $00000100;
1 daniel-mar 13987
 
13988
type
4 daniel-mar 13989
 
13990
  IDirectInputW = interface (IUnknown)
1 daniel-mar 13991
    ['{89521361-AA8A-11CF-BFC7-444553540000}']
4 daniel-mar 13992
    (*** IDirectInputW methods ***)
13993
    function CreateDevice(const rguid: TGUID; var lplpDirectInputDevice:
13994
        IDirectInputDeviceW; pUnkOuter: IUnknown) : HResult;  stdcall;
1 daniel-mar 13995
    function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackW;
4 daniel-mar 13996
        pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
13997
    function GetDeviceStatus(const rguidInstance: TGUID) : HResult;  stdcall;
13998
    function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
13999
    function Initialize(hinst: THandle; dwVersion: DWORD) : HResult;  stdcall;
1 daniel-mar 14000
  end;
14001
 
4 daniel-mar 14002
  IDirectInputA = interface (IUnknown)
1 daniel-mar 14003
    ['{89521360-AA8A-11CF-BFC7-444553540000}']
4 daniel-mar 14004
    (*** IDirectInputA methods ***)
14005
    function CreateDevice(const rguid: TGUID; var lplpDirectInputDevice:
14006
        IDirectInputDeviceA; pUnkOuter: IUnknown) : HResult;  stdcall;
1 daniel-mar 14007
    function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackA;
4 daniel-mar 14008
        pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
14009
    function GetDeviceStatus(const rguidInstance: TGUID) : HResult;  stdcall;
14010
    function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
14011
    function Initialize(hinst: THandle; dwVersion: DWORD) : HResult;  stdcall;
1 daniel-mar 14012
  end;
14013
 
4 daniel-mar 14014
{$IFDEF UNICODE}
14015
  IDirectInput = IDirectInputW;
14016
{$ELSE}
1 daniel-mar 14017
  IDirectInput = IDirectInputA;
4 daniel-mar 14018
{$ENDIF}
1 daniel-mar 14019
 
4 daniel-mar 14020
 
14021
  IDirectInput2W = interface (IDirectInputW)
1 daniel-mar 14022
    ['{5944E663-AA8A-11CF-BFC7-444553540000}']
4 daniel-mar 14023
    (*** IDirectInput2W methods ***)
14024
    function FindDevice(const rguidClass: TGUID; ptszName: PWideChar; out pguidInstance: TGUID): HResult;  stdcall;
1 daniel-mar 14025
  end;
14026
 
4 daniel-mar 14027
  IDirectInput2A = interface (IDirectInputA)
1 daniel-mar 14028
    ['{5944E662-AA8A-11CF-BFC7-444553540000}']
4 daniel-mar 14029
    (*** IDirectInput2A methods ***)
14030
    function FindDevice(const rguidClass: TGUID; ptszName: PAnsiChar; out pguidInstance: TGUID): HResult;  stdcall;
1 daniel-mar 14031
  end;
14032
 
4 daniel-mar 14033
{$IFDEF UNICODE}
14034
  IDirectInput2 = IDirectInput2W;
14035
{$ELSE}
1 daniel-mar 14036
  IDirectInput2 = IDirectInput2A;
4 daniel-mar 14037
{$ENDIF}
1 daniel-mar 14038
 
4 daniel-mar 14039
 
14040
type
14041
  IDirectInput7W = interface (IDirectInput2W)
1 daniel-mar 14042
    ['{9A4CB685-236D-11D3-8E9D-00C04F6844AE}']
4 daniel-mar 14043
    {*** IDirectInput7W methods ***}
14044
    function CreateDeviceEx(const rguid, riid: TGUID; out lplpDirectInputDevice;
14045
        pUnkOuter: IUnknown) : HResult; stdcall;
1 daniel-mar 14046
  end;
14047
 
4 daniel-mar 14048
  IDirectInput7A = interface (IDirectInput2A)
1 daniel-mar 14049
    ['{9A4CB684-236D-11D3-8E9D-00C04F6844AE}']
4 daniel-mar 14050
    {*** IDirectInput7A methods ***}
14051
    function CreateDeviceEx(const rguid, riid: TGUID; out lplpDirectInputDevice;
14052
        pUnkOuter: IUnknown) : HResult; stdcall;
1 daniel-mar 14053
  end;
14054
 
4 daniel-mar 14055
{$IFDEF UNICODE}
14056
  IDirectInput7 = IDirectInput7W;
14057
{$ELSE}
1 daniel-mar 14058
  IDirectInput7 = IDirectInput7A;
4 daniel-mar 14059
{$ENDIF}
1 daniel-mar 14060
 
14061
 
4 daniel-mar 14062
var
14063
  DirectInputCreateA : function (hinst: THandle; dwVersion: DWORD;
14064
      out ppDI: IDirectInputA;
14065
      punkOuter: IUnknown) : HResult; stdcall;
14066
  DirectInputCreateW : function (hinst: THandle; dwVersion: DWORD;
14067
      out ppDI: IDirectInputW;
14068
      punkOuter: IUnknown) : HResult; stdcall;
14069
  DirectInputCreate : function (hinst: THandle; dwVersion: DWORD;
14070
      out ppDI: IDirectInput;
14071
      punkOuter: IUnknown) : HResult; stdcall;
14072
 
14073
  DirectInputCreateEx : function (
14074
      hinst: THandle;
14075
      dwVersion: DWORD;
14076
      const riidltf: TGUID;
14077
      out ppvOut;
14078
      punkOuter: IUnknown) : HResult; stdcall;
14079
 
14080
(****************************************************************************
14081
 *
14082
 *      Interfaces
14083
 *
14084
 ****************************************************************************)
14085
type
14086
  IID_IDirectInputW = IDirectInputW;
14087
  IID_IDirectInputA = IDirectInputA;
14088
  IID_IDirectInput = IDirectInput;
14089
 
14090
  IID_IDirectInput2W = IDirectInput2W;
14091
  IID_IDirectInput2A = IDirectInput2A;
14092
  IID_IDirectInput2 = IDirectInput2;
14093
 
14094
  IID_IDirectInput7W = IDirectInput7W;
14095
  IID_IDirectInput7A = IDirectInput7A;
14096
  IID_IDirectInput7 = IDirectInput7;
14097
 
14098
  IID_IDirectInputDeviceW = IDirectInputDeviceW;
14099
  IID_IDirectInputDeviceA = IDirectInputDeviceA;
14100
  IID_IDirectInputDevice = IDirectInputDevice;
14101
 
14102
  IID_IDirectInputDevice2W = IDirectInputDevice2W;
14103
  IID_IDirectInputDevice2A = IDirectInputDevice2A;
14104
  IID_IDirectInputDevice2 = IDirectInputDevice2;
14105
 
14106
  IID_IDirectInputEffect = IDirectInputEffect;
14107
 
14108
  IID_IDirectInputDevice7W = IDirectInputDevice7W;
14109
  IID_IDirectInputDevice7A = IDirectInputDevice7A;
14110
  IID_IDirectInputDevice7 = IDirectInputDevice7;
14111
 
14112
(****************************************************************************
14113
 *
14114
 *  Return Codes
14115
 *
14116
 ****************************************************************************)
14117
 
14118
(*
14119
 *  The operation completed successfully.
14120
 *)
1 daniel-mar 14121
const
4 daniel-mar 14122
  DI_OK = S_OK;
1 daniel-mar 14123
 
4 daniel-mar 14124
(*
14125
 *  The device exists but is not currently attached.
14126
 *)
14127
  DI_NOTATTACHED = S_FALSE;
1 daniel-mar 14128
 
4 daniel-mar 14129
(*
14130
 *  The device buffer overflowed.  Some input was lost.
14131
 *)
14132
  DI_BUFFEROVERFLOW = S_FALSE;
1 daniel-mar 14133
 
4 daniel-mar 14134
(*
14135
 *  The change in device properties had no effect.
14136
 *)
14137
  DI_PROPNOEFFECT = S_FALSE;
1 daniel-mar 14138
 
4 daniel-mar 14139
(*
14140
 *  The operation had no effect.
14141
 *)
14142
  DI_NOEFFECT = S_FALSE;
1 daniel-mar 14143
 
4 daniel-mar 14144
(*
14145
 *  The device is a polled device.  As a result, device buffering
14146
 *  will not collect any data and event notifications will not be
14147
 *  signalled until GetDeviceState is called.
14148
 *)
14149
  DI_POLLEDDEVICE = $00000002;
1 daniel-mar 14150
 
4 daniel-mar 14151
(*
14152
 *  The parameters of the effect were successfully updated by
14153
 *  IDirectInputEffect::SetParameters, but the effect was not
14154
 *  downloaded because the device is not exclusively acquired
14155
 *  or because the DIEP_NODOWNLOAD flag was passed.
14156
 *)
14157
  DI_DOWNLOADSKIPPED = $00000003;
1 daniel-mar 14158
 
4 daniel-mar 14159
(*
14160
 *  The parameters of the effect were successfully updated by
14161
 *  IDirectInputEffect::SetParameters, but in order to change
14162
 *  the parameters, the effect needed to be restarted.
14163
 *)
14164
  DI_EFFECTRESTARTED = $00000004;
1 daniel-mar 14165
 
4 daniel-mar 14166
(*
14167
 *  The parameters of the effect were successfully updated by
14168
 *  IDirectInputEffect::SetParameters, but some of them were
14169
 *  beyond the capabilities of the device and were truncated.
14170
 *)
14171
  DI_TRUNCATED = $00000008;
14172
 
14173
(*
14174
 *  Equal to DI_EFFECTRESTARTED | DI_TRUNCATED.
14175
 *)
14176
  DI_TRUNCATEDANDRESTARTED = $0000000C;
14177
 
14178
  SEVERITY_ERROR_FACILITY_WIN32 =
14179
      HResult(SEVERITY_ERROR shl 31) or HResult(FACILITY_WIN32 shl 16);
14180
 
14181
(*
14182
 *  The application requires a newer version of DirectInput.
14183
 *)
14184
 
14185
  DIERR_OLDDIRECTINPUTVERSION = SEVERITY_ERROR_FACILITY_WIN32
14186
      or ERROR_OLD_WIN_VERSION;
14187
 
14188
(*
14189
 *  The application was written for an unsupported prerelease version
14190
 *  of DirectInput.
14191
 *)
14192
  DIERR_BETADIRECTINPUTVERSION = SEVERITY_ERROR_FACILITY_WIN32
14193
      or ERROR_RMODE_APP;
14194
 
14195
(*
14196
 *  The object could not be created due to an incompatible driver version
14197
 *  or mismatched or incomplete driver components.
14198
 *)
14199
  DIERR_BADDRIVERVER = SEVERITY_ERROR_FACILITY_WIN32
14200
      or ERROR_BAD_DRIVER_LEVEL;
14201
 
14202
(*
14203
 * The device or device instance or effect is not registered with DirectInput.
14204
 *)
14205
  DIERR_DEVICENOTREG = REGDB_E_CLASSNOTREG;
14206
 
14207
(*
14208
 * The requested object does not exist.
14209
 *)
14210
  DIERR_NOTFOUND = SEVERITY_ERROR_FACILITY_WIN32
14211
      or ERROR_FILE_NOT_FOUND;
14212
 
14213
(*
14214
 * The requested object does not exist.
14215
 *)
14216
  DIERR_OBJECTNOTFOUND = SEVERITY_ERROR_FACILITY_WIN32
14217
      or ERROR_FILE_NOT_FOUND;
14218
 
14219
(*
14220
 * An invalid parameter was passed to the returning function,
14221
 * or the object was not in a state that admitted the function
14222
 * to be called.
14223
 *)
14224
  DIERR_INVALIDPARAM = E_INVALIDARG;
14225
 
14226
(*
14227
 * The specified interface is not supported by the object
14228
 *)
14229
  DIERR_NOINTERFACE = E_NOINTERFACE;
14230
 
14231
(*
14232
 * An undetermined error occured inside the DInput subsystem
14233
 *)
14234
  DIERR_GENERIC = E_FAIL;
14235
 
14236
(*
14237
 * The DInput subsystem couldn't allocate sufficient memory to complete the
14238
 * caller's request.
14239
 *)
14240
  DIERR_OUTOFMEMORY = E_OUTOFMEMORY;
14241
 
14242
(*
14243
 * The function called is not supported at this time
14244
 *)
14245
  DIERR_UNSUPPORTED = E_NOTIMPL;
14246
 
14247
(*
14248
 * This object has not been initialized
14249
 *)
14250
  DIERR_NOTINITIALIZED = SEVERITY_ERROR_FACILITY_WIN32
14251
      or ERROR_NOT_READY;
14252
 
14253
(*
14254
 * This object is already initialized
14255
 *)
14256
  DIERR_ALREADYINITIALIZED = SEVERITY_ERROR_FACILITY_WIN32
14257
      or ERROR_ALREADY_INITIALIZED;
14258
 
14259
(*
14260
 * This object does not support aggregation
14261
 *)
14262
  DIERR_NOAGGREGATION = CLASS_E_NOAGGREGATION;
14263
 
14264
(*
14265
 * Another app has a higher priority level, preventing this call from
14266
 * succeeding.
14267
 *)
14268
  DIERR_OTHERAPPHASPRIO = E_ACCESSDENIED;
14269
 
14270
(*
14271
 * Access to the device has been lost.  It must be re-acquired.
14272
 *)
14273
  DIERR_INPUTLOST = SEVERITY_ERROR_FACILITY_WIN32
14274
      or ERROR_READ_FAULT;
14275
 
14276
(*
14277
 * The operation cannot be performed while the device is acquired.
14278
 *)
14279
  DIERR_ACQUIRED = SEVERITY_ERROR_FACILITY_WIN32
14280
      or ERROR_BUSY;
14281
 
14282
(*
14283
 * The operation cannot be performed unless the device is acquired.
14284
 *)
14285
  DIERR_NOTACQUIRED = SEVERITY_ERROR_FACILITY_WIN32
14286
      or ERROR_INVALID_ACCESS;
14287
 
14288
(*
14289
 * The specified property cannot be changed.
14290
 *)
14291
  DIERR_READONLY = E_ACCESSDENIED;
14292
 
14293
(*
14294
 * The device already has an event notification associated with it.
14295
 *)
14296
  DIERR_HANDLEEXISTS = E_ACCESSDENIED;
14297
 
14298
(*
14299
 * Data is not yet available.
14300
 *)
14301
  E_PENDING = HResult($80070007);
14302
 
14303
(*
14304
 * Unable to IDirectInputJoyConfig_Acquire because the user
14305
 * does not have sufficient privileges to change the joystick
14306
 * configuration.
14307
 *)
14308
  DIERR_INSUFFICIENTPRIVS = HResult($80040200);
14309
 
14310
(*
14311
 * The device is full.
14312
 *)
14313
  DIERR_DEVICEFULL = DIERR_INSUFFICIENTPRIVS + 1;
14314
 
14315
(*
14316
 * Not all the requested information fit into the buffer.
14317
 *)
14318
  DIERR_MOREDATA = DIERR_INSUFFICIENTPRIVS + 2;
14319
 
14320
(*
14321
 * The effect is not downloaded.
14322
 *)
14323
  DIERR_NOTDOWNLOADED = DIERR_INSUFFICIENTPRIVS + 3;
14324
 
14325
(*
14326
 *  The device cannot be reinitialized because there are still effects
14327
 *  attached to it.
14328
 *)
14329
  DIERR_HASEFFECTS = DIERR_INSUFFICIENTPRIVS + 4;
14330
 
14331
(*
14332
 *  The operation cannot be performed unless the device is acquired
14333
 *  in DISCL_EXCLUSIVE mode.
14334
 *)
14335
  DIERR_NOTEXCLUSIVEACQUIRED = DIERR_INSUFFICIENTPRIVS + 5;
14336
 
14337
(*
14338
 *  The effect could not be downloaded because essential information
14339
 *  is missing.  For example, no axes have been associated with the
14340
 *  effect, or no type-specific information has been created.
14341
 *)
14342
  DIERR_INCOMPLETEEFFECT = DIERR_INSUFFICIENTPRIVS + 6;
14343
 
14344
(*
14345
 *  Attempted to read buffered device data from a device that is
14346
 *  not buffered.
14347
 *)
14348
  DIERR_NOTBUFFERED = DIERR_INSUFFICIENTPRIVS + 7;
14349
 
14350
(*
14351
 *  An attempt was made to modify parameters of an effect while it is
14352
 *  playing.  Not all hardware devices support altering the parameters
14353
 *  of an effect while it is playing.
14354
 *)
14355
  DIERR_EFFECTPLAYING = DIERR_INSUFFICIENTPRIVS + 8;
14356
 
14357
(*
14358
 *  The operation could not be completed because the device is not
14359
 *  plugged in.
14360
 *)
14361
  DIERR_UNPLUGGED                = $80040209;
14362
 
14363
(*
14364
 *  SendDeviceData failed because more information was requested
14365
 *  to be sent than can be sent to the device.  Some devices have
14366
 *  restrictions on how much data can be sent to them.  (For example,
14367
 *  there might be a limit on the number of buttons that can be
14368
 *  pressed at once.)
14369
 *)
14370
 DIERR_REPORTFULL                = $8004020A;
14371
 
14372
 
14373
(****************************************************************************
14374
 *
14375
 *  Definitions for non-IDirectInput (VJoyD) features defined more recently
14376
 *  than the current sdk files
14377
 *
14378
 ****************************************************************************)
14379
 
14380
(*
14381
 * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure
14382
 * contains mini-driver specific data to be passed by VJoyD to the mini-
14383
 * driver instead of doing a poll.
14384
 *)
14385
  JOY_PASSDRIVERDATA          = $10000000;
14386
 
14387
(*
14388
 * Informs the joystick driver that the configuration has been changed
14389
 * and should be reloaded from the registery.
14390
 * dwFlags is reserved and should be set to zero
14391
 *)
14392
 
14393
function joyConfigChanged(dwFlags: DWORD) : MMRESULT; stdcall;
14394
 
14395
const
14396
(*
14397
 * Hardware Setting indicating that the device is a headtracker
14398
 *)
14399
  JOY_HWS_ISHEADTRACKER       = $02000000;
14400
 
14401
(*
14402
 * Hardware Setting indicating that the VxD is used to replace
14403
 * the standard analog polling
14404
 *)
14405
  JOY_HWS_ISGAMEPORTDRIVER    = $04000000;
14406
 
14407
(*
14408
 * Hardware Setting indicating that the driver needs a standard
14409
 * gameport in order to communicate with the device.
14410
 *)
14411
  JOY_HWS_ISANALOGPORTDRIVER  = $08000000;
14412
 
14413
(*
14414
 * Hardware Setting indicating that VJoyD should not load this
14415
 * driver, it will be loaded externally and will register with
14416
 * VJoyD of it's own accord.
14417
 *)
14418
  JOY_HWS_AUTOLOAD            = $10000000;
14419
 
14420
(*
14421
 * Hardware Setting indicating that the driver acquires any
14422
 * resources needed without needing a devnode through VJoyD.
14423
 *)
14424
  JOY_HWS_NODEVNODE           = $20000000;
14425
 
14426
(*
14427
 * Hardware Setting indicating that the device is a gameport bus
14428
 *)
14429
  JOY_HWS_ISGAMEPORTBUS       = $80000000;
14430
  JOY_HWS_GAMEPORTBUSBUSY     = $00000001;
14431
 
14432
//from older Verion:
14433
(*
14434
 * Hardware Setting indicating that the VxD can be used as
14435
 * a port 201h emulator.
14436
 *)
14437
  JOY_HWS_ISGAMEPORTEMULATOR  = $40000000;
14438
 
14439
 
14440
(*
14441
 * Usage Setting indicating that the settings are volatile and
14442
 * should be removed if still present on a reboot.
14443
 *)
14444
  JOY_US_VOLATILE             = $00000008;
14445
 
14446
(****************************************************************************
14447
 *
14448
 *  Definitions for non-IDirectInput (VJoyD) features defined more recently
14449
 *  than the current ddk files
14450
 *
14451
 ****************************************************************************)
14452
 
14453
(*
14454
 * Poll type in which the do_other field of the JOYOEMPOLLDATA
14455
 * structure contains mini-driver specific data passed from an app.
14456
 *)
14457
  JOY_OEMPOLL_PASSDRIVERDATA  = 7;
14458
 
14459
//DirectPlay file
14460
 
1 daniel-mar 14461
(*==========================================================================;
14462
 *
14463
 *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
14464
 *
4 daniel-mar 14465
 *  File:       dplay.h dplobby.h
14466
 *  Content:    DirectPlay include files
14467
 *
14468
 *  DirectX 7 Delphi adaptation by Erik Unger
14469
 *
14470
 *  Modified: 4-Jun-2000
14471
 *
14472
 *  Download: http://www.delphi-jedi.org/DelphiGraphics/
14473
 *  E-Mail: DelphiDirectX@next-reality.com
14474
 *
14475
 ***************************************************************************)
14476
 
14477
var
14478
  DPlayDLL : HMODULE = 0;
14479
 
14480
(*==========================================================================;
14481
 *
14482
 *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
14483
 *
1 daniel-mar 14484
 *  File:       dplay.h
14485
 *  Content:    DirectPlay include file
14486
 *
14487
 ***************************************************************************)
14488
 
4 daniel-mar 14489
function DPErrorString(Value: HResult) : string;
14490
 
1 daniel-mar 14491
const
4 daniel-mar 14492
// {D1EB6D20-8923-11d0-9D97-00A0C90A43CB}
14493
  CLSID_DirectPlay: TGUID =
14494
      (D1:$d1eb6d20;D2:$8923;D3:$11d0;D4:($9d,$97,$00,$a0,$c9,$a,$43,$cb));
1 daniel-mar 14495
 
4 daniel-mar 14496
(*
14497
 * GUIDS used by Service Providers shipped with DirectPlay
14498
 * Use these to identify Service Provider returned by EnumConnections
14499
 *)
1 daniel-mar 14500
 
4 daniel-mar 14501
// GUID for IPX service provider
14502
// {685BC400-9D2C-11cf-A9CD-00AA006886E3}
14503
  DPSPGUID_IPX: TGUID =
14504
      (D1:$685bc400;D2:$9d2c;D3:$11cf;D4:($a9,$cd,$00,$aa,$00,$68,$86,$e3));
1 daniel-mar 14505
 
4 daniel-mar 14506
// GUID for TCP/IP service provider
14507
// 36E95EE0-8577-11cf-960C-0080C7534E82
14508
  DPSPGUID_TCPIP: TGUID =
14509
      (D1:$36E95EE0;D2:$8577;D3:$11cf;D4:($96,$0c,$00,$80,$c7,$53,$4e,$82));
1 daniel-mar 14510
 
4 daniel-mar 14511
// GUID for Serial service provider
14512
// {0F1D6860-88D9-11cf-9C4E-00A0C905425E}
14513
  DPSPGUID_SERIAL: TGUID =
14514
      (D1:$f1d6860;D2:$88d9;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$05,$42,$5e));
1 daniel-mar 14515
 
4 daniel-mar 14516
// GUID for Modem service provider
14517
// {44EAA760-CB68-11cf-9C4E-00A0C905425E}
14518
  DPSPGUID_MODEM: TGUID =
14519
      (D1:$44eaa760;D2:$cb68;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$05,$42,$5e));
1 daniel-mar 14520
 
4 daniel-mar 14521
 
14522
(****************************************************************************
14523
 *
14524
 * DirectPlay Structures
14525
 *
14526
 * Various structures used to invoke DirectPlay.
14527
 *
14528
 ****************************************************************************)
14529
 
1 daniel-mar 14530
type
4 daniel-mar 14531
{$IFDEF UNICODE}
14532
  PCharAW = PWideChar;
14533
{$ELSE}
14534
  PCharAW = PAnsiChar;
14535
{$ENDIF}
14536
(*
14537
 * TDPID
14538
 * DirectPlay player and group ID
14539
 *)
14540
  TDPID = DWORD;
1 daniel-mar 14541
  PDPID = ^TDPID;
14542
 
14543
 
14544
const
4 daniel-mar 14545
(*
14546
 * DPID that system messages come from
14547
 *)
14548
  DPID_SYSMSG = 0;
1 daniel-mar 14549
 
4 daniel-mar 14550
(*
14551
 * DPID representing all players in the session
14552
 *)
14553
  DPID_ALLPLAYERS = 0;
14554
 
14555
(*
14556
 * DPID representing the server player
14557
 *)
14558
  DPID_SERVERPLAYER = 1;
14559
 
14560
(*
14561
 * DPID representing the maximum ID in the range of DPID's reserved for
14562
 * use by DirectPlay.
14563
 *)
14564
  DPID_RESERVEDRANGE = 100;
14565
 
14566
(*
14567
 * The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID)
14568
 *)
14569
  DPID_UNKNOWN = $FFFFFFFF;
14570
 
1 daniel-mar 14571
type
4 daniel-mar 14572
(*
14573
 * DPCAPS
14574
 * Used to obtain the capabilities of a DirectPlay object
14575
 *)
1 daniel-mar 14576
  PDPCaps = ^TDPCaps;
4 daniel-mar 14577
  TDPCaps = packed record
1 daniel-mar 14578
    dwSize: DWORD;              // Size of structure, in bytes
14579
    dwFlags: DWORD;             // DPCAPS_xxx flags
14580
    dwMaxBufferSize: DWORD;     // Maximum message size, in bytes,  for this service provider
14581
    dwMaxQueueSize: DWORD;      // Obsolete.
14582
    dwMaxPlayers: DWORD;        // Maximum players/groups (local + remote)
14583
    dwHundredBaud: DWORD;       // Bandwidth in 100 bits per second units;
14584
                                // i.e. 24 is 2400, 96 is 9600, etc.
14585
    dwLatency: DWORD;           // Estimated latency; 0 = unknown
14586
    dwMaxLocalPlayers: DWORD;   // Maximum # of locally created players allowed
14587
    dwHeaderLength: DWORD;      // Maximum header length, in bytes, on messages
14588
                                // added by the service provider
14589
    dwTimeout: DWORD;           // Service provider's suggested timeout value
14590
                                // This is how long DirectPlay will wait for
14591
                                // responses to system messages
14592
  end;
14593
 
4 daniel-mar 14594
const
14595
(*
14596
 * This DirectPlay object is the session host.  If the host exits the
14597
 * session, another application will become the host and receive a
14598
 * DPSYS_HOST system message.
14599
 *)
14600
  DPCAPS_ISHOST = $00000002;
1 daniel-mar 14601
 
4 daniel-mar 14602
(*
14603
 * The service provider bound to this DirectPlay object can optimize
14604
 * group messaging.
14605
 *)
14606
  DPCAPS_GROUPOPTIMIZED = $00000008;
14607
 
14608
(*
14609
 * The service provider bound to this DirectPlay object can optimize
14610
 * keep alives (see DPSESSION_KEEPALIVE)
14611
 *)
14612
  DPCAPS_KEEPALIVEOPTIMIZED = $00000010;
14613
 
14614
(*
14615
 * The service provider bound to this DirectPlay object can optimize
14616
 * guaranteed message delivery.
14617
 *)
14618
  DPCAPS_GUARANTEEDOPTIMIZED = $00000020;
14619
 
14620
(*
14621
 * This DirectPlay object supports guaranteed message delivery.
14622
 *)
14623
  DPCAPS_GUARANTEEDSUPPORTED = $00000040;
14624
 
14625
(*
14626
 * This DirectPlay object supports digital signing of messages.
14627
 *)
14628
  DPCAPS_SIGNINGSUPPORTED = $00000080;
14629
 
14630
(*
14631
 * This DirectPlay object supports encryption of messages.
14632
 *)
14633
  DPCAPS_ENCRYPTIONSUPPORTED = $00000100;
14634
 
14635
(*
14636
 * This DirectPlay player was created on this machine
14637
 *)
14638
  DPPLAYERCAPS_LOCAL = $00000800;
14639
 
14640
(*
14641
 * Current Open settings supports all forms of Cancel
14642
 *)
14643
  DPCAPS_ASYNCCANCELSUPPORTED = $00001000;
14644
 
14645
(*
14646
 * Current Open settings supports CancelAll, but not Cancel
14647
 *)
1 daniel-mar 14648
  DPCAPS_ASYNCCANCELALLSUPPORTED = $00002000;
14649
 
4 daniel-mar 14650
(*
14651
 * Current Open settings supports Send Timeouts for sends
14652
 *)
14653
  DPCAPS_SENDTIMEOUTSUPPORTED = $00004000;
14654
 
14655
(*
14656
 * Current Open settings supports send priority
14657
 *)
14658
  DPCAPS_SENDPRIORITYSUPPORTED = $00008000;
14659
 
14660
(*
14661
 * Current Open settings supports DPSEND_ASYNC flag
14662
 *)
14663
  DPCAPS_ASYNCSUPPORTED = $00010000;
14664
 
1 daniel-mar 14665
type
4 daniel-mar 14666
(*
14667
 * TDPSessionDesc2
14668
 * Used to describe the properties of a DirectPlay
14669
 * session instance
14670
 *)
1 daniel-mar 14671
  PDPSessionDesc2 = ^TDPSessionDesc2;
4 daniel-mar 14672
  TDPSessionDesc2 = packed record
14673
    dwSize: DWORD;             // Size of structure
14674
    dwFlags: DWORD;            // DPSESSION_xxx flags
14675
    guidInstance: TGUID;       // ID for the session instance
14676
    guidApplication: TGUID;    // GUID of the DirectPlay application.
14677
                               // GUID_NULL for all applications.
14678
    dwMaxPlayers: DWORD;       // Maximum # players allowed in session
14679
    dwCurrentPlayers: DWORD;   // Current # players in session (read only)
14680
    case integer of
14681
 
14682
    lpszSessionName: PCharAW;  // Name of the session
14683
    lpszPassword: PCharAW;     // Password of the session (optional)
14684
    dwReserved1: DWORD;        // Reserved for future MS use.
14685
    dwReserved2: DWORD;
14686
    dwUser1: DWORD;            // For use by the application
14687
    dwUser2: DWORD;
14688
    dwUser3: DWORD;
14689
    dwUser4: DWORD;
14690
      );
14691
      1 : (
14692
    lpszSessionNameA: PAnsiChar;   // Name of the session
14693
    lpszPasswordA: PAnsiChar       // Password of the session (optional)
14694
      );
14695
      2 : (
14696
    lpszSessionNameW: PWideChar;
14697
    lpszPasswordW: PWideChar
14698
      );
1 daniel-mar 14699
  end;
14700
 
14701
const
4 daniel-mar 14702
(*
14703
 * Applications cannot create new players in this session.
14704
 *)
1 daniel-mar 14705
  DPSESSION_NEWPLAYERSDISABLED = $00000001;
4 daniel-mar 14706
 
14707
(*
14708
 * If the DirectPlay object that created the session, the host,
14709
 * quits, then the host will attempt to migrate to another
14710
 * DirectPlay object so that new players can continue to be created
14711
 * and new applications can join the session.
14712
 *)
14713
  DPSESSION_MIGRATEHOST = $00000004;
14714
 
14715
(*
14716
 * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom
14717
 * fields in player messages.  This cuts two DWORD's off the message
14718
 * overhead.
14719
 *)
14720
  DPSESSION_NOMESSAGEID = $00000008;
14721
 
14722
(*
14723
 * This flag tells DirectPlay to not allow any new applications to
14724
 * join the session.  Applications already in the session can still
14725
 * create new players.
14726
 *)
14727
  DPSESSION_JOINDISABLED = $00000020;
14728
 
14729
(*
14730
 * This flag tells DirectPlay to detect when remote players
14731
 * exit abnormally (e.g. their computer or modem gets unplugged)
14732
 *)
14733
  DPSESSION_KEEPALIVE = $00000040;
14734
 
14735
(*
14736
 * This flag tells DirectPlay not to send a message to all players
14737
 * when a players remote data changes
14738
 *)
14739
  DPSESSION_NODATAMESSAGES = $00000080;
14740
 
14741
(*
14742
 * This flag indicates that the session belongs to a secure server
14743
 * and needs user authentication
14744
 *)
14745
  DPSESSION_SECURESERVER = $00000100;
14746
 
14747
(*
14748
 * This flag indicates that the session is private and requirs a password
14749
 * for EnumSessions as well as Open.
14750
 *)
14751
  DPSESSION_PRIVATE = $00000200;
14752
 
14753
(*
14754
 * This flag indicates that the session requires a password for joining.
14755
 *)
14756
  DPSESSION_PASSWORDREQUIRED = $00000400;
14757
 
14758
(*
14759
 * This flag tells DirectPlay to route all messages through the server
14760
 *)
14761
  DPSESSION_MULTICASTSERVER = $00000800;
14762
 
14763
(*
14764
 * This flag tells DirectPlay to only download information about the
14765
 * DPPLAYER_SERVERPLAYER.
14766
 *)
14767
  DPSESSION_CLIENTSERVER = $00001000;
14768
 
14769
(*
14770
 * This flag tells DirectPlay to use the protocol built into dplay
14771
 * for reliability and statistics all the time.  When this bit is
14772
 * set, only other sessions with this bit set can join or be joined.
14773
 *)
1 daniel-mar 14774
  DPSESSION_DIRECTPLAYPROTOCOL = $00002000;
14775
 
4 daniel-mar 14776
(*
14777
 * This flag tells DirectPlay that preserving order of received
14778
 * packets is not important, when using reliable delivery.  This
14779
 * will allow messages to be indicated out of order if preceding
14780
 * messages have not yet arrived.  Otherwise DPLAY will wait for
14781
 * earlier messages before delivering later reliable messages.
14782
 *)
14783
  DPSESSION_NOPRESERVEORDER = $00004000;
14784
 
14785
 
14786
(*
14787
 * This flag tells DirectPlay to optimize communication for latency
14788
 *)
14789
  DPSESSION_OPTIMIZELATENCY = $00008000;
14790
 
1 daniel-mar 14791
type
4 daniel-mar 14792
(*
14793
 * TDPName
14794
 * Used to hold the name of a DirectPlay entity
14795
 * like a player or a group
14796
 *)
1 daniel-mar 14797
  PDPName = ^TDPName;
4 daniel-mar 14798
  TDPName = packed record
1 daniel-mar 14799
    dwSize: DWORD;    // Size of structure
14800
    dwFlags: DWORD;   // Not used. Must be zero.
14801
    case Integer of
4 daniel-mar 14802
 
14803
    lpszShortName : PCharAW; // The short or friendly name
14804
    lpszLongName : PCharAW;  // The long or formal name
14805
      );
14806
      1 : (
14807
    lpszShortNameA : PAnsiChar;
14808
    lpszLongNameA : PAnsiChar;
14809
      );
14810
      2 : (
14811
    lpszShortNameW : PWideChar;
14812
    lpszLongNameW : PWideChar;
14813
      );
1 daniel-mar 14814
  end;
14815
 
14816
(*
14817
 * TDPCredentials
14818
 * Used to hold the user name and password of a DirectPlay user
14819
 *)
14820
 
14821
  PDPCredentials = ^TDPCredentials;
4 daniel-mar 14822
  TDPCredentials = packed record
1 daniel-mar 14823
    dwSize: DWORD;    // Size of structure
14824
    dwFlags: DWORD;   // Not used. Must be zero.
14825
    case Integer of
4 daniel-mar 14826
 
14827
    lpszUsername: PCharAW;   // User name of the account
14828
    lpszPassword: PCharAW;   // Password of the account
14829
    lpszDomain:   PCharAW;   // Domain name of the account
14830
      );
14831
      1 : (
14832
    lpszUsernameA: PAnsiChar;   // User name of the account
14833
    lpszPasswordA: PAnsiChar;   // Password of the account
14834
    lpszDomainA:   PAnsiChar;   // Domain name of the account
14835
      );
14836
      2 : (
14837
    lpszUsernameW: PWideChar;   // User name of the account
14838
    lpszPasswordW: PWideChar;   // Password of the account
14839
    lpszDomainW:   PWideChar;   // Domain name of the account
14840
      );
1 daniel-mar 14841
  end;
14842
 
14843
(*
4 daniel-mar 14844
 * TDPSecurityDesc
1 daniel-mar 14845
 * Used to describe the security properties of a DirectPlay
14846
 * session instance
14847
 *)
14848
  PDPSecurityDesc = ^TDPSecurityDesc;
4 daniel-mar 14849
  TDPSecurityDesc = packed record
1 daniel-mar 14850
    dwSize: DWORD;                  // Size of structure
14851
    dwFlags: DWORD;                 // Not used. Must be zero.
14852
    case Integer of
4 daniel-mar 14853
 
14854
    lpszSSPIProvider : PCharAW;  // SSPI provider name
14855
    lpszCAPIProvider : PCharAW;  // CAPI provider name
14856
    dwCAPIProviderType: DWORD;      // Crypto Service Provider type
14857
    dwEncryptionAlgorithm: DWORD;   // Encryption Algorithm type
14858
      );
14859
      1 : (
14860
    lpszSSPIProviderA : PAnsiChar;  // SSPI provider name
14861
    lpszCAPIProviderA : PAnsiChar;  // CAPI provider name
14862
      );
14863
      2 : (
14864
    lpszSSPIProviderW : PWideChar;  // SSPI provider name
14865
    lpszCAPIProviderW : PWideChar;  // CAPI provider name
14866
      );
1 daniel-mar 14867
  end;
14868
 
14869
(*
4 daniel-mar 14870
 * DPACCOUNTDESC
1 daniel-mar 14871
 * Used to describe a user membership account
14872
 *)
4 daniel-mar 14873
 
1 daniel-mar 14874
  PDPAccountDesc = ^TDPAccountDesc;
4 daniel-mar 14875
  TDPAccountDesc = packed record
1 daniel-mar 14876
    dwSize: DWORD;    // Size of structure
14877
    dwFlags: DWORD;   // Not used. Must be zero.
14878
    case Integer of
4 daniel-mar 14879
 
14880
      1 : (lpszAccountIDA : PAnsiChar);
14881
      2 : (lpszAccountIDW : PWideChar);
1 daniel-mar 14882
  end;
14883
 
14884
(*
14885
 * TDPLConnection
14886
 * Used to hold all in the informaion needed to connect
14887
 * an application to a session or create a session
14888
 *)
14889
  PDPLConnection = ^TDPLConnection;
4 daniel-mar 14890
  TDPLConnection = packed record
1 daniel-mar 14891
    dwSize: DWORD;                     // Size of this structure
14892
    dwFlags: DWORD;                    // Flags specific to this structure
14893
    lpSessionDesc: PDPSessionDesc2;    // Pointer to session desc to use on connect
14894
    lpPlayerName: PDPName;             // Pointer to Player name structure
14895
    guidSP: TGUID;                     // GUID of the DPlay SP to use
14896
    lpAddress: Pointer;                // Address for service provider
14897
    dwAddressSize: DWORD;              // Size of address data
14898
  end;
14899
 
14900
(*
14901
 * TDPChat
14902
 * Used to hold the a DirectPlay chat message
14903
 *)
14904
  PDPChat = ^TDPChat;
4 daniel-mar 14905
  TDPChat = packed record
1 daniel-mar 14906
    dwSize: DWORD;
14907
    dwFlags: DWORD;
14908
    case Integer of
4 daniel-mar 14909
 
14910
      1 : (lpszMessageA : PAnsiChar);
14911
      2 : (lpszMessageW : PWideChar);
1 daniel-mar 14912
  end;
14913
 
14914
(*
4 daniel-mar 14915
 * TSGBuffer
1 daniel-mar 14916
 * Scatter Gather Buffer used for SendEx
14917
 *)
14918
  PSGBuffer = ^TSGBuffer;
4 daniel-mar 14919
  TSGBuffer = packed record
14920
    len: UINT;
14921
    pData: PUCHAR;
1 daniel-mar 14922
  end;
14923
 
4 daniel-mar 14924
(****************************************************************************
14925
 *
14926
 * Prototypes for DirectPlay callback functions
14927
 *
14928
 ****************************************************************************)
1 daniel-mar 14929
 
4 daniel-mar 14930
(*
14931
 * Callback for IDirectPlay2::EnumSessions
14932
 *)
14933
  TDPEnumSessionsCallback2 = function(lpThisSD: PDPSessionDesc2;
14934
      var lpdwTimeOut: DWORD; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 14935
 
14936
const
4 daniel-mar 14937
(*
14938
 * This flag is set on the EnumSessions callback dwFlags parameter when
14939
 * the time out has occurred. There will be no session data for this
14940
 * callback. If *lpdwTimeOut is set to a non-zero value and the
14941
 * EnumSessionsCallback function returns TRUE then EnumSessions will
14942
 * continue waiting until the next timeout occurs. Timeouts are in
14943
 * milliseconds.
14944
 *)
1 daniel-mar 14945
  DPESC_TIMEDOUT = $00000001;
14946
 
14947
type
4 daniel-mar 14948
(*
14949
 * Callback for IDirectPlay2.EnumPlayers
14950
 *              IDirectPlay2.EnumGroups
14951
 *              IDirectPlay2.EnumGroupPlayers
14952
 *)
14953
  TDPEnumPlayersCallback2 = function(DPID: TDPID; dwPlayerType: DWORD;
14954
      const lpName: TDPName; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 14955
 
14956
 
4 daniel-mar 14957
(*
14958
 * ANSI callback for DirectPlayEnumerate
14959
 * This callback prototype will be used if compiling
14960
 * for ANSI strings
14961
 *)
14962
  TDPEnumDPCallbackA = function(const lpguidSP: TGUID; lpSPName: PAnsiChar;
14963
      dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 14964
 
4 daniel-mar 14965
(*
14966
 * Unicode callback for DirectPlayEnumerate
14967
 * This callback prototype will be used if compiling
14968
 * for Unicode strings
14969
 *)
14970
  TDPEnumDPCallbackW = function(const lpguidSP: TGUID; lpSPName: PWideChar;
14971
      dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer) : BOOL; stdcall;
14972
 
14973
(*
14974
 * Callback for DirectPlayEnumerate
14975
 *)
14976
{$IFDEF UNICODE}
14977
  TDPEnumDPCallback = TDPEnumDPCallbackW;
14978
{$ELSE}
14979
  TDPEnumDPCallback = TDPEnumDPCallbackA;
14980
{$ENDIF}
14981
 
14982
(*
14983
 * Callback for IDirectPlay3(A/W).EnumConnections
14984
 *)
1 daniel-mar 14985
  TDPEnumConnectionsCallback = function(const lpguidSP: TGUID;
14986
      lpConnection: Pointer; dwConnectionSize: DWORD; const lpName: TDPName;
4 daniel-mar 14987
      dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 14988
 
4 daniel-mar 14989
(*
14990
 * API's
14991
 *)
1 daniel-mar 14992
 
4 daniel-mar 14993
var
14994
  DirectPlayEnumerate : function (lpEnumDPCallback: TDPEnumDPCallback;
14995
      lpContext: Pointer) : HResult; stdcall;
14996
  DirectPlayEnumerateA : function (lpEnumDPCallback: TDPEnumDPCallbackA;
14997
      lpContext: Pointer) : HResult; stdcall;
14998
  DirectPlayEnumerateW : function (lpEnumDPCallback: TDPEnumDPCallbackW;
14999
      lpContext: Pointer) : HResult; stdcall;
1 daniel-mar 15000
 
15001
 
4 daniel-mar 15002
(****************************************************************************
15003
 *
15004
 * IDirectPlay2 (and IDirectPlay2A) Interface
15005
 *
15006
 ****************************************************************************)
1 daniel-mar 15007
 
15008
type
4 daniel-mar 15009
  IDirectPlay2AW = interface (IUnknown)
15010
    (*** IDirectPlay2 methods ***)
15011
    function AddPlayerToGroup(idGroup: TDPID; idPlayer: TDPID) : HResult; stdcall;
1 daniel-mar 15012
    function Close: HResult; stdcall;
4 daniel-mar 15013
    function CreateGroup(out lpidGroup: TDPID; lpGroupName: PDPName;
15014
        lpData: Pointer; dwDataSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
15015
    function CreatePlayer(out lpidPlayer: TDPID; pPlayerName: PDPName;
15016
        hEvent: THandle; lpData: Pointer; dwDataSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
15017
    function DeletePlayerFromGroup(idGroup: TDPID; idPlayer: TDPID) : HResult; stdcall;
15018
    function DestroyGroup(idGroup: TDPID) : HResult; stdcall;
15019
    function DestroyPlayer(idPlayer: TDPID) : HResult; stdcall;
15020
    function EnumGroupPlayers(idGroup: TDPID; lpguidInstance: PGUID;
1 daniel-mar 15021
        lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
4 daniel-mar 15022
        dwFlags: DWORD) : HResult; stdcall;
15023
    function EnumGroups(lpguidInstance: PGUID; lpEnumPlayersCallback2:
15024
        TDPEnumPlayersCallback2; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
15025
    function EnumPlayers(lpguidInstance: PGUID; lpEnumPlayersCallback2:
15026
        TDPEnumPlayersCallback2; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 15027
    function EnumSessions(const lpsd: TDPSessionDesc2; dwTimeout: DWORD;
15028
        lpEnumSessionsCallback2: TDPEnumSessionsCallback2; lpContext: Pointer;
4 daniel-mar 15029
        dwFlags: DWORD) : HResult; stdcall;
15030
    function GetCaps(var lpDPCaps: TDPCaps; dwFlags: DWORD) : HResult; stdcall;
15031
    function GetGroupData(idGroup: TDPID; lpData: Pointer; var lpdwDataSize: DWORD;
15032
        dwFlags: DWORD) : HResult; stdcall;
15033
    function GetGroupName(idGroup: TDPID; lpData: Pointer; var lpdwDataSize: DWORD) :
15034
        HResult; stdcall;
15035
    function GetMessageCount(idPlayer: TDPID; var lpdwCount: DWORD) : HResult; stdcall;
15036
    function GetPlayerAddress(idPlayer: TDPID; lpAddress: Pointer;
15037
        var lpdwAddressSize: DWORD) : HResult; stdcall;
1 daniel-mar 15038
    function GetPlayerCaps(idPlayer: TDPID; var lpPlayerCaps: TDPCaps;
4 daniel-mar 15039
        dwFlags: DWORD) : HResult; stdcall;
15040
    function GetPlayerData(idPlayer: TDPID; lpData: Pointer; var lpdwDataSize: DWORD;
15041
        dwFlags: DWORD) : HResult; stdcall;
15042
    function GetPlayerName(idPlayer: TDPID; lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
15043
    function GetSessionDesc(lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
15044
    function Initialize(const lpGUID: TGUID) : HResult; stdcall;
15045
    function Open(var lpsd: TDPSessionDesc2; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 15046
    function Receive(var lpidFrom: TDPID; var lpidTo: TDPID; dwFlags: DWORD;
4 daniel-mar 15047
        lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
15048
    function Send(idFrom: TDPID; lpidTo: TDPID; dwFlags: DWORD; var lpData;
15049
        lpdwDataSize: DWORD) : HResult; stdcall;
15050
    function SetGroupData(idGroup: TDPID; lpData: Pointer; dwDataSize: DWORD;
15051
        dwFlags: DWORD) : HResult; stdcall;
15052
    function SetGroupName(idGroup: TDPID; lpGroupName: PDPName;
15053
        dwFlags: DWORD) : HResult; stdcall;
15054
    function SetPlayerData(idPlayer: TDPID; lpData: Pointer; dwDataSize: DWORD;
15055
        dwFlags: DWORD) : HResult; stdcall;
15056
    function SetPlayerName(idPlayer: TDPID; lpPlayerName: PDPName;
15057
        dwFlags: DWORD) : HResult; stdcall;
15058
    function SetSessionDesc(var lpSessDesc: TDPSessionDesc2; dwFlags: DWORD) :
15059
        HResult; stdcall;
1 daniel-mar 15060
  end;
15061
 
4 daniel-mar 15062
  IDirectPlay2W = interface (IDirectPlay2AW)
15063
    ['{2B74F7C0-9154-11CF-A9CD-00AA006886E3}']
1 daniel-mar 15064
  end;
4 daniel-mar 15065
  IDirectPlay2A = interface (IDirectPlay2AW)
15066
    ['{9d460580-a822-11cf-960c-0080c7534e82}']
15067
  end;
1 daniel-mar 15068
 
4 daniel-mar 15069
{$IFDEF UNICODE}
15070
  IDirectPlay2 = IDirectPlay2W;
15071
{$ELSE}
15072
  IDirectPlay2 = IDirectPlay2A;
15073
{$ENDIF}
1 daniel-mar 15074
 
4 daniel-mar 15075
(****************************************************************************
15076
 *
15077
 * IDirectPlay3 (and IDirectPlay3A) Interface
15078
 *
15079
 ****************************************************************************)
15080
 
15081
  IDirectPlay3AW = interface (IDirectPlay2AW)
15082
    (*** IDirectPlay3 methods ***)
15083
    function AddGroupToGroup(idParentGroup: TDPID; idGroup: TDPID) : HResult; stdcall;
1 daniel-mar 15084
    function CreateGroupInGroup(idParentGroup: TDPID; var lpidGroup: TDPID;
4 daniel-mar 15085
        lpGroupName: PDPName; lpData: Pointer; dwDataSize: DWORD;
15086
        dwFlags: DWORD) : HResult; stdcall;
15087
    function DeleteGroupFromGroup(idParentGroup: TDPID; idGroup: TDPID) : HResult; stdcall;
15088
    function EnumConnections(lpguidApplication: PGUID;
1 daniel-mar 15089
        lpEnumCallback: TDPEnumConnectionsCallback; lpContext: Pointer;
4 daniel-mar 15090
        dwFlags: DWORD) : HResult; stdcall;
15091
    function EnumGroupsInGroup(idGroup: TDPID; lpguidInstance: PGUID;
1 daniel-mar 15092
        lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
4 daniel-mar 15093
        dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 15094
    function GetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
4 daniel-mar 15095
        lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
15096
    function InitializeConnection(lpConnection: Pointer; dwFlags: DWORD) : HResult; stdcall;
15097
    function SecureOpen(var lpsd: TDPSessionDesc2; dwFlags: DWORD;
15098
        var lpSecurity: TDPSecurityDesc; var lpCredentials: TDPCredentials) : HResult; stdcall;
1 daniel-mar 15099
    function SendChatMessage(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
4 daniel-mar 15100
        var lpChatMessage: TDPChat) : HResult; stdcall;
1 daniel-mar 15101
    function SetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
4 daniel-mar 15102
        var lpConnection: TDPLConnection) : HResult; stdcall;
15103
    function StartSession(dwFlags: DWORD; idGroup: TDPID) : HResult; stdcall;
15104
    function GetGroupFlags(idGroup: TDPID; out lpdwFlags: DWORD) : HResult; stdcall;
15105
    function GetGroupParent(idGroup: TDPID; out lpidParent: TDPID) : HResult; stdcall;
1 daniel-mar 15106
    function GetPlayerAccount(idPlayer: TDPID; dwFlags: DWORD; var lpData;
4 daniel-mar 15107
        var lpdwDataSize: DWORD) : HResult; stdcall;
15108
    function GetPlayerFlags(idPlayer: TDPID; out lpdwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 15109
  end;
15110
 
4 daniel-mar 15111
 
15112
  IDirectPlay3W = interface (IDirectPlay3AW)
15113
    ['{133EFE40-32DC-11D0-9CFB-00A0C90A43CB}']
1 daniel-mar 15114
  end;
4 daniel-mar 15115
  IDirectPlay3A = interface (IDirectPlay3AW)
15116
    ['{133efe41-32dc-11d0-9cfb-00a0c90a43cb}']
15117
  end;
1 daniel-mar 15118
 
4 daniel-mar 15119
{$IFDEF UNICODE}
15120
  IDirectPlay3 = IDirectPlay3W;
15121
{$ELSE}
15122
  IDirectPlay3 = IDirectPlay3A;
15123
{$ENDIF}
1 daniel-mar 15124
 
4 daniel-mar 15125
 
15126
(****************************************************************************
15127
 *
15128
 * IDirectPlay4 (and IDirectPlay4A) Interface
15129
 *
15130
 ****************************************************************************)
15131
 
15132
  IDirectPlay4AW = interface (IDirectPlay3AW)
15133
    (*** IDirectPlay4 methods ***)
15134
    function GetGroupOwner(idGroup: TDPID; out idOwner: TDPID) : HResult; stdcall;
15135
    function SetGroupOwner(idGroup: TDPID; idOwner: TDPID) : HResult; stdcall;
15136
    function SendEx(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD; lpData: Pointer;
1 daniel-mar 15137
        dwDataSize: DWORD; dwPriority: DWORD; dwTimeout: DWORD;
4 daniel-mar 15138
        lpContext: Pointer; lpdwMsgId: PDWORD) : HResult; stdcall;
1 daniel-mar 15139
    function GetMessageQueue(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
4 daniel-mar 15140
        lpdwNumMsgs: PDWORD; lpdwNumBytes: PDWORD) : HResult; stdcall;
15141
    function CancelMessage(dwMessageID: DWORD; dwFlags: DWORD) : HResult; stdcall;
15142
    function CancelPriority(dwMinPriority: DWORD; dwMaxPriority: DWORD; dwFlags: DWORD) : HResult; stdcall;
15143
  end;
1 daniel-mar 15144
 
4 daniel-mar 15145
 
15146
  IDirectPlay4W = interface (IDirectPlay4AW)
15147
    ['{0ab1c530-4745-11D1-a7a1-0000f803abfc}']
1 daniel-mar 15148
  end;
4 daniel-mar 15149
  IDirectPlay4A = interface (IDirectPlay4AW)
15150
    ['{0ab1c531-4745-11D1-a7a1-0000f803abfc}']
15151
  end;
1 daniel-mar 15152
 
4 daniel-mar 15153
{$IFDEF UNICODE}
15154
  IDirectPlay4 = IDirectPlay4W;
15155
{$ELSE}
15156
  IDirectPlay4 = IDirectPlay4A;
15157
{$ENDIF}
15158
 
15159
 
1 daniel-mar 15160
const
4 daniel-mar 15161
(****************************************************************************
15162
 *
15163
 * EnumConnections API flags
15164
 *
15165
 ****************************************************************************)
1 daniel-mar 15166
 
4 daniel-mar 15167
(*
15168
 * Enumerate Service Providers
15169
 *)
15170
  DPCONNECTION_DIRECTPLAY = $00000001;
15171
 
15172
(*
15173
 * Enumerate Lobby Providers
15174
 *)
1 daniel-mar 15175
  DPCONNECTION_DIRECTPLAYLOBBY = $00000002;
15176
 
4 daniel-mar 15177
(****************************************************************************
15178
 *
15179
 * EnumPlayers API flags
15180
 *
15181
 ****************************************************************************)
1 daniel-mar 15182
 
4 daniel-mar 15183
(*
15184
 * Enumerate all players in the current session
15185
 *)
15186
  DPENUMPLAYERS_ALL = $00000000;
15187
  DPENUMGROUPS_ALL = DPENUMPLAYERS_ALL;
15188
 
15189
(*
15190
 * Enumerate only local (created by this application) players
15191
 * or groups
15192
 *)
15193
  DPENUMPLAYERS_LOCAL = $00000008;
15194
  DPENUMGROUPS_LOCAL = DPENUMPLAYERS_LOCAL;
15195
 
15196
(*
15197
 * Enumerate only remote (non-local) players
15198
 * or groups
15199
 *)
15200
  DPENUMPLAYERS_REMOTE = $00000010;
15201
  DPENUMGROUPS_REMOTE = DPENUMPLAYERS_REMOTE;
15202
 
15203
(*
15204
 * Enumerate groups along with the players
15205
 *)
15206
  DPENUMPLAYERS_GROUP = $00000020;
15207
 
15208
(*
15209
 * Enumerate players or groups in another session
15210
 * (must supply lpguidInstance)
15211
 *)
15212
  DPENUMPLAYERS_SESSION = $00000080;
15213
  DPENUMGROUPS_SESSION = DPENUMPLAYERS_SESSION;
15214
 
15215
(*
15216
 * Enumerate server players
15217
 *)
1 daniel-mar 15218
  DPENUMPLAYERS_SERVERPLAYER = $00000100;
15219
 
4 daniel-mar 15220
(*
15221
 * Enumerate spectator players
15222
 *)
15223
  DPENUMPLAYERS_SPECTATOR = $00000200;
1 daniel-mar 15224
 
4 daniel-mar 15225
(*
15226
 * Enumerate shortcut groups
15227
 *)
15228
  DPENUMGROUPS_SHORTCUT = $00000400;
15229
 
15230
(*
15231
 * Enumerate staging area groups
15232
 *)
15233
  DPENUMGROUPS_STAGINGAREA = $00000800;
15234
 
15235
(*
15236
 * Enumerate hidden groups
15237
 *)
15238
  DPENUMGROUPS_HIDDEN = $00001000;
15239
 
15240
(*
15241
 * Enumerate the group's owner
15242
 *)
15243
  DPENUMPLAYERS_OWNER = $00002000;
15244
 
15245
(****************************************************************************
15246
 *
15247
 * CreatePlayer API flags
15248
 *
15249
 ****************************************************************************)
15250
 
15251
(*
15252
 * This flag indicates that this player should be designated
15253
 * the server player. The app should specify this at CreatePlayer.
15254
 *)
1 daniel-mar 15255
  DPPLAYER_SERVERPLAYER = DPENUMPLAYERS_SERVERPLAYER;
15256
 
4 daniel-mar 15257
(*
15258
 * This flag indicates that this player should be designated
15259
 * a spectator. The app should specify this at CreatePlayer.
15260
 *)
15261
  DPPLAYER_SPECTATOR = DPENUMPLAYERS_SPECTATOR;
1 daniel-mar 15262
 
4 daniel-mar 15263
(*
15264
 * This flag indicates that this player was created locally.
15265
 * (returned from GetPlayerFlags)
15266
 *)
15267
  DPPLAYER_LOCAL = DPENUMPLAYERS_LOCAL;
15268
 
15269
(*
15270
 * This flag indicates that this player is the group's owner
15271
 * (Only returned in EnumGroupPlayers)
15272
 *)
15273
  DPPLAYER_OWNER = DPENUMPLAYERS_OWNER;
15274
 
15275
(****************************************************************************
15276
 *
15277
 * CreateGroup API flags
15278
 *
15279
 ****************************************************************************)
15280
 
15281
(*
15282
 * This flag indicates that the StartSession can be called on the group.
15283
 * The app should specify this at CreateGroup, or CreateGroupInGroup.
15284
 *)
1 daniel-mar 15285
  DPGROUP_STAGINGAREA = DPENUMGROUPS_STAGINGAREA;
15286
 
4 daniel-mar 15287
(*
15288
 * This flag indicates that this group was created locally.
15289
 * (returned from GetGroupFlags)
15290
 *)
15291
  DPGROUP_LOCAL = DPENUMGROUPS_LOCAL;
1 daniel-mar 15292
 
4 daniel-mar 15293
(*
15294
 * This flag indicates that this group was created hidden.
15295
 *)
15296
  DPGROUP_HIDDEN = DPENUMGROUPS_HIDDEN;
15297
 
15298
(****************************************************************************
15299
 *
15300
 * EnumSessions API flags
15301
 *
15302
 ****************************************************************************)
15303
 
15304
(*
15305
 * Enumerate sessions which can be joined
15306
 *)
15307
  DPENUMSESSIONS_AVAILABLE = $00000001;
15308
 
15309
(*
15310
 * Enumerate all sessions even if they can't be joined.
15311
 *)
15312
  DPENUMSESSIONS_ALL = $00000002;
15313
 
15314
(*
15315
 * Start an asynchronous enum sessions
15316
 *)
15317
  DPENUMSESSIONS_ASYNC = $00000010;
15318
 
15319
(*
15320
 * Stop an asynchronous enum sessions
15321
 *)
15322
  DPENUMSESSIONS_STOPASYNC = $00000020;
15323
 
15324
(*
15325
 * Enumerate sessions even if they require a password
15326
 *)
1 daniel-mar 15327
  DPENUMSESSIONS_PASSWORDREQUIRED = $00000040;
15328
 
4 daniel-mar 15329
(*
15330
 * Return status about progress of enumeration instead of
15331
 * showing any status dialogs.
15332
 *)
15333
  DPENUMSESSIONS_RETURNSTATUS = $00000080;
1 daniel-mar 15334
 
4 daniel-mar 15335
(****************************************************************************
15336
 *
15337
 * GetCaps and GetPlayerCaps API flags
15338
 *
15339
 ****************************************************************************)
15340
 
15341
(*
15342
 * The latency returned should be for guaranteed message sending.
15343
 * Default is non-guaranteed messaging.
15344
 *)
1 daniel-mar 15345
  DPGETCAPS_GUARANTEED = $00000001;
15346
 
4 daniel-mar 15347
(****************************************************************************
15348
 *
15349
 * GetGroupData, GetPlayerData API flags
15350
 * Remote and local Group/Player data is maintained separately.
15351
 * Default is DPGET_REMOTE.
15352
 *
15353
 ****************************************************************************)
1 daniel-mar 15354
 
4 daniel-mar 15355
(*
15356
 * Get the remote data (set by any DirectPlay object in
15357
 * the session using DPSET_REMOTE)
15358
 *)
1 daniel-mar 15359
  DPGET_REMOTE = $00000000;
15360
 
4 daniel-mar 15361
(*
15362
 * Get the local data (set by this DirectPlay object
15363
 * using DPSET_LOCAL)
15364
 *)
15365
  DPGET_LOCAL = $00000001;
1 daniel-mar 15366
 
4 daniel-mar 15367
(****************************************************************************
15368
 *
15369
 * Open API flags
15370
 *
15371
 ****************************************************************************)
15372
 
15373
(*
15374
 * Join the session that is described by the DPSESSIONDESC2 structure
15375
 *)
15376
  DPOPEN_JOIN = $00000001;
15377
 
15378
(*
15379
 * Create a new session as described by the DPSESSIONDESC2 structure
15380
 *)
15381
  DPOPEN_CREATE = $00000002;
15382
 
15383
(*
15384
 * Return status about progress of open instead of showing
15385
 * any status dialogs.
15386
 *)
1 daniel-mar 15387
  DPOPEN_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
15388
 
4 daniel-mar 15389
(****************************************************************************
15390
 *
15391
 * DPLCONNECTION flags
15392
 *
15393
 ****************************************************************************)
1 daniel-mar 15394
 
4 daniel-mar 15395
(*
15396
 * This application should create a new session as
15397
 * described by the DPSESIONDESC structure
15398
 *)
1 daniel-mar 15399
  DPLCONNECTION_CREATESESSION = DPOPEN_CREATE;
15400
 
4 daniel-mar 15401
(*
15402
 * This application should join the session described by
15403
 * the DPSESIONDESC structure with the lpAddress data
15404
 *)
15405
  DPLCONNECTION_JOINSESSION = DPOPEN_JOIN;
1 daniel-mar 15406
 
4 daniel-mar 15407
(****************************************************************************
15408
 *
15409
 * Receive API flags
15410
 * Default is DPRECEIVE_ALL
15411
 *
15412
 ****************************************************************************)
15413
 
15414
(*
15415
 * Get the first message in the queue
15416
 *)
15417
  DPRECEIVE_ALL = $00000001;
15418
 
15419
(*
15420
 * Get the first message in the queue directed to a specific player
15421
 *)
15422
  DPRECEIVE_TOPLAYER = $00000002;
15423
 
15424
(*
15425
 * Get the first message in the queue from a specific player
15426
 *)
1 daniel-mar 15427
  DPRECEIVE_FROMPLAYER = $00000004;
15428
 
4 daniel-mar 15429
(*
15430
 * Get the message but don't remove it from the queue
15431
 *)
15432
  DPRECEIVE_PEEK = $00000008;
1 daniel-mar 15433
 
4 daniel-mar 15434
(****************************************************************************
15435
 *
15436
 * Send API flags
15437
 *
15438
 ****************************************************************************)
15439
 
15440
(*
15441
 * Send the message using a guaranteed send method.
15442
 * Default is non-guaranteed.
15443
 *)
15444
  DPSEND_GUARANTEED = $00000001;
15445
 
15446
(*
15447
 * This flag is obsolete. It is ignored by DirectPlay
15448
 *)
15449
  DPSEND_HIGHPRIORITY = $00000002;
15450
 
15451
(*
15452
 * This flag is obsolete. It is ignored by DirectPlay
15453
 *)
15454
  DPSEND_OPENSTREAM = $00000008;
15455
 
15456
(*
15457
 * This flag is obsolete. It is ignored by DirectPlay
15458
 *)
15459
  DPSEND_CLOSESTREAM = $00000010;
15460
 
15461
(*
15462
 * Send the message digitally signed to ensure authenticity.
15463
 *)
15464
  DPSEND_SIGNED = $00000020;
15465
 
15466
(*
15467
 * Send the message with encryption to ensure privacy.
15468
 *)
15469
  DPSEND_ENCRYPTED = $00000040;
15470
 
15471
(*
15472
 * The message is a lobby system message
15473
 *)
1 daniel-mar 15474
  DPSEND_LOBBYSYSTEMMESSAGE = $00000080;
15475
 
4 daniel-mar 15476
(*
15477
 * andyco - added this so we can make addforward async.
15478
 * needs to be sanitized when we add / expose full async
15479
 * support.  8/3/97.
15480
 *)
15481
  DPSEND_ASYNC = $00000200;
1 daniel-mar 15482
 
4 daniel-mar 15483
(*
15484
 * When a message is completed, don't tell me.
15485
 * by default the application is notified with a system message.
15486
 *)
15487
  DPSEND_NOSENDCOMPLETEMSG = $00000400;
15488
 
15489
 
15490
(*
15491
 * Maximum priority for sends available to applications
15492
 *)
15493
  DPSEND_MAX_PRI = $0000FFFF;
15494
  DPSEND_MAX_PRIORITY = DPSEND_MAX_PRI;
15495
 
15496
(****************************************************************************
15497
 *
15498
 * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName,
15499
 * SetSessionDesc API flags.
15500
 * Default is DPSET_REMOTE.
15501
 *
15502
 ****************************************************************************)
15503
 
15504
(*
15505
 * Propagate the data to all players in the session
15506
 *)
15507
  DPSET_REMOTE = $00000000;
15508
 
15509
(*
15510
 * Do not propagate the data to other players
15511
 *)
15512
  DPSET_LOCAL = $00000001;
15513
 
15514
(*
15515
 * Used with DPSET_REMOTE, use guaranteed message send to
15516
 * propagate the data
15517
 *)
1 daniel-mar 15518
  DPSET_GUARANTEED = $00000002;
15519
 
4 daniel-mar 15520
(****************************************************************************
15521
 *
15522
 * GetMessageQueue API flags.
15523
 * Default is DPMESSAGEQUEUE_SEND
15524
 *
15525
 ****************************************************************************)
1 daniel-mar 15526
 
4 daniel-mar 15527
(*
15528
 * Get Send Queue - requires Service Provider Support
15529
 *)
15530
  DPMESSAGEQUEUE_SEND = $00000001;
1 daniel-mar 15531
 
4 daniel-mar 15532
(*
15533
 * Get Receive Queue
15534
 *)
15535
  DPMESSAGEQUEUE_RECEIVE = $00000002;
1 daniel-mar 15536
 
4 daniel-mar 15537
(****************************************************************************
15538
 *
15539
 * Connect API flags
15540
 *
15541
 ****************************************************************************)
15542
 
15543
(*
15544
 * Start an asynchronous connect which returns status codes
15545
 *)
1 daniel-mar 15546
  DPCONNECT_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
15547
 
4 daniel-mar 15548
(****************************************************************************
15549
 *
15550
 * DirectPlay system messages and message data structures
15551
 *
15552
 * All system message come 'From' player DPID_SYSMSG.  To determine what type
15553
 * of message it is, cast the lpData from Receive to TDPMsg_Generic and check
15554
 * the dwType member against one of the following DPSYS_xxx constants. Once
15555
 * a match is found, cast the lpData to the corresponding of the DPMSG_xxx
15556
 * structures to access the data of the message.
15557
 *
15558
 ****************************************************************************)
1 daniel-mar 15559
 
4 daniel-mar 15560
(*
15561
 * A new player or group has been created in the session
15562
 * Use TDPMsg_CreatePlayerOrGroup.  Check dwPlayerType to see if it
15563
 * is a player or a group.
15564
 *)
15565
  DPSYS_CREATEPLAYERORGROUP = $0003;
15566
 
15567
(*
15568
 * A player has been deleted from the session
15569
 * Use TDPMsg_DestroyPlayerOrGroup
15570
 *)
15571
  DPSYS_DESTROYPLAYERORGROUP = $0005;
15572
 
15573
(*
15574
 * A player has been added to a group
15575
 * Use DPMSG_ADDPLAYERTOGROUP
15576
 *)
15577
  DPSYS_ADDPLAYERTOGROUP = $0007;
15578
 
15579
(*
15580
 * A player has been removed from a group
15581
 * Use DPMSG_DELETEPLAYERFROMGROUP
15582
 *)
1 daniel-mar 15583
  DPSYS_DELETEPLAYERFROMGROUP = $0021;
15584
 
4 daniel-mar 15585
(*
15586
 * This DirectPlay object lost its connection with all the
15587
 * other players in the session.
15588
 * Use DPMSG_SESSIONLOST.
15589
 *)
15590
  DPSYS_SESSIONLOST = $0031;
1 daniel-mar 15591
 
4 daniel-mar 15592
(*
15593
 * The current host has left the session.
15594
 * This DirectPlay object is now the host.
15595
 * Use DPMSG_HOST.
15596
 *)
15597
  DPSYS_HOST = $0101;
1 daniel-mar 15598
 
4 daniel-mar 15599
(*
15600
 * The remote data associated with a player or
15601
 * group has changed. Check dwPlayerType to see
15602
 * if it is a player or a group
15603
 * Use DPMSG_SETPLAYERORGROUPDATA
15604
 *)
15605
  DPSYS_SETPLAYERORGROUPDATA = $0102;
1 daniel-mar 15606
 
4 daniel-mar 15607
(*
15608
 * The name of a player or group has changed.
15609
 * Check dwPlayerType to see if it is a player
15610
 * or a group.
15611
 * Use TDPMsg_SetPlayerOrGroupName
15612
 *)
15613
  DPSYS_SETPLAYERORGROUPNAME = $0103;
1 daniel-mar 15614
 
4 daniel-mar 15615
(*
15616
 * The session description has changed.
15617
 * Use DPMSG_SETSESSIONDESC
15618
 *)
15619
  DPSYS_SETSESSIONDESC = $0104;
15620
 
15621
(*
15622
 * A group has been added to a group
15623
 * Use TDPMsg_AddGroupToGroup
15624
 *)
15625
  DPSYS_ADDGROUPTOGROUP = $0105;
15626
 
15627
(*
15628
 * A group has been removed from a group
15629
 * Use DPMsg_DeleteGroupFromGroup
15630
 *)
15631
  DPSYS_DELETEGROUPFROMGROUP = $0106;
15632
 
15633
(*
15634
 * A secure player-player message has arrived.
15635
 * Use DPMSG_SECUREMESSAGE
15636
 *)
15637
  DPSYS_SECUREMESSAGE = $0107;
15638
 
15639
(*
15640
 * Start a new session.
15641
 * Use DPMSG_STARTSESSION
15642
 *)
15643
  DPSYS_STARTSESSION = $0108;
15644
 
15645
(*
15646
 * A chat message has arrived
15647
 * Use DPMSG_CHAT
15648
 *)
15649
  DPSYS_CHAT = $0109;
15650
 
15651
(*
15652
 * The owner of a group has changed
15653
 * Use DPMSG_SETGROUPOWNER
15654
 *)
15655
  DPSYS_SETGROUPOWNER = $010A;
15656
 
15657
(*
15658
 * An async send has finished, failed or been cancelled
15659
 * Use DPMSG_SENDCOMPLETE
15660
 *)
15661
  DPSYS_SENDCOMPLETE = $010D;
15662
 
15663
(*
15664
 * Used in the dwPlayerType field to indicate if it applies to a group
15665
 * or a player
15666
 *)
15667
  DPPLAYERTYPE_GROUP = $00000000;
15668
  DPPLAYERTYPE_PLAYER = $00000001;
15669
 
1 daniel-mar 15670
type
4 daniel-mar 15671
(*
15672
 * TDPMsg_Generic
15673
 * Generic message structure used to identify the message type.
15674
 *)
1 daniel-mar 15675
  PDPMsg_Generic = ^TDPMsg_Generic;
4 daniel-mar 15676
  TDPMsg_Generic = packed record
1 daniel-mar 15677
    dwType: DWORD;   // Message type
15678
  end;
15679
 
4 daniel-mar 15680
(*
15681
 * TDPMsg_CreatePlayerOrGroup
15682
 * System message generated when a new player or group
15683
 * created in the session with information about it.
15684
 *)
1 daniel-mar 15685
  PDPMsg_CreatePlayerOrGroup = ^TDPMsg_CreatePlayerOrGroup;
4 daniel-mar 15686
  TDPMsg_CreatePlayerOrGroup = packed record
1 daniel-mar 15687
    dwType: DWORD;             // Message type
15688
    dwPlayerType: DWORD;       // Is it a player or group
4 daniel-mar 15689
    DPID: TDPID;               // ID of the player or group
1 daniel-mar 15690
    dwCurrentPlayers: DWORD;   // current # players & groups in session
15691
    lpData: Pointer;           // pointer to remote data
15692
    dwDataSize: DWORD;         // size of remote data
15693
    dpnName: TDPName;           // structure with name info
15694
                               // the following fields are only available when using
15695
                               // the IDirectPlay3 interface or greater
4 daniel-mar 15696
    dpIdParent: TDPID;         // id of parent group
1 daniel-mar 15697
    dwFlags: DWORD;            // player or group flags
15698
  end;
15699
 
4 daniel-mar 15700
(*
15701
 * TDPMsg_DestroyPlayerOrGroup
15702
 * System message generated when a player or group is being
15703
 * destroyed in the session with information about it.
15704
 *)
15705
  PDPMsg_DestroyPlayerOrGroup= ^TDPMsg_DestroyPlayerOrGroup;
15706
  TDPMsg_DestroyPlayerOrGroup = packed record
1 daniel-mar 15707
    dwType: DWORD;             // Message type
15708
    dwPlayerType: DWORD;       // Is it a player or group
4 daniel-mar 15709
    DPID: TDPID;                // player ID being deleted
1 daniel-mar 15710
    lpLocalData: Pointer;      // copy of players local data
15711
    dwLocalDataSize: DWORD;    // sizeof local data
15712
    lpRemoteData: Pointer;     // copy of players remote data
15713
    dwRemoteDataSize: DWORD;   // sizeof remote data
15714
                               // the following fields are only available when using
15715
                               // the IDirectPlay3 interface or greater
15716
    dpnName: TDPName;           // structure with name info
15717
    dpIdParent: TDPID;          // id of parent group
15718
    dwFlags: DWORD;            // player or group flags
15719
  end;
15720
 
4 daniel-mar 15721
(*
15722
 * DPMSG_ADDPLAYERTOGROUP
15723
 * System message generated when a player is being added
15724
 * to a group.
15725
 *)
15726
  PDPMsg_AddPlayerToGroup = ^TDPMsg_AddPlayerToGroup;
15727
  TDPMsg_AddPlayerToGroup = packed record
1 daniel-mar 15728
    dwType: DWORD;      // Message type
15729
    dpIdGroup: TDPID;    // group ID being added to
15730
    dpIdPlayer: TDPID;   // player ID being added
15731
  end;
15732
 
4 daniel-mar 15733
(*
15734
 * DPMSG_DELETEPLAYERFROMGROUP
15735
 * System message generated when a player is being
15736
 * removed from a group
15737
 *)
15738
  PDPMsg_DeletePlayerFromGroup = ^TDPMsg_DeletePlayerFromGroup;
15739
  TDPMsg_DeletePlayerFromGroup = TDPMsg_AddPlayerToGroup;
1 daniel-mar 15740
 
4 daniel-mar 15741
(*
15742
 * TDPMsg_AddGroupToGroup
15743
 * System message generated when a group is being added
15744
 * to a group.
15745
 *)
1 daniel-mar 15746
  PDPMsg_AddGroupToGroup = ^TDPMsg_AddGroupToGroup;
4 daniel-mar 15747
  TDPMsg_AddGroupToGroup = packed record
1 daniel-mar 15748
    dwType: DWORD;           // Message type
15749
    dpIdParentGroup: TDPID;   // group ID being added to
15750
    dpIdGroup: TDPID;         // group ID being added
15751
  end;
15752
 
4 daniel-mar 15753
(*
15754
 * DPMsg_DeleteGroupFromGroup
15755
 * System message generated when a GROUP is being
15756
 * removed from a group
15757
 *)
15758
  PDPMsg_DeleteGroupFromGroup = ^TDPMsg_DeleteGroupFromGroup;
1 daniel-mar 15759
  TDPMsg_DeleteGroupFromGroup = TDPMsg_AddGroupToGroup;
15760
 
4 daniel-mar 15761
(*
15762
 * DPMSG_SETPLAYERORGROUPDATA
15763
 * System message generated when remote data for a player or
15764
 * group has changed.
15765
 *)
1 daniel-mar 15766
  PDPMsg_SetPlayerOrGroupData = ^TDPMsg_SetPlayerOrGroupData;
4 daniel-mar 15767
  TDPMsg_SetPlayerOrGroupData = packed record
1 daniel-mar 15768
    dwType: DWORD;         // Message type
15769
    dwPlayerType: DWORD;   // Is it a player or group
4 daniel-mar 15770
    DPID: TDPID;           // ID of player or group
1 daniel-mar 15771
    lpData: Pointer;       // pointer to remote data
15772
    dwDataSize: DWORD;     // size of remote data
15773
  end;
15774
 
4 daniel-mar 15775
(*
15776
 * DPMSG_SETPLAYERORGROUPNAME
15777
 * System message generated when the name of a player or
15778
 * group has changed.
15779
 *)
1 daniel-mar 15780
  PDPMsg_SetPlayerOrGroupName = ^TDPMsg_SetPlayerOrGroupName;
4 daniel-mar 15781
  TDPMsg_SetPlayerOrGroupName = packed record
1 daniel-mar 15782
    dwType: DWORD;         // Message type
15783
    dwPlayerType: DWORD;   // Is it a player or group
4 daniel-mar 15784
    DPID: TDPID;           // ID of player or group
15785
    dpnName: TDPName;      // structure with new name info
1 daniel-mar 15786
  end;
15787
 
4 daniel-mar 15788
(*
15789
 * DPMSG_SETSESSIONDESC
15790
 * System message generated when session desc has changed
15791
 *)
1 daniel-mar 15792
  PDPMsg_SetSessionDesc = ^TDPMsg_SetSessionDesc;
4 daniel-mar 15793
  TDPMsg_SetSessionDesc = packed record
1 daniel-mar 15794
    dwType: DWORD;            // Message type
15795
    dpDesc: TDPSessionDesc2;   // Session desc
15796
  end;
15797
 
4 daniel-mar 15798
(*
15799
 * DPMSG_HOST
15800
 * System message generated when the host has migrated to this
15801
 * DirectPlay object.
15802
 *
15803
 *)
1 daniel-mar 15804
  PDPMsg_Host = ^TDPMsg_Host;
15805
  TDPMsg_Host = TDPMsg_Generic;
15806
 
4 daniel-mar 15807
(*
15808
 * DPMSG_SESSIONLOST
15809
 * System message generated when the connection to the session is lost.
15810
 *
15811
 *)
1 daniel-mar 15812
  PDPMsg_SessionLost = ^TDPMsg_SessionLost;
15813
  TDPMsg_SessionLost = TDPMsg_Generic;
15814
 
4 daniel-mar 15815
(*
15816
 * DPMSG_SECUREMESSAGE
15817
 * System message generated when a player requests a secure send
15818
 *)
1 daniel-mar 15819
  PDPMsg_SecureMessage = ^TDPMsg_SecureMessage;
4 daniel-mar 15820
  TDPMsg_SecureMessage = packed record
1 daniel-mar 15821
    dwType: DWORD;       // Message Type
15822
    dwFlags: DWORD;      // Signed/Encrypted
15823
    dpIdFrom: TDPID;      // ID of Sending Player
15824
    lpData: Pointer;     // Player message
15825
    dwDataSize: DWORD;   // Size of player message
15826
  end;
15827
 
4 daniel-mar 15828
(*
15829
 * DPMSG_STARTSESSION
15830
 * System message containing all information required to
15831
 * start a new session
15832
 *)
1 daniel-mar 15833
  PDPMsg_StartSession = ^TDPMsg_StartSession;
4 daniel-mar 15834
  TDPMsg_StartSession = packed record
1 daniel-mar 15835
    dwType: DWORD;             // Message type
4 daniel-mar 15836
    lpConn: PDPLConnection;   // TDPLConnection structure
1 daniel-mar 15837
  end;
15838
 
4 daniel-mar 15839
(*
15840
 * DPMSG_CHAT
15841
 * System message containing a chat message
15842
 *)
1 daniel-mar 15843
  PDPMsg_Chat = ^TDPMsg_Chat;
4 daniel-mar 15844
  TDPMsg_Chat = packed record
1 daniel-mar 15845
    dwType: DWORD;        // Message type
15846
    dwFlags: DWORD;       // Message flags
15847
    idFromPlayer: TDPID;  // ID of the Sending Player
15848
    idToPlayer: TDPID;    // ID of the To Player
15849
    idToGroup: TDPID;     // ID of the To Group
15850
    lpChat: PDPChat;      // Pointer to a structure containing the chat message
15851
  end;
15852
 
4 daniel-mar 15853
(*
15854
 * DPMSG_SETGROUPOWNER
15855
 * System message generated when the owner of a group has changed
15856
 *)
1 daniel-mar 15857
  PDPMsg_SetGroupOwner = ^TDPMsg_SetGroupOwner;
4 daniel-mar 15858
  TDPMsg_SetGroupOwner = packed record
1 daniel-mar 15859
    dwType: DWORD;        // Message type
15860
    idGroup: TDPID;       // ID of the group
15861
    idNewOwner: TDPID;    // ID of the player that is the new owner
15862
    idOldOwner: TDPID;    // ID of the player that used to be the owner
15863
  end;
15864
 
4 daniel-mar 15865
(*
15866
 * DPMSG_SENDCOMPLETE
15867
 * System message generated when finished with an Async Send message
15868
 *
15869
 * NOTE SENDPARMS has an overlay for DPMSG_SENDCOMPLETE, don't
15870
 *                change this message w/o changing SENDPARMS.
15871
 *)
15872
  PDPMsg_SendComplete = ^TDPMsg_SendComplete;
15873
  TDPMsg_SendComplete = packed record
1 daniel-mar 15874
    dwType: DWORD;        // Message type
15875
    idFrom: TDPID;
15876
    idTo: TDPID;
15877
    dwFlags: DWORD;
15878
    dwPriority: DWORD;
15879
    dwTimeout: DWORD;
15880
    lpvContext: Pointer;
15881
    dwMsgID: DWORD;
15882
    hr: HRESULT;
15883
    dwSendTime: DWORD;
15884
  end;
15885
 
4 daniel-mar 15886
(****************************************************************************
15887
 *
15888
 * DIRECTPLAY ERRORS
15889
 *
15890
 * Errors are represented by negative values and cannot be combined.
15891
 *
15892
 ****************************************************************************)
1 daniel-mar 15893
const
4 daniel-mar 15894
  MAKE_DPHRESULT = HResult($88770000);
1 daniel-mar 15895
 
4 daniel-mar 15896
  DP_OK = S_OK;
15897
  DPERR_ALREADYINITIALIZED = MAKE_DPHRESULT + 5;
15898
  DPERR_ACCESSDENIED = MAKE_DPHRESULT + 10;
15899
  DPERR_ACTIVEPLAYERS = MAKE_DPHRESULT + 20;
15900
  DPERR_BUFFERTOOSMALL = MAKE_DPHRESULT + 30;
15901
  DPERR_CANTADDPLAYER = MAKE_DPHRESULT + 40;
15902
  DPERR_CANTCREATEGROUP = MAKE_DPHRESULT + 50;
15903
  DPERR_CANTCREATEPLAYER = MAKE_DPHRESULT + 60;
15904
  DPERR_CANTCREATESESSION = MAKE_DPHRESULT + 70;
15905
  DPERR_CAPSNOTAVAILABLEYET = MAKE_DPHRESULT + 80;
15906
  DPERR_EXCEPTION = MAKE_DPHRESULT + 90;
15907
  DPERR_GENERIC = E_FAIL;
15908
  DPERR_INVALIDFLAGS = MAKE_DPHRESULT + 120;
15909
  DPERR_INVALIDOBJECT = MAKE_DPHRESULT + 130;
15910
  DPERR_INVALIDPARAM = E_INVALIDARG;
15911
  DPERR_INVALIDPARAMS = DPERR_INVALIDPARAM;
15912
  DPERR_INVALIDPLAYER = MAKE_DPHRESULT + 150;
15913
  DPERR_INVALIDGROUP = MAKE_DPHRESULT + 155;
15914
  DPERR_NOCAPS = MAKE_DPHRESULT + 160;
15915
  DPERR_NOCONNECTION = MAKE_DPHRESULT + 170;
15916
  DPERR_NOMEMORY = E_OUTOFMEMORY;
15917
  DPERR_OUTOFMEMORY = DPERR_NOMEMORY;
15918
  DPERR_NOMESSAGES = MAKE_DPHRESULT + 190;
15919
  DPERR_NONAMESERVERFOUND = MAKE_DPHRESULT + 200;
15920
  DPERR_NOPLAYERS = MAKE_DPHRESULT + 210;
15921
  DPERR_NOSESSIONS = MAKE_DPHRESULT + 220;
15922
  DPERR_PENDING = E_PENDING;
15923
  DPERR_SENDTOOBIG = MAKE_DPHRESULT + 230;
15924
  DPERR_TIMEOUT = MAKE_DPHRESULT + 240;
15925
  DPERR_UNAVAILABLE = MAKE_DPHRESULT + 250;
15926
  DPERR_UNSUPPORTED = E_NOTIMPL;
15927
  DPERR_BUSY = MAKE_DPHRESULT + 270;
15928
  DPERR_USERCANCEL = MAKE_DPHRESULT + 280;
15929
  DPERR_NOINTERFACE = E_NOINTERFACE;
15930
  DPERR_CANNOTCREATESERVER = MAKE_DPHRESULT + 290;
15931
  DPERR_PLAYERLOST = MAKE_DPHRESULT + 300;
15932
  DPERR_SESSIONLOST = MAKE_DPHRESULT + 310;
15933
  DPERR_UNINITIALIZED = MAKE_DPHRESULT + 320;
15934
  DPERR_NONEWPLAYERS = MAKE_DPHRESULT + 330;
15935
  DPERR_INVALIDPASSWORD = MAKE_DPHRESULT + 340;
15936
  DPERR_CONNECTING = MAKE_DPHRESULT + 350;
15937
  DPERR_CONNECTIONLOST = MAKE_DPHRESULT + 360;
15938
  DPERR_UNKNOWNMESSAGE = MAKE_DPHRESULT + 370;
15939
  DPERR_CANCELFAILED = MAKE_DPHRESULT + 380;
15940
  DPERR_INVALIDPRIORITY = MAKE_DPHRESULT + 390;
15941
  DPERR_NOTHANDLED = MAKE_DPHRESULT + 400;
15942
  DPERR_CANCELLED = MAKE_DPHRESULT + 410;
15943
  DPERR_ABORTED = MAKE_DPHRESULT + 420;
1 daniel-mar 15944
 
15945
 
4 daniel-mar 15946
  DPERR_BUFFERTOOLARGE = MAKE_DPHRESULT + 1000;
15947
  DPERR_CANTCREATEPROCESS = MAKE_DPHRESULT + 1010;
15948
  DPERR_APPNOTSTARTED = MAKE_DPHRESULT + 1020;
15949
  DPERR_INVALIDINTERFACE = MAKE_DPHRESULT + 1030;
15950
  DPERR_NOSERVICEPROVIDER = MAKE_DPHRESULT + 1040;
15951
  DPERR_UNKNOWNAPPLICATION = MAKE_DPHRESULT + 1050;
15952
  DPERR_NOTLOBBIED = MAKE_DPHRESULT + 1070;
15953
  DPERR_SERVICEPROVIDERLOADED = MAKE_DPHRESULT + 1080;
15954
  DPERR_ALREADYREGISTERED = MAKE_DPHRESULT + 1090;
15955
  DPERR_NOTREGISTERED = MAKE_DPHRESULT + 1100;
1 daniel-mar 15956
 
4 daniel-mar 15957
//
15958
// Security related errors
15959
//
15960
  DPERR_AUTHENTICATIONFAILED = MAKE_DPHRESULT + 2000;
15961
  DPERR_CANTLOADSSPI = MAKE_DPHRESULT + 2010;
15962
  DPERR_ENCRYPTIONFAILED = MAKE_DPHRESULT + 2020;
15963
  DPERR_SIGNFAILED = MAKE_DPHRESULT + 2030;
15964
  DPERR_CANTLOADSECURITYPACKAGE = MAKE_DPHRESULT + 2040;
15965
  DPERR_ENCRYPTIONNOTSUPPORTED = MAKE_DPHRESULT + 2050;
15966
  DPERR_CANTLOADCAPI = MAKE_DPHRESULT + 2060;
15967
  DPERR_NOTLOGGEDIN = MAKE_DPHRESULT + 2070;
15968
  DPERR_LOGONDENIED = MAKE_DPHRESULT + 2080;
15969
 
15970
(****************************************************************************
15971
 *
15972
 *      dplay 1.0 obsolete structures + interfaces
15973
 *      Included for compatibility only. New apps should
15974
 *      use IDirectPlay2
15975
 *
15976
 ****************************************************************************)
15977
 
15978
  DPOPEN_OPENSESSION = DPOPEN_JOIN;
1 daniel-mar 15979
  DPOPEN_CREATESESSION = DPOPEN_CREATE;
15980
 
15981
  DPENUMSESSIONS_PREVIOUS = $00000004;
15982
 
15983
  DPENUMPLAYERS_PREVIOUS = $00000004;
15984
 
15985
  DPSEND_GUARANTEE = DPSEND_GUARANTEED;
4 daniel-mar 15986
  DPSEND_TRYONCE = $00000004;
1 daniel-mar 15987
 
15988
  DPCAPS_NAMESERVICE = $00000001;
4 daniel-mar 15989
  DPCAPS_NAMESERVER = DPCAPS_ISHOST;
15990
  DPCAPS_GUARANTEED = $00000004;
1 daniel-mar 15991
 
4 daniel-mar 15992
  DPLONGNAMELEN = 52;
15993
  DPSHORTNAMELEN = 20;
1 daniel-mar 15994
  DPSESSIONNAMELEN = 32;
4 daniel-mar 15995
  DPPASSWORDLEN = 16;
15996
  DPUSERRESERVED = 16;
1 daniel-mar 15997
 
4 daniel-mar 15998
  DPSYS_ADDPLAYER = $0003;
1 daniel-mar 15999
  DPSYS_DELETEPLAYER = $0005;
16000
 
4 daniel-mar 16001
  DPSYS_DELETEGROUP = $0020;
1 daniel-mar 16002
  DPSYS_DELETEPLAYERFROMGRP = $0021;
4 daniel-mar 16003
  DPSYS_CONNECT = $484b;
1 daniel-mar 16004
 
16005
type
16006
  PDPMsg_AddPlayer = ^TDPMsg_AddPlayer;
4 daniel-mar 16007
  TDPMsg_AddPlayer = packed record
1 daniel-mar 16008
    dwType: DWORD;
16009
    dwPlayerType: DWORD;
4 daniel-mar 16010
    DPID: TDPID;
1 daniel-mar 16011
    szLongName: array[0..DPLONGNAMELEN-1] of Char;
16012
    szShortName: array[0..DPSHORTNAMELEN-1] of Char;
16013
    dwCurrentPlayers: DWORD;
16014
  end;
16015
 
16016
  PDPMsg_AddGroup = ^TDPMsg_AddGroup;
16017
  TDPMsg_AddGroup = TDPMsg_AddPlayer;
16018
 
16019
  PDPMsg_GroupAdd = ^TDPMsg_GroupAdd;
4 daniel-mar 16020
  TDPMsg_GroupAdd = packed record
1 daniel-mar 16021
    dwType: DWORD;
16022
    dpIdGroup: TDPID;
16023
    dpIdPlayer: TDPID;
16024
  end;
16025
 
16026
  PDPMsg_GroupDelete = ^TDPMsg_GroupDelete;
16027
  TDPMsg_GroupDelete = TDPMsg_GroupAdd;
16028
 
16029
  PDPMsg_DeletePlayer = ^TDPMsg_DeletePlayer;
4 daniel-mar 16030
  TDPMsg_DeletePlayer = packed record
1 daniel-mar 16031
    dwType: DWORD;
4 daniel-mar 16032
    DPID: TDPID;
1 daniel-mar 16033
  end;
16034
 
4 daniel-mar 16035
  TDPEnumPlayersCallback = function(dpId: TDPID; lpFriendlyName: PChar;
16036
      lpFormalName: PChar; dwFlags: DWORD; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 16037
 
16038
  PDPSessionDesc = ^TDPSessionDesc;
4 daniel-mar 16039
  TDPSessionDesc = packed record
1 daniel-mar 16040
    dwSize: DWORD;
16041
    guidSession: TGUID;
16042
    dwSession: DWORD;
16043
    dwMaxPlayers: DWORD;
16044
    dwCurrentPlayers: DWORD;
16045
    dwFlags: DWORD;
4 daniel-mar 16046
    szSessionName: Array [0..DPSESSIONNAMELEN-1] of char;
16047
    szUserField: Array [0..DPUSERRESERVED-1] of char;
1 daniel-mar 16048
    dwReserved1: DWORD;
4 daniel-mar 16049
    szPassword: Array [0..DPPASSWORDLEN-1] of char;
1 daniel-mar 16050
    dwReserved2: DWORD;
16051
    dwUser1: DWORD;
16052
    dwUser2: DWORD;
16053
    dwUser3: DWORD;
16054
    dwUser4: DWORD;
16055
  end;
16056
 
4 daniel-mar 16057
  TDPEnumSessionsCallback = function(const lpDPSessionDesc: TDPSessionDesc;
16058
      lpContext: Pointer; var lpdwTimeOut: DWORD; dwFlags: DWORD) : BOOL; stdcall;
1 daniel-mar 16059
 
16060
type
4 daniel-mar 16061
  IDirectPlay = interface (IUnknown)
16062
    ['{5454e9a0-db65-11ce-921c-00aa006c4972}']
16063
    (*** IDirectPlay methods ***)
16064
    function AddPlayerToGroup(pidGroup: TDPID; pidPlayer: TDPID) : HResult; stdcall;
1 daniel-mar 16065
    function Close: HResult; stdcall;
4 daniel-mar 16066
    function CreatePlayer(out lppidID: TDPID; lpPlayerFriendlyName: PChar;
16067
        lpPlayerFormalName: PChar; lpEvent: PHandle) : HResult; stdcall;
16068
    function CreateGroup(out lppidID: TDPID; lpGroupFriendlyName: PChar;
16069
        lpGroupFormalName: PChar) : HResult; stdcall;
16070
    function DeletePlayerFromGroup(pidGroup: TDPID; pidPlayer: TDPID) : HResult; stdcall;
16071
    function DestroyPlayer(pidID: TDPID) : HResult; stdcall;
16072
    function DestroyGroup(pidID: TDPID) : HResult; stdcall;
16073
    function EnableNewPlayers(bEnable: BOOL) : HResult; stdcall;
1 daniel-mar 16074
    function EnumGroupPlayers(pidGroupPID: TDPID; lpEnumPlayersCallback:
4 daniel-mar 16075
        TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 16076
    function EnumGroups(dwSessionID: DWORD; lpEnumPlayersCallback:
4 daniel-mar 16077
        TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
1 daniel-mar 16078
    function EnumPlayers(dwSessionId: DWORD; lpEnumPlayersCallback:
4 daniel-mar 16079
        TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
16080
    function EnumSessions(var lpSDesc: TDPSessionDesc; dwTimeout: DWORD;
16081
        lpEnumSessionsCallback: TDPEnumSessionsCallback; lpContext: Pointer;
16082
        dwFlags: DWORD) : HResult; stdcall;
16083
    function GetCaps(var lpDPCaps: TDPCaps) : HResult; stdcall;
16084
    function GetMessageCount(pidID: TDPID; var lpdwCount: DWORD) : HResult; stdcall;
16085
    function GetPlayerCaps(pidID: TDPID; var lpDPPlayerCaps: TDPCaps) : HResult; stdcall;
16086
    function GetPlayerName(pidID: TDPID; lpPlayerFriendlyName: PChar;
16087
        var lpdwFriendlyNameLength: DWORD; lpPlayerFormalName: PChar;
16088
        var lpdwFormalNameLength: DWORD) : HResult; stdcall;
16089
    function Initialize(const lpGUID: TGUID) : HResult; stdcall;
16090
    function Open(var lpSDesc: TDPSessionDesc) : HResult; stdcall;
1 daniel-mar 16091
    function Receive(var lppidFrom, lppidTo: TDPID; dwFlags: DWORD;
4 daniel-mar 16092
        var lpvBuffer; var lpdwSize: DWORD) : HResult; stdcall;
16093
    function SaveSession(lpSessionName: PChar) : HResult; stdcall;
1 daniel-mar 16094
    function Send(pidFrom: TDPID; pidTo: TDPID; dwFlags: DWORD;
4 daniel-mar 16095
        var lpvBuffer; dwBuffSize: DWORD) : HResult; stdcall;
16096
    function SetPlayerName(pidID: TDPID; lpPlayerFriendlyName: PChar;
16097
        lpPlayerFormalName: PChar) : HResult; stdcall;
1 daniel-mar 16098
  end;
16099
 
4 daniel-mar 16100
(*
16101
 * GUIDS used by DirectPlay objects
16102
 *)
16103
  IID_IDirectPlay2W = IDirectPlay2W;
16104
  IID_IDirectPlay2A = IDirectPlay2A;
16105
  IID_IDirectPlay2 =  IDirectPlay2;
1 daniel-mar 16106
 
4 daniel-mar 16107
  IID_IDirectPlay3W = IDirectPlay3W;
16108
  IID_IDirectPlay3A = IDirectPlay3A;
16109
  IID_IDirectPlay3 =  IDirectPlay3;
1 daniel-mar 16110
 
4 daniel-mar 16111
  IID_IDirectPlay4W = IDirectPlay4W;
16112
  IID_IDirectPlay4A = IDirectPlay4A;
16113
  IID_IDirectPlay4 =  IDirectPlay4;
16114
 
16115
  IID_IDirectPlay = IDirectPlay;
16116
 
16117
var
16118
  DirectPlayCreate : function (lpGUID: PGUID; out lplpDP: IDirectPlay;
16119
      pUnk: IUnknown) : HResult; stdcall;
16120
 
1 daniel-mar 16121
(*==========================================================================;
16122
 *
16123
 *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
16124
 *
16125
 *  File:       dplobby.h
16126
 *  Content:    DirectPlayLobby include file
16127
 ***************************************************************************)
16128
 
4 daniel-mar 16129
(*
16130
 * GUIDS used by DirectPlay objects
16131
 *)
1 daniel-mar 16132
 
16133
const
4 daniel-mar 16134
(* {2FE8F810-B2A5-11d0-A787-0000F803ABFC} *)
16135
  CLSID_DirectPlayLobby: TGUID =
16136
      (D1:$2fe8f810;D2:$b2a5;D3:$11d0;D4:($a7,$87,$00,$00,$f8,$3,$ab,$fc));
1 daniel-mar 16137
 
4 daniel-mar 16138
(****************************************************************************
16139
 *
16140
 * IDirectPlayLobby Structures
16141
 *
16142
 * Various structures used to invoke DirectPlayLobby.
16143
 *
16144
 ****************************************************************************)
1 daniel-mar 16145
 
16146
type
4 daniel-mar 16147
(*
16148
 * TDPLAppInfo
16149
 * Used to hold information about a registered DirectPlay
16150
 * application
16151
 *)
1 daniel-mar 16152
  PDPLAppInfo = ^TDPLAppInfo;
4 daniel-mar 16153
  TDPLAppInfo = packed record
1 daniel-mar 16154
    dwSize: DWORD;            // Size of this structure
16155
    guidApplication: TGUID;   // GUID of the Application
16156
    case Integer of           // Pointer to the Application Name
4 daniel-mar 16157
      0: (lpszAppName: PCharAW);
16158
      1: (lpszAppNameW: PWideChar);
16159
      3: (lpszAppNameA: PChar);
1 daniel-mar 16160
  end;
16161
 
4 daniel-mar 16162
(*
16163
 * TDPCompoundAddressElement
16164
 *
16165
 * An array of these is passed to CreateCompoundAddresses()
16166
 *)
1 daniel-mar 16167
  PDPCompoundAddressElement = ^TDPCompoundAddressElement;
4 daniel-mar 16168
  TDPCompoundAddressElement = packed record
1 daniel-mar 16169
    guidDataType: TGUID;
16170
    dwDataSize: DWORD;
16171
    lpData: Pointer;
4 daniel-mar 16172
  end;                                
1 daniel-mar 16173
 
4 daniel-mar 16174
(*
16175
 * TDPApplicationDesc
16176
 * Used to register a DirectPlay application
16177
 *)
1 daniel-mar 16178
  PDPApplicationDesc = ^TDPApplicationDesc;
4 daniel-mar 16179
  TDPApplicationDesc = packed record
1 daniel-mar 16180
    dwSize: DWORD;
16181
    dwFlags: DWORD;
4 daniel-mar 16182
    case integer of
16183
 
16184
           guidApplication: TGUID;
16185
           lpszFilename: PCharAW;
16186
           lpszCommandLine: PCharAW;
16187
           lpszPath: PCharAW;
16188
           lpszCurrentDirectory: PCharAW;
16189
           lpszDescriptionA: PAnsiChar;
16190
           lpszDescriptionW: PWideChar);
16191
      1 : (lpszApplicationNameA: PAnsiChar;
16192
           filler1: TGUID;
16193
           lpszFilenameA: PAnsiChar;
16194
           lpszCommandLineA: PAnsiChar;
16195
           lpszPathA: PAnsiChar;
16196
           lpszCurrentDirectoryA: PAnsiChar);
16197
      2 : (lpszApplicationNameW: PWideChar;
16198
           filler2: TGUID;
16199
           lpszFilenameW: PWideChar;
16200
           lpszCommandLineW: PWideChar;
16201
           lpszPathW: PWideChar;
16202
           lpszCurrentDirectoryW: PWideChar);
1 daniel-mar 16203
  end;
16204
 
4 daniel-mar 16205
(*
16206
 * TDPApplicationDesc2
16207
 * Used to register a DirectPlay application
16208
 *)
1 daniel-mar 16209
  PDPApplicationDesc2 = ^TDPApplicationDesc2;
4 daniel-mar 16210
  TDPApplicationDesc2 = packed record
1 daniel-mar 16211
    dwSize: DWORD;
16212
    dwFlags: DWORD;
4 daniel-mar 16213
    case integer of
16214
 
16215
           guidApplication: TGUID;
16216
           lpszFilename: PCharAW;
16217
           lpszCommandLine: PCharAW;
16218
           lpszPath: PCharAW;
16219
           lpszCurrentDirectory: PCharAW;
16220
           lpszDescriptionA: PAnsiChar;
16221
           lpszDescriptionW: PWideChar;
16222
           lpszAppLauncherName: PCharAW);
16223
      1 : (lpszApplicationNameA: PAnsiChar;
16224
           filler1: TGUID;
16225
           lpszFilenameA: PAnsiChar;
16226
           lpszCommandLineA: PAnsiChar;
16227
           lpszPathA: PAnsiChar;
16228
           lpszCurrentDirectoryA: PAnsiChar;
16229
           filler3: PChar;
16230
           filler4: PChar;
16231
           lpszAppLauncherNameA: PAnsiChar);
16232
      2 : (lpszApplicationNameW: PWideChar;
16233
           filler2: TGUID;
16234
           lpszFilenameW: PWideChar;
16235
           lpszCommandLineW: PWideChar;
16236
           lpszPathW: PWideChar;
16237
           lpszCurrentDirectoryW: PWideChar;
16238
           filler5: PChar;
16239
           filler6: PChar;
16240
           lpszAppLauncherNameW: PWideChar);
1 daniel-mar 16241
  end;
16242
 
16243
 
4 daniel-mar 16244
(****************************************************************************
16245
 *
16246
 * Enumeration Method Callback Prototypes
16247
 *
16248
 ****************************************************************************)
1 daniel-mar 16249
 
4 daniel-mar 16250
(*
16251
 * Callback for EnumAddress()
16252
 *)
16253
  TDPEnumAdressCallback = function(const guidDataType: TGUID;
16254
      dwDataSize: DWORD; lpData: Pointer; lpContext: Pointer) : BOOL; stdcall;
1 daniel-mar 16255
 
4 daniel-mar 16256
(*
16257
 * Callback for EnumAddressTypes()
16258
 *)
1 daniel-mar 16259
  TDPLEnumAddressTypesCallback = function(const guidDataType: TGUID;
4 daniel-mar 16260
      lpContext: Pointer; dwFlags: DWORD) : BOOL; stdcall;
1 daniel-mar 16261
 
4 daniel-mar 16262
(*
16263
 * Callback for EnumLocalApplications()
16264
 *)
1 daniel-mar 16265
  TDPLEnumLocalApplicationsCallback = function(const lpAppInfo: TDPLAppInfo;
4 daniel-mar 16266
      lpContext: Pointer; dwFlags: DWORD) : BOOL; stdcall;
1 daniel-mar 16267
 
4 daniel-mar 16268
(****************************************************************************
16269
 *
16270
 * IDirectPlayLobby (and IDirectPlayLobbyA) Interface
16271
 *
16272
 ****************************************************************************)
1 daniel-mar 16273
 
16274
type
4 daniel-mar 16275
  IDirectPlayLobbyAW = interface (IUnknown)
16276
    (*** IDirectPlayLobby methods ***)
1 daniel-mar 16277
    function Connect(dwFlags: DWORD; out lplpDP: IDirectPlay2;
4 daniel-mar 16278
        pUnk: IUnknown) : HResult; stdcall;
16279
    function CreateAddress(const guidSP, guidDataType: TGUID; var lpData;
16280
        dwDataSize: DWORD; var lpAddress; var lpdwAddressSize: DWORD) : HResult; stdcall;
16281
    function EnumAddress(lpEnumAddressCallback: TDPEnumAdressCallback;
16282
        var lpAddress; dwAddressSize: DWORD; lpContext : Pointer) : HResult; stdcall;
1 daniel-mar 16283
    function EnumAddressTypes(lpEnumAddressTypeCallback:
16284
        TDPLEnumAddressTypesCallback; const guidSP: TGUID; lpContext: Pointer;
4 daniel-mar 16285
        dwFlags: DWORD) : HResult; stdcall;
16286
    function EnumLocalApplications(lpEnumLocalAppCallback: TDPLEnumLocalApplicationsCallback;
16287
        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
16288
    function GetConnectionSettings(dwAppID: DWORD; lpData: PDPLConnection;
16289
        var lpdwDataSize: DWORD) : HResult; stdcall;
1 daniel-mar 16290
    function ReceiveLobbyMessage(dwFlags: DWORD; dwAppID: DWORD;
4 daniel-mar 16291
        var lpdwMessageFlags: DWORD; lpData: Pointer; var lpdwDataSize: DWORD) : HResult; stdcall;
1 daniel-mar 16292
    function RunApplication(dwFlags: DWORD; var lpdwAppId: DWORD;
4 daniel-mar 16293
        const lpConn: TDPLConnection; hReceiveEvent: THandle) : HResult; stdcall;
1 daniel-mar 16294
    function SendLobbyMessage(dwFlags: DWORD; dwAppID: DWORD; const lpData;
4 daniel-mar 16295
        dwDataSize: DWORD) : HResult; stdcall;
1 daniel-mar 16296
    function SetConnectionSettings(dwFlags: DWORD; dwAppID: DWORD;
4 daniel-mar 16297
        var lpConn: TDPLConnection) : HResult; stdcall;
1 daniel-mar 16298
    function SetLobbyMessageEvent(dwFlags: DWORD; dwAppID: DWORD;
4 daniel-mar 16299
        hReceiveEvent: THandle) : HResult; stdcall;
1 daniel-mar 16300
  end;
16301
 
4 daniel-mar 16302
  IDirectPlayLobbyW = interface (IDirectPlayLobbyAW)
16303
    ['{AF465C71-9588-11CF-A020-00AA006157AC}']
1 daniel-mar 16304
  end;
4 daniel-mar 16305
  IDirectPlayLobbyA = interface (IDirectPlayLobbyAW)
16306
    ['{26C66A70-B367-11cf-A024-00AA006157AC}']
16307
  end;
1 daniel-mar 16308
 
4 daniel-mar 16309
{$IFDEF UNICODE}
16310
  IDirectPlayLobby = IDirectPlayLobbyW;
16311
{$ELSE}
16312
  IDirectPlayLobby = IDirectPlayLobbyA;
16313
{$ENDIF}
1 daniel-mar 16314
 
4 daniel-mar 16315
 
16316
(****************************************************************************
16317
 *
16318
 * IDirectPlayLobby2 (and IDirectPlayLobby2A) Interface
16319
 *
16320
 ****************************************************************************)
16321
 
16322
  IDirectPlayLobby2AW = interface(IDirectPlayLobbyAW)
16323
    (*** IDirectPlayLobby2 methods ***)
1 daniel-mar 16324
    function CreateCompoundAddress(const lpElements: TDPCompoundAddressElement;
4 daniel-mar 16325
        dwElementCount: DWORD; lpAddress: Pointer; var lpdwAddressSize: DWORD) : HResult; stdcall;
1 daniel-mar 16326
  end;
16327
 
4 daniel-mar 16328
  IDirectPlayLobby2W = interface (IDirectPlayLobby2AW)
16329
    ['{0194C220-A303-11D0-9C4F-00A0C905425E}']
1 daniel-mar 16330
  end;
4 daniel-mar 16331
  IDirectPlayLobby2A = interface (IDirectPlayLobby2AW)
16332
    ['{1BB4AF80-A303-11d0-9C4F-00A0C905425E}']
16333
  end;
1 daniel-mar 16334
 
4 daniel-mar 16335
{$IFDEF UNICODE}
16336
  IDirectPlayLobby2 = IDirectPlayLobby2W;
16337
{$ELSE}
16338
  IDirectPlayLobby2 = IDirectPlayLobby2A;
16339
{$ENDIF}
1 daniel-mar 16340
 
4 daniel-mar 16341
(****************************************************************************
16342
 *
16343
 * IDirectPlayLobby3 (and IDirectPlayLobby3A) Interface
16344
 *
16345
 ****************************************************************************)
16346
 
16347
  IDirectPlayLobby3AW = interface(IDirectPlayLobby2AW)
16348
    (*** IDirectPlayLobby3 methods ***)
16349
    function ConnectEx(dwFlags: DWORD; const riid: TGUID;
16350
        out lplpDP; pUnk: IUnknown) : HResult; stdcall;
16351
    function RegisterApplication(dwFlags: DWORD;
16352
        var lpAppDesc: TDPApplicationDesc) : HResult; stdcall;
16353
    function UnregisterApplication(dwFlags: DWORD;
16354
         const guidApplication: TGUID) : HResult; stdcall;
16355
    function WaitForConnectionSettings(dwFlags: DWORD) : HResult; stdcall;
16356
        end;
16357
 
16358
  IDirectPlayLobby3W = interface (IDirectPlayLobby3AW)
1 daniel-mar 16359
    ['{2DB72490-652C-11d1-A7A8-0000F803ABFC}']
16360
  end;
4 daniel-mar 16361
  IDirectPlayLobby3A = interface (IDirectPlayLobby3AW)
1 daniel-mar 16362
    ['{2DB72491-652C-11d1-A7A8-0000F803ABFC}']
16363
  end;
16364
 
4 daniel-mar 16365
{$IFDEF UNICODE}
16366
  IDirectPlayLobby3 = IDirectPlayLobby3W;
16367
{$ELSE}
16368
  IDirectPlayLobby3 = IDirectPlayLobby3A;
16369
{$ENDIF}
1 daniel-mar 16370
 
4 daniel-mar 16371
  IID_IDirectPlayLobbyW =  IDirectPlayLobbyW;
16372
  IID_IDirectPlayLobbyA =  IDirectPlayLobbyA;
16373
  IID_IDirectPlayLobby =   IDirectPlayLobby;
1 daniel-mar 16374
 
4 daniel-mar 16375
  IID_IDirectPlayLobby2W = IDirectPlayLobby2W;
16376
  IID_IDirectPlayLobby2A = IDirectPlayLobby2A;
16377
  IID_IDirectPlayLobby2 =  IDirectPlayLobby2;
1 daniel-mar 16378
 
4 daniel-mar 16379
  IID_IDirectPlayLobby3W = IDirectPlayLobby3W;
16380
  IID_IDirectPlayLobby3A = IDirectPlayLobby3A;
16381
  IID_IDirectPlayLobby3 =  IDirectPlayLobby3;
16382
 
16383
(****************************************************************************
16384
 *
16385
 * DirectPlayLobby API Prototypes
16386
 *
16387
 ****************************************************************************)
16388
 
16389
var
16390
  DirectPlayLobbyCreateW : function (lpguidSP: PGUID; out lplpDPL:
16391
      IDirectPlayLobbyW; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
16392
  DirectPlayLobbyCreateA : function (lpguidSP: PGUID; out lplpDPL:
16393
      IDirectPlayLobbyA; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
16394
  DirectPlayLobbyCreate : function (lpguidSP: PGUID; out lplpDPL:
16395
      IDirectPlayLobby; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD) : HResult; stdcall;
16396
 
1 daniel-mar 16397
const
4 daniel-mar 16398
(****************************************************************************
16399
 *
16400
 * DirectPlayLobby Flags
16401
 *
16402
 ****************************************************************************)
1 daniel-mar 16403
 
4 daniel-mar 16404
(*
16405
 *  This flag is used by IDirectPlayLobby.WaitForConnectionSettings to
16406
 *  cancel a current wait that is in progress.
16407
 *)
16408
 DPLWAIT_CANCEL = $00000001;
1 daniel-mar 16409
 
4 daniel-mar 16410
(*
16411
 *      This is a message flag used by ReceiveLobbyMessage.  It can be
16412
 *      returned in the dwMessageFlags parameter to indicate a message from
16413
 *      the system.
16414
 *)
16415
  DPLMSG_SYSTEM = $00000001;
1 daniel-mar 16416
 
4 daniel-mar 16417
(*
16418
 *      This is a message flag used by ReceiveLobbyMessage and SendLobbyMessage.
16419
 *  It is used to indicate that the message is a standard lobby message.
16420
 *  TDPLMsg_SetProperty, TDPLMsg_SetPropertyResponse, TDPLMsg_GetProperty,
16421
 *      TDPLMsg_GetPropertyResponse
16422
 *)
16423
  DPLMSG_STANDARD = $00000002;
1 daniel-mar 16424
 
4 daniel-mar 16425
type
16426
(****************************************************************************
16427
 *
16428
 * DirectPlayLobby messages and message data structures
16429
 *
16430
 * All system messages have a dwMessageFlags value of DPLMSG_SYSTEM returned
16431
 * from a call to ReceiveLobbyMessage.
16432
 *
16433
 * All standard messages have a dwMessageFlags value of DPLMSG_STANDARD returned
16434
 * from a call to ReceiveLobbyMessage.
16435
 *
16436
 ****************************************************************************)
1 daniel-mar 16437
 
4 daniel-mar 16438
(*
16439
 * TDPLMsg_Generic
16440
 * Generic message structure used to identify the message type.
16441
 *)
1 daniel-mar 16442
  PDPLMsg_Generic = ^TDPLMsg_Generic;
4 daniel-mar 16443
  TDPLMsg_Generic = packed record
1 daniel-mar 16444
    dwType: DWORD;   // Message type
16445
  end;
16446
 
4 daniel-mar 16447
(*
16448
 * TDPLMsg_SystemMessage
16449
 * Generic message format for all system messages --
16450
 * DPLSYS_CONNECTIONSETTINGSREAD, DPLSYS_DPLYCONNECTSUCCEEDED,
16451
 * DPLSYS_DPLAYCONNECTFAILED, DPLSYS_APPTERMINATED, DPLSYS_NEWCONNECTIONSETTINGS
16452
 *)
1 daniel-mar 16453
  PDPLMsg_SystemMessage = ^TDPLMsg_SystemMessage;
4 daniel-mar 16454
  TDPLMsg_SystemMessage = packed record
16455
    dwType: DWORD;         // Message type
16456
    guidInstance: TGUID;    // Instance GUID of the dplay session the message corresponds to
1 daniel-mar 16457
  end;
16458
 
4 daniel-mar 16459
(*
16460
 *  TDPLMsg_SetProperty
16461
 *  Standard message sent by an application to a lobby to set a
16462
 *  property
16463
 *)
1 daniel-mar 16464
  PDPLMsg_SetProperty = ^TDPLMsg_SetProperty;
4 daniel-mar 16465
  TDPLMsg_SetProperty = packed record
1 daniel-mar 16466
    dwType: DWORD;                           // Message type
16467
    dwRequestID: DWORD;                      // Request ID (DPL_NOCONFIRMATION if no confirmation desired)
16468
    guidPlayer: TGUID;                       // Player GUID
16469
    guidPropertyTag: TGUID;                  // Property GUID
16470
    dwDataSize: DWORD;                       // Size of data
4 daniel-mar 16471
    dwPropertyData: array[0..0] of DWORD;    // Buffer containing data
1 daniel-mar 16472
  end;
16473
 
16474
const
16475
  DPL_NOCONFIRMATION = 0;
16476
 
16477
type
4 daniel-mar 16478
(*
16479
 *  TDPLMsg_SetPropertyResponse
16480
 *  Standard message returned by a lobby to confirm a
16481
 *  TDPLMsg_SetProperty message.
16482
 *)
1 daniel-mar 16483
  PDPLMsg_SetPropertyResponse = ^TDPLMsg_SetPropertyResponse;
4 daniel-mar 16484
  TDPLMsg_SetPropertyResponse = packed record
1 daniel-mar 16485
    dwType: DWORD;            // Message type
16486
    dwRequestID: DWORD;       // Request ID
16487
    guidPlayer: TGUID;        // Player GUID
16488
    guidPropertyTag: TGUID;   // Property GUID
16489
    hr: HResult;              // Return Code
16490
  end;
16491
 
4 daniel-mar 16492
(*
16493
 *  TDPLMsg_GetProperty
16494
 *  Standard message sent by an application to a lobby to request
16495
 *      the current value of a property
16496
 *)
1 daniel-mar 16497
  PDPLMsg_GetProperty = ^TDPLMsg_GetProperty;
4 daniel-mar 16498
  TDPLMsg_GetProperty = packed record
1 daniel-mar 16499
    dwType: DWORD;            // Message type
16500
    dwRequestID: DWORD;       // Request ID
16501
    guidPlayer: TGUID;        // Player GUID
16502
    guidPropertyTag: TGUID;   // Property GUID
16503
  end;
4 daniel-mar 16504
  LPDPLMSG_GETPROPERTY = ^TDPLMsg_GetProperty;
1 daniel-mar 16505
 
4 daniel-mar 16506
(*
16507
 *  TDPLMsg_GetPropertyResponse
16508
 *  Standard message returned by a lobby in response to a
16509
 *      TDPLMsg_GetProperty message.
16510
 *)
1 daniel-mar 16511
  PDPLMsg_GetPropertyResponse = ^TDPLMsg_GetPropertyResponse;
4 daniel-mar 16512
  TDPLMsg_GetPropertyResponse = packed record
1 daniel-mar 16513
    dwType: DWORD;                           // Message type
16514
    dwRequestID: DWORD;                      // Request ID
16515
    guidPlayer: TGUID;                       // Player GUID
16516
    guidPropertyTag: TGUID;                  // Property GUID
16517
    hr: HResult;                             // Return Code
16518
    dwDataSize: DWORD;                       // Size of data
16519
    dwPropertyData: array[0..0] of DWORD;    // Buffer containing data
16520
  end;
16521
 
4 daniel-mar 16522
(*
16523
 *  TDPLMsg_NewSessionHost
16524
 *  Standard message returned by a lobby in response to a
16525
 *  the session host migrating to a new client
16526
 *)
1 daniel-mar 16527
  PDPLMsg_NewSessionHost = ^TDPLMsg_NewSessionHost;
4 daniel-mar 16528
  TDPLMsg_NewSessionHost = packed record
1 daniel-mar 16529
    dwType: DWORD;            // Message type
4 daniel-mar 16530
    guidInstance: TGUID;      // Property GUID
1 daniel-mar 16531
  end;
16532
 
4 daniel-mar 16533
const
16534
(******************************************
16535
 *
16536
 *      DirectPlay Lobby message dwType values
16537
 *
16538
 *****************************************)
1 daniel-mar 16539
 
4 daniel-mar 16540
(*
16541
 *  The application has read the connection settings.
16542
 *  It is now O.K. for the lobby client to release
16543
 *  its IDirectPlayLobby interface.
16544
 *)
1 daniel-mar 16545
  DPLSYS_CONNECTIONSETTINGSREAD = $00000001;
16546
 
4 daniel-mar 16547
(*
16548
 *  The application's call to DirectPlayConnect failed
16549
 *)
16550
  DPLSYS_DPLAYCONNECTFAILED = $00000002;
1 daniel-mar 16551
 
4 daniel-mar 16552
(*
16553
 *  The application has created a DirectPlay session.
16554
 *)
16555
  DPLSYS_DPLAYCONNECTSUCCEEDED = $00000003;
1 daniel-mar 16556
 
4 daniel-mar 16557
(*
16558
 *  The application has terminated.
16559
 *)
16560
  DPLSYS_APPTERMINATED = $00000004;
1 daniel-mar 16561
 
4 daniel-mar 16562
(*
16563
 *  The message is a TDPLMsg_SetProperty message.
16564
 *)
16565
  DPLSYS_SETPROPERTY = $00000005;
16566
 
16567
(*
16568
 *  The message is a TDPLMsg_SetPropertyResponse message.
16569
 *)
16570
  DPLSYS_SETPROPERTYRESPONSE = $00000006;
16571
 
16572
(*
16573
 *  The message is a TDPLMsg_GetProperty message.
16574
 *)
16575
  DPLSYS_GETPROPERTY = $00000007;
16576
 
16577
(*
16578
 *  The message is a TDPLMsg_GetPropertyResponse message.
16579
 *)
16580
  DPLSYS_GETPROPERTYRESPONSE = $00000008;
16581
 
16582
(*
16583
 *  The message is a TDPLMsg_NewSessionHost message.
16584
 *)
16585
  DPLSYS_NEWSESSIONHOST = $00000009;
16586
 
16587
(*
16588
 *  New connection settings are available.
16589
 *)
16590
  DPLSYS_NEWCONNECTIONSETTINGS = $0000000A;
16591
 
16592
(****************************************************************************
16593
 *
16594
 * DirectPlay defined property GUIDs and associated data structures
16595
 *
16596
 ****************************************************************************)
16597
 
16598
(*
16599
 * DPLPROPERTY_MessagesSupported
16600
 *
16601
 * Request whether the lobby supports standard.  Lobby with respond with either
16602
 * TRUE or FALSE or may not respond at all.
16603
 *
16604
 * Property data is a single BOOL with TRUE or FALSE
16605
 *)
16606
// {762CCDA1-D916-11d0-BA39-00C04FD7ED67}
16607
  DPLPROPERTY_MessagesSupported: TGUID =
16608
      (D1:$762ccda1;D2:$d916;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
16609
 
16610
(*
16611
 * DPLPROPERTY_LobbyGuid
16612
 *
16613
 * Request the GUID that identifies the lobby software that the application
16614
 * is communicating with.
16615
 *
16616
 * Property data is a single GUID.
16617
 *)
16618
// {F56920A0-D218-11d0-BA39-00C04FD7ED67}
16619
  DPLPROPERTY_LobbyGuid: TGUID =
16620
      (D1:$F56920A0;D2:$D218;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
16621
 
16622
(*
16623
 * DPLPROPERTY_PlayerGuid
16624
 *
16625
 * Request the GUID that identifies the player on this machine for sending
16626
 * property data back to the lobby.
16627
 *
16628
 * Property data is the DPLDATA_PLAYERDATA structure
16629
 *)
16630
// {B4319322-D20D-11d0-BA39-00C04FD7ED67}
16631
  DPLPROPERTY_PlayerGuid: TGUID =
16632
      (D1:$b4319322;D2:$d20d;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
16633
 
1 daniel-mar 16634
type
4 daniel-mar 16635
(*
16636
 * TDPLData_PlayerGUID
16637
 *
16638
 * Data structure to hold the GUID of the player and player creation flags
16639
 * from the lobby.
16640
 *)
1 daniel-mar 16641
  PDPLData_PlayerGUID = ^TDPLData_PlayerGUID;
4 daniel-mar 16642
  TDPLData_PlayerGUID = packed record
1 daniel-mar 16643
    guidPlayer: TGUID;
16644
    dwPlayerFlags: DWORD;
16645
  end;
16646
 
16647
const
4 daniel-mar 16648
(*
16649
 * DPLPROPERTY_PlayerScore
16650
 *
16651
 * Used to send an array of long integers to the lobby indicating the
16652
 * score of a player.
16653
 *
16654
 * Property data is the TDPLData_PlayerScore structure.
16655
 *)
16656
// {48784000-D219-11d0-BA39-00C04FD7ED67}
16657
  DPLPROPERTY_PlayerScore: TGUID =
16658
      (D1:$48784000;D2:$d219;D3:$11d0;D4:($ba,$39,$00,$c0,$4f,$d7,$ed,$67));
1 daniel-mar 16659
 
16660
type
4 daniel-mar 16661
(*
16662
 * TDPLData_PlayerScore
16663
 *
16664
 * Data structure to hold an array of long integers representing a player score.
16665
 * Application must allocate enough memory to hold all the scores.
16666
 *)
1 daniel-mar 16667
  PDPLData_PlayerScore = ^TDPLData_PlayerScore;
4 daniel-mar 16668
  TDPLData_PlayerScore = packed record
1 daniel-mar 16669
    dwScoreCount: DWORD;
4 daniel-mar 16670
    Score: array[0..0] of LongInt;
1 daniel-mar 16671
  end;
16672
 
4 daniel-mar 16673
(****************************************************************************
16674
 *
16675
 * DirectPlay Address ID's
16676
 *
16677
 ****************************************************************************)
1 daniel-mar 16678
 
4 daniel-mar 16679
(* DirectPlay Address
16680
 *
16681
 * A DirectPlay address consists of multiple chunks of data, each tagged
16682
 * with a GUID signifying the type of data in the chunk. The chunk also
16683
 * has a length so that unknown chunk types can be skipped.
16684
 *
16685
 * The EnumAddress() function is used to parse these address data chunks.
16686
 *)
1 daniel-mar 16687
 
4 daniel-mar 16688
(*
16689
 * TDPAddress
16690
 *
16691
 * Header for block of address data elements
16692
 *)
1 daniel-mar 16693
  PDPAddress = ^TDPAddress;
4 daniel-mar 16694
  TDPAddress = packed record
1 daniel-mar 16695
    guidDataType: TGUID;
16696
    dwDataSize: DWORD;
16697
  end;
16698
 
16699
const
4 daniel-mar 16700
(*
16701
 * DPAID_TotalSize
16702
 *
16703
 * Chunk is a DWORD containing size of entire TDPAddress structure
16704
 *)
1 daniel-mar 16705
 
4 daniel-mar 16706
// {1318F560-912C-11d0-9DAA-00A0C90A43CB}
16707
  DPAID_TotalSize: TGUID =
16708
      (D1:$1318f560;D2:$912c;D3:$11d0;D4:($9d,$aa,$00,$a0,$c9,$a,$43,$cb));
1 daniel-mar 16709
 
4 daniel-mar 16710
(*
16711
 * DPAID_ServiceProvider
16712
 *
16713
 * Chunk is a GUID describing the service provider that created the chunk.
16714
 * All addresses must contain this chunk.
16715
 *)
1 daniel-mar 16716
 
4 daniel-mar 16717
// {07D916C0-E0AF-11cf-9C4E-00A0C905425E}
16718
  DPAID_ServiceProvider: TGUID =
16719
      (D1:$7d916c0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
16720
 
16721
(*
16722
 * DPAID_LobbyProvider
16723
 *
16724
 * Chunk is a GUID describing the lobby provider that created the chunk.
16725
 * All addresses must contain this chunk.
16726
 *)
16727
 
16728
// {59B95640-9667-11d0-A77D-0000F803ABFC}
16729
  DPAID_LobbyProvider: TGUID =
16730
      (D1:$59b95640;D2:$9667;D3:$11d0;D4:($a7,$7d,$00,$00,$f8,$3,$ab,$fc));
16731
 
16732
(*
16733
 * DPAID_Phone and DPAID_PhoneW
16734
 *
16735
 * Chunk is a string containing a phone number (i.e. "1-800-555-1212")
16736
 * in ANSI or UNICODE format
16737
 *)
16738
 
16739
// {78EC89A0-E0AF-11cf-9C4E-00A0C905425E}
16740
  DPAID_Phone: TGUID =
16741
      (D1:$78ec89a0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
16742
 
16743
// {BA5A7A70-9DBF-11d0-9CC1-00A0C905425E}
16744
  DPAID_PhoneW: TGUID =
16745
      (D1:$ba5a7a70;D2:$9dbf;D3:$11d0;D4:($9c,$c1,$00,$a0,$c9,$5,$42,$5e));
16746
 
16747
(*
16748
 * DPAID_Modem and DPAID_ModemW
16749
 *
16750
 * Chunk is a string containing a modem name registered with TAPI
16751
 * in ANSI or UNICODE format
16752
 *)
16753
 
16754
// {F6DCC200-A2FE-11d0-9C4F-00A0C905425E}
16755
  DPAID_Modem: TGUID =
16756
      (D1:$f6dcc200;D2:$a2fe;D3:$11d0;D4:($9c,$4f,$00,$a0,$c9,$5,$42,$5e));
16757
 
16758
// {01FD92E0-A2FF-11d0-9C4F-00A0C905425E}
16759
  DPAID_ModemW: TGUID =
16760
      (D1:$1fd92e0;D2:$a2ff;D3:$11d0;D4:($9c,$4f,$00,$a0,$c9,$5,$42,$5e));
16761
 
16762
(*
16763
 * DPAID_Inet and DPAID_InetW
16764
 *
16765
 * Chunk is a string containing a TCP/IP host name or an IP address
16766
 * (i.e. "dplay.microsoft.com" or "137.55.100.173") in ANSI or UNICODE format
16767
 *)
16768
 
16769
// {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E}
16770
  DPAID_INet: TGUID =
16771
      (D1:$c4a54da0;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
16772
 
16773
// {E63232A0-9DBF-11d0-9CC1-00A0C905425E}
16774
  DPAID_INetW: TGUID =
16775
      (D1:$e63232a0;D2:$9dbf;D3:$11d0;D4:($9c,$c1,$00,$a0,$c9,$5,$42,$5e));
16776
 
16777
(*
16778
 * DPAID_InetPort
16779
 *
16780
 * Chunk is the port number used for creating the apps TCP and UDP sockets.
16781
 * WORD value (i.e. 47624)
16782
 *)
16783
 
16784
// {E4524541-8EA5-11d1-8A96-006097B01411}
16785
  DPAID_INetPort: TGUID =
16786
      (D1:$e4524541;D2:$8ea5;D3:$11d1;D4:($8a,$96,$00,$60,$97,$b0,$14,$11));
16787
 
16788
//@@BEGIN_MSINTERNAL
16789
(*
16790
 * DPAID_MaxMessageSize
16791
 *
16792
 * Tells DPLAY what the maximum allowed message size is.  Enables SPs to
16793
 *      combat Denial of Service attacks
16794
 *)
16795
 
16796
 // this terrible hack is needed so the SP can work with the Elmer build.
16797
 // it can be removed when the MSINTERNAL stuff is removed
16798
{$DEFINE MAXMSGSIZEGUIDDEFINED}
16799
 
16800
// {F5D09980-F0C4-11d1-8326-006097B01411}
16801
  DPAID_MaxMessageSize: TGUID =
16802
      (D1:$f5d09980;D2:$f0c4;D3:$11d1;D4:($83,$26,$00,$60,$97,$b0,$14,$11));
16803
//@@END_MSINTERNAL
16804
 
16805
(*
16806
 * TDPComPortAddress
16807
 *
16808
 * Used to specify com port settings. The constants that define baud rate,
16809
 * stop bits and parity are defined in WINBASE.H. The constants for flow
16810
 * control are given below.
16811
 *)
16812
 
16813
  DPCPA_NOFLOW       = 0;           // no flow control
16814
  DPCPA_XONXOFFFLOW  = 1;           // software flow control
16815
  DPCPA_RTSFLOW      = 2;           // hardware flow control with RTS
16816
  DPCPA_DTRFLOW      = 3;           // hardware flow control with DTR
16817
  DPCPA_RTSDTRFLOW   = 4;           // hardware flow control with RTS and DTR
16818
 
1 daniel-mar 16819
type
16820
  PDPComPortAddress = ^TDPComPortAddress;
4 daniel-mar 16821
  TDPComPortAddress = packed record
1 daniel-mar 16822
    dwComPort: DWORD;       // COM port to use (1-4)
16823
    dwBaudRate: DWORD;      // baud rate (100-256k)
16824
    dwStopBits: DWORD;      // no. stop bits (1-2)
16825
    dwParity: DWORD;        // parity (none, odd, even, mark)
16826
    dwFlowControl: DWORD;   // flow control (none, xon/xoff, rts, dtr)
16827
  end;
16828
 
16829
const
4 daniel-mar 16830
(*
16831
 * DPAID_ComPort
16832
 *
16833
 * Chunk contains a TDPComPortAddress structure defining the serial port.
16834
 *)
1 daniel-mar 16835
 
4 daniel-mar 16836
// {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E}
16837
  DPAID_ComPort: TGUID =
16838
      (D1:$f2f0ce00;D2:$e0af;D3:$11cf;D4:($9c,$4e,$00,$a0,$c9,$5,$42,$5e));
1 daniel-mar 16839
 
4 daniel-mar 16840
(****************************************************************************
16841
 *
16842
 *      dplobby 1.0 obsolete definitions
16843
 *      Included for compatibility only.
16844
 *
16845
 ****************************************************************************)
16846
 
1 daniel-mar 16847
  DPLAD_SYSTEM = DPLMSG_SYSTEM;
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;
17044
  DirectXSetup : function (hWnd: HWND; lpszRootPath: PCharAW; 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;
17050
  DirectXDeviceDriverSetup : function (hWnd: HWND; lpszDriverClass: PCharAW;
17051
     lpszDriverPath: PCharAW; 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
 
22647
function DPErrorString(Value: HResult) : string;
1 daniel-mar 22648
begin
4 daniel-mar 22649
  case Value of
22650
    CLASS_E_NOAGGREGATION: Result := 'A non-NULL value was passed for the pUnkOuter parameter in DirectPlayCreate, DirectPlayLobbyCreate, or IDirectPlayLobby2::Connect.';
22651
    DPERR_ACCESSDENIED: Result := 'The session is full or an incorrect password was supplied.';
22652
    DPERR_ACTIVEPLAYERS: Result := 'The requested operation cannot be performed because there are existing active players.';
22653
    DPERR_ALREADYINITIALIZED: Result := 'This object is already initialized.';
22654
    DPERR_APPNOTSTARTED: Result := 'The application has not been started yet.';
22655
    DPERR_AUTHENTICATIONFAILED: Result := 'The password or credentials supplied could not be authenticated.';
22656
    DPERR_BUFFERTOOLARGE: Result := 'The data buffer is too large to store.';
22657
    DPERR_BUSY: Result := 'A message cannot be sent because the transmission medium is busy.';
22658
    DPERR_BUFFERTOOSMALL: Result := 'The supplied buffer is not large enough to contain the requested data.';
22659
    DPERR_CANTADDPLAYER: Result := 'The player cannot be added to the session.';
22660
    DPERR_CANTCREATEGROUP: Result := 'A new group cannot be created.';
22661
    DPERR_CANTCREATEPLAYER: Result := 'A new player cannot be created.';
22662
    DPERR_CANTCREATEPROCESS: Result := 'Cannot start the application.';
22663
    DPERR_CANTCREATESESSION: Result := 'A new session cannot be created.';
22664
    DPERR_CANTLOADCAPI: Result := 'No credentials were supplied and the CryptoAPI package (CAPI) to use for cryptography services cannot be loaded.';
22665
    DPERR_CANTLOADSECURITYPACKAGE: Result := 'The software security package cannot be loaded.';
22666
    DPERR_CANTLOADSSPI: Result := 'No credentials were supplied and the software security package (SSPI) that will prompt for credentials cannot be loaded.';
22667
    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.';
22668
    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.';
22669
    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.';
22670
    DPERR_EXCEPTION: Result := 'An exception occurred when processing the request.';
22671
    DPERR_GENERIC: Result := 'An undefined error condition occurred.';
22672
//    DPERR_INVALIDCREDENTIALS: Result := 'The credentials supplied (as to IDirectPlay3::SecureOpen) were not valid.';
22673
    DPERR_INVALIDFLAGS: Result := 'The flags passed to this method are invalid.';
22674
    DPERR_INVALIDGROUP: Result := 'The group ID is not recognized as a valid group ID for this game session.';
22675
    DPERR_INVALIDINTERFACE: Result := 'The interface parameter is invalid.';
22676
    DPERR_INVALIDOBJECT: Result := 'The DirectPlay object pointer is invalid.';
22677
    DPERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the method are invalid.';
22678
    DPERR_INVALIDPASSWORD: Result := 'An invalid password was supplied when attempting to join a session that requires a password.';
22679
    DPERR_INVALIDPLAYER: Result := 'The player ID is not recognized as a valid player ID for this game session.';
22680
    DPERR_LOGONDENIED: Result := 'The session could not be opened because credentials are required and either no credentials were supplied or the credentials were invalid.';
22681
    DPERR_NOCAPS: Result := 'The communication link that DirectPlay is attempting to use is not capable of this function.';
22682
    DPERR_NOCONNECTION: Result := 'No communication link was established.';
22683
    DPERR_NOINTERFACE: Result := 'The interface is not supported.';
22684
    DPERR_NOMESSAGES: Result := 'There are no messages in the receive queue.';
22685
    DPERR_NONAMESERVERFOUND: Result := 'No name server (host) could be found or created. A host must exist to create a player.';
22686
    DPERR_NONEWPLAYERS: Result := 'The session is not accepting any new players.';
22687
    DPERR_NOPLAYERS: Result := 'There are no active players in the session.';
22688
    DPERR_NOSESSIONS: Result := 'There are no existing sessions for this game.';
22689
    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.';
22690
    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.';
22691
    DPERR_OUTOFMEMORY: Result := 'There is insufficient memory to perform the requested operation.';
22692
    DPERR_PLAYERLOST: Result := 'A player has lost the connection to the session.';
22693
    DPERR_SENDTOOBIG: Result := 'The message being sent by the IDirectPlay3::Send method is too large.';
22694
    DPERR_SESSIONLOST: Result := 'The connection to the session has been lost.';
22695
    DPERR_SIGNFAILED: Result := 'The requested information could not be digitally signed. Digital signatures are used to establish the authenticity of messages.';
22696
    DPERR_TIMEOUT: Result := 'The operation could not be completed in the specified time.';
22697
    DPERR_UNAVAILABLE: Result := 'The requested function is not available at this time.';
22698
    DPERR_UNINITIALIZED: Result := 'The requested object has not been initialized.';
22699
    DPERR_UNKNOWNAPPLICATION: Result := 'An unknown application was specified.';
22700
    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.';
22701
    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.';
22702
    else Result := 'Unrecognized Error';
22703
  end;
1 daniel-mar 22704
end;
22705
 
4 daniel-mar 22706
//DirectSetup file
1 daniel-mar 22707
 
4 daniel-mar 22708
(*==========================================================================
22709
 *
22710
 *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
22711
 *
22712
 *  File:       dsetup.h
22713
 *  Content:    DirectXSetup, error codes and flags
22714
 ***************************************************************************)
1 daniel-mar 22715
 
4 daniel-mar 22716
procedure LoadDSetup;
1 daniel-mar 22717
 
4 daniel-mar 22718
  function RegGetStringValue(Hive: HKEY; const KeyName, ValueName: string): string;
22719
  var EnvKey  : HKEY;
22720
      Buf     : array[0..255] of char;
22721
      BufSize : DWord;
22722
      RegType : DWord;
22723
      rc      : DWord;
22724
  begin
22725
    Result := '';
22726
    BufSize := Sizeof(Buf);
22727
    ZeroMemory(@Buf, BufSize);
22728
    RegType := REG_SZ;
22729
    try
22730
      if (RegOpenKeyEx(Hive, PChar(KeyName), 0, KEY_READ, EnvKey) = ERROR_SUCCESS) then
22731
      begin
22732
        try
22733
          if (ValueName = '') then rc := RegQueryValueEx(EnvKey, nil, nil, @RegType, @Buf, @BufSize)
22734
            else rc := RegQueryValueEx(EnvKey, PChar(ValueName), nil, @RegType, @Buf, @BufSize);
22735
          if rc = ERROR_SUCCESS then Result := string(Buf);
22736
        finally
22737
          RegCloseKey(EnvKey);
22738
        end;
22739
      end;
22740
    finally
22741
      RegCloseKey(Hive);
22742
    end;
22743
  end;
1 daniel-mar 22744
 
22745
 
4 daniel-mar 22746
  function ExistFile(const FileName: string): Boolean;
22747
  var hFile: THandle;
22748
  begin
22749
    hFile := CreateFile(PChar(FileName), 0, 0, nil, OPEN_EXISTING, 0, 0);
22750
    Result := hFile <> INVALID_HANDLE_VALUE;
22751
    if hFile = INVALID_HANDLE_VALUE then CloseHandle(hFile);
22752
  end;
1 daniel-mar 22753
 
4 daniel-mar 22754
  function GetDSetupDLLPath : string;
22755
  begin
22756
     Result := RegGetStringValue(HKEY_LOCAL_MACHINE,
22757
                                 'Software\Microsoft\Windows\CurrentVersion\Uninstall\DirectXDrivers',
22758
                                 'UninstallString');
22759
     if Result <> '' then
22760
       Result := Copy(Result,1,Length(Result)-Length('dxsetup.exe')) + 'DSetup.dll';
22761
  end;
1 daniel-mar 22762
 
4 daniel-mar 22763
begin
22764
  DSetupDLL := LoadLibrary(PChar(GetDSetupDLLPath));
1 daniel-mar 22765
 
4 daniel-mar 22766
  DirectXSetupA := GetProcAddress(DSetupDLL,'DirectXSetupA');
22767
  DirectXSetupW := GetProcAddress(DSetupDLL,'DirectXSetupW');
22768
{$IFDEF UNICODE}
22769
  DirectXSetup := DirectXSetupW;
22770
{$ELSE}
22771
  DirectXSetup := DirectXSetupA;
22772
{$ENDIF}
1 daniel-mar 22773
 
4 daniel-mar 22774
  DirectXDeviceDriverSetupA :=
22775
      GetProcAddress(DSetupDLL,'DirectXDeviceDriverSetupA');
22776
  DirectXDeviceDriverSetupW :=
22777
      GetProcAddress(DSetupDLL,'DirectXDeviceDriverSetupW');
22778
{$IFDEF UNICODE}
22779
  DirectXDeviceDriverSetup := DirectXDeviceDriverSetupW;
22780
{$ELSE}
22781
  DirectXDeviceDriverSetup := DirectXDeviceDriverSetupA;
22782
{$ENDIF}
1 daniel-mar 22783
 
4 daniel-mar 22784
  DirectXRegisterApplicationA :=
22785
       GetProcAddress(DSetupDLL,'DirectXRegisterApplicationA');
22786
  DirectXRegisterApplicationW :=
22787
       GetProcAddress(DSetupDLL,'DirectXRegisterApplicationW');
22788
{$IFDEF UNICODE}
22789
  DirectXRegisterApplication := DirectXRegisterApplicationW;
22790
{$ELSE}
22791
  DirectXRegisterApplication := DirectXRegisterApplicationA;
22792
{$ENDIF}
1 daniel-mar 22793
 
4 daniel-mar 22794
  DirectXUnRegisterApplication :=
22795
      GetProcAddress(DSetupDLL,'DirectXUnRegisterApplication');
1 daniel-mar 22796
 
4 daniel-mar 22797
  DirectXSetupSetCallback :=
22798
      GetProcAddress(DSetupDLL,'DirectXSetupSetCallback');
1 daniel-mar 22799
 
4 daniel-mar 22800
  DirectXSetupGetVersion := GetProcAddress(DSetupDLL,'DirectXSetupGetVersion');
22801
 
22802
end;
22803
 
22804
//DirectSound file
22805
 
22806
function MAKE_DSHRESULT(code: DWORD) : HResult;
1 daniel-mar 22807
begin
4 daniel-mar 22808
  Result := HResult(1 shl 31) or HResult(_FACDS shl 16)
22809
      or HResult(code);
1 daniel-mar 22810
end;
22811
 
4 daniel-mar 22812
function DSSPEAKER_COMBINED(c, g: variant) : DWORD;
1 daniel-mar 22813
begin
4 daniel-mar 22814
  Result := byte(c) or (byte(g) shl 16)
1 daniel-mar 22815
end;
22816
 
4 daniel-mar 22817
function DSSPEAKER_CONFIG(a: variant) : byte;
1 daniel-mar 22818
begin
4 daniel-mar 22819
  Result := byte(a);
1 daniel-mar 22820
end;
22821
 
4 daniel-mar 22822
function DSSPEAKER_GEOMETRY(a: variant) : byte;
22823
begin
22824
  Result := byte(a shr 16 and $FF);
22825
end;
1 daniel-mar 22826
 
22827
 
4 daniel-mar 22828
function DSErrorString(Value: HResult) : string;
1 daniel-mar 22829
begin
4 daniel-mar 22830
  case Value of
22831
    DS_OK: Result := 'The request completed successfully.';
22832
    DSERR_ALLOCATED: Result := 'The request failed because resources, such as a priority level, were already in use by another caller.';
22833
    DSERR_ALREADYINITIALIZED: Result := 'The object is already initialized.';
22834
    DSERR_BADFORMAT: Result := 'The specified wave format is not supported.';
22835
    DSERR_BUFFERLOST: Result := 'The buffer memory has been lost and must be restored.';
22836
    DSERR_CONTROLUNAVAIL: Result := 'The control (volume, pan, and so forth) requested by the caller is not available.';
22837
    DSERR_GENERIC: Result := 'An undetermined error occurred inside the DirectSound subsystem.';
22838
    DSERR_INVALIDCALL: Result := 'This function is not valid for the current state of this object.';
22839
    DSERR_INVALIDPARAM: Result := 'An invalid parameter was passed to the returning function.';
22840
    DSERR_NOAGGREGATION: Result := 'The object does not support aggregation.';
22841
    DSERR_NODRIVER: Result := 'No sound driver is available for use.';
22842
    DSERR_NOINTERFACE: Result := 'The requested COM interface is not available.';
22843
    DSERR_OTHERAPPHASPRIO: Result := 'Another application has a higher priority level, preventing this call from succeeding.';
22844
    DSERR_OUTOFMEMORY: Result := 'The DirectSound subsystem could not allocate sufficient memory to complete the caller´s request.';
22845
    DSERR_PRIOLEVELNEEDED: Result := 'The caller does not have the priority level required for the function to succeed.';
22846
    DSERR_UNINITIALIZED: Result := 'The IDirectSound::Initialize method has not been called or has not been called successfully before other methods were called.';
22847
    DSERR_UNSUPPORTED: Result := 'The function called is not supported at this time.';
22848
    else Result := 'Unrecognized Error';
22849
  end;
1 daniel-mar 22850
end;
22851
 
4 daniel-mar 22852
//DirectMusic file
22853
 
22854
function MAKE_HRESULT(sev,fac,code: DWORD) : HResult;
1 daniel-mar 22855
begin
4 daniel-mar 22856
  Result := (sev shl 31) or (fac shl 16) or code;
1 daniel-mar 22857
end;
22858
 
4 daniel-mar 22859
//function MAKEFOURCC (ch0, ch1, ch2, ch3: Char) : TFourCC;
22860
//type
22861
//  tfcc = array [0..3] of Char;
22862
//begin
22863
//  tfcc(Result)[0] := ch0;
22864
//  tfcc(Result)[1] := ch1;
22865
//  tfcc(Result)[2] := ch2;
22866
//  tfcc(Result)[3] := ch3;
22867
//end;
22868
 
22869
function QWORD_ALIGN(x: DWORD) : DWORD;
1 daniel-mar 22870
begin
4 daniel-mar 22871
  Result := (x + 7) and (not 7); //  (((x) + 7) & ~7)
1 daniel-mar 22872
end;
22873
 
4 daniel-mar 22874
function DMUS_EVENT_SIZE(cb: DWORD) : DWORD;
1 daniel-mar 22875
begin
4 daniel-mar 22876
  Result := QWORD_ALIGN(SizeOf(TDMus_EventHeader) + cb); // QWORD_ALIGN(sizeof(DMUS_EVENTHEADER) + cb)
1 daniel-mar 22877
end;
22878
 
4 daniel-mar 22879
function IsNTandDelphiRunning : boolean;
22880
var
22881
  OSVersion  : TOSVersionInfo;
22882
  AppName    : array[0..255] of char;
1 daniel-mar 22883
begin
4 daniel-mar 22884
  OSVersion.dwOsVersionInfoSize := sizeof(OSVersion);
22885
  GetVersionEx(OSVersion);
22886
  // Not running in NT or program is not Delphi itself ?
22887
  AppName[0] := #0;
22888
  lstrcat(AppName, PChar(ParamStr(0)));  // ParamStr(0) = Application.ExeName
22889
  {$IFDEF VER12UP}
22890
  CharUpperBuff(AppName, High(AppName) + 1);
22891
  {$ELSE}
22892
  CharUpperBuff(AppName, SizeOf(AppName));
22893
  {$ENDIF}
22894
  result := ( (OSVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) and
22895
              (Pos('DELPHI32.EXE', AppName) = Length(AppName) - Length('DELPHI32.EXE') + 1) );
1 daniel-mar 22896
end;
22897
 
4 daniel-mar 22898
initialization
22899
begin
22900
  {DirectDraw}
1 daniel-mar 22901
 
4 daniel-mar 22902
  if not IsNTandDelphiRunning then
22903
  begin
22904
    DDrawDLL := LoadLibrary('DDraw.dll');
22905
    DirectDrawEnumerateA := GetProcAddress(DDrawDLL,'DirectDrawEnumerateA');
22906
    DirectDrawEnumerateW := GetProcAddress(DDrawDLL,'DirectDrawEnumerateW');
22907
{$IFDEF UNICODE}
22908
    DirectDrawEnumerate := DirectDrawEnumerateW;
22909
{$ELSE}
22910
    DirectDrawEnumerate := DirectDrawEnumerateA;
22911
{$ENDIF}
22912
 
22913
    DirectDrawEnumerateExA := GetProcAddress(DDrawDLL,'DirectDrawEnumerateExA');
22914
    DirectDrawEnumerateExW := GetProcAddress(DDrawDLL,'DirectDrawEnumerateExW');
22915
{$IFDEF UNICODE}
22916
    DirectDrawEnumerateEx := DirectDrawEnumerateExW;
22917
{$ELSE}
22918
    DirectDrawEnumerateEx := DirectDrawEnumerateExA;
22919
{$ENDIF}
22920
 
22921
    DirectDrawCreate := GetProcAddress(DDrawDLL,'DirectDrawCreate');
22922
    DirectDrawCreateEx := GetProcAddress(DDrawDLL,'DirectDrawCreateEx');
22923
    DirectDrawCreateClipper := GetProcAddress(DDrawDLL,'DirectDrawCreateClipper');
22924
{$IFDEF WINNT}
22925
    NtDirectDrawCreate := GetProcAddress(DDrawDLL,'NtDirectDrawCreate');
22926
{$ENDIF}
22927
  end;
22928
  {DirectDraw}
22929
  {Direct3D}
22930
  DisableFPUExceptions;
22931
  {$IFDEF D3DRM}
22932
  if not IsNTandDelphiRunning then
22933
  begin
22934
    DXFileDLL := LoadLibrary('D3DXOF.DLL');
22935
    DirectXFileCreate := GetProcAddress(DXFileDLL,'DirectXFileCreate');
22936
  end;
22937
  {Direct3D}
22938
  {Direct3DRM}
22939
  if not IsNTandDelphiRunning then
22940
  begin
22941
    D3DRMDLL := LoadLibrary('D3DRM.dll');
22942
    //d3drmdef:
22943
    D3DRMCreateColorRGB := GetProcAddress(D3DRMDLL,'D3DRMCreateColorRGB');
22944
    D3DRMCreateColorRGBA := GetProcAddress(D3DRMDLL,'D3DRMCreateColorRGBA');
22945
    D3DRMColorGetRed := GetProcAddress(D3DRMDLL,'D3DRMColorGetRed');
22946
    D3DRMColorGetGreen := GetProcAddress(D3DRMDLL,'D3DRMColorGetGreen');
22947
    D3DRMColorGetBlue := GetProcAddress(D3DRMDLL,'D3DRMColorGetBlue');
22948
    D3DRMColorGetAlpha := GetProcAddress(D3DRMDLL,'D3DRMColorGetAlpha');
22949
    D3DRMVectorAdd := GetProcAddress(D3DRMDLL,'D3DRMVectorAdd');
22950
    D3DRMVectorSubtract := GetProcAddress(D3DRMDLL,'D3DRMVectorSubtract');
22951
    D3DRMVectorReflect := GetProcAddress(D3DRMDLL,'D3DRMVectorReflect');
22952
    D3DRMVectorCrossProduct := GetProcAddress(D3DRMDLL,'D3DRMVectorCrossProduct');
22953
    D3DRMVectorDotProduct := GetProcAddress(D3DRMDLL,'D3DRMVectorDotProduct');
22954
    D3DRMVectorNormalize := GetProcAddress(D3DRMDLL,'D3DRMVectorNormalize');
22955
    D3DRMVectorModulus := GetProcAddress(D3DRMDLL,'D3DRMVectorModulus');
22956
    D3DRMVectorRotate := GetProcAddress(D3DRMDLL,'D3DRMVectorRotate');
22957
    D3DRMVectorScale := GetProcAddress(D3DRMDLL,'D3DRMVectorScale');
22958
    D3DRMVectorRandom := GetProcAddress(D3DRMDLL,'D3DRMVectorRandom');
22959
    D3DRMQuaternionFromRotation := GetProcAddress(D3DRMDLL,'D3DRMQuaternionFromRotation');
22960
    D3DRMQuaternionMultiply := GetProcAddress(D3DRMDLL,'D3DRMQuaternionMultiply');
22961
    D3DRMQuaternionSlerp := GetProcAddress(D3DRMDLL,'D3DRMQuaternionSlerp');
22962
    D3DRMMatrixFromQuaternion := GetProcAddress(D3DRMDLL,'D3DRMMatrixFromQuaternion');
22963
    D3DRMQuaternionFromMatrix := GetProcAddress(D3DRMDLL,'D3DRMQuaternionFromMatrix');
22964
    //d3drm:
22965
    Direct3DRMCreate := GetProcAddress(D3DRMDLL,'Direct3DRMCreate');
22966
  end;
22967
  {$ENDIF}
22968
  {Direct3DRM}
22969
  {DirectInput}
22970
  Init_c_dfDIKeyboard_Objects;  // set kbd GUIDs & flags
22971
  Init_c_dfDIJoystick2_Objects;  // construct Joystick2 from Joystick fmt
22972
 
22973
  if not IsNTandDelphiRunning then
22974
  begin
22975
    DInputDLL := LoadLibrary('DInput.dll');
22976
 
22977
    DirectInputCreateA := GetProcAddress(DInputDLL,'DirectInputCreateA');
22978
    DirectInputCreateW := GetProcAddress(DInputDLL,'DirectInputCreateW');
22979
    // no A/W version
22980
    DirectInputCreateEx := GetProcAddress(DInputDLL,'DirectInputCreateEx');
22981
{$IFDEF UNICODE}
22982
    DirectInputCreate := DirectInputCreateW;
22983
{$ELSE}
22984
    DirectInputCreate := DirectInputCreateA;
22985
{$ENDIF}
22986
  end;
22987
  {DirectInput}
22988
  {DirectPlay}
22989
  if not IsNTandDelphiRunning then
22990
  begin
22991
    DPlayDLL := LoadLibrary('DPlayX.dll');
22992
 
22993
    DirectPlayEnumerateA := GetProcAddress(DPlayDLL,'DirectPlayEnumerateA');
22994
    DirectPlayEnumerateW := GetProcAddress(DPlayDLL,'DirectPlayEnumerateW');
22995
  {$IFDEF UNICODE}
22996
    DirectPlayEnumerate := DirectPlayEnumerateW;
22997
  {$ELSE}
22998
    DirectPlayEnumerate := DirectPlayEnumerateA;
22999
  {$ENDIF}
23000
 
23001
    DirectPlayCreate := GetProcAddress(DPlayDLL,'DirectPlayCreate');
23002
 
23003
//  File:       dplay.h
23004
 
23005
    DirectPlayLobbyCreateW := GetProcAddress(DPlayDLL,'DirectPlayLobbyCreateW');
23006
    DirectPlayLobbyCreateA := GetProcAddress(DPlayDLL,'DirectPlayLobbyCreateA');
23007
  {$IFDEF UNICODE}
23008
    DirectPlayLobbyCreate := DirectPlayLobbyCreateW;
23009
  {$ELSE}
23010
    DirectPlayLobbyCreate := DirectPlayLobbyCreateA;
23011
  {$ENDIF}
23012
 
23013
  end;
23014
  {DirectPlay}
23015
  {DirectSetup}
23016
  if not IsNTandDelphiRunning then
23017
  begin
23018
    LoadDSetup;
23019
  end;
23020
  {DirectSetup}
23021
  {DirectSound}
23022
  if not IsNTandDelphiRunning then
23023
  begin
23024
    DSoundDLL := LoadLibrary('DSound.dll');
23025
    DirectSoundCreate := GetProcAddress(DSoundDLL,'DirectSoundCreate');
23026
 
23027
    DirectSoundEnumerateW := GetProcAddress(DSoundDLL,'DirectSoundEnumerateW');
23028
    DirectSoundEnumerateA := GetProcAddress(DSoundDLL,'DirectSoundEnumerateA');
23029
  {$IFDEF UNICODE}
23030
    DirectSoundEnumerate := DirectSoundEnumerateW;
23031
  {$ELSE}
23032
    DirectSoundEnumerate := DirectSoundEnumerateA;
23033
  {$ENDIF}
23034
 
23035
    DirectSoundCaptureCreate :=
23036
        GetProcAddress(DSoundDLL,'DirectSoundCaptureCreate');
23037
 
23038
    DirectSoundCaptureEnumerateW :=
23039
        GetProcAddress(DSoundDLL,'DirectSoundCaptureEnumerateW');
23040
    DirectSoundCaptureEnumerateA :=
23041
        GetProcAddress(DSoundDLL,'DirectSoundCaptureEnumerateA');
23042
  {$IFDEF UNICODE}
23043
    DirectSoundCaptureEnumerate := DirectSoundCaptureEnumerateW;
23044
  {$ELSE}
23045
    DirectSoundCaptureEnumerate := DirectSoundCaptureEnumerateA;
23046
  {$ENDIF}
23047
  end;
23048
  {DirectSound}
23049
end;
23050
 
23051
finalization
23052
begin
23053
  {DirectDraw}
23054
  if DDrawDLL <> 0 then FreeLibrary(DDrawDLL);
23055
  {DirectDraw}
23056
  {Direct3D}
23057
  FreeLibrary(DXFileDLL);
23058
  {Direct3D}
23059
  {Direct3DRM}
23060
  {$IFDEF D3DRM}
23061
  if D3DRMDLL <> 0 then FreeLibrary(D3DRMDLL);
23062
  {$ENDIF}
23063
  {Direct3DRM}
23064
  {DirectInput}
23065
  FreeLibrary(DInputDLL);
23066
  {DirectInput}
23067
  {DirectPlay}
23068
  if DPlayDLL <> 0 then FreeLibrary(DPlayDLL);
23069
  {DirectPlay}
23070
  {DirectSetup}
23071
  FreeLibrary(DSetupDLL);
23072
  {DirectSetup}
23073
  {DirectSound}
23074
  FreeLibrary(DSoundDLL);
23075
  {DirectSound}
23076
end;
23077
 
23078
 
23079
End.