ReactOS 0.4.15-dev-7924-g5949c20
ddraw.c File Reference
#include <dxg_int.h>
Include dependency graph for ddraw.c:

Go to the source code of this file.

Functions

BOOL intDdGetDriverInfo (PEDD_DIRECTDRAW_GLOBAL peDdGl, GUID guid, PVOID callbackStruct, ULONG callbackSize, ULONG *returnSize)
 
VOID intDdGetAllDriverInfo (PEDD_DIRECTDRAW_GLOBAL peDdGl)
 
VOID intDdEnableDriver (PEDD_DIRECTDRAW_GLOBAL peDdGl)
 
PVOID FASTCALL intDdCreateDirectDrawLocal (HDEV hDev)
 
DWORD NTAPI DxDdCreateDirectDrawObject (HDC hDC)
 
DWORD NTAPI DxDdGetDriverInfo (HANDLE DdHandle, PDD_GETDRIVERINFODATA drvInfoData)
 
BOOL NTAPI DxDdQueryDirectDrawObject (HANDLE DdHandle, DD_HALINFO *pDdHalInfo, DWORD *pCallBackFlags, LPD3DNTHAL_CALLBACKS pd3dNtHalCallbacks, LPD3DNTHAL_GLOBALDRIVERDATA pd3dNtGlobalDriverData, PDD_D3DBUFCALLBACKS pd3dBufCallbacks, LPDDSURFACEDESC pTextureFormats, DWORD *p8, VIDEOMEMORY *p9, DWORD *pdwNumFourCC, DWORD *pdwFourCC)
 
BOOL NTAPI DxDdEnableDirectDraw (HANDLE hDev, BOOL arg2)
 
DWORD NTAPI DxDdReenableDirectDrawObject (HANDLE DdHandle, PVOID p2)
 
PEDD_SURFACE NTAPI intDdCreateNewSurfaceObject (PEDD_DIRECTDRAW_LOCAL peDdL, HANDLE hDirectDrawLocal, PDD_SURFACE_GLOBAL pDdSurfGlob, PDD_SURFACE_LOCAL pDdSurfLoc, PDD_SURFACE_MORE pDdSurfMore)
 
HANDLE NTAPI DxDdCreateSurfaceObject (HANDLE hDirectDrawLocal, HANDLE hSurface, PDD_SURFACE_LOCAL puSurfaceLocal, PDD_SURFACE_MORE puSurfaceMore, PDD_SURFACE_GLOBAL puSurfaceGlobal, BOOL bComplete)
 

Function Documentation

◆ DxDdCreateDirectDrawObject()

DWORD NTAPI DxDdCreateDirectDrawObject ( HDC  hDC)

Definition at line 258 of file ddraw.c.

260{
261 PDC pDC = NULL;
262 HDEV hDev = NULL;
263 DWORD_PTR retVal = 0;
264
266 if (!pDC)
267 return 0;
268
269 // get driver hDev from DC
270 hDev = (HDEV)gpEngFuncs.DxEngGetDCState(hDC, 3);
271 if (!hDev) {
273 return 0;
274 }
275
276 // is this primary display?
278 {
280 return 0;
281 }
282
284
285 // create object only for 8BPP and more
288
291 return retVal;
292}
static HDC hDC
Definition: 3dtext.c:33
#define NULL
Definition: types.h:112
@ DxEGShDevData_DitherFmt
Definition: dxeng.h:54
@ DxEGShDevData_display
Definition: dxeng.h:64
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
Definition: polytest.cpp:41
PFN_DxEngGetHdevData DxEngGetHdevData
Definition: dxg_int.h:142
PFN_DxEngLockDC DxEngLockDC
Definition: dxg_int.h:149
PFN_DxEngUnlockHdev DxEngUnlockHdev
Definition: dxg_int.h:133
PFN_DxEngGetDCState DxEngGetDCState
Definition: dxg_int.h:152
PFN_DxEngUnlockDC DxEngUnlockDC
Definition: dxg_int.h:150
PFN_DxEngLockHdev DxEngLockHdev
Definition: dxg_int.h:132
uint32_t DWORD_PTR
Definition: typedefs.h:65
PVOID FASTCALL intDdCreateDirectDrawLocal(HDEV hDev)
Definition: ddraw.c:210
#define BMF_8BPP
Definition: winddi.h:357

◆ DxDdCreateSurfaceObject()

