Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SteamTinkerLaunch Source #119

Merged
merged 4 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions pupgui2/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
break

POSSIBLE_INSTALL_LOCATIONS = [
{'install_dir': _STEAM_ROOT + '/compatibilitytools.d/', 'display_name': 'Steam', 'launcher': 'steam', 'icon': 'steam', 'vdf_dir': _STEAM_ROOT + '/config'},
{'install_dir': '~/.var/app/com.valvesoftware.Steam/data/Steam/compatibilitytools.d/', 'display_name': 'Steam Flatpak', 'launcher': 'steam', 'icon': 'steam'},
{'install_dir': '~/snap/steam/common/.steam/root/compatibilitytools.d/', 'display_name': 'Steam Snap', 'launcher': 'steam', 'icon': 'steam', 'vdf_dir': '~/snap/steam/common/.steam/root/config'},
{'install_dir': '~/.local/share/lutris/runners/wine/', 'display_name': 'Lutris', 'launcher': 'lutris', 'icon': 'lutris', 'config_dir': '~/.config/lutris'},
{'install_dir': '~/.var/app/net.lutris.Lutris/data/lutris/runners/wine/', 'display_name': 'Lutris Flatpak', 'launcher': 'lutris', 'icon': 'lutris', 'config_dir': '~/.var/app/net.lutris.Lutris/config/lutris'},
{'install_dir': '~/.config/heroic/tools/wine/', 'display_name': 'Heroic Wine', 'launcher': 'heroicwine', 'icon': 'heroic'},
{'install_dir': '~/.config/heroic/tools/proton/', 'display_name': 'Heroic Proton', 'launcher': 'heroicproton', 'icon': 'heroic'},
{'install_dir': '~/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/', 'display_name': 'Heroic Wine Flatpak', 'launcher': 'heroicwine', 'icon': 'heroic'},
{'install_dir': '~/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/proton/', 'display_name': 'Heroic Proton Flatpak', 'launcher': 'heroicproton', 'icon': 'heroic'},
{'install_dir': '~/.local/share/bottles/runners/', 'display_name': 'Bottles', 'launcher': 'bottles', 'icon': 'com.usebottles.bottles'},
{'install_dir': '~/.var/app/com.usebottles.bottles/data/bottles/runners/', 'display_name': 'Bottles Flatpak', 'launcher': 'bottles', 'icon': 'com.usebottles.bottles'}
{'install_dir': _STEAM_ROOT + '/compatibilitytools.d/', 'display_name': 'Steam', 'launcher': 'steam', 'type': 'native', 'icon': 'steam', 'vdf_dir': _STEAM_ROOT + '/config'},
{'install_dir': '~/.var/app/com.valvesoftware.Steam/data/Steam/compatibilitytools.d/', 'display_name': 'Steam Flatpak', 'launcher': 'steam', 'type': 'flatpak', 'icon': 'steam'},
{'install_dir': '~/snap/steam/common/.steam/root/compatibilitytools.d/', 'display_name': 'Steam Snap', 'launcher': 'steam', 'type': 'snap', 'icon': 'steam', 'vdf_dir': '~/snap/steam/common/.steam/root/config'},
{'install_dir': '~/.local/share/lutris/runners/wine/', 'display_name': 'Lutris', 'launcher': 'lutris', 'type': 'native', 'icon': 'lutris', 'config_dir': '~/.config/lutris'},
{'install_dir': '~/.var/app/net.lutris.Lutris/data/lutris/runners/wine/', 'display_name': 'Lutris Flatpak', 'launcher': 'lutris', 'type': 'flatpak', 'icon': 'lutris', 'config_dir': '~/.var/app/net.lutris.Lutris/config/lutris'},
{'install_dir': '~/.config/heroic/tools/wine/', 'display_name': 'Heroic Wine', 'launcher': 'heroicwine', 'type': 'native', 'icon': 'heroic'},
{'install_dir': '~/.config/heroic/tools/proton/', 'display_name': 'Heroic Proton', 'launcher': 'heroicproton', 'type': 'native', 'icon': 'heroic'},
{'install_dir': '~/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/', 'display_name': 'Heroic Wine Flatpak', 'launcher': 'heroicwine', 'type': 'flatpak', 'icon': 'heroic'},
{'install_dir': '~/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/proton/', 'display_name': 'Heroic Proton Flatpak', 'launcher': 'heroicproton', 'type': 'flatpak', 'icon': 'heroic'},
{'install_dir': '~/.local/share/bottles/runners/', 'display_name': 'Bottles', 'launcher': 'bottles', 'type': 'native', 'icon': 'com.usebottles.bottles'},
{'install_dir': '~/.var/app/com.usebottles.bottles/data/bottles/runners/', 'display_name': 'Bottles Flatpak', 'launcher': 'bottles', 'type': 'flatpak', 'icon': 'com.usebottles.bottles'}
]

