mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 04:14:53 +00:00
adpabte wine SetCooperativeLevel to reactis ddraw. allot test need be done, I also took DDRAWI_DIRECTDRAW_LCL->dwObsolete1 as device windows.
memory leak can exists and some value I forget free as well. svn path=/trunk/; revision=26467
This commit is contained in:
parent
84234a9add
commit
2189a28c87
3 changed files with 293 additions and 108 deletions
|
@ -3,7 +3,7 @@
|
|||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS
|
||||
* FILE: lib/ddraw/main/ddraw.c
|
||||
* PURPOSE: IDirectDraw7 Implementation
|
||||
* PURPOSE: IDirectDraw7 Implementation
|
||||
* PROGRAMMER: Magnus Olsen, Maarten Bosma
|
||||
*
|
||||
*/
|
||||
|
@ -11,19 +11,19 @@
|
|||
|
||||
#include "../rosdraw.h"
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
|
||||
REFIID id,
|
||||
LPVOID *obj)
|
||||
{
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
|
||||
REFIID id,
|
||||
LPVOID *obj)
|
||||
{
|
||||
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
/* fixme
|
||||
the D3D object cab be optain from here
|
||||
Direct3D7
|
||||
|
||||
/* fixme
|
||||
the D3D object cab be optain from here
|
||||
Direct3D7
|
||||
*/
|
||||
if (IsEqualGUID(&IID_IDirectDraw7, id))
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
|
|||
}
|
||||
|
||||
Main_DirectDraw_AddRef(iface);
|
||||
return S_OK;
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -46,9 +46,9 @@ Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
|
|||
* Status ok
|
||||
*/
|
||||
ULONG
|
||||
WINAPI
|
||||
Main_DirectDraw_AddRef (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
WINAPI
|
||||
Main_DirectDraw_AddRef (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
@ -67,10 +67,10 @@ Main_DirectDraw_AddRef (LPDIRECTDRAW7 iface)
|
|||
}
|
||||
|
||||
|
||||
ULONG
|
||||
WINAPI
|
||||
Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
ULONG
|
||||
WINAPI
|
||||
Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
||||
{
|
||||
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
@ -92,7 +92,7 @@ Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
|||
{
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
}*/
|
||||
|
||||
|
||||
Cleanup(iface);
|
||||
return 0;
|
||||
}
|
||||
|
@ -104,9 +104,9 @@ Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
|||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_Compact(LPDIRECTDRAW7 iface)
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_Compact(LPDIRECTDRAW7 iface)
|
||||
{
|
||||
/* MSDN say not implement but my question what does it return then */
|
||||
DX_WINDBG_trace();
|
||||
|
@ -117,16 +117,16 @@ Main_DirectDraw_Compact(LPDIRECTDRAW7 iface)
|
|||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface,
|
||||
DWORD dwFlags,
|
||||
LPDIRECTDRAWCLIPPER *ppClipper,
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface,
|
||||
DWORD dwFlags,
|
||||
LPDIRECTDRAWCLIPPER *ppClipper,
|
||||
IUnknown *pUnkOuter)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
|
||||
|
@ -143,13 +143,13 @@ HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
|
|||
* Status not done
|
||||
*/
|
||||
HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
|
||||
LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter)
|
||||
LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter)
|
||||
{
|
||||
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
|
||||
DX_STUB;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,33 +158,7 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
|||
* Status not done
|
||||
*/
|
||||
HRESULT WINAPI Main_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface, LPDIRECTDRAWSURFACE7 src,
|
||||
LPDIRECTDRAWSURFACE7* dst)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 pDDSD, LPVOID context, LPDDENUMMODESCALLBACK2 callback)
|
||||
{
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* stub
|
||||
* Status not done
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 lpDDSD2, LPVOID context,
|
||||
LPDDENUMSURFACESCALLBACK7 callback)
|
||||
LPDIRECTDRAWSURFACE7* dst)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
DX_STUB;
|
||||
|
@ -194,26 +168,52 @@ Main_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
|
|||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
|
||||
HRESULT WINAPI Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 pDDSD, LPVOID context, LPDDENUMMODESCALLBACK2 callback)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* stub
|
||||
* Status not done
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 lpDDSD2, LPVOID context,
|
||||
LPDDENUMSURFACESCALLBACK7 callback)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
|
||||
LPDDCAPS pHELCaps)
|
||||
LPDDCAPS pHELCaps)
|
||||
{
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
|
||||
|
@ -221,20 +221,20 @@ Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
|
|||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD)
|
||||
{
|
||||
HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD)
|
||||
{
|
||||
//LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stub
|
||||
* Status todo
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes, LPDWORD pCodes)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
@ -245,8 +245,8 @@ Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes, LPDWORD p
|
|||
* Stub
|
||||
* Status todo
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface,
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface,
|
||||
LPDIRECTDRAWSURFACE7 *lplpGDIDDSSurface)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
@ -257,31 +257,31 @@ Main_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface,
|
|||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq)
|
||||
{
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
|
||||
{
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stub
|
||||
* Status todo
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, LPBOOL lpbIsInVB)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
@ -292,78 +292,233 @@ Main_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, LPBOOL lpbIsInVB)
|
|||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT
|
||||
WINAPI
|
||||
HRESULT
|
||||
WINAPI
|
||||
Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
|
||||
{
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD cooplevel)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
/*
|
||||
* Code from wine, this functions have been cut and paste from wine 0.9.35
|
||||
* and have been modify allot and are still in devloping so it match with
|
||||
* msdn document struct and flags
|
||||
*/
|
||||
|
||||
HWND window;
|
||||
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
||||
|
||||
|
||||
/* Get the old window */
|
||||
window = (HWND) This->lpLcl->hWnd;
|
||||
if(!window)
|
||||
{
|
||||
return DDERR_NOHWND;
|
||||
}
|
||||
|
||||
/* Tests suggest that we need one of them: */
|
||||
if(!(cooplevel & (DDSCL_SETFOCUSWINDOW |
|
||||
DDSCL_NORMAL |
|
||||
DDSCL_EXCLUSIVE )))
|
||||
{
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
/* Handle those levels first which set various hwnds */
|
||||
if(cooplevel & DDSCL_SETFOCUSWINDOW)
|
||||
{
|
||||
/* This isn't compatible with a lot of flags */
|
||||
if(cooplevel & ( DDSCL_MULTITHREADED |
|
||||
DDSCL_FPUSETUP |
|
||||
DDSCL_FPUPRESERVE |
|
||||
DDSCL_ALLOWREBOOT |
|
||||
DDSCL_ALLOWMODEX |
|
||||
DDSCL_SETDEVICEWINDOW |
|
||||
DDSCL_NORMAL |
|
||||
DDSCL_EXCLUSIVE |
|
||||
DDSCL_FULLSCREEN ) )
|
||||
{
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
else if(This->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED)
|
||||
{
|
||||
return DDERR_HWNDALREADYSET;
|
||||
}
|
||||
else if( (This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN) && window)
|
||||
{
|
||||
return DDERR_HWNDALREADYSET;
|
||||
}
|
||||
|
||||
This->lpLcl->hFocusWnd = (ULONG_PTR) hwnd;
|
||||
|
||||
|
||||
/* Won't use the hwnd param for anything else */
|
||||
hwnd = NULL;
|
||||
|
||||
/* Use the focus window for drawing too */
|
||||
This->lpLcl->hWnd = This->lpLcl->hFocusWnd;
|
||||
|
||||
}
|
||||
|
||||
/* DDSCL_NORMAL or DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE */
|
||||
if(cooplevel & DDSCL_NORMAL)
|
||||
{
|
||||
/* Can't coexist with fullscreen or exclusive */
|
||||
if(cooplevel & (DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) )
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
|
||||
/* Switching from fullscreen? */
|
||||
if(This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN)
|
||||
{
|
||||
/* Restore the display mode */
|
||||
Main_DirectDraw_RestoreDisplayMode(iface);
|
||||
|
||||
This->lpLcl->dwLocalFlags &= ~DDRAWILCL_ISFULLSCREEN;
|
||||
This->lpLcl->dwLocalFlags &= ~DDRAWILCL_HASEXCLUSIVEMODE;
|
||||
This->lpLcl->dwLocalFlags &= ~DDRAWILCL_ALLOWMODEX;
|
||||
}
|
||||
|
||||
/* Don't override focus windows or private device windows */
|
||||
if( hwnd &&
|
||||
!(This->lpLcl->hFocusWnd) &&
|
||||
!(This->lpLcl->dwObsolete1) &&
|
||||
(hwnd != window) )
|
||||
{
|
||||
This->lpLcl->hWnd = (ULONG_PTR)hwnd;
|
||||
}
|
||||
|
||||
/* FIXME GL
|
||||
IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
|
||||
FALSE);
|
||||
*/
|
||||
}
|
||||
else if(cooplevel & DDSCL_FULLSCREEN)
|
||||
{
|
||||
/* Needs DDSCL_EXCLUSIVE */
|
||||
if(!(cooplevel & DDSCL_EXCLUSIVE) )
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
/* Switch from normal to full screen mode? */
|
||||
if (!(This->lpLcl->dwLocalFlags & DDRAWILCL_HASEXCLUSIVEMODE))
|
||||
{
|
||||
/* FIXME GL
|
||||
IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
|
||||
TRUE);
|
||||
*/
|
||||
}
|
||||
|
||||
/* Don't override focus windows or private device windows */
|
||||
if( hwnd &&
|
||||
!(This->lpLcl->hFocusWnd) &&
|
||||
!(This->lpLcl->dwObsolete1) &&
|
||||
(hwnd != window) )
|
||||
{
|
||||
This->lpLcl->hWnd = (ULONG_PTR) hwnd;
|
||||
}
|
||||
}
|
||||
else if(cooplevel & DDSCL_EXCLUSIVE)
|
||||
{
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if(cooplevel & DDSCL_CREATEDEVICEWINDOW)
|
||||
{
|
||||
/* Don't create a device window if a focus window is set */
|
||||
if( !This->lpLcl->hFocusWnd)
|
||||
{
|
||||
HWND devicewindow = CreateWindowExW(0, classname, L"DDraw device window",
|
||||
WS_POPUP, 0, 0,
|
||||
GetSystemMetrics(SM_CXSCREEN),
|
||||
GetSystemMetrics(SM_CYSCREEN),
|
||||
NULL, NULL, GetModuleHandleW(0), NULL);
|
||||
|
||||
ShowWindow(devicewindow, SW_SHOW); /* Just to be sure */
|
||||
|
||||
This->lpLcl->dwObsolete1 = (DWORD)devicewindow;
|
||||
}
|
||||
}
|
||||
|
||||
if(cooplevel & DDSCL_MULTITHREADED && !(This->lpLcl->dwLocalFlags & DDRAWILCL_MULTITHREADED))
|
||||
{
|
||||
/* FIXME GL
|
||||
* IWineD3DDevice_SetMultithreaded(This->wineD3DDevice);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Store the cooperative_level */
|
||||
|
||||
/* FIXME GL
|
||||
* This->cooperative_level |= cooplevel;
|
||||
*/
|
||||
|
||||
return DD_OK;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
|
||||
DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
|
||||
HANDLE h)
|
||||
{
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPLEMENT
|
||||
* Status ok
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
|
||||
LPDWORD total, LPDWORD free)
|
||||
LPDWORD total, LPDWORD free)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
|
||||
DX_STUB;
|
||||
DX_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -372,7 +527,7 @@ Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
|
|||
*/
|
||||
HRESULT WINAPI Main_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc,
|
||||
LPDIRECTDRAWSURFACE7 *lpDDS)
|
||||
{
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
DX_STUB;
|
||||
}
|
||||
|
@ -391,7 +546,7 @@ HRESULT WINAPI Main_DirectDraw_RestoreAllSurfaces(LPDIRECTDRAW7 iface)
|
|||
* Stub
|
||||
* Status todo
|
||||
*/
|
||||
HRESULT WINAPI Main_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface)
|
||||
HRESULT WINAPI Main_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface)
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
DX_STUB;
|
||||
|
@ -403,7 +558,7 @@ HRESULT WINAPI Main_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface)
|
|||
*/
|
||||
HRESULT WINAPI Main_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
|
||||
LPDDDEVICEIDENTIFIER2 pDDDI, DWORD dwFlags)
|
||||
{
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
DX_STUB;
|
||||
}
|
||||
|
@ -424,7 +579,7 @@ HRESULT WINAPI Main_DirectDraw_StartModeTest(LPDIRECTDRAW7 iface, LPSIZE pModes,
|
|||
* Status todo
|
||||
*/
|
||||
HRESULT WINAPI Main_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface,DWORD a,DWORD* b)
|
||||
{
|
||||
{
|
||||
DX_WINDBG_trace();
|
||||
DX_STUB;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
/* DirectDraw startup code only internal use */
|
||||
extern DDRAWI_DIRECTDRAW_GBL ddgbl;
|
||||
extern DDRAWI_DDRAWSURFACE_GBL ddSurfGbl;
|
||||
extern WCHAR classname[128];
|
||||
extern WNDCLASSW wnd_class;
|
||||
|
||||
|
||||
HRESULT WINAPI StartDirectDraw(LPDIRECTDRAW* iface, LPGUID pGUID, BOOL reenable);
|
||||
|
|
|
@ -13,10 +13,12 @@
|
|||
#include "d3dhal.h"
|
||||
#include "ddrawgdi.h"
|
||||
|
||||
#include "ddrawi.h"
|
||||
DDRAWI_DIRECTDRAW_GBL ddgbl;
|
||||
DDRAWI_DDRAWSURFACE_GBL ddSurfGbl;
|
||||
|
||||
WCHAR classname[128];
|
||||
WNDCLASSW wnd_class;
|
||||
|
||||
|
||||
|
||||
HRESULT
|
||||
|
@ -74,7 +76,25 @@ Create_DirectDraw (LPGUID pGUID,
|
|||
if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface))
|
||||
{
|
||||
if (StartDirectDraw((LPDIRECTDRAW*)This, pGUID, FALSE) == DD_OK);
|
||||
{
|
||||
RtlZeroMemory(&wnd_class, sizeof(wnd_class));
|
||||
wnd_class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wnd_class.lpfnWndProc = DefWindowProcW;
|
||||
wnd_class.cbClsExtra = 0;
|
||||
wnd_class.cbWndExtra = 0;
|
||||
wnd_class.hInstance = GetModuleHandleW(0);
|
||||
wnd_class.hIcon = 0;
|
||||
wnd_class.hCursor = 0;
|
||||
wnd_class.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
|
||||
wnd_class.lpszMenuName = NULL;
|
||||
wnd_class.lpszClassName = classname;
|
||||
if(!RegisterClassW(&wnd_class))
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
@ -92,6 +112,7 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable)
|
|||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
|
||||
/*
|
||||
* ddgbl.dwPDevice is not longer in use in windows 2000 and higher
|
||||
* I am using it for device type
|
||||
|
@ -127,7 +148,8 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable)
|
|||
devicetypes= 1;
|
||||
|
||||
/* Create HDC for default, hal and hel driver */
|
||||
This->lpLcl->hDC = (ULONG_PTR) GetDC(GetActiveWindow());
|
||||
This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
|
||||
This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
|
||||
|
||||
/* cObsolete is undoc in msdn it being use in CreateDCA */
|
||||
RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
|
||||
|
@ -138,7 +160,8 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable)
|
|||
{
|
||||
devicetypes = 2;
|
||||
/* Create HDC for default, hal driver */
|
||||
This->lpLcl->hDC = (ULONG_PTR) GetDC(GetActiveWindow());
|
||||
This->lpLcl->hWnd =(ULONG_PTR) GetActiveWindow();
|
||||
This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
|
||||
|
||||
/* cObsolete is undoc in msdn it being use in CreateDCA */
|
||||
RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
|
||||
|
@ -150,7 +173,8 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable)
|
|||
devicetypes = 3;
|
||||
|
||||
/* Create HDC for default, hal and hel driver */
|
||||
This->lpLcl->hDC = (ULONG_PTR) GetDC(GetActiveWindow());
|
||||
This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
|
||||
This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
|
||||
|
||||
/* cObsolete is undoc in msdn it being use in CreateDCA */
|
||||
RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
|
||||
|
@ -165,6 +189,7 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable)
|
|||
*/
|
||||
devicetypes = 4;
|
||||
This->lpLcl->hDC = (ULONG_PTR) NULL ;
|
||||
This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
|
||||
}
|
||||
|
||||
if ( (HDC)This->lpLcl->hDC == NULL)
|
||||
|
@ -223,6 +248,7 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable)
|
|||
This->lpLcl->hDD = This->lpLcl->lpGbl->hDD;
|
||||
ddgbl.hDD = This->lpLcl->lpGbl->hDD;
|
||||
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
@ -318,12 +344,12 @@ StartDirectDrawHal(LPDIRECTDRAW* iface, BOOL reenable)
|
|||
DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
|
||||
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
||||
|
||||
|
||||
RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO));
|
||||
RtlZeroMemory(&mD3dCallbacks, sizeof(D3DHAL_CALLBACKS));
|
||||
RtlZeroMemory(&mD3dDriverData, sizeof(D3DHAL_GLOBALDRIVERDATA));
|
||||
RtlZeroMemory(&mD3dBufferCallbacks, sizeof(DDHAL_DDEXEBUFCALLBACKS));
|
||||
|
||||
|
||||
if (reenable == FALSE)
|
||||
{
|
||||
ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS));
|
||||
|
@ -346,6 +372,8 @@ StartDirectDrawHal(LPDIRECTDRAW* iface, BOOL reenable)
|
|||
return DD_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Some card disable the dx after it have been created so
|
||||
* we are force reanble it
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue