Index: ddraw/ShaderGen2D.cpp |
— | — | @@ -62,9 +62,10 @@ |
63 | 63 | Bit 28: (DXGL) Use Clipper
|
64 | 64 | Bit 29: (DXGL) Source color key range
|
65 | 65 | Bit 30: (DXGL) Dest. color key range
|
66 | | -Bit 31: reserved for DXGL usage
|
| 66 | +Bit 31: (DXGL) Render to screen instead of dest
|
67 | 67 | Bits 32-39: Texture type input
|
68 | 68 | Bits 40-47: Texture type output
|
| 69 | +Bit 48: if 1, use screen scale for filtering when applicable
|
69 | 70 | AND the dwFlags by 0xF2FAADFF before packing ROP index bits
|
70 | 71 |
|
71 | 72 | Texture types:
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1471,7 +1471,8 @@ |
1472 | 1472 | if (ddCaps.dwSize < sizeof(DDCAPS_DX3)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
1473 | 1473 | ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTCOLORFILL | DDCAPS_BLTDEPTHFILL | DDCAPS_BLTFOURCC |
|
1474 | 1474 | DDCAPS_BLTSTRETCH | DDCAPS_COLORKEY | DDCAPS_GDI | DDCAPS_PALETTE | DDCAPS_CANBLTSYSMEM |
|
1475 | | - DDCAPS_3D | DDCAPS_CANCLIP | DDCAPS_CANCLIPSTRETCHED | DDCAPS_READSCANLINE;
|
| 1475 | + DDCAPS_3D | DDCAPS_CANCLIP | DDCAPS_CANCLIPSTRETCHED | DDCAPS_READSCANLINE |
|
| 1476 | + DDCAPS_OVERLAY | DDCAPS_OVERLAYSTRETCH;
|
1476 | 1477 | ddCaps.dwCaps2 = DDCAPS2_CANRENDERWINDOWED | DDCAPS2_WIDESURFACES | DDCAPS2_NOPAGELOCKREQUIRED |
|
1477 | 1478 | DDCAPS2_FLIPINTERVAL | DDCAPS2_FLIPNOVSYNC | DDCAPS2_NONLOCALVIDMEM;
|
1478 | 1479 | ddCaps.dwFXCaps = DDFXCAPS_BLTSHRINKX | DDFXCAPS_BLTSHRINKY |
|
— | — | @@ -1484,8 +1485,10 @@ |
1485 | 1486 | DDSCAPS_FRONTBUFFER | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PALETTE |
|
1486 | 1487 | DDSCAPS_SYSTEMMEMORY | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE |
|
1487 | 1488 | DDSCAPS_NONLOCALVIDMEM | DDSCAPS_LOCALVIDMEM | DDSCAPS_TEXTURE |
|
1488 | | - DDSCAPS_MIPMAP;
|
| 1489 | + DDSCAPS_MIPMAP | DDSCAPS_OVERLAY;
|
1489 | 1490 | ddCaps.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
|
| 1491 | + ddCaps.dwMinOverlayStretch = 1;
|
| 1492 | + ddCaps.dwMaxOverlayStretch = 2147483647;
|
1490 | 1493 | ddCaps.dwCKeyCaps = DDCKEYCAPS_SRCBLT | DDCKEYCAPS_DESTBLT;
|
1491 | 1494 | ddCaps.dwZBufferBitDepths = DDBD_16 | DDBD_24 | DDBD_32;
|
1492 | 1495 | ddCaps.dwNumFourCCCodes = GetNumFOURCC();
|
— | — | @@ -1784,7 +1787,7 @@ |
1785 | 1788 | if ((glDD7->primaryx == 640) && (glDD7->primaryy == 480) && dxglcfg.HackCrop640480to640400)
|
1786 | 1789 | glDD7->internaly = (DWORD)((float)glDD7->internaly * 1.2f);
|
1787 | 1790 | if (glDD7->renderer && glDD7->primary) glRenderer_DrawScreen(glDD7->renderer, glDD7->primary->texture,
|
1788 | | - glDD7->primary->texture->palette, 0, NULL, FALSE);
|
| 1791 | + glDD7->primary->texture->palette, 0, NULL, FALSE, NULL, 0);
|
1789 | 1792 | }
|
1790 | 1793 | extern "C" BOOL glDirectDraw7_GetFullscreen(glDirectDraw7 *glDD7)
|
1791 | 1794 | {
|
— | — | @@ -2553,7 +2556,7 @@ |
2554 | 2557 | if(dwFlags & 0xFFFFFFFA) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
2555 | 2558 | if(dwFlags == 5) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
2556 | 2559 | if(!lastsync) lastsync = true;
|
2557 | | - else if(primary) primary->RenderScreen(primary->texture,1,NULL,TRUE);
|
| 2560 | + else if(primary) primary->RenderScreen(primary->texture,1,NULL,TRUE,NULL,0);
|
2558 | 2561 | TRACE_EXIT(23,DD_OK);
|
2559 | 2562 | return DD_OK;
|
2560 | 2563 | }
|
Index: ddraw/glDirectDrawPalette.c |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | #include "timer.h"
|
26 | 26 |
|
27 | 27 | extern DXGLCFG dxglcfg;
|
28 | | -void glDirectDrawSurface7_RenderScreen(LPDIRECTDRAWSURFACE7 surface, int vsync, BOOL settime);
|
| 28 | +void glDirectDrawSurface7_RenderScreen(LPDIRECTDRAWSURFACE7 surface, int vsync, BOOL settime, OVERLAY *overlays, int overlaycount);
|
29 | 29 |
|
30 | 30 | static const DDSURFACEDESC2 ddsd256pal =
|
31 | 31 | {
|
— | — | @@ -254,7 +254,7 @@ |
255 | 255 | if (This->timer)
|
256 | 256 | {
|
257 | 257 | if (DXGLTimer_CheckLastDraw(This->timer, dxglcfg.HackPaletteDelay))
|
258 | | - glDirectDrawSurface7_RenderScreen(This->surface, dxglcfg.HackPaletteVsync, FALSE);
|
| 258 | + glDirectDrawSurface7_RenderScreen(This->surface, dxglcfg.HackPaletteVsync, FALSE, NULL, 0);
|
259 | 259 | }
|
260 | 260 | }
|
261 | 261 | }
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -44,7 +44,6 @@ |
45 | 45 | TRACE_ENTER(5,14,this,14,lpDD7,14,lpDDSurfaceDesc2,14,error,14,palettein);
|
46 | 46 | this->version = version;
|
47 | 47 | creator = NULL;
|
48 | | - overlay = false;
|
49 | 48 | hasstencil = false;
|
50 | 49 | handle = 0;
|
51 | 50 | device = NULL;
|
— | — | @@ -67,6 +66,12 @@ |
68 | 67 | zbuffer = NULL;
|
69 | 68 | attachcount = 0;
|
70 | 69 | attachparent = NULL;
|
| 70 | + overlayenabled = FALSE;
|
| 71 | + overlayset = FALSE;
|
| 72 | + overlaycount = 0;
|
| 73 | + maxoverlays = 0;
|
| 74 | + overlays = NULL;
|
| 75 | + overlaydest = NULL;
|
71 | 76 | this->miplevel = miplevel;
|
72 | 77 | ddInterface = (glDirectDraw7 *)lpDD7;
|
73 | 78 | hRC = ddInterface->renderer->hRC;
|
— | — | @@ -393,6 +398,7 @@ |
394 | 399 | }
|
395 | 400 | glDirectDrawSurface7::~glDirectDrawSurface7()
|
396 | 401 | {
|
| 402 | + int i;
|
397 | 403 | TRACE_ENTER(1,14,this);
|
398 | 404 | AddRef();
|
399 | 405 | if (dds1) delete dds1;
|
— | — | @@ -402,6 +408,7 @@ |
403 | 409 | if (d3dt1) delete d3dt1;
|
404 | 410 | if (d3dt2) delete d3dt2;
|
405 | 411 | if (gammacontrol) free(gammacontrol);
|
| 412 | + if (overlaydest) overlaydest->DeleteOverlay(this);
|
406 | 413 | if (texture) glTexture_Release(texture, FALSE);
|
407 | 414 | //if(bitmapinfo) free(bitmapinfo);
|
408 | 415 | if (palette)
|
— | — | @@ -424,6 +431,12 @@ |
425 | 432 | if (!zbuffer->attachcount) zbuffer->attachparent = NULL;
|
426 | 433 | zbuffer_iface->Release();
|
427 | 434 | }
|
| 435 | + if (overlays)
|
| 436 | + {
|
| 437 | + for (i = 0; i < overlaycount; i++)
|
| 438 | + glTexture_Release(overlays[i].texture, FALSE);
|
| 439 | + free(overlays);
|
| 440 | + }
|
428 | 441 | if(miptexture) miptexture->Release();
|
429 | 442 | if (device) device->Release();
|
430 | 443 | if (device1) delete device1;
|
— | — | @@ -752,9 +765,8 @@ |
753 | 766 | {
|
754 | 767 | TRACE_ENTER(2,14,this,26,lpRect);
|
755 | 768 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
756 | | - FIXME("glDirectDrawSurface7::AddOverlayDirtyRect: stub\n");
|
757 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
758 | | - ERR(DDERR_GENERIC);
|
| 769 | + TRACE_EXIT(23,DDERR_UNSUPPORTED);
|
| 770 | + return DDERR_UNSUPPORTED;
|
759 | 771 | }
|
760 | 772 | HRESULT WINAPI glDirectDrawSurface7::Blt(LPRECT lpDestRect, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
|
761 | 773 | {
|
— | — | @@ -934,6 +946,7 @@ |
935 | 947 | {
|
936 | 948 | TRACE_ENTER(3,14,this,9,dwFlags,14,lpDDSAttachedSurface);
|
937 | 949 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 950 | + if (!lpDDSAttachedSurface) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
938 | 951 | if(lpDDSAttachedSurface == (LPDIRECTDRAWSURFACE7)zbuffer)
|
939 | 952 | {
|
940 | 953 | if (zbuffer && dxglcfg.primaryscale && (this->ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
|
— | — | @@ -975,11 +988,30 @@ |
976 | 989 | }
|
977 | 990 | HRESULT WINAPI glDirectDrawSurface7::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpfnCallback)
|
978 | 991 | {
|
| 992 | + int i;
|
979 | 993 | TRACE_ENTER(4,14,this,9,dwFlags,14,lpContext,14,lpfnCallback);
|
980 | 994 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
981 | | - FIXME("glDirectDrawSurface7::EnumOverlayZOrders: stub\n");
|
982 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
983 | | - ERR(DDERR_GENERIC);
|
| 995 | + if (!lpfnCallback) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 996 | + if (dwFlags > 1) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 997 | + if (this->overlaycount == 0) TRACE_RET(HRESULT, 23, DD_OK);
|
| 998 | + if (dwFlags == 1)
|
| 999 | + {
|
| 1000 | + for (i = this->overlaycount; i > 0; i--)
|
| 1001 | + {
|
| 1002 | + if (lpfnCallback((LPDIRECTDRAWSURFACE7)this->overlays[i].surface,
|
| 1003 | + &((glDirectDrawSurface7*)this->overlays[i].surface)->ddsd, lpContext) == DDENUMRET_CANCEL) break;
|
| 1004 | + }
|
| 1005 | + }
|
| 1006 | + else
|
| 1007 | + {
|
| 1008 | + for (i = this->overlaycount; i > 0; i--)
|
| 1009 | + {
|
| 1010 | + if (lpfnCallback((LPDIRECTDRAWSURFACE7)this->overlays[i].surface,
|
| 1011 | + &((glDirectDrawSurface7*)this->overlays[i].surface)->ddsd, lpContext) == DDENUMRET_CANCEL) break;
|
| 1012 | + }
|
| 1013 | + }
|
| 1014 | + TRACE_RET(HRESULT, 23, DD_OK);
|
| 1015 | + return DD_OK;
|
984 | 1016 | }
|
985 | 1017 | HRESULT WINAPI glDirectDrawSurface7::Flip(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags)
|
986 | 1018 | {
|
— | — | @@ -995,8 +1027,12 @@ |
996 | 1028 | swapinterval++;
|
997 | 1029 | ddInterface->lastsync = false;
|
998 | 1030 | }
|
999 | | - RenderScreen(texture,swapinterval,previous,TRUE);
|
| 1031 | + RenderScreen(texture,swapinterval,previous,TRUE,FALSE,0);
|
1000 | 1032 | }
|
| 1033 | + if (ddsd.ddsCaps.dwCaps & DDSCAPS_OVERLAY)
|
| 1034 | + {
|
| 1035 | + if (overlaydest) overlaydest->UpdateOverlayTexture(this, this->texture);
|
| 1036 | + }
|
1001 | 1037 | TRACE_EXIT(23,ret);
|
1002 | 1038 | return ret;
|
1003 | 1039 | }
|
— | — | @@ -1006,7 +1042,7 @@ |
1007 | 1043 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1008 | 1044 | if(dwFlags & 0xF8FFFFC0) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
1009 | 1045 | if(locked) TRACE_RET(HRESULT,23,DDERR_SURFACEBUSY);
|
1010 | | - if(!overlay && ((dwFlags & DDFLIP_ODD) || (dwFlags & DDFLIP_EVEN))) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
| 1046 | + if(!(this->ddsd.ddsCaps.dwCaps & DDSCAPS_OVERLAY) && ((dwFlags & DDFLIP_ODD) || (dwFlags & DDFLIP_EVEN))) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
1011 | 1047 | DWORD i;
|
1012 | 1048 | glDirectDrawSurface7 *tmp;
|
1013 | 1049 | if(previous) *previous = this->texture;
|
— | — | @@ -1250,9 +1286,15 @@ |
1251 | 1287 | {
|
1252 | 1288 | TRACE_ENTER(3,14,this,14,lplX,14,lplY);
|
1253 | 1289 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1254 | | - FIXME("glDirectDrawSurface7::GetOverlayPosition: stub\n");
|
1255 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
1256 | | - ERR(DDERR_GENERIC);
|
| 1290 | + if (!(this->ddsd.ddsCaps.dwCaps & DDSCAPS_OVERLAY))
|
| 1291 | + TRACE_RET(HRESULT, 23, DDERR_NOTAOVERLAYSURFACE);
|
| 1292 | + if (!this->overlayenabled) TRACE_RET(HRESULT, 23, DDERR_OVERLAYNOTVISIBLE);
|
| 1293 | + if (!this->overlayset) TRACE_RET(HRESULT, 23, DDERR_NOOVERLAYDEST);
|
| 1294 | + if (!lplX && !lplY) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1295 | + if (lplX) *lplX = this->overlaypos.x;
|
| 1296 | + if (lplY) *lplY = this->overlaypos.y;
|
| 1297 | + TRACE_EXIT(23, DD_OK);
|
| 1298 | + return DD_OK;
|
1257 | 1299 | }
|
1258 | 1300 | HRESULT WINAPI glDirectDrawSurface7::GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
|
1259 | 1301 | {
|
— | — | @@ -1334,10 +1376,10 @@ |
1335 | 1377 | {
|
1336 | 1378 | if (ddInterface->lastsync)
|
1337 | 1379 | {
|
1338 | | - RenderScreen(texture, 1, NULL, TRUE);
|
| 1380 | + RenderScreen(texture, 1, NULL, TRUE, FALSE, 0);
|
1339 | 1381 | ddInterface->lastsync = false;
|
1340 | 1382 | }
|
1341 | | - else RenderScreen(texture, 0, NULL, TRUE);
|
| 1383 | + else RenderScreen(texture, 0, NULL, TRUE, FALSE, 0);
|
1342 | 1384 | }
|
1343 | 1385 | TRACE_EXIT(23,error);
|
1344 | 1386 | return error;
|
— | — | @@ -1524,9 +1566,14 @@ |
1525 | 1567 | {
|
1526 | 1568 | TRACE_ENTER(3,14,this,7,lX,7,lY);
|
1527 | 1569 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1528 | | - FIXME("glDirectDrawSurface7::SetOverlayPosition: stub\n");
|
1529 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
1530 | | - ERR(DDERR_GENERIC);
|
| 1570 | + if (!(this->ddsd.ddsCaps.dwCaps & DDSCAPS_OVERLAY))
|
| 1571 | + TRACE_RET(HRESULT, 23, DDERR_NOTAOVERLAYSURFACE);
|
| 1572 | + if (!this->overlayenabled) TRACE_RET(HRESULT, 23, DDERR_OVERLAYNOTVISIBLE);
|
| 1573 | + if (!this->overlayset) TRACE_RET(HRESULT, 23, DDERR_NOOVERLAYDEST);
|
| 1574 | + this->overlaypos.x = lX;
|
| 1575 | + this->overlaypos.y = lY;
|
| 1576 | + TRACE_EXIT(23, DD_OK);
|
| 1577 | + return DD_OK;
|
1531 | 1578 | }
|
1532 | 1579 | HRESULT WINAPI glDirectDrawSurface7::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
|
1533 | 1580 | {
|
— | — | @@ -1574,7 +1621,7 @@ |
1575 | 1622 | if (!dxglcfg.DebugNoPaletteRedraw)
|
1576 | 1623 | {
|
1577 | 1624 | if(DXGLTimer_CheckLastDraw(&ddInterface->renderer->timer,dxglcfg.HackPaletteDelay))
|
1578 | | - RenderScreen(texture, dxglcfg.HackPaletteVsync, NULL, FALSE);
|
| 1625 | + RenderScreen(texture, dxglcfg.HackPaletteVsync, NULL, FALSE, NULL, 0);
|
1579 | 1626 | }
|
1580 | 1627 | }
|
1581 | 1628 | TRACE_EXIT(23,DD_OK);
|
— | — | @@ -1641,11 +1688,20 @@ |
1642 | 1689 | {
|
1643 | 1690 | if(ddInterface->lastsync)
|
1644 | 1691 | {
|
1645 | | - RenderScreen(texture,1,NULL,TRUE);
|
| 1692 | + RenderScreen(texture,1,NULL,TRUE,NULL,0);
|
1646 | 1693 | ddInterface->lastsync = false;
|
1647 | 1694 | }
|
1648 | | - else RenderScreen(texture,0,NULL,TRUE);
|
| 1695 | + else RenderScreen(texture,0,NULL,TRUE,NULL,0);
|
1649 | 1696 | }
|
| 1697 | + if ((ddsd.ddsCaps.dwCaps & DDSCAPS_OVERLAY) && overlayenabled)
|
| 1698 | + {
|
| 1699 | + if (ddInterface->lastsync)
|
| 1700 | + {
|
| 1701 | + RenderScreen(ddInterface->primary->texture, 1, NULL, TRUE, NULL, 0);
|
| 1702 | + ddInterface->lastsync = false;
|
| 1703 | + }
|
| 1704 | + else RenderScreen(ddInterface->primary->texture, 0, NULL, TRUE, NULL, 0);
|
| 1705 | + }
|
1650 | 1706 | TRACE_EXIT(23, DD_OK);
|
1651 | 1707 | return DD_OK;
|
1652 | 1708 | }
|
— | — | @@ -1653,17 +1709,43 @@ |
1654 | 1710 | {
|
1655 | 1711 | TRACE_ENTER(6,14,this,26,lpSrcRect,14,lpDDDestSurface,26,lpDestRect,9,dwFlags,14,lpDDOverlayFx);
|
1656 | 1712 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1657 | | - FIXME("glDirectDrawSurface7::UpdateOverlay: stub\n");
|
1658 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
1659 | | - ERR(DDERR_GENERIC);
|
| 1713 | + if (!(this->ddsd.ddsCaps.dwCaps & DDSCAPS_OVERLAY))
|
| 1714 | + TRACE_RET(HRESULT,23,DDERR_NOTAOVERLAYSURFACE);
|
| 1715 | + if (!(((glDirectDrawSurface7 *)lpDDDestSurface)->ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
|
| 1716 | + TRACE_RET(HRESULT, 23, DDERR_INVALIDSURFACETYPE);
|
| 1717 | + if ((dwFlags & DDOVER_SHOW) && (dwFlags & DDOVER_HIDE))
|
| 1718 | + TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1719 | + OVERLAY newoverlay;
|
| 1720 | + ZeroMemory(&newoverlay, sizeof(OVERLAY));
|
| 1721 | + if (lpSrcRect) newoverlay.srcrect = *lpSrcRect;
|
| 1722 | + else newoverlay.srcrect = nullrect;
|
| 1723 | + if (lpDestRect) newoverlay.destrect = *lpDestRect;
|
| 1724 | + else newoverlay.destrect = nullrect;
|
| 1725 | + newoverlay.surface = this;
|
| 1726 | + newoverlay.texture = this->texture;
|
| 1727 | + if (lpDDOverlayFx) newoverlay.fx = *lpDDOverlayFx;
|
| 1728 | + newoverlay.flags = dwFlags;
|
| 1729 | + if (dwFlags & DDOVER_SHOW)
|
| 1730 | + {
|
| 1731 | + this->overlayenabled = TRUE;
|
| 1732 | + newoverlay.enabled = TRUE;
|
| 1733 | + }
|
| 1734 | + if (dwFlags & DDOVER_HIDE)
|
| 1735 | + {
|
| 1736 | + this->overlayenabled = FALSE;
|
| 1737 | + newoverlay.enabled = FALSE;
|
| 1738 | + }
|
| 1739 | + this->overlaydest = (glDirectDrawSurface7 *)lpDDDestSurface;
|
| 1740 | + ((glDirectDrawSurface7 *)lpDDDestSurface)->AddOverlay(&newoverlay);
|
| 1741 | + TRACE_EXIT(23, DD_OK);
|
| 1742 | + return DD_OK;
|
1660 | 1743 | }
|
1661 | 1744 | HRESULT WINAPI glDirectDrawSurface7::UpdateOverlayDisplay(DWORD dwFlags)
|
1662 | 1745 | {
|
1663 | 1746 | TRACE_ENTER(2,14,this,9,dwFlags);
|
1664 | 1747 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1665 | | - FIXME("glDirectDrawSurface7::UpdateOverlayDisplay: stub\n");
|
1666 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
1667 | | - ERR(DDERR_GENERIC);
|
| 1748 | + TRACE_EXIT(23,DDERR_UNSUPPORTED);
|
| 1749 | + return DDERR_UNSUPPORTED;
|
1668 | 1750 | }
|
1669 | 1751 | HRESULT WINAPI glDirectDrawSurface7::UpdateOverlayZOrder(DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSReference)
|
1670 | 1752 | {
|
— | — | @@ -1674,15 +1756,15 @@ |
1675 | 1757 | ERR(DDERR_GENERIC);
|
1676 | 1758 | }
|
1677 | 1759 |
|
1678 | | -extern "C" void glDirectDrawSurface7_RenderScreen(LPDIRECTDRAWSURFACE7 surface, int vsync, BOOL settime)
|
| 1760 | +extern "C" void glDirectDrawSurface7_RenderScreen(LPDIRECTDRAWSURFACE7 surface, int vsync, BOOL settime, OVERLAY *overlays, int overlaycount)
|
1679 | 1761 | {
|
1680 | | - ((glDirectDrawSurface7*)surface)->RenderScreen(((glDirectDrawSurface7*)surface)->texture, vsync, NULL, settime);
|
| 1762 | + ((glDirectDrawSurface7*)surface)->RenderScreen(((glDirectDrawSurface7*)surface)->texture, vsync, NULL, settime, overlays, overlaycount);
|
1681 | 1763 | }
|
1682 | 1764 |
|
1683 | | -void glDirectDrawSurface7::RenderScreen(glTexture *texture, int vsync, glTexture *previous, BOOL settime)
|
| 1765 | +void glDirectDrawSurface7::RenderScreen(glTexture *texture, int vsync, glTexture *previous, BOOL settime, OVERLAY *overlays, int overlaycount)
|
1684 | 1766 | {
|
1685 | 1767 | TRACE_ENTER(3,14,this,14,texture,14,vsync);
|
1686 | | - glRenderer_DrawScreen(ddInterface->renderer,texture, texture->palette, vsync, previous, settime);
|
| 1768 | + glRenderer_DrawScreen(ddInterface->renderer,texture, texture->palette, vsync, previous, settime, overlays, overlaycount);
|
1687 | 1769 | TRACE_EXIT(0,0);
|
1688 | 1770 | }
|
1689 | 1771 | // ddraw 2+ api
|
— | — | @@ -1718,6 +1800,7 @@ |
1719 | 1801 | {
|
1720 | 1802 | TRACE_ENTER(3,14,this,14,lpddsd2,9,dwFlags);
|
1721 | 1803 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 1804 | + if (this->overlayenabled) TRACE_RET(HRESULT, 23, DDERR_SURFACEBUSY);
|
1722 | 1805 | FIXME("glDirectDrawSurface7::SetSurfaceDesc: stub\n");
|
1723 | 1806 | TRACE_EXIT(23,DDERR_GENERIC);
|
1724 | 1807 | ERR(DDERR_GENERIC);
|
— | — | @@ -1857,6 +1940,107 @@ |
1858 | 1941 | ERR(DDERR_GENERIC);
|
1859 | 1942 | }
|
1860 | 1943 |
|
| 1944 | +HRESULT glDirectDrawSurface7::AddOverlay(OVERLAY *overlay)
|
| 1945 | +{
|
| 1946 | + OVERLAY *tmpptr;
|
| 1947 | + int i;
|
| 1948 | + if (overlaycount + 1 > maxoverlays)
|
| 1949 | + {
|
| 1950 | + if (!overlays)
|
| 1951 | + {
|
| 1952 | + overlays = (OVERLAY*)malloc(16 * sizeof(OVERLAY));
|
| 1953 | + if (!overlays) return DDERR_OUTOFMEMORY;
|
| 1954 | + maxoverlays = 16;
|
| 1955 | + }
|
| 1956 | + else
|
| 1957 | + {
|
| 1958 | + if (maxoverlays == 256) return DDERR_OUTOFCAPS;
|
| 1959 | + maxoverlays += 16;
|
| 1960 | + tmpptr = (OVERLAY*)realloc(overlays, maxoverlays * sizeof(OVERLAY));
|
| 1961 | + if (!tmpptr) return DDERR_OUTOFMEMORY;
|
| 1962 | + overlays = tmpptr;
|
| 1963 | + }
|
| 1964 | + }
|
| 1965 | + for (i = 0; i < overlaycount; i++)
|
| 1966 | + {
|
| 1967 | + if (overlays[i].surface == overlay->surface)
|
| 1968 | + {
|
| 1969 | + glTexture_Release(overlays[i].texture, FALSE);
|
| 1970 | + overlays[i].destrect = overlay->destrect;
|
| 1971 | + overlays[i].srcrect = overlay->srcrect;
|
| 1972 | + overlays[i].flags = overlay->flags;
|
| 1973 | + overlays[i].fx = overlay->fx;
|
| 1974 | + overlays[i].surface = overlay->surface;
|
| 1975 | + overlays[i].texture = overlay->texture;
|
| 1976 | + if (overlay->flags & DDOVER_SHOW) overlays[i].enabled = TRUE;
|
| 1977 | + if (overlay->flags & DDOVER_HIDE) overlays[i].enabled = FALSE;
|
| 1978 | + memcpy(&overlays[i], overlay, sizeof(OVERLAY));
|
| 1979 | + glTexture_AddRef(overlays[i].texture);
|
| 1980 | + return DD_OK;
|
| 1981 | + }
|
| 1982 | + }
|
| 1983 | + overlays[overlaycount] = *overlay;
|
| 1984 | + glTexture_AddRef(overlays[overlaycount].texture);
|
| 1985 | + overlaycount++;
|
| 1986 | + if (ddInterface->lastsync)
|
| 1987 | + {
|
| 1988 | + RenderScreen(ddInterface->primary->texture, 1, NULL, TRUE, overlays, overlaycount);
|
| 1989 | + ddInterface->lastsync = false;
|
| 1990 | + }
|
| 1991 | + else RenderScreen(ddInterface->primary->texture, 0, NULL, TRUE, overlays, overlaycount);
|
| 1992 | + return DD_OK;
|
| 1993 | +}
|
| 1994 | +
|
| 1995 | +HRESULT glDirectDrawSurface7::DeleteOverlay(glDirectDrawSurface7 *surface)
|
| 1996 | +{
|
| 1997 | + int i;
|
| 1998 | + for (i = 0; i < overlaycount; i++)
|
| 1999 | + {
|
| 2000 | + if (overlays[i].surface == surface)
|
| 2001 | + {
|
| 2002 | + glTexture_Release(overlays[i].texture, FALSE);
|
| 2003 | + overlaycount--;
|
| 2004 | + memmove(&overlays[i], &overlays[i + 1], (overlaycount - i) * sizeof(OVERLAY));
|
| 2005 | + if (surface->overlayenabled)
|
| 2006 | + {
|
| 2007 | + if (ddInterface->lastsync)
|
| 2008 | + {
|
| 2009 | + RenderScreen(ddInterface->primary->texture, 1, NULL, TRUE, overlays, overlaycount);
|
| 2010 | + ddInterface->lastsync = false;
|
| 2011 | + }
|
| 2012 | + else RenderScreen(ddInterface->primary->texture, 0, NULL, TRUE, overlays, overlaycount);
|
| 2013 | + }
|
| 2014 | + return DD_OK;
|
| 2015 | + }
|
| 2016 | + }
|
| 2017 | + return DDERR_NOTFOUND;
|
| 2018 | +}
|
| 2019 | +
|
| 2020 | +HRESULT glDirectDrawSurface7::UpdateOverlayTexture(glDirectDrawSurface7 *surface, glTexture *texture)
|
| 2021 | +{
|
| 2022 | + int i;
|
| 2023 | + for (i = 0; i < overlaycount; i++)
|
| 2024 | + {
|
| 2025 | + if (overlays[i].surface == surface)
|
| 2026 | + {
|
| 2027 | + glTexture_Release(overlays[i].texture, FALSE);
|
| 2028 | + overlays[i].texture = texture;
|
| 2029 | + glTexture_AddRef(overlays[i].texture);
|
| 2030 | + if (surface->overlayenabled)
|
| 2031 | + {
|
| 2032 | + if (ddInterface->lastsync)
|
| 2033 | + {
|
| 2034 | + RenderScreen(ddInterface->primary->texture, 1, NULL, TRUE, overlays, overlaycount);
|
| 2035 | + ddInterface->lastsync = false;
|
| 2036 | + }
|
| 2037 | + else RenderScreen(ddInterface->primary->texture, 0, NULL, TRUE, overlays, overlaycount);
|
| 2038 | + }
|
| 2039 | + return DD_OK;
|
| 2040 | + }
|
| 2041 | + }
|
| 2042 | + return DDERR_NOTFOUND;
|
| 2043 | +}
|
| 2044 | +
|
1861 | 2045 | // DDRAW1 wrapper
|
1862 | 2046 | glDirectDrawSurface1::glDirectDrawSurface1(glDirectDrawSurface7 *gl_DDS7)
|
1863 | 2047 | {
|
— | — | @@ -2148,7 +2332,7 @@ |
2149 | 2333 | {
|
2150 | 2334 | TRACE_ENTER(6,14,this,26,lpSrcRect,14,lpDDDestSurface,26,lpDestRect,9,dwFlags,14,lpDDOverlayFx);
|
2151 | 2335 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2152 | | - TRACE_RET(HRESULT,23,glDDS7->UpdateOverlay(lpSrcRect,(LPDIRECTDRAWSURFACE7)lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFx));
|
| 2336 | + TRACE_RET(HRESULT,23,glDDS7->UpdateOverlay(lpSrcRect,((glDirectDrawSurface1*)lpDDDestSurface)->glDDS7,lpDestRect,dwFlags,lpDDOverlayFx));
|
2153 | 2337 | }
|
2154 | 2338 | HRESULT WINAPI glDirectDrawSurface1::UpdateOverlayDisplay(DWORD dwFlags)
|
2155 | 2339 | {
|
— | — | @@ -2452,7 +2636,7 @@ |
2453 | 2637 | {
|
2454 | 2638 | TRACE_ENTER(6,14,this,26,lpSrcRect,14,lpDDDestSurface,26,lpDestRect,9,dwFlags,14,lpDDOverlayFx);
|
2455 | 2639 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2456 | | - TRACE_RET(HRESULT,23,glDDS7->UpdateOverlay(lpSrcRect,(LPDIRECTDRAWSURFACE7)lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFx));
|
| 2640 | + TRACE_RET(HRESULT,23,glDDS7->UpdateOverlay(lpSrcRect, ((glDirectDrawSurface2*)lpDDDestSurface)->glDDS7,lpDestRect,dwFlags,lpDDOverlayFx));
|
2457 | 2641 | }
|
2458 | 2642 | HRESULT WINAPI glDirectDrawSurface2::UpdateOverlayDisplay(DWORD dwFlags)
|
2459 | 2643 | {
|
— | — | @@ -2781,7 +2965,7 @@ |
2782 | 2966 | {
|
2783 | 2967 | TRACE_ENTER(6,14,this,26,lpSrcRect,14,lpDDDestSurface,26,lpDestRect,9,dwFlags,14,lpDDOverlayFx);
|
2784 | 2968 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2785 | | - TRACE_RET(HRESULT,23,glDDS7->UpdateOverlay(lpSrcRect,(LPDIRECTDRAWSURFACE7)lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFx));
|
| 2969 | + TRACE_RET(HRESULT,23,glDDS7->UpdateOverlay(lpSrcRect,((glDirectDrawSurface3*)lpDDDestSurface)->glDDS7,lpDestRect,dwFlags,lpDDOverlayFx));
|
2786 | 2970 | }
|
2787 | 2971 | HRESULT WINAPI glDirectDrawSurface3::UpdateOverlayDisplay(DWORD dwFlags)
|
2788 | 2972 | {
|
— | — | @@ -3090,7 +3274,7 @@ |
3091 | 3275 | {
|
3092 | 3276 | TRACE_ENTER(6,14,this,26,lpSrcRect,14,lpDDDestSurface,26,lpDestRect,9,dwFlags,14,lpDDOverlayFx);
|
3093 | 3277 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
3094 | | - TRACE_RET(HRESULT,23,glDDS7->UpdateOverlay(lpSrcRect,(LPDIRECTDRAWSURFACE7)lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFx));
|
| 3278 | + TRACE_RET(HRESULT,23,glDDS7->UpdateOverlay(lpSrcRect,((glDirectDrawSurface4*)lpDDDestSurface)->glDDS7,lpDestRect,dwFlags,lpDDOverlayFx));
|
3095 | 3279 | }
|
3096 | 3280 | HRESULT WINAPI glDirectDrawSurface4::UpdateOverlayDisplay(DWORD dwFlags)
|
3097 | 3281 | {
|
Index: ddraw/glDirectDrawSurface.h |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | // DXGL
|
3 | | -// Copyright (C) 2011-2015 William Feely
|
| 3 | +// Copyright (C) 2011-2019 William Feely
|
4 | 4 |
|
5 | 5 | // This library is free software; you can redistribute it and/or
|
6 | 6 | // modify it under the terms of the GNU Lesser General Public
|
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | void SetTexture(glTexture *newtexture){ texture = newtexture; };
|
120 | 120 | glDirectDrawSurface7 *GetBackbuffer(){return backbuffer;};
|
121 | 121 | glDirectDrawSurface7 *GetZBuffer(){return zbuffer;};
|
122 | | - void RenderScreen(glTexture *texture, int vsync, glTexture *previous, BOOL settime);
|
| 122 | + void RenderScreen(glTexture *texture, int vsync, glTexture *previous, BOOL settime, OVERLAY *overlays, int overlaycount);
|
123 | 123 | // Special ddraw2->ddraw7 api
|
124 | 124 | HRESULT WINAPI Unlock2(LPVOID lpSurfaceData);
|
125 | 125 | HRESULT GetHandle(glDirect3DDevice7 *glD3DDev7, LPD3DTEXTUREHANDLE lpHandle);
|
— | — | @@ -125,6 +125,9 @@ |
126 | 126 | HRESULT Load(glDirectDrawSurface7 *src);
|
127 | 127 | HRESULT GetGammaRamp(DWORD dwFlags, LPDDGAMMARAMP lpRampData);
|
128 | 128 | HRESULT SetGammaRamp(DWORD dwFlags, LPDDGAMMARAMP lpRampData);
|
| 129 | + HRESULT AddOverlay(OVERLAY *overlay);
|
| 130 | + HRESULT DeleteOverlay(glDirectDrawSurface7 *surface);
|
| 131 | + HRESULT UpdateOverlayTexture(glDirectDrawSurface7 *surface, glTexture *texture);
|
129 | 132 | glDirectDrawSurface1 *dds1;
|
130 | 133 | glDirectDrawSurface2 *dds2;
|
131 | 134 | glDirectDrawSurface3 *dds3;
|
— | — | @@ -152,6 +155,13 @@ |
153 | 156 | glDirectDrawSurface7 *backbufferwraparound;
|
154 | 157 | DWORD attachcount;
|
155 | 158 | glDirectDrawSurface7 *attachparent;
|
| 159 | + BOOL overlayenabled;
|
| 160 | + BOOL overlayset;
|
| 161 | + int overlaycount;
|
| 162 | + int maxoverlays;
|
| 163 | + OVERLAY *overlays;
|
| 164 | + glDirectDrawSurface7 *overlaydest;
|
| 165 | + POINT overlaypos;
|
156 | 166 | private:
|
157 | 167 | int swapinterval;
|
158 | 168 | ULONG refcount7, refcount4, refcount3, refcount2, refcount1;
|
— | — | @@ -162,7 +172,6 @@ |
163 | 173 | int pagelocked;
|
164 | 174 | glDirect3DDevice7 *device1;
|
165 | 175 | glDirect3DDevice7 *device;
|
166 | | - bool overlay;
|
167 | 176 | IUnknown *zbuffer_iface;
|
168 | 177 | int version;
|
169 | 178 | unsigned char *clientbuffer;
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -1679,6 +1679,8 @@ |
1680 | 1680 | This->hDC = NULL;
|
1681 | 1681 | This->hRC = NULL;
|
1682 | 1682 | This->pbo = NULL;
|
| 1683 | + This->overlays = NULL;
|
| 1684 | + This->overlaycount = 0;
|
1683 | 1685 | This->last_fvf = 0xFFFFFFFF; // Bogus value to force initial FVF change
|
1684 | 1686 | This->mode_3d = FALSE;
|
1685 | 1687 | ZeroMemory(&This->dib, sizeof(DIB));
|
— | — | @@ -2122,7 +2124,7 @@ |
2123 | 2125 | * @param previous
|
2124 | 2126 | * Texture previously used as primary before a flip
|
2125 | 2127 | */
|
2126 | | -void glRenderer_DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL settime)
|
| 2128 | +void glRenderer_DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL settime, OVERLAY *overlays, int overlaycount)
|
2127 | 2129 | {
|
2128 | 2130 | /*DrawScreenCmd cmd;
|
2129 | 2131 | cmd.opcode = OP_DRAWSCREEN;
|
— | — | @@ -2138,6 +2140,8 @@ |
2139 | 2141 | This->inputs[2] = (void*)vsync;
|
2140 | 2142 | This->inputs[3] = previous;
|
2141 | 2143 | This->inputs[4] = (void*)settime;
|
| 2144 | + This->inputs[5] = overlays;
|
| 2145 | + This->inputs[6] = (void*)overlaycount;
|
2142 | 2146 | This->opcode = OP_DRAWSCREEN;
|
2143 | 2147 | SetEvent(This->start);
|
2144 | 2148 | WaitForSingleObject(This->busy,INFINITE);
|
— | — | @@ -2850,6 +2854,7 @@ |
2851 | 2855 | glUtil_Release(This->util);
|
2852 | 2856 | free(This->shaders);
|
2853 | 2857 | free(This->ext);
|
| 2858 | + if (This->overlays) free(This->overlays);
|
2854 | 2859 | This->ext = NULL;
|
2855 | 2860 | wglMakeCurrent(NULL,NULL);
|
2856 | 2861 | wglDeleteContext(This->hRC);
|
— | — | @@ -2888,7 +2893,8 @@ |
2889 | 2894 | break;
|
2890 | 2895 | case OP_DRAWSCREEN:
|
2891 | 2896 | glRenderer__DrawScreen(This,(glTexture*)This->inputs[0],(glTexture*)This->inputs[1],
|
2892 | | - (GLint)This->inputs[2],(glTexture*)This->inputs[3],true,(BOOL)This->inputs[4]);
|
| 2897 | + (GLint)This->inputs[2],(glTexture*)This->inputs[3],TRUE,(BOOL)This->inputs[4],
|
| 2898 | + (OVERLAY*)This->inputs[5],(int)This->inputs[6]);
|
2893 | 2899 | break;
|
2894 | 2900 | case OP_INITD3D:
|
2895 | 2901 | glRenderer__InitD3D(This,(int)This->inputs[0],(int)This->inputs[1],(int)This->inputs[2]);
|
— | — | @@ -3581,7 +3587,7 @@ |
3582 | 3588 | (ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)) ||
|
3583 | 3589 | ((ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) &&
|
3584 | 3590 | !(ddsd.ddsCaps.dwCaps & DDSCAPS_FLIP)))
|
3585 | | - glRenderer__DrawScreen(This,cmd->dest,cmd->dest->palette,0,NULL,FALSE,TRUE);
|
| 3591 | + glRenderer__DrawScreen(This,cmd->dest,cmd->dest->palette,0,NULL,FALSE,TRUE,NULL,0);
|
3586 | 3592 | This->outputs[0] = DD_OK;
|
3587 | 3593 | SetEvent(This->busy);
|
3588 | 3594 | }
|
— | — | @@ -3955,11 +3961,32 @@ |
3956 | 3962 | return __UpdateLayeredWindow(hWnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crKey, pblend, dwFlags);
|
3957 | 3963 | }
|
3958 | 3964 |
|
3959 | | -void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync, BOOL settime)
|
| 3965 | +void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync, BOOL settime, OVERLAY *overlays, int overlaycount)
|
3960 | 3966 | {
|
3961 | 3967 | int progtype;
|
3962 | 3968 | RECT r, r2;
|
| 3969 | + int i;
|
| 3970 | + unsigned __int64 shaderid;
|
| 3971 | + BltCommand bltcmd;
|
| 3972 | + glTexture *primary = texture;
|
3963 | 3973 | BOOL scale512448 = Is512448Scale(This, texture, paltex);
|
| 3974 | + if (overlays && overlaycount)
|
| 3975 | + {
|
| 3976 | + if (!This->overlays)
|
| 3977 | + {
|
| 3978 | + This->overlays = (OVERLAY *)malloc(overlaycount * sizeof(OVERLAY));
|
| 3979 | + This->overlaycount = overlaycount;
|
| 3980 | + }
|
| 3981 | + else
|
| 3982 | + {
|
| 3983 | + if (overlaycount != This->overlaycount)
|
| 3984 | + {
|
| 3985 | + This->overlays = (OVERLAY*)realloc(This->overlays, overlaycount * sizeof(OVERLAY));
|
| 3986 | + This->overlaycount = overlaycount;
|
| 3987 | + }
|
| 3988 | + }
|
| 3989 | + memcpy(This->overlays, overlays, overlaycount * sizeof(OVERLAY));
|
| 3990 | + }
|
3964 | 3991 | glUtil_BlendEnable(This->util, FALSE);
|
3965 | 3992 | if (previous) previous->levels[0].ddsd.ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER;
|
3966 | 3993 | texture->levels[0].ddsd.ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER;
|
— | — | @@ -4104,6 +4131,38 @@ |
4105 | 4132 | glUtil_SetCull(This->util, D3DCULL_NONE);
|
4106 | 4133 | glUtil_SetPolyMode(This->util, D3DFILL_SOLID);
|
4107 | 4134 | This->ext->glDrawRangeElements(GL_TRIANGLE_STRIP,0,3,4,GL_UNSIGNED_SHORT,bltindices);
|
| 4135 | + if (This->overlays)
|
| 4136 | + {
|
| 4137 | + for (i = 0; i < overlaycount; i++)
|
| 4138 | + {
|
| 4139 | + if (This->overlays[i].enabled)
|
| 4140 | + {
|
| 4141 | + bltcmd.flags = 0x80000000;
|
| 4142 | + if (overlays[i].flags & DDOVER_DDFX)
|
| 4143 | + {
|
| 4144 | + if (overlays[i].flags & DDOVER_KEYDEST) bltcmd.flags |= DDBLT_KEYDEST;
|
| 4145 | + if (overlays[i].flags & DDOVER_KEYDESTOVERRIDE)
|
| 4146 | + {
|
| 4147 | + bltcmd.flags |= DDBLT_KEYDESTOVERRIDE;
|
| 4148 | + bltcmd.destkey = overlays[i].fx.dckDestColorkey;
|
| 4149 | + }
|
| 4150 | + if (overlays[i].flags & DDOVER_KEYSRC) bltcmd.flags |= DDBLT_KEYSRC;
|
| 4151 | + if (overlays[i].flags & DDOVER_KEYSRCOVERRIDE)
|
| 4152 | + {
|
| 4153 | + bltcmd.flags |= DDBLT_KEYSRCOVERRIDE;
|
| 4154 | + bltcmd.srckey = overlays[i].fx.dckSrcColorkey;
|
| 4155 | + }
|
| 4156 | + }
|
| 4157 | + bltcmd.src = This->overlays[i].texture;
|
| 4158 | + bltcmd.srclevel = 0;
|
| 4159 | + bltcmd.srcrect = This->overlays[i].srcrect;
|
| 4160 | + bltcmd.dest = primary;
|
| 4161 | + bltcmd.destlevel = 0;
|
| 4162 | + bltcmd.destrect = This->overlays[i].destrect;
|
| 4163 | + //FIXME: Finish Blt
|
| 4164 | + }
|
| 4165 | + }
|
| 4166 | + }
|
4108 | 4167 | glFlush();
|
4109 | 4168 | if(This->hWnd) SwapBuffers(This->hDC);
|
4110 | 4169 | else
|
Index: ddraw/glRenderer.h |
— | — | @@ -161,6 +161,8 @@ |
162 | 162 | BOOL mode_3d;
|
163 | 163 | float postsizex, postsizey;
|
164 | 164 | int xoffset, yoffset;
|
| 165 | + OVERLAY *overlays;
|
| 166 | + int overlaycount;
|
165 | 167 | } glRenderer;
|
166 | 168 |
|
167 | 169 | HRESULT glRenderer_AddCommand(glRenderer *This, QueueCmd *cmd, BOOL inner, BOOL wait);
|
— | — | @@ -172,7 +174,7 @@ |
173 | 175 | void glRenderer_DownloadTexture(glRenderer *This, glTexture *texture, GLint level);
|
174 | 176 | HRESULT glRenderer_Blt(glRenderer *This, BltCommand *cmd);
|
175 | 177 | void glRenderer_MakeTexture(glRenderer *This, glTexture *texture);
|
176 | | -void glRenderer_DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL settime);
|
| 178 | +void glRenderer_DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL settime, OVERLAY *overlays, int overlaycount);
|
177 | 179 | void glRenderer_DeleteTexture(glRenderer *This, glTexture *texture);
|
178 | 180 | void glRenderer_InitD3D(glRenderer *This, int zbuffer, int x, int y);
|
179 | 181 | void glRenderer_Flush(glRenderer *This);
|
— | — | @@ -206,7 +208,7 @@ |
207 | 209 | void glRenderer__DownloadTexture(glRenderer *This, glTexture *texture, GLint level);
|
208 | 210 | void glRenderer__Blt(glRenderer *This, BltCommand *cmd);
|
209 | 211 | void glRenderer__MakeTexture(glRenderer *This, glTexture *texture);
|
210 | | -void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync, BOOL settime);
|
| 212 | +void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync, BOOL settime, OVERLAY *overlays, int overlaycount);
|
211 | 213 | void glRenderer__DeleteTexture(glRenderer *This, glTexture *texture);
|
212 | 214 | void glRenderer__DrawBackbuffer(glRenderer *This, glTexture **texture, int x, int y, int progtype, BOOL paletted, BOOL firstpass);
|
213 | 215 | void glRenderer__DrawBackbufferRect(glRenderer *This, glTexture *texture, RECT srcrect, RECT destrect, int progtype);
|
Index: ddraw/glTexture.cpp |
— | — | @@ -94,20 +94,20 @@ |
95 | 95 | {sizeof(DDPIXELFORMAT), DDPF_ZBUFFER, 0, 32, 0, 0xFFFFFFFF, 0, 0}, // 32 bit Z buffer
|
96 | 96 | {sizeof(DDPIXELFORMAT), DDPF_ZBUFFER, 0, 32, 8, 0xFFFFFF00, 0xFF, 0}, // 32 bit Z buffer with stencil
|
97 | 97 | {sizeof(DDPIXELFORMAT), DDPF_ZBUFFER, 0, 32, 8, 0xFF, 0xFFFFFF00, 0}, // 32 bit Z buffer with stencil, reversed
|
98 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','8',' ',' '), 8, 0, 0, 0, 0}, // 8-bit grayscale
|
99 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','8','0','0'), 8, 0, 0, 0, 0}, // 8-bit grayscale
|
100 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('G','R','E','Y'), 8, 0, 0, 0, 0}, // 8-bit grayscale
|
101 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','1','6',' '), 16, 0, 0, 0, 0}, // 16-bit grayscale
|
102 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U','Y','V','Y'), 16, 0, 0, 0, 0}, // UYVY packed YUV surface
|
103 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U','Y','N','V'), 16, 0, 0, 0, 0}, // UYVY packed YUV surface (NVIDIA alias)
|
104 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','4','2','2'), 16, 0, 0, 0, 0}, // UYVY packed YUV surface (ADS Tech. alias)
|
105 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','Y','2'), 16, 0, 0, 0, 0}, // YUY2 packed YUV surface
|
106 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','Y','V'), 16, 0, 0, 0, 0}, // YUY2 packed YUV surface (dup. of YUY2)
|
107 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','N','V'), 16, 0, 0, 0, 0}, // YUY2 packed YUV surface (NVIDIA alias)
|
108 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','V','Y','U'), 16, 0, 0, 0, 0}, // YUY2 packed YUV surface
|
109 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('R','G','B','G'), 16, 0, 0, 0, 0}, // RGBG packed 16-bit pixelformat
|
110 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('G','R','G','B'), 16, 0, 0, 0, 0}, // GRGB packed 16-bit pixelformat
|
111 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('A','Y','U','V'), 32, 0, 0, 0, 0}, // AYUV packed YUV surface
|
| 98 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','8',' ',' '), 0, 0, 0, 0, 0}, // 8-bit grayscale
|
| 99 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','8','0','0'), 0, 0, 0, 0, 0}, // 8-bit grayscale
|
| 100 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('G','R','E','Y'), 0, 0, 0, 0, 0}, // 8-bit grayscale
|
| 101 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','1','6',' '), 0, 0, 0, 0, 0}, // 16-bit grayscale
|
| 102 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U','Y','V','Y'), 0, 0, 0, 0, 0}, // UYVY packed YUV surface
|
| 103 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U','Y','N','V'), 0, 0, 0, 0, 0}, // UYVY packed YUV surface (NVIDIA alias)
|
| 104 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','4','2','2'), 0, 0, 0, 0, 0}, // UYVY packed YUV surface (ADS Tech. alias)
|
| 105 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0}, // YUY2 packed YUV surface
|
| 106 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','Y','V'), 0, 0, 0, 0, 0}, // YUY2 packed YUV surface (dup. of YUY2)
|
| 107 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','N','V'), 0, 0, 0, 0, 0}, // YUY2 packed YUV surface (NVIDIA alias)
|
| 108 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','V','Y','U'), 0, 0, 0, 0, 0}, // YUY2 packed YUV surface
|
| 109 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0}, // RGBG packed 16-bit pixelformat
|
| 110 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0}, // GRGB packed 16-bit pixelformat
|
| 111 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('A','Y','U','V'), 0, 0, 0, 0, 0}, // AYUV packed YUV surface
|
112 | 112 | };
|
113 | 113 | static const int END_TEXFORMATS = __LINE__ - 4;
|
114 | 114 | int numtexformats;
|
— | — | @@ -505,6 +505,15 @@ |
506 | 506 | int i;
|
507 | 507 | int texformat = -1;
|
508 | 508 | numtexformats = END_TEXFORMATS - START_TEXFORMATS;
|
| 509 | + DDPIXELFORMAT compformat;
|
| 510 | + if (pixelformat->dwFlags & DDPF_FOURCC)
|
| 511 | + {
|
| 512 | + ZeroMemory(&compformat, sizeof(DDPIXELFORMAT));
|
| 513 | + compformat.dwSize = sizeof(DDPIXELFORMAT);
|
| 514 | + compformat.dwFlags = pixelformat->dwFlags;
|
| 515 | + compformat.dwFourCC = pixelformat->dwFourCC;
|
| 516 | + }
|
| 517 | + else compformat = *pixelformat;
|
509 | 518 | for (i = 0; i < numtexformats; i++)
|
510 | 519 | {
|
511 | 520 | if (!memcmp(&texformats[i], pixelformat, sizeof(DDPIXELFORMAT)))
|
— | — | @@ -888,9 +897,18 @@ |
889 | 898 | DWORD x, y;
|
890 | 899 | GLenum error;
|
891 | 900 | numtexformats = END_TEXFORMATS - START_TEXFORMATS;
|
| 901 | + DDPIXELFORMAT compformat;
|
| 902 | + if (This->levels[0].ddsd.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
|
| 903 | + {
|
| 904 | + ZeroMemory(&compformat, sizeof(DDPIXELFORMAT));
|
| 905 | + compformat.dwSize = sizeof(DDPIXELFORMAT);
|
| 906 | + compformat.dwFlags = This->levels[0].ddsd.ddpfPixelFormat.dwFlags;
|
| 907 | + compformat.dwFourCC = This->levels[0].ddsd.ddpfPixelFormat.dwFourCC;
|
| 908 | + }
|
| 909 | + else compformat = This->levels[0].ddsd.ddpfPixelFormat;
|
892 | 910 | for (i = 0; i < numtexformats; i++)
|
893 | 911 | {
|
894 | | - if (!memcmp(&texformats[i], &This->levels[0].ddsd.ddpfPixelFormat, sizeof(DDPIXELFORMAT)))
|
| 912 | + if (!memcmp(&texformats[i], &compformat, sizeof(DDPIXELFORMAT)))
|
895 | 913 | {
|
896 | 914 | texformat = i;
|
897 | 915 | break;
|
Index: ddraw/struct.h |
— | — | @@ -326,7 +326,6 @@ |
327 | 327 | BufferObject *pboPack;
|
328 | 328 | BufferObject *pboUnpack;
|
329 | 329 | } glTexture;
|
330 | | -
|
331 | 330 | // Color orders:
|
332 | 331 | // 0 - ABGR
|
333 | 332 | // 1 - ARGB
|
— | — | @@ -337,6 +336,17 @@ |
338 | 337 | // 6 - Alpha
|
339 | 338 | // 7 - Luminance Alpha
|
340 | 339 |
|
| 340 | +typedef struct OVERLAY
|
| 341 | +{
|
| 342 | + DDOVERLAYFX fx;
|
| 343 | + RECT srcrect;
|
| 344 | + RECT destrect;
|
| 345 | + void *surface;
|
| 346 | + glTexture *texture;
|
| 347 | + DWORD flags;
|
| 348 | + BOOL enabled;
|
| 349 | +} OVERLAY;
|
| 350 | +
|
341 | 351 | typedef struct SHADER
|
342 | 352 | {
|
343 | 353 | GLint vs;
|
Index: dxglcfg/surfacegen.cpp |
— | — | @@ -1949,20 +1949,20 @@ |
1950 | 1950 | {sizeof(DDPIXELFORMAT), DDPF_ZBUFFER, 0, 32, 0, 0xFFFFFFFF, 0, 0}, // 32 bit Z buffer
|
1951 | 1951 | {sizeof(DDPIXELFORMAT), DDPF_ZBUFFER, 0, 32, 8, 0xFFFFFF00, 0xFF, 0}, // 32 bit Z buffer with stencil
|
1952 | 1952 | {sizeof(DDPIXELFORMAT), DDPF_ZBUFFER, 0, 32, 8, 0xFF, 0xFFFFFF00, 0}, // 32 bit Z buffer with stencil, reversed
|
1953 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','8',' ',' '), 8, 0, 0, 0, 0}, // 8-bit grayscale
|
1954 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','8','0','0'), 8, 0, 0, 0, 0}, // 8-bit grayscale
|
1955 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('G','R','E','Y'), 8, 0, 0, 0, 0}, // 8-bit grayscale
|
1956 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','1','6',' '), 16, 0, 0, 0, 0}, // 16-bit grayscale
|
1957 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U','Y','V','Y'), 16, 0, 0, 0, 0}, // UYVY packed YUV surface
|
1958 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U','Y','N','V'), 16, 0, 0, 0, 0}, // UYVY packed YUV surface (NVIDIA alias)
|
1959 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','4','2','2'), 16, 0, 0, 0, 0}, // UYVY packed YUV surface (ADS Tech. alias)
|
1960 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','Y','2'), 16, 0, 0, 0, 0}, // YUY2 packed YUV surface
|
1961 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','Y','V'), 16, 0, 0, 0, 0}, // YUY2 packed YUV surface (dup. of YUY2)
|
1962 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','N','V'), 16, 0, 0, 0, 0}, // YUY2 packed YUV surface (NVIDIA alias)
|
1963 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','V','Y','U'), 16, 0, 0, 0, 0}, // YUY2 packed YUV surface
|
1964 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('R','G','B','G'), 16, 0, 0, 0, 0}, // RGBG packed 16-bit pixelformat
|
1965 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('G','R','G','B'), 16, 0, 0, 0, 0}, // GRGB packed 16-bit pixelformat
|
1966 | | - {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('A','Y','U','V'), 32, 0, 0, 0, 0}, // AYUV packed YUV surface
|
| 1953 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','8',' ',' '), 0, 0, 0, 0, 0}, // 8-bit grayscale
|
| 1954 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','8','0','0'), 0, 0, 0, 0, 0}, // 8-bit grayscale
|
| 1955 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('G','R','E','Y'), 0, 0, 0, 0, 0}, // 8-bit grayscale
|
| 1956 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','1','6',' '), 0, 0, 0, 0, 0}, // 16-bit grayscale
|
| 1957 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U','Y','V','Y'), 0, 0, 0, 0, 0}, // UYVY packed YUV surface
|
| 1958 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U','Y','N','V'), 0, 0, 0, 0, 0}, // UYVY packed YUV surface (NVIDIA alias)
|
| 1959 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','4','2','2'), 0, 0, 0, 0, 0}, // UYVY packed YUV surface (ADS Tech. alias)
|
| 1960 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0}, // YUY2 packed YUV surface
|
| 1961 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','Y','V'), 0, 0, 0, 0, 0}, // YUY2 packed YUV surface (dup. of YUY2)
|
| 1962 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','U','N','V'), 0, 0, 0, 0, 0}, // YUY2 packed YUV surface (NVIDIA alias)
|
| 1963 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y','V','Y','U'), 0, 0, 0, 0, 0}, // YUY2 packed YUV surface
|
| 1964 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0}, // RGBG packed 16-bit pixelformat
|
| 1965 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0}, // GRGB packed 16-bit pixelformat
|
| 1966 | + {sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('A','Y','U','V'), 0, 0, 0, 0, 0}, // AYUV packed YUV surface
|
1967 | 1967 | };
|
1968 | 1968 |
|
1969 | 1969 | static const LPTSTR strErrorMessages[] =
|