ReactOS 0.4.16-dev-122-g325d74c
ddraw.c File Reference
#include "config.h"
#include "wine/port.h"
#include "ddraw_private.h"
#include "wine/exception.h"
Include dependency graph for ddraw.c:

Go to the source code of this file.

Classes

struct  enum_device_entry
 
struct  displaymodescallback_context
 
struct  surfacescallback2_context
 
struct  surfacescallback_context
 

Macros

#define CMP(FLAG, FIELD)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ddraw)
 
static void STDMETHODCALLTYPE ddraw_null_wined3d_object_destroyed (void *parent)
 
static struct ddrawimpl_from_IDirectDraw (IDirectDraw *iface)
 
static struct ddrawimpl_from_IDirectDraw2 (IDirectDraw2 *iface)
 
static struct ddrawimpl_from_IDirectDraw4 (IDirectDraw4 *iface)
 
static struct ddrawimpl_from_IDirectDraw7 (IDirectDraw7 *iface)
 
static struct ddrawimpl_from_IDirect3D (IDirect3D *iface)
 
static struct ddrawimpl_from_IDirect3D2 (IDirect3D2 *iface)
 
static struct ddrawimpl_from_IDirect3D3 (IDirect3D3 *iface)
 
static struct ddrawimpl_from_IDirect3D7 (IDirect3D7 *iface)
 
static HRESULT WINAPI ddraw7_QueryInterface (IDirectDraw7 *iface, REFIID riid, void **out)
 
static HRESULT WINAPI ddraw4_QueryInterface (IDirectDraw4 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI ddraw2_QueryInterface (IDirectDraw2 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI ddraw1_QueryInterface (IDirectDraw *iface, REFIID riid, void **object)
 
static HRESULT WINAPI d3d7_QueryInterface (IDirect3D7 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI d3d3_QueryInterface (IDirect3D3 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI d3d2_QueryInterface (IDirect3D2 *iface, REFIID riid, void **object)
 
static HRESULT WINAPI d3d1_QueryInterface (IDirect3D *iface, REFIID riid, void **object)
 
static ULONG WINAPI ddraw7_AddRef (IDirectDraw7 *iface)
 
static ULONG WINAPI ddraw4_AddRef (IDirectDraw4 *iface)
 
static ULONG WINAPI ddraw2_AddRef (IDirectDraw2 *iface)
 
static ULONG WINAPI ddraw1_AddRef (IDirectDraw *iface)
 
static ULONG WINAPI d3d7_AddRef (IDirect3D7 *iface)
 
static ULONG WINAPI d3d3_AddRef (IDirect3D3 *iface)
 
static ULONG WINAPI d3d2_AddRef (IDirect3D2 *iface)
 
static ULONG WINAPI d3d1_AddRef (IDirect3D *iface)
 
static void ddraw_destroy_swapchain (struct ddraw *ddraw)
 
static void ddraw_destroy (struct ddraw *This)
 
static ULONG WINAPI ddraw7_Release (IDirectDraw7 *iface)
 
static ULONG WINAPI ddraw4_Release (IDirectDraw4 *iface)
 
static ULONG WINAPI ddraw2_Release (IDirectDraw2 *iface)
 
static ULONG WINAPI ddraw1_Release (IDirectDraw *iface)
 
static ULONG WINAPI d3d7_Release (IDirect3D7 *iface)
 
static ULONG WINAPI d3d3_Release (IDirect3D3 *iface)
 
static ULONG WINAPI d3d2_Release (IDirect3D2 *iface)
 
static ULONG WINAPI d3d1_Release (IDirect3D *iface)
 
static HRESULT ddraw_set_focus_window (struct ddraw *ddraw, HWND window)
 
static HRESULT ddraw_attach_d3d_device (struct ddraw *ddraw, struct wined3d_swapchain_desc *swapchain_desc)
 
static HRESULT ddraw_create_swapchain (struct ddraw *ddraw, HWND window, BOOL windowed)
 
static HRESULT WINAPI ddraw7_RestoreDisplayMode (IDirectDraw7 *iface)
 
static HRESULT WINAPI ddraw4_RestoreDisplayMode (IDirectDraw4 *iface)
 
static HRESULT WINAPI ddraw2_RestoreDisplayMode (IDirectDraw2 *iface)
 
static HRESULT WINAPI ddraw1_RestoreDisplayMode (IDirectDraw *iface)
 
static HRESULT ddraw_set_cooperative_level (struct ddraw *ddraw, HWND window, DWORD cooplevel, BOOL restore_mode_on_normal)
 
static HRESULT WINAPI ddraw7_SetCooperativeLevel (IDirectDraw7 *iface, HWND window, DWORD flags)
 
static HRESULT WINAPI ddraw4_SetCooperativeLevel (IDirectDraw4 *iface, HWND window, DWORD flags)
 
static HRESULT WINAPI ddraw2_SetCooperativeLevel (IDirectDraw2 *iface, HWND window, DWORD flags)
 
static HRESULT WINAPI ddraw1_SetCooperativeLevel (IDirectDraw *iface, HWND window, DWORD flags)
 
static HRESULT WINAPI ddraw7_SetDisplayMode (IDirectDraw7 *iface, DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags)
 
static HRESULT WINAPI ddraw4_SetDisplayMode (IDirectDraw4 *iface, DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags)
 
static HRESULT WINAPI ddraw2_SetDisplayMode (IDirectDraw2 *iface, DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags)
 
static HRESULT WINAPI ddraw1_SetDisplayMode (IDirectDraw *iface, DWORD width, DWORD height, DWORD bpp)
 
void ddraw_d3dcaps1_from_7 (D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7)
 
HRESULT ddraw_get_d3dcaps (const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
 
HRESULT CALLBACK enum_zbuffer (DDPIXELFORMAT *format, void *ctx)
 
static HRESULT WINAPI ddraw7_GetCaps (IDirectDraw7 *iface, DDCAPS *DriverCaps, DDCAPS *HELCaps)
 
static HRESULT WINAPI ddraw4_GetCaps (IDirectDraw4 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps)
 
static HRESULT WINAPI ddraw2_GetCaps (IDirectDraw2 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps)
 
static HRESULT WINAPI ddraw1_GetCaps (IDirectDraw *iface, DDCAPS *driver_caps, DDCAPS *hel_caps)
 
static HRESULT WINAPI ddraw7_Compact (IDirectDraw7 *iface)
 
static HRESULT WINAPI ddraw4_Compact (IDirectDraw4 *iface)
 
static HRESULT WINAPI ddraw2_Compact (IDirectDraw2 *iface)
 
static HRESULT WINAPI ddraw1_Compact (IDirectDraw *iface)
 
static HRESULT WINAPI ddraw7_GetDisplayMode (IDirectDraw7 *iface, DDSURFACEDESC2 *DDSD)
 
static HRESULT WINAPI ddraw4_GetDisplayMode (IDirectDraw4 *iface, DDSURFACEDESC2 *surface_desc)
 
static HRESULT WINAPI ddraw2_GetDisplayMode (IDirectDraw2 *iface, DDSURFACEDESC *surface_desc)
 
static HRESULT WINAPI ddraw1_GetDisplayMode (IDirectDraw *iface, DDSURFACEDESC *surface_desc)
 
static HRESULT WINAPI ddraw7_GetFourCCCodes (IDirectDraw7 *iface, DWORD *NumCodes, DWORD *Codes)
 
static HRESULT WINAPI ddraw4_GetFourCCCodes (IDirectDraw4 *iface, DWORD *codes_count, DWORD *codes)
 
static HRESULT WINAPI ddraw2_GetFourCCCodes (IDirectDraw2 *iface, DWORD *codes_count, DWORD *codes)
 
static HRESULT WINAPI ddraw1_GetFourCCCodes (IDirectDraw *iface, DWORD *codes_count, DWORD *codes)
 
static HRESULT WINAPI ddraw7_GetMonitorFrequency (IDirectDraw7 *iface, DWORD *frequency)
 
static HRESULT WINAPI ddraw4_GetMonitorFrequency (IDirectDraw4 *iface, DWORD *frequency)
 
static HRESULT WINAPI ddraw2_GetMonitorFrequency (IDirectDraw2 *iface, DWORD *frequency)
 
static HRESULT WINAPI ddraw1_GetMonitorFrequency (IDirectDraw *iface, DWORD *frequency)
 
static HRESULT WINAPI ddraw7_GetVerticalBlankStatus (IDirectDraw7 *iface, BOOL *status)
 
static HRESULT WINAPI ddraw4_GetVerticalBlankStatus (IDirectDraw4 *iface, BOOL *status)
 
static HRESULT WINAPI ddraw2_GetVerticalBlankStatus (IDirectDraw2 *iface, BOOL *status)
 
static HRESULT WINAPI ddraw1_GetVerticalBlankStatus (IDirectDraw *iface, BOOL *status)
 
static HRESULT WINAPI ddraw7_GetAvailableVidMem (IDirectDraw7 *iface, DDSCAPS2 *caps, DWORD *total, DWORD *free)
 
static HRESULT WINAPI ddraw4_GetAvailableVidMem (IDirectDraw4 *iface, DDSCAPS2 *caps, DWORD *total, DWORD *free)
 
static HRESULT WINAPI ddraw2_GetAvailableVidMem (IDirectDraw2 *iface, DDSCAPS *caps, DWORD *total, DWORD *free)
 
static HRESULT WINAPI ddraw7_Initialize (IDirectDraw7 *iface, GUID *guid)
 
static HRESULT WINAPI ddraw4_Initialize (IDirectDraw4 *iface, GUID *guid)
 
static HRESULT WINAPI ddraw2_Initialize (IDirectDraw2 *iface, GUID *guid)
 
static HRESULT WINAPI ddraw1_Initialize (IDirectDraw *iface, GUID *guid)
 
static HRESULT WINAPI d3d1_Initialize (IDirect3D *iface, REFIID riid)
 
static HRESULT WINAPI ddraw7_FlipToGDISurface (IDirectDraw7 *iface)
 
static HRESULT WINAPI ddraw4_FlipToGDISurface (IDirectDraw4 *iface)
 
static HRESULT WINAPI ddraw2_FlipToGDISurface (IDirectDraw2 *iface)
 
static HRESULT WINAPI ddraw1_FlipToGDISurface (IDirectDraw *iface)
 
static HRESULT WINAPI ddraw7_WaitForVerticalBlank (IDirectDraw7 *iface, DWORD Flags, HANDLE event)
 
static HRESULT WINAPI ddraw4_WaitForVerticalBlank (IDirectDraw4 *iface, DWORD flags, HANDLE event)
 
static HRESULT WINAPI ddraw2_WaitForVerticalBlank (IDirectDraw2 *iface, DWORD flags, HANDLE event)
 
static HRESULT WINAPI ddraw1_WaitForVerticalBlank (IDirectDraw *iface, DWORD flags, HANDLE event)
 
static HRESULT WINAPI ddraw7_GetScanLine (IDirectDraw7 *iface, DWORD *Scanline)
 
static HRESULT WINAPI ddraw4_GetScanLine (IDirectDraw4 *iface, DWORD *line)
 
static HRESULT WINAPI ddraw2_GetScanLine (IDirectDraw2 *iface, DWORD *line)
 
static HRESULT WINAPI ddraw1_GetScanLine (IDirectDraw *iface, DWORD *line)
 
static HRESULT WINAPI ddraw7_TestCooperativeLevel (IDirectDraw7 *iface)
 
static HRESULT WINAPI ddraw4_TestCooperativeLevel (IDirectDraw4 *iface)
 
static HRESULT WINAPI ddraw7_GetGDISurface (IDirectDraw7 *iface, IDirectDrawSurface7 **GDISurface)
 
static HRESULT WINAPI ddraw4_GetGDISurface (IDirectDraw4 *iface, IDirectDrawSurface4 **surface)
 
static HRESULT WINAPI ddraw2_GetGDISurface (IDirectDraw2 *iface, IDirectDrawSurface **surface)
 
static HRESULT WINAPI ddraw1_GetGDISurface (IDirectDraw *iface, IDirectDrawSurface **surface)
 
static HRESULT CALLBACK EnumDisplayModesCallbackThunk (DDSURFACEDESC2 *surface_desc, void *context)
 
static HRESULT WINAPI ddraw7_EnumDisplayModes (IDirectDraw7 *iface, DWORD Flags, DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMMODESCALLBACK2 cb)
 
static HRESULT WINAPI ddraw4_EnumDisplayModes (IDirectDraw4 *iface, DWORD flags, DDSURFACEDESC2 *surface_desc, void *context, LPDDENUMMODESCALLBACK2 callback)
 
static HRESULT WINAPI ddraw2_EnumDisplayModes (IDirectDraw2 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback)
 
static HRESULT WINAPI ddraw1_EnumDisplayModes (IDirectDraw *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback)
 
static HRESULT WINAPI ddraw7_EvaluateMode (IDirectDraw7 *iface, DWORD Flags, DWORD *Timeout)
 
static HRESULT WINAPI ddraw7_GetDeviceIdentifier (IDirectDraw7 *iface, DDDEVICEIDENTIFIER2 *DDDI, DWORD Flags)
 
static HRESULT WINAPI ddraw4_GetDeviceIdentifier (IDirectDraw4 *iface, DDDEVICEIDENTIFIER *identifier, DWORD flags)
 
static HRESULT WINAPI ddraw7_GetSurfaceFromDC (IDirectDraw7 *iface, HDC dc, IDirectDrawSurface7 **surface)
 
static HRESULT WINAPI ddraw4_GetSurfaceFromDC (IDirectDraw4 *iface, HDC dc, IDirectDrawSurface4 **surface)
 
static HRESULT CALLBACK restore_callback (IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context)
 
static HRESULT WINAPI ddraw7_RestoreAllSurfaces (IDirectDraw7 *iface)
 
static HRESULT WINAPI ddraw4_RestoreAllSurfaces (IDirectDraw4 *iface)
 
static HRESULT WINAPI ddraw7_StartModeTest (IDirectDraw7 *iface, SIZE *Modes, DWORD NumModes, DWORD Flags)
 
static HRESULT WINAPI ddraw7_CreateSurface (IDirectDraw7 *iface, DDSURFACEDESC2 *surface_desc, IDirectDrawSurface7 **surface, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw4_CreateSurface (IDirectDraw4 *iface, DDSURFACEDESC2 *surface_desc, IDirectDrawSurface4 **surface, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw2_CreateSurface (IDirectDraw2 *iface, DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw1_CreateSurface (IDirectDraw *iface, DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown)
 
static BOOL Main_DirectDraw_DDPIXELFORMAT_Match (const DDPIXELFORMAT *requested, const DDPIXELFORMAT *provided)
 
static BOOL ddraw_match_surface_desc (const DDSURFACEDESC2 *requested, const DDSURFACEDESC2 *provided)
 
static HRESULT CALLBACK EnumSurfacesCallback2Thunk (IDirectDrawSurface7 *surface, DDSURFACEDESC2 *surface_desc, void *context)
 
static HRESULT CALLBACK EnumSurfacesCallbackThunk (IDirectDrawSurface7 *surface, DDSURFACEDESC2 *surface_desc, void *context)
 
static HRESULT WINAPI ddraw7_EnumSurfaces (IDirectDraw7 *iface, DWORD Flags, DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMSURFACESCALLBACK7 Callback)
 
static HRESULT WINAPI ddraw4_EnumSurfaces (IDirectDraw4 *iface, DWORD flags, DDSURFACEDESC2 *surface_desc, void *context, LPDDENUMSURFACESCALLBACK2 callback)
 
static HRESULT WINAPI ddraw2_EnumSurfaces (IDirectDraw2 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback)
 
static HRESULT WINAPI ddraw1_EnumSurfaces (IDirectDraw *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback)
 
HRESULT WINAPI DirectDrawCreateClipper (DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw7_CreateClipper (IDirectDraw7 *iface, DWORD Flags, IDirectDrawClipper **Clipper, IUnknown *UnkOuter)
 
static HRESULT WINAPI ddraw4_CreateClipper (IDirectDraw4 *iface, DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw2_CreateClipper (IDirectDraw2 *iface, DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw1_CreateClipper (IDirectDraw *iface, DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw7_CreatePalette (IDirectDraw7 *iface, DWORD Flags, PALETTEENTRY *ColorTable, IDirectDrawPalette **Palette, IUnknown *pUnkOuter)
 
static HRESULT WINAPI ddraw4_CreatePalette (IDirectDraw4 *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw2_CreatePalette (IDirectDraw2 *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw1_CreatePalette (IDirectDraw *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown)
 
static HRESULT WINAPI ddraw7_DuplicateSurface (IDirectDraw7 *iface, IDirectDrawSurface7 *Src, IDirectDrawSurface7 **Dest)
 
static HRESULT WINAPI ddraw4_DuplicateSurface (IDirectDraw4 *iface, IDirectDrawSurface4 *src, IDirectDrawSurface4 **dst)
 
static HRESULT WINAPI ddraw2_DuplicateSurface (IDirectDraw2 *iface, IDirectDrawSurface *src, IDirectDrawSurface **dst)
 
static HRESULT WINAPI ddraw1_DuplicateSurface (IDirectDraw *iface, IDirectDrawSurface *src, IDirectDrawSurface **dst)
 
static HRESULT WINAPI d3d7_EnumDevices (IDirect3D7 *iface, LPD3DENUMDEVICESCALLBACK7 callback, void *context)
 
static HRESULT WINAPI d3d3_EnumDevices (IDirect3D3 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context)
 
static HRESULT WINAPI d3d2_EnumDevices (IDirect3D2 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context)
 
static HRESULT WINAPI d3d1_EnumDevices (IDirect3D *iface, LPD3DENUMDEVICESCALLBACK callback, void *context)
 
static HRESULT WINAPI d3d3_CreateLight (IDirect3D3 *iface, IDirect3DLight **light, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d2_CreateLight (IDirect3D2 *iface, IDirect3DLight **light, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d1_CreateLight (IDirect3D *iface, IDirect3DLight **light, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d3_CreateMaterial (IDirect3D3 *iface, IDirect3DMaterial3 **material, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d2_CreateMaterial (IDirect3D2 *iface, IDirect3DMaterial2 **material, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d1_CreateMaterial (IDirect3D *iface, IDirect3DMaterial **material, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d3_CreateViewport (IDirect3D3 *iface, IDirect3DViewport3 **viewport, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d2_CreateViewport (IDirect3D2 *iface, IDirect3DViewport2 **viewport, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d1_CreateViewport (IDirect3D *iface, IDirect3DViewport **viewport, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d3_FindDevice (IDirect3D3 *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr)
 
static HRESULT WINAPI d3d2_FindDevice (IDirect3D2 *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr)
 
static HRESULT WINAPI d3d1_FindDevice (IDirect3D *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr)
 
static HRESULT WINAPI d3d7_CreateDevice (IDirect3D7 *iface, REFCLSID riid, IDirectDrawSurface7 *surface, IDirect3DDevice7 **device)
 
static HRESULT WINAPI d3d3_CreateDevice (IDirect3D3 *iface, REFCLSID riid, IDirectDrawSurface4 *surface, IDirect3DDevice3 **device, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d2_CreateDevice (IDirect3D2 *iface, REFCLSID riid, IDirectDrawSurface *surface, IDirect3DDevice2 **device)
 
static HRESULT WINAPI d3d7_CreateVertexBuffer (IDirect3D7 *iface, D3DVERTEXBUFFERDESC *desc, IDirect3DVertexBuffer7 **vertex_buffer, DWORD flags)
 
static HRESULT WINAPI d3d3_CreateVertexBuffer (IDirect3D3 *iface, D3DVERTEXBUFFERDESC *desc, IDirect3DVertexBuffer **vertex_buffer, DWORD flags, IUnknown *outer_unknown)
 
static HRESULT WINAPI d3d7_EnumZBufferFormats (IDirect3D7 *iface, REFCLSID device_iid, LPD3DENUMPIXELFORMATSCALLBACK callback, void *context)
 
static HRESULT WINAPI d3d3_EnumZBufferFormats (IDirect3D3 *iface, REFCLSID device_iid, LPD3DENUMPIXELFORMATSCALLBACK callback, void *context)
 
static HRESULT WINAPI d3d7_EvictManagedTextures (IDirect3D7 *iface)
 
static HRESULT WINAPI d3d3_EvictManagedTextures (IDirect3D3 *iface)
 
struct wined3d_vertex_declarationddraw_find_decl (struct ddraw *This, DWORD fvf)
 
static struct ddrawddraw_from_device_parent (struct wined3d_device_parent *device_parent)
 
static void CDECL device_parent_wined3d_device_created (struct wined3d_device_parent *device_parent, struct wined3d_device *device)
 
static void CDECL device_parent_mode_changed (struct wined3d_device_parent *device_parent)
 
static void CDECL device_parent_activate (struct wined3d_device_parent *device_parent, BOOL activate)
 
void ddraw_update_lost_surfaces (struct ddraw *ddraw)
 
static HRESULT CDECL device_parent_surface_created (struct wined3d_device_parent *device_parent, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
 
static HRESULT CDECL device_parent_volume_created (struct wined3d_device_parent *device_parent, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
 
static void STDMETHODCALLTYPE ddraw_frontbuffer_destroyed (void *parent)
 
static HRESULT CDECL device_parent_create_swapchain_texture (struct wined3d_device_parent *device_parent, void *container_parent, const struct wined3d_resource_desc *desc, DWORD texture_flags, struct wined3d_texture **texture)
 
static HRESULT CDECL device_parent_create_swapchain (struct wined3d_device_parent *device_parent, struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
 
HRESULT ddraw_init (struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type)
 

Variables

static const struct ddrawexclusive_ddraw
 
static HWND exclusive_window
 
static const DDDEVICEIDENTIFIER2 deviceidentifier
 
static struct enum_device_entry device_list7 []
 
const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
 
static const struct IDirectDraw7Vtbl ddraw7_vtbl
 
static const struct IDirectDraw4Vtbl ddraw4_vtbl
 
static const struct IDirectDraw2Vtbl ddraw2_vtbl
 
static struct IDirectDrawVtbl ddraw1_vtbl
 
static const struct IDirect3D7Vtbl d3d7_vtbl
 
static const struct IDirect3D3Vtbl d3d3_vtbl
 
static const struct IDirect3D2Vtbl d3d2_vtbl
 
static const struct IDirect3DVtbl d3d1_vtbl
 
static const struct wined3d_parent_ops ddraw_frontbuffer_parent_ops
 
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops
 

Macro Definition Documentation

◆ CMP

#define CMP (   FLAG,
  FIELD 
)
Value:
{ DDSD_##FLAG, offsetof(DDSURFACEDESC2, FIELD), \
sizeof(((DDSURFACEDESC2 *)(NULL))->FIELD) }
#define FLAG
Definition: main.h:130
#define NULL
Definition: types.h:112
#define offsetof(TYPE, MEMBER)

Function Documentation

◆ d3d1_AddRef()

static ULONG WINAPI d3d1_AddRef ( IDirect3D *  iface)
static

Definition at line 359 of file ddraw.c.

360{
361 struct ddraw *This = impl_from_IDirect3D(iface);
362
363 TRACE("iface %p.\n", iface);
364
365 return ddraw1_AddRef(&This->IDirectDraw_iface);
366}
static struct ddraw * impl_from_IDirect3D(IDirect3D *iface)
Definition: ddraw.c:108
static ULONG WINAPI ddraw1_AddRef(IDirectDraw *iface)
Definition: ddraw.c:320
#define TRACE(s)
Definition: solgame.cpp:4

◆ d3d1_CreateLight()

static HRESULT WINAPI d3d1_CreateLight ( IDirect3D *  iface,
IDirect3DLight **  light,
IUnknown outer_unknown 
)
static

Definition at line 3975 of file ddraw.c.

3976{
3977 struct ddraw *ddraw = impl_from_IDirect3D(iface);
3978
3979 TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);
3980
3981 return d3d3_CreateLight(&ddraw->IDirect3D3_iface, light, outer_unknown);
3982}
static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light, IUnknown *outer_unknown)
Definition: ddraw.c:3941
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum light
Definition: glfuncs.h:170
IDirect3D3 IDirect3D3_iface
Definition: ddraw_private.h:84

◆ d3d1_CreateMaterial()

static HRESULT WINAPI d3d1_CreateMaterial ( IDirect3D *  iface,
IDirect3DMaterial **  material,
IUnknown outer_unknown 
)
static

Definition at line 4048 of file ddraw.c.

4050{
4051 struct ddraw *ddraw = impl_from_IDirect3D(iface);
4052 struct d3d_material *object;
4053
4054 TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown);
4055
4056 object = d3d_material_create(ddraw);
4057 if (!object)
4058 {
4059 ERR("Failed to allocate material memory.\n");
4060 return DDERR_OUTOFMEMORY;
4061 }
4062
4063 TRACE("Created material %p.\n", object);
4064 *material = &object->IDirect3DMaterial_iface;
4065
4066 return D3D_OK;
4067}
#define ERR(fmt,...)
Definition: precomp.h:57
#define D3D_OK
Definition: d3d.h:106
struct d3d_material * d3d_material_create(struct ddraw *ddraw) DECLSPEC_HIDDEN
Definition: material.c:501
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:111

◆ d3d1_CreateViewport()

static HRESULT WINAPI d3d1_CreateViewport ( IDirect3D *  iface,
IDirect3DViewport **  viewport,
IUnknown outer_unknown 
)
static

Definition at line 4123 of file ddraw.c.

4124{
4125 struct ddraw *ddraw = impl_from_IDirect3D(iface);
4126
4127 TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown);
4128
4129 return d3d3_CreateViewport(&ddraw->IDirect3D3_iface, (IDirect3DViewport3 **)viewport,
4130 outer_unknown);
4131}
static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3 **viewport, IUnknown *outer_unknown)
Definition: ddraw.c:4089

◆ d3d1_EnumDevices()

static HRESULT WINAPI d3d1_EnumDevices ( IDirect3D *  iface,
LPD3DENUMDEVICESCALLBACK  callback,
void context 
)
static

Definition at line 3911 of file ddraw.c.

3912{
3913 struct ddraw *ddraw = impl_from_IDirect3D(iface);
3914
3915 TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
3916
3918}
static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context)
Definition: ddraw.c:3797
static IPrintDialogCallback callback
Definition: printdlg.c:326
Definition: http.c:7252

◆ d3d1_FindDevice()

static HRESULT WINAPI d3d1_FindDevice ( IDirect3D *  iface,
D3DFINDDEVICESEARCH fds,
D3DFINDDEVICERESULT fdr 
)
static

Definition at line 4223 of file ddraw.c.

4224{
4225 struct ddraw *ddraw = impl_from_IDirect3D(iface);
4226
4227 TRACE("iface %p, fds %p, fdr %p.\n", iface, fds, fdr);
4228
4229 return d3d3_FindDevice(&ddraw->IDirect3D3_iface, fds, fdr);
4230}
static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr)
Definition: ddraw.c:4149

◆ d3d1_Initialize()

static HRESULT WINAPI d3d1_Initialize ( IDirect3D *  iface,
REFIID  riid 
)
static

Definition at line 2077 of file ddraw.c.

2078{
2079 TRACE("iface %p, riid %s.\n", iface, debugstr_guid(riid));
2080
2082}
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define DDERR_ALREADYINITIALIZED
Definition: ddraw.h:67

◆ d3d1_QueryInterface()

static HRESULT WINAPI d3d1_QueryInterface ( IDirect3D *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 257 of file ddraw.c.

258{
259 struct ddraw *ddraw = impl_from_IDirect3D(iface);
260
261 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
262
264}
static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID riid, void **out)
Definition: ddraw.c:128
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:79

◆ d3d1_Release()

static ULONG WINAPI d3d1_Release ( IDirect3D *  iface)
static

Definition at line 538 of file ddraw.c.

539{
540 struct ddraw *This = impl_from_IDirect3D(iface);
541
542 TRACE("iface %p.\n", iface);
543
544 return ddraw1_Release(&This->IDirectDraw_iface);
545}
static ULONG WINAPI ddraw1_Release(IDirectDraw *iface)
Definition: ddraw.c:498

◆ d3d2_AddRef()

static ULONG WINAPI d3d2_AddRef ( IDirect3D2 *  iface)
static

Definition at line 350 of file ddraw.c.

351{
352 struct ddraw *This = impl_from_IDirect3D2(iface);
353
354 TRACE("iface %p.\n", iface);
355
356 return ddraw1_AddRef(&This->IDirectDraw_iface);
357}
static struct ddraw * impl_from_IDirect3D2(IDirect3D2 *iface)
Definition: ddraw.c:113

◆ d3d2_CreateDevice()

static HRESULT WINAPI d3d2_CreateDevice ( IDirect3D2 *  iface,
REFCLSID  riid,
IDirectDrawSurface *  surface,
IDirect3DDevice2 **  device 
)
static

Definition at line 4307 of file ddraw.c.

4309{
4310 struct ddraw_surface *surface_impl = unsafe_impl_from_IDirectDrawSurface(surface);
4311 struct ddraw *ddraw = impl_from_IDirect3D2(iface);
4312 struct d3d_device *device_impl;
4313 HRESULT hr;
4314
4315 TRACE("iface %p, riid %s, surface %p, device %p.\n",
4316 iface, debugstr_guid(riid), surface, device);
4317
4319 if (SUCCEEDED(hr = d3d_device_create(ddraw, riid, surface_impl, (IUnknown *)surface, 2, &device_impl, NULL)))
4320 {
4321 *device = &device_impl->IDirect3DDevice2_iface;
4322 }
4323 else
4324 {
4325 WARN("Failed to create device, hr %#x.\n", hr);
4326 *device = NULL;
4327 }
4329
4330 return hr;
4331}
#define WARN(fmt,...)
Definition: precomp.h:61
HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_surface *target, IUnknown *rt_iface, UINT version, struct d3d_device **device, IUnknown *outer_unknown) DECLSPEC_HIDDEN
Definition: device.c:6980
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *iface) DECLSPEC_HIDDEN
Definition: surface.c:5705
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT hr
Definition: shlfolder.c:183
IDirect3DDevice2 IDirect3DDevice2_iface
Definition: devices.h:37
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368

◆ d3d2_CreateLight()

static HRESULT WINAPI d3d2_CreateLight ( IDirect3D2 *  iface,
IDirect3DLight **  light,
IUnknown outer_unknown 
)
static

Definition at line 3966 of file ddraw.c.

3967{
3968 struct ddraw *ddraw = impl_from_IDirect3D2(iface);
3969
3970 TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);
3971
3972 return d3d3_CreateLight(&ddraw->IDirect3D3_iface, light, outer_unknown);
3973}

◆ d3d2_CreateMaterial()

static HRESULT WINAPI d3d2_CreateMaterial ( IDirect3D2 *  iface,
IDirect3DMaterial2 **  material,
IUnknown outer_unknown 
)
static

Definition at line 4027 of file ddraw.c.

4029{
4030 struct ddraw *ddraw = impl_from_IDirect3D2(iface);
4031 struct d3d_material *object;
4032
4033 TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown);
4034
4035 object = d3d_material_create(ddraw);
4036 if (!object)
4037 {
4038 ERR("Failed to allocate material memory.\n");
4039 return DDERR_OUTOFMEMORY;
4040 }
4041
4042 TRACE("Created material %p.\n", object);
4043 *material = &object->IDirect3DMaterial2_iface;
4044
4045 return D3D_OK;
4046}

◆ d3d2_CreateViewport()

static HRESULT WINAPI d3d2_CreateViewport ( IDirect3D2 *  iface,
IDirect3DViewport2 **  viewport,
IUnknown outer_unknown 
)
static

Definition at line 4113 of file ddraw.c.

4114{
4115 struct ddraw *ddraw = impl_from_IDirect3D2(iface);
4116
4117 TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown);
4118
4119 return d3d3_CreateViewport(&ddraw->IDirect3D3_iface, (IDirect3DViewport3 **)viewport,
4120 outer_unknown);
4121}

◆ d3d2_EnumDevices()

static HRESULT WINAPI d3d2_EnumDevices ( IDirect3D2 *  iface,
LPD3DENUMDEVICESCALLBACK  callback,
void context 
)
static

Definition at line 3902 of file ddraw.c.

3903{
3904 struct ddraw *ddraw = impl_from_IDirect3D2(iface);
3905
3906 TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
3907
3909}

◆ d3d2_FindDevice()

static HRESULT WINAPI d3d2_FindDevice ( IDirect3D2 *  iface,
D3DFINDDEVICESEARCH fds,
D3DFINDDEVICERESULT fdr 
)
static

Definition at line 4214 of file ddraw.c.

4215{
4216 struct ddraw *ddraw = impl_from_IDirect3D2(iface);
4217
4218 TRACE("iface %p, fds %p, fdr %p.\n", iface, fds, fdr);
4219
4220 return d3d3_FindDevice(&ddraw->IDirect3D3_iface, fds, fdr);
4221}

◆ d3d2_QueryInterface()

static HRESULT WINAPI d3d2_QueryInterface ( IDirect3D2 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 248 of file ddraw.c.

249{
250 struct ddraw *ddraw = impl_from_IDirect3D2(iface);
251
252 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
253
255}

◆ d3d2_Release()

static ULONG WINAPI d3d2_Release ( IDirect3D2 *  iface)
static

Definition at line 529 of file ddraw.c.

530{
531 struct ddraw *This = impl_from_IDirect3D2(iface);
532
533 TRACE("iface %p.\n", iface);
534
535 return ddraw1_Release(&This->IDirectDraw_iface);
536}

◆ d3d3_AddRef()

static ULONG WINAPI d3d3_AddRef ( IDirect3D3 *  iface)
static

Definition at line 341 of file ddraw.c.

342{
343 struct ddraw *This = impl_from_IDirect3D3(iface);
344
345 TRACE("iface %p.\n", iface);
346
347 return ddraw1_AddRef(&This->IDirectDraw_iface);
348}
static struct ddraw * impl_from_IDirect3D3(IDirect3D3 *iface)
Definition: ddraw.c:118

◆ d3d3_CreateDevice()

static HRESULT WINAPI d3d3_CreateDevice ( IDirect3D3 *  iface,
REFCLSID  riid,
IDirectDrawSurface4 *  surface,
IDirect3DDevice3 **  device,
IUnknown outer_unknown 
)
static

Definition at line 4278 of file ddraw.c.

4280{
4281 struct ddraw_surface *surface_impl = unsafe_impl_from_IDirectDrawSurface4(surface);
4282 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
4283 struct d3d_device *device_impl;
4284 HRESULT hr;
4285
4286 TRACE("iface %p, riid %s, surface %p, device %p, outer_unknown %p.\n",
4287 iface, debugstr_guid(riid), surface, device, outer_unknown);
4288
4289 if (outer_unknown)
4290 return CLASS_E_NOAGGREGATION;
4291
4293 if (SUCCEEDED(hr = d3d_device_create(ddraw, riid, surface_impl, (IUnknown *)surface, 3, &device_impl, NULL)))
4294 {
4295 *device = &device_impl->IDirect3DDevice3_iface;
4296 }
4297 else
4298 {
4299 WARN("Failed to create device, hr %#x.\n", hr);
4300 *device = NULL;
4301 }
4303
4304 return hr;
4305}
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface) DECLSPEC_HIDDEN
Definition: surface.c:5657
IUnknown * outer_unknown
IDirect3DDevice3 IDirect3DDevice3_iface
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662

◆ d3d3_CreateLight()

static HRESULT WINAPI d3d3_CreateLight ( IDirect3D3 *  iface,
IDirect3DLight **  light,
IUnknown outer_unknown 
)
static

Definition at line 3941 of file ddraw.c.

3943{
3944 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
3945 struct d3d_light *object;
3946
3947 TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);
3948
3949 if (outer_unknown)
3950 return CLASS_E_NOAGGREGATION;
3951
3952 if (!(object = heap_alloc_zero(sizeof(*object))))
3953 {
3954 ERR("Failed to allocate light memory.\n");
3955 return DDERR_OUTOFMEMORY;
3956 }
3957
3958 d3d_light_init(object, ddraw);
3959
3960 TRACE("Created light %p.\n", object);
3961 *light = &object->IDirect3DLight_iface;
3962
3963 return D3D_OK;
3964}
void d3d_light_init(struct d3d_light *light, struct ddraw *ddraw) DECLSPEC_HIDDEN
Definition: light.c:247

Referenced by d3d1_CreateLight(), and d3d2_CreateLight().

◆ d3d3_CreateMaterial()

static HRESULT WINAPI d3d3_CreateMaterial ( IDirect3D3 *  iface,
IDirect3DMaterial3 **  material,
IUnknown outer_unknown 
)
static

Definition at line 4004 of file ddraw.c.

4006{
4007 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
4008 struct d3d_material *object;
4009
4010 TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown);
4011
4012 if (outer_unknown) return CLASS_E_NOAGGREGATION;
4013
4014 object = d3d_material_create(ddraw);
4015 if (!object)
4016 {
4017 ERR("Failed to allocate material memory.\n");
4018 return DDERR_OUTOFMEMORY;
4019 }
4020
4021 TRACE("Created material %p.\n", object);
4022 *material = &object->IDirect3DMaterial3_iface;
4023
4024 return D3D_OK;
4025}

◆ d3d3_CreateVertexBuffer()

static HRESULT WINAPI d3d3_CreateVertexBuffer ( IDirect3D3 *  iface,
D3DVERTEXBUFFERDESC desc,
IDirect3DVertexBuffer **  vertex_buffer,
DWORD  flags,
IUnknown outer_unknown 
)
static

Definition at line 4376 of file ddraw.c.

4378{
4379 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
4380 struct d3d_vertex_buffer *object;
4381 HRESULT hr;
4382
4383 TRACE("iface %p, desc %p, vertex_buffer %p, flags %#x, outer_unknown %p.\n",
4384 iface, desc, vertex_buffer, flags, outer_unknown);
4385
4386 if (outer_unknown)
4387 return CLASS_E_NOAGGREGATION;
4388 if (!vertex_buffer || !desc)
4389 return DDERR_INVALIDPARAMS;
4390
4392 if (hr == D3D_OK)
4393 {
4394 TRACE("Created vertex buffer %p.\n", object);
4395 *vertex_buffer = (IDirect3DVertexBuffer *)&object->IDirect3DVertexBuffer7_iface;
4396 }
4397 else
4398 WARN("Failed to create vertex buffer, hr %#x.\n", hr);
4399
4400 return hr;
4401}
HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc) DECLSPEC_HIDDEN
Definition: vertexbuffer.c:432
GLbitfield flags
Definition: glext.h:7161
static const WCHAR desc[]
Definition: protectdata.c:36
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79

◆ d3d3_CreateViewport()

static HRESULT WINAPI d3d3_CreateViewport ( IDirect3D3 *  iface,
IDirect3DViewport3 **  viewport,
IUnknown outer_unknown 
)
static

Definition at line 4089 of file ddraw.c.

4091{
4092 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
4093 struct d3d_viewport *object;
4094
4095 TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown);
4096
4097 if (outer_unknown) return CLASS_E_NOAGGREGATION;
4098
4099 if (!(object = heap_alloc_zero(sizeof(*object))))
4100 {
4101 ERR("Failed to allocate viewport memory.\n");
4102 return DDERR_OUTOFMEMORY;
4103 }
4104
4105 d3d_viewport_init(object, ddraw);
4106
4107 TRACE("Created viewport %p.\n", object);
4108 *viewport = &object->IDirect3DViewport3_iface;
4109
4110 return D3D_OK;
4111}
void d3d_viewport_init(struct d3d_viewport *viewport, struct ddraw *ddraw) DECLSPEC_HIDDEN
Definition: viewport.c:1146

Referenced by d3d1_CreateViewport(), and d3d2_CreateViewport().

◆ d3d3_EnumDevices()

static HRESULT WINAPI d3d3_EnumDevices ( IDirect3D3 *  iface,
LPD3DENUMDEVICESCALLBACK  callback,
void context 
)
static

Definition at line 3797 of file ddraw.c.

3798{
3799 static CHAR wined3d_description[] = "Wine D3DDevice using WineD3D and OpenGL";
3800
3801 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
3802 D3DDEVICEDESC device_desc1, hal_desc, hel_desc;
3803 D3DDEVICEDESC7 device_desc7;
3804 HRESULT hr;
3805
3806 /* Some games (Motoracer 2 demo) have the bad idea to modify the device
3807 * name string. Let's put the string in a sufficiently sized array in
3808 * writable memory. */
3809 char device_name[50];
3810 strcpy(device_name,"Direct3D HEL");
3811
3812 TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
3813
3814 if (!callback)
3815 return DDERR_INVALIDPARAMS;
3816
3818
3819 if (FAILED(hr = ddraw_get_d3dcaps(ddraw, &device_desc7)))
3820 {
3822 return hr;
3823 }
3824 ddraw_d3dcaps1_from_7(&device_desc1, &device_desc7);
3825
3826 /* Do I have to enumerate the reference id? Note from old d3d7:
3827 * "It seems that enumerating the reference IID on Direct3D 1 games
3828 * (AvP / Motoracer2) breaks them". So do not enumerate this iid in V1
3829 *
3830 * There's a registry key HKLM\Software\Microsoft\Direct3D\Drivers,
3831 * EnumReference which enables / disables enumerating the reference
3832 * rasterizer. It's a DWORD, 0 means disabled, 2 means enabled. The
3833 * enablerefrast.reg and disablerefrast.reg files in the DirectX 7.0 sdk
3834 * demo directory suggest this.
3835 *
3836 * Some games(GTA 2) seem to use the second enumerated device, so I have
3837 * to enumerate at least 2 devices. So enumerate the reference device to
3838 * have 2 devices.
3839 *
3840 * Other games (Rollcage) tell emulation and hal device apart by certain
3841 * flags. Rollcage expects D3DPTEXTURECAPS_POW2 to be set (yeah, it is a
3842 * limitation flag), and it refuses all devices that have the perspective
3843 * flag set. This way it refuses the emulation device, and HAL devices
3844 * never have POW2 unset in d3d7 on windows. */
3845 if (ddraw->d3dversion != 1)
3846 {
3847 static CHAR reference_description[] = "RGB Direct3D emulation";
3848
3849 TRACE("Enumerating WineD3D D3DDevice interface.\n");
3850 hal_desc = device_desc1;
3851 hel_desc = device_desc1;
3852 /* The rgb device has the pow2 flag set in the hel caps, but not in the hal caps. */
3857 /* RGB, RAMP and MMX devices have a HAL dcmColorModel of 0 */
3858 hal_desc.dcmColorModel = 0;
3859 /* RGB, RAMP and MMX devices cannot report HAL hardware flags */
3860 hal_desc.dwFlags = 0;
3861
3862 hr = callback((GUID *)&IID_IDirect3DRGBDevice, reference_description,
3863 device_name, &hal_desc, &hel_desc, context);
3864 if (hr != D3DENUMRET_OK)
3865 {
3866 TRACE("Application cancelled the enumeration.\n");
3868 return D3D_OK;
3869 }
3870 }
3871
3872 strcpy(device_name,"Direct3D HAL");
3873
3874 TRACE("Enumerating HAL Direct3D device.\n");
3875 hal_desc = device_desc1;
3876 hel_desc = device_desc1;
3877
3878 /* The hal device does not have the pow2 flag set in hel, but in hal. */
3883 /* HAL devices have a HEL dcmColorModel of 0 */
3884 hel_desc.dcmColorModel = 0;
3885
3886 hr = callback((GUID *)&IID_IDirect3DHALDevice, wined3d_description,
3887 device_name, &hal_desc, &hel_desc, context);
3888 if (hr != D3DENUMRET_OK)
3889 {
3890 TRACE("Application cancelled the enumeration.\n");
3892 return D3D_OK;
3893 }
3894
3895 TRACE("End of enumeration.\n");
3896
3898
3899 return D3D_OK;
3900}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL
Definition: d3d8caps.h:119
#define D3DPTEXTURECAPS_PERSPECTIVE
Definition: d3d8caps.h:113
#define D3DPTEXTURECAPS_POW2
Definition: d3d8caps.h:114
#define D3DENUMRET_OK
Definition: d3dtypes.h:81
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
Definition: ddraw.c:1252
void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7)
Definition: ddraw.c:1196
static const WCHAR device_name[]
Definition: btrfs.c:60
#define FAILED(hr)
Definition: intsafe.h:51
D3DPRIMCAPS dpcTriCaps
Definition: d3dcaps.h:326
DWORD dwFlags
Definition: d3dcaps.h:319
D3DPRIMCAPS dpcLineCaps
Definition: d3dcaps.h:325
D3DCOLORMODEL dcmColorModel
Definition: d3dcaps.h:320
DWORD dwTextureCaps
Definition: d3dcaps.h:272
int d3dversion
char CHAR
Definition: xmlstorage.h:175

Referenced by d3d1_EnumDevices(), and d3d2_EnumDevices().

◆ d3d3_EnumZBufferFormats()

static HRESULT WINAPI d3d3_EnumZBufferFormats ( IDirect3D3 *  iface,
REFCLSID  device_iid,
LPD3DENUMPIXELFORMATSCALLBACK  callback,
void context 
)
static

Definition at line 4534 of file ddraw.c.

4536{
4537 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
4538
4539 TRACE("iface %p, device_iid %s, callback %p, context %p.\n",
4540 iface, debugstr_guid(device_iid), callback, context);
4541
4543}
static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device_iid, LPD3DENUMPIXELFORMATSCALLBACK callback, void *context)
Definition: ddraw.c:4420
IDirect3D7 IDirect3D7_iface
Definition: ddraw_private.h:83

◆ d3d3_EvictManagedTextures()

static HRESULT WINAPI d3d3_EvictManagedTextures ( IDirect3D3 *  iface)
static

Definition at line 4571 of file ddraw.c.

4572{
4573 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
4574
4575 TRACE("iface %p.\n", iface);
4576
4578}
static HRESULT WINAPI d3d7_EvictManagedTextures(IDirect3D7 *iface)
Definition: ddraw.c:4557

◆ d3d3_FindDevice()

static HRESULT WINAPI d3d3_FindDevice ( IDirect3D3 *  iface,
D3DFINDDEVICESEARCH fds,
D3DFINDDEVICERESULT fdr 
)
static

Definition at line 4149 of file ddraw.c.

4150{
4151 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
4152 D3DDEVICEDESC7 desc7;
4153 D3DDEVICEDESC desc1;
4154 HRESULT hr;
4155
4156 TRACE("iface %p, fds %p, fdr %p.\n", iface, fds, fdr);
4157
4158 if (!fds || !fdr) return DDERR_INVALIDPARAMS;
4159
4160 if (fds->dwSize != sizeof(D3DFINDDEVICESEARCH) || (fdr->dwSize != sizeof(D3DFINDDEVICERESULT1) &&
4161 fdr->dwSize != sizeof(D3DFINDDEVICERESULT2) && fdr->dwSize != sizeof(D3DFINDDEVICERESULT)))
4162 return DDERR_INVALIDPARAMS;
4163
4164 if ((fds->dwFlags & D3DFDS_COLORMODEL)
4165 && fds->dcmColorModel != D3DCOLOR_RGB)
4166 {
4167 WARN("Trying to request a non-RGB D3D color model. Not supported.\n");
4168 return DDERR_INVALIDPARAMS; /* No real idea what to return here :-) */
4169 }
4170
4171 if (fds->dwFlags & D3DFDS_GUID)
4172 {
4173 TRACE("Trying to match guid %s.\n", debugstr_guid(&(fds->guid)));
4175 && !IsEqualGUID(&IID_IDirect3DHALDevice, &fds->guid)
4176 && !IsEqualGUID(&IID_IDirect3DRGBDevice, &fds->guid))
4177 {
4178 WARN("No match for this GUID.\n");
4179 return DDERR_NOTFOUND;
4180 }
4181 }
4182
4183 /* Get the caps */
4184 if (FAILED(hr = ddraw_get_d3dcaps(ddraw, &desc7)))
4185 return hr;
4186
4187 /* Now return our own GUID */
4188 ddraw_d3dcaps1_from_7(&desc1, &desc7);
4190
4191 if (fdr->dwSize == sizeof(D3DFINDDEVICERESULT1))
4192 {
4194 memcpy(&fdr1->ddHwDesc, &desc1, sizeof(fdr1->ddHwDesc));
4195 memcpy(&fdr1->ddSwDesc, &desc1, sizeof(fdr1->ddSwDesc));
4196 }
4197 else if (fdr->dwSize == sizeof(D3DFINDDEVICERESULT2))
4198 {
4200 memcpy(&fdr2->ddHwDesc, &desc1, sizeof(fdr2->ddHwDesc));
4201 memcpy(&fdr2->ddSwDesc, &desc1, sizeof(fdr2->ddSwDesc));
4202 }
4203 else
4204 {
4205 fdr->ddHwDesc = desc1;
4206 fdr->ddSwDesc = desc1;
4207 }
4208
4209 TRACE("Returning Wine's wined3d device with (undumped) capabilities.\n");
4210
4211 return D3D_OK;
4212}
#define D3DFDS_COLORMODEL
Definition: d3dcaps.h:126
#define D3DFDS_GUID
Definition: d3dcaps.h:127
#define D3DCOLOR_RGB
Definition: d3dtypes.h:627
const GUID IID_D3DDEVICE_WineD3D
Definition: device.c:39
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define DDERR_NOTFOUND
Definition: ddraw.h:97
D3DDEVICEDESC1 ddSwDesc
Definition: d3dcaps.h:408
D3DDEVICEDESC1 ddHwDesc
Definition: d3dcaps.h:407
D3DDEVICEDESC2 ddSwDesc
Definition: d3dcaps.h:415
D3DDEVICEDESC2 ddHwDesc
Definition: d3dcaps.h:414
D3DDEVICEDESC ddSwDesc
Definition: d3dcaps.h:423
D3DDEVICEDESC ddHwDesc
Definition: d3dcaps.h:422
D3DCOLORMODEL dcmColorModel
Definition: d3dcaps.h:398

Referenced by d3d1_FindDevice(), and d3d2_FindDevice().

◆ d3d3_QueryInterface()

static HRESULT WINAPI d3d3_QueryInterface ( IDirect3D3 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 239 of file ddraw.c.

240{
241 struct ddraw *ddraw = impl_from_IDirect3D3(iface);
242
243 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
244
246}

◆ d3d3_Release()

static ULONG WINAPI d3d3_Release ( IDirect3D3 *  iface)
static

Definition at line 520 of file ddraw.c.

521{
522 struct ddraw *This = impl_from_IDirect3D3(iface);
523
524 TRACE("iface %p.\n", iface);
525
526 return ddraw1_Release(&This->IDirectDraw_iface);
527}

◆ d3d7_AddRef()

static ULONG WINAPI d3d7_AddRef ( IDirect3D7 *  iface)
static

Definition at line 332 of file ddraw.c.

333{
334 struct ddraw *This = impl_from_IDirect3D7(iface);
335
336 TRACE("iface %p.\n", iface);
337
338 return ddraw7_AddRef(&This->IDirectDraw7_iface);
339}
static struct ddraw * impl_from_IDirect3D7(IDirect3D7 *iface)
Definition: ddraw.c:123
static ULONG WINAPI ddraw7_AddRef(IDirectDraw7 *iface)
Definition: ddraw.c:284

◆ d3d7_CreateDevice()

static HRESULT WINAPI d3d7_CreateDevice ( IDirect3D7 *  iface,
REFCLSID  riid,
IDirectDrawSurface7 surface,
IDirect3DDevice7 **  device 
)
static

Definition at line 4253 of file ddraw.c.

4255{
4257 struct ddraw *ddraw = impl_from_IDirect3D7(iface);
4258 struct d3d_device *object;
4259 HRESULT hr;
4260
4261 TRACE("iface %p, riid %s, surface %p, device %p.\n", iface, debugstr_guid(riid), surface, device);
4262
4264 if (SUCCEEDED(hr = d3d_device_create(ddraw, riid, target, (IUnknown *)surface, 7, &object, NULL)))
4265 {
4266 *device = &object->IDirect3DDevice7_iface;
4267 }
4268 else
4269 {
4270 WARN("Failed to create device, hr %#x.\n", hr);
4271 *device = NULL;
4272 }
4274
4275 return hr;
4276}
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface) DECLSPEC_HIDDEN
Definition: surface.c:5641
GLenum target
Definition: glext.h:7315

◆ d3d7_CreateVertexBuffer()

static HRESULT WINAPI d3d7_CreateVertexBuffer ( IDirect3D7 *  iface,
D3DVERTEXBUFFERDESC desc,
IDirect3DVertexBuffer7 **  vertex_buffer,
DWORD  flags 
)
static

Definition at line 4352 of file ddraw.c.

4354{
4355 struct ddraw *ddraw = impl_from_IDirect3D7(iface);
4356 struct d3d_vertex_buffer *object;
4357 HRESULT hr;
4358
4359 TRACE("iface %p, desc %p, vertex_buffer %p, flags %#x.\n",
4360 iface, desc, vertex_buffer, flags);
4361
4362 if (!vertex_buffer || !desc) return DDERR_INVALIDPARAMS;
4363
4365 if (hr == D3D_OK)
4366 {
4367 TRACE("Created vertex buffer %p.\n", object);
4368 *vertex_buffer = &object->IDirect3DVertexBuffer7_iface;
4369 }
4370 else
4371 WARN("Failed to create vertex buffer, hr %#x.\n", hr);
4372
4373 return hr;
4374}

◆ d3d7_EnumDevices()

static HRESULT WINAPI d3d7_EnumDevices ( IDirect3D7 *  iface,
LPD3DENUMDEVICESCALLBACK7  callback,
void context 
)
static

Definition at line 3734 of file ddraw.c.

3735{
3736 struct ddraw *ddraw = impl_from_IDirect3D7(iface);
3737 D3DDEVICEDESC7 device_desc7;
3738 DWORD dev_caps;
3739 HRESULT hr;
3740 size_t i;
3741
3742 TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
3743
3744 if (!callback)
3745 return DDERR_INVALIDPARAMS;
3746
3748
3749 if (FAILED(hr = ddraw_get_d3dcaps(ddraw, &device_desc7)))
3750 {
3752 return hr;
3753 }
3754
3755 dev_caps = device_desc7.dwDevCaps;
3756
3757 for (i = 0; i < ARRAY_SIZE(device_list7); i++)
3758 {
3759 HRESULT ret;
3760
3761 device_desc7.deviceGUID = *device_list7[i].device_guid;
3762 device_desc7.dwDevCaps = dev_caps & ~device_list7[i].remove_caps;
3763
3764 ret = callback(device_list7[i].interface_name, device_list7[i].device_name, &device_desc7, context);
3765 if (ret != DDENUMRET_OK)
3766 {
3767 TRACE("Application cancelled the enumeration.\n");
3769 return D3D_OK;
3770 }
3771 }
3772
3773 TRACE("End of enumeration.\n");
3774
3776
3777 return D3D_OK;
3778}
#define ARRAY_SIZE(A)
Definition: main.h:20
static struct enum_device_entry device_list7[]
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DDENUMRET_OK
Definition: ddraw.h:189
GUID deviceGUID
Definition: d3dcaps.h:382
DWORD dwDevCaps
Definition: d3dcaps.h:358
int ret

◆ d3d7_EnumZBufferFormats()

static HRESULT WINAPI d3d7_EnumZBufferFormats ( IDirect3D7 *  iface,
REFCLSID  device_iid,
LPD3DENUMPIXELFORMATSCALLBACK  callback,
void context 
)
static

Definition at line 4420 of file ddraw.c.

4422{
4423 struct ddraw *ddraw = impl_from_IDirect3D7(iface);
4426 unsigned int i;
4427 HRESULT hr;
4428
4429 /* Order matters. Specifically, BattleZone II (full version) expects the
4430 * 16-bit depth formats to be listed before the 24 and 32 ones. */
4431 static const enum wined3d_format_id formats[] =
4432 {
4439 };
4440
4441 TRACE("iface %p, device_iid %s, callback %p, context %p.\n",
4442 iface, debugstr_guid(device_iid), callback, context);
4443
4444 if (!callback) return DDERR_INVALIDPARAMS;
4445
4446 if (IsEqualGUID(device_iid, &IID_IDirect3DHALDevice)
4447 || IsEqualGUID(device_iid, &IID_IDirect3DTnLHalDevice)
4448 || IsEqualGUID(device_iid, &IID_D3DDEVICE_WineD3D))
4449 {
4450 TRACE("Asked for HAL device.\n");
4452 }
4453 else if (IsEqualGUID(device_iid, &IID_IDirect3DRGBDevice)
4454 || IsEqualGUID(device_iid, &IID_IDirect3DMMXDevice))
4455 {
4456 TRACE("Asked for SW device.\n");
4458 }
4459 else if (IsEqualGUID(device_iid, &IID_IDirect3DRefDevice))
4460 {
4461 TRACE("Asked for REF device.\n");
4463 }
4464 else if (IsEqualGUID(device_iid, &IID_IDirect3DNullDevice))
4465 {
4466 TRACE("Asked for NULLREF device.\n");
4468 }
4469 else
4470 {
4471 FIXME("Unexpected device GUID %s.\n", debugstr_guid(device_iid));
4473 }
4474
4476 /* We need an adapter format from somewhere to please wined3d and WGL.
4477 * Use the current display mode. So far all cards offer the same depth
4478 * stencil format for all modes, but if some do not and applications do
4479 * not like that we'll have to find some workaround, like iterating over
4480 * all imaginable formats and collecting all the depth stencil formats we
4481 * can get. */
4483 {
4484 ERR("Failed to get display mode, hr %#x.\n", hr);
4486 return hr;
4487 }
4488
4489 for (i = 0; i < ARRAY_SIZE(formats); ++i)
4490 {
4493 {
4494 DDPIXELFORMAT pformat;
4495
4496 memset(&pformat, 0, sizeof(pformat));
4497 pformat.dwSize = sizeof(pformat);
4499
4500 TRACE("Enumerating wined3d format %#x.\n", formats[i]);
4501 hr = callback(&pformat, context);
4502 if (hr != DDENUMRET_OK)
4503 {
4504 TRACE("Format enumeration cancelled by application.\n");
4506 return D3D_OK;
4507 }
4508 }
4509 }
4510
4511 /* Historically some windows drivers used dwZBufferBitDepth=24 for WINED3DFMT_X8D24_UNORM,
4512 * while others used dwZBufferBitDepth=32. In either case the pitch matches a 32 bits per
4513 * pixel format, so we use dwZBufferBitDepth=32. Some games expect 24. Windows Vista and
4514 * newer enumerate both versions, so we do the same(bug 22434) */
4517 {
4518 DDPIXELFORMAT x8d24 =
4519 {
4520 sizeof(x8d24), DDPF_ZBUFFER, 0,
4521 {24}, {0x00000000}, {0x00ffffff}, {0x00000000}
4522 };
4523 TRACE("Enumerating WINED3DFMT_X8D24_UNORM, dwZBufferBitDepth=24 version\n");
4524 callback(&x8d24, context);
4525 }
4526
4527 TRACE("End of enumeration.\n");
4528
4530
4531 return D3D_OK;
4532}
#define FIXME(fmt,...)
Definition: precomp.h:53
void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format, enum wined3d_format_id wined3d_format) DECLSPEC_HIDDEN
Definition: utils.c:33
static const struct pixel_format_desc formats[]
Definition: util.c:59
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum mode
Definition: glext.h:6217
#define DDPF_ZBUFFER
Definition: ddraw.h:511
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwSize
Definition: ddraw.h:1070
struct wined3d * wined3d
Definition: ddraw_private.h:92
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
Definition: directx.c:5334
HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: directx.c:4767
#define WINED3DADAPTER_DEFAULT
Definition: wined3d.h:857
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
wined3d_format_id
Definition: wined3d.h:106
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:191
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:181
wined3d_device_type
Definition: wined3d.h:86
@ WINED3D_DEVICE_TYPE_NULLREF
Definition: wined3d.h:90
@ WINED3D_DEVICE_TYPE_SW
Definition: wined3d.h:89
@ WINED3D_DEVICE_TYPE_HAL
Definition: wined3d.h:87
@ WINED3D_DEVICE_TYPE_REF
Definition: wined3d.h:88
#define WINED3DUSAGE_DEPTHSTENCIL
Definition: wined3d.h:900

Referenced by d3d3_EnumZBufferFormats().

◆ d3d7_EvictManagedTextures()

static HRESULT WINAPI d3d7_EvictManagedTextures ( IDirect3D7 *  iface)
static

Definition at line 4557 of file ddraw.c.

4558{
4559 struct ddraw *ddraw = impl_from_IDirect3D7(iface);
4560
4561 TRACE("iface %p!\n", iface);
4562
4567
4568 return D3D_OK;
4569}
#define DDRAW_D3D_INITIALIZED
Definition: ddraw_private.h:55
void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
Definition: device.c:4753
DWORD flags
Definition: ddraw_private.h:94
struct wined3d_device * wined3d_device
Definition: ddraw_private.h:93

Referenced by d3d3_EvictManagedTextures().

◆ d3d7_QueryInterface()

static HRESULT WINAPI d3d7_QueryInterface ( IDirect3D7 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 230 of file ddraw.c.

231{
232 struct ddraw *ddraw = impl_from_IDirect3D7(iface);
233
234 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
235
237}

◆ d3d7_Release()

static ULONG WINAPI d3d7_Release ( IDirect3D7 *  iface)
static

Definition at line 511 of file ddraw.c.

512{
513 struct ddraw *This = impl_from_IDirect3D7(iface);
514
515 TRACE("iface %p.\n", iface);
516
517 return ddraw7_Release(&This->IDirectDraw7_iface);
518}
static ULONG WINAPI ddraw7_Release(IDirectDraw7 *iface)
Definition: ddraw.c:459

◆ ddraw1_AddRef()

static ULONG WINAPI ddraw1_AddRef ( IDirectDraw *  iface)
static

Definition at line 320 of file ddraw.c.

321{
322 struct ddraw *This = impl_from_IDirectDraw(iface);
324
325 TRACE("%p increasing refcount to %u.\n", This, ref);
326
327 if (ref == 1) InterlockedIncrement(&This->numIfaces);
328
329 return ref;
330}
#define InterlockedIncrement
Definition: armddk.h:53
static struct ddraw * impl_from_IDirectDraw(IDirectDraw *iface)
Definition: ddraw.c:88
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

Referenced by d3d1_AddRef(), d3d2_AddRef(), and d3d3_AddRef().

◆ ddraw1_Compact()

static HRESULT WINAPI ddraw1_Compact ( IDirectDraw *  iface)
static

Definition at line 1636 of file ddraw.c.

1637{
1638 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
1639
1640 TRACE("iface %p.\n", iface);
1641
1643}
static HRESULT WINAPI ddraw7_Compact(IDirectDraw7 *iface)
Definition: ddraw.c:1611

◆ ddraw1_CreateClipper()

static HRESULT WINAPI ddraw1_CreateClipper ( IDirectDraw *  iface,
DWORD  flags,
IDirectDrawClipper **  clipper,
IUnknown outer_unknown 
)
static

Definition at line 3486 of file ddraw.c.

3488{
3489 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
3490
3491 TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
3492 iface, flags, clipper, outer_unknown);
3493
3494 return ddraw7_CreateClipper(&ddraw->IDirectDraw7_iface, flags, clipper, outer_unknown);
3495}
static HRESULT WINAPI ddraw7_CreateClipper(IDirectDraw7 *iface, DWORD Flags, IDirectDrawClipper **Clipper, IUnknown *UnkOuter)
Definition: ddraw.c:3455

◆ ddraw1_CreatePalette()

static HRESULT WINAPI ddraw1_CreatePalette ( IDirectDraw *  iface,
DWORD  flags,
PALETTEENTRY entries,
IDirectDrawPalette **  palette,
IUnknown outer_unknown 
)
static

Definition at line 3600 of file ddraw.c.

3602{
3603 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
3604 HRESULT hr;
3605
3606 TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n",
3607 iface, flags, entries, palette, outer_unknown);
3608
3609 hr = ddraw7_CreatePalette(&ddraw->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
3610 if (SUCCEEDED(hr) && *palette)
3611 {
3613 IDirectDraw7_Release(&ddraw->IDirectDraw7_iface);
3614 impl->ifaceToRelease = NULL;
3615 }
3616
3617 return hr;
3618}
static struct ddraw_palette * impl_from_IDirectDrawPalette(IDirectDrawPalette *iface)
static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags, PALETTEENTRY *ColorTable, IDirectDrawPalette **Palette, IUnknown *pUnkOuter)
Definition: ddraw.c:3514
static HPALETTE palette
Definition: clipboard.c:1345
IUnknown * ifaceToRelease

◆ ddraw1_CreateSurface()

static HRESULT WINAPI ddraw1_CreateSurface ( IDirectDraw *  iface,
DDSURFACEDESC surface_desc,
IDirectDrawSurface **  surface,
IUnknown outer_unknown 
)
static

Definition at line 3023 of file ddraw.c.

3025{
3026 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
3027 struct ddraw_surface *impl;
3028 HRESULT hr;
3029 DDSURFACEDESC2 surface_desc2;
3030
3031 TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n",
3032 iface, surface_desc, surface, outer_unknown);
3033
3035
3037 {
3038 WARN("Cooperative level not set.\n");
3041 }
3042
3043 if(surface_desc == NULL || surface_desc->dwSize != sizeof(DDSURFACEDESC))
3044 {
3045 WARN("Application supplied invalid surface descriptor\n");
3047 return DDERR_INVALIDPARAMS;
3048 }
3049
3050 __TRY
3051 {
3052 *surface = NULL;
3053 }
3055 {
3056 WARN("Surface pointer %p is invalid.\n", surface);
3058 return DDERR_INVALIDPARAMS;
3059 }
3060 __ENDTRY;
3061
3066 {
3067 WARN("Application tried to create an explicit front or back buffer.\n");
3069 return DDERR_INVALIDCAPS;
3070 }
3071
3072 DDSD_to_DDSD2(surface_desc, &surface_desc2);
3073 hr = ddraw_surface_create(ddraw, &surface_desc2, &impl, outer_unknown, 1);
3075 if (FAILED(hr))
3076 return hr;
3077
3078 *surface = &impl->IDirectDrawSurface_iface;
3079 impl->ifaceToRelease = NULL;
3080
3081 return hr;
3082}
void DDSD_to_DDSD2(const DDSURFACEDESC *in, DDSURFACEDESC2 *out) DECLSPEC_HIDDEN
Definition: utils.c:1218
HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version) DECLSPEC_HIDDEN
Definition: surface.c:5791
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
#define DDSCAPS_FRONTBUFFER
Definition: ddraw.h:254
#define DDSCL_NORMAL
Definition: ddraw.h:535
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:258
#define DDERR_INVALIDCAPS
Definition: ddraw.h:75
#define DDSCL_EXCLUSIVE
Definition: ddraw.h:536
#define DDERR_NOCOOPERATIVELEVELSET
Definition: ddraw.h:89
#define DDSCAPS_FLIP
Definition: ddraw.h:253
#define DDSCAPS_BACKBUFFER
Definition: ddraw.h:251
DWORD dwCaps
Definition: ddraw.h:732
DDSCAPS2 ddsCaps
Definition: ddraw.h:1188
DWORD dwSize
Definition: ddraw.h:1152
IDirectDrawSurface IDirectDrawSurface_iface
DDSURFACEDESC2 surface_desc
IUnknown * ifaceToRelease
DWORD cooperative_level

◆ ddraw1_DuplicateSurface()

static HRESULT WINAPI ddraw1_DuplicateSurface ( IDirectDraw *  iface,
IDirectDrawSurface *  src,
IDirectDrawSurface **  dst 
)
static

Definition at line 3697 of file ddraw.c.

3699{
3701 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
3702 struct ddraw_surface *dst_impl;
3703 IDirectDrawSurface7 *dst7;
3704 HRESULT hr;
3705
3706 TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
3707
3709 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, &dst7);
3710 if (FAILED(hr))
3711 return hr;
3712 dst_impl = impl_from_IDirectDrawSurface7(dst7);
3713 *dst = &dst_impl->IDirectDrawSurface_iface;
3714 IDirectDrawSurface_AddRef(*dst);
3715 IDirectDrawSurface7_Release(dst7);
3716
3717 return hr;
3718}
static struct ddraw_surface * impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
static HRESULT WINAPI ddraw7_DuplicateSurface(IDirectDraw7 *iface, IDirectDrawSurface7 *Src, IDirectDrawSurface7 **Dest)
Definition: ddraw.c:3637
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
DWORD IDirectDrawSurface7
Definition: vmrender.idl:20
IDirectDrawSurface7 IDirectDrawSurface7_iface

◆ ddraw1_EnumDisplayModes()

static HRESULT WINAPI ddraw1_EnumDisplayModes ( IDirectDraw *  iface,
DWORD  flags,
DDSURFACEDESC surface_desc,
void context,
LPDDENUMMODESCALLBACK  callback 
)
static

Definition at line 2573 of file ddraw.c.

2575{
2576 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
2577 struct displaymodescallback_context cbcontext;
2578 DDSURFACEDESC2 surface_desc2;
2579
2580 TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
2581 iface, flags, surface_desc, context, callback);
2582
2583 cbcontext.func = callback;
2584 cbcontext.context = context;
2585
2586 if (surface_desc) DDSD_to_DDSD2(surface_desc, &surface_desc2);
2588 surface_desc ? &surface_desc2 : NULL, &cbcontext, EnumDisplayModesCallbackThunk);
2589}
static HRESULT CALLBACK EnumDisplayModesCallbackThunk(DDSURFACEDESC2 *surface_desc, void *context)
Definition: ddraw.c:2398
static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMMODESCALLBACK2 cb)
Definition: ddraw.c:2425

◆ ddraw1_EnumSurfaces()

static HRESULT WINAPI ddraw1_EnumSurfaces ( IDirectDraw *  iface,
DWORD  flags,
DDSURFACEDESC surface_desc,
void context,
LPDDENUMSURFACESCALLBACK  callback 
)
static

Definition at line 3381 of file ddraw.c.

3383{
3384 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
3385 struct surfacescallback_context cbcontext;
3386 DDSURFACEDESC2 surface_desc2;
3387
3388 TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
3389 iface, flags, surface_desc, context, callback);
3390
3391 cbcontext.func = callback;
3392 cbcontext.context = context;
3393
3394 if (surface_desc) DDSD_to_DDSD2(surface_desc, &surface_desc2);
3396 surface_desc ? &surface_desc2 : NULL, &cbcontext, EnumSurfacesCallbackThunk);
3397}
static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags, DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMSURFACESCALLBACK7 Callback)
Definition: ddraw.c:3247
static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *surface_desc, void *context)
Definition: ddraw.c:3215

◆ ddraw1_FlipToGDISurface()

static HRESULT WINAPI ddraw1_FlipToGDISurface ( IDirectDraw *  iface)
static

Definition at line 2145 of file ddraw.c.

2146{
2147 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
2148
2149 TRACE("iface %p.\n", iface);
2150
2152}
static HRESULT WINAPI ddraw7_FlipToGDISurface(IDirectDraw7 *iface)
Definition: ddraw.c:2097

◆ ddraw1_GetCaps()

static HRESULT WINAPI ddraw1_GetCaps ( IDirectDraw *  iface,
DDCAPS driver_caps,
DDCAPS hel_caps 
)
static

Definition at line 1593 of file ddraw.c.

1594{
1595 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
1596
1597 TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
1598
1599 return ddraw7_GetCaps(&ddraw->IDirectDraw7_iface, driver_caps, hel_caps);
1600}
static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DDCAPS *HELCaps)
Definition: ddraw.c:1483

◆ ddraw1_GetDisplayMode()

static HRESULT WINAPI ddraw1_GetDisplayMode ( IDirectDraw *  iface,
DDSURFACEDESC surface_desc 
)
static

Definition at line 1723 of file ddraw.c.

1724{
1725 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
1726 HRESULT hr;
1727
1728 TRACE("iface %p, surface_desc %p.\n", iface, surface_desc);
1729
1731 if (SUCCEEDED(hr)) surface_desc->dwSize = sizeof(*surface_desc);
1732 return hr;
1733}
static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2 *DDSD)
Definition: ddraw.c:1659

◆ ddraw1_GetFourCCCodes()

static HRESULT WINAPI ddraw1_GetFourCCCodes ( IDirectDraw *  iface,
DWORD codes_count,
DWORD codes 
)
static

Definition at line 1811 of file ddraw.c.

1812{
1813 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
1814
1815 TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes);
1816
1817 return ddraw7_GetFourCCCodes(&ddraw->IDirectDraw7_iface, codes_count, codes);
1818}
static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes, DWORD *Codes)
Definition: ddraw.c:1752

◆ ddraw1_GetGDISurface()

static HRESULT WINAPI ddraw1_GetGDISurface ( IDirectDraw *  iface,
IDirectDrawSurface **  surface 
)
static

Definition at line 2369 of file ddraw.c.

2370{
2371 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
2372 struct ddraw_surface *surface_impl;
2373 IDirectDrawSurface7 *surface7;
2374 HRESULT hr;
2375
2376 TRACE("iface %p, surface %p.\n", iface, surface);
2377
2379 if (FAILED(hr))
2380 {
2381 *surface = NULL;
2382 return hr;
2383 }
2384 surface_impl = impl_from_IDirectDrawSurface7(surface7);
2385 *surface = &surface_impl->IDirectDrawSurface_iface;
2386 IDirectDrawSurface_AddRef(*surface);
2387 IDirectDrawSurface7_Release(surface7);
2388
2389 return hr;
2390}
static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurface7 **GDISurface)
Definition: ddraw.c:2302

◆ ddraw1_GetMonitorFrequency()

static HRESULT WINAPI ddraw1_GetMonitorFrequency ( IDirectDraw *  iface,
DWORD frequency 
)
static

Definition at line 1860 of file ddraw.c.

1861{
1862 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
1863
1864 TRACE("iface %p, frequency %p.\n", iface, frequency);
1865
1867}
static HRESULT WINAPI ddraw7_GetMonitorFrequency(IDirectDraw7 *iface, DWORD *frequency)
Definition: ddraw.c:1820
static LARGE_INTEGER * frequency
Definition: time.c:106

◆ ddraw1_GetScanLine()

static HRESULT WINAPI ddraw1_GetScanLine ( IDirectDraw *  iface,
DWORD line 
)
static

Definition at line 2261 of file ddraw.c.

2262{
2263 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
2264
2265 TRACE("iface %p, line %p.\n", iface, line);
2266
2268}
static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline)
Definition: ddraw.c:2218
Definition: parser.c:49

◆ ddraw1_GetVerticalBlankStatus()

static HRESULT WINAPI ddraw1_GetVerticalBlankStatus ( IDirectDraw *  iface,
BOOL status 
)
static

Definition at line 1912 of file ddraw.c.

1913{
1914 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
1915
1916 TRACE("iface %p, status %p.\n", iface, status);
1917
1919}
static HRESULT WINAPI ddraw7_GetVerticalBlankStatus(IDirectDraw7 *iface, BOOL *status)
Definition: ddraw.c:1869
Definition: ps.c:97

◆ ddraw1_Initialize()

static HRESULT WINAPI ddraw1_Initialize ( IDirectDraw *  iface,
GUID guid 
)
static

Definition at line 2068 of file ddraw.c.

2069{
2070 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
2071
2072 TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
2073
2075}
static HRESULT WINAPI ddraw7_Initialize(IDirectDraw7 *iface, GUID *guid)
Definition: ddraw.c:2032
const GUID * guid

◆ ddraw1_QueryInterface()

static HRESULT WINAPI ddraw1_QueryInterface ( IDirectDraw *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 221 of file ddraw.c.

222{
223 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
224
225 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
226
228}

◆ ddraw1_Release()

static ULONG WINAPI ddraw1_Release ( IDirectDraw *  iface)
static

Definition at line 498 of file ddraw.c.

499{
500 struct ddraw *This = impl_from_IDirectDraw(iface);
502
503 TRACE("%p decreasing refcount to %u.\n", This, ref);
504
505 if (!ref && !InterlockedDecrement(&This->numIfaces))
507
508 return ref;
509}
#define InterlockedDecrement
Definition: armddk.h:52
static void ddraw_destroy(struct ddraw *This)
Definition: ddraw.c:423

Referenced by d3d1_Release(), d3d2_Release(), and d3d3_Release().

◆ ddraw1_RestoreDisplayMode()

static HRESULT WINAPI ddraw1_RestoreDisplayMode ( IDirectDraw *  iface)
static

Definition at line 727 of file ddraw.c.

728{
729 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
730
731 TRACE("iface %p.\n", iface);
732
734}
static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface)
Definition: ddraw.c:678

◆ ddraw1_SetCooperativeLevel()

static HRESULT WINAPI ddraw1_SetCooperativeLevel ( IDirectDraw *  iface,
HWND  window,
DWORD  flags 
)
static

Definition at line 1049 of file ddraw.c.

1050{
1051 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
1052 HRESULT hr;
1053
1054 TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
1055
1057 if (SUCCEEDED(hr))
1059 return hr;
1060}
#define DDRAW_SCL_DDRAW1
Definition: ddraw_private.h:58
#define FALSE
Definition: types.h:117
static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window, DWORD cooplevel, BOOL restore_mode_on_normal)
Definition: ddraw.c:778
static IHTMLWindow2 * window
Definition: events.c:77

◆ ddraw1_SetDisplayMode()

static HRESULT WINAPI ddraw1_SetDisplayMode ( IDirectDraw *  iface,
DWORD  width,
DWORD  height,
DWORD  bpp 
)
static

Definition at line 1187 of file ddraw.c.

1188{
1189 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
1190
1191 TRACE("iface %p, width %u, height %u, bpp %u.\n", iface, width, height, bpp);
1192
1194}
DWORD bpp
Definition: surface.c:185
static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags)
Definition: ddraw.c:1084
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546

◆ ddraw1_WaitForVerticalBlank()

static HRESULT WINAPI ddraw1_WaitForVerticalBlank ( IDirectDraw *  iface,
DWORD  flags,
HANDLE  event 
)
static

Definition at line 2209 of file ddraw.c.

2210{
2211 struct ddraw *ddraw = impl_from_IDirectDraw(iface);
2212
2213 TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
2214
2216}
static HRESULT WINAPI ddraw7_WaitForVerticalBlank(IDirectDraw7 *iface, DWORD Flags, HANDLE event)
Definition: ddraw.c:2171
struct _cl_event * event
Definition: glext.h:7739

◆ ddraw2_AddRef()

static ULONG WINAPI ddraw2_AddRef ( IDirectDraw2 *  iface)
static

Definition at line 308 of file ddraw.c.

309{
310 struct ddraw *This = impl_from_IDirectDraw2(iface);
312
313 TRACE("%p increasing refcount to %u.\n", This, ref);
314
315 if (ref == 1) InterlockedIncrement(&This->numIfaces);
316
317 return ref;
318}
static struct ddraw * impl_from_IDirectDraw2(IDirectDraw2 *iface)
Definition: ddraw.c:93

◆ ddraw2_Compact()

static HRESULT WINAPI ddraw2_Compact ( IDirectDraw2 *  iface)
static

Definition at line 1627 of file ddraw.c.

1628{
1629 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
1630
1631 TRACE("iface %p.\n", iface);
1632
1634}

◆ ddraw2_CreateClipper()

static HRESULT WINAPI ddraw2_CreateClipper ( IDirectDraw2 *  iface,
DWORD  flags,
IDirectDrawClipper **  clipper,
IUnknown outer_unknown 
)
static

Definition at line 3475 of file ddraw.c.

3477{
3478 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
3479
3480 TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
3481 iface, flags, clipper, outer_unknown);
3482
3483 return ddraw7_CreateClipper(&ddraw->IDirectDraw7_iface, flags, clipper, outer_unknown);
3484}

◆ ddraw2_CreatePalette()

static HRESULT WINAPI ddraw2_CreatePalette ( IDirectDraw2 *  iface,
DWORD  flags,
PALETTEENTRY entries,
IDirectDrawPalette **  palette,
IUnknown outer_unknown 
)
static

Definition at line 3580 of file ddraw.c.

3582{
3583 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
3584 HRESULT hr;
3585
3586 TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n",
3587 iface, flags, entries, palette, outer_unknown);
3588
3589 hr = ddraw7_CreatePalette(&ddraw->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
3590 if (SUCCEEDED(hr) && *palette)
3591 {
3593 IDirectDraw7_Release(&ddraw->IDirectDraw7_iface);
3594 impl->ifaceToRelease = NULL;
3595 }
3596
3597 return hr;
3598}

◆ ddraw2_CreateSurface()

static HRESULT WINAPI ddraw2_CreateSurface ( IDirectDraw2 *  iface,
DDSURFACEDESC surface_desc,
IDirectDrawSurface **  surface,
IUnknown outer_unknown 
)
static

Definition at line 2959 of file ddraw.c.

2961{
2962 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
2963 struct ddraw_surface *impl;
2964 HRESULT hr;
2965 DDSURFACEDESC2 surface_desc2;
2966
2967 TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n",
2968 iface, surface_desc, surface, outer_unknown);
2969
2971
2973 {
2974 WARN("Cooperative level not set.\n");
2977 }
2978
2979 if(surface_desc == NULL || surface_desc->dwSize != sizeof(DDSURFACEDESC))
2980 {
2981 WARN("Application supplied invalid surface descriptor\n");
2983 return DDERR_INVALIDPARAMS;
2984 }
2985
2986 __TRY
2987 {
2988 *surface = NULL;
2989 }
2991 {
2992 WARN("Surface pointer %p is invalid.\n", surface);
2994 return DDERR_INVALIDPARAMS;
2995 }
2996 __ENDTRY;
2997
2998 DDSD_to_DDSD2(surface_desc, &surface_desc2);
3000 {
3001 if (TRACE_ON(ddraw))
3002 {
3003 TRACE(" (%p) Requesting surface desc :\n", iface);
3005 }
3006
3007 WARN("Application tried to create an explicit front or back buffer\n");
3009 return DDERR_INVALIDCAPS;
3010 }
3011
3012 hr = ddraw_surface_create(ddraw, &surface_desc2, &impl, outer_unknown, 2);
3014 if (FAILED(hr))
3015 return hr;
3016
3017 *surface = &impl->IDirectDrawSurface_iface;
3018 impl->ifaceToRelease = NULL;
3019
3020 return hr;
3021}
void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) DECLSPEC_HIDDEN
Definition: utils.c:864
#define TRACE_ON(x)
Definition: compat.h:75

◆ ddraw2_DuplicateSurface()

static HRESULT WINAPI ddraw2_DuplicateSurface ( IDirectDraw2 *  iface,
IDirectDrawSurface *  src,
IDirectDrawSurface **  dst 
)
static

Definition at line 3674 of file ddraw.c.

3676{
3678 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
3679 struct ddraw_surface *dst_impl;
3680 IDirectDrawSurface7 *dst7;
3681 HRESULT hr;
3682
3683 TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
3684
3686 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, &dst7);
3687 if (FAILED(hr))
3688 return hr;
3689 dst_impl = impl_from_IDirectDrawSurface7(dst7);
3690 *dst = &dst_impl->IDirectDrawSurface_iface;
3691 IDirectDrawSurface_AddRef(*dst);
3692 IDirectDrawSurface7_Release(dst7);
3693
3694 return hr;
3695}

◆ ddraw2_EnumDisplayModes()

static HRESULT WINAPI ddraw2_EnumDisplayModes ( IDirectDraw2 *  iface,
DWORD  flags,
DDSURFACEDESC surface_desc,
void context,
LPDDENUMMODESCALLBACK  callback 
)
static

Definition at line 2555 of file ddraw.c.

2557{
2558 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
2559 struct displaymodescallback_context cbcontext;
2560 DDSURFACEDESC2 surface_desc2;
2561
2562 TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
2563 iface, flags, surface_desc, context, callback);
2564
2565 cbcontext.func = callback;
2566 cbcontext.context = context;
2567
2568 if (surface_desc) DDSD_to_DDSD2(surface_desc, &surface_desc2);
2570 surface_desc ? &surface_desc2 : NULL, &cbcontext, EnumDisplayModesCallbackThunk);
2571}

◆ ddraw2_EnumSurfaces()

static HRESULT WINAPI ddraw2_EnumSurfaces ( IDirectDraw2 *  iface,
DWORD  flags,
DDSURFACEDESC surface_desc,
void context,
LPDDENUMSURFACESCALLBACK  callback 
)
static

Definition at line 3363 of file ddraw.c.

3365{
3366 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
3367 struct surfacescallback_context cbcontext;
3368 DDSURFACEDESC2 surface_desc2;
3369
3370 TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
3371 iface, flags, surface_desc, context, callback);
3372
3373 cbcontext.func = callback;
3374 cbcontext.context = context;
3375
3376 if (surface_desc) DDSD_to_DDSD2(surface_desc, &surface_desc2);
3378 surface_desc ? &surface_desc2 : NULL, &cbcontext, EnumSurfacesCallbackThunk);
3379}

◆ ddraw2_FlipToGDISurface()

static HRESULT WINAPI ddraw2_FlipToGDISurface ( IDirectDraw2 *  iface)
static

Definition at line 2136 of file ddraw.c.

2137{
2138 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
2139
2140 TRACE("iface %p.\n", iface);
2141
2143}

◆ ddraw2_GetAvailableVidMem()

static HRESULT WINAPI ddraw2_GetAvailableVidMem ( IDirectDraw2 *  iface,
DDSCAPS caps,
DWORD total,
DWORD free 
)
static

Definition at line 2006 of file ddraw.c.

2008{
2009 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
2010 DDSCAPS2 caps2;
2011
2012 TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
2013
2014 DDRAW_Convert_DDSCAPS_1_To_2(caps, &caps2);
2016}
void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS *pIn, DDSCAPS2 *pOut) DECLSPEC_HIDDEN
Definition: utils.c:951
#define free
Definition: debug_ros.c:5
static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *caps, DWORD *total, DWORD *free)
Definition: ddraw.c:1936
size_t total

◆ ddraw2_GetCaps()

static HRESULT WINAPI ddraw2_GetCaps ( IDirectDraw2 *  iface,
DDCAPS driver_caps,
DDCAPS hel_caps 
)
static

Definition at line 1584 of file ddraw.c.

1585{
1586 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
1587
1588 TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
1589
1590 return ddraw7_GetCaps(&ddraw->IDirectDraw7_iface, driver_caps, hel_caps);
1591}

◆ ddraw2_GetDisplayMode()

static HRESULT WINAPI ddraw2_GetDisplayMode ( IDirectDraw2 *  iface,
DDSURFACEDESC surface_desc 
)
static

Definition at line 1711 of file ddraw.c.

1712{
1713 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
1714 HRESULT hr;
1715
1716 TRACE("iface %p, surface_desc %p.\n", iface, surface_desc);
1717
1719 if (SUCCEEDED(hr)) surface_desc->dwSize = sizeof(*surface_desc);
1720 return hr;
1721}

◆ ddraw2_GetFourCCCodes()

static HRESULT WINAPI ddraw2_GetFourCCCodes ( IDirectDraw2 *  iface,
DWORD codes_count,
DWORD codes 
)
static

Definition at line 1802 of file ddraw.c.

1803{
1804 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
1805
1806 TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes);
1807
1808 return ddraw7_GetFourCCCodes(&ddraw->IDirectDraw7_iface, codes_count, codes);
1809}

◆ ddraw2_GetGDISurface()

static HRESULT WINAPI ddraw2_GetGDISurface ( IDirectDraw2 *  iface,
IDirectDrawSurface **  surface 
)
static

Definition at line 2346 of file ddraw.c.

2347{
2348 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
2349 struct ddraw_surface *surface_impl;
2350 IDirectDrawSurface7 *surface7;
2351 HRESULT hr;
2352
2353 TRACE("iface %p, surface %p.\n", iface, surface);
2354
2356 if (FAILED(hr))
2357 {
2358 *surface = NULL;
2359 return hr;
2360 }
2361 surface_impl = impl_from_IDirectDrawSurface7(surface7);
2362 *surface = &surface_impl->IDirectDrawSurface_iface;
2363 IDirectDrawSurface_AddRef(*surface);
2364 IDirectDrawSurface7_Release(surface7);
2365
2366 return hr;
2367}

◆ ddraw2_GetMonitorFrequency()

static HRESULT WINAPI ddraw2_GetMonitorFrequency ( IDirectDraw2 *  iface,
DWORD frequency 
)
static

Definition at line 1851 of file ddraw.c.

1852{
1853 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
1854
1855 TRACE("iface %p, frequency %p.\n", iface, frequency);
1856
1858}

◆ ddraw2_GetScanLine()

static HRESULT WINAPI ddraw2_GetScanLine ( IDirectDraw2 *  iface,
DWORD line 
)
static

Definition at line 2252 of file ddraw.c.

2253{
2254 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
2255
2256 TRACE("iface %p, line %p.\n", iface, line);
2257
2259}

◆ ddraw2_GetVerticalBlankStatus()

static HRESULT WINAPI ddraw2_GetVerticalBlankStatus ( IDirectDraw2 *  iface,
BOOL status 
)
static

Definition at line 1903 of file ddraw.c.

1904{
1905 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
1906
1907 TRACE("iface %p, status %p.\n", iface, status);
1908
1910}

◆ ddraw2_Initialize()

static HRESULT WINAPI ddraw2_Initialize ( IDirectDraw2 *  iface,
GUID guid 
)
static

Definition at line 2059 of file ddraw.c.

2060{
2061 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
2062
2063 TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
2064
2066}

◆ ddraw2_QueryInterface()

static HRESULT WINAPI ddraw2_QueryInterface ( IDirectDraw2 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 212 of file ddraw.c.

213{
214 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
215
216 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
217
219}

◆ ddraw2_Release()

static ULONG WINAPI ddraw2_Release ( IDirectDraw2 *  iface)
static

Definition at line 485 of file ddraw.c.

486{
487 struct ddraw *This = impl_from_IDirectDraw2(iface);
489
490 TRACE("%p decreasing refcount to %u.\n", This, ref);
491
492 if (!ref && !InterlockedDecrement(&This->numIfaces))
494
495 return ref;
496}

◆ ddraw2_RestoreDisplayMode()

static HRESULT WINAPI ddraw2_RestoreDisplayMode ( IDirectDraw2 *  iface)
static

Definition at line 718 of file ddraw.c.

719{
720 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
721
722 TRACE("iface %p.\n", iface);
723
725}

◆ ddraw2_SetCooperativeLevel()

static HRESULT WINAPI ddraw2_SetCooperativeLevel ( IDirectDraw2 *  iface,
HWND  window,
DWORD  flags 
)
static

Definition at line 1040 of file ddraw.c.

1041{
1042 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
1043
1044 TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
1045
1047}

◆ ddraw2_SetDisplayMode()

static HRESULT WINAPI ddraw2_SetDisplayMode ( IDirectDraw2 *  iface,
DWORD  width,
DWORD  height,
DWORD  bpp,
DWORD  refresh_rate,
DWORD  flags 
)
static

Definition at line 1176 of file ddraw.c.

1178{
1179 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
1180
1181 TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n",
1182 iface, width, height, bpp, refresh_rate, flags);
1183
1185}

◆ ddraw2_WaitForVerticalBlank()

static HRESULT WINAPI ddraw2_WaitForVerticalBlank ( IDirectDraw2 *  iface,
DWORD  flags,
HANDLE  event 
)
static

Definition at line 2200 of file ddraw.c.

2201{
2202 struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
2203
2204 TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
2205
2207}

◆ ddraw4_AddRef()

static ULONG WINAPI ddraw4_AddRef ( IDirectDraw4 *  iface)
static

Definition at line 296 of file ddraw.c.

297{
298 struct ddraw *This = impl_from_IDirectDraw4(iface);
300
301 TRACE("%p increasing refcount to %u.\n", This, ref);
302
303 if (ref == 1) InterlockedIncrement(&This->numIfaces);
304
305 return ref;
306}
static struct ddraw * impl_from_IDirectDraw4(IDirectDraw4 *iface)
Definition: ddraw.c:98

◆ ddraw4_Compact()

static HRESULT WINAPI ddraw4_Compact ( IDirectDraw4 *  iface)
static

Definition at line 1618 of file ddraw.c.

1619{
1620 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
1621
1622 TRACE("iface %p.\n", iface);
1623
1625}

◆ ddraw4_CreateClipper()

static HRESULT WINAPI ddraw4_CreateClipper ( IDirectDraw4 *  iface,
DWORD  flags,
IDirectDrawClipper **  clipper,
IUnknown outer_unknown 
)
static

Definition at line 3464 of file ddraw.c.

3466{
3467 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
3468
3469 TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
3470 iface, flags, clipper, outer_unknown);
3471
3472 return ddraw7_CreateClipper(&ddraw->IDirectDraw7_iface, flags, clipper, outer_unknown);
3473}

◆ ddraw4_CreatePalette()

static HRESULT WINAPI ddraw4_CreatePalette ( IDirectDraw4 *  iface,
DWORD  flags,
PALETTEENTRY entries,
IDirectDrawPalette **  palette,
IUnknown outer_unknown 
)
static

Definition at line 3560 of file ddraw.c.

3562{
3563 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
3564 HRESULT hr;
3565
3566 TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n",
3567 iface, flags, entries, palette, outer_unknown);
3568
3569 hr = ddraw7_CreatePalette(&ddraw->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
3570 if (SUCCEEDED(hr) && *palette)
3571 {
3573 IDirectDraw7_Release(&ddraw->IDirectDraw7_iface);
3574 IDirectDraw4_AddRef(iface);
3575 impl->ifaceToRelease = (IUnknown *)iface;
3576 }
3577 return hr;
3578}

◆ ddraw4_CreateSurface()

static HRESULT WINAPI ddraw4_CreateSurface ( IDirectDraw4 *  iface,
DDSURFACEDESC2 surface_desc,
IDirectDrawSurface4 **  surface,
IUnknown outer_unknown 
)
static

Definition at line 2896 of file ddraw.c.

2898{
2899 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2900 struct ddraw_surface *impl;
2901 HRESULT hr;
2902
2903 TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n",
2904 iface, surface_desc, surface, outer_unknown);
2905
2907
2909 {
2910 WARN("Cooperative level not set.\n");
2913 }
2914
2915 if(surface_desc == NULL || surface_desc->dwSize != sizeof(DDSURFACEDESC2))
2916 {
2917 WARN("Application supplied invalid surface descriptor\n");
2919 return DDERR_INVALIDPARAMS;
2920 }
2921
2922 __TRY
2923 {
2924 *surface = NULL;
2925 }
2927 {
2928 WARN("Surface pointer %p is invalid.\n", surface);
2930 return DDERR_INVALIDPARAMS;
2931 }
2932 __ENDTRY;
2933
2935 {
2936 if (TRACE_ON(ddraw))
2937 {
2938 TRACE(" (%p) Requesting surface desc :\n", iface);
2940 }
2941
2942 WARN("Application tried to create an explicit front or back buffer\n");
2944 return DDERR_INVALIDCAPS;
2945 }
2946
2947 hr = ddraw_surface_create(ddraw, surface_desc, &impl, outer_unknown, 4);
2949 if (FAILED(hr))
2950 return hr;
2951
2952 *surface = &impl->IDirectDrawSurface4_iface;
2953 IDirectDraw4_AddRef(iface);
2954 impl->ifaceToRelease = (IUnknown *)iface;
2955
2956 return hr;
2957}
IDirectDrawSurface4 IDirectDrawSurface4_iface

◆ ddraw4_DuplicateSurface()

static HRESULT WINAPI ddraw4_DuplicateSurface ( IDirectDraw4 *  iface,
IDirectDrawSurface4 *  src,
IDirectDrawSurface4 **  dst 
)
static

Definition at line 3648 of file ddraw.c.

3650{
3652 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
3653 struct ddraw_surface *dst_impl;
3654 IDirectDrawSurface7 *dst7;
3655 HRESULT hr;
3656
3657 TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
3658
3660 src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, &dst7);
3661 if (FAILED(hr))
3662 {
3663 *dst = NULL;
3664 return hr;
3665 }
3666 dst_impl = impl_from_IDirectDrawSurface7(dst7);
3667 *dst = &dst_impl->IDirectDrawSurface4_iface;
3668 IDirectDrawSurface4_AddRef(*dst);
3669 IDirectDrawSurface7_Release(dst7);
3670
3671 return hr;
3672}

◆ ddraw4_EnumDisplayModes()

static HRESULT WINAPI ddraw4_EnumDisplayModes ( IDirectDraw4 *  iface,
DWORD  flags,
DDSURFACEDESC2 surface_desc,
void context,
LPDDENUMMODESCALLBACK2  callback 
)
static

Definition at line 2544 of file ddraw.c.

2546{
2547 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2548
2549 TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
2550 iface, flags, surface_desc, context, callback);
2551
2553}

◆ ddraw4_EnumSurfaces()

static HRESULT WINAPI ddraw4_EnumSurfaces ( IDirectDraw4 *  iface,
DWORD  flags,
DDSURFACEDESC2 surface_desc,
void context,
LPDDENUMSURFACESCALLBACK2  callback 
)
static

Definition at line 3347 of file ddraw.c.

3349{
3350 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
3351 struct surfacescallback2_context cbcontext;
3352
3353 TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
3354 iface, flags, surface_desc, context, callback);
3355
3356 cbcontext.func = callback;
3357 cbcontext.context = context;
3358
3359 return ddraw7_EnumSurfaces(&ddraw->IDirectDraw7_iface, flags, surface_desc,
3360 &cbcontext, EnumSurfacesCallback2Thunk);
3361}
static HRESULT CALLBACK EnumSurfacesCallback2Thunk(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *surface_desc, void *context)
Definition: ddraw.c:3202

◆ ddraw4_FlipToGDISurface()

static HRESULT WINAPI ddraw4_FlipToGDISurface ( IDirectDraw4 *  iface)
static

Definition at line 2127 of file ddraw.c.

2128{
2129 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2130
2131 TRACE("iface %p.\n", iface);
2132
2134}

◆ ddraw4_GetAvailableVidMem()

static HRESULT WINAPI ddraw4_GetAvailableVidMem ( IDirectDraw4 *  iface,
DDSCAPS2 caps,
DWORD total,
DWORD free 
)
static

Definition at line 1996 of file ddraw.c.

1998{
1999 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2000
2001 TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
2002
2004}

◆ ddraw4_GetCaps()

static HRESULT WINAPI ddraw4_GetCaps ( IDirectDraw4 *  iface,
DDCAPS driver_caps,
DDCAPS hel_caps 
)
static

Definition at line 1575 of file ddraw.c.

1576{
1577 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
1578
1579 TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
1580
1581 return ddraw7_GetCaps(&ddraw->IDirectDraw7_iface, driver_caps, hel_caps);
1582}

◆ ddraw4_GetDeviceIdentifier()

static HRESULT WINAPI ddraw4_GetDeviceIdentifier ( IDirectDraw4 *  iface,
DDDEVICEIDENTIFIER identifier,
DWORD  flags 
)
static

Definition at line 2677 of file ddraw.c.

2679{
2680 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2681 DDDEVICEIDENTIFIER2 identifier2;
2682 HRESULT hr;
2683
2684 TRACE("iface %p, identifier %p, flags %#x.\n", iface, identifier, flags);
2685
2687 DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(&identifier2, identifier);
2688
2689 return hr;
2690}
void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut) DECLSPEC_HIDDEN
Definition: utils.c:961
static HRESULT WINAPI ddraw7_GetDeviceIdentifier(IDirectDraw7 *iface, DDDEVICEIDENTIFIER2 *DDDI, DWORD Flags)
Definition: ddraw.c:2631

◆ ddraw4_GetDisplayMode()

static HRESULT WINAPI ddraw4_GetDisplayMode ( IDirectDraw4 *  iface,
DDSURFACEDESC2 surface_desc 
)
static

Definition at line 1702 of file ddraw.c.

1703{
1704 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
1705
1706 TRACE("iface %p, surface_desc %p.\n", iface, surface_desc);
1707
1708 return ddraw7_GetDisplayMode(&ddraw->IDirectDraw7_iface, surface_desc);
1709}

◆ ddraw4_GetFourCCCodes()

static HRESULT WINAPI ddraw4_GetFourCCCodes ( IDirectDraw4 *  iface,
DWORD codes_count,
DWORD codes 
)
static

Definition at line 1793 of file ddraw.c.

1794{
1795 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
1796
1797 TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes);
1798
1799 return ddraw7_GetFourCCCodes(&ddraw->IDirectDraw7_iface, codes_count, codes);
1800}

◆ ddraw4_GetGDISurface()

static HRESULT WINAPI ddraw4_GetGDISurface ( IDirectDraw4 *  iface,
IDirectDrawSurface4 **  surface 
)
static

Definition at line 2323 of file ddraw.c.

2324{
2325 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2326 struct ddraw_surface *surface_impl;
2327 IDirectDrawSurface7 *surface7;
2328 HRESULT hr;
2329
2330 TRACE("iface %p, surface %p.\n", iface, surface);
2331
2333 if (FAILED(hr))
2334 {
2335 *surface = NULL;
2336 return hr;
2337 }
2338 surface_impl = impl_from_IDirectDrawSurface7(surface7);
2339 *surface = &surface_impl->IDirectDrawSurface4_iface;
2340 IDirectDrawSurface4_AddRef(*surface);
2341 IDirectDrawSurface7_Release(surface7);
2342
2343 return hr;
2344}

◆ ddraw4_GetMonitorFrequency()

static HRESULT WINAPI ddraw4_GetMonitorFrequency ( IDirectDraw4 *  iface,
DWORD frequency 
)
static

Definition at line 1842 of file ddraw.c.

1843{
1844 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
1845
1846 TRACE("iface %p, frequency %p.\n", iface, frequency);
1847
1849}

◆ ddraw4_GetScanLine()

static HRESULT WINAPI ddraw4_GetScanLine ( IDirectDraw4 *  iface,
DWORD line 
)
static

Definition at line 2243 of file ddraw.c.

2244{
2245 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2246
2247 TRACE("iface %p, line %p.\n", iface, line);
2248
2250}

◆ ddraw4_GetSurfaceFromDC()

static HRESULT WINAPI ddraw4_GetSurfaceFromDC ( IDirectDraw4 *  iface,
HDC  dc,
IDirectDrawSurface4 **  surface 
)
static

Definition at line 2740 of file ddraw.c.

2742{
2743 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2744 struct ddraw_surface *surface_impl;
2745 IDirectDrawSurface7 *surface7;
2746 HRESULT hr;
2747
2748 TRACE("iface %p, dc %p, surface %p.\n", iface, dc, surface);
2749
2750 if (!surface) return E_INVALIDARG;
2751
2753 if (FAILED(hr))
2754 {
2755 *surface = NULL;
2756 return hr;
2757 }
2758 surface_impl = impl_from_IDirectDrawSurface7(surface7);
2759 /* Tests say this is true */
2760 *surface = (IDirectDrawSurface4 *)&surface_impl->IDirectDrawSurface_iface;
2761 IDirectDrawSurface_AddRef(&surface_impl->IDirectDrawSurface_iface);
2762 IDirectDrawSurface7_Release(surface7);
2763
2764 return hr;
2765}
#define E_INVALIDARG
Definition: ddrawi.h:101
static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC dc, IDirectDrawSurface7 **surface)
Definition: ddraw.c:2706
static const WCHAR dc[]

◆ ddraw4_GetVerticalBlankStatus()

static HRESULT WINAPI ddraw4_GetVerticalBlankStatus ( IDirectDraw4 *  iface,
BOOL status 
)
static

Definition at line 1894 of file ddraw.c.

1895{
1896 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
1897
1898 TRACE("iface %p, status %p.\n", iface, status);
1899
1901}

◆ ddraw4_Initialize()

static HRESULT WINAPI ddraw4_Initialize ( IDirectDraw4 *  iface,
GUID guid 
)
static

Definition at line 2050 of file ddraw.c.

2051{
2052 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2053
2054 TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
2055
2057}

◆ ddraw4_QueryInterface()

static HRESULT WINAPI ddraw4_QueryInterface ( IDirectDraw4 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 203 of file ddraw.c.

204{
205 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
206
207 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
208
210}

◆ ddraw4_Release()

static ULONG WINAPI ddraw4_Release ( IDirectDraw4 *  iface)
static

Definition at line 472 of file ddraw.c.

473{
474 struct ddraw *This = impl_from_IDirectDraw4(iface);
476
477 TRACE("%p decreasing refcount to %u.\n", This, ref);
478
479 if (!ref && !InterlockedDecrement(&This->numIfaces))
481
482 return ref;
483}

◆ ddraw4_RestoreAllSurfaces()

static HRESULT WINAPI ddraw4_RestoreAllSurfaces ( IDirectDraw4 *  iface)
static

Definition at line 2783 of file ddraw.c.

2784{
2785 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2786
2787 TRACE("iface %p.\n", iface);
2788
2790}
static HRESULT WINAPI ddraw7_RestoreAllSurfaces(IDirectDraw7 *iface)
Definition: ddraw.c:2775

◆ ddraw4_RestoreDisplayMode()

static HRESULT WINAPI ddraw4_RestoreDisplayMode ( IDirectDraw4 *  iface)
static

Definition at line 709 of file ddraw.c.

710{
711 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
712
713 TRACE("iface %p.\n", iface);
714
716}

◆ ddraw4_SetCooperativeLevel()

static HRESULT WINAPI ddraw4_SetCooperativeLevel ( IDirectDraw4 *  iface,
HWND  window,
DWORD  flags 
)
static

Definition at line 1031 of file ddraw.c.

1032{
1033 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
1034
1035 TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
1036
1038}

◆ ddraw4_SetDisplayMode()

static HRESULT WINAPI ddraw4_SetDisplayMode ( IDirectDraw4 *  iface,
DWORD  width,
DWORD  height,
DWORD  bpp,
DWORD  refresh_rate,
DWORD  flags 
)
static

Definition at line 1165 of file ddraw.c.

1167{
1168 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
1169
1170 TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n",
1171 iface, width, height, bpp, refresh_rate, flags);
1172
1174}

◆ ddraw4_TestCooperativeLevel()

static HRESULT WINAPI ddraw4_TestCooperativeLevel ( IDirectDraw4 *  iface)
static

Definition at line 2279 of file ddraw.c.

2280{
2281 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2282
2283 TRACE("iface %p.\n", iface);
2284
2286}
static HRESULT WINAPI ddraw7_TestCooperativeLevel(IDirectDraw7 *iface)
Definition: ddraw.c:2270

◆ ddraw4_WaitForVerticalBlank()

static HRESULT WINAPI ddraw4_WaitForVerticalBlank ( IDirectDraw4 *  iface,
DWORD  flags,
HANDLE  event 
)
static

Definition at line 2191 of file ddraw.c.

2192{
2193 struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
2194
2195 TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
2196
2198}

◆ ddraw7_AddRef()

static ULONG WINAPI ddraw7_AddRef ( IDirectDraw7 iface)
static

Definition at line 284 of file ddraw.c.

285{
286 struct ddraw *This = impl_from_IDirectDraw7(iface);
288
289 TRACE("%p increasing refcount to %u.\n", This, ref);
290
291 if(ref == 1) InterlockedIncrement(&This->numIfaces);
292
293 return ref;
294}
static struct ddraw * impl_from_IDirectDraw7(IDirectDraw7 *iface)
Definition: ddraw.c:103

Referenced by d3d7_AddRef().

◆ ddraw7_Compact()

static HRESULT WINAPI ddraw7_Compact ( IDirectDraw7 iface)
static

Definition at line 1611 of file ddraw.c.

1612{
1613 TRACE("iface %p.\n", iface);
1614
1615 return DD_OK;
1616}
#define DD_OK
Definition: ddraw.h:186

Referenced by ddraw1_Compact(), ddraw2_Compact(), and ddraw4_Compact().

◆ ddraw7_CreateClipper()

static HRESULT WINAPI ddraw7_CreateClipper ( IDirectDraw7 iface,
DWORD  Flags,
IDirectDrawClipper **  Clipper,
IUnknown UnkOuter 
)
static

Definition at line 3455 of file ddraw.c.

3457{
3458 TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
3459 iface, Flags, Clipper, UnkOuter);
3460
3461 return DirectDrawCreateClipper(Flags, Clipper, UnkOuter);
3462}
HRESULT WINAPI DirectDrawCreateClipper(DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown)
Definition: ddraw.c:3414
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by ddraw1_CreateClipper(), ddraw2_CreateClipper(), and ddraw4_CreateClipper().

◆ ddraw7_CreatePalette()

static HRESULT WINAPI ddraw7_CreatePalette ( IDirectDraw7 iface,
DWORD  Flags,
PALETTEENTRY ColorTable,
IDirectDrawPalette **  Palette,
IUnknown pUnkOuter 
)
static

Definition at line 3514 of file ddraw.c.

3516{
3517 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
3518 struct ddraw_palette *object;
3519 HRESULT hr;
3520
3521 TRACE("iface %p, flags %#x, color_table %p, palette %p, outer_unknown %p.\n",
3522 iface, Flags, ColorTable, Palette, pUnkOuter);
3523
3524 if (pUnkOuter)
3525 return CLASS_E_NOAGGREGATION;
3526
3528
3529 /* The refcount test shows that a cooplevel is required for this */
3531 {
3532 WARN("No cooperative level set, returning DDERR_NOCOOPERATIVELEVELSET\n");
3535 }
3536
3537 if (!(object = heap_alloc(sizeof(*object))))
3538 {
3539 ERR("Out of memory when allocating memory for a palette implementation\n");
3541 return E_OUTOFMEMORY;
3542 }
3543
3544 hr = ddraw_palette_init(object, ddraw, Flags, ColorTable);
3545 if (FAILED(hr))
3546 {
3547 WARN("Failed to initialize palette, hr %#x.\n", hr);
3548 heap_free(object);
3550 return hr;
3551 }
3552
3553 TRACE("Created palette %p.\n", object);
3554 *Palette = &object->IDirectDrawPalette_iface;
3556
3557 return DD_OK;
3558}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
HRESULT ddraw_palette_init(struct ddraw_palette *palette, struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries) DECLSPEC_HIDDEN
Definition: palette.c:258
#define E_OUTOFMEMORY
Definition: ddrawi.h:100

Referenced by ddraw1_CreatePalette(), ddraw2_CreatePalette(), and ddraw4_CreatePalette().

◆ ddraw7_CreateSurface()

static HRESULT WINAPI ddraw7_CreateSurface ( IDirectDraw7 iface,
DDSURFACEDESC2 surface_desc,
IDirectDrawSurface7 **  surface,
IUnknown outer_unknown 
)
static

Definition at line 2833 of file ddraw.c.

2835{
2836 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
2837 struct ddraw_surface *impl;
2838 HRESULT hr;
2839
2840 TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n",
2841 iface, surface_desc, surface, outer_unknown);
2842
2844
2846 {
2847 WARN("Cooperative level not set.\n");
2850 }
2851
2852 if(surface_desc == NULL || surface_desc->dwSize != sizeof(DDSURFACEDESC2))
2853 {
2854 WARN("Application supplied invalid surface descriptor\n");
2856 return DDERR_INVALIDPARAMS;
2857 }
2858
2859 __TRY
2860 {
2861 *surface = NULL;
2862 }
2864 {
2865 WARN("Surface pointer %p is invalid.\n", surface);
2867 return DDERR_INVALIDPARAMS;
2868 }
2869 __ENDTRY;
2870
2872 {
2873 if (TRACE_ON(ddraw))
2874 {
2875 TRACE(" (%p) Requesting surface desc :\n", iface);
2877 }
2878
2879 WARN("Application tried to create an explicit front or back buffer\n");
2881 return DDERR_INVALIDCAPS;
2882 }
2883
2884 hr = ddraw_surface_create(ddraw, surface_desc, &impl, outer_unknown, 7);
2886 if (FAILED(hr))
2887 return hr;
2888
2889 *surface = &impl->IDirectDrawSurface7_iface;
2890 IDirectDraw7_AddRef(iface);
2891 impl->ifaceToRelease = (IUnknown *)iface;
2892
2893 return hr;
2894}

◆ ddraw7_DuplicateSurface()

static HRESULT WINAPI ddraw7_DuplicateSurface ( IDirectDraw7 iface,
IDirectDrawSurface7 Src,
IDirectDrawSurface7 **  Dest 
)
static

Definition at line 3637 of file ddraw.c.

3639{
3640 struct ddraw_surface *src_surface = unsafe_impl_from_IDirectDrawSurface7(Src);
3641
3642 FIXME("iface %p, src %p, dst %p partial stub!\n", iface, Src, Dest);
3643
3644 /* For now, simply create a new, independent surface */
3645 return IDirectDraw7_CreateSurface(iface, &src_surface->surface_desc, Dest, NULL);
3646}

Referenced by ddraw1_DuplicateSurface(), ddraw2_DuplicateSurface(), and ddraw4_DuplicateSurface().

◆ ddraw7_EnumDisplayModes()

static HRESULT WINAPI ddraw7_EnumDisplayModes ( IDirectDraw7 iface,
DWORD  Flags,
DDSURFACEDESC2 DDSD,
void Context,
LPDDENUMMODESCALLBACK2  cb 
)
static

Definition at line 2425 of file ddraw.c.

2427{
2428 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
2429 struct wined3d_display_mode *enum_modes = NULL;
2431 unsigned int modenum, fmt;
2432 DDSURFACEDESC2 callback_sd;
2433 unsigned enum_mode_count = 0, enum_mode_array_size = 16;
2435
2436 static const enum wined3d_format_id checkFormatList[] =
2437 {
2441 };
2442
2443 TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
2444 iface, Flags, DDSD, Context, cb);
2445
2446 if (!cb)
2447 return DDERR_INVALIDPARAMS;
2448
2449 if (!(enum_modes = heap_alloc(enum_mode_array_size * sizeof(*enum_modes))))
2450 return DDERR_OUTOFMEMORY;
2451
2453
2454 pixelformat.dwSize = sizeof(pixelformat);
2455 for(fmt = 0; fmt < ARRAY_SIZE(checkFormatList); fmt++)
2456 {
2457 modenum = 0;
2460 {
2461 BOOL found = FALSE;
2462 unsigned i;
2463
2465 if (DDSD)
2466 {
2467 if (DDSD->dwFlags & DDSD_WIDTH && mode.width != DDSD->dwWidth)
2468 continue;
2469 if (DDSD->dwFlags & DDSD_HEIGHT && mode.height != DDSD->dwHeight)
2470 continue;
2471 if (DDSD->dwFlags & DDSD_REFRESHRATE && mode.refresh_rate != DDSD->u2.dwRefreshRate)
2472 continue;
2473 if (DDSD->dwFlags & DDSD_PIXELFORMAT
2474 && pixelformat.u1.dwRGBBitCount != DDSD->u4.ddpfPixelFormat.u1.dwRGBBitCount)
2475 continue;
2476 }
2477
2478 /* DX docs state EnumDisplayMode should return only unique modes */
2479 for (i = 0; i < enum_mode_count; i++)
2480 {
2481 if (enum_modes[i].width == mode.width && enum_modes[i].height == mode.height
2482 && enum_modes[i].format_id == mode.format_id
2483 && (enum_modes[i].refresh_rate == mode.refresh_rate || !(Flags & DDEDM_REFRESHRATES)))
2484 {
2485 found = TRUE;
2486 break;
2487 }
2488 }
2489 if(found) continue;
2490
2491 memset(&callback_sd, 0, sizeof(callback_sd));
2492 callback_sd.dwSize = sizeof(callback_sd);
2493 callback_sd.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
2494
2497 callback_sd.u2.dwRefreshRate = mode.refresh_rate;
2498
2499 callback_sd.dwWidth = mode.width;
2500 callback_sd.dwHeight = mode.height;
2501
2502 callback_sd.u4.ddpfPixelFormat=pixelformat;
2503
2504 /* Calc pitch and DWORD align like MSDN says */
2505 callback_sd.u1.lPitch = (callback_sd.u4.ddpfPixelFormat.u1.dwRGBBitCount / 8) * mode.width;
2506 callback_sd.u1.lPitch = (callback_sd.u1.lPitch + 3) & ~3;
2507
2508 TRACE("Enumerating %dx%dx%d @%d\n", callback_sd.dwWidth, callback_sd.dwHeight, callback_sd.u4.ddpfPixelFormat.u1.dwRGBBitCount,
2509 callback_sd.u2.dwRefreshRate);
2510
2511 if(cb(&callback_sd, Context) == DDENUMRET_CANCEL)
2512 {
2513 TRACE("Application asked to terminate the enumeration\n");
2514 heap_free(enum_modes);
2516 return DD_OK;
2517 }
2518
2519 if (enum_mode_count == enum_mode_array_size)
2520 {
2521 struct wined3d_display_mode *new_enum_modes;
2522
2523 enum_mode_array_size *= 2;
2524 if (!(new_enum_modes = heap_realloc(enum_modes, enum_mode_array_size * sizeof(*new_enum_modes))))
2525 {
2526 heap_free(enum_modes);
2528 return DDERR_OUTOFMEMORY;
2529 }
2530
2531 enum_modes = new_enum_modes;
2532 }
2533 enum_modes[enum_mode_count++] = mode;
2534 }
2535 }
2536
2537 TRACE("End of enumeration\n");
2538 heap_free(enum_modes);
2540
2541 return DD_OK;
2542}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define TRUE
Definition: types.h:120
pixelformat
Definition: converter.c:40
unsigned int BOOL
Definition: ntddk_ex.h:94
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
#define DDSD_WIDTH
Definition: ddraw.h:210
#define DDSD_PIXELFORMAT
Definition: ddraw.h:216
#define DDSD_PITCH
Definition: ddraw.h:211
#define DDEDM_REFRESHRATES
Definition: ddraw.h:529
#define DDSD_REFRESHRATE
Definition: ddraw.h:222
#define DDSD_HEIGHT
Definition: ddraw.h:209
struct _DDPIXELFORMAT DDPIXELFORMAT
#define DDENUMRET_CANCEL
Definition: ddraw.h:188
DWORD dwRGBBitCount
Definition: ddraw.h:1075
DWORD dwWidth
Definition: ddraw.h:1155
DWORD dwHeight
Definition: ddraw.h:1154
DWORD dwRefreshRate
Definition: ddraw.h:1169
DDPIXELFORMAT ddpfPixelFormat
Definition: ddraw.h:1185
DWORD dwFlags
Definition: ddraw.h:1153
Definition: dsound.c:943
HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering, UINT mode_idx, struct wined3d_display_mode *mode)
Definition: directx.c:4589
#define WINED3D_OK
Definition: wined3d.h:37
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:224
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:221
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:117
@ WINED3D_SCANLINE_ORDERING_UNKNOWN
Definition: wined3d.h:832

Referenced by ddraw1_EnumDisplayModes(), ddraw2_EnumDisplayModes(), and ddraw4_EnumDisplayModes().

◆ ddraw7_EnumSurfaces()

static HRESULT WINAPI ddraw7_EnumSurfaces ( IDirectDraw7 iface,
DWORD  Flags,
DDSURFACEDESC2 DDSD,
void Context,
LPDDENUMSURFACESCALLBACK7  Callback 
)
static

Definition at line 3247 of file ddraw.c.

3249{
3250 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
3251 struct ddraw_surface *surf;
3253
3254 TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
3255 iface, Flags, DDSD, Context, Callback);
3256
3257 if (!Callback)
3258 return DDERR_INVALIDPARAMS;
3259
3261 {
3262 IDirectDrawSurface7 *surface;
3263 DDSURFACEDESC2 testdesc;
3264 HRESULT hr;
3265
3266 if (match_flags != DDENUMSURFACES_MATCH)
3267 return DDERR_INVALIDPARAMS;
3268
3269 if (!DDSD)
3270 return DDERR_INVALIDPARAMS;
3271
3272 memcpy(&testdesc, DDSD, sizeof(testdesc));
3273 if (!(testdesc.dwFlags & DDSD_WIDTH))
3274 {
3275 testdesc.dwFlags |= DDSD_WIDTH;
3276 testdesc.dwWidth = 512;
3277 }
3278 if (!(testdesc.dwFlags & DDSD_HEIGHT))
3279 {
3280 testdesc.dwFlags |= DDSD_HEIGHT;
3281 testdesc.dwHeight = 512;
3282 }
3283
3284 hr = IDirectDraw7_CreateSurface(iface, &testdesc, &surface, NULL);
3285 if (SUCCEEDED(hr))
3286 {
3289 IDirectDrawSurface7_Release(surface);
3290 }
3291 else
3292 ERR("Failed to create surface, hr %#x.\n", hr);
3293 }
3295 {
3296 BOOL all, nomatch;
3298 struct list *entry, *entry2;
3299
3300 /* a combination of match flags is not allowed */
3301 if (match_flags != 0 &&
3302 match_flags != DDENUMSURFACES_ALL &&
3303 match_flags != DDENUMSURFACES_MATCH &&
3304 match_flags != DDENUMSURFACES_NOMATCH)
3305 return DDERR_INVALIDPARAMS;
3306
3307 all = (Flags & DDENUMSURFACES_ALL) != 0;
3308 nomatch = (Flags & DDENUMSURFACES_NOMATCH) != 0;
3309
3310 if (!all && !DDSD)
3311 return DDERR_INVALIDPARAMS;
3312
3314
3315 /* Use the _SAFE enumeration, the app may destroy enumerated surfaces */
3317 {
3318 surf = LIST_ENTRY(entry, struct ddraw_surface, surface_list_entry);
3319
3320 if (!surf->iface_count)
3321 {
3322 WARN("Not enumerating surface %p because it doesn't have any references.\n", surf);
3323 continue;
3324 }
3325
3326 if (all || (nomatch != ddraw_match_surface_desc(DDSD, &surf->surface_desc)))
3327 {
3328 TRACE("Enumerating surface %p.\n", surf);
3329 desc = surf->surface_desc;
3330 IDirectDrawSurface7_AddRef(&surf->IDirectDrawSurface7_iface);
3332 {
3334 return DD_OK;
3335 }
3336 }
3337 }
3338
3340 }
3341 else
3342 return DDERR_INVALIDPARAMS;
3343
3344 return DD_OK;
3345}
Definition: list.h:37
static BOOL ddraw_match_surface_desc(const DDSURFACEDESC2 *requested, const DDSURFACEDESC2 *provided)
Definition: ddraw.c:3130
uint32_t entry
Definition: isohybrid.c:63
#define DDENUMSURFACES_CANBECREATED
Definition: ddraw.h:524
#define DDENUMSURFACES_ALL
Definition: ddraw.h:521
#define DDENUMSURFACES_NOMATCH
Definition: ddraw.h:523
#define DDENUMSURFACES_MATCH
Definition: ddraw.h:522
#define DDENUMSURFACES_DOESEXIST
Definition: ddraw.h:525
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
struct list surface_list
#define LIST_ENTRY(type)
Definition: queue.h:175
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458

Referenced by ddraw1_EnumSurfaces(), ddraw2_EnumSurfaces(), and ddraw4_EnumSurfaces().

◆ ddraw7_EvaluateMode()

static HRESULT WINAPI ddraw7_EvaluateMode ( IDirectDraw7 iface,
DWORD  Flags,
DWORD Timeout 
)
static

Definition at line 2607 of file ddraw.c.

2608{
2609 FIXME("iface %p, flags %#x, timeout %p stub!\n", iface, Flags, Timeout);
2610
2611 /* When implementing this, implement it in WineD3D */
2612
2613 return DD_OK;
2614}
static ULONG Timeout
Definition: ping.c:61

◆ ddraw7_FlipToGDISurface()

static HRESULT WINAPI ddraw7_FlipToGDISurface ( IDirectDraw7 iface)
static

Definition at line 2097 of file ddraw.c.

2098{
2099 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
2100 IDirectDrawSurface7 *gdi_surface;
2101 struct ddraw_surface *gdi_impl;
2102 HRESULT hr;
2103
2104 TRACE("iface %p.\n", iface);
2105
2107
2108 if (FAILED(hr = IDirectDraw7_GetGDISurface(iface, &gdi_surface)))
2109 {
2110 WARN("Failed to retrieve GDI surface, hr %#x.\n", hr);
2112 return hr;
2113 }
2114
2115 gdi_impl = impl_from_IDirectDrawSurface7(gdi_surface);
2117 hr = DD_OK;
2118 else
2119 hr = IDirectDrawSurface7_Flip(&ddraw->primary->IDirectDrawSurface7_iface, gdi_surface, DDFLIP_WAIT);
2120 IDirectDrawSurface7_Release(gdi_surface);
2121
2123
2124 return hr;
2125}
#define DDFLIP_WAIT
Definition: ddraw.h:583
struct ddraw_surface * primary
Definition: ddraw_private.h:97

Referenced by ddraw1_FlipToGDISurface(), ddraw2_FlipToGDISurface(), and ddraw4_FlipToGDISurface().

◆ ddraw7_GetAvailableVidMem()

static HRESULT WINAPI ddraw7_GetAvailableVidMem ( IDirectDraw7 iface,
DDSCAPS2 caps,
DWORD total,
DWORD free 
)
static

Definition at line 1936 of file ddraw.c.

1938{
1939 unsigned int framebuffer_size, total_vidmem, free_vidmem;
1940 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
1942 HRESULT hr = DD_OK;
1943
1944 TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
1945
1946 if (!total && !free)
1947 return DDERR_INVALIDPARAMS;
1948
1949 if (TRACE_ON(ddraw))
1950 {
1951 TRACE("Asked for memory with description: ");
1952 DDRAW_dump_DDSCAPS2(caps);
1953 }
1955
1956 /* Todo: System memory vs local video memory vs non-local video memory
1957 * The MSDN also mentions differences between texture memory and other
1958 * resources, but that's not important
1959 */
1960
1961 /* Some applications (e.g. 3DMark 2000) assume that the reported amount of
1962 * video memory doesn't include the memory used by the default framebuffer.
1963 */
1965 {
1966 WARN("Failed to get display mode, hr %#x.\n", hr);
1968 return hr;
1969 }
1971 mode.format_id, mode.width);
1972 framebuffer_size *= mode.height;
1973
1974 if (free)
1975 {
1977 *free = framebuffer_size > free_vidmem ? 0 : free_vidmem - framebuffer_size;
1978 TRACE("Free video memory %#x.\n", *free);
1979 }
1980
1981 if (total)
1982 {
1983 struct wined3d_adapter_identifier desc = {0};
1984
1986 total_vidmem = min(UINT_MAX, desc.video_memory);
1987 *total = framebuffer_size > total_vidmem ? 0 : total_vidmem - framebuffer_size;
1988 TRACE("Total video memory %#x.\n", *total);
1989 }
1990
1992
1993 return hr;
1994}
void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in) DECLSPEC_HIDDEN
Definition: utils.c:713
UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device)
Definition: device.c:1298
#define UINT_MAX
Definition: limits.h:41
#define min(a, b)
Definition: monoChain.cc:55
UINT CDECL wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, UINT width)
Definition: directx.c:5517
HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx, DWORD flags, struct wined3d_adapter_identifier *identifier)
Definition: directx.c:4939

Referenced by ddraw2_GetAvailableVidMem(), and ddraw4_GetAvailableVidMem().

◆ ddraw7_GetCaps()

static HRESULT WINAPI ddraw7_GetCaps ( IDirectDraw7 iface,
DDCAPS DriverCaps,
DDCAPS HELCaps 
)
static

Definition at line 1483 of file ddraw.c.

1484{
1485 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
1486 DDCAPS caps;
1487 WINED3DCAPS winecaps;
1488 HRESULT hr;
1489 DDSCAPS2 ddscaps = {0, 0, 0, {0}};
1490
1491 TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, DriverCaps, HELCaps);
1492
1493 /* One structure must be != NULL */
1494 if (!DriverCaps && !HELCaps)
1495 {
1496 WARN("Invalid parameters.\n");
1497 return DDERR_INVALIDPARAMS;
1498 }
1499
1500 memset(&caps, 0, sizeof(caps));
1501 memset(&winecaps, 0, sizeof(winecaps));
1502 caps.dwSize = sizeof(caps);
1503
1506 if (FAILED(hr))
1507 {
1508 WARN("Failed to get device caps, %#x.\n", hr);
1510 return hr;
1511 }
1512
1513 hr = IDirectDraw7_GetAvailableVidMem(iface, &ddscaps, &caps.dwVidMemTotal, &caps.dwVidMemFree);
1514 if (FAILED(hr))
1515 {
1516 WARN("IDirectDraw7::GetAvailableVidMem failed\n");
1518 return hr;
1519 }
1520
1521 hr = IDirectDraw7_GetFourCCCodes(iface, &caps.dwNumFourCCCodes, NULL);
1523 if (FAILED(hr))
1524 {
1525 WARN("IDirectDraw7::GetFourCCCodes failed\n");
1526 return hr;
1527 }
1528
1529 caps.dwCaps = winecaps.ddraw_caps.caps;
1530 caps.dwCaps2 = winecaps.ddraw_caps.caps2;
1531 caps.dwCKeyCaps = winecaps.ddraw_caps.color_key_caps;
1532 caps.dwFXCaps = winecaps.ddraw_caps.fx_caps;
1533 caps.dwPalCaps = DDPCAPS_8BIT | DDPCAPS_PRIMARYSURFACE;
1534 caps.ddsCaps.dwCaps = winecaps.ddraw_caps.dds_caps;
1535 caps.dwSVBCaps = winecaps.ddraw_caps.svb_caps;
1536 caps.dwSVBCKeyCaps = winecaps.ddraw_caps.svb_color_key_caps;
1537 caps.dwSVBFXCaps = winecaps.ddraw_caps.svb_fx_caps;
1538 caps.dwVSBCaps = winecaps.ddraw_caps.vsb_caps;
1539 caps.dwVSBCKeyCaps = winecaps.ddraw_caps.vsb_color_key_caps;
1540 caps.dwVSBFXCaps = winecaps.ddraw_caps.vsb_fx_caps;
1541 caps.dwSSBCaps = winecaps.ddraw_caps.ssb_caps;
1542 caps.dwSSBCKeyCaps = winecaps.ddraw_caps.ssb_color_key_caps;
1543 caps.dwSSBFXCaps = winecaps.ddraw_caps.ssb_fx_caps;
1544
1545 caps.dwCaps |= DDCAPS_ALIGNSTRIDE;
1546 caps.dwAlignStrideAlign = DDRAW_STRIDE_ALIGNMENT;
1547
1548 caps.ddsOldCaps.dwCaps = caps.ddsCaps.dwCaps;
1549
1550 IDirect3D7_EnumZBufferFormats(&ddraw->IDirect3D7_iface, &IID_IDirect3DHALDevice, enum_zbuffer, &caps);
1551
1552 if(DriverCaps)
1553 {
1554 DD_STRUCT_COPY_BYSIZE(DriverCaps, &caps);
1555 if (TRACE_ON(ddraw))
1556 {
1557 TRACE("Driver Caps :\n");
1558 DDRAW_dump_DDCAPS(DriverCaps);
1559 }
1560
1561 }
1562 if(HELCaps)
1563 {
1564 DD_STRUCT_COPY_BYSIZE(HELCaps, &caps);
1565 if (TRACE_ON(ddraw))
1566 {
1567 TRACE("HEL Caps :\n");
1568 DDRAW_dump_DDCAPS(HELCaps);
1569 }
1570 }
1571
1572 return DD_OK;
1573}
#define IDirect3D7_EnumZBufferFormats(p, a, b, c)
Definition: d3d.h:386
void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps) DECLSPEC_HIDDEN
Definition: utils.c:990
#define DDRAW_STRIDE_ALIGNMENT
Definition: ddraw_private.h:62
#define DD_STRUCT_COPY_BYSIZE(to, from)
HRESULT CALLBACK enum_zbuffer(DDPIXELFORMAT *format, void *ctx)
Definition: ddraw.c:1446
HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps)
Definition: device.c:3526
#define DDPCAPS_PRIMARYSURFACE
Definition: ddraw.h:456
#define DDCAPS_ALIGNSTRIDE
Definition: ddraw.h:334
#define DDPCAPS_8BIT
Definition: ddraw.h:455
struct wined3d_ddraw_caps ddraw_caps
Definition: wined3d.h:1973

Referenced by ddraw1_GetCaps(), ddraw2_GetCaps(), and ddraw4_GetCaps().

◆ ddraw7_GetDeviceIdentifier()

static HRESULT WINAPI ddraw7_GetDeviceIdentifier ( IDirectDraw7 iface,
DDDEVICEIDENTIFIER2 DDDI,
DWORD  Flags 
)
static

Definition at line 2631 of file ddraw.c.

2633{
2634 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
2635 struct wined3d_adapter_identifier adapter_id;
2636 HRESULT hr = S_OK;
2637
2638 TRACE("iface %p, device_identifier %p, flags %#x.\n", iface, DDDI, Flags);
2639
2640 if (!DDDI)
2641 return DDERR_INVALIDPARAMS;
2642
2644 {
2645 /* The DDGDI_GETHOSTIDENTIFIER returns the information about the 2D
2646 * host adapter, if there's a secondary 3D adapter. This doesn't apply
2647 * to any modern hardware, nor is it interesting for Wine, so ignore it.
2648 * Size of DDDEVICEIDENTIFIER2 may be aligned to 8 bytes and thus 4
2649 * bytes too long. So only copy the relevant part of the structure
2650 */
2651
2653 return DD_OK;
2654 }
2655
2656 /* Drakan: Order of the Flame expects accurate D3D device information from ddraw */
2657 adapter_id.driver = DDDI->szDriver;
2658 adapter_id.driver_size = sizeof(DDDI->szDriver);
2659 adapter_id.description = DDDI->szDescription;
2660 adapter_id.description_size = sizeof(DDDI->szDescription);
2661 adapter_id.device_name_size = 0;
2665 if (FAILED(hr)) return hr;
2666
2667 DDDI->liDriverVersion = adapter_id.driver_version;
2668 DDDI->dwVendorId = adapter_id.vendor_id;
2669 DDDI->dwDeviceId = adapter_id.device_id;
2670 DDDI->dwSubSysId = adapter_id.subsystem_id;
2671 DDDI->dwRevision = adapter_id.revision;
2672 DDDI->guidDeviceIdentifier = adapter_id.device_identifier;
2673 DDDI->dwWHQLLevel = adapter_id.whql_level;
2674 return DD_OK;
2675}
static const DDDEVICEIDENTIFIER2 deviceidentifier
Definition: ddraw.c:37
static const WCHAR dwWHQLLevel[]
Definition: provider.c:101
#define S_OK
Definition: intsafe.h:52
#define DDGDI_GETHOSTIDENTIFIER
Definition: ddraw.h:202
char szDescription[MAX_DDDEVICEID_STRING]
Definition: ddraw.h:1346
char szDriver[MAX_DDDEVICEID_STRING]
Definition: ddraw.h:1345
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by ddraw4_GetDeviceIdentifier().

◆ ddraw7_GetDisplayMode()

static HRESULT WINAPI ddraw7_GetDisplayMode ( IDirectDraw7 iface,
DDSURFACEDESC2 DDSD 
)
static

Definition at line 1659 of file ddraw.c.

1660{
1661 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
1663 HRESULT hr;
1664
1665 TRACE("iface %p, surface_desc %p.\n", iface, DDSD);
1666
1667 /* This seems sane */
1668 if (!DDSD || (DDSD->dwSize != sizeof(DDSURFACEDESC) && DDSD->dwSize != sizeof(DDSURFACEDESC2)))
1669 return DDERR_INVALIDPARAMS;
1670
1672
1674 {
1675 ERR("Failed to get display mode, hr %#x.\n", hr);
1677 return hr;
1678 }
1679
1680 memset(DDSD, 0, DDSD->dwSize);
1681 DDSD->dwSize = sizeof(*DDSD);
1683 DDSD->dwWidth = mode.width;
1684 DDSD->dwHeight = mode.height;
1685 DDSD->u2.dwRefreshRate = 60;
1686 DDSD->ddsCaps.dwCaps = 0;
1687 DDSD->u4.ddpfPixelFormat.dwSize = sizeof(DDSD->u4.ddpfPixelFormat);
1689 DDSD->u1.lPitch = mode.width * DDSD->u4.ddpfPixelFormat.u1.dwRGBBitCount / 8;
1690
1691 if(TRACE_ON(ddraw))
1692 {
1693 TRACE("Returning surface desc :\n");
1695 }
1696
1698
1699 return DD_OK;
1700}

Referenced by ddraw1_GetDisplayMode(), ddraw2_GetDisplayMode(), and ddraw4_GetDisplayMode().

◆ ddraw7_GetFourCCCodes()

static HRESULT WINAPI ddraw7_GetFourCCCodes ( IDirectDraw7 iface,
DWORD NumCodes,
DWORD Codes 
)
static

Definition at line 1752 of file ddraw.c.

1753{
1754 struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
1755 static const enum wined3d_format_id formats[] =
1756 {
1760 };
1762 DWORD count = 0, i, outsize;
1763 HRESULT hr;
1764
1765 TRACE("iface %p, codes_count %p, codes %p.\n", iface, NumCodes, Codes);
1766
1768 {
1769 ERR("Failed to get display mode, hr %#x.\n", hr);
1770 return hr;
1771 }
1772
1773 outsize = NumCodes && Codes ? *NumCodes : 0;
1774
1775 for (i = 0; i < ARRAY_SIZE(formats); ++i)
1776 {
1778 mode.format_id, 0, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
1779 {
1780 if (count < outsize)
1781 Codes[count] = formats[i];
1782 ++count;
1783 }
1784 }
1785 if(NumCodes) {
1786 TRACE("Returning %u FourCC codes\n", count);
1787 *NumCodes = count;
1788 }
1789
1790 return DD_OK;
1791}
GLuint GLuint GLsizei count
Definition: gl.h:1545
unsigned char size_t * outsize
Definition: jpeglib.h:981
@ WINED3DFMT_DXT2
Definition: wined3d.h:240
@ WINED3DFMT_NVHS
Definition: wined3d.h:252
@ WINED3DFMT_DXT1
Definition: wined3d.h:239
@ WINED3DFMT_DXT3
Definition: wined3d.h:241
@ WINED3DFMT_DXT4
Definition: wined3d.h:242
@ WINED3DFMT_NVHU
Definition: wined3d.h:251
@ WINED3DFMT_YV12
Definition: wined3d.h:238
@ WINED3DFMT_DXT5
Definition: wined3d.h:243
@ WINED3DFMT_YUY2
Definition: wined3d.h:237
@ WINED3DFMT_UYVY
Definition: wined3d.h:236
@ WINED3DFMT_ATI2N
Definition: wined3d.h:248

Referenced by ddraw1_GetFourCCCodes(), ddraw2_GetFourCCCodes(), and ddraw4_GetFourCCCodes().

◆ ddraw7_GetGDISurface()

static HRESULT WINAPI ddraw7_GetGDISurface ( IDirectDraw7 iface,