//-----------------------------------------------------------------------------
// DIRECTX ERROR CHECKING
//-----------------------------------------------------------------------------
BOOL CheckDirectDrawResult( HRESULT result );
BOOL CheckDirect3DResult( HRESULT result );



//-----------------------------------------------------------------------------
// DIRECT DRAW ERRORS
//-----------------------------------------------------------------------------
#define STRING_DDERR_ALREADYINITIALIZED				"This object is already initialized"
#define STRING_DDERR_CANNOTATTACHSURFACE			"This surface can not be attached to the requested surface"
#define STRING_DDERR_CANNOTDETACHSURFACE			"This surface can not be detached from the requested surface."
#define STRING_DDERR_CURRENTLYNOTAVAIL				"Support is currently not available."
#define STRING_DDERR_EXCEPTION						"An exception was encountered while performing the requested operation"
#define STRING_DDERR_GENERIC						"Generic failure."
#define STRING_DDERR_HEIGHTALIGN					"Height of rectangle provided is not a multiple of reqd alignment"
#define STRING_DDERR_INCOMPATIBLEPRIMARY			"Unable to match primary surface creation request with existing primary surface."
#define STRING_DDERR_INVALIDCAPS					"One or more of the caps bits passed to the callback are incorrect."
#define STRING_DDERR_INVALIDCLIPLIST				"DirectDraw does not support provided Cliplist."
#define STRING_DDERR_INVALIDMODE					"DirectDraw does not support the requested mode"
#define STRING_DDERR_INVALIDOBJECT					"DirectDraw received a pointer that was an invalid DIRECTDRAW object."
#define STRING_DDERR_INVALIDPARAMS					"One or more of the parameters passed to the callback function are incorrect."	
#define STRING_DDERR_INVALIDPIXELFORMAT				"pixel format was invalid as specified"
#define STRING_DDERR_INVALIDRECT					"Rectangle provided was invalid."
#define STRING_DDERR_LOCKEDSURFACES					"Operation could not be carried out because one or more surfaces are locked"
#define STRING_DDERR_NO3D							"There is no 3D present."
#define STRING_DDERR_NOALPHAHW						"Operation could not be carried out because there is no alpha accleration hardware present or available."
#define STRING_DDERR_NOCLIPLIST						"no clip list available"
#define STRING_DDERR_NOCOLORCONVHW					"Operation could not be carried out because there is no color conversion hardware present or available."
#define STRING_DDERR_NOCOOPERATIVELEVELSET			"Create function called without DirectDraw object method SetCooperativeLevel being called."
#define STRING_DDERR_NOCOLORKEY						"Surface doesn't currently have a color key"
#define STRING_DDERR_NOCOLORKEYHW					"Operation could not be carried out because there is no hardware support of the dest color key."
#define STRING_DDERR_NODIRECTDRAWSUPPORT			"No DirectDraw support possible with current display driver"
#define STRING_DDERR_NOEXCLUSIVEMODE				"Operation requires the application to have exclusive mode but the application does not have exclusive mode."
#define STRING_DDERR_NOFLIPHW						"Flipping visible surfaces is not supported."
#define STRING_DDERR_NOGDI							"There is no GDI present."
#define STRING_DDERR_NOMIRRORHW						"Operation could not be carried out because there is no hardware present or available."
#define STRING_DDERR_NOTFOUND						"Requested item was not found"
#define STRING_DDERR_NOOVERLAYHW					"Operation could not be carried out because there is no overlay hardware present or available."
#define STRING_DDERR_OVERLAPPINGRECTS				"Operation could not be carried out because the source and destination rectangles are on the same surface and overlap each other."
#define STRING_DDERR_NORASTEROPHW					"Operation could not be carried out because there is no appropriate raster op hardware present or available."
#define STRING_DDERR_NOROTATIONHW					"Operation could not be carried out because there is no rotation hardware present or available."
#define STRING_DDERR_NOSTRETCHHW					"Operation could not be carried out because there is no hardware support for stretching."
#define STRING_DDERR_NOT4BITCOLOR					"DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette."
#define STRING_DDERR_NOT4BITCOLORINDEX				"DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette."
#define STRING_DDERR_NOT8BITCOLOR					"DirectDraw Surface is not in 8 bit color mode and the requested operation requires 8 bit color."
#define STRING_DDERR_NOTEXTUREHW					"Operation could not be carried out because there is no texture mapping hardware present or available."
#define STRING_DDERR_NOVSYNCHW						"Operation could not be carried out because there is no hardware support for vertical blank synchronized operations."
#define STRING_DDERR_NOZBUFFERHW					"Operation could not be carried out because there is no hardware support for zbuffer blting."
#define STRING_DDERR_NOZOVERLAYHW					"Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays."
#define STRING_DDERR_OUTOFCAPS						"The hardware needed for the requested operation has already been allocated."
#define STRING_DDERR_OUTOFMEMORY					"DirectDraw does not have enough memory to perform the operation."
#define STRING_DDERR_OUTOFVIDEOMEMORY				"DirectDraw does not have enough memory to perform the operation."
#define STRING_DDERR_OVERLAYCANTCLIP				"hardware does not support clipped overlays"
#define STRING_DDERR_OVERLAYCOLORKEYONLYONEACTIVE	"Can only have ony color key active at one time for overlays"
#define STRING_DDERR_PALETTEBUSY					"Access to this palette is being refused because the palette is already locked by another thread."
#define STRING_DDERR_COLORKEYNOTSET					"No src color key specified for this operation."
#define STRING_DDERR_SURFACEALREADYATTACHED			"This surface is already attached to the surface it is being attached to."
#define STRING_DDERR_SURFACEALREADYDEPENDENT		"This surface is already a dependency of the surface it is being made a dependency of."
#define STRING_DDERR_SURFACEBUSY					"Access to this surface is being refused because the surface is already locked by another thread."
#define STRING_DDERR_CANTLOCKSURFACE				"Access to this surface is being refused because no driver exists which can supply a pointer to the surface. This is most likely to happen when attempting to lock the primary surface when no DCI provider is present. Will also happen on attempts to lock an optimized surface."
#define STRING_DDERR_SURFACEISOBSCURED				"Access to Surface refused because Surface is obscured."
#define STRING_DDERR_SURFACELOST					"Access to this surface is being refused because the surface is gone. The DIRECTDRAWSURFACE object representing this surface should have Restore called on it."
#define STRING_DDERR_SURFACENOTATTACHED				"The requested surface is not attached."
#define STRING_DDERR_TOOBIGHEIGHT					"Height requested by DirectDraw is too large."
#define STRING_DDERR_TOOBIGSIZE						"Size requested by DirectDraw is too large --	 The individual height and width are OK."
#define STRING_DDERR_TOOBIGWIDTH					"Width requested by DirectDraw is too large."
#define STRING_DDERR_UNSUPPORTED					"Action not supported."
#define STRING_DDERR_UNSUPPORTEDFORMAT				"FOURCC format requested is unsupported by DirectDraw"
#define STRING_DDERR_UNSUPPORTEDMASK				"Bitmask in the pixel format requested is unsupported by DirectDraw"
#define STRING_DDERR_INVALIDSTREAM					"The specified stream contains invalid data"
#define STRING_DDERR_VERTICALBLANKINPROGRESS		"vertical blank is in progress"
#define STRING_DDERR_WASSTILLDRAWING				"Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete."
#define STRING_DDERR_XALIGN							"Rectangle provided was not horizontally aligned on reqd. boundary"
#define STRING_DDERR_INVALIDDIRECTDRAWGUID			"The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier."
#define STRING_DDERR_DIRECTDRAWALREADYCREATED		"A DirectDraw object representing this driver has already been created for this process."
#define STRING_DDERR_NODIRECTDRAWHW					"A hardware only DirectDraw object creation was attempted but the driver did not support any hardware."
#define STRING_DDERR_PRIMARYSURFACEALREADYEXISTS	"this process already has created a primary surface"
#define STRING_DDERR_NOEMULATION					"software emulation not available."
#define STRING_DDERR_REGIONTOOSMALL					"region passed to Clipper::GetClipList is too small."
#define STRING_DDERR_CLIPPERISUSINGHWND				"an attempt was made to set a clip list for a clipper objec that is already monitoring an hwnd."
#define STRING_DDERR_NOCLIPPERATTACHED				"No clipper object attached to surface object"
#define STRING_DDERR_NOHWND							"Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND."
#define STRING_DDERR_HWNDSUBCLASSED					"HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state."
#define STRING_DDERR_HWNDALREADYSET					"The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created."
#define STRING_DDERR_NOPALETTEATTACHED				"No palette object attached to this surface."
#define STRING_DDERR_NOPALETTEHW					"No hardware support for 16 or 256 color palettes."
#define STRING_DDERR_BLTFASTCANTCLIP				"If a clipper object is attached to the source surface passed into a BltFast call."
#define STRING_DDERR_NOBLTHW						"No blter."
#define STRING_DDERR_NODDROPSHW						"No DirectDraw ROP hardware."
#define STRING_DDERR_OVERLAYNOTVISIBLE				"returned when GetOverlayPosition is called on a hidden overlay"
#define STRING_DDERR_NOOVERLAYDEST					"returned when GetOverlayPosition is called on a overlay that UpdateOverlay has never been called on to establish a destionation."
#define STRING_DDERR_INVALIDPOSITION				"returned when the position of the overlay on the destionation is no longer legal for that destionation."
#define STRING_DDERR_NOTAOVERLAYSURFACE				"returned when an overlay member is called for a non-overlay surface"
#define STRING_DDERR_EXCLUSIVEMODEALREADYSET		"An attempt was made to set the cooperative level when it was already set to exclusive."
#define STRING_DDERR_NOTFLIPPABLE					"An attempt has been made to flip a surface that is not flippable."
#define STRING_DDERR_CANTDUPLICATE					"Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created."
#define STRING_DDERR_NOTLOCKED						"Surface was not locked.  An attempt to unlock a surface that was not locked at all, or by this process, has been attempted."
#define STRING_DDERR_CANTCREATEDC					"Windows can not create any more DCs, or a DC was requested for a paltte-indexed surface when the surface had no palette AND the display mode was not palette-indexed (in this case DirectDraw cannot select a proper palette into the DC)"
#define STRING_DDERR_NODC							"No DC was ever created for this surface."
#define STRING_DDERR_WRONGMODE						"This surface can not be restored because it was created in a different mode."
#define STRING_DDERR_IMPLICITLYCREATED				"This surface can not be restored because it is an implicitly created surface."
#define STRING_DDERR_NOTPALETTIZED					"The surface being used is not a palette-based surface"
#define STRING_DDERR_UNSUPPORTEDMODE				"The display is currently in an unsupported mode"
#define STRING_DDERR_NOMIPMAPHW						"Operation could not be carried out because there is no mip-map texture mapping hardware present or available."
#define STRING_DDERR_INVALIDSURFACETYPE				"The requested action could not be performed because the surface was of the wrong type."
#define STRING_DDERR_NOOPTIMIZEHW					"Device does not support optimized surfaces, therefore no video memory optimized surfaces"
#define STRING_DDERR_NOTLOADED						"Surface is an optimized surface, but has not yet been allocated any memory"
#define STRING_DDERR_NOFOCUSWINDOW					"Attempt was made to create or set a device window without first setting the focus window"
#define STRING_DDERR_DCALREADYCREATED				"A DC has already been returned for this surface. Only one DC can be retrieved per surface."
#define STRING_DDERR_NONONLOCALVIDMEM				"An attempt was made to allocate non-local video memory from a device that does not support non-local video memory."
#define STRING_DDERR_CANTPAGELOCK					"The attempt to page lock a surface failed."
#define STRING_DDERR_CANTPAGEUNLOCK					"The attempt to page unlock a surface failed."
#define STRING_DDERR_NOTPAGELOCKED					"An attempt was made to page unlock a surface with no outstanding page locks."
#define STRING_DDERR_MOREDATA						"There is more data available than the specified buffer size could hold"
#define STRING_DDERR_EXPIRED						"The data has expired and is therefore no longer valid."
#define STRING_DDERR_VIDEONOTACTIVE					"The video port is not active"
#define STRING_DDERR_DEVICEDOESNTOWNSURFACE			"Surfaces created by one direct draw device cannot be used directly by another direct draw device."
#define STRING_DDERR_NOTINITIALIZED					"An attempt was made to invoke an interface member of a DirectDraw object created by CoCreateInstance() before it was initialized."



//-----------------------------------------------------------------------------
// DIRECT 3D ERRORS
//-----------------------------------------------------------------------------
#define STRING_D3DERR_BADMAJORVERSION				"Bad major version"
#define STRING_D3DERR_BADMINORVERSION				"Bad minor version"
#define STRING_D3DERR_INVALID_DEVICE				"Application requested invalid device"
#define STRING_D3DERR_INITFAILED					"Initialization failed"
#define STRING_D3DERR_DEVICEAGGREGATED				"SetRenderTarget attempted on a device that was QI'd off the render target."
#define STRING_D3DERR_EXECUTE_CREATE_FAILED			"EXECUTE_CREATE_FAILED"
#define STRING_D3DERR_EXECUTE_DESTROY_FAILED		"EXECUTE_DESTROY_FAILED"
#define STRING_D3DERR_EXECUTE_LOCK_FAILED			"EXECUTE_LOCK_FAILED"
#define STRING_D3DERR_EXECUTE_UNLOCK_FAILED			"EXECUTE_UNLOCK_FAILED"
#define STRING_D3DERR_EXECUTE_LOCKED				"EXECUTE_LOCKED"
#define STRING_D3DERR_EXECUTE_NOT_LOCKED			"EXECUTE_NOT_LOCKED"
#define STRING_D3DERR_EXECUTE_FAILED				"EXECUTE_FAILED"
#define STRING_D3DERR_EXECUTE_CLIPPED_FAILED		"EXECUTE_CLIPPED_FAILED"
#define STRING_D3DERR_TEXTURE_NO_SUPPORT			"TEXTURE_NO_SUPPORT"
#define STRING_D3DERR_TEXTURE_CREATE_FAILED			"TEXTURE_CREATE_FAILED"
#define STRING_D3DERR_TEXTURE_DESTROY_FAILED		"TEXTURE_DESTROY_FAILED"
#define STRING_D3DERR_TEXTURE_LOCK_FAILED			"TEXTURE_LOCK_FAILED"
#define STRING_D3DERR_TEXTURE_UNLOCK_FAILED			"TEXTURE_UNLOCK_FAILED"
#define STRING_D3DERR_TEXTURE_LOAD_FAILED			"TEXTURE_LOAD_FAILED"
#define STRING_D3DERR_TEXTURE_SWAP_FAILED			"TEXTURE_SWAP_FAILED"
#define STRING_D3DERR_TEXTURE_LOCKED				"TEXTURE_LOCKED"
#define STRING_D3DERR_TEXTURE_NOT_LOCKED			"TEXTURE_NOT_LOCKED"
#define STRING_D3DERR_TEXTURE_GETSURF_FAILED		"TEXTURE_GETSURF_FAILED"
#define STRING_D3DERR_MATRIX_CREATE_FAILED			"MATRIX_CREATE_FAILED"
#define STRING_D3DERR_MATRIX_DESTROY_FAILED			"MATRIX_DESTROY_FAILED"
#define STRING_D3DERR_MATRIX_SETDATA_FAILED			"MATRIX_SETDATA_FAILED"
#define STRING_D3DERR_MATRIX_GETDATA_FAILED			"MATRIX_GETDATA_FAILED"
#define STRING_D3DERR_SETVIEWPORTDATA_FAILED		"SETVIEWPORTDATA_FAILED"
#define STRING_D3DERR_INVALIDCURRENTVIEWPORT		"INVALIDCURRENTVIEWPORT"
#define STRING_D3DERR_INVALIDPRIMITIVETYPE			"INVALIDPRIMITIVETYPE"
#define STRING_D3DERR_INVALIDVERTEXTYPE				"INVALIDVERTEXTYPE"
#define STRING_D3DERR_TEXTURE_BADSIZE				"TEXTURE_BADSIZE"
#define STRING_D3DERR_INVALIDRAMPTEXTURE			"INVALIDRAMPTEXTURE"
#define STRING_D3DERR_MATERIAL_CREATE_FAILED		"MATERIAL_CREATE_FAILED"
#define STRING_D3DERR_MATERIAL_DESTROY_FAILED		"MATERIAL_DESTROY_FAILED"
#define STRING_D3DERR_MATERIAL_SETDATA_FAILED		"MATERIAL_DESTROY_FAILED"
#define STRING_D3DERR_MATERIAL_GETDATA_FAILED		"MATERIAL_GETDATA_FAILED"
#define STRING_D3DERR_INVALIDPALETTE				"INVALIDPALETTE"
#define STRING_D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY		"ZBUFF_NEEDS_SYSTEMMEMORY"
#define STRING_D3DERR_ZBUFF_NEEDS_VIDEOMEMORY		"ZBUFF_NEEDS_VIDEOMEMORY"
#define STRING_D3DERR_SURFACENOTINVIDMEM			"SURFACENOTINVIDMEM"
#define STRING_D3DERR_LIGHT_SET_FAILED				"LIGHT_SET_FAILED"
#define STRING_D3DERR_LIGHTHASVIEWPORT				"LIGHTHASVIEWPORT"
#define STRING_D3DERR_LIGHTNOTINTHISVIEWPORT		"LIGHTNOTINTHISVIEWPORT"
#define STRING_D3DERR_SCENE_IN_SCENE				"SCENE_IN_SCENE"
#define STRING_D3DERR_SCENE_NOT_IN_SCENE			"SCENE_NOT_IN_SCENE"
#define STRING_D3DERR_SCENE_BEGIN_FAILED			"SCENE_BEGIN_FAILED"
#define STRING_D3DERR_SCENE_END_FAILED				"SCENE_END_FAILED"
#define STRING_D3DERR_INBEGIN						"INBEGIN"
#define STRING_D3DERR_NOTINBEGIN					"NOTINBEGIN"
#define STRING_D3DERR_NOVIEWPORTS					"NOVIEWPORTS"
#define STRING_D3DERR_VIEWPORTDATANOTSET			"VIEWPORTDATANOTSET"
#define STRING_D3DERR_VIEWPORTHASNODEVICE			"VIEWPORTHASNODEVICE"
#define STRING_D3DERR_NOCURRENTVIEWPORT				"NOCURRENTVIEWPORT"
#define STRING_D3DERR_INVALIDVERTEXFORMAT			"INVALIDVERTEXFORMAT"
#define STRING_D3DERR_COLORKEYATTACHED				"COLORKEYATTACHED"
#define STRING_D3DERR_VERTEXBUFFEROPTIMIZED			"VERTEXBUFFEROPTIMIZED"
#define STRING_D3DERR_VBUF_CREATE_FAILED			"VBUF_CREATE_FAILED"
#define STRING_D3DERR_VERTEXBUFFERLOCKED			"VERTEXBUFFERLOCKED"
#define STRING_D3DERR_ZBUFFER_NOTPRESENT			"VERTEXBUFFERLOCKED"
#define STRING_D3DERR_STENCILBUFFER_NOTPRESENT		"VERTEXBUFFERLOCKED"
#define STRING_D3DERR_WRONGTEXTUREFORMAT			"WRONGTEXTUREFORMAT"
#define STRING_D3DERR_UNSUPPORTEDCOLOROPERATION		"UNSUPPORTEDCOLOROPERATION"
#define STRING_D3DERR_UNSUPPORTEDCOLORARG			"UNSUPPORTEDCOLORARG"
#define STRING_D3DERR_UNSUPPORTEDALPHAOPERATION		"UNSUPPORTEDALPHAOPERATION"
#define STRING_D3DERR_UNSUPPORTEDALPHAARG			"UNSUPPORTEDALPHAARG"
#define STRING_D3DERR_TOOMANYOPERATIONS				"TOOMANYOPERATIONS"
#define STRING_D3DERR_CONFLICTINGTEXTUREFILTER		"CONFLICTINGTEXTUREFILTER"
#define STRING_D3DERR_UNSUPPORTEDFACTORVALUE		"UNSUPPORTEDFACTORVALUE"
#define STRING_D3DERR_CONFLICTINGRENDERSTATE		"UNSUPPORTEDFACTORVALUE"
#define STRING_D3DERR_UNSUPPORTEDTEXTUREFILTER		"UNSUPPORTEDTEXTUREFILTER"
#define STRING_D3DERR_TOOMANYPRIMITIVES				"TOOMANYPRIMITIVES"
#define STRING_D3DERR_INVALIDMATRIX					"INVALIDMATRIX"
#define STRING_D3DERR_TOOMANYVERTICES				"TOOMANYVERTICES"
#define STRING_D3DERR_CONFLICTINGTEXTUREPALETTE		"CONFLICTINGTEXTUREPALETTE"