reshade

package
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEffectCatalogueURL = "https://raw.githubusercontent.com/crosire/reshade-shaders/list/EffectPackages.ini"
	DefaultAddonCatalogueURL  = "https://raw.githubusercontent.com/crosire/reshade-shaders/list/Addons.ini"
)
View Source
const (
	DefaultSetupTimeout          = 5 * time.Minute
	DefaultSetupOutputLimitBytes = 1024 * 1024
)
View Source
const (
	ManifestVersion = 1
	JournalVersion  = 1
)
View Source
const DefaultDownloadBaseURL = "https://reshade.me/downloads"

Variables

This section is empty.

Functions

func DefaultInstallerCacheDir

func DefaultInstallerCacheDir() string

func ResolveWithinRoot

func ResolveWithinRoot(root string, relativePath string) (resolved string, err error)

Types

type APIProxyOptions

type APIProxyOptions struct {
	RenderingAPI RenderingAPI `json:"renderingApi"`
	Proxies      []string     `json:"proxies"`
}

type Action

type Action string
const (
	ActionInstall          Action = "install"
	ActionAdopt            Action = "adopt"
	ActionUpdate           Action = "update"
	ActionRepair           Action = "repair"
	ActionUninstall        Action = "uninstall"
	ActionConfigureContent Action = "configure_content"
)

type AddonPackage

type AddonPackage struct {
	ID                string `json:"id"`
	Name              string `json:"name"`
	Description       string `json:"description"`
	EffectInstallPath string `json:"effectInstallPath,omitempty"`
	DownloadURL       string `json:"downloadUrl,omitempty"`
	DownloadURL32     string `json:"downloadUrl32,omitempty"`
	DownloadURL64     string `json:"downloadUrl64,omitempty"`
	RepositoryURL     string `json:"repositoryUrl"`
}

type AddonSelection

type AddonSelection struct {
	ID string `json:"id"`
}

type ApplyResult

type ApplyResult struct {
	Success    bool   `json:"success"`
	RolledBack bool   `json:"rolledBack"`
	Message    string `json:"message"`
}

type Architecture

type Architecture string
const (
	ArchitectureX86 Architecture = "x86"
	ArchitectureX64 Architecture = "x64"
)

type BuildVariant

type BuildVariant string
const (
	BuildVariantStandard BuildVariant = "standard"
	BuildVariantAddon    BuildVariant = "addon"
)

type Candidate

type Candidate struct {
	TargetRelativePath     string            `json:"targetRelativePath"`
	ExecutableRelativePath string            `json:"executableRelativePath"`
	Architecture           Architecture      `json:"architecture"`
	APIOptions             []APIProxyOptions `json:"apiOptions"`
	ProxyEvidence          []ProxyEvidence   `json:"proxyEvidence"`
	Conflicts              []string          `json:"conflicts"`
}

type ContentCatalogue

type ContentCatalogue struct {
	Effects []EffectPackage `json:"effects"`
	Addons  []AddonPackage  `json:"addons"`
	Cached  bool            `json:"cached"`
}

func ListContentCatalogue

func ListContentCatalogue(ctx context.Context, dataDir string, refresh bool, options ContentCatalogueOptions) (catalogue ContentCatalogue, err error)

type ContentCatalogueOptions

type ContentCatalogueOptions struct {
	EffectCatalogueURL string
	AddonCatalogueURL  string
	HTTPClient         *http.Client
}

type ContentRequest

type ContentRequest struct {
	EffectPackages []EffectPackageSelection `json:"effectPackages,omitempty"`
	Addons         []AddonSelection         `json:"addons,omitempty"`
}

type ContentSource

type ContentSource struct {
	Kind          ContentSourceKind `json:"kind"`
	ID            string            `json:"id,omitempty"`
	Name          string            `json:"name,omitempty"`
	RepositoryURL string            `json:"repositoryUrl,omitempty"`
	DownloadURL   string            `json:"downloadUrl,omitempty"`
	ArchiveSHA256 string            `json:"archiveSha256,omitempty"`
	ArchiveSize   int64             `json:"archiveSizeBytes,omitempty"`
	Shared        bool              `json:"shared,omitempty"`
}

type ContentSourceKind

type ContentSourceKind string
const (
	ContentSourceRuntime       ContentSourceKind = "runtime"
	ContentSourceEffectPackage ContentSourceKind = "effect_package"
	ContentSourceAddon         ContentSourceKind = "addon"
)

type DiscoveryOptions

type DiscoveryOptions struct {
	InspectArchitecture      func(string) (Architecture, error)
	ReadMetadata             func(string) (winversion.Metadata, error)
	AllowedForeignProxyPaths []string
}

type DiscoveryResult

type DiscoveryResult struct {
	Candidates []Candidate        `json:"candidates"`
	Warnings   []DiscoveryWarning `json:"warnings"`
}

func DiscoverCandidates

func DiscoverCandidates(gameRoot string, options DiscoveryOptions) (result DiscoveryResult, err error)

type DiscoveryWarning

type DiscoveryWarning struct {
	Path    string `json:"path"`
	Message string `json:"message"`
}

type Drift

type Drift struct {
	RelativePath string `json:"relativePath"`
	ExpectedHash string `json:"expectedHash"`
	ActualHash   string `json:"actualHash,omitempty"`
	Missing      bool   `json:"missing"`
}

type EffectPackage

type EffectPackage struct {
	ID                 string   `json:"id"`
	Name               string   `json:"name"`
	Description        string   `json:"description"`
	InstallPath        string   `json:"installPath"`
	TextureInstallPath string   `json:"textureInstallPath"`
	DownloadURL        string   `json:"downloadUrl"`
	RepositoryURL      string   `json:"repositoryUrl"`
	Required           bool     `json:"required"`
	Enabled            bool     `json:"enabled"`
	Modifiable         bool     `json:"modifiable"`
	EffectFiles        []string `json:"effectFiles"`
	DenyEffectFiles    []string `json:"denyEffectFiles"`
}

type EffectPackageSelection

type EffectPackageSelection struct {
	ID          string   `json:"id"`
	EffectFiles []string `json:"effectFiles,omitempty"`
}

type InstallerAcknowledgements

type InstallerAcknowledgements struct {
	SinglePlayerAcknowledged  bool
	AntiCheatRiskAcknowledged bool
}

type InstallerAcquireOptions

type InstallerAcquireOptions struct {
	CacheDir             string
	HTTPClient           *http.Client
	SignatureVerifier    InstallerSignatureVerifier
	Acknowledgements     InstallerAcknowledgements
	TrustedDownloadHosts []string
	AllowHTTP            bool
}

type InstallerArtifact

type InstallerArtifact struct {
	InstallerRelease
	Path      string             `json:"path"`
	SizeBytes int64              `json:"sizeBytes"`
	SHA256    string             `json:"sha256"`
	Signature InstallerSignature `json:"signature"`
}

func AcquireInstaller

func AcquireInstaller(
	ctx context.Context,
	release InstallerRelease,
	options InstallerAcquireOptions,
) (artifact InstallerArtifact, err error)

type InstallerPlannerOptions

type InstallerPlannerOptions struct {
	ResolveInstaller    func(context.Context, InstallerVariant, InstallerResolveOptions) (InstallerRelease, error)
	AcquireInstaller    func(context.Context, InstallerRelease, InstallerAcquireOptions) (InstallerArtifact, error)
	PrepareSetup        func(context.Context, SetupRequest, SetupRunnerOptions) (SetupRunResult, error)
	InspectArchitecture func(string) (Architecture, error)
	ReadMetadata        func(string) (winversion.Metadata, error)
}

type InstallerProvenance

type InstallerProvenance struct {
	Tag       *string `json:"tag,omitempty"`
	AssetName *string `json:"assetName,omitempty"`
	URL       *string `json:"url,omitempty"`
	Digest    *string `json:"digest,omitempty"`
	Size      *int64  `json:"size,omitempty"`
}

type InstallerRelease

type InstallerRelease struct {
	Version   string           `json:"version"`
	Variant   InstallerVariant `json:"variant"`
	AssetName string           `json:"assetName"`
	URL       string           `json:"url"`
	SHA256    string           `json:"sha256,omitempty"`
	SizeBytes int64            `json:"sizeBytes,omitempty"`
}

func ResolveLatestInstaller

func ResolveLatestInstaller(
	ctx context.Context,
	variant InstallerVariant,
	options InstallerResolveOptions,
) (release InstallerRelease, err error)

type InstallerReleaseStatus

type InstallerReleaseStatus struct {
	Version   string           `json:"version"`
	Variant   InstallerVariant `json:"variant"`
	AssetName string           `json:"assetName"`
	URL       string           `json:"url"`
	Digest    *string          `json:"digest,omitempty"`
	Size      *int64           `json:"sizeBytes,omitempty"`
	Cached    bool             `json:"cached"`
	Error     string           `json:"error,omitempty"`
}

type InstallerResolveOptions

type InstallerResolveOptions struct {
	TagsURL              string
	DownloadBaseURL      string
	HTTPClient           *http.Client
	TrustedDownloadHosts []string
	AllowHTTP            bool
	ManifestJSON         []byte
	RefreshManifest      bool
}

type InstallerSignature

type InstallerSignature struct {
	Status          InstallerSignatureStatus `json:"status"`
	Subject         string                   `json:"subject,omitempty"`
	SPKISHA256      string                   `json:"spkiSha256,omitempty"`
	CertificateSHA1 string                   `json:"certificateSha1,omitempty"`
}

func (InstallerSignature) MatchesIdentity

func (s InstallerSignature) MatchesIdentity(other InstallerSignature) bool

type InstallerSignatureStatus

type InstallerSignatureStatus string
const (
	InstallerSignatureStatusVerified InstallerSignatureStatus = "verified"
	InstallerSignatureStatusUnsigned InstallerSignatureStatus = "unsigned"
)

type InstallerSignatureVerifier

type InstallerSignatureVerifier interface {
	VerifyInstallerSignature(string, InstallerVariant) (InstallerSignature, error)
}

type InstallerStatus

type InstallerStatus struct {
	Standard InstallerReleaseStatus `json:"standard"`
	Addon    InstallerReleaseStatus `json:"addon"`
}

func ResolveInstallerStatus

func ResolveInstallerStatus(ctx context.Context, refresh bool) InstallerStatus

type InstallerVariant

type InstallerVariant string
const (
	InstallerVariantStandard InstallerVariant = ""
	InstallerVariantAddon    InstallerVariant = "addon"
)

type ManagedFile

type ManagedFile struct {
	RelativePath string          `json:"relativePath"`
	SHA256       string          `json:"sha256"`
	SizeBytes    int64           `json:"sizeBytes"`
	Ownership    Ownership       `json:"ownership"`
	Role         PathRole        `json:"role,omitempty"`
	Source       *ContentSource  `json:"source,omitempty"`
	Sources      []ContentSource `json:"sources,omitempty"`
	BackupPath   *string         `json:"backupPath,omitempty"`
	BackupSHA256 *string         `json:"backupSha256,omitempty"`
	BackupSize   *int64          `json:"backupSizeBytes,omitempty"`
}

type ManagedTarget

type ManagedTarget struct {
	ID                     int64
	GameID                 int64
	TargetRelativePath     string
	ExecutableRelativePath string
	RenderingAPI           RenderingAPI
	ProxyFilename          string
	ActiveRuntimeFilename  string
	Architecture           Architecture
	BuildVariant           BuildVariant
	VariantProvenance      VariantProvenance
	RuntimeVersion         string
	Provenance             InstallerProvenance
	ManagementOrigin       string
	Status                 ManagementStatus
	CreatedAt              string
	UpdatedAt              string
	LastVerifiedAt         *string
}

type ManagementStatus

type ManagementStatus string
const (
	ManagementStatusUnmanaged            ManagementStatus = "unmanaged"
	ManagementStatusManaged              ManagementStatus = "managed"
	ManagementStatusDrifted              ManagementStatus = "drifted"
	ManagementStatusRecoveryRequired     ManagementStatus = "recovery_required"
	ManagementStatusIncompatibleManifest ManagementStatus = "incompatible_manifest"
)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(store Store, options ManagerOptions) *Manager

func (*Manager) Apply

func (m *Manager) Apply(ctx context.Context, gameRoot string, request Request, previewHash string) (result ApplyResult, err error)

func (*Manager) ListContentCatalogue

func (m *Manager) ListContentCatalogue(ctx context.Context, refresh bool) (ContentCatalogue, error)

func (*Manager) ListTargets

func (m *Manager) ListTargets(ctx context.Context, gameRoot string, gameID int64) (targets []ManagedTarget, err error)

func (*Manager) Preview

func (m *Manager) Preview(ctx context.Context, gameRoot string, request Request) (preview Preview, err error)

func (*Manager) RecoveryState

func (m *Manager) RecoveryState() (state RecoveryState, err error)

func (*Manager) RollbackRecovery

func (m *Manager) RollbackRecovery(journalID string) (result ApplyResult, err error)

type ManagerOptions

type ManagerOptions struct {
	DataDir           string
	Now               func() time.Time
	Planner           Planner
	VerifyApplied     func(string, Preview) error
	ExecuteOperation  func(Operation) error
	RollbackSnapshots func([]filetxn.Snapshot) error
}

type Manifest

type Manifest struct {
	Version                    int               `json:"version"`
	Files                      []ManagedFile     `json:"files"`
	HasPreAdoptionRollbackData bool              `json:"hasPreAdoptionRollbackData"`
	VariantProvenance          VariantProvenance `json:"variantProvenance,omitempty"`
	UserContent                []UserContent     `json:"userContent,omitempty"`
}

func DecodeManifest

func DecodeManifest(value string) (manifest Manifest, err error)

type Operation

type Operation = filetxn.Operation

type Ownership

type Ownership string
const (
	OwnershipManaged Ownership = "managed"
	OwnershipAdopted Ownership = "adopted"
	OwnershipUser    Ownership = "user"
	OwnershipForeign Ownership = "foreign"
)

type PathImpact

type PathImpact struct {
	Path             string    `json:"path"`
	Role             PathRole  `json:"role"`
	Action           string    `json:"action"`
	Ownership        Ownership `json:"ownership"`
	Exists           bool      `json:"exists"`
	Blocking         bool      `json:"blocking"`
	PreservationOnly bool      `json:"preservationOnly"`
}

type PathRole

type PathRole string
const (
	PathRoleRuntime       PathRole = "runtime"
	PathRoleConfiguration PathRole = "configuration"
	PathRolePreset        PathRole = "preset"
	PathRoleLog           PathRole = "log"
	PathRoleBackup        PathRole = "backup"
	PathRoleEffects       PathRole = "effects"
	PathRoleTextures      PathRole = "textures"
	PathRoleAddons        PathRole = "addons"
	PathRoleScreenshots   PathRole = "screenshots"
)

type Planner

type Planner interface {
	Plan(context.Context, string, Request, *dbtypes.ReShadeTarget) (Preview, error)
}

func NewInstallerPlanner

func NewInstallerPlanner(options InstallerPlannerOptions) Planner

type PlannerFunc

func (PlannerFunc) Plan

func (fn PlannerFunc) Plan(ctx context.Context, gameRoot string, request Request, target *dbtypes.ReShadeTarget) (Preview, error)

type PreparedSetup

type PreparedSetup struct {
	WorkspacePath string               `json:"workspacePath"`
	Artifact      InstallerArtifact    `json:"artifact"`
	ExecutableSHA string               `json:"executableSha256"`
	RenderingAPI  RenderingAPI         `json:"renderingApi"`
	Operation     SetupOperation       `json:"operation"`
	Architecture  Architecture         `json:"architecture"`
	ExpectedProxy string               `json:"expectedProxy"`
	Files         []PreparedSetupFile  `json:"files"`
	Execution     SetupExecutionResult `json:"execution"`
}

type PreparedSetupFile

type PreparedSetupFile struct {
	RelativePath string `json:"relativePath"`
	Path         string `json:"path"`
	SHA256       string `json:"sha256"`
	SizeBytes    int64  `json:"sizeBytes"`
}

type PresetInspectionResult

type PresetInspectionResult struct {
	ReferencedEffects []string               `json:"referencedEffects"`
	Recommendations   []PresetRecommendation `json:"recommendations"`
	MissingEffects    []string               `json:"missingEffects"`
	Warnings          []string               `json:"warnings"`
}

func InspectPreset

func InspectPreset(path string, catalogue ContentCatalogue) (result PresetInspectionResult, err error)

type PresetRecommendation

type PresetRecommendation struct {
	PackageID   string   `json:"packageId"`
	PackageName string   `json:"packageName"`
	EffectFiles []string `json:"effectFiles"`
}

type Preview

type Preview struct {
	Request          Request            `json:"request"`
	Operations       []Operation        `json:"operations"`
	PathImpacts      []PathImpact       `json:"pathImpacts"`
	Warnings         []string           `json:"warnings"`
	Conflicts        []string           `json:"conflicts"`
	Drift            []Drift            `json:"drift"`
	UserContentDrift []UserContentDrift `json:"userContentDrift"`
	DesiredTarget    *TargetState       `json:"desiredTarget,omitempty"`
	PreviewHash      string             `json:"previewHash"`
	CanApply         bool               `json:"canApply"`
}

type ProxyEvidence

type ProxyEvidence struct {
	Filename       string       `json:"filename"`
	Exists         bool         `json:"exists"`
	IsReShade      bool         `json:"isReShade"`
	Architecture   Architecture `json:"architecture,omitempty"`
	RuntimeVersion string       `json:"runtimeVersion,omitempty"`
	Conflict       string       `json:"conflict,omitempty"`
}

type RecoveryState

type RecoveryState struct {
	Required   bool      `json:"required"`
	JournalID  string    `json:"journalId,omitempty"`
	GameID     int64     `json:"gameId,omitempty"`
	TargetPath string    `json:"targetPath,omitempty"`
	Action     Action    `json:"action,omitempty"`
	StartedAt  time.Time `json:"startedAt,omitempty"`
	Error      string    `json:"error,omitempty"`
}

type RenderingAPI

type RenderingAPI string
const (
	RenderingAPID3D9   RenderingAPI = "d3d9"
	RenderingAPID3D10  RenderingAPI = "d3d10"
	RenderingAPID3D11  RenderingAPI = "d3d11"
	RenderingAPID3D12  RenderingAPI = "d3d12"
	RenderingAPIOpenGL RenderingAPI = "opengl"
)

type Request

type Request struct {
	Action                         Action         `json:"action"`
	GameID                         int64          `json:"gameId"`
	TargetRelativePath             string         `json:"targetRelativePath"`
	ExecutableRelativePath         string         `json:"executableRelativePath"`
	RenderingAPI                   RenderingAPI   `json:"renderingApi"`
	ProxyFilename                  string         `json:"proxyFilename"`
	ActiveRuntimeFilename          string         `json:"activeRuntimeFilename,omitempty"`
	OptiScalerPrimaryProxyFilename string         `json:"optiScalerPrimaryProxyFilename,omitempty"`
	Architecture                   Architecture   `json:"architecture"`
	BuildVariant                   BuildVariant   `json:"buildVariant"`
	BackupAndContinue              bool           `json:"backupAndContinue"`
	SinglePlayerAcknowledged       bool           `json:"singlePlayerAcknowledged"`
	AntiCheatRiskAcknowledged      bool           `json:"antiCheatRiskAcknowledged"`
	Content                        ContentRequest `json:"content,omitempty"`
}

type Result

type Result struct {
	Targets []Target
}

func ScanManaged

func ScanManaged(root string, managedChainedTargets []string) (result Result, err error)

type SetupExecutionResult

type SetupExecutionResult struct {
	Arguments       []string      `json:"arguments"`
	ExitCode        int           `json:"exitCode"`
	StartedAt       time.Time     `json:"startedAt"`
	FinishedAt      time.Time     `json:"finishedAt"`
	Duration        time.Duration `json:"duration"`
	Stdout          string        `json:"stdout"`
	Stderr          string        `json:"stderr"`
	StdoutTruncated bool          `json:"stdoutTruncated"`
	StderrTruncated bool          `json:"stderrTruncated"`
	Cancelled       bool          `json:"cancelled"`
	TimedOut        bool          `json:"timedOut"`
	ElevationNeeded bool          `json:"elevationNeeded"`
	Cached          bool          `json:"cached"`
}

type SetupInput

type SetupInput struct {
	SourcePath   string `json:"sourcePath"`
	RelativePath string `json:"relativePath"`
}

type SetupOperation

type SetupOperation string
const (
	SetupOperationInstall SetupOperation = "install"
	SetupOperationUpdate  SetupOperation = "update"
)

type SetupRequest

type SetupRequest struct {
	Artifact                        InstallerArtifact
	TargetExecutable                string
	RenderingAPI                    RenderingAPI
	Operation                       SetupOperation
	Architecture                    Architecture
	ExpectedProxy                   string
	AllowedProxyOutputRelativePaths []string
	ExistingInputs                  []SetupInput
	ExpectedOutputRelativePaths     []string
	Acknowledgements                InstallerAcknowledgements
	Timeout                         time.Duration
}

type SetupRunResult

type SetupRunResult struct {
	Execution SetupExecutionResult `json:"execution"`
	Prepared  *PreparedSetup       `json:"prepared,omitempty"`
}

func PrepareSetup

func PrepareSetup(
	ctx context.Context,
	request SetupRequest,
	options SetupRunnerOptions,
) (result SetupRunResult, err error)

type SetupRunnerOptions

type SetupRunnerOptions struct {
	WorkspaceRoot       string
	ProcessRunner       setupProcessRunner
	SignatureVerifier   InstallerSignatureVerifier
	ReadMetadata        func(string) (winversion.Metadata, error)
	InspectArchitecture func(string) (Architecture, error)
	OutputLimitBytes    int
}

type Store

type Store interface {
	GetReShadeTarget(context.Context, int64, string) (dbtypes.ReShadeTarget, bool, error)
	ListReShadeTargets(context.Context, int64) ([]dbtypes.ReShadeTarget, error)
	SaveReShadeTarget(context.Context, dbtypes.SaveReShadeTargetInput) (dbtypes.ReShadeTarget, error)
	DeleteReShadeTarget(context.Context, int64, string) error
}

type Target

type Target struct {
	Path        string
	Executables []string
}

type TargetState

type TargetState struct {
	RuntimeVersion   string              `json:"runtimeVersion"`
	Provenance       InstallerProvenance `json:"provenance"`
	ManagementOrigin string              `json:"managementOrigin"`
	Manifest         Manifest            `json:"manifest"`
}

type UserContent

type UserContent struct {
	Path          string   `json:"path"`
	Role          PathRole `json:"role"`
	SHA256        string   `json:"sha256,omitempty"`
	SizeBytes     int64    `json:"sizeBytes,omitempty"`
	Exists        bool     `json:"exists"`
	External      bool     `json:"external"`
	Directory     bool     `json:"directory"`
	InventoryOnly bool     `json:"inventoryOnly"`
}

type UserContentDrift

type UserContentDrift struct {
	Path         string   `json:"path"`
	Role         PathRole `json:"role"`
	ExpectedHash string   `json:"expectedHash,omitempty"`
	ActualHash   string   `json:"actualHash,omitempty"`
	Missing      bool     `json:"missing"`
	External     bool     `json:"external"`
}

type VariantProvenance

type VariantProvenance string
const (
	VariantProvenanceVerified     VariantProvenance = "verified"
	VariantProvenanceUserDeclared VariantProvenance = "user_declared"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL