UWPHook icon indicating copy to clipboard operation
UWPHook copied to clipboard

Request: Add all new items to Steam -- automatic mode

Open idbrii opened this issue 4 years ago • 4 comments
trafficstars

I'd love if uwphook could be more automated.

I imagine it working like this:

  • First run of UWPHook must be manual. Add games as normal. UWPHook saves the list of appids detected.
  • Run UWPHook.exe --automatic and it detects appids that weren't in the previous list, adds them to steam, and saves the new list of appids (clobbering the old list so uninstall+reinstall can be detected).

That would allow me to add UWPHook as a shortcut in steam, run it from big picture, and not have to click on anything.

idbrii avatar May 25 '21 05:05 idbrii

Bonus points if this filters down to only games somehow.

shadow7412 avatar Jun 25 '21 04:06 shadow7412

Looking at the CLIs for this kinda thing

  • https://learn.microsoft.com/en-us/powershell/module/appx/get-appxpackage?view=windowsserver2022-ps
Get-AppxPackage -Name *yak*

Name              : SEGAofAmericaInc.Yakuza0PC
Publisher         : CN=8E5E0709-F814-48B2-9B8A-DC1D37C0D899
Architecture      : X64
ResourceId        :
Version           : 1.0.21.0
PackageFullName   : SEGAofAmericaInc.Yakuza0PC_1.0.21.0_x64__s751p9cej88mt
InstallLocation   : C:\Program Files\WindowsApps\SEGAofAmericaInc.Yakuza0PC_1.0.21.0_x64__s751p9cej88mt
IsFramework       : False
PackageFamilyName : SEGAofAmericaInc.Yakuza0PC_s751p9cej88mt
PublisherId       : s751p9cej88mt
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.DirectXRuntime_9.29.1974.0_x64__8wekyb3d8bbwe,
                    Microsoft.VCLibs.140.00.UWPDesktop_14.0.32530.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

No obvious clues it's a game. Let's see the related CLIs in MS docs:

  • https://learn.microsoft.com/en-us/powershell/module/appx/get-appxpackagemanifest?view=windowsserver2022-ps

(Get-AppxPackage -Name "*yak*" | Get-AppxPackageManifest).package.applications.application gives:

Id             : Game
Executable     : GameLaunchHelper.exe
EntryPoint     : Windows.FullTrustApplication
VisualElements : VisualElements
Extensions     : Extensions

That looks like a pretty obvious clue that we're dealing with a game!


Similarly, we can't sleep on bramble:

 (Get-AppxPackage -Name "*bram*")


Name              : MergeGamesLimited.BrambleTheMountainKing
Publisher         : CN=125B2AA5-3E7D-45BC-B052-3C6832CAAE9E
...
 (Get-AppxPackage -Name "*bram*" | Get-AppxPackageManifest).package.applications.application

Id             : AppBrambleTheMountainKingShipping
Executable     : GameLaunchHelper.exe
EntryPoint     : Windows.FullTrustApplication
VisualElements : VisualElements
Extensions     : Extensions

So, the common item between the games is this "GameLaunchHelper.exe".


What if we get all packages, and filter to those who have GameLaunchHelper.exe?

james-s-w-clark avatar Jul 23 '23 15:07 james-s-w-clark

This seems to be a step in the right direction for filtering only to games.

If it's very reliable, we could consider removing the whole checkbox include system.

# Simpler example; don't sleep on Bramble
(Get-AppxPackage -Name "*bram*" | Get-AppxPackageManifest).package.applications.application

# Get all packages - it's fast, and let's just filter later
$packages = Get-AppxPackage

# The game manifest seems to have "GameLaunchHelper.exe" for most games:
# Id             : AppBrambleTheMountainKingShipping
# Executable     : GameLaunchHelper.exe
# EntryPoint     : Windows.FullTrustApplication
# VisualElements : VisualElements
# Extensions     : Extensions
$filteredPackages = $packages | Where-Object { 
    ($_ | Get-AppxPackageManifest).package.applications.application.Executable -eq "GameLaunchHelper.exe" 
}

# Show all the packages 
$filteredPackages

# Just print the name for each item, to easily see the list

# BethesdaSoftworks.Dishonored2-PC
# DevolverDigital.TrekToYomiWin10
# TeamCherry.15373CD61C66B
# PlayStack.MortalShell
# Microsoft.Psychonauts2
# AnnapurnaInteractive.DonutCounty
# 505GAMESS.P.A.EiyudenChronicleRising
# BethesdaSoftworks.LiluDallas-Multipass
# DevolverDigital.ShadowWarrior3Win10
# SEGAofAmericaInc.Yakuza0PC
# DevolverDigital.PikunikuWin10
# PillowCastle.Superliminal
# JUMPSHIP.23864955D3E5D
# MergeGamesLimited.BrambleTheMountainKing
# iam8bit.EscapeAcademy
# 41027AB6.F.I.S.T.ForgedInShadowTorchGame
# FocusHomeInteractiveSA.26534A3814B10

# 17 games here; I have 18 in UWPHook
# BUT, Crackdown 3 is listed twice (Campaign/Wrecking Mode)
$filteredPackages | Select-Object -ExpandProperty Name

Edit: Ah I see, this kinda thing is already done: https://github.com/BrianLima/UWPHook/blob/master/UWPHook/Resources/GetAUMIDScript.ps1#L13

For me, I might just build/run the app with this seen as it seem's good enough, and would make things simpler to automate

if($executable -ne "GameLaunchHelper.exe") {
  continue;
}

I made a fork with this, and selecting all the apps. It might not be accurate, doesn't have an easy download, and won't be maintained. But IMO it could be nice (maybe a program --flag like -- onlyGameLauncher, or a checkbox in the UI) to use the idea.

https://github.com/IdiosApps/UWPHook

image


Extra notes:

About saving/loading and using a diff:

  • Exporting 2+ times is the same as exporting once (from what I can see!). A game still only shows in Steam once.
  • So, exporting/loading a list is some extra work that doesn't seem to add much value
  • Adding the new apps from a diff might add stuff like Netflix, DLSS Swapper, any other random Windows Store app (e.g. RoundedTB)

About no-click controller-only setup:

  • With my forked app, I can launch from steam and just click "export"
  • I might try exporting when all apps have loaded or something, so it's no-click
  • It seems steam has to exit and relaunch, so even if UWPHook launches silently/headlessly in the background Steam would need a restart
  • If you used some list save/load diff, sometimes Steam would restart, but sometimes not. The inconsistency could be annoying. Better to just restart Steam every time?
  • Launching on Windows startup could be nice if the process check/export is automatic, and happens before users start navigating Steam. In this case, some list save/load/diff could prevent needless exports without giving the inconsistent UX mentioned above. In the case there is no diff, the UX would be good.

The simplest thing I can do in my fork next is:

  • always export
  • manually add program to startup folder
    • detects new games on startup, but if there's no diff you get the unneccesary steam restart
    • can be called manually from steam, and requires no clicking

james-s-w-clark avatar Jul 23 '23 16:07 james-s-w-clark

Since posting this issue, I've taken these ideas and contributed them to https://github.com/jaydenmilne/steamsync. It runs primarily as automatic mode (as a script) and I don't think its gui supports any of these ideas.

The filtering in our analogue of GetAUMIDScript.ps1 is minimal. We do nearly all of in python.

You can see a bunch of logic to filter out non-games because the Xbox/UWP metadata is very inconsistent.

I still think this would make a good addition to UWPHook. Although maybe just "check new items by default" might be a better direction for something already primarily GUI-driven -- a better default instead of fully automatic so you can omit handling all the corner cases.

idbrii avatar Jul 24 '23 16:07 idbrii