CloudRedirect Documentation

repository·master·Indexed 18 days ago

https://github.com/selectively11/cloudredirect

CloudRedirect provides cloud save synchronization for 'lua' games (non-owned AppIDs) by redirecting Steam Cloud RPC calls to external providers including Google Drive, OneDrive, Cloudflare R2, S3-Compatible storage, and local folders. It includes the cloudredirect-cli (STFixer) Rust port for applying patches to SteamTools.exe and managing core DLLs, as well as a C++ and WPF-based implementation for Windows and a Flatpak-based configuration for Linux.

Tokens
10K
Snippets
37
Records
51
Agent score
50%

What's inside CloudRedirect

  1. What is CloudRedirect?

    master
    CloudRedirect provides "Steam Cloud" functionality for 'lua' games (games that use Steam's Lua-based AppID system, often used for DLC unlocking). It redirects Steam Cloud requests for these games to external cloud providers like Google Drive or OneDrive, including support for Steam AutoCloud games. This allows users to sync saves for games that do not natively support Steam Cloud.
  2. How CloudRedirect works

    master

    CloudRedirect operates by intercepting Steam's internal cloud save RPC handlers.

    On Windows: It uses a C++ DLL and a WPF companion app. The companion app copies the DLL to your Steam folder and handles cloud provider authentication. The DLL hooks Steam's internal handlers to intercept read/write calls. If a game is owned, it uses standard Steam Cloud; if it is a 'lua' game, the DLL redirects the data to your chosen cloud provider.

    On Linux: It uses a library loaded at Steam startup and a Flatpak application for configuration.

  3. Setup and usage on Linux

    master
    1. Install the necessary components using the following command:
      curl -fsSL headcrab.pages.dev | bash
    2. Open the CloudRedirect app and sign into your chosen provider.
    3. Edit your SLSsteam config file:
      • Set DisableCloud to No.
      • Specify the games you want to sync under the AdditionalApps key.
    4. Launch Steam.
  4. Setup and usage on Windows

    master
    1. Download the latest release from the GitHub Releases page.
    2. Run the CloudRedirect.exe.
    3. Select your mode:
      • STfixer mode: For fixing SteamTools bugs.
      • CloudRedirect mode: For standard cloud redirection.
    4. In the Setup tab, click 'Run All Patches'.
    5. Go to the Cloud Provider tab, select your provider, and sign in.
    6. Launch Steam.
  5. Build CloudRedirect on Linux from source

    master

    Building on Linux requires specific environment constraints:

    • glibc requirement: You must build against glibc 2.31 or older (e.g., Ubuntu 20.04, Debian 11).
    • Toolchain: GCC 12 and 32-bit multilib are required if building on Ubuntu 20.04.
    • CMake: A modern version of CMake is required (system versions may be too old).

    Build Command: When running CMake, you must specify the 32-bit flag:

    -DLINUX_32BIT=ON

    Note: It is highly recommended to use Distrobox to manage these specific environment requirements.

  6. Build CloudRedirect on Windows from source

    master

    Prerequisites

    • Visual Studio 2022 (or Build Tools) with C++ and .NET 8 workloads
    • CMake 3.20+

    Build Steps

    Run the following commands to build the C++ DLL and the WPF application:

    cmake -B build -G "Visual Studio 17 2022" -A x64
    cmake --build build --config Release

    Outputs:

    • C++ DLL: build/Release/cloud_redirect.dll
    • WPF App: ui/bin/publish/CloudRedirect.exe (The DLL is automatically embedded into this executable).
  7. How CloudRedirect manages cloud providers

    master

    CloudRedirect uses a provider-based model to abstract different cloud storage services.

    Key Concepts

    • Active Provider: The provider currently configured in config.json. If no cloud provider is selected, it defaults to local.
    • Provider Labels: While internal keys might be short (e.g., gdrive), the providerLabel(provider) method returns human-readable names (e.g., Google Drive).
    • Authentication: Providers can be authenticated via OAuth (using startOAuth(provider)) or via direct credential files (S3/R2). The providerAuthenticated property indicates if the current provider is ready for use.
    • Scanning: The scanProvider(provider) method triggers a full scan of a provider's cloud storage via the CLI scan-all command to identify existing cloud backups.
  8. Google Drive path mapping and structure

    master

    When using the Google Drive provider, CloudRedirect maps flat logical paths to a specific folder hierarchy within Google Drive.

    Logical Path Format: {accountId}/{appId}/blobs/{filename}

    Google Drive Hierarchy: CloudRedirect/{accountId}/{appId}/...

    This mapping ensures that files are organized under a root CloudRedirect folder, subdivided by account and application IDs.

  9. How the STFixer patching flow works

    master

    The Patcher implements a multi-stage workflow to ensure SteamTools operates correctly in an offline-setup environment:

    1. Core DLL Discovery & Repair: It scans the Steam directory for xinput1_4.dll or dwmapi.dll. If they are missing or have incorrect hashes, it downloads verified versions from catbox.moe (with an aaasn.com fallback).
    2. Steam Version Validation: It uses steam_detector to ensure the installed Steam version is supported to prevent corruption of steamclient64.dll.
    3. Core DLL Patching: It identifies the SteamTools Core DLL, resolves patch offsets via signature scanning, and applies byte-level patches.
    4. Payload Cache Patching:
      • It locates the encrypted payload cache.
      • If the cache is missing or corrupted, it deploys an embedded payload.
      • It decrypts the payload (AES-CBC), decompresses it (Zlib), applies activation patches, and then re-encrypts/re-compresses it using the original IV to maintain compatibility with SteamTools.
    5. Executable Patching: It modifies SteamTools.exe at a specific offset (0x282F0) to change the prologue from push rbp; ret; nop to ret; nop, effectively disabling the core DLL redeployment logic.
  10. Use the CloudRedirect CLI for provider management

    master

    The CloudRedirect CLI allows you to manage cloud providers, remote applications, and blobs directly from the command line. All command output is returned as JSON to stdout.

    Exit Codes:

    • 0: Success
    • 1: Error

    Execution Syntax:

    • Windows: cloud_redirect_cli.exe <command> [args...]
    • Linux: cloud_redirect_cli <command> [args...]
    # Example usage pattern
    cloud_redirect_cli list-remote-apps <provider>
  11. Use the CloudRedirect CLI

    master

    The CloudRedirect CLI is invoked using the --cli flag followed by a specific command and its required arguments. The CLI outputs results in JSON format. A successful operation is indicated by an exit code of 0 and a JSON response containing "success":true or "authenticated":true.

    Supported providers include: gdrive, onedrive, r2, and s3.

    cloud_redirect --cli <command> [args...]
  12. Configure HTTP transport options

    master

    When using custom or internal cloud storage (like MinIO or Garage), you can configure the HTTP transport to allow insecure connections or custom certificate authorities using the TransportOptions struct.

    Key options:

    • allowInsecureHttp: Set to true to permit plaintext http:// connections.
    • allowInsecureTls: Set to true to skip TLS certificate verification (useful for self-signed certificates).
    • caCertPath: Provide a path to a custom CA bundle for internal CAs.
    TransportOptions options;
    options.allowInsecureHttp = true;
    options.allowInsecureTls = true;
    options.caCertPath = "/path/to/ca-bundle.crt";
    
    transport->SetOptions(options);