Index: ddraw/ddraw.cpp |
— | — | @@ -37,15 +37,15 @@ |
38 | 38 | { 0x9ff8900, 0x8c4a, 0x4ba4, { 0xbf, 0x29, 0x56, 0x50, 0x4a, 0xf, 0x3b, 0xb3 } };
|
39 | 39 |
|
40 | 40 |
|
41 | | -void InitGL(int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hWnd, glDirectDraw7 *glDD7)
|
| 41 | +void InitGL(int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hWnd, glDirectDraw7 *glDD7, bool devwnd)
|
42 | 42 | {
|
43 | 43 | TRACE_ENTER(6,11,width,11,height,11,bpp,21,fullscreen,13,hWnd,14,glDD7);
|
44 | 44 | if (!glDD7->renderer)
|
45 | 45 | {
|
46 | 46 | glDD7->renderer = (glRenderer*)malloc(sizeof(glRenderer));
|
47 | | - glRenderer_Init(glDD7->renderer,width,height,bpp,fullscreen,frequency,hWnd,glDD7);
|
| 47 | + glRenderer_Init(glDD7->renderer,width,height,bpp,fullscreen,frequency,hWnd,glDD7,devwnd);
|
48 | 48 | }
|
49 | | - else glRenderer_SetWnd(glDD7->renderer,width,height,bpp,fullscreen,frequency,hWnd);
|
| 49 | + else glRenderer_SetWnd(glDD7->renderer,width,height,bpp,fullscreen,frequency,hWnd,devwnd);
|
50 | 50 | TRACE_EXIT(0,0);
|
51 | 51 | }
|
52 | 52 |
|
Index: ddraw/ddraw.h |
— | — | @@ -61,6 +61,6 @@ |
62 | 62 | extern const GUID device_template;
|
63 | 63 | struct glRenderer;
|
64 | 64 | class glDirectDraw7;
|
65 | | -void InitGL(int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hWnd, glDirectDraw7 *glDD7);
|
| 65 | +void InitGL(int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hWnd, glDirectDraw7 *glDD7, bool devwnd);
|
66 | 66 |
|
67 | 67 | #endif //_DDRAW_PRIVATE_H |
\ No newline at end of file |
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1061,7 +1061,7 @@ |
1062 | 1062 | DEVMODE mode;
|
1063 | 1063 | mode.dmSize = sizeof(DEVMODE);
|
1064 | 1064 | EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &mode);
|
1065 | | - glRenderer_Init(tmprenderer, 16, 16, mode.dmBitsPerPel, false, mode.dmDisplayFrequency, hGLWnd, NULL);
|
| 1065 | + glRenderer_Init(tmprenderer, 16, 16, mode.dmBitsPerPel, false, mode.dmDisplayFrequency, hGLWnd, NULL, FALSE);
|
1066 | 1066 | if (tmprenderer->ext->glver_major >= 3) fullrop = TRUE;
|
1067 | 1067 | if (tmprenderer->ext->GLEXT_EXT_gpu_shader4) fullrop = TRUE;
|
1068 | 1068 | glRenderer_Delete(tmprenderer);
|
— | — | @@ -1329,6 +1329,7 @@ |
1330 | 1330 | winstyle = GetWindowLongPtrA(hWnd,GWL_STYLE);
|
1331 | 1331 | winstyleex = GetWindowLongPtrA(hWnd,GWL_EXSTYLE);
|
1332 | 1332 | bool exclusive = false;
|
| 1333 | + devwnd = false;
|
1333 | 1334 | if(dwFlags & DDSCL_ALLOWMODEX)
|
1334 | 1335 | {
|
1335 | 1336 | // Validate flags
|
— | — | @@ -1340,8 +1341,6 @@ |
1341 | 1342 | }
|
1342 | 1343 | if(dwFlags & DDSCL_ALLOWREBOOT)
|
1343 | 1344 | DEBUG("IDirectDraw::SetCooperativeLevel: DDSCL_ALLOWREBOOT unnecessary\n");
|
1344 | | - if(dwFlags & DDSCL_CREATEDEVICEWINDOW)
|
1345 | | - FIXME("IDirectDraw::SetCooperativeLevel: DDSCL_CREATEDEVICEWINDOW unsupported\n");
|
1346 | 1345 | if(dwFlags & DDSCL_EXCLUSIVE)
|
1347 | 1346 | exclusive = true;
|
1348 | 1347 | else exclusive = false;
|
— | — | @@ -1350,7 +1349,12 @@ |
1351 | 1350 | else fullscreen = false;
|
1352 | 1351 | if(exclusive)
|
1353 | 1352 | if(!fullscreen) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
1354 | | - if(dwFlags & DDSCL_FPUPRESERVE)
|
| 1353 | + if (dwFlags & DDSCL_CREATEDEVICEWINDOW)
|
| 1354 | + {
|
| 1355 | + if (!exclusive) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1356 | + devwnd = true;
|
| 1357 | + }
|
| 1358 | + if (dwFlags & DDSCL_FPUPRESERVE)
|
1355 | 1359 | fpupreserve = true;
|
1356 | 1360 | else fpupreserve = false;
|
1357 | 1361 | if(dwFlags & DDSCL_FPUSETUP)
|
— | — | @@ -1392,7 +1396,7 @@ |
1393 | 1397 | bpp = devmode.dmBitsPerPel;
|
1394 | 1398 | internalrefresh = primaryrefresh = screenrefresh = devmode.dmDisplayFrequency;
|
1395 | 1399 | primarybpp = bpp;
|
1396 | | - InitGL(x,y,bpp,fullscreen,internalrefresh,hWnd,this);
|
| 1400 | + InitGL(x,y,bpp,fullscreen,internalrefresh,hWnd,this,devwnd);
|
1397 | 1401 | TRACE_EXIT(23,DD_OK);
|
1398 | 1402 | return DD_OK;
|
1399 | 1403 | }
|
— | — | @@ -1467,6 +1471,7 @@ |
1468 | 1472 | if (dwFlags & 0xFFFFFFFE) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
1469 | 1473 | if ((dwBPP != 4) && (dwBPP != 8) && (dwBPP != 15) && (dwBPP != 16) && (dwBPP != 24) && (dwBPP != 32))
|
1470 | 1474 | TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1475 | + if (!fullscreen) TRACE_RET(HRESULT, 23, DDERR_NOEXCLUSIVEMODE);
|
1471 | 1476 | DEBUG("IDirectDraw::SetDisplayMode: implement multiple monitors\n");
|
1472 | 1477 | DEVMODE newmode,newmode2;
|
1473 | 1478 | DEVMODE currmode;
|
— | — | @@ -1506,7 +1511,7 @@ |
1507 | 1512 | primarybpp = dwBPP;
|
1508 | 1513 | if(dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
|
1509 | 1514 | else internalrefresh = primaryrefresh = screenrefresh = currmode.dmDisplayFrequency;
|
1510 | | - InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this);
|
| 1515 | + InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this,devwnd);
|
1511 | 1516 | primarylost = true;
|
1512 | 1517 | TRACE_EXIT(23,DD_OK);
|
1513 | 1518 | return DD_OK;
|
— | — | @@ -1539,7 +1544,7 @@ |
1540 | 1545 | if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
|
1541 | 1546 | else internalrefresh = primaryrefresh = screenrefresh = currmode.dmDisplayFrequency;
|
1542 | 1547 | primarybpp = dwBPP;
|
1543 | | - InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this);
|
| 1548 | + InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this,devwnd);
|
1544 | 1549 | primarylost = true;
|
1545 | 1550 | TRACE_EXIT(23,DD_OK);
|
1546 | 1551 | return DD_OK;
|
— | — | @@ -1584,7 +1589,7 @@ |
1585 | 1590 | if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
|
1586 | 1591 | else internalrefresh = primaryrefresh = screenrefresh = currmode.dmDisplayFrequency;
|
1587 | 1592 | primarybpp = dwBPP;
|
1588 | | - InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this);
|
| 1593 | + InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this,devwnd);
|
1589 | 1594 | primarylost = true;
|
1590 | 1595 | TRACE_EXIT(23,DD_OK);
|
1591 | 1596 | return DD_OK;
|
— | — | @@ -1599,7 +1604,7 @@ |
1600 | 1605 | else internalbpp = screenbpp = currmode.dmBitsPerPel;
|
1601 | 1606 | if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
|
1602 | 1607 | else internalrefresh = primaryrefresh = screenrefresh = currmode.dmDisplayFrequency;
|
1603 | | - InitGL(screenx, screeny, screenbpp, true, internalrefresh, hWnd, this);
|
| 1608 | + InitGL(screenx, screeny, screenbpp, true, internalrefresh, hWnd, this, devwnd);
|
1604 | 1609 | TRACE_EXIT(23,DD_OK);
|
1605 | 1610 | return DD_OK;
|
1606 | 1611 | break;
|
— | — | @@ -1637,7 +1642,7 @@ |
1638 | 1643 | if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
|
1639 | 1644 | else internalrefresh = primaryrefresh = screenrefresh = newmode2.dmDisplayFrequency;
|
1640 | 1645 | primarybpp = dwBPP;
|
1641 | | - InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this);
|
| 1646 | + InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this,devwnd);
|
1642 | 1647 | primarylost = true;
|
1643 | 1648 | TRACE_EXIT(23,DD_OK);
|
1644 | 1649 | return DD_OK;
|
— | — | @@ -1682,7 +1687,7 @@ |
1683 | 1688 | if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
|
1684 | 1689 | else internalrefresh = primaryrefresh = screenrefresh = newmode2.dmDisplayFrequency;
|
1685 | 1690 | primarybpp = dwBPP;
|
1686 | | - InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this);
|
| 1691 | + InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this,devwnd);
|
1687 | 1692 | primarylost = true;
|
1688 | 1693 | TRACE_EXIT(23,DD_OK);
|
1689 | 1694 | return DD_OK;
|
— | — | @@ -1698,7 +1703,7 @@ |
1699 | 1704 | else internalbpp = screenbpp = newmode2.dmBitsPerPel;
|
1700 | 1705 | if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
|
1701 | 1706 | else internalrefresh = primaryrefresh = screenrefresh = newmode2.dmDisplayFrequency;
|
1702 | | - InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this);
|
| 1707 | + InitGL(screenx,screeny,screenbpp,true,internalrefresh,hWnd,this,devwnd);
|
1703 | 1708 | primarylost = true;
|
1704 | 1709 | TRACE_EXIT(23,DD_OK);
|
1705 | 1710 | return DD_OK;
|
Index: ddraw/glDirectDraw.h |
— | — | @@ -113,6 +113,7 @@ |
114 | 114 | bool initialized;
|
115 | 115 | glDirect3D7 *glD3D7;
|
116 | 116 | DWORD timer;
|
| 117 | + bool devwnd;
|
117 | 118 | };
|
118 | 119 |
|
119 | 120 | class glDirectDraw1 : public IDirectDraw
|
Index: ddraw/glDirectDrawClipper.cpp |
— | — | @@ -117,10 +117,125 @@ |
118 | 118 | TRACE_EXIT(8,ret);
|
119 | 119 | return ret;
|
120 | 120 | }
|
| 121 | +
|
121 | 122 | HRESULT WINAPI glDirectDrawClipper_GetClipList(glDirectDrawClipper *This, LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize)
|
122 | 123 | {
|
| 124 | + HRGN rgnrect;
|
| 125 | + HRGN rgncliplist;
|
| 126 | + RGNDATA *rgn;
|
| 127 | + DWORD rgnsize;
|
123 | 128 | TRACE_ENTER(4,14,This,26,lpRect,14,lpClipList,14,lpdwSize);
|
124 | 129 | if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 130 | + if (!lpdwSize) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 131 | + if (!This->clipsize) TRACE_RET(HRESULT, 23, DDERR_NOCLIPLIST);
|
| 132 | + if (!lpClipList)
|
| 133 | + {
|
| 134 | + if (lpRect)
|
| 135 | + {
|
| 136 | + rgnrect = CreateRectRgnIndirect(lpRect);
|
| 137 | + rgncliplist = ExtCreateRegion(NULL, (sizeof(RGNDATAHEADER) + (This->cliplist->rdh.nCount*sizeof(RECT))),
|
| 138 | + This->cliplist);
|
| 139 | + if (CombineRgn(rgncliplist, rgnrect, rgncliplist, RGN_AND) == ERROR)
|
| 140 | + {
|
| 141 | + DeleteObject(rgnrect);
|
| 142 | + DeleteObject(rgncliplist);
|
| 143 | + TRACE_RET(HRESULT, 23, DDERR_GENERIC);
|
| 144 | + }
|
| 145 | + rgnsize = GetRegionData(rgncliplist, 0, NULL);
|
| 146 | + rgn = (RGNDATA*)malloc(rgnsize);
|
| 147 | + if (!rgn)
|
| 148 | + {
|
| 149 | + DeleteObject(rgnrect);
|
| 150 | + DeleteObject(rgncliplist);
|
| 151 | + TRACE_RET(HRESULT, 23, DDERR_OUTOFMEMORY);
|
| 152 | + }
|
| 153 | + GetRegionData(rgncliplist, rgnsize, rgn);
|
| 154 | + *lpdwSize = sizeof(RGNDATAHEADER) + (rgn->rdh.nCount*sizeof(RECT));
|
| 155 | + free(rgn);
|
| 156 | + DeleteObject(rgnrect);
|
| 157 | + DeleteObject(rgncliplist);
|
| 158 | + TRACE_EXIT(23, DD_OK);
|
| 159 | + return DD_OK;
|
| 160 | + }
|
| 161 | + else
|
| 162 | + {
|
| 163 | + *lpdwSize = sizeof(RGNDATAHEADER) + (This->clipsize*sizeof(RECT));
|
| 164 | + TRACE_EXIT(23, DD_OK);
|
| 165 | + return DD_OK;
|
| 166 | + }
|
| 167 | + }
|
| 168 | + else
|
| 169 | + {
|
| 170 | + if (lpRect)
|
| 171 | + {
|
| 172 | + rgnrect = CreateRectRgnIndirect(lpRect);
|
| 173 | + rgncliplist = ExtCreateRegion(NULL, (sizeof(RGNDATAHEADER) + (This->cliplist->rdh.nCount*sizeof(RECT))),
|
| 174 | + This->cliplist);
|
| 175 | + if (CombineRgn(rgncliplist, rgnrect, rgncliplist, RGN_AND) == ERROR)
|
| 176 | + {
|
| 177 | + DeleteObject(rgnrect);
|
| 178 | + DeleteObject(rgncliplist);
|
| 179 | + TRACE_RET(HRESULT, 23, DDERR_GENERIC);
|
| 180 | + }
|
| 181 | + rgnsize = GetRegionData(rgncliplist, 0, NULL);
|
| 182 | + rgn = (RGNDATA*)malloc(rgnsize);
|
| 183 | + if (!rgn)
|
| 184 | + {
|
| 185 | + DeleteObject(rgnrect);
|
| 186 | + DeleteObject(rgncliplist);
|
| 187 | + TRACE_RET(HRESULT, 23, DDERR_OUTOFMEMORY);
|
| 188 | + }
|
| 189 | + GetRegionData(rgncliplist, rgnsize, rgn);
|
| 190 | + if (*lpdwSize < (sizeof(RGNDATAHEADER) + (rgn->rdh.nCount*sizeof(RECT))))
|
| 191 | + {
|
| 192 | + free(rgn);
|
| 193 | + DeleteObject(rgnrect);
|
| 194 | + DeleteObject(rgncliplist);
|
| 195 | + TRACE_RET(HRESULT, 23, DDERR_REGIONTOOSMALL);
|
| 196 | + }
|
| 197 | + *lpdwSize = sizeof(RGNDATAHEADER) + (rgn->rdh.nCount*sizeof(RECT));
|
| 198 | +#ifdef _MSC_VER
|
| 199 | + __try
|
| 200 | + {
|
| 201 | +#endif
|
| 202 | + memcpy(lpClipList, rgn, sizeof(RGNDATAHEADER) + (rgn->rdh.nCount*sizeof(RECT)));
|
| 203 | +#ifdef _MSC_VER
|
| 204 | + }
|
| 205 | + __except (GetExceptionCode() == STATUS_ACCESS_VIOLATION)
|
| 206 | + {
|
| 207 | + free(rgn);
|
| 208 | + DeleteObject(rgnrect);
|
| 209 | + DeleteObject(rgncliplist);
|
| 210 | + TRACE_RET(HRESULT, 23, DDERR_INVALIDCLIPLIST);
|
| 211 | + }
|
| 212 | +#endif
|
| 213 | + free(rgn);
|
| 214 | + DeleteObject(rgnrect);
|
| 215 | + DeleteObject(rgncliplist);
|
| 216 | + TRACE_EXIT(23, DD_OK);
|
| 217 | + return DD_OK;
|
| 218 | + }
|
| 219 | + else
|
| 220 | + {
|
| 221 | + if(*lpdwSize < (sizeof(RGNDATAHEADER) + (This->clipsize*sizeof(RECT))))
|
| 222 | + TRACE_RET(HRESULT,23,DDERR_REGIONTOOSMALL);
|
| 223 | + *lpdwSize = sizeof(RGNDATAHEADER) + (This->clipsize*sizeof(RECT));
|
| 224 | +#ifdef _MSC_VER
|
| 225 | + __try
|
| 226 | + {
|
| 227 | +#endif
|
| 228 | + memcpy(lpClipList, This->cliplist, sizeof(RGNDATAHEADER) + (This->clipsize*sizeof(RECT)));
|
| 229 | +#ifdef _MSC_VER
|
| 230 | + }
|
| 231 | + __except (GetExceptionCode() == STATUS_ACCESS_VIOLATION)
|
| 232 | + {
|
| 233 | + TRACE_RET(HRESULT, 23, DDERR_INVALIDCLIPLIST);
|
| 234 | + }
|
| 235 | +#endif
|
| 236 | + TRACE_EXIT(23, DD_OK);
|
| 237 | + return DD_OK;
|
| 238 | + }
|
| 239 | + }
|
125 | 240 | FIXME("IDirectDrawClipper::GetClipList: stub");
|
126 | 241 | TRACE_EXIT(23,DDERR_GENERIC);
|
127 | 242 | ERR(DDERR_GENERIC);
|
— | — | @@ -179,7 +294,7 @@ |
180 | 295 | {
|
181 | 296 | memfail = false;
|
182 | 297 | This->maxsize = lpClipList->rdh.nCount;
|
183 | | - This->cliplist = (RECT*)malloc(This->maxsize*sizeof(RECT));
|
| 298 | + This->cliplist = (RGNDATA*)malloc(sizeof(RGNDATAHEADER)+(This->maxsize*sizeof(RECT)));
|
184 | 299 | if(!This->cliplist) memfail = true;
|
185 | 300 | if(!memfail) This->vertices = (BltVertex*)malloc(This->maxsize*4*sizeof(BltVertex));
|
186 | 301 | if(!This->vertices) memfail = true;
|
— | — | @@ -204,10 +319,10 @@ |
205 | 320 | if(lpClipList->rdh.nCount > This->maxsize)
|
206 | 321 | {
|
207 | 322 | memfail = false;
|
208 | | - RECT *newcliplist = NULL;
|
| 323 | + RGNDATA *newcliplist = NULL;
|
209 | 324 | BltVertex *newvertices = NULL;
|
210 | 325 | WORD *newindices = NULL;
|
211 | | - newcliplist = (RECT*)realloc(This->cliplist,lpClipList->rdh.nCount*sizeof(RECT));
|
| 326 | + newcliplist = (RGNDATA*)realloc(This->cliplist,sizeof(RGNDATAHEADER)+(lpClipList->rdh.nCount*sizeof(RECT)));
|
212 | 327 | if(!newcliplist) memfail = true;
|
213 | 328 | else This->cliplist = newcliplist;
|
214 | 329 | if(!memfail) newvertices = (BltVertex*)realloc(This->vertices,lpClipList->rdh.nCount*4*sizeof(BltVertex));
|
— | — | @@ -220,13 +335,14 @@ |
221 | 336 | This->maxsize = lpClipList->rdh.nCount;
|
222 | 337 | }
|
223 | 338 | This->clipsize = lpClipList->rdh.nCount;
|
224 | | - memcpy(This->cliplist,lpClipList->Buffer,lpClipList->rdh.nCount*sizeof(RECT));
|
| 339 | + memcpy(This->cliplist,lpClipList,sizeof(RGNDATAHEADER)+(lpClipList->rdh.nCount*sizeof(RECT)));
|
| 340 | + RECT *buffer = (RECT*)This->cliplist->Buffer;
|
225 | 341 | for(int i = 0; i < lpClipList->rdh.nCount; i++)
|
226 | 342 | {
|
227 | | - This->vertices[(i*4)+1].x = This->vertices[(i*4)+3].x = This->cliplist[i].left;
|
228 | | - This->vertices[i*4].x = This->vertices[(i*4)+2].x = This->cliplist[i].right;
|
229 | | - This->vertices[i*4].y = This->vertices[(i*4)+1].y = This->cliplist[i].top;
|
230 | | - This->vertices[(i*4)+2].y = This->vertices[(i*4)+3].y = This->cliplist[i].bottom;
|
| 343 | + This->vertices[(i*4)+1].x = This->vertices[(i*4)+3].x = buffer[i].left;
|
| 344 | + This->vertices[i*4].x = This->vertices[(i*4)+2].x = buffer[i].right;
|
| 345 | + This->vertices[i*4].y = This->vertices[(i*4)+1].y = buffer[i].top;
|
| 346 | + This->vertices[(i*4)+2].y = This->vertices[(i*4)+3].y = buffer[i].bottom;
|
231 | 347 | // 0 1 2 2 1 3
|
232 | 348 | This->indices[i*6] = i*4;
|
233 | 349 | This->indices[(i*6)+1] = This->indices[(i*6)+4] = (i*4)+1;
|
Index: ddraw/glDirectDrawClipper.h |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | bool hasparent;
|
33 | 33 | bool initialized;
|
34 | 34 | HWND hWnd;
|
35 | | - RECT *cliplist;
|
| 35 | + RGNDATA *cliplist;
|
36 | 36 | BltVertex *vertices;
|
37 | 37 | WORD *indices;
|
38 | 38 | int clipsize;
|
Index: ddraw/glRenderWindow.cpp |
— | — | @@ -47,12 +47,13 @@ |
48 | 48 |
|
49 | 49 | }
|
50 | 50 |
|
51 | | -glRenderWindow::glRenderWindow(int width, int height, bool fullscreen, HWND parent, glDirectDraw7 *glDD7)
|
| 51 | +glRenderWindow::glRenderWindow(int width, int height, bool fullscreen, HWND parent, glDirectDraw7 *glDD7, bool devwnd)
|
52 | 52 | {
|
53 | 53 | ddInterface = glDD7;
|
54 | 54 | this->width = width;
|
55 | 55 | this->height = height;
|
56 | 56 | this->fullscreen = fullscreen;
|
| 57 | + this->device = devwnd;
|
57 | 58 | hParentWnd = parent;
|
58 | 59 | ReadyEvent = CreateEvent(NULL,false,false,NULL);
|
59 | 60 | hThread = CreateThread(NULL,0,ThreadEntry,this,0,NULL);
|
— | — | @@ -68,6 +69,9 @@ |
69 | 70 |
|
70 | 71 | DWORD glRenderWindow::_Entry()
|
71 | 72 | {
|
| 73 | + char *windowname;
|
| 74 | + if (device) windowname = "DirectDrawDeviceWnd";
|
| 75 | + else windowname = "Renderer";
|
72 | 76 | MSG Msg;
|
73 | 77 | if(!wndclasscreated)
|
74 | 78 | {
|
— | — | @@ -81,7 +85,7 @@ |
82 | 86 | wndclass.hCursor = NULL;
|
83 | 87 | wndclass.hbrBackground = NULL;
|
84 | 88 | wndclass.lpszMenuName = NULL;
|
85 | | - wndclass.lpszClassName = "DXGLRenderWindow";
|
| 89 | + wndclass.lpszClassName = "DirectDrawDeviceWnd";
|
86 | 90 | wndclass.hIconSm = NULL;
|
87 | 91 | RegisterClassExA(&wndclass);
|
88 | 92 | wndclasscreated = true;
|
— | — | @@ -91,7 +95,7 @@ |
92 | 96 | dead = false;
|
93 | 97 | if(hParentWnd)
|
94 | 98 | {
|
95 | | - hWnd = CreateWindowA("DXGLRenderWindow","Renderer",WS_CHILD|WS_VISIBLE,0,0,rectRender.right - rectRender.left,
|
| 99 | + hWnd = CreateWindowA("DirectDrawDeviceWnd",windowname,WS_CHILD|WS_VISIBLE,0,0,rectRender.right - rectRender.left,
|
96 | 100 | rectRender.bottom - rectRender.top,hParentWnd,NULL,wndclass.hInstance,this);
|
97 | 101 | SetWindowPos(hWnd,HWND_TOP,0,0,rectRender.right,rectRender.bottom,SWP_SHOWWINDOW);
|
98 | 102 | }
|
— | — | @@ -100,7 +104,7 @@ |
101 | 105 | width = GetSystemMetrics(SM_CXSCREEN);
|
102 | 106 | height = GetSystemMetrics(SM_CYSCREEN);
|
103 | 107 | hWnd = CreateWindowExA(WS_EX_TOOLWINDOW|WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOPMOST,
|
104 | | - "DXGLRenderWindow","Renderer",WS_POPUP,0,0,width,height,0,0,NULL,this);
|
| 108 | + "DirectDrawDeviceWnd",windowname,WS_POPUP,0,0,width,height,0,0,NULL,this);
|
105 | 109 | SetWindowPos(hWnd,HWND_TOP,0,0,width,height,SWP_SHOWWINDOW|SWP_NOACTIVATE);
|
106 | 110 | }
|
107 | 111 | #ifdef _DEBUG
|
Index: ddraw/glRenderWindow.h |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | class glRenderWindow
|
28 | 28 | {
|
29 | 29 | public:
|
30 | | - glRenderWindow(int width, int height, bool fullscreen, HWND parent, glDirectDraw7 *glDD7);
|
| 30 | + glRenderWindow(int width, int height, bool fullscreen, HWND parent, glDirectDraw7 *glDD7, bool devwnd);
|
31 | 31 | ~glRenderWindow();
|
32 | 32 | void resize(int width, int height);
|
33 | 33 | HWND GetHWnd(){return hWnd;};
|
— | — | @@ -42,6 +42,7 @@ |
43 | 43 | int height;
|
44 | 44 | bool fullscreen;
|
45 | 45 | bool dead;
|
| 46 | + bool device;
|
46 | 47 | glDirectDraw7 *ddInterface;
|
47 | 48 | };
|
48 | 49 |
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -194,8 +194,10 @@ |
195 | 195 | * layered window will be created for the renderer.
|
196 | 196 | * @param glDD7
|
197 | 197 | * Pointer to the glDirectDraw7 object that is managing the glRenderer object
|
| 198 | + * @param devwnd
|
| 199 | + * True if creating window with name "DirectDrawDeviceWnd"
|
198 | 200 | */
|
199 | | -void glRenderer_Init(glRenderer *This, int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hwnd, glDirectDraw7 *glDD7)
|
| 201 | +void glRenderer_Init(glRenderer *This, int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hwnd, glDirectDraw7 *glDD7, BOOL devwnd)
|
200 | 202 | {
|
201 | 203 | This->oldswap = 0;
|
202 | 204 | This->fogcolor = 0;
|
— | — | @@ -222,7 +224,7 @@ |
223 | 225 | // TODO: Adjust window rect
|
224 | 226 | }
|
225 | 227 | SetWindowPos(This->hWnd,HWND_TOP,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
226 | | - This->RenderWnd = new glRenderWindow(width,height,fullscreen,This->hWnd,glDD7);
|
| 228 | + This->RenderWnd = new glRenderWindow(width,height,fullscreen,This->hWnd,glDD7,devwnd);
|
227 | 229 | This->inputs[0] = (void*)width;
|
228 | 230 | This->inputs[1] = (void*)height;
|
229 | 231 | This->inputs[2] = (void*)bpp;
|
— | — | @@ -231,6 +233,7 @@ |
232 | 234 | This->inputs[5] = (void*)This->hWnd;
|
233 | 235 | This->inputs[6] = glDD7;
|
234 | 236 | This->inputs[7] = This;
|
| 237 | + This->inputs[8] = (void*)devwnd;
|
235 | 238 | This->hThread = CreateThread(NULL, 0, glRenderer_ThreadEntry, This->inputs, 0, NULL);
|
236 | 239 | WaitForSingleObject(This->busy,INFINITE);
|
237 | 240 | }
|
— | — | @@ -557,8 +560,10 @@ |
558 | 561 | * True if fullscreen
|
559 | 562 | * @param newwnd
|
560 | 563 | * HWND of the new window
|
| 564 | + * @param devwnd
|
| 565 | + * True if creating window with name "DirectDrawDeviceWnd"
|
561 | 566 | */
|
562 | | -void glRenderer_SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd)
|
| 567 | +void glRenderer_SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd, BOOL devwnd)
|
563 | 568 | {
|
564 | 569 | EnterCriticalSection(&This->cs);
|
565 | 570 | if(fullscreen && newwnd)
|
— | — | @@ -573,6 +578,7 @@ |
574 | 579 | This->inputs[3] = (void*)fullscreen;
|
575 | 580 | This->inputs[4] = (void*)frequency;
|
576 | 581 | This->inputs[5] = (void*)newwnd;
|
| 582 | + This->inputs[6] = (void*)devwnd;
|
577 | 583 | This->opcode = OP_SETWND;
|
578 | 584 | SetEvent(This->start);
|
579 | 585 | WaitForObjectAndMessages(This->busy);
|
— | — | @@ -734,7 +740,7 @@ |
735 | 741 | break;
|
736 | 742 | case OP_SETWND:
|
737 | 743 | glRenderer__SetWnd(This,(int)This->inputs[0],(int)This->inputs[1],(int)This->inputs[2],
|
738 | | - (int)This->inputs[3],(unsigned int)This->inputs[4],(HWND)This->inputs[5]);
|
| 744 | + (int)This->inputs[3],(unsigned int)This->inputs[4],(HWND)This->inputs[5],(BOOL)This->inputs[6]);
|
739 | 745 | break;
|
740 | 746 | case OP_CREATE:
|
741 | 747 | glRenderer__MakeTexture(This,(TEXTURE*)This->inputs[0],(DWORD)This->inputs[1],(DWORD)This->inputs[2]);
|
— | — | @@ -1649,7 +1655,7 @@ |
1650 | 1656 | SetEvent(This->busy);
|
1651 | 1657 | }
|
1652 | 1658 |
|
1653 | | -void glRenderer__SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd)
|
| 1659 | +void glRenderer__SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd, BOOL devwnd)
|
1654 | 1660 | {
|
1655 | 1661 | if(newwnd != This->hWnd)
|
1656 | 1662 | {
|
— | — | @@ -1657,7 +1663,7 @@ |
1658 | 1664 | wglMakeCurrent(NULL, NULL);
|
1659 | 1665 | ReleaseDC(This->hWnd,This->hDC);
|
1660 | 1666 | delete This->RenderWnd;
|
1661 | | - This->RenderWnd = new glRenderWindow(width,height,fullscreen,newwnd,This->ddInterface);
|
| 1667 | + This->RenderWnd = new glRenderWindow(width,height,fullscreen,newwnd,This->ddInterface, devwnd);
|
1662 | 1668 | PIXELFORMATDESCRIPTOR pfd;
|
1663 | 1669 | GLuint pf;
|
1664 | 1670 | InterlockedIncrement(&gllock);
|
Index: ddraw/glRenderer.h |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | ShaderManager *shaders;
|
120 | 120 | } glRenderer;
|
121 | 121 |
|
122 | | -void glRenderer_Init(glRenderer *This, int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hwnd, glDirectDraw7 *glDD7);
|
| 122 | +void glRenderer_Init(glRenderer *This, int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hwnd, glDirectDraw7 *glDD7, BOOL devwnd);
|
123 | 123 | void glRenderer_Delete(glRenderer *This);
|
124 | 124 | static DWORD WINAPI glRenderer_ThreadEntry(void *entry);
|
125 | 125 | void glRenderer_UploadTexture(glRenderer *This, char *buffer, char *bigbuffer, TEXTURE *texture, int x, int y, int bigx, int bigy, int pitch, int bigpitch, int bpp);
|
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | void glRenderer_DeleteTexture(glRenderer *This, TEXTURE *texture);
|
132 | 132 | void glRenderer_InitD3D(glRenderer *This, int zbuffer);
|
133 | 133 | void glRenderer_Flush(glRenderer *This);
|
134 | | -void glRenderer_SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd);
|
| 134 | +void glRenderer_SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd, BOOL devwnd);
|
135 | 135 | HRESULT glRenderer_Clear(glRenderer *This, glDirectDrawSurface7 *target, DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags, DWORD dwColor, D3DVALUE dvZ, DWORD dwStencil);
|
136 | 136 | HRESULT glRenderer_DrawPrimitives(glRenderer *This, glDirect3DDevice7 *device, GLenum mode, GLVERTEX *vertices, int *texformats, DWORD count, LPWORD indices,
|
137 | 137 | DWORD indexcount, DWORD flags);
|
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | void glRenderer__DrawPrimitives(glRenderer *This, glDirect3DDevice7 *device, GLenum mode, GLVERTEX *vertices, int *texcormats, DWORD count, LPWORD indices,
|
156 | 156 | DWORD indexcount, DWORD flags);
|
157 | 157 | void glRenderer__Flush(glRenderer *This);
|
158 | | -void glRenderer__SetWnd(glRenderer *This, int width, int height, int fullscreen, int bpp, unsigned int frequency, HWND newwnd);
|
| 158 | +void glRenderer__SetWnd(glRenderer *This, int width, int height, int fullscreen, int bpp, unsigned int frequency, HWND newwnd, BOOL devwnd);
|
159 | 159 | void glRenderer__DeleteFBO(glRenderer *This, FBO *fbo);
|
160 | 160 | void glRenderer__UpdateClipper(glRenderer *This, glDirectDrawSurface7 *surface);
|
161 | 161 | void glRenderer__SetFogColor(glRenderer *This, DWORD color);
|