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 | #ifdef _WINDOWS
|
---|
10 | //#define INITGUID
|
---|
11 |
|
---|
12 | #include "video/win32/directx.hh"
|
---|
13 | #include "device/event.hh"
|
---|
14 | #include <d3d.h>
|
---|
15 | #include <d3drm.h>
|
---|
16 | //#include "video/win32/dx_cursor.hh"
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | // this should be defined in main/win_main
|
---|
20 | extern HINSTANCE my_instance;
|
---|
21 | extern int my_nCmdShow;
|
---|
22 |
|
---|
23 | extern sw32 win32_mouse_x, win32_mouse_y;
|
---|
24 |
|
---|
25 | static directx_display_class directx_display_instance;
|
---|
26 |
|
---|
27 | char* D3DAppErrorToString(HRESULT error);
|
---|
28 |
|
---|
29 | void dx_error(sw32 result)
|
---|
30 | {
|
---|
31 | i4_error(D3DAppErrorToString(result));
|
---|
32 | }
|
---|
33 |
|
---|
34 | // called when windows gives us a WM_MOVE message, this tells everyone else interested
|
---|
35 | void directx_display_class::move_screen(i4_coord x, i4_coord y)
|
---|
36 | {
|
---|
37 |
|
---|
38 | if (back_buffer) // make sure the screen has been created so far
|
---|
39 | {
|
---|
40 | // if the location is not word alligned move the
|
---|
41 | // window and exit (we will get another message later when this takes effect)
|
---|
42 | if (x&3)
|
---|
43 | {
|
---|
44 | SetWindowPos(input.get_window_handle(),
|
---|
45 | HWND_TOP,
|
---|
46 | x&(~3),y,
|
---|
47 | cur_mode.xres,
|
---|
48 | cur_mode.yres,
|
---|
49 | 0);
|
---|
50 | return ;
|
---|
51 | }
|
---|
52 | }
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 | i4_bool directx_display_class::set_mouse_shape(i4_cursor_class *c)
|
---|
59 |
|
---|
60 | {
|
---|
61 | return i4_T;
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 | directx_display_class::directx_display_class()
|
---|
66 | {
|
---|
67 | mouse_pict=0;
|
---|
68 | mouse_save=0;
|
---|
69 | mouse_trans=0;
|
---|
70 |
|
---|
71 | context=0;
|
---|
72 | direct_draw_driver=0;
|
---|
73 | primary_surface=0;
|
---|
74 | exclusive_mode=i4_F;
|
---|
75 | full_screen=i4_F;
|
---|
76 | back_buffer=0;
|
---|
77 | back_surface=0;
|
---|
78 | }
|
---|
79 |
|
---|
80 |
|
---|
81 |
|
---|
82 | HRESULT __stdcall dx_mode_callback(LPDDSURFACEDESC desc, LPVOID context)
|
---|
83 | {
|
---|
84 | directx_display_class *dx=(directx_display_class *)context;
|
---|
85 |
|
---|
86 | if (((desc->ddpfPixelFormat.dwRGBBitCount+1)&(~1)) == I4_BYTES_PER_PIXEL*8)
|
---|
87 | {
|
---|
88 | if (dx->last_found &&
|
---|
89 | dx->last_found->xres==desc->dwWidth &&
|
---|
90 | dx->last_found->yres==desc->dwHeight)
|
---|
91 | dx->saw_last=i4_T;
|
---|
92 | else if (!dx->last_found || (dx->saw_last))
|
---|
93 | {
|
---|
94 | dx->saw_last=i4_F;
|
---|
95 |
|
---|
96 | dx->last_found=&dx->amode;
|
---|
97 | dx->last_found->xres=desc->dwWidth;
|
---|
98 | dx->last_found->yres=desc->dwHeight;
|
---|
99 | dx->last_found->flags = i4_display_class::mode::PAGE_FLIPPED;
|
---|
100 | dx->last_found->bits_per_pixel = desc->ddpfPixelFormat.dwRGBBitCount;
|
---|
101 | dx->last_found->assoc=dx;
|
---|
102 |
|
---|
103 | w32 rbits=0, gbits=0, bbits=0,m,tbits, depth;
|
---|
104 |
|
---|
105 | m = desc->ddpfPixelFormat.dwRBitMask;
|
---|
106 | if (!m) return D3DENUMRET_OK;
|
---|
107 | dx->last_found->red_mask=m;
|
---|
108 |
|
---|
109 | for (; !(m & 1); m >>= 1);
|
---|
110 | for (; m&1; m>>=1) rbits++;
|
---|
111 |
|
---|
112 | m = desc->ddpfPixelFormat.dwGBitMask;
|
---|
113 | if (!m) return D3DENUMRET_OK;
|
---|
114 | dx->last_found->green_mask=m;
|
---|
115 | for (; !(m & 1); m >>= 1);
|
---|
116 | for (; m&1; m>>=1) gbits++;
|
---|
117 |
|
---|
118 | m = desc->ddpfPixelFormat.dwBBitMask;
|
---|
119 | if (!m) return D3DENUMRET_OK;
|
---|
120 | dx->last_found->blue_mask=m;
|
---|
121 | for (; !(m & 1); m >>= 1);
|
---|
122 | for (; m&1; m>>=1) bbits++;
|
---|
123 |
|
---|
124 | sprintf(dx->last_found->name,"Page flipped %d x %d x %d (%d%d%d)",
|
---|
125 | desc->dwWidth,
|
---|
126 | desc->dwHeight,
|
---|
127 | desc->ddpfPixelFormat.dwRGBBitCount,
|
---|
128 | rbits, gbits, bbits);
|
---|
129 |
|
---|
130 | i4_warning("Mode : %s\n",dx->last_found->name);
|
---|
131 |
|
---|
132 | }
|
---|
133 |
|
---|
134 | }
|
---|
135 | return D3DENUMRET_OK;
|
---|
136 | }
|
---|
137 |
|
---|
138 | i4_display_class::mode *directx_display_class::get_next_mode(i4_display_class::mode *last_mode)
|
---|
139 | {
|
---|
140 | sw32 last_w=last_mode->xres,
|
---|
141 | last_h=last_mode->yres;
|
---|
142 |
|
---|
143 | if (!full_screen)
|
---|
144 | return 0;
|
---|
145 | else
|
---|
146 | {
|
---|
147 | saw_last = i4_F;
|
---|
148 | last_found = (directx_display_class::directx_mode *)last_mode;
|
---|
149 |
|
---|
150 | if (!exclusive_mode)
|
---|
151 | {
|
---|
152 | direct_draw_driver->SetCooperativeLevel(input.get_window_handle(),
|
---|
153 | DDSCL_ALLOWREBOOT |
|
---|
154 | DDSCL_EXCLUSIVE |
|
---|
155 | DDSCL_FULLSCREEN );
|
---|
156 |
|
---|
157 | direct_draw_driver->EnumDisplayModes(0, 0, this, dx_mode_callback);
|
---|
158 |
|
---|
159 | direct_draw_driver->SetCooperativeLevel(input.get_window_handle(),
|
---|
160 | DDSCL_NORMAL);
|
---|
161 |
|
---|
162 | }
|
---|
163 | else
|
---|
164 | direct_draw_driver->EnumDisplayModes(0, 0, this, dx_mode_callback);
|
---|
165 |
|
---|
166 | if (last_found->xres==last_w && last_found->yres==last_h)
|
---|
167 | return 0;
|
---|
168 | else
|
---|
169 | return last_found;
|
---|
170 | }
|
---|
171 | }
|
---|
172 |
|
---|
173 | i4_display_class::mode *directx_display_class::get_first_mode()
|
---|
174 | {
|
---|
175 | if (!direct_draw_driver)
|
---|
176 | {
|
---|
177 | if (!create_direct_draw()) // initialize the direct draw driver if not already
|
---|
178 | return 0;
|
---|
179 | }
|
---|
180 |
|
---|
181 | if (full_screen)
|
---|
182 | {
|
---|
183 | saw_last = i4_F;
|
---|
184 | last_found = 0;
|
---|
185 |
|
---|
186 |
|
---|
187 | if (!exclusive_mode)
|
---|
188 | {
|
---|
189 | direct_draw_driver->SetCooperativeLevel(input.get_window_handle(),
|
---|
190 | DDSCL_ALLOWREBOOT |
|
---|
191 | DDSCL_EXCLUSIVE |
|
---|
192 | DDSCL_FULLSCREEN );
|
---|
193 |
|
---|
194 | direct_draw_driver->EnumDisplayModes(0, 0, this, dx_mode_callback);
|
---|
195 |
|
---|
196 | direct_draw_driver->SetCooperativeLevel(input.get_window_handle(),
|
---|
197 | DDSCL_NORMAL);
|
---|
198 | }
|
---|
199 | else
|
---|
200 | direct_draw_driver->EnumDisplayModes(0, 0, this, dx_mode_callback);
|
---|
201 |
|
---|
202 |
|
---|
203 |
|
---|
204 |
|
---|
205 | return last_found;
|
---|
206 | }
|
---|
207 | else
|
---|
208 | {
|
---|
209 | // get the current video mode that windows is running in
|
---|
210 | DDSURFACEDESC surface_description;
|
---|
211 | // just for luck, clear this out
|
---|
212 | memset(&surface_description,0,sizeof(surface_description));
|
---|
213 | // need to tell win how big this structure is
|
---|
214 | surface_description.dwSize=sizeof(surface_description);
|
---|
215 |
|
---|
216 |
|
---|
217 | // ask windows to fill in the struct
|
---|
218 | direct_draw_driver->GetDisplayMode(&surface_description);
|
---|
219 |
|
---|
220 |
|
---|
221 | // since we only support one bit depth per
|
---|
222 | // executable make sure windows is running in the bit depth
|
---|
223 | // this executable was made for
|
---|
224 | if (surface_description.ddpfPixelFormat.dwRGBBitCount!=I4_BYTES_PER_PIXEL*8)
|
---|
225 | return 0;
|
---|
226 |
|
---|
227 |
|
---|
228 | // fill in one of our own mode strucutres to report to the caller
|
---|
229 |
|
---|
230 | memset(&amode,0,sizeof(amode));
|
---|
231 | strcpy(amode.name,"Win32 direct screen window");
|
---|
232 | amode.flags=i4_display_class::mode::RESOLUTION_DETERMINED_ON_OPEN;
|
---|
233 | amode.bits_per_pixel=I4_SCREEN_DEPTH;
|
---|
234 |
|
---|
235 | amode.xres=surface_description.dwWidth;
|
---|
236 | amode.yres=surface_description.dwHeight;
|
---|
237 |
|
---|
238 | amode.red_mask=surface_description.ddpfPixelFormat.dwRBitMask;
|
---|
239 | amode.green_mask=surface_description.ddpfPixelFormat.dwGBitMask;
|
---|
240 | amode.blue_mask=surface_description.ddpfPixelFormat.dwBBitMask;
|
---|
241 |
|
---|
242 |
|
---|
243 | amode.assoc=this; // so we know in 'initialize_mode' that we created this mode
|
---|
244 |
|
---|
245 | }
|
---|
246 |
|
---|
247 | return &amode;
|
---|
248 | }
|
---|
249 |
|
---|
250 |
|
---|
251 |
|
---|
252 |
|
---|
253 | i4_bool directx_display_class::create_direct_draw()
|
---|
254 | {
|
---|
255 | if (direct_draw_driver) // is it already created?
|
---|
256 | return i4_T;
|
---|
257 |
|
---|
258 | // try to create it
|
---|
259 | HRESULT ret = DirectDrawCreate( NULL, &direct_draw_driver, NULL );
|
---|
260 |
|
---|
261 | // failed ?
|
---|
262 | if ( ret != DD_OK )
|
---|
263 | return i4_F;
|
---|
264 |
|
---|
265 | return i4_T;
|
---|
266 | }
|
---|
267 |
|
---|
268 | void directx_display_class::destroy_direct_draw()
|
---|
269 | {
|
---|
270 | if (direct_draw_driver)
|
---|
271 | {
|
---|
272 | direct_draw_driver->Release();
|
---|
273 | direct_draw_driver=0;
|
---|
274 | }
|
---|
275 | }
|
---|
276 |
|
---|
277 |
|
---|
278 |
|
---|
279 | i4_bool directx_display_class::close()
|
---|
280 | {
|
---|
281 | if (context)
|
---|
282 | {
|
---|
283 | delete context;
|
---|
284 | context=0;
|
---|
285 | }
|
---|
286 |
|
---|
287 | if (exclusive_mode && direct_draw_driver)
|
---|
288 | {
|
---|
289 | direct_draw_driver->SetCooperativeLevel(input.get_window_handle(), DDSCL_NORMAL );
|
---|
290 | direct_draw_driver->RestoreDisplayMode();
|
---|
291 | exclusive_mode=i4_F;
|
---|
292 | }
|
---|
293 |
|
---|
294 | if (primary_surface)
|
---|
295 | {
|
---|
296 | primary_surface->Release();
|
---|
297 | primary_surface=0;
|
---|
298 | }
|
---|
299 |
|
---|
300 | if (back_buffer)
|
---|
301 | {
|
---|
302 | delete back_buffer;
|
---|
303 | back_buffer=0;
|
---|
304 | }
|
---|
305 |
|
---|
306 | input.destroy_window();
|
---|
307 | return i4_T;
|
---|
308 | }
|
---|
309 |
|
---|
310 | i4_bool directx_display_class::initialize_mode(i4_display_class::mode *which_one)
|
---|
311 | {
|
---|
312 | // make sure this is a mode we listed, and not some other driver
|
---|
313 | if ((((directx_mode *)which_one)->assoc)==this)
|
---|
314 | {
|
---|
315 | memcpy(&cur_mode,which_one,sizeof(cur_mode));
|
---|
316 |
|
---|
317 | close();
|
---|
318 |
|
---|
319 | w32 width=which_one->xres, height=which_one->yres;
|
---|
320 |
|
---|
321 | if (!direct_draw_driver)
|
---|
322 | {
|
---|
323 | if (!create_direct_draw()) // initialize the direct draw driver if not already
|
---|
324 | return i4_F;
|
---|
325 | }
|
---|
326 |
|
---|
327 |
|
---|
328 | input.create_window(0,0,width, height, this);
|
---|
329 |
|
---|
330 | HRESULT ddrval;
|
---|
331 |
|
---|
332 | if (!full_screen)
|
---|
333 | ddrval = direct_draw_driver->SetCooperativeLevel(input.get_window_handle(),
|
---|
334 | DDSCL_NORMAL );
|
---|
335 | else if (!exclusive_mode)
|
---|
336 | {
|
---|
337 | ddrval = direct_draw_driver->SetCooperativeLevel( input.get_window_handle(),
|
---|
338 | DDSCL_ALLOWREBOOT |
|
---|
339 | DDSCL_EXCLUSIVE |
|
---|
340 | DDSCL_FULLSCREEN );
|
---|
341 | exclusive_mode=i4_T;
|
---|
342 | if (ddrval!=DD_OK)
|
---|
343 | dx_error(ddrval);
|
---|
344 |
|
---|
345 | /*
|
---|
346 | SetWindowPos(win32_display_instance.window_handle, HWND_BOTTOM,
|
---|
347 | 0,600, 320, 100, SWP_NOACTIVATE | SWP_NOZORDER);
|
---|
348 | */
|
---|
349 |
|
---|
350 | }
|
---|
351 |
|
---|
352 | if (full_screen)
|
---|
353 | direct_draw_driver->SetDisplayMode(which_one->xres,
|
---|
354 | which_one->yres,
|
---|
355 | I4_BYTES_PER_PIXEL*8
|
---|
356 | );
|
---|
357 |
|
---|
358 |
|
---|
359 | if (ddrval != DD_OK)
|
---|
360 | {
|
---|
361 | input.destroy_window();
|
---|
362 | return i4_F;
|
---|
363 | }
|
---|
364 |
|
---|
365 |
|
---|
366 | if (!create_surfaces(&cur_mode))
|
---|
367 | {
|
---|
368 | primary_surface=0;
|
---|
369 | input.destroy_window();
|
---|
370 | return i4_F;
|
---|
371 | }
|
---|
372 |
|
---|
373 | if (context)
|
---|
374 | delete context;
|
---|
375 |
|
---|
376 | context=new i4_draw_context_class(0,0,width-1,height-1);
|
---|
377 | context->both_dirty=new i4_rect_list_class;
|
---|
378 | context->both_dirty->add_area(0,0,width-1,height-1);
|
---|
379 | context->single_dirty=new i4_rect_list_class;
|
---|
380 |
|
---|
381 | return i4_T;
|
---|
382 |
|
---|
383 | } else return i4_F;
|
---|
384 | }
|
---|
385 |
|
---|
386 |
|
---|
387 |
|
---|
388 | void directx_display_class::flush()
|
---|
389 | {
|
---|
390 | // add the single dirty area into the both dirty list
|
---|
391 | i4_rect_list_class::area_iter a;
|
---|
392 | for (a=context->single_dirty->list.begin();
|
---|
393 | a!=context->single_dirty->list.end();
|
---|
394 | ++a)
|
---|
395 | context->both_dirty->add_area(a->x1, a->y1, a->x2, a->y2);
|
---|
396 |
|
---|
397 | context->single_dirty->delete_list();
|
---|
398 |
|
---|
399 | if (context->both_dirty->empty())
|
---|
400 | return ;
|
---|
401 |
|
---|
402 | context->both_dirty->delete_list();
|
---|
403 | }
|
---|
404 |
|
---|
405 |
|
---|
406 | w32 directx_display_class::priority()
|
---|
407 | {
|
---|
408 | if (create_direct_draw())
|
---|
409 | {
|
---|
410 | destroy_direct_draw();
|
---|
411 | return 2;
|
---|
412 | }
|
---|
413 | else
|
---|
414 | return 0;
|
---|
415 | }
|
---|
416 |
|
---|
417 |
|
---|
418 | i4_bool directx_display_class::create_surfaces(directx_mode *mode)
|
---|
419 | {
|
---|
420 | // Create the primary surface
|
---|
421 | DDSURFACEDESC ddsd;
|
---|
422 | ddsd.dwSize = sizeof( ddsd );
|
---|
423 | ddsd.dwFlags = DDSD_CAPS;
|
---|
424 | ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
---|
425 | HRESULT ddrval = direct_draw_driver->CreateSurface( &ddsd, &primary_surface,0);
|
---|
426 | if (ddrval != DD_OK)
|
---|
427 | {
|
---|
428 | dx_error(ddrval);
|
---|
429 | return i4_F;
|
---|
430 | }
|
---|
431 |
|
---|
432 | create_back_surface(mode);
|
---|
433 |
|
---|
434 |
|
---|
435 | win32_mouse_x=-1; // the mouse thread will wait till this is not -1 before it
|
---|
436 | // starts tracking the mouse (then we will know where the system mouse is)
|
---|
437 |
|
---|
438 |
|
---|
439 | return i4_T;
|
---|
440 | }
|
---|
441 |
|
---|
442 |
|
---|
443 | i4_bool directx_display_class::create_back_surface(directx_mode *mode)
|
---|
444 | {
|
---|
445 | DDSURFACEDESC ddsd;
|
---|
446 |
|
---|
447 | ddsd.dwSize = sizeof(ddsd);
|
---|
448 | ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
---|
449 | ddsd.dwWidth = mode->xres;
|
---|
450 | ddsd.dwHeight = mode->yres;
|
---|
451 | ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; // | DDSCAPS_SYSTEMMEMORY;
|
---|
452 |
|
---|
453 | // create a new back buffer
|
---|
454 | HRESULT er = direct_draw_driver->CreateSurface(&ddsd, &back_surface, 0);
|
---|
455 | if (er != DD_OK)
|
---|
456 | {
|
---|
457 | dx_error(er);
|
---|
458 | return i4_F;
|
---|
459 | }
|
---|
460 |
|
---|
461 |
|
---|
462 | i4_pixel_format fmt;
|
---|
463 | fmt.pixel_depth=I4_16BIT;
|
---|
464 | fmt.red_mask=mode->red_mask;
|
---|
465 | fmt.green_mask=mode->green_mask;
|
---|
466 | fmt.blue_mask=mode->blue_mask;
|
---|
467 | fmt.alpha_mask=0;
|
---|
468 | fmt.calc_shift();
|
---|
469 |
|
---|
470 | pal = i4_pal_man.register_pal(&fmt);
|
---|
471 |
|
---|
472 | // create the i4_image_class which points to the surface memory
|
---|
473 | er=back_surface->Lock(0, &ddsd, DDLOCK_WAIT, 0);
|
---|
474 | if (er == DD_OK)
|
---|
475 | {
|
---|
476 | w8 *v_addr=(w8 *)ddsd.lpSurface; // this is the address
|
---|
477 | back_surface->Unlock(0); // Now that we have the video address, unlock so we can debug!
|
---|
478 | if (back_surface)
|
---|
479 | delete back_buffer; // delete the old screen
|
---|
480 |
|
---|
481 | // create the image that maps to screen memory
|
---|
482 | back_buffer=new I4_SCREEN_TYPE(cur_mode.xres,
|
---|
483 | cur_mode.yres,
|
---|
484 | pal,
|
---|
485 | ddsd.lPitch,
|
---|
486 | v_addr);
|
---|
487 | if (context)
|
---|
488 | delete context;
|
---|
489 |
|
---|
490 | context=new i4_draw_context_class(0,0,
|
---|
491 | back_buffer->width()-1,
|
---|
492 | back_buffer->height()-1);
|
---|
493 |
|
---|
494 |
|
---|
495 | context->both_dirty=new i4_rect_list_class;
|
---|
496 | context->single_dirty=new i4_rect_list_class;
|
---|
497 | }
|
---|
498 | else
|
---|
499 | {
|
---|
500 | dx_error(er);
|
---|
501 | return i4_F;
|
---|
502 | }
|
---|
503 | return i4_T;
|
---|
504 | }
|
---|
505 |
|
---|
506 |
|
---|
507 |
|
---|
508 | void directx_display_class::get_window_pos(sw32 &x, sw32 &y)
|
---|
509 | {
|
---|
510 | POINT p;
|
---|
511 | p.x=0;
|
---|
512 | p.y=0;
|
---|
513 | ClientToScreen(input.get_window_handle(), &p);
|
---|
514 | x=p.x;
|
---|
515 | y=p.y;
|
---|
516 | }
|
---|
517 |
|
---|
518 | void directx_display_class::active(i4_bool act)
|
---|
519 | {
|
---|
520 | /* if (cursor)
|
---|
521 | cursor->active(act); */
|
---|
522 | }
|
---|
523 |
|
---|
524 | i4_bool directx_display_class::available()
|
---|
525 | {
|
---|
526 | int need_destroy=direct_draw_driver != NULL;
|
---|
527 |
|
---|
528 | if (create_direct_draw())
|
---|
529 | {
|
---|
530 | if (need_destroy)
|
---|
531 | destroy_direct_draw();
|
---|
532 | return i4_T;
|
---|
533 | }
|
---|
534 | else return i4_F;
|
---|
535 | }
|
---|
536 |
|
---|
537 |
|
---|
538 | i4_image_class *directx_display_class::get_screen()
|
---|
539 | {
|
---|
540 | return back_buffer;
|
---|
541 | }
|
---|
542 |
|
---|
543 | char* D3DAppErrorToString(HRESULT error)
|
---|
544 | {
|
---|
545 | switch(error) {
|
---|
546 | case DD_OK:
|
---|
547 | return "No error.\0";
|
---|
548 | case DDERR_ALREADYINITIALIZED:
|
---|
549 | return "This object is already initialized.\0";
|
---|
550 | case DDERR_BLTFASTCANTCLIP:
|
---|
551 | return "Return if a clipper object is attached to the source surface passed into a BltFast call.\0";
|
---|
552 | case DDERR_CANNOTATTACHSURFACE:
|
---|
553 | return "This surface can not be attached to the requested surface.\0";
|
---|
554 | case DDERR_CANNOTDETACHSURFACE:
|
---|
555 | return "This surface can not be detached from the requested surface.\0";
|
---|
556 | case DDERR_CANTCREATEDC:
|
---|
557 | return "Windows can not create any more DCs.\0";
|
---|
558 | case DDERR_CANTDUPLICATE:
|
---|
559 | return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.\0";
|
---|
560 | case DDERR_CLIPPERISUSINGHWND:
|
---|
561 | return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.\0";
|
---|
562 | case DDERR_COLORKEYNOTSET:
|
---|
563 | return "No src color key specified for this operation.\0";
|
---|
564 | case DDERR_CURRENTLYNOTAVAIL:
|
---|
565 | return "Support is currently not available.\0";
|
---|
566 | case DDERR_DIRECTDRAWALREADYCREATED:
|
---|
567 | return "A DirectDraw object representing this driver has already been created for this process.\0";
|
---|
568 | case DDERR_EXCEPTION:
|
---|
569 | return "An exception was encountered while performing the requested operation.\0";
|
---|
570 | case DDERR_EXCLUSIVEMODEALREADYSET:
|
---|
571 | return "An attempt was made to set the cooperative level when it was already set to exclusive.\0";
|
---|
572 | case DDERR_GENERIC:
|
---|
573 | return "Generic failure.\0";
|
---|
574 | case DDERR_HEIGHTALIGN:
|
---|
575 | return "Height of rectangle provided is not a multiple of reqd alignment.\0";
|
---|
576 | case DDERR_HWNDALREADYSET:
|
---|
577 | return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.\0";
|
---|
578 | case DDERR_HWNDSUBCLASSED:
|
---|
579 | return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.\0";
|
---|
580 | case DDERR_IMPLICITLYCREATED:
|
---|
581 | return "This surface can not be restored because it is an implicitly created surface.\0";
|
---|
582 | case DDERR_INCOMPATIBLEPRIMARY:
|
---|
583 | return "Unable to match primary surface creation request with existing primary surface.\0";
|
---|
584 | case DDERR_INVALIDCAPS:
|
---|
585 | return "One or more of the caps bits passed to the callback are incorrect.\0";
|
---|
586 | case DDERR_INVALIDCLIPLIST:
|
---|
587 | return "DirectDraw does not support the provided cliplist.\0";
|
---|
588 | case DDERR_INVALIDDIRECTDRAWGUID:
|
---|
589 | return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.\0";
|
---|
590 | case DDERR_INVALIDMODE:
|
---|
591 | return "DirectDraw does not support the requested mode.\0";
|
---|
592 | case DDERR_INVALIDOBJECT:
|
---|
593 | return "DirectDraw received a pointer that was an invalid DIRECTDRAW object.\0";
|
---|
594 | case DDERR_INVALIDPARAMS:
|
---|
595 | return "One or more of the parameters passed to the function are incorrect.\0";
|
---|
596 | case DDERR_INVALIDPIXELFORMAT:
|
---|
597 | return "The pixel format was invalid as specified.\0";
|
---|
598 | case DDERR_INVALIDPOSITION:
|
---|
599 | return "Returned when the position of the overlay on the destination is no longer legal for that destination.\0";
|
---|
600 | case DDERR_INVALIDRECT:
|
---|
601 | return "Rectangle provided was invalid.\0";
|
---|
602 | case DDERR_LOCKEDSURFACES:
|
---|
603 | return "Operation could not be carried out because one or more surfaces are locked.\0";
|
---|
604 | case DDERR_NO3D:
|
---|
605 | return "There is no 3D present.\0";
|
---|
606 | case DDERR_NOALPHAHW:
|
---|
607 | return "Operation could not be carried out because there is no alpha accleration hardware present or available.\0";
|
---|
608 | case DDERR_NOBLTHW:
|
---|
609 | return "No blitter hardware present.\0";
|
---|
610 | case DDERR_NOCLIPLIST:
|
---|
611 | return "No cliplist available.\0";
|
---|
612 | case DDERR_NOCLIPPERATTACHED:
|
---|
613 | return "No clipper object attached to surface object.\0";
|
---|
614 | case DDERR_NOCOLORCONVHW:
|
---|
615 | return "Operation could not be carried out because there is no color conversion hardware present or available.\0";
|
---|
616 | case DDERR_NOCOLORKEY:
|
---|
617 | return "Surface doesn't currently have a color key\0";
|
---|
618 | case DDERR_NOCOLORKEYHW:
|
---|
619 | return "Operation could not be carried out because there is no hardware support of the destination color key.\0";
|
---|
620 | case DDERR_NOCOOPERATIVELEVELSET:
|
---|
621 | return "Create function called without DirectDraw object method SetCooperativeLevel being called.\0";
|
---|
622 | case DDERR_NODC:
|
---|
623 | return "No DC was ever created for this surface.\0";
|
---|
624 | case DDERR_NODDROPSHW:
|
---|
625 | return "No DirectDraw ROP hardware.\0";
|
---|
626 | case DDERR_NODIRECTDRAWHW:
|
---|
627 | return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.\0";
|
---|
628 | case DDERR_NOEMULATION:
|
---|
629 | return "Software emulation not available.\0";
|
---|
630 | case DDERR_NOEXCLUSIVEMODE:
|
---|
631 | return "Operation requires the application to have exclusive mode but the application does not have exclusive mode.\0";
|
---|
632 | case DDERR_NOFLIPHW:
|
---|
633 | return "Flipping visible surfaces is not supported.\0";
|
---|
634 | case DDERR_NOGDI:
|
---|
635 | return "There is no GDI present.\0";
|
---|
636 | case DDERR_NOHWND:
|
---|
637 | return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.\0";
|
---|
638 | case DDERR_NOMIRRORHW:
|
---|
639 | return "Operation could not be carried out because there is no hardware present or available.\0";
|
---|
640 | case DDERR_NOOVERLAYDEST:
|
---|
641 | return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.\0";
|
---|
642 | case DDERR_NOOVERLAYHW:
|
---|
643 | return "Operation could not be carried out because there is no overlay hardware present or available.\0";
|
---|
644 | case DDERR_NOPALETTEATTACHED:
|
---|
645 | return "No palette object attached to this surface.\0";
|
---|
646 | case DDERR_NOPALETTEHW:
|
---|
647 | return "No hardware support for 16 or 256 color palettes.\0";
|
---|
648 | case DDERR_NORASTEROPHW:
|
---|
649 | return "Operation could not be carried out because there is no appropriate raster op hardware present or available.\0";
|
---|
650 | case DDERR_NOROTATIONHW:
|
---|
651 | return "Operation could not be carried out because there is no rotation hardware present or available.\0";
|
---|
652 | case DDERR_NOSTRETCHHW:
|
---|
653 | return "Operation could not be carried out because there is no hardware support for stretching.\0";
|
---|
654 | case DDERR_NOT4BITCOLOR:
|
---|
655 | return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.\0";
|
---|
656 | case DDERR_NOT4BITCOLORINDEX:
|
---|
657 | return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.\0";
|
---|
658 | case DDERR_NOT8BITCOLOR:
|
---|
659 | return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.\0";
|
---|
660 | case DDERR_NOTAOVERLAYSURFACE:
|
---|
661 | return "Returned when an overlay member is called for a non-overlay surface.\0";
|
---|
662 | case DDERR_NOTEXTUREHW:
|
---|
663 | return "Operation could not be carried out because there is no texture mapping hardware present or available.\0";
|
---|
664 | case DDERR_NOTFLIPPABLE:
|
---|
665 | return "An attempt has been made to flip a surface that is not flippable.\0";
|
---|
666 | case DDERR_NOTFOUND:
|
---|
667 | return "Requested item was not found.\0";
|
---|
668 | case DDERR_NOTLOCKED:
|
---|
669 | 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";
|
---|
670 | case DDERR_NOTPALETTIZED:
|
---|
671 | return "The surface being used is not a palette-based surface.\0";
|
---|
672 | case DDERR_NOVSYNCHW:
|
---|
673 | return "Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.\0";
|
---|
674 | case DDERR_NOZBUFFERHW:
|
---|
675 | return "Operation could not be carried out because there is no hardware support for zbuffer blitting.\0";
|
---|
676 | case DDERR_NOZOVERLAYHW:
|
---|
677 | return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.\0";
|
---|
678 | case DDERR_OUTOFCAPS:
|
---|
679 | return "The hardware needed for the requested operation has already been allocated.\0";
|
---|
680 | case DDERR_OUTOFMEMORY:
|
---|
681 | return "DirectDraw does not have enough memory to perform the operation.\0";
|
---|
682 | case DDERR_OUTOFVIDEOMEMORY:
|
---|
683 | return "DirectDraw does not have enough memory to perform the operation.\0";
|
---|
684 | case DDERR_OVERLAYCANTCLIP:
|
---|
685 | return "The hardware does not support clipped overlays.\0";
|
---|
686 | case DDERR_OVERLAYCOLORKEYONLYONEACTIVE:
|
---|
687 | return "Can only have ony color key active at one time for overlays.\0";
|
---|
688 | case DDERR_OVERLAYNOTVISIBLE:
|
---|
689 | return "Returned when GetOverlayPosition is called on a hidden overlay.\0";
|
---|
690 | case DDERR_PALETTEBUSY:
|
---|
691 | return "Access to this palette is being refused because the palette is already locked by another thread.\0";
|
---|
692 | case DDERR_PRIMARYSURFACEALREADYEXISTS:
|
---|
693 | return "This process already has created a primary surface.\0";
|
---|
694 | case DDERR_REGIONTOOSMALL:
|
---|
695 | return "Region passed to Clipper::GetClipList is too small.\0";
|
---|
696 | case DDERR_SURFACEALREADYATTACHED:
|
---|
697 | return "This surface is already attached to the surface it is being attached to.\0";
|
---|
698 | case DDERR_SURFACEALREADYDEPENDENT:
|
---|
699 | return "This surface is already a dependency of the surface it is being made a dependency of.\0";
|
---|
700 | case DDERR_SURFACEBUSY:
|
---|
701 | return "Access to this surface is being refused because the surface is already locked by another thread.\0";
|
---|
702 | case DDERR_SURFACEISOBSCURED:
|
---|
703 | return "Access to surface refused because the surface is obscured.\0";
|
---|
704 | case DDERR_SURFACELOST:
|
---|
705 | 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";
|
---|
706 | case DDERR_SURFACENOTATTACHED:
|
---|
707 | return "The requested surface is not attached.\0";
|
---|
708 | case DDERR_TOOBIGHEIGHT:
|
---|
709 | return "Height requested by DirectDraw is too large.\0";
|
---|
710 | case DDERR_TOOBIGSIZE:
|
---|
711 | return "Size requested by DirectDraw is too large, but the individual height and width are OK.\0";
|
---|
712 | case DDERR_TOOBIGWIDTH:
|
---|
713 | return "Width requested by DirectDraw is too large.\0";
|
---|
714 | case DDERR_UNSUPPORTED:
|
---|
715 | return "Action not supported.\0";
|
---|
716 | case DDERR_UNSUPPORTEDFORMAT:
|
---|
717 | return "FOURCC format requested is unsupported by DirectDraw.\0";
|
---|
718 | case DDERR_UNSUPPORTEDMASK:
|
---|
719 | return "Bitmask in the pixel format requested is unsupported by DirectDraw.\0";
|
---|
720 | case DDERR_VERTICALBLANKINPROGRESS:
|
---|
721 | return "Vertical blank is in progress.\0";
|
---|
722 | case DDERR_WASSTILLDRAWING:
|
---|
723 | return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.\0";
|
---|
724 | case DDERR_WRONGMODE:
|
---|
725 | return "This surface can not be restored because it was created in a different mode.\0";
|
---|
726 | case DDERR_XALIGN:
|
---|
727 | return "Rectangle provided was not horizontally aligned on required boundary.\0";
|
---|
728 | case D3DERR_BADMAJORVERSION:
|
---|
729 | return "D3DERR_BADMAJORVERSION\0";
|
---|
730 | case D3DERR_BADMINORVERSION:
|
---|
731 | return "D3DERR_BADMINORVERSION\0";
|
---|
732 | case D3DERR_EXECUTE_LOCKED:
|
---|
733 | return "D3DERR_EXECUTE_LOCKED\0";
|
---|
734 | case D3DERR_EXECUTE_NOT_LOCKED:
|
---|
735 | return "D3DERR_EXECUTE_NOT_LOCKED\0";
|
---|
736 | case D3DERR_EXECUTE_CREATE_FAILED:
|
---|
737 | return "D3DERR_EXECUTE_CREATE_FAILED\0";
|
---|
738 | case D3DERR_EXECUTE_DESTROY_FAILED:
|
---|
739 | return "D3DERR_EXECUTE_DESTROY_FAILED\0";
|
---|
740 | case D3DERR_EXECUTE_LOCK_FAILED:
|
---|
741 | return "D3DERR_EXECUTE_LOCK_FAILED\0";
|
---|
742 | case D3DERR_EXECUTE_UNLOCK_FAILED:
|
---|
743 | return "D3DERR_EXECUTE_UNLOCK_FAILED\0";
|
---|
744 | case D3DERR_EXECUTE_FAILED:
|
---|
745 | return "D3DERR_EXECUTE_FAILED\0";
|
---|
746 | case D3DERR_EXECUTE_CLIPPED_FAILED:
|
---|
747 | return "D3DERR_EXECUTE_CLIPPED_FAILED\0";
|
---|
748 | case D3DERR_TEXTURE_NO_SUPPORT:
|
---|
749 | return "D3DERR_TEXTURE_NO_SUPPORT\0";
|
---|
750 | case D3DERR_TEXTURE_NOT_LOCKED:
|
---|
751 | return "D3DERR_TEXTURE_NOT_LOCKED\0";
|
---|
752 | case D3DERR_TEXTURE_LOCKED:
|
---|
753 | return "D3DERR_TEXTURELOCKED\0";
|
---|
754 | case D3DERR_TEXTURE_CREATE_FAILED:
|
---|
755 | return "D3DERR_TEXTURE_CREATE_FAILED\0";
|
---|
756 | case D3DERR_TEXTURE_DESTROY_FAILED:
|
---|
757 | return "D3DERR_TEXTURE_DESTROY_FAILED\0";
|
---|
758 | case D3DERR_TEXTURE_LOCK_FAILED:
|
---|
759 | return "D3DERR_TEXTURE_LOCK_FAILED\0";
|
---|
760 | case D3DERR_TEXTURE_UNLOCK_FAILED:
|
---|
761 | return "D3DERR_TEXTURE_UNLOCK_FAILED\0";
|
---|
762 | case D3DERR_TEXTURE_LOAD_FAILED:
|
---|
763 | return "D3DERR_TEXTURE_LOAD_FAILED\0";
|
---|
764 | case D3DERR_MATRIX_CREATE_FAILED:
|
---|
765 | return "D3DERR_MATRIX_CREATE_FAILED\0";
|
---|
766 | case D3DERR_MATRIX_DESTROY_FAILED:
|
---|
767 | return "D3DERR_MATRIX_DESTROY_FAILED\0";
|
---|
768 | case D3DERR_MATRIX_SETDATA_FAILED:
|
---|
769 | return "D3DERR_MATRIX_SETDATA_FAILED\0";
|
---|
770 | case D3DERR_SETVIEWPORTDATA_FAILED:
|
---|
771 | return "D3DERR_SETVIEWPORTDATA_FAILED\0";
|
---|
772 | case D3DERR_MATERIAL_CREATE_FAILED:
|
---|
773 | return "D3DERR_MATERIAL_CREATE_FAILED\0";
|
---|
774 | case D3DERR_MATERIAL_DESTROY_FAILED:
|
---|
775 | return "D3DERR_MATERIAL_DESTROY_FAILED\0";
|
---|
776 | case D3DERR_MATERIAL_SETDATA_FAILED:
|
---|
777 | return "D3DERR_MATERIAL_SETDATA_FAILED\0";
|
---|
778 | case D3DERR_LIGHT_SET_FAILED:
|
---|
779 | return "D3DERR_LIGHT_SET_FAILED\0";
|
---|
780 | case D3DRMERR_BADOBJECT:
|
---|
781 | return "D3DRMERR_BADOBJECT\0";
|
---|
782 | case D3DRMERR_BADTYPE:
|
---|
783 | return "D3DRMERR_BADTYPE\0";
|
---|
784 | case D3DRMERR_BADALLOC:
|
---|
785 | return "D3DRMERR_BADALLOC\0";
|
---|
786 | case D3DRMERR_FACEUSED:
|
---|
787 | return "D3DRMERR_FACEUSED\0";
|
---|
788 | case D3DRMERR_NOTFOUND:
|
---|
789 | return "D3DRMERR_NOTFOUND\0";
|
---|
790 | case D3DRMERR_NOTDONEYET:
|
---|
791 | return "D3DRMERR_NOTDONEYET\0";
|
---|
792 | case D3DRMERR_FILENOTFOUND:
|
---|
793 | return "The file was not found.\0";
|
---|
794 | case D3DRMERR_BADFILE:
|
---|
795 | return "D3DRMERR_BADFILE\0";
|
---|
796 | case D3DRMERR_BADDEVICE:
|
---|
797 | return "D3DRMERR_BADDEVICE\0";
|
---|
798 | case D3DRMERR_BADVALUE:
|
---|
799 | return "D3DRMERR_BADVALUE\0";
|
---|
800 | case D3DRMERR_BADMAJORVERSION:
|
---|
801 | return "D3DRMERR_BADMAJORVERSION\0";
|
---|
802 | case D3DRMERR_BADMINORVERSION:
|
---|
803 | return "D3DRMERR_BADMINORVERSION\0";
|
---|
804 | case D3DRMERR_UNABLETOEXECUTE:
|
---|
805 | return "D3DRMERR_UNABLETOEXECUTE\0";
|
---|
806 | default:
|
---|
807 | return "Unrecognized error value.\0";
|
---|
808 | }
|
---|
809 | }
|
---|