mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
Unlock all file no of these file have been revers.
Correct The HAL startup process thanks to Steffen Schulze to solv it He is working with close software He have wrote complete MoComp to us but am waiting with to commit that interface. Rember all code he have done is being use in close source apps and thuse apps will stay close source. In his source code overlay surface is working fine. This is frist step to correct HAL. Now we need fix the CreateSurface process. svn path=/trunk/; revision=21434
This commit is contained in:
parent
b5c963889c
commit
e04f8d9c80
11 changed files with 556 additions and 503 deletions
|
@ -14,295 +14,311 @@
|
|||
HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
/* point to it self */
|
||||
This->DirectDrawGlobal.lp16DD = &This->DirectDrawGlobal;
|
||||
|
||||
/* get the object */
|
||||
if(!DdCreateDirectDrawObject (&This->DirectDrawGlobal, (HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC ))
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
/* alloc all the space */
|
||||
This->DirectDrawGlobal.lpDDCBtmp = (LPDDHAL_CALLBACKS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DDHAL_CALLBACKS));
|
||||
/* HAL Startup process */
|
||||
DEVMODE devmode;
|
||||
HBITMAP hbmp;
|
||||
const UINT bmiSize = sizeof(BITMAPINFOHEADER) + 0x10;
|
||||
UCHAR *pbmiData;
|
||||
BITMAPINFO *pbmi;
|
||||
DWORD *pMasks;
|
||||
BOOL newmode = FALSE;
|
||||
|
||||
/*
|
||||
Get Display mode res and caps
|
||||
We need fill the mDDrawGlobal
|
||||
vmidata struct right
|
||||
|
||||
This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
|
||||
sizeof(D3DHAL_CALLBACKS));
|
||||
|
||||
This->DirectDrawGlobal.lpD3DGlobalDriverData = (ULONG_PTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(D3DHAL_GLOBALDRIVERDATA));
|
||||
|
||||
/* Fill in some info */
|
||||
This->HalInfo.lpD3DGlobalDriverData = This->DirectDrawGlobal.lpD3DGlobalDriverData;
|
||||
This->HalInfo.lpD3DHALCallbacks = This->DirectDrawGlobal.lpD3DHALCallbacks;
|
||||
This->HalInfo.lpDDCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDD;
|
||||
This->HalInfo.lpDDExeBufCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf;
|
||||
This->HalInfo.lpDDPaletteCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDPalette;
|
||||
This->HalInfo.lpDDSurfaceCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface;
|
||||
|
||||
/* query all kinds of infos from the driver */
|
||||
if(!DdQueryDirectDrawObject (
|
||||
&This->DirectDrawGlobal,
|
||||
&This->HalInfo,
|
||||
This->HalInfo.lpDDCallbacks,
|
||||
This->HalInfo.lpDDSurfaceCallbacks,
|
||||
This->HalInfo.lpDDPaletteCallbacks,
|
||||
(LPD3DHAL_CALLBACKS)This->DirectDrawGlobal.lpD3DHALCallbacks,
|
||||
(LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData,
|
||||
This->HalInfo.lpDDExeBufCallbacks,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL ))
|
||||
{
|
||||
return DD_FALSE;
|
||||
this code is from Steffen Schulze
|
||||
1. Add the mpModeInfos to inisate
|
||||
*/
|
||||
This->mcModeInfos = 1;
|
||||
This->mpModeInfos = (DDHALMODEINFO*) DxHeapMemAlloc(This->mcModeInfos * sizeof(DDHALMODEINFO));
|
||||
|
||||
if (This->mpModeInfos == NULL)
|
||||
{
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
This->HalInfo.vmiData.pvmList = (LPVIDMEM) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps);
|
||||
|
||||
This->DirectDrawGlobal.lpdwFourCC = (DWORD *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DWORD) * This->HalInfo.ddCaps.dwNumFourCCCodes);
|
||||
((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats =
|
||||
(LPDDSURFACEDESC) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DDSURFACEDESC) *
|
||||
((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->dwNumTextureFormats);
|
||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
|
||||
|
||||
if(!DdQueryDirectDrawObject (
|
||||
&This->DirectDrawGlobal,
|
||||
&This->HalInfo,
|
||||
This->HalInfo.lpDDCallbacks,
|
||||
This->HalInfo.lpDDSurfaceCallbacks,
|
||||
This->HalInfo.lpDDPaletteCallbacks,
|
||||
(LPD3DHAL_CALLBACKS)This->DirectDrawGlobal.lpD3DHALCallbacks,
|
||||
(LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData,
|
||||
This->HalInfo.lpDDExeBufCallbacks,
|
||||
((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats,
|
||||
This->DirectDrawGlobal.lpdwFourCC,
|
||||
This->HalInfo.vmiData.pvmList
|
||||
))
|
||||
{
|
||||
return DD_FALSE;
|
||||
This->mpModeInfos[0].dwWidth = devmode.dmPelsWidth;
|
||||
This->mpModeInfos[0].dwHeight = devmode.dmPelsHeight;
|
||||
This->mpModeInfos[0].dwBPP = devmode.dmBitsPerPel;
|
||||
This->mpModeInfos[0].lPitch = (devmode.dmPelsWidth*devmode.dmBitsPerPel)/8;
|
||||
This->mpModeInfos[0].wRefreshRate = (WORD)devmode.dmDisplayFrequency;
|
||||
|
||||
/*
|
||||
Create HDC
|
||||
we need it for doing the Call to GdiEntry1
|
||||
*/
|
||||
This->hdc = CreateDCW(L"DISPLAY",L"DISPLAY",NULL,NULL);
|
||||
|
||||
if (This->hdc == NULL)
|
||||
{
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
/* Copy HalInfo to DirectDrawGlobal (Not complete)*/
|
||||
RtlCopyMemory(&This->DirectDrawGlobal.vmiData,&This->HalInfo.vmiData,sizeof(VIDMEMINFO));
|
||||
RtlCopyMemory(&This->DirectDrawGlobal.ddCaps,&This->HalInfo.ddCaps,sizeof(DDCORECAPS));
|
||||
This->DirectDrawGlobal.dwMonitorFrequency = This->HalInfo.dwMonitorFrequency;
|
||||
|
||||
This->DirectDrawGlobal.dwModeIndex = This->HalInfo.dwModeIndex;
|
||||
This->DirectDrawGlobal.dwNumModes = This->HalInfo.dwNumModes;
|
||||
This->DirectDrawGlobal.lpModeInfo = This->HalInfo.lpModeInfo;
|
||||
|
||||
/* Unsure which of these two for lpPDevice
|
||||
This->DirectDrawGlobal.dwPDevice = This->HalInfo.lpPDevice;
|
||||
This->lpDriverHandle = This->HalInfo.lpPDevice;
|
||||
*/
|
||||
This->DirectDrawGlobal.hInstance = This->HalInfo.hInstance;
|
||||
RtlCopyMemory(&This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf,
|
||||
&This->HalInfo.lpDDExeBufCallbacks,sizeof(DDHAL_DDEXEBUFCALLBACKS));
|
||||
|
||||
/************************************************************************/
|
||||
/* Set up the rest of the callbacks all callbacks we get back from */
|
||||
/* gdi32.dll is user mode */
|
||||
/************************************************************************/
|
||||
|
||||
/* Todo add a check see if HalInfo.GetDriverInfo is supported or not */
|
||||
/* Do not trust msdn what it say about dwContext it is not in use for
|
||||
windows nt, it is in use for all os, and it always pont to
|
||||
DirectDrawGlobal.hDD */
|
||||
|
||||
/* FIXME add all callback that have been commect out to gpl */
|
||||
/* FIXME free the memmor that being alloc when ddraw.dll exists */
|
||||
/* FIXME add check for DriverInfo if the handle or not */
|
||||
|
||||
DDHAL_GETDRIVERINFODATA DriverInfo;
|
||||
memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
|
||||
DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
|
||||
DriverInfo.dwContext = This->DirectDrawGlobal.hDD;
|
||||
|
||||
/* Get ColorControlCallbacks */
|
||||
DriverInfo.guidInfo = GUID_ColorControlCallbacks;
|
||||
DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDColorControl;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDCOLORCONTROLCALLBACKS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the GUID_D3DCallbacks callback */
|
||||
/* Problem with include files
|
||||
DDHAL_DDMISCELLANEOUSCALLBACKS misc;
|
||||
DriverInfo.guidInfo = GUID_D3DCallbacks;
|
||||
DriverInfo.lpvData = &misc;
|
||||
DriverInfo.dwExpectedSize = sizeof();
|
||||
This->HalInfo.GetDriverInfo( &DriverInfo);*/
|
||||
|
||||
/* Get the D3DCallbacks2 */
|
||||
This->DirectDrawGlobal.lpD3DHALCallbacks2 = (ULONG_PTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(D3DHAL_CALLBACKS2));
|
||||
DriverInfo.guidInfo = GUID_D3DCallbacks2;
|
||||
DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks2;
|
||||
DriverInfo.dwExpectedSize = sizeof(D3DHAL_CALLBACKS2);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
|
||||
/* Get the D3DCallbacks3 */
|
||||
This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(D3DHAL_CALLBACKS3));
|
||||
DriverInfo.guidInfo = GUID_D3DCallbacks3;
|
||||
DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks;
|
||||
DriverInfo.dwExpectedSize = sizeof(D3DHAL_CALLBACKS3);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the misc callback */
|
||||
/* Problem with include files
|
||||
DriverInfo.guidInfo = GUID_D3DCaps;
|
||||
DriverInfo.lpvData = &misc;
|
||||
DriverInfo.dwExpectedSize = sizeof();
|
||||
This->HalInfo.GetDriverInfo( &DriverInfo);
|
||||
*/
|
||||
|
||||
/* Get the D3DExtendedCaps */
|
||||
|
||||
This->DirectDrawGlobal.lpD3DExtendedCaps = (ULONG_PTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(D3DHAL_D3DEXTENDEDCAPS));
|
||||
DriverInfo.guidInfo = GUID_D3DExtendedCaps;
|
||||
DriverInfo.lpvData = (PVOID) This->DirectDrawGlobal.lpD3DExtendedCaps;
|
||||
DriverInfo.dwExpectedSize = sizeof(D3DHAL_D3DEXTENDEDCAPS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the D3DParseUnknownCommandCallback */
|
||||
/* D3dDrawPrimitives2 callback where should it be fill in
|
||||
DriverInfo.guidInfo = GUID_D3DParseUnknownCommandCallback;
|
||||
DriverInfo.lpvData = &misc;
|
||||
DriverInfo.dwExpectedSize = sizeof();
|
||||
This->HalInfo.GetDriverInfo( &DriverInfo);
|
||||
*/
|
||||
|
||||
/* Get the GetHeapAlignment */
|
||||
/* where should it be fill in
|
||||
DriverInfo.guidInfo = GUID_GetHeapAlignment;
|
||||
DriverInfo.lpvData = &misc;
|
||||
DriverInfo.dwExpectedSize = sizeof();
|
||||
This->HalInfo.GetDriverInfo( &DriverInfo);
|
||||
*/
|
||||
|
||||
/* Get the KernelCallbacks */
|
||||
DriverInfo.guidInfo = GUID_KernelCallbacks;
|
||||
DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDKernel;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDKERNELCALLBACKS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the KernelCaps */
|
||||
This->DirectDrawGlobal.lpDDKernelCaps = (LPDDKERNELCAPS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DDHAL_DDKERNELCALLBACKS));
|
||||
DriverInfo.guidInfo = GUID_KernelCaps;
|
||||
DriverInfo.lpvData = (PVOID) This->DirectDrawGlobal.lpDDKernelCaps;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDKERNELCALLBACKS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the MiscellaneousCallbacks */
|
||||
DriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
|
||||
DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the Miscellaneous2Callbacks */
|
||||
/* Not in the DDRAWI_DIRECTDRAW_GBL we map it up as private
|
||||
Contain CreatesurfaceEx and other nice callbacks */
|
||||
DriverInfo.guidInfo = GUID_Miscellaneous2Callbacks;
|
||||
DriverInfo.lpvData = &This->Misc2Callback;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the MotionCompCallbacks */
|
||||
DriverInfo.guidInfo = GUID_MotionCompCallbacks;
|
||||
DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDMotionComp;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMOTIONCOMPCALLBACKS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the NonLocalVidMemCaps */
|
||||
This->DirectDrawGlobal.lpddNLVCaps = (LPDDNONLOCALVIDMEMCAPS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DDNONLOCALVIDMEMCAPS));
|
||||
DriverInfo.guidInfo = GUID_NonLocalVidMemCaps;
|
||||
DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpddNLVCaps;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDNONLOCALVIDMEMCAPS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the NTCallbacks */
|
||||
/* Fill in wher
|
||||
DriverInfo.guidInfo = GUID_NTCallbacks;
|
||||
DriverInfo.lpvData = &misc;
|
||||
DriverInfo.dwExpectedSize = sizeof();
|
||||
This->HalInfo.GetDriverInfo( &DriverInfo);
|
||||
*/
|
||||
|
||||
/* Get the NTPrivateDriverCaps */
|
||||
/* Fill in wher
|
||||
DriverInfo.guidInfo = GUID_NTPrivateDriverCaps;
|
||||
DriverInfo.lpvData = &misc;
|
||||
DriverInfo.dwExpectedSize = sizeof();
|
||||
This->HalInfo.GetDriverInfo( &DriverInfo);
|
||||
*/
|
||||
|
||||
/* Get the UpdateNonLocalHeap */
|
||||
/* Fill in where
|
||||
DriverInfo.guidInfo = GUID_UpdateNonLocalHeap;
|
||||
DriverInfo.lpvData = &misc;
|
||||
DriverInfo.dwExpectedSize = sizeof();
|
||||
This->HalInfo.GetDriverInfo( &DriverInfo);
|
||||
*/
|
||||
|
||||
/* Get the VideoPortCallbacks */
|
||||
DriverInfo.guidInfo = GUID_VideoPortCallbacks;
|
||||
DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDVideoPort;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDVIDEOPORTCALLBACKS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the VideoPortCaps */
|
||||
This->DirectDrawGlobal.lpDDVideoPortCaps = (LPDDVIDEOPORTCAPS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DDVIDEOPORTCAPS));
|
||||
DriverInfo.guidInfo = GUID_VideoPortCaps;
|
||||
DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpDDVideoPortCaps;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDVIDEOPORTCAPS);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
|
||||
/* Get the ZPixelFormats */
|
||||
/* take off this it until we figout how lpexluisev should be fild in
|
||||
This->DirectDrawGlobal.lpZPixelFormats = (LPDDPIXELFORMAT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DDPIXELFORMAT) * This->DirectDrawGlobal.dwNumZPixelFormats);
|
||||
DriverInfo.guidInfo = GUID_ZPixelFormats;
|
||||
DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpZPixelFormats;
|
||||
DriverInfo.dwExpectedSize = sizeof(DDPIXELFORMAT);
|
||||
This->HalInfo.GetDriverInfo(&DriverInfo);
|
||||
/* Do not release HDC it is mapen in kernel mode
|
||||
we can only release it at exit of ddraw.dll
|
||||
*/
|
||||
|
||||
/* Setup some info from the callbacks we got */
|
||||
DDHAL_GETAVAILDRIVERMEMORYDATA mem;
|
||||
mem.lpDD = &This->DirectDrawGlobal;
|
||||
This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem);
|
||||
This->DirectDrawGlobal.ddCaps.dwVidMemFree = mem.dwFree;
|
||||
This->DirectDrawGlobal.ddCaps.dwVidMemTotal = mem.dwTotal;
|
||||
|
||||
BOOL dummy = TRUE;
|
||||
DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
|
||||
|
||||
/* Now all setup for HAL is done */
|
||||
return DD_OK;
|
||||
/*
|
||||
Dectect RGB bit mask
|
||||
this code is from Steffen Schulze
|
||||
why it need I do not know yet but it
|
||||
will allown us to create any type of
|
||||
surface later
|
||||
*/
|
||||
|
||||
hbmp = CreateCompatibleBitmap(This->hdc, 1, 1);
|
||||
if (hbmp==NULL)
|
||||
{
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
pbmiData = (UCHAR *) DxHeapMemAlloc(bmiSize);
|
||||
pbmi = (BITMAPINFO*)pbmiData;
|
||||
|
||||
if (pbmiData==NULL)
|
||||
{
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
DeleteObject(hbmp);
|
||||
return DDERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
pbmi->bmiHeader.biBitCount = (WORD)devmode.dmBitsPerPel;
|
||||
pbmi->bmiHeader.biCompression = BI_BITFIELDS;
|
||||
pbmi->bmiHeader.biWidth = 1;
|
||||
pbmi->bmiHeader.biHeight = 1;
|
||||
|
||||
GetDIBits(This->hdc, hbmp, 0, 0, NULL, pbmi, 0);
|
||||
DeleteObject(hbmp);
|
||||
|
||||
pMasks = (DWORD*)(pbmiData + sizeof(BITMAPINFOHEADER));
|
||||
This->mpModeInfos[0].dwRBitMask = pMasks[0];
|
||||
This->mpModeInfos[0].dwGBitMask = pMasks[1];
|
||||
This->mpModeInfos[0].dwBBitMask = pMasks[2];
|
||||
This->mpModeInfos[0].dwAlphaBitMask = pMasks[3];
|
||||
|
||||
DxHeapMemFree(pbmiData);
|
||||
|
||||
/*
|
||||
prepare start up the DX Draw HAL interface now
|
||||
*/
|
||||
|
||||
memset(&This->mDDrawGlobal, 0, sizeof(DDRAWI_DIRECTDRAW_GBL));
|
||||
memset(&This->mHALInfo, 0, sizeof(DDHALINFO));
|
||||
memset(&This->mCallbacks, 0, sizeof(DDHAL_CALLBACKS));
|
||||
|
||||
/*
|
||||
Startup DX HAL step one of three
|
||||
*/
|
||||
if (!DdCreateDirectDrawObject(&This->mDDrawGlobal, This->hdc))
|
||||
{
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
DeleteObject(hbmp);
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
// Do not relase HDC it have been map in kernel mode
|
||||
// DeleteDC(hdc);
|
||||
|
||||
if (!DdReenableDirectDrawObject(&This->mDDrawGlobal, &newmode))
|
||||
{
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
DeleteObject(hbmp);
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
Setup the DirectDraw Local
|
||||
*/
|
||||
|
||||
This->mDDrawLocal.lpDDCB = &This->mCallbacks;
|
||||
This->mDDrawLocal.lpGbl = &This->mDDrawGlobal;
|
||||
This->mDDrawLocal.dwProcessId = GetCurrentProcessId();
|
||||
|
||||
This->mDDrawGlobal.lpDDCBtmp = &This->mCallbacks;
|
||||
This->mDDrawGlobal.lpExclusiveOwner = &This->mDDrawLocal;
|
||||
|
||||
/*
|
||||
Startup DX HAL step two of three
|
||||
*/
|
||||
|
||||
if (!DdQueryDirectDrawObject(&This->mDDrawGlobal,
|
||||
&This->mHALInfo,
|
||||
&This->mCallbacks.HALDD,
|
||||
&This->mCallbacks.HALDDSurface,
|
||||
&This->mCallbacks.HALDDPalette,
|
||||
&This->mD3dCallbacks,
|
||||
&This->mD3dDriverData,
|
||||
&This->mD3dBufferCallbacks,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL))
|
||||
{
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
DeleteObject(hbmp);
|
||||
// FIXME Close DX fristcall and second call
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
This->mcvmList = This->mHALInfo.vmiData.dwNumHeaps;
|
||||
This->mpvmList = (VIDMEM*) DxHeapMemAlloc(sizeof(VIDMEM) * This->mcvmList);
|
||||
if (This->mpvmList == NULL)
|
||||
{
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
DeleteObject(hbmp);
|
||||
// FIXME Close DX fristcall and second call
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
This->mcFourCC = This->mHALInfo.ddCaps.dwNumFourCCCodes;
|
||||
This->mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * This->mcFourCC);
|
||||
if (This->mpFourCC == NULL)
|
||||
{
|
||||
DxHeapMemFree(This->mpvmList);
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
DeleteObject(hbmp);
|
||||
// FIXME Close DX fristcall and second call
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
This->mcTextures = This->mD3dDriverData.dwNumTextureFormats;
|
||||
This->mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * This->mcTextures);
|
||||
if (This->mpTextures == NULL)
|
||||
{
|
||||
DxHeapMemFree( This->mpFourCC);
|
||||
DxHeapMemFree( This->mpvmList);
|
||||
DxHeapMemFree( This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
DeleteObject(hbmp);
|
||||
// FIXME Close DX fristcall and second call
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
This->mHALInfo.vmiData.pvmList = This->mpvmList;
|
||||
This->mHALInfo.lpdwFourCC = This->mpFourCC;
|
||||
This->mD3dDriverData.lpTextureFormats = This->mpTextures;
|
||||
|
||||
if (!DdQueryDirectDrawObject(
|
||||
&This->mDDrawGlobal,
|
||||
&This->mHALInfo,
|
||||
&This->mCallbacks.HALDD,
|
||||
&This->mCallbacks.HALDDSurface,
|
||||
&This->mCallbacks.HALDDPalette,
|
||||
&This->mD3dCallbacks,
|
||||
&This->mD3dDriverData,
|
||||
&This->mCallbacks.HALDDExeBuf,
|
||||
This->mpTextures,
|
||||
This->mpFourCC,
|
||||
This->mpvmList))
|
||||
|
||||
{
|
||||
DxHeapMemFree(This->mpTextures);
|
||||
DxHeapMemFree(This->mpFourCC);
|
||||
DxHeapMemFree(This->mpvmList);
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
DeleteDC(This->hdc);
|
||||
DeleteObject(hbmp);
|
||||
// FIXME Close DX fristcall and second call
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
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);
|
||||
|
||||
memcpy(&This->mDDrawGlobal.vmiData, &This->mHALInfo.vmiData,sizeof(VIDMEMINFO));
|
||||
memcpy(&This->mDDrawGlobal.ddCaps, &This->mHALInfo.ddCaps,sizeof(DDCORECAPS));
|
||||
|
||||
This->mHALInfo.dwNumModes = This->mcModeInfos;
|
||||
This->mHALInfo.lpModeInfo = This->mpModeInfos;
|
||||
This->mHALInfo.dwMonitorFrequency = This->mpModeInfos[0].wRefreshRate;
|
||||
|
||||
This->mDDrawGlobal.dwMonitorFrequency = This->mHALInfo.dwMonitorFrequency;
|
||||
This->mDDrawGlobal.dwModeIndex = This->mHALInfo.dwModeIndex;
|
||||
This->mDDrawGlobal.dwNumModes = This->mHALInfo.dwNumModes;
|
||||
This->mDDrawGlobal.lpModeInfo = This->mHALInfo.lpModeInfo;
|
||||
This->mDDrawGlobal.hInstance = This->mHALInfo.hInstance;
|
||||
|
||||
This->mDDrawGlobal.lp16DD = &This->mDDrawGlobal;
|
||||
|
||||
DeleteObject(hbmp);
|
||||
//DeleteDC(This->hdc);
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
|
||||
VOID
|
||||
Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
if (This->mDDrawGlobal.hDD != 0)
|
||||
{
|
||||
DdDeleteDirectDrawObject (&This->mDDrawGlobal);
|
||||
}
|
||||
|
||||
if (This->mpTextures != NULL)
|
||||
{
|
||||
DxHeapMemFree(This->mpTextures);
|
||||
}
|
||||
|
||||
if (This->mpFourCC != NULL)
|
||||
{
|
||||
DxHeapMemFree(This->mpFourCC);
|
||||
}
|
||||
|
||||
if (This->mpvmList != NULL)
|
||||
{
|
||||
DxHeapMemFree(This->mpvmList);
|
||||
}
|
||||
|
||||
if (This->mpModeInfos != NULL)
|
||||
{
|
||||
DxHeapMemFree(This->mpModeInfos);
|
||||
}
|
||||
|
||||
if (This->hdc != NULL)
|
||||
{
|
||||
DeleteDC(This->hdc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT
|
||||
Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
|
||||
|
||||
if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE))
|
||||
if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE))
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
||||
SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
|
||||
SetExclusiveMode.lpDD = &This->mDDrawGlobal;
|
||||
SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
|
||||
SetExclusiveMode.dwEnterExcl = This->cooperative_level;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
@ -311,62 +327,24 @@ HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
|
|||
}
|
||||
|
||||
|
||||
VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
DdDeleteDirectDrawObject (&This->DirectDrawGlobal);
|
||||
|
||||
/*
|
||||
if(This->DirectDrawGlobal.lpDDKernelCaps)
|
||||
HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDKernelCaps);
|
||||
|
||||
if(This->DirectDrawGlobal.lpddNLVCaps)
|
||||
HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpddNLVCaps);
|
||||
|
||||
if(This->DirectDrawGlobal.lpDDVideoPortCaps)
|
||||
HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDVideoPortCaps);
|
||||
|
||||
if(This->DirectDrawGlobal.lpdwFourCC)
|
||||
HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
|
||||
|
||||
if(This->DirectDrawGlobal.lpZPixelFormats)
|
||||
HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
|
||||
|
||||
if(This->HalInfo.vmiData.pvmList)
|
||||
HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
|
||||
|
||||
if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
|
||||
HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
|
||||
|
||||
if(This->DirectDrawGlobal.lpDDCBtmp)
|
||||
HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
|
||||
|
||||
if(This->DirectDrawGlobal.lpD3DHALCallbacks)
|
||||
HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
|
||||
|
||||
if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
|
||||
HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
|
||||
HRESULT
|
||||
Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
|
||||
LPDWORD total, LPDWORD free)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
DDHAL_GETAVAILDRIVERMEMORYDATA mem;
|
||||
|
||||
if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
|
||||
if (!(This->mDDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
||||
mem.lpDD = &This->DirectDrawGlobal;
|
||||
mem.lpDD = &This->mDDrawGlobal;
|
||||
mem.ddRVal = DDERR_NOTPALETTIZED;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem) != DDHAL_DRIVER_HANDLED)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem) != DDHAL_DRIVER_HANDLED)
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
@ -387,17 +365,17 @@ HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,H
|
|||
|
||||
DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData;
|
||||
|
||||
if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK))
|
||||
if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK))
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
||||
WaitVectorData.lpDD = &This->DirectDrawGlobal;
|
||||
WaitVectorData.lpDD = &This->mDDrawGlobal;
|
||||
WaitVectorData.dwFlags = dwFlags;
|
||||
WaitVectorData.hEvent = (DWORD)h;
|
||||
WaitVectorData.ddRVal = DDERR_NOTPALETTIZED;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) != DDHAL_DRIVER_HANDLED)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) != DDHAL_DRIVER_HANDLED)
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
@ -411,15 +389,15 @@ HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
|
|||
|
||||
DDHAL_GETSCANLINEDATA GetScan;
|
||||
|
||||
if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE))
|
||||
if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE))
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
||||
GetScan.lpDD = &This->DirectDrawGlobal;
|
||||
GetScan.lpDD = &This->mDDrawGlobal;
|
||||
GetScan.ddRVal = DDERR_NOTPALETTIZED;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.GetScanLine(&GetScan) != DDHAL_DRIVER_HANDLED)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.GetScanLine(&GetScan) != DDHAL_DRIVER_HANDLED)
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
@ -434,15 +412,15 @@ HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
|
|||
|
||||
DDHAL_FLIPTOGDISURFACEDATA FlipGdi;
|
||||
|
||||
if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE))
|
||||
if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE))
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
||||
FlipGdi.lpDD = &This->DirectDrawGlobal;
|
||||
FlipGdi.lpDD = &This->mDDrawGlobal;
|
||||
FlipGdi.ddRVal = DDERR_NOTPALETTIZED;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.FlipToGDISurface(&FlipGdi) != DDHAL_DRIVER_HANDLED)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.FlipToGDISurface(&FlipGdi) != DDHAL_DRIVER_HANDLED)
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
@ -459,19 +437,21 @@ HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD
|
|||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
DDHAL_SETMODEDATA mode;
|
||||
|
||||
if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
|
||||
if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
||||
mode.lpDD = &This->DirectDrawGlobal;
|
||||
mode.lpDD = &This->mDDrawGlobal;
|
||||
mode.ddRVal = DDERR_NODRIVERSUPPORT;
|
||||
|
||||
|
||||
|
||||
// FIXME : add search for which mode.ModeIndex we should use
|
||||
// FIXME : fill the mode.inexcl;
|
||||
// FIXME : fill the mode.useRefreshRate;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED)
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
|
|
@ -45,15 +45,15 @@ HRESULT Hal_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pD
|
|||
|
||||
/************ Test see if we can Create Surface ***********************/
|
||||
|
||||
if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
|
||||
if (This->owner->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
|
||||
{
|
||||
/* can the driver create the surface */
|
||||
DDHAL_CANCREATESURFACEDATA CanCreateData;
|
||||
memset(&CanCreateData, 0, sizeof(DDHAL_CANCREATESURFACEDATA));
|
||||
CanCreateData.lpDD = &This->owner->DirectDrawGlobal;
|
||||
CanCreateData.lpDD = &This->owner->mDDrawGlobal;
|
||||
CanCreateData.lpDDSurfaceDesc = (LPDDSURFACEDESC)&This->ddsd;
|
||||
|
||||
if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CanCreateSurface(&CanCreateData) == DDHAL_DRIVER_NOTHANDLED)
|
||||
if (This->owner->mDDrawGlobal.lpDDCBtmp->HALDD.CanCreateSurface(&CanCreateData) == DDHAL_DRIVER_NOTHANDLED)
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
if(CanCreateData.ddRVal != DD_OK)
|
||||
|
@ -64,10 +64,10 @@ HRESULT Hal_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pD
|
|||
|
||||
/* surface global struct */
|
||||
memset(&This->Global, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
|
||||
This->Global.lpDD = &This->owner->DirectDrawGlobal;
|
||||
This->Global.wHeight = This->owner->DirectDrawGlobal.vmiData.dwDisplayHeight;
|
||||
This->Global.wWidth = This->owner->DirectDrawGlobal.vmiData.dwDisplayWidth;
|
||||
This->Global.dwLinearSize = This->owner->DirectDrawGlobal.vmiData.lDisplayPitch;
|
||||
This->Global.lpDD = &This->owner->mDDrawGlobal;
|
||||
This->Global.wHeight = This->owner->mDDrawGlobal.vmiData.dwDisplayHeight;
|
||||
This->Global.wWidth = This->owner->mDDrawGlobal.vmiData.dwDisplayWidth;
|
||||
This->Global.dwLinearSize = This->owner->mDDrawGlobal.vmiData.lDisplayPitch;
|
||||
if(pDDSD2->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
|
||||
This->Global.dwGlobalFlags = DDRAWISURFGBL_ISGDISURFACE;
|
||||
|
||||
|
@ -76,8 +76,10 @@ HRESULT Hal_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pD
|
|||
This->More.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
|
||||
This->More.dmiDDrawReserved7.wWidth = This->Global.wWidth;
|
||||
This->More.dmiDDrawReserved7.wHeight = This->Global.wHeight;
|
||||
This->More.dmiDDrawReserved7.wBPP = This->owner->Bpp;
|
||||
This->More.dmiDDrawReserved7.wRefreshRate = This->owner->DirectDrawGlobal.dwMonitorFrequency;
|
||||
//This->More.dmiDDrawReserved7.wBPP = This->owner->Bpp;
|
||||
This->More.dmiDDrawReserved7.wBPP = This->Global.dwLinearSize;
|
||||
|
||||
This->More.dmiDDrawReserved7.wRefreshRate = This->owner->mDDrawGlobal.dwMonitorFrequency;
|
||||
//This->More.dmiDDrawReserved7.wMonitorsAttachedToDesktop = 2;
|
||||
/* ToDo: fill ddsCapsEx */
|
||||
|
||||
|
@ -95,7 +97,7 @@ HRESULT Hal_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pD
|
|||
/* the parameter struct */
|
||||
DDHAL_CREATESURFACEDATA CreateData;
|
||||
memset(&CreateData, 0, sizeof(DDHAL_CREATESURFACEDATA));
|
||||
CreateData.lpDD = &This->owner->DirectDrawGlobal;
|
||||
CreateData.lpDD = &This->owner->mDDrawGlobal;
|
||||
CreateData.lpDDSurfaceDesc = (LPDDSURFACEDESC)&This->ddsd;
|
||||
CreateData.dwSCnt = 1;
|
||||
CreateData.lplpSList = This->pLocal;
|
||||
|
@ -103,7 +105,7 @@ HRESULT Hal_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pD
|
|||
CreateData.ddRVal = 1;
|
||||
|
||||
/* this is the call we were waiting for */
|
||||
if(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CreateSurface(&CreateData) == DDHAL_DRIVER_NOTHANDLED)
|
||||
if(This->owner->mDDrawGlobal.lpDDCBtmp->HALDD.CreateSurface(&CreateData) == DDHAL_DRIVER_NOTHANDLED)
|
||||
return DDERR_INVALIDPARAMS;
|
||||
asm("int3");
|
||||
|
||||
|
@ -126,13 +128,13 @@ HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rDest,
|
|||
IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
|
||||
IDirectDrawSurfaceImpl* That = (IDirectDrawSurfaceImpl*)src;
|
||||
|
||||
if (!(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.dwFlags & DDHAL_SURFCB32_BLT))
|
||||
if (!(This->owner->mDDrawGlobal.lpDDCBtmp->HALDDSurface.dwFlags & DDHAL_SURFCB32_BLT))
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
||||
DDHAL_BLTDATA BltData;
|
||||
BltData.lpDD = &This->owner->DirectDrawGlobal;
|
||||
BltData.lpDD = &This->owner->mDDrawGlobal;
|
||||
BltData.dwFlags = dwFlags;
|
||||
BltData.lpDDDestSurface = &This->Local;
|
||||
if(rDest) BltData.rDest = *(RECTL*)rDest;
|
||||
|
@ -140,7 +142,7 @@ HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rDest,
|
|||
if(That) BltData.lpDDSrcSurface = &That->Local;
|
||||
if(lpbltfx) BltData.bltFX = *lpbltfx;
|
||||
|
||||
if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.Blt(&BltData) != DDHAL_DRIVER_HANDLED)
|
||||
if (This->owner->mDDrawGlobal.lpDDCBtmp->HALDDSurface.Blt(&BltData) != DDHAL_DRIVER_HANDLED)
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
|
|
@ -15,9 +15,17 @@
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status this api is finish and is 100% correct
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, REFIID id, BOOL ex)
|
||||
Create_DirectDraw (LPGUID pGUID,
|
||||
LPDIRECTDRAW* pIface,
|
||||
REFIID id,
|
||||
BOOL ex)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl));
|
||||
|
||||
|
@ -30,8 +38,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, REFIID id, BOOL ex)
|
|||
This->lpVtbl_v1 = &DDRAW_IDirectDraw_VTable;
|
||||
This->lpVtbl_v2 = &DDRAW_IDirectDraw2_VTable;
|
||||
This->lpVtbl_v4 = &DDRAW_IDirectDraw4_VTable;
|
||||
|
||||
This->DirectDrawGlobal.dwRefCnt = 1;
|
||||
|
||||
*pIface = (LPDIRECTDRAW)This;
|
||||
|
||||
if(This->lpVtbl->QueryInterface ((LPDIRECTDRAW7)This, id, (void**)&pIface) != S_OK)
|
||||
|
@ -40,9 +47,16 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, REFIID id, BOOL ex)
|
|||
return This->lpVtbl->Initialize ((LPDIRECTDRAW7)This, pGUID);
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status this api is finish and is 100% correct
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
DirectDrawCreate (LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN pUnkOuter)
|
||||
DirectDrawCreate (LPGUID lpGUID,
|
||||
LPDIRECTDRAW* lplpDD,
|
||||
LPUNKNOWN pUnkOuter)
|
||||
{
|
||||
/* check see if pUnkOuter is null or not */
|
||||
if (pUnkOuter)
|
||||
|
@ -53,10 +67,18 @@ DirectDrawCreate (LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN pUnkOuter)
|
|||
|
||||
return Create_DirectDraw (lpGUID, lplpDD, &IID_IDirectDraw, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status this api is finish and is 100% correct
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
|
||||
DirectDrawCreateEx(LPGUID lpGUID,
|
||||
LPVOID* lplpDD,
|
||||
REFIID id,
|
||||
LPUNKNOWN pUnkOuter)
|
||||
{
|
||||
/* check see if pUnkOuter is null or not */
|
||||
if (pUnkOuter)
|
||||
|
@ -74,38 +96,52 @@ DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID id, LPUNKNOWN pUnkOuter
|
|||
return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* UNIMPLEMENT
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI DirectDrawEnumerateA(
|
||||
LPDDENUMCALLBACKA lpCallback,
|
||||
LPVOID lpContext
|
||||
)
|
||||
WINAPI
|
||||
DirectDrawEnumerateA(
|
||||
LPDDENUMCALLBACKA lpCallback,
|
||||
LPVOID lpContext)
|
||||
{
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
|
||||
HRESULT WINAPI DirectDrawEnumerateW(
|
||||
LPDDENUMCALLBACKW lpCallback,
|
||||
LPVOID lpContext
|
||||
)
|
||||
/*
|
||||
* UNIMPLEMENT
|
||||
*/
|
||||
|
||||
HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback,
|
||||
LPVOID lpContext)
|
||||
{
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
HRESULT WINAPI DirectDrawEnumerateExA(
|
||||
LPDDENUMCALLBACKEXA lpCallback,
|
||||
LPVOID lpContext,
|
||||
DWORD dwFlags
|
||||
)
|
||||
/*
|
||||
* UNIMPLEMENT
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback,
|
||||
LPVOID lpContext,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
HRESULT WINAPI DirectDrawEnumerateExW(
|
||||
LPDDENUMCALLBACKEXW lpCallback,
|
||||
LPVOID lpContext,
|
||||
DWORD dwFlags
|
||||
)
|
||||
/*
|
||||
* UNIMPLEMENT
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW lpCallback,
|
||||
LPVOID lpContext,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
DX_STUB;
|
||||
}
|
||||
|
@ -118,7 +154,13 @@ HRESULT WINAPI DirectDrawEnumerateExW(
|
|||
|
||||
*/
|
||||
|
||||
HRESULT WINAPI
|
||||
/*
|
||||
* UNIMPLEMENT
|
||||
* Status FIXME need be implement and this code is realy need be tested
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
D3DParseUnknownCommand( LPVOID lpvCommands,
|
||||
LPVOID *lplpvReturnedCommand)
|
||||
{
|
||||
|
|
|
@ -12,22 +12,13 @@
|
|||
|
||||
|
||||
ULONG WINAPI Main_DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedDecrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
if (ref == 0)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
return ref;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ULONG WINAPI Main_DirectDrawClipper_AddRef (LPDIRECTDRAWCLIPPER iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedIncrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
return ref;
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
HRESULT WINAPI Main_DirectDrawClipper_Initialize(
|
||||
|
|
|
@ -12,23 +12,14 @@
|
|||
|
||||
ULONG WINAPI
|
||||
Main_DirectDrawColorControl_AddRef(LPDIRECTDRAWCOLORCONTROL iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedIncrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
return ref;
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
Main_DirectDrawColorControl_Release(LPDIRECTDRAWCOLORCONTROL iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedDecrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
if (ref == 0)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
return ref;
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
|
|
@ -10,43 +10,47 @@
|
|||
|
||||
#include "rosdraw.h"
|
||||
|
||||
|
||||
HRESULT WINAPI Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status this api is finish and is 100% correct
|
||||
*/
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
HRESULT ret;
|
||||
|
||||
if (iface==NULL)
|
||||
{
|
||||
return DDERR_NOTINITIALIZED;
|
||||
}
|
||||
|
||||
|
||||
if (This->InitializeDraw == TRUE)
|
||||
{
|
||||
return DDERR_ALREADYINITIALIZED;
|
||||
}
|
||||
else
|
||||
{
|
||||
This->InitializeDraw = TRUE;
|
||||
}
|
||||
|
||||
This->InitializeDraw = TRUE;
|
||||
|
||||
RtlZeroMemory(&This->DirectDrawGlobal, sizeof(DDRAWI_DIRECTDRAW_GBL));
|
||||
RtlZeroMemory(&This->mDDrawGlobal, sizeof(DDRAWI_DIRECTDRAW_GBL));
|
||||
|
||||
|
||||
|
||||
/* cObsolete is undoc in msdn it being use in CreateDCA */
|
||||
RtlCopyMemory(&This->DirectDrawGlobal.cObsolete,&"DISPLAY",7);
|
||||
RtlCopyMemory(&This->DirectDrawGlobal.cDriverName,&"DISPLAY",7);
|
||||
RtlCopyMemory(&This->mDDrawGlobal.cObsolete,&"DISPLAY",7);
|
||||
RtlCopyMemory(&This->mDDrawGlobal.cDriverName,&"DISPLAY",7);
|
||||
|
||||
/* Setup the lpExclusiveOwner struct in msdn this struct member is undoc
|
||||
I am using there name to figout which info it should be fild with
|
||||
My hardware drv does not support call to SetExusive so I can not
|
||||
debug it see how it should be fild
|
||||
this part have been move to HAL
|
||||
*/
|
||||
|
||||
This->DirectDrawGlobal.lpExclusiveOwner = &This->ExclusiveOwner;
|
||||
memset(&This->ExclusiveOwner, 0, sizeof(DDRAWI_DIRECTDRAW_LCL));
|
||||
|
||||
This->DirectDrawGlobal.lpExclusiveOwner->dwProcessId = GetCurrentProcessId();
|
||||
This->DirectDrawGlobal.lpExclusiveOwner->hDC = ((ULONG_PTR)GetWindowDC(GetDesktopWindow()));
|
||||
This->DirectDrawGlobal.lpExclusiveOwner->hWnd = ((ULONG_PTR)GetDesktopWindow());
|
||||
This->DirectDrawGlobal.lpExclusiveOwner->lpGbl = &This->DirectDrawGlobal;
|
||||
|
||||
This->Height = GetDeviceCaps((HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC , VERTRES);
|
||||
This->Width = GetDeviceCaps((HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC , HORZRES);
|
||||
This->Bpp = GetDeviceCaps((HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC , BITSPIXEL);
|
||||
|
||||
|
||||
|
||||
// call software first
|
||||
if((ret = Hal_DirectDraw_Initialize (iface)) != DD_OK)
|
||||
return ret;
|
||||
|
@ -54,14 +58,69 @@ HRESULT WINAPI Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
|
|||
// ... then overwrite with hal
|
||||
if((ret = Hel_DirectDraw_Initialize (iface)) != DD_OK)
|
||||
return ret;
|
||||
|
||||
/* Hack to set right freq */
|
||||
|
||||
This->DirectDrawGlobal.dwMonitorFrequency = GetDeviceCaps((HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC , VREFRESH);
|
||||
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status this api is finish and is 100% correct
|
||||
*/
|
||||
ULONG
|
||||
WINAPI
|
||||
Main_DirectDraw_AddRef (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref=0;
|
||||
|
||||
if (iface!=NULL)
|
||||
{
|
||||
ref = InterlockedIncrement((PLONG)&This->mDDrawGlobal.dwRefCnt);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status
|
||||
* not finish yet but is working fine
|
||||
* it prevent memmory leaks at exit
|
||||
*/
|
||||
ULONG
|
||||
WINAPI
|
||||
Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref=0;
|
||||
|
||||
if (iface!=NULL)
|
||||
{
|
||||
ref = InterlockedDecrement((PLONG)&This->mDDrawGlobal.dwRefCnt);
|
||||
|
||||
if (ref == 0)
|
||||
{
|
||||
// set resoltion back to the one in registry
|
||||
if(This->cooperative_level & DDSCL_EXCLUSIVE)
|
||||
{
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
}
|
||||
|
||||
Hal_DirectDraw_Release(iface);
|
||||
//Hel_DirectDraw_Release(iface);
|
||||
RtlZeroMemory(&This->mDDrawGlobal, sizeof(DDRAWI_DIRECTDRAW_GBL));
|
||||
RtlZeroMemory(This, sizeof(IDirectDrawImpl));
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD cooplevel)
|
||||
{
|
||||
// TODO:
|
||||
|
@ -72,7 +131,7 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
|
|||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
// check the parameters
|
||||
if ((This->cooperative_level == cooplevel) && ((HWND)This->DirectDrawGlobal.lpExclusiveOwner->hWnd == hwnd))
|
||||
if ((This->cooperative_level == cooplevel) && ((HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd == hwnd))
|
||||
return DD_OK;
|
||||
|
||||
if (This->cooperative_level)
|
||||
|
@ -85,11 +144,15 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
|
|||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
// set the data
|
||||
This->DirectDrawGlobal.lpExclusiveOwner->hWnd = (ULONG_PTR) hwnd;
|
||||
This->DirectDrawGlobal.lpExclusiveOwner->hDC = (ULONG_PTR)GetDC(hwnd);
|
||||
This->mDDrawGlobal.lpExclusiveOwner->hWnd = (ULONG_PTR) hwnd;
|
||||
This->mDDrawGlobal.lpExclusiveOwner->hDC = (ULONG_PTR)GetDC(hwnd);
|
||||
|
||||
/* FIXME : fill the mDDrawGlobal.lpExclusiveOwner->dwLocalFlags right */
|
||||
//mDDrawGlobal.lpExclusiveOwner->dwLocalFlags
|
||||
|
||||
This->cooperative_level = cooplevel;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)
|
||||
{
|
||||
return Hal_DirectDraw_SetCooperativeLevel (iface);
|
||||
}
|
||||
|
@ -106,16 +169,16 @@ HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidt
|
|||
DWORD ret;
|
||||
|
||||
/* FIXME check the refresrate if it same if it not same do the mode switch */
|
||||
if ((This->DirectDrawGlobal.vmiData.dwDisplayHeight == dwHeight) &&
|
||||
(This->DirectDrawGlobal.vmiData.dwDisplayWidth == dwWidth) &&
|
||||
(This->DirectDrawGlobal.vmiData.ddpfDisplay.dwRGBBitCount == dwBPP))
|
||||
if ((This->mDDrawGlobal.vmiData.dwDisplayHeight == dwHeight) &&
|
||||
(This->mDDrawGlobal.vmiData.dwDisplayWidth == dwWidth) &&
|
||||
(This->mDDrawGlobal.vmiData.ddpfDisplay.dwRGBBitCount == dwBPP))
|
||||
{
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
/* Check use the Hal or Hel for SetMode */
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE)
|
||||
{
|
||||
ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate, dwFlags);
|
||||
}
|
||||
|
@ -126,40 +189,25 @@ HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidt
|
|||
|
||||
if (ret == DD_OK)
|
||||
{
|
||||
DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
|
||||
DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
|
||||
/* FIXME fill the This->DirectDrawGlobal.vmiData right */
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ULONG WINAPI Main_DirectDraw_AddRef (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedIncrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedDecrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
if (ref == 0)
|
||||
{
|
||||
// set resoltion back to the one in registry
|
||||
if(This->cooperative_level & DDSCL_EXCLUSIVE)
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI Main_DirectDraw_QueryInterface (
|
||||
LPDIRECTDRAW7 iface, REFIID id, LPVOID *obj )
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status this api is finish and is 100% correct
|
||||
*/
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
|
||||
REFIID id,
|
||||
LPVOID *obj)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
|
@ -213,13 +261,13 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
|||
That->lpVtbl = &DirectDrawSurface7_Vtable;
|
||||
That->lpVtbl_v3 = &DDRAW_IDDS3_Thunk_VTable;
|
||||
|
||||
This->DirectDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
This->mDDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DDRAWI_DDRAWSURFACE_INT));
|
||||
That->owner = (IDirectDrawImpl *)This;
|
||||
That->owner->DirectDrawGlobal.dsList->dwIntRefCnt =1;
|
||||
That->owner->mDDrawGlobal.dsList->dwIntRefCnt =1;
|
||||
|
||||
/* we alwasy set to use the DirectDrawSurface7_Vtable as internel */
|
||||
That->owner->DirectDrawGlobal.dsList->lpVtbl = (PVOID) &DirectDrawSurface7_Vtable;
|
||||
That->owner->mDDrawGlobal.dsList->lpVtbl = (PVOID) &DirectDrawSurface7_Vtable;
|
||||
|
||||
*ppSurf = (LPDIRECTDRAWSURFACE7)That;
|
||||
|
||||
|
@ -280,7 +328,7 @@ HRESULT WINAPI Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
|
|||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE)
|
||||
{
|
||||
return Hal_DirectDraw_FlipToGDISurface( iface);
|
||||
}
|
||||
|
@ -296,13 +344,13 @@ HRESULT WINAPI Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps
|
|||
|
||||
if (pDriverCaps != NULL)
|
||||
{
|
||||
RtlCopyMemory(pDriverCaps,&This->DirectDrawGlobal.ddCaps,sizeof(DDCORECAPS));
|
||||
RtlCopyMemory(pDriverCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS));
|
||||
status = DD_OK;
|
||||
}
|
||||
|
||||
if (pHELCaps != NULL)
|
||||
{
|
||||
RtlCopyMemory(pDriverCaps,&This->DirectDrawGlobal.ddHELCaps,sizeof(DDCORECAPS));
|
||||
RtlCopyMemory(pDriverCaps,&This->mDDrawGlobal.ddHELCaps,sizeof(DDCORECAPS));
|
||||
status = DD_OK;
|
||||
}
|
||||
|
||||
|
@ -322,13 +370,13 @@ HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
|||
}
|
||||
|
||||
pDDSD->dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_REFRESHRATE | DDSD_WIDTH;
|
||||
pDDSD->dwHeight = This->DirectDrawGlobal.vmiData.dwDisplayHeight;
|
||||
pDDSD->dwWidth = This->DirectDrawGlobal.vmiData.dwDisplayWidth;
|
||||
pDDSD->lPitch = This->DirectDrawGlobal.vmiData.lDisplayPitch;
|
||||
pDDSD->dwRefreshRate = This->DirectDrawGlobal.dwMonitorFrequency;
|
||||
pDDSD->dwHeight = This->mDDrawGlobal.vmiData.dwDisplayHeight;
|
||||
pDDSD->dwWidth = This->mDDrawGlobal.vmiData.dwDisplayWidth;
|
||||
pDDSD->lPitch = This->mDDrawGlobal.vmiData.lDisplayPitch;
|
||||
pDDSD->dwRefreshRate = This->mDDrawGlobal.dwMonitorFrequency;
|
||||
|
||||
RtlCopyMemory(&pDDSD->ddpfPixelFormat,&This->DirectDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
|
||||
RtlCopyMemory(&pDDSD->ddsCaps,&This->DirectDrawGlobal.ddCaps,sizeof(DDCORECAPS));
|
||||
RtlCopyMemory(&pDDSD->ddpfPixelFormat,&This->mDDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
|
||||
RtlCopyMemory(&pDDSD->ddsCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS));
|
||||
|
||||
/* have not check where I should get hold of this info yet
|
||||
DWORD dwBackBufferCount;
|
||||
|
@ -354,7 +402,7 @@ HRESULT WINAPI Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD d
|
|||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK)
|
||||
{
|
||||
return Hal_DirectDraw_WaitForVerticalBlank( iface, dwFlags, h);
|
||||
}
|
||||
|
@ -367,7 +415,7 @@ HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS
|
|||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY)
|
||||
{
|
||||
return Hal_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free);
|
||||
}
|
||||
|
@ -384,7 +432,7 @@ HRESULT WINAPI Main_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD f
|
|||
return DD_FALSE;
|
||||
}
|
||||
|
||||
*freq = This->DirectDrawGlobal.dwMonitorFrequency;
|
||||
*freq = This->mDDrawGlobal.dwMonitorFrequency;
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
@ -392,7 +440,7 @@ HRESULT WINAPI Main_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScan
|
|||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE)
|
||||
{
|
||||
return Hal_DirectDraw_GetScanLine( iface, lpdwScanLine);
|
||||
}
|
||||
|
|
|
@ -13,22 +13,13 @@
|
|||
ULONG WINAPI
|
||||
Main_DirectDrawGammaControl_AddRef(LPDIRECTDRAWGAMMACONTROL iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedIncrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
return ref;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
Main_DirectDrawGammaControl_Release(LPDIRECTDRAWGAMMACONTROL iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedDecrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
if (ref == 0)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
return ref;
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
|
|
@ -13,21 +13,12 @@
|
|||
ULONG WINAPI
|
||||
Main_DirectDrawPalette_Release(LPDIRECTDRAWPALETTE iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedIncrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
return ref;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ULONG WINAPI Main_DirectDrawPalette_AddRef(LPDIRECTDRAWPALETTE iface)
|
||||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
ULONG ref = InterlockedDecrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
|
||||
|
||||
if (ref == 0)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
return ref;
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
|
|
@ -16,7 +16,7 @@ HRESULT WINAPI Main_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIREC
|
|||
IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
|
||||
|
||||
/* Call the Hal CreateSurface */
|
||||
if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CREATESURFACE)
|
||||
if (This->owner->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CREATESURFACE)
|
||||
{
|
||||
return Hal_DDrawSurface_Initialize (iface, pDD, pDDSD2);
|
||||
}
|
||||
|
@ -29,13 +29,13 @@ ULONG WINAPI Main_DDrawSurface_AddRef(LPDIRECTDRAWSURFACE7 iface)
|
|||
{
|
||||
IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
|
||||
|
||||
return InterlockedIncrement((PLONG)&This->owner->DirectDrawGlobal.dsList->dwIntRefCnt);
|
||||
return InterlockedIncrement((PLONG)&This->owner->mDDrawGlobal.dsList->dwIntRefCnt);
|
||||
}
|
||||
|
||||
ULONG WINAPI Main_DDrawSurface_Release(LPDIRECTDRAWSURFACE7 iface)
|
||||
{
|
||||
IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
|
||||
ULONG ref = InterlockedDecrement((PLONG)&This->owner->DirectDrawGlobal.dsList->dwIntRefCnt);
|
||||
ULONG ref = InterlockedDecrement((PLONG)&This->owner->mDDrawGlobal.dsList->dwIntRefCnt);
|
||||
|
||||
if (ref == 0)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
@ -57,9 +57,8 @@ HRESULT WINAPI Main_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
|
|||
{
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
|
||||
DX_STUB;
|
||||
|
||||
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE)
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE)
|
||||
{
|
||||
return Hal_DDrawSurface_Blt( iface, rdst, src, rsrc, dwFlags, lpbltfx);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
#include <d3dhal.h>
|
||||
#include <ddrawgdi.h>
|
||||
|
||||
/* own macro to alloc memmory */
|
||||
#define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m)
|
||||
#define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p);
|
||||
/******** Main Object ********/
|
||||
|
||||
typedef struct
|
||||
|
@ -20,21 +23,36 @@ typedef struct
|
|||
IDirectDraw2Vtbl* lpVtbl_v2;
|
||||
IDirectDrawVtbl* lpVtbl_v1;
|
||||
|
||||
/* The main struct that contain all info from the HAL and HEL */
|
||||
DDRAWI_DIRECTDRAW_GBL DirectDrawGlobal;
|
||||
/* The main struct that contain all info from the HAL and HEL */
|
||||
HDC hdc;
|
||||
DDRAWI_DIRECTDRAW_GBL mDDrawGlobal;
|
||||
DDRAWI_DIRECTDRAW_LCL mDDrawLocal;
|
||||
DDHALINFO mHALInfo;
|
||||
|
||||
DDHAL_CALLBACKS mCallbacks;
|
||||
DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
|
||||
D3DHAL_CALLBACKS mD3dCallbacks;
|
||||
D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
|
||||
|
||||
UINT mcModeInfos;
|
||||
DDHALMODEINFO *mpModeInfos;
|
||||
|
||||
UINT mcvmList;
|
||||
VIDMEM *mpvmList;
|
||||
|
||||
UINT mcFourCC;
|
||||
DWORD *mpFourCC;
|
||||
|
||||
UINT mcTextures;
|
||||
DDSURFACEDESC *mpTextures;
|
||||
|
||||
|
||||
/* ExclusiveOwner */
|
||||
DDRAWI_DIRECTDRAW_LCL ExclusiveOwner;
|
||||
|
||||
/* MISC info that will be remove in futuer */
|
||||
DDHAL_DDMISCELLANEOUSCALLBACKS Misc2Callback;
|
||||
DDHALINFO HalInfo;
|
||||
DDRAWI_DIRECTDRAW_LCL ExclusiveOwner;
|
||||
|
||||
DWORD cooperative_level;
|
||||
int Height, Width, Bpp;
|
||||
|
||||
BOOL InitializeDraw;
|
||||
|
||||
BOOL InitializeDraw;
|
||||
|
||||
} IDirectDrawImpl;
|
||||
|
||||
|
|
|
@ -83,12 +83,12 @@ HRESULT Hel_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD
|
|||
|
||||
/* FIXME fill the DirectDrawGlobal right the modeindex old and new */
|
||||
|
||||
if(dwWidth)
|
||||
This->Height = dwWidth;
|
||||
if(dwHeight)
|
||||
This->Width = dwHeight;
|
||||
if(dwBPP)
|
||||
This->Bpp = dwBPP;
|
||||
//if(dwWidth)
|
||||
// This->Height = dwWidth;
|
||||
//if(dwHeight)
|
||||
// This->Width = dwHeight;
|
||||
//if(dwBPP)
|
||||
// This->Bpp = dwBPP;
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue