1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
// This file is provided under The MIT License as part of Steamworks.NET.
// Copyright (c) 2013-2022 Riley Labrecque
// Please see the included LICENSE.txt for additional information.
// This file is automatically generated.
// Changes to this file will be reverted when you update Steamworks.NET
#if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || STEAMWORKS_WIN || STEAMWORKS_LIN_OSX)
#define DISABLESTEAMWORKS
#endif
#if !DISABLESTEAMWORKS
using System.Runtime.InteropServices;
using IntPtr = System.IntPtr;
namespace Steamworks {
public static class SteamApps {
public static bool BIsSubscribed() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsSubscribed(CSteamAPIContext.GetSteamApps());
}
public static bool BIsLowViolence() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsLowViolence(CSteamAPIContext.GetSteamApps());
}
public static bool BIsCybercafe() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsCybercafe(CSteamAPIContext.GetSteamApps());
}
public static bool BIsVACBanned() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsVACBanned(CSteamAPIContext.GetSteamApps());
}
public static string GetCurrentGameLanguage() {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetCurrentGameLanguage(CSteamAPIContext.GetSteamApps()));
}
public static string GetAvailableGameLanguages() {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetAvailableGameLanguages(CSteamAPIContext.GetSteamApps()));
}
/// <summary>
/// <para> only use this member if you need to check ownership of another game related to yours, a demo for example</para>
/// </summary>
public static bool BIsSubscribedApp(AppId_t appID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsSubscribedApp(CSteamAPIContext.GetSteamApps(), appID);
}
/// <summary>
/// <para> Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed</para>
/// </summary>
public static bool BIsDlcInstalled(AppId_t appID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsDlcInstalled(CSteamAPIContext.GetSteamApps(), appID);
}
/// <summary>
/// <para> returns the Unix time of the purchase of the app</para>
/// </summary>
public static uint GetEarliestPurchaseUnixTime(AppId_t nAppID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_GetEarliestPurchaseUnixTime(CSteamAPIContext.GetSteamApps(), nAppID);
}
/// <summary>
/// <para> Checks if the user is subscribed to the current app through a free weekend</para>
/// <para> This function will return false for users who have a retail or other type of license</para>
/// <para> Before using, please ask your Valve technical contact how to package and secure your free weekened</para>
/// </summary>
public static bool BIsSubscribedFromFreeWeekend() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsSubscribedFromFreeWeekend(CSteamAPIContext.GetSteamApps());
}
/// <summary>
/// <para> Returns the number of DLC pieces for the running app</para>
/// </summary>
public static int GetDLCCount() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_GetDLCCount(CSteamAPIContext.GetSteamApps());
}
/// <summary>
/// <para> Returns metadata for DLC by index, of range [0, GetDLCCount()]</para>
/// </summary>
public static bool BGetDLCDataByIndex(int iDLC, out AppId_t pAppID, out bool pbAvailable, out string pchName, int cchNameBufferSize) {
InteropHelp.TestIfAvailableClient();
IntPtr pchName2 = Marshal.AllocHGlobal(cchNameBufferSize);
bool ret = NativeMethods.ISteamApps_BGetDLCDataByIndex(CSteamAPIContext.GetSteamApps(), iDLC, out pAppID, out pbAvailable, pchName2, cchNameBufferSize);
pchName = ret ? InteropHelp.PtrToStringUTF8(pchName2) : null;
Marshal.FreeHGlobal(pchName2);
return ret;
}
/// <summary>
/// <para> Install/Uninstall control for optional DLC</para>
/// </summary>
public static void InstallDLC(AppId_t nAppID) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamApps_InstallDLC(CSteamAPIContext.GetSteamApps(), nAppID);
}
public static void UninstallDLC(AppId_t nAppID) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamApps_UninstallDLC(CSteamAPIContext.GetSteamApps(), nAppID);
}
/// <summary>
/// <para> Request legacy cd-key for yourself or owned DLC. If you are interested in this</para>
/// <para> data then make sure you provide us with a list of valid keys to be distributed</para>
/// <para> to users when they purchase the game, before the game ships.</para>
/// <para> You'll receive an AppProofOfPurchaseKeyResponse_t callback when</para>
/// <para> the key is available (which may be immediately).</para>
/// </summary>
public static void RequestAppProofOfPurchaseKey(AppId_t nAppID) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamApps_RequestAppProofOfPurchaseKey(CSteamAPIContext.GetSteamApps(), nAppID);
}
/// <summary>
/// <para> returns current beta branch name, 'public' is the default branch</para>
/// </summary>
public static bool GetCurrentBetaName(out string pchName, int cchNameBufferSize) {
InteropHelp.TestIfAvailableClient();
IntPtr pchName2 = Marshal.AllocHGlobal(cchNameBufferSize);
bool ret = NativeMethods.ISteamApps_GetCurrentBetaName(CSteamAPIContext.GetSteamApps(), pchName2, cchNameBufferSize);
pchName = ret ? InteropHelp.PtrToStringUTF8(pchName2) : null;
Marshal.FreeHGlobal(pchName2);
return ret;
}
/// <summary>
/// <para> signal Steam that game files seems corrupt or missing</para>
/// </summary>
public static bool MarkContentCorrupt(bool bMissingFilesOnly) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_MarkContentCorrupt(CSteamAPIContext.GetSteamApps(), bMissingFilesOnly);
}
/// <summary>
/// <para> return installed depots in mount order</para>
/// </summary>
public static uint GetInstalledDepots(AppId_t appID, DepotId_t[] pvecDepots, uint cMaxDepots) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_GetInstalledDepots(CSteamAPIContext.GetSteamApps(), appID, pvecDepots, cMaxDepots);
}
/// <summary>
/// <para> returns current app install folder for AppID, returns folder name length</para>
/// </summary>
public static uint GetAppInstallDir(AppId_t appID, out string pchFolder, uint cchFolderBufferSize) {
InteropHelp.TestIfAvailableClient();
IntPtr pchFolder2 = Marshal.AllocHGlobal((int)cchFolderBufferSize);
uint ret = NativeMethods.ISteamApps_GetAppInstallDir(CSteamAPIContext.GetSteamApps(), appID, pchFolder2, cchFolderBufferSize);
pchFolder = ret != 0 ? InteropHelp.PtrToStringUTF8(pchFolder2) : null;
Marshal.FreeHGlobal(pchFolder2);
return ret;
}
/// <summary>
/// <para> returns true if that app is installed (not necessarily owned)</para>
/// </summary>
public static bool BIsAppInstalled(AppId_t appID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsAppInstalled(CSteamAPIContext.GetSteamApps(), appID);
}
/// <summary>
/// <para> returns the SteamID of the original owner. If this CSteamID is different from ISteamUser::GetSteamID(),</para>
/// <para> the user has a temporary license borrowed via Family Sharing</para>
/// </summary>
public static CSteamID GetAppOwner() {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamApps_GetAppOwner(CSteamAPIContext.GetSteamApps());
}
/// <summary>
/// <para> Returns the associated launch param if the game is run via steam://run/<appid>//?param1=value1&param2=value2&param3=value3 etc.</para>
/// <para> Parameter names starting with the character '@' are reserved for internal use and will always return and empty string.</para>
/// <para> Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game,</para>
/// <para> but it is advised that you not param names beginning with an underscore for your own features.</para>
/// <para> Check for new launch parameters on callback NewUrlLaunchParameters_t</para>
/// </summary>
public static string GetLaunchQueryParam(string pchKey) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) {
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetLaunchQueryParam(CSteamAPIContext.GetSteamApps(), pchKey2));
}
}
/// <summary>
/// <para> get download progress for optional DLC</para>
/// </summary>
public static bool GetDlcDownloadProgress(AppId_t nAppID, out ulong punBytesDownloaded, out ulong punBytesTotal) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_GetDlcDownloadProgress(CSteamAPIContext.GetSteamApps(), nAppID, out punBytesDownloaded, out punBytesTotal);
}
/// <summary>
/// <para> return the buildid of this app, may change at any time based on backend updates to the game</para>
/// </summary>
public static int GetAppBuildId() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_GetAppBuildId(CSteamAPIContext.GetSteamApps());
}
/// <summary>
/// <para> Request all proof of purchase keys for the calling appid and asociated DLC.</para>
/// <para> A series of AppProofOfPurchaseKeyResponse_t callbacks will be sent with</para>
/// <para> appropriate appid values, ending with a final callback where the m_nAppId</para>
/// <para> member is k_uAppIdInvalid (zero).</para>
/// </summary>
public static void RequestAllProofOfPurchaseKeys() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamApps_RequestAllProofOfPurchaseKeys(CSteamAPIContext.GetSteamApps());
}
public static SteamAPICall_t GetFileDetails(string pszFileName) {
InteropHelp.TestIfAvailableClient();
using (var pszFileName2 = new InteropHelp.UTF8StringHandle(pszFileName)) {
return (SteamAPICall_t)NativeMethods.ISteamApps_GetFileDetails(CSteamAPIContext.GetSteamApps(), pszFileName2);
}
}
/// <summary>
/// <para> Get command line if game was launched via Steam URL, e.g. steam://run/<appid>//<command line>/.</para>
/// <para> This method of passing a connect string (used when joining via rich presence, accepting an</para>
/// <para> invite, etc) is preferable to passing the connect string on the operating system command</para>
/// <para> line, which is a security risk. In order for rich presence joins to go through this</para>
/// <para> path and not be placed on the OS command line, you must set a value in your app's</para>
/// <para> configuration on Steam. Ask Valve for help with this.</para>
/// <para> If game was already running and launched again, the NewUrlLaunchParameters_t will be fired.</para>
/// </summary>
public static int GetLaunchCommandLine(out string pszCommandLine, int cubCommandLine) {
InteropHelp.TestIfAvailableClient();
IntPtr pszCommandLine2 = Marshal.AllocHGlobal(cubCommandLine);
int ret = NativeMethods.ISteamApps_GetLaunchCommandLine(CSteamAPIContext.GetSteamApps(), pszCommandLine2, cubCommandLine);
pszCommandLine = ret != -1 ? InteropHelp.PtrToStringUTF8(pszCommandLine2) : null;
Marshal.FreeHGlobal(pszCommandLine2);
return ret;
}
/// <summary>
/// <para> Check if user borrowed this game via Family Sharing, If true, call GetAppOwner() to get the lender SteamID</para>
/// </summary>
public static bool BIsSubscribedFromFamilySharing() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsSubscribedFromFamilySharing(CSteamAPIContext.GetSteamApps());
}
/// <summary>
/// <para> check if game is a timed trial with limited playtime</para>
/// </summary>
public static bool BIsTimedTrial(out uint punSecondsAllowed, out uint punSecondsPlayed) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_BIsTimedTrial(CSteamAPIContext.GetSteamApps(), out punSecondsAllowed, out punSecondsPlayed);
}
/// <summary>
/// <para> set current DLC AppID being played (or 0 if none). Allows Steam to track usage of major DLC extensions</para>
/// </summary>
public static bool SetDlcContext(AppId_t nAppID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_SetDlcContext(CSteamAPIContext.GetSteamApps(), nAppID);
}
}
}
#endif // !DISABLESTEAMWORKS
|