Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenrosdraw.h
Go to the documentation of this file.
00001 #pragma once 00002 00003 /********* Includes *********/ 00004 #include <windows.h> 00005 #include <stdio.h> 00006 #include <ddraw.h> 00007 #include <ddrawi.h> 00008 #include <d3dhal.h> 00009 #include <ddrawgdi.h> 00010 #include <pseh/pseh.h> 00011 00012 #include <pseh/pseh2.h> 00013 00014 #include "Ddraw/ddraw.h" 00015 #include "Surface/surface.h" 00016 #include "Clipper/clipper.h" 00017 00018 #include "resource.h" 00019 00020 /* DirectDraw startup code only internal use */ 00021 extern DDRAWI_DIRECTDRAW_GBL ddgbl; 00022 extern DDRAWI_DDRAWSURFACE_GBL ddSurfGbl; 00023 extern WCHAR classname[128]; 00024 extern WNDCLASSW wnd_class; 00025 extern CRITICAL_SECTION ddcs; 00026 extern IDirectDraw7Vtbl DirectDraw7_Vtable; 00027 extern IDirectDraw4Vtbl DirectDraw4_Vtable; 00028 extern IDirectDraw2Vtbl DirectDraw2_Vtable; 00029 extern IDirectDrawVtbl DirectDraw_Vtable; 00030 00031 00032 extern IDirectDrawSurface7Vtbl DirectDrawSurface7_Vtable; 00033 extern IDirectDrawSurface4Vtbl DirectDrawSurface4_Vtable; 00034 extern IDirectDrawSurface3Vtbl DirectDrawSurface3_Vtable; 00035 extern IDirectDrawSurface2Vtbl DirectDrawSurface2_Vtable; 00036 extern IDirectDrawSurfaceVtbl DirectDrawSurface_Vtable; 00037 extern const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable; 00038 extern IDirectDrawClipperVtbl DirectDrawClipper_Vtable; 00039 extern IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable; 00040 extern IDirectDrawGammaControlVtbl DirectDrawGammaControl_Vtable; 00041 extern IDirectDrawKernelVtbl DirectDrawKernel_Vtable; 00042 extern IDirectDrawSurfaceKernelVtbl DirectDrawSurfaceKernel_Vtable; 00043 00044 extern IDirect3DVtbl IDirect3D_Vtbl; 00045 extern IDirect3D2Vtbl IDirect3D2_Vtbl; 00046 extern IDirect3D3Vtbl IDirect3D3_Vtbl; 00047 extern IDirect3D7Vtbl IDirect3D7_Vtbl; 00048 00049 /* Start up direct hal or hel 00050 * iface = a pointer to the com object 00051 * pGUID = guid hardware acclations or software acclation this can be NULL 00052 * reenable = FALSE if we whant create a new directdraw com 00053 * = TRUE if we really whant rebuild the whole com interface (not in use) 00054 */ 00055 00056 HRESULT WINAPI 00057 StartDirectDraw( 00058 LPDIRECTDRAW iface, 00059 LPGUID pGUID, 00060 BOOL reenable); 00061 00062 /* iface = a pointer to the com object 00063 * reenable = FALSE / TRUE rebuld dx hal interface, this is need if we doing a mode change 00064 */ 00065 00066 HRESULT WINAPI 00067 StartDirectDrawHal( 00068 LPDIRECTDRAW iface, 00069 BOOL reenable); 00070 00071 /* iface = a pointer to the com object 00072 * reenable = FALSE / TRUE rebuld dx hel interface, this is need if we doing a mode change 00073 */ 00074 00075 HRESULT WINAPI 00076 StartDirectDrawHel( 00077 LPDIRECTDRAW iface, 00078 BOOL reenable); 00079 00080 HRESULT WINAPI 00081 Create_DirectDraw ( 00082 LPGUID pGUID, 00083 LPDIRECTDRAW* pIface, 00084 REFIID id, 00085 BOOL ex); 00086 00087 HRESULT WINAPI 00088 ReCreateDirectDraw(LPDIRECTDRAW iface); 00089 HRESULT 00090 Internal_CreateSurface( 00091 LPDDRAWI_DIRECTDRAW_INT pDDraw, 00092 LPDDSURFACEDESC2 pDDSD, 00093 LPDDRAWI_DDRAWSURFACE_INT *ppSurf, 00094 IUnknown *pUnkOuter); 00095 00096 HRESULT 00097 Internal_CreatePalette( LPDDRAWI_DIRECTDRAW_INT pDDraw, DWORD dwFlags, 00098 LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter); 00099 00100 /* convert DDSURFACEDESC to DDSURFACEDESC2 */ 00101 void CopyDDSurfDescToDDSurfDesc2(LPDDSURFACEDESC2 dst_pDesc, LPDDSURFACEDESC src_pDesc); 00102 00103 /* DirectDraw Cleanup code only internal use */ 00104 VOID Cleanup(LPDDRAWI_DIRECTDRAW_INT iface); 00105 00106 /* own macro to alloc memmory */ 00107 00108 /* 00109 #define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m) 00110 #define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \ 00111 p = NULL; 00112 */ 00113 #define DxHeapMemAlloc(p, m) { \ 00114 p = malloc(m); \ 00115 if (p != NULL) \ 00116 { \ 00117 ZeroMemory(p,m); \ 00118 } \ 00119 } 00120 #define DxHeapMemFree(p) { \ 00121 free(p); \ 00122 p = NULL; \ 00123 } 00124 00125 /******** Main Object ********/ 00126 00127 /* Public interface */ 00128 VOID WINAPI AcquireDDThreadLock(VOID); 00129 VOID WINAPI ReleaseDDThreadLock(VOID); 00130 00131 ULONG WINAPI DirectDrawClipper_AddRef (LPDIRECTDRAWCLIPPER iface); 00132 HRESULT WINAPI DirectDrawClipper_Initialize( LPDIRECTDRAWCLIPPER iface, LPDIRECTDRAW lpDD, DWORD dwFlags); 00133 00134 typedef struct DDRAWI_DDCOLORCONTROL_INT 00135 { 00136 LPVOID lpVtbl; 00137 LPVOID lpLcl; 00138 LPVOID lpLink; 00139 DWORD dwIntRefCnt; 00140 } DDRAWI_DDCOLORCONTROL_INT, *LPDDRAWI_DDCOLORCONTROL_INT; 00141 00142 typedef struct _DDRAWI_DDGAMMACONTROL_INT 00143 { 00144 LPVOID lpVtbl; 00145 LPVOID lpLcl; 00146 LPVOID lpLink; 00147 DWORD dwIntRefCnt; 00148 } DDRAWI_DDGAMMACONTROL_INT, *LPDDRAWI_DDGAMMACONTROL_INT; 00149 00150 typedef struct _DDRAWI_DDKERNEL_INT 00151 { 00152 LPVOID lpVtbl; 00153 LPVOID lpLcl; 00154 LPVOID lpLink; 00155 DWORD dwIntRefCnt; 00156 } DDRAWI_KERNEL_INT, *LPDDRAWI_KERNEL_INT; 00157 00158 typedef struct _DDRAWI_DDKERNELSURFACE_INT 00159 { 00160 LPVOID lpVtbl; 00161 LPVOID lpLcl; 00162 LPVOID lpLink; 00163 DWORD dwIntRefCnt; 00164 } _DDRAWI_DDKERNELSURFACE_INT, *LPDDRAWI_DDKERNELSURFACE_INT; 00165 00166 /* now to real info that are for private use and are our own */ 00167 00168 00169 00170 00171 00172 00173 00174 00175 /********* Prototypes **********/ 00176 VOID Hal_DirectDraw_Release (LPDIRECTDRAW7); 00177 00178 /* Setting for HEL should be move to ros special reg key ? */ 00179 00180 /* setup how much graphic memory should hel be limit, set it now to 64MB */ 00181 #define HEL_GRAPHIC_MEMORY_MAX 67108864 00182 00183 /*********** Macros ***********/ 00184 00185 /* 00186 use this macro to close 00187 down the debuger text complete 00188 no debuging at all, it will 00189 crash ms debuger in VS 00190 */ 00191 00192 //#define DX_WINDBG_trace() 00193 //#define DX_STUB 00194 //#define DX_STUB_DD_OK return DD_OK; 00195 //#define DX_STUB_str(x) 00196 //#define DX_WINDBG_trace_res 00197 00198 00199 /* 00200 Use this macro if you want deboug in visual studio or 00201 if you have a program to look at the _INT struct from 00202 ReactOS ddraw.dll or ms ddraw.dll, so you can see what 00203 value ms are being setup. 00204 00205 This macro will create allot warings and can not be help when you compile 00206 */ 00207 00208 00209 //#define DX_WINDBG_trace() 00210 //#define DX_STUB 00211 //#define DX_STUB_DD_OK return DD_OK; 00212 //#define DX_STUB_str(x) printf("%s",x); 00213 //#define DX_WINDBG_trace_res 00214 00215 /* 00216 use this if want doing a trace from a program 00217 like a game and ReactOS ddraw.dll in windows 00218 so you can figout what going wrong and what 00219 api are being call or if it hel or is it hal 00220 00221 This marco does not create warings when you compile 00222 */ 00223 00224 #define DX_STUB \ 00225 { \ 00226 static BOOL firstcall = TRUE; \ 00227 if (firstcall) \ 00228 { \ 00229 char buffer[1024]; \ 00230 sprintf ( buffer, "Function %s is not implemented yet (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \ 00231 OutputDebugStringA(buffer); \ 00232 firstcall = FALSE; \ 00233 } \ 00234 } \ 00235 return DDERR_UNSUPPORTED; 00236 00237 00238 00239 #define DX_STUB_DD_OK \ 00240 { \ 00241 static BOOL firstcall = TRUE; \ 00242 if (firstcall) \ 00243 { \ 00244 char buffer[1024]; \ 00245 sprintf ( buffer, "Function %s is not implemented yet (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \ 00246 OutputDebugStringA(buffer); \ 00247 firstcall = FALSE; \ 00248 } \ 00249 } \ 00250 return DD_OK; 00251 00252 00253 #if 1 00254 #define DX_STUB_str(x) \ 00255 { \ 00256 char buffer[1024]; \ 00257 sprintf ( buffer, "Function %s %s (%s:%d)\n", __FUNCTION__,x,__FILE__,__LINE__ ); \ 00258 OutputDebugStringA(buffer); \ 00259 } 00260 00261 00262 #define DX_WINDBG_trace() \ 00263 static BOOL firstcallx = TRUE; \ 00264 if (firstcallx) \ 00265 { \ 00266 char buffer[1024]; \ 00267 sprintf ( buffer, "Enter Function %s (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \ 00268 OutputDebugStringA(buffer); \ 00269 firstcallx = TRUE; \ 00270 } 00271 00272 00273 #define DX_WINDBG_trace_res(width,height,bpp, freq) \ 00274 static BOOL firstcallxx = TRUE; \ 00275 if (firstcallxx) \ 00276 { \ 00277 char buffer[1024]; \ 00278 sprintf ( buffer, "Setmode have been req width=%ld, height=%ld bpp=%ld freq = %ld\n",width,height,bpp, freq); \ 00279 OutputDebugStringA(buffer); \ 00280 firstcallxx = TRUE; \ 00281 } 00282 #else 00283 #define DX_WINDBG_trace() // 00284 #define DX_WINDBG_trace_res(width,height,bpp, freq) \\ 00285 00286 #define DX_STUB_str(x) // 00287 00288 #endif Generated on Sat May 26 2012 04:19:59 for ReactOS by
1.7.6.1
|