Skip to content

Commit

Permalink
fixed umu shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
moraroy authored Jan 12, 2025
1 parent 41dee33 commit a7de732
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions NSLGameScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a7de732

Please sign in to comment.