source: golgotha/src/i4/video/win32/dx5_error.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 14 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 16.8 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include <ddraw.h>
10#include <windows.h>
11#include "arch.hh"
12#include "error/error.hh"
13
14#ifdef DEBUG
15
16i4_bool i4_dx5_check(HRESULT res)
17{
18  if (res==DD_OK) return 1;
19
20  switch (res)
21  {
22    case DDERR_ALREADYINITIALIZED :
23      i4_warning("The object has already been initialized. ");
24      break;
25    case DDERR_BLTFASTCANTCLIP :
26      i4_warning("A DirectDrawClipper object is attached to a source surface that has "
27                 "passed into a call to the IDirectDrawSurface2::BltFast method. ");
28      break;
29    case DDERR_CANNOTATTACHSURFACE :
30      i4_warning("A surface cannot be attached to another requested surface. ");
31      break;
32    case DDERR_CANNOTDETACHSURFACE :
33      i4_warning("A surface cannot be detached from another requested surface. ");
34      break;
35    case DDERR_CANTCREATEDC :
36      i4_warning("Windows cannot create any more device contexts (DCs). ");
37      break;
38    case DDERR_CANTDUPLICATE :
39      i4_warning("Primary and 3-D surfaces, or surfaces that are implicitly created, "
40                 "cannot be duplicated. ");
41      break;
42    case DDERR_CANTLOCKSURFACE :
43      i4_warning("Access to this surface is refused because an attempt was made to lock "
44                 "the primary surface without DCI support. ");
45      break;
46    case DDERR_CANTPAGELOCK :
47      i4_warning("An attempt to page lock a surface failed. Page lock will not work on a "
48                 "display-memory surface or an emulated primary surface. ");
49      break;
50    case DDERR_CANTPAGEUNLOCK :
51      i4_warning("An attempt to page unlock a surface failed. Page unlock will not work "
52                 "on a display-memory surface or an emulated primary surface. ");
53      break;
54    case DDERR_CLIPPERISUSINGHWND :
55      i4_warning("An attempt was made to set a clip list for a DirectDrawClipper object "
56                 "that is already monitoring a window handle. ");
57      break;
58    case DDERR_COLORKEYNOTSET :
59      i4_warning("No source color key is specified for this operation. ");
60      break;
61    case DDERR_CURRENTLYNOTAVAIL :
62      i4_warning("No support is currently available. ");
63      break;
64    case DDERR_DCALREADYCREATED :
65      i4_warning("A device context (DC) has already been returned for this surface. Only "
66                 "one DC can be retrieved for each surface. ");
67      break;
68    case DDERR_DEVICEDOESNTOWNSURFACE:
69      i4_warning("Surfaces created by one direct draw device cannot be used directly by "
70                 "another direct draw device.");
71      break;
72    case DDERR_DIRECTDRAWALREADYCREATED :
73      i4_warning("A DirectDraw object representing this driver has already been created "
74                 "for this process. ");
75      break;
76    case DDERR_EXCEPTION :
77      i4_warning("An exception was encountered while performing the requested operation. ");
78      break;
79    case DDERR_EXCLUSIVEMODEALREADYSET :
80      i4_warning("An attempt was made to set the cooperative level when it was already set "
81                 "to exclusive. ");
82      break;
83    case DDERR_GENERIC :
84      i4_warning("There is an undefined error condition. ");
85      break;
86    case DDERR_HEIGHTALIGN :
87      i4_warning("The height of the provided rectangle is not a multiple of the "
88                 "required alignment. ");
89      break;
90    case DDERR_HWNDALREADYSET :
91      i4_warning("The DirectDraw cooperative level window handle has already been set. "
92                 "It cannot be reset while the process has surfaces or palettes created. ");
93      break;
94    case DDERR_HWNDSUBCLASSED :
95      i4_warning("DirectDraw is prevented from restoring state because the DirectDraw "
96                 "cooperative level window handle has been subclassed. ");
97      break;
98    case DDERR_IMPLICITLYCREATED :
99      i4_warning("The surface cannot be restored because it is an implicitly created surface. ");
100      break;
101    case DDERR_INCOMPATIBLEPRIMARY :
102      i4_warning("The primary surface creation request does not match with the existing "
103                 "primary surface. ");
104      break;
105    case DDERR_INVALIDCAPS :
106      i4_warning("One or more of the capability bits passed to the callback function are "
107                 "incorrect. ");
108      break;
109    case DDERR_INVALIDCLIPLIST :
110      i4_warning("DirectDraw does not support the provided clip list. ");
111      break;
112    case DDERR_INVALIDDIRECTDRAWGUID :
113      i4_warning("The globally unique identifier (GUID) passed to the DirectDrawCreate "
114                 "function is not a valid DirectDraw driver identifier. ");
115      break;
116    case DDERR_INVALIDMODE :
117      i4_warning("DirectDraw does not support the requested mode. ");
118      break;
119    case DDERR_INVALIDOBJECT :
120      i4_warning("DirectDraw received a pointer that was an invalid DirectDraw object. ");
121      break;
122    case DDERR_INVALIDPARAMS :
123      i4_warning("One or more of the parameters passed to the method are incorrect. ");
124      break;
125    case DDERR_INVALIDPIXELFORMAT :
126      i4_warning("The pixel format was invalid as specified. ");
127      break;
128    case DDERR_INVALIDPOSITION :
129      i4_warning("The position of the overlay on the destination is no longer legal. ");
130      break;
131    case DDERR_INVALIDRECT :
132      i4_warning("The provided rectangle was invalid. ");
133      break;
134    case DDERR_INVALIDSURFACETYPE :
135      i4_warning("The requested operation could not be performed because the surface was "
136                 "of the wrong type. ");
137      break;
138    case DDERR_LOCKEDSURFACES :
139      i4_warning("One or more surfaces are locked, causing the failure of the requested "
140                 "operation. ");
141      break;
142    case DDERR_MOREDATA:
143      i4_warning("There is more data available than the specified buffer size can hold.");
144      break;
145    case DDERR_NO3D :
146      i4_warning("No 3-D hardware or emulation is present. ");
147      break;
148    case DDERR_NOALPHAHW :
149      i4_warning("No alpha acceleration hardware is present or available, causing the "
150                 "failure of the requested operation. ");
151      break;
152    case DDERR_NOBLTHW :
153      i4_warning("No blitter hardware is present. ");
154      break;
155    case DDERR_NOCLIPLIST :
156      i4_warning("No clip list is available. ");
157      break;
158    case DDERR_NOCLIPPERATTACHED :
159      i4_warning("No DirectDrawClipper object is attached to the surface object. ");
160      break;
161    case DDERR_NOCOLORCONVHW :
162      i4_warning("The operation cannot be carried out because no color-conversion hardware "
163                 "is present or available. ");
164      break;
165    case DDERR_NOCOLORKEY :
166      i4_warning("The surface does not currently have a color key. ");
167      break;
168    case DDERR_NOCOLORKEYHW :
169      i4_warning("The operation cannot be carried out because there is no hardware support "
170                 "for the destination color key. ");
171      break;
172    case DDERR_NOCOOPERATIVELEVELSET :
173      i4_warning("A create function is called without the IDirectDraw2::SetCooperativeLevel "
174                 "method being called. ");
175      break;
176    case DDERR_NODC :
177      i4_warning("No DC has ever been created for this surface. ");
178      break;
179    case DDERR_NODDROPSHW :
180      i4_warning("No DirectDraw raster operation (ROP) hardware is available. ");
181      break;
182    case DDERR_NODIRECTDRAWHW :
183      i4_warning("Hardware-only DirectDraw object creation is not possible; the driver does "
184                 "not support any hardware. ");
185      break;
186    case DDERR_NODIRECTDRAWSUPPORT :
187      i4_warning("DirectDraw support is not possible with the current display driver. ");
188      break;
189    case DDERR_NOEMULATION :
190      i4_warning("Software emulation is not available. ");
191      break;
192    case DDERR_NOEXCLUSIVEMODE :
193      i4_warning("The operation requires the application to have exclusive mode, but the "
194                 "application does not have exclusive mode. ");
195      break;
196    case DDERR_NOFLIPHW :
197      i4_warning("Flipping visible surfaces is not supported. ");
198      break;
199    case DDERR_NOGDI :
200      i4_warning("No GDI is present. ");
201      break;
202    case DDERR_NOHWND :
203      i4_warning("Clipper notification requires a window handle, or no window handle has "
204                 "been previously set as the cooperative level window handle. ");
205      break;
206    case DDERR_NOMIPMAPHW :
207      i4_warning("The operation cannot be carried out because no mipmap texture mapping "
208                 "hardware is present or available. ");
209      break;
210    case DDERR_NOMIRRORHW :
211      i4_warning("The operation cannot be carried out because no mirroring hardware is "
212                 "present or available. ");
213      break;
214    case DDERR_NOOVERLAYDEST :
215      i4_warning("The IDirectDrawSurface2::GetOverlayPosition method is called on an "
216                 "overlay that the IDirectDrawSurface2::UpdateOverlay method has not "
217                 "been called on to establish a destination. ");
218      break;
219    case DDERR_NOOVERLAYHW :
220      i4_warning("The operation cannot be carried out because no overlay hardware is "
221                 "present or available. ");
222      break;
223    case DDERR_NOPALETTEATTACHED :
224      i4_warning("No palette object is attached to this surface. ");
225      break;
226    case DDERR_NOPALETTEHW :
227      i4_warning("There is no hardware support for 16- or 256-color palettes. ");
228      break;
229    case DDERR_NORASTEROPHW :
230      i4_warning("The operation cannot be carried out because no appropriate raster "
231                 "operation hardware is present or available. ");
232      break;
233    case DDERR_NOROTATIONHW :
234      i4_warning("The operation cannot be carried out because no rotation hardware is "
235                 "present or available. ");
236      break;
237    case DDERR_NOSTRETCHHW :
238      i4_warning("The operation cannot be carried out because there is no hardware support "
239                 "for stretching. ");
240      break;
241    case DDERR_NOT4BITCOLOR :
242      i4_warning("The DirectDrawSurface object is not using a 4-bit color palette and "
243                 "the requested operation requires a 4-bit color palette. ");
244      break;
245    case DDERR_NOT4BITCOLORINDEX :
246      i4_warning("The DirectDrawSurface object is not using a 4-bit color index palette "
247                 "and the requested operation requires a 4-bit color index palette. ");
248      break;
249    case DDERR_NOT8BITCOLOR :
250      i4_warning("The DirectDrawSurface object is not using an 8-bit color palette "
251                 "and the requested operation requires an 8-bit color palette. ");
252      break;
253    case DDERR_NOTAOVERLAYSURFACE :
254      i4_warning("An overlay component is called for a non-overlay surface. ");
255      break;
256    case DDERR_NOTEXTUREHW :
257      i4_warning("The operation cannot be carried out because no texture-mapping "
258                 "hardware is present or available. ");
259      break;
260    case DDERR_NOTFLIPPABLE :
261      i4_warning("An attempt has been made to flip a surface that cannot be flipped. ");
262      break;
263    case DDERR_NOTFOUND :
264      i4_warning("The requested item was not found. ");
265      break;
266    case DDERR_NOTINITIALIZED :
267      i4_warning("An attempt was made to call an interface method of a DirectDraw "
268                 "object created by CoCreateInstance before the object was initialized. ");
269      break;
270    case DDERR_NOTLOCKED :
271      i4_warning("An attempt is made to unlock a surface that was not locked. ");
272      break;
273    case DDERR_NOTPAGELOCKED :
274      i4_warning("An attempt is made to page unlock a surface with no outstanding page locks. ");
275      break;
276    case DDERR_NOTPALETTIZED :
277      i4_warning("The surface being used is not a palette-based surface. ");
278      break;
279    case DDERR_NOVSYNCHW :
280      i4_warning("The operation cannot be carried out because there is no hardware support "
281                 "for vertical blank synchronized operations. ");
282      break;
283    case DDERR_NOZBUFFERHW :
284      i4_warning("The operation to create a z-buffer in display memory or to perform a "
285                 "blit using a z-buffer cannot be carried out because there is no hardware "
286                 "support for z-buffers. ");
287      break;
288    case DDERR_NOZOVERLAYHW :
289      i4_warning("The overlay surfaces cannot be z-layered based on the z-order "
290                 "because the hardware does not support z-ordering of overlays. ");
291      break;
292    case DDERR_OUTOFCAPS :
293      i4_warning("The hardware needed for the requested operation has already been allocated. ");
294      break;
295    case DDERR_OUTOFMEMORY :
296      i4_warning("DirectDraw does not have enough memory to perform the operation. ");
297      break;
298    case DDERR_OUTOFVIDEOMEMORY :
299      i4_warning("DirectDraw does not have enough display memory to perform the operation. ");
300      break;
301    case DDERR_OVERLAYCANTCLIP :
302      i4_warning("The hardware does not support clipped overlays. ");
303      break;
304    case DDERR_OVERLAYCOLORKEYONLYONEACTIVE :
305      i4_warning("An attempt was made to have more than one color key active on an overlay.  ");
306      break;
307    case DDERR_OVERLAYNOTVISIBLE :
308      i4_warning("The IDirectDrawSurface2::GetOverlayPosition method is called on a "
309                 "hidden overlay. ");
310      break;
311    case DDERR_PALETTEBUSY :
312      i4_warning("Access to this palette is refused because the palette is locked by "
313                 "another thread. ");
314      break;
315    case DDERR_PRIMARYSURFACEALREADYEXISTS :
316      i4_warning("This process has already created a primary surface. ");
317      break;
318    case DDERR_REGIONTOOSMALL :
319      i4_warning("The region passed to the IDirectDrawClipper::GetClipList method is too small. ");
320      break;
321    case DDERR_SURFACEALREADYATTACHED :
322      i4_warning("An attempt was made to attach a surface to another surface to which it"
323                 " is already attached. ");
324      break;
325    case DDERR_SURFACEALREADYDEPENDENT :
326      i4_warning("An attempt was made to make a surface a dependency of another "
327                 "surface to which it is already dependent. ");
328      break;
329    case DDERR_SURFACEBUSY :
330      i4_warning("Access to the surface is refused because the surface is "
331                 "locked by another thread. ");
332      break;
333    case DDERR_SURFACEISOBSCURED :
334      i4_warning("Access to the surface is refused because the surface is obscured. ");
335      break;
336    case DDERR_SURFACELOST :
337      i4_warning("Access to the surface is refused because the surface memory is gone. "
338                 "The DirectDrawSurface object representing this surface should have the "
339                 "IDirectDrawSurface2::Restore method called on it. ");
340      break;
341    case DDERR_SURFACENOTATTACHED :
342      i4_warning("The requested surface is not attached. ");
343      break;
344    case DDERR_TOOBIGHEIGHT :
345      i4_warning("The height requested by DirectDraw is too large. ");
346      break;
347    case DDERR_TOOBIGSIZE :
348      i4_warning("The size requested by DirectDraw is too large. "
349                 "However, the individual height and width are OK. ");
350      break;
351    case DDERR_TOOBIGWIDTH :
352      i4_warning("The width requested by DirectDraw is too large. ");
353      break;
354    case DDERR_UNSUPPORTED :
355      i4_warning("The operation is not supported. ");
356      break;
357    case DDERR_UNSUPPORTEDFORMAT :
358      i4_warning("The FourCC format requested is not supported by DirectDraw. ");
359      break;
360    case DDERR_UNSUPPORTEDMASK :
361      i4_warning("The bitmask in the pixel format requested is not supported by DirectDraw. ");
362      break;
363    case DDERR_UNSUPPORTEDMODE :
364      i4_warning("The display is currently in an unsupported mode. ");
365      break;
366    case DDERR_VERTICALBLANKINPROGRESS :
367      i4_warning("A vertical blank is in progress. ");
368      break;
369    case DDERR_VIDEONOTACTIVE:
370      i4_warning("The video port is not active.");
371      break;
372    case DDERR_WASSTILLDRAWING :
373      i4_warning("The previous blit operation that is transferring information "
374                 "to or from this surface is incomplete. ");
375      break;
376    case DDERR_WRONGMODE :
377      i4_warning("This surface cannot be restored because it was created in a different mode. ");
378      break;
379    case DDERR_XALIGN :
380      i4_warning("The provided rectangle was not horizontally aligned on a required boundary.");
381      break;
382  }
383  return 0;
384}
385
386#endif
Note: See TracBrowser for help on using the repository browser.