Isle
Loading...
Searching...
No Matches
mxdirectdraw.cpp
Go to the documentation of this file.
1#include "mxdirectdraw.h"
2
3#include "decomp.h"
4
5#include <assert.h>
6
8
9#define RELEASE(x) \
10 if (x != NULL) { \
11 x->Release(); \
12 x = NULL; \
13 }
14
15#ifndef DDSCAPS_3DDEVICE
16#define DDSCAPS_3DDEVICE 0x00002000l
17#endif
18
19// GLOBAL: LEGO1 0x10100c68
20// GLOBAL: BETA10 0x101ff1c4
22
23// FUNCTION: LEGO1 0x1009d490
24// FUNCTION: BETA10 0x1012036a
26{
42 m_pauseCount = 0;
48 m_hFont = NULL;
49}
50
51// FUNCTION: LEGO1 0x1009d530
52// FUNCTION: BETA10 0x1012048f
54{
55 Destroy();
56
57 if (m_currentDevInfo != NULL) {
58 delete m_currentDevInfo;
60 }
61}
62
63// FUNCTION: LEGO1 0x1009d570
64// FUNCTION: BETA10 0x101204fe
66{
67 DWORD dwRGBBitCount = 8;
68 LPDIRECTDRAW pDDraw;
69 DDSURFACEDESC ddsd;
70
71 if (!DirectDrawCreate(NULL, &pDDraw, NULL)) {
72 memset(&ddsd, 0, sizeof(ddsd));
73 ddsd.dwSize = sizeof(ddsd);
74
75 pDDraw->GetDisplayMode(&ddsd);
76 dwRGBBitCount = ddsd.ddpfPixelFormat.dwRGBBitCount;
78 pDDraw->Release();
79 }
80
81 return dwRGBBitCount;
82}
83
84// FUNCTION: LEGO1 0x1009d5e0
85// FUNCTION: BETA10 0x1012058c
87 HWND hWnd,
88 BOOL fullscreen,
89 BOOL surface_fullscreen,
90 BOOL onlySystemMemory,
91 int width,
92 int height,
93 int bpp,
94 const PALETTEENTRY* pPaletteEntries,
95 int paletteEntryCount
96)
97{
98 assert(m_currentDevInfo);
99
101
103
105 return FALSE;
106 }
107
108 m_bFlipSurfaces = surface_fullscreen;
109 m_bOnlySystemMemory = onlySystemMemory;
111
113 fullscreen = TRUE;
114 }
115
116 if (!SetPaletteEntries(pPaletteEntries, paletteEntryCount, fullscreen)) {
117 return FALSE;
118 }
119
120 if (!DDInit(fullscreen)) {
121 return FALSE;
122 }
123
124 if (!DDSetMode(width, height, bpp)) {
125 return FALSE;
126 }
127
128 return TRUE;
129}
130
131// FUNCTION: LEGO1 0x1009d690
132// FUNCTION: BETA10 0x101206ca
134{
136 return (DirectDrawCreate(*ppGUID, &m_pDirectDraw, 0) == DD_OK);
137}
138
139// FUNCTION: LEGO1 0x1009d6c0
140// FUNCTION: BETA10 0x10120733
142{
143 HDC hdc;
144
146 hdc = GetDC(NULL);
147 GetSystemPaletteEntries(hdc, 0, (1 << 8), &m_originalPaletteEntries[0]);
148 ReleaseDC(NULL, hdc);
149 }
150 return TRUE;
151}
152
153// FUNCTION: LEGO1 0x1009d700
154// FUNCTION: BETA10 0x1012078c
155BOOL MxDirectDraw::SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int paletteEntryCount, BOOL fullscreen)
156{
157 HDC hdc;
158 int i;
159
161 hdc = GetDC(NULL);
162 GetSystemPaletteEntries(hdc, 0, (1 << 8), m_paletteEntries);
163 ReleaseDC(NULL, hdc);
164 }
165
166 for (i = 0; i < 10; i++) {
167 m_paletteEntries[i].peFlags = 0x80;
168 }
169
170 for (; i < 142; i++) {
171 m_paletteEntries[i].peFlags = 0x44;
172 }
173
174 for (; i < 246; i++) {
175 m_paletteEntries[i].peFlags = 0x84;
176 }
177
178 for (; i < 256; i++) {
179 m_paletteEntries[i].peFlags = 0x80;
180 }
181
182 if (paletteEntryCount != 0) {
183 assert(paletteEntryCount <= (sizeof(m_paletteEntries) / sizeof(m_paletteEntries[0])));
184
185 for (i = 10; (i < paletteEntryCount) && (i < 246); i++) {
186 m_paletteEntries[i].peRed = pPaletteEntries[i].peRed;
187 m_paletteEntries[i].peGreen = pPaletteEntries[i].peGreen;
188 m_paletteEntries[i].peBlue = pPaletteEntries[i].peBlue;
189 }
190 }
191
192 if (m_pPalette) {
193 HRESULT result;
194
195 result = m_pPalette->SetEntries(0, 0, sizeOfArray(m_paletteEntries), m_paletteEntries);
196 if (result != DD_OK) {
197 Error("SetEntries failed", result);
198 return FALSE;
199 }
200 }
201
202 return TRUE;
203}
204
205// FUNCTION: LEGO1 0x1009d800
206// FUNCTION: BETA10 0x10120971
208{
210
211 FUN_1009d920();
212
214
216
217 if (m_currentDevInfo != NULL) {
218 delete m_currentDevInfo;
220 }
221}
222
223// FUNCTION: LEGO1 0x1009d860
224// FUNCTION: BETA10 0x10120a18
226{
228 if (m_bFullScreen) {
229 if (m_pDirectDraw) {
231 m_pDirectDraw->RestoreDisplayMode();
233 }
234 }
235
243}
244
245// FUNCTION: LEGO1 0x1009d920
246// FUNCTION: BETA10 0x10120b9e
248{
250 if (m_pDirectDraw != NULL) {
252 m_pDirectDraw->RestoreDisplayMode();
253 m_pDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL);
255 }
256}
257
258// FUNCTION: LEGO1 0x1009d960
259// FUNCTION: BETA10 0x10120d61
261{
262 assert(m_pDirectDraw);
263
264 HRESULT result;
265
266 if (fullscreen) {
268 result = m_pDirectDraw->SetCooperativeLevel(m_hWndMain, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
270 }
271 else {
272 result = m_pDirectDraw->SetCooperativeLevel(m_hWndMain, DDSCL_NORMAL);
273 }
274
275 if (result != DD_OK) {
276 Error("SetCooperativeLevel failed", result);
277 return FALSE;
278 }
279
280 m_bFullScreen = fullscreen;
281
282 return TRUE;
283}
284
285// FUNCTION: LEGO1 0x1009d9d0
286// FUNCTION: BETA10 0x10120e45
287BOOL MxDirectDraw::IsSupportedMode(int width, int height, int bpp)
288{
289 DeviceModesInfo::Mode mode = {width, height, bpp};
290
291 assert(m_currentDevInfo);
292
293 for (int i = 0; i < m_currentDevInfo->m_count; i++) {
294 if (m_currentDevInfo->m_modeArray[i] == mode) {
295 return TRUE;
296 }
297 }
298
299 return FALSE;
300}
301
302// FUNCTION: LEGO1 0x1009da20
303// FUNCTION: BETA10 0x10120efb
304void EnableResizing(HWND p_hwnd, BOOL p_flag)
305{
306 static DWORD g_dwStyle;
307
308 if (!p_flag) {
309 g_dwStyle = GetWindowLong(p_hwnd, GWL_STYLE);
310 if (g_dwStyle & WS_THICKFRAME) {
311 SetWindowLong(p_hwnd, GWL_STYLE, GetWindowLong(p_hwnd, GWL_STYLE) ^ WS_THICKFRAME);
312 }
313 }
314 else {
315 SetWindowLong(p_hwnd, GWL_STYLE, g_dwStyle);
316 }
317}
318
319// FUNCTION: LEGO1 0x1009da80
320// FUNCTION: BETA10 0x10120f68
321BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp)
322{
323 HRESULT result;
324
325 if (m_bFullScreen) {
327
328#ifndef BETA10
330 LPDIRECTDRAW lpDD = NULL;
331 result = DirectDrawCreate(0, &lpDD, 0);
332 if (result == DD_OK) {
333 result = lpDD->SetCooperativeLevel(m_hWndMain, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT);
334 if (result == DD_OK) {
335 lpDD->SetDisplayMode(width, height, 8);
336 }
337 }
338 }
339#endif
340
341 if (!IsSupportedMode(width, height, bpp)) {
345 }
346
348 result = m_pDirectDraw->SetDisplayMode(width, height, bpp);
350 if (result != DD_OK) {
351 Error("SetDisplayMode failed", result);
352 return FALSE;
353 }
354 }
355 else {
356 RECT rc;
357 DWORD dwStyle;
358
360 Error(
361 "Attempt made enter a windowed mode on a DirectDraw device that is not the primary display",
363 );
364 return FALSE;
365 }
366
368 dwStyle = GetWindowLong(m_hWndMain, GWL_STYLE);
369 dwStyle &= ~WS_POPUP;
370 dwStyle |= WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME;
371 SetWindowLong(m_hWndMain, GWL_STYLE, dwStyle);
372 SetRect(&rc, 0, 0, width - 1, height - 1);
373 AdjustWindowRectEx(
374 &rc,
375 GetWindowLong(m_hWndMain, GWL_STYLE),
376 GetMenu(m_hWndMain) != NULL,
377 GetWindowLong(m_hWndMain, GWL_EXSTYLE)
378 );
379 SetWindowPos(
381 NULL,
382 0,
383 0,
384 rc.right - rc.left + 1,
385 rc.bottom - rc.top + 1,
386 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE
387 );
388 SetWindowPos(m_hWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
390 }
391
392 m_currentMode.width = width;
393 m_currentMode.height = height;
395
396 if (!DDCreateSurfaces()) {
397 return FALSE;
398 }
399
400 DDSURFACEDESC ddsd;
401
402 FUN_1009e020();
403
404 if (!GetDDSurfaceDesc(&ddsd, m_pBackBuffer)) {
405 return FALSE;
406 }
407
410 }
411 else {
413 }
414
416 result = m_pDirectDraw->CreatePalette(
419 &m_pPalette,
420 NULL
421 );
422 if (result != DD_OK) {
423 Error("CreatePalette failed", result);
424 return 0;
425 }
426 result = m_pBackBuffer->SetPalette(m_pPalette); // TODO: add FIX_BUGS define and fix this
427 result = m_pFrontBuffer->SetPalette(m_pPalette);
428 if (result != DD_OK) {
429 Error("SetPalette failed", result);
430 return FALSE;
431 }
432 }
433
434 // create debug text only in windowed mode?
435 if (!m_bFullScreen) {
436 if (!CreateTextSurfaces()) {
437 return FALSE;
438 }
439 }
440
441 return TRUE;
442}
443
444// FUNCTION: LEGO1 0x1009dd80
445// FUNCTION: BETA10 0x1012137f
447 LPDDSURFACEDESC p_lpDDSurfDesc,
448 LPDIRECTDRAWSURFACE FAR* p_lpDDSurface,
449 IUnknown FAR* p_pUnkOuter
450)
451{
452 HRESULT res = m_pDirectDraw->CreateSurface(p_lpDDSurfDesc, p_lpDDSurface, p_pUnkOuter);
453 return res;
454}
455
456// FUNCTION: LEGO1 0x1009dda0
457// FUNCTION: BETA10 0x101213bb
459{
460 HRESULT result;
461
462 memset(lpDDSurfDesc, 0, sizeof(DDSURFACEDESC));
463 lpDDSurfDesc->dwSize = sizeof(DDSURFACEDESC);
464 result = lpDDSurf->GetSurfaceDesc(lpDDSurfDesc);
465 if (result != DD_OK) {
466 Error("Error getting a surface description", result);
467 }
468
469 return (result == DD_OK);
470}
471
472// FUNCTION: LEGO1 0x1009ddf0
473// FUNCTION: BETA10 0x10121430
475{
476 HRESULT result;
477 DDSURFACEDESC ddsd;
478 DDSCAPS ddscaps;
479
480 if (m_bFlipSurfaces) {
481 memset(&ddsd, 0, sizeof(DDSURFACEDESC));
482 ddsd.dwSize = sizeof(ddsd);
487 }
488 ddsd.dwBackBufferCount = 1;
489 result = CreateDDSurface(&ddsd, &m_pFrontBuffer, NULL);
490 if (result != DD_OK) {
491 Error("CreateSurface for front/back fullScreen buffer failed", result);
492 return FALSE;
493 }
494 ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
495 result = m_pFrontBuffer->GetAttachedSurface(&ddscaps, &m_pBackBuffer);
496 if (result != DD_OK) {
497 Error("GetAttachedSurface failed to get back buffer", result);
498 return FALSE;
499 }
500 if (!GetDDSurfaceDesc(&ddsd, m_pBackBuffer)) {
501 return FALSE;
502 }
503 }
504 else {
505 memset(&ddsd, 0, sizeof(DDSURFACEDESC));
506 ddsd.dwSize = sizeof(DDSURFACEDESC);
507 ddsd.dwFlags = DDSD_CAPS;
509 result = CreateDDSurface(&ddsd, &m_pFrontBuffer, NULL);
510 if (result != DD_OK) {
511 Error("CreateSurface for window front buffer failed", result);
512 return FALSE;
513 }
520 }
521 result = CreateDDSurface(&ddsd, &m_pBackBuffer, NULL);
522 if (result != DD_OK) {
523 Error("CreateSurface for window back buffer failed", result);
524 return FALSE;
525 }
526 if (!GetDDSurfaceDesc(&ddsd, m_pBackBuffer)) {
527 return FALSE;
528 }
529
530 result = m_pDirectDraw->CreateClipper(0, &m_pClipper, NULL);
531 if (result != DD_OK) {
532 Error("CreateClipper failed", result);
533 return FALSE;
534 }
535 result = m_pClipper->SetHWnd(0, m_hWndMain);
536 if (result != DD_OK) {
537 Error("Clipper SetHWnd failed", result);
538 return FALSE;
539 }
540 result = m_pFrontBuffer->SetClipper(m_pClipper);
541 if (result != DD_OK) {
542 Error("SetClipper failed", result);
543 return FALSE;
544 }
545 }
546
547 return TRUE;
548}
549
550// FUNCTION: LEGO1 0x1009e020
551// FUNCTION: BETA10 0x10121700
553{
554 HRESULT result;
555 byte* line;
556 DDSURFACEDESC ddsd;
557 int count = m_bFlipSurfaces ? 2 : 1;
558 int value = 0;
559
560 for (int i = 0; i < count; i++) {
561 memset(&ddsd, 0, sizeof(ddsd));
562 ddsd.dwSize = sizeof(ddsd);
563
564 result = m_pBackBuffer->Lock(NULL, &ddsd, 1, NULL);
565 if (result == DDERR_SURFACELOST) {
566 m_pBackBuffer->Restore();
567 result = m_pBackBuffer->Lock(NULL, &ddsd, 1, NULL);
568 }
569
570 if (result != DD_OK) {
571 // lock failed
572 return;
573 }
574
575 // clear backBuffer
576 line = (byte*) ddsd.lpSurface;
577 for (int j = ddsd.dwHeight; j--;) {
578 memset(line, value, ddsd.dwWidth);
579 line += ddsd.lPitch;
580 }
581
582 m_pBackBuffer->Unlock(ddsd.lpSurface);
583
584 if (m_bFlipSurfaces) {
586 }
587 }
588}
589
590// FUNCTION: LEGO1 0x1009e110
591// FUNCTION: BETA10 0x101219de
592BOOL MxDirectDraw::TextToTextSurface(const char* text, IDirectDrawSurface* pSurface, SIZE& textSizeOnSurface)
593{
594 HRESULT result;
595 HDC hdc;
596 RECT rc;
597 size_t textLength;
598
599 if (!pSurface) {
600 return FALSE;
601 }
602
603 result = pSurface->GetDC(&hdc);
604 if (result != DD_OK) {
605 Error("GetDC for text surface failed", result);
606 return FALSE;
607 }
608
609 textLength = strlen(text);
610
611 SelectObject(hdc, m_hFont);
612 SetTextColor(hdc, RGB(255, 255, 0));
613 SetBkColor(hdc, RGB(0, 0, 0));
614 SetBkMode(hdc, OPAQUE);
615 GetTextExtentPoint32(hdc, text, textLength, &textSizeOnSurface);
616 SetRect(&rc, 0, 0, textSizeOnSurface.cx, textSizeOnSurface.cy);
617 ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, text, textLength, NULL);
618 pSurface->ReleaseDC(hdc);
619
620 return TRUE;
621}
622
623// FUNCTION: LEGO1 0x1009e210
624// FUNCTION: BETA10 0x10121aea
626{
628}
629
630// FUNCTION: LEGO1 0x1009e230
631// FUNCTION: BETA10 0x10121b1e
633{
635}
636
637// FUNCTION: LEGO1 0x1009e250
638// FUNCTION: BETA10 0x10121b52
640{
641 HRESULT result;
642 DDCOLORKEY ddck;
643 DDSURFACEDESC ddsd;
644 HDC hdc;
645 char dummyinfo[] = "000x000x00 (RAMP) 0000";
646 char dummyfps[] = "000.00 fps (000.00 fps (000.00 fps) 00000 tps)";
647
648 if (m_hFont != NULL) {
650 }
651 m_hFont = CreateFont(
652 m_currentMode.width <= 600 ? 12 : 24,
653 0,
654 0,
655 0,
656 FW_NORMAL,
657 FALSE,
658 FALSE,
659 FALSE,
660 ANSI_CHARSET,
661 OUT_DEFAULT_PRECIS,
662 CLIP_DEFAULT_PRECIS,
663 DEFAULT_QUALITY,
664 VARIABLE_PITCH,
665 "Arial"
666 );
667
668 hdc = GetDC(NULL);
669 SelectObject(hdc, m_hFont);
670 GetTextExtentPoint(hdc, dummyfps, strlen(dummyfps), &m_text1SizeOnSurface);
671 GetTextExtentPoint(hdc, dummyinfo, strlen(dummyinfo), &m_text2SizeOnSurface);
672 ReleaseDC(NULL, hdc);
673
674 memset(&ddsd, 0, sizeof(ddsd));
675 ddsd.dwSize = sizeof(ddsd);
680 }
683 result = CreateDDSurface(&ddsd, &m_pText1Surface, NULL);
684 if (result != DD_OK) {
685 Error("CreateSurface for text surface 1 failed", result);
686 return FALSE;
687 }
688 memset(&ddck, 0, sizeof(ddck));
689 m_pText1Surface->SetColorKey(DDCKEY_SRCBLT, &ddck);
690 if (!TextToTextSurface1(dummyfps)) {
691 return FALSE;
692 }
693
694 memset(&ddsd, 0, sizeof(ddsd));
695 ddsd.dwSize = sizeof(ddsd);
700 }
703 result = CreateDDSurface(&ddsd, &m_pText2Surface, NULL);
704 if (result != DD_OK) {
705 Error("CreateSurface for text surface 2 failed", result);
706 return FALSE;
707 }
708 memset(&ddck, 0, sizeof(ddck));
709 m_pText2Surface->SetColorKey(DDCKEY_SRCBLT, &ddck);
710 if (!TextToTextSurface2(dummyinfo)) {
711 return FALSE;
712 }
713
714 return TRUE;
715}
716
717// FUNCTION: LEGO1 0x1009e4d0
718// FUNCTION: BETA10 0x10121e87
720{
721 HRESULT result;
722
723 if (m_pFrontBuffer != NULL) {
724 if (m_pFrontBuffer->IsLost() == DDERR_SURFACELOST) {
725 result = m_pFrontBuffer->Restore();
726 if (result != DD_OK) {
727 Error("Restore of front buffer failed", result);
728 return FALSE;
729 }
730 }
731 }
732
733 if (m_pBackBuffer != NULL) {
734 if (m_pBackBuffer->IsLost() == DDERR_SURFACELOST) {
735 result = m_pBackBuffer->Restore();
736 if (result != DD_OK) {
737 Error("Restore of back buffer failed", result);
738 return FALSE;
739 }
740 }
741 }
742
743 if (m_pZBuffer != NULL) {
744 if (m_pZBuffer->IsLost() == DDERR_SURFACELOST) {
745 result = m_pZBuffer->Restore();
746 if (result != DD_OK) {
747 Error("Restore of Z-buffer failed", result);
748 return FALSE;
749 }
750 }
751 }
752
753 if (m_pText1Surface != NULL) {
754 if (m_pText1Surface->IsLost() == DDERR_SURFACELOST) {
755 result = m_pText1Surface->Restore();
756 if (result != DD_OK) {
757 Error("Restore of text surface 1 failed", result);
758 return FALSE;
759 }
760 }
761 }
762
763 if (m_pText2Surface != NULL) {
764 if (m_pText2Surface->IsLost() == DDERR_SURFACELOST) {
765 result = m_pText2Surface->Restore();
766 if (result != DD_OK) {
767 Error("Restore of text surface 2 failed", result);
768 return FALSE;
769 }
770 }
771 }
772
773 return TRUE;
774}
775
776// FUNCTION: LEGO1 0x1009e5e0
777// FUNCTION: BETA10 0x10122087
779{
780 HRESULT result; // eax
781 LPDIRECTDRAWSURFACE lpZBuffer; // [esp+8h] [ebp-70h] BYREF
782 DDSURFACEDESC ddsd;
783
784 memset(&ddsd, 0, sizeof(ddsd));
785 ddsd.dwSize = sizeof(ddsd);
789 ddsd.dwZBufferBitDepth = depth;
790 ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | memorytype;
791 result = CreateDDSurface(&ddsd, &lpZBuffer, 0);
792
793 if (result != DD_OK) {
794 Error("CreateSurface for fullScreen Z-buffer failed", result);
795 return FALSE;
796 }
797
798 result = m_pBackBuffer->AddAttachedSurface(lpZBuffer);
799 if (result != DD_OK) {
800 Error("AddAttachedBuffer failed for Z-Buffer", result);
801 return FALSE;
802 }
803
804 m_pZBuffer = lpZBuffer;
805 return TRUE;
806}
807
808// FUNCTION: LEGO1 0x1009e6a0
809// FUNCTION: BETA10 0x10122166
811{
812 if (p_pause) {
813 ++m_pauseCount;
814
815 if (m_pauseCount > 1) {
816 return TRUE;
817 }
818
820 return FALSE;
821 }
822
823 if (m_bFullScreen) {
824 if (!FlipToGDISurface()) {
825 return FALSE;
826 }
827
828 DrawMenuBar(m_hWndMain);
829 RedrawWindow(m_hWndMain, NULL, NULL, RDW_FRAME);
830 }
831 }
832 else {
833 --m_pauseCount;
834
835 if (m_pauseCount > 0) {
836 return TRUE;
837 }
838
839 if (m_pauseCount < 0) {
840 m_pauseCount = 0;
841 }
842
843 if (!RestorePaletteEntries()) {
844 return FALSE;
845 }
846 }
847
848 return TRUE;
849}
850
851// FUNCTION: LEGO1 0x1009e750
852// FUNCTION: BETA10 0x101223c9
854{
855
857 if (m_pPalette) {
858 HRESULT result;
859
860 result =
861 m_pPalette->SetEntries(0, 0, sizeof(m_paletteEntries) / sizeof(m_paletteEntries[0]), m_paletteEntries);
862 if (result != DD_OK) {
863 Error("SetEntries failed", result);
864 return FALSE;
865 }
866 }
867 }
868
869 return TRUE;
870}
871
872// FUNCTION: LEGO1 0x1009e7a0
873// FUNCTION: BETA10 0x10122458
875{
877 if (m_pPalette) {
878 HRESULT result;
879
880 result = m_pPalette->SetEntries(
881 0,
882 0,
885 );
886 if (result != DD_OK) {
887 Error("SetEntries failed", result);
888 return FALSE;
889 }
890 }
891 }
892
893 return TRUE;
894}
895
896// FUNCTION: LEGO1 0x1009e7f0
897// FUNCTION: BETA10 0x101224d9
899{
900
901 if (m_pDirectDraw) {
902 HRESULT result;
903
904 result = m_pDirectDraw->FlipToGDISurface();
905 if (result != DD_OK) {
906 Error("FlipToGDISurface failed", result);
907 }
908 return (result == DD_OK);
909 }
910
911 return TRUE;
912}
913
914// FUNCTION: LEGO1 0x1009e830
915// FUNCTION: BETA10 0x101225b9
916void MxDirectDraw::Error(const char* p_message, int p_error)
917{
918 // ~GLOBAL: LEGO1 0x10100c70
919 // ~GLOBAL: BETA10 0x101ff1cc
920 static BOOL g_isInsideError = FALSE;
921
922 if (g_isInsideError) {
923 return;
924 }
925
926 g_isInsideError = TRUE;
927 Destroy();
928 if (m_pErrorHandler) {
929 m_pErrorHandler(p_message, p_error, m_pErrorHandlerArg);
930 }
931 g_isInsideError = FALSE;
932}
933
934// FUNCTION: LEGO1 0x1009e880
935// FUNCTION: BETA10 0x10122630
937{
938 switch (p_error) {
939 case DD_OK:
940 return "No error.";
942 return "This object is already initialized.";
944 return "Return if a clipper object is attached to the source surface passed into a BltFast call.";
946 return "This surface can not be attached to the requested surface.";
948 return "This surface can not be detached from the requested surface.";
950 return "Windows can not create any more DCs.";
952 return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.";
954 return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.";
956 return "No src color key specified for this operation.";
958 return "Support is currently not available.";
960 return "A DirectDraw object representing this driver has already been created for this process.";
961 case DDERR_EXCEPTION:
962 return "An exception was encountered while performing the requested operation.";
964 return "An attempt was made to set the cooperative level when it was already set to exclusive.";
965 case DDERR_GENERIC:
966 return "Generic failure.";
968 return "Height of rectangle provided is not a multiple of reqd alignment.";
970 return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or "
971 "palettes created.";
973 return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring "
974 "state.";
976 return "This surface can not be restored because it is an implicitly created surface.";
978 return "Unable to match primary surface creation request with existing primary surface.";
980 return "One or more of the caps bits passed to the callback are incorrect.";
982 return "DirectDraw does not support the provided cliplist.";
984 return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.";
986 return "DirectDraw does not support the requested mode.";
988 return "DirectDraw received a pointer that was an invalid DIRECTDRAW object.";
990 return "One or more of the parameters passed to the function are incorrect.";
992 return "The pixel format was invalid as specified.";
994 return "Returned when the position of the overlay on the destination is no longer legal for that "
995 "destination.";
997 return "Rectangle provided was invalid.";
999 return "Operation could not be carried out because one or more surfaces are locked.";
1000 case DDERR_NO3D:
1001 return "There is no 3D present.";
1002 case DDERR_NOALPHAHW:
1003 return "Operation could not be carried out because there is no alpha accleration hardware present or "
1004 "available.";
1005 case DDERR_NOBLTHW:
1006 return "No blitter hardware present.";
1007 case DDERR_NOCLIPLIST:
1008 return "No cliplist available.";
1010 return "No clipper object attached to surface object.";
1012 return "Operation could not be carried out because there is no color conversion hardware present or "
1013 "available.";
1014 case DDERR_NOCOLORKEY:
1015 return "Surface doesn't currently have a color key";
1016 case DDERR_NOCOLORKEYHW:
1017 return "Operation could not be carried out because there is no hardware support of the destination color "
1018 "key.";
1020 return "Create function called without DirectDraw object method SetCooperativeLevel being called.";
1021 case DDERR_NODC:
1022 return "No DC was ever created for this surface.";
1023 case DDERR_NODDROPSHW:
1024 return "No DirectDraw ROP hardware.";
1026 return "A hardware-only DirectDraw object creation was attempted but the driver did not support any "
1027 "hardware.";
1028 case DDERR_NOEMULATION:
1029 return "Software emulation not available.";
1031 return "Operation requires the application to have exclusive mode but the application does not have exclusive "
1032 "mode.";
1033 case DDERR_NOFLIPHW:
1034 return "Flipping visible surfaces is not supported.";
1035 case DDERR_NOGDI:
1036 return "There is no GDI present.";
1037 case DDERR_NOHWND:
1038 return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel "
1039 "HWND.";
1040 case DDERR_NOMIRRORHW:
1041 return "Operation could not be carried out because there is no hardware present or available.";
1043 return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on "
1044 "to establish a destination.";
1045 case DDERR_NOOVERLAYHW:
1046 return "Operation could not be carried out because there is no overlay hardware present or available.";
1048 return "No palette object attached to this surface.";
1049 case DDERR_NOPALETTEHW:
1050 return "No hardware support for 16 or 256 color palettes.";
1051 case DDERR_NORASTEROPHW:
1052 return "Operation could not be carried out because there is no appropriate raster op hardware present or "
1053 "available.";
1054 case DDERR_NOROTATIONHW:
1055 return "Operation could not be carried out because there is no rotation hardware present or available.";
1056 case DDERR_NOSTRETCHHW:
1057 return "Operation could not be carried out because there is no hardware support for stretching.";
1058 case DDERR_NOT4BITCOLOR:
1059 return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color "
1060 "palette.";
1062 return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color "
1063 "index palette.";
1064 case DDERR_NOT8BITCOLOR:
1065 return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.";
1067 return "Returned when an overlay member is called for a non-overlay surface.";
1068 case DDERR_NOTEXTUREHW:
1069 return "Operation could not be carried out because there is no texture mapping hardware present or "
1070 "available.";
1071 case DDERR_NOTFLIPPABLE:
1072 return "An attempt has been made to flip a surface that is not flippable.";
1073 case DDERR_NOTFOUND:
1074 return "Requested item was not found.";
1075 case DDERR_NOTLOCKED:
1076 return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this "
1077 "process, has been attempted.";
1079 return "The surface being used is not a palette-based surface.";
1080 case DDERR_NOVSYNCHW:
1081 return "Operation could not be carried out because there is no hardware support for vertical blank "
1082 "synchronized operations.";
1083 case DDERR_NOZBUFFERHW:
1084 return "Operation could not be carried out because there is no hardware support for zbuffer blitting.";
1085 case DDERR_NOZOVERLAYHW:
1086 return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support "
1087 "z layering of overlays.";
1088 case DDERR_OUTOFCAPS:
1089 return "The hardware needed for the requested operation has already been allocated.";
1090 case DDERR_OUTOFMEMORY:
1091 return "DirectDraw does not have enough memory to perform the operation.";
1093 return "DirectDraw does not have enough memory to perform the operation.";
1095 return "The hardware does not support clipped overlays.";
1097 return "Can only have ony color key active at one time for overlays.";
1099 return "Returned when GetOverlayPosition is called on a hidden overlay.";
1100 case DDERR_PALETTEBUSY:
1101 return "Access to this palette is being refused because the palette is already locked by another thread.";
1103 return "This process already has created a primary surface.";
1105 return "Region passed to Clipper::GetClipList is too small.";
1107 return "This surface is already attached to the surface it is being attached to.";
1109 return "This surface is already a dependency of the surface it is being made a dependency of.";
1110 case DDERR_SURFACEBUSY:
1111 return "Access to this surface is being refused because the surface is already locked by another thread.";
1113 return "Access to surface refused because the surface is obscured.";
1114 case DDERR_SURFACELOST:
1115 return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface "
1116 "object representing this surface should have Restore called on it.";
1118 return "The requested surface is not attached.";
1119 case DDERR_TOOBIGHEIGHT:
1120 return "Height requested by DirectDraw is too large.";
1121 case DDERR_TOOBIGSIZE:
1122 return "Size requested by DirectDraw is too large, but the individual height and width are OK.";
1123 case DDERR_TOOBIGWIDTH:
1124 return "Width requested by DirectDraw is too large.";
1125 case DDERR_UNSUPPORTED:
1126 return "Action not supported.";
1128 return "FOURCC format requested is unsupported by DirectDraw.";
1130 return "Bitmask in the pixel format requested is unsupported by DirectDraw.";
1132 return "Vertical blank is in progress.";
1134 return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is "
1135 "incomplete.";
1136 case DDERR_WRONGMODE:
1137 return "This surface can not be restored because it was created in a different mode.";
1138 case DDERR_XALIGN:
1139 return "Rectangle provided was not horizontally aligned on required boundary.";
1140 default:
1141 return "Unrecognized error value.";
1142 }
1143}
Class responsible for interfacing with DirectDraw to manage rendering surfaces, palettes,...
Definition: mxdirectdraw.h:17
void FUN_1009d920()
Internal: Restores original palette and resets display mode and cooperative level.
IDirectDrawSurface * m_pBackBuffer
Backbuffer for offscreen rendering/flipping. [AI].
Definition: mxdirectdraw.h:290
BOOL IsSupportedMode(int width, int height, int bpp)
Checks if the given mode (resolution, bpp) is supported by the current device.
PALETTEENTRY m_originalPaletteEntries[256]
Backup of system/Windows palette for restoration. [AI].
Definition: mxdirectdraw.h:297
BOOL m_bIgnoreWMSIZE
Internal flag to suppress window resize messages during device switching. [AI].
Definition: mxdirectdraw.h:302
BOOL DDInit(BOOL fullscreen)
Initializes DirectDraw cooperative level for fullscreen or windowed mode.
PALETTEENTRY m_paletteEntries[256]
Active 8-bit palette entries for palettized modes. [AI].
Definition: mxdirectdraw.h:296
BOOL SetPaletteEntries(const PALETTEENTRY *pPaletteEntries, int paletteEntryCount, BOOL fullscreen)
Sets the DirectDraw palette using the provided palette entries.
BOOL m_bOnlySoftRender
If TRUE, restricts rendering to software only; disables hardware acceleration. [AI].
Definition: mxdirectdraw.h:286
HRESULT CreateDDSurface(LPDDSURFACEDESC a2, LPDIRECTDRAWSURFACE *a3, IUnknown *a4)
Creates a DirectDraw surface with the given surface description.
IDirectDrawClipper * m_pClipper
Clipper for managing windowed surface boundaries. [AI].
Definition: mxdirectdraw.h:294
BOOL CacheOriginalPaletteEntries()
Caches the original Windows/system palette for restoration.
IDirectDrawSurface * m_pText2Surface
Debug overlay surface for "text2". [AI].
Definition: mxdirectdraw.h:293
static int GetPrimaryBitDepth()
Returns the bit depth (color depth) of the primary display device.
BOOL m_bPrimaryPalettized
TRUE if primary/backbuffer is using 8-bit palettized mode. [AI].
Definition: mxdirectdraw.h:303
virtual const char * ErrorToString(HRESULT p_error)
Converts DirectDraw error code to a human-readable string.
ErrorHandler m_pErrorHandler
Callback for non-fatal DirectDraw errors. [AI].
Definition: mxdirectdraw.h:308
IDirectDrawSurface * m_pZBuffer
Attached Z-buffer for 3D rendering. [AI].
Definition: mxdirectdraw.h:291
SIZE m_text2SizeOnSurface
Pixel size of rendered text2 overlay surface. [AI].
Definition: mxdirectdraw.h:299
DeviceModesInfo::Mode m_currentMode
Struct with current width, height, and bits per pixel. [AI].
Definition: mxdirectdraw.h:314
HFONT m_hFont
Font handle for debug text overlays. [AI].
Definition: mxdirectdraw.h:301
BOOL TextToTextSurface(const char *text, IDirectDrawSurface *pSurface, SIZE &textSizeOnSurface)
Renders a string to the given surface and fills in its onscreen size.
BOOL TextToTextSurface1(const char *text)
Draws the specified text string to the debug "text1" surface.
DeviceModesInfo * m_currentDevInfo
Device info array for storing supported display modes. [AI].
Definition: mxdirectdraw.h:313
int FlipToGDISurface()
Flips to the Windows GDI surface, restoring the desktop when leaving exclusive fullscreen.
BOOL DDCreateSurfaces()
Internal: Creates all necessary front/back/offscreen surfaces for rendering.
BOOL m_bOnlySystemMemory
TRUE for system RAM-only surfaces; disables video memory allocation. [AI].
Definition: mxdirectdraw.h:306
ErrorHandler m_pFatalErrorHandler
Callback invoked for fatal device errors. [AI].
Definition: mxdirectdraw.h:309
IDirectDrawSurface * m_pText1Surface
Debug overlay surface for "text1". [AI].
Definition: mxdirectdraw.h:292
virtual void Destroy()
Shuts down DirectDraw and releases all resources, including device and surfaces.
IDirectDrawSurface * m_pFrontBuffer
Primary or front display surface. [AI].
Definition: mxdirectdraw.h:289
SIZE m_text1SizeOnSurface
Pixel size of rendered text1 overlay surface. [AI].
Definition: mxdirectdraw.h:298
void * m_pErrorHandlerArg
Custom argument pointer for error handler. [AI].
Definition: mxdirectdraw.h:310
void * m_pFatalErrorHandlerArg
Custom argument pointer for fatal error handler. [AI].
Definition: mxdirectdraw.h:311
BOOL CreateZBuffer(DWORD memorytype, DWORD depth)
Creates a z-buffer with the given memory type/capabilities and attaches it to the back buffer.
virtual void DestroyButNotDirectDraw()
Releases all DirectDraw-related resources except the DirectDraw device itself.
BOOL TextToTextSurface2(const char *lpString)
Draws the specified string to the debug "text2" surface.
IDirectDraw * m_pDirectDraw
Pointer to the DirectDraw COM device. [AI].
Definition: mxdirectdraw.h:288
MxDirectDraw()
Constructs a MxDirectDraw instance and initializes its members.
HWND m_hWndMain
Main window handle on which DirectDraw is initialized. [AI].
Definition: mxdirectdraw.h:300
void Error(const char *p_message, int p_error)
Invokes the error handler, optionally destroying the device, and outputs the given error message/code...
BOOL RestorePaletteEntries()
Restores the active DirectDraw palette entries from the internal palette array.
IDirectDrawPalette * m_pPalette
DirectDraw palette assigned to the primary/back surfaces. [AI].
Definition: mxdirectdraw.h:295
BOOL DDSetMode(int width, int height, int bpp)
Changes DirectDraw to the specified display mode and creates relevant surfaces.
int Pause(BOOL)
Pauses or resumes DirectDraw rendering.
BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf)
Retrieves the surface description for the given DirectDraw surface.
int m_pauseCount
Count of nested pauses; ensures multiple Pause(TRUE)/Pause(FALSE) work correctly. [AI].
Definition: mxdirectdraw.h:312
BOOL m_bFlipSurfaces
TRUE if using DirectDraw flipping (fullscreen buffer swap); windowed disables this....
Definition: mxdirectdraw.h:287
BOOL m_bFullScreen
TRUE if device is in exclusive fullscreen mode. [AI].
Definition: mxdirectdraw.h:304
virtual ~MxDirectDraw()
Virtual destructor.
BOOL RestoreOriginalPaletteEntries()
Restores the original Windows palette from backup.
void FUN_1009e020()
Internal: Clears the backbuffer(s), locking and filling with zero color, possibly flipping to front.
BOOL RecreateDirectDraw(GUID **a2)
Recreates the DirectDraw device, deleting and restoring the device object pointer.
BOOL RestoreSurfaces()
Attempts to restore all DirectDraw surfaces that may have been lost.
virtual BOOL Create(HWND hWnd, BOOL fullscreen_1, BOOL surface_fullscreen, BOOL onlySystemMemory, int width, int height, int bpp, const PALETTEENTRY *pPaletteEntries, int paletteEntryCount)
Creates and initializes the DirectDraw device and associated surfaces/windows/state.
BOOL m_bIsOnPrimaryDevice
TRUE if rendering on Windows' main display; disables windowed mode for other devices....
Definition: mxdirectdraw.h:307
BOOL CreateTextSurfaces()
Creates the two offscreen text surfaces used for debug overlay.
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE
Definition: ddraw.h:3440
#define DDSD_WIDTH
Definition: ddraw.h:1174
#define DDERR_NOT8BITCOLOR
Definition: ddraw.h:3390
#define DDERR_NOSTRETCHHW
Definition: ddraw.h:3372
#define IUnknown
Definition: ddraw.h:28
#define DDERR_NOTAOVERLAYSURFACE
Definition: ddraw.h:3652
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:1458
#define DDSCL_NORMAL
Definition: ddraw.h:2546
#define DDERR_INVALIDRECT
Definition: ddraw.h:3271
#define DDERR_NOT4BITCOLORINDEX
Definition: ddraw.h:3384
#define DDERR_HEIGHTALIGN
Definition: ddraw.h:3229
#define DDERR_NOOVERLAYDEST
Definition: ddraw.h:3641
struct _DDSURFACEDESC FAR * LPDDSURFACEDESC
Definition: ddraw.h:83
#define DDERR_INVALIDPIXELFORMAT
Definition: ddraw.h:3266
#define DDERR_VERTICALBLANKINPROGRESS
Definition: ddraw.h:3530
#define DDPCAPS_ALLOW256
Definition: ddraw.h:2122
#define DDERR_NOTFLIPPABLE
Definition: ddraw.h:3663
#define DDERR_NOVSYNCHW
Definition: ddraw.h:3402
#define DDERR_NODC
Definition: ddraw.h:3685
struct IDirectDrawSurface FAR * LPDIRECTDRAWSURFACE
Definition: ddraw.h:74
#define DDERR_OVERLAYCANTCLIP
Definition: ddraw.h:3435
#define DDERR_WRONGMODE
Definition: ddraw.h:3691
#define DDSD_HEIGHT
Definition: ddraw.h:1169
#define DDERR_OUTOFCAPS
Definition: ddraw.h:3420
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:1405
#define DDERR_NOFLIPHW
Definition: ddraw.h:3332
#define DDSD_ZBUFFERBITDEPTH
Definition: ddraw.h:1189
#define DDERR_UNSUPPORTEDMASK
Definition: ddraw.h:3525
#define DDERR_INVALIDCAPS
Definition: ddraw.h:3240
#define DDERR_INVALIDOBJECT
Definition: ddraw.h:3255
#define DDERR_INVALIDMODE
Definition: ddraw.h:3250
#define DDERR_CANNOTATTACHSURFACE
Definition: ddraw.h:3204
#define DDERR_UNSUPPORTEDFORMAT
Definition: ddraw.h:3520
#define DDERR_NOZOVERLAYHW
Definition: ddraw.h:3414
#define DDERR_NOTFOUND
Definition: ddraw.h:3348
#define DDERR_SURFACELOST
Definition: ddraw.h:3489
#define DDERR_NOOVERLAYHW
Definition: ddraw.h:3354
#define DDSCL_EXCLUSIVE
Definition: ddraw.h:2551
#define DDERR_NOT4BITCOLOR
Definition: ddraw.h:3378
#define DDERR_SURFACEALREADYDEPENDENT
Definition: ddraw.h:3462
#define DDERR_SURFACEISOBSCURED
Definition: ddraw.h:3482
#define DDERR_NOHWND
Definition: ddraw.h:3592
#define DDERR_INCOMPATIBLEPRIMARY
Definition: ddraw.h:3235
typedef DWORD(FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper
#define DDERR_EXCEPTION
Definition: ddraw.h:3219
#define DDERR_EXCLUSIVEMODEALREADYSET
Definition: ddraw.h:3658
#define DDERR_NOCLIPLIST
Definition: ddraw.h:3293
#define DDSCL_ALLOWREBOOT
Definition: ddraw.h:2535
#define DDERR_PALETTEBUSY
Definition: ddraw.h:3446
#define DDERR_NOCOLORCONVHW
Definition: ddraw.h:3299
struct _DDSURFACEDESC DDSURFACEDESC
#define DDERR_WASSTILLDRAWING
Definition: ddraw.h:3536
#define DDERR_HWNDSUBCLASSED
Definition: ddraw.h:3598
#define DDERR_NOEXCLUSIVEMODE
Definition: ddraw.h:3327
#define DDERR_OVERLAYNOTVISIBLE
Definition: ddraw.h:3635
#define DDERR_NODDROPSHW
Definition: ddraw.h:3630
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:3425
#define DDERR_TOOBIGSIZE
Definition: ddraw.h:3505
#define DDSCAPS_OFFSCREENPLAIN
Definition: ddraw.h:1385
#define DDERR_NOZBUFFERHW
Definition: ddraw.h:3408
#define DDERR_CANTCREATEDC
Definition: ddraw.h:3680
#define DDERR_HWNDALREADYSET
Definition: ddraw.h:3604
#define DDERR_NOPALETTEATTACHED
Definition: ddraw.h:3609
#define DDERR_NO3D
Definition: ddraw.h:3281
#define DDERR_XALIGN
Definition: ddraw.h:3542
HWND hWnd
Definition: ddraw.h:425
#define DDERR_NOCOLORKEY
Definition: ddraw.h:3310
#define DDERR_CURRENTLYNOTAVAIL
Definition: ddraw.h:3214
#define DDERR_OUTOFVIDEOMEMORY
Definition: ddraw.h:3430
#define DDERR_NOCOOPERATIVELEVELSET
Definition: ddraw.h:3305
#define DD_OK
Definition: ddraw.h:3166
#define DDERR_SURFACENOTATTACHED
Definition: ddraw.h:3494
#define DDSCAPS_FLIP
Definition: ddraw.h:1366
#define DDERR_DIRECTDRAWALREADYCREATED
Definition: ddraw.h:3554
#define DDPF_PALETTEINDEXED8
Definition: ddraw.h:2399
#define DDSCAPS_BACKBUFFER
Definition: ddraw.h:1346
#define DDPCAPS_8BIT
Definition: ddraw.h:2096
#define DDERR_NOCOLORKEYHW
Definition: ddraw.h:3316
#define DDERR_COLORKEYNOTSET
Definition: ddraw.h:3451
long HRESULT
Definition: ddraw.h:115
#define DDERR_UNSUPPORTED
Definition: ddraw.h:3515
#define DDERR_REGIONTOOSMALL
Definition: ddraw.h:3575
#define DDSCAPS_3DDEVICE
Definition: ddraw.h:1432
#define DDFLIP_WAIT
Definition: ddraw.h:2745
#define DDERR_TOOBIGWIDTH
Definition: ddraw.h:3510
#define DDERR_NOGDI
Definition: ddraw.h:3337
#define DDERR_NOPALETTEHW
Definition: ddraw.h:3614
#define DDERR_INVALIDDIRECTDRAWGUID
Definition: ddraw.h:3548
#define DDCKEY_SRCBLT
Definition: ddraw.h:2237
#define DDERR_CANTDUPLICATE
Definition: ddraw.h:3669
#define DDERR_GENERIC
Definition: ddraw.h:3224
#define DDERR_INVALIDCLIPLIST
Definition: ddraw.h:3245
#define DDERR_NOCLIPPERATTACHED
Definition: ddraw.h:3586
#define DDERR_IMPLICITLYCREATED
Definition: ddraw.h:3697
#define DDERR_NOTPALETTIZED
Definition: ddraw.h:3702
struct IDirectDraw FAR * LPDIRECTDRAW
Definition: ddraw.h:72
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:3261
#define DDERR_NOALPHAHW
Definition: ddraw.h:3287
#define DDSD_CAPS
Definition: ddraw.h:1164
#define DDERR_CLIPPERISUSINGHWND
Definition: ddraw.h:3581
#define DDERR_NOROTATIONHW
Definition: ddraw.h:3366
#define DDERR_NORASTEROPHW
Definition: ddraw.h:3360
#define DDERR_LOCKEDSURFACES
Definition: ddraw.h:3276
#define DDERR_SURFACEALREADYATTACHED
Definition: ddraw.h:3456
#define DDERR_NOEMULATION
Definition: ddraw.h:3570
#define DDERR_ALREADYINITIALIZED
Definition: ddraw.h:3199
#define DDERR_NOTLOCKED
Definition: ddraw.h:3675
#define DDERR_NOTEXTUREHW
Definition: ddraw.h:3396
#define DDERR_CANNOTDETACHSURFACE
Definition: ddraw.h:3209
#define DDERR_SURFACEBUSY
Definition: ddraw.h:3468
#define DDERR_NOBLTHW
Definition: ddraw.h:3625
#define DDERR_NODIRECTDRAWHW
Definition: ddraw.h:3560
#define DDSCAPS_SYSTEMMEMORY
Definition: ddraw.h:1419
#define DDERR_INVALIDPOSITION
Definition: ddraw.h:3647
#define DDERR_TOOBIGHEIGHT
Definition: ddraw.h:3499
#define DDPCAPS_INITIALIZE
Definition: ddraw.h:2103
#define DDSD_BACKBUFFERCOUNT
Definition: ddraw.h:1184
#define DDERR_PRIMARYSURFACEALREADYEXISTS
Definition: ddraw.h:3565
#define DDERR_BLTFASTCANTCLIP
Definition: ddraw.h:3620
#define DDSCAPS_COMPLEX
Definition: ddraw.h:1355
#define DDERR_NOMIRRORHW
Definition: ddraw.h:3343
#define DDSCL_FULLSCREEN
Definition: ddraw.h:2530
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define sizeOfArray(arr)
Definition: decomp.h:23
typedef BOOL(FAR PASCAL *LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#define RELEASE(x)
Definition: mxdirect3d.cpp:8
BOOL g_isPaletteIndexed8
void EnableResizing(HWND p_hwnd, BOOL p_flag)
void DeleteObject(MxDSAction &p_dsAction)
[AI] Deletes the specified action object, removing it from the global action list.
Definition: mxmisc.cpp:105
[AI] Represents a specific display mode supported by the device (width, height, bits per pixel).
Definition: mxdirectxinfo.h:22
int bitsPerPixel
[AI] Color depth (bits per pixel)
Definition: mxdirectxinfo.h:35
int width
[AI] Horizontal resolution in pixels
Definition: mxdirectxinfo.h:33
int height
[AI] Vertical resolution in pixels
Definition: mxdirectxinfo.h:34
Mode * m_modeArray
[AI] Array of supported display modes; dynamically allocated and owned.
Definition: mxdirectxinfo.h:49
int m_count
[AI] Number of display modes in m_modeArray.
Definition: mxdirectxinfo.h:50
GUID * m_guid
[AI] GUID of the video device (heap-allocated and owned by this struct).
Definition: mxdirectxinfo.h:48
DWORD dwRGBBitCount
Definition: ddraw.h:348
DWORD dwFlags
Definition: ddraw.h:344
DWORD dwCaps
Definition: ddraw.h:196
DDSCAPS ddsCaps
Definition: ddraw.h:1158
LPVOID lpSurface
Definition: ddraw.h:1152
DDPIXELFORMAT ddpfPixelFormat
Definition: ddraw.h:1157
LONG lPitch
Definition: ddraw.h:1140
DWORD dwZBufferBitDepth
Definition: ddraw.h:1147
DWORD dwSize
Definition: ddraw.h:1134
DWORD dwFlags
Definition: ddraw.h:1135
DWORD dwWidth
Definition: ddraw.h:1137
DWORD dwBackBufferCount
Definition: ddraw.h:1143
DWORD dwHeight
Definition: ddraw.h:1136