SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
steampp.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <cstddef>
8#include <string>
9#include <string_view>
10#include <unordered_map>
11#include <vector>
12
13#include <kvpp/KV1Binary.h>
14#include <sourcepp/Math.h>
15
16namespace steampp {
17
18using AppID = uint32_t;
19
20class Steam {
21public:
22 Steam();
23
24 [[nodiscard]] std::string_view getInstallDir() const;
25
26 [[nodiscard]] const std::vector<std::string>& getLibraryDirs() const;
27
28 [[nodiscard]] std::string getSourceModDir() const;
29
30 [[nodiscard]] std::vector<AppID> getInstalledApps() const;
31
32 [[nodiscard]] bool isAppInstalled(AppID appID) const;
33
34 [[nodiscard]] std::string_view getAppName(AppID appID) const;
35
36 [[nodiscard]] std::string getAppInstallDir(AppID appID) const;
37
38 [[nodiscard]] std::string getAppIconPath(AppID appID) const;
39
40 [[nodiscard]] std::string getAppLogoPath(AppID appID) const;
41
42 [[nodiscard]] std::string getAppHeroPath(AppID appID) const;
43
44 [[nodiscard]] std::string getAppBoxArtPath(AppID appID) const;
45
46 [[nodiscard]] std::string getAppStoreArtPath(AppID appID) const;
47
48 [[nodiscard]] bool isAppUsingGoldSrcEngine(AppID appID) const;
49
50 [[nodiscard]] bool isAppUsingSourceEngine(AppID appID) const;
51
52 [[nodiscard]] bool isAppUsingSource2Engine(AppID appID) const;
53
54 [[nodiscard]] explicit operator bool() const;
55
56private:
57 struct GameInfo {
58 std::string name;
59 std::string installDir;
60 std::size_t libraryInstallDirsIndex;
61 };
62
63 std::unordered_map<AppID, GameInfo> gameDetails;
64 std::string steamInstallDir;
65 std::vector<std::string> libraryDirs;
66 kvpp::KV1Binary assetCache;
67};
68
69} // namespace steampp
std::vector< AppID > getInstalledApps() const
Definition: steampp.cpp:301
bool isAppUsingSourceEngine(AppID appID) const
Definition: steampp.cpp:413
bool isAppUsingGoldSrcEngine(AppID appID) const
Definition: steampp.cpp:409
std::string getAppBoxArtPath(AppID appID) const
Definition: steampp.cpp:375
std::string getSourceModDir() const
Definition: steampp.cpp:297
const std::vector< std::string > & getLibraryDirs() const
Definition: steampp.cpp:293
bool isAppUsingSource2Engine(AppID appID) const
Definition: steampp.cpp:417
std::string getAppStoreArtPath(AppID appID) const
Definition: steampp.cpp:392
std::string_view getAppName(AppID appID) const
Definition: steampp.cpp:310
bool isAppInstalled(AppID appID) const
Definition: steampp.cpp:306
std::string getAppLogoPath(AppID appID) const
Definition: steampp.cpp:341
std::string getAppHeroPath(AppID appID) const
Definition: steampp.cpp:358
std::string getAppInstallDir(AppID appID) const
Definition: steampp.cpp:317
std::string_view getInstallDir() const
Definition: steampp.cpp:289
std::string getAppIconPath(AppID appID) const
Definition: steampp.cpp:324
Based on SteamAppPathProvider.
Definition: steampp.h:16
uint32_t AppID
Definition: steampp.h:18