From 398886799e32405c578dadc678620aeecf63a293 Mon Sep 17 00:00:00 2001 From: Ulrich Czekalla Date: Wed, 13 Dec 2006 20:14:35 -0500 Subject: [PATCH] ddraw: Add IDirectDraw3 interface. --- dlls/ddraw/ddraw.c | 5 + dlls/ddraw/ddraw_private.h | 2 + dlls/ddraw/ddraw_thunks.c | 370 +++++++++++++++++++++++++++++++++++++ include/ddraw.h | 103 +++++++++++ 4 files changed, 480 insertions(+) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index b613c4675a9..0fd3a5b94d1 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -117,6 +117,11 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface, *obj = ICOM_INTERFACE(This, IDirectDraw4); TRACE("(%p) Returning IDirectDraw4 interface at %p\n", This, *obj); } + else if ( IsEqualGUID( &IID_IDirectDraw3, refiid ) ) + { + *obj = ICOM_INTERFACE(This, IDirectDraw3); + TRACE("(%p) Returning IDirectDraw3 interface at %p\n", This, *obj); + } else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) { *obj = ICOM_INTERFACE(This, IDirectDraw2); diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 9e57b2d48b2..26c1bc83bcd 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -87,6 +87,7 @@ struct IDirectDrawImpl /* IUnknown fields */ ICOM_VFIELD_MULTI(IDirectDraw7); ICOM_VFIELD_MULTI(IDirectDraw4); + ICOM_VFIELD_MULTI(IDirectDraw3); ICOM_VFIELD_MULTI(IDirectDraw2); ICOM_VFIELD_MULTI(IDirectDraw); ICOM_VFIELD_MULTI(IDirect3D7); @@ -154,6 +155,7 @@ struct IDirectDrawImpl /* Declare the VTables. They can be found ddraw.c */ const IDirectDraw7Vtbl IDirectDraw7_Vtbl; const IDirectDraw4Vtbl IDirectDraw4_Vtbl; +const IDirectDraw3Vtbl IDirectDraw3_Vtbl; const IDirectDraw2Vtbl IDirectDraw2_Vtbl; const IDirectDrawVtbl IDirectDraw1_Vtbl; diff --git a/dlls/ddraw/ddraw_thunks.c b/dlls/ddraw/ddraw_thunks.c index 1b7fa5b8157..ef8af6b26dc 100644 --- a/dlls/ddraw/ddraw_thunks.c +++ b/dlls/ddraw/ddraw_thunks.c @@ -62,6 +62,14 @@ IDirectDraw2Impl_QueryInterface(LPDIRECTDRAW2 This, REFIID iid, LPVOID *ppObj) iid, ppObj); } +static HRESULT WINAPI +IDirectDraw3Impl_QueryInterface(LPDIRECTDRAW3 This, REFIID iid, LPVOID *ppObj) +{ + return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, This), + iid, ppObj); +} static HRESULT WINAPI IDirectDraw4Impl_QueryInterface(LPDIRECTDRAW4 This, REFIID iid, LPVOID *ppObj) @@ -98,6 +106,19 @@ IDirectDraw2Impl_AddRef(LPDIRECTDRAW2 iface) return ref; } +static ULONG WINAPI +IDirectDraw3Impl_AddRef(LPDIRECTDRAW3 iface) +{ + ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface); + ULONG ref = InterlockedIncrement(&This->ref4); + + TRACE("(%p) : incrementing IDirectDraw4 refcount from %lu.\n", This, ref -1); + + if(ref == 1) InterlockedIncrement(&This->numIfaces); + + return ref; +} + static ULONG WINAPI IDirectDraw4Impl_AddRef(LPDIRECTDRAW4 iface) { @@ -145,6 +166,23 @@ IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface) return ref; } +static ULONG WINAPI +IDirectDraw3Impl_Release(LPDIRECTDRAW3 iface) +{ + ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface); + ULONG ref = InterlockedDecrement(&This->ref4); + + TRACE_(ddraw)("(%p)->() decrementing IDirectDraw4 refcount from %lu.\n", This, ref +1); + + if(ref == 0) + { + ULONG ifacecount = InterlockedDecrement(&This->numIfaces); + if(ifacecount == 0) IDirectDrawImpl_Destroy(This); + } + + return ref; +} + static ULONG WINAPI IDirectDraw4Impl_Release(LPDIRECTDRAW4 iface) { @@ -178,6 +216,14 @@ IDirectDraw2Impl_Compact(LPDIRECTDRAW2 This) This)); } + static HRESULT WINAPI +IDirectDraw3Impl_Compact(LPDIRECTDRAW3 This) +{ + return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, IDirectDraw7, + This)); +} + static HRESULT WINAPI IDirectDraw4Impl_Compact(LPDIRECTDRAW4 This) { @@ -210,6 +256,18 @@ IDirectDraw2Impl_CreateClipper(LPDIRECTDRAW2 This, DWORD dwFlags, dwFlags, ppClipper, pUnkOuter); } +static HRESULT WINAPI +IDirectDraw3Impl_CreateClipper(LPDIRECTDRAW3 This, DWORD dwFlags, + LPDIRECTDRAWCLIPPER *ppClipper, + IUnknown *pUnkOuter) +{ + return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + dwFlags, ppClipper, pUnkOuter); +} + static HRESULT WINAPI IDirectDraw4Impl_CreateClipper(LPDIRECTDRAW4 This, DWORD dwFlags, LPDIRECTDRAWCLIPPER *ppClipper, @@ -271,6 +329,31 @@ IDirectDraw2Impl_CreatePalette(LPDIRECTDRAW2 This, DWORD dwFlags, return hr; } +static HRESULT WINAPI +IDirectDraw3Impl_CreatePalette(LPDIRECTDRAW3 This, DWORD dwFlags, + LPPALETTEENTRY pEntries, + LPDIRECTDRAWPALETTE *ppPalette, + IUnknown *pUnkOuter) +{ + HRESULT hr; + hr = IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + dwFlags, pEntries, ppPalette, pUnkOuter); + if(SUCCEEDED(hr) && *ppPalette) + { + IDirectDrawPaletteImpl *impl = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette, *ppPalette); + IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This)); + IDirectDraw4_AddRef(This); + impl->ifaceToRelease = (IUnknown *) This; + } + return hr; +} + static HRESULT WINAPI IDirectDraw4Impl_CreatePalette(LPDIRECTDRAW4 This, DWORD dwFlags, LPPALETTEENTRY pEntries, @@ -370,6 +453,42 @@ IDirectDraw2Impl_CreateSurface(LPDIRECTDRAW2 This, LPDDSURFACEDESC pSDesc, return hr; } +static HRESULT WINAPI +IDirectDraw3Impl_CreateSurface(LPDIRECTDRAW3 This, LPDDSURFACEDESC pSDesc, + LPDIRECTDRAWSURFACE *ppSurface, + IUnknown *pUnkOuter) +{ + LPDIRECTDRAWSURFACE7 pSurface7; + IDirectDrawSurfaceImpl *impl; + HRESULT hr; + + hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter); + + /* This coercion is safe, since the IDirectDrawSurface3 vtable has the + * IDirectDrawSurface vtable layout at the beginning */ + *ppSurface = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, + IDirectDrawSurface7, IDirectDrawSurface3, + pSurface7); + + impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7); + if(SUCCEEDED(hr) && impl) + { + impl->version = 3; + IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This)); + IDirectDraw3_AddRef(This); + impl->ifaceToRelease = (IUnknown *) This; + } + + return hr; +} + static HRESULT WINAPI IDirectDraw4Impl_CreateSurface(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pSDesc, LPDIRECTDRAWSURFACE4 *ppSurface, @@ -447,6 +566,30 @@ IDirectDraw2Impl_DuplicateSurface(LPDIRECTDRAW2 This, LPDIRECTDRAWSURFACE pSrc, return hr; } +static HRESULT WINAPI +IDirectDraw3Impl_DuplicateSurface(LPDIRECTDRAW3 This, LPDIRECTDRAWSURFACE pSrc, + LPDIRECTDRAWSURFACE *ppDst) +{ + LPDIRECTDRAWSURFACE7 pDst7; + HRESULT hr; + + hr = IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, This), + COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, + IDirectDrawSurface3, + IDirectDrawSurface7, + pSrc), + &pDst7); + + /* This coercion is safe, since the IDirectDrawSurface3 vtable has the + * IDirectDrawSurface vtable layout at the beginning */ + *ppDst = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, + IDirectDrawSurface3, pDst7); + + return hr; +} + static HRESULT WINAPI IDirectDraw4Impl_DuplicateSurface(LPDIRECTDRAW4 This, LPDIRECTDRAWSURFACE4 pSrc, @@ -514,6 +657,24 @@ IDirectDraw2Impl_EnumDisplayModes(LPDIRECTDRAW2 This, DWORD dwFlags, EnumDisplayModesCallbackThunk); } +static HRESULT WINAPI +IDirectDraw3Impl_EnumDisplayModes(LPDIRECTDRAW3 This, DWORD dwFlags, + LPDDSURFACEDESC pDDSD, LPVOID context, + LPDDENUMMODESCALLBACK cb) +{ + struct displaymodescallback_context cbcontext; + + cbcontext.func = cb; + cbcontext.context = context; + + return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + dwFlags, (LPDDSURFACEDESC2)pDDSD, &cbcontext, + EnumDisplayModesCallbackThunk); +} + static HRESULT WINAPI IDirectDraw4Impl_EnumDisplayModes(LPDIRECTDRAW4 This, DWORD dwFlags, LPDDSURFACEDESC2 pDDSD, LPVOID context, @@ -581,6 +742,23 @@ IDirectDraw2Impl_EnumSurfaces(LPDIRECTDRAW2 This, DWORD dwFlags, &cbcontext, EnumSurfacesCallbackThunk); } +static HRESULT WINAPI +IDirectDraw3Impl_EnumSurfaces(LPDIRECTDRAW3 This, DWORD dwFlags, + LPDDSURFACEDESC pDDSD, LPVOID context, + LPDDENUMSURFACESCALLBACK cb) +{ + struct surfacescallback_context cbcontext; + + cbcontext.func = cb; + cbcontext.context = context; + + return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, This), + dwFlags, (LPDDSURFACEDESC2)pDDSD, + &cbcontext, EnumSurfacesCallbackThunk); +} + static HRESULT WINAPI IDirectDraw4Impl_EnumSurfaces(LPDIRECTDRAW4 This, DWORD dwFlags, LPDDSURFACEDESC2 pDDSD, LPVOID context, @@ -611,6 +789,15 @@ IDirectDraw2Impl_FlipToGDISurface(LPDIRECTDRAW2 This) This)); } +static HRESULT WINAPI +IDirectDraw3Impl_FlipToGDISurface(LPDIRECTDRAW3 This) +{ + return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This)); +} + static HRESULT WINAPI IDirectDraw4Impl_FlipToGDISurface(LPDIRECTDRAW4 This) { @@ -636,6 +823,14 @@ IDirectDraw2Impl_GetCaps(LPDIRECTDRAW2 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2) This), pDDC1, pDDC2); } +static HRESULT WINAPI +IDirectDraw3Impl_GetCaps(LPDIRECTDRAW3 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2) +{ + return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, IDirectDraw7, + This), pDDC1, pDDC2); +} + static HRESULT WINAPI IDirectDraw4Impl_GetCaps(LPDIRECTDRAW4 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2) { @@ -662,6 +857,15 @@ IDirectDraw2Impl_GetDisplayMode(LPDIRECTDRAW2 This, LPDDSURFACEDESC pDDSD) (LPDDSURFACEDESC2)pDDSD); } +static HRESULT WINAPI +IDirectDraw3Impl_GetDisplayMode(LPDIRECTDRAW3 This, LPDDSURFACEDESC pDDSD) +{ + return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, This), + (LPDDSURFACEDESC2)pDDSD); +} + static HRESULT WINAPI IDirectDraw4Impl_GetDisplayMode(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pDDSD) { @@ -693,6 +897,17 @@ IDirectDraw2Impl_GetFourCCCodes(LPDIRECTDRAW2 This, LPDWORD lpNumCodes, lpNumCodes, lpCodes); } +static HRESULT WINAPI +IDirectDraw3Impl_GetFourCCCodes(LPDIRECTDRAW3 This, LPDWORD lpNumCodes, + LPDWORD lpCodes) +{ + return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + lpNumCodes, lpCodes); +} + static HRESULT WINAPI IDirectDraw4Impl_GetFourCCCodes(LPDIRECTDRAW4 This, LPDWORD lpNumCodes, LPDWORD lpCodes) @@ -742,6 +957,25 @@ IDirectDraw2Impl_GetGDISurface(LPDIRECTDRAW2 This, LPDIRECTDRAWSURFACE *ppSurf) return hr; } +static HRESULT WINAPI +IDirectDraw3Impl_GetGDISurface(LPDIRECTDRAW3 This, LPDIRECTDRAWSURFACE *ppSurf) +{ + LPDIRECTDRAWSURFACE7 pSurf7; + HRESULT hr; + + hr = IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), &pSurf7); + + /* This coercion is safe, since the IDirectDrawSurface3 vtable has the + * IDirectDrawSurface vtable layout at the beginning */ + *ppSurf = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, + IDirectDrawSurface3, pSurf7); + + return hr; +} + static HRESULT WINAPI IDirectDraw4Impl_GetGDISurface(LPDIRECTDRAW4 This, LPDIRECTDRAWSURFACE4 *ppSurf) @@ -773,6 +1007,16 @@ IDirectDraw2Impl_GetMonitorFrequency(LPDIRECTDRAW2 This, LPDWORD pdwFreq) pdwFreq); } +static HRESULT WINAPI +IDirectDraw3Impl_GetMonitorFrequency(LPDIRECTDRAW3 This, LPDWORD pdwFreq) +{ + return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + pdwFreq); +} + static HRESULT WINAPI IDirectDraw4Impl_GetMonitorFrequency(LPDIRECTDRAW4 This, LPDWORD pdwFreq) { @@ -801,6 +1045,15 @@ IDirectDraw2Impl_GetScanLine(LPDIRECTDRAW2 This, LPDWORD pdwLine) This), pdwLine); } +static HRESULT WINAPI +IDirectDraw3Impl_GetScanLine(LPDIRECTDRAW3 This, LPDWORD pdwLine) +{ + return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), pdwLine); +} + static HRESULT WINAPI IDirectDraw4Impl_GetScanLine(LPDIRECTDRAW4 This, LPDWORD pdwLine) { @@ -830,6 +1083,16 @@ IDirectDraw2Impl_GetVerticalBlankStatus(LPDIRECTDRAW2 This, LPBOOL lpbIsInVB) lpbIsInVB); } +static HRESULT WINAPI +IDirectDraw3Impl_GetVerticalBlankStatus(LPDIRECTDRAW3 This, LPBOOL lpbIsInVB) +{ + return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + lpbIsInVB); +} + static HRESULT WINAPI IDirectDraw4Impl_GetVerticalBlankStatus(LPDIRECTDRAW4 This, LPBOOL lpbIsInVB) { @@ -862,6 +1125,17 @@ IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID) return ret_value; } +static HRESULT WINAPI +IDirectDraw3Impl_Initialize(LPDIRECTDRAW3 iface, LPGUID pGUID) +{ + ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface); + HRESULT ret_value; + + ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID); + + return ret_value; +} + static HRESULT WINAPI IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 iface, LPGUID pGUID) { @@ -892,6 +1166,15 @@ IDirectDraw2Impl_RestoreDisplayMode(LPDIRECTDRAW2 This) This)); } +static HRESULT WINAPI +IDirectDraw3Impl_RestoreDisplayMode(LPDIRECTDRAW3 This) +{ + return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This)); +} + static HRESULT WINAPI IDirectDraw4Impl_RestoreDisplayMode(LPDIRECTDRAW4 This) { @@ -923,6 +1206,17 @@ IDirectDraw2Impl_SetCooperativeLevel(LPDIRECTDRAW2 This, HWND hWnd, hWnd, dwFlags); } +static HRESULT WINAPI +IDirectDraw3Impl_SetCooperativeLevel(LPDIRECTDRAW3 This, HWND hWnd, + DWORD dwFlags) +{ + return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + hWnd, dwFlags); +} + static HRESULT WINAPI IDirectDraw4Impl_SetCooperativeLevel(LPDIRECTDRAW4 This, HWND hWnd, DWORD dwFlags) @@ -955,6 +1249,17 @@ IDirectDraw2Impl_SetDisplayMode(LPDIRECTDRAW2 This, DWORD a, DWORD b, DWORD c, a, b, c, d, e); } +static HRESULT WINAPI +IDirectDraw3Impl_SetDisplayMode(LPDIRECTDRAW3 This, DWORD a, DWORD b, DWORD c, + DWORD d, DWORD e) +{ + return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + a, b, c, d, e); +} + static HRESULT WINAPI IDirectDraw4Impl_SetDisplayMode(LPDIRECTDRAW4 This, DWORD a, DWORD b, DWORD c, DWORD d, DWORD e) @@ -988,6 +1293,17 @@ IDirectDraw2Impl_WaitForVerticalBlank(LPDIRECTDRAW2 This, DWORD dwFlags, dwFlags, hEvent); } +static HRESULT WINAPI +IDirectDraw3Impl_WaitForVerticalBlank(LPDIRECTDRAW3 This, DWORD dwFlags, + HANDLE hEvent) +{ + return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + dwFlags, hEvent); +} + static HRESULT WINAPI IDirectDraw4Impl_WaitForVerticalBlank(LPDIRECTDRAW4 This, DWORD dwFlags, HANDLE hEvent) @@ -1013,6 +1329,20 @@ IDirectDraw2Impl_GetAvailableVidMem(LPDIRECTDRAW2 This, LPDDSCAPS pCaps, &Caps2, pdwTotal, pdwFree); } +static HRESULT WINAPI +IDirectDraw3Impl_GetAvailableVidMem(LPDIRECTDRAW3 This, LPDDSCAPS pCaps, + LPDWORD pdwTotal, LPDWORD pdwFree) +{ + DDSCAPS2 Caps2; + DDRAW_Convert_DDSCAPS_1_To_2(pCaps, &Caps2); + + return IDirectDraw7_GetAvailableVidMem(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + &Caps2, pdwTotal, pdwFree); +} + static HRESULT WINAPI IDirectDraw4Impl_GetAvailableVidMem(LPDIRECTDRAW4 This, LPDDSCAPS2 pCaps, LPDWORD pdwTotal, LPDWORD pdwFree) @@ -1024,6 +1354,17 @@ IDirectDraw4Impl_GetAvailableVidMem(LPDIRECTDRAW4 This, LPDDSCAPS2 pCaps, pCaps, pdwTotal, pdwFree); } +static HRESULT WINAPI +IDirectDraw3Impl_GetSurfaceFromDC(LPDIRECTDRAW3 This, HDC hDC, + LPDIRECTDRAWSURFACE *pSurf) +{ + return IDirectDraw7_GetSurfaceFromDC(COM_INTERFACE_CAST(IDirectDrawImpl, + IDirectDraw3, + IDirectDraw7, + This), + hDC, (LPDIRECTDRAWSURFACE7 *)pSurf); +} + static HRESULT WINAPI IDirectDraw4Impl_GetSurfaceFromDC(LPDIRECTDRAW4 This, HDC hDC, LPDIRECTDRAWSURFACE4 *pSurf) @@ -1126,6 +1467,35 @@ const IDirectDraw2Vtbl IDirectDraw2_Vtbl = IDirectDraw2Impl_GetAvailableVidMem }; +const IDirectDraw3Vtbl IDirectDraw3_Vtbl = +{ + IDirectDraw3Impl_QueryInterface, + IDirectDraw3Impl_AddRef, + IDirectDraw3Impl_Release, + IDirectDraw3Impl_Compact, + IDirectDraw3Impl_CreateClipper, + IDirectDraw3Impl_CreatePalette, + IDirectDraw3Impl_CreateSurface, + IDirectDraw3Impl_DuplicateSurface, + IDirectDraw3Impl_EnumDisplayModes, + IDirectDraw3Impl_EnumSurfaces, + IDirectDraw3Impl_FlipToGDISurface, + IDirectDraw3Impl_GetCaps, + IDirectDraw3Impl_GetDisplayMode, + IDirectDraw3Impl_GetFourCCCodes, + IDirectDraw3Impl_GetGDISurface, + IDirectDraw3Impl_GetMonitorFrequency, + IDirectDraw3Impl_GetScanLine, + IDirectDraw3Impl_GetVerticalBlankStatus, + IDirectDraw3Impl_Initialize, + IDirectDraw3Impl_RestoreDisplayMode, + IDirectDraw3Impl_SetCooperativeLevel, + IDirectDraw3Impl_SetDisplayMode, + IDirectDraw3Impl_WaitForVerticalBlank, + IDirectDraw3Impl_GetAvailableVidMem, + IDirectDraw3Impl_GetSurfaceFromDC, +}; + const IDirectDraw4Vtbl IDirectDraw4_Vtbl = { IDirectDraw4Impl_QueryInterface, diff --git a/include/ddraw.h b/include/ddraw.h index f92d47946a3..36e8f8152e3 100644 --- a/include/ddraw.h +++ b/include/ddraw.h @@ -39,6 +39,7 @@ DEFINE_GUID( CLSID_DirectDraw7, 0x3C305196,0x50DB,0x11D3,0x9C,0xFE,0x00, DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw3, 0x618f8ad4,0x8b7a,0x11d0,0x8f,0xcc,0x0,0xc0,0x4f,0xd9,0x18,0x9d ); DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); @@ -54,6 +55,7 @@ DEFINE_GUID( IID_IDirectDrawGammaControl,0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00 typedef struct IDirectDraw *LPDIRECTDRAW; typedef struct IDirectDraw2 *LPDIRECTDRAW2; +typedef struct IDirectDraw3 *LPDIRECTDRAW3; typedef struct IDirectDraw4 *LPDIRECTDRAW4; typedef struct IDirectDraw7 *LPDIRECTDRAW7; typedef struct IDirectDrawClipper *LPDIRECTDRAWCLIPPER; @@ -1491,6 +1493,107 @@ DECLARE_INTERFACE_(IDirectDraw2,IUnknown) #endif +/***************************************************************************** + * IDirectDraw3 interface + */ +#define INTERFACE IDirectDraw3 +DECLARE_INTERFACE_(IDirectDraw3,IUnknown) +{ + /*** IUnknown methods ***/ +/*00*/ STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; +/*04*/ STDMETHOD_(ULONG,AddRef)(THIS) PURE; +/*08*/ STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectDraw2 methods ***/ +/*0c*/ STDMETHOD(Compact)(THIS) PURE; +/*10*/ STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, IUnknown *pUnkOuter) PURE; +/*14*/ STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE *lplpDDPalette, IUnknown *pUnkOuter) PURE; +/*18*/ STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE *lplpDDSurface, IUnknown *pUnkOuter) PURE; +/*1c*/ STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDSurface, LPDIRECTDRAWSURFACE *lplpDupDDSurface) PURE; +/*20*/ STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback) PURE; +/*24*/ STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; +/*28*/ STDMETHOD(FlipToGDISurface)(THIS) PURE; +/*2c*/ STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; +/*30*/ STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; +/*34*/ STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; +/*38*/ STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE *lplpGDIDDSurface) PURE; +/*3c*/ STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE; +/*40*/ STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE; +/*44*/ STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL *lpbIsInVB) PURE; +/*48*/ STDMETHOD(Initialize)(THIS_ GUID *lpGUID) PURE; +/*4c*/ STDMETHOD(RestoreDisplayMode)(THIS) PURE; +/*50*/ STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE; +/*54*/ STDMETHOD(SetDisplayMode)(THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE; +/*58*/ STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE; + /* added in v2 */ +/*5c*/ STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE; + /* added in v3 */ +/*60*/ STDMETHOD(GetSurfaceFromDC)(THIS_ HDC hdc, LPDIRECTDRAWSURFACE *pSurf) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectDraw3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDraw3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectDraw methods ***/ +#define IDirectDraw3_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw3_CreateClipper(p,a,b,c) (p)->lpVtbl->CreateClipper(p,a,b,c) +#define IDirectDraw3_CreatePalette(p,a,b,c,d) (p)->lpVtbl->CreatePalette(p,a,b,c,d) +#define IDirectDraw3_CreateSurface(p,a,b,c) (p)->lpVtbl->CreateSurface(p,a,b,c) +#define IDirectDraw3_DuplicateSurface(p,a,b) (p)->lpVtbl->DuplicateSurface(p,a,b) +#define IDirectDraw3_EnumDisplayModes(p,a,b,c,d) (p)->lpVtbl->EnumDisplayModes(p,a,b,c,d) +#define IDirectDraw3_EnumSurfaces(p,a,b,c,d) (p)->lpVtbl->EnumSurfaces(p,a,b,c,d) +#define IDirectDraw3_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw3_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectDraw3_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirectDraw3_GetFourCCCodes(p,a,b) (p)->lpVtbl->GetFourCCCodes(p,a,b) +#define IDirectDraw3_GetGDISurface(p,a) (p)->lpVtbl->GetGDISurface(p,a) +#define IDirectDraw3_GetMonitorFrequency(p,a) (p)->lpVtbl->GetMonitorFrequency(p,a) +#define IDirectDraw3_GetScanLine(p,a) (p)->lpVtbl->GetScanLine(p,a) +#define IDirectDraw3_GetVerticalBlankStatus(p,a) (p)->lpVtbl->GetVerticalBlankStatus(p,a) +#define IDirectDraw3_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectDraw3_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw3_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectDraw3_SetDisplayMode(p,a,b,c,d,e) (p)->lpVtbl->SetDisplayMode(p,a,b,c,d,e) +#define IDirectDraw3_WaitForVerticalBlank(p,a,b) (p)->lpVtbl->WaitForVerticalBlank(p,a,b) +/*** IDirectDraw2 methods ***/ +#define IDirectDraw3_GetAvailableVidMem(p,a,b,c) (p)->lpVtbl->GetAvailableVidMem(p,a,b,c) +/*** IDirectDraw3 methods ***/ +#define IDirectDraw3_GetSurfaceFromDC(p,a,b) (p)->lpVtbl->GetSurfaceFromDC(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirectDraw3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDraw3_AddRef(p) (p)->AddRef() +#define IDirectDraw3_Release(p) (p)->Release() +/*** IDirectDraw methods ***/ +#define IDirectDraw3_Compact(p) (p)->Compact() +#define IDirectDraw3_CreateClipper(p,a,b,c) (p)->CreateClipper(a,b,c) +#define IDirectDraw3_CreatePalette(p,a,b,c,d) (p)->CreatePalette(a,b,c,d) +#define IDirectDraw3_CreateSurface(p,a,b,c) (p)->CreateSurface(a,b,c) +#define IDirectDraw3_DuplicateSurface(p,a,b) (p)->DuplicateSurface(a,b) +#define IDirectDraw3_EnumDisplayModes(p,a,b,c,d) (p)->EnumDisplayModes(a,b,c,d) +#define IDirectDraw3_EnumSurfaces(p,a,b,c,d) (p)->EnumSurfaces(a,b,c,d) +#define IDirectDraw3_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw3_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectDraw3_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirectDraw3_GetFourCCCodes(p,a,b) (p)->GetFourCCCodes(a,b) +#define IDirectDraw3_GetGDISurface(p,a) (p)->GetGDISurface(a) +#define IDirectDraw3_GetMonitorFrequency(p,a) (p)->GetMonitorFrequency(a) +#define IDirectDraw3_GetScanLine(p,a) (p)->GetScanLine(a) +#define IDirectDraw3_GetVerticalBlankStatus(p,a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw3_Initialize(p,a) (p)->Initialize(a) +#define IDirectDraw3_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw3_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectDraw3_SetDisplayMode(p,a,b,c,d,e) (p)->SetDisplayMode(a,b,c,d,e) +#define IDirectDraw3_WaitForVerticalBlank(p,a,b) (p)->WaitForVerticalBlank(a,b) +/*** IDirectDraw2 methods ***/ +#define IDirectDraw3_GetAvailableVidMem(p,a,b,c) (p)->GetAvailableVidMem(a,b,c) +/*** IDirectDraw3 methods ***/ +#define IDirectDraw3_GetSurfaceFromDC(p,a,b) (p)->GetSurfaceFromDC(a,b) +#endif + + /***************************************************************************** * IDirectDraw4 interface */