optiscaler

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: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManifestVersion = 1
	JournalVersion  = 1
	WarningVersion  = "online-anticheat-v1"
)
View Source
const DefaultReleasesURL = thirdparty.DefaultManifestURL

Variables

View Source
var SupportedProxyFilenames = []string{
	"dxgi.dll",
	"winmm.dll",
	"d3d12.dll",
	"dbghelp.dll",
	"version.dll",
	"wininet.dll",
	"winhttp.dll",
	"OptiScaler.asi",
}

Functions

func EnsureReleaseArchive

func EnsureReleaseArchive(ctx context.Context, release Release, options ReleaseOptions) (path string, err error)

func IsX64PE

func IsX64PE(path string) (isX64 bool, err error)

func RelativeToRoot

func RelativeToRoot(root string, path string) (relative string, err error)

func ResolveWithinRoot

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

func UpdateManagedINI

func UpdateManagedINI(contents []byte, config ManagedConfig) (updated []byte, err error)

Types

type Action

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

type ApplyResult

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

type Candidate

type Candidate struct {
	TargetRelativePath     string   `json:"targetRelativePath"`
	ExecutableRelativePath string   `json:"executableRelativePath"`
	ExecutableName         string   `json:"executableName"`
	Architecture           string   `json:"architecture"`
	Evidence               []string `json:"evidence"`
	Managed                bool     `json:"managed"`
	HasOptiScaler          bool     `json:"hasOptiScaler"`
	HasReShade             bool     `json:"hasReShade"`
}

func DiscoverCandidates

func DiscoverCandidates(gameRoot string, managedTargetPaths []string) (candidates []Candidate, err error)

type Drift

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

type GraphicsAPI

type GraphicsAPI string
const (
	GraphicsAPIDirectX GraphicsAPI = "directx"
	GraphicsAPIVulkan  GraphicsAPI = "vulkan"
)

type ManagedConfig

type ManagedConfig struct {
	LoadReShade       bool    `json:"loadReShade"`
	DXGISpoofing      bool    `json:"dxgiSpoofing"`
	TargetProcessName *string `json:"targetProcessName"`
	CheckForUpdate    bool    `json:"checkForUpdate"`
}

type ManagedFile

type ManagedFile struct {
	RelativePath string `json:"relativePath"`
	SHA256       string `json:"sha256"`
	SizeBytes    int64  `json:"sizeBytes"`
	BackupPath   string `json:"backupPath,omitempty"`
	BackupSHA256 string `json:"backupSha256,omitempty"`
	BackupSize   int64  `json:"backupSizeBytes,omitempty"`
	Ownership    string `json:"ownership,omitempty"`
}

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) Discover

func (m *Manager) Discover(ctx context.Context, gameRoot string, gameID int64) (candidates []Candidate, 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)

func (*Manager) StableRelease

func (m *Manager) StableRelease(ctx context.Context, refresh bool) (release Release, err error)

type ManagerOptions

type ManagerOptions struct {
	DataDir           string
	CacheDir          string
	ReleasesURL       string
	ReleaseManifest   []byte
	HTTPClient        *http.Client
	Now               func() time.Time
	PreparePackage    func(context.Context) (Release, Package, error)
	InspectOwnership  func(string) (Ownership, error)
	ExecuteOperation  func(Operation) error
	RollbackSnapshots func([]journalSnapshot) error
}

type Manifest

type Manifest struct {
	Version                    int           `json:"version"`
	Files                      []ManagedFile `json:"files"`
	Config                     ManagedConfig `json:"config"`
	OriginalReShadeProxy       *string       `json:"originalReShadeProxy,omitempty"`
	HasPreAdoptionRollbackData bool          `json:"hasPreAdoptionRollbackData"`
}

type Operation

type Operation = filetxn.Operation

type Ownership

type Ownership string
const (
	OwnershipOptiScaler Ownership = "optiscaler"
	OwnershipReShade    Ownership = "reshade"
	OwnershipUnknown    Ownership = "unknown"
)

func InspectOwnership

func InspectOwnership(path string) (ownership Ownership, err error)

type Package

type Package struct {
	Root  string        `json:"root"`
	Files []PackageFile `json:"files"`
}

func ExtractReleasePackage

func ExtractReleasePackage(ctx context.Context, archivePath string, destination string) (pkg Package, err error)

type PackageFile

type PackageFile struct {
	RelativePath string `json:"relativePath"`
	SourcePath   string `json:"sourcePath"`
	SHA256       string `json:"sha256"`
	SizeBytes    int64  `json:"sizeBytes"`
}

type Preview

type Preview struct {
	Request              Request     `json:"request"`
	Release              Release     `json:"release"`
	Operations           []Operation `json:"operations"`
	ConfigurationChanges []string    `json:"configurationChanges"`
	Warnings             []string    `json:"warnings"`
	Conflicts            []string    `json:"conflicts"`
	Drift                []Drift     `json:"drift"`
	PreviewHash          string      `json:"previewHash"`
	CanApply             bool        `json:"canApply"`
}

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 Release

type Release struct {
	Tag       string `json:"tag"`
	Version   string `json:"version"`
	AssetName string `json:"assetName"`
	URL       string `json:"url"`
	Digest    string `json:"digest"`
	Size      int64  `json:"size"`
	Error     string `json:"error,omitempty"`
}

func DiscoverStableRelease

func DiscoverStableRelease(ctx context.Context, options ReleaseOptions) (release Release, err error)

type ReleaseOptions

type ReleaseOptions struct {
	ReleasesURL          string
	CacheDir             string
	HTTPClient           *http.Client
	ManifestJSON         []byte
	RefreshManifest      bool
	TrustedDownloadHosts []string
	AllowHTTP            bool
}

type Request

type Request struct {
	Action                   Action      `json:"action"`
	GameID                   int64       `json:"gameId"`
	TargetRelativePath       string      `json:"targetRelativePath"`
	ExecutableRelativePath   string      `json:"executableRelativePath"`
	GraphicsAPI              GraphicsAPI `json:"graphicsApi"`
	ProxyFilename            string      `json:"proxyFilename"`
	DXGISpoofing             bool        `json:"dxgiSpoofing"`
	ProcessFilter            *string     `json:"processFilter"`
	AcknowledgeWarning       bool        `json:"acknowledgeWarning"`
	BackupAndContinue        bool        `json:"backupAndContinue"`
	EnableReShadeCoexistence bool        `json:"enableReShadeCoexistence"`
}

type Store

type Store interface {
	GetOptiScalerTarget(context.Context, int64, string) (dbtypes.OptiScalerTarget, bool, error)
	ListOptiScalerTargets(context.Context, int64) ([]dbtypes.OptiScalerTarget, error)
	SaveOptiScalerTarget(context.Context, dbtypes.SaveOptiScalerTargetInput) (dbtypes.OptiScalerTarget, error)
	DeleteOptiScalerTarget(context.Context, int64, string) error
}

Jump to

Keyboard shortcuts

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