Retrieve a list of installed games from the Steam API
Asked Answered
D

2

7

I'm working on a Steam Roulette program, and I'm trying to create filters. One of the filters I'd like to implement is (if the user data was loaded with SteamWorks), is to return a list of games (preferably in App ID form) that he/she has installed on his computer that I can then compare to my original full list to remove unneeded values; like a filter to get rid of games the user doesn't have installed on his machine from the list of possible games that can be picked.

In case:

Steam Roulette was an online trend, in the form of a web application in which the user picks a random game out of his/her Steam library and plays it.

Right now, I'm retrieving user details using the Web API using the Steam ID retrieved with SteamUser.GetSteamID().ToString() and feeding it into:

string apiURL = "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=" + APIKey + "&steamid=" + id + "&format=json&include_appinfo=1";

And reading the returned .json information from there to generate a list of games that the program can pick from.


Is there any SteamWorks function I can use to retrieve a list of games that is installed on the computer, as opposed to all the games that the player owns/has, without reading the steam libraries for their respective folders?

If no possible function exist, is there any way to manually (outside the API) get a list of installed games?

Director answered 12/11, 2015 at 0:4 Comment(0)
K
12

This file C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf

Contains the paths to all local steam libraries. (excluding the one in the default library)

Then get just get the value in the steam_appid.txt that's located in each game's folder ({library}\steamapps\common\{game}\steam_appid.txt) and you will have a list of all installed games' steam app id.

Vdf files are valve proprietary files (like JSON). You can use Vdf.NET to parse the vdf files similar to JSON.

Kaunas answered 11/9, 2016 at 10:42 Comment(4)
Just a note: it seems not all games have the steam_appid.txt file, currently trying to find a way around this as I am trying to do the same thing.Kaunas
Instead of trying to fetch steam_appid.txt (which seems to be absent for most games), you can try to process the files appmanifest_*.acfwhich are located in the steamapps folder of each library. Each file represents an installed game, the file name contains the app id, and the file itself contains even more useful information.Leddy
any idea how to tell if the game is marked as a VR game?Toledo
While not relative for all, i'm using linux with three steam folders/libs. Each of them have a libraryfolders.vdf but it does not contain any reference to the others / useless currently (2022). But there is ~/.steam/registry.vdf which looks like a extract of a windows registry / contains a parsable listingDecanal
A
2

I was looking into doing this myself. Unfortunately the steam api does not return a value that could reliably tell you if it's installed on your pc. However looking through the folder where your games are installed (mine is "C:\Program Files (x86)\Steam\steamapps\common") I found that each game folder contains a text file with it's steam app id. So you could recursively look in each folder and build a list of IDs first. Then, use the app ID list with the JSON getOwnedGames for the full name and other info.

Affirmatory answered 13/12, 2015 at 18:39 Comment(2)
That's what I thought, but one of the problems that came up was that your Steam Library Folders can be... Anywhere. And, that we can have more than one.Director
The text file with the steam ID is also not a requirement.Maze

© 2022 - 2024 — McMap. All rights reserved.