Skip to content

Commit dbb001b

Browse files
authored
Merge branch 'main' into tech/sust_ipc_refactor
2 parents f73de22 + 3ed2940 commit dbb001b

File tree

18 files changed

+275
-133
lines changed

18 files changed

+275
-133
lines changed

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
22
"name": "hyperplay",
3-
"version": "0.23.2",
3+
"version": "0.24.0",
44
"private": true,
55
"main": "build/main/main.js",
6-
"productName": "HyperPlay",
76
"homepage": "./",
87
"license": "GPL-3.0-only",
98
"description": "HyperPlay",
@@ -73,7 +72,7 @@
7372
"@hyperplay/chains": "^0.5.0",
7473
"@hyperplay/check-disk-space": "^3.5.2",
7574
"@hyperplay/quests-ui": "^0.1.26",
76-
"@hyperplay/ui": "^1.9.9",
75+
"@hyperplay/ui": "^1.11.1",
7776
"@hyperplay/utils": "^0.3.7",
7877
"@mantine/carousel": "^7.12.0",
7978
"@mantine/core": "^7.12.0",

pnpm-lock.yaml

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/locales/en/translation.json

-1
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,6 @@
884884
"autoUpdateGames": "Automatically update games",
885885
"autovkd3d": "Auto Install/Update VKD3D on Prefix",
886886
"change-target-exe": "Select an alternative EXE to run",
887-
"checkForUpdatesOnStartup": "Check for HyperPlay Updates on Startup",
888887
"crossover-version": "Crossover/Wine Version",
889888
"custom_themes_path": "Custom Themes Path",
890889
"customWineProton": "Custom Wine/Proton Paths",

src/backend/config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ class GlobalConfigV0 extends GlobalConfig {
295295
autoInstallDxvkNvapi: false,
296296
addSteamShortcuts: false,
297297
preferSystemLibs: false,
298-
checkForUpdatesOnStartup: !isLinux,
299298
autoUpdateGames: true,
300299
customWinePaths: isWindows ? null : [],
301300
defaultInstallPath: installPath,

src/backend/metrics/types.ts

+25
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,29 @@ export interface PatchingFailed {
228228
sensitiveProperties?: never
229229
}
230230

231+
export interface PatchingAborted {
232+
event: 'Patching Aborted'
233+
properties: {
234+
game_name: string
235+
game_title: string
236+
platform: ReturnType<typeof getPlatformName>
237+
platform_arch: InstallPlatform
238+
}
239+
sensitiveProperties?: never
240+
}
241+
242+
export interface PatchingCleanupFailed {
243+
event: 'Patching Cleanup Failed'
244+
properties: {
245+
game_name: string
246+
error: string
247+
game_title: string
248+
platform?: ReturnType<typeof getPlatformName>
249+
platform_arch?: InstallPlatform
250+
}
251+
sensitiveProperties?: never
252+
}
253+
231254
export interface PatchingTooSlow {
232255
event: 'Patching Too Slow'
233256
properties: {
@@ -475,6 +498,8 @@ export type PossibleMetricPayloads =
475498
| PatchingStarted
476499
| PatchingSuccess
477500
| PatchingFailed
501+
| PatchingAborted
502+
| PatchingCleanupFailed
478503
| PatchingTooSlow
479504
| AccountDropdownPortfolioClicked
480505

src/backend/storeManagers/hyperplay/games.ts

+86-16
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ import {
6565
handleArchAndPlatform,
6666
handlePlatformReversed,
6767
runModPatcher,
68-
sanitizeVersion
68+
sanitizeVersion,
69+
safeRemoveDirectory
6970
} from './utils'
7071
import { getSettings as getSettingsSideload } from 'backend/storeManagers/sideload/games'
7172
import {
@@ -423,11 +424,11 @@ const findExecutables = async (folderPath: string): Promise<string[]> => {
423424
return executables
424425
}
425426

426-
export function cleanUpDownload(appName: string, directory: string) {
427+
export async function cleanUpDownload(appName: string, directory: string) {
427428
inProgressDownloadsMap.delete(appName)
428429
inProgressExtractionsMap.delete(appName)
429430
deleteAbortController(appName)
430-
rmSync(directory, { recursive: true, force: true })
431+
await safeRemoveDirectory(directory)
431432
}
432433

433434
function getDownloadUrl(platformInfo: PlatformConfig, appName: string) {
@@ -523,9 +524,9 @@ async function downloadGame(
523524
res()
524525
}
525526

526-
function onCancel() {
527+
async function onCancel() {
527528
try {
528-
cleanUpDownload(appName, directory)
529+
await cleanUpDownload(appName, directory)
529530
} catch (err) {
530531
rej(err)
531532
}
@@ -1181,7 +1182,7 @@ export async function extract(
11811182
body: `Installed`
11821183
})
11831184

1184-
cleanUpDownload(appName, directory)
1185+
await cleanUpDownload(appName, directory)
11851186

11861187
sendFrontendMessage('refreshLibrary', 'hyperplay')
11871188

@@ -1190,21 +1191,21 @@ export async function extract(
11901191
})
11911192
}
11921193
)
1193-
extractService.once('error', (error: Error) => {
1194+
extractService.once('error', async (error: Error) => {
11941195
logError(`Extracting Error ${error.message}`, LogPrefix.HyperPlay)
11951196

11961197
cancelQueueExtraction()
11971198
callAbortController(appName)
11981199

1199-
cleanUpDownload(appName, directory)
1200+
await cleanUpDownload(appName, directory)
12001201

12011202
sendFrontendMessage('refreshLibrary', 'hyperplay')
12021203

12031204
resolve({
12041205
status: 'error'
12051206
})
12061207
})
1207-
extractService.once('canceled', () => {
1208+
extractService.once('canceled', async () => {
12081209
logInfo(
12091210
`Canceled Extracting: Cancellation completed on ${appName} - Destination ${destinationPath}`,
12101211
LogPrefix.HyperPlay
@@ -1242,7 +1243,7 @@ export async function extract(
12421243
body: 'Installation Stopped'
12431244
})
12441245

1245-
cleanUpDownload(appName, directory)
1246+
await cleanUpDownload(appName, directory)
12461247

12471248
sendFrontendMessage('refreshLibrary', 'hyperplay')
12481249

@@ -1914,13 +1915,18 @@ async function applyPatching(
19141915

19151916
if (signal.aborted) {
19161917
logInfo(`Patching ${appName} aborted`, LogPrefix.HyperPlay)
1917-
rmSync(datastoreDir, { recursive: true })
1918+
await safeRemoveDirectory(datastoreDir, {
1919+
sizeThresholdMB: blockSize * totalBlocks
1920+
})
1921+
aborted = true
19181922
return { status: 'abort' }
19191923
}
19201924

1921-
signal.onabort = () => {
1925+
signal.onabort = async () => {
19221926
aborted = true
1923-
rmSync(datastoreDir, { recursive: true })
1927+
await safeRemoveDirectory(datastoreDir, {
1928+
sizeThresholdMB: blockSize * totalBlocks
1929+
})
19241930
return { status: 'abort' }
19251931
}
19261932

@@ -2005,7 +2011,36 @@ async function applyPatching(
20052011
}
20062012
// need this to cover 100% of abort cases
20072013
if (aborted) {
2008-
rmSync(datastoreDir, { recursive: true })
2014+
try {
2015+
await safeRemoveDirectory(datastoreDir, {
2016+
sizeThresholdMB: blockSize * totalBlocks
2017+
})
2018+
} catch (cleanupError) {
2019+
trackEvent({
2020+
event: 'Patching Cleanup Failed',
2021+
properties: {
2022+
error: `${cleanupError}`,
2023+
game_name: gameInfo.app_name,
2024+
game_title: gameInfo.title,
2025+
platform: getPlatformName(platform),
2026+
platform_arch: platform
2027+
}
2028+
})
2029+
2030+
logWarning(
2031+
`Patching aborted and cleanup failed: ${cleanupError}`,
2032+
LogPrefix.HyperPlay
2033+
)
2034+
}
2035+
trackEvent({
2036+
event: 'Patching Aborted',
2037+
properties: {
2038+
game_name: gameInfo.app_name,
2039+
game_title: gameInfo.title,
2040+
platform: getPlatformName(platform),
2041+
platform_arch: platform
2042+
}
2043+
})
20092044
return { status: 'abort' }
20102045
}
20112046

@@ -2020,8 +2055,27 @@ async function applyPatching(
20202055
})
20212056

20222057
logInfo(`Patching ${appName} completed`, LogPrefix.HyperPlay)
2023-
rmSync(datastoreDir, { recursive: true })
2058+
try {
2059+
await safeRemoveDirectory(datastoreDir, {
2060+
sizeThresholdMB: blockSize * totalBlocks
2061+
})
2062+
} catch (cleanupError) {
2063+
trackEvent({
2064+
event: 'Patching Cleanup Failed',
2065+
properties: {
2066+
error: `${cleanupError}`,
2067+
game_name: gameInfo.app_name,
2068+
game_title: gameInfo.title,
2069+
platform: getPlatformName(platform),
2070+
platform_arch: platform
2071+
}
2072+
})
20242073

2074+
logWarning(
2075+
`Patching succeeded but cleanup failed: ${cleanupError}`,
2076+
LogPrefix.HyperPlay
2077+
)
2078+
}
20252079
return { status: 'done' }
20262080
} catch (error) {
20272081
if (error instanceof PatchingError) {
@@ -2061,7 +2115,23 @@ async function applyPatching(
20612115

20622116
// errors can be thrown before datastore dir created. rmSync on nonexistent dir blocks indefinitely
20632117
if (existsSync(datastoreDir)) {
2064-
rmSync(datastoreDir, { recursive: true })
2118+
try {
2119+
await safeRemoveDirectory(datastoreDir)
2120+
} catch (cleanupError) {
2121+
trackEvent({
2122+
event: 'Patching Cleanup Failed',
2123+
properties: {
2124+
error: `${cleanupError}`,
2125+
game_name: gameInfo.app_name,
2126+
game_title: gameInfo.title
2127+
}
2128+
})
2129+
2130+
logWarning(
2131+
`Patching failed and cleanup failed: ${cleanupError}`,
2132+
LogPrefix.HyperPlay
2133+
)
2134+
}
20652135
}
20662136

20672137
return { status: 'error', error: `Error while patching ${error}` }

0 commit comments

Comments
 (0)