Author: greatlrd
Date: Tue Jul 25 16:21:00 2006
New Revision: 23283
URL:
http://svn.reactos.org/svn/reactos?rev=23283&view=rev
Log:
Implement Main_DDrawSurface_GetAttachedSurface after wine desgin of it
we need rewrite Createsurface and Implement AttahedSurface
Thanks to wine code and some wine devloper to expain how it works
Modified:
trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
trunk/reactos/dll/directx/ddraw/main/surface_main.c
trunk/reactos/dll/directx/ddraw/rosdraw.h
Modified: trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main/ddr…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main/ddraw_main.c Tue Jul 25 16:21:00 2006
@@ -325,10 +325,10 @@
if (pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
- memcpy(&That->Surf->mddsdPrimary,pDDSD,sizeof(DDSURFACEDESC));
- That->Surf->mddsdPrimary.dwSize = sizeof(DDSURFACEDESC);
+ memcpy(&That->Surf->mddsdPrimary,pDDSD,pDDSD->dwSize);
+ That->Surf->mddsdPrimary.dwSize = sizeof(DDSURFACEDESC2);
This->mDdCanCreateSurface.bIsDifferentPixelFormat = FALSE;
- This->mDdCanCreateSurface.lpDDSurfaceDesc =
&That->Surf->mddsdPrimary;
+ This->mDdCanCreateSurface.lpDDSurfaceDesc =
(DDSURFACEDESC*)&That->Surf->mddsdPrimary;
if
(This->mDdCanCreateSurface.CanCreateSurface(&This->mDdCanCreateSurface)==
DDHAL_DRIVER_NOTHANDLED)
{
@@ -366,7 +366,7 @@
- This->mDdCreateSurface.lpDDSurfaceDesc =
&That->Surf->mddsdPrimary;
+ This->mDdCreateSurface.lpDDSurfaceDesc =
(DDSURFACEDESC*)&That->Surf->mddsdPrimary;
This->mDdCreateSurface.lplpSList = That->Surf->mpPrimaryLocals;
This->mDdCreateSurface.dwSCnt =
This->mDDrawGlobal.dsList->dwIntRefCnt ;
Modified: trunk/reactos/dll/directx/ddraw/main/surface_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main/sur…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main/surface_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main/surface_main.c Tue Jul 25 16:21:00 2006
@@ -234,9 +234,54 @@
LPDDSCAPS2 pCaps,
LPDIRECTDRAWSURFACE7* ppSurface)
{
- DX_WINDBG_trace();
-
- DX_STUB;
+ IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
+ IDirectDrawSurfaceImpl *surf;
+ DDSCAPS2 our_caps;
+
+ DX_WINDBG_trace();
+
+ /*
+ Wine Code from wine cvs 27/7-2006
+ with small changes to fith into our ddraw desgin
+ */
+
+ our_caps = *pCaps;
+
+ /*
+ FIXME adding version check
+ Earlier dx apps put garbage into these members, clear them
+ */
+ our_caps.dwCaps2 = 0;
+ our_caps.dwCaps3 = 0;
+ our_caps.dwCaps4 = 0;
+
+ surf = This;
+ while( (surf = surf->Surf->next_complex) )
+ {
+ if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) ==
our_caps.dwCaps) &&
+ ((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) ==
our_caps.dwCaps2))
+ {
+ *ppSurface = (LPDIRECTDRAWSURFACE7)surf;
+ Main_DDrawSurface_AddRef(*ppSurface);
+ return DD_OK;
+ }
+ }
+
+ /* Next, look at the attachment chain */
+ surf = This;
+
+ while( (surf = surf->Surf->next_attached) )
+ {
+ if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) ==
our_caps.dwCaps) &&
+ ((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) ==
our_caps.dwCaps2))
+ {
+ *ppSurface = (LPDIRECTDRAWSURFACE7)surf;
+ Main_DDrawSurface_AddRef(*ppSurface);
+ return DD_OK;
+ }
+ }
+
+ return DDERR_NOTFOUND;
}
HRESULT WINAPI
Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/rosdraw.h (original)
+++ trunk/reactos/dll/directx/ddraw/rosdraw.h Tue Jul 25 16:21:00 2006
@@ -116,10 +116,26 @@
DDRAWI_DDRAWCLIPPER_LCL mPrimaryClipperLocal;
DDRAWI_DDRAWCLIPPER_GBL mPrimaryClipperGlobal;
- DDSURFACEDESC mddsdPrimary;
+ DDSURFACEDESC2 mddsdPrimary;
DDRAWI_DDRAWSURFACE_LCL *mpInUseSurfaceLocals[1];
+ /*
+ AttachList We need getting surface pointer
+ of already create surface that have some private
+ data msdn ATTACHLIST can not provide all info
+ we need with our desgin therfor we are using
+ wine desgin for it
+ type IDirectDrawSurfaceImpl;
+ */
+ LPVOID next_attached;
+ LPVOID first_attached;
+ LPVOID next_complex;
+ LPVOID first_complex;
+ LPVOID next;
+ LPVOID prev;
+
+ /* Need be delete later */
DDRAWI_DDRAWSURFACE_GBL mSurfGlobal;
DDRAWI_DDRAWSURFACE_MORE mSurfMore;
DDRAWI_DDRAWSURFACE_LCL mSurfLocal;