Index: ddraw/glDirectDraw.cpp |
— | — | @@ -772,7 +772,7 @@ |
773 | 773 | else if(lpDDHELCaps) ddCaps.dwSize = lpDDHELCaps->dwSize;
|
774 | 774 | else ERR(DDERR_INVALIDPARAMS);
|
775 | 775 | ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTCOLORFILL | DDCAPS_BLTSTRETCH |
|
776 | | - DDCAPS_GDI | DDCAPS_PALETTE | DDCAPS_CANBLTSYSMEM;
|
| 776 | + DDCAPS_COLORKEY | DDCAPS_GDI | DDCAPS_PALETTE | DDCAPS_CANBLTSYSMEM;
|
777 | 777 | ddCaps.dwCaps2 = DDCAPS2_CANRENDERWINDOWED | DDCAPS2_WIDESURFACES | DDCAPS2_NOPAGELOCKREQUIRED |
|
778 | 778 | DDCAPS2_FLIPINTERVAL | DDCAPS2_FLIPNOVSYNC;
|
779 | 779 | ddCaps.dwFXCaps = DDFXCAPS_BLTSHRINKX | DDFXCAPS_BLTSHRINKY |
|
— | — | @@ -779,7 +779,7 @@ |
780 | 780 | DDFXCAPS_BLTSTRETCHX | DDFXCAPS_BLTSTRETCHY;
|
781 | 781 | ddCaps.dwPalCaps = DDPCAPS_8BIT | DDPCAPS_PRIMARYSURFACE;
|
782 | 782 | ddCaps.ddsOldCaps.dwCaps = ddCaps.ddsCaps.dwCaps =
|
783 | | - DDSCAPS_BACKBUFFER | DDSCAPS_COMPLEX | DDCAPS_COLORKEY | DDSCAPS_FLIP |
|
| 783 | + DDSCAPS_BACKBUFFER | DDSCAPS_COMPLEX | DDSCAPS_FLIP |
|
784 | 784 | DDSCAPS_FRONTBUFFER | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PALETTE |
|
785 | 785 | DDSCAPS_SYSTEMMEMORY | DDSCAPS_VIDEOMEMORY;
|
786 | 786 | ddCaps.dwCKeyCaps = DDCKEYCAPS_SRCBLT;
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -579,6 +579,14 @@ |
580 | 580 | }
|
581 | 581 | HRESULT WINAPI glDirectDrawSurface7::Flip(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags)
|
582 | 582 | {
|
| 583 | + HRESULT ret = Flip2(lpDDSurfaceTargetOverride,dwFlags);
|
| 584 | + if(ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) RenderScreen(texture,this);
|
| 585 | + return ret;
|
| 586 | +}
|
| 587 | +HRESULT glDirectDrawSurface7::Flip2(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags)
|
| 588 | +{
|
| 589 | + DWORD i;
|
| 590 | + glDirectDrawSurface7 *tmp;
|
583 | 591 | if(dwFlags & DDFLIP_NOVSYNC) swapinterval=0;
|
584 | 592 | else
|
585 | 593 | {
|
— | — | @@ -588,13 +596,34 @@ |
589 | 597 | else swapinterval=1;
|
590 | 598 | }
|
591 | 599 | int flips = 1;
|
592 | | - if(lpDDSurfaceTargetOverride) ERR(DDERR_GENERIC);
|
| 600 | + if(lpDDSurfaceTargetOverride)
|
| 601 | + {
|
| 602 | + bool success = false;
|
| 603 | + if(lpDDSurfaceTargetOverride == this) return DD_OK;
|
| 604 | + tmp = this;
|
| 605 | + for(i = 0; i < ddsd.dwBackBufferCount; i++)
|
| 606 | + {
|
| 607 | + tmp = tmp->GetBackbuffer();
|
| 608 | + if(lpDDSurfaceTargetOverride == tmp)
|
| 609 | + {
|
| 610 | + success = true;
|
| 611 | + i++;
|
| 612 | + break;
|
| 613 | + }
|
| 614 | + }
|
| 615 | + if(!success) return DDERR_INVALIDPARAMS;
|
| 616 | + for(DWORD x = 0; x < i; x++)
|
| 617 | + {
|
| 618 | + if(x == i-1) return Flip2(NULL,dwFlags);
|
| 619 | + else Flip2(NULL,0);
|
| 620 | + }
|
| 621 | + }
|
593 | 622 | if(ddsd.ddsCaps.dwCaps & DDSCAPS_FLIP)
|
594 | 623 | {
|
595 | 624 | if(ddsd.ddsCaps.dwCaps & DDSCAPS_BACKBUFFER) return DDERR_INVALIDOBJECT;
|
596 | 625 | GLuint *textures = new GLuint[ddsd.dwBackBufferCount+1];
|
597 | 626 | textures[0] = texture;
|
598 | | - glDirectDrawSurface7 *tmp = this;
|
| 627 | + tmp = this;
|
599 | 628 | if(dirty & 1)
|
600 | 629 | {
|
601 | 630 | renderer->UploadTexture(buffer,bigbuffer,texture,ddsd.dwWidth,ddsd.dwHeight,
|
— | — | @@ -603,7 +632,7 @@ |
604 | 633 | dirty &= ~1;
|
605 | 634 | }
|
606 | 635 | this->dirty |= 2;
|
607 | | - for(DWORD i = 0; i < ddsd.dwBackBufferCount; i++)
|
| 636 | + for(i = 0; i < ddsd.dwBackBufferCount; i++)
|
608 | 637 | {
|
609 | 638 | tmp = tmp->GetBackbuffer();
|
610 | 639 | if(tmp->dirty & 1)
|
— | — | @@ -626,7 +655,6 @@ |
627 | 656 | tmp = tmp->GetBackbuffer();
|
628 | 657 | tmp->SetTexture(textures[i+1]);
|
629 | 658 | }
|
630 | | - RenderScreen(textures[0],this);
|
631 | 659 | delete textures;
|
632 | 660 | }
|
633 | 661 | else return DDERR_NOTFLIPPABLE;
|
— | — | @@ -1124,7 +1152,9 @@ |
1125 | 1153 | }
|
1126 | 1154 | HRESULT WINAPI glDirectDrawSurface1::Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags)
|
1127 | 1155 | {
|
1128 | | - return glDDS7->Flip((LPDIRECTDRAWSURFACE7)lpDDSurfaceTargetOverride,dwFlags);
|
| 1156 | + if(lpDDSurfaceTargetOverride)
|
| 1157 | + return glDDS7->Flip(((glDirectDrawSurface1*)lpDDSurfaceTargetOverride)->GetDDS7(),dwFlags);
|
| 1158 | + else return glDDS7->Flip(NULL,dwFlags);
|
1129 | 1159 | }
|
1130 | 1160 | HRESULT WINAPI glDirectDrawSurface1::GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE FAR *lplpDDAttachedSurface)
|
1131 | 1161 | {
|
— | — | @@ -1304,7 +1334,9 @@ |
1305 | 1335 | }
|
1306 | 1336 | HRESULT WINAPI glDirectDrawSurface2::Flip(LPDIRECTDRAWSURFACE2 lpDDSurfaceTargetOverride, DWORD dwFlags)
|
1307 | 1337 | {
|
1308 | | - return glDDS7->Flip((LPDIRECTDRAWSURFACE7)lpDDSurfaceTargetOverride,dwFlags);
|
| 1338 | + if(lpDDSurfaceTargetOverride)
|
| 1339 | + return glDDS7->Flip(((glDirectDrawSurface2*)lpDDSurfaceTargetOverride)->GetDDS7(),dwFlags);
|
| 1340 | + else return glDDS7->Flip(NULL,dwFlags);
|
1309 | 1341 | }
|
1310 | 1342 | HRESULT WINAPI glDirectDrawSurface2::GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE2 FAR *lplpDDAttachedSurface)
|
1311 | 1343 | {
|
— | — | @@ -1496,7 +1528,9 @@ |
1497 | 1529 | }
|
1498 | 1530 | HRESULT WINAPI glDirectDrawSurface3::Flip(LPDIRECTDRAWSURFACE3 lpDDSurfaceTargetOverride, DWORD dwFlags)
|
1499 | 1531 | {
|
1500 | | - return glDDS7->Flip((LPDIRECTDRAWSURFACE7)lpDDSurfaceTargetOverride,dwFlags);
|
| 1532 | + if(lpDDSurfaceTargetOverride)
|
| 1533 | + return glDDS7->Flip(((glDirectDrawSurface3*)lpDDSurfaceTargetOverride)->GetDDS7(),dwFlags);
|
| 1534 | + else return glDDS7->Flip(NULL,dwFlags);
|
1501 | 1535 | }
|
1502 | 1536 | HRESULT WINAPI glDirectDrawSurface3::GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE3 FAR *lplpDDAttachedSurface)
|
1503 | 1537 | {
|
— | — | @@ -1692,7 +1726,9 @@ |
1693 | 1727 | }
|
1694 | 1728 | HRESULT WINAPI glDirectDrawSurface4::Flip(LPDIRECTDRAWSURFACE4 lpDDSurfaceTargetOverride, DWORD dwFlags)
|
1695 | 1729 | {
|
1696 | | - return glDDS7->Flip((LPDIRECTDRAWSURFACE7)lpDDSurfaceTargetOverride,dwFlags);
|
| 1730 | + if(lpDDSurfaceTargetOverride)
|
| 1731 | + return glDDS7->Flip(((glDirectDrawSurface4*)lpDDSurfaceTargetOverride)->GetDDS7(),dwFlags);
|
| 1732 | + else return glDDS7->Flip(NULL,dwFlags);
|
1697 | 1733 | }
|
1698 | 1734 | HRESULT WINAPI glDirectDrawSurface4::GetAttachedSurface(LPDDSCAPS2 lpDDSCaps2, LPDIRECTDRAWSURFACE4 FAR *lplpDDAttachedSurface)
|
1699 | 1735 | {
|
Index: ddraw/glDirectDrawSurface.h |
— | — | @@ -97,6 +97,7 @@ |
98 | 98 | return texture;
|
99 | 99 | }
|
100 | 100 | void Restore2();
|
| 101 | + HRESULT Flip2(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags);
|
101 | 102 | void SetTexture(GLuint newtexture){texture = newtexture;};
|
102 | 103 | glDirectDrawSurface7 *GetBackbuffer(){return backbuffer;};
|
103 | 104 | glDirectDrawSurface7 *GetZBuffer(){return zbuffer;};
|