3 /********* Includes *********/
10 #include <pseh/pseh.h>
12 #include <pseh/pseh2.h>
14 #include "Ddraw/ddraw.h"
15 #include "Surface/surface.h"
16 #include "Clipper/clipper.h"
20 /* DirectDraw startup code only internal use */
21 extern DDRAWI_DIRECTDRAW_GBL ddgbl
;
22 extern DDRAWI_DDRAWSURFACE_GBL ddSurfGbl
;
23 extern WCHAR classname
[128];
24 extern WNDCLASSW wnd_class
;
25 extern CRITICAL_SECTION ddcs
;
26 extern IDirectDraw7Vtbl DirectDraw7_Vtable
;
27 extern IDirectDraw4Vtbl DirectDraw4_Vtable
;
28 extern IDirectDraw2Vtbl DirectDraw2_Vtable
;
29 extern IDirectDrawVtbl DirectDraw_Vtable
;
32 extern IDirectDrawSurface7Vtbl DirectDrawSurface7_Vtable
;
33 extern IDirectDrawSurface4Vtbl DirectDrawSurface4_Vtable
;
34 extern IDirectDrawSurface3Vtbl DirectDrawSurface3_Vtable
;
35 extern IDirectDrawSurface2Vtbl DirectDrawSurface2_Vtable
;
36 extern IDirectDrawSurfaceVtbl DirectDrawSurface_Vtable
;
37 extern const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable
;
38 extern IDirectDrawClipperVtbl DirectDrawClipper_Vtable
;
39 extern IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable
;
40 extern IDirectDrawGammaControlVtbl DirectDrawGammaControl_Vtable
;
41 extern IDirectDrawKernelVtbl DirectDrawKernel_Vtable
;
42 extern IDirectDrawSurfaceKernelVtbl DirectDrawSurfaceKernel_Vtable
;
44 extern IDirect3DVtbl IDirect3D_Vtbl
;
45 extern IDirect3D2Vtbl IDirect3D2_Vtbl
;
46 extern IDirect3D3Vtbl IDirect3D3_Vtbl
;
47 extern IDirect3D7Vtbl IDirect3D7_Vtbl
;
49 /* Start up direct hal or hel
50 * iface = a pointer to the com object
51 * pGUID = guid hardware acclations or software acclation this can be NULL
52 * reenable = FALSE if we whant create a new directdraw com
53 * = TRUE if we really whant rebuild the whole com interface (not in use)
62 /* iface = a pointer to the com object
63 * reenable = FALSE / TRUE rebuld dx hal interface, this is need if we doing a mode change
71 /* iface = a pointer to the com object
72 * reenable = FALSE / TRUE rebuld dx hel interface, this is need if we doing a mode change
88 ReCreateDirectDraw(LPDIRECTDRAW iface
);
90 Internal_CreateSurface(
91 LPDDRAWI_DIRECTDRAW_INT pDDraw
,
92 LPDDSURFACEDESC2 pDDSD
,
93 LPDDRAWI_DDRAWSURFACE_INT
*ppSurf
,
97 Internal_CreatePalette( LPDDRAWI_DIRECTDRAW_INT pDDraw
, DWORD dwFlags
,
98 LPPALETTEENTRY palent
, LPDIRECTDRAWPALETTE
* ppPalette
, LPUNKNOWN pUnkOuter
);
100 /* convert DDSURFACEDESC to DDSURFACEDESC2 */
101 void CopyDDSurfDescToDDSurfDesc2(LPDDSURFACEDESC2 dst_pDesc
, LPDDSURFACEDESC src_pDesc
);
103 /* DirectDraw Cleanup code only internal use */
104 VOID
Cleanup(LPDDRAWI_DIRECTDRAW_INT iface
);
106 /* own macro to alloc memmory */
109 #define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m)
110 #define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \
113 #define DxHeapMemAlloc(p, m) { \
120 #define DxHeapMemFree(p) { \
125 /******** Main Object ********/
127 /* Public interface */
128 VOID WINAPI
AcquireDDThreadLock(VOID
);
129 VOID WINAPI
ReleaseDDThreadLock(VOID
);
131 ULONG WINAPI
DirectDrawClipper_AddRef (LPDIRECTDRAWCLIPPER iface
);
132 HRESULT WINAPI
DirectDrawClipper_Initialize( LPDIRECTDRAWCLIPPER iface
, LPDIRECTDRAW lpDD
, DWORD dwFlags
);
134 typedef struct DDRAWI_DDCOLORCONTROL_INT
140 } DDRAWI_DDCOLORCONTROL_INT
, *LPDDRAWI_DDCOLORCONTROL_INT
;
142 typedef struct _DDRAWI_DDGAMMACONTROL_INT
148 } DDRAWI_DDGAMMACONTROL_INT
, *LPDDRAWI_DDGAMMACONTROL_INT
;
150 typedef struct _DDRAWI_DDKERNEL_INT
156 } DDRAWI_KERNEL_INT
, *LPDDRAWI_KERNEL_INT
;
158 typedef struct _DDRAWI_DDKERNELSURFACE_INT
164 } _DDRAWI_DDKERNELSURFACE_INT
, *LPDDRAWI_DDKERNELSURFACE_INT
;
166 /* now to real info that are for private use and are our own */
175 /********* Prototypes **********/
176 VOID
Hal_DirectDraw_Release (LPDIRECTDRAW7
);
178 /* Setting for HEL should be move to ros special reg key ? */
180 /* setup how much graphic memory should hel be limit, set it now to 64MB */
181 #define HEL_GRAPHIC_MEMORY_MAX 67108864
183 /*********** Macros ***********/
186 use this macro to close
187 down the debuger text complete
188 no debuging at all, it will
189 crash ms debuger in VS
192 //#define DX_WINDBG_trace()
194 //#define DX_STUB_DD_OK return DD_OK;
195 //#define DX_STUB_str(x)
196 //#define DX_WINDBG_trace_res
200 Use this macro if you want deboug in visual studio or
201 if you have a program to look at the _INT struct from
202 ReactOS ddraw.dll or ms ddraw.dll, so you can see what
203 value ms are being setup.
205 This macro will create allot warings and can not be help when you compile
209 //#define DX_WINDBG_trace()
211 //#define DX_STUB_DD_OK return DD_OK;
212 //#define DX_STUB_str(x) printf("%s",x);
213 //#define DX_WINDBG_trace_res
216 use this if want doing a trace from a program
217 like a game and ReactOS ddraw.dll in windows
218 so you can figout what going wrong and what
219 api are being call or if it hel or is it hal
221 This marco does not create warings when you compile
226 static BOOL firstcall = TRUE; \
230 sprintf ( buffer, "Function %s is not implemented yet (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \
231 OutputDebugStringA(buffer); \
235 return DDERR_UNSUPPORTED;
239 #define DX_STUB_DD_OK \
241 static BOOL firstcall = TRUE; \
245 sprintf ( buffer, "Function %s is not implemented yet (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \
246 OutputDebugStringA(buffer); \
254 #define DX_STUB_str(x) \
257 sprintf ( buffer, "Function %s %s (%s:%d)\n", __FUNCTION__,x,__FILE__,__LINE__ ); \
258 OutputDebugStringA(buffer); \
262 #define DX_WINDBG_trace() \
263 static BOOL firstcallx = TRUE; \
267 sprintf ( buffer, "Enter Function %s (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \
268 OutputDebugStringA(buffer); \
273 #define DX_WINDBG_trace_res(width,height,bpp, freq) \
274 static BOOL firstcallxx = TRUE; \
278 sprintf ( buffer, "Setmode have been req width=%ld, height=%ld bpp=%ld freq = %ld\n",width,height,bpp, freq); \
279 OutputDebugStringA(buffer); \
280 firstcallxx = TRUE; \
283 #define DX_WINDBG_trace() //
284 #define DX_WINDBG_trace_res(width,height,bpp, freq) \\
286 #define DX_STUB_str(x) //