This commit is contained in:
2025-06-16 15:14:23 +02:00
commit 074e590073
3174 changed files with 428263 additions and 0 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e621350345100524c9fa97c4bc4716a7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
// 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.
#if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || STEAMWORKS_WIN || STEAMWORKS_LIN_OSX)
#define DISABLESTEAMWORKS
#endif
#if !DISABLESTEAMWORKS
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
using Steamworks;
public class RedistCopy {
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) {
// We only want to do this on Steam supported platforms.
if ((target != BuildTarget.StandaloneWindows) && (target != BuildTarget.StandaloneWindows64) && (target != BuildTarget.StandaloneLinux64)) {
return;
}
CopyDebugInfo(target, pathToBuiltProject);
DeleteOldSteamApiDlls(target, pathToBuiltProject);
}
static void CopyDebugInfo(BuildTarget target, string pathToBuiltProject) {
string baseDir = Path.Combine(Path.GetDirectoryName(pathToBuiltProject), Path.GetFileNameWithoutExtension(pathToBuiltProject) + "_Data");
string pluginsDir = Path.Combine(baseDir, "Plugins");
// Create if it doesn't exist yet
Directory.CreateDirectory(pluginsDir);
string[] DebugInfo = {
"Steamworks.NET created by Riley Labrecque",
"http://steamworks.github.io",
"",
"Steamworks.NET Version: " + Steamworks.Version.SteamworksNETVersion,
"Steamworks SDK Version: " + Steamworks.Version.SteamworksSDKVersion,
"Steam API DLL Version: " + Steamworks.Version.SteamAPIDLLVersion,
"Steam API DLL Size: " + Steamworks.Version.SteamAPIDLLSize,
"Steam API64 DLL Size: " + Steamworks.Version.SteamAPI64DLLSize,
""
};
File.WriteAllLines(Path.Combine(pluginsDir, "Steamworks.NET.txt"), DebugInfo);
}
static void DeleteOldSteamApiDlls(BuildTarget target, string pathToBuiltProject) {
string strDllPath = Path.Combine(pathToBuiltProject, "steam_api.dll");
if (File.Exists(strDllPath)) {
try {
File.Delete(strDllPath);
}
catch (System.Exception e) {
Debug.LogWarning($"[Steamworks.NET] Attempted to delete an old copy of 'steam_api.dll' in the following location: '{strDllPath}', but could not due to the following exception:");
Debug.LogException(e);
}
}
string strDll64Path = Path.Combine(pathToBuiltProject, "steam_api64.dll");
if (File.Exists(strDll64Path)) {
try {
File.Delete(strDll64Path);
}
catch (System.Exception e) {
Debug.LogWarning($"[Steamworks.NET] Attempted to delete an old copy of 'steam_api64.dll' in the following location: '{strDll64Path}', but could not due to the following exception:");
Debug.LogException(e);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 96dd4cffb1a008c4e8d429c9f4186034
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,70 @@
// 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.
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections.Generic;
// This copies various files into their required locations when Unity is launched to make installation a breeze.
[InitializeOnLoad]
public class RedistInstall {
static RedistInstall() {
WriteSteamAppIdTxtFile();
AddDefineSymbols();
CheckForOldDlls();
}
static void WriteSteamAppIdTxtFile() {
string strCWDPath = Directory.GetCurrentDirectory();
string strSteamAppIdPath = Path.Combine(strCWDPath, "steam_appid.txt");
// If the steam_appid.txt file already exists, then there's nothing to do.
if (File.Exists(strSteamAppIdPath)) {
return;
}
Debug.Log("[Steamworks.NET] 'steam_appid.txt' is not present in the project root. Writing...");
try {
StreamWriter appIdFile = File.CreateText(strSteamAppIdPath);
appIdFile.Write("480");
appIdFile.Close();
Debug.Log("[Steamworks.NET] Successfully copied 'steam_appid.txt' into the project root.");
}
catch (System.Exception e) {
Debug.LogWarning("[Steamworks.NET] Could not copy 'steam_appid.txt' into the project root. Please place 'steam_appid.txt' into the project root manually.");
Debug.LogException(e);
}
}
static void CheckForOldDlls() {
string strCwdPath = Directory.GetCurrentDirectory();
// Unfortunately we can't just delete these outright because Unity loads the dlls in the project root instantly and Windows won't let us delete them because they are in use.
string strDllPath = Path.Combine(strCwdPath, "steam_api.dll");
if (File.Exists(strDllPath)) {
Debug.LogError("[Steamworks.NET] Please delete the old version of 'steam_api.dll' in your project root before continuing.");
}
string strDll64Path = Path.Combine(strCwdPath, "steam_api64.dll");
if (File.Exists(strDll64Path)) {
Debug.LogError("[Steamworks.NET] Please delete the old version of 'steam_api64.dll' in your project root before continuing.");
}
}
static void AddDefineSymbols() {
string currentDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
HashSet<string> defines = new HashSet<string>(currentDefines.Split(';')) {
"STEAMWORKS_NET"
};
string newDefines = string.Join(";", defines);
if (newDefines != currentDefines) {
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newDefines);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7a716febd50f03244b98d9a5a0c6b36f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
{
"name": "com.rlabrecque.steamworks.net.editor",
"rootNamespace": "",
"references": [
"GUID:68bd7fdb68ef2684e982e8a9825b18a5"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: be281b7992e9e1840851a78ba9db107c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2013-2022 Riley Labrecque
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f23c4f821952c184fa3ad2e4ac6cb65b
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a5651469b1f07af4694f149e4b02cb30
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,64 @@
fileFormatVersion: 2
guid: 84c3b1e1d4f89ad42aca9ac3476a89f9
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 0
Exclude Linux64: 0
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 0
Exclude Win64: 0
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86_64
DefaultValueInitialized: true
OS: Linux
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: None
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,65 @@
fileFormatVersion: 2
guid: 0b376df920bc50246801677e7b167d14
folderAsset: yes
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 0
Exclude Linux64: 1
Exclude OSXUniversal: 0
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: OSX
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: x86_64
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 66bf26858879bfe4fbd81f069c52d05f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>11G63</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>libsteam_api.dylib</string>
<key>CFBundleIdentifier</key>
<string>com.rileylabrecque.steam_api</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.60</string>
<key>CSResourcesFileMapped</key>
<string>yes</string>
<key>DTCompiler</key>
<string></string>
<key>DTPlatformBuild</key>
<string>4H1503</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>11E52</string>
<key>DTSDKName</key>
<string>macosx10.7</string>
<key>DTXcode</key>
<string>0463</string>
<key>DTXcodeBuild</key>
<string>4H1503</string>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 77908b167592ab84cbc53e9051278227
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,64 @@
fileFormatVersion: 2
guid: f167045178ff20d45821bd7cb37231f7
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 0
Exclude Linux64: 0
Exclude OSXUniversal: 0
Exclude WebGL: 1
Exclude Win: 0
Exclude Win64: 0
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86
DefaultValueInitialized: true
OS: Windows
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: None
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,64 @@
fileFormatVersion: 2
guid: 46713ca58de687b4db4d9684c7021923
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 0
Exclude Linux64: 0
Exclude OSXUniversal: 0
Exclude WebGL: 1
Exclude Win: 0
Exclude Win64: 0
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86_64
DefaultValueInitialized: true
OS: Windows
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: x86_64
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
# Steamworks.NET
_Steamworks.NET_ is a C# Wrapper for Valve's Steamworks API, it can be used either with Unity or your C# based Application.
_Steamworks.NET_ was designed to be as close as possible to the original C++ API, as such the documentation provided from Valve largely covers usage of _Steamworks.NET_.
Niceties and C# Idioms can be easily implemented on top of _Steamworks.NET_.
_Steamworks.NET_ fully supports Windows (32 and 64 bit), OSX, and Linux. Currently building against Steamworks SDK 1.55.
* Author: [Riley Labrecque](https://github.com/rlabrecque)
* License: [MIT](http://www.opensource.org/licenses/mit-license.php)
* [Documentation](https://steamworks.github.io/)
* [Discussion Thread](http://steamcommunity.com/groups/steamworks/discussions/0/666827974770212954/)
* [Reporting Issues](https://github.com/rlabrecque/Steamworks.NET/issues)
Note that only Steamworks.NET specific issues should be reported, general API questions/issues should be asked on the [Steamworks discussion board](http://steamcommunity.com/groups/steamworks/discussions).

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a380fe31740b8a0419ed0d7bafe229bf
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 376866c7c50f30c4093ff0997e4dab4f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,400 @@
// 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
#if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
#error Unsupported Unity platform. Steamworks.NET requires Unity 4.7 or higher.
#elif UNITY_4_7 || UNITY_5 || UNITY_2017 || UNITY_2017_1_OR_NEWER
#if UNITY_EDITOR_WIN || (UNITY_STANDALONE_WIN && !UNITY_EDITOR)
#define WINDOWS_BUILD
#endif
#elif STEAMWORKS_WIN
#define WINDOWS_BUILD
#elif STEAMWORKS_LIN_OSX
// So that we don't enter the else block below.
#else
#error You need to define STEAMWORKS_WIN, or STEAMWORKS_LIN_OSX. Refer to the readme for more details.
#endif
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Steamworks {
public static class CallbackDispatcher {
// We catch exceptions inside callbacks and reroute them here.
// For some reason throwing an exception causes RunCallbacks() to break otherwise.
// If you have a custom ExceptionHandler in your engine you can register it here manually until we get something more elegant hooked up.
public static void ExceptionHandler(Exception e) {
#if UNITY_STANDALONE
UnityEngine.Debug.LogException(e);
#elif STEAMWORKS_WIN || STEAMWORKS_LIN_OSX
Console.WriteLine(e.Message);
#endif
}
private static Dictionary<int, List<Callback>> m_registeredCallbacks = new Dictionary<int, List<Callback>>();
private static Dictionary<int, List<Callback>> m_registeredGameServerCallbacks = new Dictionary<int, List<Callback>>();
private static Dictionary<ulong, List<CallResult>> m_registeredCallResults = new Dictionary<ulong, List<CallResult>>();
private static object m_sync = new object();
private static IntPtr m_pCallbackMsg;
private static int m_initCount;
public static bool IsInitialized {
get { return m_initCount > 0; }
}
internal static void Initialize() {
lock (m_sync) {
if (m_initCount == 0) {
NativeMethods.SteamAPI_ManualDispatch_Init();
m_pCallbackMsg = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CallbackMsg_t)));
}
++m_initCount;
}
}
internal static void Shutdown() {
lock (m_sync) {
--m_initCount;
if (m_initCount == 0) {
UnregisterAll();
Marshal.FreeHGlobal(m_pCallbackMsg);
m_pCallbackMsg = IntPtr.Zero;
}
}
}
internal static void Register(Callback cb) {
int iCallback = CallbackIdentities.GetCallbackIdentity(cb.GetCallbackType());
var callbacksRegistry = cb.IsGameServer ? m_registeredGameServerCallbacks : m_registeredCallbacks;
lock (m_sync) {
List<Callback> callbacksList;
if (!callbacksRegistry.TryGetValue(iCallback, out callbacksList)) {
callbacksList = new List<Callback>();
callbacksRegistry.Add(iCallback, callbacksList);
}
callbacksList.Add(cb);
}
}
internal static void Register(SteamAPICall_t asyncCall, CallResult cr) {
lock (m_sync) {
List<CallResult> callResultsList;
if (!m_registeredCallResults.TryGetValue((ulong)asyncCall, out callResultsList)) {
callResultsList = new List<CallResult>();
m_registeredCallResults.Add((ulong)asyncCall, callResultsList);
}
callResultsList.Add(cr);
}
}
internal static void Unregister(Callback cb) {
int iCallback = CallbackIdentities.GetCallbackIdentity(cb.GetCallbackType());
var callbacksRegistry = cb.IsGameServer ? m_registeredGameServerCallbacks : m_registeredCallbacks;
lock (m_sync) {
List<Callback> callbacksList;
if (callbacksRegistry.TryGetValue(iCallback, out callbacksList)) {
callbacksList.Remove(cb);
if (callbacksList.Count == 0)
callbacksRegistry.Remove(iCallback);
}
}
}
internal static void Unregister(SteamAPICall_t asyncCall, CallResult cr) {
lock (m_sync) {
List<CallResult> callResultsList;
if (m_registeredCallResults.TryGetValue((ulong)asyncCall, out callResultsList)) {
callResultsList.Remove(cr);
if (callResultsList.Count == 0)
m_registeredCallResults.Remove((ulong)asyncCall);
}
}
}
private static void UnregisterAll() {
List<Callback> callbacks = new List<Callback>();
List<CallResult> callResults = new List<CallResult>();
lock (m_sync) {
foreach (var pair in m_registeredCallbacks) {
callbacks.AddRange(pair.Value);
}
m_registeredCallbacks.Clear();
foreach (var pair in m_registeredGameServerCallbacks) {
callbacks.AddRange(pair.Value);
}
m_registeredGameServerCallbacks.Clear();
foreach (var pair in m_registeredCallResults) {
callResults.AddRange(pair.Value);
}
m_registeredCallResults.Clear();
foreach (var callback in callbacks) {
callback.SetUnregistered();
}
foreach (var callResult in callResults) {
callResult.SetUnregistered();
}
}
}
internal static void RunFrame(bool isGameServer) {
if (!IsInitialized) throw new InvalidOperationException("Callback dispatcher is not initialized.");
HSteamPipe hSteamPipe = (HSteamPipe)(isGameServer ? NativeMethods.SteamGameServer_GetHSteamPipe() : NativeMethods.SteamAPI_GetHSteamPipe());
NativeMethods.SteamAPI_ManualDispatch_RunFrame(hSteamPipe);
var callbacksRegistry = isGameServer ? m_registeredGameServerCallbacks : m_registeredCallbacks;
while (NativeMethods.SteamAPI_ManualDispatch_GetNextCallback(hSteamPipe, m_pCallbackMsg)) {
CallbackMsg_t callbackMsg = (CallbackMsg_t)Marshal.PtrToStructure(m_pCallbackMsg, typeof(CallbackMsg_t));
try {
// Check for dispatching API call results
if (callbackMsg.m_iCallback == SteamAPICallCompleted_t.k_iCallback) {
SteamAPICallCompleted_t callCompletedCb = (SteamAPICallCompleted_t)Marshal.PtrToStructure(callbackMsg.m_pubParam, typeof(SteamAPICallCompleted_t));
IntPtr pTmpCallResult = Marshal.AllocHGlobal((int)callCompletedCb.m_cubParam);
bool bFailed;
if (NativeMethods.SteamAPI_ManualDispatch_GetAPICallResult(hSteamPipe, callCompletedCb.m_hAsyncCall, pTmpCallResult, (int)callCompletedCb.m_cubParam, callCompletedCb.m_iCallback, out bFailed)) {
lock (m_sync) {
List<CallResult> callResults;
if (m_registeredCallResults.TryGetValue((ulong)callCompletedCb.m_hAsyncCall, out callResults)) {
m_registeredCallResults.Remove((ulong)callCompletedCb.m_hAsyncCall);
foreach (var cr in callResults) {
cr.OnRunCallResult(pTmpCallResult, bFailed, (ulong)callCompletedCb.m_hAsyncCall);
cr.SetUnregistered();
}
}
}
}
Marshal.FreeHGlobal(pTmpCallResult);
} else {
List<Callback> callbacks;
if (callbacksRegistry.TryGetValue(callbackMsg.m_iCallback, out callbacks)) {
List<Callback> callbacksCopy;
lock (m_sync) {
callbacksCopy = new List<Callback>(callbacks);
}
foreach (var callback in callbacksCopy) {
callback.OnRunCallback(callbackMsg.m_pubParam);
}
}
}
} catch (Exception e) {
ExceptionHandler(e);
} finally {
NativeMethods.SteamAPI_ManualDispatch_FreeLastCallback(hSteamPipe);
}
}
}
}
public abstract class Callback {
public abstract bool IsGameServer { get; }
internal abstract Type GetCallbackType();
internal abstract void OnRunCallback(IntPtr pvParam);
internal abstract void SetUnregistered();
}
public sealed class Callback<T> : Callback, IDisposable {
public delegate void DispatchDelegate(T param);
private event DispatchDelegate m_Func;
private bool m_bGameServer;
private bool m_bIsRegistered;
private bool m_bDisposed = false;
/// <summary>
/// Creates a new Callback. You must be calling SteamAPI.RunCallbacks() to retrieve the callbacks.
/// <para>Returns a handle to the Callback.</para>
/// <para>This MUST be assigned to a member variable to prevent the GC from cleaning it up.</para>
/// </summary>
public static Callback<T> Create(DispatchDelegate func) {
return new Callback<T>(func, bGameServer: false);
}
/// <summary>
/// Creates a new GameServer Callback. You must be calling GameServer.RunCallbacks() to retrieve the callbacks.
/// <para>Returns a handle to the Callback.</para>
/// <para>This MUST be assigned to a member variable to prevent the GC from cleaning it up.</para>
/// </summary>
public static Callback<T> CreateGameServer(DispatchDelegate func) {
return new Callback<T>(func, bGameServer: true);
}
public Callback(DispatchDelegate func, bool bGameServer = false) {
m_bGameServer = bGameServer;
Register(func);
}
~Callback() {
Dispose();
}
public void Dispose() {
if (m_bDisposed) {
return;
}
GC.SuppressFinalize(this);
if (m_bIsRegistered)
Unregister();
m_bDisposed = true;
}
// Manual registration of the callback
public void Register(DispatchDelegate func) {
if (func == null) {
throw new Exception("Callback function must not be null.");
}
if (m_bIsRegistered) {
Unregister();
}
m_Func = func;
CallbackDispatcher.Register(this);
m_bIsRegistered = true;
}
public void Unregister() {
CallbackDispatcher.Unregister(this);
m_bIsRegistered = false;
}
public override bool IsGameServer {
get { return m_bGameServer; }
}
internal override Type GetCallbackType() {
return typeof(T);
}
internal override void OnRunCallback(IntPtr pvParam) {
try {
m_Func((T)Marshal.PtrToStructure(pvParam, typeof(T)));
}
catch (Exception e) {
CallbackDispatcher.ExceptionHandler(e);
}
}
internal override void SetUnregistered() {
m_bIsRegistered = false;
}
}
public abstract class CallResult {
internal abstract Type GetCallbackType();
internal abstract void OnRunCallResult(IntPtr pvParam, bool bFailed, ulong hSteamAPICall);
internal abstract void SetUnregistered();
}
public sealed class CallResult<T> : CallResult, IDisposable {
public delegate void APIDispatchDelegate(T param, bool bIOFailure);
private event APIDispatchDelegate m_Func;
private SteamAPICall_t m_hAPICall = SteamAPICall_t.Invalid;
public SteamAPICall_t Handle { get { return m_hAPICall; } }
private bool m_bDisposed = false;
/// <summary>
/// Creates a new async CallResult. You must be calling SteamAPI.RunCallbacks() to retrieve the callback.
/// <para>Returns a handle to the CallResult.</para>
/// <para>This MUST be assigned to a member variable to prevent the GC from cleaning it up.</para>
/// </summary>
public static CallResult<T> Create(APIDispatchDelegate func = null) {
return new CallResult<T>(func);
}
public CallResult(APIDispatchDelegate func = null) {
m_Func = func;
}
~CallResult() {
Dispose();
}
public void Dispose() {
if (m_bDisposed) {
return;
}
GC.SuppressFinalize(this);
Cancel();
m_bDisposed = true;
}
public void Set(SteamAPICall_t hAPICall, APIDispatchDelegate func = null) {
// Unlike the official SDK we let the user assign a single function during creation,
// and allow them to skip having to do so every time that they call .Set()
if (func != null) {
m_Func = func;
}
if (m_Func == null) {
throw new Exception("CallResult function was null, you must either set it in the CallResult Constructor or via Set()");
}
if (m_hAPICall != SteamAPICall_t.Invalid) {
CallbackDispatcher.Unregister(m_hAPICall, this);
}
m_hAPICall = hAPICall;
if (hAPICall != SteamAPICall_t.Invalid) {
CallbackDispatcher.Register(hAPICall, this);
}
}
public bool IsActive() {
return (m_hAPICall != SteamAPICall_t.Invalid);
}
public void Cancel() {
if (IsActive())
CallbackDispatcher.Unregister(m_hAPICall, this);
}
internal override Type GetCallbackType() {
return typeof(T);
}
internal override void OnRunCallResult(IntPtr pvParam, bool bFailed, ulong hSteamAPICall_) {
SteamAPICall_t hSteamAPICall = (SteamAPICall_t)hSteamAPICall_;
if (hSteamAPICall == m_hAPICall) {
try {
m_Func((T)Marshal.PtrToStructure(pvParam, typeof(T)), bFailed);
}
catch (Exception e) {
CallbackDispatcher.ExceptionHandler(e);
}
}
}
internal override void SetUnregistered() {
m_hAPICall = SteamAPICall_t.Invalid;
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 67e97b7dd9922a94f8e5e866125a2eb3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,35 @@
// 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
namespace Steamworks {
class CallbackIdentities {
public static int GetCallbackIdentity(System.Type callbackStruct) {
#if UNITY_EDITOR || UNITY_STANDALONE || STEAMWORKS_WIN || STEAMWORKS_LIN_OSX
foreach (CallbackIdentityAttribute attribute in callbackStruct.GetCustomAttributes(typeof(CallbackIdentityAttribute), false)) {
return attribute.Identity;
}
#endif
throw new System.Exception("Callback number not found for struct " + callbackStruct);
}
}
[System.AttributeUsage(System.AttributeTargets.Struct, AllowMultiple = false)]
internal class CallbackIdentityAttribute : System.Attribute {
public int Identity { get; set; }
public CallbackIdentityAttribute(int callbackNum) {
Identity = callbackNum;
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 853cf3b9a25c4b44b84691b4af4f4dcf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,490 @@
// 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
// Unity 32bit Mono on Windows crashes with ThisCall for some reason, StdCall without the 'this' ptr is the only thing that works..?
#if (UNITY_EDITOR_WIN && !UNITY_EDITOR_64) || (!UNITY_EDITOR && UNITY_STANDALONE_WIN && !UNITY_64)
#define NOTHISPTR
#endif
using System;
using System.Runtime.InteropServices;
namespace Steamworks {
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after a server list refresh
// or an individual server update.
//
// Since you get these callbacks after requesting full list refreshes you will
// usually implement this interface inside an object like CServerBrowser. If that
// object is getting destructed you should use ISteamMatchMakingServers()->CancelQuery()
// to cancel any in-progress queries so you don't get a callback into the destructed
// object and crash.
//-----------------------------------------------------------------------------
public class ISteamMatchmakingServerListResponse {
// Server has responded ok with updated data
public delegate void ServerResponded(HServerListRequest hRequest, int iServer);
// Server has failed to respond
public delegate void ServerFailedToRespond(HServerListRequest hRequest, int iServer);
// A list refresh you had initiated is now 100% completed
public delegate void RefreshComplete(HServerListRequest hRequest, EMatchMakingServerResponse response);
private VTable m_VTable;
private IntPtr m_pVTable;
private GCHandle m_pGCHandle;
private ServerResponded m_ServerResponded;
private ServerFailedToRespond m_ServerFailedToRespond;
private RefreshComplete m_RefreshComplete;
public ISteamMatchmakingServerListResponse(ServerResponded onServerResponded, ServerFailedToRespond onServerFailedToRespond, RefreshComplete onRefreshComplete) {
if (onServerResponded == null || onServerFailedToRespond == null || onRefreshComplete == null) {
throw new ArgumentNullException();
}
m_ServerResponded = onServerResponded;
m_ServerFailedToRespond = onServerFailedToRespond;
m_RefreshComplete = onRefreshComplete;
m_VTable = new VTable() {
m_VTServerResponded = InternalOnServerResponded,
m_VTServerFailedToRespond = InternalOnServerFailedToRespond,
m_VTRefreshComplete = InternalOnRefreshComplete
};
m_pVTable = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VTable)));
Marshal.StructureToPtr(m_VTable, m_pVTable, false);
m_pGCHandle = GCHandle.Alloc(m_pVTable, GCHandleType.Pinned);
}
~ISteamMatchmakingServerListResponse() {
if (m_pVTable != IntPtr.Zero) {
Marshal.FreeHGlobal(m_pVTable);
}
if (m_pGCHandle.IsAllocated) {
m_pGCHandle.Free();
}
}
#if NOTHISPTR
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void InternalServerResponded(HServerListRequest hRequest, int iServer);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void InternalServerFailedToRespond(HServerListRequest hRequest, int iServer);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void InternalRefreshComplete(HServerListRequest hRequest, EMatchMakingServerResponse response);
private void InternalOnServerResponded(HServerListRequest hRequest, int iServer) {
try
{
m_ServerResponded(hRequest, iServer);
}
catch (Exception e)
{
CallbackDispatcher.ExceptionHandler(e);
}
}
private void InternalOnServerFailedToRespond(HServerListRequest hRequest, int iServer) {
try
{
m_ServerFailedToRespond(hRequest, iServer);
}
catch (Exception e)
{
CallbackDispatcher.ExceptionHandler(e);
}
}
private void InternalOnRefreshComplete(HServerListRequest hRequest, EMatchMakingServerResponse response) {
try
{
m_RefreshComplete(hRequest, response);
}
catch (Exception e)
{
CallbackDispatcher.ExceptionHandler(e);
}
}
#else
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate void InternalServerResponded(IntPtr thisptr, HServerListRequest hRequest, int iServer);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate void InternalServerFailedToRespond(IntPtr thisptr, HServerListRequest hRequest, int iServer);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate void InternalRefreshComplete(IntPtr thisptr, HServerListRequest hRequest, EMatchMakingServerResponse response);
private void InternalOnServerResponded(IntPtr thisptr, HServerListRequest hRequest, int iServer) {
try
{
m_ServerResponded(hRequest, iServer);
}
catch (Exception e)
{
CallbackDispatcher.ExceptionHandler(e);
}
}
private void InternalOnServerFailedToRespond(IntPtr thisptr, HServerListRequest hRequest, int iServer) {
try
{
m_ServerFailedToRespond(hRequest, iServer);
}
catch (Exception e)
{
CallbackDispatcher.ExceptionHandler(e);
}
}
private void InternalOnRefreshComplete(IntPtr thisptr, HServerListRequest hRequest, EMatchMakingServerResponse response) {
try
{
m_RefreshComplete(hRequest, response);
}
catch (Exception e)
{
CallbackDispatcher.ExceptionHandler(e);
}
}
#endif
[StructLayout(LayoutKind.Sequential)]
private class VTable {
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalServerResponded m_VTServerResponded;
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalServerFailedToRespond m_VTServerFailedToRespond;
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalRefreshComplete m_VTRefreshComplete;
}
public static explicit operator System.IntPtr(ISteamMatchmakingServerListResponse that) {
return that.m_pGCHandle.AddrOfPinnedObject();
}
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after pinging an individual server
//
// These callbacks all occur in response to querying an individual server
// via the ISteamMatchmakingServers()->PingServer() call below. If you are
// destructing an object that implements this interface then you should call
// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
public class ISteamMatchmakingPingResponse {
// Server has responded successfully and has updated data
public delegate void ServerResponded(gameserveritem_t server);
// Server failed to respond to the ping request
public delegate void ServerFailedToRespond();
private VTable m_VTable;
private IntPtr m_pVTable;
private GCHandle m_pGCHandle;
private ServerResponded m_ServerResponded;
private ServerFailedToRespond m_ServerFailedToRespond;
public ISteamMatchmakingPingResponse(ServerResponded onServerResponded, ServerFailedToRespond onServerFailedToRespond) {
if (onServerResponded == null || onServerFailedToRespond == null) {
throw new ArgumentNullException();
}
m_ServerResponded = onServerResponded;
m_ServerFailedToRespond = onServerFailedToRespond;
m_VTable = new VTable() {
m_VTServerResponded = InternalOnServerResponded,
m_VTServerFailedToRespond = InternalOnServerFailedToRespond,
};
m_pVTable = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VTable)));
Marshal.StructureToPtr(m_VTable, m_pVTable, false);
m_pGCHandle = GCHandle.Alloc(m_pVTable, GCHandleType.Pinned);
}
~ISteamMatchmakingPingResponse() {
if (m_pVTable != IntPtr.Zero) {
Marshal.FreeHGlobal(m_pVTable);
}
if (m_pGCHandle.IsAllocated) {
m_pGCHandle.Free();
}
}
#if NOTHISPTR
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void InternalServerResponded(gameserveritem_t server);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void InternalServerFailedToRespond();
private void InternalOnServerResponded(gameserveritem_t server) {
m_ServerResponded(server);
}
private void InternalOnServerFailedToRespond() {
m_ServerFailedToRespond();
}
#else
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate void InternalServerResponded(IntPtr thisptr, gameserveritem_t server);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate void InternalServerFailedToRespond(IntPtr thisptr);
private void InternalOnServerResponded(IntPtr thisptr, gameserveritem_t server) {
m_ServerResponded(server);
}
private void InternalOnServerFailedToRespond(IntPtr thisptr) {
m_ServerFailedToRespond();
}
#endif
[StructLayout(LayoutKind.Sequential)]
private class VTable {
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalServerResponded m_VTServerResponded;
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalServerFailedToRespond m_VTServerFailedToRespond;
}
public static explicit operator System.IntPtr(ISteamMatchmakingPingResponse that) {
return that.m_pGCHandle.AddrOfPinnedObject();
}
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after requesting details on
// who is playing on a particular server.
//
// These callbacks all occur in response to querying an individual server
// via the ISteamMatchmakingServers()->PlayerDetails() call below. If you are
// destructing an object that implements this interface then you should call
// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
public class ISteamMatchmakingPlayersResponse {
// Got data on a new player on the server -- you'll get this callback once per player
// on the server which you have requested player data on.
public delegate void AddPlayerToList(string pchName, int nScore, float flTimePlayed);
// The server failed to respond to the request for player details
public delegate void PlayersFailedToRespond();
// The server has finished responding to the player details request
// (ie, you won't get anymore AddPlayerToList callbacks)
public delegate void PlayersRefreshComplete();
private VTable m_VTable;
private IntPtr m_pVTable;
private GCHandle m_pGCHandle;
private AddPlayerToList m_AddPlayerToList;
private PlayersFailedToRespond m_PlayersFailedToRespond;
private PlayersRefreshComplete m_PlayersRefreshComplete;
public ISteamMatchmakingPlayersResponse(AddPlayerToList onAddPlayerToList, PlayersFailedToRespond onPlayersFailedToRespond, PlayersRefreshComplete onPlayersRefreshComplete) {
if (onAddPlayerToList == null || onPlayersFailedToRespond == null || onPlayersRefreshComplete == null) {
throw new ArgumentNullException();
}
m_AddPlayerToList = onAddPlayerToList;
m_PlayersFailedToRespond = onPlayersFailedToRespond;
m_PlayersRefreshComplete = onPlayersRefreshComplete;
m_VTable = new VTable() {
m_VTAddPlayerToList = InternalOnAddPlayerToList,
m_VTPlayersFailedToRespond = InternalOnPlayersFailedToRespond,
m_VTPlayersRefreshComplete = InternalOnPlayersRefreshComplete
};
m_pVTable = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VTable)));
Marshal.StructureToPtr(m_VTable, m_pVTable, false);
m_pGCHandle = GCHandle.Alloc(m_pVTable, GCHandleType.Pinned);
}
~ISteamMatchmakingPlayersResponse() {
if (m_pVTable != IntPtr.Zero) {
Marshal.FreeHGlobal(m_pVTable);
}
if (m_pGCHandle.IsAllocated) {
m_pGCHandle.Free();
}
}
#if NOTHISPTR
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void InternalAddPlayerToList(IntPtr pchName, int nScore, float flTimePlayed);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void InternalPlayersFailedToRespond();
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void InternalPlayersRefreshComplete();
private void InternalOnAddPlayerToList(IntPtr pchName, int nScore, float flTimePlayed) {
m_AddPlayerToList(InteropHelp.PtrToStringUTF8(pchName), nScore, flTimePlayed);
}
private void InternalOnPlayersFailedToRespond() {
m_PlayersFailedToRespond();
}
private void InternalOnPlayersRefreshComplete() {
m_PlayersRefreshComplete();
}
#else
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void InternalAddPlayerToList(IntPtr thisptr, IntPtr pchName, int nScore, float flTimePlayed);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void InternalPlayersFailedToRespond(IntPtr thisptr);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void InternalPlayersRefreshComplete(IntPtr thisptr);
private void InternalOnAddPlayerToList(IntPtr thisptr, IntPtr pchName, int nScore, float flTimePlayed) {
m_AddPlayerToList(InteropHelp.PtrToStringUTF8(pchName), nScore, flTimePlayed);
}
private void InternalOnPlayersFailedToRespond(IntPtr thisptr) {
m_PlayersFailedToRespond();
}
private void InternalOnPlayersRefreshComplete(IntPtr thisptr) {
m_PlayersRefreshComplete();
}
#endif
[StructLayout(LayoutKind.Sequential)]
private class VTable {
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalAddPlayerToList m_VTAddPlayerToList;
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalPlayersFailedToRespond m_VTPlayersFailedToRespond;
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalPlayersRefreshComplete m_VTPlayersRefreshComplete;
}
public static explicit operator System.IntPtr(ISteamMatchmakingPlayersResponse that) {
return that.m_pGCHandle.AddrOfPinnedObject();
}
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after requesting rules
// details on a particular server.
//
// These callbacks all occur in response to querying an individual server
// via the ISteamMatchmakingServers()->ServerRules() call below. If you are
// destructing an object that implements this interface then you should call
// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
public class ISteamMatchmakingRulesResponse {
// Got data on a rule on the server -- you'll get one of these per rule defined on
// the server you are querying
public delegate void RulesResponded(string pchRule, string pchValue);
// The server failed to respond to the request for rule details
public delegate void RulesFailedToRespond();
// The server has finished responding to the rule details request
// (ie, you won't get anymore RulesResponded callbacks)
public delegate void RulesRefreshComplete();
private VTable m_VTable;
private IntPtr m_pVTable;
private GCHandle m_pGCHandle;
private RulesResponded m_RulesResponded;
private RulesFailedToRespond m_RulesFailedToRespond;
private RulesRefreshComplete m_RulesRefreshComplete;
public ISteamMatchmakingRulesResponse(RulesResponded onRulesResponded, RulesFailedToRespond onRulesFailedToRespond, RulesRefreshComplete onRulesRefreshComplete) {
if (onRulesResponded == null || onRulesFailedToRespond == null || onRulesRefreshComplete == null) {
throw new ArgumentNullException();
}
m_RulesResponded = onRulesResponded;
m_RulesFailedToRespond = onRulesFailedToRespond;
m_RulesRefreshComplete = onRulesRefreshComplete;
m_VTable = new VTable() {
m_VTRulesResponded = InternalOnRulesResponded,
m_VTRulesFailedToRespond = InternalOnRulesFailedToRespond,
m_VTRulesRefreshComplete = InternalOnRulesRefreshComplete
};
m_pVTable = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VTable)));
Marshal.StructureToPtr(m_VTable, m_pVTable, false);
m_pGCHandle = GCHandle.Alloc(m_pVTable, GCHandleType.Pinned);
}
~ISteamMatchmakingRulesResponse() {
if (m_pVTable != IntPtr.Zero) {
Marshal.FreeHGlobal(m_pVTable);
}
if (m_pGCHandle.IsAllocated) {
m_pGCHandle.Free();
}
}
#if NOTHISPTR
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void InternalRulesResponded(IntPtr pchRule, IntPtr pchValue);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void InternalRulesFailedToRespond();
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void InternalRulesRefreshComplete();
private void InternalOnRulesResponded(IntPtr pchRule, IntPtr pchValue) {
m_RulesResponded(InteropHelp.PtrToStringUTF8(pchRule), InteropHelp.PtrToStringUTF8(pchValue));
}
private void InternalOnRulesFailedToRespond() {
m_RulesFailedToRespond();
}
private void InternalOnRulesRefreshComplete() {
m_RulesRefreshComplete();
}
#else
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void InternalRulesResponded(IntPtr thisptr, IntPtr pchRule, IntPtr pchValue);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void InternalRulesFailedToRespond(IntPtr thisptr);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void InternalRulesRefreshComplete(IntPtr thisptr);
private void InternalOnRulesResponded(IntPtr thisptr, IntPtr pchRule, IntPtr pchValue) {
m_RulesResponded(InteropHelp.PtrToStringUTF8(pchRule), InteropHelp.PtrToStringUTF8(pchValue));
}
private void InternalOnRulesFailedToRespond(IntPtr thisptr) {
m_RulesFailedToRespond();
}
private void InternalOnRulesRefreshComplete(IntPtr thisptr) {
m_RulesRefreshComplete();
}
#endif
[StructLayout(LayoutKind.Sequential)]
private class VTable {
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalRulesResponded m_VTRulesResponded;
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalRulesFailedToRespond m_VTRulesFailedToRespond;
[NonSerialized]
[MarshalAs(UnmanagedType.FunctionPtr)]
public InternalRulesRefreshComplete m_VTRulesRefreshComplete;
}
public static explicit operator System.IntPtr(ISteamMatchmakingRulesResponse that) {
return that.m_pGCHandle.AddrOfPinnedObject();
}
};
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 577f601da41ba9c4d934e78cbf1edfa6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,267 @@
// 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;
using System.Text;
namespace Steamworks {
public class InteropHelp {
public static void TestIfPlatformSupported() {
#if !UNITY_EDITOR && !UNITY_STANDALONE && !STEAMWORKS_WIN && !STEAMWORKS_LIN_OSX
throw new System.InvalidOperationException("Steamworks functions can only be called on platforms that Steam is available on.");
#endif
}
public static void TestIfAvailableClient() {
TestIfPlatformSupported();
if (CSteamAPIContext.GetSteamClient() == System.IntPtr.Zero) {
if (!CSteamAPIContext.Init()) {
throw new System.InvalidOperationException("Steamworks is not initialized.");
}
}
}
public static void TestIfAvailableGameServer() {
TestIfPlatformSupported();
if (CSteamGameServerAPIContext.GetSteamClient() == System.IntPtr.Zero) {
if (!CSteamGameServerAPIContext.Init()) {
throw new System.InvalidOperationException("Steamworks GameServer is not initialized.");
}
}
}
// This continues to exist for both 'out string' and strings returned by Steamworks functions.
public static string PtrToStringUTF8(IntPtr nativeUtf8) {
if (nativeUtf8 == IntPtr.Zero) {
return null;
}
int len = 0;
while (Marshal.ReadByte(nativeUtf8, len) != 0) {
++len;
}
if (len == 0) {
return string.Empty;
}
byte[] buffer = new byte[len];
Marshal.Copy(nativeUtf8, buffer, 0, buffer.Length);
return Encoding.UTF8.GetString(buffer);
}
public static string ByteArrayToStringUTF8(byte[] buffer) {
int length = 0;
while (length < buffer.Length && buffer[length] != 0) {
length++;
}
return Encoding.UTF8.GetString(buffer, 0, length);
}
public static void StringToByteArrayUTF8(string str, byte[] outArrayBuffer, int outArrayBufferSize)
{
outArrayBuffer = new byte[outArrayBufferSize];
int length = Encoding.UTF8.GetBytes(str, 0, str.Length, outArrayBuffer, 0);
outArrayBuffer[length] = 0;
}
// This is for 'const char *' arguments which we need to ensure do not get GC'd while Steam is using them.
// We can't use an ICustomMarshaler because Unity crashes when a string between 96 and 127 characters long is defined/initialized at the top of class scope...
#if UNITY_EDITOR || UNITY_STANDALONE || STEAMWORKS_WIN || STEAMWORKS_LIN_OSX
public class UTF8StringHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid {
public UTF8StringHandle(string str)
: base(true) {
if (str == null) {
SetHandle(IntPtr.Zero);
return;
}
// +1 for '\0'
byte[] strbuf = new byte[Encoding.UTF8.GetByteCount(str) + 1];
Encoding.UTF8.GetBytes(str, 0, str.Length, strbuf, 0);
IntPtr buffer = Marshal.AllocHGlobal(strbuf.Length);
Marshal.Copy(strbuf, 0, buffer, strbuf.Length);
SetHandle(buffer);
}
protected override bool ReleaseHandle() {
if (!IsInvalid) {
Marshal.FreeHGlobal(handle);
}
return true;
}
}
#else
public class UTF8StringHandle : IDisposable {
public UTF8StringHandle(string str) { }
public void Dispose() {}
}
#endif
// TODO - Should be IDisposable
// We can't use an ICustomMarshaler because Unity dies when MarshalManagedToNative() gets called with a generic type.
public class SteamParamStringArray {
// The pointer to each AllocHGlobal() string
IntPtr[] m_Strings;
// The pointer to the condensed version of m_Strings
IntPtr m_ptrStrings;
// The pointer to the StructureToPtr version of SteamParamStringArray_t that will get marshaled
IntPtr m_pSteamParamStringArray;
public SteamParamStringArray(System.Collections.Generic.IList<string> strings) {
if (strings == null) {
m_pSteamParamStringArray = IntPtr.Zero;
return;
}
m_Strings = new IntPtr[strings.Count];
for (int i = 0; i < strings.Count; ++i) {
byte[] strbuf = new byte[Encoding.UTF8.GetByteCount(strings[i]) + 1];
Encoding.UTF8.GetBytes(strings[i], 0, strings[i].Length, strbuf, 0);
m_Strings[i] = Marshal.AllocHGlobal(strbuf.Length);
Marshal.Copy(strbuf, 0, m_Strings[i], strbuf.Length);
}
m_ptrStrings = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)) * m_Strings.Length);
SteamParamStringArray_t stringArray = new SteamParamStringArray_t() {
m_ppStrings = m_ptrStrings,
m_nNumStrings = m_Strings.Length
};
Marshal.Copy(m_Strings, 0, stringArray.m_ppStrings, m_Strings.Length);
m_pSteamParamStringArray = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SteamParamStringArray_t)));
Marshal.StructureToPtr(stringArray, m_pSteamParamStringArray, false);
}
~SteamParamStringArray() {
if (m_Strings != null) {
foreach (IntPtr ptr in m_Strings) {
Marshal.FreeHGlobal(ptr);
}
}
if (m_ptrStrings != IntPtr.Zero) {
Marshal.FreeHGlobal(m_ptrStrings);
}
if (m_pSteamParamStringArray != IntPtr.Zero) {
Marshal.FreeHGlobal(m_pSteamParamStringArray);
}
}
public static implicit operator IntPtr(SteamParamStringArray that) {
return that.m_pSteamParamStringArray;
}
}
}
// TODO - Should be IDisposable
// MatchMaking Key-Value Pair Marshaller
public class MMKVPMarshaller {
private IntPtr m_pNativeArray;
private IntPtr m_pArrayEntries;
public MMKVPMarshaller(MatchMakingKeyValuePair_t[] filters) {
if (filters == null) {
return;
}
int sizeOfMMKVP = Marshal.SizeOf(typeof(MatchMakingKeyValuePair_t));
m_pNativeArray = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)) * filters.Length);
m_pArrayEntries = Marshal.AllocHGlobal(sizeOfMMKVP * filters.Length);
for (int i = 0; i < filters.Length; ++i) {
Marshal.StructureToPtr(filters[i], new IntPtr(m_pArrayEntries.ToInt64() + (i * sizeOfMMKVP)), false);
}
Marshal.WriteIntPtr(m_pNativeArray, m_pArrayEntries);
}
~MMKVPMarshaller() {
if (m_pArrayEntries != IntPtr.Zero) {
Marshal.FreeHGlobal(m_pArrayEntries);
}
if (m_pNativeArray != IntPtr.Zero) {
Marshal.FreeHGlobal(m_pNativeArray);
}
}
public static implicit operator IntPtr(MMKVPMarshaller that) {
return that.m_pNativeArray;
}
}
public class DllCheck {
#if DISABLED
[DllImport("kernel32.dll")]
public static extern IntPtr GetModuleHandle(string lpModuleName);
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
extern static int GetModuleFileName(IntPtr hModule, StringBuilder strFullPath, int nSize);
#endif
/// <summary>
/// This is an optional runtime check to ensure that the dlls are the correct version. Returns false only if the steam_api.dll is found and it's the wrong size or version number.
/// </summary>
public static bool Test() {
#if DISABLED
bool ret = CheckSteamAPIDLL();
#endif
return true;
}
#if DISABLED
private static bool CheckSteamAPIDLL() {
string fileName;
int fileBytes;
if (IntPtr.Size == 4) {
fileName = "steam_api.dll";
fileBytes = Version.SteamAPIDLLSize;
}
else {
fileName = "steam_api64.dll";
fileBytes = Version.SteamAPI64DLLSize;
}
IntPtr handle = GetModuleHandle(fileName);
if (handle == IntPtr.Zero) {
return true;
}
StringBuilder filePath = new StringBuilder(256);
GetModuleFileName(handle, filePath, filePath.Capacity);
string file = filePath.ToString();
// If we can not find the file we'll just skip it and let the DllNotFoundException take care of it.
if (System.IO.File.Exists(file)) {
System.IO.FileInfo fInfo = new System.IO.FileInfo(file);
if (fInfo.Length != fileBytes) {
return false;
}
if (System.Diagnostics.FileVersionInfo.GetVersionInfo(file).FileVersion != Version.SteamAPIDLLVersion) {
return false;
}
}
return true;
}
#endif
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7521a262d02c9ee47a1f08824a22b094
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,71 @@
// 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
// If we're running in the Unity Editor we need the editors platform.
#if UNITY_EDITOR_WIN
#define VALVE_CALLBACK_PACK_LARGE
#elif UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX
#define VALVE_CALLBACK_PACK_SMALL
// Otherwise we want the target platform.
#elif UNITY_STANDALONE_WIN || STEAMWORKS_WIN
#define VALVE_CALLBACK_PACK_LARGE
#elif UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || STEAMWORKS_LIN_OSX
#define VALVE_CALLBACK_PACK_SMALL
// We do not want to throw a warning when we're building in Unity but for an unsupported platform. So we'll silently let this slip by.
// It would be nice if Unity itself would define 'UNITY' or something like that...
#elif UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5 || UNITY_2017_1_OR_NEWER
#define VALVE_CALLBACK_PACK_SMALL
// But we do want to be explicit on the Standalone build for XNA/Monogame.
#else
#define VALVE_CALLBACK_PACK_LARGE
#warning You need to define STEAMWORKS_WIN, or STEAMWORKS_LIN_OSX. Refer to the readme for more details.
#endif
using System.Runtime.InteropServices;
using IntPtr = System.IntPtr;
namespace Steamworks {
public static class Packsize {
#if VALVE_CALLBACK_PACK_LARGE
public const int value = 8;
#elif VALVE_CALLBACK_PACK_SMALL
public const int value = 4;
#endif
public static bool Test() {
int sentinelSize = Marshal.SizeOf(typeof(ValvePackingSentinel_t));
int subscribedFilesSize = Marshal.SizeOf(typeof(RemoteStorageEnumerateUserSubscribedFilesResult_t));
#if VALVE_CALLBACK_PACK_LARGE
if (sentinelSize != 32 || subscribedFilesSize != (1 + 1 + 1 + 50 + 100) * 4 + 4)
return false;
#elif VALVE_CALLBACK_PACK_SMALL
if (sentinelSize != 24 || subscribedFilesSize != (1 + 1 + 1 + 50 + 100) * 4)
return false;
#endif
return true;
}
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
struct ValvePackingSentinel_t {
uint m_u32;
ulong m_u64;
ushort m_u16;
double m_d;
};
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c871c983f47850a41a28b6c09b5d9542
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,670 @@
// 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 SteamAPI {
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Steam API setup & shutdown
//
// These functions manage loading, initializing and shutdown of the steamclient.dll
//
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Initializing the Steamworks SDK
// -----------------------------
//
// There are three different methods you can use to initialize the Steamworks SDK, depending on
// your project's environment. You should only use one method in your project.
//
// If you are able to include this C++ header in your project, we recommend using the following
// initialization methods. They will ensure that all ISteam* interfaces defined in other
// C++ header files have versions that are supported by the user's Steam Client:
// - SteamAPI_InitEx() for new projects so you can show a detailed error message to the user
// - SteamAPI_Init() for existing projects that only display a generic error message
//
// If you are unable to include this C++ header in your project and are dynamically loading
// Steamworks SDK methods from dll/so, you can use the following method:
// - SteamAPI_InitFlat()
// See "Initializing the Steamworks SDK" above for how to choose an init method.
// On success k_ESteamAPIInitResult_OK is returned. Otherwise, returns a value that can be used
// to create a localized error message for the user. If pOutErrMsg is non-NULL,
// it will receive an example error message, in English, that explains the reason for the failure.
//
// Example usage:
//
// SteamErrMsg errMsg;
// if ( SteamAPI_Init(&errMsg) != k_ESteamAPIInitResult_OK )
// FatalError( "Failed to init Steam. %s", errMsg );
// See "Initializing the Steamworks SDK" above for how to choose an init method.
// Returns true on success
public static ESteamAPIInitResult InitEx(out string OutSteamErrMsg)
{
InteropHelp.TestIfPlatformSupported();
var pszInternalCheckInterfaceVersions = new System.Text.StringBuilder();
pszInternalCheckInterfaceVersions.Append(Constants.STEAMUTILS_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMNETWORKINGUTILS_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMAPPS_INTERFACE_VERSION).Append("\0");
//pszInternalCheckInterfaceVersions.Append(Constants.STEAMCONTROLLER_INTERFACE_VERSION).Append("\0"); // ISteamController is deprecated in favor of ISteamInput.
pszInternalCheckInterfaceVersions.Append(Constants.STEAMFRIENDS_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMGAMESEARCH_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMHTMLSURFACE_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMHTTP_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMINPUT_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMINVENTORY_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMMATCHMAKING_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMMUSICREMOTE_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMMUSIC_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMNETWORKINGMESSAGES_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMNETWORKINGSOCKETS_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMNETWORKING_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMPARENTALSETTINGS_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMPARTIES_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMREMOTEPLAY_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMREMOTESTORAGE_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMSCREENSHOTS_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMUGC_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMUSERSTATS_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMUSER_INTERFACE_VERSION).Append("\0");
pszInternalCheckInterfaceVersions.Append(Constants.STEAMVIDEO_INTERFACE_VERSION).Append("\0");
using (var pszInternalCheckInterfaceVersions2 = new InteropHelp.UTF8StringHandle(pszInternalCheckInterfaceVersions.ToString())) {
IntPtr SteamErrorMsgPtr = Marshal.AllocHGlobal(Constants.k_cchMaxSteamErrMsg);
ESteamAPIInitResult initResult = NativeMethods.SteamInternal_SteamAPI_Init(pszInternalCheckInterfaceVersions2, SteamErrorMsgPtr);
OutSteamErrMsg = InteropHelp.PtrToStringUTF8(SteamErrorMsgPtr);
Marshal.FreeHGlobal(SteamErrorMsgPtr);
// Steamworks.NET specific: We initialize the SteamAPI Context like this for now, but we need to do it
// every time that Unity reloads binaries, so we also check if the pointers are available and initialized
// before each call to any interface functions. That is in InteropHelp.cs
if (initResult == ESteamAPIInitResult.k_ESteamAPIInitResult_OK)
{
bool ret = CSteamAPIContext.Init();
if (ret) {
CallbackDispatcher.Initialize();
}
else {
initResult = ESteamAPIInitResult.k_ESteamAPIInitResult_FailedGeneric;
OutSteamErrMsg = "[Steamworks.NET] Failed to initialize CSteamAPIContext";
}
}
return initResult;
}
}
public static bool Init() {
InteropHelp.TestIfPlatformSupported();
string SteamErrorMsg;
return InitEx(out SteamErrorMsg) == ESteamAPIInitResult.k_ESteamAPIInitResult_OK;
}
// SteamAPI_Shutdown should be called during process shutdown if possible.
public static void Shutdown() {
InteropHelp.TestIfPlatformSupported();
NativeMethods.SteamAPI_Shutdown();
CSteamAPIContext.Clear();
CallbackDispatcher.Shutdown();
}
// SteamAPI_RestartAppIfNecessary ensures that your executable was launched through Steam.
//
// Returns true if the current process should terminate. Steam is now re-launching your application.
//
// Returns false if no action needs to be taken. This means that your executable was started through
// the Steam client, or a steam_appid.txt file is present in your game's directory (for development).
// Your current process should continue if false is returned.
//
// NOTE: If you use the Steam DRM wrapper on your primary executable file, this check is unnecessary
// since the DRM wrapper will ensure that your application was launched properly through Steam.
public static bool RestartAppIfNecessary(AppId_t unOwnAppID) {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamAPI_RestartAppIfNecessary(unOwnAppID);
}
// Many Steam API functions allocate a small amount of thread-local memory for parameter storage.
// SteamAPI_ReleaseCurrentThreadMemory() will free API memory associated with the calling thread.
// This function is also called automatically by SteamAPI_RunCallbacks(), so a single-threaded
// program never needs to explicitly call this function.
public static void ReleaseCurrentThreadMemory() {
InteropHelp.TestIfPlatformSupported();
NativeMethods.SteamAPI_ReleaseCurrentThreadMemory();
}
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steam callback and call-result helpers
//
// The following macros and classes are used to register your application for
// callbacks and call-results, which are delivered in a predictable manner.
//
// STEAM_CALLBACK macros are meant for use inside of a C++ class definition.
// They map a Steam notification callback directly to a class member function
// which is automatically prototyped as "void func( callback_type *pParam )".
//
// CCallResult is used with specific Steam APIs that return "result handles".
// The handle can be passed to a CCallResult object's Set function, along with
// an object pointer and member-function pointer. The member function will
// be executed once the results of the Steam API call are available.
//
// CCallback and CCallbackManual classes can be used instead of STEAM_CALLBACK
// macros if you require finer control over registration and unregistration.
//
// Callbacks and call-results are queued automatically and are only
// delivered/executed when your application calls SteamAPI_RunCallbacks().
//
// Note that there is an alternative, lower level callback dispatch mechanism.
// See SteamAPI_ManualDispatch_Init
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Dispatch all queued Steamworks callbacks.
//
// This is safe to call from multiple threads simultaneously,
// but if you choose to do this, callback code could be executed on any thread.
// One alternative is to call SteamAPI_RunCallbacks from the main thread only,
// and call SteamAPI_ReleaseCurrentThreadMemory regularly on other threads.
public static void RunCallbacks() {
CallbackDispatcher.RunFrame(false);
}
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steamclient.dll private wrapper functions
//
// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// SteamAPI_IsSteamRunning() returns true if Steam is currently running
public static bool IsSteamRunning() {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamAPI_IsSteamRunning();
}
// returns the pipe we are communicating to Steam with
public static HSteamPipe GetHSteamPipe() {
InteropHelp.TestIfPlatformSupported();
return (HSteamPipe)NativeMethods.SteamAPI_GetHSteamPipe();
}
public static HSteamUser GetHSteamUser() {
InteropHelp.TestIfPlatformSupported();
return (HSteamUser)NativeMethods.SteamAPI_GetHSteamUser();
}
}
public static class GameServer {
// Initialize SteamGameServer client and interface objects, and set server properties which may not be changed.
//
// After calling this function, you should set any additional server parameters, and then
// call ISteamGameServer::LogOnAnonymous() or ISteamGameServer::LogOn()
//
// - unIP will usually be zero. If you are on a machine with multiple IP addresses, you can pass a non-zero
// value here and the relevant sockets will be bound to that IP. This can be used to ensure that
// the IP you desire is the one used in the server browser.
// - usGamePort is the port that clients will connect to for gameplay. You will usually open up your
// own socket bound to this port.
// - usQueryPort is the port that will manage server browser related duties and info
// pings from clients. If you pass STEAMGAMESERVER_QUERY_PORT_SHARED for usQueryPort, then it
// will use "GameSocketShare" mode, which means that the game is responsible for sending and receiving
// UDP packets for the master server updater. (See ISteamGameServer::HandleIncomingPacket and
// ISteamGameServer::GetNextOutgoingPacket.)
// - The version string should be in the form x.x.x.x, and is used by the master server to detect when the
// server is out of date. (Only servers with the latest version will be listed.)
public static ESteamAPIInitResult InitEx(uint unIP, ushort usGamePort, ushort usQueryPort, EServerMode eServerMode, string pchVersionString, out string OutSteamErrMsg) {
InteropHelp.TestIfPlatformSupported();
var pszInternalCheckInterfaceVersions = new System.Text.StringBuilder();
pszInternalCheckInterfaceVersions.Append(Constants.STEAMUTILS_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMNETWORKINGUTILS_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMGAMESERVER_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMGAMESERVERSTATS_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMHTTP_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMINVENTORY_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMNETWORKING_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMNETWORKINGMESSAGES_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMNETWORKINGSOCKETS_INTERFACE_VERSION).Append('\0');
pszInternalCheckInterfaceVersions.Append(Constants.STEAMUGC_INTERFACE_VERSION).Append('\0');
using (var pchVersionString2 = new InteropHelp.UTF8StringHandle(pchVersionString))
using (var pszInternalCheckInterfaceVersions2 = new InteropHelp.UTF8StringHandle(pszInternalCheckInterfaceVersions.ToString())) {
IntPtr SteamErrorMsgPtr = Marshal.AllocHGlobal(Constants.k_cchMaxSteamErrMsg);
ESteamAPIInitResult initResult = NativeMethods.SteamInternal_GameServer_Init_V2(unIP, usGamePort, usQueryPort, eServerMode, pchVersionString2, pszInternalCheckInterfaceVersions2, SteamErrorMsgPtr);
OutSteamErrMsg = InteropHelp.PtrToStringUTF8(SteamErrorMsgPtr);
Marshal.FreeHGlobal(SteamErrorMsgPtr);
// Steamworks.NET specific: We initialize the SteamAPI Context like this for now, but we need to do it
// every time that Unity reloads binaries, so we also check if the pointers are available and initialized
// before each call to any interface functions. That is in InteropHelp.cs
if (initResult == ESteamAPIInitResult.k_ESteamAPIInitResult_OK)
{
bool ret = CSteamGameServerAPIContext.Init();
if (ret) {
CallbackDispatcher.Initialize();
}
else {
initResult = ESteamAPIInitResult.k_ESteamAPIInitResult_FailedGeneric;
OutSteamErrMsg = "[Steamworks.NET] Failed to initialize CSteamAPIContext";
}
}
return initResult;
}
}
// This function is included for compatibility with older SDK.
// You can use it if you don't care about decent error handling
public static bool Init(uint unIP, ushort usGamePort, ushort usQueryPort, EServerMode eServerMode, string pchVersionString) {
InteropHelp.TestIfPlatformSupported();
string SteamErrorMsg;
return InitEx(unIP, usGamePort, usQueryPort, eServerMode, pchVersionString, out SteamErrorMsg) == ESteamAPIInitResult.k_ESteamAPIInitResult_OK;
}
// Shutdown SteamGameSeverXxx interfaces, log out, and free resources.
public static void Shutdown() {
InteropHelp.TestIfPlatformSupported();
NativeMethods.SteamGameServer_Shutdown();
CSteamGameServerAPIContext.Clear();
CallbackDispatcher.Shutdown();
}
public static void RunCallbacks() {
CallbackDispatcher.RunFrame(true);
}
// Most Steam API functions allocate some amount of thread-local memory for
// parameter storage. Calling SteamGameServer_ReleaseCurrentThreadMemory()
// will free all API-related memory associated with the calling thread.
// This memory is released automatically by SteamGameServer_RunCallbacks(),
// so single-threaded servers do not need to explicitly call this function.
public static void ReleaseCurrentThreadMemory() {
InteropHelp.TestIfPlatformSupported();
NativeMethods.SteamGameServer_ReleaseCurrentThreadMemory();
}
public static bool BSecure() {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamGameServer_BSecure();
}
public static CSteamID GetSteamID() {
InteropHelp.TestIfPlatformSupported();
return (CSteamID)NativeMethods.SteamGameServer_GetSteamID();
}
public static HSteamPipe GetHSteamPipe() {
InteropHelp.TestIfPlatformSupported();
return (HSteamPipe)NativeMethods.SteamGameServer_GetHSteamPipe();
}
public static HSteamUser GetHSteamUser() {
InteropHelp.TestIfPlatformSupported();
return (HSteamUser)NativeMethods.SteamGameServer_GetHSteamUser();
}
}
public static class SteamEncryptedAppTicket {
public static bool BDecryptTicket(byte[] rgubTicketEncrypted, uint cubTicketEncrypted, byte[] rgubTicketDecrypted, ref uint pcubTicketDecrypted, byte[] rgubKey, int cubKey) {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamEncryptedAppTicket_BDecryptTicket(rgubTicketEncrypted, cubTicketEncrypted, rgubTicketDecrypted, ref pcubTicketDecrypted, rgubKey, cubKey);
}
public static bool BIsTicketForApp(byte[] rgubTicketDecrypted, uint cubTicketDecrypted, AppId_t nAppID) {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamEncryptedAppTicket_BIsTicketForApp(rgubTicketDecrypted, cubTicketDecrypted, nAppID);
}
public static uint GetTicketIssueTime(byte[] rgubTicketDecrypted, uint cubTicketDecrypted) {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamEncryptedAppTicket_GetTicketIssueTime(rgubTicketDecrypted, cubTicketDecrypted);
}
public static void GetTicketSteamID(byte[] rgubTicketDecrypted, uint cubTicketDecrypted, out CSteamID psteamID) {
InteropHelp.TestIfPlatformSupported();
NativeMethods.SteamEncryptedAppTicket_GetTicketSteamID(rgubTicketDecrypted, cubTicketDecrypted, out psteamID);
}
public static uint GetTicketAppID(byte[] rgubTicketDecrypted, uint cubTicketDecrypted) {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamEncryptedAppTicket_GetTicketAppID(rgubTicketDecrypted, cubTicketDecrypted);
}
public static bool BUserOwnsAppInTicket(byte[] rgubTicketDecrypted, uint cubTicketDecrypted, AppId_t nAppID) {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamEncryptedAppTicket_BUserOwnsAppInTicket(rgubTicketDecrypted, cubTicketDecrypted, nAppID);
}
public static bool BUserIsVacBanned(byte[] rgubTicketDecrypted, uint cubTicketDecrypted) {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamEncryptedAppTicket_BUserIsVacBanned(rgubTicketDecrypted, cubTicketDecrypted);
}
public static byte[] GetUserVariableData(byte[] rgubTicketDecrypted, uint cubTicketDecrypted, out uint pcubUserData) {
InteropHelp.TestIfPlatformSupported();
IntPtr punSecretData = NativeMethods.SteamEncryptedAppTicket_GetUserVariableData(rgubTicketDecrypted, cubTicketDecrypted, out pcubUserData);
byte[] ret = new byte[pcubUserData];
System.Runtime.InteropServices.Marshal.Copy(punSecretData, ret, 0, (int)pcubUserData);
return ret;
}
public static bool BIsTicketSigned(byte[] rgubTicketDecrypted, uint cubTicketDecrypted, byte[] pubRSAKey, uint cubRSAKey) {
InteropHelp.TestIfPlatformSupported();
return NativeMethods.SteamEncryptedAppTicket_BIsTicketSigned(rgubTicketDecrypted, cubTicketDecrypted, pubRSAKey, cubRSAKey);
}
}
internal static class CSteamAPIContext {
internal static void Clear() {
m_pSteamClient = IntPtr.Zero;
m_pSteamUser = IntPtr.Zero;
m_pSteamFriends = IntPtr.Zero;
m_pSteamUtils = IntPtr.Zero;
m_pSteamMatchmaking = IntPtr.Zero;
m_pSteamUserStats = IntPtr.Zero;
m_pSteamApps = IntPtr.Zero;
m_pSteamMatchmakingServers = IntPtr.Zero;
m_pSteamNetworking = IntPtr.Zero;
m_pSteamRemoteStorage = IntPtr.Zero;
m_pSteamHTTP = IntPtr.Zero;
m_pSteamScreenshots = IntPtr.Zero;
m_pSteamGameSearch = IntPtr.Zero;
m_pSteamMusic = IntPtr.Zero;
m_pController = IntPtr.Zero;
m_pSteamUGC = IntPtr.Zero;
m_pSteamMusic = IntPtr.Zero;
m_pSteamMusicRemote = IntPtr.Zero;
m_pSteamHTMLSurface = IntPtr.Zero;
m_pSteamInventory = IntPtr.Zero;
m_pSteamVideo = IntPtr.Zero;
m_pSteamParentalSettings = IntPtr.Zero;
m_pSteamInput = IntPtr.Zero;
m_pSteamParties = IntPtr.Zero;
m_pSteamRemotePlay = IntPtr.Zero;
m_pSteamNetworkingUtils = IntPtr.Zero;
m_pSteamNetworkingSockets = IntPtr.Zero;
m_pSteamNetworkingMessages = IntPtr.Zero;
m_pSteamTimeline = IntPtr.Zero;
}
internal static bool Init() {
HSteamUser hSteamUser = SteamAPI.GetHSteamUser();
HSteamPipe hSteamPipe = SteamAPI.GetHSteamPipe();
if (hSteamPipe == (HSteamPipe)0) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMCLIENT_INTERFACE_VERSION)) {
m_pSteamClient = NativeMethods.SteamInternal_CreateInterface(pchVersionString);
}
if (m_pSteamClient == IntPtr.Zero) { return false; }
m_pSteamUser = SteamClient.GetISteamUser(hSteamUser, hSteamPipe, Constants.STEAMUSER_INTERFACE_VERSION);
if (m_pSteamUser == IntPtr.Zero) { return false; }
m_pSteamFriends = SteamClient.GetISteamFriends(hSteamUser, hSteamPipe, Constants.STEAMFRIENDS_INTERFACE_VERSION);
if (m_pSteamFriends == IntPtr.Zero) { return false; }
m_pSteamUtils = SteamClient.GetISteamUtils(hSteamPipe, Constants.STEAMUTILS_INTERFACE_VERSION);
if (m_pSteamUtils == IntPtr.Zero) { return false; }
m_pSteamMatchmaking = SteamClient.GetISteamMatchmaking(hSteamUser, hSteamPipe, Constants.STEAMMATCHMAKING_INTERFACE_VERSION);
if (m_pSteamMatchmaking == IntPtr.Zero) { return false; }
m_pSteamMatchmakingServers = SteamClient.GetISteamMatchmakingServers(hSteamUser, hSteamPipe, Constants.STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION);
if (m_pSteamMatchmakingServers == IntPtr.Zero) { return false; }
m_pSteamUserStats = SteamClient.GetISteamUserStats(hSteamUser, hSteamPipe, Constants.STEAMUSERSTATS_INTERFACE_VERSION);
if (m_pSteamUserStats == IntPtr.Zero) { return false; }
m_pSteamApps = SteamClient.GetISteamApps(hSteamUser, hSteamPipe, Constants.STEAMAPPS_INTERFACE_VERSION);
if (m_pSteamApps == IntPtr.Zero) { return false; }
m_pSteamNetworking = SteamClient.GetISteamNetworking(hSteamUser, hSteamPipe, Constants.STEAMNETWORKING_INTERFACE_VERSION);
if (m_pSteamNetworking == IntPtr.Zero) { return false; }
m_pSteamRemoteStorage = SteamClient.GetISteamRemoteStorage(hSteamUser, hSteamPipe, Constants.STEAMREMOTESTORAGE_INTERFACE_VERSION);
if (m_pSteamRemoteStorage == IntPtr.Zero) { return false; }
m_pSteamScreenshots = SteamClient.GetISteamScreenshots(hSteamUser, hSteamPipe, Constants.STEAMSCREENSHOTS_INTERFACE_VERSION);
if (m_pSteamScreenshots == IntPtr.Zero) { return false; }
m_pSteamGameSearch = SteamClient.GetISteamGameSearch(hSteamUser, hSteamPipe, Constants.STEAMGAMESEARCH_INTERFACE_VERSION);
if (m_pSteamGameSearch == IntPtr.Zero) { return false; }
m_pSteamHTTP = SteamClient.GetISteamHTTP(hSteamUser, hSteamPipe, Constants.STEAMHTTP_INTERFACE_VERSION);
if (m_pSteamHTTP == IntPtr.Zero) { return false; }
m_pSteamUGC = SteamClient.GetISteamUGC(hSteamUser, hSteamPipe, Constants.STEAMUGC_INTERFACE_VERSION);
if (m_pSteamUGC == IntPtr.Zero) { return false; }
m_pSteamMusic = SteamClient.GetISteamMusic(hSteamUser, hSteamPipe, Constants.STEAMMUSIC_INTERFACE_VERSION);
if (m_pSteamMusic == IntPtr.Zero) { return false; }
m_pSteamMusicRemote = SteamClient.GetISteamMusicRemote(hSteamUser, hSteamPipe, Constants.STEAMMUSICREMOTE_INTERFACE_VERSION);
if (m_pSteamMusicRemote == IntPtr.Zero) { return false; }
m_pSteamHTMLSurface = SteamClient.GetISteamHTMLSurface(hSteamUser, hSteamPipe, Constants.STEAMHTMLSURFACE_INTERFACE_VERSION);
if (m_pSteamHTMLSurface == IntPtr.Zero) { return false; }
m_pSteamInventory = SteamClient.GetISteamInventory(hSteamUser, hSteamPipe, Constants.STEAMINVENTORY_INTERFACE_VERSION);
if (m_pSteamInventory == IntPtr.Zero) { return false; }
m_pSteamVideo = SteamClient.GetISteamVideo(hSteamUser, hSteamPipe, Constants.STEAMVIDEO_INTERFACE_VERSION);
if (m_pSteamVideo == IntPtr.Zero) { return false; }
m_pSteamParentalSettings = SteamClient.GetISteamParentalSettings(hSteamUser, hSteamPipe, Constants.STEAMPARENTALSETTINGS_INTERFACE_VERSION);
if (m_pSteamParentalSettings == IntPtr.Zero) { return false; }
m_pSteamInput = SteamClient.GetISteamInput(hSteamUser, hSteamPipe, Constants.STEAMINPUT_INTERFACE_VERSION);
if (m_pSteamInput == IntPtr.Zero) { return false; }
m_pSteamParties = SteamClient.GetISteamParties(hSteamUser, hSteamPipe, Constants.STEAMPARTIES_INTERFACE_VERSION);
if (m_pSteamParties == IntPtr.Zero) { return false; }
m_pSteamRemotePlay = SteamClient.GetISteamRemotePlay(hSteamUser, hSteamPipe, Constants.STEAMREMOTEPLAY_INTERFACE_VERSION);
if (m_pSteamRemotePlay == IntPtr.Zero) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGUTILS_INTERFACE_VERSION))
{
m_pSteamNetworkingUtils =
NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString) != IntPtr.Zero ?
NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString) :
NativeMethods.SteamInternal_FindOrCreateGameServerInterface(hSteamUser, pchVersionString);
}
if (m_pSteamNetworkingUtils == IntPtr.Zero) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGSOCKETS_INTERFACE_VERSION))
{
m_pSteamNetworkingSockets = NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString);
}
if (m_pSteamNetworkingSockets == IntPtr.Zero) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGMESSAGES_INTERFACE_VERSION))
{
m_pSteamNetworkingMessages = NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString);
}
if (m_pSteamNetworkingMessages == IntPtr.Zero) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMTIMELINE_INTERFACE_VERSION))
{
m_pSteamTimeline = NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString);
}
if (m_pSteamTimeline == IntPtr.Zero) { return false; }
return true;
}
internal static IntPtr GetSteamClient() { return m_pSteamClient; }
internal static IntPtr GetSteamUser() { return m_pSteamUser; }
internal static IntPtr GetSteamFriends() { return m_pSteamFriends; }
internal static IntPtr GetSteamUtils() { return m_pSteamUtils; }
internal static IntPtr GetSteamMatchmaking() { return m_pSteamMatchmaking; }
internal static IntPtr GetSteamUserStats() { return m_pSteamUserStats; }
internal static IntPtr GetSteamApps() { return m_pSteamApps; }
internal static IntPtr GetSteamMatchmakingServers() { return m_pSteamMatchmakingServers; }
internal static IntPtr GetSteamNetworking() { return m_pSteamNetworking; }
internal static IntPtr GetSteamRemoteStorage() { return m_pSteamRemoteStorage; }
internal static IntPtr GetSteamScreenshots() { return m_pSteamScreenshots; }
internal static IntPtr GetSteamGameSearch() { return m_pSteamGameSearch; }
internal static IntPtr GetSteamHTTP() { return m_pSteamHTTP; }
internal static IntPtr GetSteamController() { return m_pController; }
internal static IntPtr GetSteamUGC() { return m_pSteamUGC; }
internal static IntPtr GetSteamMusic() { return m_pSteamMusic; }
internal static IntPtr GetSteamMusicRemote() { return m_pSteamMusicRemote; }
internal static IntPtr GetSteamHTMLSurface() { return m_pSteamHTMLSurface; }
internal static IntPtr GetSteamInventory() { return m_pSteamInventory; }
internal static IntPtr GetSteamVideo() { return m_pSteamVideo; }
internal static IntPtr GetSteamParentalSettings() { return m_pSteamParentalSettings; }
internal static IntPtr GetSteamInput() { return m_pSteamInput; }
internal static IntPtr GetSteamParties() { return m_pSteamParties; }
internal static IntPtr GetSteamRemotePlay() { return m_pSteamRemotePlay; }
internal static IntPtr GetSteamNetworkingUtils() { return m_pSteamNetworkingUtils; }
internal static IntPtr GetSteamNetworkingSockets() { return m_pSteamNetworkingSockets; }
internal static IntPtr GetSteamNetworkingMessages() { return m_pSteamNetworkingMessages; }
internal static IntPtr GetSteamTimeline() { return m_pSteamTimeline; }
private static IntPtr m_pSteamClient;
private static IntPtr m_pSteamUser;
private static IntPtr m_pSteamFriends;
private static IntPtr m_pSteamUtils;
private static IntPtr m_pSteamMatchmaking;
private static IntPtr m_pSteamUserStats;
private static IntPtr m_pSteamApps;
private static IntPtr m_pSteamMatchmakingServers;
private static IntPtr m_pSteamNetworking;
private static IntPtr m_pSteamRemoteStorage;
private static IntPtr m_pSteamScreenshots;
private static IntPtr m_pSteamGameSearch;
private static IntPtr m_pSteamHTTP;
private static IntPtr m_pController;
private static IntPtr m_pSteamUGC;
private static IntPtr m_pSteamMusic;
private static IntPtr m_pSteamMusicRemote;
private static IntPtr m_pSteamHTMLSurface;
private static IntPtr m_pSteamInventory;
private static IntPtr m_pSteamVideo;
private static IntPtr m_pSteamParentalSettings;
private static IntPtr m_pSteamInput;
private static IntPtr m_pSteamParties;
private static IntPtr m_pSteamRemotePlay;
private static IntPtr m_pSteamNetworkingUtils;
private static IntPtr m_pSteamNetworkingSockets;
private static IntPtr m_pSteamNetworkingMessages;
private static IntPtr m_pSteamTimeline;
}
internal static class CSteamGameServerAPIContext {
internal static void Clear() {
m_pSteamClient = IntPtr.Zero;
m_pSteamGameServer = IntPtr.Zero;
m_pSteamUtils = IntPtr.Zero;
m_pSteamNetworking = IntPtr.Zero;
m_pSteamGameServerStats = IntPtr.Zero;
m_pSteamHTTP = IntPtr.Zero;
m_pSteamInventory = IntPtr.Zero;
m_pSteamUGC = IntPtr.Zero;
m_pSteamNetworkingUtils = IntPtr.Zero;
m_pSteamNetworkingSockets = IntPtr.Zero;
m_pSteamNetworkingMessages = IntPtr.Zero;
}
internal static bool Init() {
HSteamUser hSteamUser = GameServer.GetHSteamUser();
HSteamPipe hSteamPipe = GameServer.GetHSteamPipe();
if (hSteamPipe == (HSteamPipe)0) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMCLIENT_INTERFACE_VERSION)) {
m_pSteamClient = NativeMethods.SteamInternal_CreateInterface(pchVersionString);
}
if (m_pSteamClient == IntPtr.Zero) { return false; }
m_pSteamGameServer = SteamGameServerClient.GetISteamGameServer(hSteamUser, hSteamPipe, Constants.STEAMGAMESERVER_INTERFACE_VERSION);
if (m_pSteamGameServer == IntPtr.Zero) { return false; }
m_pSteamUtils = SteamGameServerClient.GetISteamUtils(hSteamPipe, Constants.STEAMUTILS_INTERFACE_VERSION);
if (m_pSteamUtils == IntPtr.Zero) { return false; }
m_pSteamNetworking = SteamGameServerClient.GetISteamNetworking(hSteamUser, hSteamPipe, Constants.STEAMNETWORKING_INTERFACE_VERSION);
if (m_pSteamNetworking == IntPtr.Zero) { return false; }
m_pSteamGameServerStats = SteamGameServerClient.GetISteamGameServerStats(hSteamUser, hSteamPipe, Constants.STEAMGAMESERVERSTATS_INTERFACE_VERSION);
if (m_pSteamGameServerStats == IntPtr.Zero) { return false; }
m_pSteamHTTP = SteamGameServerClient.GetISteamHTTP(hSteamUser, hSteamPipe, Constants.STEAMHTTP_INTERFACE_VERSION);
if (m_pSteamHTTP == IntPtr.Zero) { return false; }
m_pSteamInventory = SteamGameServerClient.GetISteamInventory(hSteamUser, hSteamPipe, Constants.STEAMINVENTORY_INTERFACE_VERSION);
if (m_pSteamInventory == IntPtr.Zero) { return false; }
m_pSteamUGC = SteamGameServerClient.GetISteamUGC(hSteamUser, hSteamPipe, Constants.STEAMUGC_INTERFACE_VERSION);
if (m_pSteamUGC == IntPtr.Zero) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGUTILS_INTERFACE_VERSION))
{
m_pSteamNetworkingUtils =
NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString) != IntPtr.Zero ?
NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString) :
NativeMethods.SteamInternal_FindOrCreateGameServerInterface(hSteamUser, pchVersionString);
}
if (m_pSteamNetworkingUtils == IntPtr.Zero) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGSOCKETS_INTERFACE_VERSION))
{
m_pSteamNetworkingSockets =
NativeMethods.SteamInternal_FindOrCreateGameServerInterface(hSteamUser, pchVersionString);
}
if (m_pSteamNetworkingSockets == IntPtr.Zero) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGMESSAGES_INTERFACE_VERSION))
{
m_pSteamNetworkingMessages =
NativeMethods.SteamInternal_FindOrCreateGameServerInterface(hSteamUser, pchVersionString);
}
if (m_pSteamNetworkingMessages == IntPtr.Zero) { return false; }
return true;
}
internal static IntPtr GetSteamClient() { return m_pSteamClient; }
internal static IntPtr GetSteamGameServer() { return m_pSteamGameServer; }
internal static IntPtr GetSteamUtils() { return m_pSteamUtils; }
internal static IntPtr GetSteamNetworking() { return m_pSteamNetworking; }
internal static IntPtr GetSteamGameServerStats() { return m_pSteamGameServerStats; }
internal static IntPtr GetSteamHTTP() { return m_pSteamHTTP; }
internal static IntPtr GetSteamInventory() { return m_pSteamInventory; }
internal static IntPtr GetSteamUGC() { return m_pSteamUGC; }
internal static IntPtr GetSteamNetworkingUtils() { return m_pSteamNetworkingUtils; }
internal static IntPtr GetSteamNetworkingSockets() { return m_pSteamNetworkingSockets; }
internal static IntPtr GetSteamNetworkingMessages() { return m_pSteamNetworkingMessages; }
private static IntPtr m_pSteamClient;
private static IntPtr m_pSteamGameServer;
private static IntPtr m_pSteamUtils;
private static IntPtr m_pSteamNetworking;
private static IntPtr m_pSteamGameServerStats;
private static IntPtr m_pSteamHTTP;
private static IntPtr m_pSteamInventory;
private static IntPtr m_pSteamUGC;
private static IntPtr m_pSteamNetworkingUtils;
private static IntPtr m_pSteamNetworkingSockets;
private static IntPtr m_pSteamNetworkingMessages;
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3c098e483776b9b4e9d4fd8af8558ba1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
// 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
namespace Steamworks {
public static class Version {
public const string SteamworksNETVersion = "2024.8.0";
public const string SteamworksSDKVersion = "1.60";
public const string SteamAPIDLLVersion = "08.97.99.70";
public const int SteamAPIDLLSize = 265064;
public const int SteamAPI64DLLSize = 300392;
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 392a7b7ab9d780b4ea56fa9efbd249af
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1214e34c8204bed46a26ab9d7f6b5a7b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 34b11825d034447449147528ae7c6201
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 80afdfc414f63f049bdfae509faaadf7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,338 @@
// 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 Constants {
public const string STEAMAPPS_INTERFACE_VERSION = "STEAMAPPS_INTERFACE_VERSION008";
public const string STEAMAPPTICKET_INTERFACE_VERSION = "STEAMAPPTICKET_INTERFACE_VERSION001";
public const string STEAMCLIENT_INTERFACE_VERSION = "SteamClient021";
public const string STEAMFRIENDS_INTERFACE_VERSION = "SteamFriends017";
public const string STEAMGAMECOORDINATOR_INTERFACE_VERSION = "SteamGameCoordinator001";
public const string STEAMGAMESERVER_INTERFACE_VERSION = "SteamGameServer015";
public const string STEAMGAMESERVERSTATS_INTERFACE_VERSION = "SteamGameServerStats001";
public const string STEAMHTMLSURFACE_INTERFACE_VERSION = "STEAMHTMLSURFACE_INTERFACE_VERSION_005";
public const string STEAMHTTP_INTERFACE_VERSION = "STEAMHTTP_INTERFACE_VERSION003";
public const string STEAMINPUT_INTERFACE_VERSION = "SteamInput006";
public const string STEAMINVENTORY_INTERFACE_VERSION = "STEAMINVENTORY_INTERFACE_V003";
public const string STEAMMATCHMAKING_INTERFACE_VERSION = "SteamMatchMaking009";
public const string STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION = "SteamMatchMakingServers002";
public const string STEAMGAMESEARCH_INTERFACE_VERSION = "SteamMatchGameSearch001";
public const string STEAMPARTIES_INTERFACE_VERSION = "SteamParties002";
public const string STEAMMUSIC_INTERFACE_VERSION = "STEAMMUSIC_INTERFACE_VERSION001";
public const string STEAMMUSICREMOTE_INTERFACE_VERSION = "STEAMMUSICREMOTE_INTERFACE_VERSION001";
public const string STEAMNETWORKING_INTERFACE_VERSION = "SteamNetworking006";
public const string STEAMNETWORKINGMESSAGES_INTERFACE_VERSION = "SteamNetworkingMessages002";
// Silence some warnings
public const string STEAMNETWORKINGSOCKETS_INTERFACE_VERSION = "SteamNetworkingSockets012";
// Silence some warnings
public const string STEAMNETWORKINGUTILS_INTERFACE_VERSION = "SteamNetworkingUtils004";
public const string STEAMPARENTALSETTINGS_INTERFACE_VERSION = "STEAMPARENTALSETTINGS_INTERFACE_VERSION001";
public const string STEAMREMOTEPLAY_INTERFACE_VERSION = "STEAMREMOTEPLAY_INTERFACE_VERSION002";
public const string STEAMREMOTESTORAGE_INTERFACE_VERSION = "STEAMREMOTESTORAGE_INTERFACE_VERSION016";
public const string STEAMSCREENSHOTS_INTERFACE_VERSION = "STEAMSCREENSHOTS_INTERFACE_VERSION003";
public const string STEAMTIMELINE_INTERFACE_VERSION = "STEAMTIMELINE_INTERFACE_V001";
public const string STEAMUGC_INTERFACE_VERSION = "STEAMUGC_INTERFACE_VERSION020";
public const string STEAMUSER_INTERFACE_VERSION = "SteamUser023";
public const string STEAMUSERSTATS_INTERFACE_VERSION = "STEAMUSERSTATS_INTERFACE_VERSION012";
public const string STEAMUTILS_INTERFACE_VERSION = "SteamUtils010";
public const string STEAMVIDEO_INTERFACE_VERSION = "STEAMVIDEO_INTERFACE_V007";
public const int k_cubAppProofOfPurchaseKeyMax = 240; // max supported length of a legacy cd key
// maximum length of friend group name (not including terminating nul!)
public const int k_cchMaxFriendsGroupName = 64;
// maximum number of groups a single user is allowed
public const int k_cFriendsGroupLimit = 100;
public const int k_cEnumerateFollowersMax = 50;
// special values for FriendGameInfo_t::m_usQueryPort
public const ushort k_usFriendGameInfoQueryPort_NotInitialized = 0xFFFF; // We haven't asked the GS for this query port's actual value yet. Was #define QUERY_PORT_NOT_INITIALIZED in older versions of Steamworks SDK.
public const ushort k_usFriendGameInfoQueryPort_Error = 0xFFFE; // We were unable to get the query port for this server. Was #define QUERY_PORT_ERROR in older versions of Steamworks SDK.
// maximum number of characters in a user's name. Two flavors; one for UTF-8 and one for UTF-16.
// The UTF-8 version has to be very generous to accomodate characters that get large when encoded
// in UTF-8.
public const int k_cchPersonaNameMax = 128;
public const int k_cwchPersonaNameMax = 32;
// size limit on chat room or member metadata
public const int k_cubChatMetadataMax = 8192;
// size limits on Rich Presence data
public const int k_cchMaxRichPresenceKeys = 30;
public const int k_cchMaxRichPresenceKeyLength = 64;
public const int k_cchMaxRichPresenceValueLength = 256;
// game server flags
public const int k_unFavoriteFlagNone = 0x00;
public const int k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list
public const int k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list
//-----------------------------------------------------------------------------
// Purpose: Defines the largest allowed file size. Cloud files cannot be written
// in a single chunk over 100MB (and cannot be over 200MB total.)
//-----------------------------------------------------------------------------
public const int k_unMaxCloudFileChunkSize = 100 * 1024 * 1024;
public const int k_cchPublishedDocumentTitleMax = 128 + 1;
public const int k_cchPublishedDocumentDescriptionMax = 8000;
public const int k_cchPublishedDocumentChangeDescriptionMax = 8000;
public const int k_unEnumeratePublishedFilesMaxResults = 50;
public const int k_cchTagListMax = 1024 + 1;
public const int k_cchFilenameMax = 260;
public const int k_cchPublishedFileURLMax = 256;
public const int k_nScreenshotMaxTaggedUsers = 32;
public const int k_nScreenshotMaxTaggedPublishedFiles = 32;
public const int k_cubUFSTagTypeMax = 255;
public const int k_cubUFSTagValueMax = 255;
// Required with of a thumbnail provided to AddScreenshotToLibrary. If you do not provide a thumbnail
// one will be generated.
public const int k_ScreenshotThumbWidth = 200;
public const int k_unMaxTimelinePriority = 1000;
public const float k_flMaxTimelineEventDuration = 600.0f;
public const int kNumUGCResultsPerPage = 50;
public const int k_cchDeveloperMetadataMax = 5000;
public const int k_nCubTicketMaxLength = 2560;
// size limit on stat or achievement name (UTF-8 encoded)
public const int k_cchStatNameMax = 128;
// maximum number of bytes for a leaderboard name (UTF-8 encoded)
public const int k_cchLeaderboardNameMax = 128;
// maximum number of details int32's storable for a single leaderboard entry
public const int k_cLeaderboardDetailsMax = 64;
//
// Max size (in bytes of UTF-8 data, not in characters) of server fields, including null terminator.
// WARNING: These cannot be changed easily, without breaking clients using old interfaces.
//
public const int k_cbMaxGameServerGameDir = 32;
public const int k_cbMaxGameServerMapName = 32;
public const int k_cbMaxGameServerGameDescription = 64;
public const int k_cbMaxGameServerName = 64;
public const int k_cbMaxGameServerTags = 128;
public const int k_cbMaxGameServerGameData = 2048;
// A fixed size buffer to receive an error message that is returned by some API
// calls.
public const int k_cchMaxSteamErrMsg = 1024;
// Forward declare types
//-----------------------------------------------------------------------------
// Purpose: Base values for callback identifiers, each callback must
// have a unique ID.
//-----------------------------------------------------------------------------
public const int k_iSteamUserCallbacks = 100;
public const int k_iSteamGameServerCallbacks = 200;
public const int k_iSteamFriendsCallbacks = 300;
public const int k_iSteamBillingCallbacks = 400;
public const int k_iSteamMatchmakingCallbacks = 500;
public const int k_iSteamContentServerCallbacks = 600;
public const int k_iSteamUtilsCallbacks = 700;
public const int k_iSteamAppsCallbacks = 1000;
public const int k_iSteamUserStatsCallbacks = 1100;
public const int k_iSteamNetworkingCallbacks = 1200;
public const int k_iSteamNetworkingSocketsCallbacks = 1220;
public const int k_iSteamNetworkingMessagesCallbacks = 1250;
public const int k_iSteamNetworkingUtilsCallbacks = 1280;
public const int k_iSteamRemoteStorageCallbacks = 1300;
public const int k_iSteamGameServerItemsCallbacks = 1500;
public const int k_iSteamGameCoordinatorCallbacks = 1700;
public const int k_iSteamGameServerStatsCallbacks = 1800;
public const int k_iSteam2AsyncCallbacks = 1900;
public const int k_iSteamGameStatsCallbacks = 2000;
public const int k_iSteamHTTPCallbacks = 2100;
public const int k_iSteamScreenshotsCallbacks = 2300;
// NOTE: 2500-2599 are reserved
public const int k_iSteamStreamLauncherCallbacks = 2600;
public const int k_iSteamControllerCallbacks = 2800;
public const int k_iSteamUGCCallbacks = 3400;
public const int k_iSteamStreamClientCallbacks = 3500;
public const int k_iSteamMusicCallbacks = 4000;
public const int k_iSteamMusicRemoteCallbacks = 4100;
public const int k_iSteamGameNotificationCallbacks = 4400;
public const int k_iSteamHTMLSurfaceCallbacks = 4500;
public const int k_iSteamVideoCallbacks = 4600;
public const int k_iSteamInventoryCallbacks = 4700;
public const int k_ISteamParentalSettingsCallbacks = 5000;
public const int k_iSteamGameSearchCallbacks = 5200;
public const int k_iSteamPartiesCallbacks = 5300;
public const int k_iSteamSTARCallbacks = 5500;
public const int k_iSteamRemotePlayCallbacks = 5700;
public const int k_iSteamChatCallbacks = 5900;
public const int k_iSteamTimelineCallbacks = 6000;
/// Pass to SteamGameServer_Init to indicate that the same UDP port will be used for game traffic
/// UDP queries for server browser pings and LAN discovery. In this case, Steam will not open up a
/// socket to handle server browser queries, and you must use ISteamGameServer::HandleIncomingPacket
/// and ISteamGameServer::GetNextOutgoingPacket to handle packets related to server discovery on your socket.
public const ushort STEAMGAMESERVER_QUERY_PORT_SHARED = 0xffff;
public const int k_unSteamAccountIDMask = -1;
public const int k_unSteamAccountInstanceMask = 0x000FFFFF;
public const int k_unSteamUserDefaultInstance = 1; // fixed instance for all individual users
public const int k_cchGameExtraInfoMax = 64;
public const int k_nSteamEncryptedAppTicketSymmetricKeyLen = 32;
/// Port number(s) assigned to us. Only the first entries will contain
/// nonzero values. Entries corresponding to ports beyond what was
/// allocated for you will be zero.
///
/// (NOTE: At the time of this writing, the maximum number of ports you may
/// request is 4.)
public const int k_nMaxReturnPorts = 8;
/// Max length of diagnostic error message
public const int k_cchMaxSteamNetworkingErrMsg = 1024;
/// Max length, in bytes (including null terminator) of the reason string
/// when a connection is closed.
public const int k_cchSteamNetworkingMaxConnectionCloseReason = 128;
/// Max length, in bytes (include null terminator) of debug description
/// of a connection.
public const int k_cchSteamNetworkingMaxConnectionDescription = 128;
/// Max length of the app's part of the description
public const int k_cchSteamNetworkingMaxConnectionAppName = 32;
public const int k_nSteamNetworkConnectionInfoFlags_Unauthenticated = 1; // We don't have a certificate for the remote host.
public const int k_nSteamNetworkConnectionInfoFlags_Unencrypted = 2; // Information is being sent out over a wire unencrypted (by this library)
public const int k_nSteamNetworkConnectionInfoFlags_LoopbackBuffers = 4; // Internal loopback buffers. Won't be true for localhost. (You can check the address to determine that.) This implies k_nSteamNetworkConnectionInfoFlags_FastLAN
public const int k_nSteamNetworkConnectionInfoFlags_Fast = 8; // The connection is "fast" and "reliable". Either internal/localhost (check the address to find out), or the peer is on the same LAN. (Probably. It's based on the address and the ping time, this is actually hard to determine unambiguously).
public const int k_nSteamNetworkConnectionInfoFlags_Relayed = 16; // The connection is relayed somehow (SDR or TURN).
public const int k_nSteamNetworkConnectionInfoFlags_DualWifi = 32; // We're taking advantage of dual-wifi multi-path
//
// Network messages
//
/// Max size of a single message that we can SEND.
/// Note: We might be wiling to receive larger messages,
/// and our peer might, too.
public const int k_cbMaxSteamNetworkingSocketsMessageSizeSend = 512 * 1024;
//
// Flags used to set options for message sending
//
// Send the message unreliably. Can be lost. Messages *can* be larger than a
// single MTU (UDP packet), but there is no retransmission, so if any piece
// of the message is lost, the entire message will be dropped.
//
// The sending API does have some knowledge of the underlying connection, so
// if there is no NAT-traversal accomplished or there is a recognized adjustment
// happening on the connection, the packet will be batched until the connection
// is open again.
//
// Migration note: This is not exactly the same as k_EP2PSendUnreliable! You
// probably want k_ESteamNetworkingSendType_UnreliableNoNagle
public const int k_nSteamNetworkingSend_Unreliable = 0;
// Disable Nagle's algorithm.
// By default, Nagle's algorithm is applied to all outbound messages. This means
// that the message will NOT be sent immediately, in case further messages are
// sent soon after you send this, which can be grouped together. Any time there
// is enough buffered data to fill a packet, the packets will be pushed out immediately,
// but partially-full packets not be sent until the Nagle timer expires. See
// ISteamNetworkingSockets::FlushMessagesOnConnection, ISteamNetworkingMessages::FlushMessagesToUser
//
// NOTE: Don't just send every message without Nagle because you want packets to get there
// quicker. Make sure you understand the problem that Nagle is solving before disabling it.
// If you are sending small messages, often many at the same time, then it is very likely that
// it will be more efficient to leave Nagle enabled. A typical proper use of this flag is
// when you are sending what you know will be the last message sent for a while (e.g. the last
// in the server simulation tick to a particular client), and you use this flag to flush all
// messages.
public const int k_nSteamNetworkingSend_NoNagle = 1;
// Send a message unreliably, bypassing Nagle's algorithm for this message and any messages
// currently pending on the Nagle timer. This is equivalent to using k_ESteamNetworkingSend_Unreliable
// and then immediately flushing the messages using ISteamNetworkingSockets::FlushMessagesOnConnection
// or ISteamNetworkingMessages::FlushMessagesToUser. (But using this flag is more efficient since you
// only make one API call.)
public const int k_nSteamNetworkingSend_UnreliableNoNagle = k_nSteamNetworkingSend_Unreliable|k_nSteamNetworkingSend_NoNagle;
// If the message cannot be sent very soon (because the connection is still doing some initial
// handshaking, route negotiations, etc), then just drop it. This is only applicable for unreliable
// messages. Using this flag on reliable messages is invalid.
public const int k_nSteamNetworkingSend_NoDelay = 4;
// Send an unreliable message, but if it cannot be sent relatively quickly, just drop it instead of queuing it.
// This is useful for messages that are not useful if they are excessively delayed, such as voice data.
// NOTE: The Nagle algorithm is not used, and if the message is not dropped, any messages waiting on the
// Nagle timer are immediately flushed.
//
// A message will be dropped under the following circumstances:
// - the connection is not fully connected. (E.g. the "Connecting" or "FindingRoute" states)
// - there is a sufficiently large number of messages queued up already such that the current message
// will not be placed on the wire in the next ~200ms or so.
//
// If a message is dropped for these reasons, k_EResultIgnored will be returned.
public const int k_nSteamNetworkingSend_UnreliableNoDelay = k_nSteamNetworkingSend_Unreliable|k_nSteamNetworkingSend_NoDelay|k_nSteamNetworkingSend_NoNagle;
// Reliable message send. Can send up to k_cbMaxSteamNetworkingSocketsMessageSizeSend bytes in a single message.
// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for
// efficient sends of large chunks of data.
//
// The Nagle algorithm is used. See notes on k_ESteamNetworkingSendType_Unreliable for more details.
// See k_ESteamNetworkingSendType_ReliableNoNagle, ISteamNetworkingSockets::FlushMessagesOnConnection,
// ISteamNetworkingMessages::FlushMessagesToUser
//
// Migration note: This is NOT the same as k_EP2PSendReliable, it's more like k_EP2PSendReliableWithBuffering
public const int k_nSteamNetworkingSend_Reliable = 8;
// Send a message reliably, but bypass Nagle's algorithm.
//
// Migration note: This is equivalent to k_EP2PSendReliable
public const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable|k_nSteamNetworkingSend_NoNagle;
// By default, message sending is queued, and the work of encryption and talking to
// the operating system sockets, etc is done on a service thread. This is usually a
// a performance win when messages are sent from the "main thread". However, if this
// flag is set, and data is ready to be sent immediately (either from this message
// or earlier queued data), then that work will be done in the current thread, before
// the current call returns. If data is not ready to be sent (due to rate limiting
// or Nagle), then this flag has no effect.
//
// This is an advanced flag used to control performance at a very low level. For
// most applications running on modern hardware with more than one CPU core, doing
// the work of sending on a service thread will yield the best performance. Only
// use this flag if you have a really good reason and understand what you are doing.
// Otherwise you will probably just make performance worse.
public const int k_nSteamNetworkingSend_UseCurrentThread = 16;
// When sending a message using ISteamNetworkingMessages, automatically re-establish
// a broken session, without returning k_EResultNoConnection. Without this flag,
// if you attempt to send a message, and the session was proactively closed by the
// peer, or an error occurred that disrupted communications, then you must close the
// session using ISteamNetworkingMessages::CloseSessionWithUser before attempting to
// send another message. (Or you can simply add this flag and retry.) In this way,
// the disruption cannot go unnoticed, and a more clear order of events can be
// ascertained. This is especially important when reliable messages are used, since
// if the connection is disrupted, some of those messages will not have been delivered,
// and it is in general not possible to know which. Although a
// SteamNetworkingMessagesSessionFailed_t callback will be posted when an error occurs
// to notify you that a failure has happened, callbacks are asynchronous, so it is not
// possible to tell exactly when it happened. And because the primary purpose of
// ISteamNetworkingMessages is to be like UDP, there is no notification when a peer closes
// the session.
//
// If you are not using any reliable messages (e.g. you are using ISteamNetworkingMessages
// exactly as a transport replacement for UDP-style datagrams only), you may not need to
// know when an underlying connection fails, and so you may not need this notification.
public const int k_nSteamNetworkingSend_AutoRestartBrokenSession = 32;
/// Max possible length of a ping location, in string format. This is
/// an extremely conservative worst case value which leaves room for future
/// syntax enhancements. Most strings in practice are a lot shorter.
/// If you are storing many of these, you will very likely benefit from
/// using dynamic memory.
public const int k_cchMaxSteamNetworkingPingLocationString = 1024;
/// Special values that are returned by some functions that return a ping.
public const int k_nSteamNetworkingPing_Failed = -1;
public const int k_nSteamNetworkingPing_Unknown = -2;
// Bitmask of types to share
public const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Default = -1; // Special value - use user defaults
public const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Disable = 0; // Do not do any ICE work at all or share any IP addresses with peer
public const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Relay = 1; // Relayed connection via TURN server.
public const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Private = 2; // host addresses that appear to be link-local or RFC1918 addresses
public const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Public = 4; // STUN reflexive addresses, or host address that isn't a "private" address
public const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_All = 0x7fffffff;
public const ulong k_ulPartyBeaconIdInvalid = 0;
public const int INVALID_HTTPREQUEST_HANDLE = 0;
public const int STEAM_INPUT_MAX_COUNT = 16;
public const int STEAM_INPUT_MAX_ANALOG_ACTIONS = 24;
public const int STEAM_INPUT_MAX_DIGITAL_ACTIONS = 256;
public const int STEAM_INPUT_MAX_ORIGINS = 8;
public const int STEAM_INPUT_MAX_ACTIVE_LAYERS = 16;
// When sending an option to a specific controller handle, you can send to all devices via this command
public const ulong STEAM_INPUT_HANDLE_ALL_CONTROLLERS = 0xFFFFFFFFFFFFFFFF;
public const float STEAM_INPUT_MIN_ANALOG_ACTION_DATA = -1.0f;
public const float STEAM_INPUT_MAX_ANALOG_ACTION_DATA = 1.0f;
// maximum number of characters a lobby metadata key can be
public const byte k_nMaxLobbyKeyLength = 255;
public const int k_SteamMusicNameMaxLength = 255;
public const int k_SteamMusicPNGMaxLength = 65535;
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: faa542b98284c9a40a8b61bf0977c97b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e736b081fa90e7d4b89c2062fd2c6526
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,402 @@
// 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 {
// friend game played information
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct FriendGameInfo_t {
public CGameID m_gameID;
public uint m_unGameIP;
public ushort m_usGamePort;
public ushort m_usQueryPort;
public CSteamID m_steamIDLobby;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct InputAnalogActionData_t {
// Type of data coming from this action, this will match what got specified in the action set
public EInputSourceMode eMode;
// The current state of this action; will be delta updates for mouse actions
public float x, y;
// Whether or not this action is currently available to be bound in the active action set
public byte bActive;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct InputDigitalActionData_t {
// The current state of this action; will be true if currently pressed
public byte bState;
// Whether or not this action is currently available to be bound in the active action set
public byte bActive;
}
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct InputMotionData_t {
// Sensor-fused absolute rotation; will drift in heading toward average
public float rotQuatX;
public float rotQuatY;
public float rotQuatZ;
public float rotQuatW;
// Positional acceleration
public float posAccelX;
public float posAccelY;
public float posAccelZ;
// Angular velocity
public float rotVelX;
public float rotVelY;
public float rotVelZ;
}
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct SteamItemDetails_t {
public SteamItemInstanceID_t m_itemId;
public SteamItemDef_t m_iDefinition;
public ushort m_unQuantity;
public ushort m_unFlags; // see ESteamItemFlags
}
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct SteamPartyBeaconLocation_t {
public ESteamPartyBeaconLocationType m_eType;
public ulong m_ulLocationID;
}
// connection state to a specified user, returned by GetP2PSessionState()
// this is under-the-hood info about what's going on with a SendP2PPacket(), shouldn't be needed except for debuggin
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct P2PSessionState_t {
public byte m_bConnectionActive; // true if we've got an active open connection
public byte m_bConnecting; // true if we're currently trying to establish a connection
public byte m_eP2PSessionError; // last error recorded (see enum above)
public byte m_bUsingRelay; // true if it's going through a relay server (TURN)
public int m_nBytesQueuedForSend;
public int m_nPacketsQueuedForSend;
public uint m_nRemoteIP; // potential IP:Port of remote host. Could be TURN server.
public ushort m_nRemotePort; // Only exists for compatibility with older authentication api's
}
//-----------------------------------------------------------------------------
// Purpose: Structure that contains an array of const char * strings and the number of those strings
//-----------------------------------------------------------------------------
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct SteamParamStringArray_t {
public IntPtr m_ppStrings;
public int m_nNumStrings;
}
// Details for a single published file/UGC
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct SteamUGCDetails_t {
public PublishedFileId_t m_nPublishedFileId;
public EResult m_eResult; // The result of the operation.
public EWorkshopFileType m_eFileType; // Type of the file
public AppId_t m_nCreatorAppID; // ID of the app that created this file.
public AppId_t m_nConsumerAppID; // ID of the app that will consume this file.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.k_cchPublishedDocumentTitleMax)]
private byte[] m_rgchTitle_;
public string m_rgchTitle // title of document
{
get { return InteropHelp.ByteArrayToStringUTF8(m_rgchTitle_); }
set { InteropHelp.StringToByteArrayUTF8(value, m_rgchTitle_, Constants.k_cchPublishedDocumentTitleMax); }
}
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.k_cchPublishedDocumentDescriptionMax)]
private byte[] m_rgchDescription_;
public string m_rgchDescription // description of document
{
get { return InteropHelp.ByteArrayToStringUTF8(m_rgchDescription_); }
set { InteropHelp.StringToByteArrayUTF8(value, m_rgchDescription_, Constants.k_cchPublishedDocumentDescriptionMax); }
}
public ulong m_ulSteamIDOwner; // Steam ID of the user who created this content.
public uint m_rtimeCreated; // time when the published file was created
public uint m_rtimeUpdated; // time when the published file was last updated
public uint m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable)
public ERemoteStoragePublishedFileVisibility m_eVisibility; // visibility
[MarshalAs(UnmanagedType.I1)]
public bool m_bBanned; // whether the file was banned
[MarshalAs(UnmanagedType.I1)]
public bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop
[MarshalAs(UnmanagedType.I1)]
public bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.k_cchTagListMax)]
private byte[] m_rgchTags_;
public string m_rgchTags // comma separated list of all tags associated with this file
{
get { return InteropHelp.ByteArrayToStringUTF8(m_rgchTags_); }
set { InteropHelp.StringToByteArrayUTF8(value, m_rgchTags_, Constants.k_cchTagListMax); }
}
// file/url information
public UGCHandle_t m_hFile; // The handle of the primary file
public UGCHandle_t m_hPreviewFile; // The handle of the preview file
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.k_cchFilenameMax)]
private byte[] m_pchFileName_;
public string m_pchFileName // The cloud filename of the primary file
{
get { return InteropHelp.ByteArrayToStringUTF8(m_pchFileName_); }
set { InteropHelp.StringToByteArrayUTF8(value, m_pchFileName_, Constants.k_cchFilenameMax); }
}
public int m_nFileSize; // Size of the primary file (for legacy items which only support one file). This may not be accurate for non-legacy items which can be greater than 4gb in size.
public int m_nPreviewFileSize; // Size of the preview file
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.k_cchPublishedFileURLMax)]
private byte[] m_rgchURL_;
public string m_rgchURL // URL (for a video or a website)
{
get { return InteropHelp.ByteArrayToStringUTF8(m_rgchURL_); }
set { InteropHelp.StringToByteArrayUTF8(value, m_rgchURL_, Constants.k_cchPublishedFileURLMax); }
}
// voting information
public uint m_unVotesUp; // number of votes up
public uint m_unVotesDown; // number of votes down
public float m_flScore; // calculated score
// collection details
public uint m_unNumChildren;
public ulong m_ulTotalFilesSize; // Total size of all files (non-legacy), excluding the preview file
}
// a single entry in a leaderboard, as returned by GetDownloadedLeaderboardEntry()
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct LeaderboardEntry_t {
public CSteamID m_steamIDUser; // user with the entry - use SteamFriends()->GetFriendPersonaName() & SteamFriends()->GetFriendAvatar() to get more info
public int m_nGlobalRank; // [1..N], where N is the number of users with an entry in the leaderboard
public int m_nScore; // score as set in the leaderboard
public int m_cDetails; // number of int32 details available for this entry
public UGCHandle_t m_hUGC; // handle for UGC attached to the entry
}
/// Store key/value pair used in matchmaking queries.
///
/// Actually, the name Key/Value is a bit misleading. The "key" is better
/// understood as "filter operation code" and the "value" is the operand to this
/// filter operation. The meaning of the operand depends upon the filter.
[StructLayout(LayoutKind.Sequential)]
public struct MatchMakingKeyValuePair_t {
MatchMakingKeyValuePair_t(string strKey, string strValue) {
m_szKey = strKey;
m_szValue = strValue;
}
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string m_szKey;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string m_szValue;
}
// structure that contains client callback data
// see callbacks documentation for more details
/// Internal structure used in manual callback dispatch
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct CallbackMsg_t {
public int m_hSteamUser; // Specific user to whom this callback applies.
public int m_iCallback; // Callback identifier. (Corresponds to the k_iCallback enum in the callback structure.)
public IntPtr m_pubParam; // Points to the callback structure
public int m_cubParam; // Size of the data pointed to by m_pubParam
}
/// Describe the state of a connection.
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct SteamNetConnectionInfo_t {
/// Who is on the other end? Depending on the connection type and phase of the connection, we might not know
public SteamNetworkingIdentity m_identityRemote;
/// Arbitrary user data set by the local application code
public long m_nUserData;
/// Handle to listen socket this was connected on, or k_HSteamListenSocket_Invalid if we initiated the connection
public HSteamListenSocket m_hListenSocket;
/// Remote address. Might be all 0's if we don't know it, or if this is N/A.
/// (E.g. Basically everything except direct UDP connection.)
public SteamNetworkingIPAddr m_addrRemote;
public ushort m__pad1;
/// What data center is the remote host in? (0 if we don't know.)
public SteamNetworkingPOPID m_idPOPRemote;
/// What relay are we using to communicate with the remote host?
/// (0 if not applicable.)
public SteamNetworkingPOPID m_idPOPRelay;
/// High level state of the connection
public ESteamNetworkingConnectionState m_eState;
/// Basic cause of the connection termination or problem.
/// See ESteamNetConnectionEnd for the values used
public int m_eEndReason;
/// Human-readable, but non-localized explanation for connection
/// termination or problem. This is intended for debugging /
/// diagnostic purposes only, not to display to users. It might
/// have some details specific to the issue.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.k_cchSteamNetworkingMaxConnectionCloseReason)]
private byte[] m_szEndDebug_;
public string m_szEndDebug
{
get { return InteropHelp.ByteArrayToStringUTF8(m_szEndDebug_); }
set { InteropHelp.StringToByteArrayUTF8(value, m_szEndDebug_, Constants.k_cchSteamNetworkingMaxConnectionCloseReason); }
}
/// Debug description. This includes the internal connection ID,
/// connection type (and peer information), and any name
/// given to the connection by the app. This string is used in various
/// internal logging messages.
///
/// Note that the connection ID *usually* matches the HSteamNetConnection
/// handle, but in certain cases with symmetric connections it might not.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.k_cchSteamNetworkingMaxConnectionDescription)]
private byte[] m_szConnectionDescription_;
public string m_szConnectionDescription
{
get { return InteropHelp.ByteArrayToStringUTF8(m_szConnectionDescription_); }
set { InteropHelp.StringToByteArrayUTF8(value, m_szConnectionDescription_, Constants.k_cchSteamNetworkingMaxConnectionDescription); }
}
/// Misc flags. Bitmask of k_nSteamNetworkConnectionInfoFlags_Xxxx
public int m_nFlags;
/// Internal stuff, room to change API easily
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)]
public uint[] reserved;
}
/// Quick connection state, pared down to something you could call
/// more frequently without it being too big of a perf hit.
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct SteamNetConnectionRealTimeStatus_t {
/// High level state of the connection
public ESteamNetworkingConnectionState m_eState;
/// Current ping (ms)
public int m_nPing;
/// Connection quality measured locally, 0...1. (Percentage of packets delivered
/// end-to-end in order).
public float m_flConnectionQualityLocal;
/// Packet delivery success rate as observed from remote host
public float m_flConnectionQualityRemote;
/// Current data rates from recent history.
public float m_flOutPacketsPerSec;
public float m_flOutBytesPerSec;
public float m_flInPacketsPerSec;
public float m_flInBytesPerSec;
/// Estimate rate that we believe that we can send data to our peer.
/// Note that this could be significantly higher than m_flOutBytesPerSec,
/// meaning the capacity of the channel is higher than you are sending data.
/// (That's OK!)
public int m_nSendRateBytesPerSecond;
/// Number of bytes pending to be sent. This is data that you have recently
/// requested to be sent but has not yet actually been put on the wire. The
/// reliable number ALSO includes data that was previously placed on the wire,
/// but has now been scheduled for re-transmission. Thus, it's possible to
/// observe m_cbPendingReliable increasing between two checks, even if no
/// calls were made to send reliable data between the checks. Data that is
/// awaiting the Nagle delay will appear in these numbers.
public int m_cbPendingUnreliable;
public int m_cbPendingReliable;
/// Number of bytes of reliable data that has been placed the wire, but
/// for which we have not yet received an acknowledgment, and thus we may
/// have to re-transmit.
public int m_cbSentUnackedReliable;
/// If you queued a message right now, approximately how long would that message
/// wait in the queue before we actually started putting its data on the wire in
/// a packet?
///
/// In general, data that is sent by the application is limited by the bandwidth
/// of the channel. If you send data faster than this, it must be queued and
/// put on the wire at a metered rate. Even sending a small amount of data (e.g.
/// a few MTU, say ~3k) will require some of the data to be delayed a bit.
///
/// Ignoring multiple lanes, the estimated delay will be approximately equal to
///
/// ( m_cbPendingUnreliable+m_cbPendingReliable ) / m_nSendRateBytesPerSecond
///
/// plus or minus one MTU. It depends on how much time has elapsed since the last
/// packet was put on the wire. For example, the queue might have *just* been emptied,
/// and the last packet placed on the wire, and we are exactly up against the send
/// rate limit. In that case we might need to wait for one packet's worth of time to
/// elapse before we can send again. On the other extreme, the queue might have data
/// in it waiting for Nagle. (This will always be less than one packet, because as
/// soon as we have a complete packet we would send it.) In that case, we might be
/// ready to send data now, and this value will be 0.
///
/// This value is only valid if multiple lanes are not used. If multiple lanes are
/// in use, then the queue time will be different for each lane, and you must use
/// the value in SteamNetConnectionRealTimeLaneStatus_t.
///
/// Nagle delay is ignored for the purposes of this calculation.
public SteamNetworkingMicroseconds m_usecQueueTime;
// Internal stuff, room to change API easily
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public uint[] reserved;
}
/// Quick status of a particular lane
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct SteamNetConnectionRealTimeLaneStatus_t {
// Counters for this particular lane. See the corresponding variables
// in SteamNetConnectionRealTimeStatus_t
public int m_cbPendingUnreliable;
public int m_cbPendingReliable;
public int m_cbSentUnackedReliable;
public int _reservePad1; // Reserved for future use
/// Lane-specific queue time. This value takes into consideration lane priorities
/// and weights, and how much data is queued in each lane, and attempts to predict
/// how any data currently queued will be sent out.
public SteamNetworkingMicroseconds m_usecQueueTime;
// Internal stuff, room to change API easily
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public uint[] reserved;
}
//
// Ping location / measurement
//
/// Object that describes a "location" on the Internet with sufficient
/// detail that we can reasonably estimate an upper bound on the ping between
/// the two hosts, even if a direct route between the hosts is not possible,
/// and the connection must be routed through the Steam Datagram Relay network.
/// This does not contain any information that identifies the host. Indeed,
/// if two hosts are in the same building or otherwise have nearly identical
/// networking characteristics, then it's valid to use the same location
/// object for both of them.
///
/// NOTE: This object should only be used in the same process! Do not serialize it,
/// send it over the wire, or persist it in a file or database! If you need
/// to do that, convert it to a string representation using the methods in
/// ISteamNetworkingUtils().
[StructLayout(LayoutKind.Sequential, Pack = Packsize.value)]
public struct SteamNetworkPingLocation_t {
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
public byte[] m_data;
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d968b64f163754c49be340a5b8ddd933
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,311 @@
// 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 &amp; 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/&lt;appid&gt;//?param1=value1&amp;param2=value2&amp;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 associated 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/&lt;appid&gt;//&lt;command line&gt;/.</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);
}
/// <summary>
/// <para> returns total number of known app beta branches (including default "public" branch )</para>
/// </summary>
public static int GetNumBetas(out int pnAvailable, out int pnPrivate) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamApps_GetNumBetas(CSteamAPIContext.GetSteamApps(), out pnAvailable, out pnPrivate);
}
/// <summary>
/// <para> return beta branch details, name, description, current BuildID and state flags (EBetaBranchFlags)</para>
/// <para> iterate through</para>
/// </summary>
public static bool GetBetaInfo(int iBetaIndex, out uint punFlags, out uint punBuildID, out string pchBetaName, int cchBetaName, out string pchDescription, int cchDescription) {
InteropHelp.TestIfAvailableClient();
IntPtr pchBetaName2 = Marshal.AllocHGlobal(cchBetaName);
IntPtr pchDescription2 = Marshal.AllocHGlobal(cchDescription);
bool ret = NativeMethods.ISteamApps_GetBetaInfo(CSteamAPIContext.GetSteamApps(), iBetaIndex, out punFlags, out punBuildID, pchBetaName2, cchBetaName, pchDescription2, cchDescription);
pchBetaName = ret ? InteropHelp.PtrToStringUTF8(pchBetaName2) : null;
Marshal.FreeHGlobal(pchBetaName2);
pchDescription = ret ? InteropHelp.PtrToStringUTF8(pchDescription2) : null;
Marshal.FreeHGlobal(pchDescription2);
return ret;
}
/// <summary>
/// <para> select this beta branch for this app as active, might need the game to restart so Steam can update to that branch</para>
/// </summary>
public static bool SetActiveBeta(string pchBetaName) {
InteropHelp.TestIfAvailableClient();
using (var pchBetaName2 = new InteropHelp.UTF8StringHandle(pchBetaName)) {
return NativeMethods.ISteamApps_SetActiveBeta(CSteamAPIContext.GetSteamApps(), pchBetaName2);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fc5c59b2b2e521b42a6c112e0497310a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,366 @@
// 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 SteamClient {
/// <summary>
/// <para> Creates a communication pipe to the Steam client.</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static HSteamPipe CreateSteamPipe() {
InteropHelp.TestIfAvailableClient();
return (HSteamPipe)NativeMethods.ISteamClient_CreateSteamPipe(CSteamAPIContext.GetSteamClient());
}
/// <summary>
/// <para> Releases a previously created communications pipe</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static bool BReleaseSteamPipe(HSteamPipe hSteamPipe) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamClient_BReleaseSteamPipe(CSteamAPIContext.GetSteamClient(), hSteamPipe);
}
/// <summary>
/// <para> connects to an existing global user, failing if none exists</para>
/// <para> used by the game to coordinate with the steamUI</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static HSteamUser ConnectToGlobalUser(HSteamPipe hSteamPipe) {
InteropHelp.TestIfAvailableClient();
return (HSteamUser)NativeMethods.ISteamClient_ConnectToGlobalUser(CSteamAPIContext.GetSteamClient(), hSteamPipe);
}
/// <summary>
/// <para> used by game servers, create a steam user that won't be shared with anyone else</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static HSteamUser CreateLocalUser(out HSteamPipe phSteamPipe, EAccountType eAccountType) {
InteropHelp.TestIfAvailableClient();
return (HSteamUser)NativeMethods.ISteamClient_CreateLocalUser(CSteamAPIContext.GetSteamClient(), out phSteamPipe, eAccountType);
}
/// <summary>
/// <para> removes an allocated user</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static void ReleaseUser(HSteamPipe hSteamPipe, HSteamUser hUser) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamClient_ReleaseUser(CSteamAPIContext.GetSteamClient(), hSteamPipe, hUser);
}
/// <summary>
/// <para> retrieves the ISteamUser interface associated with the handle</para>
/// </summary>
public static IntPtr GetISteamUser(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamUser(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> retrieves the ISteamGameServer interface associated with the handle</para>
/// </summary>
public static IntPtr GetISteamGameServer(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamGameServer(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> set the local IP and Port to bind to</para>
/// <para> this must be set before CreateLocalUser()</para>
/// </summary>
public static void SetLocalIPBinding(ref SteamIPAddress_t unIP, ushort usPort) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamClient_SetLocalIPBinding(CSteamAPIContext.GetSteamClient(), ref unIP, usPort);
}
/// <summary>
/// <para> returns the ISteamFriends interface</para>
/// </summary>
public static IntPtr GetISteamFriends(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamFriends(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamUtils interface</para>
/// </summary>
public static IntPtr GetISteamUtils(HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamUtils(CSteamAPIContext.GetSteamClient(), hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamMatchmaking interface</para>
/// </summary>
public static IntPtr GetISteamMatchmaking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamMatchmaking(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamMatchmakingServers interface</para>
/// </summary>
public static IntPtr GetISteamMatchmakingServers(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamMatchmakingServers(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the a generic interface</para>
/// </summary>
public static IntPtr GetISteamGenericInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamGenericInterface(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamUserStats interface</para>
/// </summary>
public static IntPtr GetISteamUserStats(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamUserStats(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamGameServerStats interface</para>
/// </summary>
public static IntPtr GetISteamGameServerStats(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamGameServerStats(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns apps interface</para>
/// </summary>
public static IntPtr GetISteamApps(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamApps(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> networking</para>
/// </summary>
public static IntPtr GetISteamNetworking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamNetworking(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> remote storage</para>
/// </summary>
public static IntPtr GetISteamRemoteStorage(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamRemoteStorage(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> user screenshots</para>
/// </summary>
public static IntPtr GetISteamScreenshots(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamScreenshots(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> game search</para>
/// </summary>
public static IntPtr GetISteamGameSearch(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamGameSearch(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the number of IPC calls made since the last time this function was called</para>
/// <para> Used for perf debugging so you can understand how many IPC calls your game makes per frame</para>
/// <para> Every IPC call is at minimum a thread context switch if not a process one so you want to rate</para>
/// <para> control how often you do them.</para>
/// </summary>
public static uint GetIPCCallCount() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamClient_GetIPCCallCount(CSteamAPIContext.GetSteamClient());
}
/// <summary>
/// <para> API warning handling</para>
/// <para> 'int' is the severity; 0 for msg, 1 for warning</para>
/// <para> 'const char *' is the text of the message</para>
/// <para> callbacks will occur directly after the API function is called that generated the warning or message.</para>
/// </summary>
public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamClient_SetWarningMessageHook(CSteamAPIContext.GetSteamClient(), pFunction);
}
/// <summary>
/// <para> Trigger global shutdown for the DLL</para>
/// </summary>
public static bool BShutdownIfAllPipesClosed() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamClient_BShutdownIfAllPipesClosed(CSteamAPIContext.GetSteamClient());
}
/// <summary>
/// <para> Expose HTTP interface</para>
/// </summary>
public static IntPtr GetISteamHTTP(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamHTTP(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Exposes the ISteamController interface - deprecated in favor of Steam Input</para>
/// </summary>
public static IntPtr GetISteamController(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamController(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Exposes the ISteamUGC interface</para>
/// </summary>
public static IntPtr GetISteamUGC(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamUGC(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Music Player</para>
/// </summary>
public static IntPtr GetISteamMusic(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamMusic(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Music Player Remote</para>
/// </summary>
public static IntPtr GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamMusicRemote(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> html page display</para>
/// </summary>
public static IntPtr GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamHTMLSurface(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> inventory</para>
/// </summary>
public static IntPtr GetISteamInventory(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamInventory(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Video</para>
/// </summary>
public static IntPtr GetISteamVideo(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamVideo(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Parental controls</para>
/// </summary>
public static IntPtr GetISteamParentalSettings(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamParentalSettings(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Exposes the Steam Input interface for controller support</para>
/// </summary>
public static IntPtr GetISteamInput(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamInput(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Steam Parties interface</para>
/// </summary>
public static IntPtr GetISteamParties(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamParties(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Steam Remote Play interface</para>
/// </summary>
public static IntPtr GetISteamRemotePlay(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableClient();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamRemotePlay(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28457456f70c3ef4ca6c7b08a9c796bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,688 @@
// 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 SteamFriends {
/// <summary>
/// <para> returns the local players name - guaranteed to not be NULL.</para>
/// <para> this is the same name as on the users community profile page</para>
/// <para> this is stored in UTF-8 format</para>
/// <para> like all the other interface functions that return a char *, it's important that this pointer is not saved</para>
/// <para> off; it will eventually be free'd or re-allocated</para>
/// </summary>
public static string GetPersonaName() {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetPersonaName(CSteamAPIContext.GetSteamFriends()));
}
/// <summary>
/// <para> Sets the player name, stores it on the server and publishes the changes to all friends who are online.</para>
/// <para> Changes take place locally immediately, and a PersonaStateChange_t is posted, presuming success.</para>
/// <para> The final results are available through the return value SteamAPICall_t, using SetPersonaNameResponse_t.</para>
/// <para> If the name change fails to happen on the server, then an additional global PersonaStateChange_t will be posted</para>
/// <para> to change the name back, in addition to the SetPersonaNameResponse_t callback.</para>
/// </summary>
public static SteamAPICall_t SetPersonaName(string pchPersonaName) {
InteropHelp.TestIfAvailableClient();
using (var pchPersonaName2 = new InteropHelp.UTF8StringHandle(pchPersonaName)) {
return (SteamAPICall_t)NativeMethods.ISteamFriends_SetPersonaName(CSteamAPIContext.GetSteamFriends(), pchPersonaName2);
}
}
/// <summary>
/// <para> gets the status of the current user</para>
/// </summary>
public static EPersonaState GetPersonaState() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetPersonaState(CSteamAPIContext.GetSteamFriends());
}
/// <summary>
/// <para> friend iteration</para>
/// <para> takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria</para>
/// <para> then GetFriendByIndex() can then be used to return the id's of each of those users</para>
/// </summary>
public static int GetFriendCount(EFriendFlags iFriendFlags) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendCount(CSteamAPIContext.GetSteamFriends(), iFriendFlags);
}
/// <summary>
/// <para> returns the steamID of a user</para>
/// <para> iFriend is a index of range [0, GetFriendCount())</para>
/// <para> iFriendsFlags must be the same value as used in GetFriendCount()</para>
/// <para> the returned CSteamID can then be used by all the functions below to access details about the user</para>
/// </summary>
public static CSteamID GetFriendByIndex(int iFriend, EFriendFlags iFriendFlags) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamFriends_GetFriendByIndex(CSteamAPIContext.GetSteamFriends(), iFriend, iFriendFlags);
}
/// <summary>
/// <para> returns a relationship to a user</para>
/// </summary>
public static EFriendRelationship GetFriendRelationship(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendRelationship(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
/// <summary>
/// <para> returns the current status of the specified user</para>
/// <para> this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user</para>
/// </summary>
public static EPersonaState GetFriendPersonaState(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendPersonaState(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
/// <summary>
/// <para> returns the name another user - guaranteed to not be NULL.</para>
/// <para> same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user</para>
/// <para> note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously</para>
/// </summary>
public static string GetFriendPersonaName(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendPersonaName(CSteamAPIContext.GetSteamFriends(), steamIDFriend));
}
/// <summary>
/// <para> returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details</para>
/// </summary>
public static bool GetFriendGamePlayed(CSteamID steamIDFriend, out FriendGameInfo_t pFriendGameInfo) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendGamePlayed(CSteamAPIContext.GetSteamFriends(), steamIDFriend, out pFriendGameInfo);
}
/// <summary>
/// <para> accesses old friends names - returns an empty string when their are no more items in the history</para>
/// </summary>
public static string GetFriendPersonaNameHistory(CSteamID steamIDFriend, int iPersonaName) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendPersonaNameHistory(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iPersonaName));
}
/// <summary>
/// <para> friends steam level</para>
/// </summary>
public static int GetFriendSteamLevel(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendSteamLevel(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
/// <summary>
/// <para> Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player.</para>
/// <para> DEPRECATED: GetPersonaName follows the Steam nickname preferences, so apps shouldn't need to care about nicknames explicitly.</para>
/// </summary>
public static string GetPlayerNickname(CSteamID steamIDPlayer) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetPlayerNickname(CSteamAPIContext.GetSteamFriends(), steamIDPlayer));
}
/// <summary>
/// <para> friend grouping (tag) apis</para>
/// <para> returns the number of friends groups</para>
/// </summary>
public static int GetFriendsGroupCount() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendsGroupCount(CSteamAPIContext.GetSteamFriends());
}
/// <summary>
/// <para> returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid)</para>
/// </summary>
public static FriendsGroupID_t GetFriendsGroupIDByIndex(int iFG) {
InteropHelp.TestIfAvailableClient();
return (FriendsGroupID_t)NativeMethods.ISteamFriends_GetFriendsGroupIDByIndex(CSteamAPIContext.GetSteamFriends(), iFG);
}
/// <summary>
/// <para> returns the name for the given friends group (NULL in the case of invalid friends group IDs)</para>
/// </summary>
public static string GetFriendsGroupName(FriendsGroupID_t friendsGroupID) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendsGroupName(CSteamAPIContext.GetSteamFriends(), friendsGroupID));
}
/// <summary>
/// <para> returns the number of members in a given friends group</para>
/// </summary>
public static int GetFriendsGroupMembersCount(FriendsGroupID_t friendsGroupID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendsGroupMembersCount(CSteamAPIContext.GetSteamFriends(), friendsGroupID);
}
/// <summary>
/// <para> gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid</para>
/// </summary>
public static void GetFriendsGroupMembersList(FriendsGroupID_t friendsGroupID, CSteamID[] pOutSteamIDMembers, int nMembersCount) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamFriends_GetFriendsGroupMembersList(CSteamAPIContext.GetSteamFriends(), friendsGroupID, pOutSteamIDMembers, nMembersCount);
}
/// <summary>
/// <para> returns true if the specified user meets any of the criteria specified in iFriendFlags</para>
/// <para> iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values</para>
/// </summary>
public static bool HasFriend(CSteamID steamIDFriend, EFriendFlags iFriendFlags) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_HasFriend(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iFriendFlags);
}
/// <summary>
/// <para> clan (group) iteration and access functions</para>
/// </summary>
public static int GetClanCount() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetClanCount(CSteamAPIContext.GetSteamFriends());
}
public static CSteamID GetClanByIndex(int iClan) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamFriends_GetClanByIndex(CSteamAPIContext.GetSteamFriends(), iClan);
}
public static string GetClanName(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetClanName(CSteamAPIContext.GetSteamFriends(), steamIDClan));
}
public static string GetClanTag(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetClanTag(CSteamAPIContext.GetSteamFriends(), steamIDClan));
}
/// <summary>
/// <para> returns the most recent information we have about what's happening in a clan</para>
/// </summary>
public static bool GetClanActivityCounts(CSteamID steamIDClan, out int pnOnline, out int pnInGame, out int pnChatting) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetClanActivityCounts(CSteamAPIContext.GetSteamFriends(), steamIDClan, out pnOnline, out pnInGame, out pnChatting);
}
/// <summary>
/// <para> for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest</para>
/// </summary>
public static SteamAPICall_t DownloadClanActivityCounts(CSteamID[] psteamIDClans, int cClansToRequest) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamFriends_DownloadClanActivityCounts(CSteamAPIContext.GetSteamFriends(), psteamIDClans, cClansToRequest);
}
/// <summary>
/// <para> iterators for getting users in a chat room, lobby, game server or clan</para>
/// <para> note that large clans that cannot be iterated by the local user</para>
/// <para> note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby</para>
/// <para> steamIDSource can be the steamID of a group, game server, lobby or chat room</para>
/// </summary>
public static int GetFriendCountFromSource(CSteamID steamIDSource) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendCountFromSource(CSteamAPIContext.GetSteamFriends(), steamIDSource);
}
public static CSteamID GetFriendFromSourceByIndex(CSteamID steamIDSource, int iFriend) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamFriends_GetFriendFromSourceByIndex(CSteamAPIContext.GetSteamFriends(), steamIDSource, iFriend);
}
/// <summary>
/// <para> returns true if the local user can see that steamIDUser is a member or in steamIDSource</para>
/// </summary>
public static bool IsUserInSource(CSteamID steamIDUser, CSteamID steamIDSource) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_IsUserInSource(CSteamAPIContext.GetSteamFriends(), steamIDUser, steamIDSource);
}
/// <summary>
/// <para> User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI)</para>
/// </summary>
public static void SetInGameVoiceSpeaking(CSteamID steamIDUser, bool bSpeaking) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamFriends_SetInGameVoiceSpeaking(CSteamAPIContext.GetSteamFriends(), steamIDUser, bSpeaking);
}
/// <summary>
/// <para> activates the game overlay, with an optional dialog to open</para>
/// <para> valid options include "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements",</para>
/// <para> "chatroomgroup/nnnn"</para>
/// </summary>
public static void ActivateGameOverlay(string pchDialog) {
InteropHelp.TestIfAvailableClient();
using (var pchDialog2 = new InteropHelp.UTF8StringHandle(pchDialog)) {
NativeMethods.ISteamFriends_ActivateGameOverlay(CSteamAPIContext.GetSteamFriends(), pchDialog2);
}
}
/// <summary>
/// <para> activates game overlay to a specific place</para>
/// <para> valid options are</para>
/// <para> "steamid" - opens the overlay web browser to the specified user or groups profile</para>
/// <para> "chat" - opens a chat window to the specified user, or joins the group chat</para>
/// <para> "jointrade" - opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API</para>
/// <para> "stats" - opens the overlay web browser to the specified user's stats</para>
/// <para> "achievements" - opens the overlay web browser to the specified user's achievements</para>
/// <para> "friendadd" - opens the overlay in minimal mode prompting the user to add the target user as a friend</para>
/// <para> "friendremove" - opens the overlay in minimal mode prompting the user to remove the target friend</para>
/// <para> "friendrequestaccept" - opens the overlay in minimal mode prompting the user to accept an incoming friend invite</para>
/// <para> "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite</para>
/// </summary>
public static void ActivateGameOverlayToUser(string pchDialog, CSteamID steamID) {
InteropHelp.TestIfAvailableClient();
using (var pchDialog2 = new InteropHelp.UTF8StringHandle(pchDialog)) {
NativeMethods.ISteamFriends_ActivateGameOverlayToUser(CSteamAPIContext.GetSteamFriends(), pchDialog2, steamID);
}
}
/// <summary>
/// <para> activates game overlay web browser directly to the specified URL</para>
/// <para> full address with protocol type is required, e.g. http://www.steamgames.com/</para>
/// </summary>
public static void ActivateGameOverlayToWebPage(string pchURL, EActivateGameOverlayToWebPageMode eMode = EActivateGameOverlayToWebPageMode.k_EActivateGameOverlayToWebPageMode_Default) {
InteropHelp.TestIfAvailableClient();
using (var pchURL2 = new InteropHelp.UTF8StringHandle(pchURL)) {
NativeMethods.ISteamFriends_ActivateGameOverlayToWebPage(CSteamAPIContext.GetSteamFriends(), pchURL2, eMode);
}
}
/// <summary>
/// <para> activates game overlay to store page for app</para>
/// </summary>
public static void ActivateGameOverlayToStore(AppId_t nAppID, EOverlayToStoreFlag eFlag) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamFriends_ActivateGameOverlayToStore(CSteamAPIContext.GetSteamFriends(), nAppID, eFlag);
}
/// <summary>
/// <para> Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is</para>
/// <para> in game</para>
/// </summary>
public static void SetPlayedWith(CSteamID steamIDUserPlayedWith) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamFriends_SetPlayedWith(CSteamAPIContext.GetSteamFriends(), steamIDUserPlayedWith);
}
/// <summary>
/// <para> activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby.</para>
/// </summary>
public static void ActivateGameOverlayInviteDialog(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamFriends_ActivateGameOverlayInviteDialog(CSteamAPIContext.GetSteamFriends(), steamIDLobby);
}
/// <summary>
/// <para> gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set</para>
/// </summary>
public static int GetSmallFriendAvatar(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetSmallFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
/// <summary>
/// <para> gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set</para>
/// </summary>
public static int GetMediumFriendAvatar(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetMediumFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
/// <summary>
/// <para> gets the large (184x184) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set</para>
/// <para> returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again</para>
/// </summary>
public static int GetLargeFriendAvatar(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetLargeFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
/// <summary>
/// <para> requests information about a user - persona name &amp; avatar</para>
/// <para> if bRequireNameOnly is set, then the avatar of a user isn't downloaded</para>
/// <para> - it's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them</para>
/// <para> if returns true, it means that data is being requested, and a PersonaStateChanged_t callback will be posted when it's retrieved</para>
/// <para> if returns false, it means that we already have all the details about that user, and functions can be called immediately</para>
/// </summary>
public static bool RequestUserInformation(CSteamID steamIDUser, bool bRequireNameOnly) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_RequestUserInformation(CSteamAPIContext.GetSteamFriends(), steamIDUser, bRequireNameOnly);
}
/// <summary>
/// <para> requests information about a clan officer list</para>
/// <para> when complete, data is returned in ClanOfficerListResponse_t call result</para>
/// <para> this makes available the calls below</para>
/// <para> you can only ask about clans that a user is a member of</para>
/// <para> note that this won't download avatars automatically; if you get an officer,</para>
/// <para> and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar</para>
/// </summary>
public static SteamAPICall_t RequestClanOfficerList(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamFriends_RequestClanOfficerList(CSteamAPIContext.GetSteamFriends(), steamIDClan);
}
/// <summary>
/// <para> iteration of clan officers - can only be done when a RequestClanOfficerList() call has completed</para>
/// <para> returns the steamID of the clan owner</para>
/// </summary>
public static CSteamID GetClanOwner(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamFriends_GetClanOwner(CSteamAPIContext.GetSteamFriends(), steamIDClan);
}
/// <summary>
/// <para> returns the number of officers in a clan (including the owner)</para>
/// </summary>
public static int GetClanOfficerCount(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetClanOfficerCount(CSteamAPIContext.GetSteamFriends(), steamIDClan);
}
/// <summary>
/// <para> returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount)</para>
/// </summary>
public static CSteamID GetClanOfficerByIndex(CSteamID steamIDClan, int iOfficer) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamFriends_GetClanOfficerByIndex(CSteamAPIContext.GetSteamFriends(), steamIDClan, iOfficer);
}
/// <summary>
/// <para> if current user is chat restricted, he can't send or receive any text/voice chat messages.</para>
/// <para> the user can't see custom avatars. But the user can be online and send/recv game invites.</para>
/// <para> a chat restricted user can't add friends or join any groups.</para>
/// </summary>
public static uint GetUserRestrictions() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetUserRestrictions(CSteamAPIContext.GetSteamFriends());
}
/// <summary>
/// <para> Rich Presence data is automatically shared between friends who are in the same game</para>
/// <para> Each user has a set of Key/Value pairs</para>
/// <para> Note the following limits: k_cchMaxRichPresenceKeys, k_cchMaxRichPresenceKeyLength, k_cchMaxRichPresenceValueLength</para>
/// <para> There are five magic keys:</para>
/// <para> "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list</para>
/// <para> "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game</para>
/// <para> "steam_display" - Names a rich presence localization token that will be displayed in the viewing user's selected language</para>
/// <para> in the Steam client UI. For more info: https://partner.steamgames.com/doc/api/ISteamFriends#richpresencelocalization</para>
/// <para> "steam_player_group" - When set, indicates to the Steam client that the player is a member of a particular group. Players in the same group</para>
/// <para> may be organized together in various places in the Steam UI.</para>
/// <para> "steam_player_group_size" - When set, indicates the total number of players in the steam_player_group. The Steam client may use this number to</para>
/// <para> display additional information about a group when all of the members are not part of a user's friends list.</para>
/// <para> GetFriendRichPresence() returns an empty string "" if no value is set</para>
/// <para> SetRichPresence() to a NULL or an empty string deletes the key</para>
/// <para> You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount()</para>
/// <para> and GetFriendRichPresenceKeyByIndex() (typically only used for debugging)</para>
/// </summary>
public static bool SetRichPresence(string pchKey, string pchValue) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey))
using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue)) {
return NativeMethods.ISteamFriends_SetRichPresence(CSteamAPIContext.GetSteamFriends(), pchKey2, pchValue2);
}
}
public static void ClearRichPresence() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamFriends_ClearRichPresence(CSteamAPIContext.GetSteamFriends());
}
public static string GetFriendRichPresence(CSteamID steamIDFriend, string pchKey) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) {
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendRichPresence(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchKey2));
}
}
public static int GetFriendRichPresenceKeyCount(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendRichPresenceKeyCount(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
public static string GetFriendRichPresenceKeyByIndex(CSteamID steamIDFriend, int iKey) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendRichPresenceKeyByIndex(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iKey));
}
/// <summary>
/// <para> Requests rich presence for a specific user.</para>
/// </summary>
public static void RequestFriendRichPresence(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamFriends_RequestFriendRichPresence(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
/// <summary>
/// <para> Rich invite support.</para>
/// <para> If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string.</para>
/// <para> (Or you can configure your game so that it is passed on the command line instead. This is a deprecated path; ask us if you really need this.)</para>
/// </summary>
public static bool InviteUserToGame(CSteamID steamIDFriend, string pchConnectString) {
InteropHelp.TestIfAvailableClient();
using (var pchConnectString2 = new InteropHelp.UTF8StringHandle(pchConnectString)) {
return NativeMethods.ISteamFriends_InviteUserToGame(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchConnectString2);
}
}
/// <summary>
/// <para> recently-played-with friends iteration</para>
/// <para> this iterates the entire list of users recently played with, across games</para>
/// <para> GetFriendCoplayTime() returns as a unix time</para>
/// </summary>
public static int GetCoplayFriendCount() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetCoplayFriendCount(CSteamAPIContext.GetSteamFriends());
}
public static CSteamID GetCoplayFriend(int iCoplayFriend) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamFriends_GetCoplayFriend(CSteamAPIContext.GetSteamFriends(), iCoplayFriend);
}
public static int GetFriendCoplayTime(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetFriendCoplayTime(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
public static AppId_t GetFriendCoplayGame(CSteamID steamIDFriend) {
InteropHelp.TestIfAvailableClient();
return (AppId_t)NativeMethods.ISteamFriends_GetFriendCoplayGame(CSteamAPIContext.GetSteamFriends(), steamIDFriend);
}
/// <summary>
/// <para> chat interface for games</para>
/// <para> this allows in-game access to group (clan) chats from in the game</para>
/// <para> the behavior is somewhat sophisticated, because the user may or may not be already in the group chat from outside the game or in the overlay</para>
/// <para> use ActivateGameOverlayToUser( "chat", steamIDClan ) to open the in-game overlay version of the chat</para>
/// </summary>
public static SteamAPICall_t JoinClanChatRoom(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamFriends_JoinClanChatRoom(CSteamAPIContext.GetSteamFriends(), steamIDClan);
}
public static bool LeaveClanChatRoom(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_LeaveClanChatRoom(CSteamAPIContext.GetSteamFriends(), steamIDClan);
}
public static int GetClanChatMemberCount(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetClanChatMemberCount(CSteamAPIContext.GetSteamFriends(), steamIDClan);
}
public static CSteamID GetChatMemberByIndex(CSteamID steamIDClan, int iUser) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamFriends_GetChatMemberByIndex(CSteamAPIContext.GetSteamFriends(), steamIDClan, iUser);
}
public static bool SendClanChatMessage(CSteamID steamIDClanChat, string pchText) {
InteropHelp.TestIfAvailableClient();
using (var pchText2 = new InteropHelp.UTF8StringHandle(pchText)) {
return NativeMethods.ISteamFriends_SendClanChatMessage(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, pchText2);
}
}
public static int GetClanChatMessage(CSteamID steamIDClanChat, int iMessage, out string prgchText, int cchTextMax, out EChatEntryType peChatEntryType, out CSteamID psteamidChatter) {
InteropHelp.TestIfAvailableClient();
IntPtr prgchText2 = Marshal.AllocHGlobal(cchTextMax);
int ret = NativeMethods.ISteamFriends_GetClanChatMessage(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, iMessage, prgchText2, cchTextMax, out peChatEntryType, out psteamidChatter);
prgchText = ret != 0 ? InteropHelp.PtrToStringUTF8(prgchText2) : null;
Marshal.FreeHGlobal(prgchText2);
return ret;
}
public static bool IsClanChatAdmin(CSteamID steamIDClanChat, CSteamID steamIDUser) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_IsClanChatAdmin(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, steamIDUser);
}
/// <summary>
/// <para> interact with the Steam (game overlay / desktop)</para>
/// </summary>
public static bool IsClanChatWindowOpenInSteam(CSteamID steamIDClanChat) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_IsClanChatWindowOpenInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat);
}
public static bool OpenClanChatWindowInSteam(CSteamID steamIDClanChat) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_OpenClanChatWindowInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat);
}
public static bool CloseClanChatWindowInSteam(CSteamID steamIDClanChat) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_CloseClanChatWindowInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat);
}
/// <summary>
/// <para> peer-to-peer chat interception</para>
/// <para> this is so you can show P2P chats inline in the game</para>
/// </summary>
public static bool SetListenForFriendsMessages(bool bInterceptEnabled) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_SetListenForFriendsMessages(CSteamAPIContext.GetSteamFriends(), bInterceptEnabled);
}
public static bool ReplyToFriendMessage(CSteamID steamIDFriend, string pchMsgToSend) {
InteropHelp.TestIfAvailableClient();
using (var pchMsgToSend2 = new InteropHelp.UTF8StringHandle(pchMsgToSend)) {
return NativeMethods.ISteamFriends_ReplyToFriendMessage(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchMsgToSend2);
}
}
public static int GetFriendMessage(CSteamID steamIDFriend, int iMessageID, out string pvData, int cubData, out EChatEntryType peChatEntryType) {
InteropHelp.TestIfAvailableClient();
IntPtr pvData2 = Marshal.AllocHGlobal(cubData);
int ret = NativeMethods.ISteamFriends_GetFriendMessage(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iMessageID, pvData2, cubData, out peChatEntryType);
pvData = ret != 0 ? InteropHelp.PtrToStringUTF8(pvData2) : null;
Marshal.FreeHGlobal(pvData2);
return ret;
}
/// <summary>
/// <para> following apis</para>
/// </summary>
public static SteamAPICall_t GetFollowerCount(CSteamID steamID) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamFriends_GetFollowerCount(CSteamAPIContext.GetSteamFriends(), steamID);
}
public static SteamAPICall_t IsFollowing(CSteamID steamID) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamFriends_IsFollowing(CSteamAPIContext.GetSteamFriends(), steamID);
}
public static SteamAPICall_t EnumerateFollowingList(uint unStartIndex) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamFriends_EnumerateFollowingList(CSteamAPIContext.GetSteamFriends(), unStartIndex);
}
public static bool IsClanPublic(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_IsClanPublic(CSteamAPIContext.GetSteamFriends(), steamIDClan);
}
public static bool IsClanOfficialGameGroup(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_IsClanOfficialGameGroup(CSteamAPIContext.GetSteamFriends(), steamIDClan);
}
/// <summary>
/// <para>/ Return the number of chats (friends or chat rooms) with unread messages.</para>
/// <para>/ A "priority" message is one that would generate some sort of toast or</para>
/// <para>/ notification, and depends on user settings.</para>
/// <para>/</para>
/// <para>/ You can register for UnreadChatMessagesChanged_t callbacks to know when this</para>
/// <para>/ has potentially changed.</para>
/// </summary>
public static int GetNumChatsWithUnreadPriorityMessages() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetNumChatsWithUnreadPriorityMessages(CSteamAPIContext.GetSteamFriends());
}
/// <summary>
/// <para> activates game overlay to open the remote play together invite dialog. Invitations will be sent for remote play together</para>
/// </summary>
public static void ActivateGameOverlayRemotePlayTogetherInviteDialog(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamFriends_ActivateGameOverlayRemotePlayTogetherInviteDialog(CSteamAPIContext.GetSteamFriends(), steamIDLobby);
}
/// <summary>
/// <para> Call this before calling ActivateGameOverlayToWebPage() to have the Steam Overlay Browser block navigations</para>
/// <para> to your specified protocol (scheme) uris and instead dispatch a OverlayBrowserProtocolNavigation_t callback to your game.</para>
/// <para> ActivateGameOverlayToWebPage() must have been called with k_EActivateGameOverlayToWebPageMode_Modal</para>
/// </summary>
public static bool RegisterProtocolInOverlayBrowser(string pchProtocol) {
InteropHelp.TestIfAvailableClient();
using (var pchProtocol2 = new InteropHelp.UTF8StringHandle(pchProtocol)) {
return NativeMethods.ISteamFriends_RegisterProtocolInOverlayBrowser(CSteamAPIContext.GetSteamFriends(), pchProtocol2);
}
}
/// <summary>
/// <para> Activates the game overlay to open an invite dialog that will send the provided Rich Presence connect string to selected friends</para>
/// </summary>
public static void ActivateGameOverlayInviteDialogConnectString(string pchConnectString) {
InteropHelp.TestIfAvailableClient();
using (var pchConnectString2 = new InteropHelp.UTF8StringHandle(pchConnectString)) {
NativeMethods.ISteamFriends_ActivateGameOverlayInviteDialogConnectString(CSteamAPIContext.GetSteamFriends(), pchConnectString2);
}
}
/// <summary>
/// <para> Steam Community items equipped by a user on their profile</para>
/// <para> You can register for EquippedProfileItemsChanged_t to know when a friend has changed their equipped profile items</para>
/// </summary>
public static SteamAPICall_t RequestEquippedProfileItems(CSteamID steamID) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamFriends_RequestEquippedProfileItems(CSteamAPIContext.GetSteamFriends(), steamID);
}
public static bool BHasEquippedProfileItem(CSteamID steamID, ECommunityProfileItemType itemType) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_BHasEquippedProfileItem(CSteamAPIContext.GetSteamFriends(), steamID, itemType);
}
public static string GetProfileItemPropertyString(CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetProfileItemPropertyString(CSteamAPIContext.GetSteamFriends(), steamID, itemType, prop));
}
public static uint GetProfileItemPropertyUint(CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamFriends_GetProfileItemPropertyUint(CSteamAPIContext.GetSteamFriends(), steamID, itemType, prop);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ff71573e5261b1e45a0db0451c6d7af4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,450 @@
// 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 SteamGameServer {
/// <summary>
/// <para>/ Game product identifier. This is currently used by the master server for version checking purposes.</para>
/// <para>/ It's a required field, but will eventually will go away, and the AppID will be used for this purpose.</para>
/// </summary>
public static void SetProduct(string pszProduct) {
InteropHelp.TestIfAvailableGameServer();
using (var pszProduct2 = new InteropHelp.UTF8StringHandle(pszProduct)) {
NativeMethods.ISteamGameServer_SetProduct(CSteamGameServerAPIContext.GetSteamGameServer(), pszProduct2);
}
}
/// <summary>
/// <para>/ Description of the game. This is a required field and is displayed in the steam server browser....for now.</para>
/// <para>/ This is a required field, but it will go away eventually, as the data should be determined from the AppID.</para>
/// </summary>
public static void SetGameDescription(string pszGameDescription) {
InteropHelp.TestIfAvailableGameServer();
using (var pszGameDescription2 = new InteropHelp.UTF8StringHandle(pszGameDescription)) {
NativeMethods.ISteamGameServer_SetGameDescription(CSteamGameServerAPIContext.GetSteamGameServer(), pszGameDescription2);
}
}
/// <summary>
/// <para>/ If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning</para>
/// <para>/ this application is the original game, not a mod.</para>
/// <para>/</para>
/// <para>/ @see k_cbMaxGameServerGameDir</para>
/// </summary>
public static void SetModDir(string pszModDir) {
InteropHelp.TestIfAvailableGameServer();
using (var pszModDir2 = new InteropHelp.UTF8StringHandle(pszModDir)) {
NativeMethods.ISteamGameServer_SetModDir(CSteamGameServerAPIContext.GetSteamGameServer(), pszModDir2);
}
}
/// <summary>
/// <para>/ Is this is a dedicated server? The default value is false.</para>
/// </summary>
public static void SetDedicatedServer(bool bDedicated) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_SetDedicatedServer(CSteamGameServerAPIContext.GetSteamGameServer(), bDedicated);
}
/// <summary>
/// <para> Login</para>
/// <para>/ Begin process to login to a persistent game server account</para>
/// <para>/</para>
/// <para>/ You need to register for callbacks to determine the result of this operation.</para>
/// <para>/ @see SteamServersConnected_t</para>
/// <para>/ @see SteamServerConnectFailure_t</para>
/// <para>/ @see SteamServersDisconnected_t</para>
/// </summary>
public static void LogOn(string pszToken) {
InteropHelp.TestIfAvailableGameServer();
using (var pszToken2 = new InteropHelp.UTF8StringHandle(pszToken)) {
NativeMethods.ISteamGameServer_LogOn(CSteamGameServerAPIContext.GetSteamGameServer(), pszToken2);
}
}
/// <summary>
/// <para>/ Login to a generic, anonymous account.</para>
/// <para>/</para>
/// <para>/ Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init,</para>
/// <para>/ but this is no longer the case.</para>
/// </summary>
public static void LogOnAnonymous() {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_LogOnAnonymous(CSteamGameServerAPIContext.GetSteamGameServer());
}
/// <summary>
/// <para>/ Begin process of logging game server out of steam</para>
/// </summary>
public static void LogOff() {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_LogOff(CSteamGameServerAPIContext.GetSteamGameServer());
}
/// <summary>
/// <para> status functions</para>
/// </summary>
public static bool BLoggedOn() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_BLoggedOn(CSteamGameServerAPIContext.GetSteamGameServer());
}
public static bool BSecure() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_BSecure(CSteamGameServerAPIContext.GetSteamGameServer());
}
public static CSteamID GetSteamID() {
InteropHelp.TestIfAvailableGameServer();
return (CSteamID)NativeMethods.ISteamGameServer_GetSteamID(CSteamGameServerAPIContext.GetSteamGameServer());
}
/// <summary>
/// <para>/ Returns true if the master server has requested a restart.</para>
/// <para>/ Only returns true once per request.</para>
/// </summary>
public static bool WasRestartRequested() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_WasRestartRequested(CSteamGameServerAPIContext.GetSteamGameServer());
}
/// <summary>
/// <para> Server state. These properties may be changed at any time.</para>
/// <para>/ Max player count that will be reported to server browser and client queries</para>
/// </summary>
public static void SetMaxPlayerCount(int cPlayersMax) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_SetMaxPlayerCount(CSteamGameServerAPIContext.GetSteamGameServer(), cPlayersMax);
}
/// <summary>
/// <para>/ Number of bots. Default value is zero</para>
/// </summary>
public static void SetBotPlayerCount(int cBotplayers) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_SetBotPlayerCount(CSteamGameServerAPIContext.GetSteamGameServer(), cBotplayers);
}
/// <summary>
/// <para>/ Set the name of server as it will appear in the server browser</para>
/// <para>/</para>
/// <para>/ @see k_cbMaxGameServerName</para>
/// </summary>
public static void SetServerName(string pszServerName) {
InteropHelp.TestIfAvailableGameServer();
using (var pszServerName2 = new InteropHelp.UTF8StringHandle(pszServerName)) {
NativeMethods.ISteamGameServer_SetServerName(CSteamGameServerAPIContext.GetSteamGameServer(), pszServerName2);
}
}
/// <summary>
/// <para>/ Set name of map to report in the server browser</para>
/// <para>/</para>
/// <para>/ @see k_cbMaxGameServerMapName</para>
/// </summary>
public static void SetMapName(string pszMapName) {
InteropHelp.TestIfAvailableGameServer();
using (var pszMapName2 = new InteropHelp.UTF8StringHandle(pszMapName)) {
NativeMethods.ISteamGameServer_SetMapName(CSteamGameServerAPIContext.GetSteamGameServer(), pszMapName2);
}
}
/// <summary>
/// <para>/ Let people know if your server will require a password</para>
/// </summary>
public static void SetPasswordProtected(bool bPasswordProtected) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_SetPasswordProtected(CSteamGameServerAPIContext.GetSteamGameServer(), bPasswordProtected);
}
/// <summary>
/// <para>/ Spectator server port to advertise. The default value is zero, meaning the</para>
/// <para>/ service is not used. If your server receives any info requests on the LAN,</para>
/// <para>/ this is the value that will be placed into the reply for such local queries.</para>
/// <para>/</para>
/// <para>/ This is also the value that will be advertised by the master server.</para>
/// <para>/ The only exception is if your server is using a FakeIP. Then then the second</para>
/// <para>/ fake port number (index 1) assigned to your server will be listed on the master</para>
/// <para>/ server as the spectator port, if you set this value to any nonzero value.</para>
/// <para>/</para>
/// <para>/ This function merely controls the values that are advertised -- it's up to you to</para>
/// <para>/ configure the server to actually listen on this port and handle any spectator traffic</para>
/// </summary>
public static void SetSpectatorPort(ushort unSpectatorPort) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_SetSpectatorPort(CSteamGameServerAPIContext.GetSteamGameServer(), unSpectatorPort);
}
/// <summary>
/// <para>/ Name of the spectator server. (Only used if spectator port is nonzero.)</para>
/// <para>/</para>
/// <para>/ @see k_cbMaxGameServerMapName</para>
/// </summary>
public static void SetSpectatorServerName(string pszSpectatorServerName) {
InteropHelp.TestIfAvailableGameServer();
using (var pszSpectatorServerName2 = new InteropHelp.UTF8StringHandle(pszSpectatorServerName)) {
NativeMethods.ISteamGameServer_SetSpectatorServerName(CSteamGameServerAPIContext.GetSteamGameServer(), pszSpectatorServerName2);
}
}
/// <summary>
/// <para>/ Call this to clear the whole list of key/values that are sent in rules queries.</para>
/// </summary>
public static void ClearAllKeyValues() {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_ClearAllKeyValues(CSteamGameServerAPIContext.GetSteamGameServer());
}
/// <summary>
/// <para>/ Call this to add/update a key/value pair.</para>
/// </summary>
public static void SetKeyValue(string pKey, string pValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pKey2 = new InteropHelp.UTF8StringHandle(pKey))
using (var pValue2 = new InteropHelp.UTF8StringHandle(pValue)) {
NativeMethods.ISteamGameServer_SetKeyValue(CSteamGameServerAPIContext.GetSteamGameServer(), pKey2, pValue2);
}
}
/// <summary>
/// <para>/ Sets a string defining the "gametags" for this server, this is optional, but if it is set</para>
/// <para>/ it allows users to filter in the matchmaking/server-browser interfaces based on the value</para>
/// <para>/</para>
/// <para>/ @see k_cbMaxGameServerTags</para>
/// </summary>
public static void SetGameTags(string pchGameTags) {
InteropHelp.TestIfAvailableGameServer();
using (var pchGameTags2 = new InteropHelp.UTF8StringHandle(pchGameTags)) {
NativeMethods.ISteamGameServer_SetGameTags(CSteamGameServerAPIContext.GetSteamGameServer(), pchGameTags2);
}
}
/// <summary>
/// <para>/ Sets a string defining the "gamedata" for this server, this is optional, but if it is set</para>
/// <para>/ it allows users to filter in the matchmaking/server-browser interfaces based on the value</para>
/// <para>/</para>
/// <para>/ @see k_cbMaxGameServerGameData</para>
/// </summary>
public static void SetGameData(string pchGameData) {
InteropHelp.TestIfAvailableGameServer();
using (var pchGameData2 = new InteropHelp.UTF8StringHandle(pchGameData)) {
NativeMethods.ISteamGameServer_SetGameData(CSteamGameServerAPIContext.GetSteamGameServer(), pchGameData2);
}
}
/// <summary>
/// <para>/ Region identifier. This is an optional field, the default value is empty, meaning the "world" region</para>
/// </summary>
public static void SetRegion(string pszRegion) {
InteropHelp.TestIfAvailableGameServer();
using (var pszRegion2 = new InteropHelp.UTF8StringHandle(pszRegion)) {
NativeMethods.ISteamGameServer_SetRegion(CSteamGameServerAPIContext.GetSteamGameServer(), pszRegion2);
}
}
/// <summary>
/// <para>/ Indicate whether you wish to be listed on the master server list</para>
/// <para>/ and/or respond to server browser / LAN discovery packets.</para>
/// <para>/ The server starts with this value set to false. You should set all</para>
/// <para>/ relevant server parameters before enabling advertisement on the server.</para>
/// <para>/</para>
/// <para>/ (This function used to be named EnableHeartbeats, so if you are wondering</para>
/// <para>/ where that function went, it's right here. It does the same thing as before,</para>
/// <para>/ the old name was just confusing.)</para>
/// </summary>
public static void SetAdvertiseServerActive(bool bActive) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_SetAdvertiseServerActive(CSteamGameServerAPIContext.GetSteamGameServer(), bActive);
}
/// <summary>
/// <para> Player list management / authentication.</para>
/// <para> Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).</para>
/// <para> pcbTicket retrieves the length of the actual ticket.</para>
/// <para> SteamNetworkingIdentity is an optional parameter to hold the public IP address of the entity you are connecting to</para>
/// <para> if an IP address is passed Steam will only allow the ticket to be used by an entity with that IP address</para>
/// </summary>
public static HAuthTicket GetAuthSessionTicket(byte[] pTicket, int cbMaxTicket, out uint pcbTicket, ref SteamNetworkingIdentity pSnid) {
InteropHelp.TestIfAvailableGameServer();
return (HAuthTicket)NativeMethods.ISteamGameServer_GetAuthSessionTicket(CSteamGameServerAPIContext.GetSteamGameServer(), pTicket, cbMaxTicket, out pcbTicket, ref pSnid);
}
/// <summary>
/// <para> Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused</para>
/// <para> Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )</para>
/// </summary>
public static EBeginAuthSessionResult BeginAuthSession(byte[] pAuthTicket, int cbAuthTicket, CSteamID steamID) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_BeginAuthSession(CSteamGameServerAPIContext.GetSteamGameServer(), pAuthTicket, cbAuthTicket, steamID);
}
/// <summary>
/// <para> Stop tracking started by BeginAuthSession - called when no longer playing game with this entity</para>
/// </summary>
public static void EndAuthSession(CSteamID steamID) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_EndAuthSession(CSteamGameServerAPIContext.GetSteamGameServer(), steamID);
}
/// <summary>
/// <para> Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to</para>
/// </summary>
public static void CancelAuthTicket(HAuthTicket hAuthTicket) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_CancelAuthTicket(CSteamGameServerAPIContext.GetSteamGameServer(), hAuthTicket);
}
/// <summary>
/// <para> After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function</para>
/// <para> to determine if the user owns downloadable content specified by the provided AppID.</para>
/// </summary>
public static EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_UserHasLicenseForApp(CSteamGameServerAPIContext.GetSteamGameServer(), steamID, appID);
}
/// <summary>
/// <para> Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t</para>
/// <para> returns false if we're not connected to the steam servers and thus cannot ask</para>
/// </summary>
public static bool RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_RequestUserGroupStatus(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser, steamIDGroup);
}
/// <summary>
/// <para> these two functions s are deprecated, and will not return results</para>
/// <para> they will be removed in a future version of the SDK</para>
/// </summary>
public static void GetGameplayStats() {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_GetGameplayStats(CSteamGameServerAPIContext.GetSteamGameServer());
}
public static SteamAPICall_t GetServerReputation() {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamGameServer_GetServerReputation(CSteamGameServerAPIContext.GetSteamGameServer());
}
/// <summary>
/// <para> Returns the public IP of the server according to Steam, useful when the server is</para>
/// <para> behind NAT and you want to advertise its IP in a lobby for other clients to directly</para>
/// <para> connect to</para>
/// </summary>
public static SteamIPAddress_t GetPublicIP() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_GetPublicIP(CSteamGameServerAPIContext.GetSteamGameServer());
}
/// <summary>
/// <para> Server browser related query packet processing for shared socket mode. These are used</para>
/// <para> when you pass STEAMGAMESERVER_QUERY_PORT_SHARED as the query port to SteamGameServer_Init.</para>
/// <para> IP address and port are in host order, i.e 127.0.0.1 == 0x7f000001</para>
/// <para> These are used when you've elected to multiplex the game server's UDP socket</para>
/// <para> rather than having the master server updater use its own sockets.</para>
/// <para> Source games use this to simplify the job of the server admins, so they</para>
/// <para> don't have to open up more ports on their firewalls.</para>
/// <para> Call this when a packet that starts with 0xFFFFFFFF comes in. That means</para>
/// <para> it's for us.</para>
/// </summary>
public static bool HandleIncomingPacket(byte[] pData, int cbData, uint srcIP, ushort srcPort) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_HandleIncomingPacket(CSteamGameServerAPIContext.GetSteamGameServer(), pData, cbData, srcIP, srcPort);
}
/// <summary>
/// <para> AFTER calling HandleIncomingPacket for any packets that came in that frame, call this.</para>
/// <para> This gets a packet that the master server updater needs to send out on UDP.</para>
/// <para> It returns the length of the packet it wants to send, or 0 if there are no more packets to send.</para>
/// <para> Call this each frame until it returns 0.</para>
/// </summary>
public static int GetNextOutgoingPacket(byte[] pOut, int cbMaxOut, out uint pNetAdr, out ushort pPort) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_GetNextOutgoingPacket(CSteamGameServerAPIContext.GetSteamGameServer(), pOut, cbMaxOut, out pNetAdr, out pPort);
}
/// <summary>
/// <para> Server clan association</para>
/// <para> associate this game server with this clan for the purposes of computing player compat</para>
/// </summary>
public static SteamAPICall_t AssociateWithClan(CSteamID steamIDClan) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamGameServer_AssociateWithClan(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDClan);
}
/// <summary>
/// <para> ask if any of the current players dont want to play with this new player - or vice versa</para>
/// </summary>
public static SteamAPICall_t ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamGameServer_ComputeNewPlayerCompatibility(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDNewPlayer);
}
/// <summary>
/// <para> Handles receiving a new connection from a Steam user. This call will ask the Steam</para>
/// <para> servers to validate the users identity, app ownership, and VAC status. If the Steam servers</para>
/// <para> are off-line, then it will validate the cached ticket itself which will validate app ownership</para>
/// <para> and identity. The AuthBlob here should be acquired on the game client using SteamUser()-&gt;InitiateGameConnection()</para>
/// <para> and must then be sent up to the game server for authentication.</para>
/// <para> Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL</para>
/// <para> If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication</para>
/// <para> for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)</para>
/// <para> DEPRECATED! This function will be removed from the SDK in an upcoming version.</para>
/// <para> Please migrate to BeginAuthSession and related functions.</para>
/// </summary>
public static bool SendUserConnectAndAuthenticate_DEPRECATED(uint unIPClient, byte[] pvAuthBlob, uint cubAuthBlobSize, out CSteamID pSteamIDUser) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamGameServer_SendUserConnectAndAuthenticate_DEPRECATED(CSteamGameServerAPIContext.GetSteamGameServer(), unIPClient, pvAuthBlob, cubAuthBlobSize, out pSteamIDUser);
}
/// <summary>
/// <para> Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation.</para>
/// <para> Return Value: Returns a SteamID for the user to be tracked with, you should call EndAuthSession()</para>
/// <para> when this user leaves the server just like you would for a real user.</para>
/// </summary>
public static CSteamID CreateUnauthenticatedUserConnection() {
InteropHelp.TestIfAvailableGameServer();
return (CSteamID)NativeMethods.ISteamGameServer_CreateUnauthenticatedUserConnection(CSteamGameServerAPIContext.GetSteamGameServer());
}
/// <summary>
/// <para> Should be called whenever a user leaves our game server, this lets Steam internally</para>
/// <para> track which users are currently on which servers for the purposes of preventing a single</para>
/// <para> account being logged into multiple servers, showing who is currently on a server, etc.</para>
/// <para> DEPRECATED! This function will be removed from the SDK in an upcoming version.</para>
/// <para> Please migrate to BeginAuthSession and related functions.</para>
/// </summary>
public static void SendUserDisconnect_DEPRECATED(CSteamID steamIDUser) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamGameServer_SendUserDisconnect_DEPRECATED(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser);
}
/// <summary>
/// <para> Update the data to be displayed in the server browser and matchmaking interfaces for a user</para>
/// <para> currently connected to the server. For regular users you must call this after you receive a</para>
/// <para> GSUserValidationSuccess callback.</para>
/// <para> Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)</para>
/// </summary>
public static bool BUpdateUserData(CSteamID steamIDUser, string pchPlayerName, uint uScore) {
InteropHelp.TestIfAvailableGameServer();
using (var pchPlayerName2 = new InteropHelp.UTF8StringHandle(pchPlayerName)) {
return NativeMethods.ISteamGameServer_BUpdateUserData(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser, pchPlayerName2, uScore);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8c4257f3ef3cd614f8137738c4a58d8a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,366 @@
// 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 SteamGameServerClient {
/// <summary>
/// <para> Creates a communication pipe to the Steam client.</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static HSteamPipe CreateSteamPipe() {
InteropHelp.TestIfAvailableGameServer();
return (HSteamPipe)NativeMethods.ISteamClient_CreateSteamPipe(CSteamGameServerAPIContext.GetSteamClient());
}
/// <summary>
/// <para> Releases a previously created communications pipe</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static bool BReleaseSteamPipe(HSteamPipe hSteamPipe) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamClient_BReleaseSteamPipe(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe);
}
/// <summary>
/// <para> connects to an existing global user, failing if none exists</para>
/// <para> used by the game to coordinate with the steamUI</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static HSteamUser ConnectToGlobalUser(HSteamPipe hSteamPipe) {
InteropHelp.TestIfAvailableGameServer();
return (HSteamUser)NativeMethods.ISteamClient_ConnectToGlobalUser(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe);
}
/// <summary>
/// <para> used by game servers, create a steam user that won't be shared with anyone else</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static HSteamUser CreateLocalUser(out HSteamPipe phSteamPipe, EAccountType eAccountType) {
InteropHelp.TestIfAvailableGameServer();
return (HSteamUser)NativeMethods.ISteamClient_CreateLocalUser(CSteamGameServerAPIContext.GetSteamClient(), out phSteamPipe, eAccountType);
}
/// <summary>
/// <para> removes an allocated user</para>
/// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
/// </summary>
public static void ReleaseUser(HSteamPipe hSteamPipe, HSteamUser hUser) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamClient_ReleaseUser(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe, hUser);
}
/// <summary>
/// <para> retrieves the ISteamUser interface associated with the handle</para>
/// </summary>
public static IntPtr GetISteamUser(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamUser(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> retrieves the ISteamGameServer interface associated with the handle</para>
/// </summary>
public static IntPtr GetISteamGameServer(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamGameServer(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> set the local IP and Port to bind to</para>
/// <para> this must be set before CreateLocalUser()</para>
/// </summary>
public static void SetLocalIPBinding(ref SteamIPAddress_t unIP, ushort usPort) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamClient_SetLocalIPBinding(CSteamGameServerAPIContext.GetSteamClient(), ref unIP, usPort);
}
/// <summary>
/// <para> returns the ISteamFriends interface</para>
/// </summary>
public static IntPtr GetISteamFriends(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamFriends(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamUtils interface</para>
/// </summary>
public static IntPtr GetISteamUtils(HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamUtils(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamMatchmaking interface</para>
/// </summary>
public static IntPtr GetISteamMatchmaking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamMatchmaking(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamMatchmakingServers interface</para>
/// </summary>
public static IntPtr GetISteamMatchmakingServers(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamMatchmakingServers(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the a generic interface</para>
/// </summary>
public static IntPtr GetISteamGenericInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamGenericInterface(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamUserStats interface</para>
/// </summary>
public static IntPtr GetISteamUserStats(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamUserStats(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the ISteamGameServerStats interface</para>
/// </summary>
public static IntPtr GetISteamGameServerStats(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamGameServerStats(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns apps interface</para>
/// </summary>
public static IntPtr GetISteamApps(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamApps(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> networking</para>
/// </summary>
public static IntPtr GetISteamNetworking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamNetworking(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> remote storage</para>
/// </summary>
public static IntPtr GetISteamRemoteStorage(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamRemoteStorage(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> user screenshots</para>
/// </summary>
public static IntPtr GetISteamScreenshots(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamScreenshots(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> game search</para>
/// </summary>
public static IntPtr GetISteamGameSearch(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamGameSearch(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> returns the number of IPC calls made since the last time this function was called</para>
/// <para> Used for perf debugging so you can understand how many IPC calls your game makes per frame</para>
/// <para> Every IPC call is at minimum a thread context switch if not a process one so you want to rate</para>
/// <para> control how often you do them.</para>
/// </summary>
public static uint GetIPCCallCount() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamClient_GetIPCCallCount(CSteamGameServerAPIContext.GetSteamClient());
}
/// <summary>
/// <para> API warning handling</para>
/// <para> 'int' is the severity; 0 for msg, 1 for warning</para>
/// <para> 'const char *' is the text of the message</para>
/// <para> callbacks will occur directly after the API function is called that generated the warning or message.</para>
/// </summary>
public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamClient_SetWarningMessageHook(CSteamGameServerAPIContext.GetSteamClient(), pFunction);
}
/// <summary>
/// <para> Trigger global shutdown for the DLL</para>
/// </summary>
public static bool BShutdownIfAllPipesClosed() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamClient_BShutdownIfAllPipesClosed(CSteamGameServerAPIContext.GetSteamClient());
}
/// <summary>
/// <para> Expose HTTP interface</para>
/// </summary>
public static IntPtr GetISteamHTTP(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamHTTP(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Exposes the ISteamController interface - deprecated in favor of Steam Input</para>
/// </summary>
public static IntPtr GetISteamController(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamController(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Exposes the ISteamUGC interface</para>
/// </summary>
public static IntPtr GetISteamUGC(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamUGC(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Music Player</para>
/// </summary>
public static IntPtr GetISteamMusic(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamMusic(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Music Player Remote</para>
/// </summary>
public static IntPtr GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamMusicRemote(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> html page display</para>
/// </summary>
public static IntPtr GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamHTMLSurface(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> inventory</para>
/// </summary>
public static IntPtr GetISteamInventory(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamInventory(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Video</para>
/// </summary>
public static IntPtr GetISteamVideo(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamVideo(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Parental controls</para>
/// </summary>
public static IntPtr GetISteamParentalSettings(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamParentalSettings(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Exposes the Steam Input interface for controller support</para>
/// </summary>
public static IntPtr GetISteamInput(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamInput(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Steam Parties interface</para>
/// </summary>
public static IntPtr GetISteamParties(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamParties(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
/// <summary>
/// <para> Steam Remote Play interface</para>
/// </summary>
public static IntPtr GetISteamRemotePlay(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) {
InteropHelp.TestIfAvailableGameServer();
using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
return NativeMethods.ISteamClient_GetISteamRemotePlay(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4b4c8a2697f638c40a8e3c70f86e5c96
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,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 SteamGameServerHTTP {
/// <summary>
/// <para> Initializes a new HTTP request, returning a handle to use in further operations on it. Requires</para>
/// <para> the method (GET or POST) and the absolute URL for the request. Both http and https are supported,</para>
/// <para> so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/</para>
/// <para> or such.</para>
/// </summary>
public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL) {
InteropHelp.TestIfAvailableGameServer();
using (var pchAbsoluteURL2 = new InteropHelp.UTF8StringHandle(pchAbsoluteURL)) {
return (HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), eHTTPRequestMethod, pchAbsoluteURL2);
}
}
/// <summary>
/// <para> Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after</para>
/// <para> sending the request. This is just so the caller can easily keep track of which callbacks go with which request data.</para>
/// </summary>
public static bool SetHTTPRequestContextValue(HTTPRequestHandle hRequest, ulong ulContextValue) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_SetHTTPRequestContextValue(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, ulContextValue);
}
/// <summary>
/// <para> Set a timeout in seconds for the HTTP request, must be called prior to sending the request. Default</para>
/// <para> timeout is 60 seconds if you don't call this. Returns false if the handle is invalid, or the request</para>
/// <para> has already been sent.</para>
/// </summary>
public static bool SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle hRequest, uint unTimeoutSeconds) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_SetHTTPRequestNetworkActivityTimeout(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, unTimeoutSeconds);
}
/// <summary>
/// <para> Set a request header value for the request, must be called prior to sending the request. Will</para>
/// <para> return false if the handle is invalid or the request is already sent.</para>
/// </summary>
public static bool SetHTTPRequestHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, string pchHeaderValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName))
using (var pchHeaderValue2 = new InteropHelp.UTF8StringHandle(pchHeaderValue)) {
return NativeMethods.ISteamHTTP_SetHTTPRequestHeaderValue(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, pchHeaderValue2);
}
}
/// <summary>
/// <para> Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified</para>
/// <para> when creating the request. Must be called prior to sending the request. Will return false if the</para>
/// <para> handle is invalid or the request is already sent.</para>
/// </summary>
public static bool SetHTTPRequestGetOrPostParameter(HTTPRequestHandle hRequest, string pchParamName, string pchParamValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pchParamName2 = new InteropHelp.UTF8StringHandle(pchParamName))
using (var pchParamValue2 = new InteropHelp.UTF8StringHandle(pchParamValue)) {
return NativeMethods.ISteamHTTP_SetHTTPRequestGetOrPostParameter(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchParamName2, pchParamValue2);
}
}
/// <summary>
/// <para> Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on</para>
/// <para> asynchronous response via callback.</para>
/// <para> Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control</para>
/// <para> header and only do a local cache lookup rather than sending any actual remote request.</para>
/// </summary>
public static bool SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_SendHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pCallHandle);
}
/// <summary>
/// <para> Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on</para>
/// <para> asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and</para>
/// <para> HTTPRequestDataReceived_t callbacks while streaming.</para>
/// </summary>
public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_SendHTTPRequestAndStreamResponse(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pCallHandle);
}
/// <summary>
/// <para> Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move</para>
/// <para> the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent.</para>
/// </summary>
public static bool DeferHTTPRequest(HTTPRequestHandle hRequest) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_DeferHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest);
}
/// <summary>
/// <para> Prioritizes a request you have sent, the actual HTTP client code may have many requests queued, and this will move</para>
/// <para> the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent.</para>
/// </summary>
public static bool PrioritizeHTTPRequest(HTTPRequestHandle hRequest) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_PrioritizeHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest);
}
/// <summary>
/// <para> Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also</para>
/// <para> returns the size of the header value if present so the caller and allocate a correctly sized buffer for</para>
/// <para> GetHTTPResponseHeaderValue.</para>
/// </summary>
public static bool GetHTTPResponseHeaderSize(HTTPRequestHandle hRequest, string pchHeaderName, out uint unResponseHeaderSize) {
InteropHelp.TestIfAvailableGameServer();
using (var pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName)) {
return NativeMethods.ISteamHTTP_GetHTTPResponseHeaderSize(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, out unResponseHeaderSize);
}
}
/// <summary>
/// <para> Gets header values from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the</para>
/// <para> header is not present or if your buffer is too small to contain it's value. You should first call</para>
/// <para> BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed.</para>
/// </summary>
public static bool GetHTTPResponseHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, byte[] pHeaderValueBuffer, uint unBufferSize) {
InteropHelp.TestIfAvailableGameServer();
using (var pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName)) {
return NativeMethods.ISteamHTTP_GetHTTPResponseHeaderValue(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, pHeaderValueBuffer, unBufferSize);
}
}
/// <summary>
/// <para> Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the</para>
/// <para> handle is invalid.</para>
/// </summary>
public static bool GetHTTPResponseBodySize(HTTPRequestHandle hRequest, out uint unBodySize) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_GetHTTPResponseBodySize(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out unBodySize);
}
/// <summary>
/// <para> Gets the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the</para>
/// <para> handle is invalid or is to a streaming response, or if the provided buffer is not the correct size. Use BGetHTTPResponseBodySize first to find out</para>
/// <para> the correct buffer size to use.</para>
/// </summary>
public static bool GetHTTPResponseBodyData(HTTPRequestHandle hRequest, byte[] pBodyDataBuffer, uint unBufferSize) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_GetHTTPResponseBodyData(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pBodyDataBuffer, unBufferSize);
}
/// <summary>
/// <para> Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the</para>
/// <para> handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset</para>
/// <para> do not match the size and offset sent in HTTPRequestDataReceived_t.</para>
/// </summary>
public static bool GetHTTPStreamingResponseBodyData(HTTPRequestHandle hRequest, uint cOffset, byte[] pBodyDataBuffer, uint unBufferSize) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_GetHTTPStreamingResponseBodyData(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, cOffset, pBodyDataBuffer, unBufferSize);
}
/// <summary>
/// <para> Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t</para>
/// <para> callback and finishing using the response.</para>
/// </summary>
public static bool ReleaseHTTPRequest(HTTPRequestHandle hRequest) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_ReleaseHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest);
}
/// <summary>
/// <para> Gets progress on downloading the body for the request. This will be zero unless a response header has already been</para>
/// <para> received which included a content-length field. For responses that contain no content-length it will report</para>
/// <para> zero for the duration of the request as the size is unknown until the connection closes.</para>
/// </summary>
public static bool GetHTTPDownloadProgressPct(HTTPRequestHandle hRequest, out float pflPercentOut) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_GetHTTPDownloadProgressPct(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pflPercentOut);
}
/// <summary>
/// <para> Sets the body for an HTTP Post request. Will fail and return false on a GET request, and will fail if POST params</para>
/// <para> have already been set for the request. Setting this raw body makes it the only contents for the post, the pchContentType</para>
/// <para> parameter will set the content-type header for the request so the server may know how to interpret the body.</para>
/// </summary>
public static bool SetHTTPRequestRawPostBody(HTTPRequestHandle hRequest, string pchContentType, byte[] pubBody, uint unBodyLen) {
InteropHelp.TestIfAvailableGameServer();
using (var pchContentType2 = new InteropHelp.UTF8StringHandle(pchContentType)) {
return NativeMethods.ISteamHTTP_SetHTTPRequestRawPostBody(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchContentType2, pubBody, unBodyLen);
}
}
/// <summary>
/// <para> Creates a cookie container handle which you must later free with ReleaseCookieContainer(). If bAllowResponsesToModify=true</para>
/// <para> than any response to your requests using this cookie container may add new cookies which may be transmitted with</para>
/// <para> future requests. If bAllowResponsesToModify=false than only cookies you explicitly set will be sent. This API is just for</para>
/// <para> during process lifetime, after steam restarts no cookies are persisted and you have no way to access the cookie container across</para>
/// <para> repeat executions of your process.</para>
/// </summary>
public static HTTPCookieContainerHandle CreateCookieContainer(bool bAllowResponsesToModify) {
InteropHelp.TestIfAvailableGameServer();
return (HTTPCookieContainerHandle)NativeMethods.ISteamHTTP_CreateCookieContainer(CSteamGameServerAPIContext.GetSteamHTTP(), bAllowResponsesToModify);
}
/// <summary>
/// <para> Release a cookie container you are finished using, freeing it's memory</para>
/// </summary>
public static bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_ReleaseCookieContainer(CSteamGameServerAPIContext.GetSteamHTTP(), hCookieContainer);
}
/// <summary>
/// <para> Adds a cookie to the specified cookie container that will be used with future requests.</para>
/// </summary>
public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie) {
InteropHelp.TestIfAvailableGameServer();
using (var pchHost2 = new InteropHelp.UTF8StringHandle(pchHost))
using (var pchUrl2 = new InteropHelp.UTF8StringHandle(pchUrl))
using (var pchCookie2 = new InteropHelp.UTF8StringHandle(pchCookie)) {
return NativeMethods.ISteamHTTP_SetCookie(CSteamGameServerAPIContext.GetSteamHTTP(), hCookieContainer, pchHost2, pchUrl2, pchCookie2);
}
}
/// <summary>
/// <para> Set the cookie container to use for a HTTP request</para>
/// </summary>
public static bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_SetHTTPRequestCookieContainer(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, hCookieContainer);
}
/// <summary>
/// <para> Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end</para>
/// </summary>
public static bool SetHTTPRequestUserAgentInfo(HTTPRequestHandle hRequest, string pchUserAgentInfo) {
InteropHelp.TestIfAvailableGameServer();
using (var pchUserAgentInfo2 = new InteropHelp.UTF8StringHandle(pchUserAgentInfo)) {
return NativeMethods.ISteamHTTP_SetHTTPRequestUserAgentInfo(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchUserAgentInfo2);
}
}
/// <summary>
/// <para> Disable or re-enable verification of SSL/TLS certificates.</para>
/// <para> By default, certificates are checked for all HTTPS requests.</para>
/// </summary>
public static bool SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, bRequireVerifiedCertificate);
}
/// <summary>
/// <para> Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout</para>
/// <para> which can bump everytime we get more data</para>
/// </summary>
public static bool SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint unMilliseconds) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, unMilliseconds);
}
/// <summary>
/// <para> Check if the reason the request failed was because we timed it out (rather than some harder failure)</para>
/// </summary>
public static bool GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, out bool pbWasTimedOut) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamHTTP_GetHTTPRequestWasTimedOut(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pbWasTimedOut);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5a78311cd8781b041a4f4cc4990719ee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,478 @@
// 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 SteamGameServerInventory {
/// <summary>
/// <para> INVENTORY ASYNC RESULT MANAGEMENT</para>
/// <para> Asynchronous inventory queries always output a result handle which can be used with</para>
/// <para> GetResultStatus, GetResultItems, etc. A SteamInventoryResultReady_t callback will</para>
/// <para> be triggered when the asynchronous result becomes ready (or fails).</para>
/// <para> Find out the status of an asynchronous inventory result handle. Possible values:</para>
/// <para> k_EResultPending - still in progress</para>
/// <para> k_EResultOK - done, result ready</para>
/// <para> k_EResultExpired - done, result ready, maybe out of date (see DeserializeResult)</para>
/// <para> k_EResultInvalidParam - ERROR: invalid API call parameters</para>
/// <para> k_EResultServiceUnavailable - ERROR: service temporarily down, you may retry later</para>
/// <para> k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits</para>
/// <para> k_EResultFail - ERROR: unknown / generic error</para>
/// </summary>
public static EResult GetResultStatus(SteamInventoryResult_t resultHandle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_GetResultStatus(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle);
}
/// <summary>
/// <para> Copies the contents of a result set into a flat array. The specific</para>
/// <para> contents of the result set depend on which query which was used.</para>
/// </summary>
public static bool GetResultItems(SteamInventoryResult_t resultHandle, SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize) {
InteropHelp.TestIfAvailableGameServer();
if (pOutItemsArray != null && pOutItemsArray.Length != punOutItemsArraySize) {
throw new System.ArgumentException("pOutItemsArray must be the same size as punOutItemsArraySize!");
}
return NativeMethods.ISteamInventory_GetResultItems(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle, pOutItemsArray, ref punOutItemsArraySize);
}
/// <summary>
/// <para> In combination with GetResultItems, you can use GetResultItemProperty to retrieve</para>
/// <para> dynamic string properties for a given item returned in the result set.</para>
/// <para> Property names are always composed of ASCII letters, numbers, and/or underscores.</para>
/// <para> Pass a NULL pointer for pchPropertyName to get a comma - separated list of available</para>
/// <para> property names.</para>
/// <para> If pchValueBuffer is NULL, *punValueBufferSize will contain the</para>
/// <para> suggested buffer size. Otherwise it will be the number of bytes actually copied</para>
/// <para> to pchValueBuffer. If the results do not fit in the given buffer, partial</para>
/// <para> results may be copied.</para>
/// </summary>
public static bool GetResultItemProperty(SteamInventoryResult_t resultHandle, uint unItemIndex, string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchValueBuffer2 = Marshal.AllocHGlobal((int)punValueBufferSizeOut);
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
bool ret = NativeMethods.ISteamInventory_GetResultItemProperty(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle, unItemIndex, pchPropertyName2, pchValueBuffer2, ref punValueBufferSizeOut);
pchValueBuffer = ret ? InteropHelp.PtrToStringUTF8(pchValueBuffer2) : null;
Marshal.FreeHGlobal(pchValueBuffer2);
return ret;
}
}
/// <summary>
/// <para> Returns the server time at which the result was generated. Compare against</para>
/// <para> the value of IClientUtils::GetServerRealTime() to determine age.</para>
/// </summary>
public static uint GetResultTimestamp(SteamInventoryResult_t resultHandle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_GetResultTimestamp(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle);
}
/// <summary>
/// <para> Returns true if the result belongs to the target steam ID, false if the</para>
/// <para> result does not. This is important when using DeserializeResult, to verify</para>
/// <para> that a remote player is not pretending to have a different user's inventory.</para>
/// </summary>
public static bool CheckResultSteamID(SteamInventoryResult_t resultHandle, CSteamID steamIDExpected) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_CheckResultSteamID(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle, steamIDExpected);
}
/// <summary>
/// <para> Destroys a result handle and frees all associated memory.</para>
/// </summary>
public static void DestroyResult(SteamInventoryResult_t resultHandle) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamInventory_DestroyResult(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle);
}
/// <summary>
/// <para> INVENTORY ASYNC QUERY</para>
/// <para> Captures the entire state of the current user's Steam inventory.</para>
/// <para> You must call DestroyResult on this handle when you are done with it.</para>
/// <para> Returns false and sets *pResultHandle to zero if inventory is unavailable.</para>
/// <para> Note: calls to this function are subject to rate limits and may return</para>
/// <para> cached results if called too frequently. It is suggested that you call</para>
/// <para> this function only when you are about to display the user's full inventory,</para>
/// <para> or if you expect that the inventory may have changed.</para>
/// </summary>
public static bool GetAllItems(out SteamInventoryResult_t pResultHandle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_GetAllItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle);
}
/// <summary>
/// <para> Captures the state of a subset of the current user's Steam inventory,</para>
/// <para> identified by an array of item instance IDs. The results from this call</para>
/// <para> can be serialized and passed to other players to "prove" that the current</para>
/// <para> user owns specific items, without exposing the user's entire inventory.</para>
/// <para> For example, you could call GetItemsByID with the IDs of the user's</para>
/// <para> currently equipped cosmetic items and serialize this to a buffer, and</para>
/// <para> then transmit this buffer to other players upon joining a game.</para>
/// </summary>
public static bool GetItemsByID(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t[] pInstanceIDs, uint unCountInstanceIDs) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_GetItemsByID(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pInstanceIDs, unCountInstanceIDs);
}
/// <summary>
/// <para> RESULT SERIALIZATION AND AUTHENTICATION</para>
/// <para> Serialized result sets contain a short signature which can't be forged</para>
/// <para> or replayed across different game sessions. A result set can be serialized</para>
/// <para> on the local client, transmitted to other players via your game networking,</para>
/// <para> and deserialized by the remote players. This is a secure way of preventing</para>
/// <para> hackers from lying about posessing rare/high-value items.</para>
/// <para> Serializes a result set with signature bytes to an output buffer. Pass</para>
/// <para> NULL as an output buffer to get the required size via punOutBufferSize.</para>
/// <para> The size of a serialized result depends on the number items which are being</para>
/// <para> serialized. When securely transmitting items to other players, it is</para>
/// <para> recommended to use "GetItemsByID" first to create a minimal result set.</para>
/// <para> Results have a built-in timestamp which will be considered "expired" after</para>
/// <para> an hour has elapsed. See DeserializeResult for expiration handling.</para>
/// </summary>
public static bool SerializeResult(SteamInventoryResult_t resultHandle, byte[] pOutBuffer, out uint punOutBufferSize) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_SerializeResult(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle, pOutBuffer, out punOutBufferSize);
}
/// <summary>
/// <para> Deserializes a result set and verifies the signature bytes. Returns false</para>
/// <para> if bRequireFullOnlineVerify is set but Steam is running in Offline mode.</para>
/// <para> Otherwise returns true and then delivers error codes via GetResultStatus.</para>
/// <para> The bRESERVED_MUST_BE_FALSE flag is reserved for future use and should not</para>
/// <para> be set to true by your game at this time.</para>
/// <para> DeserializeResult has a potential soft-failure mode where the handle status</para>
/// <para> is set to k_EResultExpired. GetResultItems() still succeeds in this mode.</para>
/// <para> The "expired" result could indicate that the data may be out of date - not</para>
/// <para> just due to timed expiration (one hour), but also because one of the items</para>
/// <para> in the result set may have been traded or consumed since the result set was</para>
/// <para> generated. You could compare the timestamp from GetResultTimestamp() to</para>
/// <para> ISteamUtils::GetServerRealTime() to determine how old the data is. You could</para>
/// <para> simply ignore the "expired" result code and continue as normal, or you</para>
/// <para> could challenge the player with expired data to send an updated result set.</para>
/// </summary>
public static bool DeserializeResult(out SteamInventoryResult_t pOutResultHandle, byte[] pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE = false) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_DeserializeResult(CSteamGameServerAPIContext.GetSteamInventory(), out pOutResultHandle, pBuffer, unBufferSize, bRESERVED_MUST_BE_FALSE);
}
/// <summary>
/// <para> INVENTORY ASYNC MODIFICATION</para>
/// <para> GenerateItems() creates one or more items and then generates a SteamInventoryCallback_t</para>
/// <para> notification with a matching nCallbackContext parameter. This API is only intended</para>
/// <para> for prototyping - it is only usable by Steam accounts that belong to the publisher group</para>
/// <para> for your game.</para>
/// <para> If punArrayQuantity is not NULL, it should be the same length as pArrayItems and should</para>
/// <para> describe the quantity of each item to generate.</para>
/// </summary>
public static bool GenerateItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayItemDefs, uint[] punArrayQuantity, uint unArrayLength) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_GenerateItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pArrayItemDefs, punArrayQuantity, unArrayLength);
}
/// <summary>
/// <para> GrantPromoItems() checks the list of promotional items for which the user may be eligible</para>
/// <para> and grants the items (one time only). On success, the result set will include items which</para>
/// <para> were granted, if any. If no items were granted because the user isn't eligible for any</para>
/// <para> promotions, this is still considered a success.</para>
/// </summary>
public static bool GrantPromoItems(out SteamInventoryResult_t pResultHandle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_GrantPromoItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle);
}
/// <summary>
/// <para> AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of</para>
/// <para> scanning for all eligible promotional items, the check is restricted to a single item</para>
/// <para> definition or set of item definitions. This can be useful if your game has custom UI for</para>
/// <para> showing a specific promo item to the user.</para>
/// </summary>
public static bool AddPromoItem(out SteamInventoryResult_t pResultHandle, SteamItemDef_t itemDef) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_AddPromoItem(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, itemDef);
}
public static bool AddPromoItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayItemDefs, uint unArrayLength) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_AddPromoItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pArrayItemDefs, unArrayLength);
}
/// <summary>
/// <para> ConsumeItem() removes items from the inventory, permanently. They cannot be recovered.</para>
/// <para> Not for the faint of heart - if your game implements item removal at all, a high-friction</para>
/// <para> UI confirmation process is highly recommended.</para>
/// </summary>
public static bool ConsumeItem(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemConsume, uint unQuantity) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_ConsumeItem(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, itemConsume, unQuantity);
}
/// <summary>
/// <para> ExchangeItems() is an atomic combination of item generation and consumption.</para>
/// <para> It can be used to implement crafting recipes or transmutations, or items which unpack</para>
/// <para> themselves into other items (e.g., a chest).</para>
/// <para> Exchange recipes are defined in the ItemDef, and explicitly list the required item</para>
/// <para> types and resulting generated type.</para>
/// <para> Exchange recipes are evaluated atomically by the Inventory Service; if the supplied</para>
/// <para> components do not match the recipe, or do not contain sufficient quantity, the</para>
/// <para> exchange will fail.</para>
/// </summary>
public static bool ExchangeItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayGenerate, uint[] punArrayGenerateQuantity, uint unArrayGenerateLength, SteamItemInstanceID_t[] pArrayDestroy, uint[] punArrayDestroyQuantity, uint unArrayDestroyLength) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_ExchangeItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pArrayGenerate, punArrayGenerateQuantity, unArrayGenerateLength, pArrayDestroy, punArrayDestroyQuantity, unArrayDestroyLength);
}
/// <summary>
/// <para> TransferItemQuantity() is intended for use with items which are "stackable" (can have</para>
/// <para> quantity greater than one). It can be used to split a stack into two, or to transfer</para>
/// <para> quantity from one stack into another stack of identical items. To split one stack into</para>
/// <para> two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.</para>
/// </summary>
public static bool TransferItemQuantity(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemIdSource, uint unQuantity, SteamItemInstanceID_t itemIdDest) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_TransferItemQuantity(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, itemIdSource, unQuantity, itemIdDest);
}
/// <summary>
/// <para> TIMED DROPS AND PLAYTIME CREDIT</para>
/// <para> Deprecated. Calling this method is not required for proper playtime accounting.</para>
/// </summary>
public static void SendItemDropHeartbeat() {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamInventory_SendItemDropHeartbeat(CSteamGameServerAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> Playtime credit must be consumed and turned into item drops by your game. Only item</para>
/// <para> definitions which are marked as "playtime item generators" can be spawned. The call</para>
/// <para> will return an empty result set if there is not enough playtime credit for a drop.</para>
/// <para> Your game should call TriggerItemDrop at an appropriate time for the user to receive</para>
/// <para> new items, such as between rounds or while the player is dead. Note that players who</para>
/// <para> hack their clients could modify the value of "dropListDefinition", so do not use it</para>
/// <para> to directly control rarity.</para>
/// <para> See your Steamworks configuration to set playtime drop rates for individual itemdefs.</para>
/// <para> The client library will suppress too-frequent calls to this method.</para>
/// </summary>
public static bool TriggerItemDrop(out SteamInventoryResult_t pResultHandle, SteamItemDef_t dropListDefinition) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_TriggerItemDrop(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, dropListDefinition);
}
/// <summary>
/// <para> Deprecated. This method is not supported.</para>
/// </summary>
public static bool TradeItems(out SteamInventoryResult_t pResultHandle, CSteamID steamIDTradePartner, SteamItemInstanceID_t[] pArrayGive, uint[] pArrayGiveQuantity, uint nArrayGiveLength, SteamItemInstanceID_t[] pArrayGet, uint[] pArrayGetQuantity, uint nArrayGetLength) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_TradeItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, steamIDTradePartner, pArrayGive, pArrayGiveQuantity, nArrayGiveLength, pArrayGet, pArrayGetQuantity, nArrayGetLength);
}
/// <summary>
/// <para> ITEM DEFINITIONS</para>
/// <para> Item definitions are a mapping of "definition IDs" (integers between 1 and 1000000)</para>
/// <para> to a set of string properties. Some of these properties are required to display items</para>
/// <para> on the Steam community web site. Other properties can be defined by applications.</para>
/// <para> Use of these functions is optional; there is no reason to call LoadItemDefinitions</para>
/// <para> if your game hardcodes the numeric definition IDs (eg, purple face mask = 20, blue</para>
/// <para> weapon mod = 55) and does not allow for adding new item types without a client patch.</para>
/// <para> LoadItemDefinitions triggers the automatic load and refresh of item definitions.</para>
/// <para> Every time new item definitions are available (eg, from the dynamic addition of new</para>
/// <para> item types while players are still in-game), a SteamInventoryDefinitionUpdate_t</para>
/// <para> callback will be fired.</para>
/// </summary>
public static bool LoadItemDefinitions() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_LoadItemDefinitions(CSteamGameServerAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> GetItemDefinitionIDs returns the set of all defined item definition IDs (which are</para>
/// <para> defined via Steamworks configuration, and not necessarily contiguous integers).</para>
/// <para> If pItemDefIDs is null, the call will return true and *punItemDefIDsArraySize will</para>
/// <para> contain the total size necessary for a subsequent call. Otherwise, the call will</para>
/// <para> return false if and only if there is not enough space in the output array.</para>
/// </summary>
public static bool GetItemDefinitionIDs(SteamItemDef_t[] pItemDefIDs, ref uint punItemDefIDsArraySize) {
InteropHelp.TestIfAvailableGameServer();
if (pItemDefIDs != null && pItemDefIDs.Length != punItemDefIDsArraySize) {
throw new System.ArgumentException("pItemDefIDs must be the same size as punItemDefIDsArraySize!");
}
return NativeMethods.ISteamInventory_GetItemDefinitionIDs(CSteamGameServerAPIContext.GetSteamInventory(), pItemDefIDs, ref punItemDefIDsArraySize);
}
/// <summary>
/// <para> GetItemDefinitionProperty returns a string property from a given item definition.</para>
/// <para> Note that some properties (for example, "name") may be localized and will depend</para>
/// <para> on the current Steam language settings (see ISteamApps::GetCurrentGameLanguage).</para>
/// <para> Property names are always composed of ASCII letters, numbers, and/or underscores.</para>
/// <para> Pass a NULL pointer for pchPropertyName to get a comma - separated list of available</para>
/// <para> property names. If pchValueBuffer is NULL, *punValueBufferSize will contain the</para>
/// <para> suggested buffer size. Otherwise it will be the number of bytes actually copied</para>
/// <para> to pchValueBuffer. If the results do not fit in the given buffer, partial</para>
/// <para> results may be copied.</para>
/// </summary>
public static bool GetItemDefinitionProperty(SteamItemDef_t iDefinition, string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchValueBuffer2 = Marshal.AllocHGlobal((int)punValueBufferSizeOut);
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
bool ret = NativeMethods.ISteamInventory_GetItemDefinitionProperty(CSteamGameServerAPIContext.GetSteamInventory(), iDefinition, pchPropertyName2, pchValueBuffer2, ref punValueBufferSizeOut);
pchValueBuffer = ret ? InteropHelp.PtrToStringUTF8(pchValueBuffer2) : null;
Marshal.FreeHGlobal(pchValueBuffer2);
return ret;
}
}
/// <summary>
/// <para> Request the list of "eligible" promo items that can be manually granted to the given</para>
/// <para> user. These are promo items of type "manual" that won't be granted automatically.</para>
/// <para> An example usage of this is an item that becomes available every week.</para>
/// </summary>
public static SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs(CSteamID steamID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamInventory_RequestEligiblePromoItemDefinitionsIDs(CSteamGameServerAPIContext.GetSteamInventory(), steamID);
}
/// <summary>
/// <para> After handling a SteamInventoryEligiblePromoItemDefIDs_t call result, use this</para>
/// <para> function to pull out the list of item definition ids that the user can be</para>
/// <para> manually granted via the AddPromoItems() call.</para>
/// </summary>
public static bool GetEligiblePromoItemDefinitionIDs(CSteamID steamID, SteamItemDef_t[] pItemDefIDs, ref uint punItemDefIDsArraySize) {
InteropHelp.TestIfAvailableGameServer();
if (pItemDefIDs != null && pItemDefIDs.Length != punItemDefIDsArraySize) {
throw new System.ArgumentException("pItemDefIDs must be the same size as punItemDefIDsArraySize!");
}
return NativeMethods.ISteamInventory_GetEligiblePromoItemDefinitionIDs(CSteamGameServerAPIContext.GetSteamInventory(), steamID, pItemDefIDs, ref punItemDefIDsArraySize);
}
/// <summary>
/// <para> Starts the purchase process for the given item definitions. The callback SteamInventoryStartPurchaseResult_t</para>
/// <para> will be posted if Steam was able to initialize the transaction.</para>
/// <para> Once the purchase has been authorized and completed by the user, the callback SteamInventoryResultReady_t</para>
/// <para> will be posted.</para>
/// </summary>
public static SteamAPICall_t StartPurchase(SteamItemDef_t[] pArrayItemDefs, uint[] punArrayQuantity, uint unArrayLength) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamInventory_StartPurchase(CSteamGameServerAPIContext.GetSteamInventory(), pArrayItemDefs, punArrayQuantity, unArrayLength);
}
/// <summary>
/// <para> Request current prices for all applicable item definitions</para>
/// </summary>
public static SteamAPICall_t RequestPrices() {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamInventory_RequestPrices(CSteamGameServerAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> Returns the number of items with prices. Need to call RequestPrices() first.</para>
/// </summary>
public static uint GetNumItemsWithPrices() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_GetNumItemsWithPrices(CSteamGameServerAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> Returns item definition ids and their prices in the user's local currency.</para>
/// <para> Need to call RequestPrices() first.</para>
/// </summary>
public static bool GetItemsWithPrices(SteamItemDef_t[] pArrayItemDefs, ulong[] pCurrentPrices, ulong[] pBasePrices, uint unArrayLength) {
InteropHelp.TestIfAvailableGameServer();
if (pArrayItemDefs != null && pArrayItemDefs.Length != unArrayLength) {
throw new System.ArgumentException("pArrayItemDefs must be the same size as unArrayLength!");
}
if (pCurrentPrices != null && pCurrentPrices.Length != unArrayLength) {
throw new System.ArgumentException("pCurrentPrices must be the same size as unArrayLength!");
}
if (pBasePrices != null && pBasePrices.Length != unArrayLength) {
throw new System.ArgumentException("pBasePrices must be the same size as unArrayLength!");
}
return NativeMethods.ISteamInventory_GetItemsWithPrices(CSteamGameServerAPIContext.GetSteamInventory(), pArrayItemDefs, pCurrentPrices, pBasePrices, unArrayLength);
}
/// <summary>
/// <para> Retrieves the price for the item definition id</para>
/// <para> Returns false if there is no price stored for the item definition.</para>
/// </summary>
public static bool GetItemPrice(SteamItemDef_t iDefinition, out ulong pCurrentPrice, out ulong pBasePrice) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_GetItemPrice(CSteamGameServerAPIContext.GetSteamInventory(), iDefinition, out pCurrentPrice, out pBasePrice);
}
/// <summary>
/// <para> Create a request to update properties on items</para>
/// </summary>
public static SteamInventoryUpdateHandle_t StartUpdateProperties() {
InteropHelp.TestIfAvailableGameServer();
return (SteamInventoryUpdateHandle_t)NativeMethods.ISteamInventory_StartUpdateProperties(CSteamGameServerAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> Remove the property on the item</para>
/// </summary>
public static bool RemoveProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName) {
InteropHelp.TestIfAvailableGameServer();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
return NativeMethods.ISteamInventory_RemoveProperty(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2);
}
}
/// <summary>
/// <para> Accessor methods to set properties on items</para>
/// </summary>
public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, string pchPropertyValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName))
using (var pchPropertyValue2 = new InteropHelp.UTF8StringHandle(pchPropertyValue)) {
return NativeMethods.ISteamInventory_SetPropertyString(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, pchPropertyValue2);
}
}
public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, bool bValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
return NativeMethods.ISteamInventory_SetPropertyBool(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, bValue);
}
}
public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, long nValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
return NativeMethods.ISteamInventory_SetPropertyInt64(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, nValue);
}
}
public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, float flValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
return NativeMethods.ISteamInventory_SetPropertyFloat(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, flValue);
}
}
/// <summary>
/// <para> Submit the update request by handle</para>
/// </summary>
public static bool SubmitUpdateProperties(SteamInventoryUpdateHandle_t handle, out SteamInventoryResult_t pResultHandle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamInventory_SubmitUpdateProperties(CSteamGameServerAPIContext.GetSteamInventory(), handle, out pResultHandle);
}
public static bool InspectItem(out SteamInventoryResult_t pResultHandle, string pchItemToken) {
InteropHelp.TestIfAvailableGameServer();
using (var pchItemToken2 = new InteropHelp.UTF8StringHandle(pchItemToken)) {
return NativeMethods.ISteamInventory_InspectItem(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pchItemToken2);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 10c74c5b7d1df524ab3ad296b9efe267
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,270 @@
// 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 SteamGameServerNetworking {
/// <summary>
/// <para>//////////////////////////////////////////////////////////////////////////////////////////</para>
/// <para> UDP-style (connectionless) networking interface. These functions send messages using</para>
/// <para> an API organized around the destination. Reliable and unreliable messages are supported.</para>
/// <para> For a more TCP-style interface (meaning you have a connection handle), see the functions below.</para>
/// <para> Both interface styles can send both reliable and unreliable messages.</para>
/// <para> Automatically establishes NAT-traversing or Relay server connections</para>
/// <para> These APIs are deprecated, and may be removed in a future version of the Steamworks</para>
/// <para> SDK. See ISteamNetworkingMessages.</para>
/// <para> Sends a P2P packet to the specified user</para>
/// <para> UDP-like, unreliable and a max packet size of 1200 bytes</para>
/// <para> the first packet send may be delayed as the NAT-traversal code runs</para>
/// <para> if we can't get through to the user, an error will be posted via the callback P2PSessionConnectFail_t</para>
/// <para> see EP2PSend enum above for the descriptions of the different ways of sending packets</para>
/// <para> nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket()</para>
/// <para> with the same channel number in order to retrieve the data on the other end</para>
/// <para> using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources</para>
/// </summary>
public static bool SendP2PPacket(CSteamID steamIDRemote, byte[] pubData, uint cubData, EP2PSend eP2PSendType, int nChannel = 0) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_SendP2PPacket(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote, pubData, cubData, eP2PSendType, nChannel);
}
/// <summary>
/// <para> returns true if any data is available for read, and the amount of data that will need to be read</para>
/// </summary>
public static bool IsP2PPacketAvailable(out uint pcubMsgSize, int nChannel = 0) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_IsP2PPacketAvailable(CSteamGameServerAPIContext.GetSteamNetworking(), out pcubMsgSize, nChannel);
}
/// <summary>
/// <para> reads in a packet that has been sent from another user via SendP2PPacket()</para>
/// <para> returns the size of the message and the steamID of the user who sent it in the last two parameters</para>
/// <para> if the buffer passed in is too small, the message will be truncated</para>
/// <para> this call is not blocking, and will return false if no data is available</para>
/// </summary>
public static bool ReadP2PPacket(byte[] pubDest, uint cubDest, out uint pcubMsgSize, out CSteamID psteamIDRemote, int nChannel = 0) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_ReadP2PPacket(CSteamGameServerAPIContext.GetSteamNetworking(), pubDest, cubDest, out pcubMsgSize, out psteamIDRemote, nChannel);
}
/// <summary>
/// <para> AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback</para>
/// <para> P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet</para>
/// <para> if you don't want to talk to the user, just ignore the request</para>
/// <para> if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically</para>
/// <para> this may be called multiple times for a single user</para>
/// <para> (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)</para>
/// </summary>
public static bool AcceptP2PSessionWithUser(CSteamID steamIDRemote) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_AcceptP2PSessionWithUser(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote);
}
/// <summary>
/// <para> call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood</para>
/// <para> if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted</para>
/// </summary>
public static bool CloseP2PSessionWithUser(CSteamID steamIDRemote) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_CloseP2PSessionWithUser(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote);
}
/// <summary>
/// <para> call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels</para>
/// <para> open channels to a user have been closed, the open session to the user will be closed and new data from this</para>
/// <para> user will trigger a P2PSessionRequest_t callback</para>
/// </summary>
public static bool CloseP2PChannelWithUser(CSteamID steamIDRemote, int nChannel) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_CloseP2PChannelWithUser(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote, nChannel);
}
/// <summary>
/// <para> fills out P2PSessionState_t structure with details about the underlying connection to the user</para>
/// <para> should only needed for debugging purposes</para>
/// <para> returns false if no connection exists to the specified user</para>
/// </summary>
public static bool GetP2PSessionState(CSteamID steamIDRemote, out P2PSessionState_t pConnectionState) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_GetP2PSessionState(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote, out pConnectionState);
}
/// <summary>
/// <para> Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection</para>
/// <para> or NAT-traversal cannot be established. Only applies to connections created after setting this value,</para>
/// <para> or to existing connections that need to automatically reconnect after this value is set.</para>
/// <para> P2P packet relay is allowed by default</para>
/// <para> NOTE: This function is deprecated and may be removed in a future version of the SDK. For</para>
/// <para> security purposes, we may decide to relay the traffic to certain peers, even if you pass false</para>
/// <para> to this function, to prevent revealing the client's IP address top another peer.</para>
/// </summary>
public static bool AllowP2PPacketRelay(bool bAllow) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_AllowP2PPacketRelay(CSteamGameServerAPIContext.GetSteamNetworking(), bAllow);
}
/// <summary>
/// <para>//////////////////////////////////////////////////////////////////////////////////////////</para>
/// <para> LISTEN / CONNECT connection-oriented interface functions</para>
/// <para> These functions are more like a client-server TCP API. One side is the "server"</para>
/// <para> and "listens" for incoming connections, which then must be "accepted." The "client"</para>
/// <para> initiates a connection by "connecting." Sending and receiving is done through a</para>
/// <para> connection handle.</para>
/// <para> For a more UDP-style interface, where you do not track connection handles but</para>
/// <para> simply send messages to a SteamID, use the UDP-style functions above.</para>
/// <para> Both methods can send both reliable and unreliable methods.</para>
/// <para> These APIs are deprecated, and may be removed in a future version of the Steamworks</para>
/// <para> SDK. See ISteamNetworkingSockets.</para>
/// <para>//////////////////////////////////////////////////////////////////////////////////////////</para>
/// <para> creates a socket and listens others to connect</para>
/// <para> will trigger a SocketStatusCallback_t callback on another client connecting</para>
/// <para> nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports</para>
/// <para> this can usually just be 0 unless you want multiple sets of connections</para>
/// <para> unIP is the local IP address to bind to</para>
/// <para> pass in 0 if you just want the default local IP</para>
/// <para> unPort is the port to use</para>
/// <para> pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only</para>
/// </summary>
public static SNetListenSocket_t CreateListenSocket(int nVirtualP2PPort, SteamIPAddress_t nIP, ushort nPort, bool bAllowUseOfPacketRelay) {
InteropHelp.TestIfAvailableGameServer();
return (SNetListenSocket_t)NativeMethods.ISteamNetworking_CreateListenSocket(CSteamGameServerAPIContext.GetSteamNetworking(), nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay);
}
/// <summary>
/// <para> creates a socket and begin connection to a remote destination</para>
/// <para> can connect via a known steamID (client or game server), or directly to an IP</para>
/// <para> on success will trigger a SocketStatusCallback_t callback</para>
/// <para> on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState</para>
/// </summary>
public static SNetSocket_t CreateP2PConnectionSocket(CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay) {
InteropHelp.TestIfAvailableGameServer();
return (SNetSocket_t)NativeMethods.ISteamNetworking_CreateP2PConnectionSocket(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDTarget, nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay);
}
public static SNetSocket_t CreateConnectionSocket(SteamIPAddress_t nIP, ushort nPort, int nTimeoutSec) {
InteropHelp.TestIfAvailableGameServer();
return (SNetSocket_t)NativeMethods.ISteamNetworking_CreateConnectionSocket(CSteamGameServerAPIContext.GetSteamNetworking(), nIP, nPort, nTimeoutSec);
}
/// <summary>
/// <para> disconnects the connection to the socket, if any, and invalidates the handle</para>
/// <para> any unread data on the socket will be thrown away</para>
/// <para> if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect</para>
/// </summary>
public static bool DestroySocket(SNetSocket_t hSocket, bool bNotifyRemoteEnd) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_DestroySocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, bNotifyRemoteEnd);
}
/// <summary>
/// <para> destroying a listen socket will automatically kill all the regular sockets generated from it</para>
/// </summary>
public static bool DestroyListenSocket(SNetListenSocket_t hSocket, bool bNotifyRemoteEnd) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_DestroyListenSocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, bNotifyRemoteEnd);
}
/// <summary>
/// <para> sending data</para>
/// <para> must be a handle to a connected socket</para>
/// <para> data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets</para>
/// <para> use the reliable flag with caution; although the resend rate is pretty aggressive,</para>
/// <para> it can still cause stalls in receiving data (like TCP)</para>
/// </summary>
public static bool SendDataOnSocket(SNetSocket_t hSocket, byte[] pubData, uint cubData, bool bReliable) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_SendDataOnSocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, pubData, cubData, bReliable);
}
/// <summary>
/// <para> receiving data</para>
/// <para> returns false if there is no data remaining</para>
/// <para> fills out *pcubMsgSize with the size of the next message, in bytes</para>
/// </summary>
public static bool IsDataAvailableOnSocket(SNetSocket_t hSocket, out uint pcubMsgSize) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_IsDataAvailableOnSocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, out pcubMsgSize);
}
/// <summary>
/// <para> fills in pubDest with the contents of the message</para>
/// <para> messages are always complete, of the same size as was sent (i.e. packetized, not streaming)</para>
/// <para> if *pcubMsgSize &lt; cubDest, only partial data is written</para>
/// <para> returns false if no data is available</para>
/// </summary>
public static bool RetrieveDataFromSocket(SNetSocket_t hSocket, byte[] pubDest, uint cubDest, out uint pcubMsgSize) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_RetrieveDataFromSocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, pubDest, cubDest, out pcubMsgSize);
}
/// <summary>
/// <para> checks for data from any socket that has been connected off this listen socket</para>
/// <para> returns false if there is no data remaining</para>
/// <para> fills out *pcubMsgSize with the size of the next message, in bytes</para>
/// <para> fills out *phSocket with the socket that data is available on</para>
/// </summary>
public static bool IsDataAvailable(SNetListenSocket_t hListenSocket, out uint pcubMsgSize, out SNetSocket_t phSocket) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_IsDataAvailable(CSteamGameServerAPIContext.GetSteamNetworking(), hListenSocket, out pcubMsgSize, out phSocket);
}
/// <summary>
/// <para> retrieves data from any socket that has been connected off this listen socket</para>
/// <para> fills in pubDest with the contents of the message</para>
/// <para> messages are always complete, of the same size as was sent (i.e. packetized, not streaming)</para>
/// <para> if *pcubMsgSize &lt; cubDest, only partial data is written</para>
/// <para> returns false if no data is available</para>
/// <para> fills out *phSocket with the socket that data is available on</para>
/// </summary>
public static bool RetrieveData(SNetListenSocket_t hListenSocket, byte[] pubDest, uint cubDest, out uint pcubMsgSize, out SNetSocket_t phSocket) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_RetrieveData(CSteamGameServerAPIContext.GetSteamNetworking(), hListenSocket, pubDest, cubDest, out pcubMsgSize, out phSocket);
}
/// <summary>
/// <para> returns information about the specified socket, filling out the contents of the pointers</para>
/// </summary>
public static bool GetSocketInfo(SNetSocket_t hSocket, out CSteamID pSteamIDRemote, out int peSocketStatus, out SteamIPAddress_t punIPRemote, out ushort punPortRemote) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_GetSocketInfo(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, out pSteamIDRemote, out peSocketStatus, out punIPRemote, out punPortRemote);
}
/// <summary>
/// <para> returns which local port the listen socket is bound to</para>
/// <para> *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only</para>
/// </summary>
public static bool GetListenSocketInfo(SNetListenSocket_t hListenSocket, out SteamIPAddress_t pnIP, out ushort pnPort) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_GetListenSocketInfo(CSteamGameServerAPIContext.GetSteamNetworking(), hListenSocket, out pnIP, out pnPort);
}
/// <summary>
/// <para> returns true to describe how the socket ended up connecting</para>
/// </summary>
public static ESNetSocketConnectionType GetSocketConnectionType(SNetSocket_t hSocket) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_GetSocketConnectionType(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket);
}
/// <summary>
/// <para> max packet size, in bytes</para>
/// </summary>
public static int GetMaxPacketSize(SNetSocket_t hSocket) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworking_GetMaxPacketSize(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb8e260012cb01949bdbff38c366d4d6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,142 @@
// 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 SteamGameServerNetworkingMessages {
/// <summary>
/// <para>/ Sends a message to the specified host. If we don't already have a session with that user,</para>
/// <para>/ a session is implicitly created. There might be some handshaking that needs to happen</para>
/// <para>/ before we can actually begin sending message data. If this handshaking fails and we can't</para>
/// <para>/ get through, an error will be posted via the callback SteamNetworkingMessagesSessionFailed_t.</para>
/// <para>/ There is no notification when the operation succeeds. (You should have the peer send a reply</para>
/// <para>/ for this purpose.)</para>
/// <para>/</para>
/// <para>/ Sending a message to a host will also implicitly accept any incoming connection from that host.</para>
/// <para>/</para>
/// <para>/ nSendFlags is a bitmask of k_nSteamNetworkingSend_xxx options</para>
/// <para>/</para>
/// <para>/ nRemoteChannel is a routing number you can use to help route message to different systems.</para>
/// <para>/ You'll have to call ReceiveMessagesOnChannel() with the same channel number in order to retrieve</para>
/// <para>/ the data on the other end.</para>
/// <para>/</para>
/// <para>/ Using different channels to talk to the same user will still use the same underlying</para>
/// <para>/ connection, saving on resources. If you don't need this feature, use 0.</para>
/// <para>/ Otherwise, small integers are the most efficient.</para>
/// <para>/</para>
/// <para>/ It is guaranteed that reliable messages to the same host on the same channel</para>
/// <para>/ will be be received by the remote host (if they are received at all) exactly once,</para>
/// <para>/ and in the same order that they were sent.</para>
/// <para>/</para>
/// <para>/ NO other order guarantees exist! In particular, unreliable messages may be dropped,</para>
/// <para>/ received out of order with respect to each other and with respect to reliable data,</para>
/// <para>/ or may be received multiple times. Messages on different channels are *not* guaranteed</para>
/// <para>/ to be received in the order they were sent.</para>
/// <para>/</para>
/// <para>/ A note for those familiar with TCP/IP ports, or converting an existing codebase that</para>
/// <para>/ opened multiple sockets: You might notice that there is only one channel, and with</para>
/// <para>/ TCP/IP each endpoint has a port number. You can think of the channel number as the</para>
/// <para>/ *destination* port. If you need each message to also include a "source port" (so the</para>
/// <para>/ recipient can route the reply), then just put that in your message. That is essentially</para>
/// <para>/ how UDP works!</para>
/// <para>/</para>
/// <para>/ Returns:</para>
/// <para>/ - k_EREsultOK on success.</para>
/// <para>/ - k_EResultNoConnection, if the session has failed or was closed by the peer and</para>
/// <para>/ k_nSteamNetworkingSend_AutoRestartBrokenSession was not specified. (You can</para>
/// <para>/ use GetSessionConnectionInfo to get the details.) In order to acknowledge the</para>
/// <para>/ broken session and start a new one, you must call CloseSessionWithUser, or you may</para>
/// <para>/ repeat the call with k_nSteamNetworkingSend_AutoRestartBrokenSession. See</para>
/// <para>/ k_nSteamNetworkingSend_AutoRestartBrokenSession for more details.</para>
/// <para>/ - See ISteamNetworkingSockets::SendMessageToConnection for more possible return values</para>
/// </summary>
public static EResult SendMessageToUser(ref SteamNetworkingIdentity identityRemote, IntPtr pubData, uint cubData, int nSendFlags, int nRemoteChannel) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingMessages_SendMessageToUser(CSteamGameServerAPIContext.GetSteamNetworkingMessages(), ref identityRemote, pubData, cubData, nSendFlags, nRemoteChannel);
}
/// <summary>
/// <para>/ Reads the next message that has been sent from another user via SendMessageToUser() on the given channel.</para>
/// <para>/ Returns number of messages returned into your list. (0 if no message are available on that channel.)</para>
/// <para>/</para>
/// <para>/ When you're done with the message object(s), make sure and call SteamNetworkingMessage_t::Release()!</para>
/// </summary>
public static int ReceiveMessagesOnChannel(int nLocalChannel, IntPtr[] ppOutMessages, int nMaxMessages) {
InteropHelp.TestIfAvailableGameServer();
if (ppOutMessages != null && ppOutMessages.Length != nMaxMessages) {
throw new System.ArgumentException("ppOutMessages must be the same size as nMaxMessages!");
}
return NativeMethods.ISteamNetworkingMessages_ReceiveMessagesOnChannel(CSteamGameServerAPIContext.GetSteamNetworkingMessages(), nLocalChannel, ppOutMessages, nMaxMessages);
}
/// <summary>
/// <para>/ Call this in response to a SteamNetworkingMessagesSessionRequest_t callback.</para>
/// <para>/ SteamNetworkingMessagesSessionRequest_t are posted when a user tries to send you a message,</para>
/// <para>/ and you haven't tried to talk to them first. If you don't want to talk to them, just ignore</para>
/// <para>/ the request. If the user continues to send you messages, SteamNetworkingMessagesSessionRequest_t</para>
/// <para>/ callbacks will continue to be posted periodically.</para>
/// <para>/</para>
/// <para>/ Returns false if there is no session with the user pending or otherwise. If there is an</para>
/// <para>/ existing active session, this function will return true, even if it is not pending.</para>
/// <para>/</para>
/// <para>/ Calling SendMessageToUser() will implicitly accepts any pending session request to that user.</para>
/// </summary>
public static bool AcceptSessionWithUser(ref SteamNetworkingIdentity identityRemote) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingMessages_AcceptSessionWithUser(CSteamGameServerAPIContext.GetSteamNetworkingMessages(), ref identityRemote);
}
/// <summary>
/// <para>/ Call this when you're done talking to a user to immediately free up resources under-the-hood.</para>
/// <para>/ If the remote user tries to send data to you again, another SteamNetworkingMessagesSessionRequest_t</para>
/// <para>/ callback will be posted.</para>
/// <para>/</para>
/// <para>/ Note that sessions that go unused for a few minutes are automatically timed out.</para>
/// </summary>
public static bool CloseSessionWithUser(ref SteamNetworkingIdentity identityRemote) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingMessages_CloseSessionWithUser(CSteamGameServerAPIContext.GetSteamNetworkingMessages(), ref identityRemote);
}
/// <summary>
/// <para>/ Call this when you're done talking to a user on a specific channel. Once all</para>
/// <para>/ open channels to a user have been closed, the open session to the user will be</para>
/// <para>/ closed, and any new data from this user will trigger a</para>
/// <para>/ SteamSteamNetworkingMessagesSessionRequest_t callback</para>
/// </summary>
public static bool CloseChannelWithUser(ref SteamNetworkingIdentity identityRemote, int nLocalChannel) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingMessages_CloseChannelWithUser(CSteamGameServerAPIContext.GetSteamNetworkingMessages(), ref identityRemote, nLocalChannel);
}
/// <summary>
/// <para>/ Returns information about the latest state of a connection, if any, with the given peer.</para>
/// <para>/ Primarily intended for debugging purposes, but can also be used to get more detailed</para>
/// <para>/ failure information. (See SendMessageToUser and k_nSteamNetworkingSend_AutoRestartBrokenSession.)</para>
/// <para>/</para>
/// <para>/ Returns the value of SteamNetConnectionInfo_t::m_eState, or k_ESteamNetworkingConnectionState_None</para>
/// <para>/ if no connection exists with specified peer. You may pass nullptr for either parameter if</para>
/// <para>/ you do not need the corresponding details. Note that sessions time out after a while,</para>
/// <para>/ so if a connection fails, or SendMessageToUser returns k_EResultNoConnection, you cannot wait</para>
/// <para>/ indefinitely to obtain the reason for failure.</para>
/// </summary>
public static ESteamNetworkingConnectionState GetSessionConnectionInfo(ref SteamNetworkingIdentity identityRemote, out SteamNetConnectionInfo_t pConnectionInfo, out SteamNetConnectionRealTimeStatus_t pQuickStatus) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingMessages_GetSessionConnectionInfo(CSteamGameServerAPIContext.GetSteamNetworkingMessages(), ref identityRemote, out pConnectionInfo, out pQuickStatus);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 52f59aadf93dd5a47b52ba2e4b178aee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 175e632ae8fecc24e902fada780c39dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,443 @@
// 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 SteamGameServerNetworkingUtils {
/// <summary>
/// <para> Efficient message sending</para>
/// <para>/ Allocate and initialize a message object. Usually the reason</para>
/// <para>/ you call this is to pass it to ISteamNetworkingSockets::SendMessages.</para>
/// <para>/ The returned object will have all of the relevant fields cleared to zero.</para>
/// <para>/</para>
/// <para>/ Optionally you can also request that this system allocate space to</para>
/// <para>/ hold the payload itself. If cbAllocateBuffer is nonzero, the system</para>
/// <para>/ will allocate memory to hold a payload of at least cbAllocateBuffer bytes.</para>
/// <para>/ m_pData will point to the allocated buffer, m_cbSize will be set to the</para>
/// <para>/ size, and m_pfnFreeData will be set to the proper function to free up</para>
/// <para>/ the buffer.</para>
/// <para>/</para>
/// <para>/ If cbAllocateBuffer=0, then no buffer is allocated. m_pData will be NULL,</para>
/// <para>/ m_cbSize will be zero, and m_pfnFreeData will be NULL. You will need to</para>
/// <para>/ set each of these.</para>
/// </summary>
public static IntPtr AllocateMessage(int cbAllocateBuffer) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_AllocateMessage(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), cbAllocateBuffer);
}
/// <summary>
/// <para> Access to Steam Datagram Relay (SDR) network</para>
/// <para> Initialization and status check</para>
/// <para>/ If you know that you are going to be using the relay network (for example,</para>
/// <para>/ because you anticipate making P2P connections), call this to initialize the</para>
/// <para>/ relay network. If you do not call this, the initialization will</para>
/// <para>/ be delayed until the first time you use a feature that requires access</para>
/// <para>/ to the relay network, which will delay that first access.</para>
/// <para>/</para>
/// <para>/ You can also call this to force a retry if the previous attempt has failed.</para>
/// <para>/ Performing any action that requires access to the relay network will also</para>
/// <para>/ trigger a retry, and so calling this function is never strictly necessary,</para>
/// <para>/ but it can be useful to call it a program launch time, if access to the</para>
/// <para>/ relay network is anticipated.</para>
/// <para>/</para>
/// <para>/ Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t</para>
/// <para>/ callbacks to know when initialization has completed.</para>
/// <para>/ Typically initialization completes in a few seconds.</para>
/// <para>/</para>
/// <para>/ Note: dedicated servers hosted in known data centers do *not* need</para>
/// <para>/ to call this, since they do not make routing decisions. However, if</para>
/// <para>/ the dedicated server will be using P2P functionality, it will act as</para>
/// <para>/ a "client" and this should be called.</para>
/// </summary>
public static void InitRelayNetworkAccess() {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamNetworkingUtils_InitRelayNetworkAccess(CSteamGameServerAPIContext.GetSteamNetworkingUtils());
}
/// <summary>
/// <para>/ Fetch current status of the relay network.</para>
/// <para>/</para>
/// <para>/ SteamRelayNetworkStatus_t is also a callback. It will be triggered on</para>
/// <para>/ both the user and gameserver interfaces any time the status changes, or</para>
/// <para>/ ping measurement starts or stops.</para>
/// <para>/</para>
/// <para>/ SteamRelayNetworkStatus_t::m_eAvail is returned. If you want</para>
/// <para>/ more details, you can pass a non-NULL value.</para>
/// </summary>
public static ESteamNetworkingAvailability GetRelayNetworkStatus(out SteamRelayNetworkStatus_t pDetails) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetRelayNetworkStatus(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), out pDetails);
}
/// <summary>
/// <para> "Ping location" functions</para>
/// <para> We use the ping times to the valve relays deployed worldwide to</para>
/// <para> generate a "marker" that describes the location of an Internet host.</para>
/// <para> Given two such markers, we can estimate the network latency between</para>
/// <para> two hosts, without sending any packets. The estimate is based on the</para>
/// <para> optimal route that is found through the Valve network. If you are</para>
/// <para> using the Valve network to carry the traffic, then this is precisely</para>
/// <para> the ping you want. If you are not, then the ping time will probably</para>
/// <para> still be a reasonable estimate.</para>
/// <para> This is extremely useful to select peers for matchmaking!</para>
/// <para> The markers can also be converted to a string, so they can be transmitted.</para>
/// <para> We have a separate library you can use on your app's matchmaking/coordinating</para>
/// <para> server to manipulate these objects. (See steamdatagram_gamecoordinator.h)</para>
/// <para>/ Return location info for the current host. Returns the approximate</para>
/// <para>/ age of the data, in seconds, or -1 if no data is available.</para>
/// <para>/</para>
/// <para>/ It takes a few seconds to initialize access to the relay network. If</para>
/// <para>/ you call this very soon after calling InitRelayNetworkAccess,</para>
/// <para>/ the data may not be available yet.</para>
/// <para>/</para>
/// <para>/ This always return the most up-to-date information we have available</para>
/// <para>/ right now, even if we are in the middle of re-calculating ping times.</para>
/// </summary>
public static float GetLocalPingLocation(out SteamNetworkPingLocation_t result) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetLocalPingLocation(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), out result);
}
/// <summary>
/// <para>/ Estimate the round-trip latency between two arbitrary locations, in</para>
/// <para>/ milliseconds. This is a conservative estimate, based on routing through</para>
/// <para>/ the relay network. For most basic relayed connections, this ping time</para>
/// <para>/ will be pretty accurate, since it will be based on the route likely to</para>
/// <para>/ be actually used.</para>
/// <para>/</para>
/// <para>/ If a direct IP route is used (perhaps via NAT traversal), then the route</para>
/// <para>/ will be different, and the ping time might be better. Or it might actually</para>
/// <para>/ be a bit worse! Standard IP routing is frequently suboptimal!</para>
/// <para>/</para>
/// <para>/ But even in this case, the estimate obtained using this method is a</para>
/// <para>/ reasonable upper bound on the ping time. (Also it has the advantage</para>
/// <para>/ of returning immediately and not sending any packets.)</para>
/// <para>/</para>
/// <para>/ In a few cases we might not able to estimate the route. In this case</para>
/// <para>/ a negative value is returned. k_nSteamNetworkingPing_Failed means</para>
/// <para>/ the reason was because of some networking difficulty. (Failure to</para>
/// <para>/ ping, etc) k_nSteamNetworkingPing_Unknown is returned if we cannot</para>
/// <para>/ currently answer the question for some other reason.</para>
/// <para>/</para>
/// <para>/ Do you need to be able to do this from a backend/matchmaking server?</para>
/// <para>/ You are looking for the "game coordinator" library.</para>
/// </summary>
public static int EstimatePingTimeBetweenTwoLocations(ref SteamNetworkPingLocation_t location1, ref SteamNetworkPingLocation_t location2) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_EstimatePingTimeBetweenTwoLocations(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), ref location1, ref location2);
}
/// <summary>
/// <para>/ Same as EstimatePingTime, but assumes that one location is the local host.</para>
/// <para>/ This is a bit faster, especially if you need to calculate a bunch of</para>
/// <para>/ these in a loop to find the fastest one.</para>
/// <para>/</para>
/// <para>/ In rare cases this might return a slightly different estimate than combining</para>
/// <para>/ GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations. That's because</para>
/// <para>/ this function uses a slightly more complete set of information about what</para>
/// <para>/ route would be taken.</para>
/// </summary>
public static int EstimatePingTimeFromLocalHost(ref SteamNetworkPingLocation_t remoteLocation) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_EstimatePingTimeFromLocalHost(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), ref remoteLocation);
}
/// <summary>
/// <para>/ Convert a ping location into a text format suitable for sending over the wire.</para>
/// <para>/ The format is a compact and human readable. However, it is subject to change</para>
/// <para>/ so please do not parse it yourself. Your buffer must be at least</para>
/// <para>/ k_cchMaxSteamNetworkingPingLocationString bytes.</para>
/// </summary>
public static void ConvertPingLocationToString(ref SteamNetworkPingLocation_t location, out string pszBuf, int cchBufSize) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pszBuf2 = Marshal.AllocHGlobal(cchBufSize);
NativeMethods.ISteamNetworkingUtils_ConvertPingLocationToString(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), ref location, pszBuf2, cchBufSize);
pszBuf = InteropHelp.PtrToStringUTF8(pszBuf2);
Marshal.FreeHGlobal(pszBuf2);
}
/// <summary>
/// <para>/ Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand</para>
/// <para>/ the string.</para>
/// </summary>
public static bool ParsePingLocationString(string pszString, out SteamNetworkPingLocation_t result) {
InteropHelp.TestIfAvailableGameServer();
using (var pszString2 = new InteropHelp.UTF8StringHandle(pszString)) {
return NativeMethods.ISteamNetworkingUtils_ParsePingLocationString(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), pszString2, out result);
}
}
/// <summary>
/// <para>/ Check if the ping data of sufficient recency is available, and if</para>
/// <para>/ it's too old, start refreshing it.</para>
/// <para>/</para>
/// <para>/ Please only call this function when you *really* do need to force an</para>
/// <para>/ immediate refresh of the data. (For example, in response to a specific</para>
/// <para>/ user input to refresh this information.) Don't call it "just in case",</para>
/// <para>/ before every connection, etc. That will cause extra traffic to be sent</para>
/// <para>/ for no benefit. The library will automatically refresh the information</para>
/// <para>/ as needed.</para>
/// <para>/</para>
/// <para>/ Returns true if sufficiently recent data is already available.</para>
/// <para>/</para>
/// <para>/ Returns false if sufficiently recent data is not available. In this</para>
/// <para>/ case, ping measurement is initiated, if it is not already active.</para>
/// <para>/ (You cannot restart a measurement already in progress.)</para>
/// <para>/</para>
/// <para>/ You can use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t</para>
/// <para>/ to know when ping measurement completes.</para>
/// </summary>
public static bool CheckPingDataUpToDate(float flMaxAgeSeconds) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_CheckPingDataUpToDate(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), flMaxAgeSeconds);
}
/// <summary>
/// <para> List of Valve data centers, and ping times to them. This might</para>
/// <para> be useful to you if you are use our hosting, or just need to measure</para>
/// <para> latency to a cloud data center where we are running relays.</para>
/// <para>/ Fetch ping time of best available relayed route from this host to</para>
/// <para>/ the specified data center.</para>
/// </summary>
public static int GetPingToDataCenter(SteamNetworkingPOPID popID, out SteamNetworkingPOPID pViaRelayPoP) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetPingToDataCenter(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), popID, out pViaRelayPoP);
}
/// <summary>
/// <para>/ Get *direct* ping time to the relays at the data center.</para>
/// </summary>
public static int GetDirectPingToPOP(SteamNetworkingPOPID popID) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetDirectPingToPOP(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), popID);
}
/// <summary>
/// <para>/ Get number of network points of presence in the config</para>
/// </summary>
public static int GetPOPCount() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetPOPCount(CSteamGameServerAPIContext.GetSteamNetworkingUtils());
}
/// <summary>
/// <para>/ Get list of all POP IDs. Returns the number of entries that were filled into</para>
/// <para>/ your list.</para>
/// </summary>
public static int GetPOPList(out SteamNetworkingPOPID list, int nListSz) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetPOPList(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), out list, nListSz);
}
/// <summary>
/// <para> Misc</para>
/// <para>/ Fetch current timestamp. This timer has the following properties:</para>
/// <para>/</para>
/// <para>/ - Monotonicity is guaranteed.</para>
/// <para>/ - The initial value will be at least 24*3600*30*1e6, i.e. about</para>
/// <para>/ 30 days worth of microseconds. In this way, the timestamp value of</para>
/// <para>/ 0 will always be at least "30 days ago". Also, negative numbers</para>
/// <para>/ will never be returned.</para>
/// <para>/ - Wraparound / overflow is not a practical concern.</para>
/// <para>/</para>
/// <para>/ If you are running under the debugger and stop the process, the clock</para>
/// <para>/ might not advance the full wall clock time that has elapsed between</para>
/// <para>/ calls. If the process is not blocked from normal operation, the</para>
/// <para>/ timestamp values will track wall clock time, even if you don't call</para>
/// <para>/ the function frequently.</para>
/// <para>/</para>
/// <para>/ The value is only meaningful for this run of the process. Don't compare</para>
/// <para>/ it to values obtained on another computer, or other runs of the same process.</para>
/// </summary>
public static SteamNetworkingMicroseconds GetLocalTimestamp() {
InteropHelp.TestIfAvailableGameServer();
return (SteamNetworkingMicroseconds)NativeMethods.ISteamNetworkingUtils_GetLocalTimestamp(CSteamGameServerAPIContext.GetSteamNetworkingUtils());
}
/// <summary>
/// <para>/ Set a function to receive network-related information that is useful for debugging.</para>
/// <para>/ This can be very useful during development, but it can also be useful for troubleshooting</para>
/// <para>/ problems with tech savvy end users. If you have a console or other log that customers</para>
/// <para>/ can examine, these log messages can often be helpful to troubleshoot network issues.</para>
/// <para>/ (Especially any warning/error messages.)</para>
/// <para>/</para>
/// <para>/ The detail level indicates what message to invoke your callback on. Lower numeric</para>
/// <para>/ value means more important, and the value you pass is the lowest priority (highest</para>
/// <para>/ numeric value) you wish to receive callbacks for.</para>
/// <para>/</para>
/// <para>/ The value here controls the detail level for most messages. You can control the</para>
/// <para>/ detail level for various subsystems (perhaps only for certain connections) by</para>
/// <para>/ adjusting the configuration values k_ESteamNetworkingConfig_LogLevel_Xxxxx.</para>
/// <para>/</para>
/// <para>/ Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg</para>
/// <para>/ or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT</para>
/// <para>/ request a high detail level and then filter out messages in your callback. This incurs</para>
/// <para>/ all of the expense of formatting the messages, which are then discarded. Setting a high</para>
/// <para>/ priority value (low numeric value) here allows the library to avoid doing this work.</para>
/// <para>/</para>
/// <para>/ IMPORTANT: This may be called from a service thread, while we own a mutex, etc.</para>
/// <para>/ Your output function must be threadsafe and fast! Do not make any other</para>
/// <para>/ Steamworks calls from within the handler.</para>
/// </summary>
public static void SetDebugOutputFunction(ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamNetworkingUtils_SetDebugOutputFunction(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), eDetailLevel, pfnFunc);
}
/// <summary>
/// <para> Fake IP</para>
/// <para> Useful for interfacing with code that assumes peers are identified using an IPv4 address</para>
/// <para>/ Return true if an IPv4 address is one that might be used as a "fake" one.</para>
/// <para>/ This function is fast; it just does some logical tests on the IP and does</para>
/// <para>/ not need to do any lookup operations.</para>
/// </summary>
public static bool IsFakeIPv4(uint nIPv4) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_IsFakeIPv4(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), nIPv4);
}
public static ESteamNetworkingFakeIPType GetIPv4FakeIPType(uint nIPv4) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetIPv4FakeIPType(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), nIPv4);
}
/// <summary>
/// <para>/ Get the real identity associated with a given FakeIP.</para>
/// <para>/</para>
/// <para>/ On failure, returns:</para>
/// <para>/ - k_EResultInvalidParam: the IP is not a FakeIP.</para>
/// <para>/ - k_EResultNoMatch: we don't recognize that FakeIP and don't know the corresponding identity.</para>
/// <para>/</para>
/// <para>/ FakeIP's used by active connections, or the FakeIPs assigned to local identities,</para>
/// <para>/ will always work. FakeIPs for recently destroyed connections will continue to</para>
/// <para>/ return results for a little while, but not forever. At some point, we will forget</para>
/// <para>/ FakeIPs to save space. It's reasonably safe to assume that you can read back the</para>
/// <para>/ real identity of a connection very soon after it is destroyed. But do not wait</para>
/// <para>/ indefinitely.</para>
/// </summary>
public static EResult GetRealIdentityForFakeIP(ref SteamNetworkingIPAddr fakeIP, out SteamNetworkingIdentity pOutRealIdentity) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetRealIdentityForFakeIP(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), ref fakeIP, out pOutRealIdentity);
}
/// <summary>
/// <para> Set and get configuration values, see ESteamNetworkingConfigValue for individual descriptions.</para>
/// <para> Shortcuts for common cases. (Implemented as inline functions below)</para>
/// <para> Set global callbacks. If you do not want to use Steam's callback dispatch mechanism and you</para>
/// <para> want to use the same callback on all (or most) listen sockets and connections, then</para>
/// <para> simply install these callbacks first thing, and you are good to go.</para>
/// <para> See ISteamNetworkingSockets::RunCallbacks</para>
/// <para>/ Set a configuration value.</para>
/// <para>/ - eValue: which value is being set</para>
/// <para>/ - eScope: Onto what type of object are you applying the setting?</para>
/// <para>/ - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc.</para>
/// <para>/ - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly!</para>
/// <para>/ - pArg: Value to set it to. You can pass NULL to remove a non-global setting at this scope,</para>
/// <para>/ causing the value for that object to use global defaults. Or at global scope, passing NULL</para>
/// <para>/ will reset any custom value and restore it to the system default.</para>
/// <para>/ NOTE: When setting pointers (e.g. callback functions), do not pass the function pointer directly.</para>
/// <para>/ Your argument should be a pointer to a function pointer.</para>
/// </summary>
public static bool SetConfigValue(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, IntPtr scopeObj, ESteamNetworkingConfigDataType eDataType, IntPtr pArg) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_SetConfigValue(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), eValue, eScopeType, scopeObj, eDataType, pArg);
}
/// <summary>
/// <para>/ Set a configuration value, using a struct to pass the value.</para>
/// <para>/ (This is just a convenience shortcut; see below for the implementation and</para>
/// <para>/ a little insight into how SteamNetworkingConfigValue_t is used when</para>
/// <para>/ setting config options during listen socket and connection creation.)</para>
/// <para>/ Get a configuration value.</para>
/// <para>/ - eValue: which value to fetch</para>
/// <para>/ - eScopeType: query setting on what type of object</para>
/// <para>/ - eScopeArg: the object to query the setting for</para>
/// <para>/ - pOutDataType: If non-NULL, the data type of the value is returned.</para>
/// <para>/ - pResult: Where to put the result. Pass NULL to query the required buffer size. (k_ESteamNetworkingGetConfigValue_BufferTooSmall will be returned.)</para>
/// <para>/ - cbResult: IN: the size of your buffer. OUT: the number of bytes filled in or required.</para>
/// </summary>
public static ESteamNetworkingGetConfigValueResult GetConfigValue(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, IntPtr scopeObj, out ESteamNetworkingConfigDataType pOutDataType, IntPtr pResult, ref ulong cbResult) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_GetConfigValue(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), eValue, eScopeType, scopeObj, out pOutDataType, pResult, ref cbResult);
}
/// <summary>
/// <para>/ Get info about a configuration value. Returns the name of the value,</para>
/// <para>/ or NULL if the value doesn't exist. Other output parameters can be NULL</para>
/// <para>/ if you do not need them.</para>
/// </summary>
public static string GetConfigValueInfo(ESteamNetworkingConfigValue eValue, out ESteamNetworkingConfigDataType pOutDataType, out ESteamNetworkingConfigScope pOutScope) {
InteropHelp.TestIfAvailableGameServer();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamNetworkingUtils_GetConfigValueInfo(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), eValue, out pOutDataType, out pOutScope));
}
/// <summary>
/// <para>/ Iterate the list of all configuration values in the current environment that it might</para>
/// <para>/ be possible to display or edit using a generic UI. To get the first iterable value,</para>
/// <para>/ pass k_ESteamNetworkingConfig_Invalid. Returns k_ESteamNetworkingConfig_Invalid</para>
/// <para>/ to signal end of list.</para>
/// <para>/</para>
/// <para>/ The bEnumerateDevVars argument can be used to include "dev" vars. These are vars that</para>
/// <para>/ are recommended to only be editable in "debug" or "dev" mode and typically should not be</para>
/// <para>/ shown in a retail environment where a malicious local user might use this to cheat.</para>
/// </summary>
public static ESteamNetworkingConfigValue IterateGenericEditableConfigValues(ESteamNetworkingConfigValue eCurrent, bool bEnumerateDevVars) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_IterateGenericEditableConfigValues(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), eCurrent, bEnumerateDevVars);
}
/// <summary>
/// <para> String conversions. You'll usually access these using the respective</para>
/// <para> inline methods.</para>
/// </summary>
public static void SteamNetworkingIPAddr_ToString(ref SteamNetworkingIPAddr addr, out string buf, uint cbBuf, bool bWithPort) {
InteropHelp.TestIfAvailableGameServer();
IntPtr buf2 = Marshal.AllocHGlobal((int)cbBuf);
NativeMethods.ISteamNetworkingUtils_SteamNetworkingIPAddr_ToString(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), ref addr, buf2, cbBuf, bWithPort);
buf = InteropHelp.PtrToStringUTF8(buf2);
Marshal.FreeHGlobal(buf2);
}
public static bool SteamNetworkingIPAddr_ParseString(out SteamNetworkingIPAddr pAddr, string pszStr) {
InteropHelp.TestIfAvailableGameServer();
using (var pszStr2 = new InteropHelp.UTF8StringHandle(pszStr)) {
return NativeMethods.ISteamNetworkingUtils_SteamNetworkingIPAddr_ParseString(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), out pAddr, pszStr2);
}
}
public static ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType(ref SteamNetworkingIPAddr addr) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamNetworkingUtils_SteamNetworkingIPAddr_GetFakeIPType(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), ref addr);
}
public static void SteamNetworkingIdentity_ToString(ref SteamNetworkingIdentity identity, out string buf, uint cbBuf) {
InteropHelp.TestIfAvailableGameServer();
IntPtr buf2 = Marshal.AllocHGlobal((int)cbBuf);
NativeMethods.ISteamNetworkingUtils_SteamNetworkingIdentity_ToString(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), ref identity, buf2, cbBuf);
buf = InteropHelp.PtrToStringUTF8(buf2);
Marshal.FreeHGlobal(buf2);
}
public static bool SteamNetworkingIdentity_ParseString(out SteamNetworkingIdentity pIdentity, string pszStr) {
InteropHelp.TestIfAvailableGameServer();
using (var pszStr2 = new InteropHelp.UTF8StringHandle(pszStr)) {
return NativeMethods.ISteamNetworkingUtils_SteamNetworkingIdentity_ParseString(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), out pIdentity, pszStr2);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe59eea1e63d61e439d63c8e54f5cfdf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,110 @@
// 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 SteamGameServerStats {
/// <summary>
/// <para> downloads stats for the user</para>
/// <para> returns a GSStatsReceived_t callback when completed</para>
/// <para> if the user has no stats, GSStatsReceived_t.m_eResult will be set to k_EResultFail</para>
/// <para> these stats will only be auto-updated for clients playing on the server. For other</para>
/// <para> users you'll need to call RequestUserStats() again to refresh any data</para>
/// </summary>
public static SteamAPICall_t RequestUserStats(CSteamID steamIDUser) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamGameServerStats_RequestUserStats(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser);
}
/// <summary>
/// <para> requests stat information for a user, usable after a successful call to RequestUserStats()</para>
/// </summary>
public static bool GetUserStat(CSteamID steamIDUser, string pchName, out int pData) {
InteropHelp.TestIfAvailableGameServer();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamGameServerStats_GetUserStatInt32(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser, pchName2, out pData);
}
}
public static bool GetUserStat(CSteamID steamIDUser, string pchName, out float pData) {
InteropHelp.TestIfAvailableGameServer();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamGameServerStats_GetUserStatFloat(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser, pchName2, out pData);
}
}
public static bool GetUserAchievement(CSteamID steamIDUser, string pchName, out bool pbAchieved) {
InteropHelp.TestIfAvailableGameServer();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamGameServerStats_GetUserAchievement(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser, pchName2, out pbAchieved);
}
}
/// <summary>
/// <para> Set / update stats and achievements.</para>
/// <para> Note: These updates will work only on stats game servers are allowed to edit and only for</para>
/// <para> game servers that have been declared as officially controlled by the game creators.</para>
/// <para> Set the IP range of your official servers on the Steamworks page</para>
/// </summary>
public static bool SetUserStat(CSteamID steamIDUser, string pchName, int nData) {
InteropHelp.TestIfAvailableGameServer();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamGameServerStats_SetUserStatInt32(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser, pchName2, nData);
}
}
public static bool SetUserStat(CSteamID steamIDUser, string pchName, float fData) {
InteropHelp.TestIfAvailableGameServer();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamGameServerStats_SetUserStatFloat(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser, pchName2, fData);
}
}
public static bool UpdateUserAvgRateStat(CSteamID steamIDUser, string pchName, float flCountThisSession, double dSessionLength) {
InteropHelp.TestIfAvailableGameServer();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamGameServerStats_UpdateUserAvgRateStat(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser, pchName2, flCountThisSession, dSessionLength);
}
}
public static bool SetUserAchievement(CSteamID steamIDUser, string pchName) {
InteropHelp.TestIfAvailableGameServer();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamGameServerStats_SetUserAchievement(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser, pchName2);
}
}
public static bool ClearUserAchievement(CSteamID steamIDUser, string pchName) {
InteropHelp.TestIfAvailableGameServer();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamGameServerStats_ClearUserAchievement(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser, pchName2);
}
}
/// <summary>
/// <para> Store the current data on the server, will get a GSStatsStored_t callback when set.</para>
/// <para> If the callback has a result of k_EResultInvalidParam, one or more stats</para>
/// <para> uploaded has been rejected, either because they broke constraints</para>
/// <para> or were out of date. In this case the server sends back updated values.</para>
/// <para> The stats should be re-iterated to keep in sync.</para>
/// </summary>
public static SteamAPICall_t StoreUserStats(CSteamID steamIDUser) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamGameServerStats_StoreUserStats(CSteamGameServerAPIContext.GetSteamGameServerStats(), steamIDUser);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07e74d4ac4bacfc489a00ec4e2a049a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,759 @@
// 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 SteamGameServerUGC {
/// <summary>
/// <para> Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.</para>
/// </summary>
public static UGCQueryHandle_t CreateQueryUserUGCRequest(AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint unPage) {
InteropHelp.TestIfAvailableGameServer();
return (UGCQueryHandle_t)NativeMethods.ISteamUGC_CreateQueryUserUGCRequest(CSteamGameServerAPIContext.GetSteamUGC(), unAccountID, eListType, eMatchingUGCType, eSortOrder, nCreatorAppID, nConsumerAppID, unPage);
}
/// <summary>
/// <para> Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.</para>
/// </summary>
public static UGCQueryHandle_t CreateQueryAllUGCRequest(EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint unPage) {
InteropHelp.TestIfAvailableGameServer();
return (UGCQueryHandle_t)NativeMethods.ISteamUGC_CreateQueryAllUGCRequestPage(CSteamGameServerAPIContext.GetSteamUGC(), eQueryType, eMatchingeMatchingUGCTypeFileType, nCreatorAppID, nConsumerAppID, unPage);
}
/// <summary>
/// <para> Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.</para>
/// </summary>
public static UGCQueryHandle_t CreateQueryAllUGCRequest(EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, string pchCursor = null) {
InteropHelp.TestIfAvailableGameServer();
using (var pchCursor2 = new InteropHelp.UTF8StringHandle(pchCursor)) {
return (UGCQueryHandle_t)NativeMethods.ISteamUGC_CreateQueryAllUGCRequestCursor(CSteamGameServerAPIContext.GetSteamUGC(), eQueryType, eMatchingeMatchingUGCTypeFileType, nCreatorAppID, nConsumerAppID, pchCursor2);
}
}
/// <summary>
/// <para> Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)</para>
/// </summary>
public static UGCQueryHandle_t CreateQueryUGCDetailsRequest(PublishedFileId_t[] pvecPublishedFileID, uint unNumPublishedFileIDs) {
InteropHelp.TestIfAvailableGameServer();
return (UGCQueryHandle_t)NativeMethods.ISteamUGC_CreateQueryUGCDetailsRequest(CSteamGameServerAPIContext.GetSteamUGC(), pvecPublishedFileID, unNumPublishedFileIDs);
}
/// <summary>
/// <para> Send the query to Steam</para>
/// </summary>
public static SteamAPICall_t SendQueryUGCRequest(UGCQueryHandle_t handle) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_SendQueryUGCRequest(CSteamGameServerAPIContext.GetSteamUGC(), handle);
}
/// <summary>
/// <para> Retrieve an individual result after receiving the callback for querying UGC</para>
/// </summary>
public static bool GetQueryUGCResult(UGCQueryHandle_t handle, uint index, out SteamUGCDetails_t pDetails) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetQueryUGCResult(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, out pDetails);
}
public static uint GetQueryUGCNumTags(UGCQueryHandle_t handle, uint index) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetQueryUGCNumTags(CSteamGameServerAPIContext.GetSteamUGC(), handle, index);
}
public static bool GetQueryUGCTag(UGCQueryHandle_t handle, uint index, uint indexTag, out string pchValue, uint cchValueSize) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchValue2 = Marshal.AllocHGlobal((int)cchValueSize);
bool ret = NativeMethods.ISteamUGC_GetQueryUGCTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, indexTag, pchValue2, cchValueSize);
pchValue = ret ? InteropHelp.PtrToStringUTF8(pchValue2) : null;
Marshal.FreeHGlobal(pchValue2);
return ret;
}
public static bool GetQueryUGCTagDisplayName(UGCQueryHandle_t handle, uint index, uint indexTag, out string pchValue, uint cchValueSize) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchValue2 = Marshal.AllocHGlobal((int)cchValueSize);
bool ret = NativeMethods.ISteamUGC_GetQueryUGCTagDisplayName(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, indexTag, pchValue2, cchValueSize);
pchValue = ret ? InteropHelp.PtrToStringUTF8(pchValue2) : null;
Marshal.FreeHGlobal(pchValue2);
return ret;
}
public static bool GetQueryUGCPreviewURL(UGCQueryHandle_t handle, uint index, out string pchURL, uint cchURLSize) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchURL2 = Marshal.AllocHGlobal((int)cchURLSize);
bool ret = NativeMethods.ISteamUGC_GetQueryUGCPreviewURL(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pchURL2, cchURLSize);
pchURL = ret ? InteropHelp.PtrToStringUTF8(pchURL2) : null;
Marshal.FreeHGlobal(pchURL2);
return ret;
}
public static bool GetQueryUGCMetadata(UGCQueryHandle_t handle, uint index, out string pchMetadata, uint cchMetadatasize) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchMetadata2 = Marshal.AllocHGlobal((int)cchMetadatasize);
bool ret = NativeMethods.ISteamUGC_GetQueryUGCMetadata(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pchMetadata2, cchMetadatasize);
pchMetadata = ret ? InteropHelp.PtrToStringUTF8(pchMetadata2) : null;
Marshal.FreeHGlobal(pchMetadata2);
return ret;
}
public static bool GetQueryUGCChildren(UGCQueryHandle_t handle, uint index, PublishedFileId_t[] pvecPublishedFileID, uint cMaxEntries) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetQueryUGCChildren(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pvecPublishedFileID, cMaxEntries);
}
public static bool GetQueryUGCStatistic(UGCQueryHandle_t handle, uint index, EItemStatistic eStatType, out ulong pStatValue) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetQueryUGCStatistic(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, eStatType, out pStatValue);
}
public static uint GetQueryUGCNumAdditionalPreviews(UGCQueryHandle_t handle, uint index) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetQueryUGCNumAdditionalPreviews(CSteamGameServerAPIContext.GetSteamUGC(), handle, index);
}
public static bool GetQueryUGCAdditionalPreview(UGCQueryHandle_t handle, uint index, uint previewIndex, out string pchURLOrVideoID, uint cchURLSize, out string pchOriginalFileName, uint cchOriginalFileNameSize, out EItemPreviewType pPreviewType) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchURLOrVideoID2 = Marshal.AllocHGlobal((int)cchURLSize);
IntPtr pchOriginalFileName2 = Marshal.AllocHGlobal((int)cchOriginalFileNameSize);
bool ret = NativeMethods.ISteamUGC_GetQueryUGCAdditionalPreview(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, previewIndex, pchURLOrVideoID2, cchURLSize, pchOriginalFileName2, cchOriginalFileNameSize, out pPreviewType);
pchURLOrVideoID = ret ? InteropHelp.PtrToStringUTF8(pchURLOrVideoID2) : null;
Marshal.FreeHGlobal(pchURLOrVideoID2);
pchOriginalFileName = ret ? InteropHelp.PtrToStringUTF8(pchOriginalFileName2) : null;
Marshal.FreeHGlobal(pchOriginalFileName2);
return ret;
}
public static uint GetQueryUGCNumKeyValueTags(UGCQueryHandle_t handle, uint index) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetQueryUGCNumKeyValueTags(CSteamGameServerAPIContext.GetSteamUGC(), handle, index);
}
public static bool GetQueryUGCKeyValueTag(UGCQueryHandle_t handle, uint index, uint keyValueTagIndex, out string pchKey, uint cchKeySize, out string pchValue, uint cchValueSize) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchKey2 = Marshal.AllocHGlobal((int)cchKeySize);
IntPtr pchValue2 = Marshal.AllocHGlobal((int)cchValueSize);
bool ret = NativeMethods.ISteamUGC_GetQueryUGCKeyValueTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, keyValueTagIndex, pchKey2, cchKeySize, pchValue2, cchValueSize);
pchKey = ret ? InteropHelp.PtrToStringUTF8(pchKey2) : null;
Marshal.FreeHGlobal(pchKey2);
pchValue = ret ? InteropHelp.PtrToStringUTF8(pchValue2) : null;
Marshal.FreeHGlobal(pchValue2);
return ret;
}
/// <summary>
/// <para> Return the first value matching the pchKey. Note that a key may map to multiple values. Returns false if there was an error or no matching value was found.</para>
/// </summary>
public static bool GetQueryUGCKeyValueTag(UGCQueryHandle_t handle, uint index, string pchKey, out string pchValue, uint cchValueSize) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchValue2 = Marshal.AllocHGlobal((int)cchValueSize);
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) {
bool ret = NativeMethods.ISteamUGC_GetQueryFirstUGCKeyValueTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pchKey2, pchValue2, cchValueSize);
pchValue = ret ? InteropHelp.PtrToStringUTF8(pchValue2) : null;
Marshal.FreeHGlobal(pchValue2);
return ret;
}
}
/// <summary>
/// <para> Some items can specify that they have a version that is valid for a range of game versions (Steam branch)</para>
/// </summary>
public static uint GetNumSupportedGameVersions(UGCQueryHandle_t handle, uint index) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetNumSupportedGameVersions(CSteamGameServerAPIContext.GetSteamUGC(), handle, index);
}
public static bool GetSupportedGameVersionData(UGCQueryHandle_t handle, uint index, uint versionIndex, out string pchGameBranchMin, out string pchGameBranchMax, uint cchGameBranchSize) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchGameBranchMin2 = Marshal.AllocHGlobal((int)cchGameBranchSize);
IntPtr pchGameBranchMax2 = Marshal.AllocHGlobal((int)cchGameBranchSize);
bool ret = NativeMethods.ISteamUGC_GetSupportedGameVersionData(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, versionIndex, pchGameBranchMin2, pchGameBranchMax2, cchGameBranchSize);
pchGameBranchMin = ret ? InteropHelp.PtrToStringUTF8(pchGameBranchMin2) : null;
Marshal.FreeHGlobal(pchGameBranchMin2);
pchGameBranchMax = ret ? InteropHelp.PtrToStringUTF8(pchGameBranchMax2) : null;
Marshal.FreeHGlobal(pchGameBranchMax2);
return ret;
}
public static uint GetQueryUGCContentDescriptors(UGCQueryHandle_t handle, uint index, EUGCContentDescriptorID[] pvecDescriptors, uint cMaxEntries) {
InteropHelp.TestIfAvailableGameServer();
if (pvecDescriptors != null && pvecDescriptors.Length != cMaxEntries) {
throw new System.ArgumentException("pvecDescriptors must be the same size as cMaxEntries!");
}
return NativeMethods.ISteamUGC_GetQueryUGCContentDescriptors(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pvecDescriptors, cMaxEntries);
}
/// <summary>
/// <para> Release the request to free up memory, after retrieving results</para>
/// </summary>
public static bool ReleaseQueryUGCRequest(UGCQueryHandle_t handle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_ReleaseQueryUGCRequest(CSteamGameServerAPIContext.GetSteamUGC(), handle);
}
/// <summary>
/// <para> Options to set for querying UGC</para>
/// </summary>
public static bool AddRequiredTag(UGCQueryHandle_t handle, string pTagName) {
InteropHelp.TestIfAvailableGameServer();
using (var pTagName2 = new InteropHelp.UTF8StringHandle(pTagName)) {
return NativeMethods.ISteamUGC_AddRequiredTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, pTagName2);
}
}
/// <summary>
/// <para> match any of the tags in this group</para>
/// </summary>
public static bool AddRequiredTagGroup(UGCQueryHandle_t handle, System.Collections.Generic.IList<string> pTagGroups) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_AddRequiredTagGroup(CSteamGameServerAPIContext.GetSteamUGC(), handle, new InteropHelp.SteamParamStringArray(pTagGroups));
}
public static bool AddExcludedTag(UGCQueryHandle_t handle, string pTagName) {
InteropHelp.TestIfAvailableGameServer();
using (var pTagName2 = new InteropHelp.UTF8StringHandle(pTagName)) {
return NativeMethods.ISteamUGC_AddExcludedTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, pTagName2);
}
}
public static bool SetReturnOnlyIDs(UGCQueryHandle_t handle, bool bReturnOnlyIDs) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetReturnOnlyIDs(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnOnlyIDs);
}
public static bool SetReturnKeyValueTags(UGCQueryHandle_t handle, bool bReturnKeyValueTags) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetReturnKeyValueTags(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnKeyValueTags);
}
public static bool SetReturnLongDescription(UGCQueryHandle_t handle, bool bReturnLongDescription) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetReturnLongDescription(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnLongDescription);
}
public static bool SetReturnMetadata(UGCQueryHandle_t handle, bool bReturnMetadata) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetReturnMetadata(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnMetadata);
}
public static bool SetReturnChildren(UGCQueryHandle_t handle, bool bReturnChildren) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetReturnChildren(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnChildren);
}
public static bool SetReturnAdditionalPreviews(UGCQueryHandle_t handle, bool bReturnAdditionalPreviews) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetReturnAdditionalPreviews(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnAdditionalPreviews);
}
public static bool SetReturnTotalOnly(UGCQueryHandle_t handle, bool bReturnTotalOnly) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetReturnTotalOnly(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnTotalOnly);
}
public static bool SetReturnPlaytimeStats(UGCQueryHandle_t handle, uint unDays) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetReturnPlaytimeStats(CSteamGameServerAPIContext.GetSteamUGC(), handle, unDays);
}
public static bool SetLanguage(UGCQueryHandle_t handle, string pchLanguage) {
InteropHelp.TestIfAvailableGameServer();
using (var pchLanguage2 = new InteropHelp.UTF8StringHandle(pchLanguage)) {
return NativeMethods.ISteamUGC_SetLanguage(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchLanguage2);
}
}
public static bool SetAllowCachedResponse(UGCQueryHandle_t handle, uint unMaxAgeSeconds) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetAllowCachedResponse(CSteamGameServerAPIContext.GetSteamUGC(), handle, unMaxAgeSeconds);
}
/// <summary>
/// <para> admin queries return hidden items</para>
/// </summary>
public static bool SetAdminQuery(UGCUpdateHandle_t handle, bool bAdminQuery) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetAdminQuery(CSteamGameServerAPIContext.GetSteamUGC(), handle, bAdminQuery);
}
/// <summary>
/// <para> Options only for querying user UGC</para>
/// </summary>
public static bool SetCloudFileNameFilter(UGCQueryHandle_t handle, string pMatchCloudFileName) {
InteropHelp.TestIfAvailableGameServer();
using (var pMatchCloudFileName2 = new InteropHelp.UTF8StringHandle(pMatchCloudFileName)) {
return NativeMethods.ISteamUGC_SetCloudFileNameFilter(CSteamGameServerAPIContext.GetSteamUGC(), handle, pMatchCloudFileName2);
}
}
/// <summary>
/// <para> Options only for querying all UGC</para>
/// </summary>
public static bool SetMatchAnyTag(UGCQueryHandle_t handle, bool bMatchAnyTag) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetMatchAnyTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, bMatchAnyTag);
}
public static bool SetSearchText(UGCQueryHandle_t handle, string pSearchText) {
InteropHelp.TestIfAvailableGameServer();
using (var pSearchText2 = new InteropHelp.UTF8StringHandle(pSearchText)) {
return NativeMethods.ISteamUGC_SetSearchText(CSteamGameServerAPIContext.GetSteamUGC(), handle, pSearchText2);
}
}
public static bool SetRankedByTrendDays(UGCQueryHandle_t handle, uint unDays) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetRankedByTrendDays(CSteamGameServerAPIContext.GetSteamUGC(), handle, unDays);
}
public static bool SetTimeCreatedDateRange(UGCQueryHandle_t handle, uint rtStart, uint rtEnd) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetTimeCreatedDateRange(CSteamGameServerAPIContext.GetSteamUGC(), handle, rtStart, rtEnd);
}
public static bool SetTimeUpdatedDateRange(UGCQueryHandle_t handle, uint rtStart, uint rtEnd) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetTimeUpdatedDateRange(CSteamGameServerAPIContext.GetSteamUGC(), handle, rtStart, rtEnd);
}
public static bool AddRequiredKeyValueTag(UGCQueryHandle_t handle, string pKey, string pValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pKey2 = new InteropHelp.UTF8StringHandle(pKey))
using (var pValue2 = new InteropHelp.UTF8StringHandle(pValue)) {
return NativeMethods.ISteamUGC_AddRequiredKeyValueTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, pKey2, pValue2);
}
}
/// <summary>
/// <para> DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!</para>
/// </summary>
public static SteamAPICall_t RequestUGCDetails(PublishedFileId_t nPublishedFileID, uint unMaxAgeSeconds) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_RequestUGCDetails(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, unMaxAgeSeconds);
}
/// <summary>
/// <para> Steam Workshop Creator API</para>
/// <para> create new item for this app with no content attached yet</para>
/// </summary>
public static SteamAPICall_t CreateItem(AppId_t nConsumerAppId, EWorkshopFileType eFileType) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_CreateItem(CSteamGameServerAPIContext.GetSteamUGC(), nConsumerAppId, eFileType);
}
/// <summary>
/// <para> start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()</para>
/// </summary>
public static UGCUpdateHandle_t StartItemUpdate(AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (UGCUpdateHandle_t)NativeMethods.ISteamUGC_StartItemUpdate(CSteamGameServerAPIContext.GetSteamUGC(), nConsumerAppId, nPublishedFileID);
}
/// <summary>
/// <para> change the title of an UGC item</para>
/// </summary>
public static bool SetItemTitle(UGCUpdateHandle_t handle, string pchTitle) {
InteropHelp.TestIfAvailableGameServer();
using (var pchTitle2 = new InteropHelp.UTF8StringHandle(pchTitle)) {
return NativeMethods.ISteamUGC_SetItemTitle(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchTitle2);
}
}
/// <summary>
/// <para> change the description of an UGC item</para>
/// </summary>
public static bool SetItemDescription(UGCUpdateHandle_t handle, string pchDescription) {
InteropHelp.TestIfAvailableGameServer();
using (var pchDescription2 = new InteropHelp.UTF8StringHandle(pchDescription)) {
return NativeMethods.ISteamUGC_SetItemDescription(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchDescription2);
}
}
/// <summary>
/// <para> specify the language of the title or description that will be set</para>
/// </summary>
public static bool SetItemUpdateLanguage(UGCUpdateHandle_t handle, string pchLanguage) {
InteropHelp.TestIfAvailableGameServer();
using (var pchLanguage2 = new InteropHelp.UTF8StringHandle(pchLanguage)) {
return NativeMethods.ISteamUGC_SetItemUpdateLanguage(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchLanguage2);
}
}
/// <summary>
/// <para> change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)</para>
/// </summary>
public static bool SetItemMetadata(UGCUpdateHandle_t handle, string pchMetaData) {
InteropHelp.TestIfAvailableGameServer();
using (var pchMetaData2 = new InteropHelp.UTF8StringHandle(pchMetaData)) {
return NativeMethods.ISteamUGC_SetItemMetadata(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchMetaData2);
}
}
/// <summary>
/// <para> change the visibility of an UGC item</para>
/// </summary>
public static bool SetItemVisibility(UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetItemVisibility(CSteamGameServerAPIContext.GetSteamUGC(), handle, eVisibility);
}
/// <summary>
/// <para> change the tags of an UGC item</para>
/// </summary>
public static bool SetItemTags(UGCUpdateHandle_t updateHandle, System.Collections.Generic.IList<string> pTags, bool bAllowAdminTags = false) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetItemTags(CSteamGameServerAPIContext.GetSteamUGC(), updateHandle, new InteropHelp.SteamParamStringArray(pTags), bAllowAdminTags);
}
/// <summary>
/// <para> update item content from this local folder</para>
/// </summary>
public static bool SetItemContent(UGCUpdateHandle_t handle, string pszContentFolder) {
InteropHelp.TestIfAvailableGameServer();
using (var pszContentFolder2 = new InteropHelp.UTF8StringHandle(pszContentFolder)) {
return NativeMethods.ISteamUGC_SetItemContent(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszContentFolder2);
}
}
/// <summary>
/// <para> change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size</para>
/// </summary>
public static bool SetItemPreview(UGCUpdateHandle_t handle, string pszPreviewFile) {
InteropHelp.TestIfAvailableGameServer();
using (var pszPreviewFile2 = new InteropHelp.UTF8StringHandle(pszPreviewFile)) {
return NativeMethods.ISteamUGC_SetItemPreview(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszPreviewFile2);
}
}
/// <summary>
/// <para> use legacy upload for a single small file. The parameter to SetItemContent() should either be a directory with one file or the full path to the file. The file must also be less than 10MB in size.</para>
/// </summary>
public static bool SetAllowLegacyUpload(UGCUpdateHandle_t handle, bool bAllowLegacyUpload) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_SetAllowLegacyUpload(CSteamGameServerAPIContext.GetSteamUGC(), handle, bAllowLegacyUpload);
}
/// <summary>
/// <para> remove all existing key-value tags (you can add new ones via the AddItemKeyValueTag function)</para>
/// </summary>
public static bool RemoveAllItemKeyValueTags(UGCUpdateHandle_t handle) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_RemoveAllItemKeyValueTags(CSteamGameServerAPIContext.GetSteamUGC(), handle);
}
/// <summary>
/// <para> remove any existing key-value tags with the specified key</para>
/// </summary>
public static bool RemoveItemKeyValueTags(UGCUpdateHandle_t handle, string pchKey) {
InteropHelp.TestIfAvailableGameServer();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) {
return NativeMethods.ISteamUGC_RemoveItemKeyValueTags(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchKey2);
}
}
/// <summary>
/// <para> add new key-value tags for the item. Note that there can be multiple values for a tag.</para>
/// </summary>
public static bool AddItemKeyValueTag(UGCUpdateHandle_t handle, string pchKey, string pchValue) {
InteropHelp.TestIfAvailableGameServer();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey))
using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue)) {
return NativeMethods.ISteamUGC_AddItemKeyValueTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchKey2, pchValue2);
}
}
/// <summary>
/// <para> add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size</para>
/// </summary>
public static bool AddItemPreviewFile(UGCUpdateHandle_t handle, string pszPreviewFile, EItemPreviewType type) {
InteropHelp.TestIfAvailableGameServer();
using (var pszPreviewFile2 = new InteropHelp.UTF8StringHandle(pszPreviewFile)) {
return NativeMethods.ISteamUGC_AddItemPreviewFile(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszPreviewFile2, type);
}
}
/// <summary>
/// <para> add preview video for this item</para>
/// </summary>
public static bool AddItemPreviewVideo(UGCUpdateHandle_t handle, string pszVideoID) {
InteropHelp.TestIfAvailableGameServer();
using (var pszVideoID2 = new InteropHelp.UTF8StringHandle(pszVideoID)) {
return NativeMethods.ISteamUGC_AddItemPreviewVideo(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszVideoID2);
}
}
/// <summary>
/// <para> updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size</para>
/// </summary>
public static bool UpdateItemPreviewFile(UGCUpdateHandle_t handle, uint index, string pszPreviewFile) {
InteropHelp.TestIfAvailableGameServer();
using (var pszPreviewFile2 = new InteropHelp.UTF8StringHandle(pszPreviewFile)) {
return NativeMethods.ISteamUGC_UpdateItemPreviewFile(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pszPreviewFile2);
}
}
/// <summary>
/// <para> updates an existing preview video for this item</para>
/// </summary>
public static bool UpdateItemPreviewVideo(UGCUpdateHandle_t handle, uint index, string pszVideoID) {
InteropHelp.TestIfAvailableGameServer();
using (var pszVideoID2 = new InteropHelp.UTF8StringHandle(pszVideoID)) {
return NativeMethods.ISteamUGC_UpdateItemPreviewVideo(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pszVideoID2);
}
}
/// <summary>
/// <para> remove a preview by index starting at 0 (previews are sorted)</para>
/// </summary>
public static bool RemoveItemPreview(UGCUpdateHandle_t handle, uint index) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_RemoveItemPreview(CSteamGameServerAPIContext.GetSteamUGC(), handle, index);
}
public static bool AddContentDescriptor(UGCUpdateHandle_t handle, EUGCContentDescriptorID descid) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_AddContentDescriptor(CSteamGameServerAPIContext.GetSteamUGC(), handle, descid);
}
public static bool RemoveContentDescriptor(UGCUpdateHandle_t handle, EUGCContentDescriptorID descid) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_RemoveContentDescriptor(CSteamGameServerAPIContext.GetSteamUGC(), handle, descid);
}
/// <summary>
/// <para> an empty string for either parameter means that it will match any version on that end of the range. This will only be applied if the actual content has been changed.</para>
/// </summary>
public static bool SetRequiredGameVersions(UGCUpdateHandle_t handle, string pszGameBranchMin, string pszGameBranchMax) {
InteropHelp.TestIfAvailableGameServer();
using (var pszGameBranchMin2 = new InteropHelp.UTF8StringHandle(pszGameBranchMin))
using (var pszGameBranchMax2 = new InteropHelp.UTF8StringHandle(pszGameBranchMax)) {
return NativeMethods.ISteamUGC_SetRequiredGameVersions(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszGameBranchMin2, pszGameBranchMax2);
}
}
/// <summary>
/// <para> commit update process started with StartItemUpdate()</para>
/// </summary>
public static SteamAPICall_t SubmitItemUpdate(UGCUpdateHandle_t handle, string pchChangeNote) {
InteropHelp.TestIfAvailableGameServer();
using (var pchChangeNote2 = new InteropHelp.UTF8StringHandle(pchChangeNote)) {
return (SteamAPICall_t)NativeMethods.ISteamUGC_SubmitItemUpdate(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchChangeNote2);
}
}
public static EItemUpdateStatus GetItemUpdateProgress(UGCUpdateHandle_t handle, out ulong punBytesProcessed, out ulong punBytesTotal) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetItemUpdateProgress(CSteamGameServerAPIContext.GetSteamUGC(), handle, out punBytesProcessed, out punBytesTotal);
}
/// <summary>
/// <para> Steam Workshop Consumer API</para>
/// </summary>
public static SteamAPICall_t SetUserItemVote(PublishedFileId_t nPublishedFileID, bool bVoteUp) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_SetUserItemVote(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, bVoteUp);
}
public static SteamAPICall_t GetUserItemVote(PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_GetUserItemVote(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID);
}
public static SteamAPICall_t AddItemToFavorites(AppId_t nAppId, PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_AddItemToFavorites(CSteamGameServerAPIContext.GetSteamUGC(), nAppId, nPublishedFileID);
}
public static SteamAPICall_t RemoveItemFromFavorites(AppId_t nAppId, PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_RemoveItemFromFavorites(CSteamGameServerAPIContext.GetSteamUGC(), nAppId, nPublishedFileID);
}
/// <summary>
/// <para> subscribe to this item, will be installed ASAP</para>
/// </summary>
public static SteamAPICall_t SubscribeItem(PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_SubscribeItem(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID);
}
/// <summary>
/// <para> unsubscribe from this item, will be uninstalled after game quits</para>
/// </summary>
public static SteamAPICall_t UnsubscribeItem(PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_UnsubscribeItem(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID);
}
/// <summary>
/// <para> number of subscribed items</para>
/// </summary>
public static uint GetNumSubscribedItems() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetNumSubscribedItems(CSteamGameServerAPIContext.GetSteamUGC());
}
/// <summary>
/// <para> all subscribed item PublishFileIDs</para>
/// </summary>
public static uint GetSubscribedItems(PublishedFileId_t[] pvecPublishedFileID, uint cMaxEntries) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetSubscribedItems(CSteamGameServerAPIContext.GetSteamUGC(), pvecPublishedFileID, cMaxEntries);
}
/// <summary>
/// <para> get EItemState flags about item on this client</para>
/// </summary>
public static uint GetItemState(PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetItemState(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID);
}
/// <summary>
/// <para> get info about currently installed content on disc for items that have k_EItemStateInstalled set</para>
/// <para> if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)</para>
/// </summary>
public static bool GetItemInstallInfo(PublishedFileId_t nPublishedFileID, out ulong punSizeOnDisk, out string pchFolder, uint cchFolderSize, out uint punTimeStamp) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchFolder2 = Marshal.AllocHGlobal((int)cchFolderSize);
bool ret = NativeMethods.ISteamUGC_GetItemInstallInfo(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, out punSizeOnDisk, pchFolder2, cchFolderSize, out punTimeStamp);
pchFolder = ret ? InteropHelp.PtrToStringUTF8(pchFolder2) : null;
Marshal.FreeHGlobal(pchFolder2);
return ret;
}
/// <summary>
/// <para> get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once</para>
/// </summary>
public static bool GetItemDownloadInfo(PublishedFileId_t nPublishedFileID, out ulong punBytesDownloaded, out ulong punBytesTotal) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetItemDownloadInfo(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, out punBytesDownloaded, out punBytesTotal);
}
/// <summary>
/// <para> download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,</para>
/// <para> then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.</para>
/// <para> If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.</para>
/// </summary>
public static bool DownloadItem(PublishedFileId_t nPublishedFileID, bool bHighPriority) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_DownloadItem(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, bHighPriority);
}
/// <summary>
/// <para> game servers can set a specific workshop folder before issuing any UGC commands.</para>
/// <para> This is helpful if you want to support multiple game servers running out of the same install folder</para>
/// </summary>
public static bool BInitWorkshopForGameServer(DepotId_t unWorkshopDepotID, string pszFolder) {
InteropHelp.TestIfAvailableGameServer();
using (var pszFolder2 = new InteropHelp.UTF8StringHandle(pszFolder)) {
return NativeMethods.ISteamUGC_BInitWorkshopForGameServer(CSteamGameServerAPIContext.GetSteamUGC(), unWorkshopDepotID, pszFolder2);
}
}
/// <summary>
/// <para> SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends</para>
/// </summary>
public static void SuspendDownloads(bool bSuspend) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamUGC_SuspendDownloads(CSteamGameServerAPIContext.GetSteamUGC(), bSuspend);
}
/// <summary>
/// <para> usage tracking</para>
/// </summary>
public static SteamAPICall_t StartPlaytimeTracking(PublishedFileId_t[] pvecPublishedFileID, uint unNumPublishedFileIDs) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_StartPlaytimeTracking(CSteamGameServerAPIContext.GetSteamUGC(), pvecPublishedFileID, unNumPublishedFileIDs);
}
public static SteamAPICall_t StopPlaytimeTracking(PublishedFileId_t[] pvecPublishedFileID, uint unNumPublishedFileIDs) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_StopPlaytimeTracking(CSteamGameServerAPIContext.GetSteamUGC(), pvecPublishedFileID, unNumPublishedFileIDs);
}
public static SteamAPICall_t StopPlaytimeTrackingForAllItems() {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_StopPlaytimeTrackingForAllItems(CSteamGameServerAPIContext.GetSteamUGC());
}
/// <summary>
/// <para> parent-child relationship or dependency management</para>
/// </summary>
public static SteamAPICall_t AddDependency(PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_AddDependency(CSteamGameServerAPIContext.GetSteamUGC(), nParentPublishedFileID, nChildPublishedFileID);
}
public static SteamAPICall_t RemoveDependency(PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_RemoveDependency(CSteamGameServerAPIContext.GetSteamUGC(), nParentPublishedFileID, nChildPublishedFileID);
}
/// <summary>
/// <para> add/remove app dependence/requirements (usually DLC)</para>
/// </summary>
public static SteamAPICall_t AddAppDependency(PublishedFileId_t nPublishedFileID, AppId_t nAppID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_AddAppDependency(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, nAppID);
}
public static SteamAPICall_t RemoveAppDependency(PublishedFileId_t nPublishedFileID, AppId_t nAppID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_RemoveAppDependency(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, nAppID);
}
/// <summary>
/// <para> request app dependencies. note that whatever callback you register for GetAppDependenciesResult_t may be called multiple times</para>
/// <para> until all app dependencies have been returned</para>
/// </summary>
public static SteamAPICall_t GetAppDependencies(PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_GetAppDependencies(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID);
}
/// <summary>
/// <para> delete the item without prompting the user</para>
/// </summary>
public static SteamAPICall_t DeleteItem(PublishedFileId_t nPublishedFileID) {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_DeleteItem(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID);
}
/// <summary>
/// <para> Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not</para>
/// </summary>
public static bool ShowWorkshopEULA() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_ShowWorkshopEULA(CSteamGameServerAPIContext.GetSteamUGC());
}
/// <summary>
/// <para> Retrieve information related to the user's acceptance or not of the app's specific Workshop EULA</para>
/// </summary>
public static SteamAPICall_t GetWorkshopEULAStatus() {
InteropHelp.TestIfAvailableGameServer();
return (SteamAPICall_t)NativeMethods.ISteamUGC_GetWorkshopEULAStatus(CSteamGameServerAPIContext.GetSteamUGC());
}
/// <summary>
/// <para> Return the user's community content descriptor preferences</para>
/// </summary>
public static uint GetUserContentDescriptorPreferences(EUGCContentDescriptorID[] pvecDescriptors, uint cMaxEntries) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUGC_GetUserContentDescriptorPreferences(CSteamGameServerAPIContext.GetSteamUGC(), pvecDescriptors, cMaxEntries);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d9d587bbccfa08f44bce4b14c0826e27
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,364 @@
// 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 SteamGameServerUtils {
/// <summary>
/// <para> return the number of seconds since the user</para>
/// </summary>
public static uint GetSecondsSinceAppActive() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetSecondsSinceAppActive(CSteamGameServerAPIContext.GetSteamUtils());
}
public static uint GetSecondsSinceComputerActive() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetSecondsSinceComputerActive(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> the universe this client is connecting to</para>
/// </summary>
public static EUniverse GetConnectedUniverse() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetConnectedUniverse(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)</para>
/// </summary>
public static uint GetServerRealTime() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetServerRealTime(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database)</para>
/// <para> e.g "US" or "UK".</para>
/// </summary>
public static string GetIPCountry() {
InteropHelp.TestIfAvailableGameServer();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamUtils_GetIPCountry(CSteamGameServerAPIContext.GetSteamUtils()));
}
/// <summary>
/// <para> returns true if the image exists, and valid sizes were filled out</para>
/// </summary>
public static bool GetImageSize(int iImage, out uint pnWidth, out uint pnHeight) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetImageSize(CSteamGameServerAPIContext.GetSteamUtils(), iImage, out pnWidth, out pnHeight);
}
/// <summary>
/// <para> returns true if the image exists, and the buffer was successfully filled out</para>
/// <para> results are returned in RGBA format</para>
/// <para> the destination buffer size should be 4 * height * width * sizeof(char)</para>
/// </summary>
public static bool GetImageRGBA(int iImage, byte[] pubDest, int nDestBufferSize) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetImageRGBA(CSteamGameServerAPIContext.GetSteamUtils(), iImage, pubDest, nDestBufferSize);
}
/// <summary>
/// <para> return the amount of battery power left in the current system in % [0..100], 255 for being on AC power</para>
/// </summary>
public static byte GetCurrentBatteryPower() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetCurrentBatteryPower(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> returns the appID of the current process</para>
/// </summary>
public static AppId_t GetAppID() {
InteropHelp.TestIfAvailableGameServer();
return (AppId_t)NativeMethods.ISteamUtils_GetAppID(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Sets the position where the overlay instance for the currently calling game should show notifications.</para>
/// <para> This position is per-game and if this function is called from outside of a game context it will do nothing.</para>
/// </summary>
public static void SetOverlayNotificationPosition(ENotificationPosition eNotificationPosition) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamUtils_SetOverlayNotificationPosition(CSteamGameServerAPIContext.GetSteamUtils(), eNotificationPosition);
}
/// <summary>
/// <para> API asynchronous call results</para>
/// <para> can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)</para>
/// </summary>
public static bool IsAPICallCompleted(SteamAPICall_t hSteamAPICall, out bool pbFailed) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_IsAPICallCompleted(CSteamGameServerAPIContext.GetSteamUtils(), hSteamAPICall, out pbFailed);
}
public static ESteamAPICallFailure GetAPICallFailureReason(SteamAPICall_t hSteamAPICall) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetAPICallFailureReason(CSteamGameServerAPIContext.GetSteamUtils(), hSteamAPICall);
}
public static bool GetAPICallResult(SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, out bool pbFailed) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetAPICallResult(CSteamGameServerAPIContext.GetSteamUtils(), hSteamAPICall, pCallback, cubCallback, iCallbackExpected, out pbFailed);
}
/// <summary>
/// <para> returns the number of IPC calls made since the last time this function was called</para>
/// <para> Used for perf debugging so you can understand how many IPC calls your game makes per frame</para>
/// <para> Every IPC call is at minimum a thread context switch if not a process one so you want to rate</para>
/// <para> control how often you do them.</para>
/// </summary>
public static uint GetIPCCallCount() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetIPCCallCount(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> API warning handling</para>
/// <para> 'int' is the severity; 0 for msg, 1 for warning</para>
/// <para> 'const char *' is the text of the message</para>
/// <para> callbacks will occur directly after the API function is called that generated the warning or message</para>
/// </summary>
public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamUtils_SetWarningMessageHook(CSteamGameServerAPIContext.GetSteamUtils(), pFunction);
}
/// <summary>
/// <para> Returns true if the overlay is running &amp; the user can access it. The overlay process could take a few seconds to</para>
/// <para> start &amp; hook the game process, so this function will initially return false while the overlay is loading.</para>
/// </summary>
public static bool IsOverlayEnabled() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_IsOverlayEnabled(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Normally this call is unneeded if your game has a constantly running frame loop that calls the</para>
/// <para> D3D Present API, or OGL SwapBuffers API every frame.</para>
/// <para> However, if you have a game that only refreshes the screen on an event driven basis then that can break</para>
/// <para> the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also</para>
/// <para> need to Present() to the screen any time an even needing a notification happens or when the overlay is</para>
/// <para> brought up over the game by a user. You can use this API to ask the overlay if it currently need a present</para>
/// <para> in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you</para>
/// <para> refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.</para>
/// </summary>
public static bool BOverlayNeedsPresent() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_BOverlayNeedsPresent(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Asynchronous call to check if an executable file has been signed using the public key set on the signing tab</para>
/// <para> of the partner site, for example to refuse to load modified executable files.</para>
/// <para> The result is returned in CheckFileSignature_t.</para>
/// <para> k_ECheckFileSignatureNoSignaturesFoundForThisApp - This app has not been configured on the signing tab of the partner site to enable this function.</para>
/// <para> k_ECheckFileSignatureNoSignaturesFoundForThisFile - This file is not listed on the signing tab for the partner site.</para>
/// <para> k_ECheckFileSignatureFileNotFound - The file does not exist on disk.</para>
/// <para> k_ECheckFileSignatureInvalidSignature - The file exists, and the signing tab has been set for this file, but the file is either not signed or the signature does not match.</para>
/// <para> k_ECheckFileSignatureValidSignature - The file is signed and the signature is valid.</para>
/// </summary>
public static SteamAPICall_t CheckFileSignature(string szFileName) {
InteropHelp.TestIfAvailableGameServer();
using (var szFileName2 = new InteropHelp.UTF8StringHandle(szFileName)) {
return (SteamAPICall_t)NativeMethods.ISteamUtils_CheckFileSignature(CSteamGameServerAPIContext.GetSteamUtils(), szFileName2);
}
}
/// <summary>
/// <para> Activates the full-screen text input dialog which takes a initial text string and returns the text the user has typed</para>
/// </summary>
public static bool ShowGamepadTextInput(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, string pchDescription, uint unCharMax, string pchExistingText) {
InteropHelp.TestIfAvailableGameServer();
using (var pchDescription2 = new InteropHelp.UTF8StringHandle(pchDescription))
using (var pchExistingText2 = new InteropHelp.UTF8StringHandle(pchExistingText)) {
return NativeMethods.ISteamUtils_ShowGamepadTextInput(CSteamGameServerAPIContext.GetSteamUtils(), eInputMode, eLineInputMode, pchDescription2, unCharMax, pchExistingText2);
}
}
/// <summary>
/// <para> Returns previously entered text &amp; length</para>
/// </summary>
public static uint GetEnteredGamepadTextLength() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetEnteredGamepadTextLength(CSteamGameServerAPIContext.GetSteamUtils());
}
public static bool GetEnteredGamepadTextInput(out string pchText, uint cchText) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchText2 = Marshal.AllocHGlobal((int)cchText);
bool ret = NativeMethods.ISteamUtils_GetEnteredGamepadTextInput(CSteamGameServerAPIContext.GetSteamUtils(), pchText2, cchText);
pchText = ret ? InteropHelp.PtrToStringUTF8(pchText2) : null;
Marshal.FreeHGlobal(pchText2);
return ret;
}
/// <summary>
/// <para> returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases</para>
/// </summary>
public static string GetSteamUILanguage() {
InteropHelp.TestIfAvailableGameServer();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamUtils_GetSteamUILanguage(CSteamGameServerAPIContext.GetSteamUtils()));
}
/// <summary>
/// <para> returns true if Steam itself is running in VR mode</para>
/// </summary>
public static bool IsSteamRunningInVR() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_IsSteamRunningInVR(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.</para>
/// </summary>
public static void SetOverlayNotificationInset(int nHorizontalInset, int nVerticalInset) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamUtils_SetOverlayNotificationInset(CSteamGameServerAPIContext.GetSteamUtils(), nHorizontalInset, nVerticalInset);
}
/// <summary>
/// <para> returns true if Steam &amp; the Steam Overlay are running in Big Picture mode</para>
/// <para> Games much be launched through the Steam client to enable the Big Picture overlay. During development,</para>
/// <para> a game can be added as a non-steam game to the developers library to test this feature</para>
/// </summary>
public static bool IsSteamInBigPictureMode() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_IsSteamInBigPictureMode(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> ask SteamUI to create and render its OpenVR dashboard</para>
/// </summary>
public static void StartVRDashboard() {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamUtils_StartVRDashboard(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Returns true if the HMD content will be streamed via Steam Remote Play</para>
/// </summary>
public static bool IsVRHeadsetStreamingEnabled() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_IsVRHeadsetStreamingEnabled(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Set whether the HMD content will be streamed via Steam Remote Play</para>
/// <para> If this is set to true, then the scene in the HMD headset will be streamed, and remote input will not be allowed.</para>
/// <para> If this is set to false, then the application window will be streamed instead, and remote input will be allowed.</para>
/// <para> The default is true unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game.</para>
/// <para> (this is useful for games that have asymmetric multiplayer gameplay)</para>
/// </summary>
public static void SetVRHeadsetStreamingEnabled(bool bEnabled) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamUtils_SetVRHeadsetStreamingEnabled(CSteamGameServerAPIContext.GetSteamUtils(), bEnabled);
}
/// <summary>
/// <para> Returns whether this steam client is a Steam China specific client, vs the global client.</para>
/// </summary>
public static bool IsSteamChinaLauncher() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_IsSteamChinaLauncher(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Initializes text filtering, loading dictionaries for the language the game is running in.</para>
/// <para> unFilterOptions are reserved for future use and should be set to 0</para>
/// <para> Returns false if filtering is unavailable for the game's language, in which case FilterText() will act as a passthrough.</para>
/// <para> Users can customize the text filter behavior in their Steam Account preferences:</para>
/// <para> https://store.steampowered.com/account/preferences#CommunityContentPreferences</para>
/// </summary>
public static bool InitFilterText(uint unFilterOptions = 0) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_InitFilterText(CSteamGameServerAPIContext.GetSteamUtils(), unFilterOptions);
}
/// <summary>
/// <para> Filters the provided input message and places the filtered result into pchOutFilteredText, using legally required filtering and additional filtering based on the context and user settings</para>
/// <para> eContext is the type of content in the input string</para>
/// <para> sourceSteamID is the Steam ID that is the source of the input string (e.g. the player with the name, or who said the chat text)</para>
/// <para> pchInputText is the input string that should be filtered, which can be ASCII or UTF-8</para>
/// <para> pchOutFilteredText is where the output will be placed, even if no filtering is performed</para>
/// <para> nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText, should be at least strlen(pchInputText)+1</para>
/// <para> Returns the number of characters (not bytes) filtered</para>
/// </summary>
public static int FilterText(ETextFilteringContext eContext, CSteamID sourceSteamID, string pchInputMessage, out string pchOutFilteredText, uint nByteSizeOutFilteredText) {
InteropHelp.TestIfAvailableGameServer();
IntPtr pchOutFilteredText2 = Marshal.AllocHGlobal((int)nByteSizeOutFilteredText);
using (var pchInputMessage2 = new InteropHelp.UTF8StringHandle(pchInputMessage)) {
int ret = NativeMethods.ISteamUtils_FilterText(CSteamGameServerAPIContext.GetSteamUtils(), eContext, sourceSteamID, pchInputMessage2, pchOutFilteredText2, nByteSizeOutFilteredText);
pchOutFilteredText = ret != -1 ? InteropHelp.PtrToStringUTF8(pchOutFilteredText2) : null;
Marshal.FreeHGlobal(pchOutFilteredText2);
return ret;
}
}
/// <summary>
/// <para> Return what we believe your current ipv6 connectivity to "the internet" is on the specified protocol.</para>
/// <para> This does NOT tell you if the Steam client is currently connected to Steam via ipv6.</para>
/// </summary>
public static ESteamIPv6ConnectivityState GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol eProtocol) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_GetIPv6ConnectivityState(CSteamGameServerAPIContext.GetSteamUtils(), eProtocol);
}
/// <summary>
/// <para> returns true if currently running on the Steam Deck device</para>
/// </summary>
public static bool IsSteamRunningOnSteamDeck() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_IsSteamRunningOnSteamDeck(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game.</para>
/// <para> The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field</para>
/// </summary>
public static bool ShowFloatingGamepadTextInput(EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight) {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_ShowFloatingGamepadTextInput(CSteamGameServerAPIContext.GetSteamUtils(), eKeyboardMode, nTextFieldXPosition, nTextFieldYPosition, nTextFieldWidth, nTextFieldHeight);
}
/// <summary>
/// <para> In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher</para>
/// </summary>
public static void SetGameLauncherMode(bool bLauncherMode) {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamUtils_SetGameLauncherMode(CSteamGameServerAPIContext.GetSteamUtils(), bLauncherMode);
}
/// <summary>
/// <para> Dismisses the floating keyboard.</para>
/// </summary>
public static bool DismissFloatingGamepadTextInput() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_DismissFloatingGamepadTextInput(CSteamGameServerAPIContext.GetSteamUtils());
}
/// <summary>
/// <para> Dismisses the full-screen text input dialog.</para>
/// </summary>
public static bool DismissGamepadTextInput() {
InteropHelp.TestIfAvailableGameServer();
return NativeMethods.ISteamUtils_DismissGamepadTextInput(CSteamGameServerAPIContext.GetSteamUtils());
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3bc4fe214c0d4e141a8566489f6eba33
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,341 @@
// 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 SteamHTMLSurface {
/// <summary>
/// <para> Must call init and shutdown when starting/ending use of the interface</para>
/// </summary>
public static bool Init() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTMLSurface_Init(CSteamAPIContext.GetSteamHTMLSurface());
}
public static bool Shutdown() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTMLSurface_Shutdown(CSteamAPIContext.GetSteamHTMLSurface());
}
/// <summary>
/// <para> Create a browser object for display of a html page, when creation is complete the call handle</para>
/// <para> will return a HTML_BrowserReady_t callback for the HHTMLBrowser of your new browser.</para>
/// <para> The user agent string is a substring to be added to the general user agent string so you can</para>
/// <para> identify your client on web servers.</para>
/// <para> The userCSS string lets you apply a CSS style sheet to every displayed page, leave null if</para>
/// <para> you do not require this functionality.</para>
/// <para> YOU MUST HAVE IMPLEMENTED HANDLERS FOR HTML_BrowserReady_t, HTML_StartRequest_t,</para>
/// <para> HTML_JSAlert_t, HTML_JSConfirm_t, and HTML_FileOpenDialog_t! See the CALLBACKS</para>
/// <para> section of this interface (AllowStartRequest, etc) for more details. If you do</para>
/// <para> not implement these callback handlers, the browser may appear to hang instead of</para>
/// <para> navigating to new pages or triggering javascript popups.</para>
/// </summary>
public static SteamAPICall_t CreateBrowser(string pchUserAgent, string pchUserCSS) {
InteropHelp.TestIfAvailableClient();
using (var pchUserAgent2 = new InteropHelp.UTF8StringHandle(pchUserAgent))
using (var pchUserCSS2 = new InteropHelp.UTF8StringHandle(pchUserCSS)) {
return (SteamAPICall_t)NativeMethods.ISteamHTMLSurface_CreateBrowser(CSteamAPIContext.GetSteamHTMLSurface(), pchUserAgent2, pchUserCSS2);
}
}
/// <summary>
/// <para> Call this when you are done with a html surface, this lets us free the resources being used by it</para>
/// </summary>
public static void RemoveBrowser(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_RemoveBrowser(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> Navigate to this URL, results in a HTML_StartRequest_t as the request commences</para>
/// </summary>
public static void LoadURL(HHTMLBrowser unBrowserHandle, string pchURL, string pchPostData) {
InteropHelp.TestIfAvailableClient();
using (var pchURL2 = new InteropHelp.UTF8StringHandle(pchURL))
using (var pchPostData2 = new InteropHelp.UTF8StringHandle(pchPostData)) {
NativeMethods.ISteamHTMLSurface_LoadURL(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, pchURL2, pchPostData2);
}
}
/// <summary>
/// <para> Tells the surface the size in pixels to display the surface</para>
/// </summary>
public static void SetSize(HHTMLBrowser unBrowserHandle, uint unWidth, uint unHeight) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_SetSize(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, unWidth, unHeight);
}
/// <summary>
/// <para> Stop the load of the current html page</para>
/// </summary>
public static void StopLoad(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_StopLoad(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> Reload (most likely from local cache) the current page</para>
/// </summary>
public static void Reload(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_Reload(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> navigate back in the page history</para>
/// </summary>
public static void GoBack(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_GoBack(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> navigate forward in the page history</para>
/// </summary>
public static void GoForward(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_GoForward(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> add this header to any url requests from this browser</para>
/// </summary>
public static void AddHeader(HHTMLBrowser unBrowserHandle, string pchKey, string pchValue) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey))
using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue)) {
NativeMethods.ISteamHTMLSurface_AddHeader(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, pchKey2, pchValue2);
}
}
/// <summary>
/// <para> run this javascript script in the currently loaded page</para>
/// </summary>
public static void ExecuteJavascript(HHTMLBrowser unBrowserHandle, string pchScript) {
InteropHelp.TestIfAvailableClient();
using (var pchScript2 = new InteropHelp.UTF8StringHandle(pchScript)) {
NativeMethods.ISteamHTMLSurface_ExecuteJavascript(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, pchScript2);
}
}
/// <summary>
/// <para> Mouse click and mouse movement commands</para>
/// </summary>
public static void MouseUp(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_MouseUp(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, eMouseButton);
}
public static void MouseDown(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_MouseDown(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, eMouseButton);
}
public static void MouseDoubleClick(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_MouseDoubleClick(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, eMouseButton);
}
/// <summary>
/// <para> x and y are relative to the HTML bounds</para>
/// </summary>
public static void MouseMove(HHTMLBrowser unBrowserHandle, int x, int y) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_MouseMove(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, x, y);
}
/// <summary>
/// <para> nDelta is pixels of scroll</para>
/// </summary>
public static void MouseWheel(HHTMLBrowser unBrowserHandle, int nDelta) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_MouseWheel(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, nDelta);
}
/// <summary>
/// <para> keyboard interactions, native keycode is the virtual key code value from your OS, system key flags the key to not</para>
/// <para> be sent as a typed character as well as a key down</para>
/// </summary>
public static void KeyDown(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_KeyDown(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, nNativeKeyCode, eHTMLKeyModifiers, bIsSystemKey);
}
public static void KeyUp(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_KeyUp(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, nNativeKeyCode, eHTMLKeyModifiers);
}
/// <summary>
/// <para> cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)</para>
/// </summary>
public static void KeyChar(HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_KeyChar(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, cUnicodeChar, eHTMLKeyModifiers);
}
/// <summary>
/// <para> programmatically scroll this many pixels on the page</para>
/// </summary>
public static void SetHorizontalScroll(HHTMLBrowser unBrowserHandle, uint nAbsolutePixelScroll) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_SetHorizontalScroll(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, nAbsolutePixelScroll);
}
public static void SetVerticalScroll(HHTMLBrowser unBrowserHandle, uint nAbsolutePixelScroll) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_SetVerticalScroll(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, nAbsolutePixelScroll);
}
/// <summary>
/// <para> tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things</para>
/// </summary>
public static void SetKeyFocus(HHTMLBrowser unBrowserHandle, bool bHasKeyFocus) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_SetKeyFocus(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, bHasKeyFocus);
}
/// <summary>
/// <para> open the current pages html code in the local editor of choice, used for debugging</para>
/// </summary>
public static void ViewSource(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_ViewSource(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> copy the currently selected text on the html page to the local clipboard</para>
/// </summary>
public static void CopyToClipboard(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_CopyToClipboard(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> paste from the local clipboard to the current html page</para>
/// </summary>
public static void PasteFromClipboard(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_PasteFromClipboard(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element</para>
/// </summary>
public static void Find(HHTMLBrowser unBrowserHandle, string pchSearchStr, bool bCurrentlyInFind, bool bReverse) {
InteropHelp.TestIfAvailableClient();
using (var pchSearchStr2 = new InteropHelp.UTF8StringHandle(pchSearchStr)) {
NativeMethods.ISteamHTMLSurface_Find(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, pchSearchStr2, bCurrentlyInFind, bReverse);
}
}
/// <summary>
/// <para> cancel a currently running find</para>
/// </summary>
public static void StopFind(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_StopFind(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> return details about the link at position x,y on the current page</para>
/// </summary>
public static void GetLinkAtPosition(HHTMLBrowser unBrowserHandle, int x, int y) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_GetLinkAtPosition(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, x, y);
}
/// <summary>
/// <para> set a webcookie for the hostname in question</para>
/// </summary>
public static void SetCookie(string pchHostname, string pchKey, string pchValue, string pchPath = "/", uint nExpires = 0, bool bSecure = false, bool bHTTPOnly = false) {
InteropHelp.TestIfAvailableClient();
using (var pchHostname2 = new InteropHelp.UTF8StringHandle(pchHostname))
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey))
using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue))
using (var pchPath2 = new InteropHelp.UTF8StringHandle(pchPath)) {
NativeMethods.ISteamHTMLSurface_SetCookie(CSteamAPIContext.GetSteamHTMLSurface(), pchHostname2, pchKey2, pchValue2, pchPath2, nExpires, bSecure, bHTTPOnly);
}
}
/// <summary>
/// <para> Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)</para>
/// </summary>
public static void SetPageScaleFactor(HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_SetPageScaleFactor(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, flZoom, nPointX, nPointY);
}
/// <summary>
/// <para> Enable/disable low-resource background mode, where javascript and repaint timers are throttled, resources are</para>
/// <para> more aggressively purged from memory, and audio/video elements are paused. When background mode is enabled,</para>
/// <para> all HTML5 video and audio objects will execute ".pause()" and gain the property "._steam_background_paused = 1".</para>
/// <para> When background mode is disabled, any video or audio objects with that property will resume with ".play()".</para>
/// </summary>
public static void SetBackgroundMode(HHTMLBrowser unBrowserHandle, bool bBackgroundMode) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_SetBackgroundMode(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, bBackgroundMode);
}
/// <summary>
/// <para> Scale the output display space by this factor, this is useful when displaying content on high dpi devices.</para>
/// <para> Specifies the ratio between physical and logical pixels.</para>
/// </summary>
public static void SetDPIScalingFactor(HHTMLBrowser unBrowserHandle, float flDPIScaling) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_SetDPIScalingFactor(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, flDPIScaling);
}
/// <summary>
/// <para> Open HTML/JS developer tools</para>
/// </summary>
public static void OpenDeveloperTools(HHTMLBrowser unBrowserHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_OpenDeveloperTools(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle);
}
/// <summary>
/// <para> CALLBACKS</para>
/// <para> These set of functions are used as responses to callback requests</para>
/// <para> You MUST call this in response to a HTML_StartRequest_t callback</para>
/// <para> Set bAllowed to true to allow this navigation, false to cancel it and stay</para>
/// <para> on the current page. You can use this feature to limit the valid pages</para>
/// <para> allowed in your HTML surface.</para>
/// </summary>
public static void AllowStartRequest(HHTMLBrowser unBrowserHandle, bool bAllowed) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_AllowStartRequest(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, bAllowed);
}
/// <summary>
/// <para> You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback</para>
/// <para> Set bResult to true for the OK option of a confirm, use false otherwise</para>
/// </summary>
public static void JSDialogResponse(HHTMLBrowser unBrowserHandle, bool bResult) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_JSDialogResponse(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, bResult);
}
/// <summary>
/// <para> You MUST call this in response to a HTML_FileOpenDialog_t callback</para>
/// </summary>
public static void FileLoadDialogResponse(HHTMLBrowser unBrowserHandle, IntPtr pchSelectedFiles) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamHTMLSurface_FileLoadDialogResponse(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, pchSelectedFiles);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c43dd86c6f6eae843b97b286ffc38913
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,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 SteamHTTP {
/// <summary>
/// <para> Initializes a new HTTP request, returning a handle to use in further operations on it. Requires</para>
/// <para> the method (GET or POST) and the absolute URL for the request. Both http and https are supported,</para>
/// <para> so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/</para>
/// <para> or such.</para>
/// </summary>
public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL) {
InteropHelp.TestIfAvailableClient();
using (var pchAbsoluteURL2 = new InteropHelp.UTF8StringHandle(pchAbsoluteURL)) {
return (HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(CSteamAPIContext.GetSteamHTTP(), eHTTPRequestMethod, pchAbsoluteURL2);
}
}
/// <summary>
/// <para> Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after</para>
/// <para> sending the request. This is just so the caller can easily keep track of which callbacks go with which request data.</para>
/// </summary>
public static bool SetHTTPRequestContextValue(HTTPRequestHandle hRequest, ulong ulContextValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_SetHTTPRequestContextValue(CSteamAPIContext.GetSteamHTTP(), hRequest, ulContextValue);
}
/// <summary>
/// <para> Set a timeout in seconds for the HTTP request, must be called prior to sending the request. Default</para>
/// <para> timeout is 60 seconds if you don't call this. Returns false if the handle is invalid, or the request</para>
/// <para> has already been sent.</para>
/// </summary>
public static bool SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle hRequest, uint unTimeoutSeconds) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_SetHTTPRequestNetworkActivityTimeout(CSteamAPIContext.GetSteamHTTP(), hRequest, unTimeoutSeconds);
}
/// <summary>
/// <para> Set a request header value for the request, must be called prior to sending the request. Will</para>
/// <para> return false if the handle is invalid or the request is already sent.</para>
/// </summary>
public static bool SetHTTPRequestHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, string pchHeaderValue) {
InteropHelp.TestIfAvailableClient();
using (var pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName))
using (var pchHeaderValue2 = new InteropHelp.UTF8StringHandle(pchHeaderValue)) {
return NativeMethods.ISteamHTTP_SetHTTPRequestHeaderValue(CSteamAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, pchHeaderValue2);
}
}
/// <summary>
/// <para> Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified</para>
/// <para> when creating the request. Must be called prior to sending the request. Will return false if the</para>
/// <para> handle is invalid or the request is already sent.</para>
/// </summary>
public static bool SetHTTPRequestGetOrPostParameter(HTTPRequestHandle hRequest, string pchParamName, string pchParamValue) {
InteropHelp.TestIfAvailableClient();
using (var pchParamName2 = new InteropHelp.UTF8StringHandle(pchParamName))
using (var pchParamValue2 = new InteropHelp.UTF8StringHandle(pchParamValue)) {
return NativeMethods.ISteamHTTP_SetHTTPRequestGetOrPostParameter(CSteamAPIContext.GetSteamHTTP(), hRequest, pchParamName2, pchParamValue2);
}
}
/// <summary>
/// <para> Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on</para>
/// <para> asynchronous response via callback.</para>
/// <para> Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control</para>
/// <para> header and only do a local cache lookup rather than sending any actual remote request.</para>
/// </summary>
public static bool SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_SendHTTPRequest(CSteamAPIContext.GetSteamHTTP(), hRequest, out pCallHandle);
}
/// <summary>
/// <para> Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on</para>
/// <para> asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and</para>
/// <para> HTTPRequestDataReceived_t callbacks while streaming.</para>
/// </summary>
public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_SendHTTPRequestAndStreamResponse(CSteamAPIContext.GetSteamHTTP(), hRequest, out pCallHandle);
}
/// <summary>
/// <para> Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move</para>
/// <para> the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent.</para>
/// </summary>
public static bool DeferHTTPRequest(HTTPRequestHandle hRequest) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_DeferHTTPRequest(CSteamAPIContext.GetSteamHTTP(), hRequest);
}
/// <summary>
/// <para> Prioritizes a request you have sent, the actual HTTP client code may have many requests queued, and this will move</para>
/// <para> the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent.</para>
/// </summary>
public static bool PrioritizeHTTPRequest(HTTPRequestHandle hRequest) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_PrioritizeHTTPRequest(CSteamAPIContext.GetSteamHTTP(), hRequest);
}
/// <summary>
/// <para> Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also</para>
/// <para> returns the size of the header value if present so the caller and allocate a correctly sized buffer for</para>
/// <para> GetHTTPResponseHeaderValue.</para>
/// </summary>
public static bool GetHTTPResponseHeaderSize(HTTPRequestHandle hRequest, string pchHeaderName, out uint unResponseHeaderSize) {
InteropHelp.TestIfAvailableClient();
using (var pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName)) {
return NativeMethods.ISteamHTTP_GetHTTPResponseHeaderSize(CSteamAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, out unResponseHeaderSize);
}
}
/// <summary>
/// <para> Gets header values from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the</para>
/// <para> header is not present or if your buffer is too small to contain it's value. You should first call</para>
/// <para> BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed.</para>
/// </summary>
public static bool GetHTTPResponseHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, byte[] pHeaderValueBuffer, uint unBufferSize) {
InteropHelp.TestIfAvailableClient();
using (var pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName)) {
return NativeMethods.ISteamHTTP_GetHTTPResponseHeaderValue(CSteamAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, pHeaderValueBuffer, unBufferSize);
}
}
/// <summary>
/// <para> Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the</para>
/// <para> handle is invalid.</para>
/// </summary>
public static bool GetHTTPResponseBodySize(HTTPRequestHandle hRequest, out uint unBodySize) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_GetHTTPResponseBodySize(CSteamAPIContext.GetSteamHTTP(), hRequest, out unBodySize);
}
/// <summary>
/// <para> Gets the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the</para>
/// <para> handle is invalid or is to a streaming response, or if the provided buffer is not the correct size. Use BGetHTTPResponseBodySize first to find out</para>
/// <para> the correct buffer size to use.</para>
/// </summary>
public static bool GetHTTPResponseBodyData(HTTPRequestHandle hRequest, byte[] pBodyDataBuffer, uint unBufferSize) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_GetHTTPResponseBodyData(CSteamAPIContext.GetSteamHTTP(), hRequest, pBodyDataBuffer, unBufferSize);
}
/// <summary>
/// <para> Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the</para>
/// <para> handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset</para>
/// <para> do not match the size and offset sent in HTTPRequestDataReceived_t.</para>
/// </summary>
public static bool GetHTTPStreamingResponseBodyData(HTTPRequestHandle hRequest, uint cOffset, byte[] pBodyDataBuffer, uint unBufferSize) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_GetHTTPStreamingResponseBodyData(CSteamAPIContext.GetSteamHTTP(), hRequest, cOffset, pBodyDataBuffer, unBufferSize);
}
/// <summary>
/// <para> Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t</para>
/// <para> callback and finishing using the response.</para>
/// </summary>
public static bool ReleaseHTTPRequest(HTTPRequestHandle hRequest) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_ReleaseHTTPRequest(CSteamAPIContext.GetSteamHTTP(), hRequest);
}
/// <summary>
/// <para> Gets progress on downloading the body for the request. This will be zero unless a response header has already been</para>
/// <para> received which included a content-length field. For responses that contain no content-length it will report</para>
/// <para> zero for the duration of the request as the size is unknown until the connection closes.</para>
/// </summary>
public static bool GetHTTPDownloadProgressPct(HTTPRequestHandle hRequest, out float pflPercentOut) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_GetHTTPDownloadProgressPct(CSteamAPIContext.GetSteamHTTP(), hRequest, out pflPercentOut);
}
/// <summary>
/// <para> Sets the body for an HTTP Post request. Will fail and return false on a GET request, and will fail if POST params</para>
/// <para> have already been set for the request. Setting this raw body makes it the only contents for the post, the pchContentType</para>
/// <para> parameter will set the content-type header for the request so the server may know how to interpret the body.</para>
/// </summary>
public static bool SetHTTPRequestRawPostBody(HTTPRequestHandle hRequest, string pchContentType, byte[] pubBody, uint unBodyLen) {
InteropHelp.TestIfAvailableClient();
using (var pchContentType2 = new InteropHelp.UTF8StringHandle(pchContentType)) {
return NativeMethods.ISteamHTTP_SetHTTPRequestRawPostBody(CSteamAPIContext.GetSteamHTTP(), hRequest, pchContentType2, pubBody, unBodyLen);
}
}
/// <summary>
/// <para> Creates a cookie container handle which you must later free with ReleaseCookieContainer(). If bAllowResponsesToModify=true</para>
/// <para> than any response to your requests using this cookie container may add new cookies which may be transmitted with</para>
/// <para> future requests. If bAllowResponsesToModify=false than only cookies you explicitly set will be sent. This API is just for</para>
/// <para> during process lifetime, after steam restarts no cookies are persisted and you have no way to access the cookie container across</para>
/// <para> repeat executions of your process.</para>
/// </summary>
public static HTTPCookieContainerHandle CreateCookieContainer(bool bAllowResponsesToModify) {
InteropHelp.TestIfAvailableClient();
return (HTTPCookieContainerHandle)NativeMethods.ISteamHTTP_CreateCookieContainer(CSteamAPIContext.GetSteamHTTP(), bAllowResponsesToModify);
}
/// <summary>
/// <para> Release a cookie container you are finished using, freeing it's memory</para>
/// </summary>
public static bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_ReleaseCookieContainer(CSteamAPIContext.GetSteamHTTP(), hCookieContainer);
}
/// <summary>
/// <para> Adds a cookie to the specified cookie container that will be used with future requests.</para>
/// </summary>
public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie) {
InteropHelp.TestIfAvailableClient();
using (var pchHost2 = new InteropHelp.UTF8StringHandle(pchHost))
using (var pchUrl2 = new InteropHelp.UTF8StringHandle(pchUrl))
using (var pchCookie2 = new InteropHelp.UTF8StringHandle(pchCookie)) {
return NativeMethods.ISteamHTTP_SetCookie(CSteamAPIContext.GetSteamHTTP(), hCookieContainer, pchHost2, pchUrl2, pchCookie2);
}
}
/// <summary>
/// <para> Set the cookie container to use for a HTTP request</para>
/// </summary>
public static bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_SetHTTPRequestCookieContainer(CSteamAPIContext.GetSteamHTTP(), hRequest, hCookieContainer);
}
/// <summary>
/// <para> Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end</para>
/// </summary>
public static bool SetHTTPRequestUserAgentInfo(HTTPRequestHandle hRequest, string pchUserAgentInfo) {
InteropHelp.TestIfAvailableClient();
using (var pchUserAgentInfo2 = new InteropHelp.UTF8StringHandle(pchUserAgentInfo)) {
return NativeMethods.ISteamHTTP_SetHTTPRequestUserAgentInfo(CSteamAPIContext.GetSteamHTTP(), hRequest, pchUserAgentInfo2);
}
}
/// <summary>
/// <para> Disable or re-enable verification of SSL/TLS certificates.</para>
/// <para> By default, certificates are checked for all HTTPS requests.</para>
/// </summary>
public static bool SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(CSteamAPIContext.GetSteamHTTP(), hRequest, bRequireVerifiedCertificate);
}
/// <summary>
/// <para> Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout</para>
/// <para> which can bump everytime we get more data</para>
/// </summary>
public static bool SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint unMilliseconds) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(CSteamAPIContext.GetSteamHTTP(), hRequest, unMilliseconds);
}
/// <summary>
/// <para> Check if the reason the request failed was because we timed it out (rather than some harder failure)</para>
/// </summary>
public static bool GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, out bool pbWasTimedOut) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamHTTP_GetHTTPRequestWasTimedOut(CSteamAPIContext.GetSteamHTTP(), hRequest, out pbWasTimedOut);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: add20100ffe7965439ac0185598adb2c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,476 @@
// 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 SteamInput {
/// <summary>
/// <para> Init and Shutdown must be called when starting/ending use of this interface.</para>
/// <para> if bExplicitlyCallRunFrame is called then you will need to manually call RunFrame</para>
/// <para> each frame, otherwise Steam Input will updated when SteamAPI_RunCallbacks() is called</para>
/// </summary>
public static bool Init(bool bExplicitlyCallRunFrame) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_Init(CSteamAPIContext.GetSteamInput(), bExplicitlyCallRunFrame);
}
public static bool Shutdown() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_Shutdown(CSteamAPIContext.GetSteamInput());
}
/// <summary>
/// <para> Set the absolute path to the Input Action Manifest file containing the in-game actions</para>
/// <para> and file paths to the official configurations. Used in games that bundle Steam Input</para>
/// <para> configurations inside of the game depot instead of using the Steam Workshop</para>
/// </summary>
public static bool SetInputActionManifestFilePath(string pchInputActionManifestAbsolutePath) {
InteropHelp.TestIfAvailableClient();
using (var pchInputActionManifestAbsolutePath2 = new InteropHelp.UTF8StringHandle(pchInputActionManifestAbsolutePath)) {
return NativeMethods.ISteamInput_SetInputActionManifestFilePath(CSteamAPIContext.GetSteamInput(), pchInputActionManifestAbsolutePath2);
}
}
/// <summary>
/// <para> Synchronize API state with the latest Steam Input action data available. This</para>
/// <para> is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest</para>
/// <para> possible latency, you call this directly before reading controller state.</para>
/// <para> Note: This must be called from somewhere before GetConnectedControllers will</para>
/// <para> return any handles</para>
/// </summary>
public static void RunFrame(bool bReservedValue = true) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_RunFrame(CSteamAPIContext.GetSteamInput(), bReservedValue);
}
/// <summary>
/// <para> Waits on an IPC event from Steam sent when there is new data to be fetched from</para>
/// <para> the data drop. Returns true when data was recievied before the timeout expires.</para>
/// <para> Useful for games with a dedicated input thread</para>
/// </summary>
public static bool BWaitForData(bool bWaitForever, uint unTimeout) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_BWaitForData(CSteamAPIContext.GetSteamInput(), bWaitForever, unTimeout);
}
/// <summary>
/// <para> Returns true if new data has been received since the last time action data was accessed</para>
/// <para> via GetDigitalActionData or GetAnalogActionData. The game will still need to call</para>
/// <para> SteamInput()-&gt;RunFrame() or SteamAPI_RunCallbacks() before this to update the data stream</para>
/// </summary>
public static bool BNewDataAvailable() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_BNewDataAvailable(CSteamAPIContext.GetSteamInput());
}
/// <summary>
/// <para> Enumerate currently connected Steam Input enabled devices - developers can opt in controller by type (ex: Xbox/Playstation/etc) via</para>
/// <para> the Steam Input settings in the Steamworks site or users can opt-in in their controller settings in Steam.</para>
/// <para> handlesOut should point to a STEAM_INPUT_MAX_COUNT sized array of InputHandle_t handles</para>
/// <para> Returns the number of handles written to handlesOut</para>
/// </summary>
public static int GetConnectedControllers(InputHandle_t[] handlesOut) {
InteropHelp.TestIfAvailableClient();
if (handlesOut != null && handlesOut.Length != Constants.STEAM_INPUT_MAX_COUNT) {
throw new System.ArgumentException("handlesOut must be the same size as Constants.STEAM_INPUT_MAX_COUNT!");
}
return NativeMethods.ISteamInput_GetConnectedControllers(CSteamAPIContext.GetSteamInput(), handlesOut);
}
/// <summary>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> CALLBACKS</para>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> Controller configuration loaded - these callbacks will always fire if you have</para>
/// <para> a handler. Note: this is called within either SteamInput()-&gt;RunFrame or by SteamAPI_RunCallbacks</para>
/// <para> Enable SteamInputDeviceConnected_t and SteamInputDeviceDisconnected_t callbacks.</para>
/// <para> Each controller that is already connected will generate a device connected</para>
/// <para> callback when you enable them</para>
/// </summary>
public static void EnableDeviceCallbacks() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_EnableDeviceCallbacks(CSteamAPIContext.GetSteamInput());
}
/// <summary>
/// <para> Controller Connected - provides info about a single newly connected controller</para>
/// <para> Note: this is called within either SteamInput()-&gt;RunFrame or by SteamAPI_RunCallbacks</para>
/// <para> Controller Disconnected - provides info about a single disconnected controller</para>
/// <para> Note: this is called within either SteamInput()-&gt;RunFrame or by SteamAPI_RunCallbacks</para>
/// <para> Controllers using Gamepad emulation (XInput, DirectInput, etc) will be seated in the order that</para>
/// <para> input is sent by the device. This callback will fire on first input for each device and when the</para>
/// <para> a user has manually changed the order via the Steam overlay. This also has the device type info</para>
/// <para> so that you can change out glyph sets without making additional API calls</para>
/// <para> Enable SteamInputActionEvent_t callbacks. Directly calls your callback function</para>
/// <para> for lower latency than standard Steam callbacks. Supports one callback at a time.</para>
/// <para> Note: this is called within either SteamInput()-&gt;RunFrame or by SteamAPI_RunCallbacks</para>
/// </summary>
public static void EnableActionEventCallbacks(SteamInputActionEventCallbackPointer pCallback) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_EnableActionEventCallbacks(CSteamAPIContext.GetSteamInput(), pCallback);
}
/// <summary>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> ACTION SETS</para>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.</para>
/// </summary>
public static InputActionSetHandle_t GetActionSetHandle(string pszActionSetName) {
InteropHelp.TestIfAvailableClient();
using (var pszActionSetName2 = new InteropHelp.UTF8StringHandle(pszActionSetName)) {
return (InputActionSetHandle_t)NativeMethods.ISteamInput_GetActionSetHandle(CSteamAPIContext.GetSteamInput(), pszActionSetName2);
}
}
/// <summary>
/// <para> Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive')</para>
/// <para> This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in</para>
/// <para> your state loops, instead of trying to place it in all of your state transitions.</para>
/// </summary>
public static void ActivateActionSet(InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_ActivateActionSet(CSteamAPIContext.GetSteamInput(), inputHandle, actionSetHandle);
}
public static InputActionSetHandle_t GetCurrentActionSet(InputHandle_t inputHandle) {
InteropHelp.TestIfAvailableClient();
return (InputActionSetHandle_t)NativeMethods.ISteamInput_GetCurrentActionSet(CSteamAPIContext.GetSteamInput(), inputHandle);
}
/// <summary>
/// <para> ACTION SET LAYERS</para>
/// </summary>
public static void ActivateActionSetLayer(InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_ActivateActionSetLayer(CSteamAPIContext.GetSteamInput(), inputHandle, actionSetLayerHandle);
}
public static void DeactivateActionSetLayer(InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_DeactivateActionSetLayer(CSteamAPIContext.GetSteamInput(), inputHandle, actionSetLayerHandle);
}
public static void DeactivateAllActionSetLayers(InputHandle_t inputHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_DeactivateAllActionSetLayers(CSteamAPIContext.GetSteamInput(), inputHandle);
}
/// <summary>
/// <para> Enumerate currently active layers.</para>
/// <para> handlesOut should point to a STEAM_INPUT_MAX_ACTIVE_LAYERS sized array of InputActionSetHandle_t handles</para>
/// <para> Returns the number of handles written to handlesOut</para>
/// </summary>
public static int GetActiveActionSetLayers(InputHandle_t inputHandle, InputActionSetHandle_t[] handlesOut) {
InteropHelp.TestIfAvailableClient();
if (handlesOut != null && handlesOut.Length != Constants.STEAM_INPUT_MAX_ACTIVE_LAYERS) {
throw new System.ArgumentException("handlesOut must be the same size as Constants.STEAM_INPUT_MAX_ACTIVE_LAYERS!");
}
return NativeMethods.ISteamInput_GetActiveActionSetLayers(CSteamAPIContext.GetSteamInput(), inputHandle, handlesOut);
}
/// <summary>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> ACTIONS</para>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.</para>
/// </summary>
public static InputDigitalActionHandle_t GetDigitalActionHandle(string pszActionName) {
InteropHelp.TestIfAvailableClient();
using (var pszActionName2 = new InteropHelp.UTF8StringHandle(pszActionName)) {
return (InputDigitalActionHandle_t)NativeMethods.ISteamInput_GetDigitalActionHandle(CSteamAPIContext.GetSteamInput(), pszActionName2);
}
}
/// <summary>
/// <para> Returns the current state of the supplied digital game action</para>
/// </summary>
public static InputDigitalActionData_t GetDigitalActionData(InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetDigitalActionData(CSteamAPIContext.GetSteamInput(), inputHandle, digitalActionHandle);
}
/// <summary>
/// <para> Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.</para>
/// <para> originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to</para>
/// <para> the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.</para>
/// </summary>
public static int GetDigitalActionOrigins(InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, EInputActionOrigin[] originsOut) {
InteropHelp.TestIfAvailableClient();
if (originsOut != null && originsOut.Length != Constants.STEAM_INPUT_MAX_ORIGINS) {
throw new System.ArgumentException("originsOut must be the same size as Constants.STEAM_INPUT_MAX_ORIGINS!");
}
return NativeMethods.ISteamInput_GetDigitalActionOrigins(CSteamAPIContext.GetSteamInput(), inputHandle, actionSetHandle, digitalActionHandle, originsOut);
}
/// <summary>
/// <para> Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle</para>
/// </summary>
public static string GetStringForDigitalActionName(InputDigitalActionHandle_t eActionHandle) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamInput_GetStringForDigitalActionName(CSteamAPIContext.GetSteamInput(), eActionHandle));
}
/// <summary>
/// <para> Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.</para>
/// </summary>
public static InputAnalogActionHandle_t GetAnalogActionHandle(string pszActionName) {
InteropHelp.TestIfAvailableClient();
using (var pszActionName2 = new InteropHelp.UTF8StringHandle(pszActionName)) {
return (InputAnalogActionHandle_t)NativeMethods.ISteamInput_GetAnalogActionHandle(CSteamAPIContext.GetSteamInput(), pszActionName2);
}
}
/// <summary>
/// <para> Returns the current state of these supplied analog game action</para>
/// </summary>
public static InputAnalogActionData_t GetAnalogActionData(InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetAnalogActionData(CSteamAPIContext.GetSteamInput(), inputHandle, analogActionHandle);
}
/// <summary>
/// <para> Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.</para>
/// <para> originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to</para>
/// <para> the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.</para>
/// </summary>
public static int GetAnalogActionOrigins(InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, EInputActionOrigin[] originsOut) {
InteropHelp.TestIfAvailableClient();
if (originsOut != null && originsOut.Length != Constants.STEAM_INPUT_MAX_ORIGINS) {
throw new System.ArgumentException("originsOut must be the same size as Constants.STEAM_INPUT_MAX_ORIGINS!");
}
return NativeMethods.ISteamInput_GetAnalogActionOrigins(CSteamAPIContext.GetSteamInput(), inputHandle, actionSetHandle, analogActionHandle, originsOut);
}
/// <summary>
/// <para> Get a local path to a PNG file for the provided origin's glyph.</para>
/// </summary>
public static string GetGlyphPNGForActionOrigin(EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint unFlags) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamInput_GetGlyphPNGForActionOrigin(CSteamAPIContext.GetSteamInput(), eOrigin, eSize, unFlags));
}
/// <summary>
/// <para> Get a local path to a SVG file for the provided origin's glyph.</para>
/// </summary>
public static string GetGlyphSVGForActionOrigin(EInputActionOrigin eOrigin, uint unFlags) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamInput_GetGlyphSVGForActionOrigin(CSteamAPIContext.GetSteamInput(), eOrigin, unFlags));
}
/// <summary>
/// <para> Get a local path to an older, Big Picture Mode-style PNG file for a particular origin</para>
/// </summary>
public static string GetGlyphForActionOrigin_Legacy(EInputActionOrigin eOrigin) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamInput_GetGlyphForActionOrigin_Legacy(CSteamAPIContext.GetSteamInput(), eOrigin));
}
/// <summary>
/// <para> Returns a localized string (from Steam's language setting) for the specified origin.</para>
/// </summary>
public static string GetStringForActionOrigin(EInputActionOrigin eOrigin) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamInput_GetStringForActionOrigin(CSteamAPIContext.GetSteamInput(), eOrigin));
}
/// <summary>
/// <para> Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle</para>
/// </summary>
public static string GetStringForAnalogActionName(InputAnalogActionHandle_t eActionHandle) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamInput_GetStringForAnalogActionName(CSteamAPIContext.GetSteamInput(), eActionHandle));
}
/// <summary>
/// <para> Stop analog momentum for the action if it is a mouse action in trackball mode</para>
/// </summary>
public static void StopAnalogActionMomentum(InputHandle_t inputHandle, InputAnalogActionHandle_t eAction) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_StopAnalogActionMomentum(CSteamAPIContext.GetSteamInput(), inputHandle, eAction);
}
/// <summary>
/// <para> Returns raw motion data from the specified device</para>
/// </summary>
public static InputMotionData_t GetMotionData(InputHandle_t inputHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetMotionData(CSteamAPIContext.GetSteamInput(), inputHandle);
}
/// <summary>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> OUTPUTS</para>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> Trigger a vibration event on supported controllers - Steam will translate these commands into haptic pulses for Steam Controllers</para>
/// </summary>
public static void TriggerVibration(InputHandle_t inputHandle, ushort usLeftSpeed, ushort usRightSpeed) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_TriggerVibration(CSteamAPIContext.GetSteamInput(), inputHandle, usLeftSpeed, usRightSpeed);
}
/// <summary>
/// <para> Trigger a vibration event on supported controllers including Xbox trigger impulse rumble - Steam will translate these commands into haptic pulses for Steam Controllers</para>
/// </summary>
public static void TriggerVibrationExtended(InputHandle_t inputHandle, ushort usLeftSpeed, ushort usRightSpeed, ushort usLeftTriggerSpeed, ushort usRightTriggerSpeed) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_TriggerVibrationExtended(CSteamAPIContext.GetSteamInput(), inputHandle, usLeftSpeed, usRightSpeed, usLeftTriggerSpeed, usRightTriggerSpeed);
}
/// <summary>
/// <para> Send a haptic pulse, works on Steam Deck and Steam Controller devices</para>
/// </summary>
public static void TriggerSimpleHapticEvent(InputHandle_t inputHandle, EControllerHapticLocation eHapticLocation, byte nIntensity, char nGainDB, byte nOtherIntensity, char nOtherGainDB) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_TriggerSimpleHapticEvent(CSteamAPIContext.GetSteamInput(), inputHandle, eHapticLocation, nIntensity, nGainDB, nOtherIntensity, nOtherGainDB);
}
/// <summary>
/// <para> Set the controller LED color on supported controllers. nFlags is a bitmask of values from ESteamInputLEDFlag - 0 will default to setting a color. Steam will handle</para>
/// <para> the behavior on exit of your program so you don't need to try restore the default as you are shutting down</para>
/// </summary>
public static void SetLEDColor(InputHandle_t inputHandle, byte nColorR, byte nColorG, byte nColorB, uint nFlags) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_SetLEDColor(CSteamAPIContext.GetSteamInput(), inputHandle, nColorR, nColorG, nColorB, nFlags);
}
/// <summary>
/// <para> Trigger a haptic pulse on a Steam Controller - if you are approximating rumble you may want to use TriggerVibration instead.</para>
/// <para> Good uses for Haptic pulses include chimes, noises, or directional gameplay feedback (taking damage, footstep locations, etc).</para>
/// </summary>
public static void Legacy_TriggerHapticPulse(InputHandle_t inputHandle, ESteamControllerPad eTargetPad, ushort usDurationMicroSec) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_Legacy_TriggerHapticPulse(CSteamAPIContext.GetSteamInput(), inputHandle, eTargetPad, usDurationMicroSec);
}
/// <summary>
/// <para> Trigger a haptic pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times. If you are approximating rumble you may want to use TriggerVibration instead.</para>
/// <para> nFlags is currently unused and reserved for future use.</para>
/// </summary>
public static void Legacy_TriggerRepeatedHapticPulse(InputHandle_t inputHandle, ESteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_Legacy_TriggerRepeatedHapticPulse(CSteamAPIContext.GetSteamInput(), inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags);
}
/// <summary>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> Utility functions available without using the rest of Steam Input API</para>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> Invokes the Steam overlay and brings up the binding screen if the user is using Big Picture Mode</para>
/// <para> If the user is not in Big Picture Mode it will open up the binding in a new window</para>
/// </summary>
public static bool ShowBindingPanel(InputHandle_t inputHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_ShowBindingPanel(CSteamAPIContext.GetSteamInput(), inputHandle);
}
/// <summary>
/// <para> Returns the input type for a particular handle - unlike EInputActionOrigin which update with Steam and may return unrecognized values</para>
/// <para> ESteamInputType will remain static and only return valid values from your SDK version</para>
/// </summary>
public static ESteamInputType GetInputTypeForHandle(InputHandle_t inputHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetInputTypeForHandle(CSteamAPIContext.GetSteamInput(), inputHandle);
}
/// <summary>
/// <para> Returns the associated controller handle for the specified emulated gamepad - can be used with the above 2 functions</para>
/// <para> to identify controllers presented to your game over Xinput. Returns 0 if the Xinput index isn't associated with Steam Input</para>
/// </summary>
public static InputHandle_t GetControllerForGamepadIndex(int nIndex) {
InteropHelp.TestIfAvailableClient();
return (InputHandle_t)NativeMethods.ISteamInput_GetControllerForGamepadIndex(CSteamAPIContext.GetSteamInput(), nIndex);
}
/// <summary>
/// <para> Returns the associated gamepad index for the specified controller, if emulating a gamepad or -1 if not associated with an Xinput index</para>
/// </summary>
public static int GetGamepadIndexForController(InputHandle_t ulinputHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetGamepadIndexForController(CSteamAPIContext.GetSteamInput(), ulinputHandle);
}
/// <summary>
/// <para> Returns a localized string (from Steam's language setting) for the specified Xbox controller origin.</para>
/// </summary>
public static string GetStringForXboxOrigin(EXboxOrigin eOrigin) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamInput_GetStringForXboxOrigin(CSteamAPIContext.GetSteamInput(), eOrigin));
}
/// <summary>
/// <para> Get a local path to art for on-screen glyph for a particular Xbox controller origin</para>
/// </summary>
public static string GetGlyphForXboxOrigin(EXboxOrigin eOrigin) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamInput_GetGlyphForXboxOrigin(CSteamAPIContext.GetSteamInput(), eOrigin));
}
/// <summary>
/// <para> Get the equivalent ActionOrigin for a given Xbox controller origin this can be chained with GetGlyphForActionOrigin to provide future proof glyphs for</para>
/// <para> non-Steam Input API action games. Note - this only translates the buttons directly and doesn't take into account any remapping a user has made in their configuration</para>
/// </summary>
public static EInputActionOrigin GetActionOriginFromXboxOrigin(InputHandle_t inputHandle, EXboxOrigin eOrigin) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetActionOriginFromXboxOrigin(CSteamAPIContext.GetSteamInput(), inputHandle, eOrigin);
}
/// <summary>
/// <para> Convert an origin to another controller type - for inputs not present on the other controller type this will return k_EInputActionOrigin_None</para>
/// <para> When a new input type is added you will be able to pass in k_ESteamInputType_Unknown and the closest origin that your version of the SDK recognized will be returned</para>
/// <para> ex: if a Playstation 5 controller was released this function would return Playstation 4 origins.</para>
/// </summary>
public static EInputActionOrigin TranslateActionOrigin(ESteamInputType eDestinationInputType, EInputActionOrigin eSourceOrigin) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_TranslateActionOrigin(CSteamAPIContext.GetSteamInput(), eDestinationInputType, eSourceOrigin);
}
/// <summary>
/// <para> Get the binding revision for a given device. Returns false if the handle was not valid or if a mapping is not yet loaded for the device</para>
/// </summary>
public static bool GetDeviceBindingRevision(InputHandle_t inputHandle, out int pMajor, out int pMinor) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetDeviceBindingRevision(CSteamAPIContext.GetSteamInput(), inputHandle, out pMajor, out pMinor);
}
/// <summary>
/// <para> Get the Steam Remote Play session ID associated with a device, or 0 if there is no session associated with it</para>
/// <para> See isteamremoteplay.h for more information on Steam Remote Play sessions</para>
/// </summary>
public static uint GetRemotePlaySessionID(InputHandle_t inputHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetRemotePlaySessionID(CSteamAPIContext.GetSteamInput(), inputHandle);
}
/// <summary>
/// <para> Get a bitmask of the Steam Input Configuration types opted in for the current session. Returns ESteamInputConfigurationEnableType values.</para>
/// <para> Note: user can override the settings from the Steamworks Partner site so the returned values may not exactly match your default configuration</para>
/// </summary>
public static ushort GetSessionInputConfigurationSettings() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInput_GetSessionInputConfigurationSettings(CSteamAPIContext.GetSteamInput());
}
/// <summary>
/// <para> Set the trigger effect for a DualSense controller</para>
/// </summary>
public static void SetDualSenseTriggerEffect(InputHandle_t inputHandle, IntPtr pParam) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInput_SetDualSenseTriggerEffect(CSteamAPIContext.GetSteamInput(), inputHandle, pParam);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41c08c9051a973f4ab4585374584267d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,478 @@
// 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 SteamInventory {
/// <summary>
/// <para> INVENTORY ASYNC RESULT MANAGEMENT</para>
/// <para> Asynchronous inventory queries always output a result handle which can be used with</para>
/// <para> GetResultStatus, GetResultItems, etc. A SteamInventoryResultReady_t callback will</para>
/// <para> be triggered when the asynchronous result becomes ready (or fails).</para>
/// <para> Find out the status of an asynchronous inventory result handle. Possible values:</para>
/// <para> k_EResultPending - still in progress</para>
/// <para> k_EResultOK - done, result ready</para>
/// <para> k_EResultExpired - done, result ready, maybe out of date (see DeserializeResult)</para>
/// <para> k_EResultInvalidParam - ERROR: invalid API call parameters</para>
/// <para> k_EResultServiceUnavailable - ERROR: service temporarily down, you may retry later</para>
/// <para> k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits</para>
/// <para> k_EResultFail - ERROR: unknown / generic error</para>
/// </summary>
public static EResult GetResultStatus(SteamInventoryResult_t resultHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_GetResultStatus(CSteamAPIContext.GetSteamInventory(), resultHandle);
}
/// <summary>
/// <para> Copies the contents of a result set into a flat array. The specific</para>
/// <para> contents of the result set depend on which query which was used.</para>
/// </summary>
public static bool GetResultItems(SteamInventoryResult_t resultHandle, SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize) {
InteropHelp.TestIfAvailableClient();
if (pOutItemsArray != null && pOutItemsArray.Length != punOutItemsArraySize) {
throw new System.ArgumentException("pOutItemsArray must be the same size as punOutItemsArraySize!");
}
return NativeMethods.ISteamInventory_GetResultItems(CSteamAPIContext.GetSteamInventory(), resultHandle, pOutItemsArray, ref punOutItemsArraySize);
}
/// <summary>
/// <para> In combination with GetResultItems, you can use GetResultItemProperty to retrieve</para>
/// <para> dynamic string properties for a given item returned in the result set.</para>
/// <para> Property names are always composed of ASCII letters, numbers, and/or underscores.</para>
/// <para> Pass a NULL pointer for pchPropertyName to get a comma - separated list of available</para>
/// <para> property names.</para>
/// <para> If pchValueBuffer is NULL, *punValueBufferSize will contain the</para>
/// <para> suggested buffer size. Otherwise it will be the number of bytes actually copied</para>
/// <para> to pchValueBuffer. If the results do not fit in the given buffer, partial</para>
/// <para> results may be copied.</para>
/// </summary>
public static bool GetResultItemProperty(SteamInventoryResult_t resultHandle, uint unItemIndex, string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut) {
InteropHelp.TestIfAvailableClient();
IntPtr pchValueBuffer2 = Marshal.AllocHGlobal((int)punValueBufferSizeOut);
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
bool ret = NativeMethods.ISteamInventory_GetResultItemProperty(CSteamAPIContext.GetSteamInventory(), resultHandle, unItemIndex, pchPropertyName2, pchValueBuffer2, ref punValueBufferSizeOut);
pchValueBuffer = ret ? InteropHelp.PtrToStringUTF8(pchValueBuffer2) : null;
Marshal.FreeHGlobal(pchValueBuffer2);
return ret;
}
}
/// <summary>
/// <para> Returns the server time at which the result was generated. Compare against</para>
/// <para> the value of IClientUtils::GetServerRealTime() to determine age.</para>
/// </summary>
public static uint GetResultTimestamp(SteamInventoryResult_t resultHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_GetResultTimestamp(CSteamAPIContext.GetSteamInventory(), resultHandle);
}
/// <summary>
/// <para> Returns true if the result belongs to the target steam ID, false if the</para>
/// <para> result does not. This is important when using DeserializeResult, to verify</para>
/// <para> that a remote player is not pretending to have a different user's inventory.</para>
/// </summary>
public static bool CheckResultSteamID(SteamInventoryResult_t resultHandle, CSteamID steamIDExpected) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_CheckResultSteamID(CSteamAPIContext.GetSteamInventory(), resultHandle, steamIDExpected);
}
/// <summary>
/// <para> Destroys a result handle and frees all associated memory.</para>
/// </summary>
public static void DestroyResult(SteamInventoryResult_t resultHandle) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInventory_DestroyResult(CSteamAPIContext.GetSteamInventory(), resultHandle);
}
/// <summary>
/// <para> INVENTORY ASYNC QUERY</para>
/// <para> Captures the entire state of the current user's Steam inventory.</para>
/// <para> You must call DestroyResult on this handle when you are done with it.</para>
/// <para> Returns false and sets *pResultHandle to zero if inventory is unavailable.</para>
/// <para> Note: calls to this function are subject to rate limits and may return</para>
/// <para> cached results if called too frequently. It is suggested that you call</para>
/// <para> this function only when you are about to display the user's full inventory,</para>
/// <para> or if you expect that the inventory may have changed.</para>
/// </summary>
public static bool GetAllItems(out SteamInventoryResult_t pResultHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_GetAllItems(CSteamAPIContext.GetSteamInventory(), out pResultHandle);
}
/// <summary>
/// <para> Captures the state of a subset of the current user's Steam inventory,</para>
/// <para> identified by an array of item instance IDs. The results from this call</para>
/// <para> can be serialized and passed to other players to "prove" that the current</para>
/// <para> user owns specific items, without exposing the user's entire inventory.</para>
/// <para> For example, you could call GetItemsByID with the IDs of the user's</para>
/// <para> currently equipped cosmetic items and serialize this to a buffer, and</para>
/// <para> then transmit this buffer to other players upon joining a game.</para>
/// </summary>
public static bool GetItemsByID(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t[] pInstanceIDs, uint unCountInstanceIDs) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_GetItemsByID(CSteamAPIContext.GetSteamInventory(), out pResultHandle, pInstanceIDs, unCountInstanceIDs);
}
/// <summary>
/// <para> RESULT SERIALIZATION AND AUTHENTICATION</para>
/// <para> Serialized result sets contain a short signature which can't be forged</para>
/// <para> or replayed across different game sessions. A result set can be serialized</para>
/// <para> on the local client, transmitted to other players via your game networking,</para>
/// <para> and deserialized by the remote players. This is a secure way of preventing</para>
/// <para> hackers from lying about posessing rare/high-value items.</para>
/// <para> Serializes a result set with signature bytes to an output buffer. Pass</para>
/// <para> NULL as an output buffer to get the required size via punOutBufferSize.</para>
/// <para> The size of a serialized result depends on the number items which are being</para>
/// <para> serialized. When securely transmitting items to other players, it is</para>
/// <para> recommended to use "GetItemsByID" first to create a minimal result set.</para>
/// <para> Results have a built-in timestamp which will be considered "expired" after</para>
/// <para> an hour has elapsed. See DeserializeResult for expiration handling.</para>
/// </summary>
public static bool SerializeResult(SteamInventoryResult_t resultHandle, byte[] pOutBuffer, out uint punOutBufferSize) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_SerializeResult(CSteamAPIContext.GetSteamInventory(), resultHandle, pOutBuffer, out punOutBufferSize);
}
/// <summary>
/// <para> Deserializes a result set and verifies the signature bytes. Returns false</para>
/// <para> if bRequireFullOnlineVerify is set but Steam is running in Offline mode.</para>
/// <para> Otherwise returns true and then delivers error codes via GetResultStatus.</para>
/// <para> The bRESERVED_MUST_BE_FALSE flag is reserved for future use and should not</para>
/// <para> be set to true by your game at this time.</para>
/// <para> DeserializeResult has a potential soft-failure mode where the handle status</para>
/// <para> is set to k_EResultExpired. GetResultItems() still succeeds in this mode.</para>
/// <para> The "expired" result could indicate that the data may be out of date - not</para>
/// <para> just due to timed expiration (one hour), but also because one of the items</para>
/// <para> in the result set may have been traded or consumed since the result set was</para>
/// <para> generated. You could compare the timestamp from GetResultTimestamp() to</para>
/// <para> ISteamUtils::GetServerRealTime() to determine how old the data is. You could</para>
/// <para> simply ignore the "expired" result code and continue as normal, or you</para>
/// <para> could challenge the player with expired data to send an updated result set.</para>
/// </summary>
public static bool DeserializeResult(out SteamInventoryResult_t pOutResultHandle, byte[] pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE = false) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_DeserializeResult(CSteamAPIContext.GetSteamInventory(), out pOutResultHandle, pBuffer, unBufferSize, bRESERVED_MUST_BE_FALSE);
}
/// <summary>
/// <para> INVENTORY ASYNC MODIFICATION</para>
/// <para> GenerateItems() creates one or more items and then generates a SteamInventoryCallback_t</para>
/// <para> notification with a matching nCallbackContext parameter. This API is only intended</para>
/// <para> for prototyping - it is only usable by Steam accounts that belong to the publisher group</para>
/// <para> for your game.</para>
/// <para> If punArrayQuantity is not NULL, it should be the same length as pArrayItems and should</para>
/// <para> describe the quantity of each item to generate.</para>
/// </summary>
public static bool GenerateItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayItemDefs, uint[] punArrayQuantity, uint unArrayLength) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_GenerateItems(CSteamAPIContext.GetSteamInventory(), out pResultHandle, pArrayItemDefs, punArrayQuantity, unArrayLength);
}
/// <summary>
/// <para> GrantPromoItems() checks the list of promotional items for which the user may be eligible</para>
/// <para> and grants the items (one time only). On success, the result set will include items which</para>
/// <para> were granted, if any. If no items were granted because the user isn't eligible for any</para>
/// <para> promotions, this is still considered a success.</para>
/// </summary>
public static bool GrantPromoItems(out SteamInventoryResult_t pResultHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_GrantPromoItems(CSteamAPIContext.GetSteamInventory(), out pResultHandle);
}
/// <summary>
/// <para> AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of</para>
/// <para> scanning for all eligible promotional items, the check is restricted to a single item</para>
/// <para> definition or set of item definitions. This can be useful if your game has custom UI for</para>
/// <para> showing a specific promo item to the user.</para>
/// </summary>
public static bool AddPromoItem(out SteamInventoryResult_t pResultHandle, SteamItemDef_t itemDef) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_AddPromoItem(CSteamAPIContext.GetSteamInventory(), out pResultHandle, itemDef);
}
public static bool AddPromoItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayItemDefs, uint unArrayLength) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_AddPromoItems(CSteamAPIContext.GetSteamInventory(), out pResultHandle, pArrayItemDefs, unArrayLength);
}
/// <summary>
/// <para> ConsumeItem() removes items from the inventory, permanently. They cannot be recovered.</para>
/// <para> Not for the faint of heart - if your game implements item removal at all, a high-friction</para>
/// <para> UI confirmation process is highly recommended.</para>
/// </summary>
public static bool ConsumeItem(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemConsume, uint unQuantity) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_ConsumeItem(CSteamAPIContext.GetSteamInventory(), out pResultHandle, itemConsume, unQuantity);
}
/// <summary>
/// <para> ExchangeItems() is an atomic combination of item generation and consumption.</para>
/// <para> It can be used to implement crafting recipes or transmutations, or items which unpack</para>
/// <para> themselves into other items (e.g., a chest).</para>
/// <para> Exchange recipes are defined in the ItemDef, and explicitly list the required item</para>
/// <para> types and resulting generated type.</para>
/// <para> Exchange recipes are evaluated atomically by the Inventory Service; if the supplied</para>
/// <para> components do not match the recipe, or do not contain sufficient quantity, the</para>
/// <para> exchange will fail.</para>
/// </summary>
public static bool ExchangeItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayGenerate, uint[] punArrayGenerateQuantity, uint unArrayGenerateLength, SteamItemInstanceID_t[] pArrayDestroy, uint[] punArrayDestroyQuantity, uint unArrayDestroyLength) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_ExchangeItems(CSteamAPIContext.GetSteamInventory(), out pResultHandle, pArrayGenerate, punArrayGenerateQuantity, unArrayGenerateLength, pArrayDestroy, punArrayDestroyQuantity, unArrayDestroyLength);
}
/// <summary>
/// <para> TransferItemQuantity() is intended for use with items which are "stackable" (can have</para>
/// <para> quantity greater than one). It can be used to split a stack into two, or to transfer</para>
/// <para> quantity from one stack into another stack of identical items. To split one stack into</para>
/// <para> two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.</para>
/// </summary>
public static bool TransferItemQuantity(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemIdSource, uint unQuantity, SteamItemInstanceID_t itemIdDest) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_TransferItemQuantity(CSteamAPIContext.GetSteamInventory(), out pResultHandle, itemIdSource, unQuantity, itemIdDest);
}
/// <summary>
/// <para> TIMED DROPS AND PLAYTIME CREDIT</para>
/// <para> Deprecated. Calling this method is not required for proper playtime accounting.</para>
/// </summary>
public static void SendItemDropHeartbeat() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamInventory_SendItemDropHeartbeat(CSteamAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> Playtime credit must be consumed and turned into item drops by your game. Only item</para>
/// <para> definitions which are marked as "playtime item generators" can be spawned. The call</para>
/// <para> will return an empty result set if there is not enough playtime credit for a drop.</para>
/// <para> Your game should call TriggerItemDrop at an appropriate time for the user to receive</para>
/// <para> new items, such as between rounds or while the player is dead. Note that players who</para>
/// <para> hack their clients could modify the value of "dropListDefinition", so do not use it</para>
/// <para> to directly control rarity.</para>
/// <para> See your Steamworks configuration to set playtime drop rates for individual itemdefs.</para>
/// <para> The client library will suppress too-frequent calls to this method.</para>
/// </summary>
public static bool TriggerItemDrop(out SteamInventoryResult_t pResultHandle, SteamItemDef_t dropListDefinition) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_TriggerItemDrop(CSteamAPIContext.GetSteamInventory(), out pResultHandle, dropListDefinition);
}
/// <summary>
/// <para> Deprecated. This method is not supported.</para>
/// </summary>
public static bool TradeItems(out SteamInventoryResult_t pResultHandle, CSteamID steamIDTradePartner, SteamItemInstanceID_t[] pArrayGive, uint[] pArrayGiveQuantity, uint nArrayGiveLength, SteamItemInstanceID_t[] pArrayGet, uint[] pArrayGetQuantity, uint nArrayGetLength) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_TradeItems(CSteamAPIContext.GetSteamInventory(), out pResultHandle, steamIDTradePartner, pArrayGive, pArrayGiveQuantity, nArrayGiveLength, pArrayGet, pArrayGetQuantity, nArrayGetLength);
}
/// <summary>
/// <para> ITEM DEFINITIONS</para>
/// <para> Item definitions are a mapping of "definition IDs" (integers between 1 and 1000000)</para>
/// <para> to a set of string properties. Some of these properties are required to display items</para>
/// <para> on the Steam community web site. Other properties can be defined by applications.</para>
/// <para> Use of these functions is optional; there is no reason to call LoadItemDefinitions</para>
/// <para> if your game hardcodes the numeric definition IDs (eg, purple face mask = 20, blue</para>
/// <para> weapon mod = 55) and does not allow for adding new item types without a client patch.</para>
/// <para> LoadItemDefinitions triggers the automatic load and refresh of item definitions.</para>
/// <para> Every time new item definitions are available (eg, from the dynamic addition of new</para>
/// <para> item types while players are still in-game), a SteamInventoryDefinitionUpdate_t</para>
/// <para> callback will be fired.</para>
/// </summary>
public static bool LoadItemDefinitions() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_LoadItemDefinitions(CSteamAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> GetItemDefinitionIDs returns the set of all defined item definition IDs (which are</para>
/// <para> defined via Steamworks configuration, and not necessarily contiguous integers).</para>
/// <para> If pItemDefIDs is null, the call will return true and *punItemDefIDsArraySize will</para>
/// <para> contain the total size necessary for a subsequent call. Otherwise, the call will</para>
/// <para> return false if and only if there is not enough space in the output array.</para>
/// </summary>
public static bool GetItemDefinitionIDs(SteamItemDef_t[] pItemDefIDs, ref uint punItemDefIDsArraySize) {
InteropHelp.TestIfAvailableClient();
if (pItemDefIDs != null && pItemDefIDs.Length != punItemDefIDsArraySize) {
throw new System.ArgumentException("pItemDefIDs must be the same size as punItemDefIDsArraySize!");
}
return NativeMethods.ISteamInventory_GetItemDefinitionIDs(CSteamAPIContext.GetSteamInventory(), pItemDefIDs, ref punItemDefIDsArraySize);
}
/// <summary>
/// <para> GetItemDefinitionProperty returns a string property from a given item definition.</para>
/// <para> Note that some properties (for example, "name") may be localized and will depend</para>
/// <para> on the current Steam language settings (see ISteamApps::GetCurrentGameLanguage).</para>
/// <para> Property names are always composed of ASCII letters, numbers, and/or underscores.</para>
/// <para> Pass a NULL pointer for pchPropertyName to get a comma - separated list of available</para>
/// <para> property names. If pchValueBuffer is NULL, *punValueBufferSize will contain the</para>
/// <para> suggested buffer size. Otherwise it will be the number of bytes actually copied</para>
/// <para> to pchValueBuffer. If the results do not fit in the given buffer, partial</para>
/// <para> results may be copied.</para>
/// </summary>
public static bool GetItemDefinitionProperty(SteamItemDef_t iDefinition, string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut) {
InteropHelp.TestIfAvailableClient();
IntPtr pchValueBuffer2 = Marshal.AllocHGlobal((int)punValueBufferSizeOut);
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
bool ret = NativeMethods.ISteamInventory_GetItemDefinitionProperty(CSteamAPIContext.GetSteamInventory(), iDefinition, pchPropertyName2, pchValueBuffer2, ref punValueBufferSizeOut);
pchValueBuffer = ret ? InteropHelp.PtrToStringUTF8(pchValueBuffer2) : null;
Marshal.FreeHGlobal(pchValueBuffer2);
return ret;
}
}
/// <summary>
/// <para> Request the list of "eligible" promo items that can be manually granted to the given</para>
/// <para> user. These are promo items of type "manual" that won't be granted automatically.</para>
/// <para> An example usage of this is an item that becomes available every week.</para>
/// </summary>
public static SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs(CSteamID steamID) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamInventory_RequestEligiblePromoItemDefinitionsIDs(CSteamAPIContext.GetSteamInventory(), steamID);
}
/// <summary>
/// <para> After handling a SteamInventoryEligiblePromoItemDefIDs_t call result, use this</para>
/// <para> function to pull out the list of item definition ids that the user can be</para>
/// <para> manually granted via the AddPromoItems() call.</para>
/// </summary>
public static bool GetEligiblePromoItemDefinitionIDs(CSteamID steamID, SteamItemDef_t[] pItemDefIDs, ref uint punItemDefIDsArraySize) {
InteropHelp.TestIfAvailableClient();
if (pItemDefIDs != null && pItemDefIDs.Length != punItemDefIDsArraySize) {
throw new System.ArgumentException("pItemDefIDs must be the same size as punItemDefIDsArraySize!");
}
return NativeMethods.ISteamInventory_GetEligiblePromoItemDefinitionIDs(CSteamAPIContext.GetSteamInventory(), steamID, pItemDefIDs, ref punItemDefIDsArraySize);
}
/// <summary>
/// <para> Starts the purchase process for the given item definitions. The callback SteamInventoryStartPurchaseResult_t</para>
/// <para> will be posted if Steam was able to initialize the transaction.</para>
/// <para> Once the purchase has been authorized and completed by the user, the callback SteamInventoryResultReady_t</para>
/// <para> will be posted.</para>
/// </summary>
public static SteamAPICall_t StartPurchase(SteamItemDef_t[] pArrayItemDefs, uint[] punArrayQuantity, uint unArrayLength) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamInventory_StartPurchase(CSteamAPIContext.GetSteamInventory(), pArrayItemDefs, punArrayQuantity, unArrayLength);
}
/// <summary>
/// <para> Request current prices for all applicable item definitions</para>
/// </summary>
public static SteamAPICall_t RequestPrices() {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamInventory_RequestPrices(CSteamAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> Returns the number of items with prices. Need to call RequestPrices() first.</para>
/// </summary>
public static uint GetNumItemsWithPrices() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_GetNumItemsWithPrices(CSteamAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> Returns item definition ids and their prices in the user's local currency.</para>
/// <para> Need to call RequestPrices() first.</para>
/// </summary>
public static bool GetItemsWithPrices(SteamItemDef_t[] pArrayItemDefs, ulong[] pCurrentPrices, ulong[] pBasePrices, uint unArrayLength) {
InteropHelp.TestIfAvailableClient();
if (pArrayItemDefs != null && pArrayItemDefs.Length != unArrayLength) {
throw new System.ArgumentException("pArrayItemDefs must be the same size as unArrayLength!");
}
if (pCurrentPrices != null && pCurrentPrices.Length != unArrayLength) {
throw new System.ArgumentException("pCurrentPrices must be the same size as unArrayLength!");
}
if (pBasePrices != null && pBasePrices.Length != unArrayLength) {
throw new System.ArgumentException("pBasePrices must be the same size as unArrayLength!");
}
return NativeMethods.ISteamInventory_GetItemsWithPrices(CSteamAPIContext.GetSteamInventory(), pArrayItemDefs, pCurrentPrices, pBasePrices, unArrayLength);
}
/// <summary>
/// <para> Retrieves the price for the item definition id</para>
/// <para> Returns false if there is no price stored for the item definition.</para>
/// </summary>
public static bool GetItemPrice(SteamItemDef_t iDefinition, out ulong pCurrentPrice, out ulong pBasePrice) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_GetItemPrice(CSteamAPIContext.GetSteamInventory(), iDefinition, out pCurrentPrice, out pBasePrice);
}
/// <summary>
/// <para> Create a request to update properties on items</para>
/// </summary>
public static SteamInventoryUpdateHandle_t StartUpdateProperties() {
InteropHelp.TestIfAvailableClient();
return (SteamInventoryUpdateHandle_t)NativeMethods.ISteamInventory_StartUpdateProperties(CSteamAPIContext.GetSteamInventory());
}
/// <summary>
/// <para> Remove the property on the item</para>
/// </summary>
public static bool RemoveProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName) {
InteropHelp.TestIfAvailableClient();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
return NativeMethods.ISteamInventory_RemoveProperty(CSteamAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2);
}
}
/// <summary>
/// <para> Accessor methods to set properties on items</para>
/// </summary>
public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, string pchPropertyValue) {
InteropHelp.TestIfAvailableClient();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName))
using (var pchPropertyValue2 = new InteropHelp.UTF8StringHandle(pchPropertyValue)) {
return NativeMethods.ISteamInventory_SetPropertyString(CSteamAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, pchPropertyValue2);
}
}
public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, bool bValue) {
InteropHelp.TestIfAvailableClient();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
return NativeMethods.ISteamInventory_SetPropertyBool(CSteamAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, bValue);
}
}
public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, long nValue) {
InteropHelp.TestIfAvailableClient();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
return NativeMethods.ISteamInventory_SetPropertyInt64(CSteamAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, nValue);
}
}
public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, float flValue) {
InteropHelp.TestIfAvailableClient();
using (var pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName)) {
return NativeMethods.ISteamInventory_SetPropertyFloat(CSteamAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, flValue);
}
}
/// <summary>
/// <para> Submit the update request by handle</para>
/// </summary>
public static bool SubmitUpdateProperties(SteamInventoryUpdateHandle_t handle, out SteamInventoryResult_t pResultHandle) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamInventory_SubmitUpdateProperties(CSteamAPIContext.GetSteamInventory(), handle, out pResultHandle);
}
public static bool InspectItem(out SteamInventoryResult_t pResultHandle, string pchItemToken) {
InteropHelp.TestIfAvailableClient();
using (var pchItemToken2 = new InteropHelp.UTF8StringHandle(pchItemToken)) {
return NativeMethods.ISteamInventory_InspectItem(CSteamAPIContext.GetSteamInventory(), out pResultHandle, pchItemToken2);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b3cb110b82106574b8dca4e5a56bbb3e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,892 @@
// 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 SteamMatchmaking {
/// <summary>
/// <para> game server favorites storage</para>
/// <para> saves basic details about a multiplayer game server locally</para>
/// <para> returns the number of favorites servers the user has stored</para>
/// </summary>
public static int GetFavoriteGameCount() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_GetFavoriteGameCount(CSteamAPIContext.GetSteamMatchmaking());
}
/// <summary>
/// <para> returns the details of the game server</para>
/// <para> iGame is of range [0,GetFavoriteGameCount())</para>
/// <para> *pnIP, *pnConnPort are filled in the with IP:port of the game server</para>
/// <para> *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections</para>
/// <para> *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added</para>
/// </summary>
public static bool GetFavoriteGame(int iGame, out AppId_t pnAppID, out uint pnIP, out ushort pnConnPort, out ushort pnQueryPort, out uint punFlags, out uint pRTime32LastPlayedOnServer) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_GetFavoriteGame(CSteamAPIContext.GetSteamMatchmaking(), iGame, out pnAppID, out pnIP, out pnConnPort, out pnQueryPort, out punFlags, out pRTime32LastPlayedOnServer);
}
/// <summary>
/// <para> adds the game server to the local list; updates the time played of the server if it already exists in the list</para>
/// </summary>
public static int AddFavoriteGame(AppId_t nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags, uint rTime32LastPlayedOnServer) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_AddFavoriteGame(CSteamAPIContext.GetSteamMatchmaking(), nAppID, nIP, nConnPort, nQueryPort, unFlags, rTime32LastPlayedOnServer);
}
/// <summary>
/// <para> removes the game server from the local storage; returns true if one was removed</para>
/// </summary>
public static bool RemoveFavoriteGame(AppId_t nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_RemoveFavoriteGame(CSteamAPIContext.GetSteamMatchmaking(), nAppID, nIP, nConnPort, nQueryPort, unFlags);
}
/// <summary>
/// <para>/////</para>
/// <para> Game lobby functions</para>
/// <para> Get a list of relevant lobbies</para>
/// <para> this is an asynchronous request</para>
/// <para> results will be returned by LobbyMatchList_t callback &amp; call result, with the number of lobbies found</para>
/// <para> this will never return lobbies that are full</para>
/// <para> to add more filter, the filter calls below need to be call before each and every RequestLobbyList() call</para>
/// <para> use the CCallResult&lt;&gt; object in steam_api.h to match the SteamAPICall_t call result to a function in an object, e.g.</para>
/// <para> class CMyLobbyListManager</para>
/// <para> {</para>
/// <para> CCallResult&lt;CMyLobbyListManager, LobbyMatchList_t&gt; m_CallResultLobbyMatchList;</para>
/// <para> void FindLobbies()</para>
/// <para> {</para>
/// <para> // SteamMatchmaking()-&gt;AddRequestLobbyListFilter*() functions would be called here, before RequestLobbyList()</para>
/// <para> SteamAPICall_t hSteamAPICall = SteamMatchmaking()-&gt;RequestLobbyList();</para>
/// <para> m_CallResultLobbyMatchList.Set( hSteamAPICall, this, &amp;CMyLobbyListManager::OnLobbyMatchList );</para>
/// <para> }</para>
/// <para> void OnLobbyMatchList( LobbyMatchList_t *pLobbyMatchList, bool bIOFailure )</para>
/// <para> {</para>
/// <para> // lobby list has be retrieved from Steam back-end, use results</para>
/// <para> }</para>
/// <para> }</para>
/// </summary>
public static SteamAPICall_t RequestLobbyList() {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamMatchmaking_RequestLobbyList(CSteamAPIContext.GetSteamMatchmaking());
}
/// <summary>
/// <para> filters for lobbies</para>
/// <para> this needs to be called before RequestLobbyList() to take effect</para>
/// <para> these are cleared on each call to RequestLobbyList()</para>
/// </summary>
public static void AddRequestLobbyListStringFilter(string pchKeyToMatch, string pchValueToMatch, ELobbyComparison eComparisonType) {
InteropHelp.TestIfAvailableClient();
using (var pchKeyToMatch2 = new InteropHelp.UTF8StringHandle(pchKeyToMatch))
using (var pchValueToMatch2 = new InteropHelp.UTF8StringHandle(pchValueToMatch)) {
NativeMethods.ISteamMatchmaking_AddRequestLobbyListStringFilter(CSteamAPIContext.GetSteamMatchmaking(), pchKeyToMatch2, pchValueToMatch2, eComparisonType);
}
}
/// <summary>
/// <para> numerical comparison</para>
/// </summary>
public static void AddRequestLobbyListNumericalFilter(string pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType) {
InteropHelp.TestIfAvailableClient();
using (var pchKeyToMatch2 = new InteropHelp.UTF8StringHandle(pchKeyToMatch)) {
NativeMethods.ISteamMatchmaking_AddRequestLobbyListNumericalFilter(CSteamAPIContext.GetSteamMatchmaking(), pchKeyToMatch2, nValueToMatch, eComparisonType);
}
}
/// <summary>
/// <para> returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence</para>
/// </summary>
public static void AddRequestLobbyListNearValueFilter(string pchKeyToMatch, int nValueToBeCloseTo) {
InteropHelp.TestIfAvailableClient();
using (var pchKeyToMatch2 = new InteropHelp.UTF8StringHandle(pchKeyToMatch)) {
NativeMethods.ISteamMatchmaking_AddRequestLobbyListNearValueFilter(CSteamAPIContext.GetSteamMatchmaking(), pchKeyToMatch2, nValueToBeCloseTo);
}
}
/// <summary>
/// <para> returns only lobbies with the specified number of slots available</para>
/// </summary>
public static void AddRequestLobbyListFilterSlotsAvailable(int nSlotsAvailable) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable(CSteamAPIContext.GetSteamMatchmaking(), nSlotsAvailable);
}
/// <summary>
/// <para> sets the distance for which we should search for lobbies (based on users IP address to location map on the Steam backed)</para>
/// </summary>
public static void AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter eLobbyDistanceFilter) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmaking_AddRequestLobbyListDistanceFilter(CSteamAPIContext.GetSteamMatchmaking(), eLobbyDistanceFilter);
}
/// <summary>
/// <para> sets how many results to return, the lower the count the faster it is to download the lobby results &amp; details to the client</para>
/// </summary>
public static void AddRequestLobbyListResultCountFilter(int cMaxResults) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmaking_AddRequestLobbyListResultCountFilter(CSteamAPIContext.GetSteamMatchmaking(), cMaxResults);
}
public static void AddRequestLobbyListCompatibleMembersFilter(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby);
}
/// <summary>
/// <para> returns the CSteamID of a lobby, as retrieved by a RequestLobbyList call</para>
/// <para> should only be called after a LobbyMatchList_t callback is received</para>
/// <para> iLobby is of the range [0, LobbyMatchList_t::m_nLobbiesMatching)</para>
/// <para> the returned CSteamID::IsValid() will be false if iLobby is out of range</para>
/// </summary>
public static CSteamID GetLobbyByIndex(int iLobby) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamMatchmaking_GetLobbyByIndex(CSteamAPIContext.GetSteamMatchmaking(), iLobby);
}
/// <summary>
/// <para> Create a lobby on the Steam servers.</para>
/// <para> If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID</para>
/// <para> of the lobby will need to be communicated via game channels or via InviteUserToLobby()</para>
/// <para> this is an asynchronous request</para>
/// <para> results will be returned by LobbyCreated_t callback and call result; lobby is joined &amp; ready to use at this point</para>
/// <para> a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)</para>
/// </summary>
public static SteamAPICall_t CreateLobby(ELobbyType eLobbyType, int cMaxMembers) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamMatchmaking_CreateLobby(CSteamAPIContext.GetSteamMatchmaking(), eLobbyType, cMaxMembers);
}
/// <summary>
/// <para> Joins an existing lobby</para>
/// <para> this is an asynchronous request</para>
/// <para> results will be returned by LobbyEnter_t callback &amp; call result, check m_EChatRoomEnterResponse to see if was successful</para>
/// <para> lobby metadata is available to use immediately on this call completing</para>
/// </summary>
public static SteamAPICall_t JoinLobby(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamMatchmaking_JoinLobby(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby);
}
/// <summary>
/// <para> Leave a lobby; this will take effect immediately on the client side</para>
/// <para> other users in the lobby will be notified by a LobbyChatUpdate_t callback</para>
/// </summary>
public static void LeaveLobby(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmaking_LeaveLobby(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby);
}
/// <summary>
/// <para> Invite another user to the lobby</para>
/// <para> the target user will receive a LobbyInvite_t callback</para>
/// <para> will return true if the invite is successfully sent, whether or not the target responds</para>
/// <para> returns false if the local user is not connected to the Steam servers</para>
/// <para> if the other user clicks the join link, a GameLobbyJoinRequested_t will be posted if the user is in-game,</para>
/// <para> or if the game isn't running yet the game will be launched with the parameter +connect_lobby &lt;64-bit lobby id&gt;</para>
/// </summary>
public static bool InviteUserToLobby(CSteamID steamIDLobby, CSteamID steamIDInvitee) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_InviteUserToLobby(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, steamIDInvitee);
}
/// <summary>
/// <para> Lobby iteration, for viewing details of users in a lobby</para>
/// <para> only accessible if the lobby user is a member of the specified lobby</para>
/// <para> persona information for other lobby members (name, avatar, etc.) will be asynchronously received</para>
/// <para> and accessible via ISteamFriends interface</para>
/// <para> returns the number of users in the specified lobby</para>
/// </summary>
public static int GetNumLobbyMembers(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_GetNumLobbyMembers(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby);
}
/// <summary>
/// <para> returns the CSteamID of a user in the lobby</para>
/// <para> iMember is of range [0,GetNumLobbyMembers())</para>
/// <para> note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby</para>
/// </summary>
public static CSteamID GetLobbyMemberByIndex(CSteamID steamIDLobby, int iMember) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamMatchmaking_GetLobbyMemberByIndex(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, iMember);
}
/// <summary>
/// <para> Get data associated with this lobby</para>
/// <para> takes a simple key, and returns the string associated with it</para>
/// <para> "" will be returned if no value is set, or if steamIDLobby is invalid</para>
/// </summary>
public static string GetLobbyData(CSteamID steamIDLobby, string pchKey) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) {
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamMatchmaking_GetLobbyData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, pchKey2));
}
}
/// <summary>
/// <para> Sets a key/value pair in the lobby metadata</para>
/// <para> each user in the lobby will be broadcast this new value, and any new users joining will receive any existing data</para>
/// <para> this can be used to set lobby names, map, etc.</para>
/// <para> to reset a key, just set it to ""</para>
/// <para> other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback</para>
/// </summary>
public static bool SetLobbyData(CSteamID steamIDLobby, string pchKey, string pchValue) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey))
using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue)) {
return NativeMethods.ISteamMatchmaking_SetLobbyData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, pchKey2, pchValue2);
}
}
/// <summary>
/// <para> returns the number of metadata keys set on the specified lobby</para>
/// </summary>
public static int GetLobbyDataCount(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_GetLobbyDataCount(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby);
}
/// <summary>
/// <para> returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount())</para>
/// </summary>
public static bool GetLobbyDataByIndex(CSteamID steamIDLobby, int iLobbyData, out string pchKey, int cchKeyBufferSize, out string pchValue, int cchValueBufferSize) {
InteropHelp.TestIfAvailableClient();
IntPtr pchKey2 = Marshal.AllocHGlobal(cchKeyBufferSize);
IntPtr pchValue2 = Marshal.AllocHGlobal(cchValueBufferSize);
bool ret = NativeMethods.ISteamMatchmaking_GetLobbyDataByIndex(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, iLobbyData, pchKey2, cchKeyBufferSize, pchValue2, cchValueBufferSize);
pchKey = ret ? InteropHelp.PtrToStringUTF8(pchKey2) : null;
Marshal.FreeHGlobal(pchKey2);
pchValue = ret ? InteropHelp.PtrToStringUTF8(pchValue2) : null;
Marshal.FreeHGlobal(pchValue2);
return ret;
}
/// <summary>
/// <para> removes a metadata key from the lobby</para>
/// </summary>
public static bool DeleteLobbyData(CSteamID steamIDLobby, string pchKey) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) {
return NativeMethods.ISteamMatchmaking_DeleteLobbyData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, pchKey2);
}
}
/// <summary>
/// <para> Gets per-user metadata for someone in this lobby</para>
/// </summary>
public static string GetLobbyMemberData(CSteamID steamIDLobby, CSteamID steamIDUser, string pchKey) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) {
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamMatchmaking_GetLobbyMemberData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, steamIDUser, pchKey2));
}
}
/// <summary>
/// <para> Sets per-user metadata (for the local user implicitly)</para>
/// </summary>
public static void SetLobbyMemberData(CSteamID steamIDLobby, string pchKey, string pchValue) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey))
using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue)) {
NativeMethods.ISteamMatchmaking_SetLobbyMemberData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, pchKey2, pchValue2);
}
}
/// <summary>
/// <para> Broadcasts a chat message to the all the users in the lobby</para>
/// <para> users in the lobby (including the local user) will receive a LobbyChatMsg_t callback</para>
/// <para> returns true if the message is successfully sent</para>
/// <para> pvMsgBody can be binary or text data, up to 4k</para>
/// <para> if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator</para>
/// </summary>
public static bool SendLobbyChatMsg(CSteamID steamIDLobby, byte[] pvMsgBody, int cubMsgBody) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_SendLobbyChatMsg(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, pvMsgBody, cubMsgBody);
}
/// <summary>
/// <para> Get a chat message as specified in a LobbyChatMsg_t callback</para>
/// <para> iChatID is the LobbyChatMsg_t::m_iChatID value in the callback</para>
/// <para> *pSteamIDUser is filled in with the CSteamID of the member</para>
/// <para> *pvData is filled in with the message itself</para>
/// <para> return value is the number of bytes written into the buffer</para>
/// </summary>
public static int GetLobbyChatEntry(CSteamID steamIDLobby, int iChatID, out CSteamID pSteamIDUser, byte[] pvData, int cubData, out EChatEntryType peChatEntryType) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_GetLobbyChatEntry(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, iChatID, out pSteamIDUser, pvData, cubData, out peChatEntryType);
}
/// <summary>
/// <para> Refreshes metadata for a lobby you're not necessarily in right now</para>
/// <para> you never do this for lobbies you're a member of, only if your</para>
/// <para> this will send down all the metadata associated with a lobby</para>
/// <para> this is an asynchronous call</para>
/// <para> returns false if the local user is not connected to the Steam servers</para>
/// <para> results will be returned by a LobbyDataUpdate_t callback</para>
/// <para> if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false</para>
/// </summary>
public static bool RequestLobbyData(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_RequestLobbyData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby);
}
/// <summary>
/// <para> sets the game server associated with the lobby</para>
/// <para> usually at this point, the users will join the specified game server</para>
/// <para> either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect</para>
/// </summary>
public static void SetLobbyGameServer(CSteamID steamIDLobby, uint unGameServerIP, ushort unGameServerPort, CSteamID steamIDGameServer) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmaking_SetLobbyGameServer(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, unGameServerIP, unGameServerPort, steamIDGameServer);
}
/// <summary>
/// <para> returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist</para>
/// </summary>
public static bool GetLobbyGameServer(CSteamID steamIDLobby, out uint punGameServerIP, out ushort punGameServerPort, out CSteamID psteamIDGameServer) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_GetLobbyGameServer(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, out punGameServerIP, out punGameServerPort, out psteamIDGameServer);
}
/// <summary>
/// <para> set the limit on the # of users who can join the lobby</para>
/// </summary>
public static bool SetLobbyMemberLimit(CSteamID steamIDLobby, int cMaxMembers) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_SetLobbyMemberLimit(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, cMaxMembers);
}
/// <summary>
/// <para> returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined</para>
/// </summary>
public static int GetLobbyMemberLimit(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_GetLobbyMemberLimit(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby);
}
/// <summary>
/// <para> updates which type of lobby it is</para>
/// <para> only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls</para>
/// </summary>
public static bool SetLobbyType(CSteamID steamIDLobby, ELobbyType eLobbyType) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_SetLobbyType(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, eLobbyType);
}
/// <summary>
/// <para> sets whether or not a lobby is joinable - defaults to true for a new lobby</para>
/// <para> if set to false, no user can join, even if they are a friend or have been invited</para>
/// </summary>
public static bool SetLobbyJoinable(CSteamID steamIDLobby, bool bLobbyJoinable) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_SetLobbyJoinable(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, bLobbyJoinable);
}
/// <summary>
/// <para> returns the current lobby owner</para>
/// <para> you must be a member of the lobby to access this</para>
/// <para> there always one lobby owner - if the current owner leaves, another user will become the owner</para>
/// <para> it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner</para>
/// </summary>
public static CSteamID GetLobbyOwner(CSteamID steamIDLobby) {
InteropHelp.TestIfAvailableClient();
return (CSteamID)NativeMethods.ISteamMatchmaking_GetLobbyOwner(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby);
}
/// <summary>
/// <para> changes who the lobby owner is</para>
/// <para> you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby</para>
/// <para> after completion, the local user will no longer be the owner</para>
/// </summary>
public static bool SetLobbyOwner(CSteamID steamIDLobby, CSteamID steamIDNewOwner) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_SetLobbyOwner(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, steamIDNewOwner);
}
/// <summary>
/// <para> link two lobbies for the purposes of checking player compatibility</para>
/// <para> you must be the lobby owner of both lobbies</para>
/// </summary>
public static bool SetLinkedLobby(CSteamID steamIDLobby, CSteamID steamIDLobbyDependent) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmaking_SetLinkedLobby(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, steamIDLobbyDependent);
}
#if _PS3
/// <summary>
/// <para> changes who the lobby owner is</para>
/// <para> you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby</para>
/// <para> after completion, the local user will no longer be the owner</para>
/// </summary>
public static void CheckForPSNGameBootInvite(uint iGameBootAttributes) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmaking_CheckForPSNGameBootInvite(CSteamAPIContext.GetSteamMatchmaking(), iGameBootAttributes);
}
#endif
}
public static class SteamMatchmakingServers {
/// <summary>
/// <para> Request a new list of servers of a particular type. These calls each correspond to one of the EMatchMakingType values.</para>
/// <para> Each call allocates a new asynchronous request object.</para>
/// <para> Request object must be released by calling ReleaseRequest( hServerListRequest )</para>
/// </summary>
public static HServerListRequest RequestInternetServerList(AppId_t iApp, MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, ISteamMatchmakingServerListResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerListRequest)NativeMethods.ISteamMatchmakingServers_RequestInternetServerList(CSteamAPIContext.GetSteamMatchmakingServers(), iApp, new MMKVPMarshaller(ppchFilters), nFilters, (IntPtr)pRequestServersResponse);
}
public static HServerListRequest RequestLANServerList(AppId_t iApp, ISteamMatchmakingServerListResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerListRequest)NativeMethods.ISteamMatchmakingServers_RequestLANServerList(CSteamAPIContext.GetSteamMatchmakingServers(), iApp, (IntPtr)pRequestServersResponse);
}
public static HServerListRequest RequestFriendsServerList(AppId_t iApp, MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, ISteamMatchmakingServerListResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerListRequest)NativeMethods.ISteamMatchmakingServers_RequestFriendsServerList(CSteamAPIContext.GetSteamMatchmakingServers(), iApp, new MMKVPMarshaller(ppchFilters), nFilters, (IntPtr)pRequestServersResponse);
}
public static HServerListRequest RequestFavoritesServerList(AppId_t iApp, MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, ISteamMatchmakingServerListResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerListRequest)NativeMethods.ISteamMatchmakingServers_RequestFavoritesServerList(CSteamAPIContext.GetSteamMatchmakingServers(), iApp, new MMKVPMarshaller(ppchFilters), nFilters, (IntPtr)pRequestServersResponse);
}
public static HServerListRequest RequestHistoryServerList(AppId_t iApp, MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, ISteamMatchmakingServerListResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerListRequest)NativeMethods.ISteamMatchmakingServers_RequestHistoryServerList(CSteamAPIContext.GetSteamMatchmakingServers(), iApp, new MMKVPMarshaller(ppchFilters), nFilters, (IntPtr)pRequestServersResponse);
}
public static HServerListRequest RequestSpectatorServerList(AppId_t iApp, MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, ISteamMatchmakingServerListResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerListRequest)NativeMethods.ISteamMatchmakingServers_RequestSpectatorServerList(CSteamAPIContext.GetSteamMatchmakingServers(), iApp, new MMKVPMarshaller(ppchFilters), nFilters, (IntPtr)pRequestServersResponse);
}
/// <summary>
/// <para> Releases the asynchronous request object and cancels any pending query on it if there's a pending query in progress.</para>
/// <para> RefreshComplete callback is not posted when request is released.</para>
/// </summary>
public static void ReleaseRequest(HServerListRequest hServerListRequest) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmakingServers_ReleaseRequest(CSteamAPIContext.GetSteamMatchmakingServers(), hServerListRequest);
}
/// <summary>
/// <para> the filter operation codes that go in the key part of MatchMakingKeyValuePair_t should be one of these:</para>
/// <para> "map"</para>
/// <para> - Server passes the filter if the server is playing the specified map.</para>
/// <para> "gamedataand"</para>
/// <para> - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) contains all of the</para>
/// <para> specified strings. The value field is a comma-delimited list of strings to match.</para>
/// <para> "gamedataor"</para>
/// <para> - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) contains at least one of the</para>
/// <para> specified strings. The value field is a comma-delimited list of strings to match.</para>
/// <para> "gamedatanor"</para>
/// <para> - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) does not contain any</para>
/// <para> of the specified strings. The value field is a comma-delimited list of strings to check.</para>
/// <para> "gametagsand"</para>
/// <para> - Server passes the filter if the server's game tags (ISteamGameServer::SetGameTags) contains all</para>
/// <para> of the specified strings. The value field is a comma-delimited list of strings to check.</para>
/// <para> "gametagsnor"</para>
/// <para> - Server passes the filter if the server's game tags (ISteamGameServer::SetGameTags) does not contain any</para>
/// <para> of the specified strings. The value field is a comma-delimited list of strings to check.</para>
/// <para> "and" (x1 &amp;&amp; x2 &amp;&amp; ... &amp;&amp; xn)</para>
/// <para> "or" (x1 || x2 || ... || xn)</para>
/// <para> "nand" !(x1 &amp;&amp; x2 &amp;&amp; ... &amp;&amp; xn)</para>
/// <para> "nor" !(x1 || x2 || ... || xn)</para>
/// <para> - Performs Boolean operation on the following filters. The operand to this filter specifies</para>
/// <para> the "size" of the Boolean inputs to the operation, in Key/value pairs. (The keyvalue</para>
/// <para> pairs must immediately follow, i.e. this is a prefix logical operator notation.)</para>
/// <para> In the simplest case where Boolean expressions are not nested, this is simply</para>
/// <para> the number of operands.</para>
/// <para> For example, to match servers on a particular map or with a particular tag, would would</para>
/// <para> use these filters.</para>
/// <para> ( server.map == "cp_dustbowl" || server.gametags.contains("payload") )</para>
/// <para> "or", "2"</para>
/// <para> "map", "cp_dustbowl"</para>
/// <para> "gametagsand", "payload"</para>
/// <para> If logical inputs are nested, then the operand specifies the size of the entire</para>
/// <para> "length" of its operands, not the number of immediate children.</para>
/// <para> ( server.map == "cp_dustbowl" || ( server.gametags.contains("payload") &amp;&amp; !server.gametags.contains("payloadrace") ) )</para>
/// <para> "or", "4"</para>
/// <para> "map", "cp_dustbowl"</para>
/// <para> "and", "2"</para>
/// <para> "gametagsand", "payload"</para>
/// <para> "gametagsnor", "payloadrace"</para>
/// <para> Unary NOT can be achieved using either "nand" or "nor" with a single operand.</para>
/// <para> "addr"</para>
/// <para> - Server passes the filter if the server's query address matches the specified IP or IP:port.</para>
/// <para> "gameaddr"</para>
/// <para> - Server passes the filter if the server's game address matches the specified IP or IP:port.</para>
/// <para> The following filter operations ignore the "value" part of MatchMakingKeyValuePair_t</para>
/// <para> "dedicated"</para>
/// <para> - Server passes the filter if it passed true to SetDedicatedServer.</para>
/// <para> "secure"</para>
/// <para> - Server passes the filter if the server is VAC-enabled.</para>
/// <para> "notfull"</para>
/// <para> - Server passes the filter if the player count is less than the reported max player count.</para>
/// <para> "hasplayers"</para>
/// <para> - Server passes the filter if the player count is greater than zero.</para>
/// <para> "noplayers"</para>
/// <para> - Server passes the filter if it doesn't have any players.</para>
/// <para> "linux"</para>
/// <para> - Server passes the filter if it's a linux server</para>
/// <para> Get details on a given server in the list, you can get the valid range of index</para>
/// <para> values by calling GetServerCount(). You will also receive index values in</para>
/// <para> ISteamMatchmakingServerListResponse::ServerResponded() callbacks</para>
/// </summary>
public static gameserveritem_t GetServerDetails(HServerListRequest hRequest, int iServer) {
InteropHelp.TestIfAvailableClient();
return (gameserveritem_t)Marshal.PtrToStructure(NativeMethods.ISteamMatchmakingServers_GetServerDetails(CSteamAPIContext.GetSteamMatchmakingServers(), hRequest, iServer), typeof(gameserveritem_t));
}
/// <summary>
/// <para> Cancel an request which is operation on the given list type. You should call this to cancel</para>
/// <para> any in-progress requests before destructing a callback object that may have been passed</para>
/// <para> to one of the above list request calls. Not doing so may result in a crash when a callback</para>
/// <para> occurs on the destructed object.</para>
/// <para> Canceling a query does not release the allocated request handle.</para>
/// <para> The request handle must be released using ReleaseRequest( hRequest )</para>
/// </summary>
public static void CancelQuery(HServerListRequest hRequest) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmakingServers_CancelQuery(CSteamAPIContext.GetSteamMatchmakingServers(), hRequest);
}
/// <summary>
/// <para> Ping every server in your list again but don't update the list of servers</para>
/// <para> Query callback installed when the server list was requested will be used</para>
/// <para> again to post notifications and RefreshComplete, so the callback must remain</para>
/// <para> valid until another RefreshComplete is called on it or the request</para>
/// <para> is released with ReleaseRequest( hRequest )</para>
/// </summary>
public static void RefreshQuery(HServerListRequest hRequest) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmakingServers_RefreshQuery(CSteamAPIContext.GetSteamMatchmakingServers(), hRequest);
}
/// <summary>
/// <para> Returns true if the list is currently refreshing its server list</para>
/// </summary>
public static bool IsRefreshing(HServerListRequest hRequest) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmakingServers_IsRefreshing(CSteamAPIContext.GetSteamMatchmakingServers(), hRequest);
}
/// <summary>
/// <para> How many servers in the given list, GetServerDetails above takes 0... GetServerCount() - 1</para>
/// </summary>
public static int GetServerCount(HServerListRequest hRequest) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMatchmakingServers_GetServerCount(CSteamAPIContext.GetSteamMatchmakingServers(), hRequest);
}
/// <summary>
/// <para> Refresh a single server inside of a query (rather than all the servers )</para>
/// </summary>
public static void RefreshServer(HServerListRequest hRequest, int iServer) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmakingServers_RefreshServer(CSteamAPIContext.GetSteamMatchmakingServers(), hRequest, iServer);
}
/// <summary>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> Queries to individual servers directly via IP/Port</para>
/// <para>-----------------------------------------------------------------------------</para>
/// <para> Request updated ping time and other details from a single server</para>
/// </summary>
public static HServerQuery PingServer(uint unIP, ushort usPort, ISteamMatchmakingPingResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerQuery)NativeMethods.ISteamMatchmakingServers_PingServer(CSteamAPIContext.GetSteamMatchmakingServers(), unIP, usPort, (IntPtr)pRequestServersResponse);
}
/// <summary>
/// <para> Request the list of players currently playing on a server</para>
/// </summary>
public static HServerQuery PlayerDetails(uint unIP, ushort usPort, ISteamMatchmakingPlayersResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerQuery)NativeMethods.ISteamMatchmakingServers_PlayerDetails(CSteamAPIContext.GetSteamMatchmakingServers(), unIP, usPort, (IntPtr)pRequestServersResponse);
}
/// <summary>
/// <para> Request the list of rules that the server is running (See ISteamGameServer::SetKeyValue() to set the rules server side)</para>
/// </summary>
public static HServerQuery ServerRules(uint unIP, ushort usPort, ISteamMatchmakingRulesResponse pRequestServersResponse) {
InteropHelp.TestIfAvailableClient();
return (HServerQuery)NativeMethods.ISteamMatchmakingServers_ServerRules(CSteamAPIContext.GetSteamMatchmakingServers(), unIP, usPort, (IntPtr)pRequestServersResponse);
}
/// <summary>
/// <para> Cancel an outstanding Ping/Players/Rules query from above. You should call this to cancel</para>
/// <para> any in-progress requests before destructing a callback object that may have been passed</para>
/// <para> to one of the above calls to avoid crashing when callbacks occur.</para>
/// </summary>
public static void CancelServerQuery(HServerQuery hServerQuery) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMatchmakingServers_CancelServerQuery(CSteamAPIContext.GetSteamMatchmakingServers(), hServerQuery);
}
}
public static class SteamGameSearch {
/// <summary>
/// <para> =============================================================================================</para>
/// <para> Game Player APIs</para>
/// <para> a keyname and a list of comma separated values: one of which is must be found in order for the match to qualify</para>
/// <para> fails if a search is currently in progress</para>
/// </summary>
public static EGameSearchErrorCode_t AddGameSearchParams(string pchKeyToFind, string pchValuesToFind) {
InteropHelp.TestIfAvailableClient();
using (var pchKeyToFind2 = new InteropHelp.UTF8StringHandle(pchKeyToFind))
using (var pchValuesToFind2 = new InteropHelp.UTF8StringHandle(pchValuesToFind)) {
return NativeMethods.ISteamGameSearch_AddGameSearchParams(CSteamAPIContext.GetSteamGameSearch(), pchKeyToFind2, pchValuesToFind2);
}
}
/// <summary>
/// <para> all players in lobby enter the queue and await a SearchForGameNotificationCallback_t callback. fails if another search is currently in progress</para>
/// <para> if not the owner of the lobby or search already in progress this call fails</para>
/// <para> periodic callbacks will be sent as queue time estimates change</para>
/// </summary>
public static EGameSearchErrorCode_t SearchForGameWithLobby(CSteamID steamIDLobby, int nPlayerMin, int nPlayerMax) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_SearchForGameWithLobby(CSteamAPIContext.GetSteamGameSearch(), steamIDLobby, nPlayerMin, nPlayerMax);
}
/// <summary>
/// <para> user enter the queue and await a SearchForGameNotificationCallback_t callback. fails if another search is currently in progress</para>
/// <para> periodic callbacks will be sent as queue time estimates change</para>
/// </summary>
public static EGameSearchErrorCode_t SearchForGameSolo(int nPlayerMin, int nPlayerMax) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_SearchForGameSolo(CSteamAPIContext.GetSteamGameSearch(), nPlayerMin, nPlayerMax);
}
/// <summary>
/// <para> after receiving SearchForGameResultCallback_t, accept or decline the game</para>
/// <para> multiple SearchForGameResultCallback_t will follow as players accept game until the host starts or cancels the game</para>
/// </summary>
public static EGameSearchErrorCode_t AcceptGame() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_AcceptGame(CSteamAPIContext.GetSteamGameSearch());
}
public static EGameSearchErrorCode_t DeclineGame() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_DeclineGame(CSteamAPIContext.GetSteamGameSearch());
}
/// <summary>
/// <para> after receiving GameStartedByHostCallback_t get connection details to server</para>
/// </summary>
public static EGameSearchErrorCode_t RetrieveConnectionDetails(CSteamID steamIDHost, out string pchConnectionDetails, int cubConnectionDetails) {
InteropHelp.TestIfAvailableClient();
IntPtr pchConnectionDetails2 = Marshal.AllocHGlobal(cubConnectionDetails);
EGameSearchErrorCode_t ret = NativeMethods.ISteamGameSearch_RetrieveConnectionDetails(CSteamAPIContext.GetSteamGameSearch(), steamIDHost, pchConnectionDetails2, cubConnectionDetails);
pchConnectionDetails = ret != 0 ? InteropHelp.PtrToStringUTF8(pchConnectionDetails2) : null;
Marshal.FreeHGlobal(pchConnectionDetails2);
return ret;
}
/// <summary>
/// <para> leaves queue if still waiting</para>
/// </summary>
public static EGameSearchErrorCode_t EndGameSearch() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_EndGameSearch(CSteamAPIContext.GetSteamGameSearch());
}
/// <summary>
/// <para> =============================================================================================</para>
/// <para> Game Host APIs</para>
/// <para> a keyname and a list of comma separated values: all the values you allow</para>
/// </summary>
public static EGameSearchErrorCode_t SetGameHostParams(string pchKey, string pchValue) {
InteropHelp.TestIfAvailableClient();
using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey))
using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue)) {
return NativeMethods.ISteamGameSearch_SetGameHostParams(CSteamAPIContext.GetSteamGameSearch(), pchKey2, pchValue2);
}
}
/// <summary>
/// <para> set connection details for players once game is found so they can connect to this server</para>
/// </summary>
public static EGameSearchErrorCode_t SetConnectionDetails(string pchConnectionDetails, int cubConnectionDetails) {
InteropHelp.TestIfAvailableClient();
using (var pchConnectionDetails2 = new InteropHelp.UTF8StringHandle(pchConnectionDetails)) {
return NativeMethods.ISteamGameSearch_SetConnectionDetails(CSteamAPIContext.GetSteamGameSearch(), pchConnectionDetails2, cubConnectionDetails);
}
}
/// <summary>
/// <para> mark server as available for more players with nPlayerMin,nPlayerMax desired</para>
/// <para> accept no lobbies with playercount greater than nMaxTeamSize</para>
/// <para> the set of lobbies returned must be partitionable into teams of no more than nMaxTeamSize</para>
/// <para> RequestPlayersForGameNotificationCallback_t callback will be sent when the search has started</para>
/// <para> multple RequestPlayersForGameResultCallback_t callbacks will follow when players are found</para>
/// </summary>
public static EGameSearchErrorCode_t RequestPlayersForGame(int nPlayerMin, int nPlayerMax, int nMaxTeamSize) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_RequestPlayersForGame(CSteamAPIContext.GetSteamGameSearch(), nPlayerMin, nPlayerMax, nMaxTeamSize);
}
/// <summary>
/// <para> accept the player list and release connection details to players</para>
/// <para> players will only be given connection details and host steamid when this is called</para>
/// <para> ( allows host to accept after all players confirm, some confirm, or none confirm. decision is entirely up to the host )</para>
/// </summary>
public static EGameSearchErrorCode_t HostConfirmGameStart(ulong ullUniqueGameID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_HostConfirmGameStart(CSteamAPIContext.GetSteamGameSearch(), ullUniqueGameID);
}
/// <summary>
/// <para> cancel request and leave the pool of game hosts looking for players</para>
/// <para> if a set of players has already been sent to host, all players will receive SearchForGameHostFailedToConfirm_t</para>
/// </summary>
public static EGameSearchErrorCode_t CancelRequestPlayersForGame() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_CancelRequestPlayersForGame(CSteamAPIContext.GetSteamGameSearch());
}
/// <summary>
/// <para> submit a result for one player. does not end the game. ullUniqueGameID continues to describe this game</para>
/// </summary>
public static EGameSearchErrorCode_t SubmitPlayerResult(ulong ullUniqueGameID, CSteamID steamIDPlayer, EPlayerResult_t EPlayerResult) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_SubmitPlayerResult(CSteamAPIContext.GetSteamGameSearch(), ullUniqueGameID, steamIDPlayer, EPlayerResult);
}
/// <summary>
/// <para> ends the game. no further SubmitPlayerResults for ullUniqueGameID will be accepted</para>
/// <para> any future requests will provide a new ullUniqueGameID</para>
/// </summary>
public static EGameSearchErrorCode_t EndGame(ulong ullUniqueGameID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamGameSearch_EndGame(CSteamAPIContext.GetSteamGameSearch(), ullUniqueGameID);
}
}
public static class SteamParties {
/// <summary>
/// <para> =============================================================================================</para>
/// <para> Party Client APIs</para>
/// <para> Enumerate any active beacons for parties you may wish to join</para>
/// </summary>
public static uint GetNumActiveBeacons() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParties_GetNumActiveBeacons(CSteamAPIContext.GetSteamParties());
}
public static PartyBeaconID_t GetBeaconByIndex(uint unIndex) {
InteropHelp.TestIfAvailableClient();
return (PartyBeaconID_t)NativeMethods.ISteamParties_GetBeaconByIndex(CSteamAPIContext.GetSteamParties(), unIndex);
}
public static bool GetBeaconDetails(PartyBeaconID_t ulBeaconID, out CSteamID pSteamIDBeaconOwner, out SteamPartyBeaconLocation_t pLocation, out string pchMetadata, int cchMetadata) {
InteropHelp.TestIfAvailableClient();
IntPtr pchMetadata2 = Marshal.AllocHGlobal(cchMetadata);
bool ret = NativeMethods.ISteamParties_GetBeaconDetails(CSteamAPIContext.GetSteamParties(), ulBeaconID, out pSteamIDBeaconOwner, out pLocation, pchMetadata2, cchMetadata);
pchMetadata = ret ? InteropHelp.PtrToStringUTF8(pchMetadata2) : null;
Marshal.FreeHGlobal(pchMetadata2);
return ret;
}
/// <summary>
/// <para> Join an open party. Steam will reserve one beacon slot for your SteamID,</para>
/// <para> and return the necessary JoinGame string for you to use to connect</para>
/// </summary>
public static SteamAPICall_t JoinParty(PartyBeaconID_t ulBeaconID) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamParties_JoinParty(CSteamAPIContext.GetSteamParties(), ulBeaconID);
}
/// <summary>
/// <para> =============================================================================================</para>
/// <para> Party Host APIs</para>
/// <para> Get a list of possible beacon locations</para>
/// </summary>
public static bool GetNumAvailableBeaconLocations(out uint puNumLocations) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParties_GetNumAvailableBeaconLocations(CSteamAPIContext.GetSteamParties(), out puNumLocations);
}
public static bool GetAvailableBeaconLocations(SteamPartyBeaconLocation_t[] pLocationList, uint uMaxNumLocations) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParties_GetAvailableBeaconLocations(CSteamAPIContext.GetSteamParties(), pLocationList, uMaxNumLocations);
}
/// <summary>
/// <para> Create a new party beacon and activate it in the selected location.</para>
/// <para> unOpenSlots is the maximum number of users that Steam will send to you.</para>
/// <para> When people begin responding to your beacon, Steam will send you</para>
/// <para> PartyReservationCallback_t callbacks to let you know who is on the way.</para>
/// </summary>
public static SteamAPICall_t CreateBeacon(uint unOpenSlots, ref SteamPartyBeaconLocation_t pBeaconLocation, string pchConnectString, string pchMetadata) {
InteropHelp.TestIfAvailableClient();
using (var pchConnectString2 = new InteropHelp.UTF8StringHandle(pchConnectString))
using (var pchMetadata2 = new InteropHelp.UTF8StringHandle(pchMetadata)) {
return (SteamAPICall_t)NativeMethods.ISteamParties_CreateBeacon(CSteamAPIContext.GetSteamParties(), unOpenSlots, ref pBeaconLocation, pchConnectString2, pchMetadata2);
}
}
/// <summary>
/// <para> Call this function when a user that had a reservation (see callback below)</para>
/// <para> has successfully joined your party.</para>
/// <para> Steam will manage the remaining open slots automatically.</para>
/// </summary>
public static void OnReservationCompleted(PartyBeaconID_t ulBeacon, CSteamID steamIDUser) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamParties_OnReservationCompleted(CSteamAPIContext.GetSteamParties(), ulBeacon, steamIDUser);
}
/// <summary>
/// <para> To cancel a reservation (due to timeout or user input), call this.</para>
/// <para> Steam will open a new reservation slot.</para>
/// <para> Note: The user may already be in-flight to your game, so it's possible they will still connect and try to join your party.</para>
/// </summary>
public static void CancelReservation(PartyBeaconID_t ulBeacon, CSteamID steamIDUser) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamParties_CancelReservation(CSteamAPIContext.GetSteamParties(), ulBeacon, steamIDUser);
}
/// <summary>
/// <para> Change the number of open beacon reservation slots.</para>
/// <para> Call this if, for example, someone without a reservation joins your party (eg a friend, or via your own matchmaking system).</para>
/// </summary>
public static SteamAPICall_t ChangeNumOpenSlots(PartyBeaconID_t ulBeacon, uint unOpenSlots) {
InteropHelp.TestIfAvailableClient();
return (SteamAPICall_t)NativeMethods.ISteamParties_ChangeNumOpenSlots(CSteamAPIContext.GetSteamParties(), ulBeacon, unOpenSlots);
}
/// <summary>
/// <para> Turn off the beacon.</para>
/// </summary>
public static bool DestroyBeacon(PartyBeaconID_t ulBeacon) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParties_DestroyBeacon(CSteamAPIContext.GetSteamParties(), ulBeacon);
}
/// <summary>
/// <para> Utils</para>
/// </summary>
public static bool GetBeaconLocationData(SteamPartyBeaconLocation_t BeaconLocation, ESteamPartyBeaconLocationData eData, out string pchDataStringOut, int cchDataStringOut) {
InteropHelp.TestIfAvailableClient();
IntPtr pchDataStringOut2 = Marshal.AllocHGlobal(cchDataStringOut);
bool ret = NativeMethods.ISteamParties_GetBeaconLocationData(CSteamAPIContext.GetSteamParties(), BeaconLocation, eData, pchDataStringOut2, cchDataStringOut);
pchDataStringOut = ret ? InteropHelp.PtrToStringUTF8(pchDataStringOut2) : null;
Marshal.FreeHGlobal(pchDataStringOut2);
return ret;
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6511b3ce700864d46ab81d101aac5560
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,69 @@
// 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 SteamMusic {
public static bool BIsEnabled() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusic_BIsEnabled(CSteamAPIContext.GetSteamMusic());
}
public static bool BIsPlaying() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusic_BIsPlaying(CSteamAPIContext.GetSteamMusic());
}
public static AudioPlayback_Status GetPlaybackStatus() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusic_GetPlaybackStatus(CSteamAPIContext.GetSteamMusic());
}
public static void Play() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMusic_Play(CSteamAPIContext.GetSteamMusic());
}
public static void Pause() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMusic_Pause(CSteamAPIContext.GetSteamMusic());
}
public static void PlayPrevious() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMusic_PlayPrevious(CSteamAPIContext.GetSteamMusic());
}
public static void PlayNext() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMusic_PlayNext(CSteamAPIContext.GetSteamMusic());
}
/// <summary>
/// <para> volume is between 0.0 and 1.0</para>
/// </summary>
public static void SetVolume(float flVolume) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamMusic_SetVolume(CSteamAPIContext.GetSteamMusic(), flVolume);
}
public static float GetVolume() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusic_GetVolume(CSteamAPIContext.GetSteamMusic());
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 72776072787328946ad6c1c1b0f54e0d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,212 @@
// 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 SteamMusicRemote {
/// <summary>
/// <para> Service Definition</para>
/// </summary>
public static bool RegisterSteamMusicRemote(string pchName) {
InteropHelp.TestIfAvailableClient();
using (var pchName2 = new InteropHelp.UTF8StringHandle(pchName)) {
return NativeMethods.ISteamMusicRemote_RegisterSteamMusicRemote(CSteamAPIContext.GetSteamMusicRemote(), pchName2);
}
}
public static bool DeregisterSteamMusicRemote() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_DeregisterSteamMusicRemote(CSteamAPIContext.GetSteamMusicRemote());
}
public static bool BIsCurrentMusicRemote() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_BIsCurrentMusicRemote(CSteamAPIContext.GetSteamMusicRemote());
}
public static bool BActivationSuccess(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_BActivationSuccess(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
public static bool SetDisplayName(string pchDisplayName) {
InteropHelp.TestIfAvailableClient();
using (var pchDisplayName2 = new InteropHelp.UTF8StringHandle(pchDisplayName)) {
return NativeMethods.ISteamMusicRemote_SetDisplayName(CSteamAPIContext.GetSteamMusicRemote(), pchDisplayName2);
}
}
public static bool SetPNGIcon_64x64(byte[] pvBuffer, uint cbBufferLength) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_SetPNGIcon_64x64(CSteamAPIContext.GetSteamMusicRemote(), pvBuffer, cbBufferLength);
}
/// <summary>
/// <para> Abilities for the user interface</para>
/// </summary>
public static bool EnablePlayPrevious(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_EnablePlayPrevious(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
public static bool EnablePlayNext(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_EnablePlayNext(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
public static bool EnableShuffled(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_EnableShuffled(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
public static bool EnableLooped(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_EnableLooped(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
public static bool EnableQueue(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_EnableQueue(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
public static bool EnablePlaylists(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_EnablePlaylists(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
/// <summary>
/// <para> Status</para>
/// </summary>
public static bool UpdatePlaybackStatus(AudioPlayback_Status nStatus) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_UpdatePlaybackStatus(CSteamAPIContext.GetSteamMusicRemote(), nStatus);
}
public static bool UpdateShuffled(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_UpdateShuffled(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
public static bool UpdateLooped(bool bValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_UpdateLooped(CSteamAPIContext.GetSteamMusicRemote(), bValue);
}
/// <summary>
/// <para> volume is between 0.0 and 1.0</para>
/// </summary>
public static bool UpdateVolume(float flValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_UpdateVolume(CSteamAPIContext.GetSteamMusicRemote(), flValue);
}
/// <summary>
/// <para> Current Entry</para>
/// </summary>
public static bool CurrentEntryWillChange() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_CurrentEntryWillChange(CSteamAPIContext.GetSteamMusicRemote());
}
public static bool CurrentEntryIsAvailable(bool bAvailable) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_CurrentEntryIsAvailable(CSteamAPIContext.GetSteamMusicRemote(), bAvailable);
}
public static bool UpdateCurrentEntryText(string pchText) {
InteropHelp.TestIfAvailableClient();
using (var pchText2 = new InteropHelp.UTF8StringHandle(pchText)) {
return NativeMethods.ISteamMusicRemote_UpdateCurrentEntryText(CSteamAPIContext.GetSteamMusicRemote(), pchText2);
}
}
public static bool UpdateCurrentEntryElapsedSeconds(int nValue) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds(CSteamAPIContext.GetSteamMusicRemote(), nValue);
}
public static bool UpdateCurrentEntryCoverArt(byte[] pvBuffer, uint cbBufferLength) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_UpdateCurrentEntryCoverArt(CSteamAPIContext.GetSteamMusicRemote(), pvBuffer, cbBufferLength);
}
public static bool CurrentEntryDidChange() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_CurrentEntryDidChange(CSteamAPIContext.GetSteamMusicRemote());
}
/// <summary>
/// <para> Queue</para>
/// </summary>
public static bool QueueWillChange() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_QueueWillChange(CSteamAPIContext.GetSteamMusicRemote());
}
public static bool ResetQueueEntries() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_ResetQueueEntries(CSteamAPIContext.GetSteamMusicRemote());
}
public static bool SetQueueEntry(int nID, int nPosition, string pchEntryText) {
InteropHelp.TestIfAvailableClient();
using (var pchEntryText2 = new InteropHelp.UTF8StringHandle(pchEntryText)) {
return NativeMethods.ISteamMusicRemote_SetQueueEntry(CSteamAPIContext.GetSteamMusicRemote(), nID, nPosition, pchEntryText2);
}
}
public static bool SetCurrentQueueEntry(int nID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_SetCurrentQueueEntry(CSteamAPIContext.GetSteamMusicRemote(), nID);
}
public static bool QueueDidChange() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_QueueDidChange(CSteamAPIContext.GetSteamMusicRemote());
}
/// <summary>
/// <para> Playlist</para>
/// </summary>
public static bool PlaylistWillChange() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_PlaylistWillChange(CSteamAPIContext.GetSteamMusicRemote());
}
public static bool ResetPlaylistEntries() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_ResetPlaylistEntries(CSteamAPIContext.GetSteamMusicRemote());
}
public static bool SetPlaylistEntry(int nID, int nPosition, string pchEntryText) {
InteropHelp.TestIfAvailableClient();
using (var pchEntryText2 = new InteropHelp.UTF8StringHandle(pchEntryText)) {
return NativeMethods.ISteamMusicRemote_SetPlaylistEntry(CSteamAPIContext.GetSteamMusicRemote(), nID, nPosition, pchEntryText2);
}
}
public static bool SetCurrentPlaylistEntry(int nID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_SetCurrentPlaylistEntry(CSteamAPIContext.GetSteamMusicRemote(), nID);
}
public static bool PlaylistDidChange() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamMusicRemote_PlaylistDidChange(CSteamAPIContext.GetSteamMusicRemote());
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 288337a492146b7469b28813c4cb20ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,270 @@
// 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 SteamNetworking {
/// <summary>
/// <para>//////////////////////////////////////////////////////////////////////////////////////////</para>
/// <para> UDP-style (connectionless) networking interface. These functions send messages using</para>
/// <para> an API organized around the destination. Reliable and unreliable messages are supported.</para>
/// <para> For a more TCP-style interface (meaning you have a connection handle), see the functions below.</para>
/// <para> Both interface styles can send both reliable and unreliable messages.</para>
/// <para> Automatically establishes NAT-traversing or Relay server connections</para>
/// <para> These APIs are deprecated, and may be removed in a future version of the Steamworks</para>
/// <para> SDK. See ISteamNetworkingMessages.</para>
/// <para> Sends a P2P packet to the specified user</para>
/// <para> UDP-like, unreliable and a max packet size of 1200 bytes</para>
/// <para> the first packet send may be delayed as the NAT-traversal code runs</para>
/// <para> if we can't get through to the user, an error will be posted via the callback P2PSessionConnectFail_t</para>
/// <para> see EP2PSend enum above for the descriptions of the different ways of sending packets</para>
/// <para> nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket()</para>
/// <para> with the same channel number in order to retrieve the data on the other end</para>
/// <para> using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources</para>
/// </summary>
public static bool SendP2PPacket(CSteamID steamIDRemote, byte[] pubData, uint cubData, EP2PSend eP2PSendType, int nChannel = 0) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_SendP2PPacket(CSteamAPIContext.GetSteamNetworking(), steamIDRemote, pubData, cubData, eP2PSendType, nChannel);
}
/// <summary>
/// <para> returns true if any data is available for read, and the amount of data that will need to be read</para>
/// </summary>
public static bool IsP2PPacketAvailable(out uint pcubMsgSize, int nChannel = 0) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_IsP2PPacketAvailable(CSteamAPIContext.GetSteamNetworking(), out pcubMsgSize, nChannel);
}
/// <summary>
/// <para> reads in a packet that has been sent from another user via SendP2PPacket()</para>
/// <para> returns the size of the message and the steamID of the user who sent it in the last two parameters</para>
/// <para> if the buffer passed in is too small, the message will be truncated</para>
/// <para> this call is not blocking, and will return false if no data is available</para>
/// </summary>
public static bool ReadP2PPacket(byte[] pubDest, uint cubDest, out uint pcubMsgSize, out CSteamID psteamIDRemote, int nChannel = 0) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_ReadP2PPacket(CSteamAPIContext.GetSteamNetworking(), pubDest, cubDest, out pcubMsgSize, out psteamIDRemote, nChannel);
}
/// <summary>
/// <para> AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback</para>
/// <para> P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet</para>
/// <para> if you don't want to talk to the user, just ignore the request</para>
/// <para> if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically</para>
/// <para> this may be called multiple times for a single user</para>
/// <para> (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)</para>
/// </summary>
public static bool AcceptP2PSessionWithUser(CSteamID steamIDRemote) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_AcceptP2PSessionWithUser(CSteamAPIContext.GetSteamNetworking(), steamIDRemote);
}
/// <summary>
/// <para> call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood</para>
/// <para> if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted</para>
/// </summary>
public static bool CloseP2PSessionWithUser(CSteamID steamIDRemote) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_CloseP2PSessionWithUser(CSteamAPIContext.GetSteamNetworking(), steamIDRemote);
}
/// <summary>
/// <para> call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels</para>
/// <para> open channels to a user have been closed, the open session to the user will be closed and new data from this</para>
/// <para> user will trigger a P2PSessionRequest_t callback</para>
/// </summary>
public static bool CloseP2PChannelWithUser(CSteamID steamIDRemote, int nChannel) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_CloseP2PChannelWithUser(CSteamAPIContext.GetSteamNetworking(), steamIDRemote, nChannel);
}
/// <summary>
/// <para> fills out P2PSessionState_t structure with details about the underlying connection to the user</para>
/// <para> should only needed for debugging purposes</para>
/// <para> returns false if no connection exists to the specified user</para>
/// </summary>
public static bool GetP2PSessionState(CSteamID steamIDRemote, out P2PSessionState_t pConnectionState) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_GetP2PSessionState(CSteamAPIContext.GetSteamNetworking(), steamIDRemote, out pConnectionState);
}
/// <summary>
/// <para> Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection</para>
/// <para> or NAT-traversal cannot be established. Only applies to connections created after setting this value,</para>
/// <para> or to existing connections that need to automatically reconnect after this value is set.</para>
/// <para> P2P packet relay is allowed by default</para>
/// <para> NOTE: This function is deprecated and may be removed in a future version of the SDK. For</para>
/// <para> security purposes, we may decide to relay the traffic to certain peers, even if you pass false</para>
/// <para> to this function, to prevent revealing the client's IP address top another peer.</para>
/// </summary>
public static bool AllowP2PPacketRelay(bool bAllow) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_AllowP2PPacketRelay(CSteamAPIContext.GetSteamNetworking(), bAllow);
}
/// <summary>
/// <para>//////////////////////////////////////////////////////////////////////////////////////////</para>
/// <para> LISTEN / CONNECT connection-oriented interface functions</para>
/// <para> These functions are more like a client-server TCP API. One side is the "server"</para>
/// <para> and "listens" for incoming connections, which then must be "accepted." The "client"</para>
/// <para> initiates a connection by "connecting." Sending and receiving is done through a</para>
/// <para> connection handle.</para>
/// <para> For a more UDP-style interface, where you do not track connection handles but</para>
/// <para> simply send messages to a SteamID, use the UDP-style functions above.</para>
/// <para> Both methods can send both reliable and unreliable methods.</para>
/// <para> These APIs are deprecated, and may be removed in a future version of the Steamworks</para>
/// <para> SDK. See ISteamNetworkingSockets.</para>
/// <para>//////////////////////////////////////////////////////////////////////////////////////////</para>
/// <para> creates a socket and listens others to connect</para>
/// <para> will trigger a SocketStatusCallback_t callback on another client connecting</para>
/// <para> nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports</para>
/// <para> this can usually just be 0 unless you want multiple sets of connections</para>
/// <para> unIP is the local IP address to bind to</para>
/// <para> pass in 0 if you just want the default local IP</para>
/// <para> unPort is the port to use</para>
/// <para> pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only</para>
/// </summary>
public static SNetListenSocket_t CreateListenSocket(int nVirtualP2PPort, SteamIPAddress_t nIP, ushort nPort, bool bAllowUseOfPacketRelay) {
InteropHelp.TestIfAvailableClient();
return (SNetListenSocket_t)NativeMethods.ISteamNetworking_CreateListenSocket(CSteamAPIContext.GetSteamNetworking(), nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay);
}
/// <summary>
/// <para> creates a socket and begin connection to a remote destination</para>
/// <para> can connect via a known steamID (client or game server), or directly to an IP</para>
/// <para> on success will trigger a SocketStatusCallback_t callback</para>
/// <para> on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState</para>
/// </summary>
public static SNetSocket_t CreateP2PConnectionSocket(CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay) {
InteropHelp.TestIfAvailableClient();
return (SNetSocket_t)NativeMethods.ISteamNetworking_CreateP2PConnectionSocket(CSteamAPIContext.GetSteamNetworking(), steamIDTarget, nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay);
}
public static SNetSocket_t CreateConnectionSocket(SteamIPAddress_t nIP, ushort nPort, int nTimeoutSec) {
InteropHelp.TestIfAvailableClient();
return (SNetSocket_t)NativeMethods.ISteamNetworking_CreateConnectionSocket(CSteamAPIContext.GetSteamNetworking(), nIP, nPort, nTimeoutSec);
}
/// <summary>
/// <para> disconnects the connection to the socket, if any, and invalidates the handle</para>
/// <para> any unread data on the socket will be thrown away</para>
/// <para> if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect</para>
/// </summary>
public static bool DestroySocket(SNetSocket_t hSocket, bool bNotifyRemoteEnd) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_DestroySocket(CSteamAPIContext.GetSteamNetworking(), hSocket, bNotifyRemoteEnd);
}
/// <summary>
/// <para> destroying a listen socket will automatically kill all the regular sockets generated from it</para>
/// </summary>
public static bool DestroyListenSocket(SNetListenSocket_t hSocket, bool bNotifyRemoteEnd) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_DestroyListenSocket(CSteamAPIContext.GetSteamNetworking(), hSocket, bNotifyRemoteEnd);
}
/// <summary>
/// <para> sending data</para>
/// <para> must be a handle to a connected socket</para>
/// <para> data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets</para>
/// <para> use the reliable flag with caution; although the resend rate is pretty aggressive,</para>
/// <para> it can still cause stalls in receiving data (like TCP)</para>
/// </summary>
public static bool SendDataOnSocket(SNetSocket_t hSocket, byte[] pubData, uint cubData, bool bReliable) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_SendDataOnSocket(CSteamAPIContext.GetSteamNetworking(), hSocket, pubData, cubData, bReliable);
}
/// <summary>
/// <para> receiving data</para>
/// <para> returns false if there is no data remaining</para>
/// <para> fills out *pcubMsgSize with the size of the next message, in bytes</para>
/// </summary>
public static bool IsDataAvailableOnSocket(SNetSocket_t hSocket, out uint pcubMsgSize) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_IsDataAvailableOnSocket(CSteamAPIContext.GetSteamNetworking(), hSocket, out pcubMsgSize);
}
/// <summary>
/// <para> fills in pubDest with the contents of the message</para>
/// <para> messages are always complete, of the same size as was sent (i.e. packetized, not streaming)</para>
/// <para> if *pcubMsgSize &lt; cubDest, only partial data is written</para>
/// <para> returns false if no data is available</para>
/// </summary>
public static bool RetrieveDataFromSocket(SNetSocket_t hSocket, byte[] pubDest, uint cubDest, out uint pcubMsgSize) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_RetrieveDataFromSocket(CSteamAPIContext.GetSteamNetworking(), hSocket, pubDest, cubDest, out pcubMsgSize);
}
/// <summary>
/// <para> checks for data from any socket that has been connected off this listen socket</para>
/// <para> returns false if there is no data remaining</para>
/// <para> fills out *pcubMsgSize with the size of the next message, in bytes</para>
/// <para> fills out *phSocket with the socket that data is available on</para>
/// </summary>
public static bool IsDataAvailable(SNetListenSocket_t hListenSocket, out uint pcubMsgSize, out SNetSocket_t phSocket) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_IsDataAvailable(CSteamAPIContext.GetSteamNetworking(), hListenSocket, out pcubMsgSize, out phSocket);
}
/// <summary>
/// <para> retrieves data from any socket that has been connected off this listen socket</para>
/// <para> fills in pubDest with the contents of the message</para>
/// <para> messages are always complete, of the same size as was sent (i.e. packetized, not streaming)</para>
/// <para> if *pcubMsgSize &lt; cubDest, only partial data is written</para>
/// <para> returns false if no data is available</para>
/// <para> fills out *phSocket with the socket that data is available on</para>
/// </summary>
public static bool RetrieveData(SNetListenSocket_t hListenSocket, byte[] pubDest, uint cubDest, out uint pcubMsgSize, out SNetSocket_t phSocket) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_RetrieveData(CSteamAPIContext.GetSteamNetworking(), hListenSocket, pubDest, cubDest, out pcubMsgSize, out phSocket);
}
/// <summary>
/// <para> returns information about the specified socket, filling out the contents of the pointers</para>
/// </summary>
public static bool GetSocketInfo(SNetSocket_t hSocket, out CSteamID pSteamIDRemote, out int peSocketStatus, out SteamIPAddress_t punIPRemote, out ushort punPortRemote) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_GetSocketInfo(CSteamAPIContext.GetSteamNetworking(), hSocket, out pSteamIDRemote, out peSocketStatus, out punIPRemote, out punPortRemote);
}
/// <summary>
/// <para> returns which local port the listen socket is bound to</para>
/// <para> *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only</para>
/// </summary>
public static bool GetListenSocketInfo(SNetListenSocket_t hListenSocket, out SteamIPAddress_t pnIP, out ushort pnPort) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_GetListenSocketInfo(CSteamAPIContext.GetSteamNetworking(), hListenSocket, out pnIP, out pnPort);
}
/// <summary>
/// <para> returns true to describe how the socket ended up connecting</para>
/// </summary>
public static ESNetSocketConnectionType GetSocketConnectionType(SNetSocket_t hSocket) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_GetSocketConnectionType(CSteamAPIContext.GetSteamNetworking(), hSocket);
}
/// <summary>
/// <para> max packet size, in bytes</para>
/// </summary>
public static int GetMaxPacketSize(SNetSocket_t hSocket) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworking_GetMaxPacketSize(CSteamAPIContext.GetSteamNetworking(), hSocket);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 15b6f39e728f43c4b85c79fd3d6e6ecb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,142 @@
// 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 SteamNetworkingMessages {
/// <summary>
/// <para>/ Sends a message to the specified host. If we don't already have a session with that user,</para>
/// <para>/ a session is implicitly created. There might be some handshaking that needs to happen</para>
/// <para>/ before we can actually begin sending message data. If this handshaking fails and we can't</para>
/// <para>/ get through, an error will be posted via the callback SteamNetworkingMessagesSessionFailed_t.</para>
/// <para>/ There is no notification when the operation succeeds. (You should have the peer send a reply</para>
/// <para>/ for this purpose.)</para>
/// <para>/</para>
/// <para>/ Sending a message to a host will also implicitly accept any incoming connection from that host.</para>
/// <para>/</para>
/// <para>/ nSendFlags is a bitmask of k_nSteamNetworkingSend_xxx options</para>
/// <para>/</para>
/// <para>/ nRemoteChannel is a routing number you can use to help route message to different systems.</para>
/// <para>/ You'll have to call ReceiveMessagesOnChannel() with the same channel number in order to retrieve</para>
/// <para>/ the data on the other end.</para>
/// <para>/</para>
/// <para>/ Using different channels to talk to the same user will still use the same underlying</para>
/// <para>/ connection, saving on resources. If you don't need this feature, use 0.</para>
/// <para>/ Otherwise, small integers are the most efficient.</para>
/// <para>/</para>
/// <para>/ It is guaranteed that reliable messages to the same host on the same channel</para>
/// <para>/ will be be received by the remote host (if they are received at all) exactly once,</para>
/// <para>/ and in the same order that they were sent.</para>
/// <para>/</para>
/// <para>/ NO other order guarantees exist! In particular, unreliable messages may be dropped,</para>
/// <para>/ received out of order with respect to each other and with respect to reliable data,</para>
/// <para>/ or may be received multiple times. Messages on different channels are *not* guaranteed</para>
/// <para>/ to be received in the order they were sent.</para>
/// <para>/</para>
/// <para>/ A note for those familiar with TCP/IP ports, or converting an existing codebase that</para>
/// <para>/ opened multiple sockets: You might notice that there is only one channel, and with</para>
/// <para>/ TCP/IP each endpoint has a port number. You can think of the channel number as the</para>
/// <para>/ *destination* port. If you need each message to also include a "source port" (so the</para>
/// <para>/ recipient can route the reply), then just put that in your message. That is essentially</para>
/// <para>/ how UDP works!</para>
/// <para>/</para>
/// <para>/ Returns:</para>
/// <para>/ - k_EREsultOK on success.</para>
/// <para>/ - k_EResultNoConnection, if the session has failed or was closed by the peer and</para>
/// <para>/ k_nSteamNetworkingSend_AutoRestartBrokenSession was not specified. (You can</para>
/// <para>/ use GetSessionConnectionInfo to get the details.) In order to acknowledge the</para>
/// <para>/ broken session and start a new one, you must call CloseSessionWithUser, or you may</para>
/// <para>/ repeat the call with k_nSteamNetworkingSend_AutoRestartBrokenSession. See</para>
/// <para>/ k_nSteamNetworkingSend_AutoRestartBrokenSession for more details.</para>
/// <para>/ - See ISteamNetworkingSockets::SendMessageToConnection for more possible return values</para>
/// </summary>
public static EResult SendMessageToUser(ref SteamNetworkingIdentity identityRemote, IntPtr pubData, uint cubData, int nSendFlags, int nRemoteChannel) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingMessages_SendMessageToUser(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote, pubData, cubData, nSendFlags, nRemoteChannel);
}
/// <summary>
/// <para>/ Reads the next message that has been sent from another user via SendMessageToUser() on the given channel.</para>
/// <para>/ Returns number of messages returned into your list. (0 if no message are available on that channel.)</para>
/// <para>/</para>
/// <para>/ When you're done with the message object(s), make sure and call SteamNetworkingMessage_t::Release()!</para>
/// </summary>
public static int ReceiveMessagesOnChannel(int nLocalChannel, IntPtr[] ppOutMessages, int nMaxMessages) {
InteropHelp.TestIfAvailableClient();
if (ppOutMessages != null && ppOutMessages.Length != nMaxMessages) {
throw new System.ArgumentException("ppOutMessages must be the same size as nMaxMessages!");
}
return NativeMethods.ISteamNetworkingMessages_ReceiveMessagesOnChannel(CSteamAPIContext.GetSteamNetworkingMessages(), nLocalChannel, ppOutMessages, nMaxMessages);
}
/// <summary>
/// <para>/ Call this in response to a SteamNetworkingMessagesSessionRequest_t callback.</para>
/// <para>/ SteamNetworkingMessagesSessionRequest_t are posted when a user tries to send you a message,</para>
/// <para>/ and you haven't tried to talk to them first. If you don't want to talk to them, just ignore</para>
/// <para>/ the request. If the user continues to send you messages, SteamNetworkingMessagesSessionRequest_t</para>
/// <para>/ callbacks will continue to be posted periodically.</para>
/// <para>/</para>
/// <para>/ Returns false if there is no session with the user pending or otherwise. If there is an</para>
/// <para>/ existing active session, this function will return true, even if it is not pending.</para>
/// <para>/</para>
/// <para>/ Calling SendMessageToUser() will implicitly accepts any pending session request to that user.</para>
/// </summary>
public static bool AcceptSessionWithUser(ref SteamNetworkingIdentity identityRemote) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingMessages_AcceptSessionWithUser(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote);
}
/// <summary>
/// <para>/ Call this when you're done talking to a user to immediately free up resources under-the-hood.</para>
/// <para>/ If the remote user tries to send data to you again, another SteamNetworkingMessagesSessionRequest_t</para>
/// <para>/ callback will be posted.</para>
/// <para>/</para>
/// <para>/ Note that sessions that go unused for a few minutes are automatically timed out.</para>
/// </summary>
public static bool CloseSessionWithUser(ref SteamNetworkingIdentity identityRemote) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingMessages_CloseSessionWithUser(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote);
}
/// <summary>
/// <para>/ Call this when you're done talking to a user on a specific channel. Once all</para>
/// <para>/ open channels to a user have been closed, the open session to the user will be</para>
/// <para>/ closed, and any new data from this user will trigger a</para>
/// <para>/ SteamSteamNetworkingMessagesSessionRequest_t callback</para>
/// </summary>
public static bool CloseChannelWithUser(ref SteamNetworkingIdentity identityRemote, int nLocalChannel) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingMessages_CloseChannelWithUser(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote, nLocalChannel);
}
/// <summary>
/// <para>/ Returns information about the latest state of a connection, if any, with the given peer.</para>
/// <para>/ Primarily intended for debugging purposes, but can also be used to get more detailed</para>
/// <para>/ failure information. (See SendMessageToUser and k_nSteamNetworkingSend_AutoRestartBrokenSession.)</para>
/// <para>/</para>
/// <para>/ Returns the value of SteamNetConnectionInfo_t::m_eState, or k_ESteamNetworkingConnectionState_None</para>
/// <para>/ if no connection exists with specified peer. You may pass nullptr for either parameter if</para>
/// <para>/ you do not need the corresponding details. Note that sessions time out after a while,</para>
/// <para>/ so if a connection fails, or SendMessageToUser returns k_EResultNoConnection, you cannot wait</para>
/// <para>/ indefinitely to obtain the reason for failure.</para>
/// </summary>
public static ESteamNetworkingConnectionState GetSessionConnectionInfo(ref SteamNetworkingIdentity identityRemote, out SteamNetConnectionInfo_t pConnectionInfo, out SteamNetConnectionRealTimeStatus_t pQuickStatus) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingMessages_GetSessionConnectionInfo(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote, out pConnectionInfo, out pQuickStatus);
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: abf31235e5c3e35459961b3c09239003
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b14ddce873fdbfc4aab2f5e4dafc27aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,443 @@
// 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 SteamNetworkingUtils {
/// <summary>
/// <para> Efficient message sending</para>
/// <para>/ Allocate and initialize a message object. Usually the reason</para>
/// <para>/ you call this is to pass it to ISteamNetworkingSockets::SendMessages.</para>
/// <para>/ The returned object will have all of the relevant fields cleared to zero.</para>
/// <para>/</para>
/// <para>/ Optionally you can also request that this system allocate space to</para>
/// <para>/ hold the payload itself. If cbAllocateBuffer is nonzero, the system</para>
/// <para>/ will allocate memory to hold a payload of at least cbAllocateBuffer bytes.</para>
/// <para>/ m_pData will point to the allocated buffer, m_cbSize will be set to the</para>
/// <para>/ size, and m_pfnFreeData will be set to the proper function to free up</para>
/// <para>/ the buffer.</para>
/// <para>/</para>
/// <para>/ If cbAllocateBuffer=0, then no buffer is allocated. m_pData will be NULL,</para>
/// <para>/ m_cbSize will be zero, and m_pfnFreeData will be NULL. You will need to</para>
/// <para>/ set each of these.</para>
/// </summary>
public static IntPtr AllocateMessage(int cbAllocateBuffer) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_AllocateMessage(CSteamAPIContext.GetSteamNetworkingUtils(), cbAllocateBuffer);
}
/// <summary>
/// <para> Access to Steam Datagram Relay (SDR) network</para>
/// <para> Initialization and status check</para>
/// <para>/ If you know that you are going to be using the relay network (for example,</para>
/// <para>/ because you anticipate making P2P connections), call this to initialize the</para>
/// <para>/ relay network. If you do not call this, the initialization will</para>
/// <para>/ be delayed until the first time you use a feature that requires access</para>
/// <para>/ to the relay network, which will delay that first access.</para>
/// <para>/</para>
/// <para>/ You can also call this to force a retry if the previous attempt has failed.</para>
/// <para>/ Performing any action that requires access to the relay network will also</para>
/// <para>/ trigger a retry, and so calling this function is never strictly necessary,</para>
/// <para>/ but it can be useful to call it a program launch time, if access to the</para>
/// <para>/ relay network is anticipated.</para>
/// <para>/</para>
/// <para>/ Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t</para>
/// <para>/ callbacks to know when initialization has completed.</para>
/// <para>/ Typically initialization completes in a few seconds.</para>
/// <para>/</para>
/// <para>/ Note: dedicated servers hosted in known data centers do *not* need</para>
/// <para>/ to call this, since they do not make routing decisions. However, if</para>
/// <para>/ the dedicated server will be using P2P functionality, it will act as</para>
/// <para>/ a "client" and this should be called.</para>
/// </summary>
public static void InitRelayNetworkAccess() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamNetworkingUtils_InitRelayNetworkAccess(CSteamAPIContext.GetSteamNetworkingUtils());
}
/// <summary>
/// <para>/ Fetch current status of the relay network.</para>
/// <para>/</para>
/// <para>/ SteamRelayNetworkStatus_t is also a callback. It will be triggered on</para>
/// <para>/ both the user and gameserver interfaces any time the status changes, or</para>
/// <para>/ ping measurement starts or stops.</para>
/// <para>/</para>
/// <para>/ SteamRelayNetworkStatus_t::m_eAvail is returned. If you want</para>
/// <para>/ more details, you can pass a non-NULL value.</para>
/// </summary>
public static ESteamNetworkingAvailability GetRelayNetworkStatus(out SteamRelayNetworkStatus_t pDetails) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetRelayNetworkStatus(CSteamAPIContext.GetSteamNetworkingUtils(), out pDetails);
}
/// <summary>
/// <para> "Ping location" functions</para>
/// <para> We use the ping times to the valve relays deployed worldwide to</para>
/// <para> generate a "marker" that describes the location of an Internet host.</para>
/// <para> Given two such markers, we can estimate the network latency between</para>
/// <para> two hosts, without sending any packets. The estimate is based on the</para>
/// <para> optimal route that is found through the Valve network. If you are</para>
/// <para> using the Valve network to carry the traffic, then this is precisely</para>
/// <para> the ping you want. If you are not, then the ping time will probably</para>
/// <para> still be a reasonable estimate.</para>
/// <para> This is extremely useful to select peers for matchmaking!</para>
/// <para> The markers can also be converted to a string, so they can be transmitted.</para>
/// <para> We have a separate library you can use on your app's matchmaking/coordinating</para>
/// <para> server to manipulate these objects. (See steamdatagram_gamecoordinator.h)</para>
/// <para>/ Return location info for the current host. Returns the approximate</para>
/// <para>/ age of the data, in seconds, or -1 if no data is available.</para>
/// <para>/</para>
/// <para>/ It takes a few seconds to initialize access to the relay network. If</para>
/// <para>/ you call this very soon after calling InitRelayNetworkAccess,</para>
/// <para>/ the data may not be available yet.</para>
/// <para>/</para>
/// <para>/ This always return the most up-to-date information we have available</para>
/// <para>/ right now, even if we are in the middle of re-calculating ping times.</para>
/// </summary>
public static float GetLocalPingLocation(out SteamNetworkPingLocation_t result) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetLocalPingLocation(CSteamAPIContext.GetSteamNetworkingUtils(), out result);
}
/// <summary>
/// <para>/ Estimate the round-trip latency between two arbitrary locations, in</para>
/// <para>/ milliseconds. This is a conservative estimate, based on routing through</para>
/// <para>/ the relay network. For most basic relayed connections, this ping time</para>
/// <para>/ will be pretty accurate, since it will be based on the route likely to</para>
/// <para>/ be actually used.</para>
/// <para>/</para>
/// <para>/ If a direct IP route is used (perhaps via NAT traversal), then the route</para>
/// <para>/ will be different, and the ping time might be better. Or it might actually</para>
/// <para>/ be a bit worse! Standard IP routing is frequently suboptimal!</para>
/// <para>/</para>
/// <para>/ But even in this case, the estimate obtained using this method is a</para>
/// <para>/ reasonable upper bound on the ping time. (Also it has the advantage</para>
/// <para>/ of returning immediately and not sending any packets.)</para>
/// <para>/</para>
/// <para>/ In a few cases we might not able to estimate the route. In this case</para>
/// <para>/ a negative value is returned. k_nSteamNetworkingPing_Failed means</para>
/// <para>/ the reason was because of some networking difficulty. (Failure to</para>
/// <para>/ ping, etc) k_nSteamNetworkingPing_Unknown is returned if we cannot</para>
/// <para>/ currently answer the question for some other reason.</para>
/// <para>/</para>
/// <para>/ Do you need to be able to do this from a backend/matchmaking server?</para>
/// <para>/ You are looking for the "game coordinator" library.</para>
/// </summary>
public static int EstimatePingTimeBetweenTwoLocations(ref SteamNetworkPingLocation_t location1, ref SteamNetworkPingLocation_t location2) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_EstimatePingTimeBetweenTwoLocations(CSteamAPIContext.GetSteamNetworkingUtils(), ref location1, ref location2);
}
/// <summary>
/// <para>/ Same as EstimatePingTime, but assumes that one location is the local host.</para>
/// <para>/ This is a bit faster, especially if you need to calculate a bunch of</para>
/// <para>/ these in a loop to find the fastest one.</para>
/// <para>/</para>
/// <para>/ In rare cases this might return a slightly different estimate than combining</para>
/// <para>/ GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations. That's because</para>
/// <para>/ this function uses a slightly more complete set of information about what</para>
/// <para>/ route would be taken.</para>
/// </summary>
public static int EstimatePingTimeFromLocalHost(ref SteamNetworkPingLocation_t remoteLocation) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_EstimatePingTimeFromLocalHost(CSteamAPIContext.GetSteamNetworkingUtils(), ref remoteLocation);
}
/// <summary>
/// <para>/ Convert a ping location into a text format suitable for sending over the wire.</para>
/// <para>/ The format is a compact and human readable. However, it is subject to change</para>
/// <para>/ so please do not parse it yourself. Your buffer must be at least</para>
/// <para>/ k_cchMaxSteamNetworkingPingLocationString bytes.</para>
/// </summary>
public static void ConvertPingLocationToString(ref SteamNetworkPingLocation_t location, out string pszBuf, int cchBufSize) {
InteropHelp.TestIfAvailableClient();
IntPtr pszBuf2 = Marshal.AllocHGlobal(cchBufSize);
NativeMethods.ISteamNetworkingUtils_ConvertPingLocationToString(CSteamAPIContext.GetSteamNetworkingUtils(), ref location, pszBuf2, cchBufSize);
pszBuf = InteropHelp.PtrToStringUTF8(pszBuf2);
Marshal.FreeHGlobal(pszBuf2);
}
/// <summary>
/// <para>/ Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand</para>
/// <para>/ the string.</para>
/// </summary>
public static bool ParsePingLocationString(string pszString, out SteamNetworkPingLocation_t result) {
InteropHelp.TestIfAvailableClient();
using (var pszString2 = new InteropHelp.UTF8StringHandle(pszString)) {
return NativeMethods.ISteamNetworkingUtils_ParsePingLocationString(CSteamAPIContext.GetSteamNetworkingUtils(), pszString2, out result);
}
}
/// <summary>
/// <para>/ Check if the ping data of sufficient recency is available, and if</para>
/// <para>/ it's too old, start refreshing it.</para>
/// <para>/</para>
/// <para>/ Please only call this function when you *really* do need to force an</para>
/// <para>/ immediate refresh of the data. (For example, in response to a specific</para>
/// <para>/ user input to refresh this information.) Don't call it "just in case",</para>
/// <para>/ before every connection, etc. That will cause extra traffic to be sent</para>
/// <para>/ for no benefit. The library will automatically refresh the information</para>
/// <para>/ as needed.</para>
/// <para>/</para>
/// <para>/ Returns true if sufficiently recent data is already available.</para>
/// <para>/</para>
/// <para>/ Returns false if sufficiently recent data is not available. In this</para>
/// <para>/ case, ping measurement is initiated, if it is not already active.</para>
/// <para>/ (You cannot restart a measurement already in progress.)</para>
/// <para>/</para>
/// <para>/ You can use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t</para>
/// <para>/ to know when ping measurement completes.</para>
/// </summary>
public static bool CheckPingDataUpToDate(float flMaxAgeSeconds) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_CheckPingDataUpToDate(CSteamAPIContext.GetSteamNetworkingUtils(), flMaxAgeSeconds);
}
/// <summary>
/// <para> List of Valve data centers, and ping times to them. This might</para>
/// <para> be useful to you if you are use our hosting, or just need to measure</para>
/// <para> latency to a cloud data center where we are running relays.</para>
/// <para>/ Fetch ping time of best available relayed route from this host to</para>
/// <para>/ the specified data center.</para>
/// </summary>
public static int GetPingToDataCenter(SteamNetworkingPOPID popID, out SteamNetworkingPOPID pViaRelayPoP) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetPingToDataCenter(CSteamAPIContext.GetSteamNetworkingUtils(), popID, out pViaRelayPoP);
}
/// <summary>
/// <para>/ Get *direct* ping time to the relays at the data center.</para>
/// </summary>
public static int GetDirectPingToPOP(SteamNetworkingPOPID popID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetDirectPingToPOP(CSteamAPIContext.GetSteamNetworkingUtils(), popID);
}
/// <summary>
/// <para>/ Get number of network points of presence in the config</para>
/// </summary>
public static int GetPOPCount() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetPOPCount(CSteamAPIContext.GetSteamNetworkingUtils());
}
/// <summary>
/// <para>/ Get list of all POP IDs. Returns the number of entries that were filled into</para>
/// <para>/ your list.</para>
/// </summary>
public static int GetPOPList(out SteamNetworkingPOPID list, int nListSz) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetPOPList(CSteamAPIContext.GetSteamNetworkingUtils(), out list, nListSz);
}
/// <summary>
/// <para> Misc</para>
/// <para>/ Fetch current timestamp. This timer has the following properties:</para>
/// <para>/</para>
/// <para>/ - Monotonicity is guaranteed.</para>
/// <para>/ - The initial value will be at least 24*3600*30*1e6, i.e. about</para>
/// <para>/ 30 days worth of microseconds. In this way, the timestamp value of</para>
/// <para>/ 0 will always be at least "30 days ago". Also, negative numbers</para>
/// <para>/ will never be returned.</para>
/// <para>/ - Wraparound / overflow is not a practical concern.</para>
/// <para>/</para>
/// <para>/ If you are running under the debugger and stop the process, the clock</para>
/// <para>/ might not advance the full wall clock time that has elapsed between</para>
/// <para>/ calls. If the process is not blocked from normal operation, the</para>
/// <para>/ timestamp values will track wall clock time, even if you don't call</para>
/// <para>/ the function frequently.</para>
/// <para>/</para>
/// <para>/ The value is only meaningful for this run of the process. Don't compare</para>
/// <para>/ it to values obtained on another computer, or other runs of the same process.</para>
/// </summary>
public static SteamNetworkingMicroseconds GetLocalTimestamp() {
InteropHelp.TestIfAvailableClient();
return (SteamNetworkingMicroseconds)NativeMethods.ISteamNetworkingUtils_GetLocalTimestamp(CSteamAPIContext.GetSteamNetworkingUtils());
}
/// <summary>
/// <para>/ Set a function to receive network-related information that is useful for debugging.</para>
/// <para>/ This can be very useful during development, but it can also be useful for troubleshooting</para>
/// <para>/ problems with tech savvy end users. If you have a console or other log that customers</para>
/// <para>/ can examine, these log messages can often be helpful to troubleshoot network issues.</para>
/// <para>/ (Especially any warning/error messages.)</para>
/// <para>/</para>
/// <para>/ The detail level indicates what message to invoke your callback on. Lower numeric</para>
/// <para>/ value means more important, and the value you pass is the lowest priority (highest</para>
/// <para>/ numeric value) you wish to receive callbacks for.</para>
/// <para>/</para>
/// <para>/ The value here controls the detail level for most messages. You can control the</para>
/// <para>/ detail level for various subsystems (perhaps only for certain connections) by</para>
/// <para>/ adjusting the configuration values k_ESteamNetworkingConfig_LogLevel_Xxxxx.</para>
/// <para>/</para>
/// <para>/ Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg</para>
/// <para>/ or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT</para>
/// <para>/ request a high detail level and then filter out messages in your callback. This incurs</para>
/// <para>/ all of the expense of formatting the messages, which are then discarded. Setting a high</para>
/// <para>/ priority value (low numeric value) here allows the library to avoid doing this work.</para>
/// <para>/</para>
/// <para>/ IMPORTANT: This may be called from a service thread, while we own a mutex, etc.</para>
/// <para>/ Your output function must be threadsafe and fast! Do not make any other</para>
/// <para>/ Steamworks calls from within the handler.</para>
/// </summary>
public static void SetDebugOutputFunction(ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc) {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamNetworkingUtils_SetDebugOutputFunction(CSteamAPIContext.GetSteamNetworkingUtils(), eDetailLevel, pfnFunc);
}
/// <summary>
/// <para> Fake IP</para>
/// <para> Useful for interfacing with code that assumes peers are identified using an IPv4 address</para>
/// <para>/ Return true if an IPv4 address is one that might be used as a "fake" one.</para>
/// <para>/ This function is fast; it just does some logical tests on the IP and does</para>
/// <para>/ not need to do any lookup operations.</para>
/// </summary>
public static bool IsFakeIPv4(uint nIPv4) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_IsFakeIPv4(CSteamAPIContext.GetSteamNetworkingUtils(), nIPv4);
}
public static ESteamNetworkingFakeIPType GetIPv4FakeIPType(uint nIPv4) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetIPv4FakeIPType(CSteamAPIContext.GetSteamNetworkingUtils(), nIPv4);
}
/// <summary>
/// <para>/ Get the real identity associated with a given FakeIP.</para>
/// <para>/</para>
/// <para>/ On failure, returns:</para>
/// <para>/ - k_EResultInvalidParam: the IP is not a FakeIP.</para>
/// <para>/ - k_EResultNoMatch: we don't recognize that FakeIP and don't know the corresponding identity.</para>
/// <para>/</para>
/// <para>/ FakeIP's used by active connections, or the FakeIPs assigned to local identities,</para>
/// <para>/ will always work. FakeIPs for recently destroyed connections will continue to</para>
/// <para>/ return results for a little while, but not forever. At some point, we will forget</para>
/// <para>/ FakeIPs to save space. It's reasonably safe to assume that you can read back the</para>
/// <para>/ real identity of a connection very soon after it is destroyed. But do not wait</para>
/// <para>/ indefinitely.</para>
/// </summary>
public static EResult GetRealIdentityForFakeIP(ref SteamNetworkingIPAddr fakeIP, out SteamNetworkingIdentity pOutRealIdentity) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetRealIdentityForFakeIP(CSteamAPIContext.GetSteamNetworkingUtils(), ref fakeIP, out pOutRealIdentity);
}
/// <summary>
/// <para> Set and get configuration values, see ESteamNetworkingConfigValue for individual descriptions.</para>
/// <para> Shortcuts for common cases. (Implemented as inline functions below)</para>
/// <para> Set global callbacks. If you do not want to use Steam's callback dispatch mechanism and you</para>
/// <para> want to use the same callback on all (or most) listen sockets and connections, then</para>
/// <para> simply install these callbacks first thing, and you are good to go.</para>
/// <para> See ISteamNetworkingSockets::RunCallbacks</para>
/// <para>/ Set a configuration value.</para>
/// <para>/ - eValue: which value is being set</para>
/// <para>/ - eScope: Onto what type of object are you applying the setting?</para>
/// <para>/ - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc.</para>
/// <para>/ - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly!</para>
/// <para>/ - pArg: Value to set it to. You can pass NULL to remove a non-global setting at this scope,</para>
/// <para>/ causing the value for that object to use global defaults. Or at global scope, passing NULL</para>
/// <para>/ will reset any custom value and restore it to the system default.</para>
/// <para>/ NOTE: When setting pointers (e.g. callback functions), do not pass the function pointer directly.</para>
/// <para>/ Your argument should be a pointer to a function pointer.</para>
/// </summary>
public static bool SetConfigValue(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, IntPtr scopeObj, ESteamNetworkingConfigDataType eDataType, IntPtr pArg) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_SetConfigValue(CSteamAPIContext.GetSteamNetworkingUtils(), eValue, eScopeType, scopeObj, eDataType, pArg);
}
/// <summary>
/// <para>/ Set a configuration value, using a struct to pass the value.</para>
/// <para>/ (This is just a convenience shortcut; see below for the implementation and</para>
/// <para>/ a little insight into how SteamNetworkingConfigValue_t is used when</para>
/// <para>/ setting config options during listen socket and connection creation.)</para>
/// <para>/ Get a configuration value.</para>
/// <para>/ - eValue: which value to fetch</para>
/// <para>/ - eScopeType: query setting on what type of object</para>
/// <para>/ - eScopeArg: the object to query the setting for</para>
/// <para>/ - pOutDataType: If non-NULL, the data type of the value is returned.</para>
/// <para>/ - pResult: Where to put the result. Pass NULL to query the required buffer size. (k_ESteamNetworkingGetConfigValue_BufferTooSmall will be returned.)</para>
/// <para>/ - cbResult: IN: the size of your buffer. OUT: the number of bytes filled in or required.</para>
/// </summary>
public static ESteamNetworkingGetConfigValueResult GetConfigValue(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, IntPtr scopeObj, out ESteamNetworkingConfigDataType pOutDataType, IntPtr pResult, ref ulong cbResult) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_GetConfigValue(CSteamAPIContext.GetSteamNetworkingUtils(), eValue, eScopeType, scopeObj, out pOutDataType, pResult, ref cbResult);
}
/// <summary>
/// <para>/ Get info about a configuration value. Returns the name of the value,</para>
/// <para>/ or NULL if the value doesn't exist. Other output parameters can be NULL</para>
/// <para>/ if you do not need them.</para>
/// </summary>
public static string GetConfigValueInfo(ESteamNetworkingConfigValue eValue, out ESteamNetworkingConfigDataType pOutDataType, out ESteamNetworkingConfigScope pOutScope) {
InteropHelp.TestIfAvailableClient();
return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamNetworkingUtils_GetConfigValueInfo(CSteamAPIContext.GetSteamNetworkingUtils(), eValue, out pOutDataType, out pOutScope));
}
/// <summary>
/// <para>/ Iterate the list of all configuration values in the current environment that it might</para>
/// <para>/ be possible to display or edit using a generic UI. To get the first iterable value,</para>
/// <para>/ pass k_ESteamNetworkingConfig_Invalid. Returns k_ESteamNetworkingConfig_Invalid</para>
/// <para>/ to signal end of list.</para>
/// <para>/</para>
/// <para>/ The bEnumerateDevVars argument can be used to include "dev" vars. These are vars that</para>
/// <para>/ are recommended to only be editable in "debug" or "dev" mode and typically should not be</para>
/// <para>/ shown in a retail environment where a malicious local user might use this to cheat.</para>
/// </summary>
public static ESteamNetworkingConfigValue IterateGenericEditableConfigValues(ESteamNetworkingConfigValue eCurrent, bool bEnumerateDevVars) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_IterateGenericEditableConfigValues(CSteamAPIContext.GetSteamNetworkingUtils(), eCurrent, bEnumerateDevVars);
}
/// <summary>
/// <para> String conversions. You'll usually access these using the respective</para>
/// <para> inline methods.</para>
/// </summary>
public static void SteamNetworkingIPAddr_ToString(ref SteamNetworkingIPAddr addr, out string buf, uint cbBuf, bool bWithPort) {
InteropHelp.TestIfAvailableClient();
IntPtr buf2 = Marshal.AllocHGlobal((int)cbBuf);
NativeMethods.ISteamNetworkingUtils_SteamNetworkingIPAddr_ToString(CSteamAPIContext.GetSteamNetworkingUtils(), ref addr, buf2, cbBuf, bWithPort);
buf = InteropHelp.PtrToStringUTF8(buf2);
Marshal.FreeHGlobal(buf2);
}
public static bool SteamNetworkingIPAddr_ParseString(out SteamNetworkingIPAddr pAddr, string pszStr) {
InteropHelp.TestIfAvailableClient();
using (var pszStr2 = new InteropHelp.UTF8StringHandle(pszStr)) {
return NativeMethods.ISteamNetworkingUtils_SteamNetworkingIPAddr_ParseString(CSteamAPIContext.GetSteamNetworkingUtils(), out pAddr, pszStr2);
}
}
public static ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType(ref SteamNetworkingIPAddr addr) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamNetworkingUtils_SteamNetworkingIPAddr_GetFakeIPType(CSteamAPIContext.GetSteamNetworkingUtils(), ref addr);
}
public static void SteamNetworkingIdentity_ToString(ref SteamNetworkingIdentity identity, out string buf, uint cbBuf) {
InteropHelp.TestIfAvailableClient();
IntPtr buf2 = Marshal.AllocHGlobal((int)cbBuf);
NativeMethods.ISteamNetworkingUtils_SteamNetworkingIdentity_ToString(CSteamAPIContext.GetSteamNetworkingUtils(), ref identity, buf2, cbBuf);
buf = InteropHelp.PtrToStringUTF8(buf2);
Marshal.FreeHGlobal(buf2);
}
public static bool SteamNetworkingIdentity_ParseString(out SteamNetworkingIdentity pIdentity, string pszStr) {
InteropHelp.TestIfAvailableClient();
using (var pszStr2 = new InteropHelp.UTF8StringHandle(pszStr)) {
return NativeMethods.ISteamNetworkingUtils_SteamNetworkingIdentity_ParseString(CSteamAPIContext.GetSteamNetworkingUtils(), out pIdentity, pszStr2);
}
}
}
}
#endif // !DISABLESTEAMWORKS

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28bd6c2bd8eef784abca992dc6409c98
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,51 @@
// 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 SteamParentalSettings {
public static bool BIsParentalLockEnabled() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParentalSettings_BIsParentalLockEnabled(CSteamAPIContext.GetSteamParentalSettings());
}
public static bool BIsParentalLockLocked() {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParentalSettings_BIsParentalLockLocked(CSteamAPIContext.GetSteamParentalSettings());
}
public static bool BIsAppBlocked(AppId_t nAppID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParentalSettings_BIsAppBlocked(CSteamAPIContext.GetSteamParentalSettings(), nAppID);
}
public static bool BIsAppInBlockList(AppId_t nAppID) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParentalSettings_BIsAppInBlockList(CSteamAPIContext.GetSteamParentalSettings(), nAppID);
}
public static bool BIsFeatureBlocked(EParentalFeature eFeature) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParentalSettings_BIsFeatureBlocked(CSteamAPIContext.GetSteamParentalSettings(), eFeature);
}
public static bool BIsFeatureInBlockList(EParentalFeature eFeature) {
InteropHelp.TestIfAvailableClient();
return NativeMethods.ISteamParentalSettings_BIsFeatureInBlockList(CSteamAPIContext.GetSteamParentalSettings(), eFeature);
}
}
}
#endif // !DISABLESTEAMWORKS

Some files were not shown because too many files have changed in this diff Show More