Changeset 913 for trunk/src


Ignore:
Timestamp:
Sep 12, 1999, 11:37:37 PM (26 years ago)
Author:
hugh
Message:

Changess in basic implementation of the IDrectDraw class
MS does assume 2 Vtables at the end and MS tools seam to use internal
knownledge of the implmentation. DDCAPS is one butn thsi does work/start now.

Location:
trunk/src/ddraw
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ddraw/OS2DDRAW.CPP

    r850 r913  
     1#include <stdlib.h>
     2#include <string.h>
    13#include <memory.h>
    24
     
    129131  }
    130132
     133  lpVtbl2 = lpVtbl;
     134
     135  pdwUnknownData = (DWORD*) malloc (255*sizeof(DWORD));
     136  for(int i= 0 ;i<255;i++)
     137    pdwUnknownData[i] = 0;
     138
    131139  rc = DiveOpen( &hDive,
    132140                 FALSE,
     
    154162  WriteLog("DiveQueryCaps rc=0x%08X\n",rc);
    155163
     164  pdwUnknownData[235] = dCaps.ulHorizontalResolution;
     165  pdwUnknownData[236] = dCaps.ulVerticalResolution;
     166  pdwUnknownData[241] = dCaps.ulDepth;
    156167
    157168  // Shall we run in FS mode ?
     
    477488//******************************************************************************
    478489//******************************************************************************
    479 HRESULT __stdcall DrawEnumDisplayModes(THIS This, DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc,
    480                                        LPVOID lpContext, LPDDENUMMODESCALLBACK lpDDEnumModesCallback)
     490HRESULT __stdcall DrawEnumDisplayModes( THIS This,
     491                                        DWORD dwFlags,
     492                                        LPDDSURFACEDESC lpDDSurfaceDesc,
     493                                        LPVOID lpContext,
     494                                        LPDDENUMMODESCALLBACK lpDDEnumModesCallback)
    481495{
    482496  int iMode = 0;
     
    515529    // DIVE modes
    516530
     531    #ifdef DEBUG
     532      WriteLog("EnumDisplayModes : DIVE modes\n");
     533    #endif
     534
    517535    // Enumerate all modes ?
    518536    if (NULL==lpDDSurfaceDesc)
     
    520538      // Check if we shall report 320x200 mode
    521539
     540      #ifdef DEBUG
     541        WriteLog("EnumDisplayModes : ALL modes\n");
     542      #endif
     543
    522544      if(dwFlags && DDEDM_STANDARDVGAMODES)
    523545      {
     546        #ifdef DEBUG
     547          WriteLog("EnumDisplayModes : STANDARDVGAMODES\n");
     548        #endif
    524549        DDSurfAct.dwHeight = ModesDive[0].iYRes;
    525550        DDSurfAct.dwWidth  = ModesDive[0].iXRes;
    526551        DDSurfAct.ddpfPixelFormat.dwRGBBitCount = ModesDive[0].iBits;
     552        DDSurfAct.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8 ;
    527553        if(!lpDDEnumModesCallback(&DDSurfAct,lpContext))
    528554        {
     555          #ifdef DEBUG
     556            WriteLog("EnumDisplayModes : Enum done\n");
     557          #endif
    529558          return (DD_OK);
    530559        }
     
    539568        // if the mode fits in the current resolution report it
    540569        // Change this if we support Fullscreen later !!!
     570
    541571        if(ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)
    542572        {
     
    546576          switch(ModesDive[iMode].iBits)
    547577          {
     578            case 8:
     579              DDSurfAct.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8;
     580              break;
    548581            case 16:
    549582              // 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;
    553587              break;
    554588            case 24:
    555589              // 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;
    559594              break;
    560595            default:
    561596              break;
    562597          }
     598          #ifdef DEBUG
     599            WriteLog( "EnumDisplayModes : Enum Mode %dx%d @ %d\n",
     600                      DDSurfAct.dwHeight,
     601                      DDSurfAct.dwWidth,
     602                      DDSurfAct.ddpfPixelFormat.dwRGBBitCount);
     603          #endif
    563604          fCallAgain = lpDDEnumModesCallback(&DDSurfAct,lpContext);
     605          #ifdef DEBUG
     606            WriteLog( "EnumDisplayModes : Callback returned with %d\n",
     607                      fCallAgain);
     608          #endif
    564609        }
    565610        iMode++;
    566611      }
    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) );
    569615    }
    570616    else
     
    596642        DDSurfAct.dwWidth  = ModesDive[0].iXRes;
    597643        DDSurfAct.ddpfPixelFormat.dwRGBBitCount = ModesDive[0].iBits;
     644        DDSurfAct.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8;
    598645        if(!lpDDEnumModesCallback(&DDSurfAct,lpContext))
    599646        {
     
    627674          DDSurfAct.dwWidth  = ModesDive[iMode].iXRes;
    628675          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          }
    629698
    630699          fCallAgain = lpDDEnumModesCallback(&DDSurfAct,lpContext);
     
    674743      iMode = 2;
    675744      fCallAgain = TRUE;
     745      // All reported mode are 16bit
     746      DDSurfAct.ddpfPixelFormat.dwRBitMask = 0x0000F800;
     747      DDSurfAct.ddpfPixelFormat.dwGBitMask = 0x000007E0;
     748      DDSurfAct.ddpfPixelFormat.dwBBitMask = 0x0000001F;
    676749      do
    677750      {
  • trunk/src/ddraw/OS2DDRAW.H

    r587 r913  
    1919    //this one has to go first!
    2020    IDirectDraw4Vtbl *lpVtbl;
     21    IDirectDraw4Vtbl *lpVtbl2;         // 2nd Vtable pointer An other MS assumtion see below
     22    DWORD            *pdwUnknownData;  // MS DDCAPS (DX6 SDK bin\tools )program makes an assumtion that after the
     23                                       // VTable comes a pointer to some data
     24                                       // to avoid crashes we do it a favor and alloc a buffer
     25                                       // with 255 DWORDS
     26                                       // Known data in the buffer Height(offset 235),
     27                                       // Height (236),  Bits (241)
     28                                       // ToDO :
     29                                       // debug into DirectDrawCreate and se what MS is doing !
    2130    IDirectDraw2Vtbl  Vtbl;
    2231    // MS did it again with direct/X 6 they changed the behavior of the directdraw component
  • trunk/src/ddraw/OS2SURFACE.CPP

    r850 r913  
    44964496                BitmapInfo.bmiHead.biBitCount,
    44974497                GetLastError());
    4498       /*
    4499       rc = GetDIBits(hdc, me->hbmImage, 0, me->DDSurfaceDesc.dwHeight,
    4500                 me->DDSurfaceDesc.lpSurface,(PBITMAPINFO)&BitmapInfo,DIB_PAL_COLORS);
     4498      rc = GetDIBits( hdc,
     4499                      me->hbmImage, 0,
     4500                      me->DDSurfaceDesc.dwHeight,
     4501                      me->DDSurfaceDesc.lpSurface,
     4502                      (PBITMAPINFO)&BitmapInfo,
     4503                      DIB_PAL_COLORS);
    45014504      WriteLog( "GetDIBits rc=%d\n LastEror = %d\n",
    45024505                rc,
    45034506                GetLastError());
    4504       */
    45054507      break;
    45064508    case 16:
Note: See TracChangeset for help on using the changeset viewer.