Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

1.2 KB
Raw Blame
import { Runner } from './types'

// What Heroic can actually offer per store. The game menu, the update badges,
// the game page and the download queue read this instead of open-coding runner
// checks.
type RunnerCapabilities = {
  update: boolean
  repair: boolean
  // Real support, not just the presence of a syncSaves method: nile and
  // itchio expose stubs that return reason 'not-supported'. Nothing reads
  // this yet; it is reserved for the cloud-save UI.
  cloudSaves: boolean
}

export const runnerCapabilities: Record<Runner, RunnerCapabilities> = {
  legendary: { update: true, repair: true, cloudSaves: true },
  gog: { update: true, repair: true, cloudSaves: true },
  // Amazon and itch.io only stub syncSaves with 'not-supported'
  nile: { update: true, repair: true, cloudSaves: false },
  steam: { update: true, repair: true, cloudSaves: true },
  itchio: { update: true, repair: true, cloudSaves: false },
  sideload: { update: false, repair: false, cloudSaves: false },
  zoom: { update: false, repair: false, cloudSaves: false }
}

export function supportsCapability(
  runner: Runner,
  capability: keyof RunnerCapabilities
): boolean {
  return runnerCapabilities[runner]?.[capability] ?? false
}