1 /* $Id: main.c 21434 2006-04-01 19:12:56Z greatlrd $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: lib/ddraw/ddraw.c
6 * PURPOSE: DirectDraw Library
7 * PROGRAMMER: Magnus Olsen (greatlrd)
16 DDRAWI_DIRECTDRAW_GBL ddgbl
;
17 DDRAWI_DDRAWSURFACE_GBL ddSurfGbl
;
21 StartDirectDraw(LPDIRECTDRAW
* iface
, LPGUID lpGuid
)
23 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
28 const UINT bmiSize
= sizeof(BITMAPINFOHEADER
) + 0x10;
36 RtlZeroMemory(&ddgbl
, sizeof(DDRAWI_DIRECTDRAW_GBL
));
38 ddgbl
.lpDDCBtmp
= (LPDDHAL_CALLBACKS
) DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS
));
39 if (ddgbl
.lpDDCBtmp
== NULL
)
41 DX_STUB_str("Out of memmory");
45 This
->lpLcl
->lpDDCB
= ddgbl
.lpDDCBtmp
;
48 /* Same for HEL and HAL */
49 This
->lpLcl
->lpGbl
->lpModeInfo
= (DDHALMODEINFO
*) DxHeapMemAlloc(1 * sizeof(DDHALMODEINFO
));
51 if (This
->lpLcl
->lpGbl
->lpModeInfo
== NULL
)
53 DX_STUB_str("DD_FALSE");
57 EnumDisplaySettings(NULL
, ENUM_CURRENT_SETTINGS
, &devmode
);
59 This
->lpLcl
->lpGbl
->lpModeInfo
[0].dwWidth
= devmode
.dmPelsWidth
;
60 This
->lpLcl
->lpGbl
->lpModeInfo
[0].dwHeight
= devmode
.dmPelsHeight
;
61 This
->lpLcl
->lpGbl
->lpModeInfo
[0].dwBPP
= devmode
.dmBitsPerPel
;
62 This
->lpLcl
->lpGbl
->lpModeInfo
[0].lPitch
= (devmode
.dmPelsWidth
*devmode
.dmBitsPerPel
)/8;
63 This
->lpLcl
->lpGbl
->lpModeInfo
[0].wRefreshRate
= (WORD
)devmode
.dmDisplayFrequency
;
70 /* Create HDC for default, hal and hel driver */
71 This
->lpLcl
->hDC
= (ULONG_PTR
) CreateDCW(L
"DISPLAY",L
"DISPLAY",NULL
,NULL
);
73 /* cObsolete is undoc in msdn it being use in CreateDCA */
74 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
75 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
78 else if (lpGuid
== (LPGUID
) DDCREATE_HARDWAREONLY
)
82 /* Create HDC for default, hal and hel driver */
83 This
->lpLcl
->hDC
= (ULONG_PTR
)CreateDCW(L
"DISPLAY",L
"DISPLAY",NULL
,NULL
);
85 /* cObsolete is undoc in msdn it being use in CreateDCA */
86 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
87 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
90 else if (lpGuid
== (LPGUID
) DDCREATE_EMULATIONONLY
)
94 /* Create HDC for default, hal and hel driver */
95 This
->lpLcl
->hDC
= (ULONG_PTR
) CreateDCW(L
"DISPLAY",L
"DISPLAY",NULL
,NULL
);
97 /* cObsolete is undoc in msdn it being use in CreateDCA */
98 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
99 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
103 /* FIXME : need getting driver from the GUID that have been pass in from
104 the register. we do not support that yet
107 This
->lpLcl
->hDC
= (ULONG_PTR
) NULL
;
110 if ( (HDC
)This
->lpLcl
->hDC
== NULL
)
112 DX_STUB_str("DDERR_OUTOFMEMORY");
113 return DDERR_OUTOFMEMORY
;
116 hbmp
= CreateCompatibleBitmap((HDC
) This
->lpLcl
->hDC
, 1, 1);
119 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
120 DeleteDC((HDC
) This
->lpLcl
->hDC
);
121 DX_STUB_str("DDERR_OUTOFMEMORY");
122 return DDERR_OUTOFMEMORY
;
125 pbmiData
= (UCHAR
*) DxHeapMemAlloc(bmiSize
);
126 pbmi
= (BITMAPINFO
*)pbmiData
;
130 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
131 DeleteDC((HDC
) This
->lpLcl
->hDC
);
133 DX_STUB_str("DDERR_OUTOFMEMORY");
134 return DDERR_OUTOFMEMORY
;
137 pbmi
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
138 pbmi
->bmiHeader
.biBitCount
= (WORD
)devmode
.dmBitsPerPel
;
139 pbmi
->bmiHeader
.biCompression
= BI_BITFIELDS
;
140 pbmi
->bmiHeader
.biWidth
= 1;
141 pbmi
->bmiHeader
.biHeight
= 1;
143 GetDIBits((HDC
) This
->lpLcl
->hDC
, hbmp
, 0, 0, NULL
, pbmi
, 0);
146 pMasks
= (DWORD
*)(pbmiData
+ sizeof(BITMAPINFOHEADER
));
147 This
->lpLcl
->lpGbl
->lpModeInfo
[0].dwRBitMask
= pMasks
[0];
148 This
->lpLcl
->lpGbl
->lpModeInfo
[0].dwGBitMask
= pMasks
[1];
149 This
->lpLcl
->lpGbl
->lpModeInfo
[0].dwBBitMask
= pMasks
[2];
150 This
->lpLcl
->lpGbl
->lpModeInfo
[0].dwAlphaBitMask
= pMasks
[3];
152 DxHeapMemFree(pbmiData
);
154 /* Startup HEL and HAL */
155 // RtlZeroMemory(&ddgbl, sizeof(DDRAWI_DIRECTDRAW_GBL));
157 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
158 This
->lpLcl
->dwProcessId
= GetCurrentProcessId();
162 hal_ret
= StartDirectDrawHal(iface
);
163 hel_ret
= StartDirectDrawHel(iface
);
164 if ((hal_ret
!=DD_OK
) && (hel_ret
!=DD_OK
))
166 DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT");
167 return DDERR_NODIRECTDRAWSUPPORT
;
170 This
->lpLcl
->hDD
= This
->lpLcl
->lpGbl
->hDD
;
173 /* Fixme the mix betwin hel and hal */
174 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->cbDDCallbacks
);
176 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_CANCREATESURFACE
)
178 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_CANCREATESURFACE
;
179 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.CanCreateSurface
= This
->lpLcl
->lpDDCB
->HALDD
.CanCreateSurface
;
181 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_CANCREATESURFACE
)
183 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_CANCREATESURFACE
;
184 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.CanCreateSurface
= This
->lpLcl
->lpDDCB
->HELDD
.CanCreateSurface
;
186 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_CREATESURFACE
)
188 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_CREATESURFACE
;
189 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.CreateSurface
= This
->lpLcl
->lpDDCB
->HALDD
.CreateSurface
;
191 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_CREATESURFACE
)
193 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_CREATESURFACE
;
194 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.CreateSurface
= This
->lpLcl
->lpDDCB
->HELDD
.CreateSurface
;
196 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_CREATEPALETTE
)
198 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_CREATEPALETTE
;
199 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.CreatePalette
= This
->lpLcl
->lpDDCB
->HALDD
.CreatePalette
;
201 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_CREATEPALETTE
)
203 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_CREATEPALETTE
;
204 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.CreatePalette
= This
->lpLcl
->lpDDCB
->HELDD
.CreatePalette
;
206 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_DESTROYDRIVER
)
208 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_DESTROYDRIVER
;
209 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.DestroyDriver
= This
->lpLcl
->lpDDCB
->HALDD
.DestroyDriver
;
211 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_DESTROYDRIVER
)
213 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_DESTROYDRIVER
;
214 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.DestroyDriver
= This
->lpLcl
->lpDDCB
->HELDD
.DestroyDriver
;
216 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_FLIPTOGDISURFACE
)
218 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_FLIPTOGDISURFACE
;
219 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.FlipToGDISurface
= This
->lpLcl
->lpDDCB
->HALDD
.FlipToGDISurface
;
221 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_FLIPTOGDISURFACE
)
223 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_FLIPTOGDISURFACE
;
224 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.FlipToGDISurface
= This
->lpLcl
->lpDDCB
->HELDD
.FlipToGDISurface
;
226 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_GETSCANLINE
)
228 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_GETSCANLINE
;
229 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.GetScanLine
= This
->lpLcl
->lpDDCB
->HALDD
.GetScanLine
;
231 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_GETSCANLINE
)
233 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_GETSCANLINE
;
234 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.GetScanLine
= This
->lpLcl
->lpDDCB
->HELDD
.GetScanLine
;
236 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_SETCOLORKEY
)
238 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_SETCOLORKEY
;
239 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.SetColorKey
= This
->lpLcl
->lpDDCB
->HALDD
.SetColorKey
;
241 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_SETCOLORKEY
)
243 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_SETCOLORKEY
;
244 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.SetColorKey
= This
->lpLcl
->lpDDCB
->HELDD
.SetColorKey
;
246 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_SETEXCLUSIVEMODE
)
248 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_SETEXCLUSIVEMODE
;
249 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.SetExclusiveMode
= This
->lpLcl
->lpDDCB
->HALDD
.SetExclusiveMode
;
251 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_SETEXCLUSIVEMODE
)
253 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_SETEXCLUSIVEMODE
;
254 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.SetExclusiveMode
= This
->lpLcl
->lpDDCB
->HELDD
.SetExclusiveMode
;
256 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_SETMODE
)
258 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_SETMODE
;
259 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.SetMode
= This
->lpLcl
->lpDDCB
->HALDD
.SetMode
;
261 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_SETMODE
)
263 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_SETMODE
;
264 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.SetMode
= This
->lpLcl
->lpDDCB
->HELDD
.SetMode
;
266 if (This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
& DDHAL_CB32_WAITFORVERTICALBLANK
)
268 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_WAITFORVERTICALBLANK
;
269 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.WaitForVerticalBlank
= This
->lpLcl
->lpDDCB
->HALDD
.WaitForVerticalBlank
;
271 else if (This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
& DDHAL_CB32_WAITFORVERTICALBLANK
)
273 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.dwFlags
= DDHAL_CB32_WAITFORVERTICALBLANK
;
274 This
->lpLcl
->lpDDCB
->cbDDCallbacks
.WaitForVerticalBlank
= This
->lpLcl
->lpDDCB
->HELDD
.WaitForVerticalBlank
;
286 /* Fill some basic info for Surface */
287 ddSurfGbl
.lpDD
= &ddgbl
;
295 StartDirectDrawHal(LPDIRECTDRAW
* iface
)
297 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
298 DDHAL_GETDRIVERINFODATA DriverInfo
;
301 DDHAL_CALLBACKS mCallbacks
;
302 DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks
;
303 D3DHAL_CALLBACKS mD3dCallbacks
;
304 D3DHAL_GLOBALDRIVERDATA mD3dDriverData
;
311 DDSURFACEDESC
*mpTextures
;
313 /* HAL Startup process */
314 BOOL newmode
= FALSE
;
317 RtlZeroMemory(&mHALInfo
, sizeof(DDHALINFO
));
318 RtlZeroMemory(&mCallbacks
, sizeof(DDHAL_CALLBACKS
));
321 Startup DX HAL step one of three
323 if (!DdCreateDirectDrawObject(This
->lpLcl
->lpGbl
, (HDC
)This
->lpLcl
->hDC
))
325 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
326 DeleteDC((HDC
)This
->lpLcl
->hDC
);
330 // Do not relase HDC it have been map in kernel mode
333 if (!DdReenableDirectDrawObject(This
->lpLcl
->lpGbl
, &newmode
))
335 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
336 DeleteDC((HDC
)This
->lpLcl
->hDC
);
342 Startup DX HAL step two of three
345 if (!DdQueryDirectDrawObject(This
->lpLcl
->lpGbl
,
348 &mCallbacks
.HALDDSurface
,
349 &mCallbacks
.HALDDPalette
,
352 &mD3dBufferCallbacks
,
357 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
358 DeleteDC((HDC
)This
->lpLcl
->hDC
);
359 // FIXME Close DX fristcall and second call
363 mcvmList
= mHALInfo
.vmiData
.dwNumHeaps
;
364 mpvmList
= (VIDMEM
*) DxHeapMemAlloc(sizeof(VIDMEM
) * mcvmList
);
365 if (mpvmList
== NULL
)
367 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
368 DeleteDC((HDC
)This
->lpLcl
->hDC
);
369 // FIXME Close DX fristcall and second call
373 mcFourCC
= mHALInfo
.ddCaps
.dwNumFourCCCodes
;
374 mpFourCC
= (DWORD
*) DxHeapMemAlloc(sizeof(DWORD
) * mcFourCC
);
375 if (mpFourCC
== NULL
)
377 DxHeapMemFree(mpvmList
);
378 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
379 DeleteDC((HDC
)This
->lpLcl
->hDC
);
380 // FIXME Close DX fristcall and second call
384 mcTextures
= mD3dDriverData
.dwNumTextureFormats
;
385 mpTextures
= (DDSURFACEDESC
*) DxHeapMemAlloc(sizeof(DDSURFACEDESC
) * mcTextures
);
386 if (mpTextures
== NULL
)
388 DxHeapMemFree( mpFourCC
);
389 DxHeapMemFree( mpvmList
);
390 DxHeapMemFree( This
->lpLcl
->lpGbl
->lpModeInfo
);
391 DeleteDC((HDC
)This
->lpLcl
->hDC
);
392 // FIXME Close DX fristcall and second call
396 mHALInfo
.vmiData
.pvmList
= mpvmList
;
397 mHALInfo
.lpdwFourCC
= mpFourCC
;
398 mD3dDriverData
.lpTextureFormats
= (DDSURFACEDESC
*) mpTextures
;
400 if (!DdQueryDirectDrawObject(
404 &mCallbacks
.HALDDSurface
,
405 &mCallbacks
.HALDDPalette
,
408 &mCallbacks
.HALDDExeBuf
,
409 (DDSURFACEDESC
*)mpTextures
,
414 DxHeapMemFree(mpTextures
);
415 DxHeapMemFree(mpFourCC
);
416 DxHeapMemFree(mpvmList
);
417 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
418 DeleteDC((HDC
)This
->lpLcl
->hDC
);
419 // FIXME Close DX fristcall and second call
424 Copy over from HalInfo to DirectDrawGlobal
427 // this is wrong, cDriverName need be in ASC code not UNICODE
428 //memcpy(mDDrawGlobal.cDriverName, mDisplayAdapter, sizeof(wchar)*MAX_DRIVER_NAME);
430 memcpy(&ddgbl
.vmiData
, &mHALInfo
.vmiData
,sizeof(VIDMEMINFO
));
431 memcpy(&ddgbl
.ddCaps
, &mHALInfo
.ddCaps
,sizeof(DDCORECAPS
));
433 mHALInfo
.dwNumModes
= 1;
434 mHALInfo
.lpModeInfo
= This
->lpLcl
->lpGbl
->lpModeInfo
;
435 mHALInfo
.dwMonitorFrequency
= This
->lpLcl
->lpGbl
->lpModeInfo
[0].wRefreshRate
;
437 This
->lpLcl
->lpGbl
->dwMonitorFrequency
= mHALInfo
.dwMonitorFrequency
;
438 This
->lpLcl
->lpGbl
->dwModeIndex
= mHALInfo
.dwModeIndex
;
439 This
->lpLcl
->lpGbl
->dwNumModes
= mHALInfo
.dwNumModes
;
440 This
->lpLcl
->lpGbl
->lpModeInfo
= mHALInfo
.lpModeInfo
;
441 This
->lpLcl
->lpGbl
->hInstance
= mHALInfo
.hInstance
;
443 This
->lpLcl
->lpGbl
->lp16DD
= This
->lpLcl
->lpGbl
;
446 memset(&DriverInfo
,0, sizeof(DDHAL_GETDRIVERINFODATA
));
447 DriverInfo
.dwSize
= sizeof(DDHAL_GETDRIVERINFODATA
);
448 DriverInfo
.dwContext
= This
->lpLcl
->lpGbl
->hDD
;
450 /* Get the MiscellaneousCallbacks */
451 DriverInfo
.guidInfo
= GUID_MiscellaneousCallbacks
;
452 DriverInfo
.lpvData
= &ddgbl
.lpDDCBtmp
->HALDDMiscellaneous
;
453 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS
);
454 mHALInfo
.GetDriverInfo(&DriverInfo
);
461 StartDirectDrawHel(LPDIRECTDRAW
* iface
)
463 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
465 This
->lpLcl
->lpDDCB
->HELDD
.CanCreateSurface
= HelDdCanCreateSurface
;
466 This
->lpLcl
->lpDDCB
->HELDD
.CreateSurface
= HelDdCreateSurface
;
467 This
->lpLcl
->lpDDCB
->HELDD
.CreatePalette
= HelDdCreatePalette
;
468 This
->lpLcl
->lpDDCB
->HELDD
.DestroyDriver
= HelDdDestroyDriver
;
469 //This->lpLcl->lpDDCB->HELDD.FlipToGDISurface = HelDdFlipToGDISurface
470 This
->lpLcl
->lpDDCB
->HELDD
.GetScanLine
= HelDdGetScanLine
;
471 // This->lpLcl->lpDDCB->HELDD.SetColorKey = HelDdSetColorKey;
472 This
->lpLcl
->lpDDCB
->HELDD
.SetExclusiveMode
= HelDdSetExclusiveMode
;
473 This
->lpLcl
->lpDDCB
->HELDD
.SetMode
= HelDdSetMode
;
474 This
->lpLcl
->lpDDCB
->HELDD
.WaitForVerticalBlank
= HelDdWaitForVerticalBlank
;
476 This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
= DDHAL_CB32_CANCREATESURFACE
|
477 DDHAL_CB32_CREATESURFACE
|
478 DDHAL_CB32_CREATEPALETTE
|
479 DDHAL_CB32_DESTROYDRIVER
|
480 // DDHAL_CB32_FLIPTOGDISURFACE |
481 DDHAL_CB32_GETSCANLINE
|
482 // DDHAL_CB32_SETCOLORKEY |
483 DDHAL_CB32_SETEXCLUSIVEMODE
|
485 DDHAL_CB32_WAITFORVERTICALBLANK
;
488 This
->lpLcl
->lpDDCB
->HELDD
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDD
);
491 This->lpLcl->lpDDCB->HELDDSurface.AddAttachedSurface = HelDdSurfAddAttachedSurface;
492 This->lpLcl->lpDDCB->HELDDSurface.Blt = HelDdSurfBlt;
493 This->lpLcl->lpDDCB->HELDDSurface.DestroySurface = HelDdSurfDestroySurface;
494 This->lpLcl->lpDDCB->HELDDSurface.Flip = HelDdSurfFlip;
495 This->lpLcl->lpDDCB->HELDDSurface.GetBltStatus = HelDdSurfGetBltStatus;
496 This->lpLcl->lpDDCB->HELDDSurface.GetFlipStatus = HelDdSurfGetFlipStatus;
497 This->lpLcl->lpDDCB->HELDDSurface.Lock = HelDdSurfLock;
498 This->lpLcl->lpDDCB->HELDDSurface.reserved4 = HelDdSurfreserved4;
499 This->lpLcl->lpDDCB->HELDDSurface.SetClipList = HelDdSurfSetClipList;
500 This->lpLcl->lpDDCB->HELDDSurface.SetColorKey = HelDdSurfSetColorKey;
501 This->lpLcl->lpDDCB->HELDDSurface.SetOverlayPosition = HelDdSurfSetOverlayPosition;
502 This->lpLcl->lpDDCB->HELDDSurface.SetPalette = HelDdSurfSetPalette;
503 This->lpLcl->lpDDCB->HELDDSurface.Unlock = HelDdSurfUnlock;
504 This->lpLcl->lpDDCB->HELDDSurface.UpdateOverlay = HelDdSurfUpdateOverlay;
508 This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
509 This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
510 This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette);
514 This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer = HelDdExeCanCreateExecuteBuffer;
515 This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer = HelDdExeCreateExecuteBuffer;
516 This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer = HelDdExeDestroyExecuteBuffer;
517 This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer = HelDdExeLockExecuteBuffer;
518 This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer = HelDdExeUnlockExecuteBuffer;
526 Create_DirectDraw (LPGUID pGUID
,
527 LPDIRECTDRAW
* pIface
,
531 LPDDRAWI_DIRECTDRAW_INT This
;
536 This
= DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT
));
539 return E_OUTOFMEMORY
;
542 This
->lpLcl
= DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT
));
544 if (This
->lpLcl
== NULL
)
547 return DDERR_OUTOFMEMORY
;
550 This
->lpLcl
->lpGbl
= &ddgbl
;
552 *pIface
= (LPDIRECTDRAW
)This
;
554 if(Main_DirectDraw_QueryInterface((LPDIRECTDRAW7
)This
, id
, (void**)&pIface
) != S_OK
)
556 return DDERR_INVALIDPARAMS
;
559 if (StartDirectDraw((LPDIRECTDRAW
*)This
, pGUID
) == DD_OK
);
565 return DDERR_INVALIDPARAMS
;