Skip to content

Commit 6ea0851

Browse files
authored
Update game_manager.py
1 parent e02df1b commit 6ea0851

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

source-code/game_manager.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ def launch_game(self, game, gamescope=False):
2727
app_id = game.get('app_id', '')
2828
prefix = game.get('prefix', '')
2929
launch_options = game.get('launch_options', '').split()
30+
fps_limit = game.get('fps_limit', '')
3031
env = os.environ.copy()
31-
3232
# Validate inputs
3333
if runner != 'Steam' and not os.path.exists(exe):
3434
raise Exception(f"Executable does not exist: {exe}")
3535
if runner == 'Steam' and not app_id:
3636
raise Exception("Steam App ID not set")
37-
3837
# Set up environment for Wine/Proton
3938
if runner in ['Wine'] or 'Proton' in runner:
4039
if not prefix:
@@ -57,7 +56,6 @@ def launch_game(self, game, gamescope=False):
5756
env['WINEESYNC'] = '1' if game.get('enable_esync', self.config_manager.settings['enable_esync']) else '0'
5857
env['WINEFSYNC'] = '1' if game.get('enable_fsync', self.config_manager.settings['enable_fsync']) else '0'
5958
env['DXVK_ASYNC'] = '1' if game.get('enable_dxvk_async', self.config_manager.settings['enable_dxvk_async']) else '0'
60-
6159
# Build command
6260
cmd = []
6361
if gamescope:
@@ -87,10 +85,12 @@ def launch_game(self, game, gamescope=False):
8785
if '--bigpicture' in launch_options:
8886
cmd.extend(['-e', '-f'])
8987
options_to_remove.append('--bigpicture')
88+
if fps_limit:
89+
cmd.append('-r')
90+
cmd.append(str(fps_limit))
9091
# Remove processed options
9192
launch_options = [opt for opt in launch_options if opt not in options_to_remove]
9293
cmd.append('--')
93-
9494
try:
9595
if runner == 'Native':
9696
cmd.extend([exe] + launch_options)
@@ -115,14 +115,13 @@ def launch_game(self, game, gamescope=False):
115115
raise Exception(f"Proton binary not found for {runner}")
116116
# Set up Steam environment for Proton
117117
steam_dir = os.path.expanduser('~/.local/share/Steam')
118-
os.makedirs(os.path.join(steam_dir, 'steamapps/compatdata'), exist_ok=True)
118+
os.makedirs(os.path.join(steam_dir, 'steamapps/compatdata'), exist_ok=True) # Ensure Steam structure
119119
env['STEAM_COMPAT_CLIENT_INSTALL_PATH'] = steam_dir
120120
env['STEAM_COMPAT_DATA_PATH'] = prefix
121121
env['STEAM_RUNTIME'] = os.path.join(steam_dir, 'ubuntu12_32/steam-runtime')
122122
ld_library_path = os.path.join(steam_dir, 'ubuntu12_32') + ':' + os.path.join(steam_dir, 'ubuntu12_64')
123123
env['LD_LIBRARY_PATH'] = ld_library_path + ':' + env.get('LD_LIBRARY_PATH', '')
124124
cmd.extend([proton_bin, 'waitforexitandrun', exe] + launch_options)
125-
126125
# Execute command
127126
log_file = os.path.join(self.config_manager.logs_dir, f"{game['name'].replace(' ', '_')}.log")
128127
with open(log_file, 'w') as f:

0 commit comments

Comments
 (0)