HANDLE NTAPI DxDdCreateSurfaceObject ( HANDLE  hDirectDrawLocal,
HANDLE  hSurface,
PDD_SURFACE_LOCAL  puSurfaceLocal,
PDD_SURFACE_MORE  puSurfaceMore,
PDD_SURFACE_GLOBAL  puSurfaceGlobal,
BOOL  bComplete 
)

Definition at line 647 of file ddraw.c.

653{
654 HANDLE RetVal = FALSE;
656 PEDD_SURFACE pDdSurface = NULL;
657
658 peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(hDirectDrawLocal, ObjType_DDLOCAL_TYPE, FALSE);
659
660 if (!peDdL)
661 return RetVal;
662
663 pDdSurface = intDdCreateNewSurfaceObject(peDdL, hSurface, puSurfaceGlobal, puSurfaceLocal, puSurfaceMore);
664 if (!pDdSurface)
665 {
667 return RetVal;
668 }
669
670 RetVal = pDdSurface->pobj.hHmgr;
671
674
675 return RetVal;
676}
#define InterlockedDecrement
Definition: armddk.h:52
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
struct _EDD_DIRECTDRAW_LOCAL * PEDD_DIRECTDRAW_LOCAL
#define FALSE
Definition: types.h:117
#define ObjType_DDLOCAL_TYPE
Definition: dxg_int.h:51
USHORT cExclusiveLock
Definition: dxg_int.h:34
HGDIOBJ hHmgr
Definition: dxg_int.h:32
DD_BASEOBJECT pobj
Definition: directxint.h:16
DD_BASEOBJECT pobj
Definition: directxint.h:46
PEDD_SURFACE NTAPI intDdCreateNewSurfaceObject(PEDD_DIRECTDRAW_LOCAL peDdL, HANDLE hDirectDrawLocal, PDD_SURFACE_GLOBAL pDdSurfGlob, PDD_SURFACE_LOCAL pDdSurfLoc, PDD_SURFACE_MORE pDdSurfMore)
Definition: ddraw.c:588

◆ DxDdEnableDirectDraw()

BOOL NTAPI DxDdEnableDirectDraw ( HANDLE  hDev,
BOOL  arg2 
)

Definition at line 504 of file ddraw.c.

505{
507
509 {
511 peDdGl->hDev = hDev;
512 peDdGl->bSuspended = FALSE;
514 intDdEnableDriver(peDdGl);
515 return TRUE;
516 }
517
518 return FALSE;
519}
struct _EDD_DIRECTDRAW_GLOBAL * PEDD_DIRECTDRAW_GLOBAL
#define TRUE
Definition: types.h:120
@ DxEGShDevData_eddg
Definition: dxeng.h:59
@ DxEGShDevData_dhpdev
Definition: dxeng.h:58
void * PVOID
Definition: typedefs.h:50
VOID intDdEnableDriver(PEDD_DIRECTDRAW_GLOBAL peDdGl)
Definition: ddraw.c:131

◆ DxDdGetDriverInfo()

DWORD NTAPI DxDdGetDriverInfo ( HANDLE  DdHandle,
PDD_GETDRIVERINFODATA  drvInfoData 
)

Definition at line 309 of file ddraw.c.

310{
313 PVOID pInfo = NULL;
314 DWORD dwInfoSize = 0;
315 BYTE callbackStruct[1024];
316 DWORD RetVal = FALSE;
317
319 if (!peDdL)
320 return RetVal;
321
322 peDdGl = peDdL->peDirectDrawGlobal2;
323
324 // check VideoPort related callbacks
326 {
327 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCallbacks))
328 {
329 dwInfoSize = sizeof(DD_VIDEOPORTCALLBACKS);
330 pInfo = (VOID*)&peDdGl->ddVideoPortCallback;
331 }
332 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCaps))
333 {
334 pInfo = (VOID*)peDdGl->lpDDVideoPortCaps;
335 dwInfoSize = 72 * peDdGl->ddHalInfo.ddCaps.dwMaxVideoPorts;
336 }
337 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_D3DCallbacks3))
338 {
339 dwInfoSize = sizeof(D3DNTHAL_CALLBACKS3);
340 pInfo = (VOID*)&peDdGl->d3dNtHalCallbacks3;
341 }
342 }
343
344 // check ColorControl related callbacks
346 {
347 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_ColorControlCallbacks))
348 {
349 dwInfoSize = sizeof(DD_COLORCONTROLCALLBACKS);
350 pInfo = (VOID*)&peDdGl->ddColorControlCallbacks;
351 }
352 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_NTCallbacks))
353 {
354 dwInfoSize = sizeof(DD_NTCALLBACKS);
355 pInfo = (VOID*)&peDdGl->ddNtCallbacks;
356 }
357 }
358
359 // check Miscellaneous callbacks
361 {
362 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MiscellaneousCallbacks))
363 {
364 dwInfoSize = sizeof(DD_MISCELLANEOUSCALLBACKS);
365 pInfo = (VOID*)&peDdGl->ddMiscellanousCallbacks;
366 }
367 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreCaps))
368 {
369 dwInfoSize = sizeof(DD_MORECAPS);
370 pInfo = &peDdGl->ddMoreCaps;
371 }
372 }
373
375 InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_Miscellaneous2Callbacks))
376 {
377 dwInfoSize = sizeof(DD_MISCELLANEOUS2CALLBACKS);
378 pInfo = (VOID*)&peDdGl->ddMiscellanous2Callbacks;
379 }
380
382 InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MotionCompCallbacks))
383 {
384 dwInfoSize = sizeof(DD_MOTIONCOMPCALLBACKS);
385 pInfo = (VOID*)&peDdGl->ddMotionCompCallbacks;
386 }
387
388 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_KernelCaps) )
389 {
390 dwInfoSize = sizeof(DD_KERNELCALLBACKS);
391 pInfo = &peDdGl->ddKernelCaps;
392 }
393
394 if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreSurfaceCaps))
395 {
396 dwInfoSize = sizeof(DDMORESURFACECAPS);
397 pInfo = &peDdGl->ddMoreSurfaceCaps;
398 }
399
400 if (dwInfoSize && pInfo)
401 {
403 intDdGetDriverInfo(peDdGl, drvInfoData->guidInfo, &callbackStruct, dwInfoSize, &dwInfoSize);
405 memcpy(drvInfoData->lpvData, callbackStruct, dwInfoSize);
406 }
407
409
410 return TRUE;
411}
struct _D3DNTHAL_CALLBACKS3 D3DNTHAL_CALLBACKS3
struct _DDMORESURFACECAPS DDMORESURFACECAPS
struct _DD_MORECAPS DD_MORECAPS
struct _DD_COLORCONTROLCALLBACKS DD_COLORCONTROLCALLBACKS
struct _DD_MISCELLANEOUS2CALLBACKS DD_MISCELLANEOUS2CALLBACKS
struct _DD_NTCALLBACKS DD_NTCALLBACKS
#define EDDDGBL_MISCCALLBACKS
Definition: directxint.h:107
#define EDDDGBL_MISC2CALLBACKS
Definition: directxint.h:111
#define EDDDGBL_MOTIONCOMPCALLBACKS
Definition: directxint.h:110
#define EDDDGBL_COLORCONTROLCALLBACKS
Definition: directxint.h:109
#define EDDDGBL_VIDEOPORTCALLBACKS
Definition: directxint.h:108
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _DD_MISCELLANEOUSCALLBACKS DD_MISCELLANEOUSCALLBACKS
#define InlineIsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:142
DWORD dwMaxVideoPorts
Definition: ddrawint.h:1110
DDNTCORECAPS ddCaps
Definition: ddrawint.h:1126
DD_MORECAPS ddMoreCaps
Definition: directxint.h:158
DD_MISCELLANEOUSCALLBACKS ddMiscellanousCallbacks
Definition: directxint.h:168
DD_MOTIONCOMPCALLBACKS ddMotionCompCallbacks
Definition: directxint.h:174
DD_NTCALLBACKS ddNtCallbacks
Definition: directxint.h:170
DD_VIDEOPORTCALLBACKS ddVideoPortCallback
Definition: directxint.h:167
DDKERNELCAPS ddKernelCaps
Definition: directxint.h:157
DD_MISCELLANEOUS2CALLBACKS ddMiscellanous2Callbacks
Definition: directxint.h:169
DDMORESURFACECAPS ddMoreSurfaceCaps
Definition: directxint.h:175
DD_COLORCONTROLCALLBACKS ddColorControlCallbacks
Definition: directxint.h:171
D3DNTHAL_CALLBACKS3 d3dNtHalCallbacks3
Definition: directxint.h:173
LPDDVIDEOPORTCAPS lpDDVideoPortCaps
Definition: directxint.h:123
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
BOOL intDdGetDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl, GUID guid, PVOID callbackStruct, ULONG callbackSize, ULONG *returnSize)
Definition: ddraw.c:42
unsigned char BYTE
Definition: xxhash.c:193

