We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[vice] Plus/4 crt loading broken
Tried to load a game in crt format, but vice throws a error and exit:

```
:Launching Pirate Adventure: {'command': ['/home/user01/.local/share/lutris/runners/vice/bin/xplus4', '-chdir', '/Games/Romz/Commodore/plus4', '-TEDdsize', '-sdl2renderer', 'opengl', '-cartgeneric', '/Games/Romz/Commodore/plus4/Pirate Adventure.crt']}
DEBUG    2017-03-10 10:26:58,891 [thread]:Command env: STEAM_RUNTIME="/home/user01/.local/share/lutris/runtime/steam" LD_PRELOAD="" SDL_VIDEO_FULLSCREEN_DISPLAY="off" LD_LIBRARY_PATH="/home/user01/.local/share/lutris/runtime/lib32:/home/user01/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/i386/lib:/home/user01/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/i386/usr/lib:/home/user01/.local/share/lutris/runtime/lib64:/home/user01/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/amd64/lib:/home/user01/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/amd64/usr/lib:$LD_LIBRARY_PATH" 
DEBUG    2017-03-10 10:26:58,891 [thread]:Running command: "/home/user01/.local/share/lutris/runners/vice/bin/xplus4" "-chdir" "/Games/Romz/Commodore/plus4" "-TEDdsize" "-sdl2renderer" "opengl" "-cartgeneric" "/Games/Romz/Commodore/plus4/Pirate Adventure.crt"
DEBUG    2017-03-10 10:26:58,891 [thread]:Storing environment variable STEAM_RUNTIME to /home/user01/.local/share/lutris/runtime/steam
DEBUG    2017-03-10 10:26:58,892 [thread]:Storing environment variable LD_PRELOAD to 
DEBUG    2017-03-10 10:26:58,892 [thread]:Storing environment variable SDL_VIDEO_FULLSCREEN_DISPLAY to off
DEBUG    2017-03-10 10:26:58,893 [thread]:Storing environment variable LD_LIBRARY_PATH to /home/user01/.local/share/lutris/runtime/lib32:/home/user01/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/i386/lib:/home/user01/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/i386/usr/lib:/home/user01/.local/share/lutris/runtime/lib64:/home/user01/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/amd64/lib:/home/user01/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/amd64/usr/lib:$LD_LIBRARY_PATH
Error - Default keymap not found, this should be fixed. Going on anyway...
Error - Default keymap not found, this should be fixed. Going on anyway...
Detecting ISA HardSID boards.
Could not open '/dev/port'.
Cannot get permission to access $300.
Detecting PCI HardSID boards.
No PCI HardSID boards found.
Unknown option '-cartgeneric'.
Error parsing command-line options, bailing out. For help use '-help'
Exiting...
```

according to the -help it's just -cart for the plus/4

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lutris/runners/vice.py`
Content:
```
1 import os
2 from lutris import settings
3 from lutris.util import system
4 from lutris.util.log import logger
5 from lutris.runners.runner import Runner
6 
7 
8 class vice(Runner):
9     description = "Commodore Emulator"
10     human_name = "Vice"
11     platforms = [
12         'Commodore 64',
13         'Commodore 128',
14         'Commodore VIC20',
15         'Commodore PET',
16         'Commodore Plus/4',
17         'Commodore CBM II',
18     ]
19 
20     game_options = [{
21         "option": "main_file",
22         "type": "file",
23         "label": "ROM file",
24         'help': ("The game data, commonly called a ROM image.\n"
25                  "Supported formats: X64, D64, G64, P64, D67, D71, D81, "
26                  "D80, D82, D1M, D2M, D4M, T46, P00 and CRT.")
27     }]
28 
29     runner_options = [
30         {
31             "option": "joy",
32             "type": "bool",
33             "label": "Use joysticks",
34             'default': False,
35         },
36         {
37             "option": "fullscreen",
38             "type": "bool",
39             "label": "Fullscreen",
40             'default': False,
41         },
42         {
43             "option": "double",
44             "type": "bool",
45             "label": "Scale up display by 2",
46             'default': True,
47         },
48         {
49             'option': 'aspect_ratio',
50             'type': 'bool',
51             'label': 'Keep aspect ratio',
52             'default': True
53         },
54         {
55             'option': 'drivesound',
56             'type': 'bool',
57             'label': 'Enable sound emulation of disk drives',
58             'default': False
59         },
60         {
61             'option': 'renderer',
62             'type': 'choice',
63             'label': 'Graphics renderer',
64             'choices': [
65                 ('OpenGL', 'opengl'),
66                 ('Software', 'software')
67             ],
68             'default': 'opengl'
69         },
70         {
71             "option": "machine",
72             "type": "choice",
73             "label": "Machine",
74             "choices": [
75                 ("C64", "c64"),
76                 ("C128", "c128"),
77                 ("vic20", "vic20"),
78                 ("PET", "pet"),
79                 ("Plus/4", "plus4"),
80                 ("CBM-II", "cbmii")
81             ],
82             "default": "c64"
83         }
84     ]
85 
86     def get_platform(self):
87         machine = self.game_config.get('machine')
88         if machine:
89             for index, choice in enumerate(self.machine_choices):
90                 if choice[1] == machine:
91                     return self.platforms[index]
92         return ''
93 
94     def get_executable(self, machine=None):
95         if not machine:
96             machine = "c64"
97         executables = {
98             "c64": "x64",
99             "c128": "x128",
100             "vic20": "xvic",
101             "pet": "xpet",
102             "plus4": "xplus4",
103             "cbmii": "xcbm2"
104         }
105         try:
106             executable = executables[machine]
107         except KeyError:
108             raise ValueError("Invalid machine '%s'" % machine)
109         return os.path.join(settings.RUNNER_DIR, "vice/bin/%s" % executable)
110 
111     def install(self, version=None, downloader=None, callback=None):
112         def on_runner_installed(*args):
113             config_path = system.create_folder('~/.vice')
114             lib_dir = os.path.join(settings.RUNNER_DIR, 'vice/lib/vice')
115             if not os.path.exists(lib_dir):
116                 lib_dir = os.path.join(settings.RUNNER_DIR, 'vice/lib64/vice')
117             if not os.path.exists(lib_dir):
118                 logger.error('Missing lib folder in the Vice runner')
119             else:
120                 system.merge_folders(lib_dir, config_path)
121             if callback:
122                 callback()
123 
124         super(vice, self).install(version, downloader, on_runner_installed)
125 
126     def get_roms_path(self, machine=None):
127         if not machine:
128             machine = "c64"
129         paths = {
130             "c64": "C64",
131             "c128": "C128",
132             "vic20": "VIC20",
133             "pet": "PET",
134             "plus4": "PLUS4",
135             "cmbii": "CBM-II"
136         }
137         root_dir = os.path.dirname(os.path.dirname(self.get_executable()))
138         return os.path.join(root_dir, 'lib64/vice', paths[machine])
139 
140     def get_option_prefix(self, machine):
141         prefixes = {
142             'c64': 'VICII',
143             'c128': 'VICII',
144             'vic20': 'VIC',
145             'pet': 'CRTC',
146             'plus4': 'TED',
147             'cmbii': 'CRTC'
148         }
149         return prefixes[machine]
150 
151     def get_joydevs(self, machine):
152         joydevs = {
153             'c64': 2,
154             'c128': 2,
155             'vic20': 1,
156             'pet': 0,
157             'plus4': 2,
158             'cmbii': 0
159         }
160         return joydevs[machine]
161 
162     def play(self):
163         machine = self.runner_config.get("machine")
164 
165         rom = self.game_config.get('main_file')
166         if not rom:
167             return {'error': 'CUSTOM', 'text': 'No rom provided'}
168         if not os.path.exists(rom):
169             return {'error': 'FILE_NOT_FOUND', 'file': rom}
170 
171         params = [self.get_executable(machine)]
172         rom_dir = os.path.dirname(rom)
173         params.append('-chdir')
174         params.append(rom_dir)
175         option_prefix = self.get_option_prefix(machine)
176 
177         if self.runner_config.get("fullscreen"):
178             params.append('-{}full'.format(option_prefix))
179 
180         if self.runner_config.get("double"):
181             params.append("-{}dsize".format(option_prefix))
182 
183         if self.runner_config.get('renderer'):
184             params.append('-sdl2renderer')
185             params.append(self.runner_config['renderer'])
186 
187         if not self.runner_config.get('aspect_ratio', True):
188             params.append('-sdlaspectmode')
189             params.append('0')
190 
191         if self.runner_config.get('drivesound'):
192             params.append('-drivesound')
193 
194         if self.runner_config.get("joy"):
195             for dev in range(self.get_joydevs(machine)):
196                 params += ["-joydev{}".format(dev + 1), "4"]
197         if rom.endswith('.crt'):
198             params.append('-cartgeneric')
199         params.append(rom)
200         return {'command': params}
201
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/lutris/runners/vice.py b/lutris/runners/vice.py
--- a/lutris/runners/vice.py
+++ b/lutris/runners/vice.py
@@ -159,6 +159,24 @@
         }
         return joydevs[machine]
 
+    def get_rom_args(self, machine, rom):
+        args = []
+
+        if rom.endswith('.crt'):
+            crt_option = {
+                'c64': "-cartcrt",
+                'c128': "-cartcrt",
+                'vic20': "-cartgeneric",
+                'pet': None,
+                'plus4': "-cart",
+                'cmbii': None,
+            }
+            if (crt_option[machine]):
+                args.append(crt_option[machine])
+
+        args.append(rom)
+        return args
+
     def play(self):
         machine = self.runner_config.get("machine")
 
@@ -194,7 +212,6 @@
         if self.runner_config.get("joy"):
             for dev in range(self.get_joydevs(machine)):
                 params += ["-joydev{}".format(dev + 1), "4"]
-        if rom.endswith('.crt'):
-            params.append('-cartgeneric')
-        params.append(rom)
+
+        params.extend(self.get_rom_args(machine, rom))
         return {'command': params}

{"golden_diff": "diff --git a/lutris/runners/vice.py b/lutris/runners/vice.py\n--- a/lutris/runners/vice.py\n+++ b/lutris/runners/vice.py\n@@ -159,6 +159,24 @@\n         }\n         return joydevs[machine]\n \n+    def get_rom_args(self, machine, rom):\n+        args = []\n+\n+        if rom.endswith('.crt'):\n+            crt_option = {\n+                'c64': \"-cartcrt\",\n+                'c128': \"-cartcrt\",\n+                'vic20': \"-cartgeneric\",\n+                'pet': None,\n+                'plus4': \"-cart\",\n+                'cmbii': None,\n+            }\n+            if (crt_option[machine]):\n+                args.append(crt_option[machine])\n+\n+        args.append(rom)\n+        return args\n+\n     def play(self):\n         machine = self.runner_config.get(\"machine\")\n \n@@ -194,7 +212,6 @@\n         if self.runner_config.get(\"joy\"):\n             for dev in range(self.get_joydevs(machine)):\n                 params += [\"-joydev{}\".format(dev + 1), \"4\"]\n-        if rom.endswith('.crt'):\n-            params.append('-cartgeneric')\n-        params.append(rom)\n+\n+        params.extend(self.get_rom_args(machine, rom))\n         return {'command': params}\n", "issue": "[vice] Plus/4 crt loading broken\nTried to load a game in crt format, but vice throws a error and exit:\r\n\r\n```\r\n:Launching Pirate Adventure: {'command': ['/home/user01/.local/share/lutris/runners/vice/bin/xplus4', '-chdir', '/Games/Romz/Commodore/plus4', '-TEDdsize', '-sdl2renderer', 'opengl', '-cartgeneric', '/Games/Romz/Commodore/plus4/Pirate Adventure.crt']}\r\nDEBUG    2017-03-10 10:26:58,891 [thread]:Command env: STEAM_RUNTIME=\"/home/user01/.local/share/lutris/runtime/steam\" LD_PRELOAD=\"\" SDL_VIDEO_FULLSCREEN_DISPLAY=\"off\" LD_LIBRARY_PATH=\"/home/user01/.local/share/lutris/runtime/lib32:/home/user01/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/i386/lib:/home/user01/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/i386/usr/lib:/home/user01/.local/share/lutris/runtime/lib64:/home/user01/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/amd64/lib:/home/user01/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/amd64/usr/lib:$LD_LIBRARY_PATH\" \r\nDEBUG    2017-03-10 10:26:58,891 [thread]:Running command: \"/home/user01/.local/share/lutris/runners/vice/bin/xplus4\" \"-chdir\" \"/Games/Romz/Commodore/plus4\" \"-TEDdsize\" \"-sdl2renderer\" \"opengl\" \"-cartgeneric\" \"/Games/Romz/Commodore/plus4/Pirate Adventure.crt\"\r\nDEBUG    2017-03-10 10:26:58,891 [thread]:Storing environment variable STEAM_RUNTIME to /home/user01/.local/share/lutris/runtime/steam\r\nDEBUG    2017-03-10 10:26:58,892 [thread]:Storing environment variable LD_PRELOAD to \r\nDEBUG    2017-03-10 10:26:58,892 [thread]:Storing environment variable SDL_VIDEO_FULLSCREEN_DISPLAY to off\r\nDEBUG    2017-03-10 10:26:58,893 [thread]:Storing environment variable LD_LIBRARY_PATH to /home/user01/.local/share/lutris/runtime/lib32:/home/user01/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/i386/lib:/home/user01/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/i386/usr/lib:/home/user01/.local/share/lutris/runtime/lib64:/home/user01/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/amd64/lib:/home/user01/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu:/home/user01/.local/share/lutris/runtime/steam/amd64/usr/lib:$LD_LIBRARY_PATH\r\nError - Default keymap not found, this should be fixed. Going on anyway...\r\nError - Default keymap not found, this should be fixed. Going on anyway...\r\nDetecting ISA HardSID boards.\r\nCould not open '/dev/port'.\r\nCannot get permission to access $300.\r\nDetecting PCI HardSID boards.\r\nNo PCI HardSID boards found.\r\nUnknown option '-cartgeneric'.\r\nError parsing command-line options, bailing out. For help use '-help'\r\nExiting...\r\n```\r\n\r\naccording to the -help it's just -cart for the plus/4\n", "before_files": [{"content": "import os\nfrom lutris import settings\nfrom lutris.util import system\nfrom lutris.util.log import logger\nfrom lutris.runners.runner import Runner\n\n\nclass vice(Runner):\n    description = \"Commodore Emulator\"\n    human_name = \"Vice\"\n    platforms = [\n        'Commodore 64',\n        'Commodore 128',\n        'Commodore VIC20',\n        'Commodore PET',\n        'Commodore Plus/4',\n        'Commodore CBM II',\n    ]\n\n    game_options = [{\n        \"option\": \"main_file\",\n        \"type\": \"file\",\n        \"label\": \"ROM file\",\n        'help': (\"The game data, commonly called a ROM image.\\n\"\n                 \"Supported formats: X64, D64, G64, P64, D67, D71, D81, \"\n                 \"D80, D82, D1M, D2M, D4M, T46, P00 and CRT.\")\n    }]\n\n    runner_options = [\n        {\n            \"option\": \"joy\",\n            \"type\": \"bool\",\n            \"label\": \"Use joysticks\",\n            'default': False,\n        },\n        {\n            \"option\": \"fullscreen\",\n            \"type\": \"bool\",\n            \"label\": \"Fullscreen\",\n            'default': False,\n        },\n        {\n            \"option\": \"double\",\n            \"type\": \"bool\",\n            \"label\": \"Scale up display by 2\",\n            'default': True,\n        },\n        {\n            'option': 'aspect_ratio',\n            'type': 'bool',\n            'label': 'Keep aspect ratio',\n            'default': True\n        },\n        {\n            'option': 'drivesound',\n            'type': 'bool',\n            'label': 'Enable sound emulation of disk drives',\n            'default': False\n        },\n        {\n            'option': 'renderer',\n            'type': 'choice',\n            'label': 'Graphics renderer',\n            'choices': [\n                ('OpenGL', 'opengl'),\n                ('Software', 'software')\n            ],\n            'default': 'opengl'\n        },\n        {\n            \"option\": \"machine\",\n            \"type\": \"choice\",\n            \"label\": \"Machine\",\n            \"choices\": [\n                (\"C64\", \"c64\"),\n                (\"C128\", \"c128\"),\n                (\"vic20\", \"vic20\"),\n                (\"PET\", \"pet\"),\n                (\"Plus/4\", \"plus4\"),\n                (\"CBM-II\", \"cbmii\")\n            ],\n            \"default\": \"c64\"\n        }\n    ]\n\n    def get_platform(self):\n        machine = self.game_config.get('machine')\n        if machine:\n            for index, choice in enumerate(self.machine_choices):\n                if choice[1] == machine:\n                    return self.platforms[index]\n        return ''\n\n    def get_executable(self, machine=None):\n        if not machine:\n            machine = \"c64\"\n        executables = {\n            \"c64\": \"x64\",\n            \"c128\": \"x128\",\n            \"vic20\": \"xvic\",\n            \"pet\": \"xpet\",\n            \"plus4\": \"xplus4\",\n            \"cbmii\": \"xcbm2\"\n        }\n        try:\n            executable = executables[machine]\n        except KeyError:\n            raise ValueError(\"Invalid machine '%s'\" % machine)\n        return os.path.join(settings.RUNNER_DIR, \"vice/bin/%s\" % executable)\n\n    def install(self, version=None, downloader=None, callback=None):\n        def on_runner_installed(*args):\n            config_path = system.create_folder('~/.vice')\n            lib_dir = os.path.join(settings.RUNNER_DIR, 'vice/lib/vice')\n            if not os.path.exists(lib_dir):\n                lib_dir = os.path.join(settings.RUNNER_DIR, 'vice/lib64/vice')\n            if not os.path.exists(lib_dir):\n                logger.error('Missing lib folder in the Vice runner')\n            else:\n                system.merge_folders(lib_dir, config_path)\n            if callback:\n                callback()\n\n        super(vice, self).install(version, downloader, on_runner_installed)\n\n    def get_roms_path(self, machine=None):\n        if not machine:\n            machine = \"c64\"\n        paths = {\n            \"c64\": \"C64\",\n            \"c128\": \"C128\",\n            \"vic20\": \"VIC20\",\n            \"pet\": \"PET\",\n            \"plus4\": \"PLUS4\",\n            \"cmbii\": \"CBM-II\"\n        }\n        root_dir = os.path.dirname(os.path.dirname(self.get_executable()))\n        return os.path.join(root_dir, 'lib64/vice', paths[machine])\n\n    def get_option_prefix(self, machine):\n        prefixes = {\n            'c64': 'VICII',\n            'c128': 'VICII',\n            'vic20': 'VIC',\n            'pet': 'CRTC',\n            'plus4': 'TED',\n            'cmbii': 'CRTC'\n        }\n        return prefixes[machine]\n\n    def get_joydevs(self, machine):\n        joydevs = {\n            'c64': 2,\n            'c128': 2,\n            'vic20': 1,\n            'pet': 0,\n            'plus4': 2,\n            'cmbii': 0\n        }\n        return joydevs[machine]\n\n    def play(self):\n        machine = self.runner_config.get(\"machine\")\n\n        rom = self.game_config.get('main_file')\n        if not rom:\n            return {'error': 'CUSTOM', 'text': 'No rom provided'}\n        if not os.path.exists(rom):\n            return {'error': 'FILE_NOT_FOUND', 'file': rom}\n\n        params = [self.get_executable(machine)]\n        rom_dir = os.path.dirname(rom)\n        params.append('-chdir')\n        params.append(rom_dir)\n        option_prefix = self.get_option_prefix(machine)\n\n        if self.runner_config.get(\"fullscreen\"):\n            params.append('-{}full'.format(option_prefix))\n\n        if self.runner_config.get(\"double\"):\n            params.append(\"-{}dsize\".format(option_prefix))\n\n        if self.runner_config.get('renderer'):\n            params.append('-sdl2renderer')\n            params.append(self.runner_config['renderer'])\n\n        if not self.runner_config.get('aspect_ratio', True):\n            params.append('-sdlaspectmode')\n            params.append('0')\n\n        if self.runner_config.get('drivesound'):\n            params.append('-drivesound')\n\n        if self.runner_config.get(\"joy\"):\n            for dev in range(self.get_joydevs(machine)):\n                params += [\"-joydev{}\".format(dev + 1), \"4\"]\n        if rom.endswith('.crt'):\n            params.append('-cartgeneric')\n        params.append(rom)\n        return {'command': params}\n", "path": "lutris/runners/vice.py"}], "after_files": [{"content": "import os\nfrom lutris import settings\nfrom lutris.util import system\nfrom lutris.util.log import logger\nfrom lutris.runners.runner import Runner\n\n\nclass vice(Runner):\n    description = \"Commodore Emulator\"\n    human_name = \"Vice\"\n    platforms = [\n        'Commodore 64',\n        'Commodore 128',\n        'Commodore VIC20',\n        'Commodore PET',\n        'Commodore Plus/4',\n        'Commodore CBM II',\n    ]\n\n    game_options = [{\n        \"option\": \"main_file\",\n        \"type\": \"file\",\n        \"label\": \"ROM file\",\n        'help': (\"The game data, commonly called a ROM image.\\n\"\n                 \"Supported formats: X64, D64, G64, P64, D67, D71, D81, \"\n                 \"D80, D82, D1M, D2M, D4M, T46, P00 and CRT.\")\n    }]\n\n    runner_options = [\n        {\n            \"option\": \"joy\",\n            \"type\": \"bool\",\n            \"label\": \"Use joysticks\",\n            'default': False,\n        },\n        {\n            \"option\": \"fullscreen\",\n            \"type\": \"bool\",\n            \"label\": \"Fullscreen\",\n            'default': False,\n        },\n        {\n            \"option\": \"double\",\n            \"type\": \"bool\",\n            \"label\": \"Scale up display by 2\",\n            'default': True,\n        },\n        {\n            'option': 'aspect_ratio',\n            'type': 'bool',\n            'label': 'Keep aspect ratio',\n            'default': True\n        },\n        {\n            'option': 'drivesound',\n            'type': 'bool',\n            'label': 'Enable sound emulation of disk drives',\n            'default': False\n        },\n        {\n            'option': 'renderer',\n            'type': 'choice',\n            'label': 'Graphics renderer',\n            'choices': [\n                ('OpenGL', 'opengl'),\n                ('Software', 'software')\n            ],\n            'default': 'opengl'\n        },\n        {\n            \"option\": \"machine\",\n            \"type\": \"choice\",\n            \"label\": \"Machine\",\n            \"choices\": [\n                (\"C64\", \"c64\"),\n                (\"C128\", \"c128\"),\n                (\"vic20\", \"vic20\"),\n                (\"PET\", \"pet\"),\n                (\"Plus/4\", \"plus4\"),\n                (\"CBM-II\", \"cbmii\")\n            ],\n            \"default\": \"c64\"\n        }\n    ]\n\n    def get_platform(self):\n        machine = self.game_config.get('machine')\n        if machine:\n            for index, choice in enumerate(self.machine_choices):\n                if choice[1] == machine:\n                    return self.platforms[index]\n        return ''\n\n    def get_executable(self, machine=None):\n        if not machine:\n            machine = \"c64\"\n        executables = {\n            \"c64\": \"x64\",\n            \"c128\": \"x128\",\n            \"vic20\": \"xvic\",\n            \"pet\": \"xpet\",\n            \"plus4\": \"xplus4\",\n            \"cbmii\": \"xcbm2\"\n        }\n        try:\n            executable = executables[machine]\n        except KeyError:\n            raise ValueError(\"Invalid machine '%s'\" % machine)\n        return os.path.join(settings.RUNNER_DIR, \"vice/bin/%s\" % executable)\n\n    def install(self, version=None, downloader=None, callback=None):\n        def on_runner_installed(*args):\n            config_path = system.create_folder('~/.vice')\n            lib_dir = os.path.join(settings.RUNNER_DIR, 'vice/lib/vice')\n            if not os.path.exists(lib_dir):\n                lib_dir = os.path.join(settings.RUNNER_DIR, 'vice/lib64/vice')\n            if not os.path.exists(lib_dir):\n                logger.error('Missing lib folder in the Vice runner')\n            else:\n                system.merge_folders(lib_dir, config_path)\n            if callback:\n                callback()\n\n        super(vice, self).install(version, downloader, on_runner_installed)\n\n    def get_roms_path(self, machine=None):\n        if not machine:\n            machine = \"c64\"\n        paths = {\n            \"c64\": \"C64\",\n            \"c128\": \"C128\",\n            \"vic20\": \"VIC20\",\n            \"pet\": \"PET\",\n            \"plus4\": \"PLUS4\",\n            \"cmbii\": \"CBM-II\"\n        }\n        root_dir = os.path.dirname(os.path.dirname(self.get_executable()))\n        return os.path.join(root_dir, 'lib64/vice', paths[machine])\n\n    def get_option_prefix(self, machine):\n        prefixes = {\n            'c64': 'VICII',\n            'c128': 'VICII',\n            'vic20': 'VIC',\n            'pet': 'CRTC',\n            'plus4': 'TED',\n            'cmbii': 'CRTC'\n        }\n        return prefixes[machine]\n\n    def get_joydevs(self, machine):\n        joydevs = {\n            'c64': 2,\n            'c128': 2,\n            'vic20': 1,\n            'pet': 0,\n            'plus4': 2,\n            'cmbii': 0\n        }\n        return joydevs[machine]\n\n    def get_rom_args(self, machine, rom):\n        args = []\n\n        if rom.endswith('.crt'):\n            crt_option = {\n                'c64': \"-cartcrt\",\n                'c128': \"-cartcrt\",\n                'vic20': \"-cartgeneric\",\n                'pet': None,\n                'plus4': \"-cart\",\n                'cmbii': None,\n            }\n            if (crt_option[machine]):\n                args.append(crt_option[machine])\n\n        args.append(rom)\n        return args\n\n    def play(self):\n        machine = self.runner_config.get(\"machine\")\n\n        rom = self.game_config.get('main_file')\n        if not rom:\n            return {'error': 'CUSTOM', 'text': 'No rom provided'}\n        if not os.path.exists(rom):\n            return {'error': 'FILE_NOT_FOUND', 'file': rom}\n\n        params = [self.get_executable(machine)]\n        rom_dir = os.path.dirname(rom)\n        params.append('-chdir')\n        params.append(rom_dir)\n        option_prefix = self.get_option_prefix(machine)\n\n        if self.runner_config.get(\"fullscreen\"):\n            params.append('-{}full'.format(option_prefix))\n\n        if self.runner_config.get(\"double\"):\n            params.append(\"-{}dsize\".format(option_prefix))\n\n        if self.runner_config.get('renderer'):\n            params.append('-sdl2renderer')\n            params.append(self.runner_config['renderer'])\n\n        if not self.runner_config.get('aspect_ratio', True):\n            params.append('-sdlaspectmode')\n            params.append('0')\n\n        if self.runner_config.get('drivesound'):\n            params.append('-drivesound')\n\n        if self.runner_config.get(\"joy\"):\n            for dev in range(self.get_joydevs(machine)):\n                params += [\"-joydev{}\".format(dev + 1), \"4\"]\n\n        params.extend(self.get_rom_args(machine, rom))\n        return {'command': params}\n", "path": "lutris/runners/vice.py"}]}