Changeset 8989 for trunk/src


Ignore:
Timestamp:
Aug 12, 2002, 5:06:21 PM (23 years ago)
Author:
sandervl
Message:

SetCustomFullScreenMode added + many fixes/changes

Location:
trunk/src/ddraw
Files:
2 edited

Legend:

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

    r8604 r8989  
    1 /* $Id: OS2DDRAW.CPP,v 1.35 2002-06-08 13:12:33 sandervl Exp $ */
     1/* $Id: OS2DDRAW.CPP,v 1.36 2002-08-12 15:06:21 sandervl Exp $ */
    22
    33/*
     
    4747
    4848BOOL bUseFSDD = FALSE;
     49BOOL fNoFSDD = FALSE;
    4950
    5051FOURCC SupportedFourCCs[]   = {FOURCC_SCRN,FOURCC_LUT8,FOURCC_R565,FOURCC_RGB3,FOURCC_RGB4};
     
    5455FOURCC DiveFOURCCs[MAX_DIVE_FOURCC] = {0};
    5556
     57//******************************************************************************
     58//Force DirectDraw to report only one fullscreen mode (useful for custom builds)
     59//******************************************************************************
     60void WIN32API SetCustomFullScreenMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP)
     61{
     62    NUM_MODES_DIVE = 1;
     63
     64    dprintf(("SetCustomFullScreenMode (%d,%d) bpp %d", dwWidth, dwHeight, dwBPP));
     65    ModesDive[0].iXRes  = dwWidth;
     66    ModesDive[0].iYRes  = dwHeight;
     67    ModesDive[0].iBits  = dwBPP;
     68    ModesDive[0].iRatio = 0;
     69    fNoFSDD = TRUE;
     70}
    5671//******************************************************************************
    5772//******************************************************************************
     
    238253
    239254  // Check to see if FS DDraw is enabled in ODIN.INI
    240   if (PROFILE_GetOdinIniBool(ODINDDRAW_SECTION, "Fullscreen", FALSE))
     255  if (!fNoFSDD && PROFILE_GetOdinIniBool(ODINDDRAW_SECTION, "Fullscreen", FALSE))
    241256  {
    242257      rc = InitIO();
     
    642657      dprintf(("DDRAW: EnumDisplayModes : ALL modes\n"));
    643658
    644       if(dwFlags && DDEDM_STANDARDVGAMODES)
     659      //SvL: Don't report 320x200 if we've been told to report only one
     660      //     display mode
     661      if(NUM_MODES_DIVE != 1 && (dwFlags & DDEDM_STANDARDVGAMODES))
    645662      {
    646663        dprintf(("DDRAW: EnumDisplayModes : STANDARDVGAMODES\n"));
     
    659676
    660677      // Now report all our modes
    661       iMode = 2;
     678      iMode = min(2, NUM_MODES_DIVE-1);
    662679      fCallAgain = TRUE;
    663680      do
     
    666683        // Change this if we support Fullscreen later !!!
    667684
    668         if(ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)
     685        if(ModesDive[iMode].iXRes <= me->dCaps.ulHorizontalResolution)
    669686        {
    670687          DDSurfAct.dwHeight = ModesDive[iMode].iYRes;
     
    684701              break;
    685702            case 24:
     703            case 32:
    686704              // VESA uses per default RGB4
    687705              DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8;
     
    718736
    719737      iMode = 0;
    720       if( (dwFlags && DDEDM_STANDARDVGAMODES) &&
     738      if( (dwFlags & DDEDM_STANDARDVGAMODES) &&
    721739         (
    722740          (((lpDDSurfaceDesc->dwFlags & DDSD_WIDTH)&&
     
    744762
    745763      // Now report all our modes
    746       iMode = 2;
     764      iMode = min(2, NUM_MODES_DIVE-1);
    747765      fCallAgain = TRUE;
    748766      do
     
    750768        // if the mode fits in the current resolution and the filter applies report it
    751769        // Change this if we support Fullscreen later !!!
    752         if( (ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)&&
     770        if( (ModesDive[iMode].iXRes <= me->dCaps.ulHorizontalResolution)&&
    753771           (
    754772            (((lpDDSurfaceDesc->dwFlags & DDSD_WIDTH)&&
     
    780798              break;
    781799            case 24:
     800            case 32:
    782801              // VESA uses per default RGB4
    783802              DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8;
     
    917936      dprintf(("DDRAW: EnumDisplayModes : ALL modes\n"));
    918937
    919       if(dwFlags && DDEDM_STANDARDVGAMODES)
     938      //SvL: Don't report 320x200 if we've been told to report only one
     939      //     display mode
     940      if(NUM_MODES_DIVE != 1 && (dwFlags & DDEDM_STANDARDVGAMODES))
    920941      {
    921942        dprintf(("DDRAW: EnumDisplayModes : STANDARDVGAMODES\n"));
     
    934955
    935956      // Now report all our modes
    936       iMode = 2;
     957      iMode = min(2, NUM_MODES_DIVE-1);
    937958      fCallAgain = TRUE;
    938959      do
     
    941962        // Change this if we support Fullscreen later !!!
    942963
    943         if(ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)
     964        if(ModesDive[iMode].iXRes <= me->dCaps.ulHorizontalResolution)
    944965        {
    945966          DDSurfAct.dwHeight = ModesDive[iMode].iYRes;
     
    959980              break;
    960981            case 24:
     982            case 32:
    961983              // VESA uses per default RGB4
    962984              DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8;
     
    9931015
    9941016      iMode = 0;
    995       if( (dwFlags && DDEDM_STANDARDVGAMODES) &&
     1017      if( (dwFlags & DDEDM_STANDARDVGAMODES) &&
    9961018         (
    9971019          (((lpDDSurfaceDesc2->dwFlags & DDSD_WIDTH)&&
     
    10191041
    10201042      // Now report all our modes
    1021       iMode = 2;
     1043      iMode = min(2, NUM_MODES_DIVE-1);
    10221044      fCallAgain = TRUE;
    10231045      do
     
    10251047        // if the mode fits in the current resolution and the filter applies report it
    10261048        // Change this if we support Fullscreen later !!!
    1027         if( (ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)&&
     1049        if( (ModesDive[iMode].iXRes <= me->dCaps.ulHorizontalResolution)&&
    10281050           (
    10291051            (((lpDDSurfaceDesc2->dwFlags & DDSD_WIDTH)&&
     
    10551077              break;
    10561078            case 24:
     1079            case 32:
    10571080              // VESA uses per default RGB4
    10581081              DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8;
     
    18401863HRESULT WIN32API DrawSetCooperativeLevel(THIS This, HWND hwndClient, DWORD dwFlags)
    18411864{
    1842  OS2IDirectDraw        *me = (OS2IDirectDraw *)This;
    1843 
    1844   dprintf(("DDRAW: SetCooperativeLevel: hwnd %X, Flags %X\n", hwndClient, dwFlags));
    1845   me->dwCoopMode = dwFlags;
    1846   if(!(DDSCL_NORMAL & dwFlags))
    1847   {
    1848     // client window req. for all none DDSCL_NORMAL modes
    1849     if(NULL==hwndClient)
    1850       return(DDERR_INVALIDPARAMS);
    1851   }
    1852   me->hwndClient = hwndClient;
    1853   #if 0
    1854     OS2DDSubclassWindow(hwndClient);
    1855   #endif
    1856   return(DD_OK);
     1865    OS2IDirectDraw *me = (OS2IDirectDraw *)This;
     1866
     1867    dprintf(("DDRAW: SetCooperativeLevel: hwnd %X, Flags %X\n", hwndClient, dwFlags));
     1868
     1869    if (!(dwFlags & (DDSCL_EXCLUSIVE|DDSCL_NORMAL)))
     1870        return DDERR_INVALIDPARAMS;
     1871
     1872    me->dwCoopMode = dwFlags;
     1873
     1874    if(dwFlags & DDSCL_NORMAL) {
     1875        //normal mode, no window required
     1876        if(dwFlags & DDSCL_FULLSCREEN)    return DDERR_INVALIDPARAMS;
     1877    }
     1878    else {
     1879        //fullscreen mode, window required
     1880        if(!hwndClient)                   return DDERR_INVALIDPARAMS;
     1881        if(!(dwFlags & DDSCL_FULLSCREEN)) return DDERR_INVALIDPARAMS;
     1882    }
     1883    me->hwndClient = hwndClient;
     1884    if(hwndClient) {
     1885        //TODO: Can this be done here??
     1886        SetWindowPos(me->hwndClient, HWND_TOP, 0, 0, me->screenwidth, me->screenheight,0);
     1887        ShowWindow(hwndClient, SW_SHOW);
     1888    }
     1889    return(DD_OK);
    18571890}
    18581891//******************************************************************************
     
    18601893//******************************************************************************
    18611894HRESULT WIN32API DrawSetDisplayMode2(THIS This, DWORD dwWidth, DWORD dwHeight,
    1862               DWORD dwBPP, DWORD dwRefreshRate,
    1863               DWORD dwFlags)
     1895                                     DWORD dwBPP, DWORD dwRefreshRate,
     1896                                     DWORD dwFlags)
    18641897{
    18651898 ULONG rc;
     
    19331966//******************************************************************************
    19341967HRESULT WIN32API DrawSetDisplayMode(THIS This, DWORD dwWidth, DWORD dwHeight,
    1935              DWORD dwBPP)
    1936 {
    1937  ULONG rc;
    1938  OS2IDirectDraw        *me = (OS2IDirectDraw *)This;
    1939  SETUP_BLITTER sBlt;
    1940 
    1941   dprintf(("DDRAW: SetDisplayMode to %dx%d with %d bits colors\n", dwWidth, dwHeight, dwBPP));
    1942 
    1943   me->screenwidth  = dwWidth;
    1944   me->screenheight = dwHeight;
    1945   me->screenbpp    = dwBPP;
    1946 
    1947   if(me->dwCoopMode & DDSCL_FULLSCREEN)
    1948   {
    1949     // FSDDRAW additions
    1950     ULONG  ulModeInd;
    1951 
    1952     SetWindowPos(me->hwndClient, HWND_TOP,0,0,dwWidth,dwHeight,0);
    1953     SetCursorPos(dwWidth / 2, dwHeight / 2);
    1954 
    1955     if ((bUseFSDD) && (ModeInSVGAModeTable(dwWidth,dwHeight,dwBPP)))
    1956     {
    1957       KillPM();
    1958 
    1959       rc = SetSVGAMode(dwWidth, dwHeight, dwBPP, 0xFF, &ulModeInd, NULL);
    1960 
    1961       if (!rc) // When mode switched successfully
    1962       {
    1963         /* save old screen values */
    1964         me->bInFullScreen=TRUE;
    1965         me->oldwidth     = me->dCaps.ulHorizontalResolution;
    1966         me->oldheight    = me->dCaps.ulVerticalResolution;
    1967         me->oldscanlines = me->dCaps.ulScanLineBytes;
    1968         me->oldbpp       = me->dCaps.ulDepth;
    1969 
    1970         /* now 'fix' some DIVE caps entries */
    1971         me->dCaps.ulScanLineBytes        = dwWidth * (dwBPP >> 3); /* FIX: use real value */
    1972         me->dCaps.ulHorizontalResolution = dwWidth;
    1973         me->dCaps.ulVerticalResolution   = dwHeight;
    1974         me->dCaps.ulDepth                = dwBPP;
    1975       }
    1976       else
    1977       // Display must be return to PM Session
    1978       RestorePM();
    1979     }
    1980   }
    1981 
    1982   memset(&sBlt,0,sizeof(sBlt));
    1983   sBlt.ulStructLen = sizeof(sBlt);
    1984   sBlt.fccSrcColorFormat = FOURCC_SCRN;
    1985   sBlt.ulSrcWidth        = dwWidth;
    1986   sBlt.ulSrcHeight       = dwHeight;
    1987   sBlt.ulSrcPosX         = 0;
    1988   sBlt.ulSrcPosY         = 0;
    1989   sBlt.fccDstColorFormat = FOURCC_SCRN;
    1990   sBlt.ulDstWidth        = dwWidth;
    1991   sBlt.ulDstHeight       = dwHeight;
    1992   sBlt.lDstPosX          = 0;
    1993   sBlt.lDstPosY          = 0;
    1994   sBlt.lScreenPosX       = 0;
    1995   sBlt.lScreenPosY       = me->dCaps.ulVerticalResolution-dwHeight;
    1996   sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
    1997 
    1998   rc = DiveSetupBlitter( me->hDive,
    1999                          &sBlt);
    2000   dprintf(("       DiveSetupBlitter rc=%d",rc));
    2001 
    2002   return(DD_OK);
     1968                                    DWORD dwBPP)
     1969{
     1970    return DrawSetDisplayMode2(This, dwWidth, dwHeight, dwBPP, 70, 0);
    20031971}
    20041972//******************************************************************************
  • trunk/src/ddraw/os2ddrawmodes.h

    r5326 r8989  
    1 /* $Id: os2ddrawmodes.h,v 1.4 2001-03-18 21:44:46 mike Exp $ */
     1/* $Id: os2ddrawmodes.h,v 1.5 2002-08-12 15:06:21 sandervl Exp $ */
    22
    33/*
     
    2222} OS2_DXMODES, *POS2_DXMODES;
    2323
    24 #define NUM_MODES_DIVE 30
    25 OS2_DXMODES ModesDive[NUM_MODES_DIVE] =
     24#define MAX_NUM_MODES_DIVE 30
     25
     26int NUM_MODES_DIVE = MAX_NUM_MODES_DIVE;
     27OS2_DXMODES ModesDive[MAX_NUM_MODES_DIVE] =
    2628{
    2729  {320,200,8,1},
Note: See TracChangeset for help on using the changeset viewer.