Author: greatlrd
Date: Mon Jul 24 22:29:02 2006
New Revision: 23268
URL:
http://svn.reactos.org/svn/reactos?rev=23268&view=rev
Log:
Sorry I have create a mess in ddraw.c
1. found why createsurface did stop working, fixed
2. Split some surface member betwin gbl and lcl struct
3. Reimplement the revert I did, implement Revision: 23263 and Revision: 23262 again
4. Revert new createsurface code and setdisplay mode code that was intrudes
5. Alot other changes as well.
6. Todo Need remove the old code for HAL and HEL split.
7. move Our ddraw working again with apps it did work with.
8. Almost complete kill the file ddraw_hal.c some api is left be kill for at moment they
are in use
Added:
trunk/reactos/dll/directx/ddraw/cleanup.c
Modified:
trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c
trunk/reactos/dll/directx/ddraw/hal/surface_hal.c
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
trunk/reactos/dll/directx/ddraw/soft/ddraw_hel.c
trunk/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c
trunk/reactos/dll/directx/ddraw/startup.c
Added: trunk/reactos/dll/directx/ddraw/cleanup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/cleanup.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/cleanup.c (added)
+++ trunk/reactos/dll/directx/ddraw/cleanup.c Mon Jul 24 22:29:02 2006
@@ -1,0 +1,51 @@
+/* $Id: main.c 21434 2006-04-01 19:12:56Z greatlrd $
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * FILE: lib/ddraw/ddraw.c
+ * PURPOSE: DirectDraw Library
+ * PROGRAMMER: Magnus Olsen (greatlrd)
+ *
+ */
+
+#include <windows.h>
+#include "rosdraw.h"
+#include "d3dhal.h"
+
+VOID
+Cleanup(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);
+ }
+
+}
+
Modified: trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/hal/ddra…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c (original)
+++ trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c Mon Jul 24 22:29:02 2006
@@ -9,6 +9,8 @@
*/
#include "rosdraw.h"
+
+
HRESULT
@@ -42,7 +44,29 @@
return mem.ddRVal;
}
+HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h)
+{
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+ DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData;
+
+ if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_WAITFORVERTICALBLANK))
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
+ WaitVectorData.lpDD = &This->mDDrawGlobal;
+ WaitVectorData.dwFlags = dwFlags;
+ WaitVectorData.hEvent = (DWORD)h;
+ WaitVectorData.ddRVal = DDERR_NOTPALETTIZED;
+
+ if
(This->mDDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) !=
DDHAL_DRIVER_HANDLED)
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
+ return WaitVectorData.ddRVal;
+}
HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
{
@@ -67,31 +91,36 @@
return GetScan.ddRVal;
}
-HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
-{
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-
- DDHAL_FLIPTOGDISURFACEDATA FlipGdi;
-
- if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_FLIPTOGDISURFACE))
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- FlipGdi.lpDD = &This->mDDrawGlobal;
- FlipGdi.ddRVal = DDERR_NOTPALETTIZED;
-
- if (This->mDDrawGlobal.lpDDCBtmp->HALDD.FlipToGDISurface(&FlipGdi) !=
DDHAL_DRIVER_HANDLED)
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- /* FIXME where should FlipGdi.dwToGDI be fill in */
- return FlipGdi.ddRVal;
-}
+HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD
dwHeight,
+ DWORD dwBPP, DWORD dwRefreshRate,
DWORD dwFlags)
+{
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+ DDHAL_SETMODEDATA mode;
+
+ if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
+ 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->mDDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) !=
DDHAL_DRIVER_HANDLED)
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
+ return mode.ddRVal;
+}
Modified: trunk/reactos/dll/directx/ddraw/hal/surface_hal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/hal/surf…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/hal/surface_hal.c (original)
+++ trunk/reactos/dll/directx/ddraw/hal/surface_hal.c Mon Jul 24 22:29:02 2006
@@ -35,9 +35,9 @@
return DDERR_NODRIVERSUPPORT;
}
- mDdBlt.lpDDDestSurface = This->Owner->mpPrimaryLocals[0];
-
- if (!DdResetVisrgn(This->Owner->mpPrimaryLocals[0], NULL))
+ mDdBlt.lpDDDestSurface = This->Surf->mpPrimaryLocals[0];
+
+ if (!DdResetVisrgn(This->Surf->mpPrimaryLocals[0], NULL))
{
return DDERR_NOGDI;
}
@@ -113,7 +113,7 @@
Lock.lpDD = &This->Owner->mDDrawGlobal;
Lock.lpSurfData = NULL;
- if (!DdResetVisrgn(&This->Owner->mPrimaryLocal, NULL))
+ if (!DdResetVisrgn(&This->Surf->mPrimaryLocal, NULL))
{
OutputDebugStringA("Here DdResetVisrgn lock");
return DDERR_UNSUPPORTED;
@@ -138,13 +138,13 @@
{
RtlZeroMemory(pDDSD,sizeof(DDSURFACEDESC2));
// FIXME the interanl mddsdPrimary shall be DDSURFACEDESC2
- memcpy(pDDSD,&This->Owner->mddsdPrimary,sizeof(DDSURFACEDESC));
+ memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
pDDSD->dwSize = sizeof(DDSURFACEDESC2);
}
if (pDDSD->dwSize == sizeof(DDSURFACEDESC))
{
RtlZeroMemory(pDDSD,sizeof(DDSURFACEDESC));
- memcpy(pDDSD,&This->Owner->mddsdPrimary,sizeof(DDSURFACEDESC));
+ memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
pDDSD->dwSize = sizeof(DDSURFACEDESC);
}
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 Mon Jul 24 22:29:02 2006
@@ -8,12 +8,13 @@
*
*/
-#include "rosdraw.h"
-
/*
* IMPLEMENT
* Status ok
*/
+
+#include "rosdraw.h"
+
HRESULT
WINAPI
Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
@@ -49,7 +50,6 @@
Main_DirectDraw_AddRef(iface);
return S_OK;
}
-
/*
* IMPLEMENT
* Status ok
@@ -104,6 +104,7 @@
}
return ref;
}
+
/*
* IMPLEMENT
* Status ok
@@ -131,16 +132,14 @@
DX_WINDBG_trace();
if (pUnkOuter!=NULL)
- return DDERR_INVALIDPARAMS;
+ return CLASS_E_NOAGGREGATION;
IDirectDrawClipperImpl* That;
That = (IDirectDrawClipperImpl*)HeapAlloc(GetProcessHeap(), 0,
sizeof(IDirectDrawClipperImpl));
if (That == NULL)
return E_OUTOFMEMORY;
-
- ZeroMemory(That, sizeof(IDirectDrawClipperImpl));
-
+
That->lpVtbl = &DirectDrawClipper_Vtable;
That->ref = 1;
*ppClipper = (LPDIRECTDRAWCLIPPER)That;
@@ -148,7 +147,10 @@
return That->lpVtbl->Initialize (*ppClipper, (LPDIRECTDRAW)iface, dwFlags);
}
-
+/*
+ * IMPLEMENT
+ * Status ok
+ */
HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN
pUnkOuter)
{
@@ -258,318 +260,10 @@
return DDERR_NODRIVERSUPPORT;
}
-
-
-const DDPIXELFORMAT pixelformats[] =
-{
- /* 8bpp paletted */
- { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, { 24 }, { 0xFF0000 },
- { 0x00FF00 }, { 0x0000FF } },
- /* 15bpp 5/5/5 */
- { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, { 16 }, { 0x7C00 }, { 0x3E0 },
- { 0x1F } },
- /* 16bpp 5/6/5 */
- { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, { 16 }, { 0xF800 }, { 0x7E0 },
- { 0x1F } },
- /* 24bpp 8/8/8 */
- { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, { 24 }, { 0xFF0000 },
- { 0x00FF00 }, { 0x0000FF } },
- /* 32bpp 8/8/8 */
- { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, { 32 }, { 0xFF0000 },
- { 0x00FF00 }, { 0x0000FF } }
-};
-
-const DWORD pixelformatsCount = sizeof(pixelformats) / sizeof(DDPIXELFORMAT);
-
-/* more surface format not adding it */
- /* 4 bit paletted 0 */
- // sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_PALETTEINDEXED4, 0, 4, 0x00, 0x00,
0x00, 0x00
-
- ///* 8bpp paletted 1 */
- //{sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED8, 0, 8, 0, 0, 0, 0},
-
- ///* 15bpp 5:5:5 RGB 2 */
- //{sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x7c00, 0x03e0, 0x001f, 0},
-
- ///* 15bpp 1:5:5:5 ARGB 3 */
- //{sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0, 16, 0x7c00, 0x03e0,
0x001f, 0x8000},
-
- ///* 16bpp 5:6:5 RGB 4 */
- //{sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0xf800, 0x07e0, 0x001f, 0}
-
- ///* 16bpp 4:4:4:4 ARGB 5 */
- //{sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS,´0, 16, 0x0f00,
0x00f0, 0x000f, 0xf000},
-
- /* 24bpp 8/8/8 RGB 6 */
- // {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 24 , 0x00FF0000,
0x0000FF00 , 0x000000FF, 0 },
-
- /* 32bpp 8:8:8 RGB 7 */
- // {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff,
0},
-
- /* 32bpp 8:8:8:8 ARGB 8*/
- // {sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0, 32, 0x00ff0000,
0x0000ff00, 0x000000ff, 0xff000000}
-
-
-
-
-/*
- * IMPLEMENT
- * Status this api is finish and is 100% correct
- */
-HRESULT
-WINAPI
-Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
-{
- DX_WINDBG_trace();
-
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-
- if (iface==NULL)
- {
- return DDERR_NOTINITIALIZED;
- }
-
- if (This->InitializeDraw == TRUE)
- {
- return DDERR_ALREADYINITIALIZED;
- }
- else
- {
- This->InitializeDraw = TRUE;
- }
-
- return DD_OK;
-}
-
-
-
-
-
-
-/*
- * IMPLEMENT
- * Status
- * not finish yet but is working fine
- * it prevent memmory leaks at exit
- */
-
-
-
-
-
-
-HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD
cooplevel)
-{
- // TODO:
- // - create a scaner that check which driver we should get the HDC from
- // for now we always asume it is the active dirver that should be use.
- // - allow more Flags
-
- DX_WINDBG_trace();
-
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
- DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
-
- // check the parameters
- if ((This->cooperative_level == cooplevel) &&
((HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd == hwnd))
- return DD_OK;
-
- if (This->cooperative_level)
- return DDERR_EXCLUSIVEMODEALREADYSET;
-
- if ((cooplevel&DDSCL_EXCLUSIVE) && !(cooplevel&DDSCL_FULLSCREEN))
- return DDERR_INVALIDPARAMS;
-
- if (cooplevel&DDSCL_NORMAL && cooplevel&DDSCL_FULLSCREEN)
- return DDERR_INVALIDPARAMS;
-
- // set the data
- 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->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_SETEXCLUSIVEMODE))
- {
- DX_STUB_str("HAL \n");
- SetExclusiveMode.SetExclusiveMode =
This->mDDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode;
- }
- else
- {
- DX_STUB_str("HEL \n");
- SetExclusiveMode.SetExclusiveMode =
This->mDDrawGlobal.lpDDCBtmp->HELDD.SetExclusiveMode;
- }
-
- SetExclusiveMode.lpDD = &This->mDDrawGlobal;
- SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
- SetExclusiveMode.dwEnterExcl = This->cooperative_level;
-
- if (SetExclusiveMode.SetExclusiveMode(&SetExclusiveMode) !=
DDHAL_DRIVER_HANDLED)
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- return SetExclusiveMode.ddRVal;
-}
-
-HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD
dwHeight,
- DWORD dwBPP, DWORD
dwRefreshRate, DWORD dwFlags)
-{
- DX_WINDBG_trace();
-
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
- //BOOL dummy = TRUE;
-
- DX_WINDBG_trace_res((int)dwWidth, (int)dwHeight, (int)dwBPP );
- /* FIXME check the refresrate if it same if it not same do the mode switch */
- if ((This->mDDrawGlobal.vmiData.dwDisplayHeight == dwHeight) &&
- (This->mDDrawGlobal.vmiData.dwDisplayWidth == dwWidth) &&
- (This->mDDrawGlobal.vmiData.ddpfDisplay.dwRGBBitCount == dwBPP))
- {
-
- return DD_OK;
- }
-
- if (This->mDdSetMode.SetMode == NULL )
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
-
- This->mDdSetMode.ddRVal = DDERR_NODRIVERSUPPORT;
-
- // FIXME : fill the mode.inexcl;
- // FIXME : fill the mode.useRefreshRate;
-
- /* FIXME
- we hardcoding modIndex list we should
- try getting it from ReactOS instead and compare it
- for now a small hack for do, using VBE 3.0 mode
- index table todo it.
- */
-
- /* 320x200 15, 16, 32 */
- if ((dwHeight == 200) && (dwWidth == 320) && (dwBPP == 15))
- {
- This->mDdSetMode.dwModeIndex = 0x10d;
- }
-
- if ((dwHeight == 200) && (dwWidth == 320) && (dwBPP == 16))
- {
- This->mDdSetMode.dwModeIndex = 0x10e;
- }
-
- if ((dwHeight == 200) && (dwWidth == 320) && (dwBPP == 32))
- {
- This->mDdSetMode.dwModeIndex = 0x10f;
- }
-
-
- /* 640x400 8 */
- if ((dwHeight == 400) && (dwWidth == 640) && (dwBPP == 8))
- {
- This->mDdSetMode.dwModeIndex = 0x100;
- }
-
- /* 640x480 8, 15, 16 , 32*/
- if ((dwHeight == 480) && (dwWidth == 640) && (dwBPP == 8))
- {
- This->mDdSetMode.dwModeIndex = 0x101;
- }
-
- if ((dwHeight == 480) && (dwWidth == 640) && (dwBPP == 15))
- {
- This->mDdSetMode.dwModeIndex = 0x110;
- }
-
- if ((dwHeight == 480) && (dwWidth == 640) && (dwBPP == 16))
- {
- This->mDdSetMode.dwModeIndex = 0x111;
- }
-
- if ((dwHeight == 480) && (dwWidth == 640) && (dwBPP == 32))
- {
- This->mDdSetMode.dwModeIndex = 0x112;
- }
-
- /* 800x600 4, 8, 15, 16 , 32*/
- if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 4))
- {
- This->mDdSetMode.dwModeIndex = 0x102;
- }
-
- if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 8))
- {
- This->mDdSetMode.dwModeIndex = 0x103;
- }
-
- if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 15))
- {
- This->mDdSetMode.dwModeIndex = 0x113;
- }
-
- if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 16))
- {
- This->mDdSetMode.dwModeIndex = 0x114;
- }
-
- if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 32))
- {
- This->mDdSetMode.dwModeIndex = 0x115;
- }
-
- /* 1024x768 8, 15, 16 , 32*/
-
- if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 4))
- {
- This->mDdSetMode.dwModeIndex = 0x104;
- }
-
- if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 8))
- {
- This->mDdSetMode.dwModeIndex = 0x105;
- }
-
- if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 15))
- {
- This->mDdSetMode.dwModeIndex = 0x116;
- }
- if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 16))
- {
- This->mDdSetMode.dwModeIndex = 0x117;
- }
-
- if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 32))
- {
- This->mDdSetMode.dwModeIndex = 0x118;
- }
-
- /* not coding for 1280x1024 */
-
-
- if (This->mDdSetMode.SetMode(&This->mDdSetMode)==DDHAL_DRIVER_HANDLED);
- {
-
- //if (This->mDdSetMode.ddRVal == DD_OK)
- //{
- // // DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
- // /* FIXME fill the This->DirectDrawGlobal.vmiData right */
- //}
-
- return This->mDdSetMode.ddRVal;
- }
- return DDERR_NODRIVERSUPPORT;
-}
-
-
-
-
-
-
+/*
+ * stub
+ * Status not done
+ */
HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2
pDDSD,
LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown
*pUnkOuter)
{
@@ -631,10 +325,10 @@
if (pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
- memcpy(&That->Owner->mddsdPrimary,pDDSD,sizeof(DDSURFACEDESC));
- That->Owner->mddsdPrimary.dwSize = sizeof(DDSURFACEDESC);
+ memcpy(&That->Surf->mddsdPrimary,pDDSD,sizeof(DDSURFACEDESC));
+ That->Surf->mddsdPrimary.dwSize = sizeof(DDSURFACEDESC);
This->mDdCanCreateSurface.bIsDifferentPixelFormat = FALSE;
- This->mDdCanCreateSurface.lpDDSurfaceDesc =
(DDSURFACEDESC*)&That->Owner->mddsdPrimary;
+ This->mDdCanCreateSurface.lpDDSurfaceDesc =
&That->Surf->mddsdPrimary;
if
(This->mDdCanCreateSurface.CanCreateSurface(&This->mDdCanCreateSurface)==
DDHAL_DRIVER_NOTHANDLED)
{
@@ -654,26 +348,26 @@
That->Owner->mPrimaryGlobal.wHeight =
(WORD)This->mpModeInfos[0].dwHeight;
That->Owner->mPrimaryGlobal.lPitch = This->mpModeInfos[0].lPitch;
- memset(&That->Owner->mPrimaryMore, 0,
sizeof(DDRAWI_DDRAWSURFACE_MORE));
- That->Owner->mPrimaryMore.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
-
- memset(&That->Owner->mPrimaryLocal, 0,
sizeof(DDRAWI_DDRAWSURFACE_LCL));
- That->Owner->mPrimaryLocal.lpGbl =
&That->Owner->mPrimaryGlobal;
- That->Owner->mPrimaryLocal.lpSurfMore =
&That->Owner->mPrimaryMore;
- That->Owner->mPrimaryLocal.dwProcessId = GetCurrentProcessId();
+ memset(&That->Surf->mPrimaryMore, 0,
sizeof(DDRAWI_DDRAWSURFACE_MORE));
+ That->Surf->mPrimaryMore.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
+
+ memset(&That->Surf->mPrimaryLocal, 0,
sizeof(DDRAWI_DDRAWSURFACE_LCL));
+ That->Surf->mPrimaryLocal.lpGbl =
&That->Owner->mPrimaryGlobal;
+ That->Surf->mPrimaryLocal.lpSurfMore =
&That->Surf->mPrimaryMore;
+ That->Surf->mPrimaryLocal.dwProcessId = GetCurrentProcessId();
/*
FIXME Check the flags if we shall create a primaresurface for overlay or
something else
Examine windows which flags are being set for we assume this is right unsue
I think
*/
//That->Surf->mPrimaryLocal.dwFlags =
DDRAWISURF_PARTOFPRIMARYCHAIN|DDRAWISURF_HASOVERLAYDATA;
- That->Owner->mPrimaryLocal.ddsCaps.dwCaps =
That->Owner->mddsdPrimary.ddsCaps.dwCaps;
- That->Owner->mpPrimaryLocals[0] =
&That->Owner->mPrimaryLocal;
+ That->Surf->mPrimaryLocal.ddsCaps.dwCaps =
That->Surf->mddsdPrimary.ddsCaps.dwCaps;
+ That->Surf->mpPrimaryLocals[0] = &That->Surf->mPrimaryLocal;
- This->mDdCreateSurface.lpDDSurfaceDesc =
(DDSURFACEDESC*)&That->Owner->mddsdPrimary;
- This->mDdCreateSurface.lplpSList = That->Owner->mpPrimaryLocals;
+ This->mDdCreateSurface.lpDDSurfaceDesc =
&That->Surf->mddsdPrimary;
+ This->mDdCreateSurface.lplpSList = That->Surf->mpPrimaryLocals;
This->mDdCreateSurface.dwSCnt =
This->mDDrawGlobal.dsList->dwIntRefCnt ;
@@ -700,8 +394,8 @@
DDSD_ZBUFFERBITDEPTH
*/
- That->Owner->mddsdPrimary.dwFlags = DDSD_CAPS + DDSD_PIXELFORMAT;
-
RtlCopyMemory(&That->Owner->mddsdPrimary.ddpfPixelFormat,&This->mDDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
+ That->Surf->mddsdPrimary.dwFlags = DDSD_CAPS + DDSD_PIXELFORMAT;
+
RtlCopyMemory(&That->Surf->mddsdPrimary.ddpfPixelFormat,&This->mDDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
//RtlCopyMemory(&That->Surf->mddsdPrimary.ddsCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS));
//RtlCopyMemory(&pDDSD->ddckCKDestOverlay,&This->mDDrawGlobal.ddckCKDestOverlay,sizeof(DDCOLORKEY));
@@ -709,35 +403,35 @@
if (This->mDDrawGlobal.vmiData.dwDisplayHeight != 0)
{
- That->Owner->mddsdPrimary.dwFlags += DDSD_HEIGHT ;
- That->Owner->mddsdPrimary.dwHeight =
This->mDDrawGlobal.vmiData.dwDisplayHeight;
+ That->Surf->mddsdPrimary.dwFlags += DDSD_HEIGHT ;
+ That->Surf->mddsdPrimary.dwHeight =
This->mDDrawGlobal.vmiData.dwDisplayHeight;
}
if (This->mDDrawGlobal.vmiData.dwDisplayWidth != 0)
{
- That->Owner->mddsdPrimary.dwFlags += DDSD_WIDTH ;
- That->Owner->mddsdPrimary.dwWidth =
This->mDDrawGlobal.vmiData.dwDisplayWidth;
+ That->Surf->mddsdPrimary.dwFlags += DDSD_WIDTH ;
+ That->Surf->mddsdPrimary.dwWidth =
This->mDDrawGlobal.vmiData.dwDisplayWidth;
}
if (This->mDDrawGlobal.vmiData.lDisplayPitch != 0)
{
- That->Owner->mddsdPrimary.dwFlags += DDSD_PITCH ;
- That->Owner->mddsdPrimary.lPitch =
This->mDDrawGlobal.vmiData.lDisplayPitch;
+ That->Surf->mddsdPrimary.dwFlags += DDSD_PITCH ;
+ That->Surf->mddsdPrimary.lPitch =
This->mDDrawGlobal.vmiData.lDisplayPitch;
}
if ( This->mDDrawGlobal.dwMonitorFrequency != 0)
{
- That->Owner->mddsdPrimary.dwFlags += DDSD_REFRESHRATE ;
- That->Owner->mddsdPrimary.dwRefreshRate =
This->mDDrawGlobal.dwMonitorFrequency;
+ That->Surf->mddsdPrimary.dwFlags += DDSD_REFRESHRATE ;
+ That->Surf->mddsdPrimary.dwRefreshRate =
This->mDDrawGlobal.dwMonitorFrequency;
}
if (This->mDDrawGlobal.vmiData.ddpfDisplay.dwAlphaBitDepth != 0)
{
- That->Owner->mddsdPrimary.dwFlags += DDSD_ALPHABITDEPTH ;
- That->Owner->mddsdPrimary.dwAlphaBitDepth =
This->mDDrawGlobal.vmiData.ddpfDisplay.dwAlphaBitDepth;
+ That->Surf->mddsdPrimary.dwFlags += DDSD_ALPHABITDEPTH ;
+ That->Surf->mddsdPrimary.dwAlphaBitDepth =
This->mDDrawGlobal.vmiData.ddpfDisplay.dwAlphaBitDepth;
}
- That->Surf->mpInUseSurfaceLocals[0] =
&That->Owner->mPrimaryLocal;
+ That->Surf->mpInUseSurfaceLocals[0] =
&That->Surf->mPrimaryLocal;
return DD_OK;
}
@@ -873,188 +567,10 @@
}
-
-
-// This function is exported by the dll
-HRESULT WINAPI DirectDrawCreateClipper (DWORD dwFlags,
- LPDIRECTDRAWCLIPPER* lplpDDClipper, LPUNKNOWN
pUnkOuter)
-{
- DX_WINDBG_trace();
-
- return Main_DirectDraw_CreateClipper(NULL, dwFlags, lplpDDClipper, pUnkOuter);
-}
-
-
-
-HRESULT WINAPI Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
-{
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-
- if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_FLIPTOGDISURFACE)
- {
- return Hal_DirectDraw_FlipToGDISurface( iface);
- }
-
- return Hel_DirectDraw_FlipToGDISurface( iface);
-}
-
-HRESULT WINAPI Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
- LPDDCAPS pHELCaps)
-{
- DX_WINDBG_trace();
-
- DDSCAPS2 ddscaps;
- DWORD status = DD_FALSE;
- IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
-
- if (pDriverCaps != NULL)
- {
-
-
-
- Main_DirectDraw_GetAvailableVidMem(iface,
- &ddscaps,
- &This->mDDrawGlobal.ddCaps.dwVidMemTotal,
- &This->mDDrawGlobal.ddCaps.dwVidMemFree);
-
- RtlCopyMemory(pDriverCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS));
- pDriverCaps->dwSize=sizeof(DDCAPS);
-
- status = DD_OK;
- }
-
- if (pHELCaps != NULL)
- {
- Main_DirectDraw_GetAvailableVidMem(iface,
- &ddscaps,
- &This->mDDrawGlobal.ddHELCaps.dwVidMemTotal,
- &This->mDDrawGlobal.ddHELCaps.dwVidMemFree);
-
- RtlCopyMemory(pDriverCaps,&This->mDDrawGlobal.ddHELCaps,sizeof(DDCORECAPS));
- status = DD_OK;
- }
-
- return status;
-}
-
-HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2
pDDSD)
-{
- DX_WINDBG_trace();
-
- IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
-
- if (pDDSD == NULL)
- {
- return DD_FALSE;
- }
-
-
- pDDSD->dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT |
DDSD_REFRESHRATE | DDSD_WIDTH;
- pDDSD->dwHeight = This->mDDrawGlobal.vmiData.dwDisplayHeight;
- pDDSD->dwWidth = This->mDDrawGlobal.vmiData.dwDisplayWidth;
- pDDSD->lPitch = This->mDDrawGlobal.vmiData.lDisplayPitch;
- pDDSD->dwRefreshRate = This->mDDrawGlobal.dwMonitorFrequency;
- pDDSD->dwAlphaBitDepth =
This->mDDrawGlobal.vmiData.ddpfDisplay.dwAlphaBitDepth;
-
-
RtlCopyMemory(&pDDSD->ddpfPixelFormat,&This->mDDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
-
RtlCopyMemory(&pDDSD->ddsCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS));
-
-
RtlCopyMemory(&pDDSD->ddckCKDestOverlay,&This->mDDrawGlobal.ddckCKDestOverlay,sizeof(DDCOLORKEY));
-
RtlCopyMemory(&pDDSD->ddckCKSrcOverlay,&This->mDDrawGlobal.ddckCKSrcOverlay,sizeof(DDCOLORKEY));
-
- /* have not check where I should get hold of this info yet
- DWORD dwBackBufferCount;
- DWORD dwReserved;
- LPVOID lpSurface;
- DDCOLORKEY ddckCKDestBlt;
- DDCOLORKEY ddckCKSrcBlt;
- DWORD dwTextureStage;
- */
-
- return DD_OK;
-}
-
-HRESULT WINAPI Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
- HANDLE h)
-{
- DX_WINDBG_trace();
-
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-
- if (This->mDdWaitForVerticalBlank.WaitForVerticalBlank == NULL)
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- This->mDdWaitForVerticalBlank.dwFlags = dwFlags;
- This->mDdWaitForVerticalBlank.hEvent = (DWORD)h;
- This->mDdWaitForVerticalBlank.ddRVal = DDERR_NOTPALETTIZED;
-
- if
(This->mDdWaitForVerticalBlank.WaitForVerticalBlank(&This->mDdWaitForVerticalBlank)
!= DDHAL_DRIVER_HANDLED)
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- return This->mDdWaitForVerticalBlank.ddRVal;
-}
-
-HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2
ddscaps,
- LPDWORD total, LPDWORD free)
-{
- DX_WINDBG_trace();
-
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-
-
- if (This->mDDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags &
DDHAL_MISCCB32_GETAVAILDRIVERMEMORY)
- {
- return Hal_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free);
- }
-
- return Hel_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free);
-}
-
-HRESULT WINAPI Main_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq)
-{
- DX_WINDBG_trace();
-
- IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
-
- if (freq == NULL)
- {
- return DD_FALSE;
- }
-
- *freq = This->mDDrawGlobal.dwMonitorFrequency;
- return DD_OK;
-}
-
-HRESULT WINAPI Main_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
-{
- DX_WINDBG_trace();
-
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-
- if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE)
- {
- return Hal_DirectDraw_GetScanLine( iface, lpdwScanLine);
- }
-
- return Hel_DirectDraw_GetScanLine( iface, lpdwScanLine);
-}
-
-HRESULT WINAPI Main_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
-{
- DX_WINDBG_trace();
-
- ChangeDisplaySettings(NULL, 0);
- return DD_OK;
-}
-
-/********************************** Stubs **********************************/
-
-
-
+/*
+ * stub
+ * Status not done
+ */
HRESULT WINAPI Main_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface, LPDIRECTDRAWSURFACE7
src,
LPDIRECTDRAWSURFACE7* dst)
{
@@ -1062,25 +578,24 @@
DX_STUB;
}
+/*
+ * IMPLEMENT
+ * Status ok
+ */
HRESULT WINAPI Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
LPDDSURFACEDESC2 pDDSD, LPVOID context, LPDDENUMMODESCALLBACK2 callback)
{
- DX_WINDBG_trace();
-
+
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
DDSURFACEDESC2 desc_callback;
DEVMODE DevMode;
int iMode=0;
-
- if (pDDSD!=NULL)
- {
- // FIXME fill in pDDSD
- }
-
- RtlZeroMemory(&desc_callback, sizeof(DDSURFACEDESC2));
- desc_callback.dwSize = sizeof(DDSURFACEDESC2);
-
- desc_callback.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_CAPS |
DDSD_PITCH;
+
+ RtlZeroMemory(&desc_callback, sizeof(DDSURFACEDESC2));
+
+ desc_callback.dwSize = sizeof(DDSURFACEDESC2);
+
+ desc_callback.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_PITCH;
if (dwFlags & DDEDM_REFRESHRATES)
{
@@ -1089,7 +604,7 @@
}
- /// FIXME check if the mode are suppretd before sending it back
+ /* FIXME check if the mode are suppretd before sending it back */
while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0))
{
@@ -1104,65 +619,106 @@
(pDDSD->ddpfPixelFormat.dwRGBBitCount != DevMode.dmBitsPerPel))
continue;
}
-
desc_callback.dwHeight = DevMode.dmPelsHeight;
desc_callback.dwWidth = DevMode.dmPelsWidth;
-
+
if (DevMode.dmFields & DM_DISPLAYFREQUENCY)
{
desc_callback.dwRefreshRate = DevMode.dmDisplayFrequency;
}
-
- switch(DevMode.dmBitsPerPel)
+
+ if (desc_callback.dwRefreshRate == 0)
+ {
+ DX_STUB_str("dwRefreshRate = 0, we hard code it to value 60");
+ desc_callback.dwRefreshRate = 60; /* Maybe the valye should be biger */
+ }
+
+ /* above same as wine */
+ if ((pDDSD->dwFlags & DDSD_PIXELFORMAT) &&
(pDDSD->ddpfPixelFormat.dwFlags & DDPF_RGB) )
+ {
+ switch(DevMode.dmBitsPerPel)
+ {
+ case 8:
+ desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ desc_callback.ddpfPixelFormat.dwFourCC = 0;
+ desc_callback.ddpfPixelFormat.dwRGBBitCount=8;
+ /* FIXME right value */
+ desc_callback.ddpfPixelFormat.dwRBitMask = 0xFF0000; /* red bitmask */
+ desc_callback.ddpfPixelFormat.dwGBitMask = 0; /* Green bitmask */
+ desc_callback.ddpfPixelFormat.dwBBitMask = 0; /* Blue bitmask */
+ break;
+
+ case 15:
+ desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ desc_callback.ddpfPixelFormat.dwFourCC = 0;
+ desc_callback.ddpfPixelFormat.dwRGBBitCount=15;
+ /* FIXME right value */
+ desc_callback.ddpfPixelFormat.dwRBitMask = 0x7C00; /* red bitmask */
+ desc_callback.ddpfPixelFormat.dwGBitMask = 0x3E0; /* Green bitmask */
+ desc_callback.ddpfPixelFormat.dwBBitMask = 0x1F; /* Blue bitmask */
+ break;
+
+ case 16:
+ desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ desc_callback.ddpfPixelFormat.dwFourCC = 0;
+ desc_callback.ddpfPixelFormat.dwRGBBitCount=16;
+ /* FIXME right value */
+ desc_callback.ddpfPixelFormat.dwRBitMask = 0xF800; /* red bitmask */
+ desc_callback.ddpfPixelFormat.dwGBitMask = 0x7E0; /* Green bitmask */
+ desc_callback.ddpfPixelFormat.dwBBitMask = 0x1F; /* Blue bitmask */
+ break;
+
+ case 24:
+ desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ desc_callback.ddpfPixelFormat.dwFourCC = 0;
+ desc_callback.ddpfPixelFormat.dwRGBBitCount=24;
+ /* FIXME right value */
+ desc_callback.ddpfPixelFormat.dwRBitMask = 0xFF0000; /* red bitmask */
+ desc_callback.ddpfPixelFormat.dwGBitMask = 0x00FF00; /* Green bitmask */
+ desc_callback.ddpfPixelFormat.dwBBitMask = 0x0000FF; /* Blue bitmask */
+ break;
+
+ case 32:
+ desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ desc_callback.ddpfPixelFormat.dwFourCC = 0;
+ desc_callback.ddpfPixelFormat.dwRGBBitCount=8;
+ /* FIXME right value */
+ desc_callback.ddpfPixelFormat.dwRBitMask = 0xFF0000; /* red bitmask */
+ desc_callback.ddpfPixelFormat.dwGBitMask = 0x00FF00; /* Green bitmask */
+ desc_callback.ddpfPixelFormat.dwBBitMask = 0x0000FF; /* Blue bitmask */
+ break;
+
+ default:
+ break;
+ }
+ desc_callback.ddsCaps.dwCaps = 0;
+ if (desc_callback.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
+ {
+ /* FIXME srt DDCS Caps flag */
+ desc_callback.ddsCaps.dwCaps |= DDSCAPS_PALETTE;
+ }
+ }
+
+ if (DevMode.dmBitsPerPel==15)
+ {
+ desc_callback.lPitch = DevMode.dmPelsWidth + (8 - ( DevMode.dmPelsWidth % 8)) % 8;
+ }
+ else
+ {
+ desc_callback.lPitch = DevMode.dmPelsWidth * (DevMode.dmBitsPerPel / 8);
+ desc_callback.lPitch = desc_callback.lPitch + (8 - (desc_callback.lPitch % 8)) %
8;
+ }
+
+ if (callback(&desc_callback, context) == DDENUMRET_CANCEL)
{
- case 8:
-
memcpy(&desc_callback.ddpfPixelFormat,&pixelformats[0],sizeof(DDPIXELFORMAT));
- break;
-
- case 15:
-
memcpy(&desc_callback.ddpfPixelFormat,&pixelformats[1],sizeof(DDPIXELFORMAT));
- break;
-
- case 16:
-
memcpy(&desc_callback.ddpfPixelFormat,&pixelformats[2],sizeof(DDPIXELFORMAT));
- break;
-
-
- case 24:
-
memcpy(&desc_callback.ddpfPixelFormat,&pixelformats[3],sizeof(DDPIXELFORMAT));
- break;
-
- case 32:
-
memcpy(&desc_callback.ddpfPixelFormat,&pixelformats[4],sizeof(DDPIXELFORMAT));
- break;
-
- default:
- break;
+ return DD_OK;
}
-
- if (desc_callback.ddpfPixelFormat.dwRGBBitCount==15)
- {
- desc_callback.lPitch = DevMode.dmPelsWidth + (8 - ( DevMode.dmPelsWidth %
8)) % 8;
- }
- else
- {
- desc_callback.lPitch = DevMode.dmPelsWidth *
(desc_callback.ddpfPixelFormat.dwRGBBitCount / 8);
- desc_callback.lPitch = desc_callback.lPitch + (8 - (desc_callback.lPitch %
8)) % 8;
- }
-
- desc_callback.ddsCaps.dwCaps = 0;
- if (desc_callback.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
- {
- desc_callback.ddsCaps.dwCaps |= DDSCAPS_PALETTE;
- }
-
-
- if (callback(&desc_callback, context) == DDENUMRET_CANCEL)
- {
-
- return DD_OK;
- }
iMode++;
}
@@ -1170,13 +726,353 @@
return DD_OK;
}
-HRESULT WINAPI Main_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
+/*
+ * 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
+Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
+{
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+ if (This->mDdFlipToGDISurface.FlipToGDISurface == NULL)
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
+ This->mDdFlipToGDISurface.ddRVal = DDERR_NOTPALETTIZED;
+ This->mDdFlipToGDISurface.dwToGDI = TRUE;
+
+ if
(This->mDdFlipToGDISurface.FlipToGDISurface(&This->mDdFlipToGDISurface)==DDHAL_DRIVER_HANDLED);
+ {
+ return This->mDdFlipToGDISurface.ddRVal;
+ }
+
+ return DDERR_NODRIVERSUPPORT;
+}
+
+/*
+ * IMPLEMENT
+ * Status ok
+ */
+HRESULT WINAPI
+Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
+ LPDDCAPS pHELCaps)
+{
+ DX_WINDBG_trace();
+
+ DDSCAPS2 ddscaps;
+ DWORD status = DD_FALSE;
+ IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
+
+ if (pDriverCaps != NULL)
+ {
+ Main_DirectDraw_GetAvailableVidMem(iface,
+ &ddscaps,
+ &This->mDDrawGlobal.ddCaps.dwVidMemTotal,
+ &This->mDDrawGlobal.ddCaps.dwVidMemFree);
+
+ RtlCopyMemory(pDriverCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS));
+ pDriverCaps->dwSize=sizeof(DDCAPS);
+
+ status = DD_OK;
+ }
+
+ if (pHELCaps != NULL)
+ {
+ Main_DirectDraw_GetAvailableVidMem(iface,
+ &ddscaps,
+ &This->mDDrawGlobal.ddHELCaps.dwVidMemTotal,
+ &This->mDDrawGlobal.ddHELCaps.dwVidMemFree);
+
+ RtlCopyMemory(pDriverCaps,&This->mDDrawGlobal.ddHELCaps,sizeof(DDCORECAPS));
+ status = DD_OK;
+ }
+
+ return status;
+}
+
+
+
+/*
+ * IMPLEMENT
+ * Status this api is finish and is 100% correct
+ */
+HRESULT
+WINAPI
+Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
+{
+ DX_WINDBG_trace();
+
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+ if (iface==NULL)
+ {
+ return DDERR_NOTINITIALIZED;
+ }
+
+ if (This->InitializeDraw == TRUE)
+ {
+ return DDERR_ALREADYINITIALIZED;
+ }
+ else
+ {
+ This->InitializeDraw = TRUE;
+ }
+
+ return DD_OK;
+}
+
+HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD
cooplevel)
+{
+ // TODO:
+ // - create a scaner that check which driver we should get the HDC from
+ // for now we always asume it is the active dirver that should be use.
+ // - allow more Flags
+
+ DX_WINDBG_trace();
+
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+ DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
+
+ // check the parameters
+ if ((This->cooperative_level == cooplevel) &&
((HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd == hwnd))
+ return DD_OK;
+
+ if (This->cooperative_level)
+ return DDERR_EXCLUSIVEMODEALREADYSET;
+
+ if ((cooplevel&DDSCL_EXCLUSIVE) && !(cooplevel&DDSCL_FULLSCREEN))
+ return DDERR_INVALIDPARAMS;
+
+ if (cooplevel&DDSCL_NORMAL && cooplevel&DDSCL_FULLSCREEN)
+ return DDERR_INVALIDPARAMS;
+
+ // set the data
+ 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->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_SETEXCLUSIVEMODE))
+ {
+ DX_STUB_str("HAL \n");
+ SetExclusiveMode.SetExclusiveMode =
This->mDDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode;
+ }
+ else
+ {
+ DX_STUB_str("HEL \n");
+ SetExclusiveMode.SetExclusiveMode =
This->mDDrawGlobal.lpDDCBtmp->HELDD.SetExclusiveMode;
+ }
+
+ SetExclusiveMode.lpDD = &This->mDDrawGlobal;
+ SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
+ SetExclusiveMode.dwEnterExcl = This->cooperative_level;
+
+ if (SetExclusiveMode.SetExclusiveMode(&SetExclusiveMode) !=
DDHAL_DRIVER_HANDLED)
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
+ return SetExclusiveMode.ddRVal;
+}
+
+HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD
dwHeight,
+ DWORD dwBPP, DWORD
dwRefreshRate, DWORD dwFlags)
+{
+ DX_WINDBG_trace();
+
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+ BOOL dummy = TRUE;
+ DWORD ret;
+
+ /* FIXME check the refresrate if it same if it not same do the mode switch */
+ 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->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE)
+ {
+ ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate,
dwFlags);
+
+ }
+ else
+ {
+ ret = Hel_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate,
dwFlags);
+ }
+
+ if (ret == DD_OK)
+ {
+ DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
+ /* FIXME fill the This->DirectDrawGlobal.vmiData right */
+ }
+
+ //This->mDDrawGlobal.lpExclusiveOwner->hDC = (ULONG_PTR)GetDC(
(HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd);
+
+
+
+
+ return ret;
+}
+
+
+
+
+
+
+
+
+
+// This function is exported by the dll
+HRESULT WINAPI DirectDrawCreateClipper (DWORD dwFlags,
+ LPDIRECTDRAWCLIPPER* lplpDDClipper, LPUNKNOWN
pUnkOuter)
+{
+ DX_WINDBG_trace();
+
+ return Main_DirectDraw_CreateClipper(NULL, dwFlags, lplpDDClipper, pUnkOuter);
+}
+
+
+
+
+
+
+HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2
pDDSD)
+{
+ DX_WINDBG_trace();
+
+ IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
+
+ if (pDDSD == NULL)
+ {
+ return DD_FALSE;
+ }
+
+
+ pDDSD->dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT |
DDSD_REFRESHRATE | DDSD_WIDTH;
+ pDDSD->dwHeight = This->mDDrawGlobal.vmiData.dwDisplayHeight;
+ pDDSD->dwWidth = This->mDDrawGlobal.vmiData.dwDisplayWidth;
+ pDDSD->lPitch = This->mDDrawGlobal.vmiData.lDisplayPitch;
+ pDDSD->dwRefreshRate = This->mDDrawGlobal.dwMonitorFrequency;
+ pDDSD->dwAlphaBitDepth =
This->mDDrawGlobal.vmiData.ddpfDisplay.dwAlphaBitDepth;
+
+
RtlCopyMemory(&pDDSD->ddpfPixelFormat,&This->mDDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
+
RtlCopyMemory(&pDDSD->ddsCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS));
+
+
RtlCopyMemory(&pDDSD->ddckCKDestOverlay,&This->mDDrawGlobal.ddckCKDestOverlay,sizeof(DDCOLORKEY));
+
RtlCopyMemory(&pDDSD->ddckCKSrcOverlay,&This->mDDrawGlobal.ddckCKSrcOverlay,sizeof(DDCOLORKEY));
+
+ /* have not check where I should get hold of this info yet
+ DWORD dwBackBufferCount;
+ DWORD dwReserved;
+ LPVOID lpSurface;
+ DDCOLORKEY ddckCKDestBlt;
+ DDCOLORKEY ddckCKSrcBlt;
+ DWORD dwTextureStage;
+ */
+
+ return DD_OK;
+}
+
+HRESULT WINAPI Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
+ HANDLE h)
+{
+ DX_WINDBG_trace();
+
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+ if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_WAITFORVERTICALBLANK)
+ {
+ return Hal_DirectDraw_WaitForVerticalBlank( iface, dwFlags, h);
+ }
+
+ return Hel_DirectDraw_WaitForVerticalBlank( iface, dwFlags, h);
+}
+
+HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2
ddscaps,
+ LPDWORD total, LPDWORD free)
+{
+ DX_WINDBG_trace();
+
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+
+ if (This->mDDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags &
DDHAL_MISCCB32_GETAVAILDRIVERMEMORY)
+ {
+ return Hal_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free);
+ }
+
+ return Hel_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free);
+}
+
+HRESULT WINAPI Main_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq)
+{
+ DX_WINDBG_trace();
+
+ IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
+
+ if (freq == NULL)
+ {
+ return DD_FALSE;
+ }
+
+ *freq = This->mDDrawGlobal.dwMonitorFrequency;
+ return DD_OK;
+}
+
+HRESULT WINAPI Main_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
+{
+ DX_WINDBG_trace();
+
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+ if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE)
+ {
+ return Hal_DirectDraw_GetScanLine( iface, lpdwScanLine);
+ }
+
+ return Hel_DirectDraw_GetScanLine( iface, lpdwScanLine);
+}
+
+HRESULT WINAPI Main_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
+{
+ DX_WINDBG_trace();
+
+ ChangeDisplaySettings(NULL, 0);
+ return DD_OK;
+}
+
+/********************************** Stubs **********************************/
+
+
+
+
+
+
+
+
HRESULT WINAPI Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes,
LPDWORD pCodes)
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 Mon Jul 24 22:29:02 2006
@@ -125,7 +125,7 @@
That = (IDirectDrawSurfaceImpl*)pAttach;
//FIXME Have I put This and That in right order ?? DdAttachSurface(from, to)
- return DdAttachSurface(
That->Owner->mpPrimaryLocals[0],This->Owner->mpPrimaryLocals[0]);
+ return DdAttachSurface(
That->Surf->mpPrimaryLocals[0],This->Surf->mpPrimaryLocals[0]);
}
/* MSDN: "not currently implemented." */
@@ -274,7 +274,7 @@
This = (IDirectDrawSurfaceImpl*)iface;
RtlZeroMemory(pCaps,sizeof(DDSCAPS2));
- pCaps->dwCaps = This->Owner->mddsdPrimary.ddsCaps.dwCaps;
+ pCaps->dwCaps = This->Surf->mddsdPrimary.ddsCaps.dwCaps;
return DD_OK;
}
@@ -321,14 +321,14 @@
for now we aussme the surface exits and create the hDC for it
*/
- if ((HDC)This->Owner->mPrimaryLocal.hDC == NULL)
- {
- This->Owner->mPrimaryLocal.hDC =
(ULONG_PTR)GetDC((HWND)This->Owner->mDDrawGlobal.lpExclusiveOwner->hWnd);
- *phDC = (HDC)This->Owner->mPrimaryLocal.hDC;
+ if ((HDC)This->Surf->mPrimaryLocal.hDC == NULL)
+ {
+ This->Surf->mPrimaryLocal.hDC =
(ULONG_PTR)GetDC((HWND)This->Owner->mDDrawGlobal.lpExclusiveOwner->hWnd);
+ *phDC = (HDC)This->Surf->mPrimaryLocal.hDC;
}
else
{
- *phDC = (HDC)This->Owner->mpPrimaryLocals[0]->hDC;
+ *phDC = (HDC)This->Surf->mpPrimaryLocals[0]->hDC;
}
return DD_OK;
@@ -420,7 +420,7 @@
}
RtlZeroMemory(pDDSD,dwSize);
- memcpy(pDDSD, &This->Owner->mddsdPrimary, sizeof(DDSURFACEDESC));
+ memcpy(pDDSD, &This->Surf->mddsdPrimary, sizeof(DDSURFACEDESC));
pDDSD->dwSize = dwSize;
return DD_OK;
@@ -482,7 +482,7 @@
/* FIXME check if surface exits or not */
- if ((HDC)This->Owner->mPrimaryLocal.hDC == NULL)
+ if ((HDC)This->Surf->mPrimaryLocal.hDC == NULL)
{
return DDERR_GENERIC;
}
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 Mon Jul 24 22:29:02 2006
@@ -71,7 +71,10 @@
DWORD *mpFourCC;
UINT mcTextures;
- DDSURFACEDESC2 *mpTextures;
+ DDSURFACEDESC *mpTextures;
+
+
+
/* ExclusiveOwner */
@@ -82,7 +85,7 @@
/* HEL stuff */
DWORD HELMemoryAvilable;
-
+
/* DD Callbacks info */
DDHAL_DESTROYDRIVERDATA mDdDestroyDriver;
DDHAL_CREATESURFACEDATA mDdCreateSurface;
@@ -95,24 +98,25 @@
DDHAL_SETEXCLUSIVEMODEDATA mDdSetExclusiveMode;
DDHAL_FLIPTOGDISURFACEDATA mDdFlipToGDISurface;
- /* Primarey surface we must reach it from every where */
DDRAWI_DDRAWSURFACE_GBL mPrimaryGlobal;
+
+ /* adding a switch */
+ DWORD devicetype;
+
+} IDirectDrawImpl;
+
+/******** Surface Object ********/
+typedef struct
+{
+ /* Primarey surface we must reach it from every where */
+
DDRAWI_DDRAWSURFACE_MORE mPrimaryMore;
DDRAWI_DDRAWSURFACE_LCL mPrimaryLocal;
DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
DDRAWI_DDRAWCLIPPER_LCL mPrimaryClipperLocal;
DDRAWI_DDRAWCLIPPER_GBL mPrimaryClipperGlobal;
- DDSURFACEDESC2 mddsdPrimary;
-
- /* adding a switch */
- DWORD devicetype;
-
-} IDirectDrawImpl;
-
-/******** Surface Object ********/
-typedef struct
-{
+ DDSURFACEDESC mddsdPrimary;
DDRAWI_DDRAWSURFACE_LCL *mpInUseSurfaceLocals[1];
Modified: trunk/reactos/dll/directx/ddraw/soft/ddraw_hel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/soft/ddr…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/soft/ddraw_hel.c (original)
+++ trunk/reactos/dll/directx/ddraw/soft/ddraw_hel.c Mon Jul 24 22:29:02 2006
@@ -21,12 +21,67 @@
return DD_OK;
}
+
+HRESULT Hel_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h)
+{
+ DX_STUB;
+}
+
HRESULT Hel_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
{
DX_STUB;
}
-HRESULT Hel_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
+
+
+HRESULT Hel_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD
dwHeight,
+ DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
{
- DX_STUB;
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+ // this only for exclusive mode
+ if(!(This->cooperative_level & DDSCL_EXCLUSIVE))
+ return DDERR_NOEXCLUSIVEMODE;
+
+ // change the resolution using normal WinAPI function
+ DEVMODE mode;
+ mode.dmSize = sizeof(mode);
+ mode.dmPelsWidth = dwWidth;
+ mode.dmPelsHeight = dwHeight;
+ mode.dmBitsPerPel = dwBPP;
+
+ //mode.dmDisplayFrequency = dwRefreshRate;
+ mode.dmFields = 0;
+
+ DX_STUB_str("in hel");
+
+ if(dwWidth)
+ mode.dmFields |= DM_PELSWIDTH;
+ if(dwHeight)
+ mode.dmFields |= DM_PELSHEIGHT;
+ if(dwBPP)
+ mode.dmFields |= DM_BITSPERPEL;
+ /*
+ if(dwRefreshRate)
+ mode.dmFields |= DM_DISPLAYFREQUENCY;
+ */
+ if (ChangeDisplaySettings(&mode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
+ return DDERR_UNSUPPORTEDMODE;
+
+
+ // TODO: reactivate ddraw object, maximize window, set it in foreground
+ // and set excluive mode (if implemented by the driver)
+
+ /* 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;
+
+ return DD_OK;
}
+
+
Modified: trunk/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/soft/sur…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c (original)
+++ trunk/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c Mon Jul 24 22:29:02 2006
@@ -28,187 +28,16 @@
DX_STUB;
}
-
+/*
DWORD CALLBACK HelDdSetColorKey(LPDDHAL_SETCOLORKEYDATA lpSetColorKey)
{
DX_STUB;
}
-
+*/
DWORD CALLBACK HelDdSetMode(LPDDHAL_SETMODEDATA SetMode)
-{
- // change the resolution using normal WinAPI function
- DEVMODE mode;
- mode.dmSize = sizeof(DEVMODE);
- mode.dmPelsWidth = 0;
- mode.dmPelsHeight = 0;
- mode.dmBitsPerPel = 0;
-
- /* FIXME use emuate display to get the res */
-
- /* 320x200 15, 16, 32 */
- if (SetMode->dwModeIndex == 0x10d)
- {
- mode.dmPelsWidth = 320;
- mode.dmPelsHeight = 200;
- mode.dmBitsPerPel = 15;
- }
-
- if (SetMode->dwModeIndex == 0x10e)
- {
- mode.dmPelsWidth = 320;
- mode.dmPelsHeight = 200;
- mode.dmBitsPerPel = 16;
- }
-
- if (SetMode->dwModeIndex == 0x10f)
- {
- mode.dmPelsWidth = 320;
- mode.dmPelsHeight = 200;
- mode.dmBitsPerPel = 32;
- }
-
- /* 640x400 8 */
- if (SetMode->dwModeIndex == 0x100)
- {
- mode.dmPelsWidth = 640;
- mode.dmPelsHeight = 400;
- mode.dmBitsPerPel = 8;
- }
-
- /* 640x480 8, 15, 16 , 32*/
- if (SetMode->dwModeIndex == 0x101)
- {
- mode.dmPelsWidth = 640;
- mode.dmPelsHeight = 480;
- mode.dmBitsPerPel = 8;
- }
-
- if (SetMode->dwModeIndex == 0x110)
- {
- mode.dmPelsWidth = 640;
- mode.dmPelsHeight = 480;
- mode.dmBitsPerPel = 15;
- }
-
- if (SetMode->dwModeIndex == 0x111)
- {
- mode.dmPelsWidth = 640;
- mode.dmPelsHeight = 480;
- mode.dmBitsPerPel = 16;
- }
-
- if (SetMode->dwModeIndex == 0x112)
- {
- mode.dmPelsWidth = 640;
- mode.dmPelsHeight = 480;
- mode.dmBitsPerPel = 32;
- }
-
- /* 800x600 4, 8, 15, 16 , 32*/
- if (SetMode->dwModeIndex == 0x102)
- {
- mode.dmPelsWidth = 800;
- mode.dmPelsHeight = 600;
- mode.dmBitsPerPel = 4;
- }
-
- if (SetMode->dwModeIndex == 0x103)
- {
- mode.dmPelsWidth = 800;
- mode.dmPelsHeight = 600;
- mode.dmBitsPerPel = 8;
- }
-
- if (SetMode->dwModeIndex == 0x113)
- {
- mode.dmPelsWidth = 800;
- mode.dmPelsHeight = 600;
- mode.dmBitsPerPel = 15;
- }
-
-
- if (SetMode->dwModeIndex == 0x114)
- {
- mode.dmPelsWidth = 800;
- mode.dmPelsHeight = 600;
- mode.dmBitsPerPel = 16;
- }
-
- if (SetMode->dwModeIndex == 0x115)
- {
- mode.dmPelsWidth = 800;
- mode.dmPelsHeight = 600;
- mode.dmBitsPerPel = 32;
- }
-
- /* 1024x768 8, 15, 16 , 32*/
-
- if (SetMode->dwModeIndex == 0x104)
- {
- mode.dmPelsWidth = 1024;
- mode.dmPelsHeight = 768;
- mode.dmBitsPerPel = 4;
- }
-
- if (SetMode->dwModeIndex == 0x105)
- {
- mode.dmPelsWidth = 1024;
- mode.dmPelsHeight = 768;
- mode.dmBitsPerPel = 8;
- }
-
- if (SetMode->dwModeIndex == 0x116)
- {
- mode.dmPelsWidth = 1024;
- mode.dmPelsHeight = 768;
- mode.dmBitsPerPel = 15;
- }
-
- if (SetMode->dwModeIndex == 0x117)
- {
- mode.dmPelsWidth = 1024;
- mode.dmPelsHeight = 768;
- mode.dmBitsPerPel = 16;
- }
-
- if (SetMode->dwModeIndex == 0x118)
- {
- mode.dmPelsWidth = 1024;
- mode.dmPelsHeight = 768;
- mode.dmBitsPerPel = 32;
- }
-
- //mode.dmDisplayFrequency = dwRefreshRate;
- mode.dmFields = 0;
-
- DX_STUB_str("in hel");
-
- if(mode.dmPelsWidth != 0)
- mode.dmFields |= DM_PELSWIDTH;
- if(mode.dmPelsHeight != 0)
- mode.dmFields |= DM_PELSHEIGHT;
- if( mode.dmBitsPerPel != 0)
- mode.dmFields |= DM_BITSPERPEL;
- /*
- if(dwRefreshRate)
- mode.dmFields |= DM_DISPLAYFREQUENCY;
- */
-
- DX_WINDBG_trace_res((int)mode.dmPelsWidth, (int)mode.dmPelsHeight,
(int)mode.dmBitsPerPel );
-
- if (ChangeDisplaySettings(&mode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
- {
- DX_STUB_str("FAIL");
- SetMode->ddRVal = DDERR_UNSUPPORTEDMODE;
- }
- else
- {
- DX_STUB_str("OK");
- SetMode->ddRVal = DD_OK;
- }
-
- return DDHAL_DRIVER_HANDLED;
+{
+ DX_STUB;
}
DWORD CALLBACK HelDdWaitForVerticalBlank(LPDDHAL_WAITFORVERTICALBLANKDATA
lpWaitForVerticalBlank)
Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c Mon Jul 24 22:29:02 2006
@@ -291,7 +291,7 @@
}
This->mcTextures = This->mD3dDriverData.dwNumTextureFormats;
- This->mpTextures = (DDSURFACEDESC2*) DxHeapMemAlloc(sizeof(DDSURFACEDESC2) *
This->mcTextures);
+ This->mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) *
This->mcTextures);
if (This->mpTextures == NULL)
{
DxHeapMemFree( This->mpFourCC);
@@ -364,6 +364,16 @@
DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
This->mHALInfo.GetDriverInfo(&DriverInfo);
+ /* Setup global surface */
+ /*This->mPrimaryGlobal.dwGlobalFlags = DDRAWISURFGBL_ISGDISURFACE;
+ This->mPrimaryGlobal.lpDD = &This->mDDrawGlobal;
+ This->mPrimaryGlobal.lpDDHandle = &This->mDDrawGlobal;
+ This->mPrimaryGlobal.wWidth = (WORD)This->mpModeInfos[0].dwWidth;
+ This->mPrimaryGlobal.wHeight = (WORD)This->mpModeInfos[0].dwHeight;
+ This->mPrimaryGlobal.lPitch = This->mpModeInfos[0].lPitch;*/
+
+ /* FIXME free it in cleanup */
+ This->mDDrawGlobal.dsList =
(LPDDRAWI_DDRAWSURFACE_INT)DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_INT));
return DD_OK;
}