-
-
Notifications
You must be signed in to change notification settings - Fork 609
Expand file tree
/
Copy pathtypes.ts
More file actions
869 lines (781 loc) · 18.8 KB
/
types.ts
File metadata and controls
869 lines (781 loc) · 18.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
import {
GOGCloudSavesLocation,
GogInstallInfo,
GogInstallPlatform
} from './types/gog'
import {
LegendaryInstallPlatform,
GameMetadataInner,
LegendaryInstallInfo
} from './types/legendary'
import { NileInstallInfo, NileInstallPlatform } from './types/nile'
import {
ZoomInstallPlatform,
ZoomInstalledInfo,
ZoomInstallInfo
} from './types/zoom'
import { TitleBarOverlay } from 'electron'
import { ChildProcess } from 'child_process'
import type { HeroicHowLongToBeatEntry } from 'backend/wiki_game_info/howlongtobeat/utils'
import type { Path } from 'backend/schemas'
import type LogWriter from 'backend/logger/log_writer'
export type Runner = 'legendary' | 'gog' | 'sideload' | 'nile' | 'zoom'
// NOTE: Do not put enum's in this module or it will break imports
export type DialogType = 'MESSAGE' | 'ERROR'
export interface ButtonOptions {
text: string
onClick?: () => void
}
export type LaunchParams = {
appName: string
launchArguments?: LaunchOption
runner: Runner
skipVersionCheck?: boolean
args?: string[]
}
export type LaunchOption =
| BaseLaunchOption
| AltExeLaunchOption
| DLCLaunchOption
// Option to append extra parameters to the launch command
interface BaseLaunchOption {
type?: 'basic'
name: string
parameters: string
}
// Option to launch an alternative executable instead
interface AltExeLaunchOption {
type: 'altExe'
executable: Path
}
// Option to launch a DLC (another game) instead of the base game
interface DLCLaunchOption {
type: 'dlc'
dlcAppName: string
dlcTitle: string
}
interface About {
description: string
shortDescription: string
}
export type Release = {
type: 'stable' | 'beta'
html_url: string
name: string
tag_name: string
published_at: string
prerelease: boolean
id: number
body?: string
}
export type ExperimentalFeatures = {
enableHelp: boolean
cometSupport: boolean
umuSupport?: boolean
zoomPlatform?: boolean
}
export interface AppSettings extends GameSettings {
analyticsOptIn: boolean
addDesktopShortcuts: boolean
addStartMenuShortcuts: boolean
addSteamShortcuts: boolean
altGogdlBin: string
altCometBin: string
altLegendaryBin: string
altNileBin: string
autoUpdateGames: boolean
checkForUpdatesOnStartup: boolean
checkUpdatesInterval: number
customCSS: string
customThemesPath: string
customWinePaths: string[]
darkTrayIcon: boolean
defaultInstallPath: string
defaultSteamPath: string
defaultWinePrefix: string
disableController: boolean
disablePlaytimeSync: boolean
disableSmoothScrolling: boolean
disableLogs: boolean
disableAnimations: boolean
discordRPC: boolean
disableGOGPresence: boolean
downloadNoHttps: boolean
downloadProtonToSteam: boolean
egsLinkedPath: string
enableUpdates: boolean
exitToTray: boolean
noTrayIcon: boolean
experimentalFeatures?: ExperimentalFeatures
framelessWindow: boolean
hideChangelogsOnStartup: boolean
libraryTopSection: LibraryTopSectionOptions
maxRecentGames: number
maxWorkers: number
minimizeOnLaunch: boolean
startInTray: boolean
allowInstallationBrokenAnticheat: boolean
disableUMU: boolean
verboseLogs: boolean
showValveProton: boolean
}
export type LibraryTopSectionOptions =
| 'disabled'
| 'recently_played'
| 'recently_played_installed'
| 'favourites'
export type ExecResult = {
stderr: string
stdout: string
fullCommand?: string
error?: string
abort?: boolean
}
export interface ExtraInfo {
about?: About
reqs: Reqs[]
releaseDate?: string
storeUrl?: string
changelog?: string
genres?: string[]
}
export type GameConfigVersion = 'auto' | 'v0' | 'v0.1'
export type GOGAchievement = {
achievement_id: string
achievement_key: string
visible: boolean
name: string
description: string
image_url_unlocked: string
image_url_locked: string
rarity: number
date_unlocked: string | null
rarity_level_description: string
rarity_level_slug: string
}
export type GameAchievement = GOGAchievement
export interface GameInfo {
runner: 'legendary' | 'gog' | 'sideload' | 'nile' | 'zoom'
store_url?: string
app_name: string
art_cover: string
art_logo?: string
art_background?: string
art_icon?: string
art_square: string
cloud_save_enabled?: boolean
developer?: string
extra?: ExtraInfo
folder_name?: string
install: Partial<InstalledInfo>
installable?: boolean
is_installed: boolean
namespace?: string
// NOTE: This is the save folder without any variables filled in...
save_folder?: string
// ...and this is the folder with them filled in
save_path?: string
gog_save_location?: GOGCloudSavesLocation[]
title: string
canRunOffline: boolean
thirdPartyManagedApp?: string
isEAManaged?: boolean
is_mac_native?: boolean
is_linux_native?: boolean
browserUrl?: string
description?: string
//used for store release versions. if remote !== local, then update
version?: string
dlcList?: GameMetadataInner[]
customUserAgent?: string
launchFullScreen?: boolean
}
export interface GameSettings {
autoInstallDxvk: boolean
autoInstallVkd3d: boolean
autoInstallDxvkNvapi: boolean
autoSyncSaves: boolean
battlEyeRuntime: boolean
DXVKFpsCap: string //Entered as string but used as number
eacRuntime: boolean
enableDXVKFpsLimit: boolean
enableEsync: boolean
enableFSR: boolean
enableMsync: boolean
enableFsync: boolean
enableWineWayland: boolean
enableHDR: boolean
enableWoW64: boolean
gamescope: GameScopeSettings
enviromentOptions: EnviromentVariable[]
ignoreGameUpdates: boolean
language: string
launcherArgs: string
lastUsedLaunchOption?: LaunchOption
maxSharpness?: number
nvidiaPrime: boolean
offlineMode: boolean
otherOptions?: string //deprecated
preferSystemLibs: boolean
showFps: boolean
showMangohud: boolean
targetExe: string
useGameMode: boolean
useSteamRuntime: boolean
wineCrossoverBottle: string
winePrefix: string
wineVersion: WineInstallation
wrapperOptions: WrapperVariable[]
savesPath: string
gogSaves?: GOGCloudSavesLocation[]
beforeLaunchScriptPath: string
afterLaunchScriptPath: string
disableUMU: boolean
verboseLogs: boolean
advertiseAvxForRosetta: boolean
enableQuickSavesMenu: boolean
}
export type Status =
| 'installing'
| 'importing'
| 'updating'
| 'launching'
| 'playing'
| 'uninstalling'
| 'repairing'
| 'done'
| 'canceled'
| 'moving'
| 'queued'
| 'error'
| 'syncing-saves'
| 'notAvailable'
| 'notSupportedGame'
| 'notInstalled'
| 'installed'
| 'redist'
| 'extracting'
| 'winetricks'
export interface GameStatus {
appName: string
progress?: InstallProgress
folder?: string
context?: string // Additional context e.g current step
runner?: Runner
status: Status
}
export type GlobalConfigVersion = 'auto' | 'v0'
export interface InstallProgress {
bytes: string
eta: string
folder?: string
percent?: number
downSpeed?: number
diskSpeed?: number
file?: string
}
export interface InstalledInfo {
manifest?: {
disk_size: number
download_size: number
app_name: string
languages: string[]
versionEtag: string
dependencies: string[]
perLangSize: {
[key: string]: {
download_size: number
disk_size: number
}
}
}
executable: string
install_path: string
install_size: string
is_dlc: boolean
isDosbox?: boolean
dosboxConf?: string[]
version: string
platform: InstallPlatform
appName?: string
installedWithDLCs?: boolean // OLD DLC boolean (all dlcs installed)
installedDLCs?: string[] // New installed GOG DLCs array
language?: string // For GOG games
versionEtag?: string // Checksum for checking GOG updates
buildId?: string // For verifing and version pinning of GOG games
branch?: string // GOG beta channels
// Whether to skip update check for this title (currently only used for GOG as it is the only platform actively supporting version rollback)
pinnedVersion?: boolean
cyberpunk?: {
// Cyberpunk compatibility options
modsEnabled: boolean
modsToLoad: string[] // If this is empty redmod will load mods in alphabetic order
}
}
export interface Reqs {
minimum: string
recommended: string
title: string
}
export type SyncType = 'Download' | 'Upload' | 'Force download' | 'Force upload'
export type UserInfo = {
account_id: string
displayName: string
user: string
}
export interface WineInstallation {
bin: string
name: string
type: 'wine' | 'proton' | 'crossover' | 'toolkit'
lib?: string
lib32?: string
wineserver?: string
}
export interface InstallArgs {
path: string
platformToInstall: InstallPlatform
installDlcs?: Array<string>
sdlList?: string[]
installLanguage?: string
branch?: string
build?: string
dependencies?: string[]
}
export interface InstallParams extends InstallArgs {
appName: string
gameInfo: GameInfo
runner: Runner
size?: string
}
export interface UpdateParams {
appName: string
runner: Runner
gameInfo: GameInfo
installDlcs?: Array<string>
installLanguage?: string
build?: string
branch?: string
}
export interface GOGLoginData {
expires_in: number
access_token: string
refresh_token: string
user_id: string
loginTime: number
error?: boolean
}
export interface GOGImportData {
// "appName": "1441974651", "buildId": "55136646198962890", "title": "Prison Architect", "tasks": [{"category": "launcher", "isPrimary": true, "languages": ["en-US"], "name": "Prison Architect", "osBitness": ["64"], "path": "Launcher/dowser.exe", "type": "FileTask"}, {"category": "game", "isHidden": true, "languages": ["en-US"], "name": "Prison Architect - launcher process Prison Architect64_exe", "osBitness": ["64"], "path": "Prison Architect64.exe", "type": "FileTask"}, {"category": "document", "languages": ["en-US"], "link": "http://www.gog.com/support/prison_architect", "name": "Support", "type": "URLTask"}, {"category": "other", "languages": ["en-US"], "link": "http://www.gog.com/forum/prison_architect/prison_break_escape_map_megathread/post1", "name": "Escape Map Megathread", "type": "URLTask"}], "installedLanguage": "en-US"}
appName: string
buildId: string
title: string
tasks: Array<{
category: string
isPrimary?: boolean
languages?: Array<string>
arguments?: Array<string> | string
path: string
name: string
type: string
}>
installedLanguage: string
platform: GogInstallPlatform
versionName: string
dlcs: string[]
}
export interface SteamRuntime {
path: string
type: 'sniper' | 'scout' | 'soldier'
args: string[]
}
export interface LaunchPreperationResult {
success: boolean
failureReason?: string
rpcClient?: RpcClient
mangoHudCommand?: string[]
gameModeBin?: string
gameScopeCommand?: string[]
steamRuntime?: string[]
offlineMode?: boolean
}
export interface RpcClient {
destroy(): void
}
export interface CallRunnerOptions {
logMessagePrefix?: string
logWriters?: LogWriter[]
logSanitizer?: (line: string) => string
env?: Record<string, string> | NodeJS.ProcessEnv
wrappers?: string[]
onOutput?: (output: string, child: ChildProcess) => void
abortId?: string
cwd?: string
}
export interface EnviromentVariable {
key: string
value: string
}
export interface WrapperVariable {
exe: string
args: string
}
export interface WrapperEnv {
appName: string
appRunner: Runner
}
type AntiCheat =
| 'Arbiter'
| 'BattlEye'
| 'Denuvo Anti-Cheat'
| 'Easy Anti-Cheat'
| 'EQU8'
| 'FACEIT'
| 'FairFight'
| 'Mail.ru Anti-Cheat'
| 'miHoYo Protect'
| 'miHoYo Protect 2'
| 'NEAC Protect'
| 'Nexon Game Security'
| 'nProtect GameGuard'
| 'PunkBuster'
| 'RICOCHET'
| 'Sabreclaw'
| 'Treyarch Anti-Cheat'
| 'UNCHEATER'
| 'Unknown (Custom)'
| 'VAC'
| 'Vanguard'
| 'Warden'
| 'XIGNCODE3'
| 'Zakynthos'
export interface AntiCheatInfo {
status: 'Broken' | 'Denied' | 'Working' | 'Running' | 'Supported'
anticheats: AntiCheat[]
notes: string[]
native: boolean
storeIds: {
epic?: {
namespace: string
slug: string
}
steam?: string
}
reference: string
updates: AntiCheatReference[]
}
interface AntiCheatReference {
name: string
date: string
reference: string
}
export interface Runtime {
id: number
name: string
created_at: string
architecture: string
url: string
}
export type RuntimeName = 'eac_runtime' | 'battleye_runtime' | 'umu'
export type RecentGame = {
appName: string
title: string
}
export type HiddenGame = RecentGame
export type FavouriteGame = HiddenGame
export type RefreshOptions = {
checkForUpdates?: boolean
fullRefresh?: boolean
library?: Runner | 'all'
runInBackground?: boolean
}
export interface WineVersionInfo extends VersionInfo {
isInstalled: boolean
hasUpdate: boolean
installDir: string
}
export type GamepadActionStatus = Record<
ValidGamepadAction,
{
triggeredAt: { [key: number]: number }
repeatDelay: false | number
}
>
export type ValidGamepadAction = GamepadActionArgs['action']
export type GamepadActionArgs =
| GamepadActionArgsWithMetadata
| GamepadActionArgsWithoutMetadata
interface GamepadActionArgsWithMetadata {
action: 'leftClick' | 'rightClick'
metadata: {
elementTag: string
x: number
y: number
}
}
interface GamepadActionArgsWithoutMetadata {
action:
| 'padUp'
| 'padDown'
| 'padLeft'
| 'padRight'
| 'leftStickUp'
| 'leftStickDown'
| 'leftStickLeft'
| 'leftStickRight'
| 'rightStickUp'
| 'rightStickDown'
| 'rightStickLeft'
| 'rightStickRight'
| 'mainAction'
| 'back'
| 'altAction'
| 'esc'
| 'tab'
| 'shiftTab'
| 'keyboardClick'
metadata?: undefined
}
export type InstallPlatform =
| LegendaryInstallPlatform
| GogInstallPlatform
| NileInstallPlatform
| ZoomInstallPlatform
| 'Browser'
export type ConnectivityStatus = 'offline' | 'check-online' | 'online'
export interface Tools {
exe?: string
tool: string
appName: string
runner: Runner
}
export interface Tool {
name: string
url: string
os: string
strip?: number
}
export type DMStatus = 'done' | 'error' | 'abort' | 'paused'
export interface DMQueueElement {
type: 'update' | 'install'
params: InstallParams
addToQueueTime: number
startTime: number
endTime: number
status?: DMStatus
}
type ProtonVerb =
| 'run'
| 'waitforexitandrun'
| 'runinprefix'
| 'destroyprefix'
| 'getcompatpath'
| 'getnativepath'
export type WineCommandArgs = {
commandParts: string[]
wait?: boolean
protonVerb?: ProtonVerb
gameSettings?: GameSettings
gameInstallPath?: string
installFolderName?: string
options?: CallRunnerOptions
startFolder?: string
skipPrefixCheckIKnowWhatImDoing?: boolean
ignoreLogging?: boolean
}
export interface SaveSyncArgs {
arg: string | undefined
path: string
appName: string
runner: Runner
}
export interface RunWineCommandArgs {
appName: string
runner: Runner
commandParts: string[]
}
export interface ImportGameArgs {
appName: string
path: string
runner: Runner
platform: InstallPlatform
}
export interface MoveGameArgs {
appName: string
path: string
runner: Runner
}
export interface DiskSpaceData {
free: number
diskSize: number
message: string
validPath: boolean
validFlatpakPath: boolean
}
export interface ToolArgs {
appName: string
action: 'backup' | 'restore'
}
export type StatusPromise = Promise<{ status: 'done' | 'error' | 'abort' }>
export interface GameScoreInfo {
score: string
urlid: string
}
export interface PCGamingWikiInfo {
steamID: string
howLongToBeatID: string
metacritic: GameScoreInfo
opencritic: GameScoreInfo
igdb: GameScoreInfo
direct3DVersions: string[]
genres: string[]
releaseDate: string[]
}
export interface AppleGamingWikiInfo {
crossoverRating: string
wineRating: string
crossoverLink: string
}
export interface GamesDBInfo {
steamID: string
}
export interface ProtonDBCompatibilityInfo {
level: string
}
export interface SteamDeckComp {
category: number
}
export interface SteamInfo {
compatibilityLevel: string | null
steamDeckCatagory: number | null
}
export interface WikiInfo {
pcgamingwiki: PCGamingWikiInfo | null
applegamingwiki: AppleGamingWikiInfo | null
howlongtobeat: HeroicHowLongToBeatEntry | null
gamesdb: GamesDBInfo | null
steamInfo: SteamInfo | null
umuId: string | null
}
/**
* Defines from where the version comes
*/
export type Type =
| 'Wine-GE'
| 'GE-Proton'
| 'Proton'
| 'Proton-Sarek'
| 'Wine-Lutris'
| 'Wine-Kron4ek'
| 'Wine-Crossover'
| 'Wine-Staging-macOS'
| 'Game-Porting-Toolkit'
/**
* Interface contains information about a version
* - version
* - type (wine, proton, lutris, ge ...)
* - date
* - download link
* - checksum link
* - size (download and disk)
*/
export interface VersionInfo {
version: string
type: Type
date: string
download: string
downsize: number
disksize: number
checksum: string
release_notes_link: string
}
/**
* Enum for the supported repositorys
*/
export enum Repositorys {
WINEGE,
PROTONGE,
PROTON,
WINELUTRIS,
WINECROSSOVER,
WINESTAGINGMACOS,
GPTK,
PROTONSAREK
}
export type WineManagerStatus =
| { status: 'idle' | 'unzipping' }
| { status: 'downloading'; percentage: number; avgSpeed: number; eta: string }
export interface WineManagerUISettings {
value: string
type: Type
enabled: boolean
}
export type DownloadManagerState = 'idle' | 'running' | 'paused' | 'stopped'
export interface WindowProps extends Electron.Rectangle {
maximized: boolean
frame?: boolean
titleBarStyle?: 'default' | 'hidden' | 'hiddenInset'
titleBarOverlay?: TitleBarOverlay | boolean
}
interface GameScopeSettings {
enableUpscaling: boolean
enableLimiter: boolean
enableForceGrabCursor: boolean
windowType: string
gameWidth: string
gameHeight: string
upscaleWidth: string
upscaleHeight: string
upscaleMethod: string
fpsLimiter: string
fpsLimiterNoFocus: string
additionalOptions: string
}
export type InstallInfo =
| LegendaryInstallInfo
| GogInstallInfo
| NileInstallInfo
| ZoomInstalledInfo
| ZoomInstallInfo
export interface KnowFixesInfo {
title: string
notes?: Record<string, string>
winetricks?: string[]
runInPrefix?: string[]
envVariables?: Record<string, string>
wikiLink?: string
}
export interface UploadedLogData {
// Descriptive name of the log file (e.g. "Game log of ...")
name: string
// Token to modify the file (used to delete the log file on the server)
token: string
// Time the log file was uploaded (used to know whether it expired)
uploadedAt: number
}
export interface RunnerCommandStub {
commandParts: string[]
response?: Promise<ExecResult>
stdout?: string
stderr?: string
}
export type ReleasesInfo = Record<
| 'ge-proton'
| 'wine-ge'
| 'game-porting-toolkit'
| 'wine-staging'
| 'wine-crossover'
| 'proton-sarek'
| 'dxvk'
| 'dxvk-mac'
| 'dxmt'
| 'vkd3d',
{
tag: string
published_at: string
}
> & {
anticheatFiles: {
shaMac: string
shaLinux: string
}
}