Repository: lutris/lutris

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


Discussion:

Resolving patch:
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 @@ def get_joydevs(self, machine):
         }
         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 @@ def play(self):
         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}


Test patch: