Ignore:
Timestamp:
Mar 18, 2001, 10:44:46 PM (24 years ago)
Author:
mike
Message:

Merged DDRAW and DDRAW\NEW

File:
1 edited

Legend:

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

    r5291 r5326  
    1 /* $Id: OS2DDRAW.CPP,v 1.25 2001-03-09 22:48:46 mike Exp $ */
     1/* $Id: OS2DDRAW.CPP,v 1.26 2001-03-18 21:44:42 mike Exp $ */
    22
    33/*
    44 * DX Draw base class implementation
    55 *
    6  * Copyright 1998 Sander va Leeuwen
     6 * Copyright 1998 Sander van Leeuwen
    77 * Copyright 1999 Markus Montkowski
     8 * Copyright 2000 Przemyslaw Dobrowolski
     9 * Copyright 2001 Michal Necasek
    810 *
    911 * Project Odin Software License can be found in LICENSE.TXT
     
    2729#include <winuser.h>
    2830#include <winerror.h>
     31#include <options.h>
    2932#include "cio2.h"
    3033#include "os2util.h"
     34#include "os2fsdd.h"
    3135// include with the videomodes we support
    3236// better would be to get these modes from the card
     
    3842#define KEY_DIRECT2 "\\Software\\Win32OS2\\Direct2"
    3943#define KEY_DIRECT2DRAW "\\Software\\Win32OS2\\Direct2\\Draw"
     44
     45
     46BOOL bUseFSDD = FALSE;
    4047
    4148FOURCC  SupportedFourCCs[] = {FOURCC_SCRN,FOURCC_LUT8,FOURCC_R565,FOURCC_RGB3,FOURCC_RGB4};
     
    216223  if(rc)  // try to get IOPL for the thread
    217224  {
    218     dprintf(("DDRAW: No IOPL\n"));
     225    dprintf(("DDRAW: No IOPL"));
    219226  }
    220227  else
    221228  {
    222     dprintf(("DDRAW: IOPL 3!\n"));
    223   }
     229    dprintf(("DDRAW: IOPL 3!"));
     230  }
     231
     232
     233        // Check to see if FS DDraw is enabled in ODIN.INI
     234        if (PROFILE_GetOdinIniBool(ODINDDRAW_SECTION, "Fullscreen", FALSE)) {
     235                rc = LoadPMIService();
     236                dprintf(("DDRAW: LoadPMIService() rc=0x%08X",rc));
     237               
     238                if (!rc) {
     239                        SetUpModeTable();
     240                       
     241                        bUseFSDD = TRUE;
     242                        dprintf(("DDRAW: Fullscreen enabled",rc));
     243                }       
     244        }       
    224245}
    225246//******************************************************************************
     
    227248OS2IDirectDraw::~OS2IDirectDraw()
    228249{
    229   dprintf(("DDRAW: OS2IDirectDraw::~OS2IDirectDraw()\n"));
    230   if(hDive)
     250  dprintf(("DDRAW: OS2IDirectDraw::~OS2IDirectDraw()"));
     251
     252  if (hDive)
    231253    DiveClose(hDive);
    232254
    233   // Safty call in case the program did set the pal to all black
     255  // Safety call in case the program did set the pal to all black
    234256  // so if the destructor gets called we might be able change this back
    235257  OS2ResetPhysPalette();
     258
     259  // FSDDRAW additions
     260  // we need this in Full Screen, but don't do anything in windowed
     261  // session.
     262  if (bUseFSDD) {
     263    RestorePM();
     264    FreeModeTable();
     265  }
    236266}
    237267//******************************************************************************
     
    273303    if(IsEqualGUID(riid, IID_IDirectDraw4))
    274304    {
    275       dprintf(("DDRAW: IID_IDirectDraw4 Interface\n"));
     305      dprintf(("DDRAW: IID_IDirectDraw4 Interface"));
    276306      me->lpVtbl = &me->Vtbl4;
    277307    }
     
    280310      if(IsEqualGUID(riid, IID_IDirectDraw2))
    281311      {
    282         dprintf(("DDRAW: IID_IDirectDraw2 Interface\n"));
     312        dprintf(("DDRAW: IID_IDirectDraw2 Interface"));
    283313        me->lpVtbl = (IDirectDraw4Vtbl *) &me->Vtbl2;
    284314      }
    285315      else
    286316      {
    287         dprintf(("DDRAW: IID_IDirectDraw Interface\n"));
     317        dprintf(("DDRAW: IID_IDirectDraw Interface"));
    288318        me->lpVtbl = (IDirectDraw4Vtbl *) &me->Vtbl;
    289319      }
     
    302332 OS2IDirectDraw *me = (OS2IDirectDraw *)This;
    303333
    304   dprintf(("DDRAW: OS2IDirectDraw::AddRef %d\n", me->Referenced+1));
     334  dprintf(("DDRAW: OS2IDirectDraw::AddRef %d", me->Referenced+1));
    305335
    306336  return ++me->Referenced;
     
    313343 ULONG rc;
    314344
    315   dprintf(("DDRAW: OS2IDirectDraw::Release %d\n", me->Referenced-1));
    316   dprintf(("DDRAW: OS2IDirectDraw::%X \n", me));
     345  dprintf(("DDRAW: OS2IDirectDraw::Release %d", me->Referenced-1));
     346  dprintf(("DDRAW: OS2IDirectDraw::%X", me));
    317347
    318348  if(me->Referenced)
     
    337367HRESULT WIN32API DrawCompact(THIS)
    338368{
    339   dprintf(("DDRAW: Compact\n"));
     369  dprintf(("DDRAW: Compact"));
    340370
    341371  return(DD_OK);
     
    351381  newclip = new OS2IDirectDrawClipper(me);
    352382
    353   dprintf(("DDRAW: CreateClipper\n"));
     383  dprintf(("DDRAW: CreateClipper"));
    354384
    355385  if(newclip == NULL)
     
    405435  if(DD_OK == rc)
    406436  {
    407     dprintf(("DDRAW: CreatePalette with %d colors\n", palsize));
     437    dprintf(("DDRAW: CreatePalette with %d colors", palsize));
    408438
    409439    newpal = new OS2IDirectDrawPalette((VOID*)me, palsize, lpColorTable, dwFlags);
     
    10241054  {
    10251055    // Caller wants HEL Caps
    1026     dprintf(("DDRAW:  HEL\n"));
     1056    dprintf(("DDRAW: CHEL\n"));
    10271057
    10281058    //SvL: PowerDVD uses size 316
     
    14851515//******************************************************************************
    14861516//******************************************************************************
    1487 HRESULT WIN32API DrawRestoreDisplayMode(THIS)
    1488 {
    1489   dprintf(("DDRAW: RestoreDisplayMod\n"));
     1517HRESULT WIN32API DrawRestoreDisplayMode(THIS This)
     1518{
     1519  OS2IDirectDraw        *me = (OS2IDirectDraw *)This;
     1520
     1521  dprintf(("DDRAW: RestoreDisplayMode"));
     1522
     1523  // FSDDRAW additions
     1524  ULONG  ulModeInd;
     1525  /* restore previous screen mode */
     1526  if ((bUseFSDD) && (me->bInFullScreen))
     1527  {
     1528    SetSVGAMode(me->oldwidth, me->oldheight, me->oldbpp, 0xFF, &ulModeInd, NULL);
     1529    RestorePM();
     1530    /* restore DIVE caps entries */
     1531    me->dCaps.ulScanLineBytes        = me->oldscanlines;
     1532    me->dCaps.ulHorizontalResolution = me->oldwidth;
     1533    me->dCaps.ulVerticalResolution   = me->oldheight;
     1534    me->dCaps.ulDepth                = me->oldbpp;
     1535  }
    14901536
    14911537  return(DD_OK);
     
    15301576  if(me->dwCoopMode & DDSCL_FULLSCREEN)
    15311577  {
     1578    // FSDDRAW additions
     1579    ULONG  ulModeInd;
     1580
    15321581    SetWindowPos(me->hwndClient, HWND_TOP,0,0,dwWidth,dwHeight,0);
     1582    SetCursorPos(dwWidth / 2, dwHeight / 2);
     1583
     1584    if ((bUseFSDD) && (ModeInSVGAModeTable(dwWidth,dwHeight,dwBPP)))
     1585    {
     1586      KillPM();
     1587
     1588      rc = SetSVGAMode(dwWidth, dwHeight, dwBPP, 0xFF, &ulModeInd, NULL);
     1589
     1590      if (!rc) // When mode switched successfully
     1591      {
     1592        /* save old screen values */
     1593        me->bInFullScreen=TRUE;
     1594        me->oldwidth     = me->dCaps.ulHorizontalResolution;
     1595        me->oldheight    = me->dCaps.ulVerticalResolution;
     1596        me->oldscanlines = me->dCaps.ulScanLineBytes;
     1597        me->oldbpp       = me->dCaps.ulDepth;
     1598
     1599        /* now 'fix' some DIVE caps entries */
     1600        me->dCaps.ulScanLineBytes        = dwWidth * (dwBPP >> 3); /* FIX: use real value */
     1601        me->dCaps.ulHorizontalResolution = dwWidth;
     1602        me->dCaps.ulVerticalResolution   = dwHeight;
     1603        me->dCaps.ulDepth                = dwBPP;
     1604      }
     1605      else
     1606      // Display must be return to PM Session
     1607      RestorePM();
     1608    }
    15331609  }
    15341610
     
    15721648  if(me->dwCoopMode & DDSCL_FULLSCREEN)
    15731649  {
     1650    // FSDDRAW additions
     1651    ULONG  ulModeInd;
     1652
    15741653    SetWindowPos(me->hwndClient, HWND_TOP,0,0,dwWidth,dwHeight,0);
     1654    SetCursorPos(dwWidth / 2, dwHeight / 2);
     1655
     1656    if ((bUseFSDD) && (ModeInSVGAModeTable(dwWidth,dwHeight,dwBPP)))
     1657    {
     1658      KillPM();
     1659
     1660      rc = SetSVGAMode(dwWidth, dwHeight, dwBPP, 0xFF, &ulModeInd, NULL);
     1661
     1662      if (!rc) // When mode switched successfully
     1663      {
     1664        /* save old screen values */
     1665        me->bInFullScreen=TRUE;
     1666        me->oldwidth     = me->dCaps.ulHorizontalResolution;
     1667        me->oldheight    = me->dCaps.ulVerticalResolution;
     1668        me->oldscanlines = me->dCaps.ulScanLineBytes;
     1669        me->oldbpp       = me->dCaps.ulDepth;
     1670
     1671        /* now 'fix' some DIVE caps entries */
     1672        me->dCaps.ulScanLineBytes        = dwWidth * (dwBPP >> 3); /* FIX: use real value */
     1673        me->dCaps.ulHorizontalResolution = dwWidth;
     1674        me->dCaps.ulVerticalResolution   = dwHeight;
     1675        me->dCaps.ulDepth                = dwBPP;
     1676      }
     1677      else
     1678      // Display must be return to PM Session
     1679      RestorePM();
     1680    }
    15751681  }
    15761682
Note: See TracChangeset for help on using the changeset viewer.