| Index: ddraw/glDirectDraw.cpp |
| — | — | @@ -1744,6 +1744,16 @@ |
| 1745 | 1745 | return newmode;
|
| 1746 | 1746 | }
|
| 1747 | 1747 |
|
| | 1748 | +int IsStretchedMode(DWORD width, DWORD height)
|
| | 1749 | +{
|
| | 1750 | + if ((width == 320) || (width == 360))
|
| | 1751 | + {
|
| | 1752 | + if ((height == 400) || (height == 480)) return 1;
|
| | 1753 | + }
|
| | 1754 | + else if ((width == 640) && (height == 200)) return 2;
|
| | 1755 | + else return 0;
|
| | 1756 | +}
|
| | 1757 | +
|
| 1748 | 1758 | HRESULT WINAPI glDirectDraw7::SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
|
| 1749 | 1759 | {
|
| 1750 | 1760 | TRACE_ENTER(6,14,this,8,dwWidth,8,dwHeight,8,dwBPP,8,dwRefreshRate,9,dwFlags);
|
| — | — | @@ -1765,6 +1775,7 @@ |
| 1766 | 1776 | float aspect,xmul,ymul,xscale,yscale;
|
| 1767 | 1777 | LONG error;
|
| 1768 | 1778 | DWORD flags;
|
| | 1779 | + int stretchmode;
|
| 1769 | 1780 | if(!oldmode.dmSize)
|
| 1770 | 1781 | {
|
| 1771 | 1782 | oldmode.dmSize = sizeof(DEVMODE);
|
| — | — | @@ -1871,17 +1882,44 @@ |
| 1872 | 1883 | if (_isnan(dxglcfg.aspect) || dxglcfg.aspect <= 0)
|
| 1873 | 1884 | {
|
| 1874 | 1885 | aspect = (float)dwWidth / (float)dwHeight;
|
| 1875 | | - xmul = (float)screenx / (float)dwWidth;
|
| 1876 | | - ymul = (float)screeny / (float)dwHeight;
|
| 1877 | | - if ((float)dwWidth*(float)ymul > (float)screenx)
|
| | 1886 | + switch (stretchmode = IsStretchedMode(dwWidth, dwHeight))
|
| 1878 | 1887 | {
|
| 1879 | | - internalx = (DWORD)((float)dwWidth * (float)xmul);
|
| 1880 | | - internaly = (DWORD)((float)dwHeight * (float)xmul);
|
| | 1888 | + case 1:
|
| | 1889 | + aspect *= 2.0f;
|
| | 1890 | + break;
|
| | 1891 | + case 2:
|
| | 1892 | + aspect /= 2.0f;
|
| | 1893 | + break;
|
| | 1894 | + default:
|
| | 1895 | + break;
|
| 1881 | 1896 | }
|
| | 1897 | + if (stretchmode)
|
| | 1898 | + {
|
| | 1899 | + if (screenx / aspect > screeny)
|
| | 1900 | + {
|
| | 1901 | + internalx = (DWORD)((float)screeny * (float)aspect);
|
| | 1902 | + internaly = screeny;
|
| | 1903 | + }
|
| | 1904 | + else
|
| | 1905 | + {
|
| | 1906 | + internalx = screenx;
|
| | 1907 | + internaly = (DWORD)((float)screenx / (float)aspect);
|
| | 1908 | + }
|
| | 1909 | + }
|
| 1882 | 1910 | else
|
| 1883 | 1911 | {
|
| 1884 | | - internalx = (DWORD)((float)dwWidth * (float)ymul);
|
| 1885 | | - internaly = (DWORD)((float)dwHeight * (float)ymul);
|
| | 1912 | + xmul = (float)screenx / (float)dwWidth;
|
| | 1913 | + ymul = (float)screeny / (float)dwHeight;
|
| | 1914 | + if ((float)dwWidth*(float)ymul > (float)screenx)
|
| | 1915 | + {
|
| | 1916 | + internalx = (DWORD)((float)dwWidth * (float)xmul);
|
| | 1917 | + internaly = (DWORD)((float)dwHeight * (float)xmul);
|
| | 1918 | + }
|
| | 1919 | + else
|
| | 1920 | + {
|
| | 1921 | + internalx = (DWORD)((float)dwWidth * (float)ymul);
|
| | 1922 | + internaly = (DWORD)((float)dwHeight * (float)ymul);
|
| | 1923 | + }
|
| 1886 | 1924 | }
|
| 1887 | 1925 | }
|
| 1888 | 1926 | else
|
| — | — | @@ -1973,17 +2011,44 @@ |
| 1974 | 2012 | if (_isnan(dxglcfg.aspect) || dxglcfg.aspect <= 0)
|
| 1975 | 2013 | {
|
| 1976 | 2014 | aspect = (float)dwWidth / (float)dwHeight;
|
| 1977 | | - xmul = (float)screenx / (float)dwWidth;
|
| 1978 | | - ymul = (float)screeny / (float)dwHeight;
|
| 1979 | | - if ((float)dwWidth*(float)ymul > (float)screenx)
|
| | 2015 | + switch (stretchmode = IsStretchedMode(dwWidth, dwHeight))
|
| 1980 | 2016 | {
|
| 1981 | | - internalx = (DWORD)((float)dwWidth * (float)xmul);
|
| 1982 | | - internaly = (DWORD)((float)dwHeight * (float)xmul);
|
| | 2017 | + case 1:
|
| | 2018 | + aspect *= 2.0f;
|
| | 2019 | + break;
|
| | 2020 | + case 2:
|
| | 2021 | + aspect /= 2.0f;
|
| | 2022 | + break;
|
| | 2023 | + default:
|
| | 2024 | + break;
|
| 1983 | 2025 | }
|
| | 2026 | + if (stretchmode)
|
| | 2027 | + {
|
| | 2028 | + if (screenx / aspect > screeny)
|
| | 2029 | + {
|
| | 2030 | + internalx = (DWORD)((float)screeny * (float)aspect);
|
| | 2031 | + internaly = screeny;
|
| | 2032 | + }
|
| | 2033 | + else
|
| | 2034 | + {
|
| | 2035 | + internalx = screenx;
|
| | 2036 | + internaly = (DWORD)((float)screenx / (float)aspect);
|
| | 2037 | + }
|
| | 2038 | + }
|
| 1984 | 2039 | else
|
| 1985 | 2040 | {
|
| 1986 | | - internalx = (DWORD)((float)dwWidth * (float)ymul);
|
| 1987 | | - internaly = (DWORD)((float)dwHeight * (float)ymul);
|
| | 2041 | + xmul = (float)screenx / (float)dwWidth;
|
| | 2042 | + ymul = (float)screeny / (float)dwHeight;
|
| | 2043 | + if ((float)dwWidth*(float)ymul > (float)screenx)
|
| | 2044 | + {
|
| | 2045 | + internalx = (DWORD)((float)dwWidth * (float)xmul);
|
| | 2046 | + internaly = (DWORD)((float)dwHeight * (float)xmul);
|
| | 2047 | + }
|
| | 2048 | + else
|
| | 2049 | + {
|
| | 2050 | + internalx = (DWORD)((float)dwWidth * (float)ymul);
|
| | 2051 | + internaly = (DWORD)((float)dwHeight * (float)ymul);
|
| | 2052 | + }
|
| 1988 | 2053 | }
|
| 1989 | 2054 | }
|
| 1990 | 2055 | else
|
| — | — | @@ -2038,17 +2103,44 @@ |
| 2039 | 2104 | if (_isnan(dxglcfg.aspect) || dxglcfg.aspect <= 0)
|
| 2040 | 2105 | {
|
| 2041 | 2106 | aspect = (float)dwWidth / (float)dwHeight;
|
| 2042 | | - xmul = (float)screenx / (float)dwWidth;
|
| 2043 | | - ymul = (float)screeny / (float)dwHeight;
|
| 2044 | | - if ((float)dwWidth*(float)ymul < (float)screenx)
|
| | 2107 | + switch (stretchmode = IsStretchedMode(dwWidth, dwHeight))
|
| 2045 | 2108 | {
|
| 2046 | | - internalx = (DWORD)((float)dwWidth * (float)xmul);
|
| 2047 | | - internaly = (DWORD)((float)dwHeight * (float)xmul);
|
| | 2109 | + case 1:
|
| | 2110 | + aspect *= 2.0f;
|
| | 2111 | + break;
|
| | 2112 | + case 2:
|
| | 2113 | + aspect /= 2.0f;
|
| | 2114 | + break;
|
| | 2115 | + default:
|
| | 2116 | + break;
|
| 2048 | 2117 | }
|
| | 2118 | + if (stretchmode)
|
| | 2119 | + {
|
| | 2120 | + if (screenx / aspect < screeny)
|
| | 2121 | + {
|
| | 2122 | + internalx = (DWORD)((float)screeny * (float)aspect);
|
| | 2123 | + internaly = screeny;
|
| | 2124 | + }
|
| | 2125 | + else
|
| | 2126 | + {
|
| | 2127 | + internalx = screenx;
|
| | 2128 | + internaly = (DWORD)((float)screenx / (float)aspect);
|
| | 2129 | + }
|
| | 2130 | + }
|
| 2049 | 2131 | else
|
| 2050 | 2132 | {
|
| 2051 | | - internalx = (DWORD)((float)dwWidth * (float)ymul);
|
| 2052 | | - internaly = (DWORD)((float)dwHeight * (float)ymul);
|
| | 2133 | + xmul = (float)screenx / (float)dwWidth;
|
| | 2134 | + ymul = (float)screeny / (float)dwHeight;
|
| | 2135 | + if ((float)dwWidth*(float)ymul < (float)screenx)
|
| | 2136 | + {
|
| | 2137 | + internalx = (DWORD)((float)dwWidth * (float)xmul);
|
| | 2138 | + internaly = (DWORD)((float)dwHeight * (float)xmul);
|
| | 2139 | + }
|
| | 2140 | + else
|
| | 2141 | + {
|
| | 2142 | + internalx = (DWORD)((float)dwWidth * (float)ymul);
|
| | 2143 | + internaly = (DWORD)((float)dwHeight * (float)ymul);
|
| | 2144 | + }
|
| 2053 | 2145 | }
|
| 2054 | 2146 | }
|
| 2055 | 2147 | else
|