◆ DxDdQueryDirectDrawObject()

BOOL NTAPI DxDdQueryDirectDrawObject ( HANDLE  DdHandle,
DD_HALINFO pDdHalInfo,
DWORD pCallBackFlags,
LPD3DNTHAL_CALLBACKS  pd3dNtHalCallbacks,
LPD3DNTHAL_GLOBALDRIVERDATA  pd3dNtGlobalDriverData,
PDD_D3DBUFCALLBACKS  pd3dBufCallbacks,
LPDDSURFACEDESC  pTextureFormats,
DWORD p8,
VIDEOMEMORY p9,
DWORD pdwNumFourCC,
DWORD pdwFourCC 
)

Definition at line 424 of file ddraw.c.

436{
439 BOOL RetVal = FALSE;
440
441 if (!DdHandle)
442 return RetVal;
443
444 if (!pDdHalInfo)
445 return RetVal;
446
448 return RetVal;
449
451 if (peDdL)
452 {
453 peDdGl = peDdL->peDirectDrawGlobal2;
455
456 memcpy(pDdHalInfo, &peDdGl->ddHalInfo, sizeof(DD_HALINFO));
457
458 if (pCallBackFlags)
459 {
460 *(DWORD*)pCallBackFlags = peDdGl->ddCallbacks.dwFlags;
461 *(DWORD*)((ULONG_PTR)pCallBackFlags + 4) = peDdGl->ddSurfaceCallbacks.dwFlags;
462 *(DWORD*)((ULONG_PTR)pCallBackFlags + 8) = peDdGl->ddPaletteCallbacks.dwFlags;
463 }
464
465 if (pd3dNtHalCallbacks)
466 memcpy(pd3dNtHalCallbacks, &peDdGl->d3dNtHalCallbacks, sizeof(peDdGl->d3dNtHalCallbacks));
467
468 if (pd3dNtGlobalDriverData)
469 memcpy(pd3dNtGlobalDriverData, &peDdGl->d3dNtGlobalDriverData, sizeof(peDdGl->d3dNtGlobalDriverData));
470
471 if (pd3dBufCallbacks)
472 memcpy(pd3dBufCallbacks, &peDdGl->d3dBufCallbacks, sizeof(peDdGl->d3dBufCallbacks));
473
474 if (pTextureFormats)
476
477 if (pdwNumFourCC)
478 *pdwNumFourCC = peDdGl->dwNumFourCC;
479
480 if (pdwFourCC)
481 memcpy(pdwFourCC, &peDdGl->pdwFourCC, 4 * peDdGl->dwNumFourCC);
482
483 RetVal = TRUE;
484
486
488 }
489
490 return RetVal;
491}
#define ULONG_PTR
Definition: config.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD dwFlags
Definition: ddrawint.h:499
LPDDSURFACEDESC lpTextureFormats
Definition: d3dnthal.h:132
PFN_DxEngScreenAccessCheck DxEngScreenAccessCheck
Definition: dxg_int.h:124
D3DNTHAL_GLOBALDRIVERDATA d3dNtGlobalDriverData
Definition: directxint.h:163
DD_D3DBUFCALLBACKS d3dBufCallbacks
Definition: directxint.h:165
DD_PALETTECALLBACKS ddPaletteCallbacks
Definition: directxint.h:162
DD_CALLBACKS ddCallbacks
Definition: directxint.h:160
D3DNTHAL_CALLBACKS d3dNtHalCallbacks
Definition: directxint.h:164
DD_SURFACECALLBACKS ddSurfaceCallbacks
Definition: directxint.h:161
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Out_ DD_HALINFO _Out_ DWORD _Out_ VIDEOMEMORY _Out_ DWORD _Out_ DWORD * pdwFourCC
Definition: winddi.h:4230

◆ DxDdReenableDirectDrawObject()

DWORD NTAPI DxDdReenableDirectDrawObject ( HANDLE  DdHandle,
PVOID  p2 
)

Definition at line 541 of file ddraw.c.

