Index: ddraw/glDirectDraw.cpp |
— | — | @@ -849,6 +849,7 @@ |
850 | 850 | if (!this) TRACE_RET(HRESULT, 23, DDERR_INVALIDOBJECT);
|
851 | 851 | if (!lpDDSurfaceDesc2) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
852 | 852 | if (pUnkOuter) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 853 | + if (!renderer) TRACE_RET(HRESULT, 23, DDERR_NOCOOPERATIVELEVELSET);
|
853 | 854 | if (primary && (lpDDSurfaceDesc2->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) && (renderer->hRC == primary->hRC))
|
854 | 855 | {
|
855 | 856 | if (primarylost)
|
Index: ddraw/glDirectDraw.h |
— | — | @@ -230,4 +230,8 @@ |
231 | 231 | ULONG refcount;
|
232 | 232 | glDirectDraw7 *glDD7;
|
233 | 233 | };
|
| 234 | +
|
| 235 | +HRESULT WINAPI EnumSurfacesCallback1(LPDIRECTDRAWSURFACE7 lpDDSurface, LPDDSURFACEDESC2 lpDDSD2, LPVOID lpContext);
|
| 236 | +HRESULT WINAPI EnumSurfacesCallback2(LPDIRECTDRAWSURFACE7 lpDDSurface, LPDDSURFACEDESC2 lpDDSD2, LPVOID lpContext);
|
| 237 | +
|
234 | 238 | #endif //_GLDIRECTDRAW_H
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -394,6 +394,7 @@ |
395 | 395 | if(buffer) free(buffer);
|
396 | 396 | if(bigbuffer) free(bigbuffer);
|
397 | 397 | if(zbuffer) zbuffer->Release();
|
| 398 | + if(miptexture) miptexture->Release();
|
398 | 399 | if(device) device->Release();
|
399 | 400 | ddInterface->DeleteSurface(this);
|
400 | 401 | TRACE_EXIT(-1,0);
|
— | — | @@ -758,9 +759,26 @@ |
759 | 760 | {
|
760 | 761 | TRACE_ENTER(3,14,this,14,lpContext,14,lpEnumSurfacesCallback);
|
761 | 762 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
762 | | - FIXME("glDirectDrawSurface7::EnumAttachedSurfaces: stub\n");
|
763 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
764 | | - ERR(DDERR_GENERIC);
|
| 763 | + HRESULT enumret = DDENUMRET_OK;
|
| 764 | + if (backbuffer)
|
| 765 | + {
|
| 766 | + backbuffer->AddRef();
|
| 767 | + enumret = lpEnumSurfacesCallback(backbuffer, &backbuffer->ddsd, lpContext);
|
| 768 | + }
|
| 769 | + if (enumret == DDENUMRET_CANCEL) TRACE_RET(HRESULT, 23, DD_OK);
|
| 770 | + if (zbuffer)
|
| 771 | + {
|
| 772 | + zbuffer->AddRef();
|
| 773 | + enumret = lpEnumSurfacesCallback(zbuffer, &zbuffer->ddsd, lpContext);
|
| 774 | + }
|
| 775 | + if (enumret == DDENUMRET_CANCEL) TRACE_RET(HRESULT, 23, DD_OK);
|
| 776 | + if (miptexture)
|
| 777 | + {
|
| 778 | + miptexture->AddRef();
|
| 779 | + enumret = lpEnumSurfacesCallback(miptexture, &miptexture->ddsd, lpContext);
|
| 780 | + }
|
| 781 | + TRACE_EXIT(23, DD_OK);
|
| 782 | + return DD_OK;
|
765 | 783 | }
|
766 | 784 | HRESULT WINAPI glDirectDrawSurface7::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpfnCallback)
|
767 | 785 | {
|
— | — | @@ -924,7 +942,7 @@ |
925 | 943 | }
|
926 | 944 |
|
927 | 945 | TRACE_EXIT(23,DDERR_NOTFOUND);
|
928 | | - ERR(DDERR_NOTFOUND);
|
| 946 | + return DDERR_NOTFOUND;
|
929 | 947 | }
|
930 | 948 | HRESULT WINAPI glDirectDrawSurface7::GetBltStatus(DWORD dwFlags)
|
931 | 949 | {
|
— | — | @@ -1772,7 +1790,11 @@ |
1773 | 1791 | {
|
1774 | 1792 | TRACE_ENTER(3,14,this,14,lpContext,14,lpEnumSurfacesCallback);
|
1775 | 1793 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1776 | | - TRACE_RET(HRESULT,23,glDDS7->EnumAttachedSurfaces(lpContext,(LPDDENUMSURFACESCALLBACK7)lpEnumSurfacesCallback));
|
| 1794 | + if (!lpEnumSurfacesCallback) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1795 | + LPVOID context[2];
|
| 1796 | + context[0] = lpEnumSurfacesCallback;
|
| 1797 | + context[1] = lpContext;
|
| 1798 | + TRACE_RET(HRESULT,23,glDDS7->EnumAttachedSurfaces(context,EnumSurfacesCallback1));
|
1777 | 1799 | }
|
1778 | 1800 | HRESULT WINAPI glDirectDrawSurface1::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback)
|
1779 | 1801 | {
|
— | — | @@ -2143,7 +2165,11 @@ |
2144 | 2166 | {
|
2145 | 2167 | TRACE_ENTER(3,14,this,14,lpContext,14,lpEnumSurfacesCallback);
|
2146 | 2168 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2147 | | - TRACE_RET(HRESULT,23,glDDS7->EnumAttachedSurfaces(lpContext,(LPDDENUMSURFACESCALLBACK7)lpEnumSurfacesCallback));
|
| 2169 | + if (!lpEnumSurfacesCallback) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2170 | + LPVOID context[2];
|
| 2171 | + context[0] = lpEnumSurfacesCallback;
|
| 2172 | + context[1] = lpContext;
|
| 2173 | + TRACE_RET(HRESULT, 23, glDDS7->EnumAttachedSurfaces(context, EnumSurfacesCallback1));
|
2148 | 2174 | }
|
2149 | 2175 | HRESULT WINAPI glDirectDrawSurface2::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback)
|
2150 | 2176 | {
|
— | — | @@ -2538,7 +2564,11 @@ |
2539 | 2565 | {
|
2540 | 2566 | TRACE_ENTER(3,14,this,14,lpContext,14,lpEnumSurfacesCallback);
|
2541 | 2567 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2542 | | - TRACE_RET(HRESULT,23,glDDS7->EnumAttachedSurfaces(lpContext,(LPDDENUMSURFACESCALLBACK7)lpEnumSurfacesCallback));
|
| 2568 | + if (!lpEnumSurfacesCallback) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2569 | + LPVOID context[2];
|
| 2570 | + context[0] = lpEnumSurfacesCallback;
|
| 2571 | + context[1] = lpContext;
|
| 2572 | + TRACE_RET(HRESULT, 23, glDDS7->EnumAttachedSurfaces(context, EnumSurfacesCallback1));
|
2543 | 2573 | }
|
2544 | 2574 | HRESULT WINAPI glDirectDrawSurface3::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback)
|
2545 | 2575 | {
|
— | — | @@ -2939,7 +2969,11 @@ |
2940 | 2970 | {
|
2941 | 2971 | TRACE_ENTER(3,14,this,14,lpContext,14,lpEnumSurfacesCallback);
|
2942 | 2972 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2943 | | - TRACE_RET(HRESULT,23,glDDS7->EnumAttachedSurfaces(lpContext,(LPDDENUMSURFACESCALLBACK7)lpEnumSurfacesCallback));
|
| 2973 | + if (!lpEnumSurfacesCallback) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2974 | + LPVOID context[2];
|
| 2975 | + context[0] = lpEnumSurfacesCallback;
|
| 2976 | + context[1] = lpContext;
|
| 2977 | + TRACE_RET(HRESULT, 23, glDDS7->EnumAttachedSurfaces(context, EnumSurfacesCallback2));
|
2944 | 2978 | }
|
2945 | 2979 | HRESULT WINAPI glDirectDrawSurface4::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK2 lpfnCallback)
|
2946 | 2980 | {
|