internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: lutris/lutris

Issue:
Add migration for banners cache
Since https://github.com/lutris/lutris/commit/db6c0f4e03395946c6f1dc0abcfe208cfd447056 changed the location for banners, Lutris should add a migration that will move banners that are already stored in the data dir location to the cache dir location.
Because right now, when you start Lutris, all games are missing banners, and Lutris does not seem to redownload them.


Discussion:
Hmm. What bothers me is that Lutris does not redownload missing banners. I actually have a branch that does download them when they are viewed (if missing).

But this seems like its intended, not a bug.

Can anyone tell me *why* Lutris won't redownload missing banners or icons?

Resolving patch:
diff --git a/lutris/migrations/__init__.py b/lutris/migrations/__init__.py
--- a/lutris/migrations/__init__.py
+++ b/lutris/migrations/__init__.py
@@ -3,7 +3,7 @@
 from lutris import settings
 from lutris.util.log import logger
 
-MIGRATION_VERSION = 10  # Never decrease this number
+MIGRATION_VERSION = 11  # Never decrease this number
 
 # Replace deprecated migrations with empty lists
 MIGRATIONS = [
@@ -11,6 +11,7 @@
     ["mess_to_mame"],
     ["migrate_hidden_ids"],
     ["migrate_steam_appids"],
+    ["migrate_banners"]
 ]
 
 
diff --git a/lutris/migrations/migrate_banners.py b/lutris/migrations/migrate_banners.py
new file mode 100644
--- /dev/null
+++ b/lutris/migrations/migrate_banners.py
@@ -0,0 +1,25 @@
+"""Migrate banners from .local/share/lutris to .cache/lutris"""
+import os
+
+from lutris import settings
+from lutris.util.log import logger
+
+
+def migrate():
+    dest_dir = settings.BANNER_PATH
+    src_dir = os.path.join(settings.DATA_DIR, "banners")
+
+    try:
+        # init_lutris() creates the new banners directrory
+        if os.path.isdir(src_dir) and os.path.isdir(dest_dir):
+            for filename in os.listdir(src_dir):
+                src_file = os.path.join(src_dir, filename)
+                dest_file = os.path.join(dest_dir, filename)
+
+                if not os.path.exists(dest_file):
+                    os.rename(src_file, dest_file)
+
+            if not os.listdir(src_dir):
+                os.rmdir(src_dir)
+    except OSError as ex:
+        logger.exception("Failed to migrate banners: %s", ex)
diff --git a/lutris/startup.py b/lutris/startup.py
--- a/lutris/startup.py
+++ b/lutris/startup.py
@@ -32,7 +32,7 @@ def init_dirs():
         settings.DATA_DIR,
         os.path.join(settings.DATA_DIR, "covers"),
         settings.ICON_PATH,
-        os.path.join(settings.DATA_DIR, "banners"),
+        os.path.join(settings.CACHE_DIR, "banners"),
         os.path.join(settings.DATA_DIR, "coverart"),
         os.path.join(settings.DATA_DIR, "runners"),
         os.path.join(settings.DATA_DIR, "lib"),


Test patch:
Repository: lutris/lutris

Issue:
Redream runner shows with wrong styling
Shows up with full, coloured logo, really massive. Screenshot attached
![2021-12-17_21-03](https://user-images.githubusercontent.com/60288171/146607719-84e70073-94f5-4ed6-94d8-a8aee15ab0de.png)
.


Discussion:
@strycore redream is kinda dead to OSS community, shouldn't it be deprecated in favor of flycast?

Resolving patch:
diff --git a/lutris/gui/widgets/sidebar.py b/lutris/gui/widgets/sidebar.py
--- a/lutris/gui/widgets/sidebar.py
+++ b/lutris/gui/widgets/sidebar.py
@@ -276,7 +276,15 @@ def __init__(self, application, selected=None):
         self.show_all()
 
     def get_sidebar_icon(self, icon_name):
-        return Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
+        icon = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
+
+        # We can wind up with an icon of the wrong size, if that's what is
+        # available. So we'll fix that.
+        icon_size = Gtk.IconSize.lookup(Gtk.IconSize.MENU)
+        if icon_size[0]:
+            icon.set_pixel_size(icon_size[2])
+
+        return icon
 
     def initialize_rows(self):
         """


Test patch:
Repository: lutris/lutris

Issue:
MicroM8 runner does not work
I installed the MicroM8 runner and tried to manually configure an Apple II game by selecting the runner and pointing it to an Apple II floppy. Debug output shows a “No game found in library” error, but no indication of specifically what file it is looking for that it can’t find.

```
~$ lutris -d lutris:rungame/10
2021-10-10 18:18:51,525: Initializing lutris
2021-10-10 18:18:52,016: Downloading DXVK releases to /home/********/.local/share/lutris/runtime/dxvk/dxvk_versions.json
2021-10-10 18:18:52,017: Runtime updated. Initialization complete.
INFO 2021-10-10 18:18:52,019 [application.do_command_line:315]:Lutris 0.5.8.3
INFO 2021-10-10 18:18:52,019 [startup.check_driver:57]:Running Intel Mesa driver 21.2.1 on Mesa Intel(R) Xe Graphics (TGL GT2) (0x9a49)
INFO 2021-10-10 18:18:52,019 [startup.check_driver:69]:GPU: 8086:9A49 1558:51A1 (i915 drivers)
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

WARNING 2021-10-10 18:18:52,115 [application.do_command_line:455]:No game found in library
INFO 2021-10-10 18:18:52,115 [application.do_shutdown:598]:Shutting down Lutris
INFO 2021-10-10 18:18:52,118 [application.do_shutdown:598]:Shutting down Lutris
```


Discussion:
Ah, I figured out that I was running incorrectly when trying to obtain the debug output above.  The real issue is that the downloaded microm8 binary does not have the exec attribute set.  Leaving this issue here as I think the Lutris client should really be taking care of this.  The workaround, after downloading the runner, is to `chmod a+x ~/.local/share/lutris/runners/microm8/microm8`.
It would also be nice if there was a way to check if libportaudio2 is installed, as this is required by microM8.

Resolving patch:
diff --git a/lutris/runners/runner.py b/lutris/runners/runner.py
--- a/lutris/runners/runner.py
+++ b/lutris/runners/runner.py
@@ -411,6 +411,11 @@ def extract(self, archive=None, dest=None, merge_single=None, callback=None):
             from lutris.util.wine.wine import get_wine_versions
             get_wine_versions.cache_clear()
 
+        if self.runner_executable:
+            runner_executable = os.path.join(settings.RUNNER_DIR, self.runner_executable)
+            if os.path.isfile(runner_executable):
+                system.make_executable(runner_executable)
+
         if callback:
             callback()
 


Test patch:
Repository: lutris/lutris

Issue:
Won't open configure panel with some icons
```
2021-11-03 02:59:23,691: Unable to load icon from image fl-studio
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/game_actions.py", line 178, in on_edit_game_configuration
    EditGameConfigDialog(self.window, self.game)
  File "/usr/lib/python3/dist-packages/lutris/gui/config/edit_game.py", line 16, in __init__
    self.build_tabs("game")
  File "/usr/lib/python3/dist-packages/lutris/gui/config/common.py", line 70, in build_tabs
    self._build_info_tab()
  File "/usr/lib/python3/dist-packages/lutris/gui/config/common.py", line 79, in _build_info_tab
    info_box.pack_start(self._get_banner_box(), False, False, 6)  # Banner
  File "/usr/lib/python3/dist-packages/lutris/gui/config/common.py", line 155, in _get_banner_box
    self._set_image("banner")
  File "/usr/lib/python3/dist-packages/lutris/gui/config/common.py", line 195, in _set_image
    image.set_from_pixbuf(get_pixbuf_for_game(game_slug, size))
  File "/usr/lib/python3/dist-packages/lutris/gui/widgets/utils.py", line 127, in get_pixbuf_for_game
    return get_pixbuf(image_abspath, size, fallback=get_default_icon(size), is_installed=is_installed)
  File "/usr/lib/python3/dist-packages/lutris/gui/widgets/utils.py", line 58, in get_pixbuf
    pixbuf = pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.NEAREST)
AttributeError: 'NoneType' object has no attribute 'scale_simple'
```


This seems to happen with the icon for "FL Studio", right click > configure to reproduce.


Discussion:
I can confirm this happening as well on 0.5.9.1
The problem seems to only exist on one icon which is is a linux game. It never shows itself on another WINE game. The problem is also not consistent. Most of the time I can't open this menu but sometimes I suddenly can.
I only have two games installed so I can't do any further testing but my errors are the same as @sfjuocekr .
I have the same issue on 0.5.9.1. It seems to happen with almost every game I have.
I have it happening on a couple of WINE titles including Star Citizen

Resolving patch:
diff --git a/lutris/gui/widgets/utils.py b/lutris/gui/widgets/utils.py
--- a/lutris/gui/widgets/utils.py
+++ b/lutris/gui/widgets/utils.py
@@ -54,7 +54,7 @@ def get_pixbuf(image, size, fallback=None, is_installed=True):
             fallback = get_default_icon(size)
         if system.path_exists(fallback):
             pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(fallback, width, height)
-    if is_installed:
+    if is_installed and pixbuf:
         pixbuf = pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.NEAREST)
         return pixbuf
     overlay = os.path.join(datapath.get(), "media/unavailable.png")


Test patch:
Repository: lutris/lutris

Issue:
DllManager only updates WINEDLLOVERRIDES overrides on client restart
How to reproduce:
1) Launch Lutris in the debug mode (lutris -d in terminal)
2) Launch a game with the DXVK option enabled. WINEDLLOVERRIDES environment variable (printed in the output) shows that overrides like d3d11, d3d9, d3d10core are set.
3) Go to the game's configuration, disable DXVK. Do not close Lutris after this
4) Launch it again. WINEDLLOVERRIDES environment variable will still have overrides like d3d11, d3d9, d3d10core set to `=n`.
5) Close Lutris, restart it again (still in debug mode)
6) Launch the same game that had DXVK disabled. WINEDLLOVERRIDES will not have d3d11, d3d9, d3d10core overrides set.

This happens with all DllManager operated versions.


Discussion:

Resolving patch:
diff --git a/lutris/runners/wine.py b/lutris/runners/wine.py
--- a/lutris/runners/wine.py
+++ b/lutris/runners/wine.py
@@ -105,7 +105,7 @@ class wine(Runner):
 
     def __init__(self, config=None):  # noqa: C901
         super().__init__(config)
-        self.dll_overrides = DEFAULT_DLL_OVERRIDES
+        self.dll_overrides = DEFAULT_DLL_OVERRIDES.copy()  # we'll modify this, so we better copy it
 
         def get_wine_version_choices():
             version_choices = [(_("Custom (select executable below)"), "custom")]


Test patch:
Repository: lutris/lutris

Issue:
Can't interact with existing winesteam games in the library
```ERROR    2021-12-29 15:17:54,343 [game._get_runner:195]:Unable to import runner winesteam for steven-universe-save-the-light
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/lutris/gui/lutriswindow.py", line 436, in update_revealer
    self.game_bar = GameBar(game, self.game_actions, self.application)
  File "/usr/lib/python3.10/site-packages/lutris/gui/widgets/game_bar.py", line 60, in __init__
    self.update_view()
  File "/usr/lib/python3.10/site-packages/lutris/gui/widgets/game_bar.py", line 76, in update_view
    self.play_button = self.get_play_button()
  File "/usr/lib/python3.10/site-packages/lutris/gui/widgets/game_bar.py", line 216, in get_play_button
    popover = self.get_popover(self.get_game_buttons(), popover_button)
  File "/usr/lib/python3.10/site-packages/lutris/gui/widgets/game_bar.py", line 223, in get_game_buttons
    displayed = self.game_actions.get_displayed_entries()
  File "/usr/lib/python3.10/site-packages/lutris/game_actions.py", line 106, in get_displayed_entries
    "execute-script": bool(self.game.is_installed and self.game.runner.system_config.get("manual_command")),
AttributeError: 'NoneType' object has no attribute 'system_config'```


Discussion:

Resolving patch:
diff --git a/lutris/game_actions.py b/lutris/game_actions.py
--- a/lutris/game_actions.py
+++ b/lutris/game_actions.py
@@ -103,7 +103,10 @@ def get_displayed_entries(self):
             "favorite": not self.game.is_favorite,
             "deletefavorite": self.game.is_favorite,
             "install_more": not self.game.service and self.game.is_installed,
-            "execute-script": bool(self.game.is_installed and self.game.runner.system_config.get("manual_command")),
+            "execute-script": bool(
+                self.game.is_installed and self.game.runner
+                and self.game.runner.system_config.get("manual_command")
+            ),
             "desktop-shortcut": (
                 self.game.is_installed
                 and not xdgshortcuts.desktop_launcher_exists(self.game.slug, self.game.id)


Test patch:
Repository: lutris/lutris

Issue:
Installer didnt Start Errors in .py
i want to install some stuff like kotor with steam but get everytime the same error.

File "/usr/lib/python3.10/site-packages/lutris/gui/installerwindow.py", line 155, in on_installer_selected
    self.interpreter = interpreter.ScriptInterpreter(
  File "/usr/lib/python3.10/site-packages/lutris/installer/interpreter.py", line 50, in __init__
    self.installer = LutrisInstaller(installer, self, service=self.service, appid=self.appid)
  File "/usr/lib/python3.10/site-packages/lutris/installer/installer.py", line 31, in __init__
    self.service = self.get_service(initial=service)
  File "/usr/lib/python3.10/site-packages/lutris/installer/installer.py", line 47, in get_service
    return SERVICES["steam"]()
KeyError: 'steam'



Discussion:

Resolving patch:
diff --git a/lutris/installer/installer.py b/lutris/installer/installer.py
--- a/lutris/installer/installer.py
+++ b/lutris/installer/installer.py
@@ -44,12 +44,12 @@ def __init__(self, installer, interpreter, service, appid):
     def get_service(self, initial=None):
         if initial:
             return initial
-        if "steam" in self.runner:
+        if "steam" in self.runner and "steam" in SERVICES:
             return SERVICES["steam"]()
         version = self.version.lower()
-        if "humble" in version:
+        if "humble" in version and "humblebundle" in SERVICES:
             return SERVICES["humblebundle"]()
-        if "gog" in version:
+        if "gog" in version and "gog" in SERVICES:
             return SERVICES["gog"]()
 
     def get_appid(self, installer, initial=None):


Test patch:
Repository: lutris/lutris

Issue:
Provide resolution dimensions in a hex format
Currently, Lutris provides resolution dimensions via the envars $RESOLUTION_WIDTH and $RESOLUTION_HEIGHT, which is incredibly useful.
However, some games have resolutions coded in the Wine registry as DWORDs, which are 6 character long hex numbers (1080 is `000438`, for example).
Right now, I workaround this with printf:
```
- execute:
    command: 'printf -v $RESOLUTION_HEIGHT_HEX '%06x\n' $RESOLUTION_HEIGHT'
```
It would be nice if Lutris could also expose hex variants of those envars by default.


Discussion:

Resolving patch:
diff --git a/lutris/installer/interpreter.py b/lutris/installer/interpreter.py
--- a/lutris/installer/interpreter.py
+++ b/lutris/installer/interpreter.py
@@ -385,6 +385,8 @@ def _substitute(self, template_string):
             "RESOLUTION": "x".join(self.current_resolution),
             "RESOLUTION_WIDTH": self.current_resolution[0],
             "RESOLUTION_HEIGHT": self.current_resolution[1],
+            "RESOLUTION_WIDTH_HEX": hex(int(self.current_resolution[0])),
+            "RESOLUTION_HEIGHT_HEX": hex(int(self.current_resolution[1])),
             "WINEBIN": self.get_wine_path(),
         }
         replacements.update(self.installer.variables)


Test patch:
Repository: lutris/lutris

Issue:
Bottom panel switches to a different game when it stops
If another game is running and you switch to a different one, and the first game is closed by itself (like quitting it manually, closing the game window), not through Lutris, the bottom panel will switch to that stopped game all by itself, without user's interaction:
![Peek 2022-02-04 13-29](https://user-images.githubusercontent.com/10602045/152513690-224ef6c1-b56f-4510-9d0f-897ffe2dd8ea.gif)

It should be noted that so far, only I can reproduce this, for some bizarre reason.



Discussion:
That is very strange, but it does not reproduce for me, either in the master branch or in 0.5.9. 

I notice in your screenie that the selected game does *not* change, only the game bar. But that is strange too, as looking at the code there seems to be no way for the game-bar to switch games except when the selected game changes.

So, two questions:

1. How do you close "Minecraft Dungeons"? F4? Window close box? In game quit command?
2. Does this happen for every game, or only "Minecraft Dungeons"?
1. I close the game windows itself. Application itself closes and Lutris detects it as closed and switches its stated to stopped/not running. 
2. This happens for every game.
It doesn't really matter how you close it as long as the process of the game self terminates.
I don't understand it, and it does not happen for me.

Are you seeing this on the latest dev stuff (master branch), or in the last release (0.5.9.1)? Maybe post your hardware information and logs?

*Something* must be different between your experience and mine to account for this, but I don't know what.
I am experiencing this with master and latest release.
System info:
```[System]
OS:              Arch Linux rolling n/a
Arch:            x86_64
Kernel:          5.16.3-241-tkg-pds
Desktop:         GNOME
Display Server:  x11

[CPU]
Vendor:          AuthenticAMD
Model:           AMD Ryzen 7 3800X 8-Core Processor
Physical cores:  8
Logical cores:   16

[Memory]
RAM:             31.3 GB
Swap:            1.9 GB

[Graphics]
Vendor:          NVIDIA Corporation
OpenGL Renderer: NVIDIA GeForce GTX 1070/PCIe/SSE2
OpenGL Version:  4.6.0 NVIDIA 510.47.03
OpenGL Core:     4.6.0 NVIDIA 510.47.03
OpenGL ES:       OpenGL ES 3.2 NVIDIA 510.47.03
Vulkan:          Supported

```
I see nothing in that; perhaps a Lutris debug log ("lutris -d") would be more helpful.

Resolving patch:
diff --git a/lutris/gui/widgets/game_bar.py b/lutris/gui/widgets/game_bar.py
--- a/lutris/gui/widgets/game_bar.py
+++ b/lutris/gui/widgets/game_bar.py
@@ -261,7 +261,7 @@ def on_game_state_changed(self, game):
         """Handler called when the game has changed state"""
         if (
             game.id == self.game.id
-            or game.appid == self.appid
+            or (self.appid and game.appid == self.appid)
         ):
             self.game = game
         else:


Test patch:
Repository: lutris/lutris

Issue:
After installation of EasyRPG runner executable for the runner has to be set manually
After installation of EasyRPG runner its executable is downloaded to `~/.local/share/lutris/runners/easyrpg/easyrpg-player`, but not used, so runner is not usable from lutris till `Custom executable for runner` in `Runner options` is set accordingly.


Discussion:
also, this might be Happening when you try to download the runner in install runners.

Resolving patch:
diff --git a/lutris/runners/easyrpg.py b/lutris/runners/easyrpg.py
--- a/lutris/runners/easyrpg.py
+++ b/lutris/runners/easyrpg.py
@@ -12,7 +12,7 @@ class easyrpg(Runner):
     platforms = [_("Linux")]
     runnable_alone = True
     entry_point_option = "project_path"
-    runner_executable = "easyrpg-player"
+    runner_executable = "easyrpg/easyrpg-player"
     download_url = "https://easyrpg.org/downloads/player/0.7.0/easyrpg-player-0.7.0-linux.tar.gz"
 
     game_options = [


Test patch:
Repository: lutris/lutris

Issue:
error running "lutris --list-steam-folders"  - TypeError: 'dict_values' object is not subscriptable
### Bug description

running "lutris --list-steam-folders" produces  the error: 
TypeError: 'dict_values' object is not subscriptable

I assume the above is also why steam games do not show up in lutris.

### How to Reproduce

Steps to reproduce the behavior:
1. run lutris --list-steam-folders 
2. observe error


### Expected behavior

steam folders are listed

### Log output

```shell
2022-04-08 14:32:39,857: Starting Lutris 0.5.10
2022-04-08 14:32:39,883: No folder at /home/dc/.local/share/lutris/runners/retroarch/
2022-04-08 14:32:40,021: Using NVIDIA drivers 510.54 for x86_64
2022-04-08 14:32:40,021: GPU: Unknown
2022-04-08 14:32:40,021: GPU: 10DE:13C0 1462:3170 (nvidia drivers)
2022-04-08 14:32:40,021: GPU: 8086:0412 1043:8534 (i915 drivers)
MESA-INTEL: warning: Haswell Vulkan support is incomplete
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/gui/application.py", line 434, in do_command_line
    self.print_steam_folders(command_line)
  File "/usr/lib/python3/dist-packages/lutris/gui/application.py", line 782, in print_steam_folders
    for path in steamapps_paths[platform] if steamapps_paths else []:
TypeError: 'dict_values' object is not subscriptable
2022-04-08 14:32:40,118: Shutting down Lutris
```


### System Information

```shell
[System]
OS:              Debian GNU/Linux 11 bullseye
Arch:            x86_64
Kernel:          5.16.0-0.bpo.3-amd64
Desktop:         KDE
Display Server:  x11

[CPU]
Vendor:          GenuineIntel
Model:           Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz
Physical cores:  4
Logical cores:   4

[Memory]
RAM:             15.5 GB
Swap:            7.5 GB

[Graphics]
Vendor:          NVIDIA Corporation
OpenGL Renderer: NVIDIA GeForce GTX 980/PCIe/SSE2
OpenGL Version:  4.6.0 NVIDIA 510.54
OpenGL Core:     4.6.0 NVIDIA 510.54
OpenGL ES:       OpenGL ES 3.2 NVIDIA 510.54
Vulkan:          Supported
```


### Media (optional)

_No response_

### Checklist:

- [X] I'm not asking for support with a game or the wine runner.
- [X] I have followed the above mentioned guides and have all the graphics and wine dependencies installed.
- [X] I have checked for existing issues that describe my problem prior to opening this one.
- [X] I understand that improperly formatted bug reports may be closed without explanation.


Discussion:

Resolving patch:
diff --git a/lutris/gui/application.py b/lutris/gui/application.py
--- a/lutris/gui/application.py
+++ b/lutris/gui/application.py
@@ -778,8 +778,8 @@ def execute_command(command):
 
     def print_steam_folders(self, command_line):
         steamapps_paths = get_steamapps_paths()
-        for platform in ("linux", "windows"):
-            for path in steamapps_paths[platform] if steamapps_paths else []:
+        if steamapps_paths:
+            for path in steamapps_paths:
                 self._print(command_line, path)
 
     def print_runners(self):


Test patch: