aytimothy aytimothy - 2 months ago 47
C# Question

Retrieve a list of installed games from the Steam API

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?

Answer

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.