- Some formatting fixes

- Some checks and fixed return values

svn path=/trunk/; revision=27224
This commit is contained in:
Maarten Bosma 2007-06-18 14:58:44 +00:00
parent 93e0ad758f
commit 0e95f8362e
2 changed files with 71 additions and 59 deletions

View file

@ -489,7 +489,7 @@ Main_DirectDraw_CreateSurface (LPDIRECTDRAW iface, LPDDSURFACEDESC pDDSD,
} }
_SEH_HANDLE _SEH_HANDLE
{ {
ret = DDERR_GENERIC; ret = DDERR_INVALIDPARAMS;
} }
_SEH_END; _SEH_END;
// LeaveCriticalSection(&ddcs); // LeaveCriticalSection(&ddcs);
@ -502,16 +502,16 @@ HRESULT WINAPI
Main_DirectDraw_CreateSurface4(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD, Main_DirectDraw_CreateSurface4(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter) LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter)
{ {
HRESULT ret; HRESULT ret;
DX_WINDBG_trace(); DX_WINDBG_trace();
// EnterCriticalSection(&ddcs); // EnterCriticalSection(&ddcs);
_SEH_TRY _SEH_TRY
{ {
ret = Internal_CreateSurface( (LPDDRAWI_DIRECTDRAW_INT)iface,pDDSD, ppSurf,pUnkOuter); ret = Internal_CreateSurface( (LPDDRAWI_DIRECTDRAW_INT)iface,pDDSD, ppSurf,pUnkOuter);
} }
_SEH_HANDLE _SEH_HANDLE
{ {
ret = DDERR_GENERIC; ret = DDERR_INVALIDPARAMS;
} }
_SEH_END; _SEH_END;
@ -519,8 +519,6 @@ Main_DirectDraw_CreateSurface4(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
return ret; return ret;
} }
/* 5 of 31 DirectDraw7_Vtable api are working simluare to windows */ /* 5 of 31 DirectDraw7_Vtable api are working simluare to windows */
/* 8 of 31 DirectDraw7_Vtable api are under devloping / testing */ /* 8 of 31 DirectDraw7_Vtable api are under devloping / testing */

View file

@ -41,8 +41,33 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD,
DWORD num_of_surf=1; DWORD num_of_surf=1;
DWORD count; DWORD count;
/* Fixme adding vaidlate of income param */ /* Fixme adding vaidlate of income param */
if(pDDraw->lpLcl->dwLocalFlags == 0x20000)
{
return DDERR_NOCOOPERATIVELEVELSET;
}
if(pUnkOuter)
{
return CLASS_E_NOAGGREGATION;
}
if(!pDDSD->dwFlags & DDSD_CAPS)
{
return DDERR_INVALIDPARAMS;
}
if(!(pDDSD->dwFlags & DDSD_HEIGHT) && !(pDDSD->dwFlags & DDSD_HEIGHT)
&& !(pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
{
return DDERR_INVALIDPARAMS;
}
else if(pDDSD->dwFlags & DDSD_HEIGHT && pDDSD->dwFlags & DDSD_HEIGHT
&& pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
return DDERR_INVALIDPARAMS;
}
/* FIXME count our how many surface we need */ /* FIXME count our how many surface we need */
@ -75,9 +100,6 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD,
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
for( count=0; count < num_of_surf; count++ ) for( count=0; count < num_of_surf; count++ )
{ {
/* Alloc the surface interface and need members */ /* Alloc the surface interface and need members */
@ -156,14 +178,10 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD,
ThisSurfLcl->dwProcessId = GetCurrentProcessId(); ThisSurfLcl->dwProcessId = GetCurrentProcessId();
/* FIXME the lpLnk */ /* FIXME the lpLnk */
/* FIXME the ref counter */ /* FIXME the ref counter */
} }
/* Fixme call on DdCanCreate then on DdCreateSurface createsurface data here */ /* Fixme call on DdCanCreate then on DdCreateSurface createsurface data here */
/* FIXME bIsDifferentPixelFormat being set to true or false with automatic detcitons */ /* FIXME bIsDifferentPixelFormat being set to true or false with automatic detcitons */
@ -180,11 +198,11 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD,
return DDERR_NOTINITIALIZED; return DDERR_NOTINITIALIZED;
} }
if (mDdCanCreateSurface.ddRVal != DD_OK) if (mDdCanCreateSurface.ddRVal != DD_OK)
{ {
DX_STUB_str("mDdCanCreateSurface fail"); DX_STUB_str("mDdCanCreateSurface fail");
return DDERR_NOTINITIALIZED; return DDERR_NOTINITIALIZED;
} }
mDdCreateSurface.lpDD = pDDraw->lpLcl->lpGbl; mDdCreateSurface.lpDD = pDDraw->lpLcl->lpGbl;
mDdCreateSurface.CreateSurface = pDDraw->lpLcl->lpGbl->lpDDCBtmp->HALDD.CreateSurface; mDdCreateSurface.CreateSurface = pDDraw->lpLcl->lpGbl->lpDDCBtmp->HALDD.CreateSurface;
@ -195,12 +213,12 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD,
if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED) if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED)
{ {
return DDERR_NOTINITIALIZED; return DDERR_NOTINITIALIZED;
} }
if (mDdCreateSurface.ddRVal != DD_OK) if (mDdCreateSurface.ddRVal != DD_OK)
{ {
return mDdCreateSurface.ddRVal; return mDdCreateSurface.ddRVal;
} }
*ppSurf = &slist_int[0]->lpVtbl; *ppSurf = &slist_int[0]->lpVtbl;
@ -233,7 +251,7 @@ CreatePrimarySurface(LPDDRAWI_DIRECTDRAW_INT This,
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
// That->lpLcl->lpSurfMore->slist = lpLcl; // That->lpLcl->lpSurfMore->slist = lpLcl;
That->lpVtbl = &DirectDrawSurface7_Vtable; That->lpVtbl = &DirectDrawSurface7_Vtable;
That->lpLcl->lpSurfMore->dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE); That->lpLcl->lpSurfMore->dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
@ -264,37 +282,37 @@ CreatePrimarySurface(LPDDRAWI_DIRECTDRAW_INT This,
mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist; mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist;
That->lpLcl->ddsCaps.dwCaps = pDDSD->ddsCaps.dwCaps; That->lpLcl->ddsCaps.dwCaps = pDDSD->ddsCaps.dwCaps;
This->lpLcl->lpPrimary = That; This->lpLcl->lpPrimary = That;
if (mDdCanCreateSurface.CanCreateSurface(&mDdCanCreateSurface)== DDHAL_DRIVER_NOTHANDLED) if (mDdCanCreateSurface.CanCreateSurface(&mDdCanCreateSurface)== DDHAL_DRIVER_NOTHANDLED)
{ {
return DDERR_NOTINITIALIZED; return DDERR_NOTINITIALIZED;
} }
if (mDdCanCreateSurface.ddRVal != DD_OK) if (mDdCanCreateSurface.ddRVal != DD_OK)
{ {
return DDERR_NOTINITIALIZED; return DDERR_NOTINITIALIZED;
} }
mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist; mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist;
if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED) if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED)
{ {
return DDERR_NOTINITIALIZED; return DDERR_NOTINITIALIZED;
} }
if (mDdCreateSurface.ddRVal != DD_OK) if (mDdCreateSurface.ddRVal != DD_OK)
{ {
return mDdCreateSurface.ddRVal; return mDdCreateSurface.ddRVal;
} }
That->lpLcl->lpSurfMore->slist = mDdCreateSurface.lplpSList ; That->lpLcl->lpSurfMore->slist = mDdCreateSurface.lplpSList ;
That->lpLink = This->lpLcl->lpGbl->dsList; That->lpLink = This->lpLcl->lpGbl->dsList;
This->lpLcl->lpGbl->dsList = That; This->lpLcl->lpGbl->dsList = That;
return DD_OK; return DD_OK;
} }
HRESULT HRESULT
@ -398,7 +416,6 @@ CreateOverlaySurface(LPDDRAWI_DIRECTDRAW_INT This,
LPDDRAWI_DDRAWSURFACE_INT *That, LPDDRAWI_DDRAWSURFACE_INT *That,
LPDDSURFACEDESC2 pDDSD) LPDDSURFACEDESC2 pDDSD)
{ {
DDSURFACEDESC mddsdOverlay; DDSURFACEDESC mddsdOverlay;
DDRAWI_DDRAWSURFACE_GBL mOverlayGlobal; DDRAWI_DDRAWSURFACE_GBL mOverlayGlobal;
DDRAWI_DDRAWSURFACE_LCL mOverlayLocal[6]; DDRAWI_DDRAWSURFACE_LCL mOverlayLocal[6];
@ -489,13 +506,13 @@ CreateOverlaySurface(LPDDRAWI_DIRECTDRAW_INT This,
/*if (!mHALInfo.lpDDSurfaceCallbacks->AddAttachedSurface(mpOverlayLocals[i], mpOverlayLocals[j])) /*if (!mHALInfo.lpDDSurfaceCallbacks->AddAttachedSurface(mpOverlayLocals[i], mpOverlayLocals[j]))
{ {
// derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d, %d) failed", this, i, j); // derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d, %d) failed", this, i, j);
return DD_FALSE; return DD_FALSE;
}*/ }*/
if (!DdAttachSurface(mpOverlayLocals[i], mpOverlayLocals[j])) if (!DdAttachSurface(mpOverlayLocals[i], mpOverlayLocals[j]))
{ {
// derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d, %d) failed", this, i, j); // derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d, %d) failed", this, i, j);
//printf("Fail to DdAttachSurface (%d:%d)\n", i, j); //printf("Fail to DdAttachSurface (%d:%d)\n", i, j);
DX_STUB_str("DdAttachSurface fail"); DX_STUB_str("DdAttachSurface fail");
@ -513,14 +530,14 @@ CreateOverlaySurface(LPDDRAWI_DIRECTDRAW_INT This,
if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED) if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED)
{ {
DX_STUB_str("mDdCreateSurface DDHAL_DRIVER_NOTHANDLED fail"); DX_STUB_str("mDdCreateSurface DDHAL_DRIVER_NOTHANDLED fail");
return DDERR_NOTINITIALIZED; return DDERR_NOTINITIALIZED;
} }
if (mDdCreateSurface.ddRVal != DD_OK) if (mDdCreateSurface.ddRVal != DD_OK)
{ {
DX_STUB_str("mDdCreateSurface fail"); DX_STUB_str("mDdCreateSurface fail");
return mDdCreateSurface.ddRVal; return mDdCreateSurface.ddRVal;
} }
@ -540,20 +557,17 @@ CreateOverlaySurface(LPDDRAWI_DIRECTDRAW_INT This,
mDdUpdateOverlay.rSrc.right = 50; mDdUpdateOverlay.rSrc.right = 50;
mDdUpdateOverlay.rSrc.bottom = 50; mDdUpdateOverlay.rSrc.bottom = 50;
if ( mDdUpdateOverlay.UpdateOverlay(&mDdUpdateOverlay) == DDHAL_DRIVER_NOTHANDLED) if ( mDdUpdateOverlay.UpdateOverlay(&mDdUpdateOverlay) == DDHAL_DRIVER_NOTHANDLED)
{ {
DX_STUB_str("UpdateOverlay fail"); DX_STUB_str("UpdateOverlay fail");
return DDERR_NOTINITIALIZED; return DDERR_NOTINITIALIZED;
} }
if (mDdUpdateOverlay.ddRVal != DD_OK) if (mDdUpdateOverlay.ddRVal != DD_OK)
{ {
DX_STUB_str("mDdUpdateOverlay fail"); DX_STUB_str("mDdUpdateOverlay fail");
//printf("Fail to mDdUpdateOverlay mDdUpdateOverlay.ddRVal = %d:%s\n",(int)mDdUpdateOverlay.ddRVal,DDErrorString(mDdUpdateOverlay.ddRVal)); //printf("Fail to mDdUpdateOverlay mDdUpdateOverlay.ddRVal = %d:%s\n",(int)mDdUpdateOverlay.ddRVal,DDErrorString(mDdUpdateOverlay.ddRVal));
return mDdUpdateOverlay.ddRVal; return mDdUpdateOverlay.ddRVal;
} }