1 #include <windows.h> 2 #include <ddrawi.h> 3 #include <d3dhal.h> 4 5 6 int StartupHAL (VOID); 7 extern HDC hdc; 8 extern DDRAWI_DIRECTDRAW_GBL mDDrawGlobal; 9 extern DDRAWI_DIRECTDRAW_LCL mDDrawLocal; 10 extern DDHALINFO mHALInfo; 11 12 extern DDHAL_CALLBACKS mCallbacks; 13 extern DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks; 14 extern D3DHAL_CALLBACKS mD3dCallbacks; 15 extern D3DHAL_GLOBALDRIVERDATA mD3dDriverData; 16 17 extern UINT mcModeInfos; 18 extern DDHALMODEINFO *mpModeInfos; 19 20 extern UINT mcvmList; 21 extern VIDMEM *mpvmList; 22 23 extern UINT mcFourCC; 24 extern DWORD *mpFourCC; 25 26 extern UINT mcTextures; 27 extern DDSURFACEDESC *mpTextures; 28 29 30 31 BOOL (APIENTRY *DdCreateDirectDrawObject) ( 32 LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal, 33 HDC hdc 34 ); 35 36 BOOL (APIENTRY *DdQueryDirectDrawObject) ( 37 LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal, 38 LPDDHALINFO pHalInfo, 39 LPDDHAL_DDCALLBACKS pDDCallbacks, 40 LPDDHAL_DDSURFACECALLBACKS pDDSurfaceCallbacks, 41 LPDDHAL_DDPALETTECALLBACKS pDDPaletteCallbacks, 42 LPD3DHAL_CALLBACKS pD3dCallbacks, 43 LPD3DHAL_GLOBALDRIVERDATA pD3dDriverData, 44 LPDDHAL_DDEXEBUFCALLBACKS pD3dBufferCallbacks, 45 LPDDSURFACEDESC pD3dTextureFormats, 46 LPDWORD pdwFourCC, 47 LPVIDMEM pvmList 48 ); 49 50 BOOL 51 APIENTRY 52 DdDeleteDirectDrawObject( 53 LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal 54 ); 55 56 BOOL 57 APIENTRY 58 DdCreateSurfaceObject( 59 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal, 60 BOOL bPrimarySurface 61 ); 62 63 BOOL 64 APIENTRY 65 DdDeleteSurfaceObject( 66 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal 67 ); 68 69 //BOOL 70 //APIENTRY 71 //DdResetVisrgn( 72 // LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal, 73 // HWND hWnd 74 //); 75 BOOL (APIENTRY *DdResetVisrgn) ( 76 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal, 77 HWND hWnd 78 ); 79 80 HDC 81 APIENTRY 82 DdGetDC( 83 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal, 84 LPPALETTEENTRY pColorTable 85 ); 86 87 BOOL 88 APIENTRY 89 DdReleaseDC( 90 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal 91 ); 92 93 HBITMAP 94 APIENTRY 95 DdCreateDIBSection( 96 HDC hdc, 97 CONST BITMAPINFO *pbmi, 98 UINT iUsage, 99 VOID **ppvBits, 100 HANDLE hSectionApp, 101 DWORD dwOffset 102 ); 103 104 BOOL 105 APIENTRY 106 DdReenableDirectDrawObject( 107 LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal, 108 BOOL *pbNewMode 109 ); 110 111 //BOOL 112 //APIENTRY 113 //DdAttachSurface( 114 // LPDDRAWI_DDRAWSURFACE_LCL pSurfaceFrom, 115 // LPDDRAWI_DDRAWSURFACE_LCL pSurfaceTo 116 //); 117 118 BOOL (APIENTRY *DdAttachSurface) ( 119 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceFrom, 120 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceTo 121 ); 122 123 VOID 124 APIENTRY 125 DdUnattachSurface( 126 LPDDRAWI_DDRAWSURFACE_LCL pSurface, 127 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceAttached 128 ); 129 130 ULONG 131 APIENTRY 132 DdQueryDisplaySettingsUniqueness(VOID); 133 134 HANDLE 135 APIENTRY 136 DdGetDxHandle( 137 LPDDRAWI_DIRECTDRAW_LCL pDDraw, 138 LPDDRAWI_DDRAWSURFACE_LCL pSurface, 139 BOOL bRelease 140 ); 141 142 BOOL 143 APIENTRY 144 DdSetGammaRamp( 145 LPDDRAWI_DIRECTDRAW_LCL pDDraw, 146 HDC hdc, 147 LPVOID lpGammaRamp 148 ); 149 150 DWORD 151 APIENTRY 152 DdSwapTextureHandles( 153 LPDDRAWI_DIRECTDRAW_LCL pDDraw, 154 LPDDRAWI_DDRAWSURFACE_LCL pDDSLcl1, 155 LPDDRAWI_DDRAWSURFACE_LCL pDDSLcl2 156 ); 157 158 char* DDErrorString (HRESULT hr) 159 { 160 switch (hr) 161 { 162 case DD_OK: return "DD_OK"; 163 case DDERR_ALREADYINITIALIZED: return "DDERR_ALREADYINITIALIZED"; 164 case DDERR_CANNOTATTACHSURFACE: return "DDERR_CANNOTATTACHSURFACE"; 165 case DDERR_CANNOTDETACHSURFACE: return "DDERR_CANNOTDETACHSURFACE"; 166 case DDERR_CURRENTLYNOTAVAIL: return "DDERR_CURRENTLYNOTAVAIL"; 167 case DDERR_EXCEPTION: return "DDERR_EXCEPTION"; 168 case DDERR_GENERIC: return "DDERR_GENERIC"; 169 case DDERR_HEIGHTALIGN: return "DDERR_HEIGHTALIGN"; 170 case DDERR_INCOMPATIBLEPRIMARY: return "DDERR_INCOMPATIBLEPRIMARY"; 171 case DDERR_INVALIDCAPS: return "DDERR_INVALIDCAPS"; 172 case DDERR_INVALIDCLIPLIST: return "DDERR_INVALIDCLIPLIST"; 173 case DDERR_INVALIDMODE: return "DDERR_INVALIDMODE"; 174 case DDERR_INVALIDOBJECT: return "DDERR_INVALIDOBJECT"; 175 case DDERR_INVALIDPARAMS: return "DDERR_INVALIDPARAMS"; 176 case DDERR_INVALIDPIXELFORMAT: return "DDERR_INVALIDPIXELFORMAT"; 177 case DDERR_INVALIDRECT: return "DDERR_INVALIDRECT"; 178 case DDERR_LOCKEDSURFACES: return "DDERR_LOCKEDSURFACES"; 179 case DDERR_NO3D: return "DDERR_NO3D"; 180 case DDERR_NOALPHAHW: return "DDERR_NOALPHAHW"; 181 case DDERR_NOCLIPLIST: return "DDERR_NOCLIPLIST"; 182 case DDERR_NOCOLORCONVHW: return "DDERR_NOCOLORCONVHW"; 183 case DDERR_NOCOOPERATIVELEVELSET: return "DDERR_NOCOOPERATIVELEVELSET"; 184 case DDERR_NOCOLORKEY: return "DDERR_NOCOLORKEY"; 185 case DDERR_NOCOLORKEYHW: return "DDERR_NOCOLORKEYHW"; 186 case DDERR_NODIRECTDRAWSUPPORT: return "DDERR_NODIRECTDRAWSUPPORT"; 187 case DDERR_NOEXCLUSIVEMODE: return "DDERR_NOEXCLUSIVEMODE"; 188 case DDERR_NOFLIPHW: return "DDERR_NOFLIPHW"; 189 case DDERR_NOGDI: return "DDERR_NOGDI"; 190 case DDERR_NOMIRRORHW: return "DDERR_NOMIRRORHW"; 191 case DDERR_NOTFOUND: return "DDERR_NOTFOUND"; 192 case DDERR_NOOVERLAYHW: return "DDERR_NOOVERLAYHW"; 193 case DDERR_NORASTEROPHW: return "DDERR_NORASTEROPHW"; 194 case DDERR_NOROTATIONHW: return "DDERR_NOROTATIONHW"; 195 case DDERR_NOSTRETCHHW: return "DDERR_NOSTRETCHHW"; 196 case DDERR_NOT4BITCOLOR: return "DDERR_NOT4BITCOLOR"; 197 case DDERR_NOT4BITCOLORINDEX: return "DDERR_NOT4BITCOLORINDEX"; 198 case DDERR_NOT8BITCOLOR: return "DDERR_NOT8BITCOLOR"; 199 case DDERR_NOTEXTUREHW: return "DDERR_NOTEXTUREHW"; 200 case DDERR_NOVSYNCHW: return "DDERR_NOVSYNCHW"; 201 case DDERR_NOZBUFFERHW: return "DDERR_NOZBUFFERHW"; 202 case DDERR_NOZOVERLAYHW: return "DDERR_NOZOVERLAYHW"; 203 case DDERR_OUTOFCAPS: return "DDERR_OUTOFCAPS"; 204 case DDERR_OUTOFMEMORY: return "DDERR_OUTOFMEMORY"; 205 case DDERR_OUTOFVIDEOMEMORY: return "DDERR_OUTOFVIDEOMEMORY"; 206 case DDERR_OVERLAYCANTCLIP: return "DDERR_OVERLAYCANTCLIP"; 207 case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"; 208 case DDERR_PALETTEBUSY: return "DDERR_PALETTEBUSY"; 209 case DDERR_COLORKEYNOTSET: return "DDERR_COLORKEYNOTSET"; 210 case DDERR_SURFACEALREADYATTACHED: return "DDERR_SURFACEALREADYATTACHED"; 211 case DDERR_SURFACEALREADYDEPENDENT: return "DDERR_SURFACEALREADYDEPENDENT"; 212 case DDERR_SURFACEBUSY: return "DDERR_SURFACEBUSY"; 213 case DDERR_CANTLOCKSURFACE: return "DDERR_CANTLOCKSURFACE"; 214 case DDERR_SURFACEISOBSCURED: return "DDERR_SURFACEISOBSCURED"; 215 case DDERR_SURFACELOST: return "DDERR_SURFACELOST"; 216 case DDERR_SURFACENOTATTACHED: return "DDERR_SURFACENOTATTACHED"; 217 case DDERR_TOOBIGHEIGHT: return "DDERR_TOOBIGHEIGHT"; 218 case DDERR_TOOBIGSIZE: return "DDERR_TOOBIGSIZE"; 219 case DDERR_TOOBIGWIDTH: return "DDERR_TOOBIGWIDTH"; 220 case DDERR_UNSUPPORTED: return "DDERR_UNSUPPORTED"; 221 case DDERR_UNSUPPORTEDFORMAT: return "DDERR_UNSUPPORTEDFORMAT"; 222 case DDERR_UNSUPPORTEDMASK: return "DDERR_UNSUPPORTEDMASK"; 223 case DDERR_VERTICALBLANKINPROGRESS: return "DDERR_VERTICALBLANKINPROGRESS"; 224 case DDERR_WASSTILLDRAWING: return "DDERR_WASSTILLDRAWING"; 225 case DDERR_XALIGN: return "DDERR_XALIGN"; 226 case DDERR_INVALIDDIRECTDRAWGUID: return "DDERR_INVALIDDIRECTDRAWGUID"; 227 case DDERR_DIRECTDRAWALREADYCREATED: return "DDERR_DIRECTDRAWALREADYCREATED"; 228 case DDERR_NODIRECTDRAWHW: return "DDERR_NODIRECTDRAWHW"; 229 case DDERR_PRIMARYSURFACEALREADYEXISTS: return "DDERR_PRIMARYSURFACEALREADYEXISTS"; 230 case DDERR_NOEMULATION: return "DDERR_NOEMULATION"; 231 case DDERR_REGIONTOOSMALL: return "DDERR_REGIONTOOSMALL"; 232 case DDERR_CLIPPERISUSINGHWND: return "DDERR_CLIPPERISUSINGHWND"; 233 case DDERR_NOCLIPPERATTACHED: return "DDERR_NOCLIPPERATTACHED"; 234 case DDERR_NOHWND: return "DDERR_NOHWND"; 235 case DDERR_HWNDSUBCLASSED: return "DDERR_HWNDSUBCLASSED"; 236 case DDERR_HWNDALREADYSET: return "DDERR_HWNDALREADYSET"; 237 case DDERR_NOPALETTEATTACHED: return "DDERR_NOPALETTEATTACHED"; 238 case DDERR_NOPALETTEHW: return "DDERR_NOPALETTEHW"; 239 case DDERR_BLTFASTCANTCLIP: return "DDERR_BLTFASTCANTCLIP"; 240 case DDERR_NOBLTHW: return "DDERR_NOBLTHW"; 241 case DDERR_NODDROPSHW: return "DDERR_NODDROPSHW"; 242 case DDERR_OVERLAYNOTVISIBLE: return "DDERR_OVERLAYNOTVISIBLE"; 243 case DDERR_NOOVERLAYDEST: return "DDERR_NOOVERLAYDEST"; 244 case DDERR_INVALIDPOSITION: return "DDERR_INVALIDPOSITION"; 245 case DDERR_NOTAOVERLAYSURFACE: return "DDERR_NOTAOVERLAYSURFACE"; 246 case DDERR_EXCLUSIVEMODEALREADYSET: return "DDERR_EXCLUSIVEMODEALREADYSET"; 247 case DDERR_NOTFLIPPABLE: return "DDERR_NOTFLIPPABLE"; 248 case DDERR_CANTDUPLICATE: return "DDERR_CANTDUPLICATE"; 249 case DDERR_NOTLOCKED: return "DDERR_NOTLOCKED"; 250 case DDERR_CANTCREATEDC: return "DDERR_CANTCREATEDC"; 251 case DDERR_NODC: return "DDERR_NODC"; 252 case DDERR_WRONGMODE: return "DDERR_WRONGMODE"; 253 case DDERR_IMPLICITLYCREATED: return "DDERR_IMPLICITLYCREATED"; 254 case DDERR_NOTPALETTIZED: return "DDERR_NOTPALETTIZED"; 255 case DDERR_UNSUPPORTEDMODE: return "DDERR_UNSUPPORTEDMODE"; 256 case DDERR_NOMIPMAPHW: return "DDERR_NOMIPMAPHW"; 257 case DDERR_INVALIDSURFACETYPE: return "DDERR_INVALIDSURFACETYPE"; 258 case DDERR_DCALREADYCREATED: return "DDERR_DCALREADYCREATED"; 259 case DDERR_CANTPAGELOCK: return "DDERR_CANTPAGELOCK"; 260 case DDERR_CANTPAGEUNLOCK: return "DDERR_CANTPAGEUNLOCK"; 261 case DDERR_NOTPAGELOCKED: return "DDERR_NOTPAGELOCKED"; 262 case DDERR_NOTINITIALIZED: return "DDERR_NOTINITIALIZED"; 263 } 264 265 return "Unknown Error "; 266 } 267 268