|
3 | 3 | import shutil |
4 | 4 | import logging |
5 | 5 | from config_manager import ConfigManager |
6 | | - |
7 | 6 | class GameManager: |
8 | 7 | def __init__(self, proton_manager): |
9 | 8 | self.proton_manager = proton_manager |
10 | 9 | self.config_manager = ConfigManager() |
11 | | - |
12 | 10 | def add_game(self, game): |
13 | 11 | games = self.config_manager.load_games() |
14 | 12 | games.append(game) |
15 | 13 | self.config_manager.save_games(games) |
16 | 14 | logging.info(f"Added game: {game['name']}") |
17 | | - |
18 | 15 | def remove_game(self, name): |
19 | 16 | games = self.config_manager.load_games() |
20 | 17 | games = [g for g in games if g['name'] != name] |
21 | 18 | self.config_manager.save_games(games) |
22 | 19 | logging.info(f"Removed game: {name}") |
23 | | - |
24 | 20 | def launch_game(self, game, gamescope=False): |
25 | 21 | runner = game['runner'] |
26 | 22 | exe = game['exe'] |
@@ -109,13 +105,13 @@ def launch_game(self, game, gamescope=False): |
109 | 105 | cmd.extend(['steam', '-applaunch', app_id] + launch_options) |
110 | 106 | else: |
111 | 107 | raise Exception("Steam or Flatpak not installed. Please install Steam (e.g., flatpak install flathub com.valvesoftware.Steam).") |
112 | | - else: # Proton |
| 108 | + else: # Proton |
113 | 109 | proton_bin = self.proton_manager.get_proton_path(runner) |
114 | 110 | if not os.path.exists(proton_bin): |
115 | 111 | raise Exception(f"Proton binary not found for {runner}") |
116 | 112 | # Set up Steam environment for Proton |
117 | 113 | steam_dir = os.path.expanduser('~/.local/share/Steam') |
118 | | - os.makedirs(os.path.join(steam_dir, 'steamapps/compatdata'), exist_ok=True) # Ensure Steam structure |
| 114 | + os.makedirs(os.path.join(steam_dir, 'steamapps/compatdata'), exist_ok=True) # Ensure Steam structure |
119 | 115 | env['STEAM_COMPAT_CLIENT_INSTALL_PATH'] = steam_dir |
120 | 116 | env['STEAM_COMPAT_DATA_PATH'] = prefix |
121 | 117 | env['STEAM_RUNTIME'] = os.path.join(steam_dir, 'ubuntu12_32/steam-runtime') |
|
0 commit comments