Repository: lutris/lutris

Issue:
Nine: Lutris can't find Nine libraries
A lot of changed before creating PR #2092 and merging it - biggest issue is commit 792c22176eff9e063b22d7b9700e2e9b79a11fae, which changes return val of iter_lib_folders() from lists to strings. I believe I used iter_lib_folders() in #2092 because I needed distinguish between lib32 and lib64 paths. I will take a look at this and try to fix it ASAP (this week).

Original report:
https://github.com/lutris/lutris/pull/2092#issuecomment-529362315


Discussion:

Resolving patch:
diff --git a/lutris/util/wine/nine.py b/lutris/util/wine/nine.py
--- a/lutris/util/wine/nine.py
+++ b/lutris/util/wine/nine.py
@@ -4,6 +4,7 @@
 
 from lutris.util import system
 from lutris.runners.commands.wine import wineexec
+from lutris.util.wine.cabinstall import CabInstaller
 
 class NineUnavailable(RuntimeError):
     """Exception raised when Gallium Nine is not available"""
@@ -26,15 +27,10 @@ def nine_is_supported():
         of system library directory
         """
         for mesa_file in NineManager.mesa_files:
-            if not any([os.path.exists(os.path.join(lib[0], "d3d", mesa_file))
+            if not any([os.path.exists(os.path.join(lib, "d3d", mesa_file))
             for lib in system.LINUX_SYSTEM.iter_lib_folders()]):
                 return False
 
-            if system.LINUX_SYSTEM.is_64_bit:
-                if not any([os.path.exists(os.path.join(lib[1], "d3d", mesa_file))
-                for lib in system.LINUX_SYSTEM.iter_lib_folders()]):
-                    return False
-
         return True
 
     @staticmethod
@@ -44,15 +40,10 @@ def nine_is_installed():
         check 'wine/fakedlls' subdirectory of system library directory for Nine binaries
         """
         for nine_file in NineManager.nine_files:
-            if not any([os.path.exists(os.path.join(lib[0], "wine/fakedlls", nine_file))
+            if not any([os.path.exists(os.path.join(lib, "wine/fakedlls", nine_file))
             for lib in system.LINUX_SYSTEM.iter_lib_folders()]):
                 return False
 
-            if system.LINUX_SYSTEM.is_64_bit:
-                if not any([os.path.exists(os.path.join(lib[1], "wine/fakedlls", nine_file))
-                for lib in system.LINUX_SYSTEM.iter_lib_folders()]):
-                    return False
-
         return True
 
     @staticmethod
@@ -88,15 +79,24 @@ def is_prefix_prepared(self):
     def prepare_prefix(self):
         for nine_file in NineManager.nine_files:
             for lib in system.LINUX_SYSTEM.iter_lib_folders():
-                nine_file_32 = os.path.join(lib[0], "wine/fakedlls", nine_file)
-                if os.path.exists(nine_file_32):
-                    shutil.copy(nine_file_32, self.get_system_path("x32"))
+                nine_file_path = os.path.join(lib, "wine/fakedlls", nine_file)
+
+                if (os.path.exists(nine_file_path) and
+                CabInstaller.get_arch_from_dll(nine_file_path) == "win32"):
+                    shutil.copy(nine_file_path, self.get_system_path("x32"))
 
                 if self.wine_arch == "win64":
-                    nine_file_64 = os.path.join(lib[1], "wine/fakedlls", nine_file)
-                    if os.path.exists(nine_file_64):
+                    if (os.path.exists(nine_file_path) and
+                    CabInstaller.get_arch_from_dll(nine_file_path) == "win64"):
                         shutil.copy(nine_file_64, self.get_system_path("x64"))
 
+            if not os.path.exists(os.path.join(self.get_system_path("x32"), nine_file)):
+                raise NineUnavailable("could not install " + nine_file + " (x32)")
+
+            if self.wine_arch == "win64":
+                if not os.path.exists(os.path.join(self.get_system_path("x64"), nine_file)):
+                    raise NineUnavailable("could not install " + nine_file + " (x64)")
+
     def enable(self):
         if not self.nine_is_supported():
             raise NineUnavailable("Nine is not supported on this system")


Test patch: