Skip to content

Commit

Permalink
comet support (#3727)
Browse files Browse the repository at this point in the history
* comet support (doesn't include comet binaries)

* use --quit flag

* gog online presence support

Co-Authored-By: Paweł Lidwin <[email protected]>

* code review suggestions

Co-authored-by: Ariel Juodziukynas <[email protected]>

* Update translation.json

* add comet binaries

* Revert "use --quit flag"

This reverts commit 68f3b24.

* log comet output to gogdl logs

* download comet (initial version, is broken)

* fix comet download

* add experimental feature for comet support

* Update translation.json

* improv: disable presence when playtime sync is disabled

* feat: comet dummy service download

* fix: mock unzip plugin

* fix: maybe let's pass the script path to wine

* remove skipPrefixCheck

---------

Co-authored-by: Paweł Lidwin <[email protected]>
Co-authored-by: Ariel Juodziukynas <[email protected]>
Co-authored-by: Paweł Lidwin <[email protected]>
Co-authored-by: Mathis Dröge <[email protected]>
  • Loading branch information
5 people authored Aug 4, 2024
1 parent 177b0b9 commit 6828379
Show file tree
Hide file tree
Showing 25 changed files with 342 additions and 29 deletions.
3 changes: 2 additions & 1 deletion electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const srcAliases = ['backend', 'frontend', 'common'].map((aliasName) => ({

const dependenciesToNotExternalize = [
'@xhmikosr/decompress',
'@xhmikosr/decompress-targz'
'@xhmikosr/decompress-targz',
'@xhmikosr/decompress-unzip'
]

// FIXME: Potentially publish this as a dedicated plugin, if other projects
Expand Down
27 changes: 24 additions & 3 deletions meta/downloadHelperBinaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { Readable } from 'stream'
import { finished } from 'stream/promises'

type SupportedPlatform = 'win32' | 'darwin' | 'linux'
type DownloadedBinary = 'legendary' | 'gogdl' | 'nile'
type DownloadedBinary = 'legendary' | 'gogdl' | 'nile' | 'comet'

const RELEASE_TAGS = {
legendary: '0.20.35',
gogdl: 'v1.1.1',
nile: 'v1.1.0'
nile: 'v1.1.0',
comet: 'v0.1.2'
} as const satisfies Record<DownloadedBinary, string>

const pathExists = async (path: string): Promise<boolean> =>
Expand Down Expand Up @@ -137,6 +138,24 @@ async function downloadNile() {
})
}

async function downloadComet() {
return downloadGithubAssets(
'comet',
'imLinguin/comet',
RELEASE_TAGS['comet'],
{
x64: {
linux: 'comet-x86_64-unknown-linux-gnu',
darwin: 'comet-x86_64-apple-darwin',
win32: 'comet-x86_64-pc-windows-msvc.exe'
},
arm64: {
darwin: 'comet-aarch64-apple-darwin'
}
}
)
}

/**
* Finds out which binaries need to be downloaded by comparing
* `public/bin/.release_tags` to RELEASE_TAGS
Expand All @@ -150,7 +169,7 @@ async function compareDownloadedTags(): Promise<DownloadedBinary[]> {
try {
storedTagsParsed = JSON.parse(storedTagsText)
} catch {
return ['legendary', 'gogdl', 'nile']
return ['legendary', 'gogdl', 'nile', 'comet']
}
const binariesToDownload: DownloadedBinary[] = []
for (const [runner, currentTag] of Object.entries(RELEASE_TAGS)) {
Expand Down Expand Up @@ -184,6 +203,8 @@ async function main() {
if (binariesToDownload.includes('gogdl'))
promisesToAwait.push(downloadGogdl())
if (binariesToDownload.includes('nile')) promisesToAwait.push(downloadNile())
if (binariesToDownload.includes('comet'))
promisesToAwait.push(downloadComet())

await Promise.all(promisesToAwait)

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@shockpkg/icon-encoder": "2.1.3",
"@xhmikosr/decompress": "9.0.1",
"@xhmikosr/decompress-targz": "7.0.0",
"@xhmikosr/decompress-unzip": "^7.0.0",
"axios": "0.26.1",
"classnames": "2.3.1",
"compare-versions": "6.1.0",
Expand Down
76 changes: 69 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion public/bin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
**/gogdl.exe
**/nile
**/nile.exe
.release_tags
**/comet
**/comet.exe
.release_tags
2 changes: 2 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@
"exit-to-tray": "Exit to System Tray",
"experimental_features": {
"automaticWinetricksFixes": "Apply known fixes automatically",
"cometSupport": "Comet support",
"enableHelp": "Help component",
"enableNewDesign": "New design",
"umuSupport": "Use UMU as Proton runtime"
Expand Down Expand Up @@ -786,6 +787,7 @@
"warning": "Cloud Saves feature is in Beta, please backup your saves before syncing (in case something goes wrong)"
},
"systemInformation": {
"cometVersion": "Comet: {{cometVersion}}",
"copyToClipboard": "Copy to clipboard",
"cpu": "CPU:",
"cpuDescription": "{{numOfCores}}x {{modelName}}",
Expand Down
1 change: 1 addition & 0 deletions src/backend/__mocks__/@xhmikosr/decompress-unzip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {}
1 change: 1 addition & 0 deletions src/backend/api/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const setSetting = (args: {
export const getLegendaryVersion = async () =>
ipcRenderer.invoke('getLegendaryVersion')
export const getGogdlVersion = async () => ipcRenderer.invoke('getGogdlVersion')
export const getCometVersion = async () => ipcRenderer.invoke('getCometVersion')
export const getNileVersion = async () => ipcRenderer.invoke('getNileVersion')
export const getEosOverlayStatus = async () =>
ipcRenderer.invoke('getEosOverlayStatus')
Expand Down
29 changes: 25 additions & 4 deletions src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ async function prepareWineLaunch(
}

const { updated: winePrefixUpdated } = await verifyWinePrefix(gameSettings)
const experimentalFeatures =
GlobalConfig.get().getSettings().experimentalFeatures
if (winePrefixUpdated) {
logInfo(
['Created/Updated Wineprefix at', gameSettings.winePrefix],
Expand All @@ -363,14 +365,33 @@ async function prepareWineLaunch(
if (runner === 'legendary') {
await legendarySetup(appName)
}
if (
GlobalConfig.get().getSettings().experimentalFeatures
?.automaticWinetricksFixes !== false
) {
if (experimentalFeatures?.automaticWinetricksFixes !== false) {
await installFixes(appName, runner)
}
}

if (runner === 'gog' && experimentalFeatures?.cometSupport !== false) {
if (isOnline() && !(await isInstalled('comet_dummy_service'))) {
await download('comet_dummy_service')
}
const installerScript = join(
runtimePath,
'comet_dummy_service',
'install-dummy-service.bat'
)
if (existsSync(installerScript)) {
await runWineCommand({
commandParts: [installerScript],
gameSettings,
protonVerb: 'runinprefix'
})
} else {
logWarning(
"Comet dummy service isn't downloaded, online functionality may not work"
)
}
}

// If DXVK/VKD3D installation is enabled, install it
if (gameSettings.wineVersion.type === 'wine') {
if (gameSettings.autoInstallDxvk) {
Expand Down
Loading

0 comments on commit 6828379

Please sign in to comment.