fixed umu shortcuts

This commit is contained in:
Roy 2025-01-11 23:42:07 -08:00 committed by GitHub
parent 41dee335a8
commit a7de732b02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -569,7 +569,7 @@ def extract_base_path(launchoptions):
return match.group(1)
raise ValueError("STEAM_COMPAT_DATA_PATH not found in launch options")
def modify_shortcut_for_umu(appname, exe, launchoptions, startingdir):
def modify_shortcut_for_umu(appname, exe, launchoptions, startingdir, logged_in_home, compat_tool_name):
# Skip processing if STEAM_COMPAT_DATA_PATH is not present
if 'STEAM_COMPAT_DATA_PATH=' not in launchoptions:
print(f"Launch options for {appname} do not contain STEAM_COMPAT_DATA_PATH. Skipping modification.")
@ -618,14 +618,26 @@ def modify_shortcut_for_umu(appname, exe, launchoptions, startingdir):
elif "/command=runGame /gameId=" in launchoptions:
updated_launch = f'/command=runGame /gameId={codename} /path={launchoptions.split("/path=")[1]}'
# Ensure the first STEAM_COMPAT_DATA_PATH is included and avoid adding it again
if 'STEAM_COMPAT_DATA_PATH=' in updated_launch:
# Remove the existing STEAM_COMPAT_DATA_PATH if it exists in the launch options
updated_launch = re.sub(r'STEAM_COMPAT_DATA_PATH="[^"]+" ', '', updated_launch)
# Always include the first STEAM_COMPAT_DATA_PATH at the start
new_launch_options = (
f'STEAM_COMPAT_DATA_PATH="{base_path}" '
f'WINEPREFIX="{base_path}pfx" '
f'GAMEID="{umu_id}" '
f'PROTONPATH="{logged_in_home}/.steam/root/compatibilitytools.d/{compat_tool_name}" '
f'%command% {updated_launch}'
)
# Check if %command% is already in the launch options
if '%command%' not in updated_launch:
updated_launch = f'%command% {updated_launch}'
# Final new launch options
new_launch_options += updated_launch
umu_processed_shortcuts[umu_id] = True
return new_exe, new_start_dir, new_launch_options