544{
547 HDC hDC;
548 DWORD RetVal = FALSE;
549
551
552 if (!peDdL)
553 return RetVal;
554
555 peDdGl = peDdL->peDirectDrawGlobal2;
556
558
561
562 if (peDdGl->fl & 1 &&
563 gpEngFuncs.DxEngGetDCState(hDC, 2) != 1 &&
568 {
569 // reset acceleration and suspend flags
570 peDdGl->fl &= 0xFFFFFFFD;
571 peDdGl->bSuspended = 0;
573
574 RetVal = TRUE;
575 // FIXME AGP Stuff
576 }
577
580
582
583 return RetVal;
584}
@ DxEGShDevData_OpenRefs
Definition: dxeng.h:66
@ DxEGShDevData_disable
Definition: dxeng.h:62
@ DxEGShDevData_dd_locks
Definition: dxeng.h:60
static HDC
Definition: imagelist.c:92
PFN_DxEngUnlockShareSem DxEngUnlockShareSem
Definition: dxg_int.h:130
PFN_DxEngGetDesktopDC DxEngGetDesktopDC
Definition: dxg_int.h:145
PFN_DxEngLockShareSem DxEngLockShareSem
Definition: dxg_int.h:129

◆ intDdCreateDirectDrawLocal()

PVOID FASTCALL intDdCreateDirectDrawLocal ( HDEV  hDev)

Definition at line 210 of file ddraw.c.

211{
214 PDD_ENTRY AllocRet;
215
217
219 if (!AllocRet)
220 return NULL;
221
222 peDdL = (PEDD_DIRECTDRAW_LOCAL)AllocRet->pobj;
223
224 /* initialize DIRECTDRAW_LOCAL */
227 peDdL->Process = PsGetCurrentProcess();
228
229 // link DirectDrawGlobal and DirectDrawLocal
230 peDdGl->peDirectDrawLocalList = peDdL;
231 peDdL->peDirectDrawGlobal = peDdGl;
232 peDdL->peDirectDrawGlobal2 = peDdGl;
233
235
237
238 return peDdL->pobj.hHmgr;
239}
HANDLE FASTCALL DdHmgAlloc(ULONG objSize, CHAR objType, BOOLEAN objLock)
Definition: ddhmg.c:340
HANDLE NTAPI PsGetCurrentThreadProcessId(VOID)
Definition: thread.c:755
Definition: dxg_int.h:58
PDD_BASEOBJECT pobj
Definition: dxg_int.h:61
PFN_DxEngReferenceHdev DxEngReferenceHdev
Definition: dxg_int.h:135
EDD_DIRECTDRAW_LOCAL * peDirectDrawLocalList
Definition: directxint.h:176
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal
Definition: directxint.h:17
struct _EDD_DIRECTDRAW_LOCAL * peDirectDrawLocal_prev
Definition: directxint.h:25
#define PsGetCurrentProcess
Definition: psfuncs.h:17

Referenced by DxDdCreateDirectDrawObject().

◆ intDdCreateNewSurfaceObject()

PEDD_SURFACE NTAPI intDdCreateNewSurfaceObject ( PEDD_DIRECTDRAW_LOCAL  peDdL,
HANDLE  hDirectDrawLocal,
PDD_SURFACE_GLOBAL  pDdSurfGlob,
PDD_SURFACE_LOCAL  pDdSurfLoc,
PDD_SURFACE_MORE  pDdSurfMore 
)

Definition at line 588 of file ddraw.c.

589{
591
592 // first check if we can assign it from current ddHandle
593 if (hDirectDrawLocal)
594 {
596 // check if surface is locked and belongs to correct DirectDrawLocal
597 if ((pSurface)&&((pSurface->peDirectDrawLocal != peDdL)||(!pSurface->hSecure)))
598 {
600 return NULL;
601 }
602 }
603
604 // if surface not found from ddHandle or ddHandle not provided
605 if (!pSurface)
606 {
607 // create new surface object
609 if (pSurface)
610 {
611 pSurface->ddsSurfaceLocal.lpGbl = &pSurface->ddsSurfaceGlobal;
612 pSurface->ddsSurfaceLocal.lpSurfMore = &pSurface->ddsSurfaceMore;
613 pSurface->ddsSurfaceInt.lpLcl = &pSurface->ddsSurfaceLocal;
614 pSurface->peDirectDrawLocal = peDdL;
615 pSurface->peDirectDrawGlobalNext = peDdL->peDirectDrawGlobal2;
616 pSurface->ldev = gpEngFuncs.DxEngGetHdevData(pSurface->peDirectDrawGlobalNext->hDev, DxEGShDevData_ldev);
617 pSurface->gdev = gpEngFuncs.DxEngGetHdevData(pSurface->peDirectDrawGlobalNext->hDev, DxEGShDevData_GDev);
618 pSurface->hSecure = (VOID*)1;
619 }
620 }
621
622 if (pSurface)
623 {
624 pSurface->ddsSurfaceGlobal.fpVidMem = pDdSurfGlob->fpVidMem;
625 pSurface->ddsSurfaceGlobal.lPitch = pDdSurfGlob->lPitch;
626 pSurface->ddsSurfaceGlobal.wWidth = pDdSurfGlob->wWidth;
627 pSurface->ddsSurfaceGlobal.wHeight = pDdSurfGlob->wHeight;
628 pSurface->wWidth = pDdSurfGlob->wWidth;
629 pSurface->wHeight = pDdSurfGlob->wHeight;
630 memcpy(&pSurface->ddsSurfaceGlobal.ddpfSurface, &pDdSurfGlob->ddpfSurface, sizeof(pSurface->ddsSurfaceGlobal.ddpfSurface));
631 pSurface->ddsSurfaceLocal.ddsCaps.dwCaps = pDdSurfLoc->ddsCaps.dwCaps;
632 pSurface->ddsSurfaceMore.ddsCapsEx.dwCaps2 = pDdSurfMore->ddsCapsEx.dwCaps2;
633 pSurface->ddsSurfaceMore.ddsCapsEx.dwCaps3 = pDdSurfMore->ddsCapsEx.dwCaps3;
634 pSurface->ddsSurfaceMore.ddsCapsEx.dwCaps4 = pDdSurfMore->ddsCapsEx.dwCaps4;
635 pSurface->ddsSurfaceMore.dwSurfaceHandle = pDdSurfMore->dwSurfaceHandle;
636 pSurface->hSecure = (VOID*)1;
637
638 peDdL->peSurface_DdList = pSurface;
639 peDdL->hSurface = (ULONG_PTR)pSurface->pobj.hHmgr;
640 }
641
642 return pSurface;
643}
struct _EDD_SURFACE * PEDD_SURFACE
@ DxEGShDevData_ldev
Definition: dxeng.h:68
@ DxEGShDevData_GDev
Definition: dxeng.h:69
#define ObjType_DDSURFACE_TYPE
Definition: dxg_int.h:52
DWORD dwCaps4
Definition: ddraw.h:1063
DWORD dwCaps3
Definition: ddraw.h:1060
DWORD dwCaps2
Definition: ddraw.h:1059
DWORD dwCaps
Definition: ddraw.h:727
DDPIXELFORMAT ddpfSurface
Definition: ddrawint.h:156
FLATPTR fpVidMem
Definition: ddrawint.h:146
DDSCAPS ddsCaps
Definition: ddrawint.h:174
DDSCAPSEX ddsCapsEx
Definition: ddrawint.h:165
DWORD dwSurfaceHandle
Definition: ddrawint.h:166
struct _EDD_SURFACE * peSurface_DdList
Definition: directxint.h:19
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481

Referenced by DxDdCreateSurfaceObject(), and intDdCreateSurfaceOrBuffer().

◆ intDdEnableDriver()

VOID intDdEnableDriver ( PEDD_DIRECTDRAW_GLOBAL  peDdGl)

Definition at line 131 of file ddraw.c.

132{
133 PDRIVER_FUNCTIONS DriverFunctions;
134 LPD3DNTHAL_GLOBALDRIVERDATA GlobalDriverData;
135 LPD3DNTHAL_CALLBACKS HalCallbacks;
136 PDD_D3DBUFCALLBACKS D3DBufCallbacks;
137
138
141
142 // check if driver has DirectDraw functions
143 if ((!DriverFunctions->GetDirectDrawInfo)||(!DriverFunctions->EnableDirectDraw)||(!DriverFunctions->DisableDirectDraw))
144 peDdGl->dhpdev = 0;
145
146
147 // reset acceleration flag
148 peDdGl->fl = peDdGl->fl & 0xFFFFFFFE;
149
150 // ask for structure sizes
151 if ((peDdGl->dhpdev)&&(DriverFunctions->GetDirectDrawInfo(peDdGl->dhpdev, &peDdGl->ddHalInfo, &peDdGl->dwNumHeaps, NULL, &peDdGl->dwNumFourCC, NULL)))
152 {
153 // allocate memory for DX data
154 if (peDdGl->dwNumHeaps)
156 if (peDdGl->dwNumFourCC)
158
159 // get data from driver
160 if (!DriverFunctions->GetDirectDrawInfo(peDdGl->dhpdev, &peDdGl->ddHalInfo, &peDdGl->dwNumHeaps, peDdGl->pvmList, &peDdGl->dwNumFourCC, peDdGl->pdwFourCC))
161 {
162 // failed - cleanup and exit
163 if (peDdGl->pvmList)
164 EngFreeMem(peDdGl->pvmList);
165 if (peDdGl->pdwFourCC)
166 EngFreeMem(peDdGl->pdwFourCC);
168 return;
169 }
170
171 // check if we can enable DirectDraw acceleration
172 if ((peDdGl->ddHalInfo.vmiData.pvPrimary) &&
173 (DriverFunctions->EnableDirectDraw(peDdGl->dhpdev, &peDdGl->ddCallbacks, &peDdGl->ddSurfaceCallbacks, &peDdGl->ddPaletteCallbacks))&&
175 (peDdGl->ddHalInfo.dwSize == sizeof(DD_HALINFO)))
176 {
177 GlobalDriverData = peDdGl->ddHalInfo.lpD3DGlobalDriverData;
178 HalCallbacks = peDdGl->ddHalInfo.lpD3DHALCallbacks;
179 D3DBufCallbacks = peDdGl->ddHalInfo.lpD3DHALCallbacks;
180
181 if (GlobalDriverData && GlobalDriverData->dwSize == sizeof(D3DNTHAL_GLOBALDRIVERDATA))
182 memcpy(&peDdGl->d3dNtGlobalDriverData, GlobalDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA));
183
184 if (HalCallbacks && HalCallbacks->dwSize == sizeof(D3DNTHAL_CALLBACKS))
185 memcpy(&peDdGl->d3dNtHalCallbacks, HalCallbacks, sizeof(D3DNTHAL_CALLBACKS));
186
187 if (D3DBufCallbacks && D3DBufCallbacks->dwSize == sizeof(DD_D3DBUFCALLBACKS))
188 memcpy(&peDdGl->d3dBufCallbacks, D3DBufCallbacks, sizeof(DD_D3DBUFCALLBACKS));
189
190 intDdGetAllDriverInfo(peDdGl);
191
192 // enable DirectDraw acceleration
193 peDdGl->fl |= 1;
194 }
195 else
196 {
197 // failed - cleanup and exit
198 if (peDdGl->pvmList)
199 EngFreeMem(peDdGl->pvmList);
200 if (peDdGl->pdwFourCC)
201 EngFreeMem(peDdGl->pdwFourCC);
202 }
203 }
204
206}
@ DxEGShDevData_DrvFuncs
Definition: dxeng.h:57
@ DxEGShDevData_dd_flags
Definition: dxeng.h:61
#define CapOver_DisableD3DAccel
Definition: dxg_int.h:47
if(dx< 0)
Definition: linetemp.h:194
struct _DRIVER_FUNCTIONS * PDRIVER_FUNCTIONS
#define EngFreeMem
Definition: polytest.cpp:56
#define FL_ZERO_MEMORY
Definition: polytest.cpp:58
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
DWORD dwSize
Definition: ddrawint.h:1124
PVOID lpD3DHALCallbacks
Definition: ddrawint.h:1130
PVOID lpD3DGlobalDriverData
Definition: ddrawint.h:1129
VIDEOMEMORYINFO vmiData
Definition: ddrawint.h:1125
PFN_DrvEnableDirectDraw EnableDirectDraw
Definition: ntgdityp.h:629
PFN_DrvDisableDirectDraw DisableDirectDraw
Definition: ntgdityp.h:630
PFN_DrvGetDirectDrawInfo GetDirectDrawInfo
Definition: ntgdityp.h:628
VIDEOMEMORY * pvmList
Definition: directxint.h:150
VOID intDdGetAllDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl)
Definition: ddraw.c:85
#define TAG_GDDV
Definition: tags.h:3
#define TAG_GDDF
Definition: tags.h:4

