isteamclient.cs (16858B)
1 // This file is provided under The MIT License as part of Steamworks.NET. 2 // Copyright (c) 2013-2019 Riley Labrecque 3 // Please see the included LICENSE.txt for additional information. 4 5 // This file is automatically generated. 6 // Changes to this file will be reverted when you update Steamworks.NET 7 8 #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH 9 #define DISABLESTEAMWORKS 10 #endif 11 12 #if !DISABLESTEAMWORKS 13 14 using System.Runtime.InteropServices; 15 using IntPtr = System.IntPtr; 16 17 namespace Steamworks { 18 public static class SteamClient { 19 /// <summary> 20 /// <para> Creates a communication pipe to the Steam client.</para> 21 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para> 22 /// </summary> 23 public static HSteamPipe CreateSteamPipe() { 24 InteropHelp.TestIfAvailableClient(); 25 return (HSteamPipe)NativeMethods.ISteamClient_CreateSteamPipe(CSteamAPIContext.GetSteamClient()); 26 } 27 28 /// <summary> 29 /// <para> Releases a previously created communications pipe</para> 30 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para> 31 /// </summary> 32 public static bool BReleaseSteamPipe(HSteamPipe hSteamPipe) { 33 InteropHelp.TestIfAvailableClient(); 34 return NativeMethods.ISteamClient_BReleaseSteamPipe(CSteamAPIContext.GetSteamClient(), hSteamPipe); 35 } 36 37 /// <summary> 38 /// <para> connects to an existing global user, failing if none exists</para> 39 /// <para> used by the game to coordinate with the steamUI</para> 40 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para> 41 /// </summary> 42 public static HSteamUser ConnectToGlobalUser(HSteamPipe hSteamPipe) { 43 InteropHelp.TestIfAvailableClient(); 44 return (HSteamUser)NativeMethods.ISteamClient_ConnectToGlobalUser(CSteamAPIContext.GetSteamClient(), hSteamPipe); 45 } 46 47 /// <summary> 48 /// <para> used by game servers, create a steam user that won't be shared with anyone else</para> 49 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para> 50 /// </summary> 51 public static HSteamUser CreateLocalUser(out HSteamPipe phSteamPipe, EAccountType eAccountType) { 52 InteropHelp.TestIfAvailableClient(); 53 return (HSteamUser)NativeMethods.ISteamClient_CreateLocalUser(CSteamAPIContext.GetSteamClient(), out phSteamPipe, eAccountType); 54 } 55 56 /// <summary> 57 /// <para> removes an allocated user</para> 58 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para> 59 /// </summary> 60 public static void ReleaseUser(HSteamPipe hSteamPipe, HSteamUser hUser) { 61 InteropHelp.TestIfAvailableClient(); 62 NativeMethods.ISteamClient_ReleaseUser(CSteamAPIContext.GetSteamClient(), hSteamPipe, hUser); 63 } 64 65 /// <summary> 66 /// <para> retrieves the ISteamUser interface associated with the handle</para> 67 /// </summary> 68 public static IntPtr GetISteamUser(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 69 InteropHelp.TestIfAvailableClient(); 70 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 71 return NativeMethods.ISteamClient_GetISteamUser(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 72 } 73 } 74 75 /// <summary> 76 /// <para> retrieves the ISteamGameServer interface associated with the handle</para> 77 /// </summary> 78 public static IntPtr GetISteamGameServer(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 79 InteropHelp.TestIfAvailableClient(); 80 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 81 return NativeMethods.ISteamClient_GetISteamGameServer(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 82 } 83 } 84 85 /// <summary> 86 /// <para> set the local IP and Port to bind to</para> 87 /// <para> this must be set before CreateLocalUser()</para> 88 /// </summary> 89 public static void SetLocalIPBinding(uint unIP, ushort usPort) { 90 InteropHelp.TestIfAvailableClient(); 91 NativeMethods.ISteamClient_SetLocalIPBinding(CSteamAPIContext.GetSteamClient(), unIP, usPort); 92 } 93 94 /// <summary> 95 /// <para> returns the ISteamFriends interface</para> 96 /// </summary> 97 public static IntPtr GetISteamFriends(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 98 InteropHelp.TestIfAvailableClient(); 99 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 100 return NativeMethods.ISteamClient_GetISteamFriends(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 101 } 102 } 103 104 /// <summary> 105 /// <para> returns the ISteamUtils interface</para> 106 /// </summary> 107 public static IntPtr GetISteamUtils(HSteamPipe hSteamPipe, string pchVersion) { 108 InteropHelp.TestIfAvailableClient(); 109 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 110 return NativeMethods.ISteamClient_GetISteamUtils(CSteamAPIContext.GetSteamClient(), hSteamPipe, pchVersion2); 111 } 112 } 113 114 /// <summary> 115 /// <para> returns the ISteamMatchmaking interface</para> 116 /// </summary> 117 public static IntPtr GetISteamMatchmaking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 118 InteropHelp.TestIfAvailableClient(); 119 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 120 return NativeMethods.ISteamClient_GetISteamMatchmaking(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 121 } 122 } 123 124 /// <summary> 125 /// <para> returns the ISteamMatchmakingServers interface</para> 126 /// </summary> 127 public static IntPtr GetISteamMatchmakingServers(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 128 InteropHelp.TestIfAvailableClient(); 129 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 130 return NativeMethods.ISteamClient_GetISteamMatchmakingServers(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 131 } 132 } 133 134 /// <summary> 135 /// <para> returns the a generic interface</para> 136 /// </summary> 137 public static IntPtr GetISteamGenericInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 138 InteropHelp.TestIfAvailableClient(); 139 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 140 return NativeMethods.ISteamClient_GetISteamGenericInterface(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 141 } 142 } 143 144 /// <summary> 145 /// <para> returns the ISteamUserStats interface</para> 146 /// </summary> 147 public static IntPtr GetISteamUserStats(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 148 InteropHelp.TestIfAvailableClient(); 149 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 150 return NativeMethods.ISteamClient_GetISteamUserStats(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 151 } 152 } 153 154 /// <summary> 155 /// <para> returns the ISteamGameServerStats interface</para> 156 /// </summary> 157 public static IntPtr GetISteamGameServerStats(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 158 InteropHelp.TestIfAvailableClient(); 159 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 160 return NativeMethods.ISteamClient_GetISteamGameServerStats(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 161 } 162 } 163 164 /// <summary> 165 /// <para> returns apps interface</para> 166 /// </summary> 167 public static IntPtr GetISteamApps(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 168 InteropHelp.TestIfAvailableClient(); 169 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 170 return NativeMethods.ISteamClient_GetISteamApps(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 171 } 172 } 173 174 /// <summary> 175 /// <para> networking</para> 176 /// </summary> 177 public static IntPtr GetISteamNetworking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 178 InteropHelp.TestIfAvailableClient(); 179 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 180 return NativeMethods.ISteamClient_GetISteamNetworking(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 181 } 182 } 183 184 /// <summary> 185 /// <para> remote storage</para> 186 /// </summary> 187 public static IntPtr GetISteamRemoteStorage(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 188 InteropHelp.TestIfAvailableClient(); 189 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 190 return NativeMethods.ISteamClient_GetISteamRemoteStorage(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 191 } 192 } 193 194 /// <summary> 195 /// <para> user screenshots</para> 196 /// </summary> 197 public static IntPtr GetISteamScreenshots(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 198 InteropHelp.TestIfAvailableClient(); 199 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 200 return NativeMethods.ISteamClient_GetISteamScreenshots(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 201 } 202 } 203 204 /// <summary> 205 /// <para> game search</para> 206 /// </summary> 207 public static IntPtr GetISteamGameSearch(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 208 InteropHelp.TestIfAvailableClient(); 209 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 210 return NativeMethods.ISteamClient_GetISteamGameSearch(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 211 } 212 } 213 214 /// <summary> 215 /// <para> returns the number of IPC calls made since the last time this function was called</para> 216 /// <para> Used for perf debugging so you can understand how many IPC calls your game makes per frame</para> 217 /// <para> Every IPC call is at minimum a thread context switch if not a process one so you want to rate</para> 218 /// <para> control how often you do them.</para> 219 /// </summary> 220 public static uint GetIPCCallCount() { 221 InteropHelp.TestIfAvailableClient(); 222 return NativeMethods.ISteamClient_GetIPCCallCount(CSteamAPIContext.GetSteamClient()); 223 } 224 225 /// <summary> 226 /// <para> API warning handling</para> 227 /// <para> 'int' is the severity; 0 for msg, 1 for warning</para> 228 /// <para> 'const char *' is the text of the message</para> 229 /// <para> callbacks will occur directly after the API function is called that generated the warning or message.</para> 230 /// </summary> 231 public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) { 232 InteropHelp.TestIfAvailableClient(); 233 NativeMethods.ISteamClient_SetWarningMessageHook(CSteamAPIContext.GetSteamClient(), pFunction); 234 } 235 236 /// <summary> 237 /// <para> Trigger global shutdown for the DLL</para> 238 /// </summary> 239 public static bool BShutdownIfAllPipesClosed() { 240 InteropHelp.TestIfAvailableClient(); 241 return NativeMethods.ISteamClient_BShutdownIfAllPipesClosed(CSteamAPIContext.GetSteamClient()); 242 } 243 244 /// <summary> 245 /// <para> Expose HTTP interface</para> 246 /// </summary> 247 public static IntPtr GetISteamHTTP(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 248 InteropHelp.TestIfAvailableClient(); 249 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 250 return NativeMethods.ISteamClient_GetISteamHTTP(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 251 } 252 } 253 254 /// <summary> 255 /// <para> Exposes the ISteamController interface - deprecated in favor of Steam Input</para> 256 /// </summary> 257 public static IntPtr GetISteamController(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 258 InteropHelp.TestIfAvailableClient(); 259 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 260 return NativeMethods.ISteamClient_GetISteamController(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 261 } 262 } 263 264 /// <summary> 265 /// <para> Exposes the ISteamUGC interface</para> 266 /// </summary> 267 public static IntPtr GetISteamUGC(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 268 InteropHelp.TestIfAvailableClient(); 269 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 270 return NativeMethods.ISteamClient_GetISteamUGC(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 271 } 272 } 273 274 /// <summary> 275 /// <para> returns app list interface, only available on specially registered apps</para> 276 /// </summary> 277 public static IntPtr GetISteamAppList(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 278 InteropHelp.TestIfAvailableClient(); 279 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 280 return NativeMethods.ISteamClient_GetISteamAppList(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 281 } 282 } 283 284 /// <summary> 285 /// <para> Music Player</para> 286 /// </summary> 287 public static IntPtr GetISteamMusic(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 288 InteropHelp.TestIfAvailableClient(); 289 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 290 return NativeMethods.ISteamClient_GetISteamMusic(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 291 } 292 } 293 294 /// <summary> 295 /// <para> Music Player Remote</para> 296 /// </summary> 297 public static IntPtr GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 298 InteropHelp.TestIfAvailableClient(); 299 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 300 return NativeMethods.ISteamClient_GetISteamMusicRemote(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 301 } 302 } 303 304 /// <summary> 305 /// <para> html page display</para> 306 /// </summary> 307 public static IntPtr GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 308 InteropHelp.TestIfAvailableClient(); 309 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 310 return NativeMethods.ISteamClient_GetISteamHTMLSurface(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 311 } 312 } 313 314 /// <summary> 315 /// <para> inventory</para> 316 /// </summary> 317 public static IntPtr GetISteamInventory(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 318 InteropHelp.TestIfAvailableClient(); 319 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 320 return NativeMethods.ISteamClient_GetISteamInventory(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 321 } 322 } 323 324 /// <summary> 325 /// <para> Video</para> 326 /// </summary> 327 public static IntPtr GetISteamVideo(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 328 InteropHelp.TestIfAvailableClient(); 329 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 330 return NativeMethods.ISteamClient_GetISteamVideo(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 331 } 332 } 333 334 /// <summary> 335 /// <para> Parental controls</para> 336 /// </summary> 337 public static IntPtr GetISteamParentalSettings(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { 338 InteropHelp.TestIfAvailableClient(); 339 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 340 return NativeMethods.ISteamClient_GetISteamParentalSettings(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); 341 } 342 } 343 344 /// <summary> 345 /// <para> Exposes the Steam Input interface for controller support</para> 346 /// </summary> 347 public static IntPtr GetISteamInput(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 348 InteropHelp.TestIfAvailableClient(); 349 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 350 return NativeMethods.ISteamClient_GetISteamInput(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 351 } 352 } 353 354 /// <summary> 355 /// <para> Steam Parties interface</para> 356 /// </summary> 357 public static IntPtr GetISteamParties(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 358 InteropHelp.TestIfAvailableClient(); 359 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 360 return NativeMethods.ISteamClient_GetISteamParties(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 361 } 362 } 363 364 /// <summary> 365 /// <para> Steam Remote Play interface</para> 366 /// </summary> 367 public static IntPtr GetISteamRemotePlay(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { 368 InteropHelp.TestIfAvailableClient(); 369 using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) { 370 return NativeMethods.ISteamClient_GetISteamRemotePlay(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); 371 } 372 } 373 } 374 } 375 376 #endif // !DISABLESTEAMWORKS