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
4
5#pragma once
6
7#include <cstddef>
8#include <filesystem>
9#include <span>
10#include <string>
11#include <string_view>
12#include <unordered_map>
13#include <vector>
14
15#include <kvpp/KV1Binary.h>
16
17namespace steampp {
18
19using AppID = uint32_t;
20
21class Steam {
22public:
23 Steam();
24
25 [[nodiscard]] const std::filesystem::path& getInstallDir() const;
26
27 [[nodiscard]] std::span<const std::filesystem::path> getLibraryDirs() const;
28
29 [[nodiscard]] std::filesystem::path getSourceModDir() const;
30
31 [[nodiscard]] std::vector<AppID> getInstalledApps() const;
32
33 [[nodiscard]] bool isAppInstalled(AppID appID) const;
34
35 [[nodiscard]] std::string_view getAppName(AppID appID) const;
36
37 [[nodiscard]] std::filesystem::path getAppInstallDir(AppID appID) const;
38
39 [[nodiscard]] std::filesystem::path getAppIconPath(AppID appID) const;
40
41 [[nodiscard]] std::filesystem::path getAppLogoPath(AppID appID) const;
42
43 [[nodiscard]] std::filesystem::path getAppHeroPath(AppID appID) const;
44
45 [[nodiscard]] std::filesystem::path getAppBoxArtPath(AppID appID) const;
46
47 [[nodiscard]] std::filesystem::path getAppStoreArtPath(AppID appID) const;
48
49 [[nodiscard]] bool isAppUsingGoldSrcEngine(AppID appID) const;
50
51 [[nodiscard]] bool isAppUsingSourceEngine(AppID appID) const;
52
53 [[nodiscard]] bool isAppUsingSource2Engine(AppID appID) const;
54
55 [[nodiscard]] explicit operator bool() const;
56
57private:
58 struct GameInfo {
59 std::string name;
60 std::filesystem::path installDir;
61 std::size_t libraryInstallDirsIndex;
62 };
63
64 std::unordered_map<AppID, GameInfo> gameDetails;
65 std::filesystem::path steamInstallDir;
66 std::vector<std::filesystem::path> libraryDirs;
67 kvpp::KV1Binary assetCache;
68};
69
70} // namespace steampp
std::vector< AppID > getInstalledApps() const
Definition steampp.cpp:294
bool isAppUsingSourceEngine(AppID appID) const
Definition steampp.cpp:406
bool isAppUsingGoldSrcEngine(AppID appID) const
Definition steampp.cpp:402
std::span< const std::filesystem::path > getLibraryDirs() const
Definition steampp.cpp:286
const std::filesystem::path & getInstallDir() const
Definition steampp.cpp:282
std::filesystem::path getAppLogoPath(AppID appID) const
Definition steampp.cpp:334
bool isAppUsingSource2Engine(AppID appID) const
Definition steampp.cpp:410
std::string_view getAppName(AppID appID) const
Definition steampp.cpp:303
std::filesystem::path getAppStoreArtPath(AppID appID) const
Definition steampp.cpp:385
bool isAppInstalled(AppID appID) const
Definition steampp.cpp:299
std::filesystem::path getAppHeroPath(AppID appID) const
Definition steampp.cpp:351
std::filesystem::path getAppBoxArtPath(AppID appID) const
Definition steampp.cpp:368
std::filesystem::path getAppInstallDir(AppID appID) const
Definition steampp.cpp:310
std::filesystem::path getSourceModDir() const
Definition steampp.cpp:290
std::filesystem::path getAppIconPath(AppID appID) const
Definition steampp.cpp:317
Based on SteamAppPathProvider.
Definition steampp.h:17
uint32_t AppID
Definition steampp.h:19