def PALETTE_DARK():
Expand Down Expand Up @@ -65,3 +65,9 @@ def PALETTE_DARK():

STEAM_BOXTRON_FLATPAK_APPSTREAM = 'appstream://com.valvesoftware.Steam.CompatibilityTool.Boxtron'
STEAM_PROTONGE_FLATPAK_APPSTREAM = 'appstream://com.valvesoftware.Steam.CompatibilityTool.Proton-GE'
STEAM_STL_FLATPAK_APPSTREAM = 'appstream://com.valvesoftware.Steam.Utility.steamtinkerlaunch'

STEAM_STL_INSTALL_PATH = os.path.join(os.path.expanduser('~'), 'stl')
STEAM_STL_CONFIG_PATH = os.path.join(os.path.expanduser('~'), '.config', 'steamtinkerlaunch')
STEAM_STL_SHELL_FILES = [ '.bashrc', '.zshrc', '.kshrc' ]
STEAM_STL_FISH_VARIABLES = os.path.join(os.path.expanduser('~'), '.config/fish/fish_variables')
4 changes: 3 additions & 1 deletion pupgui2/ctloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ def get_ctobjs(self, launcher=None, advanced_mode=True):

ctobjs = []
for ctobj in self.ctobjs:
if launcher in ctobj['launchers']:
if launcher.get('launcher') in ctobj['launchers']:
if 'advmode' in ctobj['launchers'] and not advanced_mode:
continue
if 'native-only' in ctobj['launchers'] and not launcher.get('type') == 'native':
continue
ctobjs.append(ctobj)
return ctobjs
14 changes: 14 additions & 0 deletions pupgui2/datastructures.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enum import Enum
import os
import vdf
import yaml


Expand Down Expand Up @@ -83,6 +84,19 @@ def get_displayname(self, unused_tr='unused') -> str:
displayname += ' (' + unused_tr + ')'
return displayname

def get_internal_name(self) -> str:
"""
Returns the internal name if available, e.g. Proton-stl.
If unavailable, returns the displayname
"""
compat_tool_vdf_path = os.path.join(self.install_dir, self.install_folder, 'compatibilitytool.vdf')
if os.path.exists(compat_tool_vdf_path):
compat_tool_vdf = vdf.load(open(compat_tool_vdf_path))
if 'compatibilitytools' in compat_tool_vdf and 'compat_tools' in compat_tool_vdf['compatibilitytools']:
return list(compat_tool_vdf['compatibilitytools']['compat_tools'].keys())[0]

return self.displayname

def get_install_dir(self) -> str:
""" Returns the install directory, e.g. .../compatibilitytools.d/ """
return os.path.normpath(self.install_dir)
Expand Down
9 changes: 7 additions & 2 deletions pupgui2/pupgui2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .util import single_instance
from .util import download_awacy_gamelist
from .constants import APP_NAME, APP_VERSION, BUILD_INFO, TEMP_DIR
from .constants import STEAM_PROTONGE_FLATPAK_APPSTREAM, STEAM_BOXTRON_FLATPAK_APPSTREAM
from .constants import STEAM_PROTONGE_FLATPAK_APPSTREAM, STEAM_BOXTRON_FLATPAK_APPSTREAM, STEAM_STL_FLATPAK_APPSTREAM
from . import ctloader
from .pupgui2installdialog import PupguiInstallDialog
from .pupgui2aboutdialog import PupguiAboutDialog
Expand Down Expand Up @@ -167,7 +167,7 @@ def update_ui(self):
get_steam_game_list(install_loc.get('vdf_dir'), cached=False) # update app list cache
self.compat_tool_index_map += get_steam_acruntime_list(install_loc.get('vdf_dir'), cached=True)
for ct in self.compat_tool_index_map:
games = get_steam_game_list(install_loc.get('vdf_dir'), ct.get_install_folder(), cached=True)
games = get_steam_game_list(install_loc.get('vdf_dir'), ct.get_internal_name(), cached=True)
ct.no_games = len(games)

for ct in self.compat_tool_index_map:
Expand Down Expand Up @@ -224,6 +224,8 @@ def set_download_progress_percent(self, value):
self.ui.statusBar().showMessage(self.tr('Downloading {current_compat_tool_name}...').format(current_compat_tool_name=self.current_compat_tool_name))
elif value == 99:
self.ui.statusBar().showMessage(self.tr('Extracting {current_compat_tool_name}...').format(current_compat_tool_name=self.current_compat_tool_name))
elif value == 99.5:
self.ui.statusBar().showMessage(self.tr('Installing {current_compat_tool_name}...').format(current_compat_tool_name=self.current_compat_tool_name))
elif value == 100:
self.ui.statusBar().showMessage(self.tr('Installed {current_compat_tool_name}.').format(current_compat_tool_name=self.current_compat_tool_name))
self.update_ui()
Expand Down Expand Up @@ -329,13 +331,16 @@ def btn_steam_flatpak_ctools_clicked(self):
lbl_description = QLabel(self.tr('Click to open your app store'))
btn_dl_protonge = QPushButton('Proton-GE')
btn_dl_boxtron = QPushButton('Boxtron')
btn_dl_stl = QPushButton('Steam Tinker Launch')
layout1 = QVBoxLayout()
layout1.addWidget(lbl_description)
layout1.addWidget(btn_dl_protonge)
layout1.addWidget(btn_dl_boxtron)
layout1.addWidget(btn_dl_stl)
iftdialog.setLayout(layout1)
btn_dl_protonge.clicked.connect(lambda: os.system('xdg-open ' + STEAM_PROTONGE_FLATPAK_APPSTREAM))
btn_dl_boxtron.clicked.connect(lambda: os.system('xdg-open ' + STEAM_BOXTRON_FLATPAK_APPSTREAM))
btn_dl_stl.clicked.connect(lambda: os.system('xdg-open ' + STEAM_STL_FLATPAK_APPSTREAM))
iftdialog.show()

def press_virtual_key(self, key, mod):
Expand Down
2 changes: 1 addition & 1 deletion pupgui2/pupgui2ctinfodialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def setup_ui(self):

def update_game_list_steam(self):
if self.install_loc.get('launcher') == 'steam' and 'vdf_dir' in self.install_loc:
self.games = get_steam_game_list(self.install_loc.get('vdf_dir'), self.ctool.displayname)
self.games = get_steam_game_list(self.install_loc.get('vdf_dir'), self.ctool.get_internal_name())
self.ui.txtNumGamesUsingTool.setText(str(len(self.games)))

self.ui.listGames.clear()
Expand Down
2 changes: 1 addition & 1 deletion pupgui2/pupgui2gamelistdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def setup_ui(self):
def update_game_list_steam(self):
""" update the game list for the Steam launcher """
games = get_steam_game_list(steam_config_folder=self.install_loc.get('vdf_dir'))
ctools = sort_compatibility_tool_names(list_installed_ctools(self.install_dir, without_version=True), reverse=True)
ctools = [c if c != 'SteamTinkerLaunch' else 'Proton-stl' for c in sort_compatibility_tool_names(list_installed_ctools(self.install_dir, without_version=True), reverse=True) ]
for t in get_steam_ctool_list(steam_config_folder=self.install_loc.get('vdf_dir')):
ctools.append(t.ctool_name)

Expand Down
2 changes: 1 addition & 1 deletion pupgui2/pupgui2installdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, install_location, ct_loader, parent=None):
super(PupguiInstallDialog, self).__init__(parent)
self.install_location = install_location
advanced_mode = (config_advanced_mode() == 'enabled')
self.ct_objs = ct_loader.get_ctobjs(self.install_location['launcher'], advanced_mode=advanced_mode)
self.ct_objs = ct_loader.get_ctobjs(self.install_location, advanced_mode=advanced_mode)

def setup_ui(self):
self.setWindowTitle(self.tr('Install Compatibility Tool'))
Expand Down
Loading