Changeset 913 for trunk/src/ddraw/OS2DDRAW.CPP
- Timestamp:
- Sep 12, 1999, 11:37:37 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2DDRAW.CPP
r850 r913 1 #include <stdlib.h> 2 #include <string.h> 1 3 #include <memory.h> 2 4 … … 129 131 } 130 132 133 lpVtbl2 = lpVtbl; 134 135 pdwUnknownData = (DWORD*) malloc (255*sizeof(DWORD)); 136 for(int i= 0 ;i<255;i++) 137 pdwUnknownData[i] = 0; 138 131 139 rc = DiveOpen( &hDive, 132 140 FALSE, … … 154 162 WriteLog("DiveQueryCaps rc=0x%08X\n",rc); 155 163 164 pdwUnknownData[235] = dCaps.ulHorizontalResolution; 165 pdwUnknownData[236] = dCaps.ulVerticalResolution; 166 pdwUnknownData[241] = dCaps.ulDepth; 156 167 157 168 // Shall we run in FS mode ? … … 477 488 //****************************************************************************** 478 489 //****************************************************************************** 479 HRESULT __stdcall DrawEnumDisplayModes(THIS This, DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, 480 LPVOID lpContext, LPDDENUMMODESCALLBACK lpDDEnumModesCallback) 490 HRESULT __stdcall DrawEnumDisplayModes( THIS This, 491 DWORD dwFlags, 492 LPDDSURFACEDESC lpDDSurfaceDesc, 493 LPVOID lpContext, 494 LPDDENUMMODESCALLBACK lpDDEnumModesCallback) 481 495 { 482 496 int iMode = 0; … … 515 529 // DIVE modes 516 530 531 #ifdef DEBUG 532 WriteLog("EnumDisplayModes : DIVE modes\n"); 533 #endif 534 517 535 // Enumerate all modes ? 518 536 if (NULL==lpDDSurfaceDesc) … … 520 538 // Check if we shall report 320x200 mode 521 539 540 #ifdef DEBUG 541 WriteLog("EnumDisplayModes : ALL modes\n"); 542 #endif 543 522 544 if(dwFlags && DDEDM_STANDARDVGAMODES) 523 545 { 546 #ifdef DEBUG 547 WriteLog("EnumDisplayModes : STANDARDVGAMODES\n"); 548 #endif 524 549 DDSurfAct.dwHeight = ModesDive[0].iYRes; 525 550 DDSurfAct.dwWidth = ModesDive[0].iXRes; 526 551 DDSurfAct.ddpfPixelFormat.dwRGBBitCount = ModesDive[0].iBits; 552 DDSurfAct.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8 ; 527 553 if(!lpDDEnumModesCallback(&DDSurfAct,lpContext)) 528 554 { 555 #ifdef DEBUG 556 WriteLog("EnumDisplayModes : Enum done\n"); 557 #endif 529 558 return (DD_OK); 530 559 } … … 539 568 // if the mode fits in the current resolution report it 540 569 // Change this if we support Fullscreen later !!! 570 541 571 if(ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution) 542 572 { … … 546 576 switch(ModesDive[iMode].iBits) 547 577 { 578 case 8: 579 DDSurfAct.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8; 580 break; 548 581 case 16: 549 582 // VESA uses 565 encoding in 16 bit modes 550 lpDDSurfaceDesc->ddpfPixelFormat.dwRBitMask = 0x0000F800; 551 lpDDSurfaceDesc->ddpfPixelFormat.dwGBitMask = 0x000007E0; 552 lpDDSurfaceDesc->ddpfPixelFormat.dwBBitMask = 0x0000001F; 583 DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8; 584 DDSurfAct.ddpfPixelFormat.dwRBitMask = 0x0000F800; 585 DDSurfAct.ddpfPixelFormat.dwGBitMask = 0x000007E0; 586 DDSurfAct.ddpfPixelFormat.dwBBitMask = 0x0000001F; 553 587 break; 554 588 case 24: 555 589 // VESA uses per default RGB4 556 lpDDSurfaceDesc->ddpfPixelFormat.dwRBitMask = 0x00FF0000; 557 lpDDSurfaceDesc->ddpfPixelFormat.dwGBitMask = 0x0000FF00; 558 lpDDSurfaceDesc->ddpfPixelFormat.dwBBitMask = 0x000000FF; 590 DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8; 591 DDSurfAct.ddpfPixelFormat.dwRBitMask = 0x00FF0000; 592 DDSurfAct.ddpfPixelFormat.dwGBitMask = 0x0000FF00; 593 DDSurfAct.ddpfPixelFormat.dwBBitMask = 0x000000FF; 559 594 break; 560 595 default: 561 596 break; 562 597 } 598 #ifdef DEBUG 599 WriteLog( "EnumDisplayModes : Enum Mode %dx%d @ %d\n", 600 DDSurfAct.dwHeight, 601 DDSurfAct.dwWidth, 602 DDSurfAct.ddpfPixelFormat.dwRGBBitCount); 603 #endif 563 604 fCallAgain = lpDDEnumModesCallback(&DDSurfAct,lpContext); 605 #ifdef DEBUG 606 WriteLog( "EnumDisplayModes : Callback returned with %d\n", 607 fCallAgain); 608 #endif 564 609 } 565 610 iMode++; 566 611 } 567 while((ModesDive[iMode].iBits <= me->dCaps.ulDepth) && 568 (iMode < NUM_MODES_DIVE) && (TRUE==fCallAgain)); 612 while( (iMode < NUM_MODES_DIVE) && 613 (ModesDive[iMode].iBits <= me->dCaps.ulDepth) && 614 (TRUE==fCallAgain) ); 569 615 } 570 616 else … … 596 642 DDSurfAct.dwWidth = ModesDive[0].iXRes; 597 643 DDSurfAct.ddpfPixelFormat.dwRGBBitCount = ModesDive[0].iBits; 644 DDSurfAct.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8; 598 645 if(!lpDDEnumModesCallback(&DDSurfAct,lpContext)) 599 646 { … … 627 674 DDSurfAct.dwWidth = ModesDive[iMode].iXRes; 628 675 DDSurfAct.ddpfPixelFormat.dwRGBBitCount = ModesDive[iMode].iBits; 676 switch(ModesDive[iMode].iBits) 677 { 678 case 8: 679 DDSurfAct.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8; 680 break; 681 case 16: 682 // VESA uses 565 encoding in 16 bit modes 683 DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8; 684 DDSurfAct.ddpfPixelFormat.dwRBitMask = 0x0000F800; 685 DDSurfAct.ddpfPixelFormat.dwGBitMask = 0x000007E0; 686 DDSurfAct.ddpfPixelFormat.dwBBitMask = 0x0000001F; 687 break; 688 case 24: 689 // VESA uses per default RGB4 690 DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8; 691 DDSurfAct.ddpfPixelFormat.dwRBitMask = 0x00FF0000; 692 DDSurfAct.ddpfPixelFormat.dwGBitMask = 0x0000FF00; 693 DDSurfAct.ddpfPixelFormat.dwBBitMask = 0x000000FF; 694 break; 695 default: 696 break; 697 } 629 698 630 699 fCallAgain = lpDDEnumModesCallback(&DDSurfAct,lpContext); … … 674 743 iMode = 2; 675 744 fCallAgain = TRUE; 745 // All reported mode are 16bit 746 DDSurfAct.ddpfPixelFormat.dwRBitMask = 0x0000F800; 747 DDSurfAct.ddpfPixelFormat.dwGBitMask = 0x000007E0; 748 DDSurfAct.ddpfPixelFormat.dwBBitMask = 0x0000001F; 676 749 do 677 750 {
Note:
See TracChangeset
for help on using the changeset viewer.