- Timestamp:
- Aug 12, 2002, 5:06:21 PM (23 years ago)
- Location:
- trunk/src/ddraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2DDRAW.CPP
r8604 r8989 1 /* $Id: OS2DDRAW.CPP,v 1.3 5 2002-06-08 13:12:33sandervl Exp $ */1 /* $Id: OS2DDRAW.CPP,v 1.36 2002-08-12 15:06:21 sandervl Exp $ */ 2 2 3 3 /* … … 47 47 48 48 BOOL bUseFSDD = FALSE; 49 BOOL fNoFSDD = FALSE; 49 50 50 51 FOURCC SupportedFourCCs[] = {FOURCC_SCRN,FOURCC_LUT8,FOURCC_R565,FOURCC_RGB3,FOURCC_RGB4}; … … 54 55 FOURCC DiveFOURCCs[MAX_DIVE_FOURCC] = {0}; 55 56 57 //****************************************************************************** 58 //Force DirectDraw to report only one fullscreen mode (useful for custom builds) 59 //****************************************************************************** 60 void 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 } 56 71 //****************************************************************************** 57 72 //****************************************************************************** … … 238 253 239 254 // 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)) 241 256 { 242 257 rc = InitIO(); … … 642 657 dprintf(("DDRAW: EnumDisplayModes : ALL modes\n")); 643 658 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)) 645 662 { 646 663 dprintf(("DDRAW: EnumDisplayModes : STANDARDVGAMODES\n")); … … 659 676 660 677 // Now report all our modes 661 iMode = 2;678 iMode = min(2, NUM_MODES_DIVE-1); 662 679 fCallAgain = TRUE; 663 680 do … … 666 683 // Change this if we support Fullscreen later !!! 667 684 668 if(ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)685 if(ModesDive[iMode].iXRes <= me->dCaps.ulHorizontalResolution) 669 686 { 670 687 DDSurfAct.dwHeight = ModesDive[iMode].iYRes; … … 684 701 break; 685 702 case 24: 703 case 32: 686 704 // VESA uses per default RGB4 687 705 DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8; … … 718 736 719 737 iMode = 0; 720 if( (dwFlags & &DDEDM_STANDARDVGAMODES) &&738 if( (dwFlags & DDEDM_STANDARDVGAMODES) && 721 739 ( 722 740 (((lpDDSurfaceDesc->dwFlags & DDSD_WIDTH)&& … … 744 762 745 763 // Now report all our modes 746 iMode = 2;764 iMode = min(2, NUM_MODES_DIVE-1); 747 765 fCallAgain = TRUE; 748 766 do … … 750 768 // if the mode fits in the current resolution and the filter applies report it 751 769 // Change this if we support Fullscreen later !!! 752 if( (ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)&&770 if( (ModesDive[iMode].iXRes <= me->dCaps.ulHorizontalResolution)&& 753 771 ( 754 772 (((lpDDSurfaceDesc->dwFlags & DDSD_WIDTH)&& … … 780 798 break; 781 799 case 24: 800 case 32: 782 801 // VESA uses per default RGB4 783 802 DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8; … … 917 936 dprintf(("DDRAW: EnumDisplayModes : ALL modes\n")); 918 937 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)) 920 941 { 921 942 dprintf(("DDRAW: EnumDisplayModes : STANDARDVGAMODES\n")); … … 934 955 935 956 // Now report all our modes 936 iMode = 2;957 iMode = min(2, NUM_MODES_DIVE-1); 937 958 fCallAgain = TRUE; 938 959 do … … 941 962 // Change this if we support Fullscreen later !!! 942 963 943 if(ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)964 if(ModesDive[iMode].iXRes <= me->dCaps.ulHorizontalResolution) 944 965 { 945 966 DDSurfAct.dwHeight = ModesDive[iMode].iYRes; … … 959 980 break; 960 981 case 24: 982 case 32: 961 983 // VESA uses per default RGB4 962 984 DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8; … … 993 1015 994 1016 iMode = 0; 995 if( (dwFlags & &DDEDM_STANDARDVGAMODES) &&1017 if( (dwFlags & DDEDM_STANDARDVGAMODES) && 996 1018 ( 997 1019 (((lpDDSurfaceDesc2->dwFlags & DDSD_WIDTH)&& … … 1019 1041 1020 1042 // Now report all our modes 1021 iMode = 2;1043 iMode = min(2, NUM_MODES_DIVE-1); 1022 1044 fCallAgain = TRUE; 1023 1045 do … … 1025 1047 // if the mode fits in the current resolution and the filter applies report it 1026 1048 // Change this if we support Fullscreen later !!! 1027 if( (ModesDive[iMode].iXRes < me->dCaps.ulHorizontalResolution)&&1049 if( (ModesDive[iMode].iXRes <= me->dCaps.ulHorizontalResolution)&& 1028 1050 ( 1029 1051 (((lpDDSurfaceDesc2->dwFlags & DDSD_WIDTH)&& … … 1055 1077 break; 1056 1078 case 24: 1079 case 32: 1057 1080 // VESA uses per default RGB4 1058 1081 DDSurfAct.ddpfPixelFormat.dwFlags &= ~DDPF_PALETTEINDEXED8; … … 1840 1863 HRESULT WIN32API DrawSetCooperativeLevel(THIS This, HWND hwndClient, DWORD dwFlags) 1841 1864 { 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); 1857 1890 } 1858 1891 //****************************************************************************** … … 1860 1893 //****************************************************************************** 1861 1894 HRESULT WIN32API DrawSetDisplayMode2(THIS This, DWORD dwWidth, DWORD dwHeight, 1862 DWORD dwBPP, DWORD dwRefreshRate,1863 DWORD dwFlags)1895 DWORD dwBPP, DWORD dwRefreshRate, 1896 DWORD dwFlags) 1864 1897 { 1865 1898 ULONG rc; … … 1933 1966 //****************************************************************************** 1934 1967 HRESULT 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); 2003 1971 } 2004 1972 //****************************************************************************** -
trunk/src/ddraw/os2ddrawmodes.h
r5326 r8989 1 /* $Id: os2ddrawmodes.h,v 1. 4 2001-03-18 21:44:46 mikeExp $ */1 /* $Id: os2ddrawmodes.h,v 1.5 2002-08-12 15:06:21 sandervl Exp $ */ 2 2 3 3 /* … … 22 22 } OS2_DXMODES, *POS2_DXMODES; 23 23 24 #define NUM_MODES_DIVE 30 25 OS2_DXMODES ModesDive[NUM_MODES_DIVE] = 24 #define MAX_NUM_MODES_DIVE 30 25 26 int NUM_MODES_DIVE = MAX_NUM_MODES_DIVE; 27 OS2_DXMODES ModesDive[MAX_NUM_MODES_DIVE] = 26 28 { 27 29 {320,200,8,1},
Note:
See TracChangeset
for help on using the changeset viewer.