Skip to content

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

[FIX]: Fix the Zoom store and take it out of experimental (#6181)

Flávio Fearn2ee92bbe2e1f
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index 99fc866fa..e34a14c4d 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -661,9 +661,7 @@
"show_steam_owned_only": "Show Steam owned games only",
"show_support_offline_only": "Show offline-supported only",
"show_third_party_managed_only": "Show third-party managed only",
- "show_updates_only": "Show games with updates only",
- "stores": "Stores",
- "uncategorized": "Uncategorized"
+ "show_updates_only": "Show games with updates only"
},
"help": {
"advertiseAvxForRosetta": "Enables AVX instruction set support when running windows games through Rosetta on Apple Silicon macs. This may be required for some games like Death Stranding that need AVX support.",
@@ -1312,13 +1310,11 @@
"experimental_features": {
"cometSupport": "Comet support",
"enableHelp": "Help component",
- "enableNewDesign": "New design",
- "zoomPlatform": "Zoom Platform support (only linux)"
+ "enableNewDesign": "New design"
},
"experimental_features_description": {
"cometSupport": "Enable GOG Galaxy features such as achievements and multiplayer",
- "enableHelp": "Show an in-app help panel explaining the setting you are hovering",
- "zoomPlatform": "Add the Zoom Platform store to your library"
+ "enableHelp": "Show an in-app help panel explaining the setting you are hovering"
},
"frameless-window": {
"confirmation": {
@@ -1910,6 +1906,7 @@
"remove": "Remove",
"save_hint": "Changes in this table are not saved automatically. Click the + button"
},
+ "uncategorized": "Uncategorized",
"Update available!": "Update available!",
"userselector": {
"cancel": "Cancel",
@@ -1972,5 +1969,22 @@
"nothingYet": "Nothing was installed by winetricks yet",
"openGUI": "Open winetricks GUI",
"search": "Search fonts or components"
+ },
+ "zoom": {
+ "collections": {
+ "back": "Back",
+ "changePlatform": "Change platform",
+ "description": "This product includes more than one file. Pick what you want to install.",
+ "extrasGroup": "Extras",
+ "extrasSummary_one": "{{count}} files · {{size}}",
+ "extrasSummary_other": "{{count}} files · {{size}}",
+ "gameGroup": "Game files",
+ "noBuild": "No game files are available for this platform.",
+ "noBuildHint": "Choose another platform to see its files.",
+ "noFiles": "This product has no files to install.",
+ "selectedTotal": "Selected: {{size}}",
+ "selectOne": "Select at least one game file to continue.",
+ "title": "Select files to install"
+ }
}
}
diff --git a/src/backend/downloadmanager/__tests__/downloadqueue.test.ts b/src/backend/downloadmanager/__tests__/downloadqueue.test.ts
index e241ad168..c6463cbce 100644
--- a/src/backend/downloadmanager/__tests__/downloadqueue.test.ts
+++ b/src/backend/downloadmanager/__tests__/downloadqueue.test.ts
@@ -56,13 +56,14 @@ const pending = new Map<string, (status: DMStatus) => void>()
function element(
appName: string,
- type: DMQueueElement['type'] = 'install'
+ type: DMQueueElement['type'] = 'install',
+ runner = 'steam'
): DMQueueElement {
return {
type,
params: {
appName,
- runner: 'steam',
+ runner,
path: '/games',
platformToInstall: 'linux',
gameInfo: { title: appName }
@@ -109,6 +110,18 @@ async function pauseFirstDownload() {
expect(dm.isPaused()).toBe(true)
}
+describe('update capability', () => {
+ it('never queues an update for a store without an update flow', async () => {
+ await dm.addToQueue(element('zoom-game', 'update', 'zoom'), {
+ userStarted: true
+ })
+ await flush()
+
+ expect(queued()).toEqual([])
+ expect(update).not.toHaveBeenCalled()
+ })
+})
+
describe('starting a download while one is paused', () => {
it('starts the new one and queues the paused one', async () => {
await pauseFirstDownload()
diff --git a/src/backend/downloadmanager/downloadqueue.ts b/src/backend/downloadmanager/downloadqueue.ts
index 9fbefb4f6..8ca19cd6d 100644
--- a/src/backend/downloadmanager/downloadqueue.ts
+++ b/src/backend/downloadmanager/downloadqueue.ts
@@ -8,6 +8,7 @@ import { sendFrontendMessage } from '../ipc'
import { callAbortController } from 'backend/utils/aborthandler/aborthandler'
import { notify } from '../dialog/dialog'
import i18next from 'i18next'
+import { runnerCapabilities } from 'common/runnerCapabilities'
import { createRedistDMQueueElement } from 'backend/storeManagers/gog/redist'
import {
forgetSteamInstall,
@@ -169,6 +170,19 @@ async function addToQueue(
return
}
+ // Stores without an update flow never get update items in the queue, no
+ // matter who asked: game page, menu, bulk action or auto-update.
+ if (
+ element.type === 'update' &&
+ !runnerCapabilities[element.params.runner].update
+ ) {
+ logWarning(
+ `Skipping update for ${element.params.appName}: ${element.params.runner} has no update flow`,
+ LogPrefix.DownloadManager
+ )
+ return
+ }
+
sendGameStatusUpdate({
appName: element.params.appName,
runner: element.params.runner,
diff --git a/src/backend/downloadmanager/utils.ts b/src/backend/downloadmanager/utils.ts
index fc1ab9659..c2a1aca56 100644
--- a/src/backend/downloadmanager/utils.ts
+++ b/src/backend/downloadmanager/utils.ts
@@ -22,7 +22,8 @@ async function installQueueElement(params: InstallParams): Promise<{
installLanguage,
platformToInstall,
build,
- branch
+ branch,
+ zoomFileIds
} = params
const { title } = libraryManagerMap[runner].getGame(appName).getGameInfo()
@@ -85,7 +86,8 @@ async function installQueueElement(params: InstallParams): Promise<{
platformToInstall,
installLanguage,
build,
- branch
+ branch,
+ zoomFileIds
})
if (status === 'error') {
diff --git a/src/backend/main.ts b/src/backend/main.ts
index 4d56593b3..b8d12b7fa 100644
--- a/src/backend/main.ts
+++ b/src/backend/main.ts
@@ -7,6 +7,7 @@ import {
import { fetchLastestReleases } from './utils/releases'
import { getControllerBatteries } from './utils/controller_battery'
import { DiskSpaceData, StatusPromise, WineInstallation } from 'common/types'
+import { runnerCapabilities } from 'common/runnerCapabilities'
import * as path from 'path'
import {
BrowserWindow,
@@ -715,6 +716,9 @@ addHandler('checkGameUpdates', async (): Promise<string[]> => {
for (const runner of Object.keys(
libraryManagerMap
) as (keyof typeof libraryManagerMap)[]) {
+ // Stores without an update flow never contribute to the update badges
+ if (!runnerCapabilities[runner].update) continue
+
let gamesToUpdate = await libraryManagerMap[runner].listUpdateableGames()
if (autoUpdateGames) {
gamesToUpdate = autoUpdate(runner, gamesToUpdate)
diff --git a/src/backend/storeManagers/zoom/__tests__/batchLauncher.test.ts b/src/backend/storeManagers/zoom/__tests__/batchLauncher.test.ts
new file mode 100644
index 000000000..20759dc96
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/batchLauncher.test.ts
@@ -0,0 +1,192 @@
+import { mkdirSync, mkdtempSync, writeFileSync, rmSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import {
+ findBatchLauncher,
+ parseBatchLauncher,
+ resolveCaseInsensitivePath
+} from '../install'
+
+describe('findBatchLauncher', () => {
+ let dir: string
+
+ beforeEach(() => {
+ dir = mkdtempSync(join(tmpdir(), 'zoom-launcher-'))
+ })
+
+ afterEach(() => {
+ rmSync(dir, { recursive: true, force: true })
+ })
+
+ it('prefers the launch batch file over other batches and exes', () => {
+ writeFileSync(join(dir, 'setup.bat'), '')
+ writeFileSync(join(dir, 'Launch The Colony (DOS).bat'), '')
+ writeFileSync(join(dir, 'unins000.bat'), '')
+ writeFileSync(join(dir, 'scummvm.exe'), '')
+
+ expect(findBatchLauncher(dir)).toBe('Launch The Colony (DOS).bat')
+ })
+
+ it('accepts play and start batches', () => {
+ writeFileSync(join(dir, 'Play Game.bat'), '')
+
+ expect(findBatchLauncher(dir)).toBe('Play Game.bat')
+
+ rmSync(join(dir, 'Play Game.bat'))
+ writeFileSync(join(dir, 'Start Game.bat'), '')
+
+ expect(findBatchLauncher(dir)).toBe('Start Game.bat')
+ })
+
+ it('ignores batches that only configure or register the game', () => {
+ writeFileSync(join(dir, 'config.bat'), '')
+ writeFileSync(join(dir, 'register.bat'), '')
+
+ expect(findBatchLauncher(dir)).toBeUndefined()
+ })
+
+ it('accepts any batch name when the package bundles scummvm.exe', () => {
+ writeFileSync(join(dir, 'The Colony (DOS).bat'), '')
+ writeFileSync(join(dir, 'scummvm.exe'), '')
+
+ expect(findBatchLauncher(dir)).toBe('The Colony (DOS).bat')
+ })
+
+ it('detects scummvm.exe inside a subfolder', () => {
+ mkdirSync(join(dir, 'scummvm'))
+ writeFileSync(join(dir, 'scummvm', 'scummvm.exe'), '')
+ writeFileSync(join(dir, 'Run Game.bat'), '')
+
+ expect(findBatchLauncher(dir)).toBe('Run Game.bat')
+ })
+
+ it('still refuses an unnamed batch when scummvm.exe is absent', () => {
+ writeFileSync(join(dir, 'Game.bat'), '')
+
+ expect(findBatchLauncher(dir)).toBeUndefined()
+ })
+
+ it('ignores setup and uninstall batches', () => {
+ writeFileSync(join(dir, 'setup.bat'), '')
+ writeFileSync(join(dir, 'unins000.bat'), '')
+
+ expect(findBatchLauncher(dir)).toBeUndefined()
+ })
+
+ it('returns undefined when there is no batch file', () => {
+ writeFileSync(join(dir, 'game.exe'), '')
+
+ expect(findBatchLauncher(dir)).toBeUndefined()
+ })
+
+ it('ignores batch files inside subfolders', () => {
+ mkdirSync(join(dir, 'ScummVM'))
+ writeFileSync(join(dir, 'ScummVM', 'Launch Game.bat'), '')
+
+ expect(findBatchLauncher(dir)).toBeUndefined()
+ })
+})
+
+describe('parseBatchLauncher', () => {
+ it('extracts the target and arguments from a Zoom launcher', () => {
+ const line =
+ 'start .\\ScummVM\\scummvm.exe --zoom-splash=black --no-console -c "thecolony.ini" colony'
+
+ expect(parseBatchLauncher(line)).toEqual({
+ executable: 'ScummVM/scummvm.exe',
+ args: [
+ '--zoom-splash=black',
+ '--no-console',
+ '-c',
+ 'thecolony.ini',
+ 'colony'
+ ]
+ })
+ })
+
+ it('handles a quoted executable with spaces', () => {
+ const line = 'start "" ".\\Game Files\\My Game.exe" -windowed'
+
+ expect(parseBatchLauncher(line)).toEqual({
+ executable: 'Game Files/My Game.exe',
+ args: ['-windowed']
+ })
+ })
+
+ it('returns undefined when there is no executable', () => {
+ expect(parseBatchLauncher('echo hello')).toBeUndefined()
+ })
+
+ it('skips checks and only parses the launch line', () => {
+ const script = [
+ '@echo off',
+ 'if not exist "ScummVM\\scummvm.exe" goto missing',
+ 'cd /d "%~dp0"',
+ 'start "" "ScummVM\\scummvm.exe" -c "game.ini" gameid',
+ 'exit',
+ ':missing'
+ ].join('\r\n')
+
+ expect(parseBatchLauncher(script)).toEqual({
+ executable: 'ScummVM/scummvm.exe',
+ args: ['-c', 'game.ini', 'gameid']
+ })
+ })
+
+ it('refuses arguments with unresolved variables so cmd can run the batch', () => {
+ expect(
+ parseBatchLauncher('scummvm.exe -c "%GAME%.ini" gameid')
+ ).toBeUndefined()
+ })
+
+ it('parses a quoted executable without a start prefix', () => {
+ expect(parseBatchLauncher('"ScummVM\\scummvm.exe" --no-console')).toEqual({
+ executable: 'ScummVM/scummvm.exe',
+ args: ['--no-console']
+ })
+ })
+
+ it('refuses drive-absolute and UNC targets so Wine runs the batch', () => {
+ expect(parseBatchLauncher('start C:\\Game\\game.exe -x')).toBeUndefined()
+ expect(parseBatchLauncher('"D:/Games/game.exe" -x')).toBeUndefined()
+ expect(parseBatchLauncher('\\\\server\\share\\game.exe -x')).toBeUndefined()
+ })
+})
+
+describe('resolveCaseInsensitivePath', () => {
+ let dir: string
+
+ beforeEach(() => {
+ dir = mkdtempSync(join(tmpdir(), 'zoom-case-'))
+ mkdirSync(join(dir, 'scummvm'))
+ writeFileSync(join(dir, 'scummvm', 'scummvm.exe'), '')
+ writeFileSync(join(dir, 'thecolony.ini'), '')
+ })
+
+ afterEach(() => {
+ rmSync(dir, { recursive: true, force: true })
+ })
+
+ it('resolves a launcher path whose case differs from the archive', () => {
+ expect(resolveCaseInsensitivePath(dir, 'ScummVM/scummvm.exe')).toBe(
+ 'scummvm/scummvm.exe'
+ )
+ })
+
+ it('resolves backslash-separated Windows paths', () => {
+ expect(resolveCaseInsensitivePath(dir, 'ScummVM\\scummvm.exe')).toBe(
+ 'scummvm/scummvm.exe'
+ )
+ })
+
+ it('returns undefined when a segment is missing', () => {
+ expect(
+ resolveCaseInsensitivePath(dir, 'ScummVM/missing.exe')
+ ).toBeUndefined()
+ expect(resolveCaseInsensitivePath(dir, 'Nope/scummvm.exe')).toBeUndefined()
+ })
+
+ it('returns undefined for an empty path', () => {
+ expect(resolveCaseInsensitivePath(dir, '')).toBeUndefined()
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/capabilities.test.ts b/src/backend/storeManagers/zoom/__tests__/capabilities.test.ts
new file mode 100644
index 000000000..daf98eb3b
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/capabilities.test.ts
@@ -0,0 +1,37 @@
+import { Runner } from 'common/types'
+import {
+ runnerCapabilities,
+ supportsCapability
+} from 'common/runnerCapabilities'
+
+describe('runner capabilities', () => {
+ it('offers no update, repair or cloud saves for zoom', () => {
+ expect(runnerCapabilities.zoom).toEqual({
+ update: false,
+ repair: false,
+ cloudSaves: false
+ })
+ })
+
+ it('keeps update and repair for the stores that implement them', () => {
+ for (const runner of ['legendary', 'gog', 'nile', 'steam', 'itchio']) {
+ expect(supportsCapability(runner as Runner, 'update')).toBe(true)
+ expect(supportsCapability(runner as Runner, 'repair')).toBe(true)
+ }
+ })
+
+ it('reserves cloudSaves for real support, not syncSaves stubs', () => {
+ expect(runnerCapabilities.nile.cloudSaves).toBe(false)
+ expect(runnerCapabilities.itchio.cloudSaves).toBe(false)
+ expect(runnerCapabilities.legendary.cloudSaves).toBe(true)
+ })
+
+ it('does not report capabilities for sideloaded games', () => {
+ expect(supportsCapability('sideload', 'update')).toBe(false)
+ expect(supportsCapability('sideload', 'cloudSaves')).toBe(false)
+ })
+
+ it('falls back to false for unknown runners', () => {
+ expect(supportsCapability('unknown' as Runner, 'update')).toBe(false)
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/catalog.test.ts b/src/backend/storeManagers/zoom/__tests__/catalog.test.ts
new file mode 100644
index 000000000..6f72bd6a4
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/catalog.test.ts
@@ -0,0 +1,48 @@
+import { readFileSync } from 'fs'
+import { join } from 'node:path'
+
+const catalog = JSON.parse(
+ readFileSync(
+ join(process.cwd(), 'public/locales/en/translation.json'),
+ 'utf-8'
+ )
+) as Record<string, unknown>
+
+interface CatalogNode {
+ [key: string]: string | CatalogNode
+}
+
+describe('zoom catalog', () => {
+ it('has the zoom keys at the top level, not under header', () => {
+ expect(catalog.zoom).toBeDefined()
+ expect((catalog.header as CatalogNode).zoom).toBeUndefined()
+ })
+
+ it('keeps stores and uncategorized at the top level too', () => {
+ const header = catalog.header as CatalogNode
+
+ expect(header.zoom).toBeUndefined()
+ expect(header.stores).toBeUndefined()
+ expect(header.uncategorized).toBeUndefined()
+ expect(catalog.stores).toBe('Stores')
+ expect(catalog.uncategorized).toBe('Uncategorized')
+ })
+
+ it('resolves the collection copy and its plural summary', () => {
+ const zoom = catalog.zoom as CatalogNode
+ const collections = zoom.collections as CatalogNode
+
+ expect(collections.title).toBe('Select files to install')
+ expect(collections.description).toBe(
+ 'This product includes more than one file. Pick what you want to install.'
+ )
+ expect(collections.noFiles).toBe('This product has no files to install.')
+ expect(collections.noBuildHint).toBe(
+ 'Choose another platform to see its files.'
+ )
+ expect(collections.changePlatform).toBe('Change platform')
+ expect(collections.selectedTotal).toBe('Selected: {{size}}')
+ expect(collections.extrasSummary_one).toBe('{{count}} files · {{size}}')
+ expect(collections.extrasSummary_other).toBe('{{count}} files · {{size}}')
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/collections.test.ts b/src/backend/storeManagers/zoom/__tests__/collections.test.ts
new file mode 100644
index 000000000..788e07170
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/collections.test.ts
@@ -0,0 +1,105 @@
+import {
+ carryZoomSelection,
+ hasSelectedGameFile,
+ isInstallableZoomFile,
+ selectedZoomFileGroups,
+ shouldShowZoomCollections,
+ zoomFilesBytes,
+ zoomSelectionDefaults
+} from 'common/zoomFiles'
+import { resolveZoomInstallSelection } from '../selection'
+import { ZoomDownloadFile } from 'common/types/zoom'
+
+const file = (id: string, extra = false): ZoomDownloadFile => ({
+ id,
+ name: extra ? `extra-${id}` : `game-${id}`,
+ filename: extra ? `extra-${id}.zip` : `game-${id}.tar.xz`,
+ size: '1 GB',
+ total_size: 1024
+})
+
+const oneBuild = { game: [file('a')], extras: [] }
+const buildWithExtras = { game: [file('a')], extras: [file('x', true)] }
+const twoBuilds = { game: [file('a'), file('b')], extras: [file('x', true)] }
+
+describe('zoom file selection', () => {
+ it('skips the step only for a single game file without extras', () => {
+ expect(shouldShowZoomCollections(oneBuild)).toBe(false)
+ expect(shouldShowZoomCollections(buildWithExtras)).toBe(true)
+ expect(shouldShowZoomCollections(twoBuilds)).toBe(true)
+ // No files still shows the step so it can explain the empty product
+ expect(shouldShowZoomCollections({ game: [], extras: [] })).toBe(true)
+ })
+
+ it('only offers files the platform install loop can apply', () => {
+ expect(isInstallableZoomFile('setup.exe', 'windows')).toBe(true)
+ expect(isInstallableZoomFile('manual.pdf', 'windows')).toBe(false)
+
+ expect(isInstallableZoomFile('game.tar.xz', 'linux')).toBe(true)
+ expect(isInstallableZoomFile('install.sh', 'linux')).toBe(true)
+ expect(isInstallableZoomFile('installer.run', 'linux')).toBe(true)
+ expect(isInstallableZoomFile('setup.exe', 'linux')).toBe(false)
+ expect(isInstallableZoomFile('soundtrack.zip', 'linux')).toBe(false)
+ })
+
+ it('preselects every game file and leaves extras unchecked by default', () => {
+ expect(zoomSelectionDefaults(twoBuilds)).toEqual(['a', 'b'])
+ expect(
+ zoomSelectionDefaults({ game: [], extras: twoBuilds.extras })
+ ).toEqual([])
+ })
+
+ it('keeps stored ids, dropping files that disappeared', () => {
+ expect(zoomSelectionDefaults(twoBuilds, ['a', 'gone'])).toEqual(['a'])
+ expect(zoomSelectionDefaults(buildWithExtras, ['a', 'x'])).toEqual([
+ 'a',
+ 'x'
+ ])
+ })
+
+ it('falls back to defaults when no stored game file exists', () => {
+ expect(zoomSelectionDefaults(twoBuilds, ['x', 'gone'])).toEqual(['a', 'b'])
+ expect(zoomSelectionDefaults(oneBuild, [])).toEqual(['a'])
+ })
+
+ it('counts only selected files and knows whether a game file is in', () => {
+ expect(zoomFilesBytes([file('a'), file('x', true)])).toBe(2048)
+ expect(hasSelectedGameFile(twoBuilds, ['x'])).toBe(false)
+ expect(hasSelectedGameFile(twoBuilds, ['b'])).toBe(true)
+ expect(selectedZoomFileGroups(twoBuilds, ['a']).extras).toEqual([])
+ })
+
+ it('keeps only ids that exist when the platform changes', () => {
+ expect(carryZoomSelection(twoBuilds, ['a', 'x'])).toEqual(['a', 'x'])
+ expect(carryZoomSelection(twoBuilds, ['a', 'gone'])).toEqual(['a'])
+ })
+
+ it('falls back to the new platform defaults when no game id survives', () => {
+ const otherPlatform = {
+ game: [file('b'), file('c')],
+ extras: [file('x', true)]
+ }
+
+ expect(carryZoomSelection(otherPlatform, ['a', 'x'])).toEqual(['b', 'c'])
+ expect(carryZoomSelection(otherPlatform, [])).toEqual(['b', 'c'])
+ })
+
+ it('rejects an install without a game file', () => {
+ const result = resolveZoomInstallSelection(buildWithExtras, ['x'], 'pick')
+ expect(result).toEqual({ error: 'pick' })
+ })
+
+ it('defaults to all game files when no selection is sent', () => {
+ const result = resolveZoomInstallSelection(twoBuilds, undefined, 'pick')
+
+ expect('selection' in result && result.selection.game).toHaveLength(2)
+ expect('selection' in result && result.ids).toEqual(['a', 'b'])
+ })
+
+ it('keeps the selected game files and extras', () => {
+ const result = resolveZoomInstallSelection(twoBuilds, ['b', 'x'], 'pick')
+
+ expect('ids' in result && result.ids).toEqual(['b', 'x'])
+ expect('selection' in result && result.selection.game).toEqual([file('b')])
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/errors.test.ts b/src/backend/storeManagers/zoom/__tests__/errors.test.ts
new file mode 100644
index 000000000..41b4a5911
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/errors.test.ts
@@ -0,0 +1,21 @@
+import { installerLookupError, missingInstallersError } from '../errors'
+
+describe('zoom installer errors', () => {
+ it('reports the HTTP status when the API answered', () => {
+ expect(installerLookupError(404)).toBe(
+ 'Zoom installer lookup failed (HTTP 404)'
+ )
+ })
+
+ it('does not invent a status when the request never got one', () => {
+ expect(installerLookupError()).toBe(
+ 'Zoom installer lookup failed (network or auth error)'
+ )
+ })
+
+ it('names the platform when no installer is listed', () => {
+ expect(missingInstallersError('linux')).toBe(
+ 'No installers available for linux on this product'
+ )
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/install.test.ts b/src/backend/storeManagers/zoom/__tests__/install.test.ts
new file mode 100644
index 000000000..080039a28
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/install.test.ts
@@ -0,0 +1,66 @@
+import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'graceful-fs'
+import { join } from 'node:path'
+import { tmpdir } from 'node:os'
+import {
+ findStartScript,
+ linuxInstallerPath,
+ resolveStartScript
+} from '../install'
+
+describe('zoom linux install paths', () => {
+ it('reads the installer from the download root', () => {
+ expect(linuxInstallerPath('/games/.zoom-download', 'game.tar.xz')).toBe(
+ '/games/.zoom-download/game.tar.xz'
+ )
+ })
+
+ it('finds start.sh in the extracted game folder', () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-install-'))
+ const gamePath = join(root, 'game')
+ mkdirSync(gamePath)
+ writeFileSync(join(gamePath, 'start.sh'), '')
+
+ expect(resolveStartScript(gamePath)).toBe(join(gamePath, 'start.sh'))
+
+ rmSync(root, { recursive: true, force: true })
+ })
+
+ it('finds start.sh inside a single extracted folder', () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-install-'))
+ const gamePath = join(root, 'Game')
+ mkdirSync(gamePath)
+ writeFileSync(join(gamePath, 'start.sh'), '')
+
+ expect(findStartScript(root)).toBe(join(gamePath, 'start.sh'))
+
+ rmSync(root, { recursive: true, force: true })
+ })
+
+ it('ignores the extras folder when looking for the game', () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-install-'))
+ mkdirSync(join(root, 'extras'))
+ writeFileSync(join(root, 'start.sh'), '')
+
+ expect(findStartScript(root)).toBe(join(root, 'start.sh'))
+
+ rmSync(root, { recursive: true, force: true })
+ })
+
+ it('does not guess between several top-level folders', () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-install-'))
+ mkdirSync(join(root, 'one'))
+ mkdirSync(join(root, 'two'))
+
+ expect(findStartScript(root)).toBeUndefined()
+
+ rmSync(root, { recursive: true, force: true })
+ })
+
+ it('returns undefined when start.sh is missing', () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-install-'))
+
+ expect(resolveStartScript(root)).toBeUndefined()
+
+ rmSync(root, { recursive: true, force: true })
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/launch.test.ts b/src/backend/storeManagers/zoom/__tests__/launch.test.ts
new file mode 100644
index 000000000..7173d520a
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/launch.test.ts
@@ -0,0 +1,20 @@
+import { steamRuntimeForWrappers } from '../launch'
+
+describe('steamRuntimeForWrappers', () => {
+ it('only forwards a Steam runtime for native launches', () => {
+ expect(steamRuntimeForWrappers(true, ['steam-runtime'])).toEqual([
+ 'steam-runtime'
+ ])
+ expect(steamRuntimeForWrappers(false, ['steam-runtime'])).toBeUndefined()
+ })
+
+ it('leaves the wrappers untouched without a runtime', () => {
+ expect(steamRuntimeForWrappers(true, [])).toBeUndefined()
+ expect(steamRuntimeForWrappers(true, undefined)).toBeUndefined()
+ })
+
+ it('returns a copy instead of the caller array', () => {
+ const runtime = ['steam-runtime']
+ expect(steamRuntimeForWrappers(true, runtime)).not.toBe(runtime)
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/linuxInstall.test.ts b/src/backend/storeManagers/zoom/__tests__/linuxInstall.test.ts
new file mode 100644
index 000000000..907a2ffb3
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/linuxInstall.test.ts
@@ -0,0 +1,106 @@
+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'graceful-fs'
+import { join } from 'node:path'
+import { tmpdir } from 'node:os'
+import { ZoomDownloadFile } from 'common/types/zoom'
+import { applyLinuxGameFiles } from '../linuxInstall'
+
+const file = (id: string, filename: string): ZoomDownloadFile => ({
+ id,
+ name: filename,
+ filename,
+ size: '1 GB',
+ total_size: 1024
+})
+
+const ok = { stdout: '', stderr: '' }
+
+describe('applyLinuxGameFiles', () => {
+ it('keeps the executable found before a patch adds a second folder', async () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-linux-'))
+ const installPath = join(root, 'game')
+ mkdirSync(installPath)
+
+ const run = async (gameFile: ZoomDownloadFile) => {
+ if (gameFile.id === 'base') {
+ mkdirSync(join(installPath, 'base'))
+ writeFileSync(join(installPath, 'base', 'start.sh'), '')
+ } else {
+ mkdirSync(join(installPath, 'patch'))
+ }
+ return ok
+ }
+
+ const result = await applyLinuxGameFiles(
+ [file('base', 'base.tar.xz'), file('patch', 'patch.tar.xz')],
+ installPath,
+ run,
+ () => undefined
+ )
+
+ expect(result.executable).toBe(join(installPath, 'base', 'start.sh'))
+ expect(result.error).toBeUndefined()
+
+ rmSync(root, { recursive: true, force: true })
+ })
+
+ it('resolves start.sh for a non-tar installer instead of the download', async () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-linux-'))
+ const installPath = join(root, 'game')
+ mkdirSync(installPath)
+
+ const result = await applyLinuxGameFiles(
+ [file('run', 'installer.run')],
+ installPath,
+ async () => {
+ writeFileSync(join(installPath, 'start.sh'), '')
+ return ok
+ },
+ () => undefined
+ )
+
+ expect(result.executable).toBe(join(installPath, 'start.sh'))
+
+ rmSync(root, { recursive: true, force: true })
+ })
+
+ it('reports no executable when no file provides a start script', async () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-linux-'))
+ const installPath = join(root, 'game')
+ mkdirSync(installPath)
+ mkdirSync(join(installPath, 'base'))
+
+ const result = await applyLinuxGameFiles(
+ [file('base', 'base.tar.xz')],
+ installPath,
+ async () => ok,
+ () => undefined
+ )
+
+ expect(result.executable).toBeUndefined()
+ expect(result.error).toBeUndefined()
+
+ rmSync(root, { recursive: true, force: true })
+ })
+
+ it('stops when a game file fails', async () => {
+ const root = mkdtempSync(join(tmpdir(), 'zoom-linux-'))
+ const installPath = join(root, 'game')
+ mkdirSync(installPath)
+
+ const second = jest.fn(async () => ok)
+ const result = await applyLinuxGameFiles(
+ [file('base', 'base.tar.xz'), file('patch', 'patch.tar.xz')],
+ installPath,
+ async (gameFile) =>
+ gameFile.id === 'base'
+ ? { stdout: '', stderr: '', error: 'boom' }
+ : second(),
+ () => undefined
+ )
+
+ expect(result.error).toBe('boom')
+ expect(second).not.toHaveBeenCalled()
+
+ rmSync(root, { recursive: true, force: true })
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/move.test.ts b/src/backend/storeManagers/zoom/__tests__/move.test.ts
new file mode 100644
index 000000000..627d447a5
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/move.test.ts
@@ -0,0 +1,57 @@
+import { remapInstallPath, withInstallPath } from '../move'
+
+const installed = [
+ { appName: 'zoom-1', install_path: '/games/one' },
+ { appName: 'zoom-2', install_path: '/games/two' }
+]
+
+describe('withInstallPath', () => {
+ it('rewrites only the moved game', () => {
+ const updated = withInstallPath(installed, 'zoom-2', '/new/two')
+
+ expect(updated).toEqual([
+ { appName: 'zoom-1', install_path: '/games/one' },
+ { appName: 'zoom-2', install_path: '/new/two' }
+ ])
+ })
+
+ it('does not mutate the stored list', () => {
+ withInstallPath(installed, 'zoom-1', '/new/one')
+
+ expect(installed[0].install_path).toBe('/games/one')
+ })
+
+ it('returns undefined for an unknown game', () => {
+ expect(withInstallPath(installed, 'zoom-3', '/new/three')).toBeUndefined()
+ })
+})
+
+describe('remapInstallPath', () => {
+ it('re-points a path inside the old install folder', () => {
+ expect(
+ remapInstallPath('/old/game/start.sh', '/old/game', '/new/game')
+ ).toBe('/new/game/start.sh')
+ })
+
+ it('leaves values outside the old folder untouched', () => {
+ expect(remapInstallPath('/other/start.sh', '/old/game', '/new/game')).toBe(
+ '/other/start.sh'
+ )
+ })
+
+ it('handles a missing value', () => {
+ expect(remapInstallPath(undefined, '/old', '/new')).toBeUndefined()
+ })
+
+ it('does not claim a sibling folder with a shared prefix', () => {
+ expect(
+ remapInstallPath('/games/Game2/start.sh', '/games/Game', '/new/Game')
+ ).toBe('/games/Game2/start.sh')
+ })
+
+ it('remaps the folder itself', () => {
+ expect(remapInstallPath('/games/Game', '/games/Game', '/new/Game')).toBe(
+ '/new/Game'
+ )
+ })
+})
diff --git a/src/backend/storeManagers/zoom/__tests__/stop.test.ts b/src/backend/storeManagers/zoom/__tests__/stop.test.ts
new file mode 100644
index 000000000..f74771f6d
--- /dev/null
+++ b/src/backend/storeManagers/zoom/__tests__/stop.test.ts
@@ -0,0 +1,16 @@
+import { stoppedGameStatus, stopNeedsWineShutdown } from '../stop'
+
+describe('zoom stop', () => {
+ it('only shuts Wine down for non-native launches', () => {
+ expect(stopNeedsWineShutdown(false)).toBe(true)
+ expect(stopNeedsWineShutdown(true)).toBe(false)
+ })
+
+ it('clears the playing state for the right game', () => {
+ expect(stoppedGameStatus('zoom-1')).toEqual({
+ appName: 'zoom-1',
+ runner: 'zoom',
+ status: 'done'
+ })
+ })
+})
diff --git a/src/backend/storeManagers/zoom/errors.ts b/src/backend/storeManagers/zoom/errors.ts
new file mode 100644
index 000000000..7e8f7013c
--- /dev/null
+++ b/src/backend/storeManagers/zoom/errors.ts
@@ -0,0 +1,8 @@
+export function installerLookupError(status?: number): string {
+ const detail = status ? `HTTP ${status}` : 'network or auth error'
+ return `Zoom installer lookup failed (${detail})`
+}
+
+export function missingInstallersError(platform: string): string {
+ return `No installers available for ${platform} on this product`
+}
diff --git a/src/backend/storeManagers/zoom/games.ts b/src/backend/storeManagers/zoom/games.ts
index 922d0db2d..b93e6f796 100644
--- a/src/backend/storeManagers/zoom/games.ts
+++ b/src/backend/storeManagers/zoom/games.ts
@@ -2,10 +2,10 @@ import { GameConfig } from '../../game_config'
import {
errorHandler,
getFileSize,
- parseSize,
spawnAsync,
sendGameStatusUpdate,
- sendProgressUpdate
+ sendProgressUpdate,
+ shutdownWine
} from '../../utils'
import { join, relative, dirname, basename, isAbsolute } from 'node:path'
import * as fs from 'fs'
@@ -43,13 +43,22 @@ import {
prepareWineLaunch,
runWineCommand
} from '../../launcher'
+import { moveOnUnix, moveOnWindows } from '../../utils'
import {
addShortcuts as addShortcutsUtil,
removeShortcuts as removeShortcutsUtil
} from '../../shortcuts/shortcuts/shortcuts'
import { removeNonSteamGame } from '../../shortcuts/nonesteamgame/nonesteamgame'
import shlex from 'shlex'
-import { ZoomInstallPlatform, ZoomDownloadFile } from 'common/types/zoom'
+import { ZoomInstallPlatform } from 'common/types/zoom'
+import { steamRuntimeForWrappers } from './launch'
+import { linuxInstallerPath, resolveCaseInsensitivePath } from './install'
+import { applyLinuxGameFiles } from './linuxInstall'
+import { findBatchLauncher, parseBatchLauncher } from './install'
+import { missingInstallersError } from './errors'
+import { resolveZoomInstallSelection } from './selection'
+import { ZoomFileGroups, zoomFilesBytes } from 'common/zoomFiles'
+import { stoppedGameStatus, stopNeedsWineShutdown } from './stop'
import { t } from 'i18next'
import { showDialogBoxModalAuto } from '../../dialog/dialog'
import { sendFrontendMessage } from '../../ipc'
@@ -216,7 +225,8 @@ export default class ZoomGame implements Game {
async install({
path,
platformToInstall,
- installLanguage
+ installLanguage,
+ zoomFileIds
}: InstallArgs): Promise<{
status: 'done' | 'error' | 'abort'
error?: string
@@ -237,51 +247,70 @@ export default class ZoomGame implements Game {
platformToInstall.toLowerCase() as ZoomInstallPlatform
let finalInstallPlatform = installPlatform
- // Fetch installer URL
- const installers: ZoomDownloadFile[] = await libraryManagerMap[
- 'zoom'
- ].getInstallers(installPlatform, this.id)
- if (installers.length === 0 || !installers[0].url) {
- logError(
- `No installer found for ${this.id} on ${installPlatform}`,
- LogPrefix.Zoom
+ let files: ZoomFileGroups
+ try {
+ files = await libraryManagerMap['zoom'].getFiles(this.id, installPlatform)
+ } catch (error) {
+ const message = error instanceof Error ? error.message : String(error)
+ logError([`File lookup failed for ${this.id}:`, message], LogPrefix.Zoom)
+ return { status: 'error', error: message }
+ }
+
+ if (!files.game.length && !files.extras.length) {
+ const error = missingInstallersError(installPlatform)
+ logError(`${error} (${this.id})`, LogPrefix.Zoom)
+ return { status: 'error', error }
+ }
+
+ const selectionResult = resolveZoomInstallSelection(
+ files,
+ zoomFileIds,
+ t(
+ 'zoom.collections.selectOne',
+ 'Select at least one game file to continue.'
)
- return { status: 'error', error: 'No installer found' }
+ )
+ if ('error' in selectionResult) {
+ logError(`${selectionResult.error} (${this.id})`, LogPrefix.Zoom)
+ return { status: 'error', error: selectionResult.error }
}
+ const { selection, ids: selectedFileIds } = selectionResult
+ const selectedFiles = [...selection.game, ...selection.extras]
+
const installPath = join(path, gameInfo.folder_name)
const downloadRoot = join(path, '.zoom-download')
const infFilePath = join(downloadRoot, 'zoom_installer.inf')
- const totalSize = installers
- .map((file) => parseSize(file.size))
- .reduce((acc, num) => acc + num, 0)
+ let totalSize = zoomFilesBytes(selectedFiles)
let downloaded = 0
- for (const file of installers) {
+ for (const file of selectedFiles) {
const downloadPath = join(downloadRoot, file.filename)
let fileDownloaded = 0
// Create game directory
fs.mkdirSync(downloadRoot, { recursive: true })
- // Download the installer
- logInfo(
- `Downloading installer from ${file.url} to ${downloadPath}`,
- LogPrefix.Zoom
- )
+ // Download the file
+ logInfo(`Downloading ${file.name} to ${downloadPath}`, LogPrefix.Zoom)
if (!existsSync(downloadPath)) {
try {
- const response = await axios.get(file.url!, {
+ const url =
+ file.url ||
+ (await libraryManagerMap['zoom'].getDownloadUrl(file.id))
+ const response = await axios.get(url, {
responseType: 'stream',
onDownloadProgress: (progressEvent: AxiosProgressEvent) => {
let percent: undefined | number
if (progressEvent.bytes) {
fileDownloaded = fileDownloaded + progressEvent.bytes
- percent = Math.round(
- ((downloaded + fileDownloaded) * 100) / totalSize
- )
+ percent = totalSize
+ ? Math.round(
+ ((downloaded + fileDownloaded) * 100) / totalSize
+ )
+ : 0
}
this.onInstallOrUpdateOutput(
@@ -292,68 +321,85 @@ export default class ZoomGame implements Game {
}
})
- await pipeline(response.data, createWriteStream(downloadPath)) // Use pipeline for robust stream handling
- logInfo(`Installer downloaded to ${downloadPath}`, LogPrefix.Zoom)
+ // Download beside the target and rename only when complete, so a
+ // dropped connection cannot leave a truncated file that the next
+ // attempt would trust as already downloaded.
+ const partialPath = `${downloadPath}.partial`
+ await pipeline(response.data, createWriteStream(partialPath))
+ await fs.promises.rename(partialPath, downloadPath)
+ logInfo(`Downloaded ${file.name} to ${downloadPath}`, LogPrefix.Zoom)
- downloaded = downloaded + parseSize(file.size)
+ downloaded = downloaded + file.total_size
} catch (error) {
- logError(['Failed to download installer:', error], LogPrefix.Zoom)
+ await fs.promises
+ .rm(`${downloadPath}.partial`, { force: true })
+ .catch(() => {
+ // The original failure is the one worth reporting.
+ })
+
+ if (selection.extras.some((extra) => extra.id === file.id)) {
+ logWarning(
+ [`Failed to download extra ${file.name}:`, error],
+ LogPrefix.Zoom
+ )
+ totalSize -= file.total_size
+ continue
+ }
+
+ logError(['Failed to download file:', error], LogPrefix.Zoom)
return {
status: 'error',
- error: `Failed to download installer: ${error}`
+ error: `Failed to download ${file.name}: ${error}`
}
}
} else {
+ downloaded = downloaded + file.total_size
logDebug(`File already exists ${downloadPath}, skipping`)
}
}
- // Execute the installer
- let installResult: ExecResult
+ // Execute the selected game files in the order the API lists them
+ let installResult: ExecResult = { stdout: '', stderr: '' }
let confFilesBefore: string[] = []
let executable: string = ''
if (installPlatform === 'linux') {
- const downloadPath = join(installPath, installers[0].filename)
-
- if (downloadPath.endsWith('.tar.xz')) {
- logInfo(`Extracting ${downloadPath}...`, LogPrefix.Zoom)
- installResult = await spawnAsync('tar', [
- '-xf',
- downloadPath,
- '-C',
- installPath
- ])
- let gamePath = installPath
- const files = await fs.promises.readdir(installPath)
- const gameDir = files.find((f) =>
- fs.statSync(join(path, gameInfo.folder_name!, f)).isDirectory()
- )
- if (gameDir) {
- gamePath = join(installPath, gameDir)
- }
+ fs.mkdirSync(installPath, { recursive: true })
+ const linuxResult = await applyLinuxGameFiles(
+ selection.game,
+ installPath,
+ async (file) => {
+ const downloadPath = linuxInstallerPath(downloadRoot, file.filename)
+
+ if (downloadPath.endsWith('.tar.xz')) {
+ logInfo(`Extracting ${downloadPath}...`, LogPrefix.Zoom)
+ return spawnAsync('tar', ['-xf', downloadPath, '-C', installPath])
+ }
+
+ await fs.promises.chmod(downloadPath, '755')
+ return spawnAsync(downloadPath, [], { cwd: installPath })
+ },
+ (message) => logInfo(message, LogPrefix.Zoom)
+ )
- const exe = join(gamePath, 'start.sh')
- if (existsSync(exe)) {
- executable = exe
- await fs.promises.chmod(executable, '755')
+ if (linuxResult.error) {
+ return {
+ status: 'error',
+ error: `Installer execution failed: ${linuxResult.error}`
}
- } else {
- await fs.promises.chmod(executable, '755')
- installResult = await spawnAsync(executable, [], {
- cwd: installPath
- })
}
- } else {
- // windows
- // Determine executable based on platform (similar to zoom.py's AUTO_ELF_EXE, AUTO_WIN32_EXE)
- // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
- executable = installers.find((file) =>
- file.filename.endsWith('.exe')
- )?.filename!
+ executable = linuxResult.executable ?? ''
+ if (!executable) {
+ const error =
+ 'Could not find start.sh after installing the selected files'
+ logError(error, LogPrefix.Zoom)
+ return { status: 'error', error }
+ }
- logInfo(`Executing installer: ${executable}`, LogPrefix.Zoom)
+ installResult = { stdout: '', stderr: '' }
+ } else {
+ // windows
const gameSettings = await this.getSettings()
await writeFile(
@@ -368,25 +414,38 @@ export default class ZoomGame implements Game {
fs.mkdirSync(installPath, { recursive: true })
}
- installResult = await runWineCommand({
- commandParts: [
- join(downloadRoot, executable),
- '/NORESTART',
- '/NOICONS',
- '/SP-',
- `/DIR=Z:${installPath.replaceAll('/', '\\')}`,
- `/LOADINF=Z:${infFilePath.replaceAll('/', '\\')}`,
- '/LOG=C:\\zoom_installer.log'
- ],
- gameSettings,
- gameInstallPath: path,
- wait: true,
- options: {
- logMessagePrefix: `Installing ${this.id}`,
- logWriters: [await createGameLogWriter(this.id, 'zoom', 'install')],
- abortId: this.id
+ for (const file of selection.game) {
+ if (!file.filename.endsWith('.exe')) {
+ continue
}
- })
+
+ const installerPath = join(downloadRoot, file.filename)
+ logInfo(`Executing installer: ${installerPath}`, LogPrefix.Zoom)
+
+ installResult = await runWineCommand({
+ commandParts: [
+ installerPath,
+ '/NORESTART',
+ '/NOICONS',
+ '/SP-',
+ `/DIR=Z:${installPath.replaceAll('/', '\\')}`,
+ `/LOADINF=Z:${infFilePath.replaceAll('/', '\\')}`,
+ '/LOG=C:\\zoom_installer.log'
+ ],
+ gameSettings,
+ gameInstallPath: path,
+ wait: true,
+ options: {
+ logMessagePrefix: `Installing ${this.id}`,
+ logWriters: [await createGameLogWriter(this.id, 'zoom', 'install')],
+ abortId: this.id
+ }
+ })
+
+ if (installResult.error) {
+ break
+ }
+ }
}
if (installResult.error) {
@@ -444,55 +503,77 @@ export default class ZoomGame implements Game {
}
if (!isDosbox) {
- const findExes = async (dir: string): Promise<string[]> => {
- let exes: string[] = []
+ // DOS/ScummVM packages ship .bat launchers (often with the game id as
+ // an argument). Running the raw scummvm.exe opens the launcher instead
+ // of the game, so prefer a top-level batch launcher when present.
+ // Native Windows spawns the stored executable directly, so a .bat
+ // there would only break the launch. The launcher preference is for
+ // games running through Wine.
+ let launcher: string | undefined
+ if (!this.isNative()) {
try {
- const list = await fs.promises.readdir(dir, { withFileTypes: true })
- for (const file of list) {
- const fullPath = join(dir, file.name)
- if (file.isDirectory()) {
- exes = exes.concat(await findExes(fullPath))
- } else if (file.name.toLowerCase().endsWith('.exe')) {
- exes.push(fullPath)
- }
- }
+ launcher = findBatchLauncher(installPath)
} catch (error) {
- logError(
- `Error finding .exe files in ${dir}: ${error}`,
- LogPrefix.Zoom
- )
+ logError(`Error reading install dir: ${error}`, LogPrefix.Zoom)
}
- return exes
}
- const exes = (await findExes(installPath))
- .map((f) => relative(installPath, f))
- .filter((name) => !/setup|unins|redist/i.test(name))
-
- if (exes.length === 1) {
- finalExecutable = exes[0]
- } else if (exes.length > 1) {
- // Try to find an exe with the game's name in it
- const gameInfo = this.getGameInfo()
- const gameName = gameInfo.title
- .toLowerCase()
- .replace(/[^a-z0-9]/g, '')
- const bestMatch = exes.find((exe) =>
- exe
+
+ if (launcher) {
+ finalExecutable = launcher
+ logInfo(`Using launcher: ${launcher}`, LogPrefix.Zoom)
+ } else {
+ const findExes = async (dir: string): Promise<string[]> => {
+ let exes: string[] = []
+ try {
+ const list = await fs.promises.readdir(dir, {
+ withFileTypes: true
+ })
+ for (const file of list) {
+ const fullPath = join(dir, file.name)
+ if (file.isDirectory()) {
+ exes = exes.concat(await findExes(fullPath))
+ } else if (file.name.toLowerCase().endsWith('.exe')) {
+ exes.push(fullPath)
+ }
+ }
+ } catch (error) {
+ logError(
+ `Error finding .exe files in ${dir}: ${error}`,
+ LogPrefix.Zoom
+ )
+ }
+ return exes
+ }
+ const exes = (await findExes(installPath))
+ .map((f) => relative(installPath, f))
+ .filter((name) => !/setup|unins|redist/i.test(name))
+
+ if (exes.length === 1) {
+ finalExecutable = exes[0]
+ } else if (exes.length > 1) {
+ // Try to find an exe with the game's name in it
+ const gameInfo = this.getGameInfo()
+ const gameName = gameInfo.title
.toLowerCase()
.replace(/[^a-z0-9]/g, '')
- .includes(gameName)
- )
- if (bestMatch) {
- finalExecutable = bestMatch
- } else {
- // As a fallback, pick the largest exe
- let largestSize = 0
- for (const exe of exes) {
- const exePath = join(installPath, exe)
- const stats = fs.statSync(exePath)
- if (stats.size > largestSize) {
- largestSize = stats.size
- finalExecutable = exe
+ const bestMatch = exes.find((exe) =>
+ exe
+ .toLowerCase()
+ .replace(/[^a-z0-9]/g, '')
+ .includes(gameName)
+ )
+ if (bestMatch) {
+ finalExecutable = bestMatch
+ } else {
+ // As a fallback, pick the largest exe
+ let largestSize = 0
+ for (const exe of exes) {
+ const exePath = join(installPath, exe)
+ const stats = fs.statSync(exePath)
+ if (stats.size > largestSize) {
+ largestSize = stats.size
+ finalExecutable = exe
+ }
}
}
}
@@ -501,6 +582,26 @@ export default class ZoomGame implements Game {
} else {
finalExecutable = executable
}
+
+ // Extras are not installers: keep them next to the game files
+ if (selection.extras.length) {
+ const extrasDir = join(installPath, 'extras')
+ await fs.promises.mkdir(extrasDir, { recursive: true })
+
+ for (const extra of selection.extras) {
+ const source = join(downloadRoot, extra.filename)
+ if (existsSync(source)) {
+ await fs.promises.copyFile(source, join(extrasDir, extra.filename))
+ }
+ }
+ }
+
+ libraryManagerMap['zoom'].saveInstalledFileIds(
+ this.id,
+ installPlatform,
+ selectedFileIds
+ )
+
await rm(downloadRoot, { recursive: true, force: true })
if (!finalExecutable) {
logError(['Could not find executable for', this.id], LogPrefix.Zoom)
@@ -632,7 +733,7 @@ export default class ZoomGame implements Game {
mangoHudCommand,
gameModeBin,
gameScopeCommand,
- steamRuntime?.length ? [...steamRuntime] : undefined
+ steamRuntimeForWrappers(this.isNative(), steamRuntime)
)
const launchArgumentsArgs =
@@ -705,10 +806,72 @@ export default class ZoomGame implements Game {
return false
}
- const executable = gameSettings.targetExe || gameInfo.install.executable
- const startFolder = isAbsolute(executable)
- ? dirname(executable)
- : dirname(join(gameInfo.install.install_path, executable))
+ let executable = gameSettings.targetExe || gameInfo.install.executable
+ let batchArgs: string[] = []
+ let batchFolder: string | undefined
+
+ // Installs made before the launcher preference stored scummvm.exe
+ // directly; prefer the packaged .bat launcher when one exists.
+ if (
+ !gameSettings.targetExe &&
+ /scummvm(\.exe)?$/i.test(basename(executable))
+ ) {
+ try {
+ const launcher = findBatchLauncher(gameInfo.install.install_path)
+ if (launcher) {
+ executable = launcher
+ }
+ } catch (error) {
+ logWarning(`Could not read launchers: ${error}`, LogPrefix.Zoom)
+ }
+ }
+
+ // Archives sometimes ship a launcher whose case does not match the
+ // extracted folders (ScummVM/ vs scummvm/). Resolve it before any path
+ // is used as cwd; Linux lookups are case-sensitive.
+ if (!isAbsolute(executable)) {
+ executable =
+ resolveCaseInsensitivePath(
+ gameInfo.install.install_path,
+ executable
+ ) ?? executable
+ }
+
+ // Batch launchers contain spaces and quote their own arguments, so
+ // parse them and run the real target instead of going through cmd. The
+ // batch folder stays the working directory, matching cmd semantics for
+ // relative paths passed by the launcher.
+ if (executable.toLowerCase().endsWith('.bat')) {
+ const launcherPath = isAbsolute(executable)
+ ? executable
+ : join(gameInfo.install.install_path, executable)
+ batchFolder = dirname(launcherPath)
+ try {
+ const content = await fs.promises.readFile(launcherPath, 'utf8')
+ const parsed = parseBatchLauncher(content)
+ if (parsed) {
+ executable = isAbsolute(parsed.executable)
+ ? parsed.executable
+ : (resolveCaseInsensitivePath(
+ gameInfo.install.install_path,
+ parsed.executable
+ ) ?? parsed.executable)
+ batchArgs = parsed.args
+ } else {
+ logWarning(
+ 'Could not parse the batch launcher, running it directly',
+ LogPrefix.Zoom
+ )
+ }
+ } catch (error) {
+ logWarning(`Could not read launcher: ${error}`, LogPrefix.Zoom)
+ }
+ }
+ const startFolder =
+ batchFolder ??
+ (isAbsolute(executable)
+ ? dirname(executable)
+ : dirname(join(gameInfo.install.install_path, executable)))
if (await isUmuSupported(gameSettings)) {
const gameId =
@@ -719,8 +882,14 @@ export default class ZoomGame implements Game {
}
}
+ // A parsed launcher keeps its relative path so subfolders resolve. An
+ // unparsed batch is handed to Wine as-is, never through cmd.
+ const executableParts = batchFolder
+ ? [executable, ...batchArgs, ...commandParts]
+ : [basename(executable), ...commandParts]
+
const result = await runWineCommand({
- commandParts: [basename(executable), ...commandParts],
+ commandParts: executableParts,
gameSettings,
gameInstallPath: gameInfo.install.install_path,
installFolderName: gameInfo.folder_name,
@@ -745,14 +914,34 @@ export default class ZoomGame implements Game {
}
}
- async moveInstall(): Promise<
- { status: 'done' } | { status: 'error'; error: string }
- > {
- logWarning(
- `Move install not implemented for Zoom: ${this.id}`,
- LogPrefix.Zoom
+ async moveInstall(
+ newInstallPath: string
+ ): Promise<{ status: 'done' } | { status: 'error'; error: string }> {
+ const gameInfo = this.getGameInfo()
+ logInfo(`Moving ${gameInfo.title} to ${newInstallPath}`, LogPrefix.Zoom)
+
+ const moveImpl = isWindows ? moveOnWindows : moveOnUnix
+ const moveResult = await moveImpl(newInstallPath, gameInfo)
+
+ if (moveResult.status === 'error') {
+ logError(
+ [
+ 'Error moving',
+ gameInfo.title,
+ 'to',
+ newInstallPath,
+ moveResult.error
+ ],
+ LogPrefix.Zoom
+ )
+ return { status: 'error', error: moveResult.error }
+ }
+
+ await libraryManagerMap['zoom'].changeGameInstallPath(
+ this.id,
+ moveResult.installPath
)
- return { status: 'error', error: 'Move install not implemented' }
+ return { status: 'done' }
}
async repair(): Promise<ExecResult> {
@@ -815,12 +1004,18 @@ export default class ZoomGame implements Game {
}
async stop(): Promise<void> {
- logWarning(
- `Stop not fully implemented for Zoom: ${this.id}`,
- LogPrefix.Zoom
- )
- // For now, we don't have a specific process to stop for Zoom games
- // If wine is used, it will be handled by the launcher's wine cleanup.
+ logInfo(`Stopping ${this.id}`, LogPrefix.Zoom)
+
+ if (stopNeedsWineShutdown(this.isNative())) {
+ const gameSettings = await this.getSettings()
+ try {
+ await shutdownWine(gameSettings)
+ } catch (error) {
+ logError(['Error shutting down Wine:', error], LogPrefix.Zoom)
+ }
+ }
+
+ sendGameStatusUpdate(stoppedGameStatus(this.id))
}
async isGameAvailable(): Promise<boolean> {
diff --git a/src/backend/storeManagers/zoom/install.ts b/src/backend/storeManagers/zoom/install.ts
new file mode 100644
index 000000000..8c261b171
--- /dev/null
+++ b/src/backend/storeManagers/zoom/install.ts
@@ -0,0 +1,170 @@
+import { existsSync, readdirSync, statSync } from 'graceful-fs'
+import { join } from 'node:path'
+
+export const linuxInstallerPath = (downloadRoot: string, filename: string) =>
+ join(downloadRoot, filename)
+
+export function resolveStartScript(gamePath: string): string | undefined {
+ const candidate = join(gamePath, 'start.sh')
+
+ return existsSync(candidate) ? candidate : undefined
+}
+
+// Multi-file Linux builds extract in place, so start.sh can end up either at
+// the install root or inside a single top-level directory from the archive.
+export function findStartScript(installPath: string): string | undefined {
+ const atRoot = resolveStartScript(installPath)
+ if (atRoot) {
+ return atRoot
+ }
+
+ const directories = readdirSync(installPath).filter(
+ (entry) =>
+ entry !== 'extras' && statSync(join(installPath, entry)).isDirectory()
+ )
+
+ if (directories.length !== 1) {
+ return undefined
+ }
+
+ return resolveStartScript(join(installPath, directories[0]))
+}
+
+// ScummVM packages keep the engine either at the install root or one folder
+// down (ScummVM/scummvm.exe), and launch it through a batch file.
+function hasScummvmExecutable(installPath: string): boolean {
+ let entries: string[] = []
+ try {
+ entries = readdirSync(installPath)
+ } catch {
+ return false
+ }
+
+ if (entries.some((entry) => entry.toLowerCase() === 'scummvm.exe')) {
+ return true
+ }
+
+ return entries.some((entry) => {
+ try {
+ return readdirSync(join(installPath, entry)).some(
+ (child) => child.toLowerCase() === 'scummvm.exe'
+ )
+ } catch {
+ return false
+ }
+ })
+}
+
+// DOS/ScummVM packages ship .bat launchers (often with the game id as an
+// argument). Running the raw scummvm.exe opens the launcher instead of the
+// game, so prefer a top-level batch launcher when present. Batches that only
+// configure or register the game are not launchers and must not be picked,
+// except inside ScummVM packages where any non-installer batch is a launcher.
+export function findBatchLauncher(installPath: string): string | undefined {
+ const entries = readdirSync(installPath, { withFileTypes: true })
+
+ const batches = entries
+ .filter(
+ (entry) =>
+ entry.isFile() &&
+ entry.name.toLowerCase().endsWith('.bat') &&
+ !/unins|setup|install/i.test(entry.name)
+ )
+ .map((entry) => entry.name)
+
+ const named = batches.find((name) => /launch|play|start/i.test(name))
+ if (named) return named
+
+ return hasScummvmExecutable(installPath) ? batches[0] : undefined
+}
+
+interface BatchLauncher {
+ executable: string
+ args: string[]
+}
+
+// Lines that inspect files or control the script, not launch the game
+const SCRIPT_CONTROL =
+ /^\s*@?(rem\b|::|echo\b|set\b|if\b|goto\b|call\b|cd\b|pushd\b|popd\b|title\b|pause\b|exit\b|copy\b|del\b|ren\b|move\b|mkdir\b|md\b)/i
+
+function tokensOf(line: string): string[] {
+ return [...line.matchAll(/"([^"]*)"|(\S+)/g)].map(
+ (match) => match[1] ?? match[2]
+ )
+}
+
+// Parses the simple launchers Zoom ships for DOS/ScummVM games, e.g.
+// start .\\ScummVM\\scummvm.exe --zoom-splash=black -c "game.ini" gameid
+// Control-flow lines and unresolved %VARIABLES% are refused so the caller can
+// fall back to running the batch through cmd.
+export function parseBatchLauncher(content: string): BatchLauncher | undefined {
+ const lines = content.split(/\r?\n/)
+
+ for (const line of lines) {
+ if (!/\.exe/i.test(line) || SCRIPT_CONTROL.test(line)) {
+ continue
+ }
+
+ const spawned = line
+ .replace(/^\s*@/, '')
+ .replace(/^\s*start\s+(\/wait\s+)?/i, '')
+ .replace(/^\s*""\s+/, '')
+ .replace(/^\s*"[^"]*"\s+(?=")/, '')
+
+ const tokens = tokensOf(spawned).filter(Boolean)
+ if (!tokens.length) continue
+
+ const executable = tokens[0]
+ if (!executable.toLowerCase().endsWith('.exe')) continue
+ if (/%[^%]+%/.test(executable)) continue
+ // Drive-absolute and UNC targets cannot be resolved against the install
+ // folder; leave the batch to Wine instead of launching a wrong path.
+ if (/^[a-z]:[\\/]/i.test(executable) || executable.startsWith('\\\\')) {
+ return undefined
+ }
+
+ const args = tokens.slice(1)
+ if (args.some((arg) => /%[^%]+%/.test(arg))) continue
+
+ return {
+ executable: executable.replaceAll('\\', '/').replace(/^\.\//, ''),
+ args
+ }
+ }
+
+ return undefined
+}
+
+// Zoom archives can differ from their launchers in case (ScummVM/ vs
+// scummvm/). Linux cwd lookups are case-sensitive, so resolve each segment
+// against the real directory entries before spawning.
+export function resolveCaseInsensitivePath(
+ baseDir: string,
+ relativePath: string
+): string | undefined {
+ const segments = relativePath.replaceAll('\\', '/').split('/').filter(Boolean)
+
+ if (!segments.length) return undefined
+
+ const resolved: string[] = []
+ let current = baseDir
+
+ for (const segment of segments) {
+ let entries: string[]
+ try {
+ entries = readdirSync(current)
+ } catch {
+ return undefined
+ }
+
+ const match = entries.find(
+ (entry) => entry.toLowerCase() === segment.toLowerCase()
+ )
+ if (!match) return undefined
+
+ resolved.push(match)
+ current = join(current, match)
+ }
+
+ return resolved.join('/')
+}
diff --git a/src/backend/storeManagers/zoom/launch.ts b/src/backend/storeManagers/zoom/launch.ts
new file mode 100644
index 000000000..a0126fe81
--- /dev/null
+++ b/src/backend/storeManagers/zoom/launch.ts
@@ -0,0 +1,6 @@
+export function steamRuntimeForWrappers(
+ isNative: boolean,
+ steamRuntime: string[] | undefined
+): string[] | undefined {
+ return isNative && steamRuntime?.length ? [...steamRuntime] : undefined
+}
diff --git a/src/backend/storeManagers/zoom/library.ts b/src/backend/storeManagers/zoom/library.ts
index a2cd9d445..38ca9c5db 100644
--- a/src/backend/storeManagers/zoom/library.ts
+++ b/src/backend/storeManagers/zoom/library.ts
@@ -23,11 +23,15 @@ import CacheStore from '../../cache'
import {
libraryStore,
installedGamesStore,
- installInfoStore
+ installInfoStore,
+ configStore
} from './electronStores'
import { isOnline } from '../../online_monitor'
import { apiUrl, tokenPath, zoomConfigPath } from './constants'
-import { GlobalConfig } from 'backend/config'
+import { isAxiosError } from 'axios'
+import { installerLookupError } from './errors'
+import { isInstallableZoomFile } from 'common/zoomFiles'
+import { remapInstallPath, withInstallPath } from './move'
import { LibraryManager, RunnerBackupPaths } from 'common/types/game_manager'
import { BACKUP_PATHS } from 'backend/importExport/constants'
@@ -37,9 +41,6 @@ const installedGames: Map<string, InstalledInfo> = new Map()
export default class ZoomLibraryManager implements LibraryManager {
async init() {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
-
await this.refresh()
}
@@ -48,8 +49,6 @@ export default class ZoomLibraryManager implements LibraryManager {
}
async refresh(): Promise<ExecResult> {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return { stdout: '', stderr: 'Zoom Support disabled' }
libraryCache.clear()
this.refreshInstalled()
if (!(await ZoomUser.isLoggedIn())) {
@@ -112,8 +111,6 @@ export default class ZoomLibraryManager implements LibraryManager {
}
private async getZoomLibrary(): Promise<ZoomGameInfo[]> {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return []
const cachedGames = libraryCache.get('library')
if (cachedGames) {
logDebug('Returning cached Zoom library', LogPrefix.Zoom)
@@ -145,8 +142,6 @@ export default class ZoomLibraryManager implements LibraryManager {
}
zoomToUnifiedInfo(zoomGame: ZoomGameInfo): GameInfo {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return {} as GameInfo
const object: GameInfo = {
runner: 'zoom',
app_name: String(zoomGame.id),
@@ -177,15 +172,10 @@ export default class ZoomLibraryManager implements LibraryManager {
}
getGameInfo(slug: string): GameInfo | undefined {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
-
return library.get(slug) || this.getInstallAndGameInfo(slug)
}
getInstallAndGameInfo(slug: string): GameInfo | undefined {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
const lib = libraryStore.get('games', [])
const game = lib.find((value) => value.app_name === slug)
@@ -205,9 +195,6 @@ export default class ZoomLibraryManager implements LibraryManager {
appName: string,
installPlatform = 'windows'
): Promise<ZoomInstallInfo | undefined> {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
-
logInfo(
`Getting install info for ${appName} on ${installPlatform}`,
LogPrefix.Zoom
@@ -220,23 +207,26 @@ export default class ZoomLibraryManager implements LibraryManager {
}
try {
- const filesRequest = await ZoomUser.makeRequest<ZoomFilesResponse>(
- `${apiUrl}/li/game/${appName}/files`
- )
- const files =
- filesRequest[installPlatform as keyof ZoomFilesResponse] || []
+ const files = await this.getFiles(appName, installPlatform)
- if (files.length === 0) {
+ if (!files.game.length) {
logWarning(
- `No installer files found for ${appName} on platform ${installPlatform}`,
+ `No game files found for ${appName} on platform ${installPlatform}`,
LogPrefix.Zoom
)
- return
}
- const sizeInBytes = files
- .map((file) => parseSize(file.size))
+ // Only game files count towards the size of the installation, extras
+ // are optional bonus content.
+ const sizeInBytes = files.game
+ .map((file) => file.total_size)
.reduce((acc, num) => acc + num, 0)
+
+ const knownIds = new Set(
+ [...files.game, ...files.extras].map((file) => file.id)
+ )
+ const storedIds = this.getInstalledFileIds(appName, installPlatform)
+
const info: ZoomInstallInfo = {
game: {
app_name: appName,
@@ -257,7 +247,9 @@ export default class ZoomLibraryManager implements LibraryManager {
perLangSize: {
'*': { download_size: sizeInBytes, disk_size: sizeInBytes }
}
- }
+ },
+ files,
+ installedFileIds: storedIds?.filter((id) => knownIds.has(id))
}
installInfoStore.set(appName, info)
return info
@@ -267,9 +259,20 @@ export default class ZoomLibraryManager implements LibraryManager {
}
}
+ getInstalledFileIds(appName: string, platform: string): string[] | undefined {
+ return configStore.get('installedFileIds', {})[appName]?.[platform]
+ }
+
+ saveInstalledFileIds(appName: string, platform: string, ids: string[]) {
+ const stored = configStore.get('installedFileIds', {})
+
+ configStore.set('installedFileIds', {
+ ...stored,
+ [appName]: { ...stored[appName], [platform]: ids }
+ })
+ }
+
refreshInstalled() {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
const installedArray = installedGamesStore.get('installed', [])
installedGames.clear()
installedArray.forEach((value) => {
@@ -281,8 +284,6 @@ export default class ZoomLibraryManager implements LibraryManager {
}
async getExtras(appName: string) {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return { extras: [] }
logDebug(`Fetching extras for Zoom ID ${appName}`, LogPrefix.Zoom)
try {
const filesRequest = await ZoomUser.makeRequest<ZoomFilesResponse>(
@@ -316,50 +317,72 @@ export default class ZoomLibraryManager implements LibraryManager {
}
}
- async getInstallers(
- platform: string,
- appName: string
- ): Promise<ZoomDownloadFile[]> {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return []
+ // Game files for the platform plus every optional extra
+ async getFiles(
+ appName: string,
+ platform: string
+ ): Promise<{ game: ZoomDownloadFile[]; extras: ZoomDownloadFile[] }> {
+ const endpoint = `${apiUrl}/li/game/${appName}/files`
logDebug(
- `Fetching installers for ${appName} on platform ${platform}`,
+ `Fetching files for ${appName} on platform ${platform}`,
LogPrefix.Zoom
)
try {
- const filesRequest: ZoomFilesResponse = await ZoomUser.makeRequest(
- `${apiUrl}/li/game/${appName}/files`
- )
- const files = filesRequest[platform as keyof ZoomFilesResponse] || []
-
- if (files.length === 0) {
- logWarning(
- `No installer files found for ${appName} on platform ${platform}`,
- LogPrefix.Zoom
- )
- return []
+ const filesRequest: ZoomFilesResponse =
+ await ZoomUser.makeRequest(endpoint)
+
+ const toDownloadFile = (file: ZoomDownloadFile): ZoomDownloadFile => ({
+ url: file.url,
+ filename: file.name,
+ total_size: parseSize(file.size),
+ id: file.id,
+ name: file.name,
+ size: file.size
+ })
+
+ const platformKey = platform.toLowerCase() as 'windows' | 'linux'
+
+ return {
+ game: (filesRequest[platformKey] || [])
+ .filter((file) => isInstallableZoomFile(file.name, platformKey))
+ .map(toDownloadFile),
+ extras: [
+ ...(filesRequest.manual || []),
+ ...(filesRequest.misc || []),
+ ...(filesRequest.soundtrack || [])
+ ].map(toDownloadFile)
}
+ } catch (error) {
+ const status = isAxiosError(error) ? error.response?.status : undefined
+ logError(
+ [
+ `Zoom file lookup failed for ${appName} on ${platform}`,
+ endpoint,
+ `status=${status ?? 'unknown'}`,
+ error
+ ],
+ LogPrefix.Zoom
+ )
+ throw new Error(installerLookupError(status))
+ }
+ }
- const returnValue = []
- for (const file of files) {
- const downloadRequest = await ZoomUser.makeRequest<{ url: string }>(
- `${apiUrl}/li/download/${file.id}`
- )
+ async getDownloadUrl(fileId: string): Promise<string> {
+ const endpoint = `${apiUrl}/li/download/${fileId}`
- returnValue.push({
- url: downloadRequest.url,
- filename: file.name,
- total_size: parseSize(file.size),
- id: file.id,
- name: file.name,
- size: file.size
- })
- }
- return returnValue
+ try {
+ const downloadRequest = await ZoomUser.makeRequest<{ url: string }>(
+ endpoint
+ )
+ return downloadRequest.url
} catch (error) {
- logError(['Error fetching Zoom installers:', error], LogPrefix.Zoom)
- return []
+ const status = isAxiosError(error) ? error.response?.status : undefined
+ logError(
+ [`Zoom download link failed for ${fileId}`, endpoint, status, error],
+ LogPrefix.Zoom
+ )
+ throw new Error(installerLookupError(status))
}
}
@@ -373,9 +396,6 @@ export default class ZoomLibraryManager implements LibraryManager {
appName: string,
newInstallPath: string
): Promise<void> {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
-
const cachedGameData = library.get(appName)
if (!cachedGameData || !cachedGameData.install) {
logError(
@@ -386,18 +406,33 @@ export default class ZoomLibraryManager implements LibraryManager {
}
const installedArray = installedGamesStore.get('installed', [])
- const gameIndex = installedArray.findIndex(
- (value) => value.appName === appName
+ const updatedArray = withInstallPath(
+ installedArray,
+ appName,
+ newInstallPath
)
- installedArray[gameIndex].install_path = newInstallPath
+ if (!updatedArray) {
+ logError(
+ `Changing install path failed: ${appName} is not installed`,
+ LogPrefix.Zoom
+ )
+ return
+ }
+
+ installedGamesStore.set('installed', updatedArray)
+ cachedGameData.install.executable =
+ remapInstallPath(
+ cachedGameData.install.executable,
+ cachedGameData.install.install_path ?? '',
+ newInstallPath
+ ) ?? cachedGameData.install.executable
cachedGameData.install.install_path = newInstallPath
- installedGamesStore.set('installed', installedArray)
+ this.refreshInstalled()
+ sendFrontendMessage('pushGameToLibrary', cachedGameData)
}
installState() {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
logWarning(
`installState not implemented on Zoom Library Manager`,
LogPrefix.Zoom
@@ -405,8 +440,6 @@ export default class ZoomLibraryManager implements LibraryManager {
}
changeVersionPinnedStatus(appName: string, status: boolean) {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
const game = library.get(appName)
const installed = installedGames.get(appName)
if (!game || !installed) {
@@ -428,16 +461,12 @@ export default class ZoomLibraryManager implements LibraryManager {
sendFrontendMessage('pushGameToLibrary', game)
}
+ // Zoom has no update flow yet, so no game is ever reported as updateable
async listUpdateableGames(): Promise<string[]> {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return []
- logWarning('listUpdateableGames not implemented for Zoom', LogPrefix.Zoom)
return []
}
updateGameInLibrary(game: GameInfo) {
- if (!GlobalConfig.get().getSettings().experimentalFeatures?.zoomPlatform)
- return
if (library.has(game.app_name)) {
library.set(game.app_name, game)
}
diff --git a/src/backend/storeManagers/zoom/linuxInstall.ts b/src/backend/storeManagers/zoom/linuxInstall.ts
new file mode 100644
index 000000000..27bde62af
--- /dev/null
+++ b/src/backend/storeManagers/zoom/linuxInstall.ts
@@ -0,0 +1,36 @@
+import * as fs from 'fs'
+import { ZoomDownloadFile } from 'common/types/zoom'
+import { ExecResult } from 'common/types'
+import { findStartScript } from './install'
+
+type RunZoomFile = (file: ZoomDownloadFile) => Promise<ExecResult>
+
+// Applies the Linux game files in order. A base archive and a later patch can
+// add separate top-level folders, so the start script is looked up after each
+// file and the last one found is kept: a later archive that makes the lookup
+// ambiguous must not discard an executable that already worked.
+export async function applyLinuxGameFiles(
+ gameFiles: ZoomDownloadFile[],
+ installPath: string,
+ run: RunZoomFile,
+ log: (message: string) => void
+): Promise<{ executable?: string; error?: string }> {
+ let executable: string | undefined
+
+ for (const file of gameFiles) {
+ const result = await run(file)
+
+ if (result.error) {
+ return { error: result.error }
+ }
+
+ const found = findStartScript(installPath)
+ if (found) {
+ executable = found
+ await fs.promises.chmod(found, '755')
+ log(`Found start script: ${found}`)
+ }
+ }
+
+ return { executable }
+}
diff --git a/src/backend/storeManagers/zoom/move.ts b/src/backend/storeManagers/zoom/move.ts
new file mode 100644
index 000000000..7ab5f084a
--- /dev/null
+++ b/src/backend/storeManagers/zoom/move.ts
@@ -0,0 +1,53 @@
+import { sep } from 'path'
+
+/** Re-points a value that lived under the old install path to the new one. */
+export function remapInstallPath(
+ value: string | undefined,
+ previousPath: string,
+ newInstallPath: string
+): string | undefined {
+ if (!value || !previousPath) {
+ return value
+ }
+
+ // Compare against the folder boundary so `/games/Game` does not claim
+ // `/games/Game2/start.sh` as its own.
+ const base = previousPath.endsWith(sep)
+ ? previousPath
+ : `${previousPath}${sep}`
+ if (value !== previousPath && !value.startsWith(base)) {
+ return value
+ }
+
+ if (value === previousPath) {
+ return newInstallPath
+ }
+
+ return `${newInstallPath}${value.slice(previousPath.length)}`
+}
+
+export function withInstallPath<
+ T extends { appName?: string; install_path: string; executable?: string }
+>(installed: T[], appName: string, newInstallPath: string): T[] | undefined {
+ const index = installed.findIndex((game) => game.appName === appName)
+
+ if (index === -1) {
+ return undefined
+ }
+
+ const updated = [...installed]
+ const game = installed[index]
+ updated[index] = {
+ ...game,
+ install_path: newInstallPath,
+ // The executable is stored as an absolute path, so moving the game without
+ // this leaves the launch pointing at the folder it was moved out of.
+ executable: remapInstallPath(
+ game.executable,
+ game.install_path,
+ newInstallPath
+ )
+ }
+
+ return updated
+}
diff --git a/src/backend/storeManagers/zoom/selection.ts b/src/backend/storeManagers/zoom/selection.ts
new file mode 100644
index 000000000..42c1a92cd
--- /dev/null
+++ b/src/backend/storeManagers/zoom/selection.ts
@@ -0,0 +1,21 @@
+import { selectedZoomFileGroups, ZoomFileGroups } from 'common/zoomFiles'
+
+// Files are selected by id in the install modal. Without a selection the
+// backend falls back to every game file, which keeps older callers working.
+export function resolveZoomInstallSelection(
+ files: ZoomFileGroups,
+ requestedIds: string[] | undefined,
+ missingSelectionError: string
+): { selection: ZoomFileGroups; ids: string[] } | { error: string } {
+ const ids = requestedIds ?? files.game.map((file) => file.id)
+ const selection = selectedZoomFileGroups(files, ids)
+
+ if (!selection.game.length) {
+ return { error: missingSelectionError }
+ }
+
+ return {
+ selection,
+ ids: [...selection.game, ...selection.extras].map((file) => file.id)
+ }
+}
diff --git a/src/backend/storeManagers/zoom/stop.ts b/src/backend/storeManagers/zoom/stop.ts
new file mode 100644
index 000000000..0bb9e1134
--- /dev/null
+++ b/src/backend/storeManagers/zoom/stop.ts
@@ -0,0 +1,12 @@
+import { GameStatus } from 'common/types'
+
+// Native Zoom games are spawned through callRunner with the app name as the
+// abort id, so the kill handler can stop them. Wine games run under a shared
+// prefix, which has to be shut down explicitly.
+export function stopNeedsWineShutdown(isNative: boolean): boolean {
+ return !isNative
+}
+
+export function stoppedGameStatus(appName: string): GameStatus {
+ return { appName, runner: 'zoom', status: 'done' }
+}
diff --git a/src/common/runnerCapabilities.ts b/src/common/runnerCapabilities.ts
new file mode 100644
index 000000000..351ac2f02
--- /dev/null
+++ b/src/common/runnerCapabilities.ts
@@ -0,0 +1,31 @@
+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
+}
diff --git a/src/common/types.ts b/src/common/types.ts
index deeddc68a..7ea050d63 100644
--- a/src/common/types.ts
+++ b/src/common/types.ts
@@ -110,6 +110,10 @@ export type ExperimentalFeatures = {
enableHelp: boolean
cometSupport: boolean
umuSupport?: boolean
+ /**
+ * @deprecated Zoom Platform is no longer experimental. Nothing reads this
+ * flag; it stays optional so old configs keep loading until it is removed.
+ */
zoomPlatform?: boolean
}
@@ -500,6 +504,7 @@ export interface InstallArgs {
branch?: string
build?: string
dependencies?: string[]
+ zoomFileIds?: string[]
}
export interface InstallParams extends InstallArgs {
diff --git a/src/common/types/electron_store.ts b/src/common/types/electron_store.ts
index 4b9a4cbf3..da701905a 100644
--- a/src/common/types/electron_store.ts
+++ b/src/common/types/electron_store.ts
@@ -88,6 +88,8 @@ export interface StoreStructure {
credentials?: ZoomCredentials
isLoggedIn: boolean
username?: string
+ // Selected Zoom download files per app, then per install platform
+ installedFileIds?: Record<string, Record<string, string[]>>
}
steamConfigStore: {
isLoggedIn: boolean
diff --git a/src/common/types/zoom.ts b/src/common/types/zoom.ts
index be15120ca..02662c75b 100644
--- a/src/common/types/zoom.ts
+++ b/src/common/types/zoom.ts
@@ -102,4 +102,9 @@ interface GameManifest {
export interface ZoomInstallInfo {
game: GameInstallInfo
manifest: GameManifest
+ files?: {
+ game: ZoomDownloadFile[]
+ extras: ZoomDownloadFile[]
+ }
+ installedFileIds?: string[]
}
diff --git a/src/common/zoomFiles.ts b/src/common/zoomFiles.ts
new file mode 100644
index 000000000..904c12536
--- /dev/null
+++ b/src/common/zoomFiles.ts
@@ -0,0 +1,89 @@
+import { ZoomDownloadFile } from './types/zoom'
+
+export interface ZoomFileGroups {
+ game: ZoomDownloadFile[]
+ extras: ZoomDownloadFile[]
+}
+
+function allZoomFiles(files: ZoomFileGroups): ZoomDownloadFile[] {
+ return [...files.game, ...files.extras]
+}
+
+export function zoomFilesBytes(files: ZoomDownloadFile[]): number {
+ return files.reduce((total, file) => total + file.total_size, 0)
+}
+
+export function selectedZoomFileGroups(
+ files: ZoomFileGroups,
+ selectedIds: string[]
+): ZoomFileGroups {
+ return {
+ game: files.game.filter((file) => selectedIds.includes(file.id)),
+ extras: files.extras.filter((file) => selectedIds.includes(file.id))
+ }
+}
+
+export function hasSelectedGameFile(
+ files: ZoomFileGroups,
+ selectedIds: string[]
+): boolean {
+ return files.game.some((file) => selectedIds.includes(file.id))
+}
+
+// One game file and no extras installs in one click, everything else needs
+// the file selection step. A product with no files still shows the step so it
+// can explain why there is nothing to install.
+export function shouldShowZoomCollections(files: ZoomFileGroups): boolean {
+ return !(files.game.length === 1 && files.extras.length === 0)
+}
+
+// Zoom lists bonus content and occasionally non-installable archives in the
+// game group. Only offer what the platform install loop can actually apply.
+export function isInstallableZoomFile(
+ filename: string,
+ platform: 'windows' | 'linux'
+): boolean {
+ const name = filename.toLowerCase()
+
+ if (platform === 'windows') {
+ return name.endsWith('.exe')
+ }
+
+ return (
+ name.endsWith('.tar.xz') || name.endsWith('.sh') || name.endsWith('.run')
+ )
+}
+
+// Changing platform reloads the file list: keep only the ids that still
+// exist, and fall back to the defaults when no selected game file survives.
+export function carryZoomSelection(
+ files: ZoomFileGroups,
+ previousIds: string[],
+ storedIds?: string[]
+): string[] {
+ const knownIds = new Set(allZoomFiles(files).map((file) => file.id))
+ const carried = previousIds.filter((id) => knownIds.has(id))
+
+ if (hasSelectedGameFile(files, carried)) {
+ return carried
+ }
+
+ return zoomSelectionDefaults(files, storedIds)
+}
+
+// Stored ids win when at least one of them is still a game file, so a
+// reinstall keeps the previous selection. Missing ids are dropped silently;
+// if none of the stored game files exist anymore, fall back to all game files.
+export function zoomSelectionDefaults(
+ files: ZoomFileGroups,
+ storedIds?: string[]
+): string[] {
+ const knownIds = new Set(allZoomFiles(files).map((file) => file.id))
+ const stored = (storedIds ?? []).filter((id) => knownIds.has(id))
+
+ if (hasSelectedGameFile(files, stored)) {
+ return stored
+ }
+
+ return files.game.map((file) => file.id)
+}
diff --git a/src/frontend/helpers/library.ts b/src/frontend/helpers/library.ts
index 6e456a3d0..df56187b7 100644
--- a/src/frontend/helpers/library.ts
+++ b/src/frontend/helpers/library.ts
@@ -31,6 +31,7 @@ type InstallArgs = {
installLanguage?: string
build?: string
branch?: string
+ zoomFileIds?: string[]
}
async function install({
@@ -47,6 +48,7 @@ async function install({
platformToInstall = 'Windows',
build,
branch,
+ zoomFileIds,
showDialogModal
}: InstallArgs) {
if (!installPath) {
@@ -99,7 +101,8 @@ async function install({
platformToInstall,
gameInfo,
build,
- branch
+ branch,
+ zoomFileIds
})
}
diff --git a/src/frontend/screens/Game/GamePage/index.tsx b/src/frontend/screens/Game/GamePage/index.tsx
index 3deef588f..2614a3029 100644
--- a/src/frontend/screens/Game/GamePage/index.tsx
+++ b/src/frontend/screens/Game/GamePage/index.tsx
@@ -34,6 +34,7 @@ import {
InstallInfo,
GameAchievement
} from 'common/types'
+import { supportsCapability } from 'common/runnerCapabilities'
import { hasProgress } from 'frontend/hooks/hasProgress'
import ErrorComponent from 'frontend/components/UI/ErrorComponent'
@@ -270,7 +271,9 @@ export default React.memo(function GamePage(): JSX.Element | null {
if (!info) {
throw new Error('Cannot get game info')
}
+ // Zoom shows the available files in the install modal instead
if (
+ runner !== 'zoom' &&
info.manifest &&
info.manifest.disk_size === 0 &&
info.manifest.download_size === 0
@@ -352,7 +355,10 @@ export default React.memo(function GamePage(): JSX.Element | null {
const title = gameInfo.overrides?.title || gameInfo.title
const art_cover = gameInfo.overrides?.art_cover || gameInfo.art_cover
- hasUpdate = is_installed && gameUpdates?.includes(appName)
+ hasUpdate =
+ supportsCapability(runner, 'update') &&
+ is_installed &&
+ gameUpdates?.includes(appName)
/*
Other Keys:
diff --git a/src/frontend/screens/Game/GameSubMenu/index.tsx b/src/frontend/screens/Game/GameSubMenu/index.tsx
index 53791176a..36e329c79 100644
--- a/src/frontend/screens/Game/GameSubMenu/index.tsx
+++ b/src/frontend/screens/Game/GameSubMenu/index.tsx
@@ -3,6 +3,7 @@ import './index.css'
import { useCallback, useContext, useEffect, useState } from 'react'
import { GameInfo, GameStatus, Runner } from 'common/types'
+import { supportsCapability } from 'common/runnerCapabilities'
import { createNewWindow } from 'frontend/helpers'
import { repair } from 'frontend/helpers/library'
@@ -88,6 +89,8 @@ export default function GamesSubmenu({
const { t } = useTranslation('gamepage')
const isSideloaded = runner === 'sideload'
const isThirdPartyManaged = !!gameInfo.thirdPartyManagedApp
+ const canUpdate = supportsCapability(runner, 'update')
+ const canRepair = supportsCapability(runner, 'repair')
async function onMoveInstallYesClick() {
// Steam manages the move (and destination drive selection) in its own
@@ -324,7 +327,7 @@ export default function GamesSubmenu({
>
{t('button.uninstall', 'Uninstall')}
</MenuItem>{' '}
- {!isSideloaded && !isThirdPartyManaged && (
+ {canUpdate && !isSideloaded && !isThirdPartyManaged && (
<MenuItem
glyph={ArrowUpCircle}
onClick={async () => handleUpdate()}
@@ -349,7 +352,7 @@ export default function GamesSubmenu({
{t('submenu.change', 'Change install path')}
</MenuItem>
)}{' '}
- {!isSideloaded && !isThirdPartyManaged && (
+ {canRepair && !isSideloaded && !isThirdPartyManaged && (
<MenuItem
glyph={CircleCheck}
onClick={async () => handleRepair(appName)}
diff --git a/src/frontend/screens/Library/components/GamesList/index.tsx b/src/frontend/screens/Library/components/GamesList/index.tsx
index 0f37ee7d9..f9c124274 100644
--- a/src/frontend/screens/Library/components/GamesList/index.tsx
+++ b/src/frontend/screens/Library/components/GamesList/index.tsx
@@ -1,5 +1,6 @@
import React, { useContext, useEffect, useRef } from 'react'
import { GameInfo, Runner } from 'common/types'
+import { supportsCapability } from 'common/runnerCapabilities'
import cx from 'classnames'
import GameCard from '../GameCard'
import ContextProvider from 'frontend/state/ContextProvider'
@@ -139,7 +140,10 @@ const GamesList = ({
return null
}
- const hasUpdate = is_installed && gameUpdates?.includes(app_name)
+ const hasUpdate =
+ supportsCapability(runner, 'update') &&
+ is_installed &&
+ gameUpdates?.includes(app_name)
return (
<GameCard
key={`${runner}_${app_name}${isFirstLane ? '_firstlane' : ''}`}
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/ZoomCollections.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/ZoomCollections.tsx
new file mode 100644
index 000000000..17aa91985
--- /dev/null
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/ZoomCollections.tsx
@@ -0,0 +1,186 @@
+import { useTranslation } from 'react-i18next'
+import { ZoomDownloadFile } from 'common/types/zoom'
+import {
+ hasSelectedGameFile,
+ selectedZoomFileGroups,
+ ZoomFileGroups,
+ zoomFilesBytes
+} from 'common/zoomFiles'
+import { formatSize } from 'common/format'
+import { useDisplayUnits } from 'frontend/state/DisplayUnits'
+import Button from 'frontend/components/UI/Button'
+
+interface Props {
+ files: ZoomFileGroups
+ selectedIds: string[]
+ onToggle: (fileId: string) => void
+ canChangePlatform: boolean
+ onChangePlatform: () => void
+ onBack: () => void
+}
+
+function FileRow({
+ file,
+ checked,
+ onToggle
+}: {
+ file: ZoomDownloadFile
+ checked: boolean
+ onToggle: (fileId: string) => void
+}) {
+ const units = useDisplayUnits((state) => state.units)
+ const inputId = `zoom-file-${file.id}`
+
+ return (
+ <label
+ className="ZoomCollections__row"
+ htmlFor={inputId}
+ title={file.filename}
+ >
+ <input
+ checked={checked}
+ className="ZoomCollections__checkbox"
+ id={inputId}
+ onChange={() => onToggle(file.id)}
+ type="checkbox"
+ />
+ <span className="ZoomCollections__name">{file.name}</span>
+ <span className="ZoomCollections__size">
+ {formatSize(file.total_size, units)}
+ </span>
+ </label>
+ )
+}
+
+export default function ZoomCollections({
+ files,
+ selectedIds,
+ onToggle,
+ canChangePlatform,
+ onChangePlatform,
+ onBack
+}: Props) {
+ const { t } = useTranslation()
+ const units = useDisplayUnits((state) => state.units)
+
+ if (!files.game.length && !files.extras.length) {
+ return (
+ <section className="ZoomCollections">
+ <p className="ZoomCollections__empty">
+ {t(
+ 'zoom.collections.noFiles',
+ 'This product has no files to install.'
+ )}
+ </p>
+ <Button variant="secondary" onClick={onBack}>
+ {t('zoom.collections.back', 'Back')}
+ </Button>
+ </section>
+ )
+ }
+
+ const selected = selectedZoomFileGroups(files, selectedIds)
+ const selectedBytes = zoomFilesBytes([...selected.game, ...selected.extras])
+ const extrasBytes = zoomFilesBytes(files.extras)
+
+ return (
+ <section className="ZoomCollections">
+ <h3 className="ZoomCollections__title">
+ {t('zoom.collections.title', 'Select files to install')}
+ </h3>
+ <p className="ZoomCollections__description">
+ {t(
+ 'zoom.collections.description',
+ 'This product includes more than one file. Pick what you want to install.'
+ )}
+ </p>
+
+ <fieldset className="ZoomCollections__group">
+ <legend>{t('zoom.collections.gameGroup', 'Game files')}</legend>
+
+ {files.game.length === 0 ? (
+ <div className="ZoomCollections__noBuild">
+ <p className="ZoomCollections__empty">
+ {t(
+ 'zoom.collections.noBuild',
+ 'No game files are available for this platform.'
+ )}
+ </p>
+ {canChangePlatform ? (
+ <>
+ <p className="ZoomCollections__hint">
+ {t(
+ 'zoom.collections.noBuildHint',
+ 'Choose another platform to see its files.'
+ )}
+ </p>
+ <Button variant="secondary" onClick={onChangePlatform}>
+ {t('zoom.collections.changePlatform', 'Change platform')}
+ </Button>
+ </>
+ ) : (
+ <Button variant="secondary" onClick={onBack}>
+ {t('zoom.collections.back', 'Back')}
+ </Button>
+ )}
+ </div>
+ ) : (
+ files.game.map((file) => (
+ <FileRow
+ key={file.id}
+ checked={selectedIds.includes(file.id)}
+ file={file}
+ onToggle={onToggle}
+ />
+ ))
+ )}
+ </fieldset>
+
+ {files.extras.length > 0 && (
+ <details className="ZoomCollections__extras">
+ <summary className="ZoomCollections__summaryRow">
+ <span className="ZoomCollections__summaryLabel">
+ {t('zoom.collections.extrasGroup', 'Extras')}
+ </span>
+ <span className="ZoomCollections__summary">
+ {t(
+ 'zoom.collections.extrasSummary',
+ '{{count}} files · {{size}}',
+ {
+ count: files.extras.length,
+ size: formatSize(extrasBytes, units)
+ }
+ )}
+ </span>
+ </summary>
+
+ <div className="ZoomCollections__extrasList">
+ {files.extras.map((file) => (
+ <FileRow
+ key={file.id}
+ checked={selectedIds.includes(file.id)}
+ file={file}
+ onToggle={onToggle}
+ />
+ ))}
+ </div>
+ </details>
+ )}
+
+ <p className="ZoomCollections__selectedTotal">
+ {t('zoom.collections.selectedTotal', 'Selected: {{size}}', {
+ size: formatSize(selectedBytes, units)
+ })}
+ </p>
+
+ {files.game.length > 0 && !hasSelectedGameFile(files, selectedIds) && (
+ <p className="ZoomCollections__hint">
+ {t(
+ 'zoom.collections.selectOne',
+ 'Select at least one game file to continue.'
+ )}
+ </p>
+ )}
+ </section>
+ )
+}
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
index b72dc0970..84424a1a1 100644
--- a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
@@ -19,6 +19,13 @@ import {
DLCInfo as LegendaryDLCInfo
} from 'common/types/legendary'
import { BuildItem, DLCInfo as GOGDLCInfo } from 'common/types/gog'
+import { ZoomInstallInfo } from 'common/types/zoom'
+import {
+ carryZoomSelection,
+ hasSelectedGameFile,
+ shouldShowZoomCollections,
+ ZoomFileGroups
+} from 'common/zoomFiles'
import { PathSelectionBox, ToggleSwitch } from 'frontend/components/UI'
import Anticheat from 'frontend/components/UI/Anticheat'
import {
@@ -54,6 +61,7 @@ import SteamLibrarySelector from './SteamLibrarySelector'
import { SteamInstallLibrary } from 'common/types/steam'
import { hasAnticheatInfo } from 'frontend/hooks/hasAnticheatInfo'
import BranchSelector from './BranchSelector'
+import ZoomCollections from './ZoomCollections'
import { openInstallGameModal } from 'frontend/state/InstallGameModal'
interface Props {
@@ -156,6 +164,29 @@ export default function DownloadDialog({
)
const [gettingInstallInfo, setGettingInstallInfo] = useState(false)
+ const isZoom = runner === 'zoom'
+ const [zoomFiles, setZoomFiles] = useState<ZoomFileGroups>({
+ game: [],
+ extras: []
+ })
+ const [selectedZoomFiles, setSelectedZoomFiles] = useState<string[]>([])
+
+ function focusPlatformPicker() {
+ const picker = document.getElementById('platformPick')
+ if (!picker) return
+
+ picker.scrollIntoView({ block: 'center', behavior: 'smooth' })
+ picker.focus({ preventScroll: true })
+ }
+
+ const handleZoomFileToggle = useCallback((fileId: string) => {
+ setSelectedZoomFiles((current) =>
+ current.includes(fileId)
+ ? current.filter((id) => id !== fileId)
+ : [...current, fileId]
+ )
+ }, [])
+
const installFolder = gameStatus?.folder || installPath
const [spaceLeft, setSpaceLeft] = useState<DiskSpaceInfo>({
@@ -271,6 +302,10 @@ export default function DownloadDialog({
async function handleInstall(path?: string, ignoreAnticheat = false) {
if (!wineSelectionValid) return
+ if (isZoom && !hasSelectedGameFile(zoomFiles, selectedZoomFiles)) {
+ return
+ }
+
if (
anticheatInfo &&
['Denied', 'Broken', 'Unknown'].includes(anticheatInfo.status)
@@ -313,6 +348,7 @@ export default function DownloadDialog({
platformToInstall,
build: selectedBuild,
branch,
+ zoomFileIds: selectedZoomFiles,
showDialogModal: () => backdropClick()
})
}
@@ -359,7 +395,7 @@ export default function DownloadDialog({
return
}
- if (noContent) {
+ if (noContent && !isZoom) {
showDialogModal({
showDialog: true,
title: t(
@@ -381,6 +417,15 @@ export default function DownloadDialog({
return
}
+ if (isZoom) {
+ const zoomInfo = gameInstallInfo as ZoomInstallInfo | null
+ const files = zoomInfo?.files ?? { game: [], extras: [] }
+ setZoomFiles(files)
+ setSelectedZoomFiles((previous) =>
+ carryZoomSelection(files, previous, zoomInfo?.installedFileIds)
+ )
+ }
+
setGameInstallInfo(gameInstallInfo)
setGettingInstallInfo(false)
@@ -478,6 +523,7 @@ export default function DownloadDialog({
}, [
appName,
i18n.languages,
+ isZoom,
platformToInstall,
selectedBuild,
branch,
@@ -648,12 +694,18 @@ export default function DownloadDialog({
return t('button.no-path-selected', 'No path selected')
}
- const readyToInstall =
- installPath &&
- !!diskSize &&
- !gettingInstallInfo &&
- validFlatpakPath &&
- wineSelectionValid
+ const zoomGameSelected = hasSelectedGameFile(zoomFiles, selectedZoomFiles)
+ const readyToInstall = isZoom
+ ? !!installPath &&
+ !gettingInstallInfo &&
+ validFlatpakPath &&
+ zoomGameSelected &&
+ wineSelectionValid
+ : installPath &&
+ !!diskSize &&
+ !gettingInstallInfo &&
+ validFlatpakPath &&
+ wineSelectionValid
const showDlcSelector =
['legendary', 'gog'].includes(runner) && DLCList && DLCList?.length > 0
@@ -831,6 +883,16 @@ export default function DownloadDialog({
/>
</div>
)}
+ {isZoom && shouldShowZoomCollections(zoomFiles) && (
+ <ZoomCollections
+ files={zoomFiles}
+ selectedIds={selectedZoomFiles}
+ onToggle={handleZoomFileToggle}
+ canChangePlatform={availablePlatforms.length > 1}
+ onChangePlatform={focusPlatformPicker}
+ onBack={backdropClick}
+ />
+ )}
{(haveDLCs || haveSDL) && (
<div className="InstallModal__sectionHeader">
{t('sdl.title', 'Select components to Install')}:
diff --git a/src/frontend/screens/Library/components/InstallModal/index.scss b/src/frontend/screens/Library/components/InstallModal/index.scss
index fbfc79632..82c45be3d 100644
--- a/src/frontend/screens/Library/components/InstallModal/index.scss
+++ b/src/frontend/screens/Library/components/InstallModal/index.scss
@@ -107,3 +107,134 @@
text-decoration: underline;
}
}
+
+.ZoomCollections {
+ margin: var(--space-md) var(--space-md) 0;
+
+ &__title {
+ margin: 0 0 var(--space-xs);
+ font-size: 1em;
+ font-weight: 600;
+ }
+
+ &__description {
+ margin: 0 0 var(--space-sm);
+ color: var(--text-secondary);
+ font-size: 0.9em;
+ }
+
+ &__group {
+ margin: 0;
+ padding: 0;
+ border: none;
+ min-width: 0;
+
+ legend {
+ padding: 0;
+ margin-bottom: var(--space-xs);
+ font-weight: 600;
+ }
+ }
+
+ &__row,
+ &__summaryRow {
+ display: flex;
+ align-items: center;
+ gap: var(--space-sm);
+ min-height: 44px;
+ padding-inline-start: var(--space-xs);
+ padding-inline-end: var(--space-sm);
+ cursor: pointer;
+ }
+
+ &__row:hover,
+ &__summaryRow:hover {
+ background: var(--background-secondary);
+ border-radius: var(--radius-sm);
+ }
+
+ &__checkbox {
+ flex: 0 0 auto;
+ width: 18px;
+ height: 18px;
+ }
+
+ &__name,
+ &__summaryLabel {
+ flex: 1 1 auto;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ &__size,
+ &__summary {
+ flex: 0 0 auto;
+ margin-inline-start: auto;
+ white-space: nowrap;
+ color: var(--text-secondary);
+ font-variant-numeric: tabular-nums;
+ }
+
+ &__extras {
+ margin-top: var(--space-sm);
+ border-top: 1px solid var(--divider);
+ }
+
+ &__summaryRow {
+ list-style: none;
+
+ &::-webkit-details-marker {
+ display: none;
+ }
+ }
+
+ &__summaryLabel {
+ font-weight: 600;
+ }
+
+ &__extrasList {
+ padding-bottom: var(--space-xs);
+ }
+
+ &__noBuild {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: var(--space-xs);
+ }
+
+ &__empty,
+ &__hint {
+ margin: var(--space-xs) 0 0;
+ color: var(--text-secondary);
+ }
+
+ &__selectedTotal {
+ margin: var(--space-sm) 0 0;
+ font-weight: 600;
+ }
+
+ &__hint {
+ color: var(--status-warning);
+ }
+
+ @media (max-width: 600px) {
+ &__row {
+ flex-wrap: wrap;
+ row-gap: 2px;
+ }
+
+ &__name {
+ flex-basis: calc(100% - 34px);
+ white-space: normal;
+ overflow-wrap: anywhere;
+ }
+
+ &__size {
+ flex-basis: 100%;
+ margin-inline-start: 26px;
+ }
+ }
+}
diff --git a/src/frontend/screens/Settings/components/ExperimentalFeatures.tsx b/src/frontend/screens/Settings/components/ExperimentalFeatures.tsx
index 44838309c..7f30e760c 100644
--- a/src/frontend/screens/Settings/components/ExperimentalFeatures.tsx
+++ b/src/frontend/screens/Settings/components/ExperimentalFeatures.tsx
@@ -8,8 +8,7 @@ import { ExperimentalFeatures as IExperimentalFeatures } from 'common/types'
const ExperimentalFeatures = () => {
const FEATURES: (keyof IExperimentalFeatures)[] = [
'enableHelp',
- 'cometSupport',
- 'zoomPlatform'
+ 'cometSupport'
]
const { t } = useTranslation()
@@ -17,8 +16,7 @@ const ExperimentalFeatures = () => {
'experimentalFeatures',
{
enableHelp: false,
- cometSupport: true,
- zoomPlatform: false
+ cometSupport: true
}
)
const { handleExperimentalFeatures } = useContext(ContextProvider)
@@ -37,7 +35,6 @@ const ExperimentalFeatures = () => {
t('setting.experimental_features.enableNewDesign', 'New design')
t('setting.experimental_features.enableHelp', 'Help component')
t('setting.experimental_features.cometSupport', 'Comet support')
- t('setting.experimental_features.zoomPlatform', 'Zoom Platform support (only linux)')
*/
const descriptions: Partial<Record<keyof IExperimentalFeatures, string>> = {
@@ -48,10 +45,6 @@ const ExperimentalFeatures = () => {
cometSupport: t(
'setting.experimental_features_description.cometSupport',
'Enable GOG Galaxy features such as achievements and multiplayer'
- ),
- zoomPlatform: t(
- 'setting.experimental_features_description.zoomPlatform',
- 'Add the Zoom Platform store to your library'
)
}
diff --git a/src/frontend/screens/Settings/search/advanced.ts b/src/frontend/screens/Settings/search/advanced.ts
index 9a59640a3..54babe24d 100644
--- a/src/frontend/screens/Settings/search/advanced.ts
+++ b/src/frontend/screens/Settings/search/advanced.ts
@@ -55,12 +55,6 @@ export const advancedSearchEntries: SettingsSearchEntry[] = [
sectionKey: 'settings.section.experimental',
titleKey: 'setting.experimental_features.cometSupport'
},
- {
- id: 'zoomPlatform',
- tab: 'advanced',
- sectionKey: 'settings.section.experimental',
- titleKey: 'setting.experimental_features.zoomPlatform'
- },
{
titleKey: 'settings.section.eosOverlay',
tab: 'advanced',
diff --git a/src/frontend/screens/Settings/sections/LogSettings/index.tsx b/src/frontend/screens/Settings/sections/LogSettings/index.tsx
index 75bf6484b..891e17256 100644
--- a/src/frontend/screens/Settings/sections/LogSettings/index.tsx
+++ b/src/frontend/screens/Settings/sections/LogSettings/index.tsx
@@ -239,7 +239,7 @@ export default function LogSettings() {
{ title: 'GOG', args: { runner: 'gog' } },
{ title: 'Amazon/Nile', args: { runner: 'nile' } }
]
- if (zoom.enabled) {
+ if (zoom.username) {
baseFiles.push({ title: 'Zoom', args: { runner: 'zoom' } })
}
if (itchio.username) {
@@ -256,7 +256,7 @@ export default function LogSettings() {
}
}))
return baseFiles.concat(logsForInstalledGames)
- }, [installedGames, zoom.enabled, itchio.username, steam.enabled])
+ }, [installedGames, zoom.username, itchio.username, steam.enabled])
return (
<SettingsCard
diff --git a/src/frontend/state/ContextProvider.tsx b/src/frontend/state/ContextProvider.tsx
index 672155677..54f8ca2bf 100644
--- a/src/frontend/state/ContextProvider.tsx
+++ b/src/frontend/state/ContextProvider.tsx
@@ -122,8 +122,7 @@ const initialContext: ContextType = {
},
experimentalFeatures: {
enableHelp: false,
- cometSupport: true,
- zoomPlatform: false
+ cometSupport: true
},
handleExperimentalFeatures: () => null,
disableDialogBackdropClose: false,
diff --git a/src/frontend/state/GlobalState.tsx b/src/frontend/state/GlobalState.tsx
index 34c01e8ad..8cf5d2c9f 100644
--- a/src/frontend/state/GlobalState.tsx
+++ b/src/frontend/state/GlobalState.tsx
@@ -253,7 +253,8 @@ class GlobalState extends PureComponent<Props> {
zoom: {
library: this.loadZoomLibrary(),
username: zoomConfigStore.get_nodefault('username'),
- enabled: !!globalSettings?.experimentalFeatures?.zoomPlatform
+ // Zoom is a regular store now; the login card and filters key on username
+ enabled: true
},
itchio: {
library: this.loadItchioLibrary(),
@@ -321,7 +322,6 @@ class GlobalState extends PureComponent<Props> {
experimentalFeatures: {
enableHelp: false,
cometSupport: true,
- zoomPlatform: false,
...(globalSettings?.experimentalFeatures || {})
},
disableDialogBackdropClose: configStore.get(