Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[GOG]: Refactor almost all GOG components #3020

Merged
merged 66 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
2fd3101
initial changes to downloading
imLinguin Aug 12, 2023
c844302
feat: changelog with html sanitizer, gogdl config sandboxing
imLinguin Aug 24, 2023
e8c6b65
ui for gog modfiy install, and minor additions for obtaining install …
imLinguin Aug 25, 2023
7e3f61b
split reusable frontend components, add Cyberpunk REDmod support, gog…
imLinguin Aug 27, 2023
c1dd3e2
re-enable playtime sync
imLinguin Aug 27, 2023
f1e1130
feat: private branches, small fixes to redMod
imLinguin Aug 28, 2023
d2aff7e
impov: redmod windows support
imLinguin Aug 28, 2023
d9e1f75
feat: redistributable management
imLinguin Aug 29, 2023
9a79fa2
feat: support instruction parsing compliant with backup installers
imLinguin Aug 30, 2023
d766c20
fix: lint
imLinguin Aug 30, 2023
fe1788d
improv: improvements to backup installers interop
imLinguin Aug 31, 2023
dc0d230
feat: setup should work on windows
imLinguin Aug 31, 2023
21dda3a
add very important comment
imLinguin Sep 3, 2023
4489c1f
improv: avoid refreshing library too much
imLinguin Sep 13, 2023
feed9b5
Pull upstream main changes
imLinguin Sep 13, 2023
7b7b758
i18n: generate locales
imLinguin Sep 13, 2023
c138cba
chore: remove merge leftovers
imLinguin Sep 13, 2023
4770278
linux: default to sniper steam runtime
imLinguin Sep 13, 2023
d1769f8
improv: use steam_compat_install_path env var on Linux (wine, proton …
imLinguin Sep 14, 2023
78e0fce
feat: add redist state
imLinguin Sep 16, 2023
5803351
fix: consistent styling of game card play button
imLinguin Sep 16, 2023
bac4914
generate i18n
imLinguin Sep 16, 2023
667bf45
improv: hide spammy redist update notifications, change ok to apply
imLinguin Sep 16, 2023
4da9a1b
improv: get accurate data for linux native games
imLinguin Sep 16, 2023
3964599
chore: update gogdl binaries
imLinguin Sep 16, 2023
7d9dc00
fix: lint
imLinguin Sep 16, 2023
b4e92ce
fix: error on download modal for Linux native games
imLinguin Sep 19, 2023
28f31f0
shortcuts: prefer icons shipped with games
imLinguin Sep 23, 2023
33f8407
fix: avoid emptying game library if some library page requests fail
imLinguin Sep 23, 2023
defafb1
tech: don't pass onIconClick prop to input element
imLinguin Sep 23, 2023
0a60943
use run verb for uninstall, make clearer script interpreter error
imLinguin Sep 24, 2023
2f77bc4
Merge branch 'main' of github.com:Heroic-Games-Launcher/HeroicGamesLa…
imLinguin Sep 26, 2023
d8c023e
update gogdl with windows and mac fixes
imLinguin Sep 27, 2023
4a47773
Merge branch 'main' of github.com:Heroic-Games-Launcher/HeroicGamesLa…
imLinguin Sep 30, 2023
4b23ba2
don't create prefix on uninstall
imLinguin Sep 30, 2023
98cecbe
fix: loading indicator bug
imLinguin Sep 30, 2023
4cd62b5
fix: uninstall status change, redmod error detection
imLinguin Sep 30, 2023
9c62eaf
make gogdl use redmod config from info file (hacky)
imLinguin Oct 1, 2023
42a8fd2
avoid overwriting metadata for paused installations
imLinguin Oct 2, 2023
719b31c
Merge branch 'main' of github.com:Heroic-Games-Launcher/HeroicGamesLa…
imLinguin Oct 2, 2023
b30564b
Pull upstream main
imLinguin Oct 21, 2023
3134fa6
fix: move from Collapsable to Tabs in modifyinstall
imLinguin Oct 21, 2023
625953d
update gogdl with xdelta patching
imLinguin Oct 21, 2023
e8b516b
improv: make modify install same size as settings modal
imLinguin Oct 28, 2023
e86c196
fix: re-add offline installers changes detection
imLinguin Oct 28, 2023
20bcc34
Merge branch 'main' of github.com:Heroic-Games-Launcher/HeroicGamesLa…
imLinguin Oct 28, 2023
9e093df
fix: patching percentage going over 100%
imLinguin Oct 28, 2023
4051518
Pull upstream main
imLinguin Nov 7, 2023
e2c271b
fix: branch password style
imLinguin Nov 7, 2023
fd5520e
improv: avoid retrying to fetch game data on 404 response
imLinguin Nov 10, 2023
6916885
feat: add ability to select beta channel during install
imLinguin Nov 11, 2023
eb3a2f8
improv: use Intl instead of conspired/i18n-iso-languages
imLinguin Nov 17, 2023
474ca99
Pull upstream
imLinguin Dec 4, 2023
e62e545
tech: gogdl update
imLinguin Dec 4, 2023
476c2cc
linux: new download method
imLinguin Dec 10, 2023
a7bcaff
improv: don't run uninstall exe if we are going to remove the prefix
imLinguin Dec 11, 2023
05f707f
linux: support symlinks - gogdl update
imLinguin Dec 11, 2023
a379515
fix: exception when some images are not defined
imLinguin Dec 11, 2023
7ae8b57
fix: redist not being installed sometimes
imLinguin Dec 14, 2023
2680b41
fix: library refresh + game push race condition
imLinguin Dec 18, 2023
f1bdf6c
Pull upstream main
imLinguin Jan 5, 2024
d741c03
Resolve conflicts afer merging #3393
imLinguin Jan 6, 2024
abf4ddf
fix: let the uninstall command know if we are removing the prefix
imLinguin Jan 16, 2024
551abdb
:shushing_face:
imLinguin Jan 16, 2024
9cd8b35
Pull upstream main v2.12.0
imLinguin Jan 17, 2024
4ee3548
Merge branch 'main' of github.com:Heroic-Games-Launcher/HeroicGamesLa…
imLinguin Jan 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improv: avoid refreshing library too much
  • Loading branch information
imLinguin committed Sep 13, 2023
commit 4489c1f8f99e4ca860b27eb626d438d986e235d6
1 change: 1 addition & 0 deletions src/backend/downloadmanager/downloadqueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ async function addToQueue(element: DMQueueElement) {

if (
element.params.runner === 'gog' &&
element.params.platformToInstall === 'windows' &&
installInfo &&
'dependencies' in installInfo.manifest
) {
Expand Down
4 changes: 2 additions & 2 deletions src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
import { GlobalConfig } from './config'
import { GameConfig } from './game_config'
import { DXVK } from './tools'
import setup from './storeManagers/gog/setup'
import gogSetup from './storeManagers/gog/setup'
import nileSetup from './storeManagers/nile/setup'
import {
CallRunnerOptions,
Expand Down Expand Up @@ -241,7 +241,7 @@ async function prepareWineLaunch(
LogPrefix.Backend
)
if (runner === 'gog') {
await setup(appName)
await gogSetup(appName)
}
if (runner === 'nile') {
await nileSetup(appName)
Expand Down
10 changes: 7 additions & 3 deletions src/backend/storeManagers/gog/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@ export async function install(
const array = installedGamesStore.get('installed', [])
array.push(installedData)
installedGamesStore.set('installed', array)
gameInfo.is_installed = true
gameInfo.install = installedData
sendFrontendMessage('pushGameToLibrary', gameInfo)
refreshInstalled()
if (isWindows) {
logInfo('Windows os, running setup instructions on install', LogPrefix.Gog)
Expand All @@ -416,7 +419,7 @@ export async function install(
} catch (e) {
logWarning(
[
`Failed to run setup instructions on install for ${gameInfo.title}, some other step might be needed for the game to work. Check the 'goggame-${appName}.script' file in the game folder`,
`Failed to run setup instructions on install for ${gameInfo.title}`,
'Error:',
e
],
Expand Down Expand Up @@ -906,7 +909,7 @@ export async function uninstall({ appName }: RemoveArgs): Promise<ExecResult> {
await removeShortcutsUtil(gameInfo)
syncStore.delete(appName)
await removeNonSteamGame({ gameInfo })
sendFrontendMessage('refreshLibrary', 'gog')
sendFrontendMessage('pushGameToLibrary', gameInfo)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since gog integration is so tied up to Heroic I feel like we should move towards making less full library refreshes

return res
}

Expand Down Expand Up @@ -1189,7 +1192,8 @@ export async function forceUninstall(appName: string): Promise<void> {
const installed = installedGamesStore.get('installed', [])
const newInstalled = installed.filter((g) => g.appName !== appName)
installedGamesStore.set('installed', newInstalled)
sendFrontendMessage('refreshLibrary', 'gog')
refreshInstalled()
sendFrontendMessage('pushGameToLibrary', getGameInfo(appName))
}

// GOGDL now handles the signal, this is no longer needed
Expand Down
29 changes: 16 additions & 13 deletions src/backend/storeManagers/gog/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ export async function initGOGLibraryManager() {
await mkdir(manifestDir, { recursive: true })
}

const credentials = await GOGUser.getCredentials()
for (const appName of installedGamesList) {
await createMissingGogdlManifest(appName, credentials)
}
runOnceWhenOnline(async () => {
const credentials = await GOGUser.getCredentials()
for (const appName of installedGamesList) {
await createMissingGogdlManifest(appName, credentials)
}
})
runOnceWhenOnline(checkForRedistUpdates)
}

Expand All @@ -91,18 +93,14 @@ async function createMissingGogdlManifest(
// Pull the data, read info file from install dir if possible
const res = await runRunnerCommand(
['import', installedData.install_path],
createAbortController(appName),
createAbortController(`${appName}-manifest-restore`),
{
logMessagePrefix: `Getting data of ${appName}`
}
)
deleteAbortController(appName)
deleteAbortController(`${appName}-manifest-restore`)
try {
const importData: GOGImportData = JSON.parse(res.stdout)
if (!importData.buildId) {
logError(`Unable to get data of ${appName}`, { prefix: LogPrefix.Gog })
return
}
const builds = await getBuilds(
appName,
installedData.platform,
Expand All @@ -112,9 +110,9 @@ async function createMissingGogdlManifest(

// Find our build in the list

const currentBuild = buildItems.find(
(item) => item.build_id === importData.buildId
)
const currentBuild = importData.buildId
? buildItems.find((item) => item.build_id === importData.buildId)
: buildItems.find((item) => !item.branch)
if (!currentBuild || !currentBuild.urls) {
logError(`Unable to get current build of ${appName}`, {
prefix: LogPrefix.Gog
Expand All @@ -132,6 +130,7 @@ async function createMissingGogdlManifest(
}
const manifestData = JSON.parse(manifestDataRaw.toString())

manifestData.HGLPlatform = importData.platform
manifestData.HGLInstallLanguage = importData.installedLanguage
manifestData.HGLdlcs = importData.dlcs.map((dlc) => ({ id: dlc }))

Expand Down Expand Up @@ -772,6 +771,10 @@ export async function importGame(data: GOGImportData, executablePath: string) {
gameData.is_installed = true
library.set(data.appName, gameData)
installedGamesStore.set('installed', Array.from(installedGames.values()))
refreshInstalled()
await createMissingGogdlManifest(data.appName)
await checkForRedistUpdates()
sendFrontendMessage('pushGameToLibrary', gameData)
}

// This checks for updates of Windows and Mac titles
Expand Down
11 changes: 7 additions & 4 deletions src/backend/storeManagers/gog/redist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ import {
import { DMQueueElement } from 'common/types'
import axios from 'axios'
import { GOGUser } from './user'
import { isOnline } from 'backend/online_monitor'

export async function checkForRedistUpdates() {
if (!GOGUser.isLoggedIn()) {
if (!GOGUser.isLoggedIn() || !isOnline()) {
return
}
const manifestPath = path.join(gogRedistPath, '.gogdl-redist-manifest')
Expand Down Expand Up @@ -80,10 +81,12 @@ export async function checkForRedistUpdates() {
'https://content-system.gog.com/dependencies/repository?generation=2'
)
const newBuildId = response.data.build_id
logInfo('Updating redist, reason - new buildId', {
prefix: LogPrefix.Gog
})
shouldUpdate = buildId !== newBuildId
if (shouldUpdate) {
logInfo('Updating redist, reason - new buildId', {
prefix: LogPrefix.Gog
})
}
}
} catch (e) {
logError(['Failed to read gog redist manifest', e], {
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/state/GlobalState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,9 @@ class GlobalState extends PureComponent<Props> {
})
}

this.refreshLibrary({ runInBackground: true, library: runner })
if (runner !== 'gog') {
this.refreshLibrary({ runInBackground: true, library: runner })
}
this.setState({ libraryStatus: newLibraryStatus })
}
}
Expand Down