2006-07-23 09:57:15 +00:00
|
|
|
/* $Id: main.c 21434 2006-04-01 19:12:56Z greatlrd $
|
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: lib/ddraw/ddraw.c
|
|
|
|
* PURPOSE: DirectDraw Library
|
|
|
|
* PROGRAMMER: Magnus Olsen (greatlrd)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include "rosdraw.h"
|
|
|
|
#include "d3dhal.h"
|
2006-11-28 20:22:02 +00:00
|
|
|
#include "ddrawgdi.h"
|
2006-07-23 09:57:15 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
DDRAWI_DIRECTDRAW_GBL ddgbl;
|
|
|
|
DDRAWI_DDRAWSURFACE_GBL ddSurfGbl;
|
|
|
|
|
2006-07-23 09:57:15 +00:00
|
|
|
|
|
|
|
HRESULT WINAPI
|
2006-11-19 19:13:35 +00:00
|
|
|
StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid)
|
2006-07-23 09:57:15 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
2006-12-03 17:54:25 +00:00
|
|
|
DWORD hal_ret = DD_FALSE;
|
|
|
|
DWORD hel_ret = DD_FALSE;
|
2006-07-23 09:57:15 +00:00
|
|
|
DEVMODE devmode;
|
|
|
|
HBITMAP hbmp;
|
|
|
|
const UINT bmiSize = sizeof(BITMAPINFOHEADER) + 0x10;
|
|
|
|
UCHAR *pbmiData;
|
|
|
|
BITMAPINFO *pbmi;
|
2006-11-19 19:13:35 +00:00
|
|
|
DWORD *pMasks;
|
|
|
|
INT devicetypes = 0;
|
2006-12-03 17:54:25 +00:00
|
|
|
DWORD dwFlags = 0;
|
2006-07-23 09:57:15 +00:00
|
|
|
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2006-12-02 18:59:05 +00:00
|
|
|
|
|
|
|
if (This->lpLink == NULL)
|
2006-11-19 19:13:35 +00:00
|
|
|
{
|
2006-12-03 15:42:12 +00:00
|
|
|
|
2006-12-02 18:59:05 +00:00
|
|
|
RtlZeroMemory(&ddgbl, sizeof(DDRAWI_DIRECTDRAW_GBL));
|
2006-12-03 15:42:12 +00:00
|
|
|
This->lpLcl->lpGbl->dwRefCnt++;
|
2006-12-02 18:59:05 +00:00
|
|
|
|
|
|
|
if (ddgbl.lpDDCBtmp == NULL)
|
|
|
|
{
|
|
|
|
ddgbl.lpDDCBtmp = (LPDDHAL_CALLBACKS) DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS));
|
|
|
|
if (ddgbl.lpDDCBtmp == NULL)
|
|
|
|
{
|
|
|
|
DX_STUB_str("Out of memmory");
|
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Visual studio think this code is a break point if we call
|
|
|
|
second time to this function, press on continue in visual
|
|
|
|
studio the program will work. No real bug. gcc 3.4.5 genreate
|
|
|
|
code that look like MS visual studio break point.
|
|
|
|
*/
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
This->lpLcl->lpDDCB = ddgbl.lpDDCBtmp;
|
2006-12-02 18:59:05 +00:00
|
|
|
|
2006-07-23 09:57:15 +00:00
|
|
|
/* Same for HEL and HAL */
|
|
|
|
|
2006-12-02 18:59:05 +00:00
|
|
|
if (ddgbl.lpModeInfo == NULL)
|
|
|
|
{
|
|
|
|
ddgbl.lpModeInfo = (DDHALMODEINFO*) DxHeapMemAlloc(1 * sizeof(DDHALMODEINFO));
|
|
|
|
if (ddgbl.lpModeInfo == NULL)
|
|
|
|
{
|
|
|
|
DX_STUB_str("DD_FALSE");
|
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-23 09:57:15 +00:00
|
|
|
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].dwWidth = devmode.dmPelsWidth;
|
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].dwHeight = devmode.dmPelsHeight;
|
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].dwBPP = devmode.dmBitsPerPel;
|
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].lPitch = (devmode.dmPelsWidth*devmode.dmBitsPerPel)/8;
|
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].wRefreshRate = (WORD)devmode.dmDisplayFrequency;
|
2006-07-23 09:57:15 +00:00
|
|
|
|
2006-12-03 09:12:35 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
if (lpGuid == NULL)
|
|
|
|
{
|
|
|
|
devicetypes = 1;
|
|
|
|
|
|
|
|
/* Create HDC for default, hal and hel driver */
|
|
|
|
This->lpLcl->hDC = (ULONG_PTR) CreateDCW(L"DISPLAY",L"DISPLAY",NULL,NULL);
|
|
|
|
|
|
|
|
/* cObsolete is undoc in msdn it being use in CreateDCA */
|
|
|
|
RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
|
|
|
|
RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
|
2006-12-03 17:54:25 +00:00
|
|
|
|
|
|
|
dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
|
2006-11-19 19:13:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if (lpGuid == (LPGUID) DDCREATE_HARDWAREONLY)
|
|
|
|
{
|
|
|
|
devicetypes = 2;
|
|
|
|
|
|
|
|
/* Create HDC for default, hal and hel driver */
|
|
|
|
This->lpLcl->hDC = (ULONG_PTR)CreateDCW(L"DISPLAY",L"DISPLAY",NULL,NULL);
|
|
|
|
|
|
|
|
/* cObsolete is undoc in msdn it being use in CreateDCA */
|
|
|
|
RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
|
|
|
|
RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
|
2006-12-03 17:54:25 +00:00
|
|
|
|
|
|
|
dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
|
2006-11-19 19:13:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if (lpGuid == (LPGUID) DDCREATE_EMULATIONONLY)
|
|
|
|
{
|
|
|
|
devicetypes = 3;
|
|
|
|
|
|
|
|
/* Create HDC for default, hal and hel driver */
|
|
|
|
This->lpLcl->hDC = (ULONG_PTR) CreateDCW(L"DISPLAY",L"DISPLAY",NULL,NULL);
|
|
|
|
|
|
|
|
/* cObsolete is undoc in msdn it being use in CreateDCA */
|
|
|
|
RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
|
|
|
|
RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
|
2006-12-03 17:54:25 +00:00
|
|
|
|
|
|
|
dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
|
2006-11-05 21:19:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* FIXME : need getting driver from the GUID that have been pass in from
|
|
|
|
the register. we do not support that yet
|
|
|
|
*/
|
2006-11-19 19:13:35 +00:00
|
|
|
devicetypes = 4;
|
|
|
|
This->lpLcl->hDC = (ULONG_PTR) NULL ;
|
2006-11-05 21:19:53 +00:00
|
|
|
}
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
if ( (HDC)This->lpLcl->hDC == NULL)
|
2006-07-23 09:57:15 +00:00
|
|
|
{
|
|
|
|
DX_STUB_str("DDERR_OUTOFMEMORY");
|
|
|
|
return DDERR_OUTOFMEMORY ;
|
|
|
|
}
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
hbmp = CreateCompatibleBitmap((HDC) This->lpLcl->hDC, 1, 1);
|
2006-07-23 09:57:15 +00:00
|
|
|
if (hbmp==NULL)
|
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC) This->lpLcl->hDC);
|
2006-07-23 09:57:15 +00:00
|
|
|
DX_STUB_str("DDERR_OUTOFMEMORY");
|
|
|
|
return DDERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
pbmiData = (UCHAR *) DxHeapMemAlloc(bmiSize);
|
|
|
|
pbmi = (BITMAPINFO*)pbmiData;
|
|
|
|
|
|
|
|
if (pbmiData==NULL)
|
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC) This->lpLcl->hDC);
|
2006-07-23 09:57:15 +00:00
|
|
|
DeleteObject(hbmp);
|
|
|
|
DX_STUB_str("DDERR_OUTOFMEMORY");
|
|
|
|
return DDERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
|
|
|
pbmi->bmiHeader.biBitCount = (WORD)devmode.dmBitsPerPel;
|
|
|
|
pbmi->bmiHeader.biCompression = BI_BITFIELDS;
|
|
|
|
pbmi->bmiHeader.biWidth = 1;
|
|
|
|
pbmi->bmiHeader.biHeight = 1;
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
GetDIBits((HDC) This->lpLcl->hDC, hbmp, 0, 0, NULL, pbmi, 0);
|
2006-07-23 09:57:15 +00:00
|
|
|
DeleteObject(hbmp);
|
|
|
|
|
|
|
|
pMasks = (DWORD*)(pbmiData + sizeof(BITMAPINFOHEADER));
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].dwRBitMask = pMasks[0];
|
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].dwGBitMask = pMasks[1];
|
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].dwBBitMask = pMasks[2];
|
|
|
|
This->lpLcl->lpGbl->lpModeInfo[0].dwAlphaBitMask = pMasks[3];
|
2006-07-23 09:57:15 +00:00
|
|
|
|
|
|
|
DxHeapMemFree(pbmiData);
|
|
|
|
|
|
|
|
/* Startup HEL and HAL */
|
2006-11-19 19:13:35 +00:00
|
|
|
// RtlZeroMemory(&ddgbl, sizeof(DDRAWI_DIRECTDRAW_GBL));
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB = This->lpLcl->lpGbl->lpDDCBtmp;
|
|
|
|
This->lpLcl->dwProcessId = GetCurrentProcessId();
|
2006-12-02 08:30:16 +00:00
|
|
|
|
2006-12-03 15:23:44 +00:00
|
|
|
switch (devicetypes)
|
|
|
|
{
|
|
|
|
case 2:
|
2006-12-03 17:54:25 +00:00
|
|
|
hal_ret = StartDirectDrawHal(iface);
|
|
|
|
This->lpLcl->lpDDCB->HELDD.dwFlags = 0;
|
2006-12-03 15:23:44 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2006-12-03 17:54:25 +00:00
|
|
|
hel_ret = StartDirectDrawHel(iface);
|
2006-12-03 15:23:44 +00:00
|
|
|
This->lpLcl->lpDDCB->HALDD.dwFlags = 0;
|
|
|
|
break;
|
2006-12-02 08:30:16 +00:00
|
|
|
|
2006-12-03 15:23:44 +00:00
|
|
|
default:
|
|
|
|
hal_ret = StartDirectDrawHal(iface);
|
|
|
|
hel_ret = StartDirectDrawHel(iface);
|
2006-12-03 17:54:25 +00:00
|
|
|
|
2006-12-03 15:23:44 +00:00
|
|
|
}
|
|
|
|
|
2006-12-03 17:54:25 +00:00
|
|
|
if (hal_ret!=DD_OK)
|
|
|
|
{
|
|
|
|
if (hel_ret!=DD_OK)
|
|
|
|
{
|
|
|
|
DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT");
|
|
|
|
return DDERR_NODIRECTDRAWSUPPORT;
|
|
|
|
}
|
|
|
|
dwFlags |= DDRAWI_NOHARDWARE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hel_ret!=DD_OK)
|
|
|
|
{
|
|
|
|
dwFlags |= DDRAWI_NOEMULATION;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dwFlags |= DDRAWI_EMULATIONINITIALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
This->lpLcl->lpGbl->dwFlags = dwFlags | DDRAWI_ATTACHEDTODESKTOP;
|
2006-07-23 09:57:15 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl->hDD = This->lpLcl->lpGbl->hDD;
|
2006-07-23 13:13:07 +00:00
|
|
|
|
2006-11-29 22:09:52 +00:00
|
|
|
/* Mix the DDCALLBACKS */
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwSize = sizeof(This->lpLcl->lpDDCB->cbDDCallbacks);
|
|
|
|
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CANCREATESURFACE) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CANCREATESURFACE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.CanCreateSurface = This->lpLcl->lpDDCB->HALDD.CanCreateSurface;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CANCREATESURFACE) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CANCREATESURFACE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.CanCreateSurface = This->lpLcl->lpDDCB->HELDD.CanCreateSurface;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CREATESURFACE) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATESURFACE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.CreateSurface = This->lpLcl->lpDDCB->HALDD.CreateSurface;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CREATESURFACE) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATESURFACE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.CreateSurface = This->lpLcl->lpDDCB->HELDD.CreateSurface;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CREATEPALETTE) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATEPALETTE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.CreatePalette = This->lpLcl->lpDDCB->HALDD.CreatePalette;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CREATEPALETTE) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATEPALETTE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.CreatePalette = This->lpLcl->lpDDCB->HELDD.CreatePalette;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_DESTROYDRIVER) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_DESTROYDRIVER;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.DestroyDriver = This->lpLcl->lpDDCB->HALDD.DestroyDriver;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_DESTROYDRIVER) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_DESTROYDRIVER;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.DestroyDriver = This->lpLcl->lpDDCB->HELDD.DestroyDriver;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_FLIPTOGDISURFACE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.FlipToGDISurface = This->lpLcl->lpDDCB->HALDD.FlipToGDISurface;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_FLIPTOGDISURFACE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.FlipToGDISurface = This->lpLcl->lpDDCB->HELDD.FlipToGDISurface;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_GETSCANLINE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.GetScanLine = This->lpLcl->lpDDCB->HALDD.GetScanLine;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_GETSCANLINE) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_GETSCANLINE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.GetScanLine = This->lpLcl->lpDDCB->HELDD.GetScanLine;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETCOLORKEY) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETCOLORKEY;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.SetColorKey = This->lpLcl->lpDDCB->HALDD.SetColorKey;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETCOLORKEY) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETCOLORKEY;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.SetColorKey = This->lpLcl->lpDDCB->HELDD.SetColorKey;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETEXCLUSIVEMODE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.SetExclusiveMode = This->lpLcl->lpDDCB->HALDD.SetExclusiveMode;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETEXCLUSIVEMODE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.SetExclusiveMode = This->lpLcl->lpDDCB->HELDD.SetExclusiveMode;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETMODE) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETMODE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.SetMode = This->lpLcl->lpDDCB->HALDD.SetMode;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETMODE) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETMODE;
|
2006-11-28 20:22:02 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.SetMode = This->lpLcl->lpDDCB->HELDD.SetMode;
|
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK) && (devicetypes !=3))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_WAITFORVERTICALBLANK;
|
2006-11-28 21:45:51 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.WaitForVerticalBlank =
|
|
|
|
This->lpLcl->lpDDCB->HALDD.WaitForVerticalBlank;
|
2006-11-28 20:22:02 +00:00
|
|
|
}
|
2006-11-28 21:45:51 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK) && (devicetypes !=2))
|
2006-11-28 20:22:02 +00:00
|
|
|
{
|
2006-11-28 21:28:12 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_WAITFORVERTICALBLANK;
|
2006-11-28 21:45:51 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDCallbacks.WaitForVerticalBlank =
|
|
|
|
This->lpLcl->lpDDCB->HELDD.WaitForVerticalBlank;
|
2006-11-28 20:22:02 +00:00
|
|
|
}
|
|
|
|
|
2006-11-29 18:51:04 +00:00
|
|
|
/* Mix the DDSURFACE CALLBACKS */
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwSize = sizeof(This->lpLcl->lpDDCB->cbDDSurfaceCallbacks);
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_ADDATTACHEDSURFACE) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_ADDATTACHEDSURFACE;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.AddAttachedSurface =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.AddAttachedSurface;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_ADDATTACHEDSURFACE) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_ADDATTACHEDSURFACE;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.AddAttachedSurface =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.AddAttachedSurface;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_BLT) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_BLT;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Blt =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.Blt;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_BLT) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_BLT;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Blt =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.Blt;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_DESTROYSURFACE) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_DESTROYSURFACE;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.DestroySurface =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.DestroySurface;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_DESTROYSURFACE) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_DESTROYSURFACE;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.DestroySurface =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.DestroySurface;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_FLIP) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_FLIP;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Flip =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.Flip;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_FLIP) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_FLIP;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Flip =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.Flip;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_GETBLTSTATUS) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_GETBLTSTATUS;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.GetBltStatus =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.GetBltStatus;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_GETBLTSTATUS) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_GETBLTSTATUS;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.GetBltStatus =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.GetBltStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_GETFLIPSTATUS) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_GETFLIPSTATUS;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.GetFlipStatus =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.GetFlipStatus;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_GETFLIPSTATUS) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_GETFLIPSTATUS;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.GetFlipStatus =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.GetFlipStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_LOCK) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_LOCK;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Lock =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.Lock;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_LOCK) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_LOCK;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Lock =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.Lock;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_RESERVED4) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_RESERVED4;
|
2006-11-28 21:28:12 +00:00
|
|
|
|
2006-11-29 18:51:04 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.reserved4 =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.reserved4;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_RESERVED4) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_RESERVED4;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.reserved4 =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.reserved4;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_SETCLIPLIST) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETCLIPLIST;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetClipList =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.SetClipList;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_SETCLIPLIST) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETCLIPLIST;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetClipList =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.SetClipList;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_SETCOLORKEY) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETCOLORKEY;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetColorKey =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.SetColorKey;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_SETCOLORKEY) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETCOLORKEY;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetColorKey =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.SetColorKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_SETOVERLAYPOSITION) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETOVERLAYPOSITION;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetOverlayPosition =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.SetOverlayPosition;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_SETOVERLAYPOSITION) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETOVERLAYPOSITION;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetOverlayPosition =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.SetOverlayPosition;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_SETPALETTE) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETPALETTE;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetPalette =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.SetPalette;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_SETPALETTE) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETPALETTE;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetPalette =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.SetPalette;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_UNLOCK) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_UNLOCK;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Unlock =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.Unlock;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_UNLOCK) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_UNLOCK;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Unlock =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.Unlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_UPDATEOVERLAY) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_UPDATEOVERLAY;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.UpdateOverlay =
|
|
|
|
This->lpLcl->lpDDCB->HALDDSurface.UpdateOverlay;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_UPDATEOVERLAY) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_UPDATEOVERLAY;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.UpdateOverlay =
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.UpdateOverlay;
|
|
|
|
}
|
|
|
|
|
2006-11-29 22:09:52 +00:00
|
|
|
/* Mix the DDPALETTE CALLBACKS */
|
|
|
|
This->lpLcl->lpDDCB->HALDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HALDDPalette);
|
2006-11-29 18:51:04 +00:00
|
|
|
|
2006-11-29 22:09:52 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDDPalette.dwFlags & DDHAL_PALCB32_DESTROYPALETTE) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDPaletteCallbacks.dwFlags |= DDHAL_PALCB32_SETENTRIES;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDPaletteCallbacks.DestroyPalette =
|
|
|
|
This->lpLcl->lpDDCB->HALDDPalette.DestroyPalette;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDPalette.dwFlags & DDHAL_PALCB32_DESTROYPALETTE) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDPaletteCallbacks.dwFlags |= DDHAL_PALCB32_DESTROYPALETTE;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDPaletteCallbacks.DestroyPalette =
|
|
|
|
This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->lpLcl->lpDDCB->HALDDPalette.dwFlags & DDHAL_PALCB32_SETENTRIES) && (devicetypes !=3))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDPaletteCallbacks.dwFlags |= DDHAL_PALCB32_SETENTRIES;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDPaletteCallbacks.SetEntries =
|
|
|
|
This->lpLcl->lpDDCB->HALDDPalette.SetEntries;
|
|
|
|
}
|
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDPalette.dwFlags & DDHAL_PALCB32_SETENTRIES) && (devicetypes !=2))
|
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDPaletteCallbacks.dwFlags |= DDHAL_PALCB32_SETENTRIES;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->cbDDPaletteCallbacks.SetEntries =
|
|
|
|
This->lpLcl->lpDDCB->HELDDPalette.SetEntries;
|
|
|
|
}
|
2006-11-28 21:28:12 +00:00
|
|
|
|
2006-11-29 18:51:04 +00:00
|
|
|
/* Mix the DDExeBuf CALLBACKS */
|
2006-11-29 22:09:52 +00:00
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwSize = sizeof(This->lpLcl->lpDDCB->cbDDExeBufCallbacks);
|
2006-11-29 18:51:04 +00:00
|
|
|
|
2006-11-29 19:12:06 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_CANCREATEEXEBUF) && (devicetypes !=3))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CanCreateExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HALDDExeBuf.CanCreateExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_CANCREATEEXEBUF;
|
|
|
|
}
|
2006-11-29 19:12:06 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_CANCREATEEXEBUF) && (devicetypes !=2))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CanCreateExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_CANCREATEEXEBUF;
|
|
|
|
}
|
2006-11-28 20:22:02 +00:00
|
|
|
|
2006-11-29 19:12:06 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_CREATEEXEBUF) && (devicetypes !=3))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CreateExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HALDDExeBuf.CreateExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_CREATEEXEBUF;
|
|
|
|
}
|
2006-11-29 19:12:06 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_CREATEEXEBUF) && (devicetypes !=2))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CreateExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_CREATEEXEBUF;
|
|
|
|
}
|
2006-11-28 20:22:02 +00:00
|
|
|
|
2006-11-29 19:12:06 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_DESTROYEXEBUF) && (devicetypes !=3))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.DestroyExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HALDDExeBuf.DestroyExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_DESTROYEXEBUF;
|
|
|
|
}
|
2006-11-29 19:12:06 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_DESTROYEXEBUF) && (devicetypes !=2))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.DestroyExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_DESTROYEXEBUF;
|
|
|
|
}
|
2006-11-19 19:13:35 +00:00
|
|
|
|
2006-11-29 19:12:06 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_LOCKEXEBUF) && (devicetypes !=3))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.LockExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HALDDExeBuf.LockExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_LOCKEXEBUF;
|
|
|
|
}
|
2006-11-29 19:12:06 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_LOCKEXEBUF) && (devicetypes !=2))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.LockExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_LOCKEXEBUF;
|
|
|
|
}
|
|
|
|
|
2006-11-29 19:12:06 +00:00
|
|
|
if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_UNLOCKEXEBUF) && (devicetypes !=3))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.UnlockExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HALDDExeBuf.UnlockExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_UNLOCKEXEBUF;
|
|
|
|
}
|
2006-11-29 19:12:06 +00:00
|
|
|
else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_UNLOCKEXEBUF) && (devicetypes !=2))
|
2006-11-28 21:28:12 +00:00
|
|
|
{
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.UnlockExecuteBuffer =
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_UNLOCKEXEBUF;
|
|
|
|
}
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
/* Fill some basic info for Surface */
|
|
|
|
ddSurfGbl.lpDD = &ddgbl;
|
|
|
|
|
2006-11-29 18:51:04 +00:00
|
|
|
/* FIXME
|
|
|
|
We need setup this also
|
|
|
|
This->lpLcl->lpDDCB->cbDDColorControlCallbacks
|
|
|
|
This->lpLcl->lpDDCB->cbDDKernelCallbacks
|
|
|
|
This->lpLcl->lpDDCB->cbDDMiscellaneousCallbacks
|
|
|
|
This->lpLcl->lpDDCB->cbDDMotionCompCallbacks
|
|
|
|
This->lpLcl->lpDDCB->cbDDVideoPortCallbacks
|
|
|
|
*/
|
|
|
|
|
2006-07-23 09:57:15 +00:00
|
|
|
return DD_OK;
|
|
|
|
}
|
|
|
|
|
2006-07-23 10:12:08 +00:00
|
|
|
|
|
|
|
HRESULT WINAPI
|
|
|
|
StartDirectDrawHal(LPDIRECTDRAW* iface)
|
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
2006-11-05 21:19:53 +00:00
|
|
|
DDHAL_GETDRIVERINFODATA DriverInfo;
|
2006-07-23 10:12:08 +00:00
|
|
|
|
2006-12-03 18:53:05 +00:00
|
|
|
DDHALINFO mHALInfo;
|
2006-11-19 19:13:35 +00:00
|
|
|
DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
|
|
|
|
D3DHAL_CALLBACKS mD3dCallbacks;
|
|
|
|
D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
|
|
|
|
UINT mcvmList;
|
|
|
|
VIDMEM *mpvmList;
|
|
|
|
|
|
|
|
UINT mcFourCC;
|
|
|
|
DWORD *mpFourCC;
|
|
|
|
UINT mcTextures;
|
|
|
|
DDSURFACEDESC *mpTextures;
|
|
|
|
|
2006-07-23 10:12:08 +00:00
|
|
|
/* HAL Startup process */
|
|
|
|
BOOL newmode = FALSE;
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO));
|
2006-12-03 18:53:05 +00:00
|
|
|
|
|
|
|
ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS));
|
|
|
|
if ( ddgbl.lpDDCBtmp == NULL)
|
|
|
|
{
|
|
|
|
return DD_FALSE;
|
|
|
|
}
|
2006-11-19 19:13:35 +00:00
|
|
|
|
2006-07-23 10:12:08 +00:00
|
|
|
/*
|
|
|
|
Startup DX HAL step one of three
|
|
|
|
*/
|
2006-11-19 19:13:35 +00:00
|
|
|
if (!DdCreateDirectDrawObject(This->lpLcl->lpGbl, (HDC)This->lpLcl->hDC))
|
2006-07-23 10:12:08 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC)This->lpLcl->hDC);
|
2006-07-23 10:12:08 +00:00
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do not relase HDC it have been map in kernel mode
|
|
|
|
// DeleteDC(hdc);
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
if (!DdReenableDirectDrawObject(This->lpLcl->lpGbl, &newmode))
|
2006-07-23 10:12:08 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC)This->lpLcl->hDC);
|
2006-07-23 10:12:08 +00:00
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Startup DX HAL step two of three
|
|
|
|
*/
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl,
|
|
|
|
&mHALInfo,
|
2006-12-03 18:53:05 +00:00
|
|
|
&ddgbl.lpDDCBtmp->HALDD,
|
|
|
|
&ddgbl.lpDDCBtmp->HALDDSurface,
|
|
|
|
&ddgbl.lpDDCBtmp->HALDDPalette,
|
2006-11-19 19:13:35 +00:00
|
|
|
&mD3dCallbacks,
|
|
|
|
&mD3dDriverData,
|
|
|
|
&mD3dBufferCallbacks,
|
2006-07-23 10:12:08 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL))
|
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC)This->lpLcl->hDC);
|
2006-07-23 10:12:08 +00:00
|
|
|
// FIXME Close DX fristcall and second call
|
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
mcvmList = mHALInfo.vmiData.dwNumHeaps;
|
|
|
|
mpvmList = (VIDMEM*) DxHeapMemAlloc(sizeof(VIDMEM) * mcvmList);
|
|
|
|
if (mpvmList == NULL)
|
2006-07-23 10:12:08 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC)This->lpLcl->hDC);
|
2006-07-23 10:12:08 +00:00
|
|
|
// FIXME Close DX fristcall and second call
|
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
mcFourCC = mHALInfo.ddCaps.dwNumFourCCCodes;
|
|
|
|
mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mcFourCC);
|
|
|
|
if (mpFourCC == NULL)
|
2006-07-23 10:12:08 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree(mpvmList);
|
|
|
|
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC)This->lpLcl->hDC);
|
2006-07-23 10:12:08 +00:00
|
|
|
// FIXME Close DX fristcall and second call
|
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
mcTextures = mD3dDriverData.dwNumTextureFormats;
|
|
|
|
mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mcTextures);
|
|
|
|
if (mpTextures == NULL)
|
2006-07-23 10:12:08 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree( mpFourCC);
|
|
|
|
DxHeapMemFree( mpvmList);
|
|
|
|
DxHeapMemFree( This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC)This->lpLcl->hDC);
|
2006-07-23 10:12:08 +00:00
|
|
|
// FIXME Close DX fristcall and second call
|
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
mHALInfo.vmiData.pvmList = mpvmList;
|
|
|
|
mHALInfo.lpdwFourCC = mpFourCC;
|
|
|
|
mD3dDriverData.lpTextureFormats = (DDSURFACEDESC*) mpTextures;
|
2006-07-23 10:12:08 +00:00
|
|
|
|
|
|
|
if (!DdQueryDirectDrawObject(
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl->lpGbl,
|
|
|
|
&mHALInfo,
|
2006-12-03 18:53:05 +00:00
|
|
|
&ddgbl.lpDDCBtmp->HALDD,
|
|
|
|
&ddgbl.lpDDCBtmp->HALDDSurface,
|
|
|
|
&ddgbl.lpDDCBtmp->HALDDPalette,
|
2006-11-19 19:13:35 +00:00
|
|
|
&mD3dCallbacks,
|
|
|
|
&mD3dDriverData,
|
2006-12-03 18:53:05 +00:00
|
|
|
&ddgbl.lpDDCBtmp->HALDDExeBuf,
|
2006-11-19 19:13:35 +00:00
|
|
|
(DDSURFACEDESC*)mpTextures,
|
|
|
|
mpFourCC,
|
|
|
|
mpvmList))
|
2006-07-23 10:12:08 +00:00
|
|
|
|
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
DxHeapMemFree(mpTextures);
|
|
|
|
DxHeapMemFree(mpFourCC);
|
|
|
|
DxHeapMemFree(mpvmList);
|
|
|
|
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
|
|
|
|
DeleteDC((HDC)This->lpLcl->hDC);
|
2006-07-23 10:12:08 +00:00
|
|
|
// FIXME Close DX fristcall and second call
|
|
|
|
return DD_FALSE;
|
|
|
|
}
|
|
|
|
|
2006-12-03 18:53:05 +00:00
|
|
|
|
2006-07-23 10:12:08 +00:00
|
|
|
/*
|
|
|
|
Copy over from HalInfo to DirectDrawGlobal
|
|
|
|
*/
|
|
|
|
|
|
|
|
// this is wrong, cDriverName need be in ASC code not UNICODE
|
|
|
|
//memcpy(mDDrawGlobal.cDriverName, mDisplayAdapter, sizeof(wchar)*MAX_DRIVER_NAME);
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));
|
|
|
|
memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS));
|
2006-07-23 10:12:08 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
mHALInfo.dwNumModes = 1;
|
|
|
|
mHALInfo.lpModeInfo = This->lpLcl->lpGbl->lpModeInfo;
|
|
|
|
mHALInfo.dwMonitorFrequency = This->lpLcl->lpGbl->lpModeInfo[0].wRefreshRate;
|
|
|
|
|
|
|
|
This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency;
|
|
|
|
This->lpLcl->lpGbl->dwModeIndex = mHALInfo.dwModeIndex;
|
|
|
|
This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes;
|
|
|
|
This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo;
|
|
|
|
This->lpLcl->lpGbl->hInstance = mHALInfo.hInstance;
|
|
|
|
|
|
|
|
This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl;
|
2006-07-23 10:12:08 +00:00
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
|
2006-07-23 10:12:08 +00:00
|
|
|
memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
|
|
|
|
DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
|
2006-11-19 19:13:35 +00:00
|
|
|
DriverInfo.dwContext = This->lpLcl->lpGbl->hDD;
|
2006-07-23 10:12:08 +00:00
|
|
|
|
|
|
|
/* Get the MiscellaneousCallbacks */
|
|
|
|
DriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
|
2006-11-19 19:13:35 +00:00
|
|
|
DriverInfo.lpvData = &ddgbl.lpDDCBtmp->HALDDMiscellaneous;
|
2006-07-23 10:12:08 +00:00
|
|
|
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
|
2006-11-19 19:13:35 +00:00
|
|
|
mHALInfo.GetDriverInfo(&DriverInfo);
|
|
|
|
|
2006-11-29 18:51:04 +00:00
|
|
|
|
|
|
|
/* FIXME
|
|
|
|
The 3d and private data are not save at moment
|
|
|
|
|
|
|
|
we need lest the private data being setup
|
|
|
|
for some driver are puting kmode memory there
|
|
|
|
the memory often contain the private struct +
|
|
|
|
surface, see MS DDK how MS example driver using
|
|
|
|
it
|
|
|
|
|
|
|
|
the 3d interface are not so improten if u do not
|
|
|
|
want the 3d, and we are not writing 3d code yet
|
|
|
|
so we be okay for now.
|
|
|
|
*/
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
|
2006-07-23 10:12:08 +00:00
|
|
|
return DD_OK;
|
|
|
|
}
|
|
|
|
|
2006-07-23 10:21:30 +00:00
|
|
|
HRESULT WINAPI
|
|
|
|
StartDirectDrawHel(LPDIRECTDRAW* iface)
|
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
2006-11-28 21:14:30 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl->lpDDCB->HELDD.CanCreateSurface = HelDdCanCreateSurface;
|
|
|
|
This->lpLcl->lpDDCB->HELDD.CreateSurface = HelDdCreateSurface;
|
|
|
|
This->lpLcl->lpDDCB->HELDD.CreatePalette = HelDdCreatePalette;
|
|
|
|
This->lpLcl->lpDDCB->HELDD.DestroyDriver = HelDdDestroyDriver;
|
2006-11-29 22:09:52 +00:00
|
|
|
This->lpLcl->lpDDCB->HELDD.FlipToGDISurface = HelDdFlipToGDISurface;
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl->lpDDCB->HELDD.GetScanLine = HelDdGetScanLine;
|
2006-11-30 21:04:09 +00:00
|
|
|
This->lpLcl->lpDDCB->HELDD.SetColorKey = HelDdSetColorKey;
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl->lpDDCB->HELDD.SetExclusiveMode = HelDdSetExclusiveMode;
|
|
|
|
This->lpLcl->lpDDCB->HELDD.SetMode = HelDdSetMode;
|
|
|
|
This->lpLcl->lpDDCB->HELDD.WaitForVerticalBlank = HelDdWaitForVerticalBlank;
|
|
|
|
|
2006-11-30 21:04:09 +00:00
|
|
|
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl->lpDDCB->HELDD.dwFlags = DDHAL_CB32_CANCREATESURFACE |
|
|
|
|
DDHAL_CB32_CREATESURFACE |
|
|
|
|
DDHAL_CB32_CREATEPALETTE |
|
|
|
|
DDHAL_CB32_DESTROYDRIVER |
|
2006-11-29 22:09:52 +00:00
|
|
|
DDHAL_CB32_FLIPTOGDISURFACE |
|
2006-11-19 19:13:35 +00:00
|
|
|
DDHAL_CB32_GETSCANLINE |
|
2006-11-30 21:04:09 +00:00
|
|
|
DDHAL_CB32_SETCOLORKEY |
|
2006-11-19 19:13:35 +00:00
|
|
|
DDHAL_CB32_SETEXCLUSIVEMODE |
|
|
|
|
DDHAL_CB32_SETMODE |
|
|
|
|
DDHAL_CB32_WAITFORVERTICALBLANK ;
|
2006-11-28 21:14:30 +00:00
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->HELDD.dwSize = sizeof(This->lpLcl->lpDDCB->HELDD);
|
2006-11-29 22:09:52 +00:00
|
|
|
|
2006-11-28 21:14:30 +00:00
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.AddAttachedSurface = HelDdSurfAddAttachedSurface;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.Blt = HelDdSurfBlt;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.DestroySurface = HelDdSurfDestroySurface;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.Flip = HelDdSurfFlip;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.GetBltStatus = HelDdSurfGetBltStatus;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.GetFlipStatus = HelDdSurfGetFlipStatus;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.Lock = HelDdSurfLock;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.reserved4 = HelDdSurfreserved4;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.SetClipList = HelDdSurfSetClipList;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.SetColorKey = HelDdSurfSetColorKey;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.SetOverlayPosition = HelDdSurfSetOverlayPosition;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.SetPalette = HelDdSurfSetPalette;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.Unlock = HelDdSurfUnlock;
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.UpdateOverlay = HelDdSurfUpdateOverlay;
|
2006-11-29 22:09:52 +00:00
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.dwFlags = DDHAL_SURFCB32_ADDATTACHEDSURFACE |
|
|
|
|
DDHAL_SURFCB32_BLT |
|
|
|
|
DDHAL_SURFCB32_DESTROYSURFACE |
|
|
|
|
DDHAL_SURFCB32_FLIP |
|
|
|
|
DDHAL_SURFCB32_GETBLTSTATUS |
|
|
|
|
DDHAL_SURFCB32_GETFLIPSTATUS |
|
|
|
|
DDHAL_SURFCB32_LOCK |
|
|
|
|
DDHAL_SURFCB32_RESERVED4 |
|
|
|
|
DDHAL_SURFCB32_SETCLIPLIST |
|
|
|
|
DDHAL_SURFCB32_SETCOLORKEY |
|
|
|
|
DDHAL_SURFCB32_SETOVERLAYPOSITION |
|
|
|
|
DDHAL_SURFCB32_SETPALETTE |
|
|
|
|
DDHAL_SURFCB32_UNLOCK |
|
|
|
|
DDHAL_SURFCB32_UPDATEOVERLAY;
|
|
|
|
|
|
|
|
This->lpLcl->lpDDCB->HELDDSurface.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDSurface);
|
|
|
|
|
2006-11-28 21:14:30 +00:00
|
|
|
/*
|
|
|
|
This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
|
|
|
|
This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
|
|
|
|
This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette);
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer = HelDdExeCanCreateExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer = HelDdExeCreateExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer = HelDdExeDestroyExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer = HelDdExeLockExecuteBuffer;
|
|
|
|
This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer = HelDdExeUnlockExecuteBuffer;
|
|
|
|
*/
|
2006-11-19 19:13:35 +00:00
|
|
|
|
2006-07-23 10:21:30 +00:00
|
|
|
return DD_OK;
|
|
|
|
}
|
|
|
|
|
2006-07-23 09:57:15 +00:00
|
|
|
HRESULT
|
|
|
|
WINAPI
|
|
|
|
Create_DirectDraw (LPGUID pGUID,
|
|
|
|
LPDIRECTDRAW* pIface,
|
|
|
|
REFIID id,
|
|
|
|
BOOL ex)
|
2006-12-02 13:37:55 +00:00
|
|
|
{
|
|
|
|
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
|
|
|
|
|
2006-07-23 09:57:15 +00:00
|
|
|
DX_WINDBG_trace();
|
2006-12-02 10:27:56 +00:00
|
|
|
|
|
|
|
if (!IsEqualGUID(&IID_IDirectDraw7, id))
|
|
|
|
{
|
|
|
|
return DDERR_INVALIDDIRECTDRAWGUID;
|
|
|
|
}
|
2006-12-02 13:37:55 +00:00
|
|
|
|
|
|
|
if (This == NULL)
|
|
|
|
{
|
|
|
|
/* We do not have any DirectDraw interface alloc */
|
|
|
|
This = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
|
|
|
|
if (This == NULL)
|
|
|
|
{
|
|
|
|
return DDERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2006-07-23 19:03:41 +00:00
|
|
|
{
|
2006-12-02 13:37:55 +00:00
|
|
|
/* We got the DirectDraw interface alloc and we need create the link */
|
2006-12-02 19:26:55 +00:00
|
|
|
|
|
|
|
LPDDRAWI_DIRECTDRAW_INT newThis;
|
2006-12-02 13:37:55 +00:00
|
|
|
newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
|
|
|
|
if (newThis == NULL)
|
|
|
|
{
|
|
|
|
return DDERR_OUTOFMEMORY;
|
|
|
|
}
|
2006-12-02 19:26:55 +00:00
|
|
|
|
|
|
|
/* we need check the GUID lpGUID what type it is */
|
|
|
|
if (pGUID != DDCREATE_HARDWAREONLY)
|
|
|
|
{
|
|
|
|
if (pGUID !=NULL)
|
|
|
|
{
|
|
|
|
This = newThis;
|
|
|
|
return DDERR_INVALIDDIRECTDRAWGUID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-02 13:37:55 +00:00
|
|
|
newThis->lpLink = This;
|
|
|
|
This = newThis;
|
2006-07-23 19:03:41 +00:00
|
|
|
}
|
2006-07-23 09:57:15 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
|
2006-11-05 21:19:53 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
if (This->lpLcl == NULL)
|
2006-11-05 21:19:53 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
/* FIXME cleanup */
|
|
|
|
return DDERR_OUTOFMEMORY;
|
2006-07-23 19:03:41 +00:00
|
|
|
}
|
2006-12-02 23:04:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
FIXME
|
|
|
|
read dwAppHackFlags flag from the system register instead for hard code it
|
|
|
|
*/
|
|
|
|
This->lpLcl->dwAppHackFlags = 0;
|
|
|
|
This->lpLcl->dwHotTracking = 0;
|
|
|
|
This->lpLcl->dwIMEState = 0;
|
2006-12-02 16:57:21 +00:00
|
|
|
This->lpLcl->dwLocalFlags = DDRAWILCL_DIRECTDRAW7;
|
2006-12-02 23:04:11 +00:00
|
|
|
This->lpLcl->dwLocalRefCnt = 0;
|
2006-12-03 00:17:56 +00:00
|
|
|
/*
|
|
|
|
do not rest this flag to NULL it need be unistae for some reason other wise
|
|
|
|
somet thing will crash dwObsolete1 seam being use for something this was a
|
|
|
|
supriese for me
|
|
|
|
*/
|
|
|
|
//This->lpLcl->dwObsolete1 = 0;
|
2006-12-02 23:04:11 +00:00
|
|
|
This->lpLcl->dwProcessId = 0;
|
|
|
|
This->lpLcl->dwUnused0 = 0;
|
|
|
|
This->lpLcl->hD3DInstance = NULL;
|
|
|
|
This->lpLcl->hDC = 0;
|
|
|
|
This->lpLcl->hDDVxd = 0;
|
|
|
|
This->lpLcl->hFocusWnd = 0;
|
|
|
|
This->lpLcl->hGammaCalibrator = 0;
|
2006-12-03 09:12:35 +00:00
|
|
|
/* Do mot inistate this value if we do we can not open the HAL interface */
|
|
|
|
//This->lpLcl->hWnd = 0;
|
2006-12-02 23:04:11 +00:00
|
|
|
This->lpLcl->hWndPopup = 0;
|
|
|
|
This->lpLcl->lpCB = NULL;
|
|
|
|
This->lpLcl->lpDDCB = NULL;
|
|
|
|
This->lpLcl->lpDDMore = 0;
|
|
|
|
This->lpLcl->lpGammaCalibrator = 0;
|
|
|
|
This->lpLcl->lpGbl = &ddgbl;
|
2006-12-03 09:12:35 +00:00
|
|
|
|
|
|
|
/* Do mot inistate this value if we do we can not open the HAL interface */
|
|
|
|
//This->lpLcl->lpPrimary = NULL;
|
2006-12-02 23:04:11 +00:00
|
|
|
This->lpLcl->pD3DIUnknown = NULL;
|
|
|
|
This->lpLcl->pUnkOuter = NULL;
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
*pIface = (LPDIRECTDRAW)This;
|
|
|
|
|
|
|
|
if(Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface) != S_OK)
|
|
|
|
{
|
2006-07-23 09:57:15 +00:00
|
|
|
return DDERR_INVALIDPARAMS;
|
|
|
|
}
|
2006-12-02 18:59:05 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
if (StartDirectDraw((LPDIRECTDRAW*)This, pGUID) == DD_OK);
|
2006-07-23 09:57:15 +00:00
|
|
|
{
|
2006-12-03 15:23:44 +00:00
|
|
|
|
2006-12-02 23:04:11 +00:00
|
|
|
This->lpLcl->hDD = ddgbl.hDD;
|
2006-11-28 20:52:22 +00:00
|
|
|
return DD_OK;
|
2006-11-19 19:13:35 +00:00
|
|
|
}
|
|
|
|
|
2006-07-23 09:57:15 +00:00
|
|
|
return DDERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
|