-
Notifications
You must be signed in to change notification settings - Fork 0
Game Wrapper (sdy)
This page outlines the execution wrapper responsible for process interception and dynamic environment injection.
When sdy %command% is executed, the script performs a hierarchical search for a configuration profile in ~/.config/steamos_diy/games.d/:
-
Steam AppID: If
SteamAppIdis present, it scans YAML files for a matchingSTEAM_APPIDorSDY_ID. -
Path-Based Discovery (Climbing Logic): If no ID matches,
sdyidentifies the executable path and performs an upward search (up to 3 directory levels). It attempts to match:- The executable filename (e.g.,
Cyberpunk2077.yaml). - The parent directory name (to handle generic launchers like
start.exe).
- The executable filename (e.g.,
-
Exclusion: The engine automatically ignores common system/bin folders (
bin,x64,common) during the search.
sdy.py merges configurations using a cascading priority system. Values defined at lower levels are overridden by higher levels:
-
System Defaults:
/etc/default/steamos_diy.conf -
Global User Manifesto:
~/.config/steamos_diy/config.yaml -
Game-Specific Profile:
.yamlfile found ingames.d/.
| Key | Type | Description |
|---|---|---|
GAME_WRAPPER |
Execution Prefix | Prepended to the command (e.g., gamemoderun). |
GAME_EXTRA_ARGS |
Flags | Appended to the end of the command. |
env_vars |
Dictionary | Environment variables injected into the process. |
To maintain a clean process tree, sdy uses os.execvpe. The launcher process is replaced by the game process, ensuring that the GAME_WRAPPER becomes the direct parent of the game.
# Construction of the final command list
full_cmd = shlex.split(str(wrapper)) if wrapper else []
full_cmd.extend(raw_args)
if extra:
full_cmd.extend(shlex.split(str(extra)))
# Process replacement
os.execvpe(executable, full_cmd, os.environ)YAML Resilience: If a game-specific YAML contains syntax errors, load_yaml_safe catches the exception, logs a YAML_PARSE_ERR, and defaults to the global configuration, ensuring the game launches regardless of profile corruption.
To enable the wrapper for any game:
-
Right-click the game in Steam โ Properties.
-
In Launch Options, paste:
sdy %command%
To verify if sdy has correctly identified your game and applied the right config, check the centralized log via the Control Center or the system journal.
Real-world Log Example:
STEAM: Profile via AppID [1091500] -> cyberpunk.yaml
STEAM: EXEC: mangohud gamemoderun Cyberpunk2077...
| Log Component | Description |
|---|---|
STEAM |
The primary tag for game discovery and launch events. |
Profile via AppID |
Indicates a successful match using the Steam AppID. |
Profile Loaded by Name |
Indicates a match found via Executable or Folder name climbing. |
EXEC |
Shows the final command being executed, including wrappers and extra arguments. |
Tip
If a profile is not found after the 3-level directory climb, the script will skip the "Profile Loaded" message and proceed using only the global environment variables defined in config.yaml.
If you love this project, feel free to join and help me make it better!