adding more stuff for create surface right

svn path=/trunk/; revision=18886
This commit is contained in:
Magnus Olsen 2005-10-30 15:45:40 +00:00
parent 41477c4529
commit f872c290a7
3 changed files with 61 additions and 16 deletions

View file

@ -319,6 +319,33 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
/* */
/* DWORD dwIntRefCnt;
LPVOID lpVtbl;
LPDDRAWI_DDRAWSURFACE_LCL lpLcl;
LPDDRAWI_DDRAWSURFACE_INT lpLink;
} DDRAWI_DDRAWSURFACE_INT;
*/
/* Setting up some part for surface not ever thing are being fill in yet */
This->DirectDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)HeapAlloc(GetProcessHeap(), 0,
sizeof(DDRAWI_DDRAWSURFACE_INT));
This->DirectDrawGlobal.dsList->lpLink = (LPDDRAWI_DDRAWSURFACE_INT) &This->DirectDrawGlobal.dsList;
This->DirectDrawGlobal.dsList->lpLcl = (LPDDRAWI_DDRAWSURFACE_LCL)HeapAlloc(GetProcessHeap(), 0,
sizeof(DDRAWI_DDRAWSURFACE_LCL));
This->DirectDrawGlobal.dsList->lpLcl->lpGbl =
(LPDDRAWI_DDRAWSURFACE_GBL)HeapAlloc(GetProcessHeap(), 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
This->DirectDrawGlobal.dsList->lpLcl->lpGbl->lpDD = &This->DirectDrawGlobal;
/* Now all setup for HAL is done and we hopply do not have forget anything */ /* Now all setup for HAL is done and we hopply do not have forget anything */
@ -328,7 +355,25 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface) HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
{ {
return DD_OK; IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE))
{
return DDERR_NODRIVERSUPPORT;
}
SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
SetExclusiveMode.dwEnterExcl = This->cooperative_level;
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
{
return DDERR_NODRIVERSUPPORT;
}
return SetExclusiveMode.ddRVal;
} }

View file

@ -16,6 +16,8 @@ HRESULT WINAPI Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
IDirectDrawImpl* This = (IDirectDrawImpl*)iface; IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
HRESULT ret; HRESULT ret;
// this if it is not called by DirectDrawCreate // this if it is not called by DirectDrawCreate
if(FALSE) if(FALSE)
return DDERR_ALREADYINITIALIZED; return DDERR_ALREADYINITIALIZED;
@ -48,7 +50,6 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
// - allow more Flags // - allow more Flags
IDirectDrawImpl* This = (IDirectDrawImpl*)iface; IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
HRESULT ret;
// check the parameters // check the parameters
if (This->cooperative_level == cooplevel && This->window == hwnd) if (This->cooperative_level == cooplevel && This->window == hwnd)
@ -72,20 +73,21 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
This->cooperative_level = cooplevel; This->cooperative_level = cooplevel;
if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)
{
return Hal_DirectDraw_SetCooperativeLevel (iface);
}
if((ret = Hal_DirectDraw_SetCooperativeLevel (iface)) != DD_OK) return Hel_DirectDraw_SetCooperativeLevel(iface);
return ret;
if((ret = Hel_DirectDraw_SetCooperativeLevel (iface)) != DD_OK)
return ret;
return DD_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) DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
{ {
DWORD ret; DWORD ret;
/* FIXME implement hal setMode */
if((ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, if((ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight,
dwBPP, dwRefreshRate, dwFlags)) == DD_OK) dwBPP, dwRefreshRate, dwFlags)) == DD_OK)
{ {
@ -174,7 +176,11 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
That->lpVtbl = &DirectDrawSurface7_Vtable; That->lpVtbl = &DirectDrawSurface7_Vtable;
That->lpVtbl_v3 = &DDRAW_IDDS3_Thunk_VTable; That->lpVtbl_v3 = &DDRAW_IDDS3_Thunk_VTable;
That->ref = 1;
That->owner->DirectDrawGlobal.dsList->dwIntRefCnt =1;
/* we alwasy set to use the DirectDrawSurface7_Vtable as internel */
That->owner->DirectDrawGlobal.dsList->lpVtbl = (PVOID) &DirectDrawSurface7_Vtable;
*ppSurf = (LPDIRECTDRAWSURFACE7)That; *ppSurf = (LPDIRECTDRAWSURFACE7)That;

View file

@ -39,12 +39,6 @@ typedef struct
IDirectDrawSurface7Vtbl* lpVtbl; IDirectDrawSurface7Vtbl* lpVtbl;
IDirectDrawSurface3Vtbl* lpVtbl_v3; IDirectDrawSurface3Vtbl* lpVtbl_v3;
LONG ref;
DDRAWI_DDRAWSURFACE_GBL Global;
DDRAWI_DDRAWSURFACE_MORE More;
DDRAWI_DDRAWSURFACE_LCL Local;
IDirectDrawImpl* owner; IDirectDrawImpl* owner;
} IDirectDrawSurfaceImpl; } IDirectDrawSurfaceImpl;