Referenced by DxDdEnableDirectDraw().

◆ intDdGetAllDriverInfo()

VOID intDdGetAllDriverInfo ( PEDD_DIRECTDRAW_GLOBAL  peDdGl)

Definition at line 85 of file ddraw.c.

86{
88 {
89 intDdGetDriverInfo(peDdGl, GUID_KernelCaps, &peDdGl->ddKernelCaps, sizeof(peDdGl->ddKernelCaps), 0);
90 intDdGetDriverInfo(peDdGl, GUID_KernelCallbacks, &peDdGl->ddKernelCallbacks, sizeof(peDdGl->ddKernelCallbacks), 0);
91
92 if (intDdGetDriverInfo(peDdGl, GUID_D3DCallbacks3, &peDdGl->d3dNtHalCallbacks3, sizeof(peDdGl->d3dNtHalCallbacks3), 0))
94
95 if (intDdGetDriverInfo(peDdGl, GUID_ColorControlCallbacks, &peDdGl->ddColorControlCallbacks, sizeof(peDdGl->ddColorControlCallbacks), 0))
97
98 if (intDdGetDriverInfo(peDdGl, GUID_MiscellaneousCallbacks, &peDdGl->ddMiscellanousCallbacks, sizeof(peDdGl->ddMiscellanousCallbacks), 0))
100
101 if (intDdGetDriverInfo(peDdGl, GUID_Miscellaneous2Callbacks, &peDdGl->ddMiscellanous2Callbacks, sizeof(peDdGl->ddMiscellanous2Callbacks), 0))
103
104 if (intDdGetDriverInfo(peDdGl, GUID_NTCallbacks, &peDdGl->ddNtCallbacks, sizeof(peDdGl->ddNtCallbacks), 0) )
106
107 if (intDdGetDriverInfo(peDdGl, GUID_DDMoreCaps, &peDdGl->ddMoreCaps, sizeof(peDdGl->ddMoreCaps), 0) )
109
110 if (intDdGetDriverInfo(peDdGl, GUID_NTPrivateDriverCaps, &peDdGl->ddNtPrivateDriverCaps, sizeof(peDdGl->ddNtPrivateDriverCaps), 0) )
112
113 if (intDdGetDriverInfo(peDdGl, GUID_MotionCompCallbacks, &peDdGl->ddMotionCompCallbacks, sizeof(peDdGl->ddMotionCompCallbacks), 0) )
115 }
116}
#define DDHALINFO_GETDRIVERINFOSET
Definition: ddrawi.h:667
#define EDDDGBL_PRIVATEDRIVERCAPS
Definition: directxint.h:115
#define EDDDGBL_DDMORECAPS
Definition: directxint.h:112
#define EDDDGBL_NTCALLBACKS
Definition: directxint.h:114
#define EDDDGBL_D3DCALLBACKS3
Definition: directxint.h:113
DWORD dwFlags
Definition: ddrawint.h:1128
PDD_GETDRIVERINFO GetDriverInfo
Definition: ddrawint.h:1127
DD_NTPRIVATEDRIVERCAPS ddNtPrivateDriverCaps
Definition: directxint.h:159
DD_KERNELCALLBACKS ddKernelCallbacks
Definition: directxint.h:172

Referenced by intDdEnableDriver().

◆ intDdGetDriverInfo()

BOOL intDdGetDriverInfo ( PEDD_DIRECTDRAW_GLOBAL  peDdGl,
GUID  guid,
PVOID  callbackStruct,
ULONG  callbackSize,
ULONG returnSize 
)

Definition at line 42 of file ddraw.c.

43{
44 DD_GETDRIVERINFODATA ddGetDriverInfoData;
45
47 {
48 memset(&ddGetDriverInfoData, 0, sizeof(DD_GETDRIVERINFODATA));
49 ddGetDriverInfoData.dwSize = sizeof(DD_GETDRIVERINFODATA);
50 ddGetDriverInfoData.dhpdev = peDdGl->dhpdev;
51 memcpy(&ddGetDriverInfoData.guidInfo, &guid, sizeof(GUID));
52 ddGetDriverInfoData.dwExpectedSize = callbackSize;
53 ddGetDriverInfoData.lpvData = callbackStruct;
54 ddGetDriverInfoData.ddRVal = DDERR_CURRENTLYNOTAVAIL;
55 if (peDdGl->ddHalInfo.GetDriverInfo(&ddGetDriverInfoData) && !ddGetDriverInfoData.ddRVal)
56 {
57 if (returnSize)
58 *returnSize = ddGetDriverInfoData.dwActualSize;
59 return TRUE;
60 }
61
62 }
63
64 /* cleanup on error */
65 memset(callbackStruct, 0, callbackSize);
66 if (returnSize)
67 *returnSize = 0;
68 return FALSE;
69}
const GUID * guid
struct _DD_GETDRIVERINFODATA DD_GETDRIVERINFODATA
#define DDERR_CURRENTLYNOTAVAIL
Definition: ddraw.h:70
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwExpectedSize
Definition: main.c:55
HRESULT ddRVal
Definition: main.c:58
DWORD dwActualSize
Definition: main.c:57

Referenced by DxDdGetDriverInfo(), and intDdGetAllDriverInfo().