Index: ddraw/glDirect3D.cpp |
— | — | @@ -274,6 +274,36 @@ |
275 | 275 | TRACE_EXIT(23,ret);
|
276 | 276 | return ret;
|
277 | 277 | }
|
| 278 | +
|
| 279 | +void FixCapsTexture(D3DDEVICEDESC7 *d3ddesc, D3DDEVICEDESC *d3ddesc3, glRenderer *renderer)
|
| 280 | +{
|
| 281 | + if (!d3ddesc->dwMaxTextureWidth)
|
| 282 | + {
|
| 283 | + if (!renderer)
|
| 284 | + {
|
| 285 | + HWND hGLWnd = CreateWindow(_T("Test"), NULL, WS_POPUP, 0, 0, 16, 16, NULL, NULL, NULL, NULL);
|
| 286 | + glRenderer *tmprenderer = (glRenderer*)malloc(sizeof(glRenderer));
|
| 287 | + DEVMODE mode;
|
| 288 | + mode.dmSize = sizeof(DEVMODE);
|
| 289 | + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &mode);
|
| 290 | + glRenderer_Init(tmprenderer, 16, 16, mode.dmBitsPerPel, false, mode.dmDisplayFrequency, hGLWnd, NULL, FALSE);
|
| 291 | + d3ddesc->dwMaxTextureWidth = d3ddesc->dwMaxTextureHeight =
|
| 292 | + d3ddesc->dwMaxTextureRepeat = d3ddesc->dwMaxTextureAspectRatio = tmprenderer->gl_caps.TextureMax;
|
| 293 | + d3ddesc3->dwMaxTextureWidth = d3ddesc3->dwMaxTextureHeight =
|
| 294 | + d3ddesc3->dwMaxTextureRepeat = d3ddesc3->dwMaxTextureAspectRatio = tmprenderer->gl_caps.TextureMax;
|
| 295 | + glRenderer_Delete(tmprenderer);
|
| 296 | + free(tmprenderer);
|
| 297 | + }
|
| 298 | + else
|
| 299 | + {
|
| 300 | + d3ddesc->dwMaxTextureWidth = d3ddesc->dwMaxTextureHeight =
|
| 301 | + d3ddesc->dwMaxTextureRepeat = d3ddesc->dwMaxTextureAspectRatio = renderer->gl_caps.TextureMax;
|
| 302 | + d3ddesc3->dwMaxTextureWidth = d3ddesc3->dwMaxTextureHeight =
|
| 303 | + d3ddesc3->dwMaxTextureRepeat = d3ddesc3->dwMaxTextureAspectRatio = renderer->gl_caps.TextureMax;
|
| 304 | + }
|
| 305 | + }
|
| 306 | +}
|
| 307 | +
|
278 | 308 | HRESULT WINAPI glDirect3D7::EnumDevices(LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPVOID lpUserArg)
|
279 | 309 | {
|
280 | 310 | TRACE_ENTER(3,14,this,14,lpEnumDevicesCallback,14,lpUserArg);
|
— | — | @@ -280,6 +310,7 @@ |
281 | 311 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
282 | 312 | if(!lpEnumDevicesCallback) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
283 | 313 | HRESULT result;
|
| 314 | + FixCapsTexture(&glDD7->d3ddesc, &glDD7->d3ddesc3, glDD7->renderer);
|
284 | 315 | D3DDEVICEDESC7 desc = glDD7->d3ddesc;
|
285 | 316 | for(int i = 0; i < 3; i++)
|
286 | 317 | {
|
— | — | @@ -310,6 +341,7 @@ |
311 | 342 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
312 | 343 | if(!lpEnumDevicesCallback) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
313 | 344 | HRESULT result;
|
| 345 | + FixCapsTexture(&glDD7->d3ddesc, &glDD7->d3ddesc3, glDD7->renderer);
|
314 | 346 | D3DDEVICEDESC desc = glDD7->d3ddesc3;
|
315 | 347 | GUID guid = IID_IDirect3DRGBDevice;
|
316 | 348 | result = lpEnumDevicesCallback(&guid,glDD7->stored_devices[0].name,glDD7->stored_devices[0].devname,&desc,&desc,lpUserArg);
|
— | — | @@ -369,6 +401,7 @@ |
370 | 402 | if(!lpD3DFDR) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
371 | 403 | if(lpD3DFDR->dwSize < sizeof(D3DFINDDEVICERESULT)) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
372 | 404 | if(lpD3DFDS->dwSize < sizeof(D3DFINDDEVICESEARCH)) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
| 405 | + FixCapsTexture(&glDD7->d3ddesc, &glDD7->d3ddesc3, glDD7->renderer);
|
373 | 406 | bool found = true;
|
374 | 407 | GUID guid = IID_IDirect3DHALDevice;
|
375 | 408 | if((lpD3DFDS->dwFlags & D3DFDS_LINES) || (lpD3DFDS->dwFlags & D3DFDS_TRIANGLES))
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1403,29 +1403,6 @@ |
1404 | 1404 | }
|
1405 | 1405 | d3ddesc = d3ddesc_default;
|
1406 | 1406 | d3ddesc3 = d3ddesc3_default;
|
1407 | | - if (!renderer)
|
1408 | | - {
|
1409 | | - HWND hGLWnd = CreateWindow(_T("Test"), NULL, WS_POPUP, 0, 0, 16, 16, NULL, NULL, NULL, NULL);
|
1410 | | - glRenderer *tmprenderer = (glRenderer*)malloc(sizeof(glRenderer));
|
1411 | | - DEVMODE mode;
|
1412 | | - mode.dmSize = sizeof(DEVMODE);
|
1413 | | - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &mode);
|
1414 | | - glRenderer_Init(tmprenderer, 16, 16, mode.dmBitsPerPel, false, mode.dmDisplayFrequency, hGLWnd, NULL, FALSE);
|
1415 | | - d3ddesc.dwMaxTextureWidth = d3ddesc.dwMaxTextureHeight =
|
1416 | | - d3ddesc.dwMaxTextureRepeat = d3ddesc.dwMaxTextureAspectRatio = tmprenderer->gl_caps.TextureMax;
|
1417 | | - d3ddesc3.dwMaxTextureWidth = d3ddesc3.dwMaxTextureHeight =
|
1418 | | - d3ddesc3.dwMaxTextureRepeat = d3ddesc3.dwMaxTextureAspectRatio = tmprenderer->gl_caps.TextureMax;
|
1419 | | - glRenderer_Delete(tmprenderer);
|
1420 | | - free(tmprenderer);
|
1421 | | - }
|
1422 | | - else
|
1423 | | - {
|
1424 | | - d3ddesc.dwMaxTextureWidth = d3ddesc.dwMaxTextureHeight =
|
1425 | | - d3ddesc.dwMaxTextureRepeat = d3ddesc.dwMaxTextureAspectRatio = renderer->gl_caps.TextureMax;
|
1426 | | - d3ddesc3.dwMaxTextureWidth = d3ddesc3.dwMaxTextureHeight =
|
1427 | | - d3ddesc3.dwMaxTextureRepeat = d3ddesc3.dwMaxTextureAspectRatio = renderer->gl_caps.TextureMax;
|
1428 | | - }
|
1429 | | -
|
1430 | 1407 | memcpy(stored_devices, d3ddevices, 3 * sizeof(D3DDevice));
|
1431 | 1408 | winstyle = winstyleex = 0;
|
1432 | 1409 | initialized = true;
|