Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save sync Improvements #4322

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/backend/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ class GlobalConfigV0 extends GlobalConfig {
framelessWindow: false,
beforeLaunchScriptPath: '',
afterLaunchScriptPath: '',
disableUMU: false
disableUMU: false,
autoSyncSaves: true
}
// @ts-expect-error TODO: We need to settle on *one* place to define settings defaults
return settings
Expand Down
19 changes: 18 additions & 1 deletion src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ import { app, powerSaveBlocker } from 'electron'
import gogPresence from './storeManagers/gog/presence'
import { updateGOGPlaytime } from './storeManagers/gog/games'
import { addRecentGame } from './recent_games/recent_games'
import { getDefaultSavePath } from './save_sync'
import { GOGCloudSavesLocation } from 'common/types/gog'

let powerDisplayId: number | null

Expand All @@ -106,7 +108,8 @@ const launchEventCallback: (args: LaunchParams) => StatusPromise = async ({
}) => {
const game = gameManagerMap[runner].getGameInfo(appName)
const gameSettings = await gameManagerMap[runner].getSettings(appName)
const { autoSyncSaves, savesPath, gogSaves = [] } = gameSettings
const { autoSyncSaves } = gameSettings
let { savesPath, gogSaves = [] } = gameSettings

const { title } = game

Expand All @@ -127,6 +130,20 @@ const launchEventCallback: (args: LaunchParams) => StatusPromise = async ({
status: 'syncing-saves'
})
logInfo(`Downloading saves for ${title}`, LogPrefix.Backend)
//recompute save path if user never computed it
if (runner === 'legendary' && !savesPath) {
savesPath = (await getDefaultSavePath(appName, runner, [])) as string
} else if (
runner === 'gog' &&
(gogSaves.length === 0 ||
(gogSaves[0].name === '' && gogSaves[0].location === ''))
) {
gogSaves = (await getDefaultSavePath(
appName,
runner,
[]
)) as GOGCloudSavesLocation[]
}
try {
await gameManagerMap[runner].syncSaves(
appName,
Expand Down
Loading