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

[Suggestion] Use steam AppId to identify running steam games? #86

Open
Sollace opened this issue May 8, 2024 · 0 comments
Open

[Suggestion] Use steam AppId to identify running steam games? #86

Sollace opened this issue May 8, 2024 · 0 comments

Comments

@Sollace
Copy link

Sollace commented May 8, 2024

Rather than having a massive database of steam games and have to update it constantly, I was thinking why not get the information from steam?

Steam stores a appmanifest_<id>.acf file in the steamapps/ directory for all the installed games. All you would need to do is iterate through them, pull out the id and name, and grep it into ps to find out if that game is running.

The acf files are essentially just json files:
e.g.

"AppState"
{
	"appid"		"228980"
	"Universe"		"1"
	"name"		"Steamworks Common Redistributables"
	"StateFlags"		"6"
	"installdir"		"Steamworks Shared"
	"LastUpdated"		"1711538996"
	"LastPlayed"		"0"
	"SizeOnDisk"		"306849073"
	"StagingSize"		"0"
	"buildid"		"13816744"
	"LastOwner"		"76561198128153468"
	"UpdateResult"		"0"
	"BytesToDownload"		"0"
	"BytesDownloaded"		"0"
	"BytesToStage"		"0"
	"BytesStaged"		"0"
	"TargetBuildID"		"13816744"
	"AutoUpdateBehavior"		"0"
	"AllowOtherDownloadsWhileRunning"		"0"
	"ScheduledAutoUpdate"		"1715400287"
	"InstalledDepots"
	{
	...

Similarly, you can grab all the library folders to scan from libraryfolders.vdf (found in the default steamapps folder) ((Edit: Or steam/config/libraryfolders.vdf))

"libraryfolders"
{
	"0"
	{
		"path"		"/home/sollace/.local/share/Steam"
		"label"		""
		"contentid"		"6247994451411179098"
		"totalsize"		"0"
		"update_clean_bytes_tally"		"1916286658"
		"time_last_update_corruption"		"0"
		"apps"
		{
			"228980"		"306849073"
			"1391110"		"645296846"
			"1493710"		"1210565293"
			"1628350"		"705721365"
			"1887720"		"1098535663"
		}
	}
	"1"
	{
		"path"		"/mnt/d/SteamLibrary"

Example command to check if Voices of the Void (non-steam game) is running:

ps aux | grep 3900658693
sollace    74497  0.0  0.0  28120  5504 ?        S    19:54   0:00 /home/sollace/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=3900658693 -- /home/sollace/.local/share/Steam/ubuntu12_32/steam-launch-wrapper -- /home/sollace/.local/share/Steam/steamapps/common/SteamLinuxRuntime_sniper/_v2-entry-point --verb=waitforexitandrun -- /home/sollace/.local/share/Steam/steamapps/common/Proton - Experimental/proton waitforexitandrun /home/sollace/Games/standalone/Voices of the Void/VotV.exe
sollace    79378  0.0  0.0   6592  2432 pts/3    S+   20:14   0:00 grep --colour=auto 3900658693

This approach should work for all standard steam games. I haven't yet found where it stores the ids/names for non-steam games, but with that this should be 100% of the time using only what you have locally available on the user's system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant