No longer directly accessing debuggee memory.
[wine] / graphics / ddraw_private.h
1 #ifndef __GRAPHICS_WINE_DDRAW_PRIVATE_H
2 #define __GRAPHICS_WINE_DDRAW_PRIVATE_H
3
4 #include "config.h"
5
6 #ifdef HAVE_LIBXXF86DGA2
7 #include "ts_xf86dga2.h"
8 #endif /* defined(HAVE_LIBXXF86DGA2) */
9
10 #include "ddraw.h"
11 #include "winuser.h"
12
13 /*****************************************************************************
14  * Predeclare the interface implementation structures
15  */
16 typedef struct IDirectDrawPaletteImpl IDirectDrawPaletteImpl;
17 typedef struct IDirectDrawClipperImpl IDirectDrawClipperImpl;
18 typedef struct IDirectDrawImpl IDirectDrawImpl;
19 typedef struct IDirectDraw2Impl IDirectDraw2Impl;
20 typedef struct IDirectDraw4Impl IDirectDraw4Impl;
21 typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
22 typedef struct IDirectDrawSurface3Impl IDirectDrawSurface2Impl;
23 typedef struct IDirectDrawSurface4Impl IDirectDrawSurface3Impl;
24 typedef struct IDirectDrawSurface4Impl IDirectDrawSurface4Impl;
25 typedef struct IDirectDrawColorControlImpl IDirectDrawColorControlImpl;
26
27 #include "d3d_private.h"
28
29 /*****************************************************************************
30  * IDirectDrawPalette implementation structure
31  */
32 struct IDirectDrawPaletteImpl
33 {
34     /* IUnknown fields */
35     ICOM_VFIELD(IDirectDrawPalette);
36     DWORD                            ref;
37     /* IDirectDrawPalette fields */
38     IDirectDrawImpl* ddraw;
39     Colormap         cm;
40     PALETTEENTRY     palents[256];
41     int              installed;
42     /* This is to store the palette in 'screen format' */
43     int              screen_palents[256];
44 };
45
46 /*****************************************************************************
47  * IDirectDrawClipper implementation structure
48  */
49 struct IDirectDrawClipperImpl
50 {
51     /* IUnknown fields */
52     ICOM_VFIELD(IDirectDrawClipper);
53     DWORD                            ref;
54
55     /* IDirectDrawClipper fields */
56     HWND hWnd;
57 };
58
59 /*****************************************************************************
60  * IDirectDraw implementation structure
61  */
62 struct _common_directdrawdata
63 {
64     DDPIXELFORMAT directdraw_pixelformat;
65     DDPIXELFORMAT screen_pixelformat;
66     int           pixmap_depth;
67     void (*pixel_convert)(void *src, void *dst, DWORD width, DWORD height, LONG pitch, IDirectDrawPaletteImpl* palette);
68     void (*palette_convert)(LPPALETTEENTRY palent, void *screen_palette, DWORD start, DWORD count);
69     DWORD         height,width; /* SetDisplayMode */
70     HWND          mainWindow;   /* SetCooperativeLevel */
71
72     /* This is for Wine's fake mainWindow.
73        We need it also in DGA mode to make some games (for example Monkey Island III work) */
74     ATOM          winclass;
75     HWND          window;
76     Window        drawable;
77     PAINTSTRUCT   ps;
78     int           paintable;
79 };
80
81 struct _dga_directdrawdata
82 {
83     DWORD        fb_width,fb_height,fb_memsize;
84     void*        fb_addr;
85     unsigned int vpmask;
86 #ifdef HAVE_LIBXXF86DGA2
87     int version;
88     XDGADevice *dev;
89     XDGAMode *modes;
90     int num_modes;
91 #endif /* define(HAVE_LIBXXF86DGA2) */
92 };
93
94 struct _xlib_directdrawdata
95 {
96 #ifdef HAVE_LIBXXSHM
97     int xshm_active, xshm_compl;
98 #endif /* defined(HAVE_LIBXXSHM) */
99     
100     /* are these needed for anything? (draw_surf is the active surface)
101     IDirectDrawSurfaceImpl* surfs;
102     DWORD               num_surfs, alloc_surfs, draw_surf; */
103 };
104
105 struct IDirectDrawImpl
106 {
107     /* IUnknown fields */
108     ICOM_VFIELD(IDirectDraw);
109     DWORD                     ref;
110     /* IDirectDraw fields */
111     struct _common_directdrawdata   d;
112     union {
113         struct _xlib_directdrawdata xlib;
114         struct _dga_directdrawdata  dga;
115     } e;
116 };
117
118 /*****************************************************************************
119  * IDirectDraw2 implementation structure
120  */
121 struct IDirectDraw2Impl
122 {
123     /* IUnknown fields */
124     ICOM_VFIELD(IDirectDraw2);
125     DWORD                      ref;
126     /* IDirectDraw2 fields */
127     struct _common_directdrawdata   d;
128     union {
129         struct _xlib_directdrawdata xlib;
130         struct _dga_directdrawdata  dga;
131     } e;
132 };
133
134 /*****************************************************************************
135  * IDirectDraw4 implementation structure
136  */
137 struct IDirectDraw4Impl
138 {
139     /* IUnknown fields */
140     ICOM_VFIELD(IDirectDraw4);
141     DWORD                      ref;
142     /* IDirectDraw4 fields */
143     struct _common_directdrawdata   d;
144     union {
145         struct _xlib_directdrawdata xlib;
146         struct _dga_directdrawdata  dga;
147     } e;
148 };
149
150 /*****************************************************************************
151  * IDirectDrawSurface implementation structure
152  */
153 struct _common_directdrawsurface
154 {
155     IDirectDrawPaletteImpl*     palette;
156     IDirectDraw2Impl*           ddraw;
157
158     struct _surface_chain       *chain;
159
160     DDSURFACEDESC               surface_desc;
161
162     /* For Get / Release DC methods */
163     HBITMAP DIBsection;
164     void *bitmap_data;
165     HDC hdc;
166     HGDIOBJ holdbitmap;
167     
168     /* Callback for loaded textures */
169     IDirect3DTexture2Impl*      texture;
170     HRESULT WINAPI            (*SetColorKey_cb)(IDirect3DTexture2Impl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
171
172     /* Storage for attached device (void * as it can be either a Device or a Device2) */
173     void                       *d3d_device;
174
175     LPDIRECTDRAWCLIPPER         lpClipper;
176 };
177
178 struct _dga_directdrawsurface
179 {
180     DWORD               fb_height;
181 };
182
183 struct _xlib_directdrawsurface
184 {
185     XImage              *image;
186 #ifdef HAVE_LIBXXSHM
187     XShmSegmentInfo     shminfo;
188 #endif
189 };
190
191 struct IDirectDrawSurfaceImpl
192 {
193     /* IUnknown fields */
194     ICOM_VFIELD(IDirectDrawSurface);
195     DWORD                            ref;
196     /* IDirectDrawSurface fields */
197     struct _common_directdrawsurface    s;
198     union {
199         struct _dga_directdrawsurface   dga;
200         struct _xlib_directdrawsurface  xlib;
201     } t;
202 };
203
204 /*****************************************************************************
205  * IDirectDrawSurface2 implementation structure
206  */
207 struct IDirectDrawSurface2Impl
208 {
209     /* IUnknown fields */
210     ICOM_VFIELD(IDirectDrawSurface2);
211     DWORD                             ref;
212     /* IDirectDrawSurface2 fields */
213     struct _common_directdrawsurface    s;
214     union {
215         struct _dga_directdrawsurface   dga;
216         struct _xlib_directdrawsurface  xlib;
217     } t;
218 };
219
220 /*****************************************************************************
221  * IDirectDrawSurface3 implementation structure
222  */
223 struct IDirectDrawSurface3Impl
224 {
225     /* IUnknown fields */
226     ICOM_VFIELD(IDirectDrawSurface3);
227     DWORD                             ref;
228     /* IDirectDrawSurface3 fields */
229     struct _common_directdrawsurface    s;
230     union {
231         struct _dga_directdrawsurface   dga;
232         struct _xlib_directdrawsurface  xlib;
233     } t;
234 };
235
236 /*****************************************************************************
237  * IDirectDrawSurface4 implementation structure
238  */
239 struct IDirectDrawSurface4Impl
240 {
241     /* IUnknown fields */
242     ICOM_VFIELD(IDirectDrawSurface4);
243     DWORD                             ref;
244
245     /* IDirectDrawSurface4 fields */
246     struct _common_directdrawsurface    s;
247     union {
248         struct _dga_directdrawsurface   dga;
249         struct _xlib_directdrawsurface  xlib;
250     } t;
251 } ;
252
253 struct _surface_chain {
254         IDirectDrawSurface4Impl **surfaces;
255         int                     nrofsurfaces;
256 };
257
258 /*****************************************************************************
259  * IDirectDrawColorControl implementation structure
260  */
261 struct IDirectDrawColorControlImpl
262 {
263     /* IUnknown fields */
264     ICOM_VFIELD(IDirectDrawColorControl);
265     DWORD                                 ref;
266     /* IDirectDrawColorControl fields */
267     /* none */
268 };
269
270
271 #endif /* __GRAPHICS_WINE_DDRAW_PRIVATE_H */