Started working on a Steam library

This commit is contained in:
2026-04-30 19:20:40 +01:00
parent ab525cc22e
commit c6505fede9
13 changed files with 2603 additions and 4 deletions
+79
View File
@@ -32,6 +32,85 @@ public class Program
steamLogger.LogInformation("Welcome {SteamName}", steam.GetSteamName());
}
steamLogger.LogInformation("--- Steam wrapper smoke tests ---");
// Utils (read-only)
steamLogger.LogInformation("Utils available: {Available}", steam.Utils.IsAvailable);
if (steam.Utils.IsAvailable)
{
steamLogger.LogInformation("AppId: {AppId}, Country: {Country}, Overlay: {Overlay}",
steam.Utils.GetAppId(),
steam.Utils.GetIpCountry(),
steam.Utils.IsOverlayEnabled());
}
// Friends (read-only)
steamLogger.LogInformation("Friends available: {Available}", steam.Friends.IsAvailable);
if (steam.Friends.IsAvailable)
{
// 65535 tests all friend relationship flags for quick smoke coverage.
var friendCount = steam.Friends.GetFriendCount(65535);
steamLogger.LogInformation("Friend count (all flags): {FriendCount}", friendCount);
}
// Remote storage (read-only)
steamLogger.LogInformation("RemoteStorage available: {Available}", steam.RemoteStorage.IsAvailable);
if (steam.RemoteStorage.IsAvailable)
{
steamLogger.LogInformation("Cloud enabled: {Enabled}, file count: {Count}",
steam.RemoteStorage.IsCloudEnabledForApp(),
steam.RemoteStorage.GetFileCount());
}
// User stats (safe read/request)
steamLogger.LogInformation("UserStats available: {Available}", steam.UserStats.IsAvailable);
if (steam.UserStats.IsAvailable)
{
var globalStatsCall = steam.UserStats.RequestGlobalStats(7);
steamLogger.LogInformation("RequestGlobalStats call handle: {Handle}", globalStatsCall);
}
// UGC (safe query/subscription read)
steamLogger.LogInformation("UGC subscribed count: {Count}", steam.Ugc.GetNumSubscribedItems());
var ugcQuery = steam.Ugc.CreateQueryAllUgcRequest(queryType: 0, matchingType: 0, creatorAppId: 480, consumerAppId: 480, page: 1);
if (ugcQuery != 0)
{
var ugcCall = steam.Ugc.SendQueryUgcRequest(ugcQuery);
steamLogger.LogInformation("UGC query handle: {QueryHandle}, call handle: {CallHandle}", ugcQuery, ugcCall);
steam.Ugc.ReleaseQueryUgcRequest(ugcQuery);
}
else
{
steamLogger.LogWarning("UGC query handle returned 0 (unsupported on this runtime or invalid params).");
}
// Matchmaking (safe request)
steamLogger.LogInformation("Matchmaking available: {Available}", steam.Matchmaking.IsAvailable);
if (steam.Matchmaking.IsAvailable)
{
steam.Matchmaking.AddRequestLobbyListResultCountFilter(10);
var lobbyListCall = steam.Matchmaking.RequestLobbyList();
steamLogger.LogInformation("RequestLobbyList call handle: {Handle}", lobbyListCall);
}
// Remote Play
steamLogger.LogInformation("RemotePlay sessions: {SessionCount}", steam.RemotePlay.GetSessionCount());
// Other read-only status checks
steamLogger.LogInformation("Screenshots hooked: {Hooked}", steam.Screenshots.IsScreenshotsHooked());
steamLogger.LogInformation("Music enabled: {Enabled}, playing: {Playing}, volume: {Volume}",
steam.Music.IsEnabled(), steam.Music.IsPlaying(), steam.Music.GetVolume());
if (steam.Video.IsBroadcasting(out var viewers))
{
steamLogger.LogInformation("Video broadcasting viewers: {Viewers}", viewers);
}
else
{
steamLogger.LogInformation("Video broadcasting is not active.");
}
steamLogger.LogInformation("--- End smoke tests ---");
// Call this in your game loop (Unity Update, Godot _Process, etc.)
steam.Update();