Skip to content
Distracted-E421Public

About

A fork and Zig rewrite of SteamTinkerLaunch with the addition of first class NixOS support :)

Resources

Stars

8 stars

Watchers

2 watching

Forks

Latest commit

ย 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

STL-Next: Steam Tinker Launch - Next Generation

License: MIT Zig NixOS

A high-performance Steam game wrapper written in Zig, hoping to replace the original SteamTinkerLaunch.

๐ŸŽฏ Why This Fork Exists

The original SteamTinkerLaunch has (at the time of writing) has been inactive for over 6 months, and the orginal maintainer does not have the access that they used to

There are also several critical bugs that make certain things/games unplayable. The one that got me and pushed me to fork was this one:

# The Bug: Wine interprets "/" as command switches!
# What STL sends to Vortex:
nxm://stardewvalley/collections/tckf0m/revisions/100

# What Vortex actually receives (TRUNCATED!):
nxm://stardewvalley/collections/tckf0m
# Error: "Invalid URL: invalid nxm url"

STL-Next fixes this with proper URL encoding:

$ ./stl-next nxm "nxm://stardewvalley/collections/tckf0m/revisions/100"
  Parsed: Collection: stardewvalley/collections/tckf0m/revisions/100
  Wine-safe: nxm://stardewvalley%2Fcollections%2Ftckf0m%2Frevisions%2F100
  # /revisions/100 PRESERVED! โœ…

See: STL_URL_TRUNCATION_BUG_REPORT.md

Additionally, if you look at the code for the orginal STL (and this is not shade, hate, or anything at the original dev or any maintainers, love yall <3), its a brittle, terrifing, 30,000 plus lines of bash. and thats after they did a modular rewrite from a 21,000 line monolit bash script. Bash is great, but not here, where all that overhead is causing it to take a while to start up, or complete actions. Again, this is not shade to past development, I am greatful for the projects very existence, as it has given me a create conceptual base to work from.

While it is def overkill, I have decided to do this rewrite in Zig, to get as small as possible as a binary, as well as if there is any c interop issues with the edge cases like vr, dos games, cross platform stuff, mod managers, winetricks, etc etc.

๐Ÿ“Š Project Status

Phase Status Description
Phase 1 โœ… Complete Core CLI, VDF text parsing, Steam discovery
Phase 2 โœ… Complete Binary VDF streaming, fast AppID seeking
Phase 3 โœ… Complete Tinker modules (MangoHud, Gamescope, GameMode)
Phase 3.5 โœ… Complete Launch Options, JSON parsing, exec(), tests
Phase 4 โœ… Complete IPC Daemon, Wait Requester, NXM Handler, TUI
Phase 4.5 โœ… Complete Winetricks, Custom Commands, Non-Steam Games, SteamGridDB
Phase 5 โœ… Complete Nix Flake Packaging, NixOS/Home Manager Modules
Phase 5.5 โœ… Complete Raylib GUI - Modern Wait Requester
Phase 5.6 โœ… Complete Vortex Integration - Auto-discovery, NXM forwarding
Phase 5.7 โœ… Complete Nexus Mods API - Full v1 client, tracking, Premium downloads
Phase 6 โœ… Complete 14 Tinkers: ReShade, vkBasalt, SpecialK, LatencyFleX, MultiApp, Boxtron, OBS, DLSS, OptiScaler
Phase 7 โœ… Complete Stardrop Integration + Nexus Collections Import (KILLER FEATURE!)
Phase 8 โœ… Complete D-Bus Integration (Multi-GPU!), GPU Selection, Session Management
Phase 8.5 โœ… Complete Launch Profiles - Per-game GPU/Monitor presets, Steam Shortcuts
Phase 9 ๐Ÿ“‹ Planned Full MO2 USVFS, VR support, Steam Deck mode

Zig Version

STL-Next is built with Zig 0.15.2 (latest stable). The Raylib GUI is next in the roadmap.

๐ŸŽฎ Phase 8.5: Launch Profiles (NEW!)

No more remembering launch options! Save per-game GPU/monitor configurations:

Create a Profile

# Create a profile for your Arc GPU on main monitor
stl-next profile-create 413150 "Arc-Main" --gpu arc --monitor DP-1 --resolution 2560x1440@144

# Create a profile for NVIDIA on secondary monitor  
stl-next profile-create 413150 "RTX-4K" --gpu nvidia --monitor HDMI-1 --resolution 3840x2160@60

Use Profiles

# Launch with a specific profile
stl-next run 413150 --profile "Arc-Main"

# Set default profile (used when no --profile specified)
stl-next profile-set 413150 "Arc-Main"

# List all profiles for a game
stl-next profile-list 413150

Steam Library Integration

# Create a Steam shortcut for a profile
# Appears as "Stardew Valley [Arc-Main]" in your library!
stl-next profile-shortcut 413150 "Arc-Main"

Multi-GPU Support

# List detected GPUs
stl-next gpu-list

# Test GPU selection
stl-next gpu-test nvidia   # Test NVIDIA env vars
stl-next gpu-test arc      # Test Intel Arc env vars
stl-next gpu-test 0        # Test specific GPU index

๐Ÿš€ Performance

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘              STL-NEXT BENCHMARK                              โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Steam Discovery:         0.14 ms
Game Lookup (413150):    0.35 ms (with launch options!)
List All Games:         12.25 ms (42 games)
List Protons:            0.07 ms (6 versions)

All operations < 100ms โœ“

๐Ÿ“ฆ Installation

NixOS / Home Manager (Recommended)

Add to your flake inputs:

inputs.stl-next.url = "github:e421/stl-next";
# Or local: inputs.stl-next.url = "path:/path/to/stl-next";

NixOS Module:

{ stl-next, ... }: {
  imports = [ stl-next.nixosModules.default ];
  programs.stl-next = {
    enable = true;
    registerNxmHandler = true;
  };
}

Home Manager Module:

{ stl-next, ... }: {
  imports = [ stl-next.homeManagerModules.default ];
  programs.stl-next = {
    enable = true;
    countdownSeconds = 10;
    defaultTinkers.gamemode = true;
  };
}

Development / Manual Build

git clone https://github.com/e421/stl-next
cd stl-next
nix develop
zig build -Doptimize=ReleaseFast

# Usage
./zig-out/bin/stl-next help
./zig-out/bin/stl-next 413150          # Launch Stardew Valley
./zig-out/bin/stl-next info 413150     # Get game info (JSON)
./zig-out/bin/stl-next wait 413150     # Start wait requester
./zig-out/bin/stl-next tui 413150      # Connect TUI client
./zig-out/bin/stl-next nxm "nxm://..." # Handle NXM link

๐Ÿ—๏ธ Architecture

src/
โ”œโ”€โ”€ main.zig              # CLI entry point
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ config.zig        # JSON configs (std.json)
โ”‚   โ””โ”€โ”€ launcher.zig      # Launch pipeline (real exec!)
โ”œโ”€โ”€ engine/
โ”‚   โ”œโ”€โ”€ steam.zig         # Steam discovery + launch options
โ”‚   โ”œโ”€โ”€ vdf.zig           # VDF parsing
โ”‚   โ”œโ”€โ”€ appinfo.zig       # Binary VDF streaming
โ”‚   โ””โ”€โ”€ leveldb.zig       # Collections (best-effort)
โ”œโ”€โ”€ tinkers/
โ”‚   โ”œโ”€โ”€ interface.zig     # Tinker trait (no global state!)
โ”‚   โ”œโ”€โ”€ mangohud.zig      # MangoHud overlay
โ”‚   โ”œโ”€โ”€ gamescope.zig     # Compositor wrapper
โ”‚   โ””โ”€โ”€ gamemode.zig      # System optimizations
โ”œโ”€โ”€ ipc/                  # Phase 4: NEW
โ”‚   โ”œโ”€โ”€ protocol.zig      # JSON over Unix sockets
โ”‚   โ”œโ”€โ”€ server.zig        # Daemon side
โ”‚   โ””โ”€โ”€ client.zig        # Client side
โ”œโ”€โ”€ ui/                   # Phase 4: NEW
โ”‚   โ”œโ”€โ”€ daemon.zig        # Wait requester daemon
โ”‚   โ””โ”€โ”€ tui.zig           # Terminal UI client
โ””โ”€โ”€ modding/              # Phase 4+: Mod Manager Integration
    โ”œโ”€โ”€ manager.zig       # MO2/Vortex coordinator + NXM handler
    โ””โ”€โ”€ vortex.zig        # Vortex auto-discovery + NXM forwarding

๐ŸŽฎ New CLI Commands (Phase 4+)

Command Description
wait <AppID> Start wait requester daemon with countdown
tui <AppID> Connect TUI client to running daemon
nxm <url> Handle NXM protocol link from browser

Nexus Mods Commands (Phase 5.5)

# Setup (get key from nexusmods.com/users/myaccount?tab=api%20access)
stl-next nexus-login YOUR_API_KEY   # Save API key
stl-next nexus-whoami               # Verify key + show user info

# Mod information
stl-next nexus-mod stardewvalley 21297        # Get mod details
stl-next nexus-files stardewvalley 21297      # List downloadable files

# Downloads (Premium Nexus members only)
stl-next nexus-download stardewvalley 21297 12345  # Get download link

# Update tracking
stl-next nexus-track stardewvalley 21297      # Track mod for updates
stl-next nexus-tracked                         # List all tracked mods

See: NEXUS_API_SECRETS.md for NixOS secret management.

๐Ÿ”ง Environment Variables

Variable Description
STL_SKIP_WAIT Skip wait requester (instant launch)
STL_COUNTDOWN Countdown seconds (default: 10)
STL_CONFIG_DIR Config directory
STL_NEXUS_API_KEY Nexus Mods API key (get from nexusmods.com)
STEAMGRIDDB_API_KEY SteamGridDB API key (free at steamgriddb.com)

๐Ÿ›ก๏ธ Error Handling (Hardened)

Unlike the original Bash script, STL-Next has comprehensive error handling:

Category Hardening
NXM URLs Validates scheme, domain, IDs; URL-encodes for Wine
IPC Retry logic, timeouts, connection recovery
Config JSON validation, size limits, graceful defaults
VDF Handles malformed files, missing fields
Memory Test allocator catches all leaks

Edge case tests in src/tests/edge_cases.zig:

  • Collection URL revision preservation (THE BUG FIX)
  • Special characters in mod names
  • Boundary conditions (max AppID, etc.)
  • Memory safety (allocation/deallocation loops)

๐Ÿ“ Known Limitations

Feature Status Notes
Raylib GUI โŒ Phase 5 TUI available now
MO2 USVFS ๐Ÿ”ถ Basic DLL override detection
VR Support โŒ Phase 5+ UEVR integration planned

๐Ÿ”œ Phase 5 Roadmap

  • Raylib-based graphical Wait-Requester
  • Vortex auto-discovery and NXM forwarding
  • Full MO2 USVFS injection
  • Vortex download queue integration
  • ReShade with hash-based updates
  • Steam Deck gamepad support

๐Ÿ“š Documentation

Core Documentation

Document Description
IPC Protocol Full specification of the daemon/client protocol
Architecture Code structure and component overview
Feature Roadmap Comparison with original STL + future plans
NXM Handling NXM protocol parsing and the bug fix

Quality Assurance

Document Description
Bug Verification Matrix All original STL bugs and their status in STL-Next
Game Testing Guide Test procedures for target games (Stardew, Skyrim, FO4, CP77)

Platform-Specific

Document Description
NixOS Installation Dedicated guide for NixOS users
Stardrop Integration Stardrop mod manager research and plan

Feature Guides

Document Description
Winetricks Guide Windows components & DLL installation
Custom Commands Pre/post launch shell commands
Non-Steam Games Adding GOG, Epic, and other games
SteamGridDB Guide Game artwork integration
Nexus API Secrets API key management (sops-nix, agenix)

๐Ÿ”ง Development

# Enter development shell
nix develop

# Build debug
zig build

# Build release
zig build -Doptimize=ReleaseFast

# Run tests
zig build test

# Run specific test
zig build test -- "nxm: collection url"

๐Ÿค Contributing

We welcome contributions! Priority areas:

  1. Tinker modules - Add tools like ReShade, vkBasalt
  2. Tests - Edge cases in src/tests/edge_cases.zig
  3. Documentation - Usage guides and examples
  4. Bug reports - Especially for mod manager issues

See ARCHITECTURE.md for code structure.

๐Ÿ“œ License

MIT


Why STL-Next? Because bugs like the NXM URL truncation shouldn't sit unfixed for 6+ months.

About

A fork and Zig rewrite of SteamTinkerLaunch with the addition of first class NixOS support :)

Resources

Stars

8 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages