@@ -439,8 +439,68 @@ HRESULT m_IDirect3DDeviceX::Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestP
439
439
440
440
if (Config.Dd7to9 )
441
441
{
442
- LOG_LIMIT (100 , __FUNCTION__ << " Not Implemented" );
443
- return DDERR_UNSUPPORTED;
442
+ if (!lpDestTex || !lpSrcTex)
443
+ {
444
+ return DDERR_INVALIDPARAMS;
445
+ }
446
+
447
+ // ToDo: support the following dwFlags:
448
+ // DDSCAPS2_CUBEMAP_ALLFACES - All faces should be loaded with the image data within the source texture.
449
+ // DDSCAPS2_CUBEMAP_NEGATIVEX, DDSCAPS2_CUBEMAP_NEGATIVEY, or DDSCAPS2_CUBEMAP_NEGATIVEZ
450
+ // The negative x, y, or z faces should receive the image data.
451
+ // DDSCAPS2_CUBEMAP_POSITIVEX, DDSCAPS2_CUBEMAP_POSITIVEY, or DDSCAPS2_CUBEMAP_POSITIVEZ
452
+ // The positive x, y, or z faces should receive the image data.
453
+
454
+ if (dwFlags)
455
+ {
456
+ LOG_LIMIT (100 , __FUNCTION__ << " Warning: flags not supported. dwFlags: " << Logging::hex (dwFlags));
457
+ }
458
+
459
+ // ToDo: check if source and destination surfaces are valid
460
+
461
+ if (!lprcSrcRect && (!lpDestPoint || (lpDestPoint && lpDestPoint->x == 0 && lpDestPoint->y == 0 )))
462
+ {
463
+ return lpDestTex->Blt (nullptr , lpSrcTex, nullptr , 0 , nullptr );
464
+ }
465
+ else
466
+ {
467
+ // Get source rect
468
+ RECT SrcRect = {};
469
+ if (lprcSrcRect)
470
+ {
471
+ SrcRect = *lprcSrcRect;
472
+ }
473
+ else
474
+ {
475
+ DDSURFACEDESC2 Desc2 = {};
476
+ Desc2.dwSize = sizeof (DDSURFACEDESC2);
477
+ lpSrcTex->GetSurfaceDesc (&Desc2);
478
+
479
+ if ((Desc2.dwFlags & (DDSD_WIDTH | DDSD_HEIGHT)) != (DDSD_WIDTH | DDSD_HEIGHT))
480
+ {
481
+ return DDERR_GENERIC;
482
+ }
483
+
484
+ SrcRect = { 0 , 0 , (LONG)Desc2.dwWidth , (LONG)Desc2.dwHeight };
485
+ }
486
+
487
+ // Get destination point
488
+ POINT DestPoint = {};
489
+ if (lpDestPoint)
490
+ {
491
+ DestPoint = *lpDestPoint;
492
+ }
493
+
494
+ // Get destination rect
495
+ RECT DestRect = {
496
+ DestPoint.x , // left
497
+ DestPoint.y , // top
498
+ DestPoint.x + (SrcRect.right - SrcRect.left ), // right
499
+ DestPoint.y + (SrcRect.bottom - SrcRect.top ), // bottom
500
+ };
501
+
502
+ return lpDestTex->Blt (&DestRect, lpSrcTex, &SrcRect, 0 , nullptr );
503
+ }
444
504
}
445
505
446
506
if (lpDestTex)
0 commit comments