- GBPSLib compiles now with the final filestrutcure of G3D
[genesis3d.git] / G3D / Drivers / D3D7xDrv / D3D_ERR.CPP
1 /****************************************************************************************/\r
2 /*  D3D_Err.cpp                                                                         */\r
3 /*                                                                                      */\r
4 /*  Author: John Pollard                                                                */\r
5 /*  Description: D3D Error code conversions                                             */\r
6 /*                                                                                      */\r
7 /*  The contents of this file are subject to the Genesis3D Public License               */\r
8 /*  Version 1.01 (the "License"); you may not use this file except in                   */\r
9 /*  compliance with the License. You may obtain a copy of the License at                */\r
10 /*  http://www.genesis3d.com                                                            */\r
11 /*                                                                                      */\r
12 /*  Software distributed under the License is distributed on an "AS IS"                 */\r
13 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */\r
14 /*  the License for the specific language governing rights and limitations              */\r
15 /*  under the License.                                                                  */\r
16 /*                                                                                      */\r
17 /*  The Original Code is Genesis3D, released March 25, 1999.                            */\r
18 /*Genesis3D Version 1.1 released November 15, 1999                            */\r
19 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */\r
20 /*                                                                                      */\r
21 /****************************************************************************************/\r
22 #include <Windows.h>\r
23 #include <DDraw.h>\r
24 #include <D3D.h>\r
25 \r
26 #include "D3D_Err.h"\r
27 \r
28 //================================================================================\r
29 //      D3DErrorToString\r
30 //================================================================================\r
31 char *D3DErrorToString(HRESULT error)\r
32 {\r
33   switch(error) {\r
34   case DD_OK:\r
35     return "No error.\0";\r
36   case DDERR_ALREADYINITIALIZED:\r
37     return "This object is already initialized.\0";\r
38   case DDERR_BLTFASTCANTCLIP:\r
39     return "Return if a clipper object is attached to the source surface passed into a BltFast call.\0";\r
40   case DDERR_CANNOTATTACHSURFACE:\r
41     return "This surface can not be attached to the requested surface.\0";\r
42   case DDERR_CANNOTDETACHSURFACE:\r
43     return "This surface can not be detached from the requested surface.\0";\r
44   case DDERR_CANTCREATEDC:\r
45     return "Windows can not create any more DCs.\0";\r
46   case DDERR_CANTDUPLICATE:\r
47     return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.\0";\r
48   case DDERR_CLIPPERISUSINGHWND:\r
49     return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.\0";\r
50   case DDERR_COLORKEYNOTSET:\r
51     return "No src color key specified for this operation.\0";\r
52   case DDERR_CURRENTLYNOTAVAIL:\r
53     return "Support is currently not available.\0";\r
54   case DDERR_DIRECTDRAWALREADYCREATED:\r
55     return "A DirectDraw object representing this driver has already been created for this process.\0";\r
56   case DDERR_EXCEPTION:\r
57     return "An exception was encountered while performing the requested operation.\0";\r
58   case DDERR_EXCLUSIVEMODEALREADYSET:\r
59     return "An attempt was made to set the cooperative level when it was already set to exclusive.\0";\r
60   case DDERR_GENERIC:\r
61     return "Generic failure.\0";\r
62   case DDERR_HEIGHTALIGN:\r
63     return "Height of rectangle provided is not a multiple of reqd alignment.\0";\r
64   case DDERR_HWNDALREADYSET:\r
65     return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.\0";\r
66   case DDERR_HWNDSUBCLASSED:\r
67     return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.\0";\r
68   case DDERR_IMPLICITLYCREATED:\r
69     return "This surface can not be restored because it is an implicitly created surface.\0";\r
70   case DDERR_INCOMPATIBLEPRIMARY:\r
71     return "Unable to match primary surface creation request with existing primary surface.\0";\r
72   case DDERR_INVALIDCAPS:\r
73     return "One or more of the caps bits passed to the callback are incorrect.\0";\r
74   case DDERR_INVALIDCLIPLIST:\r
75     return "DirectDraw does not support the provided cliplist.\0";\r
76   case DDERR_INVALIDDIRECTDRAWGUID:\r
77     return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.\0";\r
78   case DDERR_INVALIDMODE:\r
79     return "DirectDraw does not support the requested mode.\0";\r
80   case DDERR_INVALIDOBJECT:\r
81     return "DirectDraw received a pointer that was an invalid DIRECTDRAW object.\0";\r
82   case DDERR_INVALIDPARAMS:\r
83     return "One or more of the parameters passed to the function are incorrect.\0";\r
84   case DDERR_INVALIDPIXELFORMAT:\r
85     return "The pixel format was invalid as specified.\0";\r
86   case DDERR_INVALIDPOSITION:\r
87     return "Returned when the position of the overlay on the destination is no longer legal for that destination.\0";\r
88   case DDERR_INVALIDRECT:\r
89     return "Rectangle provided was invalid.\0";\r
90   case DDERR_LOCKEDSURFACES:\r
91     return "Operation could not be carried out because one or more surfaces are locked.\0";\r
92   case DDERR_NO3D:\r
93     return "There is no 3D present.\0";\r
94   case DDERR_NOALPHAHW:\r
95     return "Operation could not be carried out because there is no alpha accleration hardware present or available.\0";\r
96   case DDERR_NOBLTHW:\r
97     return "No blitter hardware present.\0";\r
98   case DDERR_NOCLIPLIST:\r
99     return "No cliplist available.\0";\r
100   case DDERR_NOCLIPPERATTACHED:\r
101     return "No clipper object attached to surface object.\0";\r
102   case DDERR_NOCOLORCONVHW:\r
103     return "Operation could not be carried out because there is no color conversion hardware present or available.\0";\r
104   case DDERR_NOCOLORKEY:\r
105     return "Surface doesn't currently have a color key\0";\r
106   case DDERR_NOCOLORKEYHW:\r
107     return "Operation could not be carried out because there is no hardware support of the destination color key.\0";\r
108   case DDERR_NOCOOPERATIVELEVELSET:\r
109     return "Create function called without DirectDraw object method SetCooperativeLevel being called.\0";\r
110   case DDERR_NODC:\r
111     return "No DC was ever created for this surface.\0";\r
112   case DDERR_NODDROPSHW:\r
113     return "No DirectDraw ROP hardware.\0";\r
114   case DDERR_NODIRECTDRAWHW:\r
115     return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.\0";\r
116   case DDERR_NOEMULATION:\r
117     return "Software emulation not available.\0";\r
118   case DDERR_NOEXCLUSIVEMODE:\r
119     return "Operation requires the application to have exclusive mode but the application does not have exclusive mode.\0";\r
120   case DDERR_NOFLIPHW:\r
121     return "Flipping visible surfaces is not supported.\0";\r
122   case DDERR_NOGDI:\r
123     return "There is no GDI present.\0";\r
124   case DDERR_NOHWND:\r
125     return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.\0";\r
126   case DDERR_NOMIRRORHW:\r
127     return "Operation could not be carried out because there is no hardware present or available.\0";\r
128   case DDERR_NOOVERLAYDEST:\r
129     return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.\0";\r
130   case DDERR_NOOVERLAYHW:\r
131     return "Operation could not be carried out because there is no overlay hardware present or available.\0";\r
132   case DDERR_NOPALETTEATTACHED:\r
133     return "No palette object attached to this surface.\0";\r
134   case DDERR_NOPALETTEHW:\r
135     return "No hardware support for 16 or 256 color palettes.\0";\r
136   case DDERR_NORASTEROPHW:\r
137     return "Operation could not be carried out because there is no appropriate raster op hardware present or available.\0";\r
138   case DDERR_NOROTATIONHW:\r
139     return "Operation could not be carried out because there is no rotation hardware present or available.\0";\r
140   case DDERR_NOSTRETCHHW:\r
141     return "Operation could not be carried out because there is no hardware support for stretching.\0";\r
142   case DDERR_NOT4BITCOLOR:\r
143     return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.\0";\r
144   case DDERR_NOT4BITCOLORINDEX:\r
145     return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.\0";\r
146   case DDERR_NOT8BITCOLOR:\r
147     return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.\0";\r
148   case DDERR_NOTAOVERLAYSURFACE:\r
149     return "Returned when an overlay member is called for a non-overlay surface.\0";\r
150   case DDERR_NOTEXTUREHW:\r
151     return "Operation could not be carried out because there is no texture mapping hardware present or available.\0";\r
152   case DDERR_NOTFLIPPABLE:\r
153     return "An attempt has been made to flip a surface that is not flippable.\0";\r
154   case DDERR_NOTFOUND:\r
155     return "Requested item was not found.\0";\r
156   case DDERR_NOTLOCKED:\r
157     return "Surface was not locked.  An attempt to unlock a surface that was not locked at all, or by this process, has been attempted.\0";\r
158   case DDERR_NOTPALETTIZED:\r
159     return "The surface being used is not a palette-based surface.\0";\r
160   case DDERR_NOVSYNCHW:\r
161     return "Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.\0";\r
162   case DDERR_NOZBUFFERHW:\r
163     return "Operation could not be carried out because there is no hardware support for zbuffer blitting.\0";\r
164   case DDERR_NOZOVERLAYHW:\r
165     return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.\0";\r
166   case DDERR_OUTOFCAPS:\r
167     return "The hardware needed for the requested operation has already been allocated.\0";\r
168   case DDERR_OUTOFMEMORY:\r
169     return "DirectDraw does not have enough memory to perform the operation.\0";\r
170   case DDERR_OUTOFVIDEOMEMORY:\r
171     return "DirectDraw does not have enough video memory to perform the operation.\0";\r
172   case DDERR_OVERLAYCANTCLIP:\r
173     return "The hardware does not support clipped overlays.\0";\r
174   case DDERR_OVERLAYCOLORKEYONLYONEACTIVE:\r
175     return "Can only have ony color key active at one time for overlays.\0";\r
176   case DDERR_OVERLAYNOTVISIBLE:\r
177     return "Returned when GetOverlayPosition is called on a hidden overlay.\0";\r
178   case DDERR_PALETTEBUSY:\r
179     return "Access to this palette is being refused because the palette is already locked by another thread.\0";\r
180   case DDERR_PRIMARYSURFACEALREADYEXISTS:\r
181     return "This process already has created a primary surface.\0";\r
182   case DDERR_REGIONTOOSMALL:\r
183     return "Region passed to Clipper::GetClipList is too small.\0";\r
184   case DDERR_SURFACEALREADYATTACHED:\r
185     return "This surface is already attached to the surface it is being attached to.\0";\r
186   case DDERR_SURFACEALREADYDEPENDENT:\r
187     return "This surface is already a dependency of the surface it is being made a dependency of.\0";\r
188   case DDERR_SURFACEBUSY:\r
189     return "Access to this surface is being refused because the surface is already locked by another thread.\0";\r
190   case DDERR_SURFACEISOBSCURED:\r
191     return "Access to surface refused because the surface is obscured.\0";\r
192   case DDERR_SURFACELOST:\r
193     return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.\0";\r
194   case DDERR_SURFACENOTATTACHED:\r
195     return "The requested surface is not attached.\0";\r
196   case DDERR_TOOBIGHEIGHT:\r
197     return "Height requested by DirectDraw is too large.\0";\r
198   case DDERR_TOOBIGSIZE:\r
199     return "Size requested by DirectDraw is too large, but the individual height and width are OK.\0";\r
200   case DDERR_TOOBIGWIDTH:\r
201     return "Width requested by DirectDraw is too large.\0";\r
202   case DDERR_UNSUPPORTED:\r
203     return "Action not supported.\0";\r
204   case DDERR_UNSUPPORTEDFORMAT:\r
205     return "FOURCC format requested is unsupported by DirectDraw.\0";\r
206   case DDERR_UNSUPPORTEDMASK:\r
207     return "Bitmask in the pixel format requested is unsupported by DirectDraw.\0";\r
208   case DDERR_VERTICALBLANKINPROGRESS:\r
209     return "Vertical blank is in progress.\0";\r
210   case DDERR_WASSTILLDRAWING:\r
211     return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.\0";\r
212   case DDERR_WRONGMODE:\r
213     return "This surface can not be restored because it was created in a different mode.\0";\r
214   case DDERR_XALIGN:\r
215     return "Rectangle provided was not horizontally aligned on required boundary.\0";\r
216   case D3DERR_BADMAJORVERSION:\r
217     return "D3DERR_BADMAJORVERSION\0";\r
218   case D3DERR_BADMINORVERSION:\r
219     return "D3DERR_BADMINORVERSION\0";\r
220   case D3DERR_EXECUTE_LOCKED:\r
221     return "D3DERR_EXECUTE_LOCKED\0";\r
222   case D3DERR_EXECUTE_NOT_LOCKED:\r
223     return "D3DERR_EXECUTE_NOT_LOCKED\0";\r
224   case D3DERR_EXECUTE_CREATE_FAILED:\r
225     return "D3DERR_EXECUTE_CREATE_FAILED\0";\r
226   case D3DERR_EXECUTE_DESTROY_FAILED:\r
227     return "D3DERR_EXECUTE_DESTROY_FAILED\0";\r
228   case D3DERR_EXECUTE_LOCK_FAILED:\r
229     return "D3DERR_EXECUTE_LOCK_FAILED\0";\r
230   case D3DERR_EXECUTE_UNLOCK_FAILED:\r
231     return "DDERR_EXECUTE_UNLOCK_FAILED\0";\r
232   case D3DERR_EXECUTE_FAILED:\r
233     return "D3DERR_EXECUTE_FAILED\0";\r
234   case D3DERR_EXECUTE_CLIPPED_FAILED:\r
235     return "D3DERR_EXECUTE_CLIPPED_FAILED\0";\r
236   case D3DERR_TEXTURE_NO_SUPPORT:\r
237     return "D3DERR_TEXTURE_NO_SUPPORT\0";\r
238   case D3DERR_TEXTURE_NOT_LOCKED:\r
239     return "D3DERR_TEXTURE_NOT_LOCKED\0";\r
240   case D3DERR_TEXTURE_LOCKED:\r
241     return "D3DERR_TEXTURELOCKED\0";\r
242   case D3DERR_TEXTURE_CREATE_FAILED:\r
243     return "D3DERR_TEXTURE_CREATE_FAILED\0";\r
244   case D3DERR_TEXTURE_DESTROY_FAILED:\r
245     return "D3DERR_TEXTURE_DESTROY_FAILED\0";\r
246   case D3DERR_TEXTURE_LOCK_FAILED:\r
247     return "D3DERR_TEXTURE_LOCK_FAILED\0";\r
248   case D3DERR_TEXTURE_UNLOCK_FAILED:\r
249     return "D3DERR_TEXTURE_UNLOCK_FAILED\0";\r
250   case D3DERR_TEXTURE_LOAD_FAILED:\r
251     return "D3DERR_TEXTURE_LOAD_FAILED\0";\r
252   case D3DERR_MATRIX_CREATE_FAILED:\r
253     return "D3DERR_MATRIX_CREATE_FAILED\0";\r
254   case D3DERR_MATRIX_DESTROY_FAILED:\r
255     return "D3DERR_MATRIX_DESTROY_FAILED\0";\r
256   case D3DERR_MATRIX_SETDATA_FAILED:\r
257     return "D3DERR_MATRIX_SETDATA_FAILED\0";\r
258   case D3DERR_SETVIEWPORTDATA_FAILED:\r
259     return "D3DERR_SETVIEWPORTDATA_FAILED\0";\r
260   case D3DERR_MATERIAL_CREATE_FAILED:\r
261     return "D3DERR_MATERIAL_CREATE_FAILED\0";\r
262   case D3DERR_MATERIAL_DESTROY_FAILED:\r
263     return "D3DERR_MATERIAL_DESTROY_FAILED\0";\r
264   case D3DERR_MATERIAL_SETDATA_FAILED:\r
265     return "D3DERR_MATERIAL_SETDATA_FAILED\0";\r
266   case D3DERR_LIGHT_SET_FAILED:\r
267     return "D3DERR_LIGHT_SET_FAILED\0";\r
268   default:\r
269     return "Unrecognized error value.\0";\r
270     }\r
271 }\r