(61d00a474) v0.9.7.1
This commit is contained in:
@@ -1,226 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Facepunch.Steamworks.Interop;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements shared functionality between Steamworks.Client and Steamworks.Server
|
||||
/// </summary>
|
||||
public class BaseSteamworks : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Current running program's AppId
|
||||
/// </summary>
|
||||
public uint AppId { get; internal set; }
|
||||
|
||||
public Networking Networking { get; internal set; }
|
||||
public Inventory Inventory { get; internal set; }
|
||||
public Workshop Workshop { get; internal set; }
|
||||
|
||||
internal event Action OnUpdate;
|
||||
|
||||
internal Interop.NativeInterface native;
|
||||
|
||||
private List<SteamNative.CallbackHandle> CallbackHandles = new List<SteamNative.CallbackHandle>();
|
||||
private List<SteamNative.CallResult> CallResults = new List<SteamNative.CallResult>();
|
||||
protected bool disposed = false;
|
||||
|
||||
|
||||
protected BaseSteamworks( uint appId )
|
||||
{
|
||||
AppId = appId;
|
||||
|
||||
//
|
||||
// No need for the "steam_appid.txt" file any more
|
||||
//
|
||||
System.Environment.SetEnvironmentVariable("SteamAppId", AppId.ToString());
|
||||
System.Environment.SetEnvironmentVariable("SteamGameId", AppId.ToString());
|
||||
}
|
||||
|
||||
~BaseSteamworks()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
if ( disposed ) return;
|
||||
|
||||
Callbacks.Clear();
|
||||
|
||||
foreach ( var h in CallbackHandles )
|
||||
{
|
||||
h.Dispose();
|
||||
}
|
||||
CallbackHandles.Clear();
|
||||
|
||||
foreach ( var h in CallResults )
|
||||
{
|
||||
h.Dispose();
|
||||
}
|
||||
CallResults.Clear();
|
||||
|
||||
if ( Workshop != null )
|
||||
{
|
||||
Workshop.Dispose();
|
||||
Workshop = null;
|
||||
}
|
||||
|
||||
if ( Inventory != null )
|
||||
{
|
||||
Inventory.Dispose();
|
||||
Inventory = null;
|
||||
}
|
||||
|
||||
if ( Networking != null )
|
||||
{
|
||||
Networking.Dispose();
|
||||
Networking = null;
|
||||
}
|
||||
|
||||
if ( native != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
native.Dispose();
|
||||
}
|
||||
catch (DllNotFoundException e)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Disposing SteamWorks NativeInterface failed (" + e.Message + ")\n" + e.StackTrace);
|
||||
}
|
||||
native = null;
|
||||
}
|
||||
|
||||
System.Environment.SetEnvironmentVariable("SteamAppId", null );
|
||||
System.Environment.SetEnvironmentVariable("SteamGameId", null );
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
protected void SetupCommonInterfaces()
|
||||
{
|
||||
Networking = new Steamworks.Networking( this, native.networking );
|
||||
Inventory = new Steamworks.Inventory( this, native.inventory, IsGameServer );
|
||||
Workshop = new Steamworks.Workshop( this, native.ugc, native.remoteStorage );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this instance has initialized properly.
|
||||
/// If this returns false you should Dispose and throw an error.
|
||||
/// </summary>
|
||||
public bool IsValid
|
||||
{
|
||||
get { return native != null; }
|
||||
}
|
||||
|
||||
|
||||
internal virtual bool IsGameServer { get { return false; } }
|
||||
|
||||
internal void RegisterCallbackHandle( SteamNative.CallbackHandle handle )
|
||||
{
|
||||
CallbackHandles.Add( handle );
|
||||
}
|
||||
|
||||
internal void RegisterCallResult( SteamNative.CallResult handle )
|
||||
{
|
||||
CallResults.Add( handle );
|
||||
}
|
||||
|
||||
internal void UnregisterCallResult( SteamNative.CallResult handle )
|
||||
{
|
||||
CallResults.Remove( handle );
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
Networking.Update();
|
||||
|
||||
RunUpdateCallbacks();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This gets called automatically in Update. Only call it manually if you know why you're doing it.
|
||||
/// </summary>
|
||||
public void RunUpdateCallbacks()
|
||||
{
|
||||
if ( OnUpdate != null )
|
||||
OnUpdate();
|
||||
|
||||
for( int i=0; i < CallResults.Count; i++ )
|
||||
{
|
||||
CallResults[i].Try();
|
||||
}
|
||||
|
||||
//
|
||||
// The SourceServerQuery's happen in another thread, so we
|
||||
// query them to see if they're finished, and if so post a callback
|
||||
// in our main thread. This will all suck less once we have async.
|
||||
//
|
||||
Facepunch.Steamworks.SourceServerQuery.Cycle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run Update until func returns false.
|
||||
/// This will cause your program to lock up until it finishes.
|
||||
/// This is useful for things like tests or command line utilities etc.
|
||||
/// </summary>
|
||||
public void UpdateWhile( Func<bool> func )
|
||||
{
|
||||
const int sleepMs = 1;
|
||||
|
||||
while ( func() )
|
||||
{
|
||||
Update();
|
||||
#if NET_CORE
|
||||
System.Threading.Tasks.Task.Delay( sleepMs ).Wait();
|
||||
#else
|
||||
System.Threading.Thread.Sleep( sleepMs );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Debug function, called for every callback. Only really used to confirm that callbacks are working properly.
|
||||
/// </summary>
|
||||
public Action<object> OnAnyCallback;
|
||||
|
||||
Dictionary<Type, List<Action<object>>> Callbacks = new Dictionary<Type, List<Action<object>>>();
|
||||
|
||||
internal List<Action<object>> CallbackList( Type T )
|
||||
{
|
||||
List<Action<object>> list = null;
|
||||
|
||||
if ( !Callbacks.TryGetValue( T, out list ) )
|
||||
{
|
||||
list = new List<Action<object>>();
|
||||
Callbacks[T] = list;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
internal void OnCallback<T>( T data )
|
||||
{
|
||||
var list = CallbackList( typeof( T ) );
|
||||
|
||||
foreach ( var i in list )
|
||||
{
|
||||
i( data );
|
||||
}
|
||||
|
||||
if ( OnAnyCallback != null )
|
||||
{
|
||||
OnAnyCallback.Invoke( data );
|
||||
}
|
||||
}
|
||||
|
||||
internal void RegisterCallback<T>( Action<T> func )
|
||||
{
|
||||
var list = CallbackList( typeof( T ) );
|
||||
list.Add( ( o ) => func( (T) o ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal partial class Callback
|
||||
{
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
public delegate void Run( IntPtr thisptr, IntPtr pvParam );
|
||||
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
public delegate void RunCall( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
|
||||
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
public delegate int GetCallbackSizeBytes( IntPtr thisptr );
|
||||
|
||||
internal enum Flags : byte
|
||||
{
|
||||
Registered = 0x01,
|
||||
GameServer = 0x02
|
||||
}
|
||||
|
||||
public IntPtr vTablePtr;
|
||||
public byte CallbackFlags;
|
||||
public int CallbackId;
|
||||
|
||||
//
|
||||
// These are functions that are on CCallback but are never called
|
||||
// We could just send a IntPtr.Zero but it's probably safer to throw a
|
||||
// big apeshit message if steam changes its behaviour at some point
|
||||
//
|
||||
[MonoPInvokeCallback]
|
||||
internal static void RunStub( IntPtr self, IntPtr param, bool failure, SteamAPICall_t call ) =>
|
||||
throw new System.Exception( "Something changed in the Steam API and now CCallbackBack is calling the CallResult function [Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall )]" );
|
||||
|
||||
[MonoPInvokeCallback]
|
||||
internal static int SizeStub( IntPtr self ) =>
|
||||
throw new System.Exception( "Something changed in the Steam API and now CCallbackBack is calling the GetSize function [GetCallbackSizeBytes()]" );
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using Steamworks.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
//
|
||||
// Created on registration of a callback
|
||||
//
|
||||
internal class Event : IDisposable
|
||||
{
|
||||
internal static List<IDisposable> AllClient = new List<IDisposable>();
|
||||
internal static List<IDisposable> AllServer = new List<IDisposable>();
|
||||
|
||||
internal static void DisposeAllClient()
|
||||
{
|
||||
foreach ( var a in AllClient.ToArray() )
|
||||
{
|
||||
a.Dispose();
|
||||
}
|
||||
|
||||
AllClient.Clear();
|
||||
}
|
||||
|
||||
internal static void DisposeAllServer()
|
||||
{
|
||||
foreach ( var a in AllServer.ToArray() )
|
||||
{
|
||||
a.Dispose();
|
||||
}
|
||||
|
||||
AllServer.Clear();
|
||||
}
|
||||
|
||||
internal static void Register( Callback.Run func, int size, int callbackId, bool gameserver )
|
||||
{
|
||||
var r = new Event();
|
||||
r.vTablePtr = BuildVTable( func, r.Allocations );
|
||||
|
||||
//
|
||||
// Create the callback object
|
||||
//
|
||||
var cb = new Callback();
|
||||
cb.vTablePtr = r.vTablePtr;
|
||||
cb.CallbackFlags = gameserver ? (byte)0x02 : (byte)0;
|
||||
cb.CallbackId = callbackId;
|
||||
|
||||
//
|
||||
// Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native
|
||||
//
|
||||
r.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned );
|
||||
|
||||
//
|
||||
// Register the callback with Steam
|
||||
//
|
||||
SteamClient.RegisterCallback( r.PinnedCallback.AddrOfPinnedObject(), cb.CallbackId );
|
||||
|
||||
r.IsAllocated = true;
|
||||
|
||||
if ( gameserver )
|
||||
Event.AllServer.Add( r );
|
||||
else
|
||||
Event.AllClient.Add( r );
|
||||
}
|
||||
|
||||
static IntPtr BuildVTable( Callback.Run run, List<GCHandle> allocations )
|
||||
{
|
||||
var RunStub = (Callback.RunCall)Callback.RunStub;
|
||||
var SizeStub = (Callback.GetCallbackSizeBytes)Callback.SizeStub;
|
||||
|
||||
allocations.Add( GCHandle.Alloc( run ) );
|
||||
allocations.Add( GCHandle.Alloc( RunStub ) );
|
||||
allocations.Add( GCHandle.Alloc( SizeStub ) );
|
||||
|
||||
var a = Marshal.GetFunctionPointerForDelegate<Callback.Run>( run );
|
||||
var b = Marshal.GetFunctionPointerForDelegate<Callback.RunCall>( RunStub );
|
||||
var c = Marshal.GetFunctionPointerForDelegate<Callback.GetCallbackSizeBytes>( SizeStub );
|
||||
|
||||
var vt = Marshal.AllocHGlobal( IntPtr.Size * 3 );
|
||||
|
||||
// Windows switches the function positions
|
||||
#if PLATFORM_WIN
|
||||
Marshal.WriteIntPtr( vt, IntPtr.Size * 0, b );
|
||||
Marshal.WriteIntPtr( vt, IntPtr.Size * 1, a );
|
||||
Marshal.WriteIntPtr( vt, IntPtr.Size * 2, c );
|
||||
#else
|
||||
Marshal.WriteIntPtr( vt, IntPtr.Size * 0, a );
|
||||
Marshal.WriteIntPtr( vt, IntPtr.Size * 1, b );
|
||||
Marshal.WriteIntPtr( vt, IntPtr.Size * 2, c );
|
||||
#endif
|
||||
|
||||
return vt;
|
||||
}
|
||||
|
||||
bool IsAllocated;
|
||||
List<GCHandle> Allocations = new List<GCHandle>();
|
||||
internal IntPtr vTablePtr;
|
||||
internal GCHandle PinnedCallback;
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if ( !IsAllocated ) return;
|
||||
IsAllocated = false;
|
||||
|
||||
if ( !PinnedCallback.IsAllocated )
|
||||
throw new System.Exception( "Callback isn't allocated!?" );
|
||||
|
||||
SteamClient.UnregisterCallback( PinnedCallback.AddrOfPinnedObject() );
|
||||
|
||||
foreach ( var a in Allocations )
|
||||
{
|
||||
if ( a.IsAllocated )
|
||||
a.Free();
|
||||
}
|
||||
|
||||
Allocations = null;
|
||||
|
||||
PinnedCallback.Free();
|
||||
|
||||
if ( vTablePtr != IntPtr.Zero )
|
||||
{
|
||||
Marshal.FreeHGlobal( vTablePtr );
|
||||
vTablePtr = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
~Event()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks.Callbacks
|
||||
{
|
||||
public delegate void FailureCallback( Result reason );
|
||||
|
||||
public enum Result : int
|
||||
{
|
||||
OK = 1, // success
|
||||
Fail = 2, // generic failure
|
||||
NoConnection = 3, // no/failed network connection
|
||||
// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
|
||||
InvalidPassword = 5, // password/ticket is invalid
|
||||
LoggedInElsewhere = 6, // same user logged in elsewhere
|
||||
InvalidProtocolVer = 7, // protocol version is incorrect
|
||||
InvalidParam = 8, // a parameter is incorrect
|
||||
FileNotFound = 9, // file was not found
|
||||
Busy = 10, // called method busy - action not taken
|
||||
InvalidState = 11, // called object was in an invalid state
|
||||
InvalidName = 12, // name is invalid
|
||||
InvalidEmail = 13, // email is invalid
|
||||
DuplicateName = 14, // name is not unique
|
||||
AccessDenied = 15, // access is denied
|
||||
Timeout = 16, // operation timed out
|
||||
Banned = 17, // VAC2 banned
|
||||
AccountNotFound = 18, // account not found
|
||||
InvalidSteamID = 19, // steamID is invalid
|
||||
ServiceUnavailable = 20, // The requested service is currently unavailable
|
||||
NotLoggedOn = 21, // The user is not logged on
|
||||
Pending = 22, // Request is pending (may be in process, or waiting on third party)
|
||||
EncryptionFailure = 23, // Encryption or Decryption failed
|
||||
InsufficientPrivilege = 24, // Insufficient privilege
|
||||
LimitExceeded = 25, // Too much of a good thing
|
||||
Revoked = 26, // Access has been revoked (used for revoked guest passes)
|
||||
Expired = 27, // License/Guest pass the user is trying to access is expired
|
||||
AlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again
|
||||
DuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time
|
||||
AlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user
|
||||
IPNotFound = 31, // IP address not found
|
||||
PersistFailed = 32, // failed to write change to the data store
|
||||
LockingFailed = 33, // failed to acquire access lock for this operation
|
||||
LogonSessionReplaced = 34,
|
||||
ConnectFailed = 35,
|
||||
HandshakeFailed = 36,
|
||||
IOFailure = 37,
|
||||
RemoteDisconnect = 38,
|
||||
ShoppingCartNotFound = 39, // failed to find the shopping cart requested
|
||||
Blocked = 40, // a user didn't allow it
|
||||
Ignored = 41, // target is ignoring sender
|
||||
NoMatch = 42, // nothing matching the request found
|
||||
AccountDisabled = 43,
|
||||
ServiceReadOnly = 44, // this service is not accepting content changes right now
|
||||
AccountNotFeatured = 45, // account doesn't have value, so this feature isn't available
|
||||
AdministratorOK = 46, // allowed to take this action, but only because requester is admin
|
||||
ContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol.
|
||||
TryAnotherCM = 48, // The current CM can't service the user making a request, user should try another.
|
||||
PasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed.
|
||||
AlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait
|
||||
Suspended = 51, // Long running operation (content download) suspended/paused
|
||||
Cancelled = 52, // Operation canceled (typically by user: content download)
|
||||
DataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable
|
||||
DiskFull = 54, // Operation canceled - not enough disk space.
|
||||
RemoteCallFailed = 55, // an remote call or IPC call failed
|
||||
PasswordUnset = 56, // Password could not be verified as it's unset server side
|
||||
ExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account
|
||||
PSNTicketInvalid = 58, // PSN ticket was invalid
|
||||
ExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first
|
||||
RemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files
|
||||
IllegalPassword = 61, // The requested new password is not legal
|
||||
SameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer )
|
||||
AccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure
|
||||
CannotUseOldPassword = 64, // The requested new password is not legal
|
||||
InvalidLoginAuthCode = 65, // account login denied due to auth code invalid
|
||||
AccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
|
||||
HardwareNotCapableOfIPT = 67, //
|
||||
IPTInitError = 68, //
|
||||
ParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
|
||||
FacebookQueryError = 70, // Facebook query returned an error
|
||||
ExpiredLoginAuthCode = 71, // account login denied due to auth code expired
|
||||
IPLoginRestrictionFailed = 72,
|
||||
AccountLockedDown = 73,
|
||||
AccountLogonDeniedVerifiedEmailRequired = 74,
|
||||
NoMatchingURL = 75,
|
||||
BadResponse = 76, // parse failure, missing field, etc.
|
||||
RequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password
|
||||
ValueOutOfRange = 78, // the value entered is outside the acceptable range
|
||||
UnexpectedError = 79, // something happened that we didn't expect to ever happen
|
||||
Disabled = 80, // The requested service has been configured to be unavailable
|
||||
InvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid !
|
||||
RestrictedDevice = 82, // The device being used is not allowed to perform this action
|
||||
RegionLocked = 83, // The action could not be complete because it is region restricted
|
||||
RateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent
|
||||
AccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
|
||||
ItemDeleted = 86, // The thing we're trying to access has been deleted
|
||||
AccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
|
||||
TwoFactorCodeMismatch = 88, // two factor code mismatch
|
||||
TwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
|
||||
AccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners
|
||||
NotModified = 91, // data not modified
|
||||
NoMobileDevice = 92, // the account does not have a mobile device associated with it
|
||||
TimeNotSynced = 93, // the time presented is out of range or tolerance
|
||||
SmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.)
|
||||
AccountLimitExceeded = 95, // Too many accounts access this resource
|
||||
AccountActivityLimitExceeded = 96, // Too many changes to this account
|
||||
PhoneActivityLimitExceeded = 97, // Too many changes to this phone
|
||||
RefundToWallet = 98, // Cannot refund to payment method, must use wallet
|
||||
EmailSendFailure = 99, // Cannot send an email
|
||||
NotSettled = 100, // Can't perform operation till payment has settled
|
||||
NeedCaptcha = 101, // Needs to provide a valid captcha
|
||||
GSLTDenied = 102, // a game server login token owned by this token's owner has been banned
|
||||
GSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone)
|
||||
InvalidItemType = 104, // the type of thing we were requested to act on is invalid
|
||||
IPBanned = 105, // the ip address has been banned from taking this action
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
public class AuthTicket : IDisposable
|
||||
{
|
||||
public byte[] Data;
|
||||
public uint Handle;
|
||||
|
||||
/// <summary>
|
||||
/// Cancels a ticket.
|
||||
/// You should cancel your ticket when you close the game or leave a server.
|
||||
/// </summary>
|
||||
public void Cancel()
|
||||
{
|
||||
if ( Handle != 0 )
|
||||
{
|
||||
SteamUser.Internal.CancelAuthTicket( Handle );
|
||||
}
|
||||
|
||||
Handle = 0;
|
||||
Data = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using Steamworks.Data;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ConnectionInterface
|
||||
{
|
||||
public Connection Connection;
|
||||
public bool Connected = false;
|
||||
public bool Connecting = true;
|
||||
|
||||
public string ConnectionName
|
||||
{
|
||||
get => Connection.ConnectionName;
|
||||
set => Connection.ConnectionName = value;
|
||||
}
|
||||
|
||||
public long UserData
|
||||
{
|
||||
get => Connection.UserData;
|
||||
set => Connection.UserData = value;
|
||||
}
|
||||
|
||||
public void Close() => Connection.Close();
|
||||
|
||||
public override string ToString() => Connection.ToString();
|
||||
|
||||
public virtual void OnConnectionChanged( ConnectionInfo data )
|
||||
{
|
||||
switch ( data.State )
|
||||
{
|
||||
case ConnectionState.Connecting:
|
||||
OnConnecting( data );
|
||||
break;
|
||||
case ConnectionState.Connected:
|
||||
OnConnected( data );
|
||||
break;
|
||||
case ConnectionState.ClosedByPeer:
|
||||
case ConnectionState.ProblemDetectedLocally:
|
||||
case ConnectionState.None:
|
||||
OnDisconnected( data );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We're trying to connect!
|
||||
/// </summary>
|
||||
public virtual void OnConnecting( ConnectionInfo data )
|
||||
{
|
||||
Connecting = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Client is connected. They move from connecting to Connections
|
||||
/// </summary>
|
||||
public virtual void OnConnected( ConnectionInfo data )
|
||||
{
|
||||
Connected = true;
|
||||
Connecting = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The connection has been closed remotely or disconnected locally. Check data.State for details.
|
||||
/// </summary>
|
||||
public virtual void OnDisconnected( ConnectionInfo data )
|
||||
{
|
||||
Connected = false;
|
||||
Connecting = false;
|
||||
}
|
||||
|
||||
public void Receive( int bufferSize = 32 )
|
||||
{
|
||||
int processed = 0;
|
||||
IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize );
|
||||
|
||||
try
|
||||
{
|
||||
processed = SteamNetworkingSockets.Internal.ReceiveMessagesOnConnection( Connection, messageBuffer, bufferSize );
|
||||
|
||||
for ( int i = 0; i < processed; i++ )
|
||||
{
|
||||
ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * IntPtr.Size ) );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeHGlobal( messageBuffer );
|
||||
}
|
||||
|
||||
//
|
||||
// Overwhelmed our buffer, keep going
|
||||
//
|
||||
if ( processed == bufferSize )
|
||||
Receive( bufferSize );
|
||||
}
|
||||
|
||||
internal unsafe void ReceiveMessage( IntPtr msgPtr )
|
||||
{
|
||||
var msg = Marshal.PtrToStructure<NetMsg>( msgPtr );
|
||||
try
|
||||
{
|
||||
OnMessage( msg.DataPtr, msg.DataSize, msg.RecvTime, msg.MessageNumber, msg.Channel );
|
||||
}
|
||||
finally
|
||||
{
|
||||
//
|
||||
// Releases the message
|
||||
//
|
||||
msg.Release( msgPtr );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnMessage( IntPtr data, int size, long messageNum, long recvTime, int channel )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
public class SocketInterface
|
||||
{
|
||||
public List<Connection> Connecting = new List<Connection>();
|
||||
public List<Connection> Connected = new List<Connection>();
|
||||
public Socket Socket { get; internal set; }
|
||||
|
||||
public bool Close() => Socket.Close();
|
||||
|
||||
public override string ToString() => Socket.ToString();
|
||||
|
||||
public virtual void OnConnectionChanged( Connection connection, ConnectionInfo data )
|
||||
{
|
||||
switch ( data.State )
|
||||
{
|
||||
case ConnectionState.Connecting:
|
||||
OnConnecting( connection, data );
|
||||
break;
|
||||
case ConnectionState.Connected:
|
||||
OnConnected( connection, data );
|
||||
break;
|
||||
case ConnectionState.ClosedByPeer:
|
||||
case ConnectionState.ProblemDetectedLocally:
|
||||
case ConnectionState.None:
|
||||
OnDisconnected( connection, data );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default behaviour is to accept every connection
|
||||
/// </summary>
|
||||
public virtual void OnConnecting( Connection connection, ConnectionInfo data )
|
||||
{
|
||||
connection.Accept();
|
||||
Connecting.Add( connection );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Client is connected. They move from connecting to Connections
|
||||
/// </summary>
|
||||
public virtual void OnConnected( Connection connection, ConnectionInfo data )
|
||||
{
|
||||
Connecting.Remove( connection );
|
||||
Connected.Add( connection );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The connection has been closed remotely or disconnected locally. Check data.State for details.
|
||||
/// </summary>
|
||||
public virtual void OnDisconnected( Connection connection, ConnectionInfo data )
|
||||
{
|
||||
connection.Close();
|
||||
|
||||
Connecting.Remove( connection );
|
||||
Connected.Remove( connection );
|
||||
}
|
||||
|
||||
public void Receive( int bufferSize = 32 )
|
||||
{
|
||||
int processed = 0;
|
||||
IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize );
|
||||
|
||||
try
|
||||
{
|
||||
processed = SteamNetworkingSockets.Internal.ReceiveMessagesOnListenSocket( Socket, messageBuffer, bufferSize );
|
||||
|
||||
for ( int i = 0; i < processed; i++ )
|
||||
{
|
||||
ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * IntPtr.Size ) );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeHGlobal( messageBuffer );
|
||||
}
|
||||
|
||||
//
|
||||
// Overwhelmed our buffer, keep going
|
||||
//
|
||||
if ( processed == bufferSize )
|
||||
Receive( bufferSize );
|
||||
}
|
||||
|
||||
internal unsafe void ReceiveMessage( IntPtr msgPtr )
|
||||
{
|
||||
var msg = Marshal.PtrToStructure<NetMsg>( msgPtr );
|
||||
try
|
||||
{
|
||||
OnMessage( msg.Connection, msg.Identity, msg.DataPtr, msg.DataSize, msg.RecvTime, msg.MessageNumber, msg.Channel );
|
||||
}
|
||||
finally
|
||||
{
|
||||
//
|
||||
// Releases the message
|
||||
//
|
||||
msg.Release( msgPtr );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnMessage( Connection connection, NetIdentity identity, IntPtr data, int size, long messageNum, long recvTime, int channel )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,308 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Client : BaseSteamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// A singleton accessor to get the current client instance.
|
||||
/// </summary>
|
||||
public static Client Instance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current user's Username
|
||||
/// </summary>
|
||||
public string Username { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current user's SteamId
|
||||
/// </summary>
|
||||
public ulong SteamId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// If we're sharing this game, this is the owner of it.
|
||||
/// </summary>
|
||||
public ulong OwnerSteamId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current Beta name, if we're using a beta branch.
|
||||
/// </summary>
|
||||
public string BetaName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The BuildId of the current build
|
||||
/// </summary>
|
||||
public int BuildId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The folder in which this app is installed
|
||||
/// </summary>
|
||||
public DirectoryInfo InstallFolder { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The currently selected language
|
||||
/// </summary>
|
||||
public string CurrentLanguage { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// List of languages available to the game
|
||||
/// </summary>
|
||||
public string[] AvailableLanguages { get; }
|
||||
|
||||
public Voice Voice { get; private set; }
|
||||
public ServerList ServerList { get; private set; }
|
||||
public LobbyList LobbyList { get; private set; }
|
||||
public App App { get; private set; }
|
||||
public Achievements Achievements { get; private set; }
|
||||
public Stats Stats { get; private set; }
|
||||
public MicroTransactions MicroTransactions { get; private set; }
|
||||
public User User { get; private set; }
|
||||
public RemoteStorage RemoteStorage { get; private set; }
|
||||
public Overlay Overlay { get; private set; }
|
||||
|
||||
public Client( uint appId ) : base( appId )
|
||||
{
|
||||
if ( Instance != null )
|
||||
{
|
||||
throw new System.Exception( "Only one Facepunch.Steamworks.Client can exist - dispose the old one before trying to create a new one." );
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
native = new Interop.NativeInterface();
|
||||
|
||||
//
|
||||
// Get other interfaces
|
||||
//
|
||||
if ( !native.InitClient( this ) )
|
||||
{
|
||||
native.Dispose();
|
||||
native = null;
|
||||
Instance = null;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Register Callbacks
|
||||
//
|
||||
|
||||
SteamNative.Callbacks.RegisterCallbacks( this );
|
||||
|
||||
//
|
||||
// Setup interfaces that client and server both have
|
||||
//
|
||||
SetupCommonInterfaces();
|
||||
|
||||
//
|
||||
// Client only interfaces
|
||||
//
|
||||
Voice = new Voice( this );
|
||||
ServerList = new ServerList( this );
|
||||
LobbyList = new LobbyList(this);
|
||||
App = new App( this );
|
||||
Stats = new Stats( this );
|
||||
Achievements = new Achievements( this );
|
||||
MicroTransactions = new MicroTransactions( this );
|
||||
User = new User( this );
|
||||
RemoteStorage = new RemoteStorage( this );
|
||||
Overlay = new Overlay( this );
|
||||
|
||||
Workshop.friends = Friends;
|
||||
|
||||
Stats.UpdateStats();
|
||||
|
||||
//
|
||||
// Cache common, unchanging info
|
||||
//
|
||||
AppId = appId;
|
||||
Username = native.friends.GetPersonaName();
|
||||
SteamId = native.user.GetSteamID();
|
||||
BetaName = native.apps.GetCurrentBetaName();
|
||||
OwnerSteamId = native.apps.GetAppOwner();
|
||||
var appInstallDir = native.apps.GetAppInstallDir(AppId);
|
||||
|
||||
if (!String.IsNullOrEmpty(appInstallDir) && Directory.Exists(appInstallDir))
|
||||
InstallFolder = new DirectoryInfo(appInstallDir);
|
||||
|
||||
BuildId = native.apps.GetAppBuildId();
|
||||
CurrentLanguage = native.apps.GetCurrentGameLanguage();
|
||||
AvailableLanguages = native.apps.GetAvailableGameLanguages().Split( new[] {';'}, StringSplitOptions.RemoveEmptyEntries ); // TODO: Assumed colon separated
|
||||
|
||||
//
|
||||
// Run update, first call does some initialization
|
||||
//
|
||||
Update();
|
||||
}
|
||||
|
||||
~Client()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should be called at least once every frame
|
||||
/// </summary>
|
||||
public override void Update()
|
||||
{
|
||||
if ( !IsValid )
|
||||
return;
|
||||
|
||||
RunCallbacks();
|
||||
LobbyList.Update();
|
||||
Voice.Update();
|
||||
Friends.Cycle();
|
||||
|
||||
base.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called in Update() - there's no need to call it manually unless you're running your own Update
|
||||
/// </summary>
|
||||
public void RunCallbacks()
|
||||
{
|
||||
native.api.SteamAPI_RunCallbacks();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call when finished to shut down the Steam client.
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
if ( disposed ) return;
|
||||
|
||||
if ( Voice != null )
|
||||
{
|
||||
Voice = null;
|
||||
}
|
||||
|
||||
if ( ServerList != null )
|
||||
{
|
||||
ServerList.Dispose();
|
||||
ServerList = null;
|
||||
}
|
||||
|
||||
if (LobbyList != null)
|
||||
{
|
||||
LobbyList.Dispose();
|
||||
LobbyList = null;
|
||||
}
|
||||
|
||||
if ( App != null )
|
||||
{
|
||||
App.Dispose();
|
||||
App = null;
|
||||
}
|
||||
|
||||
if ( Stats != null )
|
||||
{
|
||||
Stats.Dispose();
|
||||
Stats = null;
|
||||
}
|
||||
|
||||
if ( Achievements != null )
|
||||
{
|
||||
Achievements.Dispose();
|
||||
Achievements = null;
|
||||
}
|
||||
|
||||
if ( MicroTransactions != null )
|
||||
{
|
||||
MicroTransactions.Dispose();
|
||||
MicroTransactions = null;
|
||||
}
|
||||
|
||||
if ( User != null )
|
||||
{
|
||||
User.Dispose();
|
||||
User = null;
|
||||
}
|
||||
|
||||
if ( RemoteStorage != null )
|
||||
{
|
||||
RemoteStorage.Dispose();
|
||||
RemoteStorage = null;
|
||||
}
|
||||
|
||||
if ( Instance == this )
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public enum LeaderboardSortMethod
|
||||
{
|
||||
None = 0,
|
||||
Ascending = 1, // top-score is lowest number
|
||||
Descending = 2, // top-score is highest number
|
||||
};
|
||||
|
||||
// the display type (used by the Steam Community web site) for a leaderboard
|
||||
public enum LeaderboardDisplayType
|
||||
{
|
||||
None = 0,
|
||||
Numeric = 1, // simple numerical score
|
||||
TimeSeconds = 2, // the score represents a time, in seconds
|
||||
TimeMilliSeconds = 3, // the score represents a time, in milliseconds
|
||||
};
|
||||
|
||||
public Leaderboard GetLeaderboard( string name, LeaderboardSortMethod sortMethod = LeaderboardSortMethod.None, LeaderboardDisplayType displayType = LeaderboardDisplayType.None )
|
||||
{
|
||||
var board = new Leaderboard( this );
|
||||
native.userstats.FindOrCreateLeaderboard( name, (SteamNative.LeaderboardSortMethod)sortMethod, (SteamNative.LeaderboardDisplayType)displayType, board.OnBoardCreated );
|
||||
return board;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the current user's Steam client is connected and logged on to the Steam servers.
|
||||
/// If it's not then no real-time services provided by the Steamworks API will be enabled.
|
||||
/// The Steam client will automatically be trying to recreate the connection as often as possible.
|
||||
/// All of the API calls that rely on this will check internally.
|
||||
/// </summary>
|
||||
public bool IsLoggedOn => native.user.BLoggedOn();
|
||||
|
||||
/// <summary>
|
||||
/// True if we're subscribed/authorised to be running this app
|
||||
/// </summary>
|
||||
public bool IsSubscribed => native.apps.BIsSubscribed();
|
||||
|
||||
/// <summary>
|
||||
/// True if we're a cybercafe account
|
||||
/// </summary>
|
||||
public bool IsCybercafe => native.apps.BIsCybercafe();
|
||||
|
||||
/// <summary>
|
||||
/// True if we're subscribed/authorised to be running this app, but only temporarily
|
||||
/// due to a free weekend etc.
|
||||
/// </summary>
|
||||
public bool IsSubscribedFromFreeWeekend => native.apps.BIsSubscribedFromFreeWeekend();
|
||||
|
||||
/// <summary>
|
||||
/// True if we're in low violence mode (germans are only allowed to see the insides of bodies in porn)
|
||||
/// </summary>
|
||||
public bool IsLowViolence => native.apps.BIsLowViolence();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't.
|
||||
/// If this returns true then it starts the Steam client if required and launches your game again through it,
|
||||
/// and you should quit your process as soon as possible. This effectively runs steam://run/AppId so it may
|
||||
/// not relaunch the exact executable that called it, as it will always relaunch from the version installed
|
||||
/// in your Steam library folder.
|
||||
/// If it returns false, then your game was launched by the Steam client and no action needs to be taken.
|
||||
/// One exception is if a steam_appid.txt file is present then this will return false regardless. This allows
|
||||
/// you to develop and test without launching your game through the Steam client. Make sure to remove the
|
||||
/// steam_appid.txt file when uploading the game to your Steam depot!
|
||||
/// </summary>
|
||||
public static bool RestartIfNecessary( uint appid )
|
||||
{
|
||||
using ( var api = new SteamNative.SteamApi() )
|
||||
{
|
||||
return api.SteamAPI_RestartAppIfNecessary( appid );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class Achievements : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public Achievement[] All { get; private set; }
|
||||
|
||||
public event Action OnUpdated;
|
||||
public event Action<Achievement> OnAchievementStateChanged;
|
||||
|
||||
private List<Achievement> unlockedRecently = new List<Achievement>();
|
||||
|
||||
internal Achievements( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
All = new Achievement[0];
|
||||
c.RegisterCallback<UserStatsReceived_t>( UserStatsReceived );
|
||||
c.RegisterCallback<UserStatsStored_t>( UserStatsStored );
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
var old = All;
|
||||
|
||||
All = Enumerable.Range( 0, (int)client.native.userstats.GetNumAchievements() )
|
||||
.Select( x =>
|
||||
{
|
||||
if ( old != null )
|
||||
{
|
||||
var name = client.native.userstats.GetAchievementName( (uint)x );
|
||||
var found = old.FirstOrDefault( y => y.Id == name );
|
||||
if ( found != null )
|
||||
{
|
||||
if ( found.Refresh() )
|
||||
{
|
||||
unlockedRecently.Add( found );
|
||||
}
|
||||
return found;
|
||||
}
|
||||
}
|
||||
|
||||
return new Achievement( client, x );
|
||||
} )
|
||||
.ToArray();
|
||||
|
||||
foreach ( var i in unlockedRecently )
|
||||
{
|
||||
OnUnlocked( i );
|
||||
}
|
||||
|
||||
unlockedRecently.Clear();
|
||||
}
|
||||
|
||||
internal void OnUnlocked( Achievement a )
|
||||
{
|
||||
OnAchievementStateChanged?.Invoke( a );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find an achievement by name. Will be null if not found, or not ready.
|
||||
/// </summary>
|
||||
public Achievement Find( string identifier )
|
||||
{
|
||||
return All.FirstOrDefault( x => x.Id == identifier );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unlock an achievement by identifier. If apply is true this will happen as expected
|
||||
/// and the achievement overlay will popup etc. If it's false then you'll have to manually
|
||||
/// call Stats.StoreStats() to actually trigger it.
|
||||
/// </summary>
|
||||
public bool Trigger( string identifier, bool apply = true )
|
||||
{
|
||||
var a = Find( identifier );
|
||||
if ( a == null ) return false;
|
||||
|
||||
return a.Trigger( apply );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset an achievement by identifier
|
||||
/// </summary>
|
||||
public bool Reset( string identifier )
|
||||
{
|
||||
return client.native.userstats.ClearAchievement( identifier );
|
||||
}
|
||||
|
||||
private void UserStatsReceived( UserStatsReceived_t stats )
|
||||
{
|
||||
if ( stats.GameID != client.AppId ) return;
|
||||
|
||||
Refresh();
|
||||
|
||||
OnUpdated?.Invoke();
|
||||
}
|
||||
|
||||
private void UserStatsStored( UserStatsStored_t stats )
|
||||
{
|
||||
if ( stats.GameID != client.AppId ) return;
|
||||
|
||||
Refresh();
|
||||
|
||||
OnUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public class Achievement
|
||||
{
|
||||
private Client client;
|
||||
|
||||
public string Id { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string Description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if unlocked
|
||||
/// </summary>
|
||||
public bool State { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should hold the unlock time if State is true
|
||||
/// </summary>
|
||||
public DateTime UnlockTime { get; private set; }
|
||||
|
||||
private int iconId { get; set; } = -1;
|
||||
private int refreshCount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the percentage of users who have unlocked the specified achievement, or -1 if no data available.
|
||||
/// </summary>
|
||||
public float GlobalUnlockedPercentage
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( State )
|
||||
return 1;
|
||||
|
||||
float pct = 0;
|
||||
|
||||
if ( !client.native.userstats.GetAchievementAchievedPercent( Id, out pct ) )
|
||||
return -1.0f;
|
||||
|
||||
return pct;
|
||||
}
|
||||
}
|
||||
|
||||
private Image _icon;
|
||||
|
||||
public Image Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( iconId <= 0 ) return null;
|
||||
|
||||
if ( _icon == null )
|
||||
{
|
||||
_icon = new Image();
|
||||
_icon.Id = iconId;
|
||||
}
|
||||
|
||||
if ( _icon.IsLoaded )
|
||||
return _icon;
|
||||
|
||||
if ( !_icon.TryLoad( client.native.utils ) )
|
||||
return null;
|
||||
|
||||
return _icon;
|
||||
}
|
||||
}
|
||||
|
||||
public Achievement( Client client, int index )
|
||||
{
|
||||
this.client = client;
|
||||
|
||||
Id = client.native.userstats.GetAchievementName( (uint) index );
|
||||
Name = client.native.userstats.GetAchievementDisplayAttribute( Id, "name" );
|
||||
Description = client.native.userstats.GetAchievementDisplayAttribute( Id, "desc" );
|
||||
|
||||
iconId = client.native.userstats.GetAchievementIcon( Id );
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make this achievement earned
|
||||
/// </summary>
|
||||
public bool Trigger( bool apply = true )
|
||||
{
|
||||
if ( State )
|
||||
return false;
|
||||
|
||||
State = true;
|
||||
UnlockTime = DateTime.Now;
|
||||
|
||||
var r = client.native.userstats.SetAchievement( Id );
|
||||
|
||||
if ( apply )
|
||||
{
|
||||
client.Stats.StoreStats();
|
||||
}
|
||||
|
||||
client.Achievements.OnUnlocked( this );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset this achievement to not achieved
|
||||
/// </summary>
|
||||
public bool Reset()
|
||||
{
|
||||
State = false;
|
||||
UnlockTime = DateTime.Now;
|
||||
|
||||
return client.native.userstats.ClearAchievement( Id );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refresh the unlock state. You shouldn't need to call this manually
|
||||
/// but it's here if you have to for some reason. Retuns true if state changed (meaning, probably unlocked)
|
||||
/// </summary>
|
||||
public bool Refresh()
|
||||
{
|
||||
bool previousState = State;
|
||||
|
||||
bool state = false;
|
||||
uint unlockTime;
|
||||
|
||||
State = false;
|
||||
|
||||
if ( client.native.userstats.GetAchievementAndUnlockTime( Id, ref state, out unlockTime ) )
|
||||
{
|
||||
State = state;
|
||||
UnlockTime = Utility.Epoch.ToDateTime( unlockTime );
|
||||
}
|
||||
|
||||
refreshCount++;
|
||||
|
||||
if ( previousState != State && refreshCount > 1 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class App : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
internal App( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
client.RegisterCallback<SteamNative.DlcInstalled_t>( DlcInstalled );
|
||||
}
|
||||
|
||||
public delegate void DlcInstalledDelegate( uint appid );
|
||||
|
||||
/// <summary>
|
||||
/// Triggered after the current user gains ownership of DLC and that DLC is installed.
|
||||
/// </summary>
|
||||
public event DlcInstalledDelegate OnDlcInstalled;
|
||||
|
||||
private void DlcInstalled( DlcInstalled_t data )
|
||||
{
|
||||
if ( OnDlcInstalled != null )
|
||||
{
|
||||
OnDlcInstalled( data.AppID );
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mark the content as corrupt, so it will validate the downloaded files
|
||||
/// once the app is closed. This is good to call when you detect a crash happening
|
||||
/// or a file is missing that is meant to be there.
|
||||
/// </summary>
|
||||
public void MarkContentCorrupt( bool missingFilesOnly = false )
|
||||
{
|
||||
client.native.apps.MarkContentCorrupt( missingFilesOnly );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tell steam to install the Dlc specified by the AppId
|
||||
/// </summary>
|
||||
public void InstallDlc( uint appId )
|
||||
{
|
||||
client.native.apps.InstallDLC( appId );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tell steam to uninstall the Dlc specified by the AppId
|
||||
/// </summary>
|
||||
public void UninstallDlc(uint appId)
|
||||
{
|
||||
client.native.apps.UninstallDLC( appId );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the purchase time for this appid. Will return DateTime.MinValue if none.
|
||||
/// </summary>
|
||||
public DateTime PurchaseTime(uint appId)
|
||||
{
|
||||
var time = client.native.apps.GetEarliestPurchaseUnixTime(appId);
|
||||
if ( time == 0 ) return DateTime.MinValue;
|
||||
|
||||
return Utility.Epoch.ToDateTime( time );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the active user is subscribed to a specified AppId.
|
||||
/// Only use this if you need to check ownership of another game related to yours, a demo for example.
|
||||
/// </summary>
|
||||
public bool IsSubscribed(uint appId)
|
||||
{
|
||||
return client.native.apps.BIsSubscribedApp(appId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if specified app is installed.
|
||||
/// </summary>
|
||||
public bool IsInstalled(uint appId)
|
||||
{
|
||||
return client.native.apps.BIsAppInstalled(appId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if specified app is installed.
|
||||
/// </summary>
|
||||
public bool IsDlcInstalled( uint appId )
|
||||
{
|
||||
return client.native.apps.BIsDlcInstalled( appId );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the appid's name
|
||||
/// Returns error if the current app Id does not have permission to use this interface
|
||||
/// </summary>
|
||||
public string GetName( uint appId )
|
||||
{
|
||||
var str = client.native.applist.GetAppName( appId );
|
||||
if ( str == null ) return "error";
|
||||
return str;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the app's install folder
|
||||
/// Returns error if the current app Id does not have permission to use this interface
|
||||
/// </summary>
|
||||
public string GetInstallFolder( uint appId )
|
||||
{
|
||||
return client.native.applist.GetAppInstallDir( appId );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the app's current build id
|
||||
/// Returns 0 if the current app Id does not have permission to use this interface
|
||||
/// </summary>
|
||||
public int GetBuildId( uint appId )
|
||||
{
|
||||
return client.native.applist.GetAppBuildId( appId );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Client : IDisposable
|
||||
{
|
||||
Auth _auth;
|
||||
|
||||
public Auth Auth
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _auth == null )
|
||||
_auth = new Auth(this);
|
||||
|
||||
return _auth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Steam authentication statuses
|
||||
/// </summary>
|
||||
public enum ClientAuthStatus : int
|
||||
{
|
||||
OK = 0,
|
||||
UserNotConnectedToSteam = 1,
|
||||
NoLicenseOrExpired = 2,
|
||||
VACBanned = 3,
|
||||
LoggedInElseWhere = 4,
|
||||
VACCheckTimedOut = 5,
|
||||
AuthTicketCanceled = 6,
|
||||
AuthTicketInvalidAlreadyUsed = 7,
|
||||
AuthTicketInvalid = 8,
|
||||
PublisherIssuedBan = 9,
|
||||
}
|
||||
|
||||
public enum ClientStartAuthSessionResult : int
|
||||
{
|
||||
OK = 0,
|
||||
InvalidTicket = 1,
|
||||
DuplicateRequest = 2,
|
||||
InvalidVersion = 3,
|
||||
GameMismatch = 4,
|
||||
ExpiredTicket = 5,
|
||||
ServerNotConnectedToSteam = 6,
|
||||
}
|
||||
|
||||
public class Auth
|
||||
{
|
||||
public Auth(Client c)
|
||||
{
|
||||
client = c;
|
||||
|
||||
client.RegisterCallback<SteamNative.ValidateAuthTicketResponse_t>(OnAuthTicketValidate);
|
||||
}
|
||||
|
||||
void OnAuthTicketValidate(SteamNative.ValidateAuthTicketResponse_t data)
|
||||
{
|
||||
if (OnAuthChange != null)
|
||||
OnAuthChange(data.SteamID, data.OwnerSteamID, (ClientAuthStatus)data.AuthSessionResponse);
|
||||
}
|
||||
|
||||
internal Client client;
|
||||
|
||||
public Action<ulong, ulong, ClientAuthStatus> OnAuthChange;
|
||||
|
||||
public class Ticket : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public byte[] Data;
|
||||
public uint Handle;
|
||||
|
||||
/// <summary>
|
||||
/// Cancels a ticket.
|
||||
/// You should cancel your ticket when you close the game or leave a server.
|
||||
/// </summary>
|
||||
public void Cancel()
|
||||
{
|
||||
if ( client.IsValid && Handle != 0 )
|
||||
{
|
||||
client.native.user.CancelAuthTicket( Handle );
|
||||
Handle = 0;
|
||||
Data = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an auth ticket.
|
||||
/// Which you can send to a server to authenticate that you are who you say you are.
|
||||
/// </summary>
|
||||
public unsafe Ticket GetAuthSessionTicket()
|
||||
{
|
||||
var data = new byte[1024];
|
||||
|
||||
fixed ( byte* b = data )
|
||||
{
|
||||
uint ticketLength = 0;
|
||||
uint ticket = client.native.user.GetAuthSessionTicket( (IntPtr) b, data.Length, out ticketLength );
|
||||
|
||||
if ( ticket == 0 )
|
||||
return null;
|
||||
|
||||
return new Ticket()
|
||||
{
|
||||
client = client,
|
||||
Data = data.Take( (int)ticketLength ).ToArray(),
|
||||
Handle = ticket
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start authorizing a ticket. This user isn't authorized yet. Wait for a call to OnAuthChange.
|
||||
/// </summary>
|
||||
public unsafe ClientStartAuthSessionResult StartSession(byte[] data, ulong steamid)
|
||||
{
|
||||
fixed (byte* p = data)
|
||||
{
|
||||
var result = client.native.user.BeginAuthSession((IntPtr)p, data.Length, steamid);
|
||||
|
||||
return (ClientStartAuthSessionResult)result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forget this guy. They're no longer in the game.
|
||||
/// </summary>
|
||||
public void EndSession(ulong steamid)
|
||||
{
|
||||
client.native.user.EndAuthSession(steamid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,435 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Client : IDisposable
|
||||
{
|
||||
Friends _friends;
|
||||
|
||||
public Friends Friends
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _friends == null )
|
||||
_friends = new Friends( this );
|
||||
|
||||
return _friends;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles most interactions with people in Steam, not just friends as the name would suggest.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// foreach ( var friend in client.Friends.AllFriends )
|
||||
/// {
|
||||
/// Console.WriteLine( $"{friend.Id}: {friend.Name}" );
|
||||
/// }
|
||||
/// </example>
|
||||
public class Friends
|
||||
{
|
||||
internal Client client;
|
||||
private byte[] buffer = new byte[1024 * 128];
|
||||
|
||||
public Dictionary<ulong, Action> OnRichPresenceUpdateCallbacks;
|
||||
|
||||
internal Friends( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
client.RegisterCallback<FriendRichPresenceUpdate_t>(OnRichPresenceUpdate);
|
||||
client.RegisterCallback<AvatarImageLoaded_t>( OnAvatarImageLoaded );
|
||||
client.RegisterCallback<PersonaStateChange_t>( OnPersonaStateChange );
|
||||
client.RegisterCallback<GameRichPresenceJoinRequested_t>( OnGameJoinRequested );
|
||||
client.RegisterCallback<GameConnectedFriendChatMsg_t>( OnFriendChatMessage );
|
||||
}
|
||||
|
||||
public delegate void ChatMessageDelegate( SteamFriend friend, string type, string message );
|
||||
|
||||
/// <summary>
|
||||
/// Called when chat message has been received from a friend. You'll need to turn on
|
||||
/// ListenForFriendsMessages to recieve this.
|
||||
/// </summary>
|
||||
public event ChatMessageDelegate OnChatMessage;
|
||||
|
||||
private unsafe void OnFriendChatMessage( GameConnectedFriendChatMsg_t data )
|
||||
{
|
||||
if ( OnChatMessage == null ) return;
|
||||
|
||||
var friend = Get( data.SteamIDUser );
|
||||
var type = ChatEntryType.ChatMsg;
|
||||
fixed ( byte* ptr = buffer )
|
||||
{
|
||||
var len = client.native.friends.GetFriendMessage( data.SteamIDUser, data.MessageID, (IntPtr)ptr, buffer.Length, out type );
|
||||
|
||||
if ( len == 0 && type == ChatEntryType.Invalid )
|
||||
return;
|
||||
|
||||
var typeName = type.ToString();
|
||||
var message = Encoding.UTF8.GetString( buffer, 0, len );
|
||||
|
||||
OnChatMessage( friend, typeName, message );
|
||||
}
|
||||
}
|
||||
|
||||
private bool _listenForFriendsMessages;
|
||||
|
||||
/// <summary>
|
||||
/// Listens for Steam friends chat messages.
|
||||
/// You can then show these chats inline in the game. For example with a Blizzard style chat message system or the chat system in Dota 2.
|
||||
/// After enabling this you will receive callbacks when ever the user receives a chat message.
|
||||
/// </summary>
|
||||
public bool ListenForFriendsMessages
|
||||
{
|
||||
get
|
||||
{
|
||||
return _listenForFriendsMessages;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_listenForFriendsMessages = value;
|
||||
client.native.friends.SetListenForFriendsMessages( value );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public delegate void JoinRequestedDelegate( SteamFriend friend, string connect );
|
||||
|
||||
//
|
||||
// Called when a friend has invited you to their game (using InviteToGame)
|
||||
//
|
||||
public event JoinRequestedDelegate OnInvitedToGame;
|
||||
|
||||
|
||||
private void OnGameJoinRequested( GameRichPresenceJoinRequested_t data )
|
||||
{
|
||||
if ( OnInvitedToGame != null )
|
||||
{
|
||||
OnInvitedToGame( Get( data.SteamIDFriend ), data.Connect );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to get information about this user - which as name and avatar.
|
||||
/// If returns true, we already have this user's information.
|
||||
/// </summary>
|
||||
public bool UpdateInformation( ulong steamid )
|
||||
{
|
||||
return !client.native.friends.RequestUserInformation( steamid, false );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get this user's name
|
||||
/// </summary>
|
||||
public string GetName( ulong steamid )
|
||||
{
|
||||
client.native.friends.RequestUserInformation( steamid, true );
|
||||
return client.native.friends.GetFriendPersonaName( steamid );
|
||||
}
|
||||
|
||||
private List<SteamFriend> _allFriends;
|
||||
|
||||
/// <summary>
|
||||
/// Returns all friends, even blocked, ignored, friend requests etc
|
||||
/// </summary>
|
||||
public IEnumerable<SteamFriend> All
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _allFriends == null )
|
||||
{
|
||||
_allFriends = new List<SteamFriend>();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
return _allFriends;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRichPresenceUpdateCallback(ulong steamId, Action callback)
|
||||
{
|
||||
if (callback != null)
|
||||
{
|
||||
if (OnRichPresenceUpdateCallbacks == null)
|
||||
{
|
||||
OnRichPresenceUpdateCallbacks = new Dictionary<ulong, Action>();
|
||||
}
|
||||
if (!OnRichPresenceUpdateCallbacks.ContainsKey(steamId))
|
||||
{
|
||||
OnRichPresenceUpdateCallbacks.Add(steamId, callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnRichPresenceUpdateCallbacks[steamId] = callback;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OnRichPresenceUpdateCallbacks == null) { return; }
|
||||
if (OnRichPresenceUpdateCallbacks.ContainsKey(steamId))
|
||||
{
|
||||
OnRichPresenceUpdateCallbacks.Remove(steamId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns only friends
|
||||
/// </summary>
|
||||
public IEnumerable<SteamFriend> AllFriends
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach ( var friend in All )
|
||||
{
|
||||
if ( !friend.IsFriend ) continue;
|
||||
|
||||
yield return friend;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all blocked users
|
||||
/// </summary>
|
||||
public IEnumerable<SteamFriend> AllBlocked
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach ( var friend in All )
|
||||
{
|
||||
if ( !friend.IsBlocked ) continue;
|
||||
|
||||
yield return friend;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
if ( _allFriends == null )
|
||||
{
|
||||
_allFriends = new List<SteamFriend>();
|
||||
}
|
||||
|
||||
_allFriends.Clear();
|
||||
|
||||
var flags = (int) SteamNative.FriendFlags.All;
|
||||
var count = client.native.friends.GetFriendCount( flags );
|
||||
|
||||
for ( int i=0; i<count; i++ )
|
||||
{
|
||||
var steamid = client.native.friends.GetFriendByIndex( i, flags );
|
||||
_allFriends.Add( Get( steamid ) );
|
||||
}
|
||||
}
|
||||
|
||||
public enum AvatarSize
|
||||
{
|
||||
/// <summary>
|
||||
/// Should be 32x32 - but make sure to check!
|
||||
/// </summary>
|
||||
Small,
|
||||
|
||||
/// <summary>
|
||||
/// Should be 64x64 - but make sure to check!
|
||||
/// </summary>
|
||||
Medium,
|
||||
|
||||
/// <summary>
|
||||
/// Should be 184x184 - but make sure to check!
|
||||
/// </summary>
|
||||
Large
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to get the avatar immediately. This should work for people on your friends list.
|
||||
/// </summary>
|
||||
public Image GetCachedAvatar( AvatarSize size, ulong steamid )
|
||||
{
|
||||
var imageid = 0;
|
||||
|
||||
switch (size)
|
||||
{
|
||||
case AvatarSize.Small:
|
||||
imageid = client.native.friends.GetSmallFriendAvatar(steamid);
|
||||
break;
|
||||
case AvatarSize.Medium:
|
||||
imageid = client.native.friends.GetMediumFriendAvatar(steamid);
|
||||
break;
|
||||
case AvatarSize.Large:
|
||||
imageid = client.native.friends.GetLargeFriendAvatar(steamid);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( imageid == 1 ) return null; // Placeholder large
|
||||
if ( imageid == 2 ) return null; // Placeholder medium
|
||||
if ( imageid == 3 ) return null; // Placeholder small
|
||||
|
||||
var img = new Image()
|
||||
{
|
||||
Id = imageid
|
||||
};
|
||||
|
||||
if ( !img.TryLoad( client.native.utils ) )
|
||||
return null;
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Callback will be called when the avatar is ready. If we fail to get an
|
||||
/// avatar, might be called with a null Image.
|
||||
/// </summary>
|
||||
public void GetAvatar( AvatarSize size, ulong steamid, Action<Image> callback )
|
||||
{
|
||||
// Maybe we already have it downloaded?
|
||||
var image = GetCachedAvatar(size, steamid);
|
||||
if ( image != null )
|
||||
{
|
||||
callback(image);
|
||||
return;
|
||||
}
|
||||
|
||||
// Lets request it from Steam
|
||||
if (!client.native.friends.RequestUserInformation(steamid, false))
|
||||
{
|
||||
// from docs: false means that we already have all the details about that user, and functions that require this information can be used immediately
|
||||
// but that's probably not true because we just checked the cache
|
||||
|
||||
// check again in case it was just a race
|
||||
image = GetCachedAvatar(size, steamid);
|
||||
if ( image != null )
|
||||
{
|
||||
callback(image);
|
||||
return;
|
||||
}
|
||||
|
||||
// maybe Steam returns false if it was already requested? just add another callback and hope it comes
|
||||
// if not it'll time out anyway
|
||||
}
|
||||
|
||||
PersonaCallbacks.Add( new PersonaCallback
|
||||
{
|
||||
SteamId = steamid,
|
||||
Size = size,
|
||||
Callback = callback,
|
||||
Time = DateTime.Now
|
||||
});
|
||||
}
|
||||
|
||||
private class PersonaCallback
|
||||
{
|
||||
public ulong SteamId;
|
||||
public AvatarSize Size;
|
||||
public Action<Image> Callback;
|
||||
public DateTime Time;
|
||||
}
|
||||
|
||||
List<PersonaCallback> PersonaCallbacks = new List<PersonaCallback>();
|
||||
|
||||
public SteamFriend Get( ulong steamid )
|
||||
{
|
||||
var friend = All.Where( x => x.Id == steamid ).FirstOrDefault();
|
||||
if ( friend != null ) return friend;
|
||||
|
||||
var f = new SteamFriend()
|
||||
{
|
||||
Id = steamid,
|
||||
Client = client
|
||||
};
|
||||
|
||||
f.Refresh();
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
internal void Cycle()
|
||||
{
|
||||
if ( PersonaCallbacks.Count == 0 ) return;
|
||||
|
||||
var timeOut = DateTime.Now.AddSeconds( -10 );
|
||||
|
||||
for ( int i = PersonaCallbacks.Count-1; i >= 0; i-- )
|
||||
{
|
||||
var cb = PersonaCallbacks[i];
|
||||
|
||||
// Timeout
|
||||
if ( cb.Time < timeOut )
|
||||
{
|
||||
if ( cb.Callback != null )
|
||||
{
|
||||
// final attempt, will be null unless the callback was missed somehow
|
||||
var image = GetCachedAvatar( cb.Size, cb.SteamId );
|
||||
|
||||
cb.Callback( image );
|
||||
}
|
||||
|
||||
PersonaCallbacks.Remove( cb );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnPersonaStateChange( PersonaStateChange_t data )
|
||||
{
|
||||
// k_EPersonaChangeAvatar
|
||||
if ( (data.ChangeFlags & 0x0040) == 0x0040 )
|
||||
{
|
||||
LoadAvatarForSteamId( data.SteamID );
|
||||
}
|
||||
|
||||
//
|
||||
// Find and refresh this friend's status
|
||||
//
|
||||
foreach ( var friend in All )
|
||||
{
|
||||
if ( friend.Id != data.SteamID ) continue;
|
||||
|
||||
friend.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void LoadAvatarForSteamId( ulong Steamid )
|
||||
{
|
||||
for ( int i = PersonaCallbacks.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
var cb = PersonaCallbacks[i];
|
||||
if ( cb.SteamId != Steamid ) continue;
|
||||
|
||||
var image = GetCachedAvatar( cb.Size, cb.SteamId );
|
||||
if ( image == null ) continue;
|
||||
|
||||
PersonaCallbacks.Remove( cb );
|
||||
|
||||
if ( cb.Callback != null )
|
||||
{
|
||||
cb.Callback( image );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAvatarImageLoaded( AvatarImageLoaded_t data )
|
||||
{
|
||||
LoadAvatarForSteamId( data.SteamID );
|
||||
}
|
||||
|
||||
private void OnRichPresenceUpdate( FriendRichPresenceUpdate_t data )
|
||||
{
|
||||
if (OnRichPresenceUpdateCallbacks == null) { return; }
|
||||
if (OnRichPresenceUpdateCallbacks.ContainsKey(data.SteamIDFriend))
|
||||
{
|
||||
OnRichPresenceUpdateCallbacks[data.SteamIDFriend]?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class Image
|
||||
{
|
||||
public int Id { get; internal set; }
|
||||
public int Width { get; internal set; }
|
||||
public int Height { get; internal set; }
|
||||
|
||||
public byte[] Data { get; internal set; }
|
||||
|
||||
public bool IsLoaded { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return true if this image couldn't be loaded for some reason
|
||||
/// </summary>
|
||||
public bool IsError { get; internal set; }
|
||||
|
||||
unsafe internal bool TryLoad( SteamNative.SteamUtils utils )
|
||||
{
|
||||
if ( IsLoaded ) return true;
|
||||
|
||||
uint width = 0, height = 0;
|
||||
|
||||
if ( utils.GetImageSize( Id, out width, out height ) == false )
|
||||
{
|
||||
IsError = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
var buffer = new byte[ width * height * 4 ];
|
||||
|
||||
fixed ( byte* ptr = buffer )
|
||||
{
|
||||
if ( utils.GetImageRGBA( Id, (IntPtr) ptr, buffer.Length ) == false )
|
||||
{
|
||||
IsError = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Width = (int) width;
|
||||
Height = (int) height;
|
||||
Data = buffer;
|
||||
IsLoaded = true;
|
||||
IsError = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Color GetPixel( int x, int y )
|
||||
{
|
||||
if ( !IsLoaded ) throw new System.Exception( "Image not loaded" );
|
||||
if ( x < 0 || x >= Width ) throw new System.Exception( "x out of bounds" );
|
||||
if ( y < 0 || y >= Height ) throw new System.Exception( "y out of bounds" );
|
||||
|
||||
Color c = new Color();
|
||||
|
||||
var i = ( y * Width + x ) * 4;
|
||||
|
||||
c.r = Data[i + 0];
|
||||
c.g = Data[i + 1];
|
||||
c.b = Data[i + 2];
|
||||
c.a = Data[i + 3];
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
public struct Color
|
||||
{
|
||||
public byte r, g, b, a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,387 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Facepunch.Steamworks.Callbacks;
|
||||
using SteamNative;
|
||||
using Result = SteamNative.Result;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class Leaderboard : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Type of leaderboard request
|
||||
/// </summary>
|
||||
public enum RequestType
|
||||
{
|
||||
/// <summary>
|
||||
/// Query everyone and everything
|
||||
/// </summary>
|
||||
Global = LeaderboardDataRequest.Global,
|
||||
|
||||
/// <summary>
|
||||
/// Query entries near to this user's rank
|
||||
/// </summary>
|
||||
GlobalAroundUser = LeaderboardDataRequest.GlobalAroundUser,
|
||||
|
||||
/// <summary>
|
||||
/// Only show friends of this user
|
||||
/// </summary>
|
||||
Friends = LeaderboardDataRequest.Friends
|
||||
}
|
||||
|
||||
private static readonly int[] subEntriesBuffer = new int[512];
|
||||
|
||||
internal ulong BoardId;
|
||||
public ulong GetBoardId()
|
||||
{
|
||||
return BoardId;
|
||||
}
|
||||
internal Client client;
|
||||
|
||||
private readonly Queue<Action> _onCreated = new Queue<Action>();
|
||||
|
||||
/// <summary>
|
||||
/// The results from the last query. Can be null.
|
||||
/// </summary>
|
||||
public Entry[] Results;
|
||||
|
||||
internal Leaderboard( Client c )
|
||||
{
|
||||
client = c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of this board, as retrieved from Steam
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total number of entries on this board
|
||||
/// </summary>
|
||||
public int TotalEntries { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this board is valid, ie, we've received
|
||||
/// a positive response from Steam about it.
|
||||
/// </summary>
|
||||
public bool IsValid => BoardId != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if we asked steam about this board but it returned
|
||||
/// an error.
|
||||
/// </summary>
|
||||
public bool IsError { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if we're querying scores
|
||||
/// </summary>
|
||||
public bool IsQuerying { get; private set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
|
||||
private void DispatchOnCreatedCallbacks()
|
||||
{
|
||||
while ( _onCreated.Count > 0 )
|
||||
{
|
||||
_onCreated.Dequeue()();
|
||||
}
|
||||
}
|
||||
|
||||
private bool DeferOnCreated( Action onValid, FailureCallback onFailure = null )
|
||||
{
|
||||
if ( IsValid || IsError ) return false;
|
||||
|
||||
_onCreated.Enqueue( () =>
|
||||
{
|
||||
if ( IsValid ) onValid();
|
||||
else onFailure?.Invoke( Callbacks.Result.Fail );
|
||||
} );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the leaderboard information is successfully recieved from Steam
|
||||
/// </summary>
|
||||
public Action OnBoardInformation;
|
||||
|
||||
internal void OnBoardCreated( LeaderboardFindResult_t result, bool error )
|
||||
{
|
||||
Console.WriteLine( $"result.LeaderboardFound: {result.LeaderboardFound}" );
|
||||
Console.WriteLine( $"result.SteamLeaderboard: {result.SteamLeaderboard}" );
|
||||
|
||||
if ( error || ( result.LeaderboardFound == 0 ) )
|
||||
{
|
||||
IsError = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BoardId = result.SteamLeaderboard;
|
||||
|
||||
if ( IsValid )
|
||||
{
|
||||
Name = client.native.userstats.GetLeaderboardName( BoardId );
|
||||
TotalEntries = client.native.userstats.GetLeaderboardEntryCount( BoardId );
|
||||
|
||||
OnBoardInformation?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
DispatchOnCreatedCallbacks();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a score to this leaderboard.
|
||||
/// Subscores are totally optional, and can be used for other game defined data such as laps etc.. although
|
||||
/// they have no bearing on sorting at all
|
||||
/// If onlyIfBeatsOldScore is true, the score will only be updated if it beats the existing score, else it will always
|
||||
/// be updated. Beating the existing score is subjective - and depends on how your leaderboard was set up as to whether
|
||||
/// that means higher or lower.
|
||||
/// </summary>
|
||||
public bool AddScore( bool onlyIfBeatsOldScore, int score, params int[] subscores )
|
||||
{
|
||||
if ( IsError ) return false;
|
||||
if ( !IsValid ) return DeferOnCreated( () => AddScore( onlyIfBeatsOldScore, score, subscores ) );
|
||||
|
||||
var flags = LeaderboardUploadScoreMethod.ForceUpdate;
|
||||
if ( onlyIfBeatsOldScore ) flags = LeaderboardUploadScoreMethod.KeepBest;
|
||||
|
||||
client.native.userstats.UploadLeaderboardScore( BoardId, flags, score, subscores, subscores.Length );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback invoked by <see cref="AddScore(bool, int, int[], AddScoreCallback, FailureCallback)"/> when score submission
|
||||
/// is complete.
|
||||
/// </summary>
|
||||
/// <param name="result">If successful, information about the new entry</param>
|
||||
public delegate void AddScoreCallback( AddScoreResult result );
|
||||
|
||||
/// <summary>
|
||||
/// Information about a newly submitted score.
|
||||
/// </summary>
|
||||
public struct AddScoreResult
|
||||
{
|
||||
public int Score;
|
||||
public bool ScoreChanged;
|
||||
public int GlobalRankNew;
|
||||
public int GlobalRankPrevious;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a score to this leaderboard.
|
||||
/// Subscores are totally optional, and can be used for other game defined data such as laps etc.. although
|
||||
/// they have no bearing on sorting at all
|
||||
/// If onlyIfBeatsOldScore is true, the score will only be updated if it beats the existing score, else it will always
|
||||
/// be updated.
|
||||
/// Information about the newly submitted score is passed to the optional <paramref name="onSuccess"/>.
|
||||
/// </summary>
|
||||
public bool AddScore( bool onlyIfBeatsOldScore, int score, int[] subscores = null, AddScoreCallback onSuccess = null, FailureCallback onFailure = null )
|
||||
{
|
||||
if ( IsError ) return false;
|
||||
if ( !IsValid ) return DeferOnCreated( () => AddScore( onlyIfBeatsOldScore, score, subscores, onSuccess, onFailure ), onFailure );
|
||||
|
||||
if ( subscores == null ) subscores = new int[0];
|
||||
|
||||
var flags = LeaderboardUploadScoreMethod.ForceUpdate;
|
||||
if ( onlyIfBeatsOldScore ) flags = LeaderboardUploadScoreMethod.KeepBest;
|
||||
|
||||
client.native.userstats.UploadLeaderboardScore( BoardId, flags, score, subscores, subscores.Length, ( result, error ) =>
|
||||
{
|
||||
if ( !error && result.Success != 0 )
|
||||
{
|
||||
onSuccess?.Invoke( new AddScoreResult
|
||||
{
|
||||
Score = result.Score,
|
||||
ScoreChanged = result.ScoreChanged != 0,
|
||||
GlobalRankNew = result.GlobalRankNew,
|
||||
GlobalRankPrevious = result.GlobalRankPrevious
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
onFailure?.Invoke( error ? Callbacks.Result.IOFailure : Callbacks.Result.Fail );
|
||||
}
|
||||
} );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback invoked by <see cref="Leaderboard.AttachRemoteFile"/> when file attachment is complete.
|
||||
/// </summary>
|
||||
public delegate void AttachRemoteFileCallback();
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to attach a <see cref="RemoteStorage"/> file to the current user's leaderboard entry.
|
||||
/// Can be useful for storing replays along with scores.
|
||||
/// </summary>
|
||||
/// <returns>True if the file attachment process has started</returns>
|
||||
public bool AttachRemoteFile( RemoteFile file, AttachRemoteFileCallback onSuccess = null, FailureCallback onFailure = null )
|
||||
{
|
||||
if ( IsError ) return false;
|
||||
if ( !IsValid ) return DeferOnCreated( () => AttachRemoteFile( file, onSuccess, onFailure ), onFailure );
|
||||
|
||||
if ( file.IsShared )
|
||||
{
|
||||
var handle = client.native.userstats.AttachLeaderboardUGC( BoardId, file.UGCHandle, ( result, error ) =>
|
||||
{
|
||||
if ( !error && result.Result == Result.OK )
|
||||
{
|
||||
onSuccess?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
onFailure?.Invoke( result.Result == 0 ? Callbacks.Result.IOFailure : (Callbacks.Result) result.Result );
|
||||
}
|
||||
} );
|
||||
|
||||
return handle.IsValid;
|
||||
}
|
||||
|
||||
file.Share( () =>
|
||||
{
|
||||
if ( !file.IsShared || !AttachRemoteFile( file, onSuccess, onFailure ) )
|
||||
{
|
||||
onFailure?.Invoke( Callbacks.Result.Fail );
|
||||
}
|
||||
}, onFailure );
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetch a subset of scores. The scores end up in Results.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if we have started the query</returns>
|
||||
public bool FetchScores( RequestType RequestType, int start, int end )
|
||||
{
|
||||
if ( !IsValid ) return false;
|
||||
if ( IsQuerying ) return false;
|
||||
|
||||
client.native.userstats.DownloadLeaderboardEntries( BoardId, (LeaderboardDataRequest) RequestType, start, end, OnScores );
|
||||
|
||||
Results = null;
|
||||
IsQuerying = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
private unsafe void ReadScores( LeaderboardScoresDownloaded_t result, List<Entry> dest )
|
||||
{
|
||||
for ( var i = 0; i < result.CEntryCount; i++ )
|
||||
fixed ( int* ptr = subEntriesBuffer )
|
||||
{
|
||||
var entry = new LeaderboardEntry_t();
|
||||
if ( client.native.userstats.GetDownloadedLeaderboardEntry( result.SteamLeaderboardEntries, i, ref entry, (IntPtr) ptr, subEntriesBuffer.Length ) )
|
||||
dest.Add( new Entry
|
||||
{
|
||||
GlobalRank = entry.GlobalRank,
|
||||
Score = entry.Score,
|
||||
SteamId = entry.SteamIDUser,
|
||||
SubScores = entry.CDetails == 0 ? null : subEntriesBuffer.Take( entry.CDetails ).ToArray(),
|
||||
Name = client.Friends.GetName( entry.SteamIDUser ),
|
||||
AttachedFile = (entry.UGC >> 32) == 0xffffffff ? null : new RemoteFile( client.RemoteStorage, entry.UGC )
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
[ThreadStatic] private static List<Entry> _sEntryBuffer;
|
||||
|
||||
/// <summary>
|
||||
/// Callback invoked by <see cref="FetchScores(RequestType, int, int, FetchScoresCallback, FailureCallback)"/> when
|
||||
/// a query is complete.
|
||||
/// </summary>
|
||||
public delegate void FetchScoresCallback( Entry[] results );
|
||||
|
||||
/// <summary>
|
||||
/// Fetch a subset of scores. The scores are passed to <paramref name="onSuccess"/>.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if we have started the query</returns>
|
||||
public bool FetchScores( RequestType RequestType, int start, int end, FetchScoresCallback onSuccess, FailureCallback onFailure = null )
|
||||
{
|
||||
if ( IsError ) return false;
|
||||
if ( !IsValid ) return DeferOnCreated( () => FetchScores( RequestType, start, end, onSuccess, onFailure ), onFailure );
|
||||
|
||||
client.native.userstats.DownloadLeaderboardEntries( BoardId, (LeaderboardDataRequest) RequestType, start, end, ( result, error ) =>
|
||||
{
|
||||
if ( error )
|
||||
{
|
||||
onFailure?.Invoke( Callbacks.Result.IOFailure );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _sEntryBuffer == null ) _sEntryBuffer = new List<Entry>();
|
||||
else _sEntryBuffer.Clear();
|
||||
|
||||
ReadScores( result, _sEntryBuffer );
|
||||
onSuccess( _sEntryBuffer.ToArray() );
|
||||
}
|
||||
} );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public unsafe bool FetchUsersScores( RequestType RequestType, UInt64[] steamIds, FetchScoresCallback onSuccess, FailureCallback onFailure = null )
|
||||
{
|
||||
|
||||
if ( IsError ) return false;
|
||||
if ( !IsValid ) return DeferOnCreated( () => FetchUsersScores( RequestType, steamIds, onSuccess, onFailure ), onFailure );
|
||||
|
||||
fixed(ulong* pointer = steamIds){
|
||||
|
||||
client.native.userstats.DownloadLeaderboardEntriesForUsers(BoardId, (IntPtr)pointer, steamIds.Length, (result, error) =>
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
onFailure?.Invoke(Callbacks.Result.IOFailure);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_sEntryBuffer == null) _sEntryBuffer = new List<Entry>();
|
||||
else _sEntryBuffer.Clear();
|
||||
|
||||
ReadScores(result, _sEntryBuffer);
|
||||
onSuccess(_sEntryBuffer.ToArray());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnScores( LeaderboardScoresDownloaded_t result, bool error )
|
||||
{
|
||||
IsQuerying = false;
|
||||
|
||||
if ( client == null ) return;
|
||||
if ( error ) return;
|
||||
|
||||
var list = new List<Entry>();
|
||||
ReadScores( result, list );
|
||||
|
||||
Results = list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A single entry in a leaderboard
|
||||
/// </summary>
|
||||
public struct Entry
|
||||
{
|
||||
public ulong SteamId;
|
||||
public int Score;
|
||||
public int[] SubScores;
|
||||
public int GlobalRank;
|
||||
public RemoteFile AttachedFile;
|
||||
|
||||
/// <summary>
|
||||
/// Note that the player's name might not be immediately available.
|
||||
/// If that's the case you'll have to use Friends.GetName to find the name
|
||||
/// </summary>
|
||||
public string Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Lobby
|
||||
{
|
||||
/// <summary>
|
||||
/// Class to hold global lobby data. This is stuff like maps/modes/etc. Data set here can be filtered by LobbyList.
|
||||
/// </summary>
|
||||
public class LobbyData
|
||||
{
|
||||
internal Client client;
|
||||
internal ulong lobby;
|
||||
internal Dictionary<string, string> data;
|
||||
|
||||
public LobbyData( Client c, ulong l )
|
||||
{
|
||||
client = c;
|
||||
lobby = l;
|
||||
data = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the lobby value for the specific key
|
||||
/// </summary>
|
||||
/// <param name="k">The key to find</param>
|
||||
/// <returns>The value at key</returns>
|
||||
public string GetData( string k )
|
||||
{
|
||||
if ( data.ContainsKey( k ) )
|
||||
{
|
||||
return data[k];
|
||||
}
|
||||
|
||||
return "ERROR: key not found";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of all the data in the Lobby
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of all the key/value pairs in the data</returns>
|
||||
public Dictionary<string, string> GetAllData()
|
||||
{
|
||||
Dictionary<string, string> returnData = new Dictionary<string, string>();
|
||||
foreach ( KeyValuePair<string, string> item in data )
|
||||
{
|
||||
returnData.Add( item.Key, item.Value );
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the value for specified Key. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use.
|
||||
/// </summary>
|
||||
/// <param name="k">The key to set the value for</param>
|
||||
/// <param name="v">The value of the Key</param>
|
||||
/// <returns>True if data successfully set</returns>
|
||||
public bool SetData( string k, string v )
|
||||
{
|
||||
if ( data.ContainsKey( k ) )
|
||||
{
|
||||
if ( data[k] == v ) { return true; }
|
||||
bool setKey = true;
|
||||
if (lobby == client.Lobby.CurrentLobby && client.Lobby.Owner == client.SteamId)
|
||||
{
|
||||
setKey = client.native.matchmaking.SetLobbyData(lobby, k, v);
|
||||
}
|
||||
if ( setKey )
|
||||
{
|
||||
data[k] = v;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool setKey = true;
|
||||
if (lobby == client.Lobby.CurrentLobby && client.Lobby.Owner == client.SteamId)
|
||||
{
|
||||
setKey = client.native.matchmaking.SetLobbyData(lobby, k, v);
|
||||
}
|
||||
if ( setKey )
|
||||
{
|
||||
data.Add( k, v );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the key from the LobbyData. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use.
|
||||
/// </summary>
|
||||
/// <param name="k">The key to remove</param>
|
||||
/// <returns>True if Key successfully removed</returns>
|
||||
public bool RemoveData( string k )
|
||||
{
|
||||
if ( data.ContainsKey( k ) )
|
||||
{
|
||||
if ( client.native.matchmaking.DeleteLobbyData( lobby, k ) )
|
||||
{
|
||||
data.Remove( k );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*not implemented
|
||||
|
||||
//set the game server of the lobby
|
||||
client.native.matchmaking.GetLobbyGameServer;
|
||||
client.native.matchmaking.SetLobbyGameServer;
|
||||
|
||||
//used with game server stuff
|
||||
SteamNative.LobbyGameCreated_t
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,616 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Client : IDisposable
|
||||
{
|
||||
Lobby _lobby;
|
||||
|
||||
public Lobby Lobby
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _lobby == null )
|
||||
_lobby = new Steamworks.Lobby( this );
|
||||
return _lobby;
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial class Lobby : IDisposable
|
||||
{
|
||||
//The type of lobby you are creating
|
||||
public enum Type : int
|
||||
{
|
||||
Private = SteamNative.LobbyType.Private,
|
||||
FriendsOnly = SteamNative.LobbyType.FriendsOnly,
|
||||
Public = SteamNative.LobbyType.Public,
|
||||
Invisible = SteamNative.LobbyType.Invisible,
|
||||
Error //happens if you try to get this when you aren't in a valid lobby
|
||||
}
|
||||
|
||||
internal Client client;
|
||||
|
||||
public Lobby( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
// For backwards compatibility
|
||||
OnLobbyJoinRequested = Join;
|
||||
|
||||
client.RegisterCallback<SteamNative.LobbyDataUpdate_t>( OnLobbyDataUpdatedAPI );
|
||||
client.RegisterCallback<SteamNative.LobbyChatMsg_t>( OnLobbyChatMessageRecievedAPI );
|
||||
client.RegisterCallback<SteamNative.LobbyChatUpdate_t>( OnLobbyStateUpdatedAPI );
|
||||
client.RegisterCallback<SteamNative.GameLobbyJoinRequested_t>( OnLobbyJoinRequestedAPI );
|
||||
client.RegisterCallback<SteamNative.LobbyInvite_t>( OnUserInvitedToLobbyAPI );
|
||||
client.RegisterCallback<SteamNative.PersonaStateChange_t>( OnLobbyMemberPersonaChangeAPI );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The CSteamID of the lobby we're currently in.
|
||||
/// </summary>
|
||||
public ulong CurrentLobby { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The LobbyData of the CurrentLobby. Note this is the global data for the lobby. Use SetMemberData to set specific member data.
|
||||
/// </summary>
|
||||
public LobbyData CurrentLobbyData { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this lobby is valid, ie, we've succesffuly created and/or joined a lobby.
|
||||
/// </summary>
|
||||
public bool IsValid => CurrentLobby != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Join a Lobby through its LobbyID. OnLobbyJoined is called with the result of the Join attempt.
|
||||
/// </summary>
|
||||
/// <param name="lobbyID">CSteamID of lobby to join</param>
|
||||
public void Join( ulong lobbyID )
|
||||
{
|
||||
Leave();
|
||||
client.native.matchmaking.JoinLobby( lobbyID, OnLobbyJoinedAPI );
|
||||
}
|
||||
|
||||
void OnLobbyJoinedAPI( LobbyEnter_t callback, bool error )
|
||||
{
|
||||
if ( error || (callback.EChatRoomEnterResponse != (uint)(SteamNative.ChatRoomEnterResponse.Success)) )
|
||||
{
|
||||
if ( OnLobbyJoined != null ) { OnLobbyJoined( false ); }
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentLobby = callback.SteamIDLobby;
|
||||
UpdateLobbyData();
|
||||
if ( OnLobbyJoined != null ) { OnLobbyJoined( true ); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a lobby has been attempted joined. Returns true if lobby was successfuly joined, false if not.
|
||||
/// </summary>
|
||||
public Action<bool> OnLobbyJoined;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a lobby and returns the created lobby. You auto join the created lobby. The lobby is stored in Client.Lobby.CurrentLobby if successful.
|
||||
/// </summary>
|
||||
/// <param name="lobbyType">The Lobby.Type of Lobby to be created</param>
|
||||
/// <param name="maxMembers">The maximum amount of people you want to be able to be in this lobby, including yourself</param>
|
||||
public void Create( Lobby.Type lobbyType, int maxMembers )
|
||||
{
|
||||
client.native.matchmaking.CreateLobby( (SteamNative.LobbyType)lobbyType, maxMembers, OnLobbyCreatedAPI );
|
||||
createdLobbyType = lobbyType;
|
||||
}
|
||||
|
||||
internal Type createdLobbyType;
|
||||
|
||||
internal void OnLobbyCreatedAPI( LobbyCreated_t callback, bool error )
|
||||
{
|
||||
//from SpaceWarClient.cpp 793
|
||||
if ( error || (callback.Result != Result.OK) )
|
||||
{
|
||||
if ( OnLobbyCreated != null ) { OnLobbyCreated( false ); }
|
||||
return;
|
||||
}
|
||||
|
||||
//set owner specific properties
|
||||
Owner = client.SteamId;
|
||||
CurrentLobby = callback.SteamIDLobby;
|
||||
CurrentLobbyData = new LobbyData( client, CurrentLobby );
|
||||
Name = client.Username + "'s Lobby";
|
||||
CurrentLobbyData.SetData( "appid", client.AppId.ToString() );
|
||||
LobbyType = createdLobbyType;
|
||||
CurrentLobbyData.SetData( "lobbytype", LobbyType.ToString() );
|
||||
Joinable = true;
|
||||
if ( OnLobbyCreated != null ) { OnLobbyCreated( true ); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback for when lobby is created. Parameter resolves true when the Lobby was successfully created
|
||||
/// </summary>
|
||||
public Action<bool> OnLobbyCreated;
|
||||
|
||||
/// <summary>
|
||||
/// Sets user data for the Lobby. Things like Character, Skin, Ready, etc. Can only set your own member data
|
||||
/// </summary>
|
||||
public void SetMemberData( string key, string value )
|
||||
{
|
||||
if ( CurrentLobby == 0 ) { return; }
|
||||
client.native.matchmaking.SetLobbyMemberData( CurrentLobby, key, value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the per-user metadata from this lobby. Can get data from any user
|
||||
/// </summary>
|
||||
/// <param name="steamID">ulong SteamID of the user you want to get data from</param>
|
||||
/// <param name="key">String key of the type of data you want to get</param>
|
||||
/// <returns></returns>
|
||||
public string GetMemberData( ulong steamID, string key )
|
||||
{
|
||||
if ( CurrentLobby == 0 ) { return "ERROR: NOT IN ANY LOBBY"; }
|
||||
return client.native.matchmaking.GetLobbyMemberData( CurrentLobby, steamID, key );
|
||||
}
|
||||
|
||||
internal void OnLobbyDataUpdatedAPI( LobbyDataUpdate_t callback )
|
||||
{
|
||||
if ( callback.SteamIDLobby != CurrentLobby ) return;
|
||||
|
||||
if ( callback.SteamIDLobby == CurrentLobby ) //actual lobby data was updated by owner
|
||||
{
|
||||
UpdateLobbyData();
|
||||
}
|
||||
|
||||
if ( UserIsInCurrentLobby( callback.SteamIDMember ) ) //some member of this lobby updated their information
|
||||
{
|
||||
if ( OnLobbyMemberDataUpdated != null ) { OnLobbyMemberDataUpdated( callback.SteamIDMember ); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the LobbyData property to have the data for the current lobby, if any
|
||||
/// </summary>
|
||||
private bool suppressUpdateLobbyData = false;
|
||||
internal void UpdateLobbyData()
|
||||
{
|
||||
if (suppressUpdateLobbyData) { return; }
|
||||
try
|
||||
{
|
||||
suppressUpdateLobbyData = true;
|
||||
int dataCount = client.native.matchmaking.GetLobbyDataCount(CurrentLobby);
|
||||
CurrentLobbyData = new LobbyData(client, CurrentLobby);
|
||||
for (int i = 0; i < dataCount; i++)
|
||||
{
|
||||
if (client.native.matchmaking.GetLobbyDataByIndex(CurrentLobby, i, out string key, out string value))
|
||||
{
|
||||
CurrentLobbyData.SetData(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
if (OnLobbyDataUpdated != null) { OnLobbyDataUpdated(); }
|
||||
}
|
||||
finally
|
||||
{
|
||||
suppressUpdateLobbyData = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the lobby data itself has been updated. Called when someone has joined/left, Owner has updated data, etc.
|
||||
/// </summary>
|
||||
public Action OnLobbyDataUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Called when a member of the lobby has updated either their personal Lobby metadata or someone's global steam state has changed (like a display name). Parameter is the user who changed.
|
||||
/// </summary>
|
||||
public Action<ulong> OnLobbyMemberDataUpdated;
|
||||
|
||||
|
||||
public Type LobbyType
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !IsValid ) { return Type.Error; } //if we're currently in a valid server
|
||||
|
||||
//we know that we've set the lobby type via the lobbydata in the creation function
|
||||
//ps this is important because steam doesn't have an easy way to get lobby type (why idk)
|
||||
string lobbyType = CurrentLobbyData.GetData( "lobbytype" );
|
||||
switch ( lobbyType )
|
||||
{
|
||||
case "Private":
|
||||
return Type.Private;
|
||||
case "FriendsOnly":
|
||||
return Type.FriendsOnly;
|
||||
case "Invisible":
|
||||
return Type.Invisible;
|
||||
case "Public":
|
||||
return Type.Public;
|
||||
default:
|
||||
return Type.Error;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( !IsValid ) { return; }
|
||||
if ( client.native.matchmaking.SetLobbyType( CurrentLobby, (SteamNative.LobbyType)value ) )
|
||||
{
|
||||
CurrentLobbyData.SetData( "lobbytype", value.ToString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] chatMessageData = new byte[1024 * 4];
|
||||
|
||||
private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callback )
|
||||
{
|
||||
//from Client.Networking
|
||||
if ( callback.SteamIDLobby != CurrentLobby )
|
||||
return;
|
||||
|
||||
SteamNative.CSteamID steamid = 1;
|
||||
ChatEntryType chatEntryType; // "If set then this will just always return k_EChatEntryTypeChatMsg. This can usually just be set to NULL."
|
||||
int readData = 0;
|
||||
fixed ( byte* p = chatMessageData )
|
||||
{
|
||||
readData = client.native.matchmaking.GetLobbyChatEntry( CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, chatMessageData.Length, out chatEntryType );
|
||||
}
|
||||
|
||||
|
||||
OnChatMessageRecieved?.Invoke( steamid, chatMessageData, readData );
|
||||
|
||||
if ( readData > 0 )
|
||||
{
|
||||
OnChatStringRecieved?.Invoke( steamid, Encoding.UTF8.GetString( chatMessageData, 0, readData ) );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback to get chat messages. Use Encoding.UTF8.GetString to retrive the message.
|
||||
/// </summary>
|
||||
public Action<ulong, byte[], int> OnChatMessageRecieved;
|
||||
|
||||
/// <summary>
|
||||
/// Like OnChatMessageRecieved but the data is converted to a string
|
||||
/// </summary>
|
||||
public Action<ulong, string> OnChatStringRecieved;
|
||||
|
||||
/// <summary>
|
||||
/// Broadcasts a chat message to the all the users in the lobby users in the lobby (including the local user) will receive a LobbyChatMsg_t callback.
|
||||
/// </summary>
|
||||
/// <returns>True if message successfully sent</returns>
|
||||
public unsafe bool SendChatMessage( string message )
|
||||
{
|
||||
var data = Encoding.UTF8.GetBytes( message );
|
||||
fixed ( byte* p = data )
|
||||
{
|
||||
// pvMsgBody can be binary or text data, up to 4k
|
||||
// if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator
|
||||
return client.native.matchmaking.SendLobbyChatMsg( CurrentLobby, (IntPtr)p, data.Length );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enums to catch the state of a user when their state has changed
|
||||
/// </summary>
|
||||
public enum MemberStateChange
|
||||
{
|
||||
Entered = ChatMemberStateChange.Entered,
|
||||
Left = ChatMemberStateChange.Left,
|
||||
Disconnected = ChatMemberStateChange.Disconnected,
|
||||
Kicked = ChatMemberStateChange.Kicked,
|
||||
Banned = ChatMemberStateChange.Banned,
|
||||
}
|
||||
|
||||
internal void OnLobbyStateUpdatedAPI( LobbyChatUpdate_t callback )
|
||||
{
|
||||
if ( callback.SteamIDLobby != CurrentLobby )
|
||||
return;
|
||||
|
||||
MemberStateChange change = (MemberStateChange)callback.GfChatMemberStateChange;
|
||||
ulong initiator = callback.SteamIDMakingChange;
|
||||
ulong affected = callback.SteamIDUserChanged;
|
||||
|
||||
OnLobbyStateChanged?.Invoke( change, initiator, affected );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the state of the Lobby is somehow shifted. Usually when someone joins or leaves the lobby.
|
||||
/// The first ulong is the SteamID of the user that initiated the change.
|
||||
/// The second ulong is the person that was affected
|
||||
/// </summary>
|
||||
public Action<MemberStateChange, ulong, ulong> OnLobbyStateChanged;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the lobby as a property for easy getting/setting. Note that this is setting LobbyData, which you cannot do unless you are the Owner of the lobby
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !IsValid ) { return ""; }
|
||||
return CurrentLobbyData.GetData( "name" );
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( !IsValid ) { return; }
|
||||
CurrentLobbyData.SetData( "name", value );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if we're the current owner
|
||||
/// </summary>
|
||||
public bool IsOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return Owner == client.SteamId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Owner of the current lobby. Returns 0 if you are not in a valid lobby.
|
||||
/// </summary>
|
||||
public ulong Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( IsValid )
|
||||
{
|
||||
return client.native.matchmaking.GetLobbyOwner( CurrentLobby );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( Owner == value ) return;
|
||||
client.native.matchmaking.SetLobbyOwner( CurrentLobby, value );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is the Lobby joinable by other people? Defaults to true;
|
||||
/// </summary>
|
||||
public bool Joinable
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !IsValid ) { return false; }
|
||||
string joinable = CurrentLobbyData.GetData( "joinable" );
|
||||
switch ( joinable )
|
||||
{
|
||||
case "true":
|
||||
return true;
|
||||
case "false":
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( !IsValid ) { return; }
|
||||
if ( client.native.matchmaking.SetLobbyJoinable( CurrentLobby, value ) )
|
||||
{
|
||||
CurrentLobbyData.SetData( "joinable", value.ToString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How many people can be in the Lobby
|
||||
/// </summary>
|
||||
public int MaxMembers
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !IsValid ) { return 0; } //0 is default, but value is inited when lobby is created.
|
||||
return client.native.matchmaking.GetLobbyMemberLimit( CurrentLobby );
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( !IsValid ) { return; }
|
||||
client.native.matchmaking.SetLobbyMemberLimit( CurrentLobby, value );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How many people are currently in the Lobby
|
||||
/// </summary>
|
||||
public int NumMembers
|
||||
{
|
||||
get { return client.native.matchmaking.GetNumLobbyMembers( CurrentLobby ); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Leave the CurrentLobby.
|
||||
/// </summary>
|
||||
public void Leave()
|
||||
{
|
||||
if ( CurrentLobby != 0 )
|
||||
{
|
||||
client.native.matchmaking.LeaveLobby( CurrentLobby );
|
||||
}
|
||||
|
||||
CurrentLobby = 0;
|
||||
CurrentLobbyData = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an array of all the CSteamIDs in the CurrentLobby.
|
||||
/// Note that you must be in the Lobby you are trying to request the MemberIDs from.
|
||||
/// Returns an empty array if you aren't in a lobby.
|
||||
/// </summary>
|
||||
/// <returns>Array of member SteamIDs</returns>
|
||||
public ulong[] GetMemberIDs()
|
||||
{
|
||||
int numMembers = NumMembers;
|
||||
ulong[] memIDs = new ulong[numMembers];
|
||||
for ( int i = 0; i < numMembers; i++ )
|
||||
{
|
||||
int currNumMembers = NumMembers;
|
||||
if (i >= currNumMembers)
|
||||
{
|
||||
Array.Resize<ulong>(ref memIDs, currNumMembers);
|
||||
break;
|
||||
}
|
||||
memIDs[i] = client.native.matchmaking.GetLobbyMemberByIndex( CurrentLobby, i );
|
||||
}
|
||||
return memIDs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a user is in your CurrentLobby
|
||||
/// </summary>
|
||||
/// <param name="steamID">SteamID of the user to check for</param>
|
||||
/// <returns></returns>
|
||||
public bool UserIsInCurrentLobby( ulong steamID )
|
||||
{
|
||||
if ( CurrentLobby == 0 )
|
||||
return false;
|
||||
|
||||
ulong[] mems = GetMemberIDs();
|
||||
|
||||
for ( int i = 0; i < mems.Length; i++ )
|
||||
{
|
||||
if ( mems[i] == steamID )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invites the specified user to the CurrentLobby the user is in.
|
||||
/// </summary>
|
||||
/// <param name="friendID">ulong ID of person to invite</param>
|
||||
public bool InviteUserToLobby( ulong friendID )
|
||||
{
|
||||
return client.native.matchmaking.InviteUserToLobby( CurrentLobby, friendID );
|
||||
}
|
||||
|
||||
internal void OnUserInvitedToLobbyAPI( LobbyInvite_t callback )
|
||||
{
|
||||
if ( callback.GameID != client.AppId ) return;
|
||||
if ( OnUserInvitedToLobby != null ) { OnUserInvitedToLobby( callback.SteamIDLobby, callback.SteamIDUser ); }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activates the steam overlay to invite friends to the CurrentLobby the user is in.
|
||||
/// </summary>
|
||||
public void OpenFriendInviteOverlay()
|
||||
{
|
||||
client.native.friends.ActivateGameOverlayInviteDialog(CurrentLobby);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a user invites the current user to a lobby. The first parameter is the lobby the user was invited to, the second is the CSteamID of the person who invited this user
|
||||
/// </summary>
|
||||
public Action<ulong, ulong> OnUserInvitedToLobby;
|
||||
|
||||
/// <summary>
|
||||
/// Called when a user accepts an invitation to a lobby while the game is running. The parameter is a lobby id.
|
||||
/// </summary>
|
||||
public Action<ulong> OnLobbyJoinRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Joins a lobby if a request was made to join the lobby through the friends list or an invite
|
||||
/// </summary>
|
||||
internal void OnLobbyJoinRequestedAPI( GameLobbyJoinRequested_t callback )
|
||||
{
|
||||
if (OnLobbyJoinRequested != null) { OnLobbyJoinRequested(callback.SteamIDLobby); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Makes sure we send an update callback if a Lobby user updates their information
|
||||
/// </summary>
|
||||
internal void OnLobbyMemberPersonaChangeAPI( PersonaStateChange_t callback )
|
||||
{
|
||||
if ( !UserIsInCurrentLobby( callback.SteamID ) ) return;
|
||||
if ( OnLobbyMemberDataUpdated != null ) { OnLobbyMemberDataUpdated( callback.SteamID ); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the game server associated with the lobby.
|
||||
/// This can only be set by the owner of the lobby.
|
||||
/// Either the IP/Port or the Steam ID of the game server must be valid, depending on how you want the clients to be able to connect.
|
||||
/// </summary>
|
||||
public bool SetGameServer( System.Net.IPAddress ip, int port, ulong serverSteamId = 0 )
|
||||
{
|
||||
if ( !IsValid || !IsOwner ) return false;
|
||||
|
||||
var ipint = System.Net.IPAddress.NetworkToHostOrder( ip.Address );
|
||||
client.native.matchmaking.SetLobbyGameServer( CurrentLobby, (uint)ipint, (ushort)port, serverSteamId );
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the details of a game server set in a lobby.
|
||||
/// </summary>
|
||||
public System.Net.IPAddress GameServerIp
|
||||
{
|
||||
get
|
||||
{
|
||||
uint ip;
|
||||
ushort port;
|
||||
CSteamID steamid;
|
||||
|
||||
if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) || ip == 0 )
|
||||
return null;
|
||||
|
||||
return new System.Net.IPAddress( System.Net.IPAddress.HostToNetworkOrder( ip ) );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the details of a game server set in a lobby.
|
||||
/// </summary>
|
||||
public int GameServerPort
|
||||
{
|
||||
get
|
||||
{
|
||||
uint ip;
|
||||
ushort port;
|
||||
CSteamID steamid;
|
||||
|
||||
if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) )
|
||||
return 0;
|
||||
|
||||
return (int)port;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the details of a game server set in a lobby.
|
||||
/// </summary>
|
||||
public ulong GameServerSteamId
|
||||
{
|
||||
get
|
||||
{
|
||||
uint ip;
|
||||
ushort port;
|
||||
CSteamID steamid;
|
||||
|
||||
if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) )
|
||||
return 0;
|
||||
|
||||
return steamid;
|
||||
}
|
||||
}
|
||||
|
||||
/*not implemented
|
||||
|
||||
//set the game server of the lobby
|
||||
client.native.matchmaking.GetLobbyGameServer;
|
||||
client.native.matchmaking.SetLobbyGameServer;
|
||||
|
||||
//used with game server stuff
|
||||
SteamNative.LobbyGameCreated_t
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class LobbyList
|
||||
{
|
||||
public class Lobby
|
||||
{
|
||||
private Dictionary<string, string> lobbyData;
|
||||
internal Client Client;
|
||||
public string Name { get; private set; }
|
||||
public ulong LobbyID { get; private set; }
|
||||
public ulong Owner { get; private set; }
|
||||
public int MemberLimit{ get; private set; }
|
||||
public int NumMembers{ get; private set; }
|
||||
public string LobbyType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the lobby value for the specific key
|
||||
/// </summary>
|
||||
/// <param name="k">The key to find</param>
|
||||
/// <returns>The value at key</returns>
|
||||
public string GetData(string k)
|
||||
{
|
||||
if (lobbyData.TryGetValue(k, out var v))
|
||||
return v;
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of all the data in the Lobby
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of all the key/value pairs in the data</returns>
|
||||
public Dictionary<string, string> GetAllData()
|
||||
{
|
||||
var returnData = new Dictionary<string, string>();
|
||||
|
||||
foreach ( var item in lobbyData)
|
||||
{
|
||||
returnData.Add(item.Key, item.Value);
|
||||
}
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
internal static Lobby FromSteam(Client client, ulong lobby)
|
||||
{
|
||||
var lobbyData = new Dictionary<string, string>();
|
||||
int dataCount = client.native.matchmaking.GetLobbyDataCount(lobby);
|
||||
|
||||
for (int i = 0; i < dataCount; i++)
|
||||
{
|
||||
if (client.native.matchmaking.GetLobbyDataByIndex(lobby, i, out var datakey, out var datavalue))
|
||||
{
|
||||
lobbyData.Add(datakey, datavalue);
|
||||
}
|
||||
}
|
||||
|
||||
return new Lobby()
|
||||
{
|
||||
Client = client,
|
||||
LobbyID = lobby,
|
||||
Name = client.native.matchmaking.GetLobbyData(lobby, "name"),
|
||||
LobbyType = client.native.matchmaking.GetLobbyData(lobby, "lobbytype"),
|
||||
MemberLimit = client.native.matchmaking.GetLobbyMemberLimit(lobby),
|
||||
Owner = client.native.matchmaking.GetLobbyOwner(lobby),
|
||||
NumMembers = client.native.matchmaking.GetNumLobbyMembers(lobby),
|
||||
lobbyData = lobbyData
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
|
||||
//TODO: this entire file is the main reason why we need to update this library
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class LobbyList : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public Action<Lobby> OnLobbyDataReceived;
|
||||
|
||||
internal LobbyList(Client client)
|
||||
{
|
||||
client.RegisterCallback<SteamNative.LobbyDataUpdate_t>(OnLobbyDataUpdated);
|
||||
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
List<ulong> pendingCallbacks = new List<ulong>();
|
||||
public void Update()
|
||||
{
|
||||
lock (pendingCallbacks)
|
||||
{
|
||||
foreach (ulong lobbyId in pendingCallbacks)
|
||||
{
|
||||
OnLobbyDataReceived?.Invoke(Lobby.FromSteam(client, lobbyId));
|
||||
}
|
||||
pendingCallbacks.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refresh the List of Lobbies. If no filter is passed in, a default one is created that filters based on AppId ("appid").
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
public void Request(Filter filter = null)
|
||||
{
|
||||
//init out values
|
||||
if (filter == null)
|
||||
{
|
||||
filter = new Filter();
|
||||
filter.StringFilters.Add("appid", client.AppId.ToString());
|
||||
filter.DistanceFilter = Filter.Distance.Worldwide;
|
||||
}
|
||||
|
||||
client.native.matchmaking.AddRequestLobbyListDistanceFilter((SteamNative.LobbyDistanceFilter)filter.DistanceFilter);
|
||||
|
||||
if (filter.SlotsAvailable != null)
|
||||
{
|
||||
client.native.matchmaking.AddRequestLobbyListFilterSlotsAvailable((int)filter.SlotsAvailable);
|
||||
}
|
||||
|
||||
if (filter.MaxResults != null)
|
||||
{
|
||||
client.native.matchmaking.AddRequestLobbyListResultCountFilter((int)filter.MaxResults);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, string> fil in filter.StringFilters)
|
||||
{
|
||||
client.native.matchmaking.AddRequestLobbyListStringFilter(fil.Key, fil.Value, SteamNative.LobbyComparison.Equal);
|
||||
}
|
||||
foreach (KeyValuePair<string, int> fil in filter.NearFilters)
|
||||
{
|
||||
client.native.matchmaking.AddRequestLobbyListNearValueFilter(fil.Key, fil.Value);
|
||||
}
|
||||
|
||||
// this will never return lobbies that are full (via the actual api)
|
||||
client.native.matchmaking.RequestLobbyList(OnLobbyList);
|
||||
|
||||
}
|
||||
|
||||
void OnLobbyList(LobbyMatchList_t callback, bool error)
|
||||
{
|
||||
if (error) return;
|
||||
|
||||
//how many lobbies matched
|
||||
uint lobbiesMatching = callback.LobbiesMatching;
|
||||
|
||||
// lobbies are returned in order of closeness to the user, so add them to the list in that order
|
||||
for (int i = 0; i < lobbiesMatching; i++)
|
||||
{
|
||||
//request lobby data
|
||||
ulong lobby = client.native.matchmaking.GetLobbyByIndex(i);
|
||||
|
||||
client.native.matchmaking.RequestLobbyData(lobby);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void OnLobbyDataUpdated(LobbyDataUpdate_t callback)
|
||||
{
|
||||
if (callback.Success == 1) //1 if success, 0 if failure
|
||||
{
|
||||
lock (pendingCallbacks)
|
||||
{
|
||||
pendingCallbacks.Add(callback.SteamIDLobby);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Lobby GetLobbyFromID(ulong lobbyId)
|
||||
{
|
||||
return Lobby.FromSteam(client, lobbyId);
|
||||
}
|
||||
|
||||
public void RequestLobbyData(ulong lobby)
|
||||
{
|
||||
client.native.matchmaking.RequestLobbyData(lobby);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
|
||||
public class Filter
|
||||
{
|
||||
// Filters that match actual metadata keys exactly
|
||||
public Dictionary<string, string> StringFilters = new Dictionary<string, string>();
|
||||
// Filters that are of string key and int value for that key to be close to
|
||||
public Dictionary<string, int> NearFilters = new Dictionary<string, int>();
|
||||
//Filters that are of string key and int value, with a comparison filter to say how we should relate to the value
|
||||
//public Dictionary<string, KeyValuePair<Comparison, int>> NumericalFilters = new Dictionary<string, KeyValuePair<Comparison, int>>();
|
||||
public Distance DistanceFilter = Distance.Worldwide;
|
||||
public int? SlotsAvailable { get; set; }
|
||||
public int? MaxResults { get; set; }
|
||||
|
||||
public enum Distance : int
|
||||
{
|
||||
Close = SteamNative.LobbyDistanceFilter.Close,
|
||||
Default = SteamNative.LobbyDistanceFilter.Default,
|
||||
Far = SteamNative.LobbyDistanceFilter.Far,
|
||||
Worldwide = SteamNative.LobbyDistanceFilter.Worldwide
|
||||
}
|
||||
|
||||
public enum Comparison : int
|
||||
{
|
||||
EqualToOrLessThan = SteamNative.LobbyComparison.EqualToOrLessThan,
|
||||
LessThan = SteamNative.LobbyComparison.LessThan,
|
||||
Equal = SteamNative.LobbyComparison.Equal,
|
||||
GreaterThan = SteamNative.LobbyComparison.GreaterThan,
|
||||
EqualToOrGreaterThan = SteamNative.LobbyComparison.EqualToOrGreaterThan,
|
||||
NotEqual = SteamNative.LobbyComparison.NotEqual
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class MicroTransactions : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public delegate void AuthorizationResponse( bool authorized, int appId, ulong orderId );
|
||||
|
||||
/// <summary>
|
||||
/// Called on the MicroTxnAuthorizationResponse_t event
|
||||
/// </summary>
|
||||
public event AuthorizationResponse OnAuthorizationResponse;
|
||||
|
||||
internal MicroTransactions( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
client.RegisterCallback<SteamNative.MicroTxnAuthorizationResponse_t>( onMicroTxnAuthorizationResponse );
|
||||
}
|
||||
|
||||
private void onMicroTxnAuthorizationResponse( MicroTxnAuthorizationResponse_t arg1 )
|
||||
{
|
||||
if ( OnAuthorizationResponse != null )
|
||||
{
|
||||
OnAuthorizationResponse( arg1.Authorized == 1, (int) arg1.AppID, arg1.OrderID );
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class Overlay
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get { return client.native.utils.IsOverlayEnabled(); }
|
||||
}
|
||||
|
||||
public bool IsOpen { get; private set; }
|
||||
|
||||
internal Overlay( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
c.RegisterCallback<GameOverlayActivated_t>( OverlayStateChange );
|
||||
}
|
||||
|
||||
private void OverlayStateChange( GameOverlayActivated_t activation )
|
||||
{
|
||||
IsOpen = activation.Active == 1;
|
||||
}
|
||||
|
||||
public void OpenUserPage( string name, ulong steamid ) { client.native.friends.ActivateGameOverlayToUser( name, steamid ); }
|
||||
|
||||
public void OpenProfile( ulong steamid ) { OpenUserPage( "steamid", steamid ); }
|
||||
public void OpenChat( ulong steamid ){ OpenUserPage( "chat", steamid ); }
|
||||
public void OpenTrade( ulong steamid ) { OpenUserPage( "jointrade", steamid ); }
|
||||
public void OpenStats( ulong steamid ) { OpenUserPage( "stats", steamid ); }
|
||||
public void OpenAchievements( ulong steamid ) { OpenUserPage( "achievements", steamid ); }
|
||||
public void AddFriend( ulong steamid ) { OpenUserPage( "friendadd", steamid ); }
|
||||
public void RemoveFriend( ulong steamid ) { OpenUserPage( "friendremove", steamid ); }
|
||||
public void AcceptFriendRequest( ulong steamid ) { OpenUserPage( "friendrequestaccept", steamid ); }
|
||||
public void IgnoreFriendRequest( ulong steamid ) { OpenUserPage( "friendrequestignore", steamid ); }
|
||||
|
||||
public void OpenUrl( string url ) { client.native.friends.ActivateGameOverlayToWebPage( url ); }
|
||||
}
|
||||
}
|
||||
@@ -1,323 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Facepunch.Steamworks.Callbacks;
|
||||
using SteamNative;
|
||||
using Result = SteamNative.Result;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a file stored in a user's Steam Cloud.
|
||||
/// </summary>
|
||||
public class RemoteFile
|
||||
{
|
||||
internal readonly RemoteStorage remoteStorage;
|
||||
|
||||
private readonly bool _isUgc;
|
||||
private string _fileName;
|
||||
private int _sizeInBytes = -1;
|
||||
private long _timestamp = 0;
|
||||
private UGCHandle_t _handle;
|
||||
private ulong _ownerId;
|
||||
|
||||
private bool _isDownloading;
|
||||
private byte[] _downloadedData;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the file exists.
|
||||
/// </summary>
|
||||
public bool Exists { get; internal set; }
|
||||
|
||||
public bool IsDownloading { get { return _isUgc && _isDownloading && _downloadedData == null; } }
|
||||
|
||||
public bool IsDownloaded { get { return !_isUgc || _downloadedData != null; } }
|
||||
|
||||
/// <summary>
|
||||
/// If true, the file is available for other users to download.
|
||||
/// </summary>
|
||||
public bool IsShared { get { return _handle.Value != 0; } }
|
||||
|
||||
internal UGCHandle_t UGCHandle { get { return _handle; } }
|
||||
|
||||
public ulong SharingId { get { return UGCHandle.Value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Name and path of the file.
|
||||
/// </summary>
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _fileName != null ) return _fileName;
|
||||
GetUGCDetails();
|
||||
return _fileName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Steam ID of the file's owner.
|
||||
/// </summary>
|
||||
public ulong OwnerId
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _ownerId != 0 ) return _ownerId;
|
||||
GetUGCDetails();
|
||||
return _ownerId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Total size of the file in bytes.
|
||||
/// </summary>
|
||||
public int SizeInBytes
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _sizeInBytes != -1 ) return _sizeInBytes;
|
||||
if ( _isUgc ) throw new NotImplementedException();
|
||||
_sizeInBytes = remoteStorage.native.GetFileSize( FileName );
|
||||
return _sizeInBytes;
|
||||
}
|
||||
internal set { _sizeInBytes = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Date modified timestamp in epoch format.
|
||||
/// </summary>
|
||||
public long FileTimestamp
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _timestamp != 0 ) return _timestamp;
|
||||
if (_isUgc) throw new NotImplementedException();
|
||||
_timestamp = remoteStorage.native.GetFileTimestamp(FileName);
|
||||
return _timestamp;
|
||||
}
|
||||
internal set { _timestamp = value; }
|
||||
}
|
||||
|
||||
internal RemoteFile( RemoteStorage r, UGCHandle_t handle )
|
||||
{
|
||||
Exists = true;
|
||||
|
||||
remoteStorage = r;
|
||||
|
||||
_isUgc = true;
|
||||
_handle = handle;
|
||||
}
|
||||
|
||||
internal RemoteFile( RemoteStorage r, string name, ulong ownerId, int sizeInBytes = -1, long timestamp = 0 )
|
||||
{
|
||||
remoteStorage = r;
|
||||
|
||||
_isUgc = false;
|
||||
_fileName = name;
|
||||
_ownerId = ownerId;
|
||||
_sizeInBytes = sizeInBytes;
|
||||
_timestamp = timestamp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="RemoteFileWriteStream"/> used to write to this file.
|
||||
/// </summary>
|
||||
public RemoteFileWriteStream OpenWrite()
|
||||
{
|
||||
if (_isUgc) throw new InvalidOperationException("Cannot write to a shared file.");
|
||||
|
||||
return new RemoteFileWriteStream( remoteStorage, this );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a byte array to this file, replacing any existing contents.
|
||||
/// </summary>
|
||||
public void WriteAllBytes( byte[] buffer )
|
||||
{
|
||||
using ( var stream = OpenWrite() )
|
||||
{
|
||||
stream.Write( buffer, 0, buffer.Length );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a string to this file, replacing any existing contents.
|
||||
/// </summary>
|
||||
public void WriteAllText( string text, Encoding encoding = null )
|
||||
{
|
||||
if ( encoding == null ) encoding = Encoding.UTF8;
|
||||
WriteAllBytes( encoding.GetBytes( text ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback invoked by <see cref="RemoteFile.Download"/> when a file download is complete.
|
||||
/// </summary>
|
||||
public delegate void DownloadCallback();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of bytes downloaded and the total number of bytes expected while
|
||||
/// this file is downloading.
|
||||
/// </summary>
|
||||
/// <returns>True if the file is downloading</returns>
|
||||
public bool GetDownloadProgress( out int bytesDownloaded, out int bytesExpected )
|
||||
{
|
||||
return remoteStorage.native.GetUGCDownloadProgress( _handle, out bytesDownloaded, out bytesExpected );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to start downloading a shared file.
|
||||
/// </summary>
|
||||
/// <returns>True if the download has successfully started</returns>
|
||||
public bool Download( DownloadCallback onSuccess = null, FailureCallback onFailure = null )
|
||||
{
|
||||
if ( !_isUgc ) return false;
|
||||
if ( _isDownloading ) return false;
|
||||
if ( IsDownloaded ) return false;
|
||||
|
||||
_isDownloading = true;
|
||||
|
||||
remoteStorage.native.UGCDownload( _handle, 1000, ( result, error ) =>
|
||||
{
|
||||
_isDownloading = false;
|
||||
|
||||
if ( error || result.Result != Result.OK )
|
||||
{
|
||||
onFailure?.Invoke( result.Result == 0 ? Callbacks.Result.IOFailure : (Callbacks.Result) result.Result );
|
||||
return;
|
||||
}
|
||||
|
||||
_ownerId = result.SteamIDOwner;
|
||||
_sizeInBytes = result.SizeInBytes;
|
||||
_fileName = result.PchFileName;
|
||||
|
||||
unsafe
|
||||
{
|
||||
_downloadedData = new byte[_sizeInBytes];
|
||||
fixed ( byte* bufferPtr = _downloadedData )
|
||||
{
|
||||
remoteStorage.native.UGCRead( _handle, (IntPtr) bufferPtr, _sizeInBytes, 0, UGCReadAction.ontinueReading );
|
||||
}
|
||||
}
|
||||
|
||||
onSuccess?.Invoke();
|
||||
} );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a stream used to read from this file.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Stream OpenRead()
|
||||
{
|
||||
return new MemoryStream( ReadAllBytes(), false );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the entire contents of the file as a byte array.
|
||||
/// </summary>
|
||||
public unsafe byte[] ReadAllBytes()
|
||||
{
|
||||
if ( _isUgc )
|
||||
{
|
||||
if ( !IsDownloaded ) throw new Exception( "Cannot read a file that hasn't been downloaded." );
|
||||
return _downloadedData;
|
||||
}
|
||||
|
||||
var size = SizeInBytes;
|
||||
var buffer = new byte[size];
|
||||
|
||||
fixed ( byte* bufferPtr = buffer )
|
||||
{
|
||||
remoteStorage.native.FileRead( FileName, (IntPtr) bufferPtr, size );
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the entire contents of the file as a string.
|
||||
/// </summary>
|
||||
public string ReadAllText( Encoding encoding = null )
|
||||
{
|
||||
if ( encoding == null ) encoding = Encoding.UTF8;
|
||||
return encoding.GetString( ReadAllBytes() );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback invoked by <see cref="RemoteFile.Share"/> when file sharing is complete.
|
||||
/// </summary>
|
||||
public delegate void ShareCallback();
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to publish this file for other users to download.
|
||||
/// </summary>
|
||||
/// <returns>True if we have started attempting to share</returns>
|
||||
public bool Share( ShareCallback onSuccess = null, FailureCallback onFailure = null )
|
||||
{
|
||||
if ( _isUgc ) return false;
|
||||
|
||||
// Already shared
|
||||
if ( _handle.Value != 0 ) return false;
|
||||
|
||||
remoteStorage.native.FileShare( FileName, ( result, error ) =>
|
||||
{
|
||||
if ( !error && result.Result == Result.OK )
|
||||
{
|
||||
_handle.Value = result.File;
|
||||
onSuccess?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
onFailure?.Invoke( result.Result == 0 ? Callbacks.Result.IOFailure : (Callbacks.Result) result.Result );
|
||||
}
|
||||
} );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete this file from remote storage.
|
||||
/// </summary>
|
||||
/// <returns>True if the file could be deleted</returns>
|
||||
public bool Delete()
|
||||
{
|
||||
if ( !Exists ) return false;
|
||||
if ( _isUgc ) return false;
|
||||
if ( !remoteStorage.native.FileDelete( FileName ) ) return false;
|
||||
|
||||
Exists = false;
|
||||
remoteStorage.InvalidateFiles();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove this file from remote storage, while keeping a local copy.
|
||||
/// Writing to this file again will re-add it to the cloud.
|
||||
/// </summary>
|
||||
/// <returns>True if the file was forgotten</returns>
|
||||
public bool Forget()
|
||||
{
|
||||
if ( !Exists ) return false;
|
||||
if ( _isUgc ) return false;
|
||||
|
||||
return remoteStorage.native.FileForget( FileName );
|
||||
}
|
||||
|
||||
private void GetUGCDetails()
|
||||
{
|
||||
if ( !_isUgc ) throw new InvalidOperationException();
|
||||
|
||||
var appId = new AppId_t { Value = remoteStorage.native.steamworks.AppId };
|
||||
|
||||
CSteamID ownerId;
|
||||
remoteStorage.native.GetUGCDetails( _handle, ref appId, out _fileName, out ownerId );
|
||||
|
||||
_ownerId = ownerId.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Stream used to write to a <see cref="RemoteFile"/>.
|
||||
/// </summary>
|
||||
public class RemoteFileWriteStream : Stream
|
||||
{
|
||||
internal readonly RemoteStorage remoteStorage;
|
||||
|
||||
private readonly UGCFileWriteStreamHandle_t _handle;
|
||||
private readonly RemoteFile _file;
|
||||
|
||||
private int _written;
|
||||
private bool _closed;
|
||||
|
||||
internal RemoteFileWriteStream( RemoteStorage r, RemoteFile file )
|
||||
{
|
||||
remoteStorage = r;
|
||||
|
||||
_handle = remoteStorage.native.FileWriteStreamOpen( file.FileName );
|
||||
_file = file;
|
||||
}
|
||||
|
||||
public override void Flush() { }
|
||||
|
||||
public override int Read( byte[] buffer, int offset, int count )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override long Seek( long offset, SeekOrigin origin )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void SetLength( long value )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override unsafe void Write( byte[] buffer, int offset, int count )
|
||||
{
|
||||
if ( _closed ) throw new ObjectDisposedException( ToString() );
|
||||
|
||||
fixed ( byte* bufferPtr = buffer )
|
||||
{
|
||||
if ( remoteStorage.native.FileWriteStreamWriteChunk( _handle, (IntPtr)(bufferPtr + offset), count ) )
|
||||
{
|
||||
_written += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanRead => false;
|
||||
public override bool CanSeek => false;
|
||||
public override bool CanWrite => true;
|
||||
public override long Length => _written;
|
||||
public override long Position { get { return _written; } set { throw new NotImplementedException(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Close the stream without saving the file to remote storage.
|
||||
/// </summary>
|
||||
public void Cancel()
|
||||
{
|
||||
if ( _closed ) return;
|
||||
|
||||
_closed = true;
|
||||
remoteStorage.native.FileWriteStreamCancel( _handle );
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
if ( _closed ) return;
|
||||
|
||||
_closed = true;
|
||||
remoteStorage.native.FileWriteStreamClose( _handle );
|
||||
|
||||
_file.remoteStorage.OnWrittenNewFile( _file );
|
||||
}
|
||||
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if ( disposing ) Close();
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,269 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles Steam Cloud related actions.
|
||||
/// </summary>
|
||||
public class RemoteStorage : IDisposable
|
||||
{
|
||||
private static string NormalizePath( string path )
|
||||
{
|
||||
// TODO: DUMB HACK ALERT
|
||||
|
||||
return SteamNative.Platform.IsWindows
|
||||
? new FileInfo( $"x:/{path}" ).FullName.Substring( 3 )
|
||||
: new FileInfo( $"/x/{path}" ).FullName.Substring( 3 );
|
||||
}
|
||||
|
||||
internal Client client;
|
||||
internal SteamNative.SteamRemoteStorage native;
|
||||
|
||||
private bool _filesInvalid = true;
|
||||
private readonly List<RemoteFile> _files = new List<RemoteFile>();
|
||||
|
||||
internal RemoteStorage( Client c )
|
||||
{
|
||||
client = c;
|
||||
native = client.native.remoteStorage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if Steam Cloud is currently enabled by the current user.
|
||||
/// </summary>
|
||||
public bool IsCloudEnabledForAccount
|
||||
{
|
||||
get { return native.IsCloudEnabledForAccount(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if Steam Cloud is currently enabled for this app by the current user.
|
||||
/// </summary>
|
||||
public bool IsCloudEnabledForApp
|
||||
{
|
||||
get { return native.IsCloudEnabledForApp(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total number of files in the current user's remote storage for the current game.
|
||||
/// </summary>
|
||||
public int FileCount
|
||||
{
|
||||
get { return native.GetFileCount(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all files in the current user's remote storage for the current game.
|
||||
/// </summary>
|
||||
public IEnumerable<RemoteFile> Files
|
||||
{
|
||||
get
|
||||
{
|
||||
UpdateFiles();
|
||||
return _files;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RemoteFile"/> with the given <paramref name="path"/>.
|
||||
/// If a file exists at that path it will be overwritten.
|
||||
/// </summary>
|
||||
public RemoteFile CreateFile( string path )
|
||||
{
|
||||
path = NormalizePath( path );
|
||||
|
||||
InvalidateFiles();
|
||||
var existing = Files.FirstOrDefault( x => x.FileName == path );
|
||||
return existing ?? new RemoteFile( this, path, client.SteamId, 0 );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the file if it exists, else returns null;
|
||||
/// </summary>
|
||||
public RemoteFile OpenFile( string path )
|
||||
{
|
||||
path = NormalizePath( path );
|
||||
|
||||
InvalidateFiles();
|
||||
var existing = Files.FirstOrDefault( x => x.FileName == path );
|
||||
return existing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a previously shared <see cref="RemoteFile"/>
|
||||
/// with the given <paramref name="sharingId"/>.
|
||||
/// </summary>
|
||||
public RemoteFile OpenSharedFile( ulong sharingId )
|
||||
{
|
||||
return new RemoteFile( this, sharingId );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write all text to the file at the specified path. This
|
||||
/// overwrites the contents - it does not append.
|
||||
/// </summary>
|
||||
public bool WriteString( string path, string text, Encoding encoding = null )
|
||||
{
|
||||
var file = CreateFile( path );
|
||||
file.WriteAllText( text, encoding );
|
||||
return file.Exists;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write all data to the file at the specified path. This
|
||||
/// overwrites the contents - it does not append.
|
||||
/// </summary>
|
||||
public bool WriteBytes( string path, byte[] data )
|
||||
{
|
||||
var file = CreateFile( path );
|
||||
file.WriteAllBytes( data );
|
||||
return file.Exists;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the entire contents of the file as a string.
|
||||
/// Returns null if the file isn't found.
|
||||
/// </summary>
|
||||
public string ReadString( string path, Encoding encoding = null )
|
||||
{
|
||||
var file = OpenFile( path );
|
||||
if ( file == null ) return null;
|
||||
return file.ReadAllText( encoding );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the entire contents of the file as raw data.
|
||||
/// Returns null if the file isn't found.
|
||||
/// </summary>
|
||||
public byte[] ReadBytes( string path )
|
||||
{
|
||||
var file = OpenFile( path );
|
||||
if ( file == null ) return null;
|
||||
return file.ReadAllBytes();
|
||||
}
|
||||
|
||||
internal void OnWrittenNewFile( RemoteFile file )
|
||||
{
|
||||
if ( _files.Any( x => x.FileName == file.FileName ) ) return;
|
||||
|
||||
_files.Add( file );
|
||||
file.Exists = true;
|
||||
|
||||
InvalidateFiles();
|
||||
}
|
||||
|
||||
internal void InvalidateFiles()
|
||||
{
|
||||
_filesInvalid = true;
|
||||
}
|
||||
|
||||
private void UpdateFiles()
|
||||
{
|
||||
if ( !_filesInvalid ) return;
|
||||
_filesInvalid = false;
|
||||
|
||||
foreach ( var file in _files )
|
||||
{
|
||||
file.Exists = false;
|
||||
}
|
||||
|
||||
var count = FileCount;
|
||||
for ( var i = 0; i < count; ++i )
|
||||
{
|
||||
int size;
|
||||
var name = NormalizePath( native.GetFileNameAndSize( i, out size ) );
|
||||
var timestamp = native.GetFileTimestamp(name);
|
||||
|
||||
var existing = _files.FirstOrDefault( x => x.FileName == name );
|
||||
if ( existing == null )
|
||||
{
|
||||
existing = new RemoteFile( this, name, client.SteamId, size, timestamp );
|
||||
_files.Add( existing );
|
||||
}
|
||||
else
|
||||
{
|
||||
existing.SizeInBytes = size;
|
||||
existing.FileTimestamp = timestamp;
|
||||
}
|
||||
|
||||
existing.Exists = true;
|
||||
}
|
||||
|
||||
for ( var i = _files.Count - 1; i >= 0; --i )
|
||||
{
|
||||
if ( !_files[i].Exists ) _files.RemoveAt( i );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether a file exists in remote storage at the given <paramref name="path"/>.
|
||||
/// </summary>
|
||||
public bool FileExists( string path )
|
||||
{
|
||||
return native.FileExists( path );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
native = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes used out of the user's total quota
|
||||
/// </summary>
|
||||
public ulong QuotaUsed
|
||||
{
|
||||
get
|
||||
{
|
||||
ulong totalBytes = 0;
|
||||
ulong availableBytes = 0;
|
||||
|
||||
if ( !native.GetQuota( out totalBytes, out availableBytes ) )
|
||||
return 0;
|
||||
|
||||
return totalBytes - availableBytes;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Total quota size in bytes
|
||||
/// </summary>
|
||||
public ulong QuotaTotal
|
||||
{
|
||||
get
|
||||
{
|
||||
ulong totalBytes = 0;
|
||||
ulong availableBytes = 0;
|
||||
|
||||
if ( !native.GetQuota( out totalBytes, out availableBytes ) )
|
||||
return 0;
|
||||
|
||||
return totalBytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes remaining out of the user's total quota
|
||||
/// </summary>
|
||||
public ulong QuotaRemaining
|
||||
{
|
||||
get
|
||||
{
|
||||
ulong totalBytes = 0;
|
||||
ulong availableBytes = 0;
|
||||
|
||||
if ( !native.GetQuota( out totalBytes, out availableBytes ) )
|
||||
return 0;
|
||||
|
||||
return availableBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Client : IDisposable
|
||||
{
|
||||
Screenshots _screenshots;
|
||||
|
||||
public Screenshots Screenshots
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _screenshots == null )
|
||||
_screenshots = new Screenshots( this );
|
||||
|
||||
return _screenshots;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Screenshots
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
internal Screenshots( Client c )
|
||||
{
|
||||
client = c;
|
||||
}
|
||||
|
||||
public void Trigger()
|
||||
{
|
||||
client.native.screenshots.TriggerScreenshot();
|
||||
}
|
||||
|
||||
public unsafe void Write( byte[] rgbData, int width, int height )
|
||||
{
|
||||
if ( rgbData == null )
|
||||
{
|
||||
throw new ArgumentNullException( nameof(rgbData) );
|
||||
}
|
||||
|
||||
if ( width < 1 )
|
||||
{
|
||||
throw new ArgumentOutOfRangeException( nameof(width), width,
|
||||
$"Expected {nameof(width)} to be at least 1." );
|
||||
}
|
||||
|
||||
if ( height < 1 )
|
||||
{
|
||||
throw new ArgumentOutOfRangeException( nameof(height), height,
|
||||
$"Expected {nameof(height)} to be at least 1." );
|
||||
}
|
||||
|
||||
var size = width * height * 3;
|
||||
if ( rgbData.Length < size )
|
||||
{
|
||||
throw new ArgumentException( nameof(rgbData),
|
||||
$"Expected {nameof(rgbData)} to contain at least {size} elements (actual size: {rgbData.Length})." );
|
||||
}
|
||||
|
||||
fixed ( byte* ptr = rgbData )
|
||||
{
|
||||
client.native.screenshots.WriteScreenshot( (IntPtr) ptr, (uint) rgbData.Length, width, height );
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void AddScreenshotToLibrary( string filename, string thumbnailFilename, int width, int height)
|
||||
{
|
||||
client.native.screenshots.AddScreenshotToLibrary(filename, thumbnailFilename, width, height);
|
||||
}
|
||||
|
||||
public unsafe void AddScreenshotToLibrary( string filename, int width, int height)
|
||||
{
|
||||
client.native.screenshots.AddScreenshotToLibrary(filename, null, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class ServerList
|
||||
{
|
||||
public class Request : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
internal List<SubRequest> Requests = new List<SubRequest>();
|
||||
|
||||
internal class SubRequest
|
||||
{
|
||||
internal IntPtr Request;
|
||||
internal int Pointer = 0;
|
||||
internal List<int> WatchList = new List<int>();
|
||||
internal System.Diagnostics.Stopwatch Timer = System.Diagnostics.Stopwatch.StartNew();
|
||||
|
||||
internal bool Update( SteamNative.SteamMatchmakingServers servers, Action<SteamNative.gameserveritem_t> OnServer, Action OnUpdate )
|
||||
{
|
||||
if ( Request == IntPtr.Zero )
|
||||
return true;
|
||||
|
||||
if ( Timer.Elapsed.TotalSeconds < 0.5f )
|
||||
return false;
|
||||
|
||||
Timer.Reset();
|
||||
Timer.Start();
|
||||
|
||||
bool changes = false;
|
||||
|
||||
//
|
||||
// Add any servers we're not watching to our watch list
|
||||
//
|
||||
var count = servers.GetServerCount( Request );
|
||||
if ( count != Pointer )
|
||||
{
|
||||
for ( int i = Pointer; i < count; i++ )
|
||||
{
|
||||
WatchList.Add( i );
|
||||
}
|
||||
}
|
||||
Pointer = count;
|
||||
|
||||
//
|
||||
// Remove any servers that respond successfully
|
||||
//
|
||||
WatchList.RemoveAll( x =>
|
||||
{
|
||||
var info = servers.GetServerDetails( Request, x );
|
||||
if ( info.HadSuccessfulResponse )
|
||||
{
|
||||
OnServer( info );
|
||||
changes = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
//
|
||||
// If we've finished refreshing
|
||||
//
|
||||
if ( servers.IsRefreshing( Request ) == false )
|
||||
{
|
||||
//
|
||||
// Put any other servers on the 'no response' list
|
||||
//
|
||||
WatchList.RemoveAll( x =>
|
||||
{
|
||||
var info = servers.GetServerDetails( Request, x );
|
||||
OnServer( info );
|
||||
return true;
|
||||
} );
|
||||
|
||||
servers.CancelQuery( Request );
|
||||
Request = IntPtr.Zero;
|
||||
changes = true;
|
||||
}
|
||||
|
||||
if ( changes && OnUpdate != null )
|
||||
OnUpdate();
|
||||
|
||||
return Request == IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public Action OnUpdate;
|
||||
public Action<Server> OnServerResponded;
|
||||
public Action OnFinished;
|
||||
|
||||
/// <summary>
|
||||
/// A list of servers that responded. If you're only interested in servers that responded since you
|
||||
/// last updated, then simply clear this list.
|
||||
/// </summary>
|
||||
public List<Server> Responded = new List<Server>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of servers that were in the master list but didn't respond.
|
||||
/// </summary>
|
||||
public List<Server> Unresponsive = new List<Server>();
|
||||
|
||||
/// <summary>
|
||||
/// True when we have finished
|
||||
/// </summary>
|
||||
public bool Finished = false;
|
||||
|
||||
internal Request( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
client.OnUpdate += Update;
|
||||
}
|
||||
|
||||
~Request()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
internal IEnumerable<string> ServerList { get; set; }
|
||||
internal Filter Filter { get; set; }
|
||||
|
||||
internal void StartCustomQuery()
|
||||
{
|
||||
if ( ServerList == null )
|
||||
return;
|
||||
|
||||
int blockSize = 16;
|
||||
int Pointer = 0;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
var sublist = ServerList.Skip( Pointer ).Take( blockSize );
|
||||
|
||||
if ( sublist.Count() == 0 )
|
||||
break;
|
||||
|
||||
Pointer += sublist.Count();
|
||||
|
||||
var filter = new Filter();
|
||||
filter.Add( "or", sublist.Count().ToString() );
|
||||
|
||||
foreach ( var server in sublist )
|
||||
{
|
||||
filter.Add( "gameaddr", server );
|
||||
}
|
||||
|
||||
filter.Start();
|
||||
var id = client.native.servers.RequestInternetServerList( client.AppId, filter.NativeArray, (uint)filter.Count, IntPtr.Zero );
|
||||
filter.Free();
|
||||
|
||||
AddRequest( id );
|
||||
}
|
||||
|
||||
ServerList = null;
|
||||
}
|
||||
|
||||
internal void AddRequest( IntPtr id )
|
||||
{
|
||||
Requests.Add( new SubRequest() { Request = id } );
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if ( Requests.Count == 0 )
|
||||
return;
|
||||
|
||||
for( int i=0; i< Requests.Count(); i++ )
|
||||
{
|
||||
if ( Requests[i].Update( client.native.servers, OnServer, OnUpdate ) )
|
||||
{
|
||||
Requests.RemoveAt( i );
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Requests.Count == 0 )
|
||||
{
|
||||
Finished = true;
|
||||
client.OnUpdate -= Update;
|
||||
|
||||
OnFinished?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnServer( SteamNative.gameserveritem_t info )
|
||||
{
|
||||
if ( info.HadSuccessfulResponse )
|
||||
{
|
||||
if ( Filter != null && !Filter.Test( info ) )
|
||||
return;
|
||||
|
||||
var s = Server.FromSteam( client, info );
|
||||
Responded.Add( s );
|
||||
|
||||
OnServerResponded?.Invoke( s );
|
||||
}
|
||||
else
|
||||
{
|
||||
Unresponsive.Add( Server.FromSteam( client, info ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposing will end the query
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if ( client.IsValid )
|
||||
client.OnUpdate -= Update;
|
||||
|
||||
//
|
||||
// Cancel the query if it's still running
|
||||
//
|
||||
foreach( var subRequest in Requests )
|
||||
{
|
||||
if ( client.IsValid )
|
||||
client.native.servers.CancelQuery( subRequest.Request );
|
||||
}
|
||||
Requests.Clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class ServerList
|
||||
{
|
||||
public class Server
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Ping { get; set; }
|
||||
public string GameDir { get; set; }
|
||||
public string Map { get; set; }
|
||||
public string Description { get; set; }
|
||||
public uint AppId { get; set; }
|
||||
public int Players { get; set; }
|
||||
public int MaxPlayers { get; set; }
|
||||
public int BotPlayers { get; set; }
|
||||
public bool Passworded { get; set; }
|
||||
public bool Secure { get; set; }
|
||||
public uint LastTimePlayed { get; set; }
|
||||
public int Version { get; set; }
|
||||
public string[] Tags { get; set; }
|
||||
public ulong SteamId { get; set; }
|
||||
public IPAddress Address { get; set; }
|
||||
public int ConnectionPort { get; set; }
|
||||
public int QueryPort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this server is in the favourites list
|
||||
/// </summary>
|
||||
public bool Favourite
|
||||
{
|
||||
get
|
||||
{
|
||||
return Client.ServerList.IsFavourite( this );
|
||||
}
|
||||
}
|
||||
|
||||
internal Client Client;
|
||||
|
||||
|
||||
internal static Server FromSteam( Client client, SteamNative.gameserveritem_t item )
|
||||
{
|
||||
int serverNameLength = item.ServerName.Length;
|
||||
for (int i = 0; i < item.ServerName.Length; i++)
|
||||
{
|
||||
if (item.ServerName[i] == '\0')
|
||||
{
|
||||
serverNameLength = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int mapLength = item.Map.Length;
|
||||
for (int i = 0; i < item.Map.Length; i++)
|
||||
{
|
||||
if (item.Map[i] == '\0')
|
||||
{
|
||||
mapLength = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new Server()
|
||||
{
|
||||
Client = client,
|
||||
Address = Utility.Int32ToIp( item.NetAdr.IP ),
|
||||
ConnectionPort = item.NetAdr.ConnectionPort,
|
||||
QueryPort = item.NetAdr.QueryPort,
|
||||
Name = Encoding.UTF8.GetString(item.ServerName, 0, serverNameLength),
|
||||
Ping = item.Ping,
|
||||
GameDir = item.GameDir,
|
||||
Map = Encoding.UTF8.GetString(item.Map, 0, mapLength),
|
||||
Description = item.GameDescription,
|
||||
AppId = item.AppID,
|
||||
Players = item.Players,
|
||||
MaxPlayers = item.MaxPlayers,
|
||||
BotPlayers = item.BotPlayers,
|
||||
Passworded = item.Password,
|
||||
Secure = item.Secure,
|
||||
LastTimePlayed = item.TimeLastPlayed,
|
||||
Version = item.ServerVersion,
|
||||
Tags = item.GameTags == null ? null : item.GameTags.Split( ',' ),
|
||||
SteamId = item.SteamID
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback when rules are receieved.
|
||||
/// The bool is true if server responded properly.
|
||||
/// </summary>
|
||||
public Action<bool> OnReceivedRules;
|
||||
|
||||
/// <summary>
|
||||
/// List of server rules. Use HasRules to see if this is safe to access.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> Rules;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this server has rules
|
||||
/// </summary>
|
||||
public bool HasRules { get { return Rules != null && Rules.Count > 0; } }
|
||||
|
||||
internal SourceServerQuery RulesRequest;
|
||||
|
||||
/// <summary>
|
||||
/// Populates Rules for this server
|
||||
/// </summary>
|
||||
public void FetchRules()
|
||||
{
|
||||
if ( RulesRequest != null )
|
||||
return;
|
||||
|
||||
Rules = null;
|
||||
RulesRequest = new SourceServerQuery( this, Address, QueryPort );
|
||||
}
|
||||
|
||||
internal void OnServerRulesReceiveFinished( Dictionary<string, string> rules, bool Success )
|
||||
{
|
||||
RulesRequest = null;
|
||||
|
||||
if ( Success )
|
||||
{
|
||||
Rules = rules;
|
||||
}
|
||||
|
||||
if ( OnReceivedRules != null )
|
||||
{
|
||||
OnReceivedRules( Success );
|
||||
}
|
||||
}
|
||||
|
||||
internal const uint k_unFavoriteFlagNone = 0x00;
|
||||
internal const uint k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list
|
||||
internal const uint k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list
|
||||
|
||||
/// <summary>
|
||||
/// Add this server to our history list
|
||||
/// If we're already in the history list, weill set the last played time to now
|
||||
/// </summary>
|
||||
public void AddToHistory()
|
||||
{
|
||||
Client.native.matchmaking.AddFavoriteGame( AppId, Utility.IpToInt32( Address ), (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagHistory, (uint)Utility.Epoch.Current );
|
||||
Client.ServerList.UpdateFavouriteList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove this server from our history list
|
||||
/// </summary>
|
||||
public void RemoveFromHistory()
|
||||
{
|
||||
Client.native.matchmaking.RemoveFavoriteGame( AppId, Utility.IpToInt32( Address ), (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagHistory );
|
||||
Client.ServerList.UpdateFavouriteList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add this server to our favourite list
|
||||
/// </summary>
|
||||
public void AddToFavourites()
|
||||
{
|
||||
Client.native.matchmaking.AddFavoriteGame( AppId, Utility.IpToInt32( Address ), (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagFavorite, (uint)Utility.Epoch.Current );
|
||||
Client.ServerList.UpdateFavouriteList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove this server from our favourite list
|
||||
/// </summary>
|
||||
public void RemoveFromFavourites()
|
||||
{
|
||||
Client.native.matchmaking.RemoveFavoriteGame( AppId, Utility.IpToInt32( Address ), (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagFavorite );
|
||||
Client.ServerList.UpdateFavouriteList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,617 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
//ISteamMatchmakingRulesResponse & ISteamMatchmakingPlayersResponse taken from:
|
||||
// https://github.com/rlabrecque/Steamworks.NET/blob/master/Plugins/Steamworks.NET/ISteamMatchmakingResponses.cs
|
||||
|
||||
/**
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2019 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.
|
||||
|
||||
**/
|
||||
public class ISteamMatchmakingPingResponse
|
||||
{
|
||||
// Server has responded successfully and has updated data
|
||||
public delegate void ServerResponded(ServerList.Server 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;
|
||||
private Client client;
|
||||
|
||||
public ISteamMatchmakingPingResponse(Client c, ServerResponded onServerResponded, ServerFailedToRespond onServerFailedToRespond)
|
||||
{
|
||||
if (onServerResponded == null || onServerFailedToRespond == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
client = c;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
[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 serverItem)
|
||||
{
|
||||
m_ServerResponded(ServerList.Server.FromSteam(client, serverItem));
|
||||
}
|
||||
private void InternalOnServerFailedToRespond(IntPtr thisptr)
|
||||
{
|
||||
m_ServerFailedToRespond();
|
||||
}
|
||||
|
||||
[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();
|
||||
}
|
||||
};
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
List<byte> bytes = new List<byte>();
|
||||
IntPtr seekPointer = pchRule;
|
||||
byte b = Marshal.ReadByte(seekPointer);
|
||||
while (b != 0)
|
||||
{
|
||||
bytes.Add(b);
|
||||
seekPointer = (IntPtr)(seekPointer.ToInt64() + sizeof(byte));
|
||||
b = Marshal.ReadByte(seekPointer);
|
||||
}
|
||||
|
||||
string pchRuleDecoded = Encoding.UTF8.GetString(bytes.ToArray());
|
||||
|
||||
bytes.Clear();
|
||||
seekPointer = pchValue;
|
||||
b = Marshal.ReadByte(seekPointer);
|
||||
while (b != 0)
|
||||
{
|
||||
bytes.Add(b);
|
||||
seekPointer = (IntPtr)(seekPointer.ToInt64() + sizeof(byte));
|
||||
b = Marshal.ReadByte(seekPointer);
|
||||
}
|
||||
|
||||
string pchValueDecoded = Encoding.UTF8.GetString(bytes.ToArray());
|
||||
|
||||
m_RulesResponded(pchRuleDecoded, pchValueDecoded);
|
||||
}
|
||||
private void InternalOnRulesFailedToRespond(IntPtr thisptr)
|
||||
{
|
||||
m_RulesFailedToRespond();
|
||||
}
|
||||
private void InternalOnRulesRefreshComplete(IntPtr thisptr)
|
||||
{
|
||||
m_RulesRefreshComplete();
|
||||
}
|
||||
|
||||
[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();
|
||||
}
|
||||
};
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
List<byte> bytes = new List<byte>();
|
||||
IntPtr seekPointer = pchName;
|
||||
byte b = Marshal.ReadByte(seekPointer);
|
||||
while (b != 0)
|
||||
{
|
||||
bytes.Add(b);
|
||||
seekPointer = (IntPtr)(seekPointer.ToInt64() + sizeof(byte));
|
||||
b = Marshal.ReadByte(seekPointer);
|
||||
}
|
||||
|
||||
string pchNameDecoded = Encoding.UTF8.GetString(bytes.ToArray());
|
||||
|
||||
m_AddPlayerToList(pchNameDecoded, nScore, flTimePlayed);
|
||||
}
|
||||
private void InternalOnPlayersFailedToRespond(IntPtr thisptr)
|
||||
{
|
||||
m_PlayersFailedToRespond();
|
||||
}
|
||||
private void InternalOnPlayersRefreshComplete(IntPtr thisptr)
|
||||
{
|
||||
m_PlayersRefreshComplete();
|
||||
}
|
||||
|
||||
[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();
|
||||
}
|
||||
};
|
||||
|
||||
public partial class ServerList : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
internal ServerList( Client client )
|
||||
{
|
||||
this.client = client;
|
||||
|
||||
UpdateFavouriteList();
|
||||
}
|
||||
|
||||
HashSet<ulong> FavouriteHash = new HashSet<ulong>();
|
||||
HashSet<ulong> HistoryHash = new HashSet<ulong>();
|
||||
|
||||
internal void UpdateFavouriteList()
|
||||
{
|
||||
FavouriteHash.Clear();
|
||||
HistoryHash.Clear();
|
||||
|
||||
for ( int i=0; i< client.native.matchmaking.GetFavoriteGameCount(); i++ )
|
||||
{
|
||||
AppId_t appid = 0;
|
||||
uint ip;
|
||||
ushort conPort;
|
||||
ushort queryPort;
|
||||
uint lastplayed;
|
||||
uint flags;
|
||||
|
||||
client.native.matchmaking.GetFavoriteGame( i, ref appid, out ip, out conPort, out queryPort, out flags, out lastplayed );
|
||||
|
||||
ulong encoded = ip;
|
||||
encoded = encoded << 32;
|
||||
encoded = encoded | (uint)conPort;
|
||||
|
||||
if ( ( flags & Server.k_unFavoriteFlagFavorite ) == Server.k_unFavoriteFlagFavorite )
|
||||
FavouriteHash.Add( encoded );
|
||||
|
||||
if ( ( flags & Server.k_unFavoriteFlagFavorite ) == Server.k_unFavoriteFlagFavorite )
|
||||
HistoryHash.Add( encoded );
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
|
||||
public class Filter : List<KeyValuePair<string, string>>
|
||||
{
|
||||
public void Add( string k, string v )
|
||||
{
|
||||
Add( new KeyValuePair<string, string>( k, v ) );
|
||||
}
|
||||
|
||||
internal IntPtr NativeArray;
|
||||
private IntPtr m_pArrayEntries;
|
||||
|
||||
private int AppId = 0;
|
||||
|
||||
internal void Start()
|
||||
{
|
||||
var filters = this.Select( x =>
|
||||
{
|
||||
if ( x.Key == "appid" ) AppId = int.Parse( x.Value );
|
||||
|
||||
return new SteamNative.MatchMakingKeyValuePair_t()
|
||||
{
|
||||
Key = x.Key,
|
||||
Value = x.Value
|
||||
};
|
||||
} ).ToArray();
|
||||
|
||||
int sizeOfMMKVP = Marshal.SizeOf(typeof(SteamNative.MatchMakingKeyValuePair_t));
|
||||
NativeArray = 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( NativeArray, m_pArrayEntries );
|
||||
}
|
||||
|
||||
internal void Free()
|
||||
{
|
||||
if ( m_pArrayEntries != IntPtr.Zero )
|
||||
{
|
||||
Marshal.FreeHGlobal( m_pArrayEntries );
|
||||
}
|
||||
|
||||
if ( NativeArray != IntPtr.Zero )
|
||||
{
|
||||
Marshal.FreeHGlobal( NativeArray );
|
||||
}
|
||||
}
|
||||
|
||||
internal bool Test( gameserveritem_t info )
|
||||
{
|
||||
if ( AppId != 0 && AppId != info.AppID )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
private struct MatchPair
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string key;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string value;
|
||||
}
|
||||
|
||||
public void CancelHQuery(int query)
|
||||
{
|
||||
client.native.servers.CancelServerQuery((HServerQuery)query);
|
||||
}
|
||||
|
||||
public int HQueryPing(ISteamMatchmakingPingResponse response, IPAddress ip, int port)
|
||||
{
|
||||
return client.native.servers.PingServer(ip.IpToInt32(), (ushort)port, (IntPtr)response).Value;
|
||||
}
|
||||
|
||||
public int HQueryServerRules(ISteamMatchmakingRulesResponse response, IPAddress ip, int queryPort)
|
||||
{
|
||||
return client.native.servers.ServerRules(ip.IpToInt32(), (ushort)queryPort, (IntPtr)response).Value;
|
||||
}
|
||||
|
||||
public Request Internet( Filter filter = null )
|
||||
{
|
||||
if ( filter == null )
|
||||
{
|
||||
filter = new Filter();
|
||||
filter.Add( "appid", client.AppId.ToString() );
|
||||
}
|
||||
|
||||
filter.Start();
|
||||
|
||||
var request = new Request( client );
|
||||
request.Filter = filter;
|
||||
request.AddRequest( client.native.servers.RequestInternetServerList( client.AppId, filter.NativeArray, (uint) filter.Count, IntPtr.Zero ) );
|
||||
|
||||
filter.Free();
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query a list of addresses. No filters applied.
|
||||
/// </summary>
|
||||
public Request Custom( IEnumerable<string> serverList )
|
||||
{
|
||||
var request = new Request( client );
|
||||
request.ServerList = serverList;
|
||||
request.StartCustomQuery();
|
||||
return request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request a list of servers we've been on. History isn't applied automatically
|
||||
/// You need to call server.AddtoHistoryList() when you join a server etc.
|
||||
/// </summary>
|
||||
public Request History( Filter filter = null )
|
||||
{
|
||||
if ( filter == null )
|
||||
{
|
||||
filter = new Filter();
|
||||
filter.Add( "appid", client.AppId.ToString() );
|
||||
}
|
||||
|
||||
filter.Start();
|
||||
|
||||
var request = new Request( client );
|
||||
request.Filter = filter;
|
||||
request.AddRequest( client.native.servers.RequestHistoryServerList( client.AppId, filter.NativeArray, (uint)filter.Count, IntPtr.Zero ) );
|
||||
|
||||
filter.Free();
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request a list of servers we've favourited
|
||||
/// </summary>
|
||||
public Request Favourites( Filter filter = null )
|
||||
{
|
||||
if ( filter == null )
|
||||
{
|
||||
filter = new Filter();
|
||||
filter.Add( "appid", client.AppId.ToString() );
|
||||
}
|
||||
|
||||
filter.Start();
|
||||
|
||||
var request = new Request( client );
|
||||
request.Filter = filter;
|
||||
request.AddRequest( client.native.servers.RequestFavoritesServerList( client.AppId, filter.NativeArray, (uint)filter.Count, IntPtr.Zero ) );
|
||||
|
||||
filter.Free();
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request a list of servers that our friends are on
|
||||
/// </summary>
|
||||
public Request Friends( Filter filter = null )
|
||||
{
|
||||
if ( filter == null )
|
||||
{
|
||||
filter = new Filter();
|
||||
filter.Add( "appid", client.AppId.ToString() );
|
||||
}
|
||||
|
||||
filter.Start();
|
||||
|
||||
var request = new Request( client );
|
||||
request.Filter = filter;
|
||||
request.AddRequest( client.native.servers.RequestFriendsServerList( client.AppId, filter.NativeArray, (uint)filter.Count, IntPtr.Zero ) );
|
||||
|
||||
filter.Free();
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request a list of servers that are running on our LAN
|
||||
/// </summary>
|
||||
public Request Local( Filter filter = null )
|
||||
{
|
||||
if ( filter == null )
|
||||
{
|
||||
filter = new Filter();
|
||||
filter.Add( "appid", client.AppId.ToString() );
|
||||
}
|
||||
|
||||
filter.Start();
|
||||
|
||||
var request = new Request( client );
|
||||
request.Filter = filter;
|
||||
request.AddRequest( client.native.servers.RequestLANServerList( client.AppId, IntPtr.Zero ) );
|
||||
|
||||
filter.Free();
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
internal bool IsFavourite( Server server )
|
||||
{
|
||||
ulong encoded = Utility.IpToInt32( server.Address );
|
||||
encoded = encoded << 32;
|
||||
encoded = encoded | (uint)server.ConnectionPort;
|
||||
|
||||
return FavouriteHash.Contains( encoded );
|
||||
}
|
||||
|
||||
internal bool IsHistory( Server server )
|
||||
{
|
||||
ulong encoded = Utility.IpToInt32( server.Address );
|
||||
encoded = encoded << 32;
|
||||
encoded = encoded | (uint)server.ConnectionPort;
|
||||
|
||||
return HistoryHash.Contains( encoded );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class Stats : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
internal Stats( Client c )
|
||||
{
|
||||
client = c;
|
||||
}
|
||||
|
||||
public bool StoreStats()
|
||||
{
|
||||
return client.native.userstats.StoreStats();
|
||||
}
|
||||
|
||||
public void UpdateStats()
|
||||
{
|
||||
client.native.userstats.RequestCurrentStats();
|
||||
}
|
||||
|
||||
public void UpdateGlobalStats( int days = 1 )
|
||||
{
|
||||
client.native.userstats.GetNumberOfCurrentPlayers();
|
||||
client.native.userstats.RequestGlobalAchievementPercentages();
|
||||
client.native.userstats.RequestGlobalStats( days );
|
||||
}
|
||||
|
||||
public int GetInt( string name )
|
||||
{
|
||||
int data = 0;
|
||||
client.native.userstats.GetStat( name, out data );
|
||||
return data;
|
||||
}
|
||||
|
||||
public long GetGlobalInt( string name )
|
||||
{
|
||||
long data = 0;
|
||||
client.native.userstats.GetGlobalStat( name, out data );
|
||||
return data;
|
||||
}
|
||||
|
||||
public float GetFloat( string name )
|
||||
{
|
||||
float data = 0;
|
||||
client.native.userstats.GetStat0( name, out data );
|
||||
return data;
|
||||
}
|
||||
|
||||
public double GetGlobalFloat( string name )
|
||||
{
|
||||
double data = 0;
|
||||
client.native.userstats.GetGlobalStat0( name, out data );
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set a stat value. This will automatically call StoreStats() after a successful call
|
||||
/// unless you pass false as the last argument.
|
||||
/// </summary>
|
||||
public bool Set( string name, int value, bool store = true )
|
||||
{
|
||||
var r = client.native.userstats.SetStat( name, value );
|
||||
|
||||
if ( store )
|
||||
{
|
||||
return r && client.native.userstats.StoreStats();
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set a stat value. This will automatically call StoreStats() after a successful call
|
||||
/// unless you pass false as the last argument.
|
||||
/// </summary>
|
||||
public bool Set( string name, float value, bool store = true )
|
||||
{
|
||||
var r = client.native.userstats.SetStat0( name, value );
|
||||
|
||||
if ( store )
|
||||
{
|
||||
return r && client.native.userstats.StoreStats();
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds this amount to the named stat. Internally this calls Get() and adds
|
||||
/// to that value. Steam doesn't provide a mechanism for atomically increasing
|
||||
/// stats like this, this functionality is added here as a convenience.
|
||||
/// </summary>
|
||||
public bool Add( string name, int amount = 1, bool store = true )
|
||||
{
|
||||
var val = GetInt( name );
|
||||
val += amount;
|
||||
return Set( name, val, store );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds this amount to the named stat. Internally this calls Get() and adds
|
||||
/// to that value. Steam doesn't provide a mechanism for atomically increasing
|
||||
/// stats like this, this functionality is added here as a convenience.
|
||||
/// </summary>
|
||||
public bool Add(string name, float amount = 1.0f, bool store = true)
|
||||
{
|
||||
var val = GetFloat(name);
|
||||
val += amount;
|
||||
return Set(name, val, store);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Practically wipes the slate clean for this user. If includeAchievements is true, will wipe
|
||||
/// any achievements too.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ResetAll( bool includeAchievements )
|
||||
{
|
||||
return client.native.userstats.ResetAllStats( includeAchievements );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class SteamFriend
|
||||
{
|
||||
/// <summary>
|
||||
/// Steam Id
|
||||
/// </summary>
|
||||
public ulong Id { get; internal set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return true if blocked
|
||||
/// </summary>
|
||||
public bool IsBlocked => relationship == FriendRelationship.Blocked;
|
||||
|
||||
/// <summary>
|
||||
/// Return true if is a friend. Returns false if blocked, request etc.
|
||||
/// </summary>
|
||||
public bool IsFriend => relationship == FriendRelationship.Friend;
|
||||
|
||||
/// <summary>
|
||||
/// Their current display name
|
||||
/// </summary>
|
||||
public string Name;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this friend is online
|
||||
/// </summary>
|
||||
public bool IsOnline => personaState != PersonaState.Offline;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this friend is marked as away
|
||||
/// </summary>
|
||||
public bool IsAway => personaState == PersonaState.Away;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this friend is marked as busy
|
||||
/// </summary>
|
||||
public bool IsBusy => personaState == PersonaState.Busy;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this friend is marked as snoozing
|
||||
/// </summary>
|
||||
public bool IsSnoozing => personaState == PersonaState.Snooze;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this friend is online and playing this game
|
||||
/// </summary>
|
||||
public bool IsPlayingThisGame => CurrentAppId == Client.AppId;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this friend is online and playing this game
|
||||
/// </summary>
|
||||
public bool IsPlaying => CurrentAppId != 0;
|
||||
|
||||
/// <summary>
|
||||
/// The AppId this guy is playing
|
||||
/// </summary>
|
||||
public ulong CurrentAppId { get; internal set; }
|
||||
|
||||
public uint ServerIp { get; internal set; }
|
||||
public int ServerGamePort { get; internal set; }
|
||||
public int ServerQueryPort { get; internal set; }
|
||||
public ulong ServerLobbyId { get; internal set; }
|
||||
|
||||
internal Client Client { get; set; }
|
||||
private PersonaState personaState;
|
||||
private FriendRelationship relationship;
|
||||
|
||||
/// <summary>
|
||||
/// Returns null if the value doesn't exist
|
||||
/// </summary>
|
||||
public string GetRichPresence( string key )
|
||||
{
|
||||
var val = Client.native.friends.GetFriendRichPresence( Id, key );
|
||||
if ( string.IsNullOrEmpty( val ) ) return null;
|
||||
return val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update this friend, request the latest data from Steam's servers
|
||||
/// </summary>
|
||||
public void Refresh()
|
||||
{
|
||||
Name = Client.native.friends.GetFriendPersonaName( Id );
|
||||
|
||||
relationship = Client.native.friends.GetFriendRelationship( Id );
|
||||
personaState = Client.native.friends.GetFriendPersonaState( Id );
|
||||
|
||||
CurrentAppId = 0;
|
||||
ServerIp = 0;
|
||||
ServerGamePort = 0;
|
||||
ServerQueryPort = 0;
|
||||
ServerLobbyId = 0;
|
||||
|
||||
var gameInfo = new SteamNative.FriendGameInfo_t();
|
||||
if ( Client.native.friends.GetFriendGamePlayed( Id, ref gameInfo ) && gameInfo.GameID > 0 )
|
||||
{
|
||||
CurrentAppId = gameInfo.GameID;
|
||||
ServerIp = gameInfo.GameIP;
|
||||
ServerGamePort = gameInfo.GamePort;
|
||||
ServerQueryPort = gameInfo.QueryPort;
|
||||
ServerLobbyId = gameInfo.SteamIDLobby;
|
||||
}
|
||||
|
||||
Client.native.friends.RequestFriendRichPresence( Id );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will return null if you don't have the target user's avatar in your cache.
|
||||
/// Which usually happens for people not on your friends list.
|
||||
/// </summary>
|
||||
public Image GetAvatar( Friends.AvatarSize size )
|
||||
{
|
||||
return Client.Friends.GetCachedAvatar( size, Id );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invite this friend to the game that we are playing
|
||||
/// </summary>
|
||||
public bool InviteToGame(string Text)
|
||||
{
|
||||
return Client.native.friends.InviteUserToGame(Id, Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a message to a Steam friend. Returns true if success
|
||||
/// </summary>
|
||||
public bool SendMessage( string message )
|
||||
{
|
||||
return Client.native.friends.ReplyToFriendMessage( Id, message );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class User : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
internal Dictionary<string, string> richPresence = new Dictionary<string, string>();
|
||||
|
||||
internal User( Client c )
|
||||
{
|
||||
client = c;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find a rich presence value by key for current user. Will be null if not found.
|
||||
/// </summary>
|
||||
public string GetRichPresence( string key )
|
||||
{
|
||||
if ( richPresence.TryGetValue( key, out var val ) )
|
||||
return val;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a rich presence value by key for current user.
|
||||
/// </summary>
|
||||
public bool SetRichPresence( string key, string value )
|
||||
{
|
||||
richPresence[key] = value;
|
||||
return client.native.friends.SetRichPresence( key, value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all of the current user's rich presence data.
|
||||
/// </summary>
|
||||
public void ClearRichPresence()
|
||||
{
|
||||
richPresence.Clear();
|
||||
client.native.friends.ClearRichPresence();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class Voice
|
||||
{
|
||||
const int ReadBufferSize = 1024 * 128;
|
||||
|
||||
internal Client client;
|
||||
|
||||
internal byte[] ReadCompressedBuffer = new byte[ReadBufferSize];
|
||||
internal byte[] ReadUncompressedBuffer = new byte[ReadBufferSize];
|
||||
|
||||
internal byte[] UncompressBuffer = new byte[1024 * 256];
|
||||
|
||||
public Action<byte[], int> OnCompressedData;
|
||||
public Action<byte[], int> OnUncompressedData;
|
||||
|
||||
private System.Diagnostics.Stopwatch UpdateTimer = System.Diagnostics.Stopwatch.StartNew();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the optimal sample rate for voice - according to Steam
|
||||
/// </summary>
|
||||
public uint OptimalSampleRate
|
||||
{
|
||||
get { return client.native.user.GetVoiceOptimalSampleRate(); }
|
||||
}
|
||||
|
||||
private bool _wantsrecording = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If set to true we are listening to the mic.
|
||||
/// You should usually toggle this with the press of a key for push to talk.
|
||||
/// </summary>
|
||||
public bool WantsRecording
|
||||
{
|
||||
get { return _wantsrecording; }
|
||||
set
|
||||
{
|
||||
_wantsrecording = value;
|
||||
|
||||
if ( value )
|
||||
{
|
||||
client.native.user.StartVoiceRecording();
|
||||
}
|
||||
else
|
||||
{
|
||||
client.native.user.StopVoiceRecording();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The last time voice was detected, recorded
|
||||
/// </summary>
|
||||
public DateTime LastVoiceRecordTime { get; private set; }
|
||||
|
||||
public TimeSpan TimeSinceLastVoiceRecord { get { return DateTime.Now.Subtract( LastVoiceRecordTime ); } }
|
||||
|
||||
public bool IsRecording = false;
|
||||
|
||||
/// <summary>
|
||||
/// If set we will capture the audio at this rate. If unset (set to 0) will capture at OptimalSampleRate
|
||||
/// </summary>
|
||||
public uint DesiredSampleRate = 0;
|
||||
|
||||
internal Voice( Client client )
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This gets called inside Update - so there's no need to call this manually if you're calling update
|
||||
/// </summary>
|
||||
public unsafe void Update()
|
||||
{
|
||||
if ( OnCompressedData == null && OnUncompressedData == null )
|
||||
return;
|
||||
|
||||
if ( UpdateTimer.Elapsed.TotalSeconds < 1.0f / 10.0f )
|
||||
return;
|
||||
|
||||
UpdateTimer.Reset();
|
||||
UpdateTimer.Start();
|
||||
|
||||
uint bufferRegularLastWrite = 0;
|
||||
uint bufferCompressedLastWrite = 0;
|
||||
|
||||
var result = client.native.user.GetAvailableVoice( out bufferCompressedLastWrite, out bufferRegularLastWrite, DesiredSampleRate == 0 ? OptimalSampleRate : DesiredSampleRate );
|
||||
|
||||
if ( result == SteamNative.VoiceResult.NotRecording || result == SteamNative.VoiceResult.NotInitialized )
|
||||
{
|
||||
IsRecording = false;
|
||||
return;
|
||||
}
|
||||
|
||||
fixed (byte* compressedPtr = ReadCompressedBuffer)
|
||||
fixed (byte* uncompressedPtr = ReadUncompressedBuffer)
|
||||
{
|
||||
result = client.native.user.GetVoice( OnCompressedData != null, (IntPtr) compressedPtr, ReadBufferSize, out bufferCompressedLastWrite,
|
||||
OnUncompressedData != null, (IntPtr) uncompressedPtr, ReadBufferSize, out bufferRegularLastWrite,
|
||||
DesiredSampleRate == 0 ? OptimalSampleRate : DesiredSampleRate );
|
||||
}
|
||||
|
||||
IsRecording = true;
|
||||
|
||||
if ( result == SteamNative.VoiceResult.OK )
|
||||
{
|
||||
if ( OnCompressedData != null && bufferCompressedLastWrite > 0 )
|
||||
{
|
||||
OnCompressedData( ReadCompressedBuffer, (int)bufferCompressedLastWrite );
|
||||
}
|
||||
|
||||
if ( OnUncompressedData != null && bufferRegularLastWrite > 0 )
|
||||
{
|
||||
OnUncompressedData( ReadUncompressedBuffer, (int)bufferRegularLastWrite );
|
||||
}
|
||||
|
||||
LastVoiceRecordTime = DateTime.Now;
|
||||
}
|
||||
|
||||
if ( result == SteamNative.VoiceResult.NotRecording ||
|
||||
result == SteamNative.VoiceResult.NotInitialized )
|
||||
IsRecording = false;
|
||||
|
||||
}
|
||||
|
||||
public bool Decompress( byte[] input, MemoryStream output, uint samepleRate = 0 )
|
||||
{
|
||||
return Decompress( input, 0, input.Length, output, samepleRate );
|
||||
}
|
||||
|
||||
public bool Decompress( byte[] input, int inputsize, MemoryStream output, uint samepleRate = 0 )
|
||||
{
|
||||
return Decompress( input, 0, inputsize, output, samepleRate );
|
||||
}
|
||||
|
||||
public unsafe bool Decompress( byte[] input, int inputoffset, int inputsize, MemoryStream output, uint samepleRate = 0 )
|
||||
{
|
||||
if ( inputoffset < 0 || inputoffset >= input.Length )
|
||||
throw new ArgumentOutOfRangeException( "inputoffset" );
|
||||
|
||||
if ( inputsize <= 0 || inputoffset + inputsize > input.Length )
|
||||
throw new ArgumentOutOfRangeException( "inputsize" );
|
||||
|
||||
fixed ( byte* p = input )
|
||||
{
|
||||
return Decompress( (IntPtr)p, inputoffset, inputsize, output, samepleRate );
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe bool Decompress( IntPtr input, int inputoffset, int inputsize, MemoryStream output, uint samepleRate = 0 )
|
||||
{
|
||||
if ( samepleRate == 0 )
|
||||
samepleRate = OptimalSampleRate;
|
||||
|
||||
uint bytesOut = 0;
|
||||
|
||||
SteamNative.VoiceResult result = SteamNative.VoiceResult.NoData;
|
||||
|
||||
fixed ( byte* outBuf = UncompressBuffer )
|
||||
{
|
||||
result = client.native.user.DecompressVoice( (IntPtr)(((byte*)input) + inputoffset), (uint)inputsize, (IntPtr)outBuf, (uint)UncompressBuffer.Length, out bytesOut, samepleRate );
|
||||
}
|
||||
|
||||
if ( result == SteamNative.VoiceResult.OK )
|
||||
{
|
||||
output.Write( (byte[])UncompressBuffer, 0, (int)bytesOut );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public static class Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Should be called before creating any interfaces, to configure Steam for Unity.
|
||||
/// </summary>
|
||||
/// <param name="platform">Please pass in Application.platform.ToString()</param>
|
||||
public static void ForUnity( string platform )
|
||||
{
|
||||
//
|
||||
// Windows Config
|
||||
//
|
||||
if ( platform == "WindowsEditor" || platform == "WindowsPlayer" )
|
||||
{
|
||||
//
|
||||
// 32bit windows unity uses a stdcall
|
||||
//
|
||||
if (IntPtr.Size == 4) UseThisCall = false;
|
||||
|
||||
ForcePlatform( OperatingSystem.Windows, IntPtr.Size == 4 ? Architecture.x86 : Architecture.x64 );
|
||||
}
|
||||
|
||||
if ( platform == "OSXEditor" || platform == "OSXPlayer" || platform == "OSXDashboardPlayer" )
|
||||
{
|
||||
ForcePlatform( OperatingSystem.macOS, IntPtr.Size == 4 ? Architecture.x86 : Architecture.x64 );
|
||||
}
|
||||
|
||||
if ( platform == "LinuxPlayer" || platform == "LinuxEditor" )
|
||||
{
|
||||
ForcePlatform( OperatingSystem.Linux, IntPtr.Size == 4 ? Architecture.x86 : Architecture.x64 );
|
||||
}
|
||||
|
||||
Console.WriteLine( "Facepunch.Steamworks Unity: " + platform );
|
||||
Console.WriteLine( "Facepunch.Steamworks Os: " + SteamNative.Platform.Os );
|
||||
Console.WriteLine( "Facepunch.Steamworks Arch: " + SteamNative.Platform.Arch );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Some platforms allow/need CallingConvention.ThisCall. If you're crashing with argument null
|
||||
/// errors on certain platforms, try flipping this to true.
|
||||
///
|
||||
/// I owe this logic to Riley Labrecque's hard work on Steamworks.net - I don't have the knowledge
|
||||
/// or patience to find this shit on my own, so massive thanks to him. And also massive thanks to him
|
||||
/// for releasing his shit open source under the MIT license so we can all learn and iterate.
|
||||
///
|
||||
/// </summary>
|
||||
public static bool UseThisCall { get; set; } = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// You can force the platform to a particular one here.
|
||||
/// This is useful if you're on OSX because some versions of mono don't have a way
|
||||
/// to tell which platform we're running
|
||||
/// </summary>
|
||||
public static void ForcePlatform( Facepunch.Steamworks.OperatingSystem os, Facepunch.Steamworks.Architecture arch )
|
||||
{
|
||||
SteamNative.Platform.Os = os;
|
||||
SteamNative.Platform.Arch = arch;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
/// High level connection status
|
||||
public enum ConnectionState
|
||||
{
|
||||
|
||||
/// Dummy value used to indicate an error condition in the API.
|
||||
/// Specified connection doesn't exist or has already been closed.
|
||||
None = 0,
|
||||
|
||||
/// We are trying to establish whether peers can talk to each other,
|
||||
/// whether they WANT to talk to each other, perform basic auth,
|
||||
/// and exchange crypt keys.
|
||||
///
|
||||
/// - For connections on the "client" side (initiated locally):
|
||||
/// We're in the process of trying to establish a connection.
|
||||
/// Depending on the connection type, we might not know who they are.
|
||||
/// Note that it is not possible to tell if we are waiting on the
|
||||
/// network to complete handshake packets, or for the application layer
|
||||
/// to accept the connection.
|
||||
///
|
||||
/// - For connections on the "server" side (accepted through listen socket):
|
||||
/// We have completed some basic handshake and the client has presented
|
||||
/// some proof of identity. The connection is ready to be accepted
|
||||
/// using AcceptConnection().
|
||||
///
|
||||
/// In either case, any unreliable packets sent now are almost certain
|
||||
/// to be dropped. Attempts to receive packets are guaranteed to fail.
|
||||
/// You may send messages if the send mode allows for them to be queued.
|
||||
/// but if you close the connection before the connection is actually
|
||||
/// established, any queued messages will be discarded immediately.
|
||||
/// (We will not attempt to flush the queue and confirm delivery to the
|
||||
/// remote host, which ordinarily happens when a connection is closed.)
|
||||
Connecting = 1,
|
||||
|
||||
/// Some connection types use a back channel or trusted 3rd party
|
||||
/// for earliest communication. If the server accepts the connection,
|
||||
/// then these connections switch into the rendezvous state. During this
|
||||
/// state, we still have not yet established an end-to-end route (through
|
||||
/// the relay network), and so if you send any messages unreliable, they
|
||||
/// are going to be discarded.
|
||||
FindingRoute = 2,
|
||||
|
||||
/// We've received communications from our peer (and we know
|
||||
/// who they are) and are all good. If you close the connection now,
|
||||
/// we will make our best effort to flush out any reliable sent data that
|
||||
/// has not been acknowledged by the peer. (But note that this happens
|
||||
/// from within the application process, so unlike a TCP connection, you are
|
||||
/// not totally handing it off to the operating system to deal with it.)
|
||||
Connected = 3,
|
||||
|
||||
/// Connection has been closed by our peer, but not closed locally.
|
||||
/// The connection still exists from an API perspective. You must close the
|
||||
/// handle to free up resources. If there are any messages in the inbound queue,
|
||||
/// you may retrieve them. Otherwise, nothing may be done with the connection
|
||||
/// except to close it.
|
||||
///
|
||||
/// This stats is similar to CLOSE_WAIT in the TCP state machine.
|
||||
ClosedByPeer = 4,
|
||||
|
||||
/// A disruption in the connection has been detected locally. (E.g. timeout,
|
||||
/// local internet connection disrupted, etc.)
|
||||
///
|
||||
/// The connection still exists from an API perspective. You must close the
|
||||
/// handle to free up resources.
|
||||
///
|
||||
/// Attempts to send further messages will fail. Any remaining received messages
|
||||
/// in the queue are available.
|
||||
ProblemDetectedLocally = 5,
|
||||
|
||||
//
|
||||
// The following values are used internally and will not be returned by any API.
|
||||
// We document them here to provide a little insight into the state machine that is used
|
||||
// under the hood.
|
||||
//
|
||||
|
||||
/// We've disconnected on our side, and from an API perspective the connection is closed.
|
||||
/// No more data may be sent or received. All reliable data has been flushed, or else
|
||||
/// we've given up and discarded it. We do not yet know for sure that the peer knows
|
||||
/// the connection has been closed, however, so we're just hanging around so that if we do
|
||||
/// get a packet from them, we can send them the appropriate packets so that they can
|
||||
/// know why the connection was closed (and not have to rely on a timeout, which makes
|
||||
/// it appear as if something is wrong).
|
||||
FinWait = -1,
|
||||
|
||||
/// We've disconnected on our side, and from an API perspective the connection is closed.
|
||||
/// No more data may be sent or received. From a network perspective, however, on the wire,
|
||||
/// we have not yet given any indication to the peer that the connection is closed.
|
||||
/// We are in the process of flushing out the last bit of reliable data. Once that is done,
|
||||
/// we will inform the peer that the connection has been closed, and transition to the
|
||||
/// FinWait state.
|
||||
///
|
||||
/// Note that no indication is given to the remote host that we have closed the connection,
|
||||
/// until the data has been flushed. If the remote host attempts to send us data, we will
|
||||
/// do whatever is necessary to keep the connection alive until it can be closed properly.
|
||||
/// But in fact the data will be discarded, since there is no way for the application to
|
||||
/// read it back. Typically this is not a problem, as application protocols that utilize
|
||||
/// the lingering functionality are designed for the remote host to wait for the response
|
||||
/// before sending any more data.
|
||||
Linger = -2,
|
||||
|
||||
/// Connection is completely inactive and ready to be destroyed
|
||||
Dead = -3,
|
||||
|
||||
Force32Bit = 0x7fffffff
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
enum DebugOutputType : int
|
||||
{
|
||||
None = 0,
|
||||
Bug = 1, // You used the API incorrectly, or an internal error happened
|
||||
Error = 2, // Run-time error condition that isn't the result of a bug. (E.g. we are offline, cannot bind a port, etc)
|
||||
Important = 3, // Nothing is wrong, but this is an important notification
|
||||
Warning = 4,
|
||||
Msg = 5, // Recommended amount
|
||||
Verbose = 6, // Quite a bit
|
||||
Debug = 7, // Practically everything
|
||||
Everything = 8, // Wall of text, detailed packet contents breakdown, etc
|
||||
|
||||
Force32Bit = 0x7fffffff
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public enum LeaderboardDisplay : int
|
||||
{
|
||||
/// <summary>
|
||||
/// The score is just a simple numerical value
|
||||
/// </summary>
|
||||
Numeric = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The score represents a time, in seconds
|
||||
/// </summary>
|
||||
TimeSeconds = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The score represents a time, in milliseconds
|
||||
/// </summary>
|
||||
TimeMilliSeconds = 3,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public enum LeaderboardSort : int
|
||||
{
|
||||
/// <summary>
|
||||
/// The top-score is the lowest number
|
||||
/// </summary>
|
||||
Ascending = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The top-score is the highest number
|
||||
/// </summary>
|
||||
Descending = 2,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
internal enum NetConfig : int
|
||||
{
|
||||
Invalid = 0,
|
||||
FakePacketLoss_Send = 2,
|
||||
FakePacketLoss_Recv = 3,
|
||||
FakePacketLag_Send = 4,
|
||||
FakePacketLag_Recv = 5,
|
||||
|
||||
FakePacketReorder_Send = 6,
|
||||
FakePacketReorder_Recv = 7,
|
||||
|
||||
FakePacketReorder_Time = 8,
|
||||
|
||||
FakePacketDup_Send = 26,
|
||||
FakePacketDup_Recv = 27,
|
||||
|
||||
FakePacketDup_TimeMax = 28,
|
||||
|
||||
TimeoutInitial = 24,
|
||||
|
||||
TimeoutConnected = 25,
|
||||
|
||||
SendBufferSize = 9,
|
||||
|
||||
SendRateMin = 10,
|
||||
SendRateMax = 11,
|
||||
|
||||
NagleTime = 12,
|
||||
|
||||
IP_AllowWithoutAuth = 23,
|
||||
|
||||
SDRClient_ConsecutitivePingTimeoutsFailInitial = 19,
|
||||
|
||||
SDRClient_ConsecutitivePingTimeoutsFail = 20,
|
||||
|
||||
SDRClient_MinPingsBeforePingAccurate = 21,
|
||||
|
||||
SDRClient_SingleSocket = 22,
|
||||
|
||||
SDRClient_ForceRelayCluster = 29,
|
||||
|
||||
SDRClient_DebugTicketAddress = 30,
|
||||
|
||||
SDRClient_ForceProxyAddr = 31,
|
||||
|
||||
LogLevel_AckRTT = 13,
|
||||
LogLevel_PacketDecode = 14,
|
||||
LogLevel_Message = 15,
|
||||
LogLevel_PacketGaps = 16,
|
||||
LogLevel_P2PRendezvous = 17,
|
||||
LogLevel_SDRRelayPings = 18,
|
||||
|
||||
Force32Bit = 0x7fffffff
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
enum NetConfigResult
|
||||
{
|
||||
BadValue = -1, // No such configuration value
|
||||
BadScopeObj = -2, // Bad connection handle, etc
|
||||
BufferTooSmall = -3, // Couldn't fit the result in your buffer
|
||||
OK = 1,
|
||||
OKInherited = 2, // A value was not set at this level, but the effective (inherited) value was returned.
|
||||
|
||||
Force32Bit = 0x7fffffff
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
enum NetConfigType
|
||||
{
|
||||
Int32 = 1,
|
||||
Int64 = 2,
|
||||
Float = 3,
|
||||
String = 4,
|
||||
FunctionPtr = 5, // NOTE: When setting callbacks, you should put the pointer into a variable and pass a pointer to that variable.
|
||||
|
||||
Force32Bit = 0x7fffffff
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
internal enum NetScope : int
|
||||
{
|
||||
Global = 1,
|
||||
SocketsInterface = 2,
|
||||
ListenSocket = 3,
|
||||
Connection = 4,
|
||||
|
||||
Force32Bit = 0x7fffffff
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
[Flags]
|
||||
public enum SendType : int
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
Unreliable = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
NoNagle = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
NoDelay = 1 << 2,
|
||||
|
||||
/// Reliable message send. Can send up to 0.5mb 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.
|
||||
Reliable = 1 << 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Facepunch.Steamworks.Posix64</AssemblyName>
|
||||
<DefineConstants>$(DefineConstants);PLATFORM_POSIX64;PLATFORM_POSIX;PLATFORM_64</DefineConstants>
|
||||
<TargetFrameworks>netstandard2.1</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<RootNamespace>Steamworks</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="Facepunch.Steamworks.targets" />
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Facepunch.Steamworks.Win64</AssemblyName>
|
||||
<DefineConstants>$(DefineConstants);PLATFORM_WIN64;PLATFORM_WIN;PLATFORM_64</DefineConstants>
|
||||
<TargetFrameworks>netstandard2.1</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="steam_api64.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Authors>Garry Newman</Authors>
|
||||
<PackageId>Facepunch.Steamworks</PackageId>
|
||||
<PackageDescription>Another fucking c# Steamworks implementation</PackageDescription>
|
||||
<PackageProjectUrl>https://github.com/Facepunch/Facepunch.Steamworks</PackageProjectUrl>
|
||||
<PackageIconUrl>https://files.facepunch.com/garry/c5edce1c-0c21-4c5d-95b6-37743be7455d.jpg</PackageIconUrl>
|
||||
<PackageTags>facepunch;steam;unity;steamworks;valve</PackageTags>
|
||||
<PackageVersion>2.2.0</PackageVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<RepositoryUrl>https://github.com/Facepunch/Facepunch.Steamworks.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="Facepunch.Steamworks.targets" />
|
||||
|
||||
</Project>
|
||||
@@ -1,78 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net45</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyName>Facepunch.Steamworks</AssemblyName>
|
||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<AllowedReferenceRelatedFileExtensions>.pdb</AllowedReferenceRelatedFileExtensions>
|
||||
<Platforms>AnyCPU;x86</Platforms>
|
||||
<ReleaseVersion>0.9.0.0</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<NoWarn>1701;1702;1705;618;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<NoWarn>1701;1702;1705;618;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>TRACE;RELEASE</DefineConstants>
|
||||
<NoWarn>1701;1702;1705;618;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
|
||||
<DefineConstants>TRACE;RELEASE</DefineConstants>
|
||||
<NoWarn>1701;1702;1705;618;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<DefineConstants>$(DefineConstants);NET_CORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="*AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="steam_api.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="steam_api64.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net40'">C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client</FrameworkPathOverride>
|
||||
<Authors>Garry Newman</Authors>
|
||||
<PackageId>Facepunch.Steamworks</PackageId>
|
||||
<PackageDescription>Another fucking c# Steamworks implementation</PackageDescription>
|
||||
<PackageProjectUrl>https://github.com/Facepunch/Facepunch.Steamworks</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://github.com/Facepunch/Facepunch.Steamworks/blob/master/LICENSE</PackageLicenseUrl>
|
||||
<PackageIconUrl>https://avatars2.githubusercontent.com/u/3371040</PackageIconUrl>
|
||||
<PackageTags>facepunch;steam;unity;steamworks;valve</PackageTags>
|
||||
<PackageVersion>0.7.5</PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|x86'">
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<NoWarn>1701;1702;1705;618;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;RELEASE</DefineConstants>
|
||||
<NoWarn>1701;1702;1705;618;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
|
||||
<DefineConstants>$(DefineConstants);NET_CORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.1|AnyCPU'">
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="*AssemblyInfo.cs" />
|
||||
<Folder Include="Generated\Interfaces\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,443 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamApps : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMAPPS_INTERFACE_VERSION008";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_BIsSubscribed = Marshal.GetDelegateForFunctionPointer<FBIsSubscribed>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_BIsLowViolence = Marshal.GetDelegateForFunctionPointer<FBIsLowViolence>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_BIsCybercafe = Marshal.GetDelegateForFunctionPointer<FBIsCybercafe>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_BIsVACBanned = Marshal.GetDelegateForFunctionPointer<FBIsVACBanned>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_GetCurrentGameLanguage = Marshal.GetDelegateForFunctionPointer<FGetCurrentGameLanguage>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_GetAvailableGameLanguages = Marshal.GetDelegateForFunctionPointer<FGetAvailableGameLanguages>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_BIsSubscribedApp = Marshal.GetDelegateForFunctionPointer<FBIsSubscribedApp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_BIsDlcInstalled = Marshal.GetDelegateForFunctionPointer<FBIsDlcInstalled>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_GetEarliestPurchaseUnixTime = Marshal.GetDelegateForFunctionPointer<FGetEarliestPurchaseUnixTime>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_BIsSubscribedFromFreeWeekend = Marshal.GetDelegateForFunctionPointer<FBIsSubscribedFromFreeWeekend>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_GetDLCCount = Marshal.GetDelegateForFunctionPointer<FGetDLCCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_BGetDLCDataByIndex = Marshal.GetDelegateForFunctionPointer<FBGetDLCDataByIndex>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_InstallDLC = Marshal.GetDelegateForFunctionPointer<FInstallDLC>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_UninstallDLC = Marshal.GetDelegateForFunctionPointer<FUninstallDLC>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_RequestAppProofOfPurchaseKey = Marshal.GetDelegateForFunctionPointer<FRequestAppProofOfPurchaseKey>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_GetCurrentBetaName = Marshal.GetDelegateForFunctionPointer<FGetCurrentBetaName>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_MarkContentCorrupt = Marshal.GetDelegateForFunctionPointer<FMarkContentCorrupt>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_GetInstalledDepots = Marshal.GetDelegateForFunctionPointer<FGetInstalledDepots>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_GetAppInstallDir = Marshal.GetDelegateForFunctionPointer<FGetAppInstallDir>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_BIsAppInstalled = Marshal.GetDelegateForFunctionPointer<FBIsAppInstalled>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_GetAppOwner = Marshal.GetDelegateForFunctionPointer<FGetAppOwner>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_GetLaunchQueryParam = Marshal.GetDelegateForFunctionPointer<FGetLaunchQueryParam>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_GetDlcDownloadProgress = Marshal.GetDelegateForFunctionPointer<FGetDlcDownloadProgress>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_GetAppBuildId = Marshal.GetDelegateForFunctionPointer<FGetAppBuildId>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_RequestAllProofOfPurchaseKeys = Marshal.GetDelegateForFunctionPointer<FRequestAllProofOfPurchaseKeys>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_GetFileDetails = Marshal.GetDelegateForFunctionPointer<FGetFileDetails>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_GetLaunchCommandLine = Marshal.GetDelegateForFunctionPointer<FGetLaunchCommandLine>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_BIsSubscribedFromFamilySharing = Marshal.GetDelegateForFunctionPointer<FBIsSubscribedFromFamilySharing>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_BIsSubscribed = null;
|
||||
_BIsLowViolence = null;
|
||||
_BIsCybercafe = null;
|
||||
_BIsVACBanned = null;
|
||||
_GetCurrentGameLanguage = null;
|
||||
_GetAvailableGameLanguages = null;
|
||||
_BIsSubscribedApp = null;
|
||||
_BIsDlcInstalled = null;
|
||||
_GetEarliestPurchaseUnixTime = null;
|
||||
_BIsSubscribedFromFreeWeekend = null;
|
||||
_GetDLCCount = null;
|
||||
_BGetDLCDataByIndex = null;
|
||||
_InstallDLC = null;
|
||||
_UninstallDLC = null;
|
||||
_RequestAppProofOfPurchaseKey = null;
|
||||
_GetCurrentBetaName = null;
|
||||
_MarkContentCorrupt = null;
|
||||
_GetInstalledDepots = null;
|
||||
_GetAppInstallDir = null;
|
||||
_BIsAppInstalled = null;
|
||||
_GetAppOwner = null;
|
||||
_GetLaunchQueryParam = null;
|
||||
_GetDlcDownloadProgress = null;
|
||||
_GetAppBuildId = null;
|
||||
_RequestAllProofOfPurchaseKeys = null;
|
||||
_GetFileDetails = null;
|
||||
_GetLaunchCommandLine = null;
|
||||
_BIsSubscribedFromFamilySharing = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsSubscribed( IntPtr self );
|
||||
private FBIsSubscribed _BIsSubscribed;
|
||||
|
||||
#endregion
|
||||
internal bool BIsSubscribed()
|
||||
{
|
||||
var returnValue = _BIsSubscribed( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsLowViolence( IntPtr self );
|
||||
private FBIsLowViolence _BIsLowViolence;
|
||||
|
||||
#endregion
|
||||
internal bool BIsLowViolence()
|
||||
{
|
||||
var returnValue = _BIsLowViolence( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsCybercafe( IntPtr self );
|
||||
private FBIsCybercafe _BIsCybercafe;
|
||||
|
||||
#endregion
|
||||
internal bool BIsCybercafe()
|
||||
{
|
||||
var returnValue = _BIsCybercafe( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsVACBanned( IntPtr self );
|
||||
private FBIsVACBanned _BIsVACBanned;
|
||||
|
||||
#endregion
|
||||
internal bool BIsVACBanned()
|
||||
{
|
||||
var returnValue = _BIsVACBanned( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetCurrentGameLanguage( IntPtr self );
|
||||
private FGetCurrentGameLanguage _GetCurrentGameLanguage;
|
||||
|
||||
#endregion
|
||||
internal string GetCurrentGameLanguage()
|
||||
{
|
||||
var returnValue = _GetCurrentGameLanguage( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetAvailableGameLanguages( IntPtr self );
|
||||
private FGetAvailableGameLanguages _GetAvailableGameLanguages;
|
||||
|
||||
#endregion
|
||||
internal string GetAvailableGameLanguages()
|
||||
{
|
||||
var returnValue = _GetAvailableGameLanguages( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsSubscribedApp( IntPtr self, AppId appID );
|
||||
private FBIsSubscribedApp _BIsSubscribedApp;
|
||||
|
||||
#endregion
|
||||
internal bool BIsSubscribedApp( AppId appID )
|
||||
{
|
||||
var returnValue = _BIsSubscribedApp( Self, appID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsDlcInstalled( IntPtr self, AppId appID );
|
||||
private FBIsDlcInstalled _BIsDlcInstalled;
|
||||
|
||||
#endregion
|
||||
internal bool BIsDlcInstalled( AppId appID )
|
||||
{
|
||||
var returnValue = _BIsDlcInstalled( Self, appID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetEarliestPurchaseUnixTime( IntPtr self, AppId nAppID );
|
||||
private FGetEarliestPurchaseUnixTime _GetEarliestPurchaseUnixTime;
|
||||
|
||||
#endregion
|
||||
internal uint GetEarliestPurchaseUnixTime( AppId nAppID )
|
||||
{
|
||||
var returnValue = _GetEarliestPurchaseUnixTime( Self, nAppID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsSubscribedFromFreeWeekend( IntPtr self );
|
||||
private FBIsSubscribedFromFreeWeekend _BIsSubscribedFromFreeWeekend;
|
||||
|
||||
#endregion
|
||||
internal bool BIsSubscribedFromFreeWeekend()
|
||||
{
|
||||
var returnValue = _BIsSubscribedFromFreeWeekend( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetDLCCount( IntPtr self );
|
||||
private FGetDLCCount _GetDLCCount;
|
||||
|
||||
#endregion
|
||||
internal int GetDLCCount()
|
||||
{
|
||||
var returnValue = _GetDLCCount( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBGetDLCDataByIndex( IntPtr self, int iDLC, ref AppId pAppID, [MarshalAs( UnmanagedType.U1 )] ref bool pbAvailable, IntPtr pchName, int cchNameBufferSize );
|
||||
private FBGetDLCDataByIndex _BGetDLCDataByIndex;
|
||||
|
||||
#endregion
|
||||
internal bool BGetDLCDataByIndex( int iDLC, ref AppId pAppID, [MarshalAs( UnmanagedType.U1 )] ref bool pbAvailable, out string pchName )
|
||||
{
|
||||
IntPtr mempchName = Helpers.TakeMemory();
|
||||
var returnValue = _BGetDLCDataByIndex( Self, iDLC, ref pAppID, ref pbAvailable, mempchName, (1024 * 32) );
|
||||
pchName = Helpers.MemoryToString( mempchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FInstallDLC( IntPtr self, AppId nAppID );
|
||||
private FInstallDLC _InstallDLC;
|
||||
|
||||
#endregion
|
||||
internal void InstallDLC( AppId nAppID )
|
||||
{
|
||||
_InstallDLC( Self, nAppID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FUninstallDLC( IntPtr self, AppId nAppID );
|
||||
private FUninstallDLC _UninstallDLC;
|
||||
|
||||
#endregion
|
||||
internal void UninstallDLC( AppId nAppID )
|
||||
{
|
||||
_UninstallDLC( Self, nAppID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FRequestAppProofOfPurchaseKey( IntPtr self, AppId nAppID );
|
||||
private FRequestAppProofOfPurchaseKey _RequestAppProofOfPurchaseKey;
|
||||
|
||||
#endregion
|
||||
internal void RequestAppProofOfPurchaseKey( AppId nAppID )
|
||||
{
|
||||
_RequestAppProofOfPurchaseKey( Self, nAppID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetCurrentBetaName( IntPtr self, IntPtr pchName, int cchNameBufferSize );
|
||||
private FGetCurrentBetaName _GetCurrentBetaName;
|
||||
|
||||
#endregion
|
||||
internal bool GetCurrentBetaName( out string pchName )
|
||||
{
|
||||
IntPtr mempchName = Helpers.TakeMemory();
|
||||
var returnValue = _GetCurrentBetaName( Self, mempchName, (1024 * 32) );
|
||||
pchName = Helpers.MemoryToString( mempchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FMarkContentCorrupt( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bMissingFilesOnly );
|
||||
private FMarkContentCorrupt _MarkContentCorrupt;
|
||||
|
||||
#endregion
|
||||
internal bool MarkContentCorrupt( [MarshalAs( UnmanagedType.U1 )] bool bMissingFilesOnly )
|
||||
{
|
||||
var returnValue = _MarkContentCorrupt( Self, bMissingFilesOnly );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetInstalledDepots( IntPtr self, AppId appID, [In,Out] DepotId_t[] pvecDepots, uint cMaxDepots );
|
||||
private FGetInstalledDepots _GetInstalledDepots;
|
||||
|
||||
#endregion
|
||||
internal uint GetInstalledDepots( AppId appID, [In,Out] DepotId_t[] pvecDepots, uint cMaxDepots )
|
||||
{
|
||||
var returnValue = _GetInstalledDepots( Self, appID, pvecDepots, cMaxDepots );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetAppInstallDir( IntPtr self, AppId appID, IntPtr pchFolder, uint cchFolderBufferSize );
|
||||
private FGetAppInstallDir _GetAppInstallDir;
|
||||
|
||||
#endregion
|
||||
internal uint GetAppInstallDir( AppId appID, out string pchFolder )
|
||||
{
|
||||
IntPtr mempchFolder = Helpers.TakeMemory();
|
||||
var returnValue = _GetAppInstallDir( Self, appID, mempchFolder, (1024 * 32) );
|
||||
pchFolder = Helpers.MemoryToString( mempchFolder );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsAppInstalled( IntPtr self, AppId appID );
|
||||
private FBIsAppInstalled _BIsAppInstalled;
|
||||
|
||||
#endregion
|
||||
internal bool BIsAppInstalled( AppId appID )
|
||||
{
|
||||
var returnValue = _BIsAppInstalled( Self, appID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetAppOwner( IntPtr self, ref SteamId retVal );
|
||||
#else
|
||||
private delegate SteamId FGetAppOwner( IntPtr self );
|
||||
#endif
|
||||
private FGetAppOwner _GetAppOwner;
|
||||
|
||||
#endregion
|
||||
internal SteamId GetAppOwner()
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( SteamId );
|
||||
_GetAppOwner( Self, ref retVal );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetAppOwner( Self );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetLaunchQueryParam( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey );
|
||||
private FGetLaunchQueryParam _GetLaunchQueryParam;
|
||||
|
||||
#endregion
|
||||
internal string GetLaunchQueryParam( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey )
|
||||
{
|
||||
var returnValue = _GetLaunchQueryParam( Self, pchKey );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetDlcDownloadProgress( IntPtr self, AppId nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal );
|
||||
private FGetDlcDownloadProgress _GetDlcDownloadProgress;
|
||||
|
||||
#endregion
|
||||
internal bool GetDlcDownloadProgress( AppId nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal )
|
||||
{
|
||||
var returnValue = _GetDlcDownloadProgress( Self, nAppID, ref punBytesDownloaded, ref punBytesTotal );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetAppBuildId( IntPtr self );
|
||||
private FGetAppBuildId _GetAppBuildId;
|
||||
|
||||
#endregion
|
||||
internal int GetAppBuildId()
|
||||
{
|
||||
var returnValue = _GetAppBuildId( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FRequestAllProofOfPurchaseKeys( IntPtr self );
|
||||
private FRequestAllProofOfPurchaseKeys _RequestAllProofOfPurchaseKeys;
|
||||
|
||||
#endregion
|
||||
internal void RequestAllProofOfPurchaseKeys()
|
||||
{
|
||||
_RequestAllProofOfPurchaseKeys( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FGetFileDetails( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszFileName );
|
||||
private FGetFileDetails _GetFileDetails;
|
||||
|
||||
#endregion
|
||||
internal async Task<FileDetailsResult_t?> GetFileDetails( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszFileName )
|
||||
{
|
||||
var returnValue = _GetFileDetails( Self, pszFileName );
|
||||
return await FileDetailsResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetLaunchCommandLine( IntPtr self, IntPtr pszCommandLine, int cubCommandLine );
|
||||
private FGetLaunchCommandLine _GetLaunchCommandLine;
|
||||
|
||||
#endregion
|
||||
internal int GetLaunchCommandLine( out string pszCommandLine )
|
||||
{
|
||||
IntPtr mempszCommandLine = Helpers.TakeMemory();
|
||||
var returnValue = _GetLaunchCommandLine( Self, mempszCommandLine, (1024 * 32) );
|
||||
pszCommandLine = Helpers.MemoryToString( mempszCommandLine );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsSubscribedFromFamilySharing( IntPtr self );
|
||||
private FBIsSubscribedFromFamilySharing _BIsSubscribedFromFamilySharing;
|
||||
|
||||
#endregion
|
||||
internal bool BIsSubscribedFromFamilySharing()
|
||||
{
|
||||
var returnValue = _BIsSubscribedFromFamilySharing( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,642 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamGameServer : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamGameServer012";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_InitGameServer = Marshal.GetDelegateForFunctionPointer<FInitGameServer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_SetProduct = Marshal.GetDelegateForFunctionPointer<FSetProduct>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_SetGameDescription = Marshal.GetDelegateForFunctionPointer<FSetGameDescription>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_SetModDir = Marshal.GetDelegateForFunctionPointer<FSetModDir>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_SetDedicatedServer = Marshal.GetDelegateForFunctionPointer<FSetDedicatedServer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_LogOn = Marshal.GetDelegateForFunctionPointer<FLogOn>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_LogOnAnonymous = Marshal.GetDelegateForFunctionPointer<FLogOnAnonymous>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_LogOff = Marshal.GetDelegateForFunctionPointer<FLogOff>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_BLoggedOn = Marshal.GetDelegateForFunctionPointer<FBLoggedOn>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_BSecure = Marshal.GetDelegateForFunctionPointer<FBSecure>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_GetSteamID = Marshal.GetDelegateForFunctionPointer<FGetSteamID>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_WasRestartRequested = Marshal.GetDelegateForFunctionPointer<FWasRestartRequested>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_SetMaxPlayerCount = Marshal.GetDelegateForFunctionPointer<FSetMaxPlayerCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_SetBotPlayerCount = Marshal.GetDelegateForFunctionPointer<FSetBotPlayerCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_SetServerName = Marshal.GetDelegateForFunctionPointer<FSetServerName>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_SetMapName = Marshal.GetDelegateForFunctionPointer<FSetMapName>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_SetPasswordProtected = Marshal.GetDelegateForFunctionPointer<FSetPasswordProtected>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_SetSpectatorPort = Marshal.GetDelegateForFunctionPointer<FSetSpectatorPort>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_SetSpectatorServerName = Marshal.GetDelegateForFunctionPointer<FSetSpectatorServerName>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_ClearAllKeyValues = Marshal.GetDelegateForFunctionPointer<FClearAllKeyValues>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_SetKeyValue = Marshal.GetDelegateForFunctionPointer<FSetKeyValue>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_SetGameTags = Marshal.GetDelegateForFunctionPointer<FSetGameTags>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_SetGameData = Marshal.GetDelegateForFunctionPointer<FSetGameData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_SetRegion = Marshal.GetDelegateForFunctionPointer<FSetRegion>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_SendUserConnectAndAuthenticate = Marshal.GetDelegateForFunctionPointer<FSendUserConnectAndAuthenticate>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_CreateUnauthenticatedUserConnection = Marshal.GetDelegateForFunctionPointer<FCreateUnauthenticatedUserConnection>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_SendUserDisconnect = Marshal.GetDelegateForFunctionPointer<FSendUserDisconnect>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_BUpdateUserData = Marshal.GetDelegateForFunctionPointer<FBUpdateUserData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_GetAuthSessionTicket = Marshal.GetDelegateForFunctionPointer<FGetAuthSessionTicket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
_BeginAuthSession = Marshal.GetDelegateForFunctionPointer<FBeginAuthSession>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 232 ) ) );
|
||||
_EndAuthSession = Marshal.GetDelegateForFunctionPointer<FEndAuthSession>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 240 ) ) );
|
||||
_CancelAuthTicket = Marshal.GetDelegateForFunctionPointer<FCancelAuthTicket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 248 ) ) );
|
||||
_UserHasLicenseForApp = Marshal.GetDelegateForFunctionPointer<FUserHasLicenseForApp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 256 ) ) );
|
||||
_RequestUserGroupStatus = Marshal.GetDelegateForFunctionPointer<FRequestUserGroupStatus>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 264 ) ) );
|
||||
_GetGameplayStats = Marshal.GetDelegateForFunctionPointer<FGetGameplayStats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 272 ) ) );
|
||||
_GetServerReputation = Marshal.GetDelegateForFunctionPointer<FGetServerReputation>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 280 ) ) );
|
||||
_GetPublicIP = Marshal.GetDelegateForFunctionPointer<FGetPublicIP>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 288 ) ) );
|
||||
_HandleIncomingPacket = Marshal.GetDelegateForFunctionPointer<FHandleIncomingPacket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 296 ) ) );
|
||||
_GetNextOutgoingPacket = Marshal.GetDelegateForFunctionPointer<FGetNextOutgoingPacket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 304 ) ) );
|
||||
_EnableHeartbeats = Marshal.GetDelegateForFunctionPointer<FEnableHeartbeats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 312 ) ) );
|
||||
_SetHeartbeatInterval = Marshal.GetDelegateForFunctionPointer<FSetHeartbeatInterval>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 320 ) ) );
|
||||
_ForceHeartbeat = Marshal.GetDelegateForFunctionPointer<FForceHeartbeat>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 328 ) ) );
|
||||
_AssociateWithClan = Marshal.GetDelegateForFunctionPointer<FAssociateWithClan>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 336 ) ) );
|
||||
_ComputeNewPlayerCompatibility = Marshal.GetDelegateForFunctionPointer<FComputeNewPlayerCompatibility>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 344 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_InitGameServer = null;
|
||||
_SetProduct = null;
|
||||
_SetGameDescription = null;
|
||||
_SetModDir = null;
|
||||
_SetDedicatedServer = null;
|
||||
_LogOn = null;
|
||||
_LogOnAnonymous = null;
|
||||
_LogOff = null;
|
||||
_BLoggedOn = null;
|
||||
_BSecure = null;
|
||||
_GetSteamID = null;
|
||||
_WasRestartRequested = null;
|
||||
_SetMaxPlayerCount = null;
|
||||
_SetBotPlayerCount = null;
|
||||
_SetServerName = null;
|
||||
_SetMapName = null;
|
||||
_SetPasswordProtected = null;
|
||||
_SetSpectatorPort = null;
|
||||
_SetSpectatorServerName = null;
|
||||
_ClearAllKeyValues = null;
|
||||
_SetKeyValue = null;
|
||||
_SetGameTags = null;
|
||||
_SetGameData = null;
|
||||
_SetRegion = null;
|
||||
_SendUserConnectAndAuthenticate = null;
|
||||
_CreateUnauthenticatedUserConnection = null;
|
||||
_SendUserDisconnect = null;
|
||||
_BUpdateUserData = null;
|
||||
_GetAuthSessionTicket = null;
|
||||
_BeginAuthSession = null;
|
||||
_EndAuthSession = null;
|
||||
_CancelAuthTicket = null;
|
||||
_UserHasLicenseForApp = null;
|
||||
_RequestUserGroupStatus = null;
|
||||
_GetGameplayStats = null;
|
||||
_GetServerReputation = null;
|
||||
_GetPublicIP = null;
|
||||
_HandleIncomingPacket = null;
|
||||
_GetNextOutgoingPacket = null;
|
||||
_EnableHeartbeats = null;
|
||||
_SetHeartbeatInterval = null;
|
||||
_ForceHeartbeat = null;
|
||||
_AssociateWithClan = null;
|
||||
_ComputeNewPlayerCompatibility = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FInitGameServer( IntPtr self, uint unIP, ushort usGamePort, ushort usQueryPort, uint unFlags, AppId nGameAppId, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersionString );
|
||||
private FInitGameServer _InitGameServer;
|
||||
|
||||
#endregion
|
||||
internal bool InitGameServer( uint unIP, ushort usGamePort, ushort usQueryPort, uint unFlags, AppId nGameAppId, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersionString )
|
||||
{
|
||||
var returnValue = _InitGameServer( Self, unIP, usGamePort, usQueryPort, unFlags, nGameAppId, pchVersionString );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetProduct( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszProduct );
|
||||
private FSetProduct _SetProduct;
|
||||
|
||||
#endregion
|
||||
internal void SetProduct( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszProduct )
|
||||
{
|
||||
_SetProduct( Self, pszProduct );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetGameDescription( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszGameDescription );
|
||||
private FSetGameDescription _SetGameDescription;
|
||||
|
||||
#endregion
|
||||
internal void SetGameDescription( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszGameDescription )
|
||||
{
|
||||
_SetGameDescription( Self, pszGameDescription );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetModDir( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszModDir );
|
||||
private FSetModDir _SetModDir;
|
||||
|
||||
#endregion
|
||||
internal void SetModDir( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszModDir )
|
||||
{
|
||||
_SetModDir( Self, pszModDir );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetDedicatedServer( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bDedicated );
|
||||
private FSetDedicatedServer _SetDedicatedServer;
|
||||
|
||||
#endregion
|
||||
internal void SetDedicatedServer( [MarshalAs( UnmanagedType.U1 )] bool bDedicated )
|
||||
{
|
||||
_SetDedicatedServer( Self, bDedicated );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FLogOn( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszToken );
|
||||
private FLogOn _LogOn;
|
||||
|
||||
#endregion
|
||||
internal void LogOn( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszToken )
|
||||
{
|
||||
_LogOn( Self, pszToken );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FLogOnAnonymous( IntPtr self );
|
||||
private FLogOnAnonymous _LogOnAnonymous;
|
||||
|
||||
#endregion
|
||||
internal void LogOnAnonymous()
|
||||
{
|
||||
_LogOnAnonymous( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FLogOff( IntPtr self );
|
||||
private FLogOff _LogOff;
|
||||
|
||||
#endregion
|
||||
internal void LogOff()
|
||||
{
|
||||
_LogOff( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBLoggedOn( IntPtr self );
|
||||
private FBLoggedOn _BLoggedOn;
|
||||
|
||||
#endregion
|
||||
internal bool BLoggedOn()
|
||||
{
|
||||
var returnValue = _BLoggedOn( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBSecure( IntPtr self );
|
||||
private FBSecure _BSecure;
|
||||
|
||||
#endregion
|
||||
internal bool BSecure()
|
||||
{
|
||||
var returnValue = _BSecure( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetSteamID( IntPtr self, ref SteamId retVal );
|
||||
#else
|
||||
private delegate SteamId FGetSteamID( IntPtr self );
|
||||
#endif
|
||||
private FGetSteamID _GetSteamID;
|
||||
|
||||
#endregion
|
||||
internal SteamId GetSteamID()
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( SteamId );
|
||||
_GetSteamID( Self, ref retVal );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetSteamID( Self );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FWasRestartRequested( IntPtr self );
|
||||
private FWasRestartRequested _WasRestartRequested;
|
||||
|
||||
#endregion
|
||||
internal bool WasRestartRequested()
|
||||
{
|
||||
var returnValue = _WasRestartRequested( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetMaxPlayerCount( IntPtr self, int cPlayersMax );
|
||||
private FSetMaxPlayerCount _SetMaxPlayerCount;
|
||||
|
||||
#endregion
|
||||
internal void SetMaxPlayerCount( int cPlayersMax )
|
||||
{
|
||||
_SetMaxPlayerCount( Self, cPlayersMax );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetBotPlayerCount( IntPtr self, int cBotplayers );
|
||||
private FSetBotPlayerCount _SetBotPlayerCount;
|
||||
|
||||
#endregion
|
||||
internal void SetBotPlayerCount( int cBotplayers )
|
||||
{
|
||||
_SetBotPlayerCount( Self, cBotplayers );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetServerName( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszServerName );
|
||||
private FSetServerName _SetServerName;
|
||||
|
||||
#endregion
|
||||
internal void SetServerName( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszServerName )
|
||||
{
|
||||
_SetServerName( Self, pszServerName );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetMapName( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszMapName );
|
||||
private FSetMapName _SetMapName;
|
||||
|
||||
#endregion
|
||||
internal void SetMapName( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszMapName )
|
||||
{
|
||||
_SetMapName( Self, pszMapName );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetPasswordProtected( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bPasswordProtected );
|
||||
private FSetPasswordProtected _SetPasswordProtected;
|
||||
|
||||
#endregion
|
||||
internal void SetPasswordProtected( [MarshalAs( UnmanagedType.U1 )] bool bPasswordProtected )
|
||||
{
|
||||
_SetPasswordProtected( Self, bPasswordProtected );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetSpectatorPort( IntPtr self, ushort unSpectatorPort );
|
||||
private FSetSpectatorPort _SetSpectatorPort;
|
||||
|
||||
#endregion
|
||||
internal void SetSpectatorPort( ushort unSpectatorPort )
|
||||
{
|
||||
_SetSpectatorPort( Self, unSpectatorPort );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetSpectatorServerName( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszSpectatorServerName );
|
||||
private FSetSpectatorServerName _SetSpectatorServerName;
|
||||
|
||||
#endregion
|
||||
internal void SetSpectatorServerName( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszSpectatorServerName )
|
||||
{
|
||||
_SetSpectatorServerName( Self, pszSpectatorServerName );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FClearAllKeyValues( IntPtr self );
|
||||
private FClearAllKeyValues _ClearAllKeyValues;
|
||||
|
||||
#endregion
|
||||
internal void ClearAllKeyValues()
|
||||
{
|
||||
_ClearAllKeyValues( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetKeyValue( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pKey, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pValue );
|
||||
private FSetKeyValue _SetKeyValue;
|
||||
|
||||
#endregion
|
||||
internal void SetKeyValue( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pKey, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pValue )
|
||||
{
|
||||
_SetKeyValue( Self, pKey, pValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetGameTags( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchGameTags );
|
||||
private FSetGameTags _SetGameTags;
|
||||
|
||||
#endregion
|
||||
internal void SetGameTags( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchGameTags )
|
||||
{
|
||||
_SetGameTags( Self, pchGameTags );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetGameData( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchGameData );
|
||||
private FSetGameData _SetGameData;
|
||||
|
||||
#endregion
|
||||
internal void SetGameData( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchGameData )
|
||||
{
|
||||
_SetGameData( Self, pchGameData );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetRegion( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszRegion );
|
||||
private FSetRegion _SetRegion;
|
||||
|
||||
#endregion
|
||||
internal void SetRegion( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszRegion )
|
||||
{
|
||||
_SetRegion( Self, pszRegion );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSendUserConnectAndAuthenticate( IntPtr self, uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref SteamId pSteamIDUser );
|
||||
private FSendUserConnectAndAuthenticate _SendUserConnectAndAuthenticate;
|
||||
|
||||
#endregion
|
||||
internal bool SendUserConnectAndAuthenticate( uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref SteamId pSteamIDUser )
|
||||
{
|
||||
var returnValue = _SendUserConnectAndAuthenticate( Self, unIPClient, pvAuthBlob, cubAuthBlobSize, ref pSteamIDUser );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FCreateUnauthenticatedUserConnection( IntPtr self, ref SteamId retVal );
|
||||
#else
|
||||
private delegate SteamId FCreateUnauthenticatedUserConnection( IntPtr self );
|
||||
#endif
|
||||
private FCreateUnauthenticatedUserConnection _CreateUnauthenticatedUserConnection;
|
||||
|
||||
#endregion
|
||||
internal SteamId CreateUnauthenticatedUserConnection()
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( SteamId );
|
||||
_CreateUnauthenticatedUserConnection( Self, ref retVal );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _CreateUnauthenticatedUserConnection( Self );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSendUserDisconnect( IntPtr self, SteamId steamIDUser );
|
||||
private FSendUserDisconnect _SendUserDisconnect;
|
||||
|
||||
#endregion
|
||||
internal void SendUserDisconnect( SteamId steamIDUser )
|
||||
{
|
||||
_SendUserDisconnect( Self, steamIDUser );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBUpdateUserData( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPlayerName, uint uScore );
|
||||
private FBUpdateUserData _BUpdateUserData;
|
||||
|
||||
#endregion
|
||||
internal bool BUpdateUserData( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPlayerName, uint uScore )
|
||||
{
|
||||
var returnValue = _BUpdateUserData( Self, steamIDUser, pchPlayerName, uScore );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HAuthTicket FGetAuthSessionTicket( IntPtr self, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket );
|
||||
private FGetAuthSessionTicket _GetAuthSessionTicket;
|
||||
|
||||
#endregion
|
||||
internal HAuthTicket GetAuthSessionTicket( IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket )
|
||||
{
|
||||
var returnValue = _GetAuthSessionTicket( Self, pTicket, cbMaxTicket, ref pcbTicket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate BeginAuthResult FBeginAuthSession( IntPtr self, IntPtr pAuthTicket, int cbAuthTicket, SteamId steamID );
|
||||
private FBeginAuthSession _BeginAuthSession;
|
||||
|
||||
#endregion
|
||||
internal BeginAuthResult BeginAuthSession( IntPtr pAuthTicket, int cbAuthTicket, SteamId steamID )
|
||||
{
|
||||
var returnValue = _BeginAuthSession( Self, pAuthTicket, cbAuthTicket, steamID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FEndAuthSession( IntPtr self, SteamId steamID );
|
||||
private FEndAuthSession _EndAuthSession;
|
||||
|
||||
#endregion
|
||||
internal void EndAuthSession( SteamId steamID )
|
||||
{
|
||||
_EndAuthSession( Self, steamID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FCancelAuthTicket( IntPtr self, HAuthTicket hAuthTicket );
|
||||
private FCancelAuthTicket _CancelAuthTicket;
|
||||
|
||||
#endregion
|
||||
internal void CancelAuthTicket( HAuthTicket hAuthTicket )
|
||||
{
|
||||
_CancelAuthTicket( Self, hAuthTicket );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate UserHasLicenseForAppResult FUserHasLicenseForApp( IntPtr self, SteamId steamID, AppId appID );
|
||||
private FUserHasLicenseForApp _UserHasLicenseForApp;
|
||||
|
||||
#endregion
|
||||
internal UserHasLicenseForAppResult UserHasLicenseForApp( SteamId steamID, AppId appID )
|
||||
{
|
||||
var returnValue = _UserHasLicenseForApp( Self, steamID, appID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FRequestUserGroupStatus( IntPtr self, SteamId steamIDUser, SteamId steamIDGroup );
|
||||
private FRequestUserGroupStatus _RequestUserGroupStatus;
|
||||
|
||||
#endregion
|
||||
internal bool RequestUserGroupStatus( SteamId steamIDUser, SteamId steamIDGroup )
|
||||
{
|
||||
var returnValue = _RequestUserGroupStatus( Self, steamIDUser, steamIDGroup );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FGetGameplayStats( IntPtr self );
|
||||
private FGetGameplayStats _GetGameplayStats;
|
||||
|
||||
#endregion
|
||||
internal void GetGameplayStats()
|
||||
{
|
||||
_GetGameplayStats( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FGetServerReputation( IntPtr self );
|
||||
private FGetServerReputation _GetServerReputation;
|
||||
|
||||
#endregion
|
||||
internal async Task<GSReputation_t?> GetServerReputation()
|
||||
{
|
||||
var returnValue = _GetServerReputation( Self );
|
||||
return await GSReputation_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetPublicIP( IntPtr self );
|
||||
private FGetPublicIP _GetPublicIP;
|
||||
|
||||
#endregion
|
||||
internal uint GetPublicIP()
|
||||
{
|
||||
var returnValue = _GetPublicIP( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FHandleIncomingPacket( IntPtr self, IntPtr pData, int cbData, uint srcIP, ushort srcPort );
|
||||
private FHandleIncomingPacket _HandleIncomingPacket;
|
||||
|
||||
#endregion
|
||||
internal bool HandleIncomingPacket( IntPtr pData, int cbData, uint srcIP, ushort srcPort )
|
||||
{
|
||||
var returnValue = _HandleIncomingPacket( Self, pData, cbData, srcIP, srcPort );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetNextOutgoingPacket( IntPtr self, IntPtr pOut, int cbMaxOut, ref uint pNetAdr, ref ushort pPort );
|
||||
private FGetNextOutgoingPacket _GetNextOutgoingPacket;
|
||||
|
||||
#endregion
|
||||
internal int GetNextOutgoingPacket( IntPtr pOut, int cbMaxOut, ref uint pNetAdr, ref ushort pPort )
|
||||
{
|
||||
var returnValue = _GetNextOutgoingPacket( Self, pOut, cbMaxOut, ref pNetAdr, ref pPort );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FEnableHeartbeats( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bActive );
|
||||
private FEnableHeartbeats _EnableHeartbeats;
|
||||
|
||||
#endregion
|
||||
internal void EnableHeartbeats( [MarshalAs( UnmanagedType.U1 )] bool bActive )
|
||||
{
|
||||
_EnableHeartbeats( Self, bActive );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetHeartbeatInterval( IntPtr self, int iHeartbeatInterval );
|
||||
private FSetHeartbeatInterval _SetHeartbeatInterval;
|
||||
|
||||
#endregion
|
||||
internal void SetHeartbeatInterval( int iHeartbeatInterval )
|
||||
{
|
||||
_SetHeartbeatInterval( Self, iHeartbeatInterval );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FForceHeartbeat( IntPtr self );
|
||||
private FForceHeartbeat _ForceHeartbeat;
|
||||
|
||||
#endregion
|
||||
internal void ForceHeartbeat()
|
||||
{
|
||||
_ForceHeartbeat( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FAssociateWithClan( IntPtr self, SteamId steamIDClan );
|
||||
private FAssociateWithClan _AssociateWithClan;
|
||||
|
||||
#endregion
|
||||
internal async Task<AssociateWithClanResult_t?> AssociateWithClan( SteamId steamIDClan )
|
||||
{
|
||||
var returnValue = _AssociateWithClan( Self, steamIDClan );
|
||||
return await AssociateWithClanResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FComputeNewPlayerCompatibility( IntPtr self, SteamId steamIDNewPlayer );
|
||||
private FComputeNewPlayerCompatibility _ComputeNewPlayerCompatibility;
|
||||
|
||||
#endregion
|
||||
internal async Task<ComputeNewPlayerCompatibilityResult_t?> ComputeNewPlayerCompatibility( SteamId steamIDNewPlayer )
|
||||
{
|
||||
var returnValue = _ComputeNewPlayerCompatibility( Self, steamIDNewPlayer );
|
||||
return await ComputeNewPlayerCompatibilityResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamGameServerStats : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamGameServerStats001";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_RequestUserStats = Marshal.GetDelegateForFunctionPointer<FRequestUserStats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_GetUserAchievement = Marshal.GetDelegateForFunctionPointer<FGetUserAchievement>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_UpdateUserAvgRateStat = Marshal.GetDelegateForFunctionPointer<FUpdateUserAvgRateStat>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_SetUserAchievement = Marshal.GetDelegateForFunctionPointer<FSetUserAchievement>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_ClearUserAchievement = Marshal.GetDelegateForFunctionPointer<FClearUserAchievement>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_StoreUserStats = Marshal.GetDelegateForFunctionPointer<FStoreUserStats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
|
||||
#if PLATFORM_WIN
|
||||
_GetUserStat1 = Marshal.GetDelegateForFunctionPointer<FGetUserStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_GetUserStat2 = Marshal.GetDelegateForFunctionPointer<FGetUserStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_SetUserStat1 = Marshal.GetDelegateForFunctionPointer<FSetUserStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_SetUserStat2 = Marshal.GetDelegateForFunctionPointer<FSetUserStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
#else
|
||||
_GetUserStat1 = Marshal.GetDelegateForFunctionPointer<FGetUserStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_GetUserStat2 = Marshal.GetDelegateForFunctionPointer<FGetUserStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_SetUserStat1 = Marshal.GetDelegateForFunctionPointer<FSetUserStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_SetUserStat2 = Marshal.GetDelegateForFunctionPointer<FSetUserStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
#endif
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_RequestUserStats = null;
|
||||
_GetUserStat1 = null;
|
||||
_GetUserStat2 = null;
|
||||
_GetUserAchievement = null;
|
||||
_SetUserStat1 = null;
|
||||
_SetUserStat2 = null;
|
||||
_UpdateUserAvgRateStat = null;
|
||||
_SetUserAchievement = null;
|
||||
_ClearUserAchievement = null;
|
||||
_StoreUserStats = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestUserStats( IntPtr self, SteamId steamIDUser );
|
||||
private FRequestUserStats _RequestUserStats;
|
||||
|
||||
#endregion
|
||||
internal async Task<GSStatsReceived_t?> RequestUserStats( SteamId steamIDUser )
|
||||
{
|
||||
var returnValue = _RequestUserStats( Self, steamIDUser );
|
||||
return await GSStatsReceived_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUserStat1( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref int pData );
|
||||
private FGetUserStat1 _GetUserStat1;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserStat1( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref int pData )
|
||||
{
|
||||
var returnValue = _GetUserStat1( Self, steamIDUser, pchName, ref pData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUserStat2( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pData );
|
||||
private FGetUserStat2 _GetUserStat2;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserStat2( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pData )
|
||||
{
|
||||
var returnValue = _GetUserStat2( Self, steamIDUser, pchName, ref pData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUserAchievement( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved );
|
||||
private FGetUserAchievement _GetUserAchievement;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserAchievement( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved )
|
||||
{
|
||||
var returnValue = _GetUserAchievement( Self, steamIDUser, pchName, ref pbAchieved );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetUserStat1( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, int nData );
|
||||
private FSetUserStat1 _SetUserStat1;
|
||||
|
||||
#endregion
|
||||
internal bool SetUserStat1( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, int nData )
|
||||
{
|
||||
var returnValue = _SetUserStat1( Self, steamIDUser, pchName, nData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetUserStat2( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float fData );
|
||||
private FSetUserStat2 _SetUserStat2;
|
||||
|
||||
#endregion
|
||||
internal bool SetUserStat2( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float fData )
|
||||
{
|
||||
var returnValue = _SetUserStat2( Self, steamIDUser, pchName, fData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FUpdateUserAvgRateStat( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float flCountThisSession, double dSessionLength );
|
||||
private FUpdateUserAvgRateStat _UpdateUserAvgRateStat;
|
||||
|
||||
#endregion
|
||||
internal bool UpdateUserAvgRateStat( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float flCountThisSession, double dSessionLength )
|
||||
{
|
||||
var returnValue = _UpdateUserAvgRateStat( Self, steamIDUser, pchName, flCountThisSession, dSessionLength );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetUserAchievement( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName );
|
||||
private FSetUserAchievement _SetUserAchievement;
|
||||
|
||||
#endregion
|
||||
internal bool SetUserAchievement( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName )
|
||||
{
|
||||
var returnValue = _SetUserAchievement( Self, steamIDUser, pchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FClearUserAchievement( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName );
|
||||
private FClearUserAchievement _ClearUserAchievement;
|
||||
|
||||
#endregion
|
||||
internal bool ClearUserAchievement( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName )
|
||||
{
|
||||
var returnValue = _ClearUserAchievement( Self, steamIDUser, pchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FStoreUserStats( IntPtr self, SteamId steamIDUser );
|
||||
private FStoreUserStats _StoreUserStats;
|
||||
|
||||
#endregion
|
||||
internal async Task<GSStatsStored_t?> StoreUserStats( SteamId steamIDUser )
|
||||
{
|
||||
var returnValue = _StoreUserStats( Self, steamIDUser );
|
||||
return await GSStatsStored_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,509 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamInput : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamInput001";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_DoInit = Marshal.GetDelegateForFunctionPointer<FDoInit>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_DoShutdown = Marshal.GetDelegateForFunctionPointer<FDoShutdown>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_RunFrame = Marshal.GetDelegateForFunctionPointer<FRunFrame>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_GetConnectedControllers = Marshal.GetDelegateForFunctionPointer<FGetConnectedControllers>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_GetActionSetHandle = Marshal.GetDelegateForFunctionPointer<FGetActionSetHandle>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_ActivateActionSet = Marshal.GetDelegateForFunctionPointer<FActivateActionSet>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_GetCurrentActionSet = Marshal.GetDelegateForFunctionPointer<FGetCurrentActionSet>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_ActivateActionSetLayer = Marshal.GetDelegateForFunctionPointer<FActivateActionSetLayer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_DeactivateActionSetLayer = Marshal.GetDelegateForFunctionPointer<FDeactivateActionSetLayer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_DeactivateAllActionSetLayers = Marshal.GetDelegateForFunctionPointer<FDeactivateAllActionSetLayers>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_GetActiveActionSetLayers = Marshal.GetDelegateForFunctionPointer<FGetActiveActionSetLayers>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_GetDigitalActionHandle = Marshal.GetDelegateForFunctionPointer<FGetDigitalActionHandle>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_GetDigitalActionData = Marshal.GetDelegateForFunctionPointer<FGetDigitalActionData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_GetDigitalActionOrigins = Marshal.GetDelegateForFunctionPointer<FGetDigitalActionOrigins>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_GetAnalogActionHandle = Marshal.GetDelegateForFunctionPointer<FGetAnalogActionHandle>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_GetAnalogActionData = Marshal.GetDelegateForFunctionPointer<FGetAnalogActionData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_GetAnalogActionOrigins = Marshal.GetDelegateForFunctionPointer<FGetAnalogActionOrigins>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_GetGlyphForActionOrigin = Marshal.GetDelegateForFunctionPointer<FGetGlyphForActionOrigin>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_GetStringForActionOrigin = Marshal.GetDelegateForFunctionPointer<FGetStringForActionOrigin>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_StopAnalogActionMomentum = Marshal.GetDelegateForFunctionPointer<FStopAnalogActionMomentum>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_GetMotionData = Marshal.GetDelegateForFunctionPointer<FGetMotionData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_TriggerVibration = Marshal.GetDelegateForFunctionPointer<FTriggerVibration>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_SetLEDColor = Marshal.GetDelegateForFunctionPointer<FSetLEDColor>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_TriggerHapticPulse = Marshal.GetDelegateForFunctionPointer<FTriggerHapticPulse>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_TriggerRepeatedHapticPulse = Marshal.GetDelegateForFunctionPointer<FTriggerRepeatedHapticPulse>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_ShowBindingPanel = Marshal.GetDelegateForFunctionPointer<FShowBindingPanel>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_GetInputTypeForHandle = Marshal.GetDelegateForFunctionPointer<FGetInputTypeForHandle>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_GetControllerForGamepadIndex = Marshal.GetDelegateForFunctionPointer<FGetControllerForGamepadIndex>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_GetGamepadIndexForController = Marshal.GetDelegateForFunctionPointer<FGetGamepadIndexForController>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
_GetStringForXboxOrigin = Marshal.GetDelegateForFunctionPointer<FGetStringForXboxOrigin>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 232 ) ) );
|
||||
_GetGlyphForXboxOrigin = Marshal.GetDelegateForFunctionPointer<FGetGlyphForXboxOrigin>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 240 ) ) );
|
||||
_GetActionOriginFromXboxOrigin = Marshal.GetDelegateForFunctionPointer<FGetActionOriginFromXboxOrigin>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 248 ) ) );
|
||||
_TranslateActionOrigin = Marshal.GetDelegateForFunctionPointer<FTranslateActionOrigin>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 256 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_DoInit = null;
|
||||
_DoShutdown = null;
|
||||
_RunFrame = null;
|
||||
_GetConnectedControllers = null;
|
||||
_GetActionSetHandle = null;
|
||||
_ActivateActionSet = null;
|
||||
_GetCurrentActionSet = null;
|
||||
_ActivateActionSetLayer = null;
|
||||
_DeactivateActionSetLayer = null;
|
||||
_DeactivateAllActionSetLayers = null;
|
||||
_GetActiveActionSetLayers = null;
|
||||
_GetDigitalActionHandle = null;
|
||||
_GetDigitalActionData = null;
|
||||
_GetDigitalActionOrigins = null;
|
||||
_GetAnalogActionHandle = null;
|
||||
_GetAnalogActionData = null;
|
||||
_GetAnalogActionOrigins = null;
|
||||
_GetGlyphForActionOrigin = null;
|
||||
_GetStringForActionOrigin = null;
|
||||
_StopAnalogActionMomentum = null;
|
||||
_GetMotionData = null;
|
||||
_TriggerVibration = null;
|
||||
_SetLEDColor = null;
|
||||
_TriggerHapticPulse = null;
|
||||
_TriggerRepeatedHapticPulse = null;
|
||||
_ShowBindingPanel = null;
|
||||
_GetInputTypeForHandle = null;
|
||||
_GetControllerForGamepadIndex = null;
|
||||
_GetGamepadIndexForController = null;
|
||||
_GetStringForXboxOrigin = null;
|
||||
_GetGlyphForXboxOrigin = null;
|
||||
_GetActionOriginFromXboxOrigin = null;
|
||||
_TranslateActionOrigin = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FDoInit( IntPtr self );
|
||||
private FDoInit _DoInit;
|
||||
|
||||
#endregion
|
||||
internal bool DoInit()
|
||||
{
|
||||
var returnValue = _DoInit( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FDoShutdown( IntPtr self );
|
||||
private FDoShutdown _DoShutdown;
|
||||
|
||||
#endregion
|
||||
internal bool DoShutdown()
|
||||
{
|
||||
var returnValue = _DoShutdown( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FRunFrame( IntPtr self );
|
||||
private FRunFrame _RunFrame;
|
||||
|
||||
#endregion
|
||||
internal void RunFrame()
|
||||
{
|
||||
_RunFrame( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetConnectedControllers( IntPtr self, [In,Out] InputHandle_t[] handlesOut );
|
||||
private FGetConnectedControllers _GetConnectedControllers;
|
||||
|
||||
#endregion
|
||||
internal int GetConnectedControllers( [In,Out] InputHandle_t[] handlesOut )
|
||||
{
|
||||
var returnValue = _GetConnectedControllers( Self, handlesOut );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate InputActionSetHandle_t FGetActionSetHandle( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszActionSetName );
|
||||
private FGetActionSetHandle _GetActionSetHandle;
|
||||
|
||||
#endregion
|
||||
internal InputActionSetHandle_t GetActionSetHandle( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszActionSetName )
|
||||
{
|
||||
var returnValue = _GetActionSetHandle( Self, pszActionSetName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FActivateActionSet( IntPtr self, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle );
|
||||
private FActivateActionSet _ActivateActionSet;
|
||||
|
||||
#endregion
|
||||
internal void ActivateActionSet( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle )
|
||||
{
|
||||
_ActivateActionSet( Self, inputHandle, actionSetHandle );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate InputActionSetHandle_t FGetCurrentActionSet( IntPtr self, InputHandle_t inputHandle );
|
||||
private FGetCurrentActionSet _GetCurrentActionSet;
|
||||
|
||||
#endregion
|
||||
internal InputActionSetHandle_t GetCurrentActionSet( InputHandle_t inputHandle )
|
||||
{
|
||||
var returnValue = _GetCurrentActionSet( Self, inputHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FActivateActionSetLayer( IntPtr self, InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle );
|
||||
private FActivateActionSetLayer _ActivateActionSetLayer;
|
||||
|
||||
#endregion
|
||||
internal void ActivateActionSetLayer( InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle )
|
||||
{
|
||||
_ActivateActionSetLayer( Self, inputHandle, actionSetLayerHandle );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FDeactivateActionSetLayer( IntPtr self, InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle );
|
||||
private FDeactivateActionSetLayer _DeactivateActionSetLayer;
|
||||
|
||||
#endregion
|
||||
internal void DeactivateActionSetLayer( InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle )
|
||||
{
|
||||
_DeactivateActionSetLayer( Self, inputHandle, actionSetLayerHandle );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FDeactivateAllActionSetLayers( IntPtr self, InputHandle_t inputHandle );
|
||||
private FDeactivateAllActionSetLayers _DeactivateAllActionSetLayers;
|
||||
|
||||
#endregion
|
||||
internal void DeactivateAllActionSetLayers( InputHandle_t inputHandle )
|
||||
{
|
||||
_DeactivateAllActionSetLayers( Self, inputHandle );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetActiveActionSetLayers( IntPtr self, InputHandle_t inputHandle, [In,Out] InputActionSetHandle_t[] handlesOut );
|
||||
private FGetActiveActionSetLayers _GetActiveActionSetLayers;
|
||||
|
||||
#endregion
|
||||
internal int GetActiveActionSetLayers( InputHandle_t inputHandle, [In,Out] InputActionSetHandle_t[] handlesOut )
|
||||
{
|
||||
var returnValue = _GetActiveActionSetLayers( Self, inputHandle, handlesOut );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate InputDigitalActionHandle_t FGetDigitalActionHandle( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszActionName );
|
||||
private FGetDigitalActionHandle _GetDigitalActionHandle;
|
||||
|
||||
#endregion
|
||||
internal InputDigitalActionHandle_t GetDigitalActionHandle( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszActionName )
|
||||
{
|
||||
var returnValue = _GetDigitalActionHandle( Self, pszActionName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetDigitalActionData( IntPtr self, ref DigitalState retVal, InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle );
|
||||
#else
|
||||
private delegate DigitalState FGetDigitalActionData( IntPtr self, InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle );
|
||||
#endif
|
||||
private FGetDigitalActionData _GetDigitalActionData;
|
||||
|
||||
#endregion
|
||||
internal DigitalState GetDigitalActionData( InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle )
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( DigitalState );
|
||||
_GetDigitalActionData( Self, ref retVal, inputHandle, digitalActionHandle );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetDigitalActionData( Self, inputHandle, digitalActionHandle );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetDigitalActionOrigins( IntPtr self, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, ref InputActionOrigin originsOut );
|
||||
private FGetDigitalActionOrigins _GetDigitalActionOrigins;
|
||||
|
||||
#endregion
|
||||
internal int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, ref InputActionOrigin originsOut )
|
||||
{
|
||||
var returnValue = _GetDigitalActionOrigins( Self, inputHandle, actionSetHandle, digitalActionHandle, ref originsOut );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate InputAnalogActionHandle_t FGetAnalogActionHandle( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszActionName );
|
||||
private FGetAnalogActionHandle _GetAnalogActionHandle;
|
||||
|
||||
#endregion
|
||||
internal InputAnalogActionHandle_t GetAnalogActionHandle( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszActionName )
|
||||
{
|
||||
var returnValue = _GetAnalogActionHandle( Self, pszActionName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetAnalogActionData( IntPtr self, ref AnalogState retVal, InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle );
|
||||
#else
|
||||
private delegate AnalogState FGetAnalogActionData( IntPtr self, InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle );
|
||||
#endif
|
||||
private FGetAnalogActionData _GetAnalogActionData;
|
||||
|
||||
#endregion
|
||||
internal AnalogState GetAnalogActionData( InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle )
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( AnalogState );
|
||||
_GetAnalogActionData( Self, ref retVal, inputHandle, analogActionHandle );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetAnalogActionData( Self, inputHandle, analogActionHandle );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetAnalogActionOrigins( IntPtr self, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, ref InputActionOrigin originsOut );
|
||||
private FGetAnalogActionOrigins _GetAnalogActionOrigins;
|
||||
|
||||
#endregion
|
||||
internal int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, ref InputActionOrigin originsOut )
|
||||
{
|
||||
var returnValue = _GetAnalogActionOrigins( Self, inputHandle, actionSetHandle, analogActionHandle, ref originsOut );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetGlyphForActionOrigin( IntPtr self, InputActionOrigin eOrigin );
|
||||
private FGetGlyphForActionOrigin _GetGlyphForActionOrigin;
|
||||
|
||||
#endregion
|
||||
internal string GetGlyphForActionOrigin( InputActionOrigin eOrigin )
|
||||
{
|
||||
var returnValue = _GetGlyphForActionOrigin( Self, eOrigin );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetStringForActionOrigin( IntPtr self, InputActionOrigin eOrigin );
|
||||
private FGetStringForActionOrigin _GetStringForActionOrigin;
|
||||
|
||||
#endregion
|
||||
internal string GetStringForActionOrigin( InputActionOrigin eOrigin )
|
||||
{
|
||||
var returnValue = _GetStringForActionOrigin( Self, eOrigin );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FStopAnalogActionMomentum( IntPtr self, InputHandle_t inputHandle, InputAnalogActionHandle_t eAction );
|
||||
private FStopAnalogActionMomentum _StopAnalogActionMomentum;
|
||||
|
||||
#endregion
|
||||
internal void StopAnalogActionMomentum( InputHandle_t inputHandle, InputAnalogActionHandle_t eAction )
|
||||
{
|
||||
_StopAnalogActionMomentum( Self, inputHandle, eAction );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetMotionData( IntPtr self, ref MotionState retVal, InputHandle_t inputHandle );
|
||||
#else
|
||||
private delegate MotionState FGetMotionData( IntPtr self, InputHandle_t inputHandle );
|
||||
#endif
|
||||
private FGetMotionData _GetMotionData;
|
||||
|
||||
#endregion
|
||||
internal MotionState GetMotionData( InputHandle_t inputHandle )
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( MotionState );
|
||||
_GetMotionData( Self, ref retVal, inputHandle );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetMotionData( Self, inputHandle );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FTriggerVibration( IntPtr self, InputHandle_t inputHandle, ushort usLeftSpeed, ushort usRightSpeed );
|
||||
private FTriggerVibration _TriggerVibration;
|
||||
|
||||
#endregion
|
||||
internal void TriggerVibration( InputHandle_t inputHandle, ushort usLeftSpeed, ushort usRightSpeed )
|
||||
{
|
||||
_TriggerVibration( Self, inputHandle, usLeftSpeed, usRightSpeed );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetLEDColor( IntPtr self, InputHandle_t inputHandle, byte nColorR, byte nColorG, byte nColorB, uint nFlags );
|
||||
private FSetLEDColor _SetLEDColor;
|
||||
|
||||
#endregion
|
||||
internal void SetLEDColor( InputHandle_t inputHandle, byte nColorR, byte nColorG, byte nColorB, uint nFlags )
|
||||
{
|
||||
_SetLEDColor( Self, inputHandle, nColorR, nColorG, nColorB, nFlags );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FTriggerHapticPulse( IntPtr self, InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec );
|
||||
private FTriggerHapticPulse _TriggerHapticPulse;
|
||||
|
||||
#endregion
|
||||
internal void TriggerHapticPulse( InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec )
|
||||
{
|
||||
_TriggerHapticPulse( Self, inputHandle, eTargetPad, usDurationMicroSec );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FTriggerRepeatedHapticPulse( IntPtr self, InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags );
|
||||
private FTriggerRepeatedHapticPulse _TriggerRepeatedHapticPulse;
|
||||
|
||||
#endregion
|
||||
internal void TriggerRepeatedHapticPulse( InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags )
|
||||
{
|
||||
_TriggerRepeatedHapticPulse( Self, inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FShowBindingPanel( IntPtr self, InputHandle_t inputHandle );
|
||||
private FShowBindingPanel _ShowBindingPanel;
|
||||
|
||||
#endregion
|
||||
internal bool ShowBindingPanel( InputHandle_t inputHandle )
|
||||
{
|
||||
var returnValue = _ShowBindingPanel( Self, inputHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate InputType FGetInputTypeForHandle( IntPtr self, InputHandle_t inputHandle );
|
||||
private FGetInputTypeForHandle _GetInputTypeForHandle;
|
||||
|
||||
#endregion
|
||||
internal InputType GetInputTypeForHandle( InputHandle_t inputHandle )
|
||||
{
|
||||
var returnValue = _GetInputTypeForHandle( Self, inputHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate InputHandle_t FGetControllerForGamepadIndex( IntPtr self, int nIndex );
|
||||
private FGetControllerForGamepadIndex _GetControllerForGamepadIndex;
|
||||
|
||||
#endregion
|
||||
internal InputHandle_t GetControllerForGamepadIndex( int nIndex )
|
||||
{
|
||||
var returnValue = _GetControllerForGamepadIndex( Self, nIndex );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetGamepadIndexForController( IntPtr self, InputHandle_t ulinputHandle );
|
||||
private FGetGamepadIndexForController _GetGamepadIndexForController;
|
||||
|
||||
#endregion
|
||||
internal int GetGamepadIndexForController( InputHandle_t ulinputHandle )
|
||||
{
|
||||
var returnValue = _GetGamepadIndexForController( Self, ulinputHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetStringForXboxOrigin( IntPtr self, XboxOrigin eOrigin );
|
||||
private FGetStringForXboxOrigin _GetStringForXboxOrigin;
|
||||
|
||||
#endregion
|
||||
internal string GetStringForXboxOrigin( XboxOrigin eOrigin )
|
||||
{
|
||||
var returnValue = _GetStringForXboxOrigin( Self, eOrigin );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetGlyphForXboxOrigin( IntPtr self, XboxOrigin eOrigin );
|
||||
private FGetGlyphForXboxOrigin _GetGlyphForXboxOrigin;
|
||||
|
||||
#endregion
|
||||
internal string GetGlyphForXboxOrigin( XboxOrigin eOrigin )
|
||||
{
|
||||
var returnValue = _GetGlyphForXboxOrigin( Self, eOrigin );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate InputActionOrigin FGetActionOriginFromXboxOrigin( IntPtr self, InputHandle_t inputHandle, XboxOrigin eOrigin );
|
||||
private FGetActionOriginFromXboxOrigin _GetActionOriginFromXboxOrigin;
|
||||
|
||||
#endregion
|
||||
internal InputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle, XboxOrigin eOrigin )
|
||||
{
|
||||
var returnValue = _GetActionOriginFromXboxOrigin( Self, inputHandle, eOrigin );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate InputActionOrigin FTranslateActionOrigin( IntPtr self, InputType eDestinationInputType, InputActionOrigin eSourceOrigin );
|
||||
private FTranslateActionOrigin _TranslateActionOrigin;
|
||||
|
||||
#endregion
|
||||
internal InputActionOrigin TranslateActionOrigin( InputType eDestinationInputType, InputActionOrigin eSourceOrigin )
|
||||
{
|
||||
var returnValue = _TranslateActionOrigin( Self, eDestinationInputType, eSourceOrigin );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,572 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamInventory : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMINVENTORY_INTERFACE_V003";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_GetResultStatus = Marshal.GetDelegateForFunctionPointer<FGetResultStatus>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_GetResultItems = Marshal.GetDelegateForFunctionPointer<FGetResultItems>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_GetResultItemProperty = Marshal.GetDelegateForFunctionPointer<FGetResultItemProperty>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_GetResultTimestamp = Marshal.GetDelegateForFunctionPointer<FGetResultTimestamp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_CheckResultSteamID = Marshal.GetDelegateForFunctionPointer<FCheckResultSteamID>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_DestroyResult = Marshal.GetDelegateForFunctionPointer<FDestroyResult>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_GetAllItems = Marshal.GetDelegateForFunctionPointer<FGetAllItems>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_GetItemsByID = Marshal.GetDelegateForFunctionPointer<FGetItemsByID>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_SerializeResult = Marshal.GetDelegateForFunctionPointer<FSerializeResult>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_DeserializeResult = Marshal.GetDelegateForFunctionPointer<FDeserializeResult>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_GenerateItems = Marshal.GetDelegateForFunctionPointer<FGenerateItems>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_GrantPromoItems = Marshal.GetDelegateForFunctionPointer<FGrantPromoItems>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_AddPromoItem = Marshal.GetDelegateForFunctionPointer<FAddPromoItem>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_AddPromoItems = Marshal.GetDelegateForFunctionPointer<FAddPromoItems>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_ConsumeItem = Marshal.GetDelegateForFunctionPointer<FConsumeItem>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_ExchangeItems = Marshal.GetDelegateForFunctionPointer<FExchangeItems>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_TransferItemQuantity = Marshal.GetDelegateForFunctionPointer<FTransferItemQuantity>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_SendItemDropHeartbeat = Marshal.GetDelegateForFunctionPointer<FSendItemDropHeartbeat>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_TriggerItemDrop = Marshal.GetDelegateForFunctionPointer<FTriggerItemDrop>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_TradeItems = Marshal.GetDelegateForFunctionPointer<FTradeItems>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_LoadItemDefinitions = Marshal.GetDelegateForFunctionPointer<FLoadItemDefinitions>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_GetItemDefinitionIDs = Marshal.GetDelegateForFunctionPointer<FGetItemDefinitionIDs>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_GetItemDefinitionProperty = Marshal.GetDelegateForFunctionPointer<FGetItemDefinitionProperty>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_RequestEligiblePromoItemDefinitionsIDs = Marshal.GetDelegateForFunctionPointer<FRequestEligiblePromoItemDefinitionsIDs>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_GetEligiblePromoItemDefinitionIDs = Marshal.GetDelegateForFunctionPointer<FGetEligiblePromoItemDefinitionIDs>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_StartPurchase = Marshal.GetDelegateForFunctionPointer<FStartPurchase>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_RequestPrices = Marshal.GetDelegateForFunctionPointer<FRequestPrices>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_GetNumItemsWithPrices = Marshal.GetDelegateForFunctionPointer<FGetNumItemsWithPrices>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_GetItemsWithPrices = Marshal.GetDelegateForFunctionPointer<FGetItemsWithPrices>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
_GetItemPrice = Marshal.GetDelegateForFunctionPointer<FGetItemPrice>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 232 ) ) );
|
||||
_StartUpdateProperties = Marshal.GetDelegateForFunctionPointer<FStartUpdateProperties>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 240 ) ) );
|
||||
_RemoveProperty = Marshal.GetDelegateForFunctionPointer<FRemoveProperty>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 248 ) ) );
|
||||
_SetProperty1 = Marshal.GetDelegateForFunctionPointer<FSetProperty1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 256 ) ) );
|
||||
_SetProperty2 = Marshal.GetDelegateForFunctionPointer<FSetProperty2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 264 ) ) );
|
||||
_SetProperty3 = Marshal.GetDelegateForFunctionPointer<FSetProperty3>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 272 ) ) );
|
||||
_SetProperty4 = Marshal.GetDelegateForFunctionPointer<FSetProperty4>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 280 ) ) );
|
||||
_SubmitUpdateProperties = Marshal.GetDelegateForFunctionPointer<FSubmitUpdateProperties>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 288 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_GetResultStatus = null;
|
||||
_GetResultItems = null;
|
||||
_GetResultItemProperty = null;
|
||||
_GetResultTimestamp = null;
|
||||
_CheckResultSteamID = null;
|
||||
_DestroyResult = null;
|
||||
_GetAllItems = null;
|
||||
_GetItemsByID = null;
|
||||
_SerializeResult = null;
|
||||
_DeserializeResult = null;
|
||||
_GenerateItems = null;
|
||||
_GrantPromoItems = null;
|
||||
_AddPromoItem = null;
|
||||
_AddPromoItems = null;
|
||||
_ConsumeItem = null;
|
||||
_ExchangeItems = null;
|
||||
_TransferItemQuantity = null;
|
||||
_SendItemDropHeartbeat = null;
|
||||
_TriggerItemDrop = null;
|
||||
_TradeItems = null;
|
||||
_LoadItemDefinitions = null;
|
||||
_GetItemDefinitionIDs = null;
|
||||
_GetItemDefinitionProperty = null;
|
||||
_RequestEligiblePromoItemDefinitionsIDs = null;
|
||||
_GetEligiblePromoItemDefinitionIDs = null;
|
||||
_StartPurchase = null;
|
||||
_RequestPrices = null;
|
||||
_GetNumItemsWithPrices = null;
|
||||
_GetItemsWithPrices = null;
|
||||
_GetItemPrice = null;
|
||||
_StartUpdateProperties = null;
|
||||
_RemoveProperty = null;
|
||||
_SetProperty1 = null;
|
||||
_SetProperty2 = null;
|
||||
_SetProperty3 = null;
|
||||
_SetProperty4 = null;
|
||||
_SubmitUpdateProperties = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Result FGetResultStatus( IntPtr self, SteamInventoryResult_t resultHandle );
|
||||
private FGetResultStatus _GetResultStatus;
|
||||
|
||||
#endregion
|
||||
internal Result GetResultStatus( SteamInventoryResult_t resultHandle )
|
||||
{
|
||||
var returnValue = _GetResultStatus( Self, resultHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetResultItems( IntPtr self, SteamInventoryResult_t resultHandle, [In,Out] SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize );
|
||||
private FGetResultItems _GetResultItems;
|
||||
|
||||
#endregion
|
||||
internal bool GetResultItems( SteamInventoryResult_t resultHandle, [In,Out] SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize )
|
||||
{
|
||||
var returnValue = _GetResultItems( Self, resultHandle, pOutItemsArray, ref punOutItemsArraySize );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetResultItemProperty( IntPtr self, SteamInventoryResult_t resultHandle, uint unItemIndex, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, IntPtr pchValueBuffer, ref uint punValueBufferSizeOut );
|
||||
private FGetResultItemProperty _GetResultItemProperty;
|
||||
|
||||
#endregion
|
||||
internal bool GetResultItemProperty( SteamInventoryResult_t resultHandle, uint unItemIndex, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut )
|
||||
{
|
||||
IntPtr mempchValueBuffer = Helpers.TakeMemory();
|
||||
var returnValue = _GetResultItemProperty( Self, resultHandle, unItemIndex, pchPropertyName, mempchValueBuffer, ref punValueBufferSizeOut );
|
||||
pchValueBuffer = Helpers.MemoryToString( mempchValueBuffer );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetResultTimestamp( IntPtr self, SteamInventoryResult_t resultHandle );
|
||||
private FGetResultTimestamp _GetResultTimestamp;
|
||||
|
||||
#endregion
|
||||
internal uint GetResultTimestamp( SteamInventoryResult_t resultHandle )
|
||||
{
|
||||
var returnValue = _GetResultTimestamp( Self, resultHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FCheckResultSteamID( IntPtr self, SteamInventoryResult_t resultHandle, SteamId steamIDExpected );
|
||||
private FCheckResultSteamID _CheckResultSteamID;
|
||||
|
||||
#endregion
|
||||
internal bool CheckResultSteamID( SteamInventoryResult_t resultHandle, SteamId steamIDExpected )
|
||||
{
|
||||
var returnValue = _CheckResultSteamID( Self, resultHandle, steamIDExpected );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FDestroyResult( IntPtr self, SteamInventoryResult_t resultHandle );
|
||||
private FDestroyResult _DestroyResult;
|
||||
|
||||
#endregion
|
||||
internal void DestroyResult( SteamInventoryResult_t resultHandle )
|
||||
{
|
||||
_DestroyResult( Self, resultHandle );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetAllItems( IntPtr self, ref SteamInventoryResult_t pResultHandle );
|
||||
private FGetAllItems _GetAllItems;
|
||||
|
||||
#endregion
|
||||
internal bool GetAllItems( ref SteamInventoryResult_t pResultHandle )
|
||||
{
|
||||
var returnValue = _GetAllItems( Self, ref pResultHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetItemsByID( IntPtr self, ref SteamInventoryResult_t pResultHandle, ref InventoryItemId pInstanceIDs, uint unCountInstanceIDs );
|
||||
private FGetItemsByID _GetItemsByID;
|
||||
|
||||
#endregion
|
||||
internal bool GetItemsByID( ref SteamInventoryResult_t pResultHandle, ref InventoryItemId pInstanceIDs, uint unCountInstanceIDs )
|
||||
{
|
||||
var returnValue = _GetItemsByID( Self, ref pResultHandle, ref pInstanceIDs, unCountInstanceIDs );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSerializeResult( IntPtr self, SteamInventoryResult_t resultHandle, IntPtr pOutBuffer, ref uint punOutBufferSize );
|
||||
private FSerializeResult _SerializeResult;
|
||||
|
||||
#endregion
|
||||
internal bool SerializeResult( SteamInventoryResult_t resultHandle, IntPtr pOutBuffer, ref uint punOutBufferSize )
|
||||
{
|
||||
var returnValue = _SerializeResult( Self, resultHandle, pOutBuffer, ref punOutBufferSize );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FDeserializeResult( IntPtr self, ref SteamInventoryResult_t pOutResultHandle, IntPtr pBuffer, uint unBufferSize, [MarshalAs( UnmanagedType.U1 )] bool bRESERVED_MUST_BE_FALSE );
|
||||
private FDeserializeResult _DeserializeResult;
|
||||
|
||||
#endregion
|
||||
internal bool DeserializeResult( ref SteamInventoryResult_t pOutResultHandle, IntPtr pBuffer, uint unBufferSize, [MarshalAs( UnmanagedType.U1 )] bool bRESERVED_MUST_BE_FALSE )
|
||||
{
|
||||
var returnValue = _DeserializeResult( Self, ref pOutResultHandle, pBuffer, unBufferSize, bRESERVED_MUST_BE_FALSE );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGenerateItems( IntPtr self, ref SteamInventoryResult_t pResultHandle, [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength );
|
||||
private FGenerateItems _GenerateItems;
|
||||
|
||||
#endregion
|
||||
internal bool GenerateItems( ref SteamInventoryResult_t pResultHandle, [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength )
|
||||
{
|
||||
var returnValue = _GenerateItems( Self, ref pResultHandle, pArrayItemDefs, punArrayQuantity, unArrayLength );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGrantPromoItems( IntPtr self, ref SteamInventoryResult_t pResultHandle );
|
||||
private FGrantPromoItems _GrantPromoItems;
|
||||
|
||||
#endregion
|
||||
internal bool GrantPromoItems( ref SteamInventoryResult_t pResultHandle )
|
||||
{
|
||||
var returnValue = _GrantPromoItems( Self, ref pResultHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FAddPromoItem( IntPtr self, ref SteamInventoryResult_t pResultHandle, InventoryDefId itemDef );
|
||||
private FAddPromoItem _AddPromoItem;
|
||||
|
||||
#endregion
|
||||
internal bool AddPromoItem( ref SteamInventoryResult_t pResultHandle, InventoryDefId itemDef )
|
||||
{
|
||||
var returnValue = _AddPromoItem( Self, ref pResultHandle, itemDef );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FAddPromoItems( IntPtr self, ref SteamInventoryResult_t pResultHandle, [In,Out] InventoryDefId[] pArrayItemDefs, uint unArrayLength );
|
||||
private FAddPromoItems _AddPromoItems;
|
||||
|
||||
#endregion
|
||||
internal bool AddPromoItems( ref SteamInventoryResult_t pResultHandle, [In,Out] InventoryDefId[] pArrayItemDefs, uint unArrayLength )
|
||||
{
|
||||
var returnValue = _AddPromoItems( Self, ref pResultHandle, pArrayItemDefs, unArrayLength );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FConsumeItem( IntPtr self, ref SteamInventoryResult_t pResultHandle, InventoryItemId itemConsume, uint unQuantity );
|
||||
private FConsumeItem _ConsumeItem;
|
||||
|
||||
#endregion
|
||||
internal bool ConsumeItem( ref SteamInventoryResult_t pResultHandle, InventoryItemId itemConsume, uint unQuantity )
|
||||
{
|
||||
var returnValue = _ConsumeItem( Self, ref pResultHandle, itemConsume, unQuantity );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FExchangeItems( IntPtr self, ref SteamInventoryResult_t pResultHandle, [In,Out] InventoryDefId[] pArrayGenerate, [In,Out] uint[] punArrayGenerateQuantity, uint unArrayGenerateLength, [In,Out] InventoryItemId[] pArrayDestroy, [In,Out] uint[] punArrayDestroyQuantity, uint unArrayDestroyLength );
|
||||
private FExchangeItems _ExchangeItems;
|
||||
|
||||
#endregion
|
||||
internal bool ExchangeItems( ref SteamInventoryResult_t pResultHandle, [In,Out] InventoryDefId[] pArrayGenerate, [In,Out] uint[] punArrayGenerateQuantity, uint unArrayGenerateLength, [In,Out] InventoryItemId[] pArrayDestroy, [In,Out] uint[] punArrayDestroyQuantity, uint unArrayDestroyLength )
|
||||
{
|
||||
var returnValue = _ExchangeItems( Self, ref pResultHandle, pArrayGenerate, punArrayGenerateQuantity, unArrayGenerateLength, pArrayDestroy, punArrayDestroyQuantity, unArrayDestroyLength );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FTransferItemQuantity( IntPtr self, ref SteamInventoryResult_t pResultHandle, InventoryItemId itemIdSource, uint unQuantity, InventoryItemId itemIdDest );
|
||||
private FTransferItemQuantity _TransferItemQuantity;
|
||||
|
||||
#endregion
|
||||
internal bool TransferItemQuantity( ref SteamInventoryResult_t pResultHandle, InventoryItemId itemIdSource, uint unQuantity, InventoryItemId itemIdDest )
|
||||
{
|
||||
var returnValue = _TransferItemQuantity( Self, ref pResultHandle, itemIdSource, unQuantity, itemIdDest );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSendItemDropHeartbeat( IntPtr self );
|
||||
private FSendItemDropHeartbeat _SendItemDropHeartbeat;
|
||||
|
||||
#endregion
|
||||
internal void SendItemDropHeartbeat()
|
||||
{
|
||||
_SendItemDropHeartbeat( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FTriggerItemDrop( IntPtr self, ref SteamInventoryResult_t pResultHandle, InventoryDefId dropListDefinition );
|
||||
private FTriggerItemDrop _TriggerItemDrop;
|
||||
|
||||
#endregion
|
||||
internal bool TriggerItemDrop( ref SteamInventoryResult_t pResultHandle, InventoryDefId dropListDefinition )
|
||||
{
|
||||
var returnValue = _TriggerItemDrop( Self, ref pResultHandle, dropListDefinition );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FTradeItems( IntPtr self, ref SteamInventoryResult_t pResultHandle, SteamId steamIDTradePartner, [In,Out] InventoryItemId[] pArrayGive, [In,Out] uint[] pArrayGiveQuantity, uint nArrayGiveLength, [In,Out] InventoryItemId[] pArrayGet, [In,Out] uint[] pArrayGetQuantity, uint nArrayGetLength );
|
||||
private FTradeItems _TradeItems;
|
||||
|
||||
#endregion
|
||||
internal bool TradeItems( ref SteamInventoryResult_t pResultHandle, SteamId steamIDTradePartner, [In,Out] InventoryItemId[] pArrayGive, [In,Out] uint[] pArrayGiveQuantity, uint nArrayGiveLength, [In,Out] InventoryItemId[] pArrayGet, [In,Out] uint[] pArrayGetQuantity, uint nArrayGetLength )
|
||||
{
|
||||
var returnValue = _TradeItems( Self, ref pResultHandle, steamIDTradePartner, pArrayGive, pArrayGiveQuantity, nArrayGiveLength, pArrayGet, pArrayGetQuantity, nArrayGetLength );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FLoadItemDefinitions( IntPtr self );
|
||||
private FLoadItemDefinitions _LoadItemDefinitions;
|
||||
|
||||
#endregion
|
||||
internal bool LoadItemDefinitions()
|
||||
{
|
||||
var returnValue = _LoadItemDefinitions( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetItemDefinitionIDs( IntPtr self, [In,Out] InventoryDefId[] pItemDefIDs, ref uint punItemDefIDsArraySize );
|
||||
private FGetItemDefinitionIDs _GetItemDefinitionIDs;
|
||||
|
||||
#endregion
|
||||
internal bool GetItemDefinitionIDs( [In,Out] InventoryDefId[] pItemDefIDs, ref uint punItemDefIDsArraySize )
|
||||
{
|
||||
var returnValue = _GetItemDefinitionIDs( Self, pItemDefIDs, ref punItemDefIDsArraySize );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetItemDefinitionProperty( IntPtr self, InventoryDefId iDefinition, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, IntPtr pchValueBuffer, ref uint punValueBufferSizeOut );
|
||||
private FGetItemDefinitionProperty _GetItemDefinitionProperty;
|
||||
|
||||
#endregion
|
||||
internal bool GetItemDefinitionProperty( InventoryDefId iDefinition, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut )
|
||||
{
|
||||
IntPtr mempchValueBuffer = Helpers.TakeMemory();
|
||||
var returnValue = _GetItemDefinitionProperty( Self, iDefinition, pchPropertyName, mempchValueBuffer, ref punValueBufferSizeOut );
|
||||
pchValueBuffer = Helpers.MemoryToString( mempchValueBuffer );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestEligiblePromoItemDefinitionsIDs( IntPtr self, SteamId steamID );
|
||||
private FRequestEligiblePromoItemDefinitionsIDs _RequestEligiblePromoItemDefinitionsIDs;
|
||||
|
||||
#endregion
|
||||
internal async Task<SteamInventoryEligiblePromoItemDefIDs_t?> RequestEligiblePromoItemDefinitionsIDs( SteamId steamID )
|
||||
{
|
||||
var returnValue = _RequestEligiblePromoItemDefinitionsIDs( Self, steamID );
|
||||
return await SteamInventoryEligiblePromoItemDefIDs_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetEligiblePromoItemDefinitionIDs( IntPtr self, SteamId steamID, [In,Out] InventoryDefId[] pItemDefIDs, ref uint punItemDefIDsArraySize );
|
||||
private FGetEligiblePromoItemDefinitionIDs _GetEligiblePromoItemDefinitionIDs;
|
||||
|
||||
#endregion
|
||||
internal bool GetEligiblePromoItemDefinitionIDs( SteamId steamID, [In,Out] InventoryDefId[] pItemDefIDs, ref uint punItemDefIDsArraySize )
|
||||
{
|
||||
var returnValue = _GetEligiblePromoItemDefinitionIDs( Self, steamID, pItemDefIDs, ref punItemDefIDsArraySize );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FStartPurchase( IntPtr self, [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength );
|
||||
private FStartPurchase _StartPurchase;
|
||||
|
||||
#endregion
|
||||
internal async Task<SteamInventoryStartPurchaseResult_t?> StartPurchase( [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength )
|
||||
{
|
||||
var returnValue = _StartPurchase( Self, pArrayItemDefs, punArrayQuantity, unArrayLength );
|
||||
return await SteamInventoryStartPurchaseResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestPrices( IntPtr self );
|
||||
private FRequestPrices _RequestPrices;
|
||||
|
||||
#endregion
|
||||
internal async Task<SteamInventoryRequestPricesResult_t?> RequestPrices()
|
||||
{
|
||||
var returnValue = _RequestPrices( Self );
|
||||
return await SteamInventoryRequestPricesResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetNumItemsWithPrices( IntPtr self );
|
||||
private FGetNumItemsWithPrices _GetNumItemsWithPrices;
|
||||
|
||||
#endregion
|
||||
internal uint GetNumItemsWithPrices()
|
||||
{
|
||||
var returnValue = _GetNumItemsWithPrices( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetItemsWithPrices( IntPtr self, [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] ulong[] pCurrentPrices, [In,Out] ulong[] pBasePrices, uint unArrayLength );
|
||||
private FGetItemsWithPrices _GetItemsWithPrices;
|
||||
|
||||
#endregion
|
||||
internal bool GetItemsWithPrices( [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] ulong[] pCurrentPrices, [In,Out] ulong[] pBasePrices, uint unArrayLength )
|
||||
{
|
||||
var returnValue = _GetItemsWithPrices( Self, pArrayItemDefs, pCurrentPrices, pBasePrices, unArrayLength );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetItemPrice( IntPtr self, InventoryDefId iDefinition, ref ulong pCurrentPrice, ref ulong pBasePrice );
|
||||
private FGetItemPrice _GetItemPrice;
|
||||
|
||||
#endregion
|
||||
internal bool GetItemPrice( InventoryDefId iDefinition, ref ulong pCurrentPrice, ref ulong pBasePrice )
|
||||
{
|
||||
var returnValue = _GetItemPrice( Self, iDefinition, ref pCurrentPrice, ref pBasePrice );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamInventoryUpdateHandle_t FStartUpdateProperties( IntPtr self );
|
||||
private FStartUpdateProperties _StartUpdateProperties;
|
||||
|
||||
#endregion
|
||||
internal SteamInventoryUpdateHandle_t StartUpdateProperties()
|
||||
{
|
||||
var returnValue = _StartUpdateProperties( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FRemoveProperty( IntPtr self, SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName );
|
||||
private FRemoveProperty _RemoveProperty;
|
||||
|
||||
#endregion
|
||||
internal bool RemoveProperty( SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName )
|
||||
{
|
||||
var returnValue = _RemoveProperty( Self, handle, nItemID, pchPropertyName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetProperty1( IntPtr self, SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyValue );
|
||||
private FSetProperty1 _SetProperty1;
|
||||
|
||||
#endregion
|
||||
internal bool SetProperty1( SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyValue )
|
||||
{
|
||||
var returnValue = _SetProperty1( Self, handle, nItemID, pchPropertyName, pchPropertyValue );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetProperty2( IntPtr self, SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, [MarshalAs( UnmanagedType.U1 )] bool bValue );
|
||||
private FSetProperty2 _SetProperty2;
|
||||
|
||||
#endregion
|
||||
internal bool SetProperty2( SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, [MarshalAs( UnmanagedType.U1 )] bool bValue )
|
||||
{
|
||||
var returnValue = _SetProperty2( Self, handle, nItemID, pchPropertyName, bValue );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetProperty3( IntPtr self, SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, long nValue );
|
||||
private FSetProperty3 _SetProperty3;
|
||||
|
||||
#endregion
|
||||
internal bool SetProperty3( SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, long nValue )
|
||||
{
|
||||
var returnValue = _SetProperty3( Self, handle, nItemID, pchPropertyName, nValue );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetProperty4( IntPtr self, SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, float flValue );
|
||||
private FSetProperty4 _SetProperty4;
|
||||
|
||||
#endregion
|
||||
internal bool SetProperty4( SteamInventoryUpdateHandle_t handle, InventoryItemId nItemID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, float flValue )
|
||||
{
|
||||
var returnValue = _SetProperty4( Self, handle, nItemID, pchPropertyName, flValue );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSubmitUpdateProperties( IntPtr self, SteamInventoryUpdateHandle_t handle, ref SteamInventoryResult_t pResultHandle );
|
||||
private FSubmitUpdateProperties _SubmitUpdateProperties;
|
||||
|
||||
#endregion
|
||||
internal bool SubmitUpdateProperties( SteamInventoryUpdateHandle_t handle, ref SteamInventoryResult_t pResultHandle )
|
||||
{
|
||||
var returnValue = _SubmitUpdateProperties( Self, handle, ref pResultHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,594 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamMatchmaking : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamMatchMaking009";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_GetFavoriteGameCount = Marshal.GetDelegateForFunctionPointer<FGetFavoriteGameCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_GetFavoriteGame = Marshal.GetDelegateForFunctionPointer<FGetFavoriteGame>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_AddFavoriteGame = Marshal.GetDelegateForFunctionPointer<FAddFavoriteGame>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_RemoveFavoriteGame = Marshal.GetDelegateForFunctionPointer<FRemoveFavoriteGame>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_RequestLobbyList = Marshal.GetDelegateForFunctionPointer<FRequestLobbyList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_AddRequestLobbyListStringFilter = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListStringFilter>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_AddRequestLobbyListNumericalFilter = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListNumericalFilter>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_AddRequestLobbyListNearValueFilter = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListNearValueFilter>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_AddRequestLobbyListFilterSlotsAvailable = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListFilterSlotsAvailable>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_AddRequestLobbyListDistanceFilter = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListDistanceFilter>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_AddRequestLobbyListResultCountFilter = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListResultCountFilter>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_AddRequestLobbyListCompatibleMembersFilter = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListCompatibleMembersFilter>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_GetLobbyByIndex = Marshal.GetDelegateForFunctionPointer<FGetLobbyByIndex>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_CreateLobby = Marshal.GetDelegateForFunctionPointer<FCreateLobby>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_JoinLobby = Marshal.GetDelegateForFunctionPointer<FJoinLobby>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_LeaveLobby = Marshal.GetDelegateForFunctionPointer<FLeaveLobby>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_InviteUserToLobby = Marshal.GetDelegateForFunctionPointer<FInviteUserToLobby>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_GetNumLobbyMembers = Marshal.GetDelegateForFunctionPointer<FGetNumLobbyMembers>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_GetLobbyMemberByIndex = Marshal.GetDelegateForFunctionPointer<FGetLobbyMemberByIndex>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_GetLobbyData = Marshal.GetDelegateForFunctionPointer<FGetLobbyData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_SetLobbyData = Marshal.GetDelegateForFunctionPointer<FSetLobbyData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_GetLobbyDataCount = Marshal.GetDelegateForFunctionPointer<FGetLobbyDataCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_GetLobbyDataByIndex = Marshal.GetDelegateForFunctionPointer<FGetLobbyDataByIndex>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_DeleteLobbyData = Marshal.GetDelegateForFunctionPointer<FDeleteLobbyData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_GetLobbyMemberData = Marshal.GetDelegateForFunctionPointer<FGetLobbyMemberData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_SetLobbyMemberData = Marshal.GetDelegateForFunctionPointer<FSetLobbyMemberData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_SendLobbyChatMsg = Marshal.GetDelegateForFunctionPointer<FSendLobbyChatMsg>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_GetLobbyChatEntry = Marshal.GetDelegateForFunctionPointer<FGetLobbyChatEntry>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_RequestLobbyData = Marshal.GetDelegateForFunctionPointer<FRequestLobbyData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
_SetLobbyGameServer = Marshal.GetDelegateForFunctionPointer<FSetLobbyGameServer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 232 ) ) );
|
||||
_GetLobbyGameServer = Marshal.GetDelegateForFunctionPointer<FGetLobbyGameServer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 240 ) ) );
|
||||
_SetLobbyMemberLimit = Marshal.GetDelegateForFunctionPointer<FSetLobbyMemberLimit>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 248 ) ) );
|
||||
_GetLobbyMemberLimit = Marshal.GetDelegateForFunctionPointer<FGetLobbyMemberLimit>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 256 ) ) );
|
||||
_SetLobbyType = Marshal.GetDelegateForFunctionPointer<FSetLobbyType>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 264 ) ) );
|
||||
_SetLobbyJoinable = Marshal.GetDelegateForFunctionPointer<FSetLobbyJoinable>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 272 ) ) );
|
||||
_GetLobbyOwner = Marshal.GetDelegateForFunctionPointer<FGetLobbyOwner>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 280 ) ) );
|
||||
_SetLobbyOwner = Marshal.GetDelegateForFunctionPointer<FSetLobbyOwner>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 288 ) ) );
|
||||
_SetLinkedLobby = Marshal.GetDelegateForFunctionPointer<FSetLinkedLobby>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 296 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_GetFavoriteGameCount = null;
|
||||
_GetFavoriteGame = null;
|
||||
_AddFavoriteGame = null;
|
||||
_RemoveFavoriteGame = null;
|
||||
_RequestLobbyList = null;
|
||||
_AddRequestLobbyListStringFilter = null;
|
||||
_AddRequestLobbyListNumericalFilter = null;
|
||||
_AddRequestLobbyListNearValueFilter = null;
|
||||
_AddRequestLobbyListFilterSlotsAvailable = null;
|
||||
_AddRequestLobbyListDistanceFilter = null;
|
||||
_AddRequestLobbyListResultCountFilter = null;
|
||||
_AddRequestLobbyListCompatibleMembersFilter = null;
|
||||
_GetLobbyByIndex = null;
|
||||
_CreateLobby = null;
|
||||
_JoinLobby = null;
|
||||
_LeaveLobby = null;
|
||||
_InviteUserToLobby = null;
|
||||
_GetNumLobbyMembers = null;
|
||||
_GetLobbyMemberByIndex = null;
|
||||
_GetLobbyData = null;
|
||||
_SetLobbyData = null;
|
||||
_GetLobbyDataCount = null;
|
||||
_GetLobbyDataByIndex = null;
|
||||
_DeleteLobbyData = null;
|
||||
_GetLobbyMemberData = null;
|
||||
_SetLobbyMemberData = null;
|
||||
_SendLobbyChatMsg = null;
|
||||
_GetLobbyChatEntry = null;
|
||||
_RequestLobbyData = null;
|
||||
_SetLobbyGameServer = null;
|
||||
_GetLobbyGameServer = null;
|
||||
_SetLobbyMemberLimit = null;
|
||||
_GetLobbyMemberLimit = null;
|
||||
_SetLobbyType = null;
|
||||
_SetLobbyJoinable = null;
|
||||
_GetLobbyOwner = null;
|
||||
_SetLobbyOwner = null;
|
||||
_SetLinkedLobby = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetFavoriteGameCount( IntPtr self );
|
||||
private FGetFavoriteGameCount _GetFavoriteGameCount;
|
||||
|
||||
#endregion
|
||||
internal int GetFavoriteGameCount()
|
||||
{
|
||||
var returnValue = _GetFavoriteGameCount( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetFavoriteGame( IntPtr self, int iGame, ref AppId pnAppID, ref uint pnIP, ref ushort pnConnPort, ref ushort pnQueryPort, ref uint punFlags, ref uint pRTime32LastPlayedOnServer );
|
||||
private FGetFavoriteGame _GetFavoriteGame;
|
||||
|
||||
#endregion
|
||||
internal bool GetFavoriteGame( int iGame, ref AppId pnAppID, ref uint pnIP, ref ushort pnConnPort, ref ushort pnQueryPort, ref uint punFlags, ref uint pRTime32LastPlayedOnServer )
|
||||
{
|
||||
var returnValue = _GetFavoriteGame( Self, iGame, ref pnAppID, ref pnIP, ref pnConnPort, ref pnQueryPort, ref punFlags, ref pRTime32LastPlayedOnServer );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FAddFavoriteGame( IntPtr self, AppId nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags, uint rTime32LastPlayedOnServer );
|
||||
private FAddFavoriteGame _AddFavoriteGame;
|
||||
|
||||
#endregion
|
||||
internal int AddFavoriteGame( AppId nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags, uint rTime32LastPlayedOnServer )
|
||||
{
|
||||
var returnValue = _AddFavoriteGame( Self, nAppID, nIP, nConnPort, nQueryPort, unFlags, rTime32LastPlayedOnServer );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FRemoveFavoriteGame( IntPtr self, AppId nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags );
|
||||
private FRemoveFavoriteGame _RemoveFavoriteGame;
|
||||
|
||||
#endregion
|
||||
internal bool RemoveFavoriteGame( AppId nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags )
|
||||
{
|
||||
var returnValue = _RemoveFavoriteGame( Self, nAppID, nIP, nConnPort, nQueryPort, unFlags );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestLobbyList( IntPtr self );
|
||||
private FRequestLobbyList _RequestLobbyList;
|
||||
|
||||
#endregion
|
||||
internal async Task<LobbyMatchList_t?> RequestLobbyList()
|
||||
{
|
||||
var returnValue = _RequestLobbyList( Self );
|
||||
return await LobbyMatchList_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FAddRequestLobbyListStringFilter( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKeyToMatch, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchValueToMatch, LobbyComparison eComparisonType );
|
||||
private FAddRequestLobbyListStringFilter _AddRequestLobbyListStringFilter;
|
||||
|
||||
#endregion
|
||||
internal void AddRequestLobbyListStringFilter( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKeyToMatch, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchValueToMatch, LobbyComparison eComparisonType )
|
||||
{
|
||||
_AddRequestLobbyListStringFilter( Self, pchKeyToMatch, pchValueToMatch, eComparisonType );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FAddRequestLobbyListNumericalFilter( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKeyToMatch, int nValueToMatch, LobbyComparison eComparisonType );
|
||||
private FAddRequestLobbyListNumericalFilter _AddRequestLobbyListNumericalFilter;
|
||||
|
||||
#endregion
|
||||
internal void AddRequestLobbyListNumericalFilter( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKeyToMatch, int nValueToMatch, LobbyComparison eComparisonType )
|
||||
{
|
||||
_AddRequestLobbyListNumericalFilter( Self, pchKeyToMatch, nValueToMatch, eComparisonType );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FAddRequestLobbyListNearValueFilter( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKeyToMatch, int nValueToBeCloseTo );
|
||||
private FAddRequestLobbyListNearValueFilter _AddRequestLobbyListNearValueFilter;
|
||||
|
||||
#endregion
|
||||
internal void AddRequestLobbyListNearValueFilter( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKeyToMatch, int nValueToBeCloseTo )
|
||||
{
|
||||
_AddRequestLobbyListNearValueFilter( Self, pchKeyToMatch, nValueToBeCloseTo );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FAddRequestLobbyListFilterSlotsAvailable( IntPtr self, int nSlotsAvailable );
|
||||
private FAddRequestLobbyListFilterSlotsAvailable _AddRequestLobbyListFilterSlotsAvailable;
|
||||
|
||||
#endregion
|
||||
internal void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable )
|
||||
{
|
||||
_AddRequestLobbyListFilterSlotsAvailable( Self, nSlotsAvailable );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FAddRequestLobbyListDistanceFilter( IntPtr self, LobbyDistanceFilter eLobbyDistanceFilter );
|
||||
private FAddRequestLobbyListDistanceFilter _AddRequestLobbyListDistanceFilter;
|
||||
|
||||
#endregion
|
||||
internal void AddRequestLobbyListDistanceFilter( LobbyDistanceFilter eLobbyDistanceFilter )
|
||||
{
|
||||
_AddRequestLobbyListDistanceFilter( Self, eLobbyDistanceFilter );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FAddRequestLobbyListResultCountFilter( IntPtr self, int cMaxResults );
|
||||
private FAddRequestLobbyListResultCountFilter _AddRequestLobbyListResultCountFilter;
|
||||
|
||||
#endregion
|
||||
internal void AddRequestLobbyListResultCountFilter( int cMaxResults )
|
||||
{
|
||||
_AddRequestLobbyListResultCountFilter( Self, cMaxResults );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FAddRequestLobbyListCompatibleMembersFilter( IntPtr self, SteamId steamIDLobby );
|
||||
private FAddRequestLobbyListCompatibleMembersFilter _AddRequestLobbyListCompatibleMembersFilter;
|
||||
|
||||
#endregion
|
||||
internal void AddRequestLobbyListCompatibleMembersFilter( SteamId steamIDLobby )
|
||||
{
|
||||
_AddRequestLobbyListCompatibleMembersFilter( Self, steamIDLobby );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetLobbyByIndex( IntPtr self, ref SteamId retVal, int iLobby );
|
||||
#else
|
||||
private delegate SteamId FGetLobbyByIndex( IntPtr self, int iLobby );
|
||||
#endif
|
||||
private FGetLobbyByIndex _GetLobbyByIndex;
|
||||
|
||||
#endregion
|
||||
internal SteamId GetLobbyByIndex( int iLobby )
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( SteamId );
|
||||
_GetLobbyByIndex( Self, ref retVal, iLobby );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetLobbyByIndex( Self, iLobby );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FCreateLobby( IntPtr self, LobbyType eLobbyType, int cMaxMembers );
|
||||
private FCreateLobby _CreateLobby;
|
||||
|
||||
#endregion
|
||||
internal async Task<LobbyCreated_t?> CreateLobby( LobbyType eLobbyType, int cMaxMembers )
|
||||
{
|
||||
var returnValue = _CreateLobby( Self, eLobbyType, cMaxMembers );
|
||||
return await LobbyCreated_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FJoinLobby( IntPtr self, SteamId steamIDLobby );
|
||||
private FJoinLobby _JoinLobby;
|
||||
|
||||
#endregion
|
||||
internal async Task<LobbyEnter_t?> JoinLobby( SteamId steamIDLobby )
|
||||
{
|
||||
var returnValue = _JoinLobby( Self, steamIDLobby );
|
||||
return await LobbyEnter_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FLeaveLobby( IntPtr self, SteamId steamIDLobby );
|
||||
private FLeaveLobby _LeaveLobby;
|
||||
|
||||
#endregion
|
||||
internal void LeaveLobby( SteamId steamIDLobby )
|
||||
{
|
||||
_LeaveLobby( Self, steamIDLobby );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FInviteUserToLobby( IntPtr self, SteamId steamIDLobby, SteamId steamIDInvitee );
|
||||
private FInviteUserToLobby _InviteUserToLobby;
|
||||
|
||||
#endregion
|
||||
internal bool InviteUserToLobby( SteamId steamIDLobby, SteamId steamIDInvitee )
|
||||
{
|
||||
var returnValue = _InviteUserToLobby( Self, steamIDLobby, steamIDInvitee );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetNumLobbyMembers( IntPtr self, SteamId steamIDLobby );
|
||||
private FGetNumLobbyMembers _GetNumLobbyMembers;
|
||||
|
||||
#endregion
|
||||
internal int GetNumLobbyMembers( SteamId steamIDLobby )
|
||||
{
|
||||
var returnValue = _GetNumLobbyMembers( Self, steamIDLobby );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetLobbyMemberByIndex( IntPtr self, ref SteamId retVal, SteamId steamIDLobby, int iMember );
|
||||
#else
|
||||
private delegate SteamId FGetLobbyMemberByIndex( IntPtr self, SteamId steamIDLobby, int iMember );
|
||||
#endif
|
||||
private FGetLobbyMemberByIndex _GetLobbyMemberByIndex;
|
||||
|
||||
#endregion
|
||||
internal SteamId GetLobbyMemberByIndex( SteamId steamIDLobby, int iMember )
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( SteamId );
|
||||
_GetLobbyMemberByIndex( Self, ref retVal, steamIDLobby, iMember );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetLobbyMemberByIndex( Self, steamIDLobby, iMember );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetLobbyData( IntPtr self, SteamId steamIDLobby, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey );
|
||||
private FGetLobbyData _GetLobbyData;
|
||||
|
||||
#endregion
|
||||
internal string GetLobbyData( SteamId steamIDLobby, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey )
|
||||
{
|
||||
var returnValue = _GetLobbyData( Self, steamIDLobby, pchKey );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetLobbyData( IntPtr self, SteamId steamIDLobby, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchValue );
|
||||
private FSetLobbyData _SetLobbyData;
|
||||
|
||||
#endregion
|
||||
internal bool SetLobbyData( SteamId steamIDLobby, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchValue )
|
||||
{
|
||||
var returnValue = _SetLobbyData( Self, steamIDLobby, pchKey, pchValue );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetLobbyDataCount( IntPtr self, SteamId steamIDLobby );
|
||||
private FGetLobbyDataCount _GetLobbyDataCount;
|
||||
|
||||
#endregion
|
||||
internal int GetLobbyDataCount( SteamId steamIDLobby )
|
||||
{
|
||||
var returnValue = _GetLobbyDataCount( Self, steamIDLobby );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetLobbyDataByIndex( IntPtr self, SteamId steamIDLobby, int iLobbyData, IntPtr pchKey, int cchKeyBufferSize, IntPtr pchValue, int cchValueBufferSize );
|
||||
private FGetLobbyDataByIndex _GetLobbyDataByIndex;
|
||||
|
||||
#endregion
|
||||
internal bool GetLobbyDataByIndex( SteamId steamIDLobby, int iLobbyData, out string pchKey, out string pchValue )
|
||||
{
|
||||
IntPtr mempchKey = Helpers.TakeMemory();
|
||||
IntPtr mempchValue = Helpers.TakeMemory();
|
||||
var returnValue = _GetLobbyDataByIndex( Self, steamIDLobby, iLobbyData, mempchKey, (1024 * 32), mempchValue, (1024 * 32) );
|
||||
pchKey = Helpers.MemoryToString( mempchKey );
|
||||
pchValue = Helpers.MemoryToString( mempchValue );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FDeleteLobbyData( IntPtr self, SteamId steamIDLobby, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey );
|
||||
private FDeleteLobbyData _DeleteLobbyData;
|
||||
|
||||
#endregion
|
||||
internal bool DeleteLobbyData( SteamId steamIDLobby, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey )
|
||||
{
|
||||
var returnValue = _DeleteLobbyData( Self, steamIDLobby, pchKey );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetLobbyMemberData( IntPtr self, SteamId steamIDLobby, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey );
|
||||
private FGetLobbyMemberData _GetLobbyMemberData;
|
||||
|
||||
#endregion
|
||||
internal string GetLobbyMemberData( SteamId steamIDLobby, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey )
|
||||
{
|
||||
var returnValue = _GetLobbyMemberData( Self, steamIDLobby, steamIDUser, pchKey );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetLobbyMemberData( IntPtr self, SteamId steamIDLobby, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchValue );
|
||||
private FSetLobbyMemberData _SetLobbyMemberData;
|
||||
|
||||
#endregion
|
||||
internal void SetLobbyMemberData( SteamId steamIDLobby, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchValue )
|
||||
{
|
||||
_SetLobbyMemberData( Self, steamIDLobby, pchKey, pchValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSendLobbyChatMsg( IntPtr self, SteamId steamIDLobby, IntPtr pvMsgBody, int cubMsgBody );
|
||||
private FSendLobbyChatMsg _SendLobbyChatMsg;
|
||||
|
||||
#endregion
|
||||
internal bool SendLobbyChatMsg( SteamId steamIDLobby, IntPtr pvMsgBody, int cubMsgBody )
|
||||
{
|
||||
var returnValue = _SendLobbyChatMsg( Self, steamIDLobby, pvMsgBody, cubMsgBody );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetLobbyChatEntry( IntPtr self, SteamId steamIDLobby, int iChatID, ref SteamId pSteamIDUser, IntPtr pvData, int cubData, ref ChatEntryType peChatEntryType );
|
||||
private FGetLobbyChatEntry _GetLobbyChatEntry;
|
||||
|
||||
#endregion
|
||||
internal int GetLobbyChatEntry( SteamId steamIDLobby, int iChatID, ref SteamId pSteamIDUser, IntPtr pvData, int cubData, ref ChatEntryType peChatEntryType )
|
||||
{
|
||||
var returnValue = _GetLobbyChatEntry( Self, steamIDLobby, iChatID, ref pSteamIDUser, pvData, cubData, ref peChatEntryType );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FRequestLobbyData( IntPtr self, SteamId steamIDLobby );
|
||||
private FRequestLobbyData _RequestLobbyData;
|
||||
|
||||
#endregion
|
||||
internal bool RequestLobbyData( SteamId steamIDLobby )
|
||||
{
|
||||
var returnValue = _RequestLobbyData( Self, steamIDLobby );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetLobbyGameServer( IntPtr self, SteamId steamIDLobby, uint unGameServerIP, ushort unGameServerPort, SteamId steamIDGameServer );
|
||||
private FSetLobbyGameServer _SetLobbyGameServer;
|
||||
|
||||
#endregion
|
||||
internal void SetLobbyGameServer( SteamId steamIDLobby, uint unGameServerIP, ushort unGameServerPort, SteamId steamIDGameServer )
|
||||
{
|
||||
_SetLobbyGameServer( Self, steamIDLobby, unGameServerIP, unGameServerPort, steamIDGameServer );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetLobbyGameServer( IntPtr self, SteamId steamIDLobby, ref uint punGameServerIP, ref ushort punGameServerPort, ref SteamId psteamIDGameServer );
|
||||
private FGetLobbyGameServer _GetLobbyGameServer;
|
||||
|
||||
#endregion
|
||||
internal bool GetLobbyGameServer( SteamId steamIDLobby, ref uint punGameServerIP, ref ushort punGameServerPort, ref SteamId psteamIDGameServer )
|
||||
{
|
||||
var returnValue = _GetLobbyGameServer( Self, steamIDLobby, ref punGameServerIP, ref punGameServerPort, ref psteamIDGameServer );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetLobbyMemberLimit( IntPtr self, SteamId steamIDLobby, int cMaxMembers );
|
||||
private FSetLobbyMemberLimit _SetLobbyMemberLimit;
|
||||
|
||||
#endregion
|
||||
internal bool SetLobbyMemberLimit( SteamId steamIDLobby, int cMaxMembers )
|
||||
{
|
||||
var returnValue = _SetLobbyMemberLimit( Self, steamIDLobby, cMaxMembers );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetLobbyMemberLimit( IntPtr self, SteamId steamIDLobby );
|
||||
private FGetLobbyMemberLimit _GetLobbyMemberLimit;
|
||||
|
||||
#endregion
|
||||
internal int GetLobbyMemberLimit( SteamId steamIDLobby )
|
||||
{
|
||||
var returnValue = _GetLobbyMemberLimit( Self, steamIDLobby );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetLobbyType( IntPtr self, SteamId steamIDLobby, LobbyType eLobbyType );
|
||||
private FSetLobbyType _SetLobbyType;
|
||||
|
||||
#endregion
|
||||
internal bool SetLobbyType( SteamId steamIDLobby, LobbyType eLobbyType )
|
||||
{
|
||||
var returnValue = _SetLobbyType( Self, steamIDLobby, eLobbyType );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetLobbyJoinable( IntPtr self, SteamId steamIDLobby, [MarshalAs( UnmanagedType.U1 )] bool bLobbyJoinable );
|
||||
private FSetLobbyJoinable _SetLobbyJoinable;
|
||||
|
||||
#endregion
|
||||
internal bool SetLobbyJoinable( SteamId steamIDLobby, [MarshalAs( UnmanagedType.U1 )] bool bLobbyJoinable )
|
||||
{
|
||||
var returnValue = _SetLobbyJoinable( Self, steamIDLobby, bLobbyJoinable );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetLobbyOwner( IntPtr self, ref SteamId retVal, SteamId steamIDLobby );
|
||||
#else
|
||||
private delegate SteamId FGetLobbyOwner( IntPtr self, SteamId steamIDLobby );
|
||||
#endif
|
||||
private FGetLobbyOwner _GetLobbyOwner;
|
||||
|
||||
#endregion
|
||||
internal SteamId GetLobbyOwner( SteamId steamIDLobby )
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( SteamId );
|
||||
_GetLobbyOwner( Self, ref retVal, steamIDLobby );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetLobbyOwner( Self, steamIDLobby );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetLobbyOwner( IntPtr self, SteamId steamIDLobby, SteamId steamIDNewOwner );
|
||||
private FSetLobbyOwner _SetLobbyOwner;
|
||||
|
||||
#endregion
|
||||
internal bool SetLobbyOwner( SteamId steamIDLobby, SteamId steamIDNewOwner )
|
||||
{
|
||||
var returnValue = _SetLobbyOwner( Self, steamIDLobby, steamIDNewOwner );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetLinkedLobby( IntPtr self, SteamId steamIDLobby, SteamId steamIDLobbyDependent );
|
||||
private FSetLinkedLobby _SetLinkedLobby;
|
||||
|
||||
#endregion
|
||||
internal bool SetLinkedLobby( SteamId steamIDLobby, SteamId steamIDLobbyDependent )
|
||||
{
|
||||
var returnValue = _SetLinkedLobby( Self, steamIDLobby, steamIDLobbyDependent );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamMatchmakingServers : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamMatchMakingServers002";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_RequestInternetServerList = Marshal.GetDelegateForFunctionPointer<FRequestInternetServerList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_RequestLANServerList = Marshal.GetDelegateForFunctionPointer<FRequestLANServerList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_RequestFriendsServerList = Marshal.GetDelegateForFunctionPointer<FRequestFriendsServerList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_RequestFavoritesServerList = Marshal.GetDelegateForFunctionPointer<FRequestFavoritesServerList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_RequestHistoryServerList = Marshal.GetDelegateForFunctionPointer<FRequestHistoryServerList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_RequestSpectatorServerList = Marshal.GetDelegateForFunctionPointer<FRequestSpectatorServerList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_ReleaseRequest = Marshal.GetDelegateForFunctionPointer<FReleaseRequest>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_GetServerDetails = Marshal.GetDelegateForFunctionPointer<FGetServerDetails>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_CancelQuery = Marshal.GetDelegateForFunctionPointer<FCancelQuery>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_RefreshQuery = Marshal.GetDelegateForFunctionPointer<FRefreshQuery>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_IsRefreshing = Marshal.GetDelegateForFunctionPointer<FIsRefreshing>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_GetServerCount = Marshal.GetDelegateForFunctionPointer<FGetServerCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_RefreshServer = Marshal.GetDelegateForFunctionPointer<FRefreshServer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_PingServer = Marshal.GetDelegateForFunctionPointer<FPingServer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_PlayerDetails = Marshal.GetDelegateForFunctionPointer<FPlayerDetails>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_ServerRules = Marshal.GetDelegateForFunctionPointer<FServerRules>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_CancelServerQuery = Marshal.GetDelegateForFunctionPointer<FCancelServerQuery>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_RequestInternetServerList = null;
|
||||
_RequestLANServerList = null;
|
||||
_RequestFriendsServerList = null;
|
||||
_RequestFavoritesServerList = null;
|
||||
_RequestHistoryServerList = null;
|
||||
_RequestSpectatorServerList = null;
|
||||
_ReleaseRequest = null;
|
||||
_GetServerDetails = null;
|
||||
_CancelQuery = null;
|
||||
_RefreshQuery = null;
|
||||
_IsRefreshing = null;
|
||||
_GetServerCount = null;
|
||||
_RefreshServer = null;
|
||||
_PingServer = null;
|
||||
_PlayerDetails = null;
|
||||
_ServerRules = null;
|
||||
_CancelServerQuery = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerListRequest FRequestInternetServerList( IntPtr self, AppId iApp, IntPtr ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
|
||||
private FRequestInternetServerList _RequestInternetServerList;
|
||||
|
||||
#endregion
|
||||
internal HServerListRequest RequestInternetServerList( AppId iApp, MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
|
||||
{
|
||||
int numPtrs = ppchFilters.Length;
|
||||
if (numPtrs <= 0) { numPtrs = 1; }
|
||||
|
||||
IntPtr[] filterPtrs = new IntPtr[numPtrs];
|
||||
GCHandle?[] filterHandles = new GCHandle?[numPtrs];
|
||||
for (int i=0;i<numPtrs; i++)
|
||||
{
|
||||
if (i < ppchFilters.Length)
|
||||
{
|
||||
filterHandles[i] = GCHandle.Alloc(ppchFilters[i], GCHandleType.Pinned);
|
||||
filterPtrs[i] = filterHandles[i]?.AddrOfPinnedObject() ?? IntPtr.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
filterHandles[i] = null;
|
||||
filterPtrs[i] = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
GCHandle arrHandle = GCHandle.Alloc(filterPtrs, GCHandleType.Pinned);
|
||||
|
||||
var returnValue = _RequestInternetServerList( Self, iApp, arrHandle.AddrOfPinnedObject(), nFilters, pRequestServersResponse );
|
||||
|
||||
arrHandle.Free();
|
||||
for (int i = 0; i < numPtrs; i++)
|
||||
{
|
||||
filterHandles[i]?.Free();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerListRequest FRequestLANServerList( IntPtr self, AppId iApp, IntPtr pRequestServersResponse );
|
||||
private FRequestLANServerList _RequestLANServerList;
|
||||
|
||||
#endregion
|
||||
internal HServerListRequest RequestLANServerList( AppId iApp, IntPtr pRequestServersResponse )
|
||||
{
|
||||
var returnValue = _RequestLANServerList( Self, iApp, pRequestServersResponse );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerListRequest FRequestFriendsServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
|
||||
private FRequestFriendsServerList _RequestFriendsServerList;
|
||||
|
||||
#endregion
|
||||
internal HServerListRequest RequestFriendsServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
|
||||
{
|
||||
var returnValue = _RequestFriendsServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerListRequest FRequestFavoritesServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
|
||||
private FRequestFavoritesServerList _RequestFavoritesServerList;
|
||||
|
||||
#endregion
|
||||
internal HServerListRequest RequestFavoritesServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
|
||||
{
|
||||
var returnValue = _RequestFavoritesServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerListRequest FRequestHistoryServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
|
||||
private FRequestHistoryServerList _RequestHistoryServerList;
|
||||
|
||||
#endregion
|
||||
internal HServerListRequest RequestHistoryServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
|
||||
{
|
||||
var returnValue = _RequestHistoryServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerListRequest FRequestSpectatorServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
|
||||
private FRequestSpectatorServerList _RequestSpectatorServerList;
|
||||
|
||||
#endregion
|
||||
internal HServerListRequest RequestSpectatorServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
|
||||
{
|
||||
var returnValue = _RequestSpectatorServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FReleaseRequest( IntPtr self, HServerListRequest hServerListRequest );
|
||||
private FReleaseRequest _ReleaseRequest;
|
||||
|
||||
#endregion
|
||||
internal void ReleaseRequest( HServerListRequest hServerListRequest )
|
||||
{
|
||||
_ReleaseRequest( Self, hServerListRequest );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate IntPtr FGetServerDetails( IntPtr self, HServerListRequest hRequest, int iServer );
|
||||
private FGetServerDetails _GetServerDetails;
|
||||
|
||||
#endregion
|
||||
internal gameserveritem_t GetServerDetails( HServerListRequest hRequest, int iServer )
|
||||
{
|
||||
var returnValue = _GetServerDetails( Self, hRequest, iServer );
|
||||
return gameserveritem_t.Fill( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FCancelQuery( IntPtr self, HServerListRequest hRequest );
|
||||
private FCancelQuery _CancelQuery;
|
||||
|
||||
#endregion
|
||||
internal void CancelQuery( HServerListRequest hRequest )
|
||||
{
|
||||
_CancelQuery( Self, hRequest );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FRefreshQuery( IntPtr self, HServerListRequest hRequest );
|
||||
private FRefreshQuery _RefreshQuery;
|
||||
|
||||
#endregion
|
||||
internal void RefreshQuery( HServerListRequest hRequest )
|
||||
{
|
||||
_RefreshQuery( Self, hRequest );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsRefreshing( IntPtr self, HServerListRequest hRequest );
|
||||
private FIsRefreshing _IsRefreshing;
|
||||
|
||||
#endregion
|
||||
internal bool IsRefreshing( HServerListRequest hRequest )
|
||||
{
|
||||
var returnValue = _IsRefreshing( Self, hRequest );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetServerCount( IntPtr self, HServerListRequest hRequest );
|
||||
private FGetServerCount _GetServerCount;
|
||||
|
||||
#endregion
|
||||
internal int GetServerCount( HServerListRequest hRequest )
|
||||
{
|
||||
var returnValue = _GetServerCount( Self, hRequest );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FRefreshServer( IntPtr self, HServerListRequest hRequest, int iServer );
|
||||
private FRefreshServer _RefreshServer;
|
||||
|
||||
#endregion
|
||||
internal void RefreshServer( HServerListRequest hRequest, int iServer )
|
||||
{
|
||||
_RefreshServer( Self, hRequest, iServer );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerQuery FPingServer( IntPtr self, uint unIP, ushort usPort, IntPtr pRequestServersResponse );
|
||||
private FPingServer _PingServer;
|
||||
|
||||
#endregion
|
||||
internal HServerQuery PingServer( uint unIP, ushort usPort, IntPtr pRequestServersResponse )
|
||||
{
|
||||
var returnValue = _PingServer( Self, unIP, usPort, pRequestServersResponse );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerQuery FPlayerDetails( IntPtr self, uint unIP, ushort usPort, IntPtr pRequestServersResponse );
|
||||
private FPlayerDetails _PlayerDetails;
|
||||
|
||||
#endregion
|
||||
internal HServerQuery PlayerDetails( uint unIP, ushort usPort, IntPtr pRequestServersResponse )
|
||||
{
|
||||
var returnValue = _PlayerDetails( Self, unIP, usPort, pRequestServersResponse );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HServerQuery FServerRules( IntPtr self, uint unIP, ushort usPort, IntPtr pRequestServersResponse );
|
||||
private FServerRules _ServerRules;
|
||||
|
||||
#endregion
|
||||
internal HServerQuery ServerRules( uint unIP, ushort usPort, IntPtr pRequestServersResponse )
|
||||
{
|
||||
var returnValue = _ServerRules( Self, unIP, usPort, pRequestServersResponse );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FCancelServerQuery( IntPtr self, HServerQuery hServerQuery );
|
||||
private FCancelServerQuery _CancelServerQuery;
|
||||
|
||||
#endregion
|
||||
internal void CancelServerQuery( HServerQuery hServerQuery )
|
||||
{
|
||||
_CancelServerQuery( Self, hServerQuery );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamMusic : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMMUSIC_INTERFACE_VERSION001";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_BIsEnabled = Marshal.GetDelegateForFunctionPointer<FBIsEnabled>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_BIsPlaying = Marshal.GetDelegateForFunctionPointer<FBIsPlaying>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_GetPlaybackStatus = Marshal.GetDelegateForFunctionPointer<FGetPlaybackStatus>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_Play = Marshal.GetDelegateForFunctionPointer<FPlay>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_Pause = Marshal.GetDelegateForFunctionPointer<FPause>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_PlayPrevious = Marshal.GetDelegateForFunctionPointer<FPlayPrevious>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_PlayNext = Marshal.GetDelegateForFunctionPointer<FPlayNext>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_SetVolume = Marshal.GetDelegateForFunctionPointer<FSetVolume>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_GetVolume = Marshal.GetDelegateForFunctionPointer<FGetVolume>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_BIsEnabled = null;
|
||||
_BIsPlaying = null;
|
||||
_GetPlaybackStatus = null;
|
||||
_Play = null;
|
||||
_Pause = null;
|
||||
_PlayPrevious = null;
|
||||
_PlayNext = null;
|
||||
_SetVolume = null;
|
||||
_GetVolume = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsEnabled( IntPtr self );
|
||||
private FBIsEnabled _BIsEnabled;
|
||||
|
||||
#endregion
|
||||
internal bool BIsEnabled()
|
||||
{
|
||||
var returnValue = _BIsEnabled( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsPlaying( IntPtr self );
|
||||
private FBIsPlaying _BIsPlaying;
|
||||
|
||||
#endregion
|
||||
internal bool BIsPlaying()
|
||||
{
|
||||
var returnValue = _BIsPlaying( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate MusicStatus FGetPlaybackStatus( IntPtr self );
|
||||
private FGetPlaybackStatus _GetPlaybackStatus;
|
||||
|
||||
#endregion
|
||||
internal MusicStatus GetPlaybackStatus()
|
||||
{
|
||||
var returnValue = _GetPlaybackStatus( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FPlay( IntPtr self );
|
||||
private FPlay _Play;
|
||||
|
||||
#endregion
|
||||
internal void Play()
|
||||
{
|
||||
_Play( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FPause( IntPtr self );
|
||||
private FPause _Pause;
|
||||
|
||||
#endregion
|
||||
internal void Pause()
|
||||
{
|
||||
_Pause( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FPlayPrevious( IntPtr self );
|
||||
private FPlayPrevious _PlayPrevious;
|
||||
|
||||
#endregion
|
||||
internal void PlayPrevious()
|
||||
{
|
||||
_PlayPrevious( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FPlayNext( IntPtr self );
|
||||
private FPlayNext _PlayNext;
|
||||
|
||||
#endregion
|
||||
internal void PlayNext()
|
||||
{
|
||||
_PlayNext( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetVolume( IntPtr self, float flVolume );
|
||||
private FSetVolume _SetVolume;
|
||||
|
||||
#endregion
|
||||
internal void SetVolume( float flVolume )
|
||||
{
|
||||
_SetVolume( Self, flVolume );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate float FGetVolume( IntPtr self );
|
||||
private FGetVolume _GetVolume;
|
||||
|
||||
#endregion
|
||||
internal float GetVolume()
|
||||
{
|
||||
var returnValue = _GetVolume( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamNetworking : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamNetworking005";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_SendP2PPacket = Marshal.GetDelegateForFunctionPointer<FSendP2PPacket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_IsP2PPacketAvailable = Marshal.GetDelegateForFunctionPointer<FIsP2PPacketAvailable>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_ReadP2PPacket = Marshal.GetDelegateForFunctionPointer<FReadP2PPacket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_AcceptP2PSessionWithUser = Marshal.GetDelegateForFunctionPointer<FAcceptP2PSessionWithUser>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_CloseP2PSessionWithUser = Marshal.GetDelegateForFunctionPointer<FCloseP2PSessionWithUser>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_CloseP2PChannelWithUser = Marshal.GetDelegateForFunctionPointer<FCloseP2PChannelWithUser>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_GetP2PSessionState = Marshal.GetDelegateForFunctionPointer<FGetP2PSessionState>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_AllowP2PPacketRelay = Marshal.GetDelegateForFunctionPointer<FAllowP2PPacketRelay>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_CreateListenSocket = Marshal.GetDelegateForFunctionPointer<FCreateListenSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_CreateP2PConnectionSocket = Marshal.GetDelegateForFunctionPointer<FCreateP2PConnectionSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_CreateConnectionSocket = Marshal.GetDelegateForFunctionPointer<FCreateConnectionSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_DestroySocket = Marshal.GetDelegateForFunctionPointer<FDestroySocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_DestroyListenSocket = Marshal.GetDelegateForFunctionPointer<FDestroyListenSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_SendDataOnSocket = Marshal.GetDelegateForFunctionPointer<FSendDataOnSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_IsDataAvailableOnSocket = Marshal.GetDelegateForFunctionPointer<FIsDataAvailableOnSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_RetrieveDataFromSocket = Marshal.GetDelegateForFunctionPointer<FRetrieveDataFromSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_IsDataAvailable = Marshal.GetDelegateForFunctionPointer<FIsDataAvailable>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_RetrieveData = Marshal.GetDelegateForFunctionPointer<FRetrieveData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_GetSocketInfo = Marshal.GetDelegateForFunctionPointer<FGetSocketInfo>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_GetListenSocketInfo = Marshal.GetDelegateForFunctionPointer<FGetListenSocketInfo>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_GetSocketConnectionType = Marshal.GetDelegateForFunctionPointer<FGetSocketConnectionType>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_GetMaxPacketSize = Marshal.GetDelegateForFunctionPointer<FGetMaxPacketSize>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_SendP2PPacket = null;
|
||||
_IsP2PPacketAvailable = null;
|
||||
_ReadP2PPacket = null;
|
||||
_AcceptP2PSessionWithUser = null;
|
||||
_CloseP2PSessionWithUser = null;
|
||||
_CloseP2PChannelWithUser = null;
|
||||
_GetP2PSessionState = null;
|
||||
_AllowP2PPacketRelay = null;
|
||||
_CreateListenSocket = null;
|
||||
_CreateP2PConnectionSocket = null;
|
||||
_CreateConnectionSocket = null;
|
||||
_DestroySocket = null;
|
||||
_DestroyListenSocket = null;
|
||||
_SendDataOnSocket = null;
|
||||
_IsDataAvailableOnSocket = null;
|
||||
_RetrieveDataFromSocket = null;
|
||||
_IsDataAvailable = null;
|
||||
_RetrieveData = null;
|
||||
_GetSocketInfo = null;
|
||||
_GetListenSocketInfo = null;
|
||||
_GetSocketConnectionType = null;
|
||||
_GetMaxPacketSize = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSendP2PPacket( IntPtr self, SteamId steamIDRemote, IntPtr pubData, uint cubData, P2PSend eP2PSendType, int nChannel );
|
||||
private FSendP2PPacket _SendP2PPacket;
|
||||
|
||||
#endregion
|
||||
internal bool SendP2PPacket( SteamId steamIDRemote, IntPtr pubData, uint cubData, P2PSend eP2PSendType, int nChannel )
|
||||
{
|
||||
var returnValue = _SendP2PPacket( Self, steamIDRemote, pubData, cubData, eP2PSendType, nChannel );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsP2PPacketAvailable( IntPtr self, ref uint pcubMsgSize, int nChannel );
|
||||
private FIsP2PPacketAvailable _IsP2PPacketAvailable;
|
||||
|
||||
#endregion
|
||||
internal bool IsP2PPacketAvailable( ref uint pcubMsgSize, int nChannel )
|
||||
{
|
||||
var returnValue = _IsP2PPacketAvailable( Self, ref pcubMsgSize, nChannel );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FReadP2PPacket( IntPtr self, IntPtr pubDest, uint cubDest, ref uint pcubMsgSize, ref SteamId psteamIDRemote, int nChannel );
|
||||
private FReadP2PPacket _ReadP2PPacket;
|
||||
|
||||
#endregion
|
||||
internal bool ReadP2PPacket( IntPtr pubDest, uint cubDest, ref uint pcubMsgSize, ref SteamId psteamIDRemote, int nChannel )
|
||||
{
|
||||
var returnValue = _ReadP2PPacket( Self, pubDest, cubDest, ref pcubMsgSize, ref psteamIDRemote, nChannel );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FAcceptP2PSessionWithUser( IntPtr self, SteamId steamIDRemote );
|
||||
private FAcceptP2PSessionWithUser _AcceptP2PSessionWithUser;
|
||||
|
||||
#endregion
|
||||
internal bool AcceptP2PSessionWithUser( SteamId steamIDRemote )
|
||||
{
|
||||
var returnValue = _AcceptP2PSessionWithUser( Self, steamIDRemote );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FCloseP2PSessionWithUser( IntPtr self, SteamId steamIDRemote );
|
||||
private FCloseP2PSessionWithUser _CloseP2PSessionWithUser;
|
||||
|
||||
#endregion
|
||||
internal bool CloseP2PSessionWithUser( SteamId steamIDRemote )
|
||||
{
|
||||
var returnValue = _CloseP2PSessionWithUser( Self, steamIDRemote );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FCloseP2PChannelWithUser( IntPtr self, SteamId steamIDRemote, int nChannel );
|
||||
private FCloseP2PChannelWithUser _CloseP2PChannelWithUser;
|
||||
|
||||
#endregion
|
||||
internal bool CloseP2PChannelWithUser( SteamId steamIDRemote, int nChannel )
|
||||
{
|
||||
var returnValue = _CloseP2PChannelWithUser( Self, steamIDRemote, nChannel );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetP2PSessionState( IntPtr self, SteamId steamIDRemote, ref P2PSessionState_t pConnectionState );
|
||||
private FGetP2PSessionState _GetP2PSessionState;
|
||||
|
||||
#endregion
|
||||
internal bool GetP2PSessionState( SteamId steamIDRemote, ref P2PSessionState_t pConnectionState )
|
||||
{
|
||||
var returnValue = _GetP2PSessionState( Self, steamIDRemote, ref pConnectionState );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FAllowP2PPacketRelay( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bAllow );
|
||||
private FAllowP2PPacketRelay _AllowP2PPacketRelay;
|
||||
|
||||
#endregion
|
||||
internal bool AllowP2PPacketRelay( [MarshalAs( UnmanagedType.U1 )] bool bAllow )
|
||||
{
|
||||
var returnValue = _AllowP2PPacketRelay( Self, bAllow );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SNetListenSocket_t FCreateListenSocket( IntPtr self, int nVirtualP2PPort, uint nIP, ushort nPort, [MarshalAs( UnmanagedType.U1 )] bool bAllowUseOfPacketRelay );
|
||||
private FCreateListenSocket _CreateListenSocket;
|
||||
|
||||
#endregion
|
||||
internal SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint nIP, ushort nPort, [MarshalAs( UnmanagedType.U1 )] bool bAllowUseOfPacketRelay )
|
||||
{
|
||||
var returnValue = _CreateListenSocket( Self, nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SNetSocket_t FCreateP2PConnectionSocket( IntPtr self, SteamId steamIDTarget, int nVirtualPort, int nTimeoutSec, [MarshalAs( UnmanagedType.U1 )] bool bAllowUseOfPacketRelay );
|
||||
private FCreateP2PConnectionSocket _CreateP2PConnectionSocket;
|
||||
|
||||
#endregion
|
||||
internal SNetSocket_t CreateP2PConnectionSocket( SteamId steamIDTarget, int nVirtualPort, int nTimeoutSec, [MarshalAs( UnmanagedType.U1 )] bool bAllowUseOfPacketRelay )
|
||||
{
|
||||
var returnValue = _CreateP2PConnectionSocket( Self, steamIDTarget, nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SNetSocket_t FCreateConnectionSocket( IntPtr self, uint nIP, ushort nPort, int nTimeoutSec );
|
||||
private FCreateConnectionSocket _CreateConnectionSocket;
|
||||
|
||||
#endregion
|
||||
internal SNetSocket_t CreateConnectionSocket( uint nIP, ushort nPort, int nTimeoutSec )
|
||||
{
|
||||
var returnValue = _CreateConnectionSocket( Self, nIP, nPort, nTimeoutSec );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FDestroySocket( IntPtr self, SNetSocket_t hSocket, [MarshalAs( UnmanagedType.U1 )] bool bNotifyRemoteEnd );
|
||||
private FDestroySocket _DestroySocket;
|
||||
|
||||
#endregion
|
||||
internal bool DestroySocket( SNetSocket_t hSocket, [MarshalAs( UnmanagedType.U1 )] bool bNotifyRemoteEnd )
|
||||
{
|
||||
var returnValue = _DestroySocket( Self, hSocket, bNotifyRemoteEnd );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FDestroyListenSocket( IntPtr self, SNetListenSocket_t hSocket, [MarshalAs( UnmanagedType.U1 )] bool bNotifyRemoteEnd );
|
||||
private FDestroyListenSocket _DestroyListenSocket;
|
||||
|
||||
#endregion
|
||||
internal bool DestroyListenSocket( SNetListenSocket_t hSocket, [MarshalAs( UnmanagedType.U1 )] bool bNotifyRemoteEnd )
|
||||
{
|
||||
var returnValue = _DestroyListenSocket( Self, hSocket, bNotifyRemoteEnd );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSendDataOnSocket( IntPtr self, SNetSocket_t hSocket, [In,Out] IntPtr[] pubData, uint cubData, [MarshalAs( UnmanagedType.U1 )] bool bReliable );
|
||||
private FSendDataOnSocket _SendDataOnSocket;
|
||||
|
||||
#endregion
|
||||
internal bool SendDataOnSocket( SNetSocket_t hSocket, [In,Out] IntPtr[] pubData, uint cubData, [MarshalAs( UnmanagedType.U1 )] bool bReliable )
|
||||
{
|
||||
var returnValue = _SendDataOnSocket( Self, hSocket, pubData, cubData, bReliable );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsDataAvailableOnSocket( IntPtr self, SNetSocket_t hSocket, ref uint pcubMsgSize );
|
||||
private FIsDataAvailableOnSocket _IsDataAvailableOnSocket;
|
||||
|
||||
#endregion
|
||||
internal bool IsDataAvailableOnSocket( SNetSocket_t hSocket, ref uint pcubMsgSize )
|
||||
{
|
||||
var returnValue = _IsDataAvailableOnSocket( Self, hSocket, ref pcubMsgSize );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FRetrieveDataFromSocket( IntPtr self, SNetSocket_t hSocket, [In,Out] IntPtr[] pubDest, uint cubDest, ref uint pcubMsgSize );
|
||||
private FRetrieveDataFromSocket _RetrieveDataFromSocket;
|
||||
|
||||
#endregion
|
||||
internal bool RetrieveDataFromSocket( SNetSocket_t hSocket, [In,Out] IntPtr[] pubDest, uint cubDest, ref uint pcubMsgSize )
|
||||
{
|
||||
var returnValue = _RetrieveDataFromSocket( Self, hSocket, pubDest, cubDest, ref pcubMsgSize );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsDataAvailable( IntPtr self, SNetListenSocket_t hListenSocket, ref uint pcubMsgSize, ref SNetSocket_t phSocket );
|
||||
private FIsDataAvailable _IsDataAvailable;
|
||||
|
||||
#endregion
|
||||
internal bool IsDataAvailable( SNetListenSocket_t hListenSocket, ref uint pcubMsgSize, ref SNetSocket_t phSocket )
|
||||
{
|
||||
var returnValue = _IsDataAvailable( Self, hListenSocket, ref pcubMsgSize, ref phSocket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FRetrieveData( IntPtr self, SNetListenSocket_t hListenSocket, [In,Out] IntPtr[] pubDest, uint cubDest, ref uint pcubMsgSize, ref SNetSocket_t phSocket );
|
||||
private FRetrieveData _RetrieveData;
|
||||
|
||||
#endregion
|
||||
internal bool RetrieveData( SNetListenSocket_t hListenSocket, [In,Out] IntPtr[] pubDest, uint cubDest, ref uint pcubMsgSize, ref SNetSocket_t phSocket )
|
||||
{
|
||||
var returnValue = _RetrieveData( Self, hListenSocket, pubDest, cubDest, ref pcubMsgSize, ref phSocket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetSocketInfo( IntPtr self, SNetSocket_t hSocket, ref SteamId pSteamIDRemote, ref int peSocketStatus, ref uint punIPRemote, ref ushort punPortRemote );
|
||||
private FGetSocketInfo _GetSocketInfo;
|
||||
|
||||
#endregion
|
||||
internal bool GetSocketInfo( SNetSocket_t hSocket, ref SteamId pSteamIDRemote, ref int peSocketStatus, ref uint punIPRemote, ref ushort punPortRemote )
|
||||
{
|
||||
var returnValue = _GetSocketInfo( Self, hSocket, ref pSteamIDRemote, ref peSocketStatus, ref punIPRemote, ref punPortRemote );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetListenSocketInfo( IntPtr self, SNetListenSocket_t hListenSocket, ref uint pnIP, ref ushort pnPort );
|
||||
private FGetListenSocketInfo _GetListenSocketInfo;
|
||||
|
||||
#endregion
|
||||
internal bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, ref uint pnIP, ref ushort pnPort )
|
||||
{
|
||||
var returnValue = _GetListenSocketInfo( Self, hListenSocket, ref pnIP, ref pnPort );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SNetSocketConnectionType FGetSocketConnectionType( IntPtr self, SNetSocket_t hSocket );
|
||||
private FGetSocketConnectionType _GetSocketConnectionType;
|
||||
|
||||
#endregion
|
||||
internal SNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket )
|
||||
{
|
||||
var returnValue = _GetSocketConnectionType( Self, hSocket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetMaxPacketSize( IntPtr self, SNetSocket_t hSocket );
|
||||
private FGetMaxPacketSize _GetMaxPacketSize;
|
||||
|
||||
#endregion
|
||||
internal int GetMaxPacketSize( SNetSocket_t hSocket )
|
||||
{
|
||||
var returnValue = _GetMaxPacketSize( Self, hSocket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,443 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamNetworkingSockets : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamNetworkingSockets002";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_CreateListenSocketIP = Marshal.GetDelegateForFunctionPointer<FCreateListenSocketIP>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_ConnectByIPAddress = Marshal.GetDelegateForFunctionPointer<FConnectByIPAddress>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_CreateListenSocketP2P = Marshal.GetDelegateForFunctionPointer<FCreateListenSocketP2P>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_ConnectP2P = Marshal.GetDelegateForFunctionPointer<FConnectP2P>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_AcceptConnection = Marshal.GetDelegateForFunctionPointer<FAcceptConnection>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_CloseConnection = Marshal.GetDelegateForFunctionPointer<FCloseConnection>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_CloseListenSocket = Marshal.GetDelegateForFunctionPointer<FCloseListenSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_SetConnectionUserData = Marshal.GetDelegateForFunctionPointer<FSetConnectionUserData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_GetConnectionUserData = Marshal.GetDelegateForFunctionPointer<FGetConnectionUserData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_SetConnectionName = Marshal.GetDelegateForFunctionPointer<FSetConnectionName>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_GetConnectionName = Marshal.GetDelegateForFunctionPointer<FGetConnectionName>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_SendMessageToConnection = Marshal.GetDelegateForFunctionPointer<FSendMessageToConnection>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_FlushMessagesOnConnection = Marshal.GetDelegateForFunctionPointer<FFlushMessagesOnConnection>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_ReceiveMessagesOnConnection = Marshal.GetDelegateForFunctionPointer<FReceiveMessagesOnConnection>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_ReceiveMessagesOnListenSocket = Marshal.GetDelegateForFunctionPointer<FReceiveMessagesOnListenSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_GetConnectionInfo = Marshal.GetDelegateForFunctionPointer<FGetConnectionInfo>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_GetQuickConnectionStatus = Marshal.GetDelegateForFunctionPointer<FGetQuickConnectionStatus>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_GetDetailedConnectionStatus = Marshal.GetDelegateForFunctionPointer<FGetDetailedConnectionStatus>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_GetListenSocketAddress = Marshal.GetDelegateForFunctionPointer<FGetListenSocketAddress>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_CreateSocketPair = Marshal.GetDelegateForFunctionPointer<FCreateSocketPair>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_GetIdentity = Marshal.GetDelegateForFunctionPointer<FGetIdentity>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_ReceivedRelayAuthTicket = Marshal.GetDelegateForFunctionPointer<FReceivedRelayAuthTicket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_FindRelayAuthTicketForServer = Marshal.GetDelegateForFunctionPointer<FFindRelayAuthTicketForServer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_ConnectToHostedDedicatedServer = Marshal.GetDelegateForFunctionPointer<FConnectToHostedDedicatedServer>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_GetHostedDedicatedServerPort = Marshal.GetDelegateForFunctionPointer<FGetHostedDedicatedServerPort>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_GetHostedDedicatedServerPOPID = Marshal.GetDelegateForFunctionPointer<FGetHostedDedicatedServerPOPID>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_GetHostedDedicatedServerAddress = Marshal.GetDelegateForFunctionPointer<FGetHostedDedicatedServerAddress>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_CreateHostedDedicatedServerListenSocket = Marshal.GetDelegateForFunctionPointer<FCreateHostedDedicatedServerListenSocket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_RunCallbacks = Marshal.GetDelegateForFunctionPointer<FRunCallbacks>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_CreateListenSocketIP = null;
|
||||
_ConnectByIPAddress = null;
|
||||
_CreateListenSocketP2P = null;
|
||||
_ConnectP2P = null;
|
||||
_AcceptConnection = null;
|
||||
_CloseConnection = null;
|
||||
_CloseListenSocket = null;
|
||||
_SetConnectionUserData = null;
|
||||
_GetConnectionUserData = null;
|
||||
_SetConnectionName = null;
|
||||
_GetConnectionName = null;
|
||||
_SendMessageToConnection = null;
|
||||
_FlushMessagesOnConnection = null;
|
||||
_ReceiveMessagesOnConnection = null;
|
||||
_ReceiveMessagesOnListenSocket = null;
|
||||
_GetConnectionInfo = null;
|
||||
_GetQuickConnectionStatus = null;
|
||||
_GetDetailedConnectionStatus = null;
|
||||
_GetListenSocketAddress = null;
|
||||
_CreateSocketPair = null;
|
||||
_GetIdentity = null;
|
||||
_ReceivedRelayAuthTicket = null;
|
||||
_FindRelayAuthTicketForServer = null;
|
||||
_ConnectToHostedDedicatedServer = null;
|
||||
_GetHostedDedicatedServerPort = null;
|
||||
_GetHostedDedicatedServerPOPID = null;
|
||||
_GetHostedDedicatedServerAddress = null;
|
||||
_CreateHostedDedicatedServerListenSocket = null;
|
||||
_RunCallbacks = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Socket FCreateListenSocketIP( IntPtr self, ref NetAddress localAddress );
|
||||
private FCreateListenSocketIP _CreateListenSocketIP;
|
||||
|
||||
#endregion
|
||||
internal Socket CreateListenSocketIP( ref NetAddress localAddress )
|
||||
{
|
||||
var returnValue = _CreateListenSocketIP( Self, ref localAddress );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Connection FConnectByIPAddress( IntPtr self, ref NetAddress address );
|
||||
private FConnectByIPAddress _ConnectByIPAddress;
|
||||
|
||||
#endregion
|
||||
internal Connection ConnectByIPAddress( ref NetAddress address )
|
||||
{
|
||||
var returnValue = _ConnectByIPAddress( Self, ref address );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Socket FCreateListenSocketP2P( IntPtr self, int nVirtualPort );
|
||||
private FCreateListenSocketP2P _CreateListenSocketP2P;
|
||||
|
||||
#endregion
|
||||
internal Socket CreateListenSocketP2P( int nVirtualPort )
|
||||
{
|
||||
var returnValue = _CreateListenSocketP2P( Self, nVirtualPort );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Connection FConnectP2P( IntPtr self, ref NetIdentity identityRemote, int nVirtualPort );
|
||||
private FConnectP2P _ConnectP2P;
|
||||
|
||||
#endregion
|
||||
internal Connection ConnectP2P( ref NetIdentity identityRemote, int nVirtualPort )
|
||||
{
|
||||
var returnValue = _ConnectP2P( Self, ref identityRemote, nVirtualPort );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Result FAcceptConnection( IntPtr self, Connection hConn );
|
||||
private FAcceptConnection _AcceptConnection;
|
||||
|
||||
#endregion
|
||||
internal Result AcceptConnection( Connection hConn )
|
||||
{
|
||||
var returnValue = _AcceptConnection( Self, hConn );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FCloseConnection( IntPtr self, Connection hPeer, int nReason, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszDebug, [MarshalAs( UnmanagedType.U1 )] bool bEnableLinger );
|
||||
private FCloseConnection _CloseConnection;
|
||||
|
||||
#endregion
|
||||
internal bool CloseConnection( Connection hPeer, int nReason, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszDebug, [MarshalAs( UnmanagedType.U1 )] bool bEnableLinger )
|
||||
{
|
||||
var returnValue = _CloseConnection( Self, hPeer, nReason, pszDebug, bEnableLinger );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FCloseListenSocket( IntPtr self, Socket hSocket );
|
||||
private FCloseListenSocket _CloseListenSocket;
|
||||
|
||||
#endregion
|
||||
internal bool CloseListenSocket( Socket hSocket )
|
||||
{
|
||||
var returnValue = _CloseListenSocket( Self, hSocket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetConnectionUserData( IntPtr self, Connection hPeer, long nUserData );
|
||||
private FSetConnectionUserData _SetConnectionUserData;
|
||||
|
||||
#endregion
|
||||
internal bool SetConnectionUserData( Connection hPeer, long nUserData )
|
||||
{
|
||||
var returnValue = _SetConnectionUserData( Self, hPeer, nUserData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate long FGetConnectionUserData( IntPtr self, Connection hPeer );
|
||||
private FGetConnectionUserData _GetConnectionUserData;
|
||||
|
||||
#endregion
|
||||
internal long GetConnectionUserData( Connection hPeer )
|
||||
{
|
||||
var returnValue = _GetConnectionUserData( Self, hPeer );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetConnectionName( IntPtr self, Connection hPeer, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszName );
|
||||
private FSetConnectionName _SetConnectionName;
|
||||
|
||||
#endregion
|
||||
internal void SetConnectionName( Connection hPeer, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszName )
|
||||
{
|
||||
_SetConnectionName( Self, hPeer, pszName );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetConnectionName( IntPtr self, Connection hPeer, IntPtr pszName, int nMaxLen );
|
||||
private FGetConnectionName _GetConnectionName;
|
||||
|
||||
#endregion
|
||||
internal bool GetConnectionName( Connection hPeer, out string pszName )
|
||||
{
|
||||
IntPtr mempszName = Helpers.TakeMemory();
|
||||
var returnValue = _GetConnectionName( Self, hPeer, mempszName, (1024 * 32) );
|
||||
pszName = Helpers.MemoryToString( mempszName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Result FSendMessageToConnection( IntPtr self, Connection hConn, IntPtr pData, uint cbData, int nSendFlags );
|
||||
private FSendMessageToConnection _SendMessageToConnection;
|
||||
|
||||
#endregion
|
||||
internal Result SendMessageToConnection( Connection hConn, IntPtr pData, uint cbData, int nSendFlags )
|
||||
{
|
||||
var returnValue = _SendMessageToConnection( Self, hConn, pData, cbData, nSendFlags );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Result FFlushMessagesOnConnection( IntPtr self, Connection hConn );
|
||||
private FFlushMessagesOnConnection _FlushMessagesOnConnection;
|
||||
|
||||
#endregion
|
||||
internal Result FlushMessagesOnConnection( Connection hConn )
|
||||
{
|
||||
var returnValue = _FlushMessagesOnConnection( Self, hConn );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FReceiveMessagesOnConnection( IntPtr self, Connection hConn, IntPtr ppOutMessages, int nMaxMessages );
|
||||
private FReceiveMessagesOnConnection _ReceiveMessagesOnConnection;
|
||||
|
||||
#endregion
|
||||
internal int ReceiveMessagesOnConnection( Connection hConn, IntPtr ppOutMessages, int nMaxMessages )
|
||||
{
|
||||
var returnValue = _ReceiveMessagesOnConnection( Self, hConn, ppOutMessages, nMaxMessages );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FReceiveMessagesOnListenSocket( IntPtr self, Socket hSocket, IntPtr ppOutMessages, int nMaxMessages );
|
||||
private FReceiveMessagesOnListenSocket _ReceiveMessagesOnListenSocket;
|
||||
|
||||
#endregion
|
||||
internal int ReceiveMessagesOnListenSocket( Socket hSocket, IntPtr ppOutMessages, int nMaxMessages )
|
||||
{
|
||||
var returnValue = _ReceiveMessagesOnListenSocket( Self, hSocket, ppOutMessages, nMaxMessages );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetConnectionInfo( IntPtr self, Connection hConn, ref ConnectionInfo pInfo );
|
||||
private FGetConnectionInfo _GetConnectionInfo;
|
||||
|
||||
#endregion
|
||||
internal bool GetConnectionInfo( Connection hConn, ref ConnectionInfo pInfo )
|
||||
{
|
||||
var returnValue = _GetConnectionInfo( Self, hConn, ref pInfo );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetQuickConnectionStatus( IntPtr self, Connection hConn, ref SteamNetworkingQuickConnectionStatus pStats );
|
||||
private FGetQuickConnectionStatus _GetQuickConnectionStatus;
|
||||
|
||||
#endregion
|
||||
internal bool GetQuickConnectionStatus( Connection hConn, ref SteamNetworkingQuickConnectionStatus pStats )
|
||||
{
|
||||
var returnValue = _GetQuickConnectionStatus( Self, hConn, ref pStats );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetDetailedConnectionStatus( IntPtr self, Connection hConn, IntPtr pszBuf, int cbBuf );
|
||||
private FGetDetailedConnectionStatus _GetDetailedConnectionStatus;
|
||||
|
||||
#endregion
|
||||
internal int GetDetailedConnectionStatus( Connection hConn, out string pszBuf )
|
||||
{
|
||||
IntPtr mempszBuf = Helpers.TakeMemory();
|
||||
var returnValue = _GetDetailedConnectionStatus( Self, hConn, mempszBuf, (1024 * 32) );
|
||||
pszBuf = Helpers.MemoryToString( mempszBuf );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetListenSocketAddress( IntPtr self, Socket hSocket, ref NetAddress address );
|
||||
private FGetListenSocketAddress _GetListenSocketAddress;
|
||||
|
||||
#endregion
|
||||
internal bool GetListenSocketAddress( Socket hSocket, ref NetAddress address )
|
||||
{
|
||||
var returnValue = _GetListenSocketAddress( Self, hSocket, ref address );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FCreateSocketPair( IntPtr self, [In,Out] Connection[] pOutConnection1, [In,Out] Connection[] pOutConnection2, [MarshalAs( UnmanagedType.U1 )] bool bUseNetworkLoopback, ref NetIdentity pIdentity1, ref NetIdentity pIdentity2 );
|
||||
private FCreateSocketPair _CreateSocketPair;
|
||||
|
||||
#endregion
|
||||
internal bool CreateSocketPair( [In,Out] Connection[] pOutConnection1, [In,Out] Connection[] pOutConnection2, [MarshalAs( UnmanagedType.U1 )] bool bUseNetworkLoopback, ref NetIdentity pIdentity1, ref NetIdentity pIdentity2 )
|
||||
{
|
||||
var returnValue = _CreateSocketPair( Self, pOutConnection1, pOutConnection2, bUseNetworkLoopback, ref pIdentity1, ref pIdentity2 );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetIdentity( IntPtr self, ref NetIdentity pIdentity );
|
||||
private FGetIdentity _GetIdentity;
|
||||
|
||||
#endregion
|
||||
internal bool GetIdentity( ref NetIdentity pIdentity )
|
||||
{
|
||||
var returnValue = _GetIdentity( Self, ref pIdentity );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FReceivedRelayAuthTicket( IntPtr self, IntPtr pvTicket, int cbTicket, [In,Out] SteamDatagramRelayAuthTicket[] pOutParsedTicket );
|
||||
private FReceivedRelayAuthTicket _ReceivedRelayAuthTicket;
|
||||
|
||||
#endregion
|
||||
internal bool ReceivedRelayAuthTicket( IntPtr pvTicket, int cbTicket, [In,Out] SteamDatagramRelayAuthTicket[] pOutParsedTicket )
|
||||
{
|
||||
var returnValue = _ReceivedRelayAuthTicket( Self, pvTicket, cbTicket, pOutParsedTicket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FFindRelayAuthTicketForServer( IntPtr self, ref NetIdentity identityGameServer, int nVirtualPort, [In,Out] SteamDatagramRelayAuthTicket[] pOutParsedTicket );
|
||||
private FFindRelayAuthTicketForServer _FindRelayAuthTicketForServer;
|
||||
|
||||
#endregion
|
||||
internal int FindRelayAuthTicketForServer( ref NetIdentity identityGameServer, int nVirtualPort, [In,Out] SteamDatagramRelayAuthTicket[] pOutParsedTicket )
|
||||
{
|
||||
var returnValue = _FindRelayAuthTicketForServer( Self, ref identityGameServer, nVirtualPort, pOutParsedTicket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Connection FConnectToHostedDedicatedServer( IntPtr self, ref NetIdentity identityTarget, int nVirtualPort );
|
||||
private FConnectToHostedDedicatedServer _ConnectToHostedDedicatedServer;
|
||||
|
||||
#endregion
|
||||
internal Connection ConnectToHostedDedicatedServer( ref NetIdentity identityTarget, int nVirtualPort )
|
||||
{
|
||||
var returnValue = _ConnectToHostedDedicatedServer( Self, ref identityTarget, nVirtualPort );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate ushort FGetHostedDedicatedServerPort( IntPtr self );
|
||||
private FGetHostedDedicatedServerPort _GetHostedDedicatedServerPort;
|
||||
|
||||
#endregion
|
||||
internal ushort GetHostedDedicatedServerPort()
|
||||
{
|
||||
var returnValue = _GetHostedDedicatedServerPort( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamNetworkingPOPID FGetHostedDedicatedServerPOPID( IntPtr self );
|
||||
private FGetHostedDedicatedServerPOPID _GetHostedDedicatedServerPOPID;
|
||||
|
||||
#endregion
|
||||
internal SteamNetworkingPOPID GetHostedDedicatedServerPOPID()
|
||||
{
|
||||
var returnValue = _GetHostedDedicatedServerPOPID( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetHostedDedicatedServerAddress( IntPtr self, ref SteamDatagramHostedAddress pRouting );
|
||||
private FGetHostedDedicatedServerAddress _GetHostedDedicatedServerAddress;
|
||||
|
||||
#endregion
|
||||
internal bool GetHostedDedicatedServerAddress( ref SteamDatagramHostedAddress pRouting )
|
||||
{
|
||||
var returnValue = _GetHostedDedicatedServerAddress( Self, ref pRouting );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Socket FCreateHostedDedicatedServerListenSocket( IntPtr self, int nVirtualPort );
|
||||
private FCreateHostedDedicatedServerListenSocket _CreateHostedDedicatedServerListenSocket;
|
||||
|
||||
#endregion
|
||||
internal Socket CreateHostedDedicatedServerListenSocket( int nVirtualPort )
|
||||
{
|
||||
var returnValue = _CreateHostedDedicatedServerListenSocket( Self, nVirtualPort );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FRunCallbacks( IntPtr self, IntPtr pCallbacks );
|
||||
private FRunCallbacks _RunCallbacks;
|
||||
|
||||
#endregion
|
||||
internal void RunCallbacks( IntPtr pCallbacks )
|
||||
{
|
||||
_RunCallbacks( Self, pCallbacks );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamNetworkingUtils : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamNetworkingUtils001";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_GetLocalPingLocation = Marshal.GetDelegateForFunctionPointer<FGetLocalPingLocation>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_EstimatePingTimeBetweenTwoLocations = Marshal.GetDelegateForFunctionPointer<FEstimatePingTimeBetweenTwoLocations>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_EstimatePingTimeFromLocalHost = Marshal.GetDelegateForFunctionPointer<FEstimatePingTimeFromLocalHost>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_ConvertPingLocationToString = Marshal.GetDelegateForFunctionPointer<FConvertPingLocationToString>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_ParsePingLocationString = Marshal.GetDelegateForFunctionPointer<FParsePingLocationString>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_CheckPingDataUpToDate = Marshal.GetDelegateForFunctionPointer<FCheckPingDataUpToDate>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_IsPingMeasurementInProgress = Marshal.GetDelegateForFunctionPointer<FIsPingMeasurementInProgress>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_GetPingToDataCenter = Marshal.GetDelegateForFunctionPointer<FGetPingToDataCenter>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_GetDirectPingToPOP = Marshal.GetDelegateForFunctionPointer<FGetDirectPingToPOP>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_GetPOPCount = Marshal.GetDelegateForFunctionPointer<FGetPOPCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_GetPOPList = Marshal.GetDelegateForFunctionPointer<FGetPOPList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_GetLocalTimestamp = Marshal.GetDelegateForFunctionPointer<FGetLocalTimestamp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_SetDebugOutputFunction = Marshal.GetDelegateForFunctionPointer<FSetDebugOutputFunction>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_SetConfigValue = Marshal.GetDelegateForFunctionPointer<FSetConfigValue>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_GetConfigValue = Marshal.GetDelegateForFunctionPointer<FGetConfigValue>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_GetConfigValueInfo = Marshal.GetDelegateForFunctionPointer<FGetConfigValueInfo>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_GetFirstConfigValue = Marshal.GetDelegateForFunctionPointer<FGetFirstConfigValue>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_GetLocalPingLocation = null;
|
||||
_EstimatePingTimeBetweenTwoLocations = null;
|
||||
_EstimatePingTimeFromLocalHost = null;
|
||||
_ConvertPingLocationToString = null;
|
||||
_ParsePingLocationString = null;
|
||||
_CheckPingDataUpToDate = null;
|
||||
_IsPingMeasurementInProgress = null;
|
||||
_GetPingToDataCenter = null;
|
||||
_GetDirectPingToPOP = null;
|
||||
_GetPOPCount = null;
|
||||
_GetPOPList = null;
|
||||
_GetLocalTimestamp = null;
|
||||
_SetDebugOutputFunction = null;
|
||||
_SetConfigValue = null;
|
||||
_GetConfigValue = null;
|
||||
_GetConfigValueInfo = null;
|
||||
_GetFirstConfigValue = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate float FGetLocalPingLocation( IntPtr self, ref PingLocation result );
|
||||
private FGetLocalPingLocation _GetLocalPingLocation;
|
||||
|
||||
#endregion
|
||||
internal float GetLocalPingLocation( ref PingLocation result )
|
||||
{
|
||||
var returnValue = _GetLocalPingLocation( Self, ref result );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FEstimatePingTimeBetweenTwoLocations( IntPtr self, ref PingLocation location1, ref PingLocation location2 );
|
||||
private FEstimatePingTimeBetweenTwoLocations _EstimatePingTimeBetweenTwoLocations;
|
||||
|
||||
#endregion
|
||||
internal int EstimatePingTimeBetweenTwoLocations( ref PingLocation location1, ref PingLocation location2 )
|
||||
{
|
||||
var returnValue = _EstimatePingTimeBetweenTwoLocations( Self, ref location1, ref location2 );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FEstimatePingTimeFromLocalHost( IntPtr self, ref PingLocation remoteLocation );
|
||||
private FEstimatePingTimeFromLocalHost _EstimatePingTimeFromLocalHost;
|
||||
|
||||
#endregion
|
||||
internal int EstimatePingTimeFromLocalHost( ref PingLocation remoteLocation )
|
||||
{
|
||||
var returnValue = _EstimatePingTimeFromLocalHost( Self, ref remoteLocation );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FConvertPingLocationToString( IntPtr self, ref PingLocation location, IntPtr pszBuf, int cchBufSize );
|
||||
private FConvertPingLocationToString _ConvertPingLocationToString;
|
||||
|
||||
#endregion
|
||||
internal void ConvertPingLocationToString( ref PingLocation location, out string pszBuf )
|
||||
{
|
||||
IntPtr mempszBuf = Helpers.TakeMemory();
|
||||
_ConvertPingLocationToString( Self, ref location, mempszBuf, (1024 * 32) );
|
||||
pszBuf = Helpers.MemoryToString( mempszBuf );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FParsePingLocationString( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszString, ref PingLocation result );
|
||||
private FParsePingLocationString _ParsePingLocationString;
|
||||
|
||||
#endregion
|
||||
internal bool ParsePingLocationString( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszString, ref PingLocation result )
|
||||
{
|
||||
var returnValue = _ParsePingLocationString( Self, pszString, ref result );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FCheckPingDataUpToDate( IntPtr self, float flMaxAgeSeconds );
|
||||
private FCheckPingDataUpToDate _CheckPingDataUpToDate;
|
||||
|
||||
#endregion
|
||||
internal bool CheckPingDataUpToDate( float flMaxAgeSeconds )
|
||||
{
|
||||
var returnValue = _CheckPingDataUpToDate( Self, flMaxAgeSeconds );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsPingMeasurementInProgress( IntPtr self );
|
||||
private FIsPingMeasurementInProgress _IsPingMeasurementInProgress;
|
||||
|
||||
#endregion
|
||||
internal bool IsPingMeasurementInProgress()
|
||||
{
|
||||
var returnValue = _IsPingMeasurementInProgress( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetPingToDataCenter( IntPtr self, SteamNetworkingPOPID popID, ref SteamNetworkingPOPID pViaRelayPoP );
|
||||
private FGetPingToDataCenter _GetPingToDataCenter;
|
||||
|
||||
#endregion
|
||||
internal int GetPingToDataCenter( SteamNetworkingPOPID popID, ref SteamNetworkingPOPID pViaRelayPoP )
|
||||
{
|
||||
var returnValue = _GetPingToDataCenter( Self, popID, ref pViaRelayPoP );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetDirectPingToPOP( IntPtr self, SteamNetworkingPOPID popID );
|
||||
private FGetDirectPingToPOP _GetDirectPingToPOP;
|
||||
|
||||
#endregion
|
||||
internal int GetDirectPingToPOP( SteamNetworkingPOPID popID )
|
||||
{
|
||||
var returnValue = _GetDirectPingToPOP( Self, popID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetPOPCount( IntPtr self );
|
||||
private FGetPOPCount _GetPOPCount;
|
||||
|
||||
#endregion
|
||||
internal int GetPOPCount()
|
||||
{
|
||||
var returnValue = _GetPOPCount( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetPOPList( IntPtr self, ref SteamNetworkingPOPID list, int nListSz );
|
||||
private FGetPOPList _GetPOPList;
|
||||
|
||||
#endregion
|
||||
internal int GetPOPList( ref SteamNetworkingPOPID list, int nListSz )
|
||||
{
|
||||
var returnValue = _GetPOPList( Self, ref list, nListSz );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate long FGetLocalTimestamp( IntPtr self );
|
||||
private FGetLocalTimestamp _GetLocalTimestamp;
|
||||
|
||||
#endregion
|
||||
internal long GetLocalTimestamp()
|
||||
{
|
||||
var returnValue = _GetLocalTimestamp( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetDebugOutputFunction( IntPtr self, DebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc );
|
||||
private FSetDebugOutputFunction _SetDebugOutputFunction;
|
||||
|
||||
#endregion
|
||||
internal void SetDebugOutputFunction( DebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc )
|
||||
{
|
||||
_SetDebugOutputFunction( Self, eDetailLevel, pfnFunc );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetConfigValue( IntPtr self, NetConfig eValue, NetScope eScopeType, long scopeObj, NetConfigType eDataType, IntPtr pArg );
|
||||
private FSetConfigValue _SetConfigValue;
|
||||
|
||||
#endregion
|
||||
internal bool SetConfigValue( NetConfig eValue, NetScope eScopeType, long scopeObj, NetConfigType eDataType, IntPtr pArg )
|
||||
{
|
||||
var returnValue = _SetConfigValue( Self, eValue, eScopeType, scopeObj, eDataType, pArg );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate NetConfigResult FGetConfigValue( IntPtr self, NetConfig eValue, NetScope eScopeType, long scopeObj, ref NetConfigType pOutDataType, IntPtr pResult, ref ulong cbResult );
|
||||
private FGetConfigValue _GetConfigValue;
|
||||
|
||||
#endregion
|
||||
internal NetConfigResult GetConfigValue( NetConfig eValue, NetScope eScopeType, long scopeObj, ref NetConfigType pOutDataType, IntPtr pResult, ref ulong cbResult )
|
||||
{
|
||||
var returnValue = _GetConfigValue( Self, eValue, eScopeType, scopeObj, ref pOutDataType, pResult, ref cbResult );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetConfigValueInfo( IntPtr self, NetConfig eValue, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pOutName, ref NetConfigType pOutDataType, [In,Out] NetScope[] pOutScope, [In,Out] NetConfig[] pOutNextValue );
|
||||
private FGetConfigValueInfo _GetConfigValueInfo;
|
||||
|
||||
#endregion
|
||||
internal bool GetConfigValueInfo( NetConfig eValue, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pOutName, ref NetConfigType pOutDataType, [In,Out] NetScope[] pOutScope, [In,Out] NetConfig[] pOutNextValue )
|
||||
{
|
||||
var returnValue = _GetConfigValueInfo( Self, eValue, pOutName, ref pOutDataType, pOutScope, pOutNextValue );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate NetConfig FGetFirstConfigValue( IntPtr self );
|
||||
private FGetFirstConfigValue _GetFirstConfigValue;
|
||||
|
||||
#endregion
|
||||
internal NetConfig GetFirstConfigValue()
|
||||
{
|
||||
var returnValue = _GetFirstConfigValue( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamParentalSettings : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMPARENTALSETTINGS_INTERFACE_VERSION001";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_BIsParentalLockEnabled = Marshal.GetDelegateForFunctionPointer<FBIsParentalLockEnabled>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_BIsParentalLockLocked = Marshal.GetDelegateForFunctionPointer<FBIsParentalLockLocked>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_BIsAppBlocked = Marshal.GetDelegateForFunctionPointer<FBIsAppBlocked>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_BIsAppInBlockList = Marshal.GetDelegateForFunctionPointer<FBIsAppInBlockList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_BIsFeatureBlocked = Marshal.GetDelegateForFunctionPointer<FBIsFeatureBlocked>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_BIsFeatureInBlockList = Marshal.GetDelegateForFunctionPointer<FBIsFeatureInBlockList>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_BIsParentalLockEnabled = null;
|
||||
_BIsParentalLockLocked = null;
|
||||
_BIsAppBlocked = null;
|
||||
_BIsAppInBlockList = null;
|
||||
_BIsFeatureBlocked = null;
|
||||
_BIsFeatureInBlockList = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsParentalLockEnabled( IntPtr self );
|
||||
private FBIsParentalLockEnabled _BIsParentalLockEnabled;
|
||||
|
||||
#endregion
|
||||
internal bool BIsParentalLockEnabled()
|
||||
{
|
||||
var returnValue = _BIsParentalLockEnabled( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsParentalLockLocked( IntPtr self );
|
||||
private FBIsParentalLockLocked _BIsParentalLockLocked;
|
||||
|
||||
#endregion
|
||||
internal bool BIsParentalLockLocked()
|
||||
{
|
||||
var returnValue = _BIsParentalLockLocked( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsAppBlocked( IntPtr self, AppId nAppID );
|
||||
private FBIsAppBlocked _BIsAppBlocked;
|
||||
|
||||
#endregion
|
||||
internal bool BIsAppBlocked( AppId nAppID )
|
||||
{
|
||||
var returnValue = _BIsAppBlocked( Self, nAppID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsAppInBlockList( IntPtr self, AppId nAppID );
|
||||
private FBIsAppInBlockList _BIsAppInBlockList;
|
||||
|
||||
#endregion
|
||||
internal bool BIsAppInBlockList( AppId nAppID )
|
||||
{
|
||||
var returnValue = _BIsAppInBlockList( Self, nAppID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsFeatureBlocked( IntPtr self, ParentalFeature eFeature );
|
||||
private FBIsFeatureBlocked _BIsFeatureBlocked;
|
||||
|
||||
#endregion
|
||||
internal bool BIsFeatureBlocked( ParentalFeature eFeature )
|
||||
{
|
||||
var returnValue = _BIsFeatureBlocked( Self, eFeature );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsFeatureInBlockList( IntPtr self, ParentalFeature eFeature );
|
||||
private FBIsFeatureInBlockList _BIsFeatureInBlockList;
|
||||
|
||||
#endregion
|
||||
internal bool BIsFeatureInBlockList( ParentalFeature eFeature )
|
||||
{
|
||||
var returnValue = _BIsFeatureInBlockList( Self, eFeature );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamParties : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamParties002";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_GetNumActiveBeacons = Marshal.GetDelegateForFunctionPointer<FGetNumActiveBeacons>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_GetBeaconByIndex = Marshal.GetDelegateForFunctionPointer<FGetBeaconByIndex>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_GetBeaconDetails = Marshal.GetDelegateForFunctionPointer<FGetBeaconDetails>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_JoinParty = Marshal.GetDelegateForFunctionPointer<FJoinParty>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_GetNumAvailableBeaconLocations = Marshal.GetDelegateForFunctionPointer<FGetNumAvailableBeaconLocations>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_GetAvailableBeaconLocations = Marshal.GetDelegateForFunctionPointer<FGetAvailableBeaconLocations>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_CreateBeacon = Marshal.GetDelegateForFunctionPointer<FCreateBeacon>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_OnReservationCompleted = Marshal.GetDelegateForFunctionPointer<FOnReservationCompleted>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_CancelReservation = Marshal.GetDelegateForFunctionPointer<FCancelReservation>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_ChangeNumOpenSlots = Marshal.GetDelegateForFunctionPointer<FChangeNumOpenSlots>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_DestroyBeacon = Marshal.GetDelegateForFunctionPointer<FDestroyBeacon>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_GetBeaconLocationData = Marshal.GetDelegateForFunctionPointer<FGetBeaconLocationData>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_GetNumActiveBeacons = null;
|
||||
_GetBeaconByIndex = null;
|
||||
_GetBeaconDetails = null;
|
||||
_JoinParty = null;
|
||||
_GetNumAvailableBeaconLocations = null;
|
||||
_GetAvailableBeaconLocations = null;
|
||||
_CreateBeacon = null;
|
||||
_OnReservationCompleted = null;
|
||||
_CancelReservation = null;
|
||||
_ChangeNumOpenSlots = null;
|
||||
_DestroyBeacon = null;
|
||||
_GetBeaconLocationData = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetNumActiveBeacons( IntPtr self );
|
||||
private FGetNumActiveBeacons _GetNumActiveBeacons;
|
||||
|
||||
#endregion
|
||||
internal uint GetNumActiveBeacons()
|
||||
{
|
||||
var returnValue = _GetNumActiveBeacons( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate PartyBeaconID_t FGetBeaconByIndex( IntPtr self, uint unIndex );
|
||||
private FGetBeaconByIndex _GetBeaconByIndex;
|
||||
|
||||
#endregion
|
||||
internal PartyBeaconID_t GetBeaconByIndex( uint unIndex )
|
||||
{
|
||||
var returnValue = _GetBeaconByIndex( Self, unIndex );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetBeaconDetails( IntPtr self, PartyBeaconID_t ulBeaconID, ref SteamId pSteamIDBeaconOwner, ref SteamPartyBeaconLocation_t pLocation, IntPtr pchMetadata, int cchMetadata );
|
||||
private FGetBeaconDetails _GetBeaconDetails;
|
||||
|
||||
#endregion
|
||||
internal bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, ref SteamId pSteamIDBeaconOwner, ref SteamPartyBeaconLocation_t pLocation, out string pchMetadata )
|
||||
{
|
||||
IntPtr mempchMetadata = Helpers.TakeMemory();
|
||||
var returnValue = _GetBeaconDetails( Self, ulBeaconID, ref pSteamIDBeaconOwner, ref pLocation, mempchMetadata, (1024 * 32) );
|
||||
pchMetadata = Helpers.MemoryToString( mempchMetadata );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FJoinParty( IntPtr self, PartyBeaconID_t ulBeaconID );
|
||||
private FJoinParty _JoinParty;
|
||||
|
||||
#endregion
|
||||
internal async Task<JoinPartyCallback_t?> JoinParty( PartyBeaconID_t ulBeaconID )
|
||||
{
|
||||
var returnValue = _JoinParty( Self, ulBeaconID );
|
||||
return await JoinPartyCallback_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetNumAvailableBeaconLocations( IntPtr self, ref uint puNumLocations );
|
||||
private FGetNumAvailableBeaconLocations _GetNumAvailableBeaconLocations;
|
||||
|
||||
#endregion
|
||||
internal bool GetNumAvailableBeaconLocations( ref uint puNumLocations )
|
||||
{
|
||||
var returnValue = _GetNumAvailableBeaconLocations( Self, ref puNumLocations );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetAvailableBeaconLocations( IntPtr self, ref SteamPartyBeaconLocation_t pLocationList, uint uMaxNumLocations );
|
||||
private FGetAvailableBeaconLocations _GetAvailableBeaconLocations;
|
||||
|
||||
#endregion
|
||||
internal bool GetAvailableBeaconLocations( ref SteamPartyBeaconLocation_t pLocationList, uint uMaxNumLocations )
|
||||
{
|
||||
var returnValue = _GetAvailableBeaconLocations( Self, ref pLocationList, uMaxNumLocations );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FCreateBeacon( IntPtr self, uint unOpenSlots, ref SteamPartyBeaconLocation_t pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata );
|
||||
private FCreateBeacon _CreateBeacon;
|
||||
|
||||
#endregion
|
||||
internal async Task<CreateBeaconCallback_t?> CreateBeacon( uint unOpenSlots, /* ref */ SteamPartyBeaconLocation_t pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata )
|
||||
{
|
||||
var returnValue = _CreateBeacon( Self, unOpenSlots, ref pBeaconLocation, pchConnectString, pchMetadata );
|
||||
return await CreateBeaconCallback_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FOnReservationCompleted( IntPtr self, PartyBeaconID_t ulBeacon, SteamId steamIDUser );
|
||||
private FOnReservationCompleted _OnReservationCompleted;
|
||||
|
||||
#endregion
|
||||
internal void OnReservationCompleted( PartyBeaconID_t ulBeacon, SteamId steamIDUser )
|
||||
{
|
||||
_OnReservationCompleted( Self, ulBeacon, steamIDUser );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FCancelReservation( IntPtr self, PartyBeaconID_t ulBeacon, SteamId steamIDUser );
|
||||
private FCancelReservation _CancelReservation;
|
||||
|
||||
#endregion
|
||||
internal void CancelReservation( PartyBeaconID_t ulBeacon, SteamId steamIDUser )
|
||||
{
|
||||
_CancelReservation( Self, ulBeacon, steamIDUser );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FChangeNumOpenSlots( IntPtr self, PartyBeaconID_t ulBeacon, uint unOpenSlots );
|
||||
private FChangeNumOpenSlots _ChangeNumOpenSlots;
|
||||
|
||||
#endregion
|
||||
internal async Task<ChangeNumOpenSlotsCallback_t?> ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint unOpenSlots )
|
||||
{
|
||||
var returnValue = _ChangeNumOpenSlots( Self, ulBeacon, unOpenSlots );
|
||||
return await ChangeNumOpenSlotsCallback_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FDestroyBeacon( IntPtr self, PartyBeaconID_t ulBeacon );
|
||||
private FDestroyBeacon _DestroyBeacon;
|
||||
|
||||
#endregion
|
||||
internal bool DestroyBeacon( PartyBeaconID_t ulBeacon )
|
||||
{
|
||||
var returnValue = _DestroyBeacon( Self, ulBeacon );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetBeaconLocationData( IntPtr self, SteamPartyBeaconLocation_t BeaconLocation, SteamPartyBeaconLocationData eData, IntPtr pchDataStringOut, int cchDataStringOut );
|
||||
private FGetBeaconLocationData _GetBeaconLocationData;
|
||||
|
||||
#endregion
|
||||
internal bool GetBeaconLocationData( SteamPartyBeaconLocation_t BeaconLocation, SteamPartyBeaconLocationData eData, out string pchDataStringOut )
|
||||
{
|
||||
IntPtr mempchDataStringOut = Helpers.TakeMemory();
|
||||
var returnValue = _GetBeaconLocationData( Self, BeaconLocation, eData, mempchDataStringOut, (1024 * 32) );
|
||||
pchDataStringOut = Helpers.MemoryToString( mempchDataStringOut );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamRemoteStorage : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMREMOTESTORAGE_INTERFACE_VERSION014";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_FileWrite = Marshal.GetDelegateForFunctionPointer<FFileWrite>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_FileRead = Marshal.GetDelegateForFunctionPointer<FFileRead>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_FileWriteAsync = Marshal.GetDelegateForFunctionPointer<FFileWriteAsync>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_FileReadAsync = Marshal.GetDelegateForFunctionPointer<FFileReadAsync>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_FileReadAsyncComplete = Marshal.GetDelegateForFunctionPointer<FFileReadAsyncComplete>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_FileForget = Marshal.GetDelegateForFunctionPointer<FFileForget>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_FileDelete = Marshal.GetDelegateForFunctionPointer<FFileDelete>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_FileShare = Marshal.GetDelegateForFunctionPointer<FFileShare>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_SetSyncPlatforms = Marshal.GetDelegateForFunctionPointer<FSetSyncPlatforms>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_FileWriteStreamOpen = Marshal.GetDelegateForFunctionPointer<FFileWriteStreamOpen>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_FileWriteStreamWriteChunk = Marshal.GetDelegateForFunctionPointer<FFileWriteStreamWriteChunk>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_FileWriteStreamClose = Marshal.GetDelegateForFunctionPointer<FFileWriteStreamClose>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_FileWriteStreamCancel = Marshal.GetDelegateForFunctionPointer<FFileWriteStreamCancel>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_FileExists = Marshal.GetDelegateForFunctionPointer<FFileExists>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_FilePersisted = Marshal.GetDelegateForFunctionPointer<FFilePersisted>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_GetFileSize = Marshal.GetDelegateForFunctionPointer<FGetFileSize>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_GetFileTimestamp = Marshal.GetDelegateForFunctionPointer<FGetFileTimestamp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_GetSyncPlatforms = Marshal.GetDelegateForFunctionPointer<FGetSyncPlatforms>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_GetFileCount = Marshal.GetDelegateForFunctionPointer<FGetFileCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_GetFileNameAndSize = Marshal.GetDelegateForFunctionPointer<FGetFileNameAndSize>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_GetQuota = Marshal.GetDelegateForFunctionPointer<FGetQuota>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_IsCloudEnabledForAccount = Marshal.GetDelegateForFunctionPointer<FIsCloudEnabledForAccount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_IsCloudEnabledForApp = Marshal.GetDelegateForFunctionPointer<FIsCloudEnabledForApp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_SetCloudEnabledForApp = Marshal.GetDelegateForFunctionPointer<FSetCloudEnabledForApp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_UGCDownload = Marshal.GetDelegateForFunctionPointer<FUGCDownload>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_GetUGCDownloadProgress = Marshal.GetDelegateForFunctionPointer<FGetUGCDownloadProgress>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_GetUGCDetails = Marshal.GetDelegateForFunctionPointer<FGetUGCDetails>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_UGCRead = Marshal.GetDelegateForFunctionPointer<FUGCRead>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_GetCachedUGCCount = Marshal.GetDelegateForFunctionPointer<FGetCachedUGCCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
// PublishWorkshopFile is deprecated
|
||||
// CreatePublishedFileUpdateRequest is deprecated
|
||||
// UpdatePublishedFileFile is deprecated
|
||||
// UpdatePublishedFilePreviewFile is deprecated
|
||||
// UpdatePublishedFileTitle is deprecated
|
||||
// UpdatePublishedFileDescription is deprecated
|
||||
// UpdatePublishedFileVisibility is deprecated
|
||||
// UpdatePublishedFileTags is deprecated
|
||||
// CommitPublishedFileUpdate is deprecated
|
||||
// GetPublishedFileDetails is deprecated
|
||||
// DeletePublishedFile is deprecated
|
||||
// EnumerateUserPublishedFiles is deprecated
|
||||
// SubscribePublishedFile is deprecated
|
||||
// EnumerateUserSubscribedFiles is deprecated
|
||||
// UnsubscribePublishedFile is deprecated
|
||||
// UpdatePublishedFileSetChangeDescription is deprecated
|
||||
// GetPublishedItemVoteDetails is deprecated
|
||||
// UpdateUserPublishedItemVote is deprecated
|
||||
// GetUserPublishedItemVoteDetails is deprecated
|
||||
// EnumerateUserSharedWorkshopFiles is deprecated
|
||||
// PublishVideo is deprecated
|
||||
// SetUserPublishedFileAction is deprecated
|
||||
// EnumeratePublishedFilesByUserAction is deprecated
|
||||
// EnumeratePublishedWorkshopFiles is deprecated
|
||||
_UGCDownloadToLocation = Marshal.GetDelegateForFunctionPointer<FUGCDownloadToLocation>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 424 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_FileWrite = null;
|
||||
_FileRead = null;
|
||||
_FileWriteAsync = null;
|
||||
_FileReadAsync = null;
|
||||
_FileReadAsyncComplete = null;
|
||||
_FileForget = null;
|
||||
_FileDelete = null;
|
||||
_FileShare = null;
|
||||
_SetSyncPlatforms = null;
|
||||
_FileWriteStreamOpen = null;
|
||||
_FileWriteStreamWriteChunk = null;
|
||||
_FileWriteStreamClose = null;
|
||||
_FileWriteStreamCancel = null;
|
||||
_FileExists = null;
|
||||
_FilePersisted = null;
|
||||
_GetFileSize = null;
|
||||
_GetFileTimestamp = null;
|
||||
_GetSyncPlatforms = null;
|
||||
_GetFileCount = null;
|
||||
_GetFileNameAndSize = null;
|
||||
_GetQuota = null;
|
||||
_IsCloudEnabledForAccount = null;
|
||||
_IsCloudEnabledForApp = null;
|
||||
_SetCloudEnabledForApp = null;
|
||||
_UGCDownload = null;
|
||||
_GetUGCDownloadProgress = null;
|
||||
_GetUGCDetails = null;
|
||||
_UGCRead = null;
|
||||
_GetCachedUGCCount = null;
|
||||
_UGCDownloadToLocation = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFileWrite( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, int cubData );
|
||||
private FFileWrite _FileWrite;
|
||||
|
||||
#endregion
|
||||
internal bool FileWrite( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, int cubData )
|
||||
{
|
||||
var returnValue = _FileWrite( Self, pchFile, pvData, cubData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FFileRead( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, int cubDataToRead );
|
||||
private FFileRead _FileRead;
|
||||
|
||||
#endregion
|
||||
internal int FileRead( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, int cubDataToRead )
|
||||
{
|
||||
var returnValue = _FileRead( Self, pchFile, pvData, cubDataToRead );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FFileWriteAsync( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, uint cubData );
|
||||
private FFileWriteAsync _FileWriteAsync;
|
||||
|
||||
#endregion
|
||||
internal async Task<RemoteStorageFileWriteAsyncComplete_t?> FileWriteAsync( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, uint cubData )
|
||||
{
|
||||
var returnValue = _FileWriteAsync( Self, pchFile, pvData, cubData );
|
||||
return await RemoteStorageFileWriteAsyncComplete_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FFileReadAsync( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, uint nOffset, uint cubToRead );
|
||||
private FFileReadAsync _FileReadAsync;
|
||||
|
||||
#endregion
|
||||
internal async Task<RemoteStorageFileReadAsyncComplete_t?> FileReadAsync( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, uint nOffset, uint cubToRead )
|
||||
{
|
||||
var returnValue = _FileReadAsync( Self, pchFile, nOffset, cubToRead );
|
||||
return await RemoteStorageFileReadAsyncComplete_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFileReadAsyncComplete( IntPtr self, SteamAPICall_t hReadCall, IntPtr pvBuffer, uint cubToRead );
|
||||
private FFileReadAsyncComplete _FileReadAsyncComplete;
|
||||
|
||||
#endregion
|
||||
internal bool FileReadAsyncComplete( SteamAPICall_t hReadCall, IntPtr pvBuffer, uint cubToRead )
|
||||
{
|
||||
var returnValue = _FileReadAsyncComplete( Self, hReadCall, pvBuffer, cubToRead );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFileForget( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FFileForget _FileForget;
|
||||
|
||||
#endregion
|
||||
internal bool FileForget( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _FileForget( Self, pchFile );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFileDelete( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FFileDelete _FileDelete;
|
||||
|
||||
#endregion
|
||||
internal bool FileDelete( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _FileDelete( Self, pchFile );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FFileShare( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FFileShare _FileShare;
|
||||
|
||||
#endregion
|
||||
internal async Task<RemoteStorageFileShareResult_t?> FileShare( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _FileShare( Self, pchFile );
|
||||
return await RemoteStorageFileShareResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetSyncPlatforms( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, RemoteStoragePlatform eRemoteStoragePlatform );
|
||||
private FSetSyncPlatforms _SetSyncPlatforms;
|
||||
|
||||
#endregion
|
||||
internal bool SetSyncPlatforms( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, RemoteStoragePlatform eRemoteStoragePlatform )
|
||||
{
|
||||
var returnValue = _SetSyncPlatforms( Self, pchFile, eRemoteStoragePlatform );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate UGCFileWriteStreamHandle_t FFileWriteStreamOpen( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FFileWriteStreamOpen _FileWriteStreamOpen;
|
||||
|
||||
#endregion
|
||||
internal UGCFileWriteStreamHandle_t FileWriteStreamOpen( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _FileWriteStreamOpen( Self, pchFile );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFileWriteStreamWriteChunk( IntPtr self, UGCFileWriteStreamHandle_t writeHandle, IntPtr pvData, int cubData );
|
||||
private FFileWriteStreamWriteChunk _FileWriteStreamWriteChunk;
|
||||
|
||||
#endregion
|
||||
internal bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, IntPtr pvData, int cubData )
|
||||
{
|
||||
var returnValue = _FileWriteStreamWriteChunk( Self, writeHandle, pvData, cubData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFileWriteStreamClose( IntPtr self, UGCFileWriteStreamHandle_t writeHandle );
|
||||
private FFileWriteStreamClose _FileWriteStreamClose;
|
||||
|
||||
#endregion
|
||||
internal bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle )
|
||||
{
|
||||
var returnValue = _FileWriteStreamClose( Self, writeHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFileWriteStreamCancel( IntPtr self, UGCFileWriteStreamHandle_t writeHandle );
|
||||
private FFileWriteStreamCancel _FileWriteStreamCancel;
|
||||
|
||||
#endregion
|
||||
internal bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle )
|
||||
{
|
||||
var returnValue = _FileWriteStreamCancel( Self, writeHandle );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFileExists( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FFileExists _FileExists;
|
||||
|
||||
#endregion
|
||||
internal bool FileExists( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _FileExists( Self, pchFile );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FFilePersisted( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FFilePersisted _FilePersisted;
|
||||
|
||||
#endregion
|
||||
internal bool FilePersisted( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _FilePersisted( Self, pchFile );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetFileSize( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FGetFileSize _GetFileSize;
|
||||
|
||||
#endregion
|
||||
internal int GetFileSize( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _GetFileSize( Self, pchFile );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate long FGetFileTimestamp( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FGetFileTimestamp _GetFileTimestamp;
|
||||
|
||||
#endregion
|
||||
internal long GetFileTimestamp( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _GetFileTimestamp( Self, pchFile );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate RemoteStoragePlatform FGetSyncPlatforms( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
|
||||
private FGetSyncPlatforms _GetSyncPlatforms;
|
||||
|
||||
#endregion
|
||||
internal RemoteStoragePlatform GetSyncPlatforms( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
|
||||
{
|
||||
var returnValue = _GetSyncPlatforms( Self, pchFile );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetFileCount( IntPtr self );
|
||||
private FGetFileCount _GetFileCount;
|
||||
|
||||
#endregion
|
||||
internal int GetFileCount()
|
||||
{
|
||||
var returnValue = _GetFileCount( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetFileNameAndSize( IntPtr self, int iFile, ref int pnFileSizeInBytes );
|
||||
private FGetFileNameAndSize _GetFileNameAndSize;
|
||||
|
||||
#endregion
|
||||
internal string GetFileNameAndSize( int iFile, ref int pnFileSizeInBytes )
|
||||
{
|
||||
var returnValue = _GetFileNameAndSize( Self, iFile, ref pnFileSizeInBytes );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetQuota( IntPtr self, ref ulong pnTotalBytes, ref ulong puAvailableBytes );
|
||||
private FGetQuota _GetQuota;
|
||||
|
||||
#endregion
|
||||
internal bool GetQuota( ref ulong pnTotalBytes, ref ulong puAvailableBytes )
|
||||
{
|
||||
var returnValue = _GetQuota( Self, ref pnTotalBytes, ref puAvailableBytes );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsCloudEnabledForAccount( IntPtr self );
|
||||
private FIsCloudEnabledForAccount _IsCloudEnabledForAccount;
|
||||
|
||||
#endregion
|
||||
internal bool IsCloudEnabledForAccount()
|
||||
{
|
||||
var returnValue = _IsCloudEnabledForAccount( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsCloudEnabledForApp( IntPtr self );
|
||||
private FIsCloudEnabledForApp _IsCloudEnabledForApp;
|
||||
|
||||
#endregion
|
||||
internal bool IsCloudEnabledForApp()
|
||||
{
|
||||
var returnValue = _IsCloudEnabledForApp( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetCloudEnabledForApp( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bEnabled );
|
||||
private FSetCloudEnabledForApp _SetCloudEnabledForApp;
|
||||
|
||||
#endregion
|
||||
internal void SetCloudEnabledForApp( [MarshalAs( UnmanagedType.U1 )] bool bEnabled )
|
||||
{
|
||||
_SetCloudEnabledForApp( Self, bEnabled );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FUGCDownload( IntPtr self, UGCHandle_t hContent, uint unPriority );
|
||||
private FUGCDownload _UGCDownload;
|
||||
|
||||
#endregion
|
||||
internal async Task<RemoteStorageDownloadUGCResult_t?> UGCDownload( UGCHandle_t hContent, uint unPriority )
|
||||
{
|
||||
var returnValue = _UGCDownload( Self, hContent, unPriority );
|
||||
return await RemoteStorageDownloadUGCResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUGCDownloadProgress( IntPtr self, UGCHandle_t hContent, ref int pnBytesDownloaded, ref int pnBytesExpected );
|
||||
private FGetUGCDownloadProgress _GetUGCDownloadProgress;
|
||||
|
||||
#endregion
|
||||
internal bool GetUGCDownloadProgress( UGCHandle_t hContent, ref int pnBytesDownloaded, ref int pnBytesExpected )
|
||||
{
|
||||
var returnValue = _GetUGCDownloadProgress( Self, hContent, ref pnBytesDownloaded, ref pnBytesExpected );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUGCDetails( IntPtr self, UGCHandle_t hContent, ref AppId pnAppID, [In,Out] ref char[] ppchName, ref int pnFileSizeInBytes, ref SteamId pSteamIDOwner );
|
||||
private FGetUGCDetails _GetUGCDetails;
|
||||
|
||||
#endregion
|
||||
internal bool GetUGCDetails( UGCHandle_t hContent, ref AppId pnAppID, [In,Out] ref char[] ppchName, ref int pnFileSizeInBytes, ref SteamId pSteamIDOwner )
|
||||
{
|
||||
var returnValue = _GetUGCDetails( Self, hContent, ref pnAppID, ref ppchName, ref pnFileSizeInBytes, ref pSteamIDOwner );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FUGCRead( IntPtr self, UGCHandle_t hContent, IntPtr pvData, int cubDataToRead, uint cOffset, UGCReadAction eAction );
|
||||
private FUGCRead _UGCRead;
|
||||
|
||||
#endregion
|
||||
internal int UGCRead( UGCHandle_t hContent, IntPtr pvData, int cubDataToRead, uint cOffset, UGCReadAction eAction )
|
||||
{
|
||||
var returnValue = _UGCRead( Self, hContent, pvData, cubDataToRead, cOffset, eAction );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetCachedUGCCount( IntPtr self );
|
||||
private FGetCachedUGCCount _GetCachedUGCCount;
|
||||
|
||||
#endregion
|
||||
internal int GetCachedUGCCount()
|
||||
{
|
||||
var returnValue = _GetCachedUGCCount( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FUGCDownloadToLocation( IntPtr self, UGCHandle_t hContent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLocation, uint unPriority );
|
||||
private FUGCDownloadToLocation _UGCDownloadToLocation;
|
||||
|
||||
#endregion
|
||||
internal async Task<RemoteStorageDownloadUGCResult_t?> UGCDownloadToLocation( UGCHandle_t hContent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLocation, uint unPriority )
|
||||
{
|
||||
var returnValue = _UGCDownloadToLocation( Self, hContent, pchLocation, unPriority );
|
||||
return await RemoteStorageDownloadUGCResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamScreenshots : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMSCREENSHOTS_INTERFACE_VERSION003";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_WriteScreenshot = Marshal.GetDelegateForFunctionPointer<FWriteScreenshot>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_AddScreenshotToLibrary = Marshal.GetDelegateForFunctionPointer<FAddScreenshotToLibrary>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_TriggerScreenshot = Marshal.GetDelegateForFunctionPointer<FTriggerScreenshot>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_HookScreenshots = Marshal.GetDelegateForFunctionPointer<FHookScreenshots>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_SetLocation = Marshal.GetDelegateForFunctionPointer<FSetLocation>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_TagUser = Marshal.GetDelegateForFunctionPointer<FTagUser>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_TagPublishedFile = Marshal.GetDelegateForFunctionPointer<FTagPublishedFile>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_IsScreenshotsHooked = Marshal.GetDelegateForFunctionPointer<FIsScreenshotsHooked>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_AddVRScreenshotToLibrary = Marshal.GetDelegateForFunctionPointer<FAddVRScreenshotToLibrary>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_WriteScreenshot = null;
|
||||
_AddScreenshotToLibrary = null;
|
||||
_TriggerScreenshot = null;
|
||||
_HookScreenshots = null;
|
||||
_SetLocation = null;
|
||||
_TagUser = null;
|
||||
_TagPublishedFile = null;
|
||||
_IsScreenshotsHooked = null;
|
||||
_AddVRScreenshotToLibrary = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate ScreenshotHandle FWriteScreenshot( IntPtr self, IntPtr pubRGB, uint cubRGB, int nWidth, int nHeight );
|
||||
private FWriteScreenshot _WriteScreenshot;
|
||||
|
||||
#endregion
|
||||
internal ScreenshotHandle WriteScreenshot( IntPtr pubRGB, uint cubRGB, int nWidth, int nHeight )
|
||||
{
|
||||
var returnValue = _WriteScreenshot( Self, pubRGB, cubRGB, nWidth, nHeight );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate ScreenshotHandle FAddScreenshotToLibrary( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFilename, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchThumbnailFilename, int nWidth, int nHeight );
|
||||
private FAddScreenshotToLibrary _AddScreenshotToLibrary;
|
||||
|
||||
#endregion
|
||||
internal ScreenshotHandle AddScreenshotToLibrary( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFilename, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchThumbnailFilename, int nWidth, int nHeight )
|
||||
{
|
||||
var returnValue = _AddScreenshotToLibrary( Self, pchFilename, pchThumbnailFilename, nWidth, nHeight );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FTriggerScreenshot( IntPtr self );
|
||||
private FTriggerScreenshot _TriggerScreenshot;
|
||||
|
||||
#endregion
|
||||
internal void TriggerScreenshot()
|
||||
{
|
||||
_TriggerScreenshot( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FHookScreenshots( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bHook );
|
||||
private FHookScreenshots _HookScreenshots;
|
||||
|
||||
#endregion
|
||||
internal void HookScreenshots( [MarshalAs( UnmanagedType.U1 )] bool bHook )
|
||||
{
|
||||
_HookScreenshots( Self, bHook );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetLocation( IntPtr self, ScreenshotHandle hScreenshot, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLocation );
|
||||
private FSetLocation _SetLocation;
|
||||
|
||||
#endregion
|
||||
internal bool SetLocation( ScreenshotHandle hScreenshot, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLocation )
|
||||
{
|
||||
var returnValue = _SetLocation( Self, hScreenshot, pchLocation );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FTagUser( IntPtr self, ScreenshotHandle hScreenshot, SteamId steamID );
|
||||
private FTagUser _TagUser;
|
||||
|
||||
#endregion
|
||||
internal bool TagUser( ScreenshotHandle hScreenshot, SteamId steamID )
|
||||
{
|
||||
var returnValue = _TagUser( Self, hScreenshot, steamID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FTagPublishedFile( IntPtr self, ScreenshotHandle hScreenshot, PublishedFileId unPublishedFileID );
|
||||
private FTagPublishedFile _TagPublishedFile;
|
||||
|
||||
#endregion
|
||||
internal bool TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId unPublishedFileID )
|
||||
{
|
||||
var returnValue = _TagPublishedFile( Self, hScreenshot, unPublishedFileID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsScreenshotsHooked( IntPtr self );
|
||||
private FIsScreenshotsHooked _IsScreenshotsHooked;
|
||||
|
||||
#endregion
|
||||
internal bool IsScreenshotsHooked()
|
||||
{
|
||||
var returnValue = _IsScreenshotsHooked( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate ScreenshotHandle FAddVRScreenshotToLibrary( IntPtr self, VRScreenshotType eType, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFilename, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVRFilename );
|
||||
private FAddVRScreenshotToLibrary _AddVRScreenshotToLibrary;
|
||||
|
||||
#endregion
|
||||
internal ScreenshotHandle AddVRScreenshotToLibrary( VRScreenshotType eType, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFilename, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVRFilename )
|
||||
{
|
||||
var returnValue = _AddVRScreenshotToLibrary( Self, eType, pchFilename, pchVRFilename );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,457 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamUser : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamUser020";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_GetHSteamUser = Marshal.GetDelegateForFunctionPointer<FGetHSteamUser>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_BLoggedOn = Marshal.GetDelegateForFunctionPointer<FBLoggedOn>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_GetSteamID = Marshal.GetDelegateForFunctionPointer<FGetSteamID>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_InitiateGameConnection = Marshal.GetDelegateForFunctionPointer<FInitiateGameConnection>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_TerminateGameConnection = Marshal.GetDelegateForFunctionPointer<FTerminateGameConnection>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_TrackAppUsageEvent = Marshal.GetDelegateForFunctionPointer<FTrackAppUsageEvent>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_GetUserDataFolder = Marshal.GetDelegateForFunctionPointer<FGetUserDataFolder>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_StartVoiceRecording = Marshal.GetDelegateForFunctionPointer<FStartVoiceRecording>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_StopVoiceRecording = Marshal.GetDelegateForFunctionPointer<FStopVoiceRecording>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_GetAvailableVoice = Marshal.GetDelegateForFunctionPointer<FGetAvailableVoice>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_GetVoice = Marshal.GetDelegateForFunctionPointer<FGetVoice>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_DecompressVoice = Marshal.GetDelegateForFunctionPointer<FDecompressVoice>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_GetVoiceOptimalSampleRate = Marshal.GetDelegateForFunctionPointer<FGetVoiceOptimalSampleRate>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_GetAuthSessionTicket = Marshal.GetDelegateForFunctionPointer<FGetAuthSessionTicket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_BeginAuthSession = Marshal.GetDelegateForFunctionPointer<FBeginAuthSession>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_EndAuthSession = Marshal.GetDelegateForFunctionPointer<FEndAuthSession>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_CancelAuthTicket = Marshal.GetDelegateForFunctionPointer<FCancelAuthTicket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_UserHasLicenseForApp = Marshal.GetDelegateForFunctionPointer<FUserHasLicenseForApp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_BIsBehindNAT = Marshal.GetDelegateForFunctionPointer<FBIsBehindNAT>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_AdvertiseGame = Marshal.GetDelegateForFunctionPointer<FAdvertiseGame>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_RequestEncryptedAppTicket = Marshal.GetDelegateForFunctionPointer<FRequestEncryptedAppTicket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_GetEncryptedAppTicket = Marshal.GetDelegateForFunctionPointer<FGetEncryptedAppTicket>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_GetGameBadgeLevel = Marshal.GetDelegateForFunctionPointer<FGetGameBadgeLevel>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_GetPlayerSteamLevel = Marshal.GetDelegateForFunctionPointer<FGetPlayerSteamLevel>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_RequestStoreAuthURL = Marshal.GetDelegateForFunctionPointer<FRequestStoreAuthURL>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_BIsPhoneVerified = Marshal.GetDelegateForFunctionPointer<FBIsPhoneVerified>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_BIsTwoFactorEnabled = Marshal.GetDelegateForFunctionPointer<FBIsTwoFactorEnabled>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_BIsPhoneIdentifying = Marshal.GetDelegateForFunctionPointer<FBIsPhoneIdentifying>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_BIsPhoneRequiringVerification = Marshal.GetDelegateForFunctionPointer<FBIsPhoneRequiringVerification>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
_GetMarketEligibility = Marshal.GetDelegateForFunctionPointer<FGetMarketEligibility>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 232 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_GetHSteamUser = null;
|
||||
_BLoggedOn = null;
|
||||
_GetSteamID = null;
|
||||
_InitiateGameConnection = null;
|
||||
_TerminateGameConnection = null;
|
||||
_TrackAppUsageEvent = null;
|
||||
_GetUserDataFolder = null;
|
||||
_StartVoiceRecording = null;
|
||||
_StopVoiceRecording = null;
|
||||
_GetAvailableVoice = null;
|
||||
_GetVoice = null;
|
||||
_DecompressVoice = null;
|
||||
_GetVoiceOptimalSampleRate = null;
|
||||
_GetAuthSessionTicket = null;
|
||||
_BeginAuthSession = null;
|
||||
_EndAuthSession = null;
|
||||
_CancelAuthTicket = null;
|
||||
_UserHasLicenseForApp = null;
|
||||
_BIsBehindNAT = null;
|
||||
_AdvertiseGame = null;
|
||||
_RequestEncryptedAppTicket = null;
|
||||
_GetEncryptedAppTicket = null;
|
||||
_GetGameBadgeLevel = null;
|
||||
_GetPlayerSteamLevel = null;
|
||||
_RequestStoreAuthURL = null;
|
||||
_BIsPhoneVerified = null;
|
||||
_BIsTwoFactorEnabled = null;
|
||||
_BIsPhoneIdentifying = null;
|
||||
_BIsPhoneRequiringVerification = null;
|
||||
_GetMarketEligibility = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HSteamUser FGetHSteamUser( IntPtr self );
|
||||
private FGetHSteamUser _GetHSteamUser;
|
||||
|
||||
#endregion
|
||||
internal HSteamUser GetHSteamUser()
|
||||
{
|
||||
var returnValue = _GetHSteamUser( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBLoggedOn( IntPtr self );
|
||||
private FBLoggedOn _BLoggedOn;
|
||||
|
||||
#endregion
|
||||
internal bool BLoggedOn()
|
||||
{
|
||||
var returnValue = _BLoggedOn( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
#if PLATFORM_WIN
|
||||
private delegate void FGetSteamID( IntPtr self, ref SteamId retVal );
|
||||
#else
|
||||
private delegate SteamId FGetSteamID( IntPtr self );
|
||||
#endif
|
||||
private FGetSteamID _GetSteamID;
|
||||
|
||||
#endregion
|
||||
internal SteamId GetSteamID()
|
||||
{
|
||||
#if PLATFORM_WIN
|
||||
var retVal = default( SteamId );
|
||||
_GetSteamID( Self, ref retVal );
|
||||
return retVal;
|
||||
#else
|
||||
var returnValue = _GetSteamID( Self );
|
||||
return returnValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FInitiateGameConnection( IntPtr self, IntPtr pAuthBlob, int cbMaxAuthBlob, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure );
|
||||
private FInitiateGameConnection _InitiateGameConnection;
|
||||
|
||||
#endregion
|
||||
internal int InitiateGameConnection( IntPtr pAuthBlob, int cbMaxAuthBlob, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure )
|
||||
{
|
||||
var returnValue = _InitiateGameConnection( Self, pAuthBlob, cbMaxAuthBlob, steamIDGameServer, unIPServer, usPortServer, bSecure );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FTerminateGameConnection( IntPtr self, uint unIPServer, ushort usPortServer );
|
||||
private FTerminateGameConnection _TerminateGameConnection;
|
||||
|
||||
#endregion
|
||||
internal void TerminateGameConnection( uint unIPServer, ushort usPortServer )
|
||||
{
|
||||
_TerminateGameConnection( Self, unIPServer, usPortServer );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FTrackAppUsageEvent( IntPtr self, GameId gameID, int eAppUsageEvent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchExtraInfo );
|
||||
private FTrackAppUsageEvent _TrackAppUsageEvent;
|
||||
|
||||
#endregion
|
||||
internal void TrackAppUsageEvent( GameId gameID, int eAppUsageEvent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchExtraInfo )
|
||||
{
|
||||
_TrackAppUsageEvent( Self, gameID, eAppUsageEvent, pchExtraInfo );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUserDataFolder( IntPtr self, IntPtr pchBuffer, int cubBuffer );
|
||||
private FGetUserDataFolder _GetUserDataFolder;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserDataFolder( out string pchBuffer )
|
||||
{
|
||||
IntPtr mempchBuffer = Helpers.TakeMemory();
|
||||
var returnValue = _GetUserDataFolder( Self, mempchBuffer, (1024 * 32) );
|
||||
pchBuffer = Helpers.MemoryToString( mempchBuffer );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FStartVoiceRecording( IntPtr self );
|
||||
private FStartVoiceRecording _StartVoiceRecording;
|
||||
|
||||
#endregion
|
||||
internal void StartVoiceRecording()
|
||||
{
|
||||
_StartVoiceRecording( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FStopVoiceRecording( IntPtr self );
|
||||
private FStopVoiceRecording _StopVoiceRecording;
|
||||
|
||||
#endregion
|
||||
internal void StopVoiceRecording()
|
||||
{
|
||||
_StopVoiceRecording( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate VoiceResult FGetAvailableVoice( IntPtr self, ref uint pcbCompressed, ref uint pcbUncompressed_Deprecated, uint nUncompressedVoiceDesiredSampleRate_Deprecated );
|
||||
private FGetAvailableVoice _GetAvailableVoice;
|
||||
|
||||
#endregion
|
||||
internal VoiceResult GetAvailableVoice( ref uint pcbCompressed, ref uint pcbUncompressed_Deprecated, uint nUncompressedVoiceDesiredSampleRate_Deprecated )
|
||||
{
|
||||
var returnValue = _GetAvailableVoice( Self, ref pcbCompressed, ref pcbUncompressed_Deprecated, nUncompressedVoiceDesiredSampleRate_Deprecated );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate VoiceResult FGetVoice( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bWantCompressed, IntPtr pDestBuffer, uint cbDestBufferSize, ref uint nBytesWritten, [MarshalAs( UnmanagedType.U1 )] bool bWantUncompressed_Deprecated, IntPtr pUncompressedDestBuffer_Deprecated, uint cbUncompressedDestBufferSize_Deprecated, ref uint nUncompressBytesWritten_Deprecated, uint nUncompressedVoiceDesiredSampleRate_Deprecated );
|
||||
private FGetVoice _GetVoice;
|
||||
|
||||
#endregion
|
||||
internal VoiceResult GetVoice( [MarshalAs( UnmanagedType.U1 )] bool bWantCompressed, IntPtr pDestBuffer, uint cbDestBufferSize, ref uint nBytesWritten, [MarshalAs( UnmanagedType.U1 )] bool bWantUncompressed_Deprecated, IntPtr pUncompressedDestBuffer_Deprecated, uint cbUncompressedDestBufferSize_Deprecated, ref uint nUncompressBytesWritten_Deprecated, uint nUncompressedVoiceDesiredSampleRate_Deprecated )
|
||||
{
|
||||
var returnValue = _GetVoice( Self, bWantCompressed, pDestBuffer, cbDestBufferSize, ref nBytesWritten, bWantUncompressed_Deprecated, pUncompressedDestBuffer_Deprecated, cbUncompressedDestBufferSize_Deprecated, ref nUncompressBytesWritten_Deprecated, nUncompressedVoiceDesiredSampleRate_Deprecated );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate VoiceResult FDecompressVoice( IntPtr self, IntPtr pCompressed, uint cbCompressed, IntPtr pDestBuffer, uint cbDestBufferSize, ref uint nBytesWritten, uint nDesiredSampleRate );
|
||||
private FDecompressVoice _DecompressVoice;
|
||||
|
||||
#endregion
|
||||
internal VoiceResult DecompressVoice( IntPtr pCompressed, uint cbCompressed, IntPtr pDestBuffer, uint cbDestBufferSize, ref uint nBytesWritten, uint nDesiredSampleRate )
|
||||
{
|
||||
var returnValue = _DecompressVoice( Self, pCompressed, cbCompressed, pDestBuffer, cbDestBufferSize, ref nBytesWritten, nDesiredSampleRate );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetVoiceOptimalSampleRate( IntPtr self );
|
||||
private FGetVoiceOptimalSampleRate _GetVoiceOptimalSampleRate;
|
||||
|
||||
#endregion
|
||||
internal uint GetVoiceOptimalSampleRate()
|
||||
{
|
||||
var returnValue = _GetVoiceOptimalSampleRate( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate HAuthTicket FGetAuthSessionTicket( IntPtr self, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket );
|
||||
private FGetAuthSessionTicket _GetAuthSessionTicket;
|
||||
|
||||
#endregion
|
||||
internal HAuthTicket GetAuthSessionTicket( IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket )
|
||||
{
|
||||
var returnValue = _GetAuthSessionTicket( Self, pTicket, cbMaxTicket, ref pcbTicket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate BeginAuthResult FBeginAuthSession( IntPtr self, IntPtr pAuthTicket, int cbAuthTicket, SteamId steamID );
|
||||
private FBeginAuthSession _BeginAuthSession;
|
||||
|
||||
#endregion
|
||||
internal BeginAuthResult BeginAuthSession( IntPtr pAuthTicket, int cbAuthTicket, SteamId steamID )
|
||||
{
|
||||
var returnValue = _BeginAuthSession( Self, pAuthTicket, cbAuthTicket, steamID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FEndAuthSession( IntPtr self, SteamId steamID );
|
||||
private FEndAuthSession _EndAuthSession;
|
||||
|
||||
#endregion
|
||||
internal void EndAuthSession( SteamId steamID )
|
||||
{
|
||||
_EndAuthSession( Self, steamID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FCancelAuthTicket( IntPtr self, HAuthTicket hAuthTicket );
|
||||
private FCancelAuthTicket _CancelAuthTicket;
|
||||
|
||||
#endregion
|
||||
internal void CancelAuthTicket( HAuthTicket hAuthTicket )
|
||||
{
|
||||
_CancelAuthTicket( Self, hAuthTicket );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate UserHasLicenseForAppResult FUserHasLicenseForApp( IntPtr self, SteamId steamID, AppId appID );
|
||||
private FUserHasLicenseForApp _UserHasLicenseForApp;
|
||||
|
||||
#endregion
|
||||
internal UserHasLicenseForAppResult UserHasLicenseForApp( SteamId steamID, AppId appID )
|
||||
{
|
||||
var returnValue = _UserHasLicenseForApp( Self, steamID, appID );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsBehindNAT( IntPtr self );
|
||||
private FBIsBehindNAT _BIsBehindNAT;
|
||||
|
||||
#endregion
|
||||
internal bool BIsBehindNAT()
|
||||
{
|
||||
var returnValue = _BIsBehindNAT( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FAdvertiseGame( IntPtr self, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer );
|
||||
private FAdvertiseGame _AdvertiseGame;
|
||||
|
||||
#endregion
|
||||
internal void AdvertiseGame( SteamId steamIDGameServer, uint unIPServer, ushort usPortServer )
|
||||
{
|
||||
_AdvertiseGame( Self, steamIDGameServer, unIPServer, usPortServer );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestEncryptedAppTicket( IntPtr self, IntPtr pDataToInclude, int cbDataToInclude );
|
||||
private FRequestEncryptedAppTicket _RequestEncryptedAppTicket;
|
||||
|
||||
#endregion
|
||||
internal async Task<EncryptedAppTicketResponse_t?> RequestEncryptedAppTicket( IntPtr pDataToInclude, int cbDataToInclude )
|
||||
{
|
||||
var returnValue = _RequestEncryptedAppTicket( Self, pDataToInclude, cbDataToInclude );
|
||||
return await EncryptedAppTicketResponse_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetEncryptedAppTicket( IntPtr self, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket );
|
||||
private FGetEncryptedAppTicket _GetEncryptedAppTicket;
|
||||
|
||||
#endregion
|
||||
internal bool GetEncryptedAppTicket( IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket )
|
||||
{
|
||||
var returnValue = _GetEncryptedAppTicket( Self, pTicket, cbMaxTicket, ref pcbTicket );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetGameBadgeLevel( IntPtr self, int nSeries, [MarshalAs( UnmanagedType.U1 )] bool bFoil );
|
||||
private FGetGameBadgeLevel _GetGameBadgeLevel;
|
||||
|
||||
#endregion
|
||||
internal int GetGameBadgeLevel( int nSeries, [MarshalAs( UnmanagedType.U1 )] bool bFoil )
|
||||
{
|
||||
var returnValue = _GetGameBadgeLevel( Self, nSeries, bFoil );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetPlayerSteamLevel( IntPtr self );
|
||||
private FGetPlayerSteamLevel _GetPlayerSteamLevel;
|
||||
|
||||
#endregion
|
||||
internal int GetPlayerSteamLevel()
|
||||
{
|
||||
var returnValue = _GetPlayerSteamLevel( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestStoreAuthURL( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchRedirectURL );
|
||||
private FRequestStoreAuthURL _RequestStoreAuthURL;
|
||||
|
||||
#endregion
|
||||
internal async Task<StoreAuthURLResponse_t?> RequestStoreAuthURL( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchRedirectURL )
|
||||
{
|
||||
var returnValue = _RequestStoreAuthURL( Self, pchRedirectURL );
|
||||
return await StoreAuthURLResponse_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsPhoneVerified( IntPtr self );
|
||||
private FBIsPhoneVerified _BIsPhoneVerified;
|
||||
|
||||
#endregion
|
||||
internal bool BIsPhoneVerified()
|
||||
{
|
||||
var returnValue = _BIsPhoneVerified( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsTwoFactorEnabled( IntPtr self );
|
||||
private FBIsTwoFactorEnabled _BIsTwoFactorEnabled;
|
||||
|
||||
#endregion
|
||||
internal bool BIsTwoFactorEnabled()
|
||||
{
|
||||
var returnValue = _BIsTwoFactorEnabled( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsPhoneIdentifying( IntPtr self );
|
||||
private FBIsPhoneIdentifying _BIsPhoneIdentifying;
|
||||
|
||||
#endregion
|
||||
internal bool BIsPhoneIdentifying()
|
||||
{
|
||||
var returnValue = _BIsPhoneIdentifying( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBIsPhoneRequiringVerification( IntPtr self );
|
||||
private FBIsPhoneRequiringVerification _BIsPhoneRequiringVerification;
|
||||
|
||||
#endregion
|
||||
internal bool BIsPhoneRequiringVerification()
|
||||
{
|
||||
var returnValue = _BIsPhoneRequiringVerification( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FGetMarketEligibility( IntPtr self );
|
||||
private FGetMarketEligibility _GetMarketEligibility;
|
||||
|
||||
#endregion
|
||||
internal async Task<MarketEligibilityResponse_t?> GetMarketEligibility()
|
||||
{
|
||||
var returnValue = _GetMarketEligibility( Self );
|
||||
return await MarketEligibilityResponse_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,665 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamUserStats : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMUSERSTATS_INTERFACE_VERSION011";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_RequestCurrentStats = Marshal.GetDelegateForFunctionPointer<FRequestCurrentStats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_UpdateAvgRateStat = Marshal.GetDelegateForFunctionPointer<FUpdateAvgRateStat>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_GetAchievement = Marshal.GetDelegateForFunctionPointer<FGetAchievement>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_SetAchievement = Marshal.GetDelegateForFunctionPointer<FSetAchievement>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_ClearAchievement = Marshal.GetDelegateForFunctionPointer<FClearAchievement>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_GetAchievementAndUnlockTime = Marshal.GetDelegateForFunctionPointer<FGetAchievementAndUnlockTime>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_StoreStats = Marshal.GetDelegateForFunctionPointer<FStoreStats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_GetAchievementIcon = Marshal.GetDelegateForFunctionPointer<FGetAchievementIcon>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_GetAchievementDisplayAttribute = Marshal.GetDelegateForFunctionPointer<FGetAchievementDisplayAttribute>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_IndicateAchievementProgress = Marshal.GetDelegateForFunctionPointer<FIndicateAchievementProgress>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_GetNumAchievements = Marshal.GetDelegateForFunctionPointer<FGetNumAchievements>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_GetAchievementName = Marshal.GetDelegateForFunctionPointer<FGetAchievementName>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_RequestUserStats = Marshal.GetDelegateForFunctionPointer<FRequestUserStats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_GetUserAchievement = Marshal.GetDelegateForFunctionPointer<FGetUserAchievement>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_GetUserAchievementAndUnlockTime = Marshal.GetDelegateForFunctionPointer<FGetUserAchievementAndUnlockTime>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_ResetAllStats = Marshal.GetDelegateForFunctionPointer<FResetAllStats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_FindOrCreateLeaderboard = Marshal.GetDelegateForFunctionPointer<FFindOrCreateLeaderboard>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_FindLeaderboard = Marshal.GetDelegateForFunctionPointer<FFindLeaderboard>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_GetLeaderboardName = Marshal.GetDelegateForFunctionPointer<FGetLeaderboardName>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_GetLeaderboardEntryCount = Marshal.GetDelegateForFunctionPointer<FGetLeaderboardEntryCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_GetLeaderboardSortMethod = Marshal.GetDelegateForFunctionPointer<FGetLeaderboardSortMethod>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_GetLeaderboardDisplayType = Marshal.GetDelegateForFunctionPointer<FGetLeaderboardDisplayType>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_DownloadLeaderboardEntries = Marshal.GetDelegateForFunctionPointer<FDownloadLeaderboardEntries>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
_DownloadLeaderboardEntriesForUsers = Marshal.GetDelegateForFunctionPointer<FDownloadLeaderboardEntriesForUsers>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 232 ) ) );
|
||||
_GetDownloadedLeaderboardEntry = Marshal.GetDelegateForFunctionPointer<FGetDownloadedLeaderboardEntry>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 240 ) ) );
|
||||
_UploadLeaderboardScore = Marshal.GetDelegateForFunctionPointer<FUploadLeaderboardScore>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 248 ) ) );
|
||||
_AttachLeaderboardUGC = Marshal.GetDelegateForFunctionPointer<FAttachLeaderboardUGC>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 256 ) ) );
|
||||
_GetNumberOfCurrentPlayers = Marshal.GetDelegateForFunctionPointer<FGetNumberOfCurrentPlayers>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 264 ) ) );
|
||||
_RequestGlobalAchievementPercentages = Marshal.GetDelegateForFunctionPointer<FRequestGlobalAchievementPercentages>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 272 ) ) );
|
||||
_GetMostAchievedAchievementInfo = Marshal.GetDelegateForFunctionPointer<FGetMostAchievedAchievementInfo>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 280 ) ) );
|
||||
_GetNextMostAchievedAchievementInfo = Marshal.GetDelegateForFunctionPointer<FGetNextMostAchievedAchievementInfo>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 288 ) ) );
|
||||
_GetAchievementAchievedPercent = Marshal.GetDelegateForFunctionPointer<FGetAchievementAchievedPercent>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 296 ) ) );
|
||||
_RequestGlobalStats = Marshal.GetDelegateForFunctionPointer<FRequestGlobalStats>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 304 ) ) );
|
||||
|
||||
#if PLATFORM_WIN
|
||||
_GetStat1 = Marshal.GetDelegateForFunctionPointer<FGetStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_GetStat2 = Marshal.GetDelegateForFunctionPointer<FGetStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_SetStat1 = Marshal.GetDelegateForFunctionPointer<FSetStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_SetStat2 = Marshal.GetDelegateForFunctionPointer<FSetStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_GetUserStat1 = Marshal.GetDelegateForFunctionPointer<FGetUserStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_GetUserStat2 = Marshal.GetDelegateForFunctionPointer<FGetUserStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_GetGlobalStat1 = Marshal.GetDelegateForFunctionPointer<FGetGlobalStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 320 ) ) );
|
||||
_GetGlobalStat2 = Marshal.GetDelegateForFunctionPointer<FGetGlobalStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 312 ) ) );
|
||||
_GetGlobalStatHistory1 = Marshal.GetDelegateForFunctionPointer<FGetGlobalStatHistory1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 336 ) ) );
|
||||
_GetGlobalStatHistory2 = Marshal.GetDelegateForFunctionPointer<FGetGlobalStatHistory2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 328 ) ) );
|
||||
#else
|
||||
_GetStat1 = Marshal.GetDelegateForFunctionPointer<FGetStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_GetStat2 = Marshal.GetDelegateForFunctionPointer<FGetStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_SetStat1 = Marshal.GetDelegateForFunctionPointer<FSetStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_SetStat2 = Marshal.GetDelegateForFunctionPointer<FSetStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_GetUserStat1 = Marshal.GetDelegateForFunctionPointer<FGetUserStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_GetUserStat2 = Marshal.GetDelegateForFunctionPointer<FGetUserStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_GetGlobalStat1 = Marshal.GetDelegateForFunctionPointer<FGetGlobalStat1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 312 ) ) );
|
||||
_GetGlobalStat2 = Marshal.GetDelegateForFunctionPointer<FGetGlobalStat2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 320 ) ) );
|
||||
_GetGlobalStatHistory1 = Marshal.GetDelegateForFunctionPointer<FGetGlobalStatHistory1>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 328 ) ) );
|
||||
_GetGlobalStatHistory2 = Marshal.GetDelegateForFunctionPointer<FGetGlobalStatHistory2>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 336 ) ) );
|
||||
#endif
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_RequestCurrentStats = null;
|
||||
_GetStat1 = null;
|
||||
_GetStat2 = null;
|
||||
_SetStat1 = null;
|
||||
_SetStat2 = null;
|
||||
_UpdateAvgRateStat = null;
|
||||
_GetAchievement = null;
|
||||
_SetAchievement = null;
|
||||
_ClearAchievement = null;
|
||||
_GetAchievementAndUnlockTime = null;
|
||||
_StoreStats = null;
|
||||
_GetAchievementIcon = null;
|
||||
_GetAchievementDisplayAttribute = null;
|
||||
_IndicateAchievementProgress = null;
|
||||
_GetNumAchievements = null;
|
||||
_GetAchievementName = null;
|
||||
_RequestUserStats = null;
|
||||
_GetUserStat1 = null;
|
||||
_GetUserStat2 = null;
|
||||
_GetUserAchievement = null;
|
||||
_GetUserAchievementAndUnlockTime = null;
|
||||
_ResetAllStats = null;
|
||||
_FindOrCreateLeaderboard = null;
|
||||
_FindLeaderboard = null;
|
||||
_GetLeaderboardName = null;
|
||||
_GetLeaderboardEntryCount = null;
|
||||
_GetLeaderboardSortMethod = null;
|
||||
_GetLeaderboardDisplayType = null;
|
||||
_DownloadLeaderboardEntries = null;
|
||||
_DownloadLeaderboardEntriesForUsers = null;
|
||||
_GetDownloadedLeaderboardEntry = null;
|
||||
_UploadLeaderboardScore = null;
|
||||
_AttachLeaderboardUGC = null;
|
||||
_GetNumberOfCurrentPlayers = null;
|
||||
_RequestGlobalAchievementPercentages = null;
|
||||
_GetMostAchievedAchievementInfo = null;
|
||||
_GetNextMostAchievedAchievementInfo = null;
|
||||
_GetAchievementAchievedPercent = null;
|
||||
_RequestGlobalStats = null;
|
||||
_GetGlobalStat1 = null;
|
||||
_GetGlobalStat2 = null;
|
||||
_GetGlobalStatHistory1 = null;
|
||||
_GetGlobalStatHistory2 = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FRequestCurrentStats( IntPtr self );
|
||||
private FRequestCurrentStats _RequestCurrentStats;
|
||||
|
||||
#endregion
|
||||
internal bool RequestCurrentStats()
|
||||
{
|
||||
var returnValue = _RequestCurrentStats( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetStat1( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref int pData );
|
||||
private FGetStat1 _GetStat1;
|
||||
|
||||
#endregion
|
||||
internal bool GetStat1( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref int pData )
|
||||
{
|
||||
var returnValue = _GetStat1( Self, pchName, ref pData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetStat2( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pData );
|
||||
private FGetStat2 _GetStat2;
|
||||
|
||||
#endregion
|
||||
internal bool GetStat2( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pData )
|
||||
{
|
||||
var returnValue = _GetStat2( Self, pchName, ref pData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetStat1( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, int nData );
|
||||
private FSetStat1 _SetStat1;
|
||||
|
||||
#endregion
|
||||
internal bool SetStat1( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, int nData )
|
||||
{
|
||||
var returnValue = _SetStat1( Self, pchName, nData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetStat2( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float fData );
|
||||
private FSetStat2 _SetStat2;
|
||||
|
||||
#endregion
|
||||
internal bool SetStat2( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float fData )
|
||||
{
|
||||
var returnValue = _SetStat2( Self, pchName, fData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FUpdateAvgRateStat( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float flCountThisSession, double dSessionLength );
|
||||
private FUpdateAvgRateStat _UpdateAvgRateStat;
|
||||
|
||||
#endregion
|
||||
internal bool UpdateAvgRateStat( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float flCountThisSession, double dSessionLength )
|
||||
{
|
||||
var returnValue = _UpdateAvgRateStat( Self, pchName, flCountThisSession, dSessionLength );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetAchievement( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved );
|
||||
private FGetAchievement _GetAchievement;
|
||||
|
||||
#endregion
|
||||
internal bool GetAchievement( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved )
|
||||
{
|
||||
var returnValue = _GetAchievement( Self, pchName, ref pbAchieved );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FSetAchievement( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName );
|
||||
private FSetAchievement _SetAchievement;
|
||||
|
||||
#endregion
|
||||
internal bool SetAchievement( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName )
|
||||
{
|
||||
var returnValue = _SetAchievement( Self, pchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FClearAchievement( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName );
|
||||
private FClearAchievement _ClearAchievement;
|
||||
|
||||
#endregion
|
||||
internal bool ClearAchievement( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName )
|
||||
{
|
||||
var returnValue = _ClearAchievement( Self, pchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetAchievementAndUnlockTime( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved, ref uint punUnlockTime );
|
||||
private FGetAchievementAndUnlockTime _GetAchievementAndUnlockTime;
|
||||
|
||||
#endregion
|
||||
internal bool GetAchievementAndUnlockTime( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved, ref uint punUnlockTime )
|
||||
{
|
||||
var returnValue = _GetAchievementAndUnlockTime( Self, pchName, ref pbAchieved, ref punUnlockTime );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FStoreStats( IntPtr self );
|
||||
private FStoreStats _StoreStats;
|
||||
|
||||
#endregion
|
||||
internal bool StoreStats()
|
||||
{
|
||||
var returnValue = _StoreStats( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetAchievementIcon( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName );
|
||||
private FGetAchievementIcon _GetAchievementIcon;
|
||||
|
||||
#endregion
|
||||
internal int GetAchievementIcon( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName )
|
||||
{
|
||||
var returnValue = _GetAchievementIcon( Self, pchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetAchievementDisplayAttribute( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey );
|
||||
private FGetAchievementDisplayAttribute _GetAchievementDisplayAttribute;
|
||||
|
||||
#endregion
|
||||
internal string GetAchievementDisplayAttribute( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey )
|
||||
{
|
||||
var returnValue = _GetAchievementDisplayAttribute( Self, pchName, pchKey );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIndicateAchievementProgress( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, uint nCurProgress, uint nMaxProgress );
|
||||
private FIndicateAchievementProgress _IndicateAchievementProgress;
|
||||
|
||||
#endregion
|
||||
internal bool IndicateAchievementProgress( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, uint nCurProgress, uint nMaxProgress )
|
||||
{
|
||||
var returnValue = _IndicateAchievementProgress( Self, pchName, nCurProgress, nMaxProgress );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetNumAchievements( IntPtr self );
|
||||
private FGetNumAchievements _GetNumAchievements;
|
||||
|
||||
#endregion
|
||||
internal uint GetNumAchievements()
|
||||
{
|
||||
var returnValue = _GetNumAchievements( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetAchievementName( IntPtr self, uint iAchievement );
|
||||
private FGetAchievementName _GetAchievementName;
|
||||
|
||||
#endregion
|
||||
internal string GetAchievementName( uint iAchievement )
|
||||
{
|
||||
var returnValue = _GetAchievementName( Self, iAchievement );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestUserStats( IntPtr self, SteamId steamIDUser );
|
||||
private FRequestUserStats _RequestUserStats;
|
||||
|
||||
#endregion
|
||||
internal async Task<UserStatsReceived_t?> RequestUserStats( SteamId steamIDUser )
|
||||
{
|
||||
var returnValue = _RequestUserStats( Self, steamIDUser );
|
||||
return await UserStatsReceived_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUserStat1( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref int pData );
|
||||
private FGetUserStat1 _GetUserStat1;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserStat1( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref int pData )
|
||||
{
|
||||
var returnValue = _GetUserStat1( Self, steamIDUser, pchName, ref pData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUserStat2( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pData );
|
||||
private FGetUserStat2 _GetUserStat2;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserStat2( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pData )
|
||||
{
|
||||
var returnValue = _GetUserStat2( Self, steamIDUser, pchName, ref pData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUserAchievement( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved );
|
||||
private FGetUserAchievement _GetUserAchievement;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserAchievement( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved )
|
||||
{
|
||||
var returnValue = _GetUserAchievement( Self, steamIDUser, pchName, ref pbAchieved );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetUserAchievementAndUnlockTime( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved, ref uint punUnlockTime );
|
||||
private FGetUserAchievementAndUnlockTime _GetUserAchievementAndUnlockTime;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserAchievementAndUnlockTime( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved, ref uint punUnlockTime )
|
||||
{
|
||||
var returnValue = _GetUserAchievementAndUnlockTime( Self, steamIDUser, pchName, ref pbAchieved, ref punUnlockTime );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FResetAllStats( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bAchievementsToo );
|
||||
private FResetAllStats _ResetAllStats;
|
||||
|
||||
#endregion
|
||||
internal bool ResetAllStats( [MarshalAs( UnmanagedType.U1 )] bool bAchievementsToo )
|
||||
{
|
||||
var returnValue = _ResetAllStats( Self, bAchievementsToo );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FFindOrCreateLeaderboard( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName, LeaderboardSort eLeaderboardSortMethod, LeaderboardDisplay eLeaderboardDisplayType );
|
||||
private FFindOrCreateLeaderboard _FindOrCreateLeaderboard;
|
||||
|
||||
#endregion
|
||||
internal async Task<LeaderboardFindResult_t?> FindOrCreateLeaderboard( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName, LeaderboardSort eLeaderboardSortMethod, LeaderboardDisplay eLeaderboardDisplayType )
|
||||
{
|
||||
var returnValue = _FindOrCreateLeaderboard( Self, pchLeaderboardName, eLeaderboardSortMethod, eLeaderboardDisplayType );
|
||||
return await LeaderboardFindResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FFindLeaderboard( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName );
|
||||
private FFindLeaderboard _FindLeaderboard;
|
||||
|
||||
#endregion
|
||||
internal async Task<LeaderboardFindResult_t?> FindLeaderboard( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName )
|
||||
{
|
||||
var returnValue = _FindLeaderboard( Self, pchLeaderboardName );
|
||||
return await LeaderboardFindResult_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetLeaderboardName( IntPtr self, SteamLeaderboard_t hSteamLeaderboard );
|
||||
private FGetLeaderboardName _GetLeaderboardName;
|
||||
|
||||
#endregion
|
||||
internal string GetLeaderboardName( SteamLeaderboard_t hSteamLeaderboard )
|
||||
{
|
||||
var returnValue = _GetLeaderboardName( Self, hSteamLeaderboard );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetLeaderboardEntryCount( IntPtr self, SteamLeaderboard_t hSteamLeaderboard );
|
||||
private FGetLeaderboardEntryCount _GetLeaderboardEntryCount;
|
||||
|
||||
#endregion
|
||||
internal int GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard )
|
||||
{
|
||||
var returnValue = _GetLeaderboardEntryCount( Self, hSteamLeaderboard );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate LeaderboardSort FGetLeaderboardSortMethod( IntPtr self, SteamLeaderboard_t hSteamLeaderboard );
|
||||
private FGetLeaderboardSortMethod _GetLeaderboardSortMethod;
|
||||
|
||||
#endregion
|
||||
internal LeaderboardSort GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard )
|
||||
{
|
||||
var returnValue = _GetLeaderboardSortMethod( Self, hSteamLeaderboard );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate LeaderboardDisplay FGetLeaderboardDisplayType( IntPtr self, SteamLeaderboard_t hSteamLeaderboard );
|
||||
private FGetLeaderboardDisplayType _GetLeaderboardDisplayType;
|
||||
|
||||
#endregion
|
||||
internal LeaderboardDisplay GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard )
|
||||
{
|
||||
var returnValue = _GetLeaderboardDisplayType( Self, hSteamLeaderboard );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FDownloadLeaderboardEntries( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, LeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd );
|
||||
private FDownloadLeaderboardEntries _DownloadLeaderboardEntries;
|
||||
|
||||
#endregion
|
||||
internal async Task<LeaderboardScoresDownloaded_t?> DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, LeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd )
|
||||
{
|
||||
var returnValue = _DownloadLeaderboardEntries( Self, hSteamLeaderboard, eLeaderboardDataRequest, nRangeStart, nRangeEnd );
|
||||
return await LeaderboardScoresDownloaded_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FDownloadLeaderboardEntriesForUsers( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers );
|
||||
private FDownloadLeaderboardEntriesForUsers _DownloadLeaderboardEntriesForUsers;
|
||||
|
||||
#endregion
|
||||
internal async Task<LeaderboardScoresDownloaded_t?> DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers )
|
||||
{
|
||||
var returnValue = _DownloadLeaderboardEntriesForUsers( Self, hSteamLeaderboard, prgUsers, cUsers );
|
||||
return await LeaderboardScoresDownloaded_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetDownloadedLeaderboardEntry( IntPtr self, SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, ref LeaderboardEntry_t pLeaderboardEntry, [In,Out] int[] pDetails, int cDetailsMax );
|
||||
private FGetDownloadedLeaderboardEntry _GetDownloadedLeaderboardEntry;
|
||||
|
||||
#endregion
|
||||
internal bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, ref LeaderboardEntry_t pLeaderboardEntry, [In,Out] int[] pDetails, int cDetailsMax )
|
||||
{
|
||||
var returnValue = _GetDownloadedLeaderboardEntry( Self, hSteamLeaderboardEntries, index, ref pLeaderboardEntry, pDetails, cDetailsMax );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FUploadLeaderboardScore( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, LeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, [In,Out] int[] pScoreDetails, int cScoreDetailsCount );
|
||||
private FUploadLeaderboardScore _UploadLeaderboardScore;
|
||||
|
||||
#endregion
|
||||
internal async Task<LeaderboardScoreUploaded_t?> UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, LeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, [In,Out] int[] pScoreDetails, int cScoreDetailsCount )
|
||||
{
|
||||
var returnValue = _UploadLeaderboardScore( Self, hSteamLeaderboard, eLeaderboardUploadScoreMethod, nScore, pScoreDetails, cScoreDetailsCount );
|
||||
return await LeaderboardScoreUploaded_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FAttachLeaderboardUGC( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC );
|
||||
private FAttachLeaderboardUGC _AttachLeaderboardUGC;
|
||||
|
||||
#endregion
|
||||
internal async Task<LeaderboardUGCSet_t?> AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC )
|
||||
{
|
||||
var returnValue = _AttachLeaderboardUGC( Self, hSteamLeaderboard, hUGC );
|
||||
return await LeaderboardUGCSet_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FGetNumberOfCurrentPlayers( IntPtr self );
|
||||
private FGetNumberOfCurrentPlayers _GetNumberOfCurrentPlayers;
|
||||
|
||||
#endregion
|
||||
internal async Task<NumberOfCurrentPlayers_t?> GetNumberOfCurrentPlayers()
|
||||
{
|
||||
var returnValue = _GetNumberOfCurrentPlayers( Self );
|
||||
return await NumberOfCurrentPlayers_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestGlobalAchievementPercentages( IntPtr self );
|
||||
private FRequestGlobalAchievementPercentages _RequestGlobalAchievementPercentages;
|
||||
|
||||
#endregion
|
||||
internal async Task<GlobalAchievementPercentagesReady_t?> RequestGlobalAchievementPercentages()
|
||||
{
|
||||
var returnValue = _RequestGlobalAchievementPercentages( Self );
|
||||
return await GlobalAchievementPercentagesReady_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetMostAchievedAchievementInfo( IntPtr self, IntPtr pchName, uint unNameBufLen, ref float pflPercent, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved );
|
||||
private FGetMostAchievedAchievementInfo _GetMostAchievedAchievementInfo;
|
||||
|
||||
#endregion
|
||||
internal int GetMostAchievedAchievementInfo( out string pchName, ref float pflPercent, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved )
|
||||
{
|
||||
IntPtr mempchName = Helpers.TakeMemory();
|
||||
var returnValue = _GetMostAchievedAchievementInfo( Self, mempchName, (1024 * 32), ref pflPercent, ref pbAchieved );
|
||||
pchName = Helpers.MemoryToString( mempchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetNextMostAchievedAchievementInfo( IntPtr self, int iIteratorPrevious, IntPtr pchName, uint unNameBufLen, ref float pflPercent, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved );
|
||||
private FGetNextMostAchievedAchievementInfo _GetNextMostAchievedAchievementInfo;
|
||||
|
||||
#endregion
|
||||
internal int GetNextMostAchievedAchievementInfo( int iIteratorPrevious, out string pchName, ref float pflPercent, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved )
|
||||
{
|
||||
IntPtr mempchName = Helpers.TakeMemory();
|
||||
var returnValue = _GetNextMostAchievedAchievementInfo( Self, iIteratorPrevious, mempchName, (1024 * 32), ref pflPercent, ref pbAchieved );
|
||||
pchName = Helpers.MemoryToString( mempchName );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetAchievementAchievedPercent( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pflPercent );
|
||||
private FGetAchievementAchievedPercent _GetAchievementAchievedPercent;
|
||||
|
||||
#endregion
|
||||
internal bool GetAchievementAchievedPercent( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pflPercent )
|
||||
{
|
||||
var returnValue = _GetAchievementAchievedPercent( Self, pchName, ref pflPercent );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FRequestGlobalStats( IntPtr self, int nHistoryDays );
|
||||
private FRequestGlobalStats _RequestGlobalStats;
|
||||
|
||||
#endregion
|
||||
internal async Task<GlobalStatsReceived_t?> RequestGlobalStats( int nHistoryDays )
|
||||
{
|
||||
var returnValue = _RequestGlobalStats( Self, nHistoryDays );
|
||||
return await GlobalStatsReceived_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetGlobalStat1( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchStatName, ref long pData );
|
||||
private FGetGlobalStat1 _GetGlobalStat1;
|
||||
|
||||
#endregion
|
||||
internal bool GetGlobalStat1( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchStatName, ref long pData )
|
||||
{
|
||||
var returnValue = _GetGlobalStat1( Self, pchStatName, ref pData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetGlobalStat2( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchStatName, ref double pData );
|
||||
private FGetGlobalStat2 _GetGlobalStat2;
|
||||
|
||||
#endregion
|
||||
internal bool GetGlobalStat2( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchStatName, ref double pData )
|
||||
{
|
||||
var returnValue = _GetGlobalStat2( Self, pchStatName, ref pData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetGlobalStatHistory1( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchStatName, [In,Out] long[] pData, uint cubData );
|
||||
private FGetGlobalStatHistory1 _GetGlobalStatHistory1;
|
||||
|
||||
#endregion
|
||||
internal int GetGlobalStatHistory1( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchStatName, [In,Out] long[] pData, uint cubData )
|
||||
{
|
||||
var returnValue = _GetGlobalStatHistory1( Self, pchStatName, pData, cubData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate int FGetGlobalStatHistory2( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchStatName, [In,Out] double[] pData, uint cubData );
|
||||
private FGetGlobalStatHistory2 _GetGlobalStatHistory2;
|
||||
|
||||
#endregion
|
||||
internal int GetGlobalStatHistory2( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchStatName, [In,Out] double[] pData, uint cubData )
|
||||
{
|
||||
var returnValue = _GetGlobalStatHistory2( Self, pchStatName, pData, cubData );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,452 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamUtils : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "SteamUtils009";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_GetSecondsSinceAppActive = Marshal.GetDelegateForFunctionPointer<FGetSecondsSinceAppActive>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_GetSecondsSinceComputerActive = Marshal.GetDelegateForFunctionPointer<FGetSecondsSinceComputerActive>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_GetConnectedUniverse = Marshal.GetDelegateForFunctionPointer<FGetConnectedUniverse>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_GetServerRealTime = Marshal.GetDelegateForFunctionPointer<FGetServerRealTime>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
_GetIPCountry = Marshal.GetDelegateForFunctionPointer<FGetIPCountry>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 32 ) ) );
|
||||
_GetImageSize = Marshal.GetDelegateForFunctionPointer<FGetImageSize>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 40 ) ) );
|
||||
_GetImageRGBA = Marshal.GetDelegateForFunctionPointer<FGetImageRGBA>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 48 ) ) );
|
||||
_GetCSERIPPort = Marshal.GetDelegateForFunctionPointer<FGetCSERIPPort>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 56 ) ) );
|
||||
_GetCurrentBatteryPower = Marshal.GetDelegateForFunctionPointer<FGetCurrentBatteryPower>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 64 ) ) );
|
||||
_GetAppID = Marshal.GetDelegateForFunctionPointer<FGetAppID>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 72 ) ) );
|
||||
_SetOverlayNotificationPosition = Marshal.GetDelegateForFunctionPointer<FSetOverlayNotificationPosition>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 80 ) ) );
|
||||
_IsAPICallCompleted = Marshal.GetDelegateForFunctionPointer<FIsAPICallCompleted>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 88 ) ) );
|
||||
_GetAPICallFailureReason = Marshal.GetDelegateForFunctionPointer<FGetAPICallFailureReason>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 96 ) ) );
|
||||
_GetAPICallResult = Marshal.GetDelegateForFunctionPointer<FGetAPICallResult>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 104 ) ) );
|
||||
_RunFrame = Marshal.GetDelegateForFunctionPointer<FRunFrame>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 112 ) ) );
|
||||
_GetIPCCallCount = Marshal.GetDelegateForFunctionPointer<FGetIPCCallCount>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 120 ) ) );
|
||||
_SetWarningMessageHook = Marshal.GetDelegateForFunctionPointer<FSetWarningMessageHook>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 128 ) ) );
|
||||
_IsOverlayEnabled = Marshal.GetDelegateForFunctionPointer<FIsOverlayEnabled>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 136 ) ) );
|
||||
_BOverlayNeedsPresent = Marshal.GetDelegateForFunctionPointer<FBOverlayNeedsPresent>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 144 ) ) );
|
||||
_CheckFileSignature = Marshal.GetDelegateForFunctionPointer<FCheckFileSignature>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 152 ) ) );
|
||||
_ShowGamepadTextInput = Marshal.GetDelegateForFunctionPointer<FShowGamepadTextInput>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 160 ) ) );
|
||||
_GetEnteredGamepadTextLength = Marshal.GetDelegateForFunctionPointer<FGetEnteredGamepadTextLength>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 168 ) ) );
|
||||
_GetEnteredGamepadTextInput = Marshal.GetDelegateForFunctionPointer<FGetEnteredGamepadTextInput>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 176 ) ) );
|
||||
_GetSteamUILanguage = Marshal.GetDelegateForFunctionPointer<FGetSteamUILanguage>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 184 ) ) );
|
||||
_IsSteamRunningInVR = Marshal.GetDelegateForFunctionPointer<FIsSteamRunningInVR>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 192 ) ) );
|
||||
_SetOverlayNotificationInset = Marshal.GetDelegateForFunctionPointer<FSetOverlayNotificationInset>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 200 ) ) );
|
||||
_IsSteamInBigPictureMode = Marshal.GetDelegateForFunctionPointer<FIsSteamInBigPictureMode>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 208 ) ) );
|
||||
_StartVRDashboard = Marshal.GetDelegateForFunctionPointer<FStartVRDashboard>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 216 ) ) );
|
||||
_IsVRHeadsetStreamingEnabled = Marshal.GetDelegateForFunctionPointer<FIsVRHeadsetStreamingEnabled>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 224 ) ) );
|
||||
_SetVRHeadsetStreamingEnabled = Marshal.GetDelegateForFunctionPointer<FSetVRHeadsetStreamingEnabled>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 232 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_GetSecondsSinceAppActive = null;
|
||||
_GetSecondsSinceComputerActive = null;
|
||||
_GetConnectedUniverse = null;
|
||||
_GetServerRealTime = null;
|
||||
_GetIPCountry = null;
|
||||
_GetImageSize = null;
|
||||
_GetImageRGBA = null;
|
||||
_GetCSERIPPort = null;
|
||||
_GetCurrentBatteryPower = null;
|
||||
_GetAppID = null;
|
||||
_SetOverlayNotificationPosition = null;
|
||||
_IsAPICallCompleted = null;
|
||||
_GetAPICallFailureReason = null;
|
||||
_GetAPICallResult = null;
|
||||
_RunFrame = null;
|
||||
_GetIPCCallCount = null;
|
||||
_SetWarningMessageHook = null;
|
||||
_IsOverlayEnabled = null;
|
||||
_BOverlayNeedsPresent = null;
|
||||
_CheckFileSignature = null;
|
||||
_ShowGamepadTextInput = null;
|
||||
_GetEnteredGamepadTextLength = null;
|
||||
_GetEnteredGamepadTextInput = null;
|
||||
_GetSteamUILanguage = null;
|
||||
_IsSteamRunningInVR = null;
|
||||
_SetOverlayNotificationInset = null;
|
||||
_IsSteamInBigPictureMode = null;
|
||||
_StartVRDashboard = null;
|
||||
_IsVRHeadsetStreamingEnabled = null;
|
||||
_SetVRHeadsetStreamingEnabled = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetSecondsSinceAppActive( IntPtr self );
|
||||
private FGetSecondsSinceAppActive _GetSecondsSinceAppActive;
|
||||
|
||||
#endregion
|
||||
internal uint GetSecondsSinceAppActive()
|
||||
{
|
||||
var returnValue = _GetSecondsSinceAppActive( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetSecondsSinceComputerActive( IntPtr self );
|
||||
private FGetSecondsSinceComputerActive _GetSecondsSinceComputerActive;
|
||||
|
||||
#endregion
|
||||
internal uint GetSecondsSinceComputerActive()
|
||||
{
|
||||
var returnValue = _GetSecondsSinceComputerActive( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Universe FGetConnectedUniverse( IntPtr self );
|
||||
private FGetConnectedUniverse _GetConnectedUniverse;
|
||||
|
||||
#endregion
|
||||
internal Universe GetConnectedUniverse()
|
||||
{
|
||||
var returnValue = _GetConnectedUniverse( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetServerRealTime( IntPtr self );
|
||||
private FGetServerRealTime _GetServerRealTime;
|
||||
|
||||
#endregion
|
||||
internal uint GetServerRealTime()
|
||||
{
|
||||
var returnValue = _GetServerRealTime( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetIPCountry( IntPtr self );
|
||||
private FGetIPCountry _GetIPCountry;
|
||||
|
||||
#endregion
|
||||
internal string GetIPCountry()
|
||||
{
|
||||
var returnValue = _GetIPCountry( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetImageSize( IntPtr self, int iImage, ref uint pnWidth, ref uint pnHeight );
|
||||
private FGetImageSize _GetImageSize;
|
||||
|
||||
#endregion
|
||||
internal bool GetImageSize( int iImage, ref uint pnWidth, ref uint pnHeight )
|
||||
{
|
||||
var returnValue = _GetImageSize( Self, iImage, ref pnWidth, ref pnHeight );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetImageRGBA( IntPtr self, int iImage, [In,Out] byte[] pubDest, int nDestBufferSize );
|
||||
private FGetImageRGBA _GetImageRGBA;
|
||||
|
||||
#endregion
|
||||
internal bool GetImageRGBA( int iImage, [In,Out] byte[] pubDest, int nDestBufferSize )
|
||||
{
|
||||
var returnValue = _GetImageRGBA( Self, iImage, pubDest, nDestBufferSize );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetCSERIPPort( IntPtr self, ref uint unIP, ref ushort usPort );
|
||||
private FGetCSERIPPort _GetCSERIPPort;
|
||||
|
||||
#endregion
|
||||
internal bool GetCSERIPPort( ref uint unIP, ref ushort usPort )
|
||||
{
|
||||
var returnValue = _GetCSERIPPort( Self, ref unIP, ref usPort );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate byte FGetCurrentBatteryPower( IntPtr self );
|
||||
private FGetCurrentBatteryPower _GetCurrentBatteryPower;
|
||||
|
||||
#endregion
|
||||
internal byte GetCurrentBatteryPower()
|
||||
{
|
||||
var returnValue = _GetCurrentBatteryPower( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetAppID( IntPtr self );
|
||||
private FGetAppID _GetAppID;
|
||||
|
||||
#endregion
|
||||
internal uint GetAppID()
|
||||
{
|
||||
var returnValue = _GetAppID( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetOverlayNotificationPosition( IntPtr self, NotificationPosition eNotificationPosition );
|
||||
private FSetOverlayNotificationPosition _SetOverlayNotificationPosition;
|
||||
|
||||
#endregion
|
||||
internal void SetOverlayNotificationPosition( NotificationPosition eNotificationPosition )
|
||||
{
|
||||
_SetOverlayNotificationPosition( Self, eNotificationPosition );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsAPICallCompleted( IntPtr self, SteamAPICall_t hSteamAPICall, [MarshalAs( UnmanagedType.U1 )] ref bool pbFailed );
|
||||
private FIsAPICallCompleted _IsAPICallCompleted;
|
||||
|
||||
#endregion
|
||||
internal bool IsAPICallCompleted( SteamAPICall_t hSteamAPICall, [MarshalAs( UnmanagedType.U1 )] ref bool pbFailed )
|
||||
{
|
||||
var returnValue = _IsAPICallCompleted( Self, hSteamAPICall, ref pbFailed );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICallFailure FGetAPICallFailureReason( IntPtr self, SteamAPICall_t hSteamAPICall );
|
||||
private FGetAPICallFailureReason _GetAPICallFailureReason;
|
||||
|
||||
#endregion
|
||||
internal SteamAPICallFailure GetAPICallFailureReason( SteamAPICall_t hSteamAPICall )
|
||||
{
|
||||
var returnValue = _GetAPICallFailureReason( Self, hSteamAPICall );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetAPICallResult( IntPtr self, SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, [MarshalAs( UnmanagedType.U1 )] ref bool pbFailed );
|
||||
private FGetAPICallResult _GetAPICallResult;
|
||||
|
||||
#endregion
|
||||
internal bool GetAPICallResult( SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, [MarshalAs( UnmanagedType.U1 )] ref bool pbFailed )
|
||||
{
|
||||
var returnValue = _GetAPICallResult( Self, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, ref pbFailed );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FRunFrame( IntPtr self );
|
||||
private FRunFrame _RunFrame;
|
||||
|
||||
#endregion
|
||||
internal void RunFrame()
|
||||
{
|
||||
_RunFrame( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetIPCCallCount( IntPtr self );
|
||||
private FGetIPCCallCount _GetIPCCallCount;
|
||||
|
||||
#endregion
|
||||
internal uint GetIPCCallCount()
|
||||
{
|
||||
var returnValue = _GetIPCCallCount( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetWarningMessageHook( IntPtr self, IntPtr pFunction );
|
||||
private FSetWarningMessageHook _SetWarningMessageHook;
|
||||
|
||||
#endregion
|
||||
internal void SetWarningMessageHook( IntPtr pFunction )
|
||||
{
|
||||
_SetWarningMessageHook( Self, pFunction );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsOverlayEnabled( IntPtr self );
|
||||
private FIsOverlayEnabled _IsOverlayEnabled;
|
||||
|
||||
#endregion
|
||||
internal bool IsOverlayEnabled()
|
||||
{
|
||||
var returnValue = _IsOverlayEnabled( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FBOverlayNeedsPresent( IntPtr self );
|
||||
private FBOverlayNeedsPresent _BOverlayNeedsPresent;
|
||||
|
||||
#endregion
|
||||
internal bool BOverlayNeedsPresent()
|
||||
{
|
||||
var returnValue = _BOverlayNeedsPresent( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate SteamAPICall_t FCheckFileSignature( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string szFileName );
|
||||
private FCheckFileSignature _CheckFileSignature;
|
||||
|
||||
#endregion
|
||||
internal async Task<CheckFileSignature_t?> CheckFileSignature( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string szFileName )
|
||||
{
|
||||
var returnValue = _CheckFileSignature( Self, szFileName );
|
||||
return await CheckFileSignature_t.GetResultAsync( returnValue );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FShowGamepadTextInput( IntPtr self, GamepadTextInputMode eInputMode, GamepadTextInputLineMode eLineInputMode, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchDescription, uint unCharMax, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchExistingText );
|
||||
private FShowGamepadTextInput _ShowGamepadTextInput;
|
||||
|
||||
#endregion
|
||||
internal bool ShowGamepadTextInput( GamepadTextInputMode eInputMode, GamepadTextInputLineMode eLineInputMode, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchDescription, uint unCharMax, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchExistingText )
|
||||
{
|
||||
var returnValue = _ShowGamepadTextInput( Self, eInputMode, eLineInputMode, pchDescription, unCharMax, pchExistingText );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate uint FGetEnteredGamepadTextLength( IntPtr self );
|
||||
private FGetEnteredGamepadTextLength _GetEnteredGamepadTextLength;
|
||||
|
||||
#endregion
|
||||
internal uint GetEnteredGamepadTextLength()
|
||||
{
|
||||
var returnValue = _GetEnteredGamepadTextLength( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetEnteredGamepadTextInput( IntPtr self, IntPtr pchText, uint cchText );
|
||||
private FGetEnteredGamepadTextInput _GetEnteredGamepadTextInput;
|
||||
|
||||
#endregion
|
||||
internal bool GetEnteredGamepadTextInput( out string pchText )
|
||||
{
|
||||
IntPtr mempchText = Helpers.TakeMemory();
|
||||
var returnValue = _GetEnteredGamepadTextInput( Self, mempchText, (1024 * 32) );
|
||||
pchText = Helpers.MemoryToString( mempchText );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate Utf8StringPointer FGetSteamUILanguage( IntPtr self );
|
||||
private FGetSteamUILanguage _GetSteamUILanguage;
|
||||
|
||||
#endregion
|
||||
internal string GetSteamUILanguage()
|
||||
{
|
||||
var returnValue = _GetSteamUILanguage( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsSteamRunningInVR( IntPtr self );
|
||||
private FIsSteamRunningInVR _IsSteamRunningInVR;
|
||||
|
||||
#endregion
|
||||
internal bool IsSteamRunningInVR()
|
||||
{
|
||||
var returnValue = _IsSteamRunningInVR( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetOverlayNotificationInset( IntPtr self, int nHorizontalInset, int nVerticalInset );
|
||||
private FSetOverlayNotificationInset _SetOverlayNotificationInset;
|
||||
|
||||
#endregion
|
||||
internal void SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset )
|
||||
{
|
||||
_SetOverlayNotificationInset( Self, nHorizontalInset, nVerticalInset );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsSteamInBigPictureMode( IntPtr self );
|
||||
private FIsSteamInBigPictureMode _IsSteamInBigPictureMode;
|
||||
|
||||
#endregion
|
||||
internal bool IsSteamInBigPictureMode()
|
||||
{
|
||||
var returnValue = _IsSteamInBigPictureMode( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FStartVRDashboard( IntPtr self );
|
||||
private FStartVRDashboard _StartVRDashboard;
|
||||
|
||||
#endregion
|
||||
internal void StartVRDashboard()
|
||||
{
|
||||
_StartVRDashboard( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsVRHeadsetStreamingEnabled( IntPtr self );
|
||||
private FIsVRHeadsetStreamingEnabled _IsVRHeadsetStreamingEnabled;
|
||||
|
||||
#endregion
|
||||
internal bool IsVRHeadsetStreamingEnabled()
|
||||
{
|
||||
var returnValue = _IsVRHeadsetStreamingEnabled( Self );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FSetVRHeadsetStreamingEnabled( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bEnabled );
|
||||
private FSetVRHeadsetStreamingEnabled _SetVRHeadsetStreamingEnabled;
|
||||
|
||||
#endregion
|
||||
internal void SetVRHeadsetStreamingEnabled( [MarshalAs( UnmanagedType.U1 )] bool bEnabled )
|
||||
{
|
||||
_SetVRHeadsetStreamingEnabled( Self, bEnabled );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal class ISteamVideo : SteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMVIDEO_INTERFACE_V002";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
_GetVideoURL = Marshal.GetDelegateForFunctionPointer<FGetVideoURL>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 0 ) ) );
|
||||
_IsBroadcasting = Marshal.GetDelegateForFunctionPointer<FIsBroadcasting>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 8 ) ) );
|
||||
_GetOPFSettings = Marshal.GetDelegateForFunctionPointer<FGetOPFSettings>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 16 ) ) );
|
||||
_GetOPFStringForApp = Marshal.GetDelegateForFunctionPointer<FGetOPFStringForApp>( Marshal.ReadIntPtr( VTable, Platform.MemoryOffset( 24 ) ) );
|
||||
}
|
||||
internal override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_GetVideoURL = null;
|
||||
_IsBroadcasting = null;
|
||||
_GetOPFSettings = null;
|
||||
_GetOPFStringForApp = null;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FGetVideoURL( IntPtr self, AppId unVideoAppID );
|
||||
private FGetVideoURL _GetVideoURL;
|
||||
|
||||
#endregion
|
||||
internal void GetVideoURL( AppId unVideoAppID )
|
||||
{
|
||||
_GetVideoURL( Self, unVideoAppID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FIsBroadcasting( IntPtr self, ref int pnNumViewers );
|
||||
private FIsBroadcasting _IsBroadcasting;
|
||||
|
||||
#endregion
|
||||
internal bool IsBroadcasting( ref int pnNumViewers )
|
||||
{
|
||||
var returnValue = _IsBroadcasting( Self, ref pnNumViewers );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
private delegate void FGetOPFSettings( IntPtr self, AppId unVideoAppID );
|
||||
private FGetOPFSettings _GetOPFSettings;
|
||||
|
||||
#endregion
|
||||
internal void GetOPFSettings( AppId unVideoAppID )
|
||||
{
|
||||
_GetOPFSettings( Self, unVideoAppID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( Platform.MemberConvention )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool FGetOPFStringForApp( IntPtr self, AppId unVideoAppID, IntPtr pchBuffer, ref int pnBufferSize );
|
||||
private FGetOPFStringForApp _GetOPFStringForApp;
|
||||
|
||||
#endregion
|
||||
internal bool GetOPFStringForApp( AppId unVideoAppID, out string pchBuffer, ref int pnBufferSize )
|
||||
{
|
||||
IntPtr mempchBuffer = Helpers.TakeMemory();
|
||||
var returnValue = _GetOPFStringForApp( Self, unVideoAppID, mempchBuffer, ref pnBufferSize );
|
||||
pchBuffer = Helpers.MemoryToString( mempchBuffer );
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal static class SteamAPI
|
||||
{
|
||||
internal static class Native
|
||||
{
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_Init", CallingConvention = CallingConvention.Cdecl )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
public static extern bool SteamAPI_Init();
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_RunCallbacks", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern void SteamAPI_RunCallbacks();
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_RegisterCallback", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern void SteamAPI_RegisterCallback( IntPtr pCallback, int callback );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_UnregisterCallback", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern void SteamAPI_UnregisterCallback( IntPtr pCallback );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_RegisterCallResult", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern void SteamAPI_RegisterCallResult( IntPtr pCallback, SteamAPICall_t callback );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_UnregisterCallResult", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern void SteamAPI_UnregisterCallResult( IntPtr pCallback, SteamAPICall_t callback );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_Shutdown", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern void SteamAPI_Shutdown();
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_GetHSteamUser", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern HSteamUser SteamAPI_GetHSteamUser();
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_GetHSteamPipe", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern HSteamPipe SteamAPI_GetHSteamPipe();
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_RestartAppIfNecessary", CallingConvention = CallingConvention.Cdecl )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
public static extern bool SteamAPI_RestartAppIfNecessary( uint unOwnAppID );
|
||||
|
||||
}
|
||||
static internal bool Init()
|
||||
{
|
||||
return Native.SteamAPI_Init();
|
||||
}
|
||||
|
||||
static internal void RunCallbacks()
|
||||
{
|
||||
Native.SteamAPI_RunCallbacks();
|
||||
}
|
||||
|
||||
static internal void RegisterCallback( IntPtr pCallback, int callback )
|
||||
{
|
||||
Native.SteamAPI_RegisterCallback( pCallback, callback );
|
||||
}
|
||||
|
||||
static internal void UnregisterCallback( IntPtr pCallback )
|
||||
{
|
||||
Native.SteamAPI_UnregisterCallback( pCallback );
|
||||
}
|
||||
|
||||
static internal void RegisterCallResult( IntPtr pCallback, SteamAPICall_t callback )
|
||||
{
|
||||
Native.SteamAPI_RegisterCallResult( pCallback, callback );
|
||||
}
|
||||
|
||||
static internal void UnregisterCallResult( IntPtr pCallback, SteamAPICall_t callback )
|
||||
{
|
||||
Native.SteamAPI_UnregisterCallResult( pCallback, callback );
|
||||
}
|
||||
|
||||
static internal void Shutdown()
|
||||
{
|
||||
Native.SteamAPI_Shutdown();
|
||||
}
|
||||
|
||||
static internal HSteamUser GetHSteamUser()
|
||||
{
|
||||
return Native.SteamAPI_GetHSteamUser();
|
||||
}
|
||||
|
||||
static internal HSteamPipe GetHSteamPipe()
|
||||
{
|
||||
return Native.SteamAPI_GetHSteamPipe();
|
||||
}
|
||||
|
||||
static internal bool RestartAppIfNecessary( uint unOwnAppID )
|
||||
{
|
||||
return Native.SteamAPI_RestartAppIfNecessary( unOwnAppID );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+20
-8
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using Steamworks.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SteamNative
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
internal static class CallbackIdentifiers
|
||||
{
|
||||
@@ -18,6 +20,8 @@ namespace SteamNative
|
||||
public const int SteamApps = 1000;
|
||||
public const int SteamUserStats = 1100;
|
||||
public const int SteamNetworking = 1200;
|
||||
public const int SteamNetworkingSockets = 1220;
|
||||
public const int SteamNetworkingMessages = 1250;
|
||||
public const int ClientRemoteStorage = 1300;
|
||||
public const int ClientDepotBuilder = 1400;
|
||||
public const int SteamGameServerItems = 1500;
|
||||
@@ -57,30 +61,38 @@ namespace SteamNative
|
||||
public const int ClientSharedConnection = 4900;
|
||||
public const int SteamParentalSettings = 5000;
|
||||
public const int ClientShader = 5100;
|
||||
public const int SteamGameSearch = 5200;
|
||||
public const int SteamParties = 5300;
|
||||
public const int ClientParties = 5400;
|
||||
}
|
||||
internal static class Defines
|
||||
{
|
||||
internal const string STEAMAPPLIST_INTERFACE_VERSION = "STEAMAPPLIST_INTERFACE_VERSION001";
|
||||
internal const string STEAMAPPS_INTERFACE_VERSION = "STEAMAPPS_INTERFACE_VERSION008";
|
||||
internal const string STEAMAPPTICKET_INTERFACE_VERSION = "STEAMAPPTICKET_INTERFACE_VERSION001";
|
||||
internal const string STEAMCONTROLLER_INTERFACE_VERSION = "SteamController006";
|
||||
internal const string STEAMFRIENDS_INTERFACE_VERSION = "SteamFriends015";
|
||||
internal const string STEAMCONTROLLER_INTERFACE_VERSION = "SteamController007";
|
||||
internal const string STEAMFRIENDS_INTERFACE_VERSION = "SteamFriends017";
|
||||
internal const string STEAMGAMECOORDINATOR_INTERFACE_VERSION = "SteamGameCoordinator001";
|
||||
internal const string STEAMGAMESERVER_INTERFACE_VERSION = "SteamGameServer012";
|
||||
internal const string STEAMGAMESERVERSTATS_INTERFACE_VERSION = "SteamGameServerStats001";
|
||||
internal const string STEAMHTMLSURFACE_INTERFACE_VERSION = "STEAMHTMLSURFACE_INTERFACE_VERSION_004";
|
||||
internal const string STEAMHTTP_INTERFACE_VERSION = "STEAMHTTP_INTERFACE_VERSION002";
|
||||
internal const string STEAMINVENTORY_INTERFACE_VERSION = "STEAMINVENTORY_INTERFACE_V002";
|
||||
internal const string STEAMHTMLSURFACE_INTERFACE_VERSION = "STEAMHTMLSURFACE_INTERFACE_VERSION_005";
|
||||
internal const string STEAMHTTP_INTERFACE_VERSION = "STEAMHTTP_INTERFACE_VERSION003";
|
||||
internal const string STEAMINPUT_INTERFACE_VERSION = "SteamInput001";
|
||||
internal const string STEAMINVENTORY_INTERFACE_VERSION = "STEAMINVENTORY_INTERFACE_V003";
|
||||
internal const string STEAMMATCHMAKING_INTERFACE_VERSION = "SteamMatchMaking009";
|
||||
internal const string STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION = "SteamMatchMakingServers002";
|
||||
internal const string STEAMGAMESEARCH_INTERFACE_VERSION = "SteamMatchGameSearch001";
|
||||
internal const string STEAMPARTIES_INTERFACE_VERSION = "SteamParties002";
|
||||
internal const string STEAMMUSIC_INTERFACE_VERSION = "STEAMMUSIC_INTERFACE_VERSION001";
|
||||
internal const string STEAMMUSICREMOTE_INTERFACE_VERSION = "STEAMMUSICREMOTE_INTERFACE_VERSION001";
|
||||
internal const string STEAMNETWORKING_INTERFACE_VERSION = "SteamNetworking005";
|
||||
internal const string STEAMNETWORKINGSOCKETS_INTERFACE_VERSION = "SteamNetworkingSockets002";
|
||||
internal const string STEAMNETWORKINGUTILS_INTERFACE_VERSION = "SteamNetworkingUtils001";
|
||||
internal const string STEAMPARENTALSETTINGS_INTERFACE_VERSION = "STEAMPARENTALSETTINGS_INTERFACE_VERSION001";
|
||||
internal const string STEAMREMOTESTORAGE_INTERFACE_VERSION = "STEAMREMOTESTORAGE_INTERFACE_VERSION014";
|
||||
internal const string STEAMSCREENSHOTS_INTERFACE_VERSION = "STEAMSCREENSHOTS_INTERFACE_VERSION003";
|
||||
internal const string STEAMUGC_INTERFACE_VERSION = "STEAMUGC_INTERFACE_VERSION010";
|
||||
internal const string STEAMUSER_INTERFACE_VERSION = "SteamUser019";
|
||||
internal const string STEAMUGC_INTERFACE_VERSION = "STEAMUGC_INTERFACE_VERSION012";
|
||||
internal const string STEAMUSER_INTERFACE_VERSION = "SteamUser020";
|
||||
internal const string STEAMUSERSTATS_INTERFACE_VERSION = "STEAMUSERSTATS_INTERFACE_VERSION011";
|
||||
internal const string STEAMUTILS_INTERFACE_VERSION = "SteamUtils009";
|
||||
internal const string STEAMVIDEO_INTERFACE_VERSION = "STEAMVIDEO_INTERFACE_V002";
|
||||
+580
-58
@@ -1,13 +1,15 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using Steamworks.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SteamNative
|
||||
namespace Steamworks
|
||||
{
|
||||
//
|
||||
// EUniverse
|
||||
//
|
||||
internal enum Universe : int
|
||||
public enum Universe : int
|
||||
{
|
||||
Invalid = 0,
|
||||
Public = 1,
|
||||
@@ -133,6 +135,7 @@ namespace SteamNative
|
||||
WGNetworkSendExceeded = 110,
|
||||
AccountNotFriends = 111,
|
||||
LimitedUserAccount = 112,
|
||||
CantRemoveItem = 113,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -178,7 +181,7 @@ namespace SteamNative
|
||||
//
|
||||
// EBeginAuthSessionResult
|
||||
//
|
||||
internal enum BeginAuthSessionResult : int
|
||||
public enum BeginAuthResult : int
|
||||
{
|
||||
OK = 0,
|
||||
InvalidTicket = 1,
|
||||
@@ -186,12 +189,16 @@ namespace SteamNative
|
||||
InvalidVersion = 3,
|
||||
GameMismatch = 4,
|
||||
ExpiredTicket = 5,
|
||||
|
||||
//NOT IMPLEMENTED BY STEAMWORKS; ONLY USED IN BAROTRAUMA
|
||||
//TODO: think up a different solution to what we use this for
|
||||
ServerNotConnectedToSteam = 9999,
|
||||
}
|
||||
|
||||
//
|
||||
// EAuthSessionResponse
|
||||
//
|
||||
internal enum AuthSessionResponse : int
|
||||
public enum AuthResponse : int
|
||||
{
|
||||
OK = 0,
|
||||
UserNotConnectedToSteam = 1,
|
||||
@@ -335,7 +342,7 @@ namespace SteamNative
|
||||
//
|
||||
// EChatRoomEnterResponse
|
||||
//
|
||||
internal enum ChatRoomEnterResponse : int
|
||||
public enum RoomEnter : int
|
||||
{
|
||||
Success = 1,
|
||||
DoesntExist = 2,
|
||||
@@ -378,7 +385,7 @@ namespace SteamNative
|
||||
//
|
||||
// ENotificationPosition
|
||||
//
|
||||
internal enum NotificationPosition : int
|
||||
public enum NotificationPosition : int
|
||||
{
|
||||
TopLeft = 0,
|
||||
TopRight = 1,
|
||||
@@ -389,7 +396,7 @@ namespace SteamNative
|
||||
//
|
||||
// EBroadcastUploadResult
|
||||
//
|
||||
internal enum BroadcastUploadResult : int
|
||||
public enum BroadcastUploadResult : int
|
||||
{
|
||||
None = 0,
|
||||
OK = 1,
|
||||
@@ -405,6 +412,16 @@ namespace SteamNative
|
||||
MissingAudio = 11,
|
||||
TooFarBehind = 12,
|
||||
TranscodeBehind = 13,
|
||||
NotAllowedToPlay = 14,
|
||||
Busy = 15,
|
||||
Banned = 16,
|
||||
AlreadyActive = 17,
|
||||
ForcedOff = 18,
|
||||
AudioBehind = 19,
|
||||
Shutdown = 20,
|
||||
Disconnect = 21,
|
||||
VideoInitFailed = 22,
|
||||
AudioInitFailed = 23,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -441,6 +458,7 @@ namespace SteamNative
|
||||
HTC_Dev = 1,
|
||||
HTC_VivePre = 2,
|
||||
HTC_Vive = 3,
|
||||
HTC_VivePro = 4,
|
||||
HTC_Unknown = 20,
|
||||
Oculus_DK1 = 21,
|
||||
Oculus_DK2 = 22,
|
||||
@@ -458,6 +476,34 @@ namespace SteamNative
|
||||
Samsung_Odyssey = 91,
|
||||
Unannounced_Unknown = 100,
|
||||
Unannounced_WindowsMR = 101,
|
||||
vridge = 110,
|
||||
Huawei_Unknown = 120,
|
||||
Huawei_VR2 = 121,
|
||||
Huawei_Unannounced = 129,
|
||||
}
|
||||
|
||||
//
|
||||
// EMarketNotAllowedReasonFlags
|
||||
//
|
||||
internal enum MarketNotAllowedReasonFlags : int
|
||||
{
|
||||
None = 0,
|
||||
TemporaryFailure = 1,
|
||||
AccountDisabled = 2,
|
||||
AccountLockedDown = 4,
|
||||
AccountLimited = 8,
|
||||
TradeBanned = 16,
|
||||
AccountNotTrusted = 32,
|
||||
SteamGuardNotEnabled = 64,
|
||||
SteamGuardOnlyRecentlyEnabled = 128,
|
||||
RecentPasswordReset = 256,
|
||||
NewPaymentMethod = 512,
|
||||
InvalidCookie = 1024,
|
||||
UsingNewDevice = 2048,
|
||||
RecentSelfRefund = 4096,
|
||||
NewPaymentMethodCannotBeVerified = 8192,
|
||||
NoRecentPurchases = 16384,
|
||||
AcceptedWalletGift = 32768,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -471,6 +517,34 @@ namespace SteamNative
|
||||
P2P = 3,
|
||||
}
|
||||
|
||||
//
|
||||
// EGameSearchErrorCode_t
|
||||
//
|
||||
internal enum GameSearchErrorCode_t : int
|
||||
{
|
||||
OK = 1,
|
||||
Failed_Search_Already_In_Progress = 2,
|
||||
Failed_No_Search_In_Progress = 3,
|
||||
Failed_Not_Lobby_Leader = 4,
|
||||
Failed_No_Host_Available = 5,
|
||||
Failed_Search_Params_Invalid = 6,
|
||||
Failed_Offline = 7,
|
||||
Failed_NotAuthorized = 8,
|
||||
Failed_Unknown_Error = 9,
|
||||
}
|
||||
|
||||
//
|
||||
// EPlayerResult_t
|
||||
//
|
||||
internal enum PlayerResult_t : int
|
||||
{
|
||||
FailedToConnect = 1,
|
||||
Abandoned = 2,
|
||||
Kicked = 3,
|
||||
Incomplete = 4,
|
||||
Completed = 5,
|
||||
}
|
||||
|
||||
//
|
||||
// IPCFailure_t::EFailureType
|
||||
//
|
||||
@@ -483,7 +557,7 @@ namespace SteamNative
|
||||
//
|
||||
// EFriendRelationship
|
||||
//
|
||||
internal enum FriendRelationship : int
|
||||
public enum Relationship : int
|
||||
{
|
||||
None = 0,
|
||||
Blocked = 1,
|
||||
@@ -499,7 +573,7 @@ namespace SteamNative
|
||||
//
|
||||
// EPersonaState
|
||||
//
|
||||
internal enum PersonaState : int
|
||||
public enum FriendState : int
|
||||
{
|
||||
Offline = 0,
|
||||
Online = 1,
|
||||
@@ -508,7 +582,8 @@ namespace SteamNative
|
||||
Snooze = 4,
|
||||
LookingToTrade = 5,
|
||||
LookingToPlay = 6,
|
||||
Max = 7,
|
||||
Invisible = 7,
|
||||
Max = 8,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -555,6 +630,15 @@ namespace SteamNative
|
||||
AddToCartAndShow = 2,
|
||||
}
|
||||
|
||||
//
|
||||
// EActivateGameOverlayToWebPageMode
|
||||
//
|
||||
internal enum ActivateGameOverlayToWebPageMode : int
|
||||
{
|
||||
Default = 0,
|
||||
Modal = 1,
|
||||
}
|
||||
|
||||
//
|
||||
// EPersonaChange
|
||||
//
|
||||
@@ -571,9 +655,10 @@ namespace SteamNative
|
||||
LeftSource = 256,
|
||||
RelationshipChanged = 512,
|
||||
NameFirstSet = 1024,
|
||||
FacebookInfo = 2048,
|
||||
Broadcast = 2048,
|
||||
Nickname = 4096,
|
||||
SteamLevel = 8192,
|
||||
RichPresence = 16384,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -591,7 +676,7 @@ namespace SteamNative
|
||||
//
|
||||
// EGamepadTextInputMode
|
||||
//
|
||||
internal enum GamepadTextInputMode : int
|
||||
public enum GamepadTextInputMode : int
|
||||
{
|
||||
Normal = 0,
|
||||
Password = 1,
|
||||
@@ -600,7 +685,7 @@ namespace SteamNative
|
||||
//
|
||||
// EGamepadTextInputLineMode
|
||||
//
|
||||
internal enum GamepadTextInputLineMode : int
|
||||
public enum GamepadTextInputLineMode : int
|
||||
{
|
||||
SingleLine = 0,
|
||||
MultipleLines = 1,
|
||||
@@ -609,7 +694,7 @@ namespace SteamNative
|
||||
//
|
||||
// ECheckFileSignature
|
||||
//
|
||||
internal enum CheckFileSignature : int
|
||||
public enum CheckFileSignature : int
|
||||
{
|
||||
InvalidSignature = 0,
|
||||
ValidSignature = 1,
|
||||
@@ -675,6 +760,38 @@ namespace SteamNative
|
||||
Banned = 16,
|
||||
}
|
||||
|
||||
//
|
||||
// ESteamPartyBeaconLocationType
|
||||
//
|
||||
internal enum SteamPartyBeaconLocationType : int
|
||||
{
|
||||
Invalid = 0,
|
||||
ChatGroup = 1,
|
||||
Max = 2,
|
||||
}
|
||||
|
||||
//
|
||||
// ESteamPartyBeaconLocationData
|
||||
//
|
||||
internal enum SteamPartyBeaconLocationData : int
|
||||
{
|
||||
Invalid = 0,
|
||||
Name = 1,
|
||||
IconURLSmall = 2,
|
||||
IconURLMedium = 3,
|
||||
IconURLLarge = 4,
|
||||
}
|
||||
|
||||
//
|
||||
// RequestPlayersForGameResultCallback_t::PlayerAcceptState_t
|
||||
//
|
||||
internal enum PlayerAcceptState_t : int
|
||||
{
|
||||
Unknown = 0,
|
||||
PlayerAccepted = 1,
|
||||
PlayerDeclined = 2,
|
||||
}
|
||||
|
||||
//
|
||||
// ERemoteStoragePlatform
|
||||
//
|
||||
@@ -686,6 +803,7 @@ namespace SteamNative
|
||||
PS3 = 4,
|
||||
Linux = 8,
|
||||
Reserved2 = 16,
|
||||
Android = 32,
|
||||
All = -1,
|
||||
}
|
||||
|
||||
@@ -791,24 +909,9 @@ namespace SteamNative
|
||||
//
|
||||
// ELeaderboardSortMethod
|
||||
//
|
||||
internal enum LeaderboardSortMethod : int
|
||||
{
|
||||
None = 0,
|
||||
Ascending = 1,
|
||||
Descending = 2,
|
||||
}
|
||||
|
||||
//
|
||||
// ELeaderboardDisplayType
|
||||
//
|
||||
internal enum LeaderboardDisplayType : int
|
||||
{
|
||||
None = 0,
|
||||
Numeric = 1,
|
||||
TimeSeconds = 2,
|
||||
TimeMilliSeconds = 3,
|
||||
}
|
||||
|
||||
//
|
||||
// ELeaderboardUploadScoreMethod
|
||||
//
|
||||
@@ -834,7 +937,7 @@ namespace SteamNative
|
||||
//
|
||||
// EP2PSessionError
|
||||
//
|
||||
internal enum P2PSessionError : int
|
||||
public enum P2PSessionError : int
|
||||
{
|
||||
None = 0,
|
||||
NotRunningApp = 1,
|
||||
@@ -847,7 +950,7 @@ namespace SteamNative
|
||||
//
|
||||
// EP2PSend
|
||||
//
|
||||
internal enum P2PSend : int
|
||||
public enum P2PSend : int
|
||||
{
|
||||
Unreliable = 0,
|
||||
UnreliableNoDelay = 1,
|
||||
@@ -899,7 +1002,7 @@ namespace SteamNative
|
||||
//
|
||||
// AudioPlayback_Status
|
||||
//
|
||||
internal enum AudioPlayback_Status : int
|
||||
public enum MusicStatus : int
|
||||
{
|
||||
Undefined = 0,
|
||||
Playing = 1,
|
||||
@@ -973,6 +1076,358 @@ namespace SteamNative
|
||||
HTTPStatusCode5xxUnknown = 599,
|
||||
}
|
||||
|
||||
//
|
||||
// EInputSource
|
||||
//
|
||||
internal enum InputSource : int
|
||||
{
|
||||
None = 0,
|
||||
LeftTrackpad = 1,
|
||||
RightTrackpad = 2,
|
||||
Joystick = 3,
|
||||
ABXY = 4,
|
||||
Switch = 5,
|
||||
LeftTrigger = 6,
|
||||
RightTrigger = 7,
|
||||
LeftBumper = 8,
|
||||
RightBumper = 9,
|
||||
Gyro = 10,
|
||||
CenterTrackpad = 11,
|
||||
RightJoystick = 12,
|
||||
DPad = 13,
|
||||
Key = 14,
|
||||
Mouse = 15,
|
||||
LeftGyro = 16,
|
||||
Count = 17,
|
||||
}
|
||||
|
||||
//
|
||||
// EInputSourceMode
|
||||
//
|
||||
public enum InputSourceMode : int
|
||||
{
|
||||
None = 0,
|
||||
Dpad = 1,
|
||||
Buttons = 2,
|
||||
FourButtons = 3,
|
||||
AbsoluteMouse = 4,
|
||||
RelativeMouse = 5,
|
||||
JoystickMove = 6,
|
||||
JoystickMouse = 7,
|
||||
JoystickCamera = 8,
|
||||
ScrollWheel = 9,
|
||||
Trigger = 10,
|
||||
TouchMenu = 11,
|
||||
MouseJoystick = 12,
|
||||
MouseRegion = 13,
|
||||
RadialMenu = 14,
|
||||
SingleButton = 15,
|
||||
Switches = 16,
|
||||
}
|
||||
|
||||
//
|
||||
// EInputActionOrigin
|
||||
//
|
||||
internal enum InputActionOrigin : int
|
||||
{
|
||||
None = 0,
|
||||
SteamController_A = 1,
|
||||
SteamController_B = 2,
|
||||
SteamController_X = 3,
|
||||
SteamController_Y = 4,
|
||||
SteamController_LeftBumper = 5,
|
||||
SteamController_RightBumper = 6,
|
||||
SteamController_LeftGrip = 7,
|
||||
SteamController_RightGrip = 8,
|
||||
SteamController_Start = 9,
|
||||
SteamController_Back = 10,
|
||||
SteamController_LeftPad_Touch = 11,
|
||||
SteamController_LeftPad_Swipe = 12,
|
||||
SteamController_LeftPad_Click = 13,
|
||||
SteamController_LeftPad_DPadNorth = 14,
|
||||
SteamController_LeftPad_DPadSouth = 15,
|
||||
SteamController_LeftPad_DPadWest = 16,
|
||||
SteamController_LeftPad_DPadEast = 17,
|
||||
SteamController_RightPad_Touch = 18,
|
||||
SteamController_RightPad_Swipe = 19,
|
||||
SteamController_RightPad_Click = 20,
|
||||
SteamController_RightPad_DPadNorth = 21,
|
||||
SteamController_RightPad_DPadSouth = 22,
|
||||
SteamController_RightPad_DPadWest = 23,
|
||||
SteamController_RightPad_DPadEast = 24,
|
||||
SteamController_LeftTrigger_Pull = 25,
|
||||
SteamController_LeftTrigger_Click = 26,
|
||||
SteamController_RightTrigger_Pull = 27,
|
||||
SteamController_RightTrigger_Click = 28,
|
||||
SteamController_LeftStick_Move = 29,
|
||||
SteamController_LeftStick_Click = 30,
|
||||
SteamController_LeftStick_DPadNorth = 31,
|
||||
SteamController_LeftStick_DPadSouth = 32,
|
||||
SteamController_LeftStick_DPadWest = 33,
|
||||
SteamController_LeftStick_DPadEast = 34,
|
||||
SteamController_Gyro_Move = 35,
|
||||
SteamController_Gyro_Pitch = 36,
|
||||
SteamController_Gyro_Yaw = 37,
|
||||
SteamController_Gyro_Roll = 38,
|
||||
SteamController_Reserved0 = 39,
|
||||
SteamController_Reserved1 = 40,
|
||||
SteamController_Reserved2 = 41,
|
||||
SteamController_Reserved3 = 42,
|
||||
SteamController_Reserved4 = 43,
|
||||
SteamController_Reserved5 = 44,
|
||||
SteamController_Reserved6 = 45,
|
||||
SteamController_Reserved7 = 46,
|
||||
SteamController_Reserved8 = 47,
|
||||
SteamController_Reserved9 = 48,
|
||||
SteamController_Reserved10 = 49,
|
||||
PS4_X = 50,
|
||||
PS4_Circle = 51,
|
||||
PS4_Triangle = 52,
|
||||
PS4_Square = 53,
|
||||
PS4_LeftBumper = 54,
|
||||
PS4_RightBumper = 55,
|
||||
PS4_Options = 56,
|
||||
PS4_Share = 57,
|
||||
PS4_LeftPad_Touch = 58,
|
||||
PS4_LeftPad_Swipe = 59,
|
||||
PS4_LeftPad_Click = 60,
|
||||
PS4_LeftPad_DPadNorth = 61,
|
||||
PS4_LeftPad_DPadSouth = 62,
|
||||
PS4_LeftPad_DPadWest = 63,
|
||||
PS4_LeftPad_DPadEast = 64,
|
||||
PS4_RightPad_Touch = 65,
|
||||
PS4_RightPad_Swipe = 66,
|
||||
PS4_RightPad_Click = 67,
|
||||
PS4_RightPad_DPadNorth = 68,
|
||||
PS4_RightPad_DPadSouth = 69,
|
||||
PS4_RightPad_DPadWest = 70,
|
||||
PS4_RightPad_DPadEast = 71,
|
||||
PS4_CenterPad_Touch = 72,
|
||||
PS4_CenterPad_Swipe = 73,
|
||||
PS4_CenterPad_Click = 74,
|
||||
PS4_CenterPad_DPadNorth = 75,
|
||||
PS4_CenterPad_DPadSouth = 76,
|
||||
PS4_CenterPad_DPadWest = 77,
|
||||
PS4_CenterPad_DPadEast = 78,
|
||||
PS4_LeftTrigger_Pull = 79,
|
||||
PS4_LeftTrigger_Click = 80,
|
||||
PS4_RightTrigger_Pull = 81,
|
||||
PS4_RightTrigger_Click = 82,
|
||||
PS4_LeftStick_Move = 83,
|
||||
PS4_LeftStick_Click = 84,
|
||||
PS4_LeftStick_DPadNorth = 85,
|
||||
PS4_LeftStick_DPadSouth = 86,
|
||||
PS4_LeftStick_DPadWest = 87,
|
||||
PS4_LeftStick_DPadEast = 88,
|
||||
PS4_RightStick_Move = 89,
|
||||
PS4_RightStick_Click = 90,
|
||||
PS4_RightStick_DPadNorth = 91,
|
||||
PS4_RightStick_DPadSouth = 92,
|
||||
PS4_RightStick_DPadWest = 93,
|
||||
PS4_RightStick_DPadEast = 94,
|
||||
PS4_DPad_North = 95,
|
||||
PS4_DPad_South = 96,
|
||||
PS4_DPad_West = 97,
|
||||
PS4_DPad_East = 98,
|
||||
PS4_Gyro_Move = 99,
|
||||
PS4_Gyro_Pitch = 100,
|
||||
PS4_Gyro_Yaw = 101,
|
||||
PS4_Gyro_Roll = 102,
|
||||
PS4_Reserved0 = 103,
|
||||
PS4_Reserved1 = 104,
|
||||
PS4_Reserved2 = 105,
|
||||
PS4_Reserved3 = 106,
|
||||
PS4_Reserved4 = 107,
|
||||
PS4_Reserved5 = 108,
|
||||
PS4_Reserved6 = 109,
|
||||
PS4_Reserved7 = 110,
|
||||
PS4_Reserved8 = 111,
|
||||
PS4_Reserved9 = 112,
|
||||
PS4_Reserved10 = 113,
|
||||
XBoxOne_A = 114,
|
||||
XBoxOne_B = 115,
|
||||
XBoxOne_X = 116,
|
||||
XBoxOne_Y = 117,
|
||||
XBoxOne_LeftBumper = 118,
|
||||
XBoxOne_RightBumper = 119,
|
||||
XBoxOne_Menu = 120,
|
||||
XBoxOne_View = 121,
|
||||
XBoxOne_LeftTrigger_Pull = 122,
|
||||
XBoxOne_LeftTrigger_Click = 123,
|
||||
XBoxOne_RightTrigger_Pull = 124,
|
||||
XBoxOne_RightTrigger_Click = 125,
|
||||
XBoxOne_LeftStick_Move = 126,
|
||||
XBoxOne_LeftStick_Click = 127,
|
||||
XBoxOne_LeftStick_DPadNorth = 128,
|
||||
XBoxOne_LeftStick_DPadSouth = 129,
|
||||
XBoxOne_LeftStick_DPadWest = 130,
|
||||
XBoxOne_LeftStick_DPadEast = 131,
|
||||
XBoxOne_RightStick_Move = 132,
|
||||
XBoxOne_RightStick_Click = 133,
|
||||
XBoxOne_RightStick_DPadNorth = 134,
|
||||
XBoxOne_RightStick_DPadSouth = 135,
|
||||
XBoxOne_RightStick_DPadWest = 136,
|
||||
XBoxOne_RightStick_DPadEast = 137,
|
||||
XBoxOne_DPad_North = 138,
|
||||
XBoxOne_DPad_South = 139,
|
||||
XBoxOne_DPad_West = 140,
|
||||
XBoxOne_DPad_East = 141,
|
||||
XBoxOne_Reserved0 = 142,
|
||||
XBoxOne_Reserved1 = 143,
|
||||
XBoxOne_Reserved2 = 144,
|
||||
XBoxOne_Reserved3 = 145,
|
||||
XBoxOne_Reserved4 = 146,
|
||||
XBoxOne_Reserved5 = 147,
|
||||
XBoxOne_Reserved6 = 148,
|
||||
XBoxOne_Reserved7 = 149,
|
||||
XBoxOne_Reserved8 = 150,
|
||||
XBoxOne_Reserved9 = 151,
|
||||
XBoxOne_Reserved10 = 152,
|
||||
XBox360_A = 153,
|
||||
XBox360_B = 154,
|
||||
XBox360_X = 155,
|
||||
XBox360_Y = 156,
|
||||
XBox360_LeftBumper = 157,
|
||||
XBox360_RightBumper = 158,
|
||||
XBox360_Start = 159,
|
||||
XBox360_Back = 160,
|
||||
XBox360_LeftTrigger_Pull = 161,
|
||||
XBox360_LeftTrigger_Click = 162,
|
||||
XBox360_RightTrigger_Pull = 163,
|
||||
XBox360_RightTrigger_Click = 164,
|
||||
XBox360_LeftStick_Move = 165,
|
||||
XBox360_LeftStick_Click = 166,
|
||||
XBox360_LeftStick_DPadNorth = 167,
|
||||
XBox360_LeftStick_DPadSouth = 168,
|
||||
XBox360_LeftStick_DPadWest = 169,
|
||||
XBox360_LeftStick_DPadEast = 170,
|
||||
XBox360_RightStick_Move = 171,
|
||||
XBox360_RightStick_Click = 172,
|
||||
XBox360_RightStick_DPadNorth = 173,
|
||||
XBox360_RightStick_DPadSouth = 174,
|
||||
XBox360_RightStick_DPadWest = 175,
|
||||
XBox360_RightStick_DPadEast = 176,
|
||||
XBox360_DPad_North = 177,
|
||||
XBox360_DPad_South = 178,
|
||||
XBox360_DPad_West = 179,
|
||||
XBox360_DPad_East = 180,
|
||||
XBox360_Reserved0 = 181,
|
||||
XBox360_Reserved1 = 182,
|
||||
XBox360_Reserved2 = 183,
|
||||
XBox360_Reserved3 = 184,
|
||||
XBox360_Reserved4 = 185,
|
||||
XBox360_Reserved5 = 186,
|
||||
XBox360_Reserved6 = 187,
|
||||
XBox360_Reserved7 = 188,
|
||||
XBox360_Reserved8 = 189,
|
||||
XBox360_Reserved9 = 190,
|
||||
XBox360_Reserved10 = 191,
|
||||
Switch_A = 192,
|
||||
Switch_B = 193,
|
||||
Switch_X = 194,
|
||||
Switch_Y = 195,
|
||||
Switch_LeftBumper = 196,
|
||||
Switch_RightBumper = 197,
|
||||
Switch_Plus = 198,
|
||||
Switch_Minus = 199,
|
||||
Switch_Capture = 200,
|
||||
Switch_LeftTrigger_Pull = 201,
|
||||
Switch_LeftTrigger_Click = 202,
|
||||
Switch_RightTrigger_Pull = 203,
|
||||
Switch_RightTrigger_Click = 204,
|
||||
Switch_LeftStick_Move = 205,
|
||||
Switch_LeftStick_Click = 206,
|
||||
Switch_LeftStick_DPadNorth = 207,
|
||||
Switch_LeftStick_DPadSouth = 208,
|
||||
Switch_LeftStick_DPadWest = 209,
|
||||
Switch_LeftStick_DPadEast = 210,
|
||||
Switch_RightStick_Move = 211,
|
||||
Switch_RightStick_Click = 212,
|
||||
Switch_RightStick_DPadNorth = 213,
|
||||
Switch_RightStick_DPadSouth = 214,
|
||||
Switch_RightStick_DPadWest = 215,
|
||||
Switch_RightStick_DPadEast = 216,
|
||||
Switch_DPad_North = 217,
|
||||
Switch_DPad_South = 218,
|
||||
Switch_DPad_West = 219,
|
||||
Switch_DPad_East = 220,
|
||||
Switch_ProGyro_Move = 221,
|
||||
Switch_ProGyro_Pitch = 222,
|
||||
Switch_ProGyro_Yaw = 223,
|
||||
Switch_ProGyro_Roll = 224,
|
||||
Switch_Reserved0 = 225,
|
||||
Switch_Reserved1 = 226,
|
||||
Switch_Reserved2 = 227,
|
||||
Switch_Reserved3 = 228,
|
||||
Switch_Reserved4 = 229,
|
||||
Switch_Reserved5 = 230,
|
||||
Switch_Reserved6 = 231,
|
||||
Switch_Reserved7 = 232,
|
||||
Switch_Reserved8 = 233,
|
||||
Switch_Reserved9 = 234,
|
||||
Switch_Reserved10 = 235,
|
||||
Switch_RightGyro_Move = 236,
|
||||
Switch_RightGyro_Pitch = 237,
|
||||
Switch_RightGyro_Yaw = 238,
|
||||
Switch_RightGyro_Roll = 239,
|
||||
Switch_LeftGyro_Move = 240,
|
||||
Switch_LeftGyro_Pitch = 241,
|
||||
Switch_LeftGyro_Yaw = 242,
|
||||
Switch_LeftGyro_Roll = 243,
|
||||
Switch_LeftGrip_Lower = 244,
|
||||
Switch_LeftGrip_Upper = 245,
|
||||
Switch_RightGrip_Lower = 246,
|
||||
Switch_RightGrip_Upper = 247,
|
||||
Switch_Reserved11 = 248,
|
||||
Switch_Reserved12 = 249,
|
||||
Switch_Reserved13 = 250,
|
||||
Switch_Reserved14 = 251,
|
||||
Switch_Reserved15 = 252,
|
||||
Switch_Reserved16 = 253,
|
||||
Switch_Reserved17 = 254,
|
||||
Switch_Reserved18 = 255,
|
||||
Switch_Reserved19 = 256,
|
||||
Switch_Reserved20 = 257,
|
||||
Count = 258,
|
||||
MaximumPossibleValue = 32767,
|
||||
}
|
||||
|
||||
//
|
||||
// EXboxOrigin
|
||||
//
|
||||
internal enum XboxOrigin : int
|
||||
{
|
||||
A = 0,
|
||||
B = 1,
|
||||
X = 2,
|
||||
Y = 3,
|
||||
LeftBumper = 4,
|
||||
RightBumper = 5,
|
||||
Menu = 6,
|
||||
View = 7,
|
||||
LeftTrigger_Pull = 8,
|
||||
LeftTrigger_Click = 9,
|
||||
RightTrigger_Pull = 10,
|
||||
RightTrigger_Click = 11,
|
||||
LeftStick_Move = 12,
|
||||
LeftStick_Click = 13,
|
||||
LeftStick_DPadNorth = 14,
|
||||
LeftStick_DPadSouth = 15,
|
||||
LeftStick_DPadWest = 16,
|
||||
LeftStick_DPadEast = 17,
|
||||
RightStick_Move = 18,
|
||||
RightStick_Click = 19,
|
||||
RightStick_DPadNorth = 20,
|
||||
RightStick_DPadSouth = 21,
|
||||
RightStick_DPadWest = 22,
|
||||
RightStick_DPadEast = 23,
|
||||
DPad_North = 24,
|
||||
DPad_South = 25,
|
||||
DPad_West = 26,
|
||||
DPad_East = 27,
|
||||
Count = 28,
|
||||
}
|
||||
|
||||
//
|
||||
// ESteamControllerPad
|
||||
//
|
||||
@@ -982,6 +1437,37 @@ namespace SteamNative
|
||||
Right = 1,
|
||||
}
|
||||
|
||||
//
|
||||
// ESteamInputType
|
||||
//
|
||||
public enum InputType : int
|
||||
{
|
||||
Unknown = 0,
|
||||
SteamController = 1,
|
||||
XBox360Controller = 2,
|
||||
XBoxOneController = 3,
|
||||
GenericGamepad = 4,
|
||||
PS4Controller = 5,
|
||||
AppleMFiController = 6,
|
||||
AndroidController = 7,
|
||||
SwitchJoyConPair = 8,
|
||||
SwitchJoyConSingle = 9,
|
||||
SwitchProController = 10,
|
||||
MobileTouch = 11,
|
||||
PS3Controller = 12,
|
||||
Count = 13,
|
||||
MaximumPossibleValue = 255,
|
||||
}
|
||||
|
||||
//
|
||||
// ESteamInputLEDFlag
|
||||
//
|
||||
internal enum SteamInputLEDFlag : int
|
||||
{
|
||||
SetColor = 0,
|
||||
RestoreUserDefault = 1,
|
||||
}
|
||||
|
||||
//
|
||||
// EControllerSource
|
||||
//
|
||||
@@ -995,13 +1481,16 @@ namespace SteamNative
|
||||
Switch = 5,
|
||||
LeftTrigger = 6,
|
||||
RightTrigger = 7,
|
||||
Gyro = 8,
|
||||
CenterTrackpad = 9,
|
||||
RightJoystick = 10,
|
||||
DPad = 11,
|
||||
Key = 12,
|
||||
Mouse = 13,
|
||||
Count = 14,
|
||||
LeftBumper = 8,
|
||||
RightBumper = 9,
|
||||
Gyro = 10,
|
||||
CenterTrackpad = 11,
|
||||
RightJoystick = 12,
|
||||
DPad = 13,
|
||||
Key = 14,
|
||||
Mouse = 15,
|
||||
LeftGyro = 16,
|
||||
Count = 17,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1187,9 +1676,9 @@ namespace SteamNative
|
||||
SteamV2_Y = 151,
|
||||
SteamV2_LeftBumper = 152,
|
||||
SteamV2_RightBumper = 153,
|
||||
SteamV2_LeftGrip = 154,
|
||||
SteamV2_RightGrip = 155,
|
||||
SteamV2_LeftGrip_Upper = 156,
|
||||
SteamV2_LeftGrip_Lower = 154,
|
||||
SteamV2_LeftGrip_Upper = 155,
|
||||
SteamV2_RightGrip_Lower = 156,
|
||||
SteamV2_RightGrip_Upper = 157,
|
||||
SteamV2_LeftBumper_Pressure = 158,
|
||||
SteamV2_RightBumper_Pressure = 159,
|
||||
@@ -1229,7 +1718,53 @@ namespace SteamNative
|
||||
SteamV2_Gyro_Pitch = 193,
|
||||
SteamV2_Gyro_Yaw = 194,
|
||||
SteamV2_Gyro_Roll = 195,
|
||||
Count = 196,
|
||||
Switch_A = 196,
|
||||
Switch_B = 197,
|
||||
Switch_X = 198,
|
||||
Switch_Y = 199,
|
||||
Switch_LeftBumper = 200,
|
||||
Switch_RightBumper = 201,
|
||||
Switch_Plus = 202,
|
||||
Switch_Minus = 203,
|
||||
Switch_Capture = 204,
|
||||
Switch_LeftTrigger_Pull = 205,
|
||||
Switch_LeftTrigger_Click = 206,
|
||||
Switch_RightTrigger_Pull = 207,
|
||||
Switch_RightTrigger_Click = 208,
|
||||
Switch_LeftStick_Move = 209,
|
||||
Switch_LeftStick_Click = 210,
|
||||
Switch_LeftStick_DPadNorth = 211,
|
||||
Switch_LeftStick_DPadSouth = 212,
|
||||
Switch_LeftStick_DPadWest = 213,
|
||||
Switch_LeftStick_DPadEast = 214,
|
||||
Switch_RightStick_Move = 215,
|
||||
Switch_RightStick_Click = 216,
|
||||
Switch_RightStick_DPadNorth = 217,
|
||||
Switch_RightStick_DPadSouth = 218,
|
||||
Switch_RightStick_DPadWest = 219,
|
||||
Switch_RightStick_DPadEast = 220,
|
||||
Switch_DPad_North = 221,
|
||||
Switch_DPad_South = 222,
|
||||
Switch_DPad_West = 223,
|
||||
Switch_DPad_East = 224,
|
||||
Switch_ProGyro_Move = 225,
|
||||
Switch_ProGyro_Pitch = 226,
|
||||
Switch_ProGyro_Yaw = 227,
|
||||
Switch_ProGyro_Roll = 228,
|
||||
Switch_RightGyro_Move = 229,
|
||||
Switch_RightGyro_Pitch = 230,
|
||||
Switch_RightGyro_Yaw = 231,
|
||||
Switch_RightGyro_Roll = 232,
|
||||
Switch_LeftGyro_Move = 233,
|
||||
Switch_LeftGyro_Pitch = 234,
|
||||
Switch_LeftGyro_Yaw = 235,
|
||||
Switch_LeftGyro_Roll = 236,
|
||||
Switch_LeftGrip_Lower = 237,
|
||||
Switch_LeftGrip_Upper = 238,
|
||||
Switch_RightGrip_Lower = 239,
|
||||
Switch_RightGrip_Upper = 240,
|
||||
Count = 241,
|
||||
MaximumPossibleValue = 32767,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1241,23 +1776,10 @@ namespace SteamNative
|
||||
RestoreUserDefault = 1,
|
||||
}
|
||||
|
||||
//
|
||||
// ESteamInputType
|
||||
//
|
||||
internal enum SteamInputType : int
|
||||
{
|
||||
Unknown = 0,
|
||||
SteamController = 1,
|
||||
XBox360Controller = 2,
|
||||
XBoxOneController = 3,
|
||||
GenericXInput = 4,
|
||||
PS4Controller = 5,
|
||||
}
|
||||
|
||||
//
|
||||
// EUGCMatchingUGCType
|
||||
//
|
||||
internal enum UGCMatchingUGCType : int
|
||||
public enum UgcType : int
|
||||
{
|
||||
Items = 0,
|
||||
Items_Mtx = 1,
|
||||
@@ -1474,7 +1996,7 @@ namespace SteamNative
|
||||
//
|
||||
// EParentalFeature
|
||||
//
|
||||
internal enum ParentalFeature : int
|
||||
public enum ParentalFeature : int
|
||||
{
|
||||
Invalid = 0,
|
||||
Store = 1,
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal static class SteamGameServer
|
||||
{
|
||||
internal static class Native
|
||||
{
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_RunCallbacks", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern void SteamGameServer_RunCallbacks();
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_Shutdown", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern void SteamGameServer_Shutdown();
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_GetHSteamUser", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern HSteamUser SteamGameServer_GetHSteamUser();
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_GetHSteamPipe", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern HSteamPipe SteamGameServer_GetHSteamPipe();
|
||||
|
||||
}
|
||||
static internal void RunCallbacks()
|
||||
{
|
||||
Native.SteamGameServer_RunCallbacks();
|
||||
}
|
||||
|
||||
static internal void Shutdown()
|
||||
{
|
||||
Native.SteamGameServer_Shutdown();
|
||||
}
|
||||
|
||||
static internal HSteamUser GetHSteamUser()
|
||||
{
|
||||
return Native.SteamGameServer_GetHSteamUser();
|
||||
}
|
||||
|
||||
static internal HSteamPipe GetHSteamPipe()
|
||||
{
|
||||
return Native.SteamGameServer_GetHSteamPipe();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
internal static class SteamInternal
|
||||
{
|
||||
internal static class Native
|
||||
{
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_GameServer_Init", CallingConvention = CallingConvention.Cdecl )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
public static extern bool SteamInternal_GameServer_Init( uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersionString );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_FindOrCreateUserInterface", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern IntPtr SteamInternal_FindOrCreateUserInterface( int steamuser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string versionname );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_FindOrCreateGameServerInterface", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern IntPtr SteamInternal_FindOrCreateGameServerInterface( int steamuser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string versionname );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_CreateInterface", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static extern IntPtr SteamInternal_CreateInterface( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string version );
|
||||
|
||||
}
|
||||
static internal bool GameServer_Init( uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersionString )
|
||||
{
|
||||
return Native.SteamInternal_GameServer_Init( unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString );
|
||||
}
|
||||
|
||||
static internal IntPtr FindOrCreateUserInterface( int steamuser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string versionname )
|
||||
{
|
||||
return Native.SteamInternal_FindOrCreateUserInterface( steamuser, versionname );
|
||||
}
|
||||
|
||||
static internal IntPtr FindOrCreateGameServerInterface( int steamuser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string versionname )
|
||||
{
|
||||
return Native.SteamInternal_FindOrCreateGameServerInterface( steamuser, versionname );
|
||||
}
|
||||
|
||||
static internal IntPtr CreateInterface( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string version )
|
||||
{
|
||||
return Native.SteamInternal_CreateInterface( version );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,744 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using Steamworks.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
internal struct GID_t : IEquatable<GID_t>, IComparable<GID_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator GID_t( ulong value ) => new GID_t(){ Value = value };
|
||||
public static implicit operator ulong( GID_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (GID_t) p );
|
||||
public bool Equals( GID_t p ) => p.Value == Value;
|
||||
public static bool operator ==( GID_t a, GID_t b ) => a.Equals( b );
|
||||
public static bool operator !=( GID_t a, GID_t b ) => !a.Equals( b );
|
||||
public int CompareTo( GID_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct JobID_t : IEquatable<JobID_t>, IComparable<JobID_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator JobID_t( ulong value ) => new JobID_t(){ Value = value };
|
||||
public static implicit operator ulong( JobID_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (JobID_t) p );
|
||||
public bool Equals( JobID_t p ) => p.Value == Value;
|
||||
public static bool operator ==( JobID_t a, JobID_t b ) => a.Equals( b );
|
||||
public static bool operator !=( JobID_t a, JobID_t b ) => !a.Equals( b );
|
||||
public int CompareTo( JobID_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct TxnID_t : IEquatable<TxnID_t>, IComparable<TxnID_t>
|
||||
{
|
||||
public GID_t Value;
|
||||
|
||||
public static implicit operator TxnID_t( GID_t value ) => new TxnID_t(){ Value = value };
|
||||
public static implicit operator GID_t( TxnID_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (TxnID_t) p );
|
||||
public bool Equals( TxnID_t p ) => p.Value == Value;
|
||||
public static bool operator ==( TxnID_t a, TxnID_t b ) => a.Equals( b );
|
||||
public static bool operator !=( TxnID_t a, TxnID_t b ) => !a.Equals( b );
|
||||
public int CompareTo( TxnID_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct PackageId_t : IEquatable<PackageId_t>, IComparable<PackageId_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator PackageId_t( uint value ) => new PackageId_t(){ Value = value };
|
||||
public static implicit operator uint( PackageId_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (PackageId_t) p );
|
||||
public bool Equals( PackageId_t p ) => p.Value == Value;
|
||||
public static bool operator ==( PackageId_t a, PackageId_t b ) => a.Equals( b );
|
||||
public static bool operator !=( PackageId_t a, PackageId_t b ) => !a.Equals( b );
|
||||
public int CompareTo( PackageId_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct BundleId_t : IEquatable<BundleId_t>, IComparable<BundleId_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator BundleId_t( uint value ) => new BundleId_t(){ Value = value };
|
||||
public static implicit operator uint( BundleId_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (BundleId_t) p );
|
||||
public bool Equals( BundleId_t p ) => p.Value == Value;
|
||||
public static bool operator ==( BundleId_t a, BundleId_t b ) => a.Equals( b );
|
||||
public static bool operator !=( BundleId_t a, BundleId_t b ) => !a.Equals( b );
|
||||
public int CompareTo( BundleId_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct AssetClassId_t : IEquatable<AssetClassId_t>, IComparable<AssetClassId_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator AssetClassId_t( ulong value ) => new AssetClassId_t(){ Value = value };
|
||||
public static implicit operator ulong( AssetClassId_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (AssetClassId_t) p );
|
||||
public bool Equals( AssetClassId_t p ) => p.Value == Value;
|
||||
public static bool operator ==( AssetClassId_t a, AssetClassId_t b ) => a.Equals( b );
|
||||
public static bool operator !=( AssetClassId_t a, AssetClassId_t b ) => !a.Equals( b );
|
||||
public int CompareTo( AssetClassId_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct PhysicalItemId_t : IEquatable<PhysicalItemId_t>, IComparable<PhysicalItemId_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator PhysicalItemId_t( uint value ) => new PhysicalItemId_t(){ Value = value };
|
||||
public static implicit operator uint( PhysicalItemId_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (PhysicalItemId_t) p );
|
||||
public bool Equals( PhysicalItemId_t p ) => p.Value == Value;
|
||||
public static bool operator ==( PhysicalItemId_t a, PhysicalItemId_t b ) => a.Equals( b );
|
||||
public static bool operator !=( PhysicalItemId_t a, PhysicalItemId_t b ) => !a.Equals( b );
|
||||
public int CompareTo( PhysicalItemId_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct DepotId_t : IEquatable<DepotId_t>, IComparable<DepotId_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator DepotId_t( uint value ) => new DepotId_t(){ Value = value };
|
||||
public static implicit operator uint( DepotId_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (DepotId_t) p );
|
||||
public bool Equals( DepotId_t p ) => p.Value == Value;
|
||||
public static bool operator ==( DepotId_t a, DepotId_t b ) => a.Equals( b );
|
||||
public static bool operator !=( DepotId_t a, DepotId_t b ) => !a.Equals( b );
|
||||
public int CompareTo( DepotId_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct RTime32 : IEquatable<RTime32>, IComparable<RTime32>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator RTime32( uint value ) => new RTime32(){ Value = value };
|
||||
public static implicit operator uint( RTime32 value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (RTime32) p );
|
||||
public bool Equals( RTime32 p ) => p.Value == Value;
|
||||
public static bool operator ==( RTime32 a, RTime32 b ) => a.Equals( b );
|
||||
public static bool operator !=( RTime32 a, RTime32 b ) => !a.Equals( b );
|
||||
public int CompareTo( RTime32 other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct CellID_t : IEquatable<CellID_t>, IComparable<CellID_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator CellID_t( uint value ) => new CellID_t(){ Value = value };
|
||||
public static implicit operator uint( CellID_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (CellID_t) p );
|
||||
public bool Equals( CellID_t p ) => p.Value == Value;
|
||||
public static bool operator ==( CellID_t a, CellID_t b ) => a.Equals( b );
|
||||
public static bool operator !=( CellID_t a, CellID_t b ) => !a.Equals( b );
|
||||
public int CompareTo( CellID_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct SteamAPICall_t : IEquatable<SteamAPICall_t>, IComparable<SteamAPICall_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator SteamAPICall_t( ulong value ) => new SteamAPICall_t(){ Value = value };
|
||||
public static implicit operator ulong( SteamAPICall_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (SteamAPICall_t) p );
|
||||
public bool Equals( SteamAPICall_t p ) => p.Value == Value;
|
||||
public static bool operator ==( SteamAPICall_t a, SteamAPICall_t b ) => a.Equals( b );
|
||||
public static bool operator !=( SteamAPICall_t a, SteamAPICall_t b ) => !a.Equals( b );
|
||||
public int CompareTo( SteamAPICall_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct AccountID_t : IEquatable<AccountID_t>, IComparable<AccountID_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator AccountID_t( uint value ) => new AccountID_t(){ Value = value };
|
||||
public static implicit operator uint( AccountID_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (AccountID_t) p );
|
||||
public bool Equals( AccountID_t p ) => p.Value == Value;
|
||||
public static bool operator ==( AccountID_t a, AccountID_t b ) => a.Equals( b );
|
||||
public static bool operator !=( AccountID_t a, AccountID_t b ) => !a.Equals( b );
|
||||
public int CompareTo( AccountID_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct PartnerId_t : IEquatable<PartnerId_t>, IComparable<PartnerId_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator PartnerId_t( uint value ) => new PartnerId_t(){ Value = value };
|
||||
public static implicit operator uint( PartnerId_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (PartnerId_t) p );
|
||||
public bool Equals( PartnerId_t p ) => p.Value == Value;
|
||||
public static bool operator ==( PartnerId_t a, PartnerId_t b ) => a.Equals( b );
|
||||
public static bool operator !=( PartnerId_t a, PartnerId_t b ) => !a.Equals( b );
|
||||
public int CompareTo( PartnerId_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct ManifestId_t : IEquatable<ManifestId_t>, IComparable<ManifestId_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator ManifestId_t( ulong value ) => new ManifestId_t(){ Value = value };
|
||||
public static implicit operator ulong( ManifestId_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (ManifestId_t) p );
|
||||
public bool Equals( ManifestId_t p ) => p.Value == Value;
|
||||
public static bool operator ==( ManifestId_t a, ManifestId_t b ) => a.Equals( b );
|
||||
public static bool operator !=( ManifestId_t a, ManifestId_t b ) => !a.Equals( b );
|
||||
public int CompareTo( ManifestId_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct SiteId_t : IEquatable<SiteId_t>, IComparable<SiteId_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator SiteId_t( ulong value ) => new SiteId_t(){ Value = value };
|
||||
public static implicit operator ulong( SiteId_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (SiteId_t) p );
|
||||
public bool Equals( SiteId_t p ) => p.Value == Value;
|
||||
public static bool operator ==( SiteId_t a, SiteId_t b ) => a.Equals( b );
|
||||
public static bool operator !=( SiteId_t a, SiteId_t b ) => !a.Equals( b );
|
||||
public int CompareTo( SiteId_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct PartyBeaconID_t : IEquatable<PartyBeaconID_t>, IComparable<PartyBeaconID_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator PartyBeaconID_t( ulong value ) => new PartyBeaconID_t(){ Value = value };
|
||||
public static implicit operator ulong( PartyBeaconID_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (PartyBeaconID_t) p );
|
||||
public bool Equals( PartyBeaconID_t p ) => p.Value == Value;
|
||||
public static bool operator ==( PartyBeaconID_t a, PartyBeaconID_t b ) => a.Equals( b );
|
||||
public static bool operator !=( PartyBeaconID_t a, PartyBeaconID_t b ) => !a.Equals( b );
|
||||
public int CompareTo( PartyBeaconID_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct HAuthTicket : IEquatable<HAuthTicket>, IComparable<HAuthTicket>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator HAuthTicket( uint value ) => new HAuthTicket(){ Value = value };
|
||||
public static implicit operator uint( HAuthTicket value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (HAuthTicket) p );
|
||||
public bool Equals( HAuthTicket p ) => p.Value == Value;
|
||||
public static bool operator ==( HAuthTicket a, HAuthTicket b ) => a.Equals( b );
|
||||
public static bool operator !=( HAuthTicket a, HAuthTicket b ) => !a.Equals( b );
|
||||
public int CompareTo( HAuthTicket other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct BREAKPAD_HANDLE : IEquatable<BREAKPAD_HANDLE>, IComparable<BREAKPAD_HANDLE>
|
||||
{
|
||||
public IntPtr Value;
|
||||
|
||||
public static implicit operator BREAKPAD_HANDLE( IntPtr value ) => new BREAKPAD_HANDLE(){ Value = value };
|
||||
public static implicit operator IntPtr( BREAKPAD_HANDLE value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (BREAKPAD_HANDLE) p );
|
||||
public bool Equals( BREAKPAD_HANDLE p ) => p.Value == Value;
|
||||
public static bool operator ==( BREAKPAD_HANDLE a, BREAKPAD_HANDLE b ) => a.Equals( b );
|
||||
public static bool operator !=( BREAKPAD_HANDLE a, BREAKPAD_HANDLE b ) => !a.Equals( b );
|
||||
public int CompareTo( BREAKPAD_HANDLE other ) => Value.ToInt64().CompareTo( other.Value.ToInt64() );
|
||||
}
|
||||
|
||||
internal struct HSteamPipe : IEquatable<HSteamPipe>, IComparable<HSteamPipe>
|
||||
{
|
||||
public int Value;
|
||||
|
||||
public static implicit operator HSteamPipe( int value ) => new HSteamPipe(){ Value = value };
|
||||
public static implicit operator int( HSteamPipe value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (HSteamPipe) p );
|
||||
public bool Equals( HSteamPipe p ) => p.Value == Value;
|
||||
public static bool operator ==( HSteamPipe a, HSteamPipe b ) => a.Equals( b );
|
||||
public static bool operator !=( HSteamPipe a, HSteamPipe b ) => !a.Equals( b );
|
||||
public int CompareTo( HSteamPipe other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct HSteamUser : IEquatable<HSteamUser>, IComparable<HSteamUser>
|
||||
{
|
||||
public int Value;
|
||||
|
||||
public static implicit operator HSteamUser( int value ) => new HSteamUser(){ Value = value };
|
||||
public static implicit operator int( HSteamUser value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (HSteamUser) p );
|
||||
public bool Equals( HSteamUser p ) => p.Value == Value;
|
||||
public static bool operator ==( HSteamUser a, HSteamUser b ) => a.Equals( b );
|
||||
public static bool operator !=( HSteamUser a, HSteamUser b ) => !a.Equals( b );
|
||||
public int CompareTo( HSteamUser other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct FriendsGroupID_t : IEquatable<FriendsGroupID_t>, IComparable<FriendsGroupID_t>
|
||||
{
|
||||
public short Value;
|
||||
|
||||
public static implicit operator FriendsGroupID_t( short value ) => new FriendsGroupID_t(){ Value = value };
|
||||
public static implicit operator short( FriendsGroupID_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (FriendsGroupID_t) p );
|
||||
public bool Equals( FriendsGroupID_t p ) => p.Value == Value;
|
||||
public static bool operator ==( FriendsGroupID_t a, FriendsGroupID_t b ) => a.Equals( b );
|
||||
public static bool operator !=( FriendsGroupID_t a, FriendsGroupID_t b ) => !a.Equals( b );
|
||||
public int CompareTo( FriendsGroupID_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct HServerListRequest : IEquatable<HServerListRequest>, IComparable<HServerListRequest>
|
||||
{
|
||||
public IntPtr Value;
|
||||
|
||||
public static implicit operator HServerListRequest( IntPtr value ) => new HServerListRequest(){ Value = value };
|
||||
public static implicit operator IntPtr( HServerListRequest value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (HServerListRequest) p );
|
||||
public bool Equals( HServerListRequest p ) => p.Value == Value;
|
||||
public static bool operator ==( HServerListRequest a, HServerListRequest b ) => a.Equals( b );
|
||||
public static bool operator !=( HServerListRequest a, HServerListRequest b ) => !a.Equals( b );
|
||||
public int CompareTo( HServerListRequest other ) => Value.ToInt64().CompareTo( other.Value.ToInt64() );
|
||||
}
|
||||
|
||||
internal struct HServerQuery : IEquatable<HServerQuery>, IComparable<HServerQuery>
|
||||
{
|
||||
public int Value;
|
||||
|
||||
public static implicit operator HServerQuery( int value ) => new HServerQuery(){ Value = value };
|
||||
public static implicit operator int( HServerQuery value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (HServerQuery) p );
|
||||
public bool Equals( HServerQuery p ) => p.Value == Value;
|
||||
public static bool operator ==( HServerQuery a, HServerQuery b ) => a.Equals( b );
|
||||
public static bool operator !=( HServerQuery a, HServerQuery b ) => !a.Equals( b );
|
||||
public int CompareTo( HServerQuery other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct UGCHandle_t : IEquatable<UGCHandle_t>, IComparable<UGCHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator UGCHandle_t( ulong value ) => new UGCHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( UGCHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (UGCHandle_t) p );
|
||||
public bool Equals( UGCHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( UGCHandle_t a, UGCHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( UGCHandle_t a, UGCHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( UGCHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct PublishedFileUpdateHandle_t : IEquatable<PublishedFileUpdateHandle_t>, IComparable<PublishedFileUpdateHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator PublishedFileUpdateHandle_t( ulong value ) => new PublishedFileUpdateHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( PublishedFileUpdateHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (PublishedFileUpdateHandle_t) p );
|
||||
public bool Equals( PublishedFileUpdateHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( PublishedFileUpdateHandle_t a, PublishedFileUpdateHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( PublishedFileUpdateHandle_t a, PublishedFileUpdateHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( PublishedFileUpdateHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
public struct PublishedFileId : IEquatable<PublishedFileId>, IComparable<PublishedFileId>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator PublishedFileId( ulong value ) => new PublishedFileId(){ Value = value };
|
||||
public static implicit operator ulong( PublishedFileId value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (PublishedFileId) p );
|
||||
public bool Equals( PublishedFileId p ) => p.Value == Value;
|
||||
public static bool operator ==( PublishedFileId a, PublishedFileId b ) => a.Equals( b );
|
||||
public static bool operator !=( PublishedFileId a, PublishedFileId b ) => !a.Equals( b );
|
||||
public int CompareTo( PublishedFileId other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct UGCFileWriteStreamHandle_t : IEquatable<UGCFileWriteStreamHandle_t>, IComparable<UGCFileWriteStreamHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator UGCFileWriteStreamHandle_t( ulong value ) => new UGCFileWriteStreamHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( UGCFileWriteStreamHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (UGCFileWriteStreamHandle_t) p );
|
||||
public bool Equals( UGCFileWriteStreamHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( UGCFileWriteStreamHandle_t a, UGCFileWriteStreamHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( UGCFileWriteStreamHandle_t a, UGCFileWriteStreamHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( UGCFileWriteStreamHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct SteamLeaderboard_t : IEquatable<SteamLeaderboard_t>, IComparable<SteamLeaderboard_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator SteamLeaderboard_t( ulong value ) => new SteamLeaderboard_t(){ Value = value };
|
||||
public static implicit operator ulong( SteamLeaderboard_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (SteamLeaderboard_t) p );
|
||||
public bool Equals( SteamLeaderboard_t p ) => p.Value == Value;
|
||||
public static bool operator ==( SteamLeaderboard_t a, SteamLeaderboard_t b ) => a.Equals( b );
|
||||
public static bool operator !=( SteamLeaderboard_t a, SteamLeaderboard_t b ) => !a.Equals( b );
|
||||
public int CompareTo( SteamLeaderboard_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct SteamLeaderboardEntries_t : IEquatable<SteamLeaderboardEntries_t>, IComparable<SteamLeaderboardEntries_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator SteamLeaderboardEntries_t( ulong value ) => new SteamLeaderboardEntries_t(){ Value = value };
|
||||
public static implicit operator ulong( SteamLeaderboardEntries_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (SteamLeaderboardEntries_t) p );
|
||||
public bool Equals( SteamLeaderboardEntries_t p ) => p.Value == Value;
|
||||
public static bool operator ==( SteamLeaderboardEntries_t a, SteamLeaderboardEntries_t b ) => a.Equals( b );
|
||||
public static bool operator !=( SteamLeaderboardEntries_t a, SteamLeaderboardEntries_t b ) => !a.Equals( b );
|
||||
public int CompareTo( SteamLeaderboardEntries_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct SNetSocket_t : IEquatable<SNetSocket_t>, IComparable<SNetSocket_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator SNetSocket_t( uint value ) => new SNetSocket_t(){ Value = value };
|
||||
public static implicit operator uint( SNetSocket_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (SNetSocket_t) p );
|
||||
public bool Equals( SNetSocket_t p ) => p.Value == Value;
|
||||
public static bool operator ==( SNetSocket_t a, SNetSocket_t b ) => a.Equals( b );
|
||||
public static bool operator !=( SNetSocket_t a, SNetSocket_t b ) => !a.Equals( b );
|
||||
public int CompareTo( SNetSocket_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct SNetListenSocket_t : IEquatable<SNetListenSocket_t>, IComparable<SNetListenSocket_t>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator SNetListenSocket_t( uint value ) => new SNetListenSocket_t(){ Value = value };
|
||||
public static implicit operator uint( SNetListenSocket_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (SNetListenSocket_t) p );
|
||||
public bool Equals( SNetListenSocket_t p ) => p.Value == Value;
|
||||
public static bool operator ==( SNetListenSocket_t a, SNetListenSocket_t b ) => a.Equals( b );
|
||||
public static bool operator !=( SNetListenSocket_t a, SNetListenSocket_t b ) => !a.Equals( b );
|
||||
public int CompareTo( SNetListenSocket_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct ScreenshotHandle : IEquatable<ScreenshotHandle>, IComparable<ScreenshotHandle>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator ScreenshotHandle( uint value ) => new ScreenshotHandle(){ Value = value };
|
||||
public static implicit operator uint( ScreenshotHandle value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (ScreenshotHandle) p );
|
||||
public bool Equals( ScreenshotHandle p ) => p.Value == Value;
|
||||
public static bool operator ==( ScreenshotHandle a, ScreenshotHandle b ) => a.Equals( b );
|
||||
public static bool operator !=( ScreenshotHandle a, ScreenshotHandle b ) => !a.Equals( b );
|
||||
public int CompareTo( ScreenshotHandle other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct HTTPRequestHandle : IEquatable<HTTPRequestHandle>, IComparable<HTTPRequestHandle>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator HTTPRequestHandle( uint value ) => new HTTPRequestHandle(){ Value = value };
|
||||
public static implicit operator uint( HTTPRequestHandle value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (HTTPRequestHandle) p );
|
||||
public bool Equals( HTTPRequestHandle p ) => p.Value == Value;
|
||||
public static bool operator ==( HTTPRequestHandle a, HTTPRequestHandle b ) => a.Equals( b );
|
||||
public static bool operator !=( HTTPRequestHandle a, HTTPRequestHandle b ) => !a.Equals( b );
|
||||
public int CompareTo( HTTPRequestHandle other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct HTTPCookieContainerHandle : IEquatable<HTTPCookieContainerHandle>, IComparable<HTTPCookieContainerHandle>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator HTTPCookieContainerHandle( uint value ) => new HTTPCookieContainerHandle(){ Value = value };
|
||||
public static implicit operator uint( HTTPCookieContainerHandle value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (HTTPCookieContainerHandle) p );
|
||||
public bool Equals( HTTPCookieContainerHandle p ) => p.Value == Value;
|
||||
public static bool operator ==( HTTPCookieContainerHandle a, HTTPCookieContainerHandle b ) => a.Equals( b );
|
||||
public static bool operator !=( HTTPCookieContainerHandle a, HTTPCookieContainerHandle b ) => !a.Equals( b );
|
||||
public int CompareTo( HTTPCookieContainerHandle other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct InputHandle_t : IEquatable<InputHandle_t>, IComparable<InputHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator InputHandle_t( ulong value ) => new InputHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( InputHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (InputHandle_t) p );
|
||||
public bool Equals( InputHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( InputHandle_t a, InputHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( InputHandle_t a, InputHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( InputHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct InputActionSetHandle_t : IEquatable<InputActionSetHandle_t>, IComparable<InputActionSetHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator InputActionSetHandle_t( ulong value ) => new InputActionSetHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( InputActionSetHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (InputActionSetHandle_t) p );
|
||||
public bool Equals( InputActionSetHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( InputActionSetHandle_t a, InputActionSetHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( InputActionSetHandle_t a, InputActionSetHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( InputActionSetHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct InputDigitalActionHandle_t : IEquatable<InputDigitalActionHandle_t>, IComparable<InputDigitalActionHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator InputDigitalActionHandle_t( ulong value ) => new InputDigitalActionHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( InputDigitalActionHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (InputDigitalActionHandle_t) p );
|
||||
public bool Equals( InputDigitalActionHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( InputDigitalActionHandle_t a, InputDigitalActionHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( InputDigitalActionHandle_t a, InputDigitalActionHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( InputDigitalActionHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct InputAnalogActionHandle_t : IEquatable<InputAnalogActionHandle_t>, IComparable<InputAnalogActionHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator InputAnalogActionHandle_t( ulong value ) => new InputAnalogActionHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( InputAnalogActionHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (InputAnalogActionHandle_t) p );
|
||||
public bool Equals( InputAnalogActionHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( InputAnalogActionHandle_t a, InputAnalogActionHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( InputAnalogActionHandle_t a, InputAnalogActionHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( InputAnalogActionHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct ControllerHandle_t : IEquatable<ControllerHandle_t>, IComparable<ControllerHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator ControllerHandle_t( ulong value ) => new ControllerHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( ControllerHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (ControllerHandle_t) p );
|
||||
public bool Equals( ControllerHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( ControllerHandle_t a, ControllerHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( ControllerHandle_t a, ControllerHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( ControllerHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct ControllerActionSetHandle_t : IEquatable<ControllerActionSetHandle_t>, IComparable<ControllerActionSetHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator ControllerActionSetHandle_t( ulong value ) => new ControllerActionSetHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( ControllerActionSetHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (ControllerActionSetHandle_t) p );
|
||||
public bool Equals( ControllerActionSetHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( ControllerActionSetHandle_t a, ControllerActionSetHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( ControllerActionSetHandle_t a, ControllerActionSetHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( ControllerActionSetHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct ControllerDigitalActionHandle_t : IEquatable<ControllerDigitalActionHandle_t>, IComparable<ControllerDigitalActionHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator ControllerDigitalActionHandle_t( ulong value ) => new ControllerDigitalActionHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( ControllerDigitalActionHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (ControllerDigitalActionHandle_t) p );
|
||||
public bool Equals( ControllerDigitalActionHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( ControllerDigitalActionHandle_t a, ControllerDigitalActionHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( ControllerDigitalActionHandle_t a, ControllerDigitalActionHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( ControllerDigitalActionHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct ControllerAnalogActionHandle_t : IEquatable<ControllerAnalogActionHandle_t>, IComparable<ControllerAnalogActionHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator ControllerAnalogActionHandle_t( ulong value ) => new ControllerAnalogActionHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( ControllerAnalogActionHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (ControllerAnalogActionHandle_t) p );
|
||||
public bool Equals( ControllerAnalogActionHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( ControllerAnalogActionHandle_t a, ControllerAnalogActionHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( ControllerAnalogActionHandle_t a, ControllerAnalogActionHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( ControllerAnalogActionHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct UGCQueryHandle_t : IEquatable<UGCQueryHandle_t>, IComparable<UGCQueryHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator UGCQueryHandle_t( ulong value ) => new UGCQueryHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( UGCQueryHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (UGCQueryHandle_t) p );
|
||||
public bool Equals( UGCQueryHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( UGCQueryHandle_t a, UGCQueryHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( UGCQueryHandle_t a, UGCQueryHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( UGCQueryHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct UGCUpdateHandle_t : IEquatable<UGCUpdateHandle_t>, IComparable<UGCUpdateHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator UGCUpdateHandle_t( ulong value ) => new UGCUpdateHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( UGCUpdateHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (UGCUpdateHandle_t) p );
|
||||
public bool Equals( UGCUpdateHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( UGCUpdateHandle_t a, UGCUpdateHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( UGCUpdateHandle_t a, UGCUpdateHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( UGCUpdateHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct HHTMLBrowser : IEquatable<HHTMLBrowser>, IComparable<HHTMLBrowser>
|
||||
{
|
||||
public uint Value;
|
||||
|
||||
public static implicit operator HHTMLBrowser( uint value ) => new HHTMLBrowser(){ Value = value };
|
||||
public static implicit operator uint( HHTMLBrowser value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (HHTMLBrowser) p );
|
||||
public bool Equals( HHTMLBrowser p ) => p.Value == Value;
|
||||
public static bool operator ==( HHTMLBrowser a, HHTMLBrowser b ) => a.Equals( b );
|
||||
public static bool operator !=( HHTMLBrowser a, HHTMLBrowser b ) => !a.Equals( b );
|
||||
public int CompareTo( HHTMLBrowser other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
public struct InventoryItemId : IEquatable<InventoryItemId>, IComparable<InventoryItemId>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator InventoryItemId( ulong value ) => new InventoryItemId(){ Value = value };
|
||||
public static implicit operator ulong( InventoryItemId value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (InventoryItemId) p );
|
||||
public bool Equals( InventoryItemId p ) => p.Value == Value;
|
||||
public static bool operator ==( InventoryItemId a, InventoryItemId b ) => a.Equals( b );
|
||||
public static bool operator !=( InventoryItemId a, InventoryItemId b ) => !a.Equals( b );
|
||||
public int CompareTo( InventoryItemId other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
public struct InventoryDefId : IEquatable<InventoryDefId>, IComparable<InventoryDefId>
|
||||
{
|
||||
public int Value;
|
||||
|
||||
public static implicit operator InventoryDefId( int value ) => new InventoryDefId(){ Value = value };
|
||||
public static implicit operator int( InventoryDefId value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (InventoryDefId) p );
|
||||
public bool Equals( InventoryDefId p ) => p.Value == Value;
|
||||
public static bool operator ==( InventoryDefId a, InventoryDefId b ) => a.Equals( b );
|
||||
public static bool operator !=( InventoryDefId a, InventoryDefId b ) => !a.Equals( b );
|
||||
public int CompareTo( InventoryDefId other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct SteamInventoryResult_t : IEquatable<SteamInventoryResult_t>, IComparable<SteamInventoryResult_t>
|
||||
{
|
||||
public int Value;
|
||||
|
||||
public static implicit operator SteamInventoryResult_t( int value ) => new SteamInventoryResult_t(){ Value = value };
|
||||
public static implicit operator int( SteamInventoryResult_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (SteamInventoryResult_t) p );
|
||||
public bool Equals( SteamInventoryResult_t p ) => p.Value == Value;
|
||||
public static bool operator ==( SteamInventoryResult_t a, SteamInventoryResult_t b ) => a.Equals( b );
|
||||
public static bool operator !=( SteamInventoryResult_t a, SteamInventoryResult_t b ) => !a.Equals( b );
|
||||
public int CompareTo( SteamInventoryResult_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
internal struct SteamInventoryUpdateHandle_t : IEquatable<SteamInventoryUpdateHandle_t>, IComparable<SteamInventoryUpdateHandle_t>
|
||||
{
|
||||
public ulong Value;
|
||||
|
||||
public static implicit operator SteamInventoryUpdateHandle_t( ulong value ) => new SteamInventoryUpdateHandle_t(){ Value = value };
|
||||
public static implicit operator ulong( SteamInventoryUpdateHandle_t value ) => value.Value;
|
||||
public override string ToString() => Value.ToString();
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
public override bool Equals( object p ) => this.Equals( (SteamInventoryUpdateHandle_t) p );
|
||||
public bool Equals( SteamInventoryUpdateHandle_t p ) => p.Value == Value;
|
||||
public static bool operator ==( SteamInventoryUpdateHandle_t a, SteamInventoryUpdateHandle_t b ) => a.Equals( b );
|
||||
public static bool operator !=( SteamInventoryUpdateHandle_t a, SteamInventoryUpdateHandle_t b ) => !a.Equals( b );
|
||||
public int CompareTo( SteamInventoryUpdateHandle_t other ) => Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,365 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// An item definition. This describes an item in your Steam inventory, but is
|
||||
/// not unique to that item. For example, this might be a tshirt, but you might be able to own
|
||||
/// multiple tshirts.
|
||||
/// </summary>
|
||||
public class Definition
|
||||
{
|
||||
internal Inventory inventory;
|
||||
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// URL to an image specified by the schema, else empty
|
||||
/// </summary>
|
||||
public string IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// URL to an image specified by the schema, else empty
|
||||
/// </summary>
|
||||
public string IconLargeUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type can be whatever the schema defines.
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If this item can be created using other items this string will contain a comma seperated
|
||||
/// list of definition ids that can be used, ie "100,101;102x5;103x3,104x3"
|
||||
/// </summary>
|
||||
public string ExchangeSchema { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of recepies for creating this item. Can be null if none.
|
||||
/// </summary>
|
||||
public Recipe[] Recipes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of recepies we're included in
|
||||
/// </summary>
|
||||
public Recipe[] IngredientFor { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The raw contents of price_category from the schema
|
||||
/// </summary>
|
||||
public string PriceCategory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The dollar price from PriceRaw
|
||||
/// </summary>
|
||||
public double PriceDollars { get; internal set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The price in the local player's currency. The local player's currency
|
||||
/// is available in Invetory.Currency
|
||||
/// </summary>
|
||||
public double LocalPrice { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Local Price but probably how you want to display it (ie, $3.99, £1.99 etc )
|
||||
/// </summary>
|
||||
public string LocalPriceFormatted { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this item can be sold on the marketplace
|
||||
/// </summary>
|
||||
public bool Marketable { get; set; }
|
||||
|
||||
public bool IsGenerator
|
||||
{
|
||||
get { return Type == "generator"; }
|
||||
}
|
||||
|
||||
private Dictionary<string, string> customProperties;
|
||||
|
||||
internal Definition( Inventory i, int id )
|
||||
{
|
||||
inventory = i;
|
||||
Id = id;
|
||||
|
||||
SetupCommonProperties();
|
||||
UpdatePrice();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If you're manually occupying the Definition (because maybe you're on a server
|
||||
/// and want to hack around the fact that definitions aren't presented to you),
|
||||
/// you can use this to set propertis.
|
||||
/// </summary>
|
||||
public void SetProperty( string name, string value )
|
||||
{
|
||||
if ( customProperties == null )
|
||||
customProperties = new Dictionary<string, string>();
|
||||
|
||||
if ( !customProperties.ContainsKey( name ) )
|
||||
customProperties.Add( name, value );
|
||||
else
|
||||
customProperties[name] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a raw property from the definition schema
|
||||
/// </summary>
|
||||
public T GetProperty<T>( string name )
|
||||
{
|
||||
string val = GetStringProperty( name );
|
||||
|
||||
if ( string.IsNullOrEmpty( val ) )
|
||||
return default( T );
|
||||
|
||||
try
|
||||
{
|
||||
return (T)Convert.ChangeType( val, typeof( T ) );
|
||||
}
|
||||
catch ( System.Exception )
|
||||
{
|
||||
return default( T );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a raw property from the definition schema
|
||||
/// </summary>
|
||||
public string GetStringProperty( string name )
|
||||
{
|
||||
string val = string.Empty;
|
||||
|
||||
if ( customProperties != null && customProperties.ContainsKey( name ) )
|
||||
return customProperties[name];
|
||||
|
||||
if ( !inventory.inventory.GetItemDefinitionProperty( Id, name, out val ) )
|
||||
return string.Empty;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a raw property from the definition schema
|
||||
/// </summary>
|
||||
public bool GetBoolProperty( string name )
|
||||
{
|
||||
string val = GetStringProperty( name );
|
||||
|
||||
if ( val.Length == 0 ) return false;
|
||||
if ( val[0] == '0' || val[0] == 'F'|| val[0] == 'f' ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal void SetupCommonProperties()
|
||||
{
|
||||
Name = GetStringProperty( "name" );
|
||||
Description = GetStringProperty( "description" );
|
||||
Created = GetProperty<DateTime>( "timestamp" );
|
||||
Modified = GetProperty<DateTime>( "modified" );
|
||||
ExchangeSchema = GetStringProperty( "exchange" );
|
||||
IconUrl = GetStringProperty( "icon_url" );
|
||||
IconLargeUrl = GetStringProperty( "icon_url_large" );
|
||||
Type = GetStringProperty( "type" );
|
||||
PriceCategory = GetStringProperty( "price_category" );
|
||||
Marketable = GetBoolProperty( "marketable" );
|
||||
|
||||
if ( !string.IsNullOrEmpty( PriceCategory ) )
|
||||
{
|
||||
PriceDollars = PriceCategoryToFloat( PriceCategory );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger an item drop. Call this when it's a good time to award
|
||||
/// an item drop to a player. This won't automatically result in giving
|
||||
/// an item to a player. Just call it every minute or so, or on launch.
|
||||
/// ItemDefinition is usually a generator
|
||||
/// </summary>
|
||||
public void TriggerItemDrop()
|
||||
{
|
||||
inventory.TriggerItemDrop( Id );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a promo item drop. You can call this at startup, it won't
|
||||
/// give users multiple promo drops.
|
||||
/// </summary>
|
||||
public void TriggerPromoDrop()
|
||||
{
|
||||
inventory.TriggerPromoDrop( Id );
|
||||
}
|
||||
|
||||
internal void Link( Definition[] definitions )
|
||||
{
|
||||
LinkExchange( definitions );
|
||||
}
|
||||
|
||||
private void LinkExchange( Definition[] definitions )
|
||||
{
|
||||
if ( string.IsNullOrEmpty( ExchangeSchema ) ) return;
|
||||
|
||||
var parts = ExchangeSchema.Split( new[] { ';' }, StringSplitOptions.RemoveEmptyEntries );
|
||||
|
||||
Recipes = parts.Select( x => Recipe.FromString( x, definitions, this ) ).ToArray();
|
||||
}
|
||||
|
||||
internal void InRecipe( Recipe r )
|
||||
{
|
||||
if ( IngredientFor == null )
|
||||
IngredientFor = new Recipe[0];
|
||||
|
||||
var list = new List<Recipe>( IngredientFor );
|
||||
list.Add( r );
|
||||
|
||||
IngredientFor = list.ToArray();
|
||||
}
|
||||
|
||||
internal void UpdatePrice()
|
||||
{
|
||||
if ( inventory.inventory.GetItemPrice( Id, out ulong price) )
|
||||
{
|
||||
LocalPrice = price / 100.0;
|
||||
LocalPriceFormatted = Utility.FormatPrice( inventory.Currency, price );
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalPrice = 0;
|
||||
LocalPriceFormatted = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a promo item drop. You can call this at startup, it won't
|
||||
/// give users multiple promo drops.
|
||||
/// </summary>
|
||||
public void TriggerPromoDrop( int definitionId )
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t result = 0;
|
||||
inventory.AddPromoItem( ref result, definitionId );
|
||||
inventory.DestroyResult( result );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger an item drop for this user. This is for timed drops. For promo
|
||||
/// drops use TriggerPromoDrop.
|
||||
/// </summary>
|
||||
public void TriggerItemDrop( int definitionId )
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t result = 0;
|
||||
inventory.TriggerItemDrop( ref result, definitionId );
|
||||
inventory.DestroyResult( result );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grant all promotional items the user is eligible for.
|
||||
/// </summary>
|
||||
public void GrantAllPromoItems()
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t result = 0;
|
||||
inventory.GrantPromoItems( ref result );
|
||||
inventory.DestroyResult( result );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a crafting recepie which was defined using the exchange
|
||||
/// section in the item schema.
|
||||
/// </summary>
|
||||
public struct Recipe
|
||||
{
|
||||
public struct Ingredient
|
||||
{
|
||||
/// <summary>
|
||||
/// The definition ID of the ingredient.
|
||||
/// </summary>
|
||||
public int DefinitionId;
|
||||
|
||||
/// <summary>
|
||||
/// If we don't know about this item definition this might be null.
|
||||
/// In which case, DefinitionId should still hold the correct id.
|
||||
/// </summary>
|
||||
public Definition Definition;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of this item needed. Generally this will be 1.
|
||||
/// </summary>
|
||||
public int Count;
|
||||
|
||||
internal static Ingredient FromString( string part, Definition[] definitions )
|
||||
{
|
||||
var i = new Ingredient();
|
||||
i.Count = 1;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if ( part.Contains( 'x' ) )
|
||||
{
|
||||
var idx = part.IndexOf( 'x' );
|
||||
|
||||
int count = 0;
|
||||
if ( int.TryParse( part.Substring( idx + 1 ), out count ) )
|
||||
i.Count = count;
|
||||
|
||||
part = part.Substring( 0, idx );
|
||||
}
|
||||
|
||||
i.DefinitionId = int.Parse( part );
|
||||
i.Definition = definitions.FirstOrDefault( x => x.Id == i.DefinitionId );
|
||||
|
||||
}
|
||||
catch ( System.Exception )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The item that this will create.
|
||||
/// </summary>
|
||||
public Definition Result;
|
||||
|
||||
/// <summary>
|
||||
/// The items, with quantity required to create this item.
|
||||
/// </summary>
|
||||
public Ingredient[] Ingredients;
|
||||
|
||||
internal static Recipe FromString( string part, Definition[] definitions, Definition Result )
|
||||
{
|
||||
var r = new Recipe();
|
||||
r.Result = Result;
|
||||
var parts = part.Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries );
|
||||
|
||||
r.Ingredients = parts.Select( x => Ingredient.FromString( x, definitions ) ).Where( x => x.DefinitionId != 0 ).ToArray();
|
||||
|
||||
foreach ( var i in r.Ingredients )
|
||||
{
|
||||
if ( i.Definition == null )
|
||||
continue;
|
||||
|
||||
i.Definition.InRecipe( r );
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// An item in your inventory.
|
||||
/// </summary>
|
||||
public class Item : IEquatable<Item>
|
||||
{
|
||||
internal Item( Inventory Inventory, ulong Id, int Quantity, int DefinitionId )
|
||||
{
|
||||
this.Inventory = Inventory;
|
||||
this.Id = Id;
|
||||
this.Quantity = Quantity;
|
||||
this.DefinitionId = DefinitionId;
|
||||
}
|
||||
|
||||
public struct Amount
|
||||
{
|
||||
public Item Item;
|
||||
public int Quantity;
|
||||
}
|
||||
|
||||
public ulong Id;
|
||||
public int Quantity;
|
||||
|
||||
public int DefinitionId;
|
||||
|
||||
internal Inventory Inventory;
|
||||
|
||||
public Dictionary<string, string> Properties { get; internal set; }
|
||||
|
||||
private Definition _cachedDefinition;
|
||||
|
||||
/// <summary>
|
||||
/// Careful, this might not be available. Especially on a game server.
|
||||
/// </summary>
|
||||
public Definition Definition
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _cachedDefinition != null )
|
||||
return _cachedDefinition;
|
||||
|
||||
_cachedDefinition = Inventory.FindDefinition( DefinitionId );
|
||||
return _cachedDefinition;
|
||||
}
|
||||
}
|
||||
|
||||
public bool TradeLocked;
|
||||
|
||||
public bool Equals(Item other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return Id == other.Id;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
return Equals((Item)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Id.GetHashCode();
|
||||
}
|
||||
|
||||
public static bool operator ==(Item left, Item right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Item left, Item right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Consumes items from a user's inventory. If the quantity of the given item goes to zero, it is permanently removed.
|
||||
/// Once an item is removed it cannot be recovered.This is not for the faint of heart - if your game implements item removal at all,
|
||||
/// a high-friction UI confirmation process is highly recommended.ConsumeItem can be restricted to certain item definitions or fully
|
||||
/// blocked via the Steamworks website to minimize support/abuse issues such as the classic "my brother borrowed my laptop and deleted all of my rare items".
|
||||
/// </summary>
|
||||
public Result Consume( int amount = 1 )
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
||||
if ( !Inventory.inventory.ConsumeItem( ref resultHandle, Id, (uint)amount ) )
|
||||
return null;
|
||||
|
||||
return new Result( Inventory, resultHandle, true );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Split stack into two items
|
||||
/// </summary>
|
||||
public Result SplitStack( int quantity = 1 )
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
||||
if ( !Inventory.inventory.TransferItemQuantity( ref resultHandle, Id, (uint)quantity, ulong.MaxValue ) )
|
||||
return null;
|
||||
|
||||
return new Result( Inventory, resultHandle, true );
|
||||
}
|
||||
|
||||
SteamNative.SteamInventoryUpdateHandle_t updateHandle;
|
||||
|
||||
private void UpdatingProperties()
|
||||
{
|
||||
if (!Inventory.EnableItemProperties)
|
||||
throw new InvalidOperationException("Item properties are disabled.");
|
||||
|
||||
if (updateHandle != 0) return;
|
||||
|
||||
updateHandle = Inventory.inventory.StartUpdateProperties();
|
||||
}
|
||||
|
||||
public bool SetProperty( string name, string value )
|
||||
{
|
||||
UpdatingProperties();
|
||||
Properties[name] = value.ToString();
|
||||
return Inventory.inventory.SetProperty(updateHandle, Id, name, value);
|
||||
}
|
||||
|
||||
public bool SetProperty(string name, bool value)
|
||||
{
|
||||
UpdatingProperties();
|
||||
Properties[name] = value.ToString();
|
||||
return Inventory.inventory.SetProperty0(updateHandle, Id, name, value);
|
||||
}
|
||||
|
||||
public bool SetProperty(string name, long value)
|
||||
{
|
||||
UpdatingProperties();
|
||||
Properties[name] = value.ToString();
|
||||
return Inventory.inventory.SetProperty1(updateHandle, Id, name, value);
|
||||
}
|
||||
|
||||
public bool SetProperty(string name, float value)
|
||||
{
|
||||
UpdatingProperties();
|
||||
Properties[name] = value.ToString();
|
||||
return Inventory.inventory.SetProperty2(updateHandle, Id, name, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called to finalize any changes made using SetProperty
|
||||
/// </summary>
|
||||
public bool SubmitProperties()
|
||||
{
|
||||
if (updateHandle == 0)
|
||||
throw new Exception("SubmitProperties called without updating properties");
|
||||
|
||||
try
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t result = -1;
|
||||
|
||||
if (!Inventory.inventory.SubmitUpdateProperties(updateHandle, ref result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Inventory.inventory.DestroyResult(result);
|
||||
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
updateHandle = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Inventory
|
||||
{
|
||||
public class Result : IDisposable
|
||||
{
|
||||
internal static Dictionary< int, Result > Pending;
|
||||
internal Inventory inventory;
|
||||
|
||||
private SteamNative.SteamInventoryResult_t Handle { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Called when result is successfully returned
|
||||
/// </summary>
|
||||
public Action<Result> OnResult;
|
||||
|
||||
/// <summary>
|
||||
/// Items that exist, or that have been created, or changed
|
||||
/// </summary>
|
||||
public Item[] Items { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Items that have been removed or somehow destroyed
|
||||
/// </summary>
|
||||
public Item[] Removed { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Items that have been consumed, like in a craft or something
|
||||
/// </summary>
|
||||
public Item[] Consumed { get; internal set; }
|
||||
|
||||
protected bool _gotResult = false;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this result is still pending
|
||||
/// </summary>
|
||||
public bool IsPending
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _gotResult ) return false;
|
||||
|
||||
if ( Status() == Callbacks.Result.OK )
|
||||
{
|
||||
Fill();
|
||||
return false;
|
||||
}
|
||||
|
||||
return Status() == Callbacks.Result.Pending;
|
||||
}
|
||||
}
|
||||
|
||||
internal uint Timestamp { get; private set; }
|
||||
|
||||
internal bool IsSuccess
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Items != null ) return true;
|
||||
if ( Handle == -1 ) return false;
|
||||
return Status() == Callbacks.Result.OK;
|
||||
}
|
||||
}
|
||||
|
||||
internal Callbacks.Result Status()
|
||||
{
|
||||
if ( Handle == -1 ) return Callbacks.Result.InvalidParam;
|
||||
return (Callbacks.Result)inventory.inventory.GetResultStatus( Handle );
|
||||
}
|
||||
|
||||
internal Result( Inventory inventory, int Handle, bool pending )
|
||||
{
|
||||
if ( pending )
|
||||
{
|
||||
Pending.Add( Handle, this );
|
||||
}
|
||||
|
||||
this.Handle = Handle;
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
|
||||
internal void Fill()
|
||||
{
|
||||
if ( _gotResult )
|
||||
return;
|
||||
|
||||
if ( Items != null )
|
||||
return;
|
||||
|
||||
if ( Status() != Callbacks.Result.OK )
|
||||
return;
|
||||
|
||||
_gotResult = true;
|
||||
|
||||
Timestamp = inventory.inventory.GetResultTimestamp( Handle );
|
||||
|
||||
SteamNative.SteamItemDetails_t[] steamItems = inventory.inventory.GetResultItems( Handle );
|
||||
|
||||
if ( steamItems == null )
|
||||
return;
|
||||
|
||||
var tempItems = new List<Item>();
|
||||
var tempRemoved = new List<Item>();
|
||||
var tempConsumed = new List<Item>();
|
||||
|
||||
for ( int i=0; i< steamItems.Length; i++ )
|
||||
{
|
||||
var item = inventory.ItemFrom( Handle, steamItems[i], i );
|
||||
if ( item == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ( steamItems[i].Flags & (int)SteamNative.SteamItemFlags.Removed ) != 0 )
|
||||
{
|
||||
tempRemoved.Add(item);
|
||||
}
|
||||
else if ((steamItems[i].Flags & (int)SteamNative.SteamItemFlags.Consumed) != 0)
|
||||
{
|
||||
tempConsumed.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempItems.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
Items = tempItems.ToArray();
|
||||
Removed = tempRemoved.ToArray();
|
||||
Consumed = tempConsumed.ToArray();
|
||||
|
||||
if ( OnResult != null )
|
||||
{
|
||||
OnResult( this );
|
||||
}
|
||||
}
|
||||
|
||||
internal void OnSteamResult( SteamInventoryResultReady_t data )
|
||||
{
|
||||
var success = data.Result == SteamNative.Result.OK;
|
||||
|
||||
if ( success )
|
||||
{
|
||||
Fill();
|
||||
}
|
||||
}
|
||||
|
||||
internal unsafe byte[] Serialize()
|
||||
{
|
||||
uint size = 0;
|
||||
|
||||
if ( !inventory.inventory.SerializeResult( Handle, IntPtr.Zero, out size ) )
|
||||
return null;
|
||||
|
||||
var data = new byte[size];
|
||||
|
||||
fixed ( byte* ptr = data )
|
||||
{
|
||||
if ( !inventory.inventory.SerializeResult( Handle, (IntPtr)ptr, out size ) )
|
||||
return null;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if ( Handle != -1 && inventory != null )
|
||||
{
|
||||
inventory.inventory.DestroyResult( Handle );
|
||||
Handle = -1;
|
||||
}
|
||||
|
||||
inventory = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal Item ItemFrom( SteamInventoryResult_t handle, SteamItemDetails_t detail, int index )
|
||||
{
|
||||
Dictionary<string, string> props = null;
|
||||
|
||||
if ( EnableItemProperties && inventory.GetResultItemProperty(handle, (uint) index, null, out string propertyNames) )
|
||||
{
|
||||
props = new Dictionary<string, string>();
|
||||
|
||||
foreach ( var propertyName in propertyNames.Split( ',' ) )
|
||||
{
|
||||
if ( inventory.GetResultItemProperty(handle, (uint)index, propertyName, out string propertyValue ) )
|
||||
{
|
||||
if (propertyName == "error")
|
||||
{
|
||||
Console.Write("Steam item error: ");
|
||||
Console.WriteLine(propertyValue);
|
||||
return null;
|
||||
}
|
||||
|
||||
props.Add(propertyName, propertyValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var item = new Item( this, detail.ItemId, detail.Quantity, detail.Definition );
|
||||
item.Properties = props;
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,487 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Inventory : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when the local client's items are first retrieved, and when they change.
|
||||
/// Obviously not called on the server.
|
||||
/// </summary>
|
||||
public event Action OnUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// A list of items owned by this user. You should call Refresh() before trying to access this,
|
||||
/// and then wait until it's non null or listen to OnUpdate to find out immediately when it's populated.
|
||||
/// </summary>
|
||||
public Item[] Items;
|
||||
|
||||
/// <summary>
|
||||
/// You can send this data to a server, or another player who can then deserialize it
|
||||
/// and get a verified list of items.
|
||||
/// </summary>
|
||||
public byte[] SerializedItems;
|
||||
|
||||
/// <summary>
|
||||
/// Serialized data exprires after an hour. This is the time the value in SerializedItems will expire.
|
||||
/// </summary>
|
||||
public DateTime SerializedExpireTime;
|
||||
|
||||
/// <summary>
|
||||
/// Controls whether per-item properties (<see cref="Item.Properties"/>) are available or not. Default true.
|
||||
/// This can improve performance of full inventory updates.
|
||||
/// </summary>
|
||||
public bool EnableItemProperties = true;
|
||||
|
||||
internal uint LastTimestamp = 0;
|
||||
|
||||
internal SteamNative.SteamInventory inventory;
|
||||
|
||||
private bool IsServer { get; set; }
|
||||
|
||||
public event Action OnDefinitionsUpdated;
|
||||
|
||||
public event Action<Result> OnInventoryResultReady;
|
||||
|
||||
internal Inventory( BaseSteamworks steamworks, SteamNative.SteamInventory c, bool server )
|
||||
{
|
||||
IsServer = server;
|
||||
inventory = c;
|
||||
|
||||
steamworks.RegisterCallback<SteamNative.SteamInventoryDefinitionUpdate_t>( onDefinitionsUpdated );
|
||||
|
||||
Result.Pending = new Dictionary<int, Result>();
|
||||
|
||||
FetchItemDefinitions();
|
||||
LoadDefinitions();
|
||||
UpdatePrices();
|
||||
|
||||
if ( !server )
|
||||
{
|
||||
steamworks.RegisterCallback<SteamNative.SteamInventoryResultReady_t>( onResultReady );
|
||||
steamworks.RegisterCallback<SteamNative.SteamInventoryFullUpdate_t>( onFullUpdate );
|
||||
|
||||
|
||||
//
|
||||
// Get a list of our items immediately
|
||||
//
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should get called when the definitions get updated from Steam.
|
||||
/// </summary>
|
||||
private void onDefinitionsUpdated( SteamInventoryDefinitionUpdate_t obj )
|
||||
{
|
||||
LoadDefinitions();
|
||||
UpdatePrices();
|
||||
|
||||
if ( OnDefinitionsUpdated != null )
|
||||
{
|
||||
OnDefinitionsUpdated.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private bool LoadDefinitions()
|
||||
{
|
||||
var ids = inventory.GetItemDefinitionIDs();
|
||||
if ( ids == null )
|
||||
return false;
|
||||
|
||||
Definitions = ids.Select( x => CreateDefinition( x ) ).ToArray();
|
||||
|
||||
foreach ( var def in Definitions )
|
||||
{
|
||||
def.Link( Definitions );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We've received a FULL update
|
||||
/// </summary>
|
||||
private void onFullUpdate( SteamInventoryFullUpdate_t data )
|
||||
{
|
||||
var result = new Result( this, data.Handle, false );
|
||||
result.Fill();
|
||||
|
||||
onResult( result, true );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A generic result has returned.
|
||||
/// </summary>
|
||||
private void onResultReady( SteamInventoryResultReady_t data )
|
||||
{
|
||||
Result result;
|
||||
if ( Result.Pending.TryGetValue( data.Handle, out result ) )
|
||||
{
|
||||
result.OnSteamResult( data );
|
||||
|
||||
if ( data.Result == SteamNative.Result.OK )
|
||||
{
|
||||
onResult( result, false );
|
||||
}
|
||||
|
||||
Result.Pending.Remove( data.Handle );
|
||||
result.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new Result(this, data.Handle, false);
|
||||
result.Fill();
|
||||
}
|
||||
|
||||
OnInventoryResultReady?.Invoke(result);
|
||||
}
|
||||
|
||||
private void onResult( Result r, bool isFullUpdate )
|
||||
{
|
||||
if ( r.IsSuccess )
|
||||
{
|
||||
//
|
||||
// We only serialize FULL updates
|
||||
//
|
||||
if ( isFullUpdate )
|
||||
{
|
||||
//
|
||||
// Only serialize if this result is newer than the last one
|
||||
//
|
||||
if ( r.Timestamp < LastTimestamp )
|
||||
return;
|
||||
|
||||
SerializedItems = r.Serialize();
|
||||
SerializedExpireTime = DateTime.Now.Add( TimeSpan.FromMinutes( 60 ) );
|
||||
}
|
||||
|
||||
LastTimestamp = r.Timestamp;
|
||||
ApplyResult( r, isFullUpdate );
|
||||
}
|
||||
|
||||
r.Dispose();
|
||||
r = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply this result to our current stack of Items
|
||||
/// Here we're trying to keep our stack up to date with whatever happens
|
||||
/// with the crafting, stacking etc
|
||||
/// </summary>
|
||||
internal void ApplyResult( Result r, bool isFullUpdate )
|
||||
{
|
||||
if ( IsServer ) return;
|
||||
|
||||
if ( r.IsSuccess && r.Items != null )
|
||||
{
|
||||
if ( Items == null )
|
||||
Items = new Item[0];
|
||||
|
||||
if (isFullUpdate)
|
||||
{
|
||||
Items = r.Items;
|
||||
}
|
||||
else
|
||||
{
|
||||
// keep the new item instance because it might have a different quantity, properties, etc
|
||||
Items = Items
|
||||
.UnionSelect(r.Items, (oldItem, newItem) => newItem)
|
||||
.Where(x => !r.Removed.Contains(x))
|
||||
.Where(x => !r.Consumed.Contains(x))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
//
|
||||
// Tell everyone we've got new items!
|
||||
//
|
||||
OnUpdate?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
inventory = null;
|
||||
|
||||
Items = null;
|
||||
SerializedItems = null;
|
||||
|
||||
Result.Pending = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this at least every two minutes, every frame doesn't hurt.
|
||||
/// You should call it when you consider it active play time.
|
||||
/// IE - your player is alive, and playing.
|
||||
/// Don't stress on it too much tho cuz it's super hijackable anyway.
|
||||
/// </summary>
|
||||
[Obsolete( "No longer required, will be removed in a later version" )]
|
||||
public void PlaytimeHeartbeat()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this to retrieve the items.
|
||||
/// Note that if this has already been called it won't
|
||||
/// trigger a call to OnUpdate unless the items have changed
|
||||
/// </summary>
|
||||
public void Refresh()
|
||||
{
|
||||
if ( IsServer ) return;
|
||||
|
||||
SteamNative.SteamInventoryResult_t request = 0;
|
||||
if ( !inventory.GetAllItems( ref request ) || request == -1 )
|
||||
{
|
||||
Console.WriteLine( "GetAllItems failed!?" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Some definitions aren't sent to the client, and all aren't available on the server.
|
||||
/// Manually getting a Definition here lets you call functions on those definitions.
|
||||
/// </summary>
|
||||
public Definition CreateDefinition( int id )
|
||||
{
|
||||
return new Definition( this, id );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetch item definitions in case new ones have been added since we've initialized
|
||||
/// </summary>
|
||||
public void FetchItemDefinitions()
|
||||
{
|
||||
inventory.LoadItemDefinitions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// No need to call this manually if you're calling Update
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of items defined for this app.
|
||||
/// This should be immediately populated and available.
|
||||
/// </summary>
|
||||
public Definition[] Definitions;
|
||||
|
||||
/// <summary>
|
||||
/// A list of item definitions that have prices and so can be bought.
|
||||
/// </summary>
|
||||
public IEnumerable<Definition> DefinitionsWithPrices
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Definitions == null )
|
||||
yield break;
|
||||
|
||||
for ( int i=0; i< Definitions.Length; i++ )
|
||||
{
|
||||
if (Definitions[i].LocalPrice > 0)
|
||||
yield return Definitions[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Utility, given a "1;VLV250" string, convert it to a 2.5
|
||||
/// </summary>
|
||||
public static float PriceCategoryToFloat( string price )
|
||||
{
|
||||
if ( string.IsNullOrEmpty( price ) )
|
||||
return 0.0f;
|
||||
|
||||
price = price.Replace( "1;VLV", "" );
|
||||
|
||||
int iPrice = 0;
|
||||
if ( !int.TryParse( price, out iPrice ) )
|
||||
return 0.0f;
|
||||
|
||||
return int.Parse( price ) / 100.0f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We might be better off using a dictionary for this, once there's 1000+ definitions
|
||||
/// </summary>
|
||||
public Definition FindDefinition( int DefinitionId )
|
||||
{
|
||||
if ( Definitions == null ) return null;
|
||||
|
||||
for( int i=0; i< Definitions.Length; i++ )
|
||||
{
|
||||
if ( Definitions[i].Id == DefinitionId )
|
||||
return Definitions[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public unsafe Result Deserialize( byte[] data, int dataLength = -1 )
|
||||
{
|
||||
if (data == null)
|
||||
throw new ArgumentException("data should nto be null");
|
||||
|
||||
if ( dataLength == -1 )
|
||||
dataLength = data.Length;
|
||||
|
||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
||||
|
||||
fixed ( byte* ptr = data )
|
||||
{
|
||||
var result = inventory.DeserializeResult( ref resultHandle, (IntPtr) ptr, (uint)dataLength, false );
|
||||
if ( !result || resultHandle == -1 )
|
||||
return null;
|
||||
|
||||
var r = new Result( this, resultHandle, false );
|
||||
r.Fill();
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crafting! Uses the passed items to buy the target item.
|
||||
/// You need to have set up the appropriate exchange rules in your item
|
||||
/// definitions. This assumes all the items passed in aren't stacked.
|
||||
/// </summary>
|
||||
public Result CraftItem( Item[] list, Definition target )
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
||||
|
||||
var newItems = new SteamNative.SteamItemDef_t[] { new SteamNative.SteamItemDef_t() { Value = target.Id } };
|
||||
var newItemC = new uint[] { 1 };
|
||||
|
||||
var takeItems = list.Select( x => (SteamNative.SteamItemInstanceID_t)x.Id ).ToArray();
|
||||
var takeItemsC = list.Select( x => (uint)1 ).ToArray();
|
||||
|
||||
if ( !inventory.ExchangeItems( ref resultHandle, newItems, newItemC, 1, takeItems, takeItemsC, (uint)takeItems.Length ) )
|
||||
return null;
|
||||
|
||||
return new Result( this, resultHandle, true );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crafting! Uses the passed items to buy the target item.
|
||||
/// You need to have set up the appropriate exchange rules in your item
|
||||
/// definitions.
|
||||
/// </summary>
|
||||
public Result CraftItem( Item.Amount[] list, Definition target )
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
||||
|
||||
var newItems = new SteamNative.SteamItemDef_t[] { new SteamNative.SteamItemDef_t() { Value = target.Id } };
|
||||
var newItemC = new uint[] { 1 };
|
||||
|
||||
var takeItems = list.Select( x => (SteamNative.SteamItemInstanceID_t)x.Item.Id ).ToArray();
|
||||
var takeItemsC = list.Select( x => (uint)x.Quantity ).ToArray();
|
||||
|
||||
if ( !inventory.ExchangeItems( ref resultHandle, newItems, newItemC, 1, takeItems, takeItemsC, (uint)takeItems.Length ) )
|
||||
return null;
|
||||
|
||||
return new Result( this, resultHandle, true );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Split stack into two items
|
||||
/// </summary>
|
||||
public Result SplitStack( Item item, int quantity = 1 )
|
||||
{
|
||||
return item.SplitStack( quantity );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stack source item onto dest item
|
||||
/// </summary>
|
||||
public Result Stack( Item source, Item dest, int quantity = 1 )
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
||||
if ( !inventory.TransferItemQuantity( ref resultHandle, source.Id, (uint)quantity, dest.Id ) )
|
||||
return null;
|
||||
|
||||
return new Result( this, resultHandle, true );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used to grant a specific item to the user. This should
|
||||
/// only be used for development prototyping, from a trusted server,
|
||||
/// or if you don't care about hacked clients granting arbitrary items.
|
||||
/// This call can be disabled by a setting on Steamworks.
|
||||
/// </summary>
|
||||
public Result GenerateItem( Definition target, int amount )
|
||||
{
|
||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
||||
|
||||
var newItems = new SteamNative.SteamItemDef_t[] { new SteamNative.SteamItemDef_t() { Value = target.Id } };
|
||||
var newItemC = new uint[] { (uint) amount };
|
||||
|
||||
if ( !inventory.GenerateItems( ref resultHandle, newItems, newItemC, 1 ) )
|
||||
return null;
|
||||
|
||||
return new Result( this, resultHandle, true );
|
||||
}
|
||||
|
||||
public delegate void StartPurchaseSuccess( ulong orderId, ulong transactionId );
|
||||
|
||||
/// <summary>
|
||||
/// Starts the purchase process for the user, given a "shopping cart" of item definitions that the user would like to buy.
|
||||
/// The user will be prompted in the Steam Overlay to complete the purchase in their local currency, funding their Steam Wallet if necessary, etc.
|
||||
///
|
||||
/// If was succesful the callback orderId and transactionId will be non 0
|
||||
/// </summary>
|
||||
public bool StartPurchase( Definition[] items, StartPurchaseSuccess callback = null )
|
||||
{
|
||||
var itemGroup = items.GroupBy(x => x.Id);
|
||||
|
||||
var newItems = itemGroup.Select( x => new SteamItemDef_t { Value = x.Key } ).ToArray();
|
||||
var newItemC = itemGroup.Select( x => (uint) x.Count() ).ToArray();
|
||||
|
||||
var h = inventory.StartPurchase( newItems, newItemC, (uint) newItemC.Length, ( result, error ) =>
|
||||
{
|
||||
if ( error )
|
||||
{
|
||||
callback?.Invoke(0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback?.Invoke(result.OrderID, result.TransID);
|
||||
}
|
||||
});
|
||||
|
||||
return h != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This might be null until Steam has actually recieved the prices.
|
||||
/// </summary>
|
||||
public string Currency { get; private set; }
|
||||
|
||||
public void UpdatePrices()
|
||||
{
|
||||
if (IsServer)
|
||||
return;
|
||||
|
||||
inventory.RequestPrices((result, b) =>
|
||||
{
|
||||
Currency = result.Currency;
|
||||
|
||||
if ( Definitions == null )
|
||||
return;
|
||||
|
||||
for (int i = 0; i < Definitions.Length; i++)
|
||||
{
|
||||
Definitions[i].UpdatePrice();
|
||||
}
|
||||
|
||||
OnUpdate?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class Networking : IDisposable
|
||||
{
|
||||
private static byte[] ReceiveBuffer = new byte[1024 * 64];
|
||||
|
||||
public delegate void OnRecievedP2PData( ulong steamid, byte[] data, int dataLength, int channel );
|
||||
|
||||
public OnRecievedP2PData OnP2PData;
|
||||
public Func<ulong, bool> OnIncomingConnection;
|
||||
public Action<ulong, SessionError> OnConnectionFailed;
|
||||
|
||||
private List<int> ListenChannels = new List<int>();
|
||||
|
||||
private System.Diagnostics.Stopwatch UpdateTimer = System.Diagnostics.Stopwatch.StartNew();
|
||||
|
||||
internal SteamNative.SteamNetworking networking;
|
||||
|
||||
internal Networking( BaseSteamworks steamworks, SteamNative.SteamNetworking networking )
|
||||
{
|
||||
this.networking = networking;
|
||||
|
||||
steamworks.RegisterCallback<SteamNative.P2PSessionRequest_t>( onP2PConnectionRequest );
|
||||
steamworks.RegisterCallback<SteamNative.P2PSessionConnectFail_t>( onP2PConnectionFailed );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
networking = null;
|
||||
|
||||
OnIncomingConnection = null;
|
||||
OnConnectionFailed = null;
|
||||
OnP2PData = null;
|
||||
lock (ListenChannels)
|
||||
{
|
||||
ListenChannels.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// No need to call this manually if you're calling Update()
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
if ( OnP2PData == null )
|
||||
return;
|
||||
|
||||
// Update every 60th of a second
|
||||
if ( UpdateTimer.Elapsed.TotalSeconds < 1.0 / 60.0 )
|
||||
return;
|
||||
|
||||
UpdateTimer.Reset();
|
||||
UpdateTimer.Start();
|
||||
|
||||
lock (ListenChannels)
|
||||
{
|
||||
for (int i = 0; i < ListenChannels.Count; i++)
|
||||
{
|
||||
while (ReadP2PPacket(ListenChannels[i]))
|
||||
{
|
||||
//handle listen channel being closed by OnP2PData callback
|
||||
if (i >= ListenChannels.Count) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable listening on a specific channel.
|
||||
/// If you don't enable the channel we won't listen to it,
|
||||
/// so you won't be able to receive messages on it.
|
||||
/// </summary>
|
||||
public void SetListenChannel( int ChannelId, bool Listen )
|
||||
{
|
||||
lock (ListenChannels)
|
||||
{
|
||||
ListenChannels.RemoveAll(x => x == ChannelId);
|
||||
|
||||
if (Listen)
|
||||
{
|
||||
ListenChannels.Add(ChannelId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onP2PConnectionRequest( SteamNative.P2PSessionRequest_t o )
|
||||
{
|
||||
if ( OnIncomingConnection != null )
|
||||
{
|
||||
var accept = OnIncomingConnection( o.SteamIDRemote );
|
||||
|
||||
if ( accept )
|
||||
{
|
||||
networking.AcceptP2PSessionWithUser( o.SteamIDRemote );
|
||||
}
|
||||
else
|
||||
{
|
||||
networking.CloseP2PSessionWithUser( o.SteamIDRemote );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Default is to reject the session
|
||||
//
|
||||
networking.CloseP2PSessionWithUser( o.SteamIDRemote );
|
||||
}
|
||||
|
||||
public enum SessionError : byte
|
||||
{
|
||||
None = 0,
|
||||
NotRunningApp = 1, // target is not running the same game
|
||||
NoRightsToApp = 2, // local user doesn't own the app that is running
|
||||
DestinationNotLoggedIn = 3, // target user isn't connected to Steam
|
||||
Timeout = 4, // target isn't responding, perhaps not calling AcceptP2PSessionWithUser()
|
||||
// corporate firewalls can also block this (NAT traversal is not firewall traversal)
|
||||
// make sure that UDP ports 3478, 4379, and 4380 are open in an outbound direction
|
||||
Max = 5
|
||||
};
|
||||
|
||||
private void onP2PConnectionFailed( SteamNative.P2PSessionConnectFail_t o )
|
||||
{
|
||||
if ( OnConnectionFailed != null )
|
||||
{
|
||||
OnConnectionFailed( o.SteamIDRemote, (SessionError) o.P2PSessionError );
|
||||
}
|
||||
}
|
||||
|
||||
public enum SendType : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic UDP send. Packets can't be bigger than 1200 bytes (your typical MTU size). Can be lost, or arrive out of order (rare).
|
||||
/// 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.
|
||||
/// </summary>
|
||||
|
||||
Unreliable = 0,
|
||||
|
||||
/// <summary>
|
||||
/// As above, but if the underlying p2p connection isn't yet established the packet will just be thrown away. Using this on the first
|
||||
/// packet sent to a remote host almost guarantees the packet will be dropped.
|
||||
/// This is only really useful for kinds of data that should never buffer up, i.e. voice payload packets
|
||||
/// </summary>
|
||||
UnreliableNoDelay = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Reliable message send. Can send up to 1MB of data 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.
|
||||
/// </summary>
|
||||
Reliable = 2,
|
||||
|
||||
/// <summary>
|
||||
/// As above, but applies the Nagle algorithm to the send - sends will accumulate
|
||||
/// until the current MTU size (typically ~1200 bytes, but can change) or ~200ms has passed (Nagle algorithm).
|
||||
/// Useful if you want to send a set of smaller messages but have the coalesced into a single packet
|
||||
/// Since the reliable stream is all ordered, you can do several small message sends with k_EP2PSendReliableWithBuffering and then
|
||||
/// do a normal k_EP2PSendReliable to force all the buffered data to be sent.
|
||||
/// </summary>
|
||||
ReliableWithBuffering = 3,
|
||||
|
||||
}
|
||||
|
||||
public unsafe bool SendP2PPacket( ulong steamid, byte[] data, int length, SendType eP2PSendType = SendType.Reliable, int nChannel = 0 )
|
||||
{
|
||||
fixed ( byte* p = data )
|
||||
{
|
||||
return networking.SendP2PPacket( steamid, (IntPtr) p, (uint)length, (SteamNative.P2PSend)(int)eP2PSendType, nChannel );
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe bool ReadP2PPacket( int channel )
|
||||
{
|
||||
uint DataAvailable = 0;
|
||||
|
||||
if ( !networking.IsP2PPacketAvailable( out DataAvailable, channel ) )
|
||||
return false;
|
||||
|
||||
if ( ReceiveBuffer.Length < DataAvailable )
|
||||
ReceiveBuffer = new byte[ DataAvailable + 1024 ];
|
||||
|
||||
fixed ( byte* p = ReceiveBuffer )
|
||||
{
|
||||
SteamNative.CSteamID steamid = 1;
|
||||
if ( !networking.ReadP2PPacket( (IntPtr)p, DataAvailable, out DataAvailable, out steamid, channel ) || DataAvailable == 0 )
|
||||
return false;
|
||||
|
||||
OnP2PData?.Invoke( steamid, ReceiveBuffer, (int) DataAvailable, channel );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This should be called when you're done communicating with a user, as this will free up all of the resources allocated for the connection under-the-hood.
|
||||
/// If the remote user tries to send data to you again, a new onP2PConnectionRequest callback will be posted.
|
||||
/// </summary>
|
||||
public bool CloseSession( ulong steamId )
|
||||
{
|
||||
return networking.CloseP2PSessionWithUser( steamId );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,243 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SteamNative;
|
||||
using Result = Facepunch.Steamworks.Callbacks.Result;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Workshop
|
||||
{
|
||||
public class Editor
|
||||
{
|
||||
internal Workshop workshop;
|
||||
|
||||
internal CallbackHandle CreateItem;
|
||||
internal CallbackHandle SubmitItemUpdate;
|
||||
internal SteamNative.UGCUpdateHandle_t UpdateHandle;
|
||||
|
||||
public ulong Id { get; internal set; }
|
||||
public string Title { get; set; } = null;
|
||||
public string Description { get; set; } = null;
|
||||
public string Folder { get; set; } = null;
|
||||
public string PreviewImage { get; set; } = null;
|
||||
public List<string> Tags { get; set; } = new List<string>();
|
||||
public bool Publishing { get; internal set; }
|
||||
public ItemType? Type { get; set; }
|
||||
public string Error { get; internal set; } = null;
|
||||
public SteamNative.Result? ErrorCode { get; internal set; } = null;
|
||||
public string ChangeNote { get; set; } = "";
|
||||
public uint WorkshopUploadAppId { get; set; }
|
||||
public string MetaData { get; set; } = null;
|
||||
public Dictionary<string, string[]> KeyValues { get; set; } = new Dictionary<string, string[]>();
|
||||
|
||||
public enum VisibilityType : int
|
||||
{
|
||||
Public = 0,
|
||||
FriendsOnly = 1,
|
||||
Private = 2
|
||||
}
|
||||
|
||||
public VisibilityType ? Visibility { get; set; }
|
||||
|
||||
public bool NeedToAgreeToWorkshopLegal { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Called when published changes have finished being submitted.
|
||||
/// </summary>
|
||||
public event Action<Result> OnChangesSubmitted;
|
||||
|
||||
public double Progress
|
||||
{
|
||||
get
|
||||
{
|
||||
var bt = BytesTotal;
|
||||
if (bt == 0) return 0;
|
||||
|
||||
return (double)BytesUploaded / (double)bt;
|
||||
}
|
||||
}
|
||||
|
||||
private int bytesUploaded = 0;
|
||||
|
||||
public int BytesUploaded
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !Publishing ) return bytesUploaded;
|
||||
if (UpdateHandle == 0) return bytesUploaded;
|
||||
|
||||
ulong b = 0;
|
||||
ulong t = 0;
|
||||
|
||||
workshop.steamworks.native.ugc.GetItemUpdateProgress( UpdateHandle, out b, out t );
|
||||
bytesUploaded = Math.Max( bytesUploaded, (int) b );
|
||||
return (int)bytesUploaded;
|
||||
}
|
||||
}
|
||||
|
||||
private int bytesTotal = 0;
|
||||
|
||||
public int BytesTotal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !Publishing ) return bytesTotal;
|
||||
if (UpdateHandle == 0 ) return bytesTotal;
|
||||
|
||||
ulong b = 0;
|
||||
ulong t = 0;
|
||||
|
||||
workshop.steamworks.native.ugc.GetItemUpdateProgress( UpdateHandle, out b, out t );
|
||||
bytesTotal = Math.Max(bytesTotal, (int)t);
|
||||
return (int)bytesTotal;
|
||||
}
|
||||
}
|
||||
|
||||
public void Publish()
|
||||
{
|
||||
bytesUploaded = 0;
|
||||
bytesTotal = 0;
|
||||
|
||||
Publishing = true;
|
||||
Error = null;
|
||||
ErrorCode = null;
|
||||
|
||||
if ( Id == 0 )
|
||||
{
|
||||
StartCreatingItem();
|
||||
return;
|
||||
}
|
||||
|
||||
PublishChanges();
|
||||
}
|
||||
|
||||
private void StartCreatingItem()
|
||||
{
|
||||
if ( !Type.HasValue )
|
||||
throw new System.Exception( "Editor.Type must be set when creating a new item!" );
|
||||
|
||||
if ( WorkshopUploadAppId == 0 )
|
||||
throw new Exception( "WorkshopUploadAppId should not be 0" );
|
||||
|
||||
CreateItem = workshop.ugc.CreateItem( WorkshopUploadAppId, (SteamNative.WorkshopFileType)(uint)Type, OnItemCreated );
|
||||
}
|
||||
|
||||
private void OnItemCreated( SteamNative.CreateItemResult_t obj, bool Failed )
|
||||
{
|
||||
NeedToAgreeToWorkshopLegal = obj.UserNeedsToAcceptWorkshopLegalAgreement;
|
||||
CreateItem.Dispose();
|
||||
CreateItem = null;
|
||||
|
||||
if ( obj.Result == SteamNative.Result.OK && !Failed )
|
||||
{
|
||||
Error = null;
|
||||
ErrorCode = null;
|
||||
Id = obj.PublishedFileId;
|
||||
PublishChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
Error = $"Error creating new file: {obj.Result} ({obj.PublishedFileId})";
|
||||
ErrorCode = obj.Result;
|
||||
Publishing = false;
|
||||
|
||||
OnChangesSubmitted?.Invoke( (Result) obj.Result );
|
||||
}
|
||||
|
||||
private void PublishChanges()
|
||||
{
|
||||
if ( WorkshopUploadAppId == 0 )
|
||||
throw new Exception( "WorkshopUploadAppId should not be 0" );
|
||||
|
||||
UpdateHandle = workshop.ugc.StartItemUpdate(WorkshopUploadAppId, Id );
|
||||
|
||||
if ( Title != null )
|
||||
workshop.ugc.SetItemTitle( UpdateHandle, Title );
|
||||
|
||||
if ( Description != null )
|
||||
workshop.ugc.SetItemDescription( UpdateHandle, Description );
|
||||
|
||||
if ( Folder != null )
|
||||
{
|
||||
var info = new System.IO.DirectoryInfo( Folder );
|
||||
|
||||
if ( !info.Exists )
|
||||
throw new System.Exception( $"Folder doesn't exist ({Folder})" );
|
||||
|
||||
workshop.ugc.SetItemContent( UpdateHandle, Folder );
|
||||
}
|
||||
|
||||
if ( Tags != null && Tags.Count > 0 )
|
||||
workshop.ugc.SetItemTags( UpdateHandle, Tags.ToArray() );
|
||||
|
||||
if ( Visibility.HasValue )
|
||||
workshop.ugc.SetItemVisibility( UpdateHandle, (SteamNative.RemoteStoragePublishedFileVisibility)(uint)Visibility.Value );
|
||||
|
||||
if ( PreviewImage != null )
|
||||
{
|
||||
var info = new System.IO.FileInfo( PreviewImage );
|
||||
|
||||
if ( !info.Exists )
|
||||
throw new System.Exception( $"PreviewImage doesn't exist ({PreviewImage})" );
|
||||
|
||||
if ( info.Length >= 1024 * 1024 )
|
||||
throw new System.Exception( $"PreviewImage should be under 1MB ({info.Length})" );
|
||||
|
||||
workshop.ugc.SetItemPreview( UpdateHandle, PreviewImage );
|
||||
}
|
||||
|
||||
if ( MetaData != null )
|
||||
{
|
||||
workshop.ugc.SetItemMetadata( UpdateHandle, MetaData );
|
||||
}
|
||||
|
||||
if ( KeyValues != null )
|
||||
{
|
||||
foreach ( var key in KeyValues )
|
||||
{
|
||||
foreach ( var value in key.Value )
|
||||
{
|
||||
workshop.ugc.AddItemKeyValueTag( UpdateHandle, key.Key, value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
workshop.ugc.SetItemUpdateLanguage( UpdateId, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
|
||||
workshop.ugc.RemoveItemKeyValueTags( UpdateId, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key
|
||||
workshop.ugc.AddItemPreviewFile( UpdateId, const char *pszPreviewFile, EItemPreviewType type ) = 0; // add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
|
||||
workshop.ugc.AddItemPreviewVideo( UpdateId, const char *pszVideoID ) = 0; // add preview video for this item
|
||||
workshop.ugc.UpdateItemPreviewFile( UpdateId, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
|
||||
workshop.ugc.UpdateItemPreviewVideo( UpdateId, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
|
||||
workshop.ugc.RemoveItemPreview( UpdateId, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
|
||||
*/
|
||||
|
||||
SubmitItemUpdate = workshop.ugc.SubmitItemUpdate( UpdateHandle, ChangeNote, OnChangesSubmittedInternal );
|
||||
}
|
||||
|
||||
private void OnChangesSubmittedInternal( SteamNative.SubmitItemUpdateResult_t obj, bool Failed )
|
||||
{
|
||||
if ( Failed )
|
||||
throw new System.Exception( "CreateItemResult_t Failed" );
|
||||
|
||||
UpdateHandle = 0;
|
||||
SubmitItemUpdate = null;
|
||||
NeedToAgreeToWorkshopLegal = obj.UserNeedsToAcceptWorkshopLegalAgreement;
|
||||
Publishing = false;
|
||||
|
||||
ErrorCode = obj.Result;
|
||||
Error = obj.Result != SteamNative.Result.OK
|
||||
? $"Error publishing changes: {obj.Result} ({NeedToAgreeToWorkshopLegal})"
|
||||
: null;
|
||||
|
||||
OnChangesSubmitted?.Invoke( (Result) obj.Result );
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
workshop.ugc.DeleteItem( Id );
|
||||
Id = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Workshop
|
||||
{
|
||||
public class Item
|
||||
{
|
||||
internal Workshop workshop;
|
||||
|
||||
internal Action onInstalled;
|
||||
|
||||
public string Description { get; private set; }
|
||||
public ulong Id { get; private set; }
|
||||
public ulong OwnerId { get; private set; }
|
||||
public float Score { get; private set; }
|
||||
public string[] Tags { get; private set; }
|
||||
public string Title { get; private set; }
|
||||
public uint VotesDown { get; private set; }
|
||||
public uint VotesUp { get; private set; }
|
||||
public DateTime Modified { get; private set; }
|
||||
public DateTime Created { get; private set; }
|
||||
public int DownloadSize { get; private set; }
|
||||
|
||||
public Item( ulong Id, Workshop workshop )
|
||||
{
|
||||
this.Id = Id;
|
||||
this.workshop = workshop;
|
||||
}
|
||||
|
||||
internal static Item From( SteamNative.SteamUGCDetails_t details, Workshop workshop )
|
||||
{
|
||||
var item = new Item( details.PublishedFileId, workshop);
|
||||
|
||||
item.Title = details.Title;
|
||||
item.Description = details.Description;
|
||||
item.OwnerId = details.SteamIDOwner;
|
||||
item.Tags = details.Tags.Split( ',' ).Select( x=> x.ToLower() ).ToArray();
|
||||
item.Score = details.Score;
|
||||
item.VotesUp = details.VotesUp;
|
||||
item.VotesDown = details.VotesDown;
|
||||
item.Modified = Utility.Epoch.ToDateTime( details.TimeUpdated );
|
||||
item.Created = Utility.Epoch.ToDateTime( details.TimeCreated );
|
||||
item.DownloadSize = details.FileSize;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public bool Download(bool highPriority = true, Action onInstalled = null)
|
||||
{
|
||||
return Download(highPriority, false, onInstalled);
|
||||
}
|
||||
|
||||
public bool ForceDownload(bool highPriority = true, Action onInstalled = null)
|
||||
{
|
||||
return Download(highPriority, true, onInstalled);
|
||||
}
|
||||
|
||||
private bool Download( bool highPriority = true, bool ignoreAlreadyInstalled = false, Action onInstalled = null )
|
||||
{
|
||||
if ( !ignoreAlreadyInstalled && Installed ) return true;
|
||||
if ( Downloading ) return true;
|
||||
|
||||
if ( !workshop.ugc.DownloadItem( Id, highPriority ) )
|
||||
{
|
||||
Console.WriteLine( "Download Failed" );
|
||||
return false;
|
||||
}
|
||||
|
||||
this.onInstalled = onInstalled;
|
||||
workshop.OnFileDownloaded += OnFileDownloaded;
|
||||
workshop.OnItemInstalled += OnItemInstalled;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Subscribe()
|
||||
{
|
||||
workshop.ugc.SubscribeItem(Id);
|
||||
SubscriptionCount++;
|
||||
}
|
||||
|
||||
public void UnSubscribe()
|
||||
{
|
||||
workshop.ugc.UnsubscribeItem(Id);
|
||||
SubscriptionCount--;
|
||||
}
|
||||
|
||||
|
||||
private void OnFileDownloaded( ulong fileid, Callbacks.Result result )
|
||||
{
|
||||
if ( fileid != Id ) return;
|
||||
|
||||
workshop.OnFileDownloaded -= OnFileDownloaded;
|
||||
}
|
||||
|
||||
private void OnItemInstalled( ulong fileid )
|
||||
{
|
||||
if ( fileid != Id ) return;
|
||||
|
||||
onInstalled?.Invoke();
|
||||
workshop.OnItemInstalled -= OnItemInstalled;
|
||||
}
|
||||
|
||||
public ulong BytesDownloaded { get { UpdateDownloadProgress(); return _BytesDownloaded; } }
|
||||
public ulong BytesTotalDownload { get { UpdateDownloadProgress(); return _BytesTotal; } }
|
||||
|
||||
public double DownloadProgress
|
||||
{
|
||||
get
|
||||
{
|
||||
UpdateDownloadProgress();
|
||||
if ( _BytesTotal == 0 ) return 0;
|
||||
return (double)_BytesDownloaded / (double)_BytesTotal;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Installed { get { return ( State & ItemState.Installed ) != 0; } }
|
||||
public bool Downloading { get { return ( State & ItemState.Downloading ) != 0; } }
|
||||
public bool DownloadPending { get { return ( State & ItemState.DownloadPending ) != 0; } }
|
||||
public bool Subscribed { get { return ( State & ItemState.Subscribed ) != 0; } }
|
||||
public bool NeedsUpdate { get { return ( State & ItemState.NeedsUpdate ) != 0; } }
|
||||
|
||||
private SteamNative.ItemState State { get { return ( SteamNative.ItemState) workshop.ugc.GetItemState( Id ); } }
|
||||
|
||||
|
||||
private DirectoryInfo _directory;
|
||||
|
||||
public DirectoryInfo Directory
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _directory != null )
|
||||
return _directory;
|
||||
|
||||
if ( !Installed )
|
||||
return null;
|
||||
|
||||
ulong sizeOnDisk;
|
||||
string folder;
|
||||
uint timestamp;
|
||||
|
||||
if ( workshop.ugc.GetItemInstallInfo( Id, out sizeOnDisk, out folder, out timestamp ) )
|
||||
{
|
||||
_directory = new DirectoryInfo( folder );
|
||||
Size = sizeOnDisk;
|
||||
|
||||
if ( !_directory.Exists )
|
||||
{
|
||||
// Size = 0;
|
||||
// _directory = null;
|
||||
}
|
||||
}
|
||||
|
||||
return _directory;
|
||||
}
|
||||
}
|
||||
|
||||
public ulong Size { get; private set; }
|
||||
|
||||
private ulong _BytesDownloaded, _BytesTotal;
|
||||
|
||||
internal void UpdateDownloadProgress()
|
||||
{
|
||||
workshop.ugc.GetItemDownloadInfo( Id, out _BytesDownloaded, out _BytesTotal );
|
||||
}
|
||||
|
||||
private int YourVote = 0;
|
||||
|
||||
|
||||
public void VoteUp()
|
||||
{
|
||||
if ( YourVote == 1 ) return;
|
||||
if ( YourVote == -1 ) VotesDown--;
|
||||
|
||||
VotesUp++;
|
||||
workshop.ugc.SetUserItemVote( Id, true );
|
||||
YourVote = 1;
|
||||
}
|
||||
|
||||
public void VoteDown()
|
||||
{
|
||||
if ( YourVote == -1 ) return;
|
||||
if ( YourVote == 1 ) VotesUp--;
|
||||
|
||||
VotesDown++;
|
||||
workshop.ugc.SetUserItemVote( Id, false );
|
||||
YourVote = -1;
|
||||
}
|
||||
|
||||
public Editor Edit()
|
||||
{
|
||||
return workshop.EditItem( Id );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return a URL to view this item online
|
||||
/// </summary>
|
||||
public string Url { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/?source=Facepunch.Steamworks&id={0}", Id ); } }
|
||||
|
||||
public string ChangelogUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/changelog/{0}", Id ); } }
|
||||
|
||||
public string CommentsUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/comments/{0}", Id ); } }
|
||||
|
||||
public string DiscussUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/discussions/{0}", Id ); } }
|
||||
|
||||
public string StartsUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/stats/{0}", Id ); } }
|
||||
|
||||
public int SubscriptionCount { get; internal set; }
|
||||
public int FavouriteCount { get; internal set; }
|
||||
public int FollowerCount { get; internal set; }
|
||||
public int WebsiteViews { get; internal set; }
|
||||
public int ReportScore { get; internal set; }
|
||||
public string PreviewImageUrl { get; internal set; }
|
||||
|
||||
string _ownerName = null;
|
||||
|
||||
|
||||
|
||||
public string OwnerName
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _ownerName == null && workshop.friends != null )
|
||||
{
|
||||
_ownerName = workshop.friends.GetName( OwnerId );
|
||||
if ( _ownerName == "[unknown]" )
|
||||
{
|
||||
_ownerName = null;
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
if ( _ownerName == null )
|
||||
return string.Empty;
|
||||
|
||||
return _ownerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,274 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Workshop
|
||||
{
|
||||
public class Query : IDisposable
|
||||
{
|
||||
internal const int SteamResponseSize = 50;
|
||||
|
||||
internal SteamNative.UGCQueryHandle_t Handle;
|
||||
internal SteamNative.CallbackHandle Callback;
|
||||
|
||||
/// <summary>
|
||||
/// The AppId you're querying. This defaults to this appid.
|
||||
/// </summary>
|
||||
public uint AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The AppId of the app used to upload the item. This defaults to 0
|
||||
/// which means all/any.
|
||||
/// </summary>
|
||||
public uint UploaderAppId { get; set; }
|
||||
|
||||
public QueryType QueryType { get; set; } = QueryType.Items;
|
||||
public Order Order { get; set; } = Order.RankedByVote;
|
||||
|
||||
public string SearchText { get; set; }
|
||||
|
||||
public Item[] Items { get; set; }
|
||||
|
||||
public int TotalResults { get; set; }
|
||||
|
||||
public ulong? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If order is RankedByTrend, this value represents how many days to take
|
||||
/// into account.
|
||||
/// </summary>
|
||||
public int RankedByTrendDays { get; set; }
|
||||
|
||||
public UserQueryType UserQueryType { get; set; } = UserQueryType.Published;
|
||||
|
||||
/// <summary>
|
||||
/// Called when the query finishes
|
||||
/// </summary>
|
||||
public Action<Query> OnResult;
|
||||
|
||||
/// <summary>
|
||||
/// Page starts at 1 !!
|
||||
/// </summary>
|
||||
public int Page { get; set; } = 1;
|
||||
|
||||
public int PerPage { get; set; } = SteamResponseSize;
|
||||
|
||||
internal Workshop workshop;
|
||||
internal Friends friends;
|
||||
|
||||
private int _resultPage = 0;
|
||||
private int _resultsRemain = 0;
|
||||
private int _resultSkip = 0;
|
||||
private List<Item> _results;
|
||||
|
||||
public void Run()
|
||||
{
|
||||
if ( Callback != null )
|
||||
return;
|
||||
|
||||
if ( Page <= 0 )
|
||||
throw new System.Exception( "Page should be 1 or above" );
|
||||
|
||||
var actualOffset = ((Page-1) * PerPage);
|
||||
|
||||
TotalResults = 0;
|
||||
|
||||
_resultSkip = actualOffset % SteamResponseSize;
|
||||
_resultsRemain = PerPage;
|
||||
_resultPage = (int) Math.Floor( (float) actualOffset / (float)SteamResponseSize );
|
||||
_results = new List<Item>();
|
||||
|
||||
RunInternal();
|
||||
}
|
||||
|
||||
unsafe void RunInternal()
|
||||
{
|
||||
string queryType = "";
|
||||
if ( FileId.Count != 0 )
|
||||
{
|
||||
var fileArray = FileId.Select( x => (SteamNative.PublishedFileId_t)x ).ToArray();
|
||||
_resultsRemain = fileArray.Length;
|
||||
|
||||
Handle = workshop.ugc.CreateQueryUGCDetailsRequest( fileArray );
|
||||
queryType = "DetailsRequest";
|
||||
}
|
||||
else if ( UserId.HasValue )
|
||||
{
|
||||
uint accountId = (uint)( UserId.Value & 0xFFFFFFFFul );
|
||||
Handle = workshop.ugc.CreateQueryUserUGCRequest( accountId, (SteamNative.UserUGCList)( int)UserQueryType, (SteamNative.UGCMatchingUGCType)( int)QueryType, SteamNative.UserUGCListSortOrder.LastUpdatedDesc, UploaderAppId, AppId, (uint)_resultPage + 1 );
|
||||
queryType = "UserRequest";
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle = workshop.ugc.CreateQueryAllUGCRequest( (SteamNative.UGCQuery)(int)Order, (SteamNative.UGCMatchingUGCType)(int)QueryType, UploaderAppId, AppId, (uint)_resultPage + 1 );
|
||||
queryType = "AllRequest";
|
||||
}
|
||||
|
||||
if (Handle == 0xfffffffffffffffful)
|
||||
{
|
||||
throw new Exception("Steam UGC "+queryType+" Query Handle invalid!");
|
||||
}
|
||||
|
||||
if ( !string.IsNullOrEmpty( SearchText ) )
|
||||
workshop.ugc.SetSearchText( Handle, SearchText );
|
||||
|
||||
foreach ( var tag in RequireTags )
|
||||
workshop.ugc.AddRequiredTag( Handle, tag );
|
||||
|
||||
if ( RequireTags.Count > 0 )
|
||||
workshop.ugc.SetMatchAnyTag( Handle, !RequireAllTags );
|
||||
|
||||
if ( RankedByTrendDays > 0 )
|
||||
workshop.ugc.SetRankedByTrendDays( Handle, (uint) RankedByTrendDays );
|
||||
|
||||
foreach ( var tag in ExcludeTags )
|
||||
workshop.ugc.AddExcludedTag( Handle, tag );
|
||||
|
||||
Callback = workshop.ugc.SendQueryUGCRequest( Handle, ResultCallback );
|
||||
}
|
||||
|
||||
void ResultCallback( SteamNative.SteamUGCQueryCompleted_t data, bool bFailed )
|
||||
{
|
||||
if ( bFailed )
|
||||
{
|
||||
throw new System.Exception("Steam UGC Query failed: "+data.Result.ToString());
|
||||
}
|
||||
|
||||
var gotFiles = 0;
|
||||
for ( int i = 0; i < data.NumResultsReturned; i++ )
|
||||
{
|
||||
if ( _resultSkip > 0 )
|
||||
{
|
||||
_resultSkip--;
|
||||
continue;
|
||||
}
|
||||
|
||||
SteamNative.SteamUGCDetails_t details = new SteamNative.SteamUGCDetails_t();
|
||||
if ( !workshop.ugc.GetQueryUGCResult( data.Handle, (uint)i, ref details ) )
|
||||
continue;
|
||||
|
||||
// We already have this file, so skip it
|
||||
if ( _results.Any( x => x.Id == details.PublishedFileId ) )
|
||||
continue;
|
||||
|
||||
var item = Item.From( details, workshop );
|
||||
|
||||
item.SubscriptionCount = GetStat( data.Handle, i, ItemStatistic.NumSubscriptions );
|
||||
item.FavouriteCount = GetStat( data.Handle, i, ItemStatistic.NumFavorites );
|
||||
item.FollowerCount = GetStat( data.Handle, i, ItemStatistic.NumFollowers );
|
||||
item.WebsiteViews = GetStat( data.Handle, i, ItemStatistic.NumUniqueWebsiteViews );
|
||||
item.ReportScore = GetStat( data.Handle, i, ItemStatistic.ReportScore );
|
||||
|
||||
string url = null;
|
||||
if ( workshop.ugc.GetQueryUGCPreviewURL( data.Handle, (uint)i, out url ) )
|
||||
item.PreviewImageUrl = url;
|
||||
|
||||
_results.Add( item );
|
||||
|
||||
_resultsRemain--;
|
||||
gotFiles++;
|
||||
|
||||
if ( _resultsRemain <= 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
TotalResults = TotalResults > data.TotalMatchingResults ? TotalResults : (int)data.TotalMatchingResults;
|
||||
|
||||
Callback.Dispose();
|
||||
Callback = null;
|
||||
|
||||
_resultPage++;
|
||||
|
||||
if ( _resultsRemain > 0 && gotFiles > 0 )
|
||||
{
|
||||
RunInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
Items = _results.ToArray();
|
||||
|
||||
if ( OnResult != null )
|
||||
{
|
||||
OnResult( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int GetStat( ulong handle, int index, ItemStatistic stat )
|
||||
{
|
||||
ulong val = 0;
|
||||
if ( !workshop.ugc.GetQueryUGCStatistic( handle, (uint)index, (SteamNative.ItemStatistic)(uint)stat, out val ) )
|
||||
return 0;
|
||||
|
||||
return (int) val;
|
||||
}
|
||||
|
||||
public bool IsRunning
|
||||
{
|
||||
get { return Callback != null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only return items with these tags
|
||||
/// </summary>
|
||||
public List<string> RequireTags { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// If true, return items that have all RequireTags
|
||||
/// If false, return items that have any tags in RequireTags
|
||||
/// </summary>
|
||||
public bool RequireAllTags { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Don't return any items with this tag
|
||||
/// </summary>
|
||||
public List<string> ExcludeTags { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// If you're querying for a particular file or files, add them to this.
|
||||
/// </summary>
|
||||
public List<ulong> FileId { get; set; } = new List<ulong>();
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Don't call this in production!
|
||||
/// </summary>
|
||||
public void Block()
|
||||
{
|
||||
const int sleepMs = 10;
|
||||
|
||||
workshop.steamworks.Update();
|
||||
|
||||
while ( IsRunning )
|
||||
{
|
||||
#if NET_CORE
|
||||
System.Threading.Tasks.Task.Delay( sleepMs ).Wait();
|
||||
#else
|
||||
System.Threading.Thread.Sleep( sleepMs );
|
||||
#endif
|
||||
workshop.steamworks.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
workshop.ugc.ReleaseQueryUGCRequest(Handle);
|
||||
}
|
||||
}
|
||||
|
||||
private enum ItemStatistic : uint
|
||||
{
|
||||
NumSubscriptions = 0,
|
||||
NumFavorites = 1,
|
||||
NumFollowers = 2,
|
||||
NumUniqueSubscriptions = 3,
|
||||
NumUniqueFavorites = 4,
|
||||
NumUniqueFollowers = 5,
|
||||
NumUniqueWebsiteViews = 6,
|
||||
ReportScore = 7,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,289 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows you to interact with Steam's UGC stuff (User Generated Content).
|
||||
/// To put simply, this allows you to upload a folder of files to Steam.
|
||||
///
|
||||
/// To upload a new file use CreateItem. This returns an Editor object.
|
||||
/// This object is also used to edit existing items.
|
||||
///
|
||||
/// To get a list of items you can call CreateQuery. From there you can download
|
||||
/// an item and retrieve the folder that it's downloaded to.
|
||||
///
|
||||
/// Generally there's no need to compress and decompress your uploads, so you should
|
||||
/// usually be able to use the content straight from the destination folder.
|
||||
///
|
||||
/// </summary>
|
||||
public partial class Workshop : IDisposable
|
||||
{
|
||||
static Workshop()
|
||||
{
|
||||
Debug.Assert( Marshal.SizeOf( typeof(PublishedFileId_t) ) == Marshal.SizeOf( typeof(ulong) ),
|
||||
$"sizeof({nameof(PublishedFileId_t)}) != sizeof({nameof(UInt64)})" );
|
||||
}
|
||||
|
||||
internal const ulong InvalidHandle = 0xffffffffffffffff;
|
||||
|
||||
internal SteamNative.SteamUGC ugc;
|
||||
internal Friends friends;
|
||||
internal BaseSteamworks steamworks;
|
||||
internal SteamNative.SteamRemoteStorage remoteStorage;
|
||||
|
||||
/// <summary>
|
||||
/// Called when an item has been downloaded. This could have been
|
||||
/// because of a call to Download.
|
||||
/// </summary>
|
||||
public event Action<ulong, Callbacks.Result> OnFileDownloaded;
|
||||
|
||||
/// <summary>
|
||||
/// Called when an item has been installed. This could have been
|
||||
/// because of a call to Download or because of a subscription triggered
|
||||
/// via the browser/app.
|
||||
/// </summary>
|
||||
public event Action<ulong> OnItemInstalled;
|
||||
|
||||
internal Workshop( BaseSteamworks steamworks, SteamNative.SteamUGC ugc, SteamNative.SteamRemoteStorage remoteStorage )
|
||||
{
|
||||
this.ugc = ugc;
|
||||
this.steamworks = steamworks;
|
||||
this.remoteStorage = remoteStorage;
|
||||
|
||||
steamworks.RegisterCallback<SteamNative.DownloadItemResult_t>( onDownloadResult );
|
||||
steamworks.RegisterCallback<SteamNative.ItemInstalled_t>( onItemInstalled );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// You should never have to call this manually
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
ugc = null;
|
||||
steamworks = null;
|
||||
remoteStorage = null;
|
||||
friends = null;
|
||||
|
||||
OnFileDownloaded = null;
|
||||
OnItemInstalled = null;
|
||||
}
|
||||
|
||||
private void onItemInstalled( SteamNative.ItemInstalled_t obj )
|
||||
{
|
||||
if ( OnItemInstalled != null && obj.AppID == Client.Instance.AppId )
|
||||
OnItemInstalled( obj.PublishedFileId );
|
||||
}
|
||||
|
||||
private void onDownloadResult( SteamNative.DownloadItemResult_t obj )
|
||||
{
|
||||
if ( OnFileDownloaded != null && obj.AppID == Client.Instance.AppId )
|
||||
OnFileDownloaded( obj.PublishedFileId, (Callbacks.Result) obj.Result );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the IDs of all subscribed workshop items. Not all items may be currently installed.
|
||||
/// </summary>
|
||||
public unsafe ulong[] GetSubscribedItemIds()
|
||||
{
|
||||
var count = ugc.GetNumSubscribedItems();
|
||||
var array = new ulong[count];
|
||||
|
||||
fixed ( ulong* ptr = array )
|
||||
{
|
||||
ugc.GetSubscribedItems( (PublishedFileId_t*) ptr, count );
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
[ThreadStatic]
|
||||
private static ulong[] _sSubscribedItemBuffer;
|
||||
|
||||
/// <summary>
|
||||
/// Get the IDs of all subscribed workshop items, avoiding repeated allocations.
|
||||
/// Not all items may be currently installed.
|
||||
/// </summary>
|
||||
public unsafe int GetSubscribedItemIds( List<ulong> destList )
|
||||
{
|
||||
const int bufferSize = 1024;
|
||||
|
||||
var count = ugc.GetNumSubscribedItems();
|
||||
|
||||
if ( count >= bufferSize )
|
||||
{
|
||||
// Fallback for exceptional cases
|
||||
destList.AddRange( GetSubscribedItemIds() );
|
||||
return (int) count;
|
||||
}
|
||||
|
||||
if ( _sSubscribedItemBuffer == null )
|
||||
{
|
||||
_sSubscribedItemBuffer = new ulong[bufferSize];
|
||||
}
|
||||
|
||||
fixed ( ulong* ptr = _sSubscribedItemBuffer)
|
||||
{
|
||||
count = ugc.GetSubscribedItems( (PublishedFileId_t*) ptr, bufferSize );
|
||||
}
|
||||
|
||||
for ( var i = 0; i < count; ++i )
|
||||
{
|
||||
destList.Add( _sSubscribedItemBuffer[i] );
|
||||
}
|
||||
|
||||
return (int) count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a query object, which is used to get a list of items.
|
||||
///
|
||||
/// This could be a list of the most popular items, or a search,
|
||||
/// or just getting a list of the items you've uploaded.
|
||||
/// </summary>
|
||||
public Query CreateQuery()
|
||||
{
|
||||
return new Query()
|
||||
{
|
||||
AppId = steamworks.AppId,
|
||||
workshop = this,
|
||||
friends = friends
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new Editor object with the intention of creating a new item.
|
||||
/// Your item won't actually be created until you call Publish() on the object.
|
||||
/// </summary>
|
||||
public Editor CreateItem( ItemType type = ItemType.Community )
|
||||
{
|
||||
return CreateItem(this.steamworks.AppId, type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new Editor object with the intention of creating a new item.
|
||||
/// Your item won't actually be created until you call Publish() on the object.
|
||||
/// Your item will be published to the provided appId.
|
||||
/// </summary>
|
||||
/// <remarks>You need to add app publish permissions for cross app uploading to work.</remarks>
|
||||
public Editor CreateItem( uint workshopUploadAppId, ItemType type = ItemType.Community )
|
||||
{
|
||||
return new Editor() { workshop = this, WorkshopUploadAppId = workshopUploadAppId, Type = type };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a class representing this ItemId. We don't query
|
||||
/// item name, description etc. We don't verify that item exists.
|
||||
/// We don't verify that this item belongs to your app.
|
||||
/// </summary>
|
||||
public Editor EditItem( ulong itemId )
|
||||
{
|
||||
return new Editor() { workshop = this, Id = itemId, WorkshopUploadAppId = steamworks.AppId };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an Item object for a specific item. This doesn't currently
|
||||
/// query the item's name and description. It's only really useful
|
||||
/// if you know an item's ID and want to download it, or check its
|
||||
/// current download status.
|
||||
/// </summary>
|
||||
public Item GetItem( ulong itemid )
|
||||
{
|
||||
return new Item( itemid, this );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How a query should be ordered.
|
||||
/// </summary>
|
||||
public enum Order
|
||||
{
|
||||
RankedByVote = 0,
|
||||
RankedByPublicationDate = 1,
|
||||
AcceptedForGameRankedByAcceptanceDate = 2,
|
||||
RankedByTrend = 3,
|
||||
FavoritedByFriendsRankedByPublicationDate = 4,
|
||||
CreatedByFriendsRankedByPublicationDate = 5,
|
||||
RankedByNumTimesReported = 6,
|
||||
CreatedByFollowedUsersRankedByPublicationDate = 7,
|
||||
NotYetRated = 8,
|
||||
RankedByTotalVotesAsc = 9,
|
||||
RankedByVotesUp = 10,
|
||||
RankedByTextSearch = 11,
|
||||
RankedByTotalUniqueSubscriptions = 12,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The type of item you are querying for
|
||||
/// </summary>
|
||||
public enum QueryType
|
||||
{
|
||||
/// <summary>
|
||||
/// Both MicrotransactionItems and subscriptionItems
|
||||
/// </summary>
|
||||
Items = 0,
|
||||
/// <summary>
|
||||
/// Workshop item that is meant to be voted on for the purpose of selling in-game
|
||||
/// </summary>
|
||||
MicrotransactionItems = 1,
|
||||
/// <summary>
|
||||
/// normal Workshop item that can be subscribed to
|
||||
/// </summary>
|
||||
SubscriptionItems = 2,
|
||||
Collections = 3,
|
||||
Artwork = 4,
|
||||
Videos = 5,
|
||||
Screenshots = 6,
|
||||
AllGuides = 7, // both web guides and integrated guides
|
||||
WebGuides = 8,
|
||||
IntegratedGuides = 9,
|
||||
UsableInGame = 10, // ready-to-use items and integrated guides
|
||||
ControllerBindings = 11,
|
||||
GameManagedItems = 12, // game managed items (not managed by users)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Used to define the item type when creating
|
||||
/// </summary>
|
||||
public enum ItemType
|
||||
{
|
||||
Community = 0, // normal Workshop item that can be subscribed to
|
||||
Microtransaction = 1, // Workshop item that is meant to be voted on for the purpose of selling in-game
|
||||
Collection = 2, // a collection of Workshop or Greenlight items
|
||||
Art = 3, // artwork
|
||||
Video = 4, // external video
|
||||
Screenshot = 5, // screenshot
|
||||
Game = 6, // Greenlight game entry
|
||||
Software = 7, // Greenlight software entry
|
||||
Concept = 8, // Greenlight concept
|
||||
WebGuide = 9, // Steam web guide
|
||||
IntegratedGuide = 10, // application integrated guide
|
||||
Merch = 11, // Workshop merchandise meant to be voted on for the purpose of being sold
|
||||
ControllerBinding = 12, // Steam Controller bindings
|
||||
SteamworksAccessInvite = 13, // internal
|
||||
SteamVideo = 14, // Steam video
|
||||
GameManagedItem = 15, // managed completely by the game, not the user, and not shown on the web
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// When querying a specific user's items this defines what
|
||||
/// type of items you're looking for.
|
||||
/// </summary>
|
||||
public enum UserQueryType : uint
|
||||
{
|
||||
Published = 0,
|
||||
VotedOn,
|
||||
VotedUp,
|
||||
VotedDown,
|
||||
WillVoteLater,
|
||||
Favorited,
|
||||
Subscribed,
|
||||
UsedOrPlayed,
|
||||
Followed,
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks.Interop
|
||||
{
|
||||
internal class NativeInterface : IDisposable
|
||||
{
|
||||
internal SteamNative.SteamApi api;
|
||||
internal SteamNative.SteamClient client;
|
||||
internal SteamNative.SteamUser user;
|
||||
internal SteamNative.SteamApps apps;
|
||||
internal SteamNative.SteamAppList applist;
|
||||
internal SteamNative.SteamFriends friends;
|
||||
internal SteamNative.SteamMatchmakingServers servers;
|
||||
internal SteamNative.SteamMatchmaking matchmaking;
|
||||
internal SteamNative.SteamInventory inventory;
|
||||
internal SteamNative.SteamNetworking networking;
|
||||
internal SteamNative.SteamUserStats userstats;
|
||||
internal SteamNative.SteamUtils utils;
|
||||
internal SteamNative.SteamScreenshots screenshots;
|
||||
internal SteamNative.SteamHTTP http;
|
||||
internal SteamNative.SteamUGC ugc;
|
||||
internal SteamNative.SteamGameServer gameServer;
|
||||
internal SteamNative.SteamGameServerStats gameServerStats;
|
||||
internal SteamNative.SteamRemoteStorage remoteStorage;
|
||||
|
||||
private bool isServer;
|
||||
|
||||
internal bool InitClient( BaseSteamworks steamworks )
|
||||
{
|
||||
if ( Steamworks.Server.Instance != null )
|
||||
throw new System.Exception("Steam client should be initialized before steam server - or there's big trouble.");
|
||||
|
||||
isServer = false;
|
||||
|
||||
api = new SteamNative.SteamApi();
|
||||
|
||||
if ( !api.SteamAPI_Init() )
|
||||
{
|
||||
Console.Error.WriteLine( "InitClient: SteamAPI_Init returned false" );
|
||||
return false;
|
||||
}
|
||||
|
||||
var hUser = api.SteamAPI_GetHSteamUser();
|
||||
var hPipe = api.SteamAPI_GetHSteamPipe();
|
||||
if ( hPipe == 0 )
|
||||
{
|
||||
Console.Error.WriteLine( "InitClient: hPipe == 0" );
|
||||
return false;
|
||||
}
|
||||
|
||||
FillInterfaces( steamworks, hUser, hPipe );
|
||||
|
||||
if ( !user.IsValid )
|
||||
{
|
||||
Console.Error.WriteLine( "InitClient: ISteamUser is null" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal bool InitServer( BaseSteamworks steamworks, uint IpAddress /*uint32*/, ushort usPort /*uint16*/, ushort GamePort /*uint16*/, ushort QueryPort /*uint16*/, int eServerMode /*int*/, string pchVersionString /*const char **/)
|
||||
{
|
||||
isServer = true;
|
||||
|
||||
api = new SteamNative.SteamApi();
|
||||
|
||||
if ( !api.SteamInternal_GameServer_Init( IpAddress, usPort, GamePort, QueryPort, eServerMode, pchVersionString ) )
|
||||
{
|
||||
Console.Error.WriteLine( "InitServer: GameServer_Init returned false" );
|
||||
return false;
|
||||
}
|
||||
|
||||
var hUser = api.SteamGameServer_GetHSteamUser();
|
||||
var hPipe = api.SteamGameServer_GetHSteamPipe();
|
||||
if ( hPipe == 0 )
|
||||
{
|
||||
Console.Error.WriteLine( "InitServer: hPipe == 0" );
|
||||
return false;
|
||||
}
|
||||
|
||||
FillInterfaces( steamworks, hPipe, hUser );
|
||||
|
||||
if ( !gameServer.IsValid )
|
||||
{
|
||||
gameServer = null;
|
||||
throw new System.Exception( "Steam Server: Couldn't load SteamGameServer012" );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void FillInterfaces( BaseSteamworks steamworks, int hpipe, int huser )
|
||||
{
|
||||
var clientPtr = api.SteamInternal_CreateInterface( "SteamClient017" );
|
||||
if ( clientPtr == IntPtr.Zero )
|
||||
{
|
||||
throw new System.Exception( "Steam Server: Couldn't load SteamClient017" );
|
||||
}
|
||||
|
||||
client = new SteamNative.SteamClient( steamworks, clientPtr );
|
||||
|
||||
user = client.GetISteamUser( huser, hpipe, SteamNative.Defines.STEAMUSER_INTERFACE_VERSION );
|
||||
utils = client.GetISteamUtils( hpipe, SteamNative.Defines.STEAMUTILS_INTERFACE_VERSION );
|
||||
networking = client.GetISteamNetworking( huser, hpipe, SteamNative.Defines.STEAMNETWORKING_INTERFACE_VERSION );
|
||||
gameServerStats = client.GetISteamGameServerStats( huser, hpipe, SteamNative.Defines.STEAMGAMESERVERSTATS_INTERFACE_VERSION );
|
||||
http = client.GetISteamHTTP( huser, hpipe, SteamNative.Defines.STEAMHTTP_INTERFACE_VERSION );
|
||||
inventory = client.GetISteamInventory( huser, hpipe, SteamNative.Defines.STEAMINVENTORY_INTERFACE_VERSION );
|
||||
ugc = client.GetISteamUGC( huser, hpipe, SteamNative.Defines.STEAMUGC_INTERFACE_VERSION );
|
||||
apps = client.GetISteamApps( huser, hpipe, SteamNative.Defines.STEAMAPPS_INTERFACE_VERSION );
|
||||
gameServer = client.GetISteamGameServer( huser, hpipe, SteamNative.Defines.STEAMGAMESERVER_INTERFACE_VERSION );
|
||||
friends = client.GetISteamFriends( huser, hpipe, SteamNative.Defines.STEAMFRIENDS_INTERFACE_VERSION );
|
||||
servers = client.GetISteamMatchmakingServers( huser, hpipe, SteamNative.Defines.STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION );
|
||||
userstats = client.GetISteamUserStats( huser, hpipe, SteamNative.Defines.STEAMUSERSTATS_INTERFACE_VERSION );
|
||||
screenshots = client.GetISteamScreenshots( huser, hpipe, SteamNative.Defines.STEAMSCREENSHOTS_INTERFACE_VERSION );
|
||||
remoteStorage = client.GetISteamRemoteStorage( huser, hpipe, SteamNative.Defines.STEAMREMOTESTORAGE_INTERFACE_VERSION );
|
||||
matchmaking = client.GetISteamMatchmaking( huser, hpipe, SteamNative.Defines.STEAMMATCHMAKING_INTERFACE_VERSION );
|
||||
applist = client.GetISteamAppList( huser, hpipe, SteamNative.Defines.STEAMAPPLIST_INTERFACE_VERSION );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if ( user != null )
|
||||
{
|
||||
user.Dispose();
|
||||
user = null;
|
||||
}
|
||||
|
||||
if ( utils != null )
|
||||
{
|
||||
utils.Dispose();
|
||||
utils = null;
|
||||
}
|
||||
|
||||
if ( networking != null )
|
||||
{
|
||||
networking.Dispose();
|
||||
networking = null;
|
||||
}
|
||||
|
||||
if ( gameServerStats != null )
|
||||
{
|
||||
gameServerStats.Dispose();
|
||||
gameServerStats = null;
|
||||
}
|
||||
|
||||
if ( http != null )
|
||||
{
|
||||
http.Dispose();
|
||||
http = null;
|
||||
}
|
||||
|
||||
if ( inventory != null )
|
||||
{
|
||||
inventory.Dispose();
|
||||
inventory = null;
|
||||
}
|
||||
|
||||
if ( ugc != null )
|
||||
{
|
||||
ugc.Dispose();
|
||||
ugc = null;
|
||||
}
|
||||
|
||||
if ( apps != null )
|
||||
{
|
||||
apps.Dispose();
|
||||
apps = null;
|
||||
}
|
||||
|
||||
if ( gameServer != null )
|
||||
{
|
||||
gameServer.Dispose();
|
||||
gameServer = null;
|
||||
}
|
||||
|
||||
if ( friends != null )
|
||||
{
|
||||
friends.Dispose();
|
||||
friends = null;
|
||||
}
|
||||
|
||||
if ( servers != null )
|
||||
{
|
||||
servers.Dispose();
|
||||
servers = null;
|
||||
}
|
||||
|
||||
if ( userstats != null )
|
||||
{
|
||||
userstats.Dispose();
|
||||
userstats = null;
|
||||
}
|
||||
|
||||
if ( screenshots != null )
|
||||
{
|
||||
screenshots.Dispose();
|
||||
screenshots = null;
|
||||
}
|
||||
|
||||
if ( remoteStorage != null )
|
||||
{
|
||||
remoteStorage.Dispose();
|
||||
remoteStorage = null;
|
||||
}
|
||||
|
||||
if ( matchmaking != null )
|
||||
{
|
||||
matchmaking.Dispose();
|
||||
matchmaking = null;
|
||||
}
|
||||
|
||||
if ( applist != null )
|
||||
{
|
||||
applist.Dispose();
|
||||
applist = null;
|
||||
}
|
||||
|
||||
if ( client != null )
|
||||
{
|
||||
client.Dispose();
|
||||
client = null;
|
||||
}
|
||||
|
||||
if ( api != null )
|
||||
{
|
||||
if ( isServer )
|
||||
api.SteamGameServer_Shutdown();
|
||||
else
|
||||
api.SteamAPI_Shutdown();
|
||||
|
||||
//
|
||||
// The functions above destroy the pipeline handles
|
||||
// and all of the classes. Trying to call a steam function
|
||||
// at this point will result in a crash - because any
|
||||
// pointers we stored are not invalid.
|
||||
//
|
||||
|
||||
api.Dispose();
|
||||
api = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if !NET_CORE
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Facepunch.Steamworks")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Facepunch Studios Ltd")]
|
||||
[assembly: AssemblyProduct("Facepunch.Steamworks")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("dc2d9fa9-f005-468f-8581-85c79f4e0034")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion( "1.2.0.0" )]
|
||||
[assembly: AssemblyFileVersion("1.2.0.0")]
|
||||
|
||||
#endif
|
||||
@@ -1,356 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialize this class for Game Servers.
|
||||
///
|
||||
/// Game servers offer a limited amount of Steam functionality - and don't require the Steam client.
|
||||
/// </summary>
|
||||
public partial class Server : BaseSteamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// A singleton accessor to get the current client instance.
|
||||
/// </summary>
|
||||
public static Server Instance { get; private set; }
|
||||
|
||||
internal override bool IsGameServer { get { return true; } }
|
||||
|
||||
public ServerQuery Query { get; internal set; }
|
||||
public ServerStats Stats { get; internal set; }
|
||||
public ServerAuth Auth { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a Steam Server instance
|
||||
/// </summary>
|
||||
public Server( uint appId, ServerInit init, bool isPublic) : base( appId )
|
||||
{
|
||||
if ( Instance != null )
|
||||
{
|
||||
throw new System.Exception( "Only one Facepunch.Steamworks.Server can exist - dispose the old one before trying to create a new one." );
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
native = new Interop.NativeInterface();
|
||||
uint ipaddress = 0; // Any Port
|
||||
|
||||
if ( init.SteamPort == 0 ) init.RandomSteamPort();
|
||||
if ( init.IpAddress != null ) ipaddress = Utility.IpToInt32( init.IpAddress );
|
||||
|
||||
//
|
||||
// Get other interfaces
|
||||
//
|
||||
|
||||
//kind of a hack:
|
||||
//use an invalid version number to hide private servers from the server list.
|
||||
//couldn't find a way to do it otherwise - using 1 as the eServerMode doesn't
|
||||
//seem to work, the server info is still returned by the API calls
|
||||
string versionString = isPublic ? init.VersionString : "-1";
|
||||
if ( !native.InitServer( this, ipaddress, init.SteamPort, init.GamePort, init.QueryPort, isPublic ? (init.Secure ? 3 : 2) : 1,
|
||||
versionString) )
|
||||
{
|
||||
native.Dispose();
|
||||
native = null;
|
||||
Instance = null;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Register Callbacks
|
||||
//
|
||||
|
||||
SteamNative.Callbacks.RegisterCallbacks( this );
|
||||
|
||||
//
|
||||
// Setup interfaces that client and server both have
|
||||
//
|
||||
SetupCommonInterfaces();
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Initial settings
|
||||
//
|
||||
native.gameServer.EnableHeartbeats( true );
|
||||
MaxPlayers = 32;
|
||||
BotCount = 0;
|
||||
Product = $"{AppId}";
|
||||
ModDir = init.ModDir;
|
||||
GameDescription = init.GameDescription;
|
||||
Passworded = false;
|
||||
DedicatedServer = true;
|
||||
|
||||
//
|
||||
// Child classes
|
||||
//
|
||||
Query = new ServerQuery( this );
|
||||
Stats = new ServerStats( this );
|
||||
Auth = new ServerAuth( this );
|
||||
|
||||
//
|
||||
// Run update, first call does some initialization
|
||||
//
|
||||
Update();
|
||||
}
|
||||
|
||||
~Server()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should be called at least once every frame
|
||||
/// </summary>
|
||||
public override void Update()
|
||||
{
|
||||
if ( !IsValid )
|
||||
return;
|
||||
|
||||
native.api.SteamGameServer_RunCallbacks();
|
||||
|
||||
base.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the server owner's SteamID.
|
||||
/// </summary>
|
||||
public ulong SteamId
|
||||
{
|
||||
get
|
||||
{
|
||||
return native.gameServer.GetSteamID();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether this should be marked as a dedicated server.
|
||||
/// If not, it is assumed to be a listen server.
|
||||
/// </summary>
|
||||
public bool DedicatedServer
|
||||
{
|
||||
get { return _dedicatedServer; }
|
||||
set { if ( _dedicatedServer == value ) return; native.gameServer.SetDedicatedServer( value ); _dedicatedServer = value; }
|
||||
}
|
||||
private bool _dedicatedServer;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current MaxPlayers.
|
||||
/// This doesn't enforce any kind of limit, it just updates the master server.
|
||||
/// </summary>
|
||||
public int MaxPlayers
|
||||
{
|
||||
get { return _maxplayers; }
|
||||
set { if ( _maxplayers == value ) return; native.gameServer.SetMaxPlayerCount( value ); _maxplayers = value; }
|
||||
}
|
||||
private int _maxplayers = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current BotCount.
|
||||
/// This doesn't enforce any kind of limit, it just updates the master server.
|
||||
/// </summary>
|
||||
public int BotCount
|
||||
{
|
||||
get { return _botcount; }
|
||||
set { if ( _botcount == value ) return; native.gameServer.SetBotPlayerCount( value ); _botcount = value; }
|
||||
}
|
||||
private int _botcount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current Map Name.
|
||||
/// </summary>
|
||||
public string MapName
|
||||
{
|
||||
get { return _mapname; }
|
||||
set { if ( _mapname == value ) return; native.gameServer.SetMapName( value ); _mapname = value; }
|
||||
}
|
||||
private string _mapname;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current ModDir
|
||||
/// </summary>
|
||||
public string ModDir
|
||||
{
|
||||
get { return _modDir; }
|
||||
internal set { if ( _modDir == value ) return; native.gameServer.SetModDir( value ); _modDir = value; }
|
||||
}
|
||||
private string _modDir = "";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current product
|
||||
/// </summary>
|
||||
public string Product
|
||||
{
|
||||
get { return _product; }
|
||||
internal set { if ( _product == value ) return; native.gameServer.SetProduct( value ); _product = value; }
|
||||
}
|
||||
private string _product = "";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current Product
|
||||
/// </summary>
|
||||
public string GameDescription
|
||||
{
|
||||
get { return _gameDescription; }
|
||||
internal set { if ( _gameDescription == value ) return; native.gameServer.SetGameDescription( value ); _gameDescription = value; }
|
||||
}
|
||||
private string _gameDescription = "";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current ServerName
|
||||
/// </summary>
|
||||
public string ServerName
|
||||
{
|
||||
get { return _serverName; }
|
||||
set { if ( _serverName == value ) return; native.gameServer.SetServerName( value ); _serverName = value; }
|
||||
}
|
||||
private string _serverName = "";
|
||||
|
||||
/// <summary>
|
||||
/// Set whether the server should report itself as passworded
|
||||
/// </summary>
|
||||
public bool Passworded
|
||||
{
|
||||
get { return _passworded; }
|
||||
set { if ( _passworded == value ) return; native.gameServer.SetPasswordProtected( value ); _passworded = value; }
|
||||
}
|
||||
private bool _passworded;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current GameTags. This is a comma seperated list of tags for this server.
|
||||
/// When querying the server list you can filter by these tags.
|
||||
/// </summary>
|
||||
public string GameTags
|
||||
{
|
||||
get { return _gametags; }
|
||||
set { if ( _gametags == value ) return; native.gameServer.SetGameTags( value ); _gametags = value; }
|
||||
}
|
||||
private string _gametags = "";
|
||||
|
||||
/// <summary>
|
||||
/// Log onto Steam anonymously.
|
||||
/// </summary>
|
||||
public void LogOnAnonymous()
|
||||
{
|
||||
native.gameServer.LogOnAnonymous();
|
||||
ForceHeartbeat();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the server is connected and registered with the Steam master server
|
||||
/// You should have called LogOnAnonymous etc on startup.
|
||||
/// </summary>
|
||||
public bool LoggedOn => native.gameServer.BLoggedOn();
|
||||
|
||||
Dictionary<string, string> KeyValue = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets a Key Value. These can be anything you like, and are accessible
|
||||
/// when querying servers from the server list.
|
||||
///
|
||||
/// Information describing gamemodes are common here.
|
||||
/// </summary>
|
||||
public void SetKey( string Key, string Value )
|
||||
{
|
||||
if ( KeyValue.ContainsKey( Key ) )
|
||||
{
|
||||
if ( KeyValue[Key] == Value )
|
||||
return;
|
||||
|
||||
KeyValue[Key] = Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyValue.Add( Key, Value );
|
||||
}
|
||||
|
||||
native.gameServer.SetKeyValue( Key, Value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update this connected player's information. You should really call this
|
||||
/// any time a player's name or score changes. This keeps the information shown
|
||||
/// to server queries up to date.
|
||||
/// </summary>
|
||||
public void UpdatePlayer( ulong steamid, string name, int score )
|
||||
{
|
||||
native.gameServer.BUpdateUserData( steamid, name, (uint) score );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Shutdown interface, disconnect from Steam
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
if ( disposed ) return;
|
||||
|
||||
if ( Query != null )
|
||||
{
|
||||
Query = null;
|
||||
}
|
||||
|
||||
if ( Stats != null )
|
||||
{
|
||||
Stats = null;
|
||||
}
|
||||
|
||||
if ( Auth != null )
|
||||
{
|
||||
Auth = null;
|
||||
}
|
||||
|
||||
if ( Instance == this )
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To the best of its ability this tries to get the server's
|
||||
/// current public ip address. Be aware that this is likely to return
|
||||
/// null for the first few seconds after initialization.
|
||||
/// </summary>
|
||||
public System.Net.IPAddress PublicIp
|
||||
{
|
||||
get
|
||||
{
|
||||
var ip = native.gameServer.GetPublicIP();
|
||||
if ( ip == 0 ) return null;
|
||||
|
||||
return Utility.Int32ToIp( ip );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable heartbeats, which are sent regularly to the master server.
|
||||
/// Enabled by default.
|
||||
/// </summary>
|
||||
public bool AutomaticHeartbeats
|
||||
{
|
||||
set { native.gameServer.EnableHeartbeats( value ); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set heartbeat interval, if automatic heartbeats are enabled.
|
||||
/// You can leave this at the default.
|
||||
/// </summary>
|
||||
public int AutomaticHeartbeatRate
|
||||
{
|
||||
set { native.gameServer.SetHeartbeatInterval( value ); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Force send a heartbeat to the master server instead of waiting
|
||||
/// for the next automatic update (if you've left them enabled)
|
||||
/// </summary>
|
||||
public void ForceHeartbeat()
|
||||
{
|
||||
native.gameServer.ForceHeartbeat();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public class ServerAuth
|
||||
{
|
||||
internal Server server;
|
||||
|
||||
/// <summary>
|
||||
/// Steamid, Ownerid, Status
|
||||
/// </summary>
|
||||
public Action<ulong, ulong, Status> OnAuthChange;
|
||||
|
||||
/// <summary>
|
||||
/// Steam authentication statuses
|
||||
/// </summary>
|
||||
public enum Status : int
|
||||
{
|
||||
OK = 0,
|
||||
UserNotConnectedToSteam = 1,
|
||||
NoLicenseOrExpired = 2,
|
||||
VACBanned = 3,
|
||||
LoggedInElseWhere = 4,
|
||||
VACCheckTimedOut = 5,
|
||||
AuthTicketCanceled = 6,
|
||||
AuthTicketInvalidAlreadyUsed = 7,
|
||||
AuthTicketInvalid = 8,
|
||||
PublisherIssuedBan = 9,
|
||||
}
|
||||
|
||||
public enum StartAuthSessionResult : int
|
||||
{
|
||||
OK = 0,
|
||||
InvalidTicket = 1,
|
||||
DuplicateRequest = 2,
|
||||
InvalidVersion = 3,
|
||||
GameMismatch = 4,
|
||||
ExpiredTicket = 5,
|
||||
ServerNotConnectedToSteam = 6,
|
||||
}
|
||||
|
||||
internal ServerAuth( Server s )
|
||||
{
|
||||
server = s;
|
||||
|
||||
server.RegisterCallback<SteamNative.ValidateAuthTicketResponse_t>( OnAuthTicketValidate );
|
||||
}
|
||||
|
||||
void OnAuthTicketValidate( SteamNative.ValidateAuthTicketResponse_t data )
|
||||
{
|
||||
if ( OnAuthChange != null )
|
||||
OnAuthChange( data.SteamID, data.OwnerSteamID, (Status) data.AuthSessionResponse );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start authorizing a ticket. This user isn't authorized yet. Wait for a call to OnAuthChange.
|
||||
/// </summary>
|
||||
public unsafe StartAuthSessionResult StartSession( byte[] data, ulong steamid )
|
||||
{
|
||||
fixed ( byte* p = data )
|
||||
{
|
||||
var result = server.native.gameServer.BeginAuthSession( (IntPtr)p, data.Length, steamid );
|
||||
|
||||
return (StartAuthSessionResult)result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forget this guy. They're no longer in the game.
|
||||
/// </summary>
|
||||
public void EndSession( ulong steamid )
|
||||
{
|
||||
server.native.gameServer.EndAuthSession( steamid );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// If you're manually processing the server queries, you should use this class.
|
||||
/// </summary>
|
||||
public class ServerQuery
|
||||
{
|
||||
internal Server server;
|
||||
internal static byte[] buffer = new byte[64*1024];
|
||||
|
||||
internal ServerQuery( Server s )
|
||||
{
|
||||
server = s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A server query packet.
|
||||
/// </summary>
|
||||
public struct Packet
|
||||
{
|
||||
/// <summary>
|
||||
/// Target IP address
|
||||
/// </summary>
|
||||
public uint Address { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Target port
|
||||
/// </summary>
|
||||
public ushort Port { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// This data is pooled. Make a copy if you don't use it immediately.
|
||||
/// This buffer is also quite large - so pay attention to Size.
|
||||
/// </summary>
|
||||
public byte[] Data { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of the data
|
||||
/// </summary>
|
||||
public int Size { get; internal set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If true, Steam wants to send a packet. You should respond by sending
|
||||
/// this packet in an unconnected way to the returned Address and Port.
|
||||
/// </summary>
|
||||
/// <param name="packet">Packet to send. The Data passed is pooled - so use it immediately.</param>
|
||||
/// <returns>True if we want to send a packet</returns>
|
||||
public unsafe bool GetOutgoingPacket( out Packet packet )
|
||||
{
|
||||
packet = new Packet();
|
||||
|
||||
fixed ( byte* ptr = buffer )
|
||||
{
|
||||
uint addr = 0;
|
||||
ushort port = 0;
|
||||
|
||||
var size = server.native.gameServer.GetNextOutgoingPacket( (IntPtr)ptr, buffer.Length, out addr, out port );
|
||||
if ( size == 0 )
|
||||
return false;
|
||||
|
||||
packet.Size = size;
|
||||
packet.Data = buffer;
|
||||
packet.Address = addr;
|
||||
packet.Port = port;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We have received a server query on our game port. Pass it to Steam to handle.
|
||||
/// </summary>
|
||||
public unsafe void Handle( byte[] data, int size, uint address, ushort port )
|
||||
{
|
||||
fixed ( byte* ptr = data )
|
||||
{
|
||||
server.native.gameServer.HandleIncomingPacket( (IntPtr)ptr, size, address, port );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows getting and setting stats on users from the gameserver. These stats
|
||||
/// should have been set up on the Steamworks website for your app.
|
||||
/// </summary>
|
||||
public class ServerStats
|
||||
{
|
||||
internal Server server;
|
||||
|
||||
internal ServerStats( Server s )
|
||||
{
|
||||
server = s;
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public struct StatsReceived
|
||||
{
|
||||
public int Result;
|
||||
public ulong SteamId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the stats for this user. If you pass a callback function in
|
||||
/// this will be called when the stats are recieved, the bool will signify whether
|
||||
/// it was successful or not.
|
||||
/// </summary>
|
||||
public void Refresh( ulong steamid, Action<ulong, bool> Callback = null )
|
||||
{
|
||||
if ( Callback == null )
|
||||
{
|
||||
server.native.gameServerStats.RequestUserStats( steamid );
|
||||
return;
|
||||
}
|
||||
|
||||
server.native.gameServerStats.RequestUserStats( steamid, ( o, failed ) =>
|
||||
{
|
||||
Callback( steamid, o.Result == SteamNative.Result.OK && !failed );
|
||||
} );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Once you've set a stat change on a user you need to commit your changes.
|
||||
/// You can do that using this function. The callback will let you know if
|
||||
/// your action succeeded, but most of the time you can fire and forget.
|
||||
/// </summary>
|
||||
public void Commit( ulong steamid, Action<ulong, bool> Callback = null )
|
||||
{
|
||||
if ( Callback == null )
|
||||
{
|
||||
server.native.gameServerStats.StoreUserStats( steamid );
|
||||
return;
|
||||
}
|
||||
|
||||
server.native.gameServerStats.StoreUserStats( steamid, ( o, failed ) =>
|
||||
{
|
||||
Callback( steamid, o.Result == SteamNative.Result.OK && !failed );
|
||||
} );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the named stat for this user. Setting stats should follow the rules
|
||||
/// you defined in Steamworks.
|
||||
/// </summary>
|
||||
public bool SetInt( ulong steamid, string name, int stat )
|
||||
{
|
||||
return server.native.gameServerStats.SetUserStat( steamid, name, stat );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the named stat for this user. Setting stats should follow the rules
|
||||
/// you defined in Steamworks.
|
||||
/// </summary>
|
||||
public bool SetFloat( ulong steamid, string name, float stat )
|
||||
{
|
||||
return server.native.gameServerStats.SetUserStat0( steamid, name, stat );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the named stat for this user. If getting the stat failed, will return
|
||||
/// defaultValue. You should have called Refresh for this userid - which downloads
|
||||
/// the stats from the backend. If you didn't call it this will always return defaultValue.
|
||||
/// </summary>
|
||||
public int GetInt( ulong steamid, string name, int defaultValue = 0 )
|
||||
{
|
||||
int data = defaultValue;
|
||||
|
||||
if ( !server.native.gameServerStats.GetUserStat( steamid, name, out data ) )
|
||||
return defaultValue;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the named stat for this user. If getting the stat failed, will return
|
||||
/// defaultValue. You should have called Refresh for this userid - which downloads
|
||||
/// the stats from the backend. If you didn't call it this will always return defaultValue.
|
||||
/// </summary>
|
||||
public float GetFloat( ulong steamid, string name, float defaultValue = 0 )
|
||||
{
|
||||
float data = defaultValue;
|
||||
|
||||
if ( !server.native.gameServerStats.GetUserStat0( steamid, name, out data ) )
|
||||
return defaultValue;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks the specified achievement for the specified user. Must have called Refresh on a steamid first.
|
||||
/// Remember to use Commit after use.
|
||||
/// </summary>
|
||||
public bool SetAchievement( ulong steamid, string name )
|
||||
{
|
||||
return server.native.gameServerStats.SetUserAchievement( steamid, name );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the unlock status of an achievement for the specified user. Must have called Refresh on a steamid first.
|
||||
/// Remember to use Commit after use.
|
||||
/// </summary>
|
||||
public bool ClearAchievement( ulong steamid, string name )
|
||||
{
|
||||
return server.native.gameServerStats.ClearUserAchievement( steamid, name );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true if available, exists and unlocked
|
||||
/// </summary>
|
||||
public bool GetAchievement( ulong steamid, string name )
|
||||
{
|
||||
bool achieved = false;
|
||||
|
||||
if ( !server.native.gameServerStats.GetUserAchievement( steamid, name, ref achieved ) )
|
||||
return false;
|
||||
|
||||
return achieved;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks.ServerList
|
||||
{
|
||||
public abstract class Base : IDisposable
|
||||
{
|
||||
|
||||
#region ISteamMatchmakingServers
|
||||
|
||||
static ISteamMatchmakingServers _internal;
|
||||
internal static ISteamMatchmakingServers Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new ISteamMatchmakingServers();
|
||||
_internal.Init();
|
||||
}
|
||||
|
||||
return _internal;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Shutdown()
|
||||
{
|
||||
_internal = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Which app we're querying. Defaults to the current app.
|
||||
/// </summary>
|
||||
public AppId AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a new server is added, this function will get called
|
||||
/// </summary>
|
||||
public event Action OnChanges;
|
||||
|
||||
/// <summary>
|
||||
/// Called for every responsive server
|
||||
/// </summary>
|
||||
public event Action<ServerInfo> OnResponsiveServer;
|
||||
|
||||
/// <summary>
|
||||
/// Called for every unresponsive server
|
||||
/// </summary>
|
||||
public event Action<ServerInfo> OnUnresponsiveServer;
|
||||
|
||||
/// <summary>
|
||||
/// A list of servers that responded. If you're only interested in servers that responded since you
|
||||
/// last updated, then simply clear this list.
|
||||
/// </summary>
|
||||
public List<ServerInfo> Responsive = new List<ServerInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of servers that were in the master list but didn't respond.
|
||||
/// </summary>
|
||||
public List<ServerInfo> Unresponsive = new List<ServerInfo>();
|
||||
|
||||
|
||||
public Base()
|
||||
{
|
||||
AppId = SteamClient.AppId; // Default AppId is this
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query the server list. Task result will be true when finished
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<bool> RunQueryAsync( float timeoutSeconds = 10 )
|
||||
{
|
||||
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
|
||||
|
||||
Reset();
|
||||
LaunchQuery();
|
||||
|
||||
var thisRequest = request;
|
||||
|
||||
while ( IsRefreshing )
|
||||
{
|
||||
await Task.Delay( 33 );
|
||||
|
||||
//
|
||||
// The request has been cancelled or changed in some way
|
||||
//
|
||||
if ( request.Value == IntPtr.Zero || thisRequest.Value != request.Value )
|
||||
return false;
|
||||
|
||||
if ( !SteamClient.IsValid )
|
||||
return false;
|
||||
|
||||
var r = Responsive.Count;
|
||||
|
||||
UpdatePending();
|
||||
UpdateResponsive();
|
||||
|
||||
if ( r != Responsive.Count )
|
||||
{
|
||||
InvokeChanges();
|
||||
}
|
||||
|
||||
if ( stopwatch.Elapsed.TotalSeconds > timeoutSeconds )
|
||||
break;
|
||||
}
|
||||
|
||||
MovePendingToUnresponsive();
|
||||
InvokeChanges();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Cancel() => Internal.CancelQuery( request );
|
||||
|
||||
// Overrides
|
||||
internal abstract void LaunchQuery();
|
||||
|
||||
internal HServerListRequest request;
|
||||
|
||||
#region Filters
|
||||
|
||||
internal List<MatchMakingKeyValuePair> filters = new List<MatchMakingKeyValuePair>();
|
||||
internal virtual MatchMakingKeyValuePair[] GetFilters() => filters.ToArray();
|
||||
|
||||
public void AddFilter( string key, string value )
|
||||
{
|
||||
filters.Add( new MatchMakingKeyValuePair { Key = key, Value = value } );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
internal int Count => Internal.GetServerCount( request );
|
||||
internal bool IsRefreshing => request.Value != IntPtr.Zero && Internal.IsRefreshing( request );
|
||||
internal List<int> watchList = new List<int>();
|
||||
internal int LastCount = 0;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
ReleaseQuery();
|
||||
LastCount = 0;
|
||||
watchList.Clear();
|
||||
}
|
||||
|
||||
void ReleaseQuery()
|
||||
{
|
||||
if ( request.Value != IntPtr.Zero )
|
||||
{
|
||||
Cancel();
|
||||
Internal.ReleaseRequest( request );
|
||||
request = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ReleaseQuery();
|
||||
}
|
||||
|
||||
internal void InvokeChanges()
|
||||
{
|
||||
OnChanges?.Invoke();
|
||||
}
|
||||
|
||||
void UpdatePending()
|
||||
{
|
||||
var count = Count;
|
||||
if ( count == LastCount ) return;
|
||||
|
||||
for ( int i = LastCount; i < count; i++ )
|
||||
{
|
||||
watchList.Add( i );
|
||||
}
|
||||
|
||||
LastCount = count;
|
||||
}
|
||||
|
||||
public void UpdateResponsive()
|
||||
{
|
||||
watchList.RemoveAll( x =>
|
||||
{
|
||||
var info = Internal.GetServerDetails( request, x );
|
||||
if ( info.HadSuccessfulResponse )
|
||||
{
|
||||
OnServer( ServerInfo.From( info ), info.HadSuccessfulResponse );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
}
|
||||
|
||||
void MovePendingToUnresponsive()
|
||||
{
|
||||
watchList.RemoveAll( x =>
|
||||
{
|
||||
var info = Internal.GetServerDetails( request, x );
|
||||
OnServer( ServerInfo.From( info ), info.HadSuccessfulResponse );
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
private void OnServer( ServerInfo serverInfo, bool responded )
|
||||
{
|
||||
if ( responded )
|
||||
{
|
||||
Responsive.Add( serverInfo );
|
||||
OnResponsiveServer?.Invoke( serverInfo );
|
||||
}
|
||||
else
|
||||
{
|
||||
Unresponsive.Add( serverInfo );
|
||||
OnUnresponsiveServer?.Invoke(serverInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.ServerList
|
||||
{
|
||||
public class Favourites : Base
|
||||
{
|
||||
internal override void LaunchQuery()
|
||||
{
|
||||
var filters = GetFilters();
|
||||
request = Internal.RequestFavoritesServerList( AppId.Value, ref filters, (uint)filters.Length, IntPtr.Zero );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.ServerList
|
||||
{
|
||||
public class Friends : Base
|
||||
{
|
||||
internal override void LaunchQuery()
|
||||
{
|
||||
var filters = GetFilters();
|
||||
request = Internal.RequestFriendsServerList( AppId.Value, ref filters, (uint)filters.Length, IntPtr.Zero );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.ServerList
|
||||
{
|
||||
public class History : Base
|
||||
{
|
||||
internal override void LaunchQuery()
|
||||
{
|
||||
var filters = GetFilters();
|
||||
request = Internal.RequestHistoryServerList( AppId.Value, ref filters, (uint)filters.Length, IntPtr.Zero );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.ServerList
|
||||
{
|
||||
public class Internet : Base
|
||||
{
|
||||
internal override void LaunchQuery()
|
||||
{
|
||||
var filters = GetFilters();
|
||||
|
||||
request = Internal.RequestInternetServerList( AppId.Value, filters, (uint)filters.Length, IntPtr.Zero );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using Steamworks.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.ServerList
|
||||
{
|
||||
public class IpList : Internet
|
||||
{
|
||||
public List<string> Ips = new List<string>();
|
||||
bool wantsCancel;
|
||||
|
||||
public IpList( IEnumerable<string> list )
|
||||
{
|
||||
Ips.AddRange( list );
|
||||
}
|
||||
|
||||
public IpList( params string[] list )
|
||||
{
|
||||
Ips.AddRange( list );
|
||||
}
|
||||
|
||||
public override async Task<bool> RunQueryAsync( float timeoutSeconds = 10 )
|
||||
{
|
||||
int blockSize = 16;
|
||||
int pointer = 0;
|
||||
|
||||
var ips = Ips.ToArray();
|
||||
|
||||
while ( true )
|
||||
{
|
||||
var sublist = ips.Skip( pointer ).Take( blockSize );
|
||||
if ( sublist.Count() == 0 )
|
||||
break;
|
||||
|
||||
using ( var list = new ServerList.Internet() )
|
||||
{
|
||||
list.AddFilter( "or", sublist.Count().ToString() );
|
||||
|
||||
foreach ( var server in sublist )
|
||||
{
|
||||
list.AddFilter( "gameaddr", server );
|
||||
}
|
||||
|
||||
await list.RunQueryAsync( timeoutSeconds );
|
||||
|
||||
if ( wantsCancel )
|
||||
return false;
|
||||
|
||||
Responsive.AddRange( list.Responsive );
|
||||
Responsive = Responsive.Distinct().ToList();
|
||||
Unresponsive.AddRange( list.Unresponsive );
|
||||
Unresponsive = Unresponsive.Distinct().ToList();
|
||||
}
|
||||
|
||||
pointer += sublist.Count();
|
||||
|
||||
InvokeChanges();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Cancel()
|
||||
{
|
||||
wantsCancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.ServerList
|
||||
{
|
||||
public class LocalNetwork : Base
|
||||
{
|
||||
internal override void LaunchQuery()
|
||||
{
|
||||
request = Internal.RequestLANServerList( AppId.Value, IntPtr.Zero );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Exposes a wide range of information and actions for applications and Downloadable Content (DLC).
|
||||
/// </summary>
|
||||
public static class SteamApps
|
||||
{
|
||||
static ISteamApps _internal;
|
||||
internal static ISteamApps Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new ISteamApps();
|
||||
_internal.Init();
|
||||
}
|
||||
|
||||
return _internal;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Shutdown()
|
||||
{
|
||||
_internal = null;
|
||||
}
|
||||
|
||||
internal static void InstallEvents()
|
||||
{
|
||||
DlcInstalled_t.Install( x => OnDlcInstalled?.Invoke( x.AppID ) );
|
||||
NewUrlLaunchParameters_t.Install( x => OnNewLaunchParameters?.Invoke() );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// posted after the user gains ownership of DLC and that DLC is installed
|
||||
/// </summary>
|
||||
public static event Action<AppId> OnDlcInstalled;
|
||||
|
||||
/// <summary>
|
||||
/// posted after the user gains executes a Steam URL with command line or query parameters
|
||||
/// such as steam://run/appid//-commandline/?param1=value1(and)param2=value2(and)param3=value3 etc
|
||||
/// while the game is already running. The new params can be queried
|
||||
/// with GetLaunchQueryParam and GetLaunchCommandLine
|
||||
/// </summary>
|
||||
public static event Action OnNewLaunchParameters;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the active user is subscribed to the current App ID
|
||||
/// </summary>
|
||||
public static bool IsSubscribed => Internal.BIsSubscribed();
|
||||
|
||||
/// <summary>
|
||||
/// Check if user borrowed this game via Family Sharing, If true, call GetAppOwner() to get the lender SteamID
|
||||
/// </summary>
|
||||
public static bool IsSubscribedFromFamilySharing => Internal.BIsSubscribedFromFamilySharing();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the license owned by the user provides low violence depots.
|
||||
/// Low violence depots are useful for copies sold in countries that have content restrictions
|
||||
/// </summary>
|
||||
public static bool IsLowViolence => Internal.BIsLowViolence();
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the current App ID license is for Cyber Cafes.
|
||||
/// </summary>
|
||||
public static bool IsCybercafe => Internal.BIsCybercafe();
|
||||
|
||||
/// <summary>
|
||||
/// CChecks if the user has a VAC ban on their account
|
||||
/// </summary>
|
||||
public static bool IsVACBanned => Internal.BIsVACBanned();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current language that the user has set.
|
||||
/// This falls back to the Steam UI language if the user hasn't explicitly picked a language for the title.
|
||||
/// </summary>
|
||||
public static string GameLanguage => Internal.GetCurrentGameLanguage();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of the languages the current app supports.
|
||||
/// </summary>
|
||||
public static string[] AvailablLanguages => Internal.GetAvailableGameLanguages().Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries );
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the active user is subscribed to a specified AppId.
|
||||
/// Only use this if you need to check ownership of another game related to yours, a demo for example.
|
||||
/// </summary>
|
||||
public static bool IsSubscribedToApp( AppId appid ) => Internal.BIsSubscribedApp( appid.Value );
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the user owns a specific DLC and if the DLC is installed
|
||||
/// </summary>
|
||||
public static bool IsDlcInstalled( AppId appid ) => Internal.BIsDlcInstalled( appid.Value );
|
||||
|
||||
/// <summary>
|
||||
/// Returns the time of the purchase of the app
|
||||
/// </summary>
|
||||
public static DateTime PurchaseTime( AppId appid = default )
|
||||
{
|
||||
if ( appid == 0 )
|
||||
appid = SteamClient.AppId;
|
||||
|
||||
return Epoch.ToDateTime(Internal.GetEarliestPurchaseUnixTime(appid.Value ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the user is subscribed to the current app through a free weekend
|
||||
/// This function will return false for users who have a retail or other type of license
|
||||
/// Before using, please ask your Valve technical contact how to package and secure your free weekened
|
||||
/// </summary>
|
||||
public static bool IsSubscribedFromFreeWeekend => Internal.BIsSubscribedFromFreeWeekend();
|
||||
|
||||
/// <summary>
|
||||
/// Returns metadata for all available DLC
|
||||
/// </summary>
|
||||
public static IEnumerable<DlcInformation> DlcInformation()
|
||||
{
|
||||
var appid = default( AppId );
|
||||
var available = false;
|
||||
|
||||
for ( int i = 0; i < Internal.GetDLCCount(); i++ )
|
||||
{
|
||||
if ( !Internal.BGetDLCDataByIndex( i, ref appid, ref available, out var strVal ) )
|
||||
continue;
|
||||
|
||||
yield return new DlcInformation
|
||||
{
|
||||
AppId = appid.Value,
|
||||
Name = strVal,
|
||||
Available = available
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Install/Uninstall control for optional DLC
|
||||
/// </summary>
|
||||
public static void InstallDlc( AppId appid ) => Internal.InstallDLC( appid.Value );
|
||||
|
||||
/// <summary>
|
||||
/// Install/Uninstall control for optional DLC
|
||||
/// </summary>
|
||||
public static void UninstallDlc( AppId appid ) => Internal.UninstallDLC( appid.Value );
|
||||
|
||||
/// <summary>
|
||||
/// Returns null if we're not on a beta branch, else the name of the branch
|
||||
/// </summary>
|
||||
public static string CurrentBetaName
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !Internal.GetCurrentBetaName( out var strVal ) )
|
||||
return null;
|
||||
|
||||
return strVal;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to force verify game content on next launch.
|
||||
///
|
||||
/// If you detect the game is out-of-date(for example, by having the client detect a version mismatch with a server),
|
||||
/// you can call use MarkContentCorrupt to force a verify, show a message to the user, and then quit.
|
||||
/// </summary>
|
||||
public static void MarkContentCorrupt( bool missingFilesOnly ) => Internal.MarkContentCorrupt( missingFilesOnly );
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all installed depots for a given App ID in mount order
|
||||
/// </summary>
|
||||
public static IEnumerable<DepotId> InstalledDepots( AppId appid = default )
|
||||
{
|
||||
if ( appid == 0 )
|
||||
appid = SteamClient.AppId;
|
||||
|
||||
var depots = new DepotId_t[32];
|
||||
uint count = 0;
|
||||
|
||||
count = Internal.GetInstalledDepots( appid.Value, depots, (uint) depots.Length );
|
||||
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
yield return new DepotId { Value = depots[i].Value };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the install folder for a specific AppID.
|
||||
/// This works even if the application is not installed, based on where the game would be installed with the default Steam library location.
|
||||
/// </summary>
|
||||
public static string AppInstallDir( AppId appid = default )
|
||||
{
|
||||
if ( appid == 0 )
|
||||
appid = SteamClient.AppId;
|
||||
|
||||
if ( Internal.GetAppInstallDir( appid.Value, out var strVal ) == 0 )
|
||||
return null;
|
||||
|
||||
return strVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The app may not actually be owned by the current user, they may have it left over from a free weekend, etc.
|
||||
/// </summary>
|
||||
public static bool IsAppInstalled( AppId appid ) => Internal.BIsAppInstalled( appid.Value );
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Steam ID of the original owner of the current app. If it's different from the current user then it is borrowed..
|
||||
/// </summary>
|
||||
public static SteamId AppOwner => Internal.GetAppOwner().Value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the associated launch parameter if the game is run via steam://run/appid/?param1=value1;param2=value2;param3=value3 etc.
|
||||
/// Parameter names starting with the character '@' are reserved for internal use and will always return an empty string.
|
||||
/// Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game,
|
||||
/// but it is advised that you not param names beginning with an underscore for your own features.
|
||||
/// </summary>
|
||||
public static string GetLaunchParam( string param ) => Internal.GetLaunchQueryParam( param );
|
||||
|
||||
/// <summary>
|
||||
/// Gets the download progress for optional DLC.
|
||||
/// </summary>
|
||||
public static DownloadProgress DlcDownloadProgress( AppId appid )
|
||||
{
|
||||
ulong punBytesDownloaded = 0;
|
||||
ulong punBytesTotal = 0;
|
||||
|
||||
if ( !Internal.GetDlcDownloadProgress( appid.Value, ref punBytesDownloaded, ref punBytesTotal ) )
|
||||
return default( DownloadProgress );
|
||||
|
||||
return new DownloadProgress { BytesDownloaded = punBytesDownloaded, BytesTotal = punBytesTotal, Active = true };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the buildid of this app, may change at any time based on backend updates to the game.
|
||||
/// Defaults to 0 if you're not running a build downloaded from steam.
|
||||
/// </summary>
|
||||
public static int BuildId => Internal.GetAppBuildId();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves metadata details about a specific file in the depot manifest.
|
||||
/// Currently provides:
|
||||
/// </summary>
|
||||
public static async Task<FileDetails?> GetFileDetailsAsync( string filename )
|
||||
{
|
||||
var r = await Internal.GetFileDetails( filename );
|
||||
|
||||
if ( !r.HasValue || r.Value.Result != Result.OK )
|
||||
return null;
|
||||
|
||||
return new FileDetails
|
||||
{
|
||||
SizeInBytes = r.Value.FileSize,
|
||||
Flags = r.Value.Flags,
|
||||
Sha1 = string.Join( "", r.Value.FileSHA.Select( x => x.ToString( "x" ) ) )
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get command line if game was launched via Steam URL, e.g. steam://run/appid//command line/.
|
||||
/// This method of passing a connect string (used when joining via rich presence, accepting an
|
||||
/// invite, etc) is preferable to passing the connect string on the operating system command
|
||||
/// line, which is a security risk. In order for rich presence joins to go through this
|
||||
/// path and not be placed on the OS command line, you must set a value in your app's
|
||||
/// configuration on Steam. Ask Valve for help with this.
|
||||
/// </summary>
|
||||
public static string CommandLine
|
||||
{
|
||||
get
|
||||
{
|
||||
var len = Internal.GetLaunchCommandLine( out var strVal );
|
||||
return strVal;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
public static class SteamClient
|
||||
{
|
||||
static bool initialized;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the steam client.
|
||||
/// If asyncCallbacks is false you need to call RunCallbacks manually every frame.
|
||||
/// </summary>
|
||||
public static void Init( uint appid, bool asyncCallbacks = true )
|
||||
{
|
||||
System.Environment.SetEnvironmentVariable( "SteamAppId", appid.ToString() );
|
||||
System.Environment.SetEnvironmentVariable( "SteamGameId", appid.ToString() );
|
||||
|
||||
if ( !SteamAPI.Init() )
|
||||
{
|
||||
throw new System.Exception( "SteamApi_Init returned false. Steam isn't running, couldn't find Steam, AppId is ureleased, Don't own AppId." );
|
||||
}
|
||||
|
||||
AppId = appid;
|
||||
|
||||
initialized = true;
|
||||
|
||||
SteamApps.InstallEvents();
|
||||
SteamUtils.InstallEvents();
|
||||
SteamParental.InstallEvents();
|
||||
SteamMusic.InstallEvents();
|
||||
SteamVideo.InstallEvents();
|
||||
SteamUser.InstallEvents();
|
||||
SteamFriends.InstallEvents();
|
||||
SteamScreenshots.InstallEvents();
|
||||
SteamUserStats.InstallEvents();
|
||||
SteamInventory.InstallEvents();
|
||||
SteamNetworking.InstallEvents();
|
||||
SteamMatchmaking.InstallEvents();
|
||||
SteamParties.InstallEvents();
|
||||
SteamNetworkingSockets.InstallEvents();
|
||||
SteamInput.InstallEvents();
|
||||
SteamUGC.InstallEvents();
|
||||
|
||||
if ( asyncCallbacks )
|
||||
{
|
||||
RunCallbacksAsync();
|
||||
}
|
||||
}
|
||||
|
||||
static List<SteamInterface> openIterfaces = new List<SteamInterface>();
|
||||
|
||||
internal static void WatchInterface( SteamInterface steamInterface )
|
||||
{
|
||||
if ( openIterfaces.Contains( steamInterface ) )
|
||||
throw new System.Exception( "openIterfaces already contains interface!" );
|
||||
|
||||
openIterfaces.Add( steamInterface );
|
||||
}
|
||||
|
||||
internal static void ShutdownInterfaces()
|
||||
{
|
||||
foreach ( var e in openIterfaces )
|
||||
{
|
||||
e.Shutdown();
|
||||
}
|
||||
|
||||
openIterfaces.Clear();
|
||||
}
|
||||
|
||||
public static Action<Exception> OnCallbackException;
|
||||
|
||||
public static bool IsValid => initialized;
|
||||
|
||||
internal static async void RunCallbacksAsync()
|
||||
{
|
||||
while ( IsValid )
|
||||
{
|
||||
await Task.Delay( 16 );
|
||||
|
||||
try
|
||||
{
|
||||
RunCallbacks();
|
||||
}
|
||||
catch ( System.Exception e )
|
||||
{
|
||||
OnCallbackException?.Invoke( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Shutdown()
|
||||
{
|
||||
if ( !IsValid ) return;
|
||||
|
||||
SteamInput.Shutdown();
|
||||
|
||||
Cleanup();
|
||||
|
||||
SteamAPI.Shutdown();
|
||||
}
|
||||
|
||||
internal static void Cleanup()
|
||||
{
|
||||
initialized = false;
|
||||
|
||||
Event.DisposeAllClient();
|
||||
ShutdownInterfaces();
|
||||
|
||||
SteamInput.Shutdown();
|
||||
SteamApps.Shutdown();
|
||||
SteamUtils.Shutdown();
|
||||
SteamParental.Shutdown();
|
||||
SteamMusic.Shutdown();
|
||||
SteamVideo.Shutdown();
|
||||
SteamUser.Shutdown();
|
||||
SteamFriends.Shutdown();
|
||||
SteamScreenshots.Shutdown();
|
||||
SteamUserStats.Shutdown();
|
||||
SteamInventory.Shutdown();
|
||||
SteamNetworking.Shutdown();
|
||||
SteamMatchmaking.Shutdown();
|
||||
SteamParties.Shutdown();
|
||||
SteamNetworkingUtils.Shutdown();
|
||||
SteamNetworkingSockets.Shutdown();
|
||||
ServerList.Base.Shutdown();
|
||||
}
|
||||
|
||||
internal static void RegisterCallback( IntPtr intPtr, int callbackId )
|
||||
{
|
||||
SteamAPI.RegisterCallback( intPtr, callbackId );
|
||||
}
|
||||
|
||||
public static void RunCallbacks()
|
||||
{
|
||||
if ( !IsValid ) return;
|
||||
|
||||
SteamAPI.RunCallbacks();
|
||||
}
|
||||
|
||||
internal static void UnregisterCallback( IntPtr intPtr )
|
||||
{
|
||||
SteamAPI.UnregisterCallback( intPtr );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the current user's Steam client is connected to the Steam servers.
|
||||
/// If it's not then no real-time services provided by the Steamworks API will be enabled. The Steam
|
||||
/// client will automatically be trying to recreate the connection as often as possible. When the
|
||||
/// connection is restored a SteamServersConnected_t callback will be posted.
|
||||
/// You usually don't need to check for this yourself. All of the API calls that rely on this will
|
||||
/// check internally. Forcefully disabling stuff when the player loses access is usually not a
|
||||
/// very good experience for the player and you could be preventing them from accessing APIs that do not
|
||||
/// need a live connection to Steam.
|
||||
/// </summary>
|
||||
public static bool IsLoggedOn => SteamUser.Internal.BLoggedOn();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Steam ID of the account currently logged into the Steam client. This is
|
||||
/// commonly called the 'current user', or 'local user'.
|
||||
/// A Steam ID is a unique identifier for a Steam accounts, Steam groups, Lobbies and Chat
|
||||
/// rooms, and used to differentiate users in all parts of the Steamworks API.
|
||||
/// </summary>
|
||||
public static SteamId SteamId => SteamUser.Internal.GetSteamID();
|
||||
|
||||
/// <summary>
|
||||
/// returns the local players name - guaranteed to not be NULL.
|
||||
/// this is the same name as on the users community profile page
|
||||
/// </summary>
|
||||
public static string Name => SteamFriends.Internal.GetPersonaName();
|
||||
|
||||
/// <summary>
|
||||
/// gets the status of the current user
|
||||
/// </summary>
|
||||
public static FriendState State => SteamFriends.Internal.GetPersonaState();
|
||||
|
||||
/// <summary>
|
||||
/// returns the appID of the current process
|
||||
/// </summary>
|
||||
public static AppId AppId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't
|
||||
/// this returns true then it starts the Steam client if required and launches your game again through it,
|
||||
/// and you should quit your process as soon as possible. This effectively runs steam://run/AppId so it
|
||||
/// may not relaunch the exact executable that called it, as it will always relaunch from the version
|
||||
/// installed in your Steam library folder/
|
||||
/// Note that during development, when not launching via Steam, this might always return true.
|
||||
/// </summary>
|
||||
public static bool RestartAppIfNecessary( uint appid )
|
||||
{
|
||||
// Having these here would probably mean it always returns false?
|
||||
|
||||
//System.Environment.SetEnvironmentVariable( "SteamAppId", appid.ToString() );
|
||||
//System.Environment.SetEnvironmentVariable( "SteamGameId", appid.ToString() );
|
||||
|
||||
return SteamAPI.RestartAppIfNecessary( appid );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called in interfaces that rely on this being initialized
|
||||
/// </summary>
|
||||
internal static void ValidCheck()
|
||||
{
|
||||
if ( !IsValid )
|
||||
throw new System.Exception( "SteamClient isn't initialized" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Undocumented Parental Settings
|
||||
/// </summary>
|
||||
public static class SteamFriends
|
||||
{
|
||||
static ISteamFriends _internal;
|
||||
internal static ISteamFriends Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
SteamClient.ValidCheck();
|
||||
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new ISteamFriends();
|
||||
_internal.Init();
|
||||
|
||||
richPresence = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
return _internal;
|
||||
}
|
||||
}
|
||||
internal static void Shutdown()
|
||||
{
|
||||
_internal = null;
|
||||
}
|
||||
|
||||
static Dictionary<string, string> richPresence;
|
||||
|
||||
internal static void InstallEvents()
|
||||
{
|
||||
FriendStateChange_t.Install( x => OnPersonaStateChange?.Invoke( new Friend( x.SteamID ) ) );
|
||||
GameRichPresenceJoinRequested_t.Install( x => OnGameRichPresenceJoinRequested?.Invoke( new Friend( x.SteamIDFriend), x.ConnectUTF8() ) );
|
||||
GameConnectedFriendChatMsg_t.Install( OnFriendChatMessage );
|
||||
GameOverlayActivated_t.Install( x => OnGameOverlayActivated?.Invoke() );
|
||||
GameServerChangeRequested_t.Install( x => OnGameServerChangeRequested?.Invoke( x.ServerUTF8(), x.PasswordUTF8() ) );
|
||||
GameLobbyJoinRequested_t.Install( x => OnGameLobbyJoinRequested?.Invoke( new Lobby( x.SteamIDLobby ), x.SteamIDFriend ) );
|
||||
FriendRichPresenceUpdate_t.Install( x => OnFriendRichPresenceUpdate?.Invoke( new Friend( x.SteamIDFriend ) ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when chat message has been received from a friend. You'll need to turn on
|
||||
/// ListenForFriendsMessages to recieve this. (friend, msgtype, message)
|
||||
/// </summary>
|
||||
public static event Action<Friend, string, string> OnChatMessage;
|
||||
|
||||
/// <summary>
|
||||
/// called when a friends' status changes
|
||||
/// </summary>
|
||||
public static event Action<Friend> OnPersonaStateChange;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called when the user tries to join a game from their friends list
|
||||
/// rich presence will have been set with the "connect" key which is set here
|
||||
/// </summary>
|
||||
public static event Action<Friend, string> OnGameRichPresenceJoinRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Posted when game overlay activates or deactivates
|
||||
/// the game can use this to be pause or resume single player games
|
||||
/// </summary>
|
||||
public static event Action OnGameOverlayActivated;
|
||||
|
||||
/// <summary>
|
||||
/// Called when the user tries to join a different game server from their friends list
|
||||
/// game client should attempt to connect to specified server when this is received
|
||||
/// </summary>
|
||||
public static event Action<string, string> OnGameServerChangeRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Called when the user tries to join a lobby from their friends list
|
||||
/// game client should attempt to connect to specified lobby when this is received
|
||||
/// </summary>
|
||||
public static event Action<Lobby, SteamId> OnGameLobbyJoinRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Callback indicating updated data about friends rich presence information
|
||||
/// </summary>
|
||||
public static event Action<Friend> OnFriendRichPresenceUpdate;
|
||||
|
||||
static unsafe void OnFriendChatMessage( GameConnectedFriendChatMsg_t data )
|
||||
{
|
||||
if ( OnChatMessage == null ) return;
|
||||
|
||||
var friend = new Friend( data.SteamIDUser );
|
||||
|
||||
var buffer = Helpers.TakeBuffer( 1024 * 32 );
|
||||
var type = ChatEntryType.ChatMsg;
|
||||
|
||||
fixed ( byte* ptr = buffer )
|
||||
{
|
||||
var len = Internal.GetFriendMessage( data.SteamIDUser, data.MessageID, (IntPtr)ptr, buffer.Length, ref type );
|
||||
|
||||
if ( len == 0 && type == ChatEntryType.Invalid )
|
||||
return;
|
||||
|
||||
var typeName = type.ToString();
|
||||
var message = Encoding.UTF8.GetString( buffer, 0, len );
|
||||
|
||||
OnChatMessage( friend, typeName, message );
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetFriendPersonaName( SteamId steamId )
|
||||
{
|
||||
return Internal.GetFriendPersonaName(steamId);
|
||||
}
|
||||
|
||||
public static IEnumerable<Friend> GetFriends()
|
||||
{
|
||||
for ( int i=0; i<Internal.GetFriendCount( (int) FriendFlags.Immediate ); i++ )
|
||||
{
|
||||
yield return new Friend( Internal.GetFriendByIndex( i, (int)FriendFlags.Immediate ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<Friend> GetBlocked()
|
||||
{
|
||||
for ( int i = 0; i < Internal.GetFriendCount( (int)FriendFlags.Blocked ); i++ )
|
||||
{
|
||||
yield return new Friend( Internal.GetFriendByIndex( i, (int)FriendFlags.Blocked) );
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<Friend> GetPlayedWith()
|
||||
{
|
||||
for ( int i = 0; i < Internal.GetCoplayFriendCount(); i++ )
|
||||
{
|
||||
yield return new Friend( Internal.GetCoplayFriend( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The dialog to open. Valid options are:
|
||||
/// "friends",
|
||||
/// "community",
|
||||
/// "players",
|
||||
/// "settings",
|
||||
/// "officialgamegroup",
|
||||
/// "stats",
|
||||
/// "achievements".
|
||||
/// </summary>
|
||||
public static void OpenOverlay( string type ) => Internal.ActivateGameOverlay( type );
|
||||
|
||||
/// <summary>
|
||||
/// "steamid" - Opens the overlay web browser to the specified user or groups profile.
|
||||
/// "chat" - Opens a chat window to the specified user, or joins the group chat.
|
||||
/// "jointrade" - Opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API.
|
||||
/// "stats" - Opens the overlay web browser to the specified user's stats.
|
||||
/// "achievements" - Opens the overlay web browser to the specified user's achievements.
|
||||
/// "friendadd" - Opens the overlay in minimal mode prompting the user to add the target user as a friend.
|
||||
/// "friendremove" - Opens the overlay in minimal mode prompting the user to remove the target friend.
|
||||
/// "friendrequestaccept" - Opens the overlay in minimal mode prompting the user to accept an incoming friend invite.
|
||||
/// "friendrequestignore" - Opens the overlay in minimal mode prompting the user to ignore an incoming friend invite.
|
||||
/// </summary>
|
||||
public static void OpenUserOverlay( SteamId id, string type ) => Internal.ActivateGameOverlayToUser( type, id );
|
||||
|
||||
/// <summary>
|
||||
/// Activates the Steam Overlay to the Steam store page for the provided app.
|
||||
/// </summary>
|
||||
public static void OpenStoreOverlay( AppId id ) => Internal.ActivateGameOverlayToStore( id.Value, OverlayToStoreFlag.None );
|
||||
|
||||
/// <summary>
|
||||
/// Activates Steam Overlay web browser directly to the specified URL.
|
||||
/// </summary>
|
||||
public static void OpenWebOverlay( string url, bool modal = false ) => Internal.ActivateGameOverlayToWebPage( url, modal ? ActivateGameOverlayToWebPageMode.Modal : ActivateGameOverlayToWebPageMode.Default );
|
||||
|
||||
/// <summary>
|
||||
/// Activates the Steam Overlay to open the invite dialog. Invitations sent from this dialog will be for the provided lobby.
|
||||
/// </summary>
|
||||
public static void OpenGameInviteOverlay( SteamId lobby ) => Internal.ActivateGameOverlayInviteDialog( lobby );
|
||||
|
||||
/// <summary>
|
||||
/// Mark a target user as 'played with'.
|
||||
/// NOTE: The current user must be in game with the other player for the association to work.
|
||||
/// </summary>
|
||||
public static void SetPlayedWith( SteamId steamid ) => Internal.SetPlayedWith( steamid );
|
||||
|
||||
/// <summary>
|
||||
/// Requests the persona name and optionally the avatar of a specified user.
|
||||
/// NOTE: It's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them.
|
||||
/// returns true if we're fetching the data, false if we already have it
|
||||
/// </summary>
|
||||
public static bool RequestUserInformation( SteamId steamid, bool nameonly = true ) => Internal.RequestUserInformation( steamid, nameonly );
|
||||
|
||||
|
||||
internal static async Task CacheUserInformationAsync( SteamId steamid, bool nameonly )
|
||||
{
|
||||
// Got it straight away, skip any waiting.
|
||||
if ( !RequestUserInformation( steamid, nameonly ) )
|
||||
return;
|
||||
|
||||
await Task.Delay( 100 );
|
||||
|
||||
while ( RequestUserInformation( steamid, nameonly ) )
|
||||
{
|
||||
await Task.Delay( 50 );
|
||||
}
|
||||
|
||||
//
|
||||
// And extra wait here seems to solve avatars loading as [?]
|
||||
//
|
||||
await Task.Delay( 500 );
|
||||
}
|
||||
|
||||
public static async Task<Data.Image?> GetSmallAvatarAsync( SteamId steamid )
|
||||
{
|
||||
await CacheUserInformationAsync( steamid, false );
|
||||
return SteamUtils.GetImage( Internal.GetSmallFriendAvatar( steamid ) );
|
||||
}
|
||||
|
||||
public static async Task<Data.Image?> GetMediumAvatarAsync( SteamId steamid )
|
||||
{
|
||||
await CacheUserInformationAsync( steamid, false );
|
||||
return SteamUtils.GetImage( Internal.GetMediumFriendAvatar( steamid ) );
|
||||
}
|
||||
|
||||
public static async Task<Data.Image?> GetLargeAvatarAsync( SteamId steamid )
|
||||
{
|
||||
await CacheUserInformationAsync( steamid, false );
|
||||
|
||||
var imageid = Internal.GetLargeFriendAvatar( steamid );
|
||||
|
||||
// Wait for the image to download
|
||||
while ( imageid == -1 )
|
||||
{
|
||||
await Task.Delay( 50 );
|
||||
imageid = Internal.GetLargeFriendAvatar( steamid );
|
||||
}
|
||||
|
||||
return SteamUtils.GetImage( imageid );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find a rich presence value by key for current user. Will be null if not found.
|
||||
/// </summary>
|
||||
public static string GetRichPresence( string key )
|
||||
{
|
||||
if ( richPresence.TryGetValue( key, out var val ) )
|
||||
return val;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a rich presence value by key for current user.
|
||||
/// </summary>
|
||||
public static bool SetRichPresence( string key, string value )
|
||||
{
|
||||
richPresence[key] = value;
|
||||
return Internal.SetRichPresence( key, value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all of the current user's rich presence data.
|
||||
/// </summary>
|
||||
public static void ClearRichPresence()
|
||||
{
|
||||
richPresence.Clear();
|
||||
Internal.ClearRichPresence();
|
||||
}
|
||||
|
||||
static bool _listenForFriendsMessages;
|
||||
|
||||
/// <summary>
|
||||
/// Listens for Steam friends chat messages.
|
||||
/// You can then show these chats inline in the game. For example with a Blizzard style chat message system or the chat system in Dota 2.
|
||||
/// After enabling this you will receive callbacks when ever the user receives a chat message.
|
||||
/// </summary>
|
||||
public static bool ListenForFriendsMessages
|
||||
{
|
||||
get => _listenForFriendsMessages;
|
||||
|
||||
set
|
||||
{
|
||||
_listenForFriendsMessages = value;
|
||||
Internal.SetListenForFriendsMessages( value );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using Steamworks.Data;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
public static class SteamInput
|
||||
{
|
||||
internal const int STEAM_CONTROLLER_MAX_COUNT = 16;
|
||||
|
||||
static ISteamInput _internal;
|
||||
internal static ISteamInput Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
SteamClient.ValidCheck();
|
||||
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new ISteamInput();
|
||||
_internal.Init();
|
||||
}
|
||||
|
||||
return _internal;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Shutdown()
|
||||
{
|
||||
if ( _internal != null && _internal.IsValid )
|
||||
{
|
||||
_internal.DoShutdown();
|
||||
}
|
||||
|
||||
_internal = null;
|
||||
}
|
||||
|
||||
internal static void InstallEvents()
|
||||
{
|
||||
Internal.DoInit();
|
||||
Internal.RunFrame();
|
||||
|
||||
// None?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// You shouldn't really need to call this because it get called by RunCallbacks on SteamClient
|
||||
/// but Valve think it might be a nice idea if you call it right before you get input info -
|
||||
/// just to make sure the info you're getting is 100% up to date.
|
||||
/// </summary>
|
||||
public static void RunFrame()
|
||||
{
|
||||
Internal.RunFrame();
|
||||
}
|
||||
|
||||
static InputHandle_t[] queryArray = new InputHandle_t[STEAM_CONTROLLER_MAX_COUNT];
|
||||
|
||||
/// <summary>
|
||||
/// Return a list of connected controllers.
|
||||
/// </summary>
|
||||
public static IEnumerable<Controller> Controllers
|
||||
{
|
||||
get
|
||||
{
|
||||
var num = Internal.GetConnectedControllers( queryArray );
|
||||
|
||||
for ( int i = 0; i < num; i++ )
|
||||
{
|
||||
yield return new Controller( queryArray[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static Dictionary<string, InputDigitalActionHandle_t> DigitalHandles = new Dictionary<string, InputDigitalActionHandle_t>();
|
||||
internal static InputDigitalActionHandle_t GetDigitalActionHandle( string name )
|
||||
{
|
||||
if ( DigitalHandles.TryGetValue( name, out var val ) )
|
||||
return val;
|
||||
|
||||
val = Internal.GetDigitalActionHandle( name );
|
||||
DigitalHandles.Add( name, val );
|
||||
return val;
|
||||
}
|
||||
|
||||
internal static Dictionary<string, InputAnalogActionHandle_t> AnalogHandles = new Dictionary<string, InputAnalogActionHandle_t>();
|
||||
internal static InputAnalogActionHandle_t GetAnalogActionHandle( string name )
|
||||
{
|
||||
if ( AnalogHandles.TryGetValue( name, out var val ) )
|
||||
return val;
|
||||
|
||||
val = Internal.GetAnalogActionHandle( name );
|
||||
AnalogHandles.Add( name, val );
|
||||
return val;
|
||||
}
|
||||
|
||||
internal static Dictionary<string, InputActionSetHandle_t> ActionSets = new Dictionary<string, InputActionSetHandle_t>();
|
||||
internal static InputActionSetHandle_t GetActionSetHandle( string name )
|
||||
{
|
||||
if ( ActionSets.TryGetValue( name, out var val ) )
|
||||
return val;
|
||||
|
||||
val = Internal.GetActionSetHandle( name );
|
||||
ActionSets.Add( name, val );
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,372 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Undocumented Parental Settings
|
||||
/// </summary>
|
||||
public static class SteamInventory
|
||||
{
|
||||
static ISteamInventory _internal;
|
||||
internal static ISteamInventory Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new ISteamInventory();
|
||||
_internal.Init();
|
||||
}
|
||||
|
||||
return _internal;
|
||||
}
|
||||
}
|
||||
internal static void Shutdown()
|
||||
{
|
||||
_internal = null;
|
||||
}
|
||||
|
||||
internal static void InstallEvents()
|
||||
{
|
||||
SteamInventoryFullUpdate_t.Install( x => InventoryUpdated( x ) );
|
||||
SteamInventoryDefinitionUpdate_t.Install( x => LoadDefinitions() );
|
||||
SteamInventoryDefinitionUpdate_t.Install( x => LoadDefinitions(), true );
|
||||
}
|
||||
|
||||
private static void InventoryUpdated( SteamInventoryFullUpdate_t x )
|
||||
{
|
||||
var r = new InventoryResult( x.Handle, false );
|
||||
Items = r.GetItems( false );
|
||||
|
||||
OnInventoryUpdated?.Invoke( r );
|
||||
}
|
||||
|
||||
public static event Action<InventoryResult> OnInventoryUpdated;
|
||||
public static event Action OnDefinitionsUpdated;
|
||||
|
||||
static void LoadDefinitions()
|
||||
{
|
||||
Definitions = GetDefinitions();
|
||||
|
||||
if ( Definitions == null )
|
||||
return;
|
||||
|
||||
_defMap = new Dictionary<int, InventoryDef>();
|
||||
|
||||
foreach ( var d in Definitions )
|
||||
{
|
||||
_defMap[d.Id] = d;
|
||||
}
|
||||
|
||||
OnDefinitionsUpdated?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Call this if you're going to want to access definition information. You should be able to get
|
||||
/// away with calling this once at the start if your game, assuming your items don't change all the time.
|
||||
/// This will trigger OnDefinitionsUpdated at which point Definitions should be set.
|
||||
/// </summary>
|
||||
public static void LoadItemDefinitions()
|
||||
{
|
||||
// If they're null, try to load them immediately
|
||||
// my hunch is that this loads a disk cached version
|
||||
// but waiting for LoadItemDefinitions downloads a new copy
|
||||
// from Steam's servers. So this will give us immediate data
|
||||
// where as Steam's inventory servers could be slow/down
|
||||
if ( Definitions == null )
|
||||
{
|
||||
LoadDefinitions();
|
||||
}
|
||||
|
||||
Internal.LoadItemDefinitions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will call LoadItemDefinitions and wait until Definitions is not null
|
||||
/// </summary>
|
||||
public static async Task<bool> WaitForDefinitions( float timeoutSeconds = 30 )
|
||||
{
|
||||
if ( Definitions != null )
|
||||
return true;
|
||||
|
||||
LoadDefinitions();
|
||||
LoadItemDefinitions();
|
||||
|
||||
if ( Definitions != null )
|
||||
return true;
|
||||
|
||||
var sw = Stopwatch.StartNew();
|
||||
|
||||
while ( Definitions == null )
|
||||
{
|
||||
if ( sw.Elapsed.TotalSeconds > timeoutSeconds )
|
||||
return false;
|
||||
|
||||
await Task.Delay( 10 );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to find the definition that matches this definition ID.
|
||||
/// Uses a dictionary so should be about as fast as possible.
|
||||
/// </summary>
|
||||
public static InventoryDef FindDefinition( InventoryDefId defId )
|
||||
{
|
||||
if ( _defMap == null )
|
||||
return null;
|
||||
|
||||
if ( _defMap.TryGetValue( defId, out var val ) )
|
||||
return val;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string Currency { get; internal set; }
|
||||
|
||||
public static async Task<InventoryDef[]> GetDefinitionsWithPricesAsync()
|
||||
{
|
||||
var priceRequest = await Internal.RequestPrices();
|
||||
if ( !priceRequest.HasValue || priceRequest.Value.Result != Result.OK )
|
||||
return null;
|
||||
|
||||
Currency = priceRequest?.CurrencyUTF8();
|
||||
|
||||
var num = Internal.GetNumItemsWithPrices();
|
||||
|
||||
if ( num <= 0 )
|
||||
return null;
|
||||
|
||||
var defs = new InventoryDefId[num];
|
||||
var currentPrices = new ulong[num];
|
||||
var baseprices = new ulong[num];
|
||||
|
||||
var gotPrices = Internal.GetItemsWithPrices( defs, currentPrices, baseprices, num );
|
||||
if ( !gotPrices )
|
||||
return null;
|
||||
|
||||
return defs.Select( x => new InventoryDef( x ) ).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We will try to keep this list of your items automatically up to date.
|
||||
/// </summary>
|
||||
public static InventoryItem[] Items { get; internal set; }
|
||||
|
||||
public static InventoryDef[] Definitions { get; internal set; }
|
||||
static Dictionary<int, InventoryDef> _defMap;
|
||||
|
||||
internal static InventoryDef[] GetDefinitions()
|
||||
{
|
||||
uint num = 0;
|
||||
if ( !Internal.GetItemDefinitionIDs( null, ref num ) )
|
||||
return null;
|
||||
|
||||
var defs = new InventoryDefId[num];
|
||||
|
||||
if ( !Internal.GetItemDefinitionIDs( defs, ref num ) )
|
||||
return null;
|
||||
|
||||
return defs.Select( x => new InventoryDef( x ) ).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the list of Items[]
|
||||
/// </summary>
|
||||
public static bool GetAllItems()
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
return Internal.GetAllItems( ref sresult );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all items and return the InventoryResult
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> GetAllItemsAsync()
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
|
||||
if ( !Internal.GetAllItems( ref sresult ) )
|
||||
return null;
|
||||
|
||||
return await InventoryResult.GetAsync( sresult );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used to grant a specific item to the user. This should
|
||||
/// only be used for development prototyping, from a trusted server,
|
||||
/// or if you don't care about hacked clients granting arbitrary items.
|
||||
/// This call can be disabled by a setting on Steamworks.
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> GenerateItemAsync( InventoryDef target, int amount )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
|
||||
var defs = new InventoryDefId[] { target.Id };
|
||||
var cnts = new uint[] { (uint)amount };
|
||||
|
||||
if ( !Internal.GenerateItems( ref sresult, defs, cnts, 1 ) )
|
||||
return null;
|
||||
|
||||
return await InventoryResult.GetAsync( sresult );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crafting! Uses the passed items to buy the target item.
|
||||
/// You need to have set up the appropriate exchange rules in your item
|
||||
/// definitions. This assumes all the items passed in aren't stacked.
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> CraftItemAsync( InventoryItem[] list, InventoryDef target )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
|
||||
var give = new InventoryDefId[] { target.Id };
|
||||
var givec = new uint[] { 1 };
|
||||
|
||||
var sell = list.Select( x => x.Id ).ToArray();
|
||||
var sellc = list.Select( x => (uint)1 ).ToArray();
|
||||
|
||||
if ( !Internal.ExchangeItems( ref sresult, give, givec, 1, sell, sellc, (uint)sell.Length ) )
|
||||
return null;
|
||||
|
||||
return await InventoryResult.GetAsync( sresult );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crafting! Uses the passed items to buy the target item.
|
||||
/// You need to have set up the appropriate exchange rules in your item
|
||||
/// definitions. This assumes all the items passed in aren't stacked.
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> CraftItemAsync( InventoryItem.Amount[] list, InventoryDef target )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
|
||||
var give = new InventoryDefId[] { target.Id };
|
||||
var givec = new uint[] { 1 };
|
||||
|
||||
var sell = list.Select( x => x.Item.Id ).ToArray();
|
||||
var sellc = list.Select( x => (uint) x.Quantity ).ToArray();
|
||||
|
||||
if ( !Internal.ExchangeItems( ref sresult, give, givec, 1, sell, sellc, (uint)sell.Length ) )
|
||||
return null;
|
||||
|
||||
return await InventoryResult.GetAsync( sresult );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a result set and verifies the signature bytes.
|
||||
/// This call has a potential soft-failure mode where the Result is expired, it will
|
||||
/// still succeed in this mode.The "expired"
|
||||
/// result could indicate that the data may be out of date - not just due to timed
|
||||
/// expiration( one hour ), but also because one of the items in the result set may
|
||||
/// have been traded or consumed since the result set was generated.You could compare
|
||||
/// the timestamp from GetResultTimestamp to ISteamUtils::GetServerRealTime to determine
|
||||
/// how old the data is. You could simply ignore the "expired" result code and
|
||||
/// continue as normal, or you could request the player with expired data to send
|
||||
/// an updated result set.
|
||||
/// You should call CheckResultSteamID on the result handle when it completes to verify
|
||||
/// that a remote player is not pretending to have a different user's inventory.
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> DeserializeAsync( byte[] data, int dataLength = -1 )
|
||||
{
|
||||
if ( data == null )
|
||||
throw new ArgumentException( "data should not be null" );
|
||||
|
||||
if ( dataLength == -1 )
|
||||
dataLength = data.Length;
|
||||
|
||||
var ptr = Marshal.AllocHGlobal( dataLength );
|
||||
|
||||
try
|
||||
{
|
||||
Marshal.Copy( data, 0, ptr, dataLength );
|
||||
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
|
||||
if ( !Internal.DeserializeResult( ref sresult, (IntPtr)ptr, (uint)dataLength, false ) )
|
||||
return null;
|
||||
|
||||
|
||||
|
||||
return await InventoryResult.GetAsync( sresult.Value );
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeHGlobal( ptr );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Grant all promotional items the user is eligible for
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> GrantPromoItemsAsync()
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
|
||||
if ( !Internal.GrantPromoItems( ref sresult ) )
|
||||
return null;
|
||||
|
||||
return await InventoryResult.GetAsync( sresult );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Trigger an item drop for this user. This is for timed drops.
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> TriggerItemDropAsync( InventoryDefId id )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
|
||||
if ( !Internal.TriggerItemDrop( ref sresult, id ) )
|
||||
return null;
|
||||
|
||||
return await InventoryResult.GetAsync( sresult );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a promo item drop. You can call this at startup, it won't
|
||||
/// give users multiple promo drops.
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> AddPromoItemAsync( InventoryDefId id )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
|
||||
if ( !Internal.AddPromoItem( ref sresult, id ) )
|
||||
return null;
|
||||
|
||||
return await InventoryResult.GetAsync( sresult );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start buying a cart load of items. This will return a positive result is the purchase has
|
||||
/// begun. You should listen out for SteamUser.OnMicroTxnAuthorizationResponse for a success.
|
||||
/// </summary>
|
||||
public static async Task<InventoryPurchaseResult?> StartPurchaseAsync( InventoryDef[] items )
|
||||
{
|
||||
var item_i = items.Select( x => x._id ).ToArray();
|
||||
var item_q = items.Select( x => (uint)1 ).ToArray();
|
||||
|
||||
var r = await Internal.StartPurchase( item_i, item_q, (uint)item_i.Length );
|
||||
if ( !r.HasValue ) return null;
|
||||
|
||||
return new InventoryPurchaseResult
|
||||
{
|
||||
Result = r.Value.Result,
|
||||
OrderID = r.Value.OrderID,
|
||||
TransID = r.Value.TransID
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user