From 4f5eb73a1f9db478e76c26d66cbb9946cbd74af0 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Fri, 15 Jun 2007 10:21:54 +0000 Subject: [PATCH] make ddraw.dll lite more msvs frendly svn path=/trunk/; revision=27184 --- .../dll/directx/ddraw/Ddraw/ddraw_displaymode.c | 16 ++++++++++------ reactos/dll/directx/ddraw/ddraw.rbuild | 2 +- reactos/dll/directx/ddraw/rosdraw.h | 11 ++++++++++- reactos/dll/directx/ddraw/startup.c | 10 ++++++---- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c index f97cfe0a2e7..1dda63f222d 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c @@ -47,10 +47,10 @@ Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags, while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0) == TRUE) { - DX_STUB_str("here\n"); - DDSURFACEDESC2 SurfaceDesc; + DX_STUB_str("here\n"); + iMode++; SurfaceDesc.dwSize = sizeof (DDSURFACEDESC2); @@ -121,10 +121,10 @@ Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeig DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) { LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - DX_WINDBG_trace(); - HRESULT ret = DD_OK; + DX_STUB_str("here\n"); + _SEH_TRY { // FIXME: Check primary if surface is locked / busy etc. @@ -145,6 +145,7 @@ Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeig } else { + LONG retval; // Here we go DEVMODE DevMode; DevMode.dmFields = 0; @@ -163,7 +164,8 @@ Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeig DevMode.dmBitsPerPel = dwBPP; DevMode.dmDisplayFrequency = dwRefreshRate; - LONG retval = ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN); /* FIXME: Are we supposed to set CDS_SET_PRIMARY as well ? */ + retval = ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN); + /* FIXME: Are we supposed to set CDS_SET_PRIMARY as well ? */ if(retval == DISP_CHANGE_BADMODE) { @@ -200,10 +202,12 @@ Main_DirectDraw_RestoreDisplayMode (LPDIRECTDRAW7 iface) _SEH_TRY { + BOOL ModeChanged; + ChangeDisplaySettings(NULL, 0); // Update Interals - BOOL ModeChanged; + This->lpLcl->lpGbl->hDD = This->lpLcl->hDD; DdReenableDirectDrawObject(This->lpLcl->lpGbl, &ModeChanged); diff --git a/reactos/dll/directx/ddraw/ddraw.rbuild b/reactos/dll/directx/ddraw/ddraw.rbuild index d271369ba0b..e53c2b2147f 100644 --- a/reactos/dll/directx/ddraw/ddraw.rbuild +++ b/reactos/dll/directx/ddraw/ddraw.rbuild @@ -6,7 +6,7 @@ 0x0600 0x0501 - ntdll + kernel32 user32 gdi32 diff --git a/reactos/dll/directx/ddraw/rosdraw.h b/reactos/dll/directx/ddraw/rosdraw.h index 5a3dfe71a37..1f5a6f55745 100644 --- a/reactos/dll/directx/ddraw/rosdraw.h +++ b/reactos/dll/directx/ddraw/rosdraw.h @@ -192,7 +192,7 @@ VOID Hal_DirectDraw_Release (LPDIRECTDRAW7); } \ return DD_OK; - + #ifdef __GNU__ #define DX_STUB_str(x) \ { \ char buffer[1024]; \ @@ -200,6 +200,7 @@ VOID Hal_DirectDraw_Release (LPDIRECTDRAW7); OutputDebugStringA(buffer); \ } + #define DX_WINDBG_trace() \ static BOOL firstcallx = TRUE; \ if (firstcallx) \ @@ -210,6 +211,8 @@ VOID Hal_DirectDraw_Release (LPDIRECTDRAW7); firstcallx = TRUE; \ } + + #define DX_WINDBG_trace_res(width,height,bpp) \ static BOOL firstcallxx = TRUE; \ if (firstcallxx) \ @@ -220,4 +223,10 @@ VOID Hal_DirectDraw_Release (LPDIRECTDRAW7); firstcallxx = FALSE; \ } +#else + #define DX_WINDBG_trace() // + #define DX_STUB_str(x) // + #define DX_WINDBG_trace_res(width,height,bpp) // +#endif + #endif /* __DDRAW_PRIVATE */ diff --git a/reactos/dll/directx/ddraw/startup.c b/reactos/dll/directx/ddraw/startup.c index 08539f1bcc1..0db71394270 100644 --- a/reactos/dll/directx/ddraw/startup.c +++ b/reactos/dll/directx/ddraw/startup.c @@ -37,11 +37,11 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, /* fixme linking too second link when we shall not doing it */ if (IsBadReadPtr(This,sizeof(LPDIRECTDRAW))) { - DX_STUB_str("1. no linking\n"); - /* We do not have a DirectDraw interface, we need alloc it*/ LPDDRAWI_DIRECTDRAW_INT memThis; + DX_STUB_str("1. no linking\n"); + DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT)); if (memThis == NULL) { @@ -60,10 +60,11 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, } else { - DX_STUB_str("2.linking\n"); /* We got the DirectDraw interface alloc and we need create the link */ LPDDRAWI_DIRECTDRAW_INT newThis; + DX_STUB_str("2.linking\n"); + /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */ DxHeapMemAlloc(newThis, sizeof(DDRAWI_DIRECTDRAW_INT)); if (newThis == NULL) @@ -378,6 +379,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) D3DHAL_GLOBALDRIVERDATA mD3dDriverData; DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks; LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; + DDHAL_GETDRIVERINFODATA DdGetDriverInfo = { 0 }; DX_WINDBG_trace(); @@ -533,7 +535,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */ - DDHAL_GETDRIVERINFODATA DdGetDriverInfo = { 0 }; + if (mHALInfo.dwFlags & DDHALINFO_GETDRIVERINFOSET)