@@ -17,6 +17,7 @@ import shlex
17
17
import uuid
18
18
import json
19
19
import time
20
+ import urllib .request
20
21
21
22
from ctypes import CDLL
22
23
from ctypes import CFUNCTYPE
@@ -732,6 +733,9 @@ class CompatData:
732
733
#How can this happen??
733
734
log ("Prefix has an invalid version?! You may want to back up user files and delete this prefix." )
734
735
#If it does, just let the Wine upgrade happen and hope it works...
736
+ with open (self .creation_sync_guard , "w" ):
737
+ pass
738
+ os .sync ()
735
739
return
736
740
737
741
try :
@@ -1009,6 +1013,19 @@ class CompatData:
1009
1013
os .remove (old )
1010
1014
os .symlink (src = link , dst = old )
1011
1015
1016
+ def setup_fsr4 (self ):
1017
+ fsr4files = ["amdxcffx64" ]
1018
+
1019
+ for f in fsr4files :
1020
+ dst = "drive_c/windows/system32/" + f + ".dll"
1021
+ if not file_exists (self .prefix_dir + dst , follow_symlinks = False ):
1022
+ try :
1023
+ tracked_files .write (dst + '\n ' )
1024
+ except Exception :
1025
+ pass
1026
+ if file_exists (g_proton .lib_dir + "wine/amdprop/" + f + ".dll" , follow_symlinks = False ):
1027
+ self .create_symlink (self .prefix_dir + dst , g_proton .lib_dir + "wine/amdprop/" + f + ".dll" )
1028
+
1012
1029
def setup_prefix (self ):
1013
1030
with self .prefix_lock :
1014
1031
if file_exists (self .version_file , follow_symlinks = True ):
@@ -1235,6 +1252,8 @@ class CompatData:
1235
1252
tracked_files .write (dst + '\n ' )
1236
1253
self .create_symlink (self .prefix_dir + dst , g_proton .lib_dir + "wine/icu/i386-windows/" + f + ".dll" )
1237
1254
1255
+ self .setup_fsr4 ()
1256
+
1238
1257
# If the user requested the NVAPI be available, copy it into place.
1239
1258
# If they didn't, clean up any stray nvapi DLLs.
1240
1259
if use_nvapi :
@@ -1611,6 +1630,13 @@ class Session:
1611
1630
self .compat_config .discard (config_name )
1612
1631
return True
1613
1632
1633
+ def download_file (self , uri , dst ):
1634
+ try :
1635
+ os .makedirs (os .path .dirname (dst ), exist_ok = True )
1636
+ urllib .request .urlretrieve (uri , dst )
1637
+ except Exception :
1638
+ pass
1639
+
1614
1640
def try_log_slr_versions (self ):
1615
1641
try :
1616
1642
if "PRESSURE_VESSEL_RUNTIME_BASE" in self .env :
@@ -1687,10 +1713,6 @@ class Session:
1687
1713
if not self .check_environment ("PROTON_USE_WINED3D" , "wined3d" ):
1688
1714
self .check_environment ("PROTON_USE_WINED3D11" , "wined3d" )
1689
1715
self .check_environment ("PROTON_NO_WM_DECORATION" , "nowmdecoration" )
1690
- self .check_environment ("PROTON_ENABLE_WAYLAND" , "enablewayland" )
1691
- self .check_environment ("PROTON_ENABLE_HDR" , "enablehdr" )
1692
- self .check_environment ("PROTON_PREFER_SDL" , "sdlinput" )
1693
- self .check_environment ("PROTON_NO_STEAMINPUT" , "sdlinput" )
1694
1716
self .check_environment ("PROTON_DXVK_D3D8" , "dxvkd3d8" )
1695
1717
self .check_environment ("PROTON_NO_D3D11" , "nod3d11" )
1696
1718
self .check_environment ("PROTON_NO_D3D10" , "nod3d10" )
@@ -1709,6 +1731,19 @@ class Session:
1709
1731
self .check_environment ("PROTON_DISABLE_NVAPI" , "disablenvapi" )
1710
1732
self .check_environment ("PROTON_FORCE_NVAPI" , "forcenvapi" )
1711
1733
self .check_environment ("PROTON_HIDE_APU" , "hideapu" )
1734
+ self .check_environment ("PROTON_ENABLE_WAYLAND" , "wayland" )
1735
+ self .check_environment ("PROTON_USE_WAYLAND" , "wayland" )
1736
+ self .check_environment ("PROTON_PREFER_SDL" , "sdlinput" )
1737
+ self .check_environment ("PROTON_USE_SDL" , "sdlinput" )
1738
+ self .check_environment ("PROTON_FSR4_UPGRADE" , "fsr4" )
1739
+ self .check_environment ("PROTON_NATIVE_AGS" , "nativeags" )
1740
+ self .check_environment ("PROTON_ENABLE_HDR" , "hdr" )
1741
+ self .check_environment ("PROTON_USE_NTSYNC" , "ntsync" )
1742
+
1743
+ if "ntsync" in self .compat_config :
1744
+ self .env ["WINENTSYNC" ] = "1"
1745
+ else :
1746
+ self .env .pop ("WINENTSYNC" , "" )
1712
1747
1713
1748
if "noesync" in self .compat_config :
1714
1749
self .env .pop ("WINEESYNC" , "" )
@@ -1718,24 +1753,6 @@ class Session:
1718
1753
if "nowmdecoration" in self .compat_config :
1719
1754
self .env ["WINE_NO_WM_DECORATION" ] = "1"
1720
1755
1721
- if "enablewayland" in self .compat_config :
1722
- if self .env .get ("WAYLAND_DISPLAY" , False ):
1723
- self .dlloverrides ["winex11.drv" ] = "d"
1724
- self .dlloverrides ["winewayland.drv" ] = "b"
1725
- self .env ["WINE_WAYLAND_HACKS" ] = "1"
1726
- if "enablehdr" in self .compat_config :
1727
- self .env ["DXVK_HDR" ] = "1"
1728
- """
1729
- It is not possible for winewayland to support xalia since
1730
- there is no way to position toplevel surfaces dynamically in wayland
1731
- """
1732
- self .env ["PROTON_USE_XALIA" ] = "0"
1733
- # Steam input does not work on wayland
1734
- self .env ["PROTON_NO_STEAMINPUT" ] = "1"
1735
- # Make sure SDL will still work with the controllers, steam sets this for some dumb reason
1736
- if "SDL_GAMECONTROLLER_IGNORE_DEVICES" in self .env :
1737
- del self .env ["SDL_GAMECONTROLLER_IGNORE_DEVICES" ]
1738
-
1739
1756
if "noxim" not in self .compat_config :
1740
1757
self .env .pop ("WINE_ALLOW_XIM" )
1741
1758
@@ -1867,6 +1884,11 @@ class Session:
1867
1884
if "disablelibglesv2" in self .compat_config :
1868
1885
self .dlloverrides ["libglesv2" ] = "d"
1869
1886
1887
+ if "nativeags" in self .compat_config :
1888
+ self .dlloverrides ["atiadlxx" ] = "b"
1889
+ self .dlloverrides ["atidxx64" ] = "b"
1890
+ self .dlloverrides ["amd_ags_x64" ] = "n"
1891
+
1870
1892
if "nomfdxgiman" in self .compat_config :
1871
1893
self .env ["WINE_DO_NOT_CREATE_DXGI_DEVICE_MANAGER" ] = "1"
1872
1894
@@ -1893,6 +1915,44 @@ class Session:
1893
1915
if "SDL_GAMECONTROLLER_IGNORE_DEVICES" in self .env :
1894
1916
del self .env ["SDL_GAMECONTROLLER_IGNORE_DEVICES" ]
1895
1917
1918
+ if "fsr4" in self .compat_config :
1919
+ self .env ["FSR4_UPGRADE" ] = "1"
1920
+ versions = ["67D435F7d97000" , "67A4D2BC10ad000" ]
1921
+ version_match = True
1922
+
1923
+ # TODO: make the following code more efficent
1924
+
1925
+ # 0. Check downloaded version
1926
+ if file_exists (g_proton .lib_dir + "wine/amdprop/amdxcffx64_version" , follow_symlinks = False ):
1927
+ with open (g_proton .lib_dir + "wine/amdprop/amdxcffx64_version" , "r" ) as file :
1928
+ first_line = file .readline ()
1929
+ version_match = False
1930
+ for version in versions :
1931
+ if first_line in version :
1932
+ version_match = True
1933
+ else :
1934
+ version_match = False
1935
+
1936
+ # 1. Download amdxcffx64 library
1937
+ if not file_exists (g_proton .lib_dir + "wine/amdprop/amdxcffx64.dll" , follow_symlinks = False ) or not version_match :
1938
+ self .download_file ("https://download.amd.com/dir/bin/amdxcffx64.dll/" + versions [1 ] + "/amdxcffx64.dll" , g_proton .lib_dir + "wine/amdprop/amdxcffx64.dll" )
1939
+
1940
+ # 2. Update stored version
1941
+ if file_exists (g_proton .lib_dir + "wine/amdprop/amdxcffx64.dll" , follow_symlinks = False ):
1942
+ g_compatdata .setup_fsr4 ()
1943
+ if not version_match :
1944
+ with open (g_proton .lib_dir + "wine/amdprop/amdxcffx64_version" , "w" ) as file :
1945
+ file .write (versions [1 ] + "\n " )
1946
+
1947
+ if "hdr" in self .compat_config :
1948
+ self .env ["DXVK_HDR" ] = "1"
1949
+
1950
+ # igdext is loaded either using the LoadLibraryExW hack on 1.3 or lower
1951
+ # or using the INTC_ALT_DRIVER_EXTENSIONS_PATH on 2.0 or newer
1952
+ # TODO: Load it through driver store data like it is on windows
1953
+ # TODO: D3D11 has a different loading mechanism because why not
1954
+ self .env ["INTC_ALT_DRIVER_EXTENSIONS_PATH" ] = "C:\\ Windows\\ System32"
1955
+
1896
1956
# NVIDIA software may check for the "DriverStore" by querying the
1897
1957
# NGXCore\NGXPath registry key via `D3DDDI_QUERYREGISTRY_SERVICEKEY` for
1898
1958
# a given adapter. In the case where this path cannot be found, the
@@ -1937,6 +1997,12 @@ class Session:
1937
1997
if var in self .env :
1938
1998
self .log_file .write ("Effective " + var + ": " + self .env [var ] + "\n " )
1939
1999
2000
+ if "fsr4" in self .compat_config :
2001
+ if file_exists (g_proton .lib_dir + "wine/amdprop/amdxcffx64.dll" , follow_symlinks = False ):
2002
+ self .log_file .write ("INFO: Automatic FSR4 upgrade enabled!\n " )
2003
+ else :
2004
+ self .log_file .write ("ERROR: Failed to download amdxcffx64.dll!\n " )
2005
+
1940
2006
# check for low fd limit
1941
2007
_soft_limit , hard_limit = resource .getrlimit (resource .RLIMIT_NOFILE )
1942
2008
if hard_limit < 524288 :
@@ -1977,6 +2043,22 @@ class Session:
1977
2043
if "disablenvapi" not in self .compat_config or "forcenvapi" in self .compat_config :
1978
2044
self .env ["DXVK_ENABLE_NVAPI" ] = "1"
1979
2045
2046
+ if "wayland" in self .compat_config :
2047
+ if "WAYLAND_DISPLAY" in self .env :
2048
+ self .dlloverrides ["winex11.drv" ] = "d"
2049
+ self .dlloverrides ["winewayland.drv" ] = "b"
2050
+ self .env ["WINE_WAYLAND_HACKS" ] = "1"
2051
+ """
2052
+ It is not possible for winewayland to support xalia since
2053
+ there is no way to position toplevel surfaces dynamically in wayland
2054
+ """
2055
+ self .env ["PROTON_USE_XALIA" ] = "0"
2056
+ # Steam input does not work on wayland
2057
+ self .env ["PROTON_NO_STEAMINPUT" ] = "1"
2058
+ # Make sure SDL will still work with the controllers, steam sets this for some dumb reason
2059
+ if "SDL_GAMECONTROLLER_IGNORE_DEVICES" in self .env :
2060
+ del self .env ["SDL_GAMECONTROLLER_IGNORE_DEVICES" ]
2061
+
1980
2062
if "forcenvapi" in self .compat_config :
1981
2063
self .env ["DXVK_NVAPI_ALLOW_OTHER_DRIVERS" ] = "1"
1982
2064
self .env ["DXVK_NVAPI_DRIVER_VERSION" ] = "99999"
0 commit comments