Skip to content

Commit 2b476d8

Browse files
committed
fix(Steam): add better install hooks and progress
1 parent 04040df commit 2b476d8

File tree

4 files changed

+193
-57
lines changed

4 files changed

+193
-57
lines changed

core/library_steam.gd

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ func _app_info_to_launch_item(info: Dictionary, is_installed: bool) -> LibraryLa
448448
item.name = data["name"]
449449
item.command = "steam"
450450
#item.args = ["-gamepadui", "-steamos3", "-steampal", "-steamdeck", "-silent", "steam://rungameid/" + app_id]
451+
#item.args = ["-silent", "steam://rungameid/" + app_id]
451452
item.args = ["-gamepadui", "steam://rungameid/" + app_id]
452453
item.categories = categories
453454
item.tags = ["steam"]
@@ -475,13 +476,16 @@ func _app_supports_linux(app_id: String) -> bool:
475476
## Hook to execute before app launch. This hook will try to ensure the app is
476477
## up-to-date before starting and will update the text in the game loading menu.
477478
## TODO: Also include shader compilation
479+
## TODO: Ensure steam is not currently running
478480
class PreLaunchHook extends AppLifecycleHook:
479481
var _steam: SteamClient
482+
var _replace_intro_video: bool
480483
var logger: Logger
481484

482485
func _init(steam: SteamClient) -> void:
483486
_hook_type = AppLifecycleHook.TYPE.PRE_LAUNCH
484487
_steam = steam
488+
_replace_intro_video = false # disable for now
485489
logger = Log.get_logger("Steam")
486490

487491
func get_name() -> String:
@@ -492,7 +496,8 @@ class PreLaunchHook extends AppLifecycleHook:
492496
await self.ensure_app_updated(item)
493497

494498
# Set the startup movie to use so it's less obnoxious
495-
await self.set_steam_startup_video()
499+
if _replace_intro_video:
500+
await self.set_steam_startup_video()
496501

497502
logger.info("Starting app")
498503
self.notified.emit("Starting Steam...")
@@ -503,6 +508,27 @@ class PreLaunchHook extends AppLifecycleHook:
503508
return
504509
if not item.provider_app_id.is_valid_int():
505510
return
511+
if not _steam.is_logged_in:
512+
return
513+
514+
# Linux Runtime
515+
const SNIPER_APP_ID := "1628350"
516+
logger.info("Updating Sniper Linux Runtime before launch")
517+
self.notified.emit("Updating Sniper Linux Runtime...")
518+
await _steam.update(SNIPER_APP_ID)
519+
520+
# Proton
521+
const PROTON_APP_ID := "1493710"
522+
logger.info("Updating Proton before launch")
523+
self.notified.emit("Updating Proton...")
524+
await _steam.update(PROTON_APP_ID)
525+
526+
# Common Redistributables
527+
const REDIST_APP_ID := "228980"
528+
logger.info("Updating Steamworks Common Redistributables before launch")
529+
self.notified.emit("Updating Steamworks Common Redistributables...")
530+
await _steam.update(REDIST_APP_ID)
531+
506532
logger.info("Updating app before launch")
507533
self.notified.emit("Updating app...")
508534
await _steam.update(item.provider_app_id)
@@ -544,18 +570,21 @@ class PreLaunchHook extends AppLifecycleHook:
544570
## Hook to execute when the app exits. This will try to restore the startup video.
545571
class ExitHook extends AppLifecycleHook:
546572
var _steam: SteamClient
573+
var _replace_intro_video: bool
547574
var logger: Logger
548575

549576
func _init(steam: SteamClient) -> void:
550577
_hook_type = AppLifecycleHook.TYPE.EXIT
551578
_steam = steam
579+
_replace_intro_video = false # disable for now
552580
logger = Log.get_logger("Steam")
553581

554582
func get_name() -> String:
555583
return "RestoreStartupVideo"
556584

557585
func execute(_item: LibraryLaunchItem) -> void:
558-
await self.restore_steam_startup_video()
586+
if _replace_intro_video:
587+
await self.restore_steam_startup_video()
559588

560589
func restore_steam_startup_video() -> void:
561590
var steam_path := _steam.steamcmd_dir
@@ -572,5 +601,5 @@ class ExitHook extends AppLifecycleHook:
572601
DirAccess.rename_absolute(override_path + ".ogui_backup", override_path)
573602

574603
func _notification(what: int) -> void:
575-
if what == NOTIFICATION_PREDELETE:
604+
if what == NOTIFICATION_PREDELETE and self._replace_intro_video:
576605
self.restore_steam_startup_video()

0 commit comments

Comments
 (0)