Signed-off-by: Stefan Dösinger stefan@codeweavers.com
---
Version 2: Add a comment. --- dlls/ddraw/surface.c | 51 +++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 32 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 22bebffce64..83b21141763 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1198,24 +1198,14 @@ static HRESULT WINAPI ddraw_surface1_Lock(IDirectDrawSurface *iface, RECT *rect, return ddraw_surface_lock_ddsd(surface, rect, surface_desc, flags, h); }
-/***************************************************************************** - * IDirectDrawSurface7::Unlock - * - * Unlocks an locked surface - * - * Params: - * Rect: Not used by this implementation - * - * Returns: - * D3D_OK on success, error code otherwise. - * - *****************************************************************************/ -static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Unlock(IDirectDrawSurface7 *iface, RECT *pRect) +/* FRAPS hooks IDirectDrawSurface::Unlock and expects the version 1 method to be called when the + * game uses later interfaces. */ +static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Unlock(IDirectDrawSurface *iface, void *data) { - struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); + struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface); HRESULT hr;
- TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(pRect)); + TRACE("iface %p, data %p.\n", iface, data);
wined3d_mutex_lock(); hr = wined3d_resource_unmap(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx); @@ -1226,43 +1216,40 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Unlock(IDirectDrawSurface return hr; }
-static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_Unlock(IDirectDrawSurface4 *iface, RECT *pRect) +static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Unlock(IDirectDrawSurface7 *iface, RECT *rect) { - struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface); + struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
- TRACE("iface %p, rect %p.\n", iface, pRect); + TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect));
- return ddraw_surface7_Unlock(&surface->IDirectDrawSurface7_iface, pRect); + return ddraw_surface1_Unlock(&surface->IDirectDrawSurface_iface, NULL); }
-static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_Unlock(IDirectDrawSurface3 *iface, void *data) +static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface4_Unlock(IDirectDrawSurface4 *iface, RECT *rect) { - struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface); + struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
- TRACE("iface %p, data %p.\n", iface, data); + TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect));
- /* data might not be the LPRECT of later versions, so drop it. */ - return ddraw_surface7_Unlock(&surface->IDirectDrawSurface7_iface, NULL); + return ddraw_surface1_Unlock(&surface->IDirectDrawSurface_iface, NULL); }
-static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Unlock(IDirectDrawSurface2 *iface, void *data) +static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface3_Unlock(IDirectDrawSurface3 *iface, void *data) { - struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface); + struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, data %p.\n", iface, data);
- /* data might not be the LPRECT of later versions, so drop it. */ - return ddraw_surface7_Unlock(&surface->IDirectDrawSurface7_iface, NULL); + return ddraw_surface1_Unlock(&surface->IDirectDrawSurface_iface, data); }
-static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Unlock(IDirectDrawSurface *iface, void *data) +static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Unlock(IDirectDrawSurface2 *iface, void *data) { - struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface); + struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
TRACE("iface %p, data %p.\n", iface, data);
- /* data might not be the LPRECT of later versions, so drop it. */ - return ddraw_surface7_Unlock(&surface->IDirectDrawSurface7_iface, NULL); + return ddraw_surface1_Unlock(&surface->IDirectDrawSurface_iface, data); }
static unsigned int ddraw_swap_interval_from_flags(DWORD flags)