Create installer for Dolphin games

This commit is contained in:
Mathieu Comandon 2021-03-15 19:28:46 -07:00
parent c92fd562cc
commit 6f89bbe0fd
3 changed files with 22 additions and 2 deletions

View file

@ -24,6 +24,7 @@ class BaseService(GObject.Object):
name = NotImplemented
icon = NotImplemented
online = False
local = False
medias = {}
default_format = "icon"

View file

@ -1,4 +1,5 @@
import os
import json
from gettext import gettext as _
from lutris import settings
@ -22,6 +23,7 @@ class DolphinService(BaseService):
id = "dolphin"
icon = "dolphin"
name = _("Dolphin")
local = True
medias = {
"icon": DolphinBanner
}
@ -37,11 +39,27 @@ class DolphinService(BaseService):
self.emit("service-games-loaded")
return dolphin_games
def generate_installer(self, db_game):
details = json.loads(db_game["details"])
return {
"name": db_game["name"],
"version": "Dolphin",
"slug": db_game["slug"],
"game_slug": slugify(db_game["name"]),
"runner": "dolphin",
"script": {
"game": {
"main_file": details["path"],
},
}
}
class DolphinGame(ServiceGame):
"""Game for the Dolphin emulator"""
service = "dolphin"
runner = "dolphin"
installer_slug = "dolphin"
@classmethod
@ -50,8 +68,9 @@ class DolphinGame(ServiceGame):
service_game = cls()
service_game.name = cls.get_game_name(cache_entry)
service_game.appid = str(cache_entry["code_1"])
service_game.slug = slugify(cache_entry["name_long"])
service_game.slug = slugify(cls.get_game_name(cache_entry))
service_game.icon = ""
service_game.details = json.dumps({"path": cache_entry["path"]})
return service_game
@staticmethod

View file

@ -40,6 +40,7 @@ class XDGService(BaseService):
name = _("Local")
icon = "linux"
online = False
local = True
medias = {
"icon": XDGMedia
}
@ -141,7 +142,6 @@ class XDGGame(ServiceGame):
service_game.icon = cls.get_app_icon(xdg_app)
service_game.appid = get_appid(xdg_app)
service_game.slug = cls.get_slug(xdg_app)
service_game.runner = "linux"
exe, args = cls.get_command_args(xdg_app)
service_game.details = json.dumps({
"exe": exe,