|
| 1 | +/* eslint-disable @typescript-eslint/no-unused-vars */ |
| 2 | +import { getGameInfo as getSteamLibraryGameInfo } from './library' |
| 3 | +import { logError, LogPrefix } from 'backend/logger/logger' |
| 4 | +import { |
| 5 | + GameInfo, |
| 6 | + GameSettings, |
| 7 | + ExtraInfo, |
| 8 | + InstallPlatform, |
| 9 | + ExecResult, |
| 10 | + InstallArgs, |
| 11 | + UpdateArgs |
| 12 | +} from 'common/types' |
| 13 | +import { existsSync } from 'graceful-fs' |
| 14 | +import { GOGCloudSavesLocation } from 'common/types/gog' |
| 15 | +import { InstallResult, RemoveArgs } from 'common/types/game_manager' |
| 16 | + |
| 17 | +export function getGameInfo(appName: string): GameInfo { |
| 18 | + const info = getSteamLibraryGameInfo(appName) |
| 19 | + if (!info) { |
| 20 | + logError( |
| 21 | + [ |
| 22 | + 'Could not get game info for', |
| 23 | + `${appName},`, |
| 24 | + 'returning empty object. Something is probably gonna go wrong soon' |
| 25 | + ], |
| 26 | + LogPrefix.Gog |
| 27 | + ) |
| 28 | + return { |
| 29 | + app_name: '', |
| 30 | + runner: 'steam', |
| 31 | + art_cover: '', |
| 32 | + art_square: '', |
| 33 | + install: {}, |
| 34 | + is_installed: false, |
| 35 | + title: '', |
| 36 | + canRunOffline: false |
| 37 | + } |
| 38 | + } |
| 39 | + return info |
| 40 | +} |
| 41 | + |
| 42 | +export async function isGameAvailable(appName: string): Promise<boolean> { |
| 43 | + const info = getGameInfo(appName) |
| 44 | + if (info && info.is_installed) { |
| 45 | + if (info.install.install_path && existsSync(info.install.install_path!)) { |
| 46 | + return true |
| 47 | + } else { |
| 48 | + return false |
| 49 | + } |
| 50 | + } |
| 51 | + return false |
| 52 | +} |
| 53 | + |
| 54 | +export async function getSettings(appName: string): Promise<GameSettings> { |
| 55 | + // not used |
| 56 | + return {} as GameSettings |
| 57 | +} |
| 58 | + |
| 59 | +export async function getExtraInfo(appName: string): Promise<ExtraInfo> { |
| 60 | + // not used |
| 61 | + return {} as ExtraInfo |
| 62 | +} |
| 63 | + |
| 64 | +export async function importGame( |
| 65 | + appName: string, |
| 66 | + path: string, |
| 67 | + platform: InstallPlatform |
| 68 | +): Promise<ExecResult> { |
| 69 | + // not used |
| 70 | + return { stderr: '', stdout: '' } |
| 71 | +} |
| 72 | + |
| 73 | +export function onInstallOrUpdateOutput( |
| 74 | + appName: string, |
| 75 | + action: 'installing' | 'updating', |
| 76 | + data: string, |
| 77 | + totalDownloadSize: number |
| 78 | +): void { |
| 79 | + // not used |
| 80 | +} |
| 81 | + |
| 82 | +export async function install( |
| 83 | + appName: string, |
| 84 | + args: InstallArgs |
| 85 | +): Promise<InstallResult> { |
| 86 | + // not used |
| 87 | + return { status: 'error', error: 'Not implemented' } |
| 88 | +} |
| 89 | + |
| 90 | +export function isNative(appName: string): boolean { |
| 91 | + // not used |
| 92 | + return false |
| 93 | +} |
| 94 | + |
| 95 | +export async function addShortcuts( |
| 96 | + appName: string, |
| 97 | + fromMenu?: boolean |
| 98 | +): Promise<void> { |
| 99 | + // not used |
| 100 | +} |
| 101 | + |
| 102 | +export async function removeShortcuts(appName: string): Promise<void> { |
| 103 | + // not used |
| 104 | +} |
| 105 | + |
| 106 | +export async function launch( |
| 107 | + appName: string, |
| 108 | + launchArguments?: string |
| 109 | +): Promise<boolean> { |
| 110 | + // not used |
| 111 | + return false |
| 112 | +} |
| 113 | + |
| 114 | +export async function moveInstall( |
| 115 | + appName: string, |
| 116 | + newInstallPath: string |
| 117 | +): Promise<InstallResult> { |
| 118 | + // not used |
| 119 | + return { status: 'error', error: 'Not implemented' } |
| 120 | +} |
| 121 | + |
| 122 | +export async function repair(appName: string): Promise<ExecResult> { |
| 123 | + // not used |
| 124 | + return { stderr: '', stdout: '' } |
| 125 | +} |
| 126 | + |
| 127 | +export async function syncSaves( |
| 128 | + appName: string, |
| 129 | + arg: string, |
| 130 | + path: string, |
| 131 | + gogSaves?: GOGCloudSavesLocation[] |
| 132 | +): Promise<string> { |
| 133 | + // not used |
| 134 | + return '' |
| 135 | +} |
| 136 | + |
| 137 | +export async function uninstall(args: RemoveArgs): Promise<ExecResult> { |
| 138 | + // not used |
| 139 | + return { stderr: '', stdout: '' } |
| 140 | +} |
| 141 | + |
| 142 | +export async function update( |
| 143 | + appName: string, |
| 144 | + args?: UpdateArgs |
| 145 | +): Promise<InstallResult> { |
| 146 | + // not used |
| 147 | + return { status: 'error', error: 'Not implemented' } |
| 148 | +} |
| 149 | + |
| 150 | +export async function forceUninstall(appName: string): Promise<void> { |
| 151 | + // not used |
| 152 | +} |
| 153 | + |
| 154 | +export async function stop(appName: string): Promise<void> { |
| 155 | + // not used |
| 156 | +} |
| 157 | + |
| 158 | +export async function pause(appName: string): Promise<void> { |
| 159 | + // not used |
| 160 | +} |
0